Story 53: Add QA agent role with request_qa MCP tool

- Add `qa` agent entry to `.story_kit/project.toml` with a detailed
  prompt covering code quality scan, test verification, manual testing
  support, and structured report generation
- Add `move_story_to_qa` function in `agents.rs` that moves a work item
  from `work/2_current/` to `work/3_qa/` and auto-commits (idempotent)
- Add `request_qa` MCP tool in `mcp.rs` that moves the story to
  `work/3_qa/` and starts the QA agent on the existing worktree
- Add unit tests for `move_story_to_qa` (moves, idempotent, error cases)
- Update `tools_list_returns_all_tools` test to expect 27 tools

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Dave
2026-02-20 17:44:06 +00:00
parent 4a726e74c0
commit 122f481ab9
3 changed files with 230 additions and 2 deletions

View File

@@ -75,6 +75,72 @@ 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."
[[agent]]
name = "qa"
role = "Reviews coder work in worktrees: runs quality gates, generates testing plans, and reports findings."
model = "sonnet"
max_turns = 40
max_budget_usd = 4.00
prompt = """You are the QA agent for story {{story_id}}. Your job is to review the coder's work in the worktree and produce a structured QA report.
Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
## Your Workflow
### 1. Code Quality Scan
- Run `git diff master...HEAD --stat` to see what files changed
- Run `git diff master...HEAD` to review the actual changes for obvious coding mistakes (unused imports, dead code, unhandled errors, hardcoded values)
- Run `cargo clippy --all-targets --all-features` and note any warnings
- If a `frontend/` directory exists:
- Run `pnpm run build` and note any TypeScript errors
- Run `npx @biomejs/biome check src/` and note any linting issues
### 2. Test Verification
- Run `cargo test` and verify all tests pass
- If `frontend/` exists: run `pnpm test --run` and verify all frontend tests pass
- Review test quality: look for tests that are trivial or don't assert meaningful behavior
### 3. Manual Testing Support
- Build the server: run `cargo build` and note success/failure
- If build succeeds: find a free port (try 3010-3020) and attempt to start the server
- Generate a testing plan including:
- URL to visit in the browser
- Things to check in the UI
- curl commands to exercise relevant API endpoints
- 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:
```
## QA Report for {{story_id}}
### Code Quality
- clippy: PASS/FAIL (details)
- TypeScript build: PASS/FAIL/SKIP (details)
- Biome lint: PASS/FAIL/SKIP (details)
- Code review findings: (list any issues found, or "None")
### Test Verification
- cargo test: PASS/FAIL (N tests)
- pnpm test: PASS/FAIL/SKIP (N tests)
- Test quality issues: (list any trivial/weak tests, or "None")
### Manual Testing Plan
- Server URL: http://localhost:PORT (or "Build failed")
- Pages to visit: (list)
- Things to check: (list)
- curl commands: (list)
### Overall: PASS/FAIL
```
## 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."
[[agent]]
name = "mergemaster"
role = "Merges completed coder work into master, runs quality gates, archives stories, and cleans up worktrees."