Skip to content

Instantly share code, notes, and snippets.

@leogodin217
Created February 14, 2026 13:03
Show Gist options
  • Select an option

  • Save leogodin217/eb9944803e544cf9fc90c366d54a25ef to your computer and use it in GitHub Desktop.

Select an option

Save leogodin217/eb9944803e544cf9fc90c366d54a25ef to your computer and use it in GitHub Desktop.
implement-sprint.md
# Implement Sprint
Automated sprint implementation. Runs all phases without stopping, presents results for approval.
## Prerequisites
- Sprint spec exists at `docs/sprints/current/spec.md`
- Sprint state at `docs/sprints/current/state.yaml`
- Contracts are fully defined (no ambiguity)
- Clean git state (commit or stash any work first)
## Automation Model
```
/implement-sprint
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ AUTOMATED (no human intervention) β”‚
β”‚ β”‚
β”‚ For each phase: β”‚
β”‚ 1. Implement (implementer agent) β”‚
β”‚ 2. Run pre-commit β”‚
β”‚ 3. Run tests β”‚
β”‚ 4. Review (reviewer agent) β”‚
β”‚ 5. Run demo β”‚
β”‚ 6. Analyze data (if applicable) β”‚
β”‚ 7. Commit phase β”‚
β”‚ β”‚
β”‚ After all phases: β”‚
β”‚ 8. Run review-sprint β”‚
β”‚ 9. Run all demos twice β”‚
β”‚ 10. Run completion checks β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ PRESENT TO USER β”‚
β”‚ β”‚
β”‚ - Summary of what was built β”‚
β”‚ - Test results + coverage β”‚
β”‚ - Review report (issues found) β”‚
β”‚ - Demo output samples (both runs) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
↓
User Decision
↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ACCEPT β”‚ FIX β”‚ RESET β”‚
β”‚ β”‚ β”‚ β”‚
β”‚ Keep β”‚ Address β”‚ git reset to β”‚
β”‚ commits β”‚ issues, β”‚ pre-sprint HEAD β”‚
β”‚ β”‚ amend/fix β”‚ Try again β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```
**Key principle:** Commit after each phase for clean git history. Reset reverts all phase commits if needed.
## Process Details
### Phase Implementation (Automated)
For each phase in the sprint:
#### Step 1: Implement
Use the **implementer** agent to write:
- Implementation code matching contracts exactly
- Tests for the phase
- Demo script
**Critical:** Follows Principle #7 (no defaults) and Principle #8 (no scaffolding) strictly.
#### Step 2: Pre-commit
```bash
pre-commit run --all-files
```
**If pre-commit fails:** Fix issues and re-run. Do not proceed until passing.
#### Step 3: Tests
```bash
# Tests with coverage
python -m pytest --cov=src/fabulexa --cov-fail-under=85
# Package installs
uv pip install -e .
```
**If tests fail:** Stop automation, report failure to user.
#### Step 4: Review
Use the **reviewer** agent to check:
- Contract compliance
- Principle #7 violations (zero tolerance)
- Principle #8 violations (no scaffolding)
- Anti-pattern detection
- Dead code (loops with pass, unused variables)
Reviewer loads minimal context (fresh eyes protocol).
**If revisions needed:** Implementer fixes, re-run gates, re-review. Limit: 3 attempts per phase.
#### Step 5: Run Demo
```bash
python docs/sprints/current/demos/phase_N_*.py
```
Demo must:
- Run without errors
- Print clear success message
- Exit with code 0
#### Step 6: Analyze Data (If Applicable)
If the demo produces simulation output, use the **data-analyst** agent to verify:
- Realistic distributions
- Appropriate inequality patterns
- No anomalies
#### Step 7: Commit Phase
Update state.yaml to show status
```bash
git add -A
git commit -m "$(cat <<'EOF'
Sprint [Name] - Phase N: [Title]
- [What this phase implemented]
- Tests: PASS
- Pre-commit: PASS
πŸ€– Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
```
Commit message should be concise and describe what the phase delivered.
### Post-Implementation (Automated)
After all phases complete:
#### Step 8: Review Sprint
Run `/review-sprint` for comprehensive fresh-eyes audit:
- Dead code scan
- Test name audit
- Coverage analysis (100% on new files)
- Spec-implementation comparison
- Workspace check
#### Step 9: Run All Demos Twice
Run every demo script twice to verify determinism and consistency:
```bash
# First run
for demo in docs/sprints/current/demos/phase_*.py; do
python "$demo"
done
# Second run
for demo in docs/sprints/current/demos/phase_*.py; do
python "$demo"
done
```
Both runs must produce consistent output. Flag any differences.
#### Step 10: Completion Checks
```bash
# Final pre-commit (catch any drift)
pre-commit run --all-files
# Workspace hygiene
git status --porcelain | grep "^??"
# Scaffolding patterns
grep -rn "# Future:" src/
grep -rn "pass$" src/
```
### Present to User
Show:
1. **Summary:** What was built, files changed, lines added
2. **Tests:** Pass/fail count, coverage percentage
3. **Review report:** Issues found (blocking and non-blocking)
4. **Demos:** Sample output proving it works
### User Decision
#### ACCEPT β†’ Keep Commits
Commits are already made per-phase. Just update state.yaml and archive sprint.
#### FIX β†’ Address Issues
If review found issues worth fixing:
1. Fix the specific issues
2. Run pre-commit
3. Commit the fix (amend last phase commit if appropriate)
4. Re-run review-sprint
5. Present again
#### RESET β†’ Try Again
If the sprint is too messy to salvage, reset to pre-sprint state:
```bash
# Find the commit before sprint started
git log --oneline -10
# Reset to pre-sprint commit
git reset --hard <pre-sprint-commit>
git clean -fd
```
Then run `/implement-sprint` again. Different RNG consumption may produce cleaner results.
**When to reset vs fix:**
- Few isolated issues β†’ Fix
- Systemic problems β†’ Reset
- "This feels wrong" β†’ Reset (trust your gut)
## Agent Summary
| Agent | Role | When |
|-------|------|------|
| **implementer** | Write code, tests, demos | Each phase |
| **reviewer** | Check quality, find issues | After each phase |
| **data-analyst** | Verify output realism | After demos with output |
## Quality Gate Reference
| Gate | Command | Pass Criteria |
|------|---------|---------------|
| Pre-commit | `pre-commit run --all-files` | All hooks pass |
| Tests | `python -m pytest --cov=src/fabulexa` | β‰₯85% coverage, all pass |
| Package | `uv pip install -e .` | Installs cleanly |
| Demo | `python docs/sprints/current/demos/phase_N_*.py` | Exit 0 |
## Failure Modes
**Gate fails:**
- Report which gate, what error
- User decides: fix or reset
**Reviewer rejects 3 times:**
- Report the persistent issue
- User decides: fix manually or reset
**Demo crashes:**
- Report stack trace
- User decides: fix or reset
**Data analyst finds anomalies:**
- Report findings with data samples
- User decides: acceptable or not
## Tips
**For clean runs:**
- Ensure spec is unambiguous before starting
- Use a dedicated branch for risky sprints
- Keep sprints small (easier to reset)
**If you keep resetting:**
- The spec may be flawed (ambiguous, contradictory)
- Consider running `/plan-sprint` again
- Or manually implement the tricky part first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment