Story 44: Agent Completion Report via MCP
- report_completion MCP tool for agents to signal done - Rejects if worktree has uncommitted changes - Runs acceptance gates (clippy, tests) automatically - Stores completion status on agent record - 10 new tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,7 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process (S
|
||||
## 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
|
||||
- wait_for_agent(story_id, agent_name, timeout_ms) - Block until the agent reaches a terminal state (completed/failed). Returns final status including completion report with gates_passed.
|
||||
- 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
|
||||
@@ -34,19 +35,18 @@ You have these tools via the story-kit MCP server:
|
||||
2. Read the story file from .story_kit/stories/ to understand requirements
|
||||
3. Move it to current/ if it is in upcoming/
|
||||
4. Start coder-1 on the story: call start_agent with story_id="{{story_id}}" and agent_name="coder-1"
|
||||
5. Monitor progress: call get_agent_output every 30-60 seconds to check on the agent
|
||||
6. If the agent completes, review the worktree changes
|
||||
7. If the agent gets stuck or fails, stop it and start a fresh agent
|
||||
8. When the work looks complete, call ensure_acceptance to verify all gates pass
|
||||
9. STOP here. Do NOT accept the story or merge to master. Report the status to the human for final review and acceptance.
|
||||
5. Wait for completion: call wait_for_agent with story_id="{{story_id}}" and agent_name="coder-1". The coder will call report_completion when done, which runs acceptance gates automatically. wait_for_agent returns when the coder reports completion.
|
||||
6. Check the result: inspect the "completion" field in the wait_for_agent response — if gates_passed is true, the work is done; if false, review the gate_output and decide whether to start a fresh coder.
|
||||
7. If the agent gets stuck or fails without calling report_completion, stop it and start a fresh agent.
|
||||
8. STOP here. Do NOT accept the story or merge to master. Report the status to the human for final review and acceptance.
|
||||
|
||||
## 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
|
||||
- Never accept stories or merge to master - that is the human's job
|
||||
- Your job ends when ensure_acceptance passes and you have reported the result"""
|
||||
system_prompt = "You are a supervisor agent. Read CLAUDE.md and .story_kit/README.md first to understand the project dev process. Use MCP tools to coordinate sub-agents. Never implement code directly - always delegate to coder agents and monitor their progress. Never accept stories or merge to master - get all gates green and report to the human."
|
||||
- Your job ends when the coder's completion report shows gates_passed=true and you have reported the result"""
|
||||
system_prompt = "You are a supervisor agent. Read CLAUDE.md and .story_kit/README.md first to understand the project dev process. Use MCP tools to coordinate sub-agents. Never implement code directly - always delegate to coder agents and monitor their progress. Use wait_for_agent to block until the coder calls report_completion (which runs acceptance gates automatically). Never accept stories or merge to master - get all gates green and report to the human."
|
||||
|
||||
[[agent]]
|
||||
name = "coder-1"
|
||||
@@ -54,8 +54,8 @@ role = "Full-stack engineer. Implements features across all components."
|
||||
model = "sonnet"
|
||||
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 through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD"
|
||||
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. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story."
|
||||
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 through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: When all your work is committed, call report_completion as your FINAL action: report_completion(story_id='{{story_id}}', agent_name='{{agent_name}}', summary='<brief summary of what you implemented>'). The server will run cargo clippy and tests automatically to verify your work."
|
||||
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. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. ALWAYS call report_completion as your absolute final action after committing."
|
||||
|
||||
[[agent]]
|
||||
name = "coder-2"
|
||||
@@ -63,8 +63,8 @@ role = "Full-stack engineer. Implements features across all components."
|
||||
model = "sonnet"
|
||||
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 through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD"
|
||||
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. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story."
|
||||
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 through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: When all your work is committed, call report_completion as your FINAL action: report_completion(story_id='{{story_id}}', agent_name='{{agent_name}}', summary='<brief summary of what you implemented>'). The server will run cargo clippy and tests automatically to verify your work."
|
||||
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. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. ALWAYS call report_completion as your absolute final action after committing."
|
||||
|
||||
[[agent]]
|
||||
name = "coder-3"
|
||||
@@ -72,5 +72,5 @@ role = "Full-stack engineer. Implements features across all components."
|
||||
model = "sonnet"
|
||||
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 through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD"
|
||||
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. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story."
|
||||
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 through implementation and verification (Steps 1-3). The worktree and feature branch already exist - do not create them. Check .mcp.json for MCP tools. Do NOT accept the story or merge - commit your work and stop. If the user asks to review your changes, tell them to run: cd \"{{worktree_path}}\" && git difftool {{base_branch}}...HEAD\n\nIMPORTANT: When all your work is committed, call report_completion as your FINAL action: report_completion(story_id='{{story_id}}', agent_name='{{agent_name}}', summary='<brief summary of what you implemented>'). The server will run cargo clippy and tests automatically to verify your work."
|
||||
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. Commit all your work before finishing - use a descriptive commit message. Do not accept stories, move them to archived, or merge to master - a human will do that. Do not coordinate with other agents - focus on your assigned story. ALWAYS call report_completion as your absolute final action after committing."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
name: Agent Completion Report via MCP
|
||||
test_plan: pending
|
||||
test_plan: approved
|
||||
---
|
||||
|
||||
# Story 44: Agent Completion Report via MCP
|
||||
@@ -12,11 +12,29 @@ As an agent finishing work on a story, I want to report my completion status via
|
||||
## Acceptance Criteria
|
||||
|
||||
- [ ] MCP tool report_completion(story_id, agent_name, summary) allows agents to signal they are done
|
||||
- [ ] Server auto-commits all changes in the worktree (git add -A && git commit) with a deterministic message before running gates — agents do NOT need to commit themselves
|
||||
- [ ] Server rejects the report if the agent's worktree has uncommitted changes
|
||||
- [ ] Server runs acceptance gates (clippy, tests) automatically on report
|
||||
- [ ] Completion status and results are stored on the agent record for retrieval by wait_for_agent or the supervisor
|
||||
- [ ] Agent prompts are updated to call report_completion as their final action
|
||||
|
||||
## Test Plan
|
||||
|
||||
### Unit Tests (agents.rs)
|
||||
- `report_completion_rejects_nonexistent_agent` — calling on a non-existent agent returns Err
|
||||
- `report_completion_rejects_non_running_agent` — calling on an already-Completed agent returns Err
|
||||
- `report_completion_rejects_dirty_worktree` — calling with uncommitted changes returns Err containing "uncommitted"
|
||||
- `report_completion_stores_result_and_transitions_status` — with a clean real git worktree, completes and stores a CompletionReport
|
||||
|
||||
### Unit Tests (mcp.rs)
|
||||
- `report_completion_in_tools_list` — tool appears in handle_tools_list output
|
||||
- `report_completion_tool_missing_story_id` — returns Err mentioning "story_id"
|
||||
- `report_completion_tool_missing_agent_name` — returns Err mentioning "agent_name"
|
||||
- `report_completion_tool_missing_summary` — returns Err mentioning "summary"
|
||||
- `report_completion_tool_nonexistent_agent` — isError response for unknown agent
|
||||
- `wait_for_agent_includes_completion_field` — wait_for_agent JSON output has "completion" key
|
||||
|
||||
## Out of Scope
|
||||
|
||||
- TBD
|
||||
- Frontend UI for displaying completion reports
|
||||
- Persisting completion reports to disk across server restarts
|
||||
- Running biome/frontend checks in the acceptance gates (Rust only for now)
|
||||
|
||||
Reference in New Issue
Block a user