Add this markdown doc to your /commands folder per these instructions:
CoreStory + Claude Code Agentic Bug Resolution Playbook
# CoreStory + Claude Fix Bug Slash Command
Activate the CoreStory-powered bug resolution workflow.
**Usage:**
/fix-bug #6992 /fix-bug JIRA-1234 /fix-bug "Users can't login after password reset"
**What this does:**
Automatically executes the complete six-phase bug resolution workflow using CoreStory’s code intelligence:
1. **Bug Intake**: Fetches ticket details (if ID provided) and creates CoreStory investigation conversation
2. **Oracle Phase**: Queries CoreStory to understand intended system behavior, invariants, and architecture
3. **Navigator Phase**: Gets precise file/line-level guidance on where to investigate
4. **TDD Investigation**: Writes failing test FIRST, then identifies root cause
5. **Solution Development**: Implements minimal fix, validates with CoreStory, adds edge case tests
6. **Completion**: Creates detailed commit, updates ticket, preserves investigation for future reference
**Prerequisites:**
- CoreStory MCP server configured
- At least one CoreStory project with completed ingestion
- (Optional) Ticketing system MCP for automatic ticket fetching
**Expected outcome:**
- Bug resolved with comprehensive test coverage
- No regressions introduced
- Detailed commit message explaining root cause and fix rationale
- CoreStory conversation preserved as institutional knowledge
**Time estimate:** 15-60 minutes depending on bug complexity
**Advanced usage:**
For security-sensitive bugs:
/fix-bug #1234 --security-check
For performance bugs:
/fix-bug #1234 --performance
For related bug clusters:
/fix-bug #1234 #1235 #1236 --cluster
---
## What to expect
### Phase 1: Bug Intake (2-5 min)
- Fetches ticket or extracts bug description
- Selects CoreStory project
- Creates investigation conversation
### Phase 2: Oracle Phase (5-10 min)
- Queries system architecture
- Identifies invariants and business rules
- Gathers historical context
### Phase 3: Navigator Phase (3-5 min)
- Maps symptoms to code paths
- Generates root cause hypotheses
- Gets precise file/method navigation
### Phase 4: TDD Investigation (8-15 min)
- Writes failing test
- Validates test with CoreStory
- Reads code (guided by hypotheses)
- Identifies exact bug location
### Phase 5: Solution Development (10-20 min)
- Implements minimal fix
- Verifies test passes
- Adds edge case tests
- Runs full test suite
### Phase 6: Completion (3-5 min)
- Creates detailed commit
- Updates ticket
- Renames CoreStory conversation
- Reports metrics
---
## Tips
**For best results:**
- Provide complete reproduction steps if describing bug directly
- If asking about a ticket, use the exact ticket ID format (e.g., #6992, JIRA-1234)
- Let the agent complete all phases - don’t interrupt the workflow
- Review the CoreStory conversation afterward to learn the codebase patterns
**Common questions:**
*“Can I just fix it without the full workflow?”*
Yes, just describe what you want to fix without using /fix-bug. This command is for systematic investigation when you want comprehensive understanding and quality.
*“What if I know where the bug is?”*
You can still use /fix-bug and the agent will validate your hypothesis against system architecture and ensure comprehensive testing.
*“How do I see the investigation conversation?”*
The agent will provide the CoreStory conversation ID. You can reference it later for similar bugs.