story-kit: start 70_story_server_owned_agent_completion_remove_report_completion_dependency

This commit is contained in:
Dave
2026-02-23 15:14:01 +00:00
6 changed files with 379 additions and 154 deletions

View File

@@ -35,9 +35,9 @@ You have these tools via the story-kit MCP server:
2. Read the story file from .story_kit/work/ to understand requirements
3. Move it to work/2_current/ if it is in work/1_upcoming/
4. Start coder-1 on the story: call start_agent with story_id="{{story_id}}" and agent_name="coder-1"
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.
5. Wait for completion: call wait_for_agent with story_id="{{story_id}}" and agent_name="coder-1". The server automatically runs acceptance gates (cargo clippy + tests) when the coder process exits. wait_for_agent returns when the coder reaches a terminal state.
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.
7. If the agent gets stuck, 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
@@ -46,7 +46,7 @@ You have these tools via the story-kit MCP server:
- Focus on coordination, monitoring, and quality review
- Never accept stories or merge to master - that is the human's job
- 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."
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 finishes — the server automatically runs acceptance gates when the agent process exits. 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/work/ - move it to work/2_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."
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/work/ - move it to work/2_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: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results."
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. The server automatically runs acceptance gates when your process exits."
[[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/work/ - move it to work/2_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."
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/work/ - move it to work/2_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: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results."
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. The server automatically runs acceptance gates when your process exits."
[[agent]]
name = "coder-3"
@@ -72,8 +72,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/work/ - move it to work/2_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."
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/work/ - move it to work/2_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: Commit all your work before your process exits. The server will automatically run acceptance gates (cargo clippy + tests) when your process exits and advance the pipeline based on the results."
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. The server automatically runs acceptance gates when your process exits."
[[agent]]
name = "qa"
@@ -110,7 +110,7 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
- Kill the test server when done: `pkill -f story-kit-server || true`
### 4. Produce Structured Report
Call report_completion as your FINAL action with a summary in this format:
Print your QA report to stdout before your process exits. The server will automatically run acceptance gates. Use this format:
```
## QA Report for {{story_id}}
@@ -138,8 +138,8 @@ Call report_completion as your FINAL action with a summary in this format:
## Rules
- Do NOT modify any code — read-only review only
- If the server fails to start, still provide the testing plan with curl commands
- Call report_completion as your FINAL action"""
system_prompt = "You are a QA agent. Your job is read-only: review code quality, run tests, try to start the server, and produce a structured QA report. Do not modify code. Call report_completion as your final action."
- The server automatically runs acceptance gates when your process exits"""
system_prompt = "You are a QA agent. Your job is read-only: review code quality, run tests, try to start the server, and produce a structured QA report. Do not modify code. The server automatically runs acceptance gates when your process exits."
[[agent]]
name = "mergemaster"
@@ -162,5 +162,5 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
- Do NOT implement code yourself
- Do NOT resolve complex conflicts yourself - report them clearly
- Your job is to trigger the merge pipeline and report results
- Call report_completion as your final action with a summary of what happened"""
- The server automatically runs acceptance gates when your process exits"""
system_prompt = "You are the mergemaster agent. Your sole responsibility is to trigger the merge_agent_work MCP tool and report the results. Do not write code. Do not resolve conflicts manually. Report success or failure clearly so the human can act."

View File

@@ -0,0 +1,27 @@
---
name: Server-owned agent completion: remove report_completion dependency
test_plan: approved
---
# Story 70: Server-owned agent completion: remove report_completion dependency
## User Story
As a developer using story-kit, I want the server to automatically run acceptance
gates and advance the pipeline when an agent process exits, so that the pipeline
does not stall when an agent forgets or fails to call `report_completion`.
## Acceptance Criteria
- [ ] When an agent process exits normally, the server automatically runs acceptance gates (uncommitted changes check + cargo clippy + tests)
- [ ] When acceptance gates pass on natural process exit, the agent status is set to `Completed` and the pipeline advances
- [ ] When acceptance gates fail on natural process exit, the agent status is set to `Failed` and the pipeline handles the failure appropriately
- [ ] `report_completion` is removed from the MCP tools list (agents no longer see or call it)
- [ ] The default agent prompt no longer instructs agents to call `report_completion`
- [ ] If a completion was already recorded before the process exits (legacy path), the server does not run gates a second time
## Out of Scope
- Removing the concept of a `CompletionReport` struct (still used internally)
- Changing the pipeline advancement logic itself
- Frontend changes

View File

@@ -0,0 +1,42 @@
---
name: "Work item creation does not quote YAML special characters or include front matter"
test_plan: pending
---
# Bug 72: Work item creation does not quote YAML special characters or include front matter
## Description
Two related issues in server-side work item creation:
1. **create_story** writes the `name` value into YAML front matter without quoting. If the name contains YAML-special characters like colons, the resulting front matter is invalid YAML and fails to parse.
2. **create_bug** does not write YAML front matter at all (no `---` block with `name` and `test_plan`). The UI/parser expects front matter on all work items in the pipeline, so bug files show parse errors.
## How to Reproduce
### Issue 1 (create_story)
1. Call create_story with a name containing a colon, e.g. "Server-owned agent completion: remove report_completion dependency"
2. Open the generated .md file
3. Observe the front matter parser rejects it: "mapping values are not allowed in this context"
### Issue 2 (create_bug)
1. Call create_bug with any name
2. Open the generated .md file
3. Observe there is no YAML front matter block — just a markdown heading
## Actual Result
- create_story: Invalid front matter when name contains colons
- create_bug: No front matter at all
## Expected Result
- All work item creation methods should write valid YAML front matter with quoted `name` values
- create_bug should include `---` front matter block with `name` and `test_plan` fields, consistent with create_story
## Acceptance Criteria
- [ ] create_story quotes name values containing YAML-special characters
- [ ] create_bug writes YAML front matter with name and test_plan fields
- [ ] Existing tests updated to cover special character handling