Skip to content

feat: autonomous agent with brain priority queue, heartbeat, and triggers#1

Merged
amaotone merged 4 commits into
mainfrom
feat/autonomous-agent
Mar 4, 2026
Merged

feat: autonomous agent with brain priority queue, heartbeat, and triggers#1
amaotone merged 4 commits into
mainfrom
feat/autonomous-agent

Conversation

@amaotone

@amaotone amaotone commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Brain priority queue: User messages automatically preempt lower-priority tasks (heartbeat, triggers), ensuring responsive chat while autonomous tasks run in the background
  • Autonomous heartbeat: Periodically checks HEARTBEAT.md in the workspace and acts on pending items; stays silent when nothing to do
  • Event triggers: Time-based triggers (morning, evening, weekly reflection) that fire prompts automatically
  • MCP refactoring: Improved context handling and Discord/scheduler tool integration
  • Scheduler improvements: Better schedule handling and parsing
  • README: Updated architecture documentation and feature descriptions

Test plan

  • Verify brain correctly prioritizes USER tasks over EVENT and HEARTBEAT
  • Test heartbeat reads and processes HEARTBEAT.md items
  • Test event triggers fire at configured times
  • Verify MCP tools work for Discord operations (send messages, read history)
  • Verify scheduler handles one-time and recurring schedules
  • Run bun run check and bun run typecheck
  • Run bun run test
  • Docker build and runtime test with docker compose up thor -d --build

🤖 Generated with Claude Code

amaotone and others added 4 commits March 4, 2026 15:04
Replace persistent Claude Code process with Agent SDK query-based architecture.

- Add Brain layer (brain.ts, heartbeat.ts, triggers.ts) for agent orchestration
- Add MCP server with Discord and schedule tools for autonomous operations
- Add SdkRunner using @anthropic-ai/claude-agent-sdk query() API
- Remove legacy modules: claude-code, persistent-runner, runner-manager,
  feedback-loop, response-parser, skills, sessions, discord-commands
- Consolidate message splitting (remove chunkDiscordMessage, enhance splitMessage)
- Simplify discord-send to schedule-only, remove chunked reply/message helpers
- Remove !discord and !schedule text commands (replaced by MCP tools)
- Rename files to reflect new architecture:
  base-runner → system-prompt, discord-types → channel-utils,
  scheduler-bridge → scheduler-discord, message-handler → agent-response,
  discord-send → schedule-send
- Rename identifiers: handleSettingsFromResponse → handleSystemCommand,
  SdkRunnerOptions → RunnerOptions, handleMessage → routeMessage
- Clean up dead code: unused constants, formatSettings, circuit breaker

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Replace hardcoded JST offset with Intl API-based dynamic timezone
resolution using the TIMEZONE constant. This correctly handles
DST transitions and non-JST timezone configurations.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Reflect current module structure after Agent SDK migration:
Brain, MCP, SdkRunner layers and updated data flow descriptions.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Implement the autonomous agent system with priority-based task scheduling:
- Brain: priority queue that preempts lower-priority tasks when user messages arrive
- Heartbeat: periodically checks HEARTBEAT.md and acts on pending items
- Triggers: time-based event triggers (morning, evening, weekly reflection)
- MCP: refactor context and tools for Discord/scheduler integration
- Discord: update agent response streaming and message routing
- Scheduler: improve schedule handling and parsing
- README: document new architecture and features

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@amaotone
amaotone merged commit dad10d8 into main Mar 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant