---
name: Mergemaster Agent Role
---

# Story 52: Mergemaster Agent Role

## User Story

As a developer, I want a dedicated mergemaster agent that handles the full accept→merge→archive→cleanup pipeline, so that merging coder work to master is deterministic and doesn't require manual conflict resolution.

## Acceptance Criteria

- [ ] New `mergemaster` agent role in `.story_kit/project.toml`
- [ ] Mergemaster can cherry-pick or rebase a worktree branch onto master
- [ ] Mergemaster resolves merge conflicts (or reports them clearly if it can't)
- [ ] Mergemaster runs all quality gates after merge (cargo test, cargo clippy, pnpm test, pnpm build)
- [ ] Mergemaster moves the story/bug from `work/4_merge/` to `work/5_archived/` and auto-commits
- [ ] Mergemaster cleans up the worktree and branch after successful merge
- [ ] MCP tool `merge_agent_work(agent_name, story_id)` triggers the mergemaster pipeline
- [ ] Mergemaster reports success/failure with details (conflicts found, tests passed/failed)

## Out of Scope

- Automated conflict resolution using AI (can follow later — start with simple cherry-pick/rebase)
- Running mergemaster as a persistent daemon
