---
name: Deterministic Bug Lifecycle Management
---

# Story 49: Deterministic Bug Lifecycle Management

## User Story

As a developer running autonomous agents, I want all bug file mutations to happen through server MCP/REST tools that auto-commit to master, so that the bug tracker is always consistent, always committed, and agents never edit bug files directly.

## Acceptance Criteria

- [ ] New MCP tool `create_bug(name, description, steps_to_reproduce, actual_result, expected_result, acceptance_criteria)` creates a bug file in `.story_kit/bugs/` with a deterministic filename and auto-commits to master
- [ ] Bug file template includes sections: Description, How to Reproduce, Actual Result, Expected Result, Acceptance Criteria
- [ ] New MCP tool `list_bugs()` returns all open bugs (files in `.story_kit/bugs/` excluding `archive/`)
- [ ] New MCP tool `close_bug(bug_id)` moves a bug from `.story_kit/bugs/` to `.story_kit/bugs/archive/` and auto-commits to master
- [ ] `start_agent` supports bug IDs (e.g. `bug-5-description`) — no move needed since bugs don't have upcoming/current
- [ ] All auto-commits use deterministic commit messages (e.g. "huskies: create bug bug-6-fix-foo", "huskies: close bug bug-5")
- [ ] Agents never need to edit bug markdown files directly — all mutations go through server tools

## Out of Scope

- Bug severity/priority fields (can be a follow-up)
- Linking bugs to stories
