Spike 3: Sub-agent infrastructure fixes for multi-agent coordination
- Fix CLAUDECODE env var blocking nested Claude Code sessions - Add drain-based event_log for reliable get_agent_output polling - Add non-SSE get_agent_output fallback (critical for MCP tool calls) - Preserve worktrees on agent stop instead of destroying work - Reap zombie processes with child.wait() after kill - Increase broadcast buffer from 256 to 1024 - Engineer supervisor and coder prompts in project.toml - Point .mcp.json to test port 3002 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,34 +7,55 @@ teardown = []
|
||||
[[component]]
|
||||
name = "server"
|
||||
path = "."
|
||||
setup = ["cargo check"]
|
||||
setup = ["mkdir -p frontend/dist", "cargo check"]
|
||||
teardown = []
|
||||
|
||||
[[agent]]
|
||||
name = "supervisor"
|
||||
role = "Coordinates work, reviews PRs, decomposes stories."
|
||||
model = "opus"
|
||||
max_turns = 50
|
||||
max_budget_usd = 10.00
|
||||
system_prompt = "You are a senior engineering lead. Coordinate the work, review code, and ensure quality."
|
||||
max_turns = 200
|
||||
max_budget_usd = 15.00
|
||||
prompt = """You are the supervisor for story {{story_id}}. Your job is to coordinate coder agents to implement this story.
|
||||
|
||||
## Your MCP Tools
|
||||
You have these tools via the story-kit MCP server:
|
||||
- start_agent(story_id, agent_name) - Start a coder agent on a story
|
||||
- get_agent_output(story_id, agent_name, timeout_ms) - Poll agent output (returns recent events, call repeatedly)
|
||||
- list_agents() - See all running agents and their status
|
||||
- stop_agent(story_id, agent_name) - Stop a running agent
|
||||
- get_story_todos(story_id) - Get unchecked acceptance criteria for a story in current/
|
||||
- ensure_acceptance(story_id) - Check if a story passes acceptance gates
|
||||
|
||||
## Your Workflow
|
||||
1. Read the story file from .story_kit/stories/ to understand requirements
|
||||
2. Move it to current/ if it is in upcoming/
|
||||
3. Start coder-1 on the story: call start_agent with story_id="{{story_id}}" and agent_name="coder-1"
|
||||
4. Monitor progress: call get_agent_output every 30-60 seconds to check on the agent
|
||||
5. If the agent completes, review the worktree changes
|
||||
6. If the agent gets stuck or fails, stop it and start a fresh agent
|
||||
7. When the work looks complete, call ensure_acceptance to verify
|
||||
|
||||
## Rules
|
||||
- Do NOT implement code yourself - delegate to coder agents
|
||||
- Only run one coder at a time per story
|
||||
- Focus on coordination, monitoring, and quality review"""
|
||||
system_prompt = "You are a supervisor agent. Use MCP tools to coordinate sub-agents. Never implement code directly - always delegate to coder agents and monitor their progress."
|
||||
|
||||
[[agent]]
|
||||
name = "coder-1"
|
||||
role = "Full-stack engineer. Implements features across all components."
|
||||
model = "sonnet"
|
||||
max_turns = 30
|
||||
max_turns = 50
|
||||
max_budget_usd = 5.00
|
||||
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. Pick up the story from .story_kit/stories/ - move it to current/ if needed. Follow the SDTW process end-to-end. The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools."
|
||||
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Do not coordinate with other agents - focus on your assigned story."
|
||||
|
||||
[[agent]]
|
||||
name = "coder-2"
|
||||
role = "Full-stack engineer. Implements features across all components."
|
||||
model = "sonnet"
|
||||
max_turns = 30
|
||||
max_turns = 50
|
||||
max_budget_usd = 5.00
|
||||
|
||||
[[agent]]
|
||||
name = "reviewer"
|
||||
role = "Reviews code changes, runs tests, checks quality gates."
|
||||
model = "sonnet"
|
||||
max_turns = 20
|
||||
max_budget_usd = 3.00
|
||||
prompt = "You are working in a git worktree on story {{story_id}}. Read CLAUDE.md first, then .story_kit/README.md to understand the dev process. Pick up the story from .story_kit/stories/ - move it to current/ if needed. Follow the SDTW process end-to-end. The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools."
|
||||
system_prompt = "You are a full-stack engineer working autonomously in a git worktree. Follow the Story-Driven Test Workflow strictly. Run cargo clippy and biome checks before considering work complete. Do not coordinate with other agents - focus on your assigned story."
|
||||
|
||||
Reference in New Issue
Block a user