@ikunin/sprintpilot 2.2.30 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +232 -413
  2. package/_Sprintpilot/Sprintpilot.md +76 -6
  3. package/_Sprintpilot/bin/autopilot.js +752 -66
  4. package/_Sprintpilot/lib/orchestrator/action-ledger.js +208 -0
  5. package/_Sprintpilot/lib/orchestrator/adapt.js +93 -15
  6. package/_Sprintpilot/lib/orchestrator/profile-rules.js +7 -16
  7. package/_Sprintpilot/lib/orchestrator/sprint-plan.js +488 -0
  8. package/_Sprintpilot/lib/orchestrator/state-store.js +9 -5
  9. package/_Sprintpilot/lib/orchestrator/user-command-applier.js +107 -0
  10. package/_Sprintpilot/lib/orchestrator/user-commands.js +124 -1
  11. package/_Sprintpilot/lib/orchestrator/verify.js +10 -17
  12. package/_Sprintpilot/manifest.yaml +4 -1
  13. package/_Sprintpilot/modules/autopilot/profiles/_base.yaml +18 -4
  14. package/_Sprintpilot/modules/git/config.yaml +15 -9
  15. package/_Sprintpilot/modules/ma/config.yaml +29 -27
  16. package/_Sprintpilot/scripts/dispatch-layer.js +12 -15
  17. package/_Sprintpilot/scripts/infer-dependencies.js +706 -254
  18. package/_Sprintpilot/scripts/log-timing.js +6 -10
  19. package/_Sprintpilot/scripts/merge-shards.js +21 -23
  20. package/_Sprintpilot/scripts/post-green-gates.js +3 -1
  21. package/_Sprintpilot/scripts/resolve-dag.js +452 -280
  22. package/_Sprintpilot/scripts/sprint-plan.js +1068 -0
  23. package/_Sprintpilot/scripts/state-shard.js +13 -5
  24. package/_Sprintpilot/scripts/summarize-timings.js +2 -3
  25. package/_Sprintpilot/skills/sprint-autopilot-on/SKILL.md +30 -2
  26. package/_Sprintpilot/skills/sprint-autopilot-on/workflow.orchestrator.md +36 -10
  27. package/_Sprintpilot/skills/sprintpilot-dependency-graph/SKILL.md +63 -0
  28. package/_Sprintpilot/skills/sprintpilot-dependency-graph/workflow.md +227 -0
  29. package/_Sprintpilot/skills/sprintpilot-plan-sprint/SKILL.md +67 -0
  30. package/_Sprintpilot/skills/sprintpilot-plan-sprint/workflow.md +435 -0
  31. package/_Sprintpilot/skills/sprintpilot-sprint-progress/SKILL.md +53 -0
  32. package/_Sprintpilot/skills/sprintpilot-sprint-progress/workflow.md +169 -0
  33. package/lib/commands/install.js +186 -10
  34. package/package.json +1 -1
package/README.md CHANGED
@@ -5,18 +5,23 @@
5
5
  [![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=flat)](LICENSE)
6
6
  [![BMad Method](https://img.shields.io/badge/BMad%20Method-v6.2%2B-green.svg?style=flat)](https://github.com/bmad-code-org/BMAD-METHOD)
7
7
  [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg?style=flat)](https://nodejs.org)
8
- [![Tools](https://img.shields.io/badge/tools-9%20supported-orange.svg?style=flat)](#tools-9-supported)
9
- [![GitHub stars](https://img.shields.io/github/stars/ikunin/sprintpilot.svg?style=flat)](https://github.com/ikunin/sprintpilot/stargazers)
8
+ [![Tools](https://img.shields.io/badge/tools-9%20supported-orange.svg?style=flat)](#compatibility)
10
9
 
11
- Sprintpilot drives [BMad Method](https://github.com/bmad-code-org/BMAD-METHOD) v6 sprints to completion autonomously. One command turns your sprint plan into reviewed, tested, PR-ready code — story by story, with full git workflow and multi-agent intelligence.
10
+ Sprintpilot drives [BMad Method](https://github.com/bmad-code-org/BMAD-METHOD) v6 sprints to completion autonomously. One slash command turns your sprint plan into reviewed, tested, PR-ready code — story by story, with full git workflow.
12
11
 
13
- BMad Method's manual flow is dozens of skills, menus, and git operations per story. Sprintpilot drives all of it for you — one command per sprint.
12
+ > **Independent project.** Sprintpilot is not affiliated with or endorsed by BMad Code, LLC. See [TRADEMARK.md](TRADEMARK.md).
13
+ > Migrating from `bmad-autopilot-addon` v1? See [MIGRATION.md](MIGRATION.md).
14
14
 
15
- Flow control is owned by a deterministic Node.js state machine (`_Sprintpilot/bin/autopilot.js`) that enforces the BMad 7-step sequence. The LLM keeps in-skill execution, diagnosis, triage, and small-judgment decisions; the orchestrator owns sequencing and BMad-step enforcement. BMad skills are invoked verbatim — Sprintpilot never invents workflows or templates of its own.
15
+ ## What it does
16
16
 
17
- > **Independent project.** Sprintpilot is not affiliated with or endorsed by BMad Code, LLC. See [TRADEMARK.md](TRADEMARK.md).
18
- >
19
- > **Migrating from `bmad-autopilot-addon` v1?** See [MIGRATION.md](MIGRATION.md). `sprintpilot install` auto-detects v1 and cleanly replaces it.
17
+ Per story, in one autonomous loop:
18
+
19
+ - Creates an isolated worktree + branch, runs `bmad-dev-story` TDD-style (RED then GREEN), lints changed files only.
20
+ - Stages explicitly (never `git add -A`), commits with a conventional message, runs **three parallel reviewers** on the diff.
21
+ - Auto-applies every PATCH finding as a separate commit, pushes, opens a PR (or merges directly, or lands as you go — your choice).
22
+ - Moves to the next story. At end-of-epic, writes a retrospective and lists PRs ready to merge.
23
+
24
+ The orchestrator (`_Sprintpilot/bin/autopilot.js`) is a deterministic Node state machine. It decides what runs next and enforces BMad's 7-step cycle. The LLM owns in-skill execution and small-judgment decisions. BMad skills are invoked verbatim — Sprintpilot never invents workflows of its own.
20
25
 
21
26
  ## Quick Start
22
27
 
@@ -27,11 +32,13 @@ npx bmad-method install --modules bmm,tea
27
32
  # 2. Install Sprintpilot (interactive — pick tool + complexity profile)
28
33
  npx @ikunin/sprintpilot@latest
29
34
 
30
- # 3. In your IDE, run:
35
+ # 3. In your IDE chat:
31
36
  /sprint-autopilot-on
32
37
  ```
33
38
 
34
- **Start at a specific story or epic** (v2.2.0+):
39
+ **What you'll see next.** The orchestrator emits one BMad skill at a time and the LLM executes it. First skill is `bmad-create-story` for the next pending story in `sprint-status.yaml`. You'll watch RED→GREEN tests, a 3-reviewer review pass, patch commits, and a push or PR. The autopilot drives until `session_story_limit` stories are done (default 3), then halts cleanly. Re-run `/sprint-autopilot-on` to continue.
40
+
41
+ **Start at a specific story or epic:**
35
42
 
36
43
  ```
37
44
  /sprint-autopilot-on epic 4
@@ -40,526 +47,338 @@ npx @ikunin/sprintpilot@latest
40
47
  /sprint-autopilot-on voice identity matcher
41
48
  ```
42
49
 
43
- The skill resolves the natural-language directive against your `sprint-status.yaml` and queues the matching stories. The autopilot runs them in order, then falls back to the normal next-pending-story flow. Ambiguous matches surface a candidate list — never picks arbitrarily.
50
+ The skill resolves the natural-language directive against `sprint-status.yaml` and queues the matching stories. Ambiguous matches surface a candidate list — never picks arbitrarily.
44
51
 
45
- Non-interactive install:
52
+ **Non-interactive install:**
46
53
 
47
54
  ```bash
48
55
  npx @ikunin/sprintpilot@latest install --tools claude-code --profile medium --yes
49
56
  ```
50
57
 
51
- Runs on Windows, macOS, and Linux — every workflow call site is portable across bash, zsh, Git Bash, PowerShell, and cmd.
52
-
53
- ## What It Does, Story by Story
54
-
55
- When you run `/sprint-autopilot-on`, the autopilot drives your entire sprint to completion:
58
+ Runs on Windows, macOS, and Linux.
56
59
 
57
- 1. **Reads your sprint plan** — picks the next story from `sprint-status.yaml`
58
- 2. **Creates an isolated worktree** — each story gets its own branch via `git worktree add`, keeping `main` clean
59
- 3. **Implements the story** — invokes `bmad-dev-story`, which writes code and tests following TDD (RED then GREEN)
60
- 4. **Lints the code** — auto-detects your language and runs the right linter on changed files only (not the whole repo)
61
- 5. **Stages explicitly** — never `git add -A`. Only changed files, with secrets / size / binary pre-commit checks.
62
- 6. **Commits with conventional messages** — `feat(epic): story title (story-key)`, placeholders resolved from your sprint artifacts
63
- 7. **Runs parallel code review** — three reviewers in parallel (see [Multi-Agent Intelligence](#multi-agent-intelligence))
64
- 8. **Applies every patch finding** — auto-accepts review fixes, commits each one separately for clean history
65
- 9. **Pushes and creates a PR** (configurable) — auto-detects GitHub / GitLab / Bitbucket / Gitea. With `create_pr: false`, merges directly to `main`.
66
- 10. **Moves to the next story** — exits the worktree, commits artifacts to `main`, picks up the next story
67
- 11. **Runs retrospective** per epic — when all stories in an epic are done, lists all PR URLs ready for merge
60
+ ## Choose your workflow
68
61
 
69
- ## What Makes It Autonomous
62
+ One config decision shapes how code reaches `main`. Pick once at install (or edit `_Sprintpilot/modules/git/config.yaml` later):
70
63
 
71
- The autopilot handles everything that normally requires you to be present:
64
+ | Mode | When to use | One PR per | Code reaches `main` |
65
+ |---|---|---|---|
66
+ | **Stacked PRs** *(default)* | Team workflow where every story needs review before it lands | story | After human PR approval & merge |
67
+ | **Land-as-you-go** | Solo / fast-iteration sprint, no end-of-sprint merge marathon | story | Right after each story (CI / review gated) |
68
+ | **Direct merge** | Prototype, tutorial, internal tool without CI | — *(no PR opened)* | Right after each story's push |
69
+ | **Reuse your branch** | Feature-branch workflow where you already have the branch | sprint | After human PR approval & merge |
72
70
 
73
- - **Deterministic state machine** `_Sprintpilot/bin/autopilot.js` emits typed Actions (`invoke_skill`, `run_script`, `git_op`, `parallel_batch`, `user_prompt`, `halt`) and consumes typed Signals (`success`, `failure`, `blocked`, `propose_alternative`, `user_input`, `verify_override`). The LLM executes one BMad skill at a time per action — it doesn't pick the next step.
74
- - **BMad bookkeeping enforced** — `verify.js` checks more than artifact existence: acceptance-criteria bullets exist, `[ ]` task boxes are flipped to `[x]`, `commit_sha` + `branch` are reported, and `git_steps_completed: true` only after every step in the orchestrator's inlined git plan (including `git push`) exits 0. Skipping any of these produces a `verify_rejected` ledger entry and the orchestrator re-emits the same action.
75
- - **Decision audit channel** — small judgment calls (architecture, test-strategy, dependency, review-triage, scope, workaround) attach as `decisions[]` on any signal. The orchestrator stamps id + timestamp + story and appends to `decision-log.yaml` — no separate skill round-trip required.
76
- - **LLM-as-peer protocol** — when the orchestrator emits an action the LLM disagrees with, it can return a `propose_alternative` signal carrying a full alternative Action + reason; the orchestrator decides whether to route. When `verify.js` rejects a `success` signal the LLM knows is correct (e.g., a test file was renamed per a logged decision), the LLM can return `verify_override` with `evidence.expected_paths` + `decision_log_ref` and verification re-runs with augmented expectations. The state machine owns sequencing; the LLM owns judgment.
77
- - **Auto-inferred story DAG** — after `bmad-sprint-planning`, the autopilot infers inter-story dependencies once and writes `_Sprintpilot/sprints/dependencies.yaml`. Parallel dispatch works out of the box; no hand-authored deps file required. Hand-authored sidecars are detected and respected silently.
78
- - **Menu navigation** — BMad skills present menus and confirmations. The autopilot auto-selects "Continue" / "Create Mode" and derives answers from your PRD and architecture docs.
79
- - **Session management** — checkpoints state every N stories, halts with a markdown handoff report, and resumes exactly where it left off in the next session — with fingerprint-based divergence detection if anything moved in between. See [Sessions and the Handoff Report](#sessions-and-the-handoff-report).
80
- - **Crash recovery** — on boot, the autopilot detects orphaned worktrees from a crashed previous run, pushes any committed-but-unpushed work, and cleans up stale state. No lost commits, no manual cleanup.
71
+ All modes use isolated worktrees (`.worktrees/<story-key>/`) so `main` never has half-finished story code. ASCII diagrams of each mode are in [Git workflow](#git-workflow-detailed) below.
81
72
 
82
- ### When it stops (and only when)
73
+ ## Choose your profile
83
74
 
84
- The autopilot runs until the sprint is done or hits one of exactly 5 true blockers:
75
+ The right amount of process for a 2-story bugfix is different from a 30-story rebuild. One knob picks the balance:
85
76
 
86
- 1. A skill needs **original creative input** not in any project document (e.g., product vision for a PRD)
87
- 2. A **new external dependency** is needed that isn't in the project
88
- 3. **3 consecutive test failures** with no forward progress
89
- 4. A **security vulnerability** requiring architectural decisions beyond the story scope
90
- 5. **Conflicting acceptance criteria** that can't be resolved from project docs
91
-
92
- Everything else — it decides, documents the decision in one sentence, and moves on.
93
-
94
- ## The Git Workflow
95
-
96
- Controlled by knobs in `_Sprintpilot/modules/git/config.yaml`. The orchestrator inlines every git op as an argv sequence (`git add`, `git commit`, `git push`, …) into the emitted action — the LLM executes the steps verbatim, never improvises. Concurrent git operations (parallel pushes, submodule updates, ref locks) are serialized and retry with jittered backoff — safe under parallel dispatch.
97
-
98
- ### Pick a mode
99
-
100
- | Mode | Knobs | One PR per | Code reaches `main` | Best for |
77
+ | Profile | Per-story flow | Branching | Parallel | Use it for |
101
78
  |---|---|---|---|---|
102
- | **Stacked PRs** *(default)* | `merge_strategy: stacked` | story (or epic, on nano) | After human PR approval & merge | Team workflows where every story needs review before it lands |
103
- | **Land-as-you-go** | `merge_strategy: land_as_you_go` + `land_when` | story | Right after each story (CI/review gated) | Solo / fast-iteration sprints where waiting for stack approval is the bottleneck |
104
- | **Direct merge** | `push.create_pr: false` | *(no PR opened)* | Right after each story's push | Prototypes, hobby projects, internal tools without CI |
105
- | **Reuse your branch** | `reuse_user_branch: true` | sprint (one PR for all stories) | After human PR approval & merge | Feature-branch workflows where you already have the branch you want |
106
-
107
- All modes use isolated worktrees (`.worktrees/<story-key>/`) so `main` never has half-finished story code. The autopilot tracks git metadata in its own `git-status.yaml` — it never modifies BMad Method's `sprint-status.yaml`. After each story's push, the orchestrator syncs `_bmad-output/` planning and bookkeeping artifacts onto the base branch, so `git log <base>` is the canonical sprint audit trail regardless of merge strategy.
108
-
109
- ### Stacked PRs (default)
110
-
111
- Stories are pushed and PRs are created. No auto-merge. Each story branches from the previous story's branch and targets it. Reviewers see each story's diff in isolation while the next story is already in progress. When a PR is merged on the platform, subsequent PRs automatically retarget.
112
-
113
- ```
114
- main ─────────────────────────────────────────────────────────
115
- │ (artifacts only)
116
- ├── story/1-1 ──→ push + PR #42 (→ main)
117
- │ │
118
- │ └── story/1-2 ──→ push + PR #43 (→ story/1-1)
119
- │ │
120
- │ └── story/1-3 ──→ push + PR #44 (→ story/1-2)
121
-
122
- Epic 1 complete → retrospective
123
- → "Ready to merge: PR #42, #43, #44"
124
- ```
79
+ | `nano` | `bmad-quick-dev` (one-shot) | one PR per epic | n/a | Tiny patch sprints, hot-fix runs |
80
+ | `small` | Full 7-step BMad cycle | one PR per story | off | Single-developer projects, 10 stories |
81
+ | `medium` *(default)* | Full 7-step BMad cycle | one PR per story | off | Most sprints balanced |
82
+ | `large` | Full 7-step BMad cycle | one PR per story | **on** (Claude Code) | Multi-epic sprints, 20+ stories |
83
+ | `legacy` | Pinned legacy behavior | one PR per story | off | Existing installs that want zero change |
125
84
 
126
- Trade-off: zero waiting for review during the sprint, but you end up with a stack to merge afterward.
85
+ Pick at install: `--profile <name>`. Missing profile defaults to `medium`.
127
86
 
128
- ### Land-as-you-go
87
+ **Nano safety net:** if `bmad-quick-dev` tests fail or its review classifies a finding as `high` severity, the autopilot escalates that session to the full 7-step cycle (session-scoped, never written back to config).
129
88
 
130
- After every `STORY_DONE`, the orchestrator runs a new `STORY_LAND` state to merge that story's PR immediately instead of letting the stack grow. Each subsequent story branches from the already-merged base, so there is no stack to unwind at sprint-end.
89
+ ## Running a session
131
90
 
132
- ```
133
- main ── story/1-1 ──→ PR #42 ──→ ✓ CI / review ──→ merge ──→
134
- │ ╲
135
- ├── story/1-2 ──→ PR #43 ──→ ✓ CI / review ──→ merge ──→ ╲
136
- │ ╲
137
- └── story/1-3 ──→ PR #44 ──→ ✓ CI / review ──→ merge ──→ done
138
- ```
91
+ The autopilot scans the host chat for your interjections every turn — you can steer it without learning a command vocabulary:
139
92
 
140
- | Knob | Default | What it does |
141
- |---|---|---|
142
- | `land_when` | `ci_pass` | `no_wait` = merge synchronously, no CI wait. `ci_pass` = wait for `gh pr checks` (or platform equivalent) to report all checks green. `ci_and_review` = also wait for an `approved` PR review. |
143
- | `land_wait_minutes` | `30` | Max wait for CI / review before the orchestrator halts and prompts you. |
93
+ - *"skip this story, the spec is wrong"* → `skip_story`
94
+ - *"close out epic 4 with retro, the remaining stories are deferred"* → `trigger_retrospective`
95
+ - *"pause"* `pause` (halts cleanly; resume with `/sprint-autopilot-on`)
96
+ - *"continue, the diff is fine"* `force_continue` (accept a `verify_rejected` or `resume_divergence`)
144
97
 
145
- **Rebase recovery.** If `main` moves while the story is in flight, the orchestrator runs `git rebase origin/<base>` and re-pushes. On rebase conflicts it halts with a `user_prompt`; resume reads `state.land_pending` and retries the land step after you resolve.
98
+ The LLM maps your phrasing to the right command + arguments and emits a `user_input` signal. Full command vocabulary in [docs/USAGE.md](docs/USAGE.md#user-commands).
146
99
 
147
- Trade-off: cleaner history and no end-of-sprint merge marathon, but each story blocks on CI before the next one starts — slower wall-clock if your CI is slow or you set `ci_and_review`.
100
+ ### When it halts
148
101
 
149
- ### Direct merge (no PR)
150
-
151
- Stories are merged straight into the base branch after push — no PR opened, no human review gate.
152
-
153
- ```
154
- main ── story/1-1 ──→ merge ── story/1-2 ──→ merge ── story/1-3 ──→ merge
155
- ```
102
+ The autopilot drives until one of these conditions is true:
156
103
 
157
- Use only when you genuinely don't want PRs (prototypes, tutorials, dev branches where you'll squash later). No CI gate, no review gate, no rebase recovery.
104
+ 1. **`session_story_limit` reached** (default 3, nano 5) checkpoints state, prints the handoff report, releases the lock. Re-run `/sprint-autopilot-on` to continue.
105
+ 2. **Sprint complete** — runs end-of-sprint cleanup, prints the final report. Done.
106
+ 3. **One of the 5 true blockers** — `creative_user_input_required`, `new_external_dependency`, `security_architectural_decision`, `contradictory_acceptance_criteria`, or 3 consecutive test failures with no forward progress. Halts with a `user_prompt`. Answer it and resume.
107
+ 4. **Retry budget exhausted on a single phase** — halts with the underlying issue surfaced. Inspect, fix, resume.
108
+ 5. **You explicitly pause** — `/pause` or any natural-language pause instruction.
158
109
 
159
- ### Reuse your own branch
110
+ Everything else the autopilot decides, logs the decision in one sentence to `decision-log.yaml`, and moves on.
160
111
 
161
- You create the branch yourself, then run the autopilot. It detects the current non-base branch on boot and commits **every** story directly onto it. No `story/*` or `epic/*` branches are created. One PR opens against `base_branch` at sprint-end.
162
-
163
- ```
164
- main ─────────────────────────────────────────────────
165
-
166
- └── feature/payments-rewrite (your branch, you created it)
167
- ├── feat(1): story 1-1 ─→ commit
168
- ├── feat(1): story 1-2 ─→ commit
169
- ├── feat(2): story 2-1 ─→ commit
170
- └── … ─→ push + PR (→ main, at sprint-end)
171
- ```
172
-
173
- Useful for feature-branch workflows where you already have the branch you want to work on, or when you want a single end-of-sprint review.
174
-
175
- ### Branch naming
176
-
177
- Branches created by the autopilot use the `branch_prefix` knob (default `story/`):
178
-
179
- - Story granularity (default, all profiles except nano): `<branch_prefix><story-key>` → `story/1-3-add-auth`
180
- - Epic granularity (nano profile): `<branch_prefix>epic-<epic-id>` → `story/epic-1`
181
- - Reuse mode: no autopilot branches; your existing branch is used as-is.
182
-
183
- The `_bmad-output/` sync after each story uses the argv sequence `git switch <base> → git checkout <branch> -- _bmad-output → git commit --allow-empty → git push origin <base> → git switch <branch>` — the orchestrator inlines those steps; the LLM runs them verbatim.
184
-
185
- ### Pre-commit safety
186
-
187
- Before every commit the orchestrator runs deterministic checks against the staged files. None of these require LLM cooperation — they're enforced by Node.js scripts:
188
-
189
- | Check | What it does |
190
- |---|---|
191
- | **Explicit staging** | Files are staged by name (`git add -- file1 file2`) — never `git add -A`, `git add .`, or `git add -u`. The set of staged files is cross-referenced against the story's `## File List`; unexpected or missing files are warned. |
192
- | **Secrets scan** | Greps staged content for `API_KEY`, `SECRET`, `TOKEN`, `PASSWORD`, `aws_access`, `private_key`. WARN severity by default — surfaced in the log but does not block the commit. Allowlist patterns live in `.secrets-allowlist`. |
193
- | **File size** | Rejects files larger than `staging.max_file_size_mb` (default `1`). |
194
- | **Binary detection** | Warns on binary files detected via `file --mime-encoding`. |
195
- | **Gitignore check** | Verifies `.gitignore` covers `.autopilot.lock` and `.claude/.sprintpilot-backups/`. |
196
-
197
- For each story, every commit (the main story commit + each code-review patch commit) runs the full check chain.
198
-
199
- See [`modules/git/branching-and-pr-strategy.md`](_Sprintpilot/modules/git/branching-and-pr-strategy.md) for the full decision matrix.
200
-
201
- ## Sessions and the Handoff Report
112
+ ## Configuration
202
113
 
203
- A sprint usually doesn't fit in one LLM session. Long contexts rot — the model starts dropping steps, forgetting decisions, and skipping cleanup. Sprintpilot pre-empts this by checkpointing every N stories, halting cleanly, and resuming exactly where it left off in a fresh session.
114
+ ### By use case
204
115
 
205
- ### When the autopilot halts
116
+ Most projects only ever change a handful of settings. Pick the change you want, edit the listed key:
206
117
 
207
- | Trigger | What happens | How you resume |
208
- |---|---|---|
209
- | `session_story_limit` reached *(default 3, nano: 5)* | Orchestrator writes state + ledger, prints the report, releases the lock | Run `/sprint-autopilot-on` again — picks up at the next story |
210
- | `sprint_finalize_pending` *(last story done)* | Orchestrator stops **before** cleanup — keeps that for a fresh context | Run `/sprint-autopilot-on` once more; finalize runs deterministically |
211
- | Sprint complete | State + ledger files deleted; final report printed | Nothing to resume — the sprint is done |
212
- | One of the 5 [true blockers](#when-it-stops-and-only-when) | Orchestrator halts with `user_prompt` | Answer the prompt, then `/sprint-autopilot-on` |
213
- | Verify-reject budget exhausted | Orchestrator halts with the verifier's issues | Inspect, fix the underlying problem, then resume |
118
+ **I want each story to land on `main` as soon as it's reviewed**
119
+ → `git.merge_strategy: land_as_you_go` (file: `_Sprintpilot/modules/git/config.yaml`)
120
+ Optional: `git.land_when: ci_pass | ci_and_review | no_wait`
214
121
 
215
- In every case, the same handoff report is emitted so you (and the next session) know exactly where things stand.
122
+ **I want every story reviewed before it lands**
123
+ → Keep the default `git.merge_strategy: stacked`
216
124
 
217
- ### The handoff report
125
+ **I'm working on my own feature branch and want one PR at sprint-end**
126
+ → `git.reuse_user_branch: true`
218
127
 
219
- Generated by `_Sprintpilot/lib/orchestrator/report.js` from the persisted state and the append-only `ledger.jsonl`. It's printed automatically whenever the autopilot halts at a session boundary, and you can re-print it on demand:
128
+ **I don't want PRs merge directly to base**
129
+ → `git.push.create_pr: false`
220
130
 
221
- ```bash
222
- node _Sprintpilot/bin/autopilot.js report
223
- ```
131
+ **I want lint failures to halt the sprint until fixed**
132
+ `git.lint.enabled: true` + `git.lint.blocking: true` (file: `_Sprintpilot/modules/git/config.yaml`)
133
+ → Lint runs `scripts/post-green-gates.js` after `dev_green` verify passes.
224
134
 
225
- The report is a single markdown block with five sections:
135
+ **My sprint is a hotfix or 1-2 small changes**
136
+ → `complexity_profile: nano` (file: `_Sprintpilot/modules/autopilot/config.yaml`)
226
137
 
227
- ```markdown
228
- # Autopilot Session Report
138
+ **My sprint is 20+ stories**
139
+ `complexity_profile: large` — enables parallel story dispatch on Claude Code
229
140
 
230
- **Current story:** 1-3-add-auth
231
- **Current phase:** PATCH_RETEST
232
- **Sprint complete:** false
233
- **Last updated:** 2026-05-15T10:42:18.041Z
141
+ **I want the autopilot to run more (or fewer) stories before checkpointing**
142
+ `autopilot.session_story_limit: <N>` — `0` is unlimited
234
143
 
235
- ## Ledger summary
236
- - action_emitted: 47
237
- - signal_recorded: 47
238
- - decisions_appended: 12
239
- - halt: 1
144
+ **I want to inspect worktrees after epic merge instead of auto-cleaning**
145
+ `git.worktree.cleanup_on_merge: false`
240
146
 
241
- ## Last 10 actions
242
- - [2026-05-15T10:41:50Z] DEV_GREEN → invoke_skill bmad-dev-story
243
- - [2026-05-15T10:42:01Z] CODE_REVIEW → invoke_skill bmad-code-review
244
- - [2026-05-15T10:42:14Z] PATCH_APPLY → run_script post-green-gates.js
245
- - …
147
+ ### Reference table
246
148
 
247
- ## Recent decisions (3)
248
- - [2026-05-15T10:38Z] story=1-3-add-auth phase=dev-story:RED ids=d-117,d-118
249
- - [2026-05-15T10:40Z] story=1-3-add-auth phase=code-review ids=d-119
250
- -
149
+ | Setting | File | Default | What it controls |
150
+ |---|---|---|---|
151
+ | `complexity_profile` | `autopilot/config.yaml` | `medium` | Per-story flow + which optimization layers are enabled |
152
+ | `autopilot.session_story_limit` | `autopilot/config.yaml` | `3` (nano: `5`) | Stories per session before checkpoint. `0` = unlimited |
153
+ | `autopilot.retrospective_mode` | `autopilot/config.yaml` | `auto` | `auto` / `stop` / `skip` |
154
+ | `git.merge_strategy` | `git/config.yaml` | `stacked` | `stacked` / `land_as_you_go` |
155
+ | `git.push.create_pr` | `git/config.yaml` | `true` | `false` = direct merge to base |
156
+ | `git.reuse_user_branch` | `git/config.yaml` | `false` | Commit every story onto the current user branch |
157
+ | `git.land_when` | `git/config.yaml` | `ci_pass` | Land-as-you-go gating: `no_wait` / `ci_pass` / `ci_and_review` |
158
+ | `git.land_wait_minutes` | `git/config.yaml` | `30` | Max wait for CI / review before halting |
159
+ | `git.branch_prefix` | `git/config.yaml` | `story/` | Prefix for autopilot-created branches |
160
+ | `git.lint.enabled` | `git/config.yaml` | `false` | Run post-GREEN lint pipeline |
161
+ | `git.lint.blocking` | `git/config.yaml` | `false` | Lint failures reject verify (LLM fix-loops) |
162
+ | `git.lint.output_limit` | `git/config.yaml` | `100` | Lines of lint output injected back as context |
163
+ | `git.lint.linters.<lang>` | `git/config.yaml` | (auto-detect) | Per-language preference; `[]` disables; `javascript` + `typescript` merge into `js-ts` |
164
+ | `git.lock.stale_timeout_minutes` | `git/config.yaml` | `30` | `.autopilot.lock` older than this is auto-taken-over; `0` disables |
165
+ | `git.worktree.health_check_on_boot` | `git/config.yaml` | `true` | Halt on orphan worktrees at session start |
166
+ | `git.worktree.cleanup_on_merge` | `git/config.yaml` | `true` | Remove `.worktrees/<key>/` after epic merge |
167
+ | `ma.enabled` | `ma/config.yaml` | `true` | Enable parallel agent skills |
251
168
 
252
- ## Recent halts
253
- - [2026-05-15T10:42:18Z] phase=PATCH_RETEST reason=session_story_limit
169
+ **Profile-level overrides** — `parallel_stories`, `state_sharding`, `phase_timings`, `cache_shared_reads`, `conditional_boot_work` live in `_Sprintpilot/modules/autopilot/profiles/<profile>.yaml`. Their effective value depends on the active `complexity_profile`.
254
170
 
255
- ## Next action
171
+ Full reference: [docs/CONFIGURATION.md](docs/CONFIGURATION.md).
256
172
 
257
- Run `autopilot next` to emit the action for phase=PATCH_RETEST on profile=medium.
258
- ```
173
+ ## Sessions
259
174
 
260
- What each section is for:
175
+ A long sprint doesn't fit in one LLM context. The autopilot checkpoints every N stories, prints a handoff report, and resumes exactly where it left off in a fresh session.
261
176
 
262
- - **Header** current story, phase, sprint-complete flag, last write timestamp. Quick "where are we?" snapshot.
263
- - **Ledger summary** — counts of every kind of event in `ledger.jsonl`. Spikes in `halt` or `failure` indicate trouble.
264
- - **Last 10 actions** — the most recent `invoke_skill` / `run_script` / `git_op` actions with their phase. The trail of what just ran.
265
- - **Recent decisions** — small judgment calls the LLM attached as `decisions[]` (architecture / test-strategy / dependency / review-triage / scope / workaround). The audit trail of the LLM's work.
266
- - **Recent halts** — the last 3 reasons the autopilot stopped. Empty on a healthy session.
267
- - **Next action** — explicit hint of what running `/sprint-autopilot-on` (or `autopilot next`) will do next, including the `sprint_finalize_pending` special case.
177
+ **Resume divergence detection.** On the next `autopilot start`, the orchestrator fingerprints `_bmad-output/`, `sprint-status.yaml`, and branch HEADs against the fingerprint stamped at the last halt. Two escape paths proceed without manual surgery:
268
178
 
269
- ### Resuming with divergence detection
179
+ - **External-completion auto-acknowledge** when the persisted `current_story` is `done` in sprint-status (you merged it manually, hot-fix, UI action), the stale identity is cleared and the next pending story is picked.
180
+ - **`--accept-divergence` flag** — catch-all for divergence the auto-path doesn't cover.
270
181
 
271
- On the next `autopilot start`, the orchestrator fingerprints `_bmad-output/`, `sprint-status.yaml`, and per-story branch HEADs against the fingerprint recorded at the last halt. If anything moved between sessions (you edited a story file by hand, merged a PR on the platform, force-pushed a branch, …) the orchestrator surfaces it as a `resume_divergence` action with a diff of what changed:
182
+ **Crash recovery.** On every boot, the autopilot health-checks `.worktrees/`. Orphan worktrees from crashed sessions are detected and surfaced. Stale `.autopilot.lock` files (older than `stale_timeout_minutes`) are auto-taken-over.
272
183
 
273
- ```json
274
- {
275
- "type": "user_prompt",
276
- "prompt": "Resume divergence detected. Differences: branch story/1-2 HEAD moved (a1b2c3 → d4e5f6). Choose: force_continue | override_decision",
277
- "kind": "resume_divergence",
278
- "differences": { ... }
279
- }
280
- ```
184
+ **Fresh-context finalize.** When the last story hits `STORY_DONE`, the state machine transitions to `sprint_finalize_pending` instead of running cleanup in the same session. The next `/sprint-autopilot-on` reads the marker, runs deterministic cleanup with a clean context. One short extra session (~60–100 turns) for reliable end-of-sprint hygiene.
281
185
 
282
- You answer via a `user_input` signal (`force_continue` to accept and keep going, `override_decision` to reject with a reason) and the state machine resumes. Nothing is silently overwritten.
186
+ Full handoff report format + ledger semantics: [docs/USAGE.md](docs/USAGE.md#handoff-report).
283
187
 
284
- ### Steering the autopilot mid-session
285
-
286
- The autopilot isn't fire-and-forget. The orchestrator scans the host chat for user interjections every turn; if you say something while it's running, the LLM records it as a `user_input` signal and the state machine reacts on the next transition. Available commands (validated server-side by `user-commands.js` — malformed input is rejected with a clear message, never silently dropped):
188
+ ## Skills
287
189
 
288
190
  | Command | What it does |
289
191
  |---|---|
290
- | `force_continue` | Accept a `resume_divergence` or `verify_rejected` finding and keep going |
291
- | `override_decision` | Reject the orchestrator's last decision with a reason; entry appended to `decision-log.yaml` |
292
- | `skip_story` | Mark the current story as skipped (BMad-side sprint-status change) |
293
- | `halt` | Stop cleanly at the next safe checkpoint |
294
- | `inject_decision` | Append a free-form decision entry without changing flow |
295
-
296
- You don't have to learn these commands by name — phrase the intent naturally and the LLM maps your message to the right command + arguments before signalling.
297
-
298
- ### Crash recovery and orphaned worktrees
299
-
300
- If a session crashes — process killed, machine rebooted, hook failed mid-commit — the next `/sprint-autopilot-on` runs a health check on `.worktrees/` *before* any new state-machine work. Each worktree is classified and handled deterministically:
301
-
302
- | Classification | Condition | What happens |
303
- |---|---|---|
304
- | `COMMITTED` | Branch has commits beyond `base_branch` | Worktree is reactivated; committed-but-unpushed work is pushed + PR'd |
305
- | `CLEAN_DONE` | Story marked `done` in sprint-status, worktree clean | Worktree removed |
306
- | `STALE` | No commits beyond base; story not done | Work was lost; worktree removed |
307
- | `DIRTY` | Uncommitted changes | You're prompted: stash, commit, or discard |
308
- | `ORPHAN` | Worktree directory exists but branch was deleted | Worktree removed |
309
-
310
- Stale locks (`.autopilot.lock` older than 30 minutes) are also auto-removed at this stage, so a crashed session never blocks the next one indefinitely.
311
-
312
- ### Fresh-context finalize
313
-
314
- When the last story of the sprint hits `STORY_DONE`, the state machine transitions to `sprint_finalize_pending` — a terminal halt state — instead of running cleanup in the same session that just finished the last story. The next `/sprint-autopilot-on` reads the pending marker, jumps straight to the finalize state, and runs deterministic cleanup (mark-done-stories task checkboxes, worktree removal, artifact commits, retrospective, final report) with a clean context window.
315
-
316
- This trades one short extra session (~60–100 turns, usually under $2) for reliable end-of-sprint hygiene. Without it, the tail of a long session regularly drops cleanup actions because the context is already full of story implementation work.
317
-
318
- ## Adaptive Process Scaling
319
-
320
- The right amount of process for a 2-story bug-fix sprint is different from a 30-story green-field rebuild — running the heavy flow on a small change costs more LLM turns, more context rot, more time. One knob picks the right balance:
321
-
322
- | Profile | Per-story flow | Branching | Worktrees | Parallel stories | Use it for |
323
- |---------|---------------|-----------|-----------|------------------|-----------|
324
- | `nano` | `bmad-quick-dev` (one-shot) | `epic` (one PR per epic) | off | n/a | Tiny patch sprints, hot-fix runs |
325
- | `small` | Full 7-step BMad cycle | `story` (one PR per story) | on | off | Single-developer projects, ≤10 stories |
326
- | `medium` *(default)* | Full 7-step BMad cycle | `story` | on | off | Default — balanced for most sprints |
327
- | `large` | Full 7-step BMad cycle | `story` | on | **on** (Claude Code) | Multi-epic sprints, 20+ stories |
328
- | `legacy` | Pinned to v1.0.5 behavior byte-for-byte | `story` | on | off | Existing installs that want zero behavior change |
329
-
330
- Pick the profile at install time — `--profile <nano|small|medium|large|legacy>` non-interactively. Missing profile defaults to `medium` with no behavior change vs. v1.0.5.
331
-
332
- **Nano safety net** — if `bmad-quick-dev` tests fail or its review classifies a finding as `high` severity, the autopilot escalates the session to the full 7-step cycle (session-scoped — never written back to config). Fast track for routine work, full rigor when something needs it.
333
-
334
- ### v2 optimization layers
335
-
336
- Each can be disabled independently per profile in `_Sprintpilot/modules/autopilot/profiles/<profile>.yaml`:
337
-
338
- - **Auto-inferred story DAG** — see above.
339
- - **Phase timing instrumentation** — emits `duration` records per skill phase. `summarize-timings.js` reports hotspots over 5% of total runtime, so you can see where a sprint actually spends its time.
340
- - **State sharding** — non-critical writes accumulate in `.pending/` shards, flushed atomically at story boundaries / session checkpoints / sprint complete. Crash-recovery keys still write straight through. This is what makes parallel dispatch safe under contention.
341
- - **Conditional boot work** — on clean repos (main worktree only, no in-progress stories), skips the slow health-check / branch-reconciliation block, saving 8–30s per session. Disabled on `large` and `legacy` profiles, which always run full reconciliation.
342
- - **Cached reads** — TTL + source-mtime aware file cache for hot reads; any writer's mtime advance auto-invalidates without explicit calls.
343
- - **Parallel story dispatch** — when the host supports it, layer-aware dispatch runs N stories concurrently in their own worktrees, then merges their state shards. Claude Code today; Gemini CLI experimentally. See [Parallel Story Dispatch](#parallel-story-dispatch).
192
+ | `/sprint-autopilot-on` | Engage autonomous sprint execution |
193
+ | `/sprint-autopilot-off` | Disengage and show status |
194
+ | `/sprintpilot-update` | Check for updates and install the latest version |
195
+ | `/sprintpilot-code-review` | Parallel 3-layer adversarial code review |
196
+ | `/sprintpilot-codebase-map` | 5-stream brownfield codebase analysis |
197
+ | `/sprintpilot-assess` | Tech debt, dependency audit, migration assessment |
198
+ | `/sprintpilot-reverse-architect` | Extract architecture document from existing code |
199
+ | `/sprintpilot-migrate` | 12-step legacy migration planning |
200
+ | `/sprintpilot-research` | Parallel web research fan-out |
201
+ | `/sprintpilot-party-mode` | Multi-persona BMad agent discussions |
344
202
 
345
- ## Parallel Story Dispatch
203
+ Multi-agent skill internals: [docs/USAGE.md](docs/USAGE.md#multi-agent-skills).
346
204
 
347
- When the active profile allows parallelism (`large` by default; opt-in on `medium`), the host supports concurrent subagents (Claude Code today; Gemini CLI experimentally), and the inferred DAG has ≥ 2 independent stories in the next layer, the orchestrator runs them concurrently instead of one after another:
205
+ ## Compatibility
348
206
 
349
- 1. **Resolve the next layer** `resolve-dag.js layers --epic <id>` returns the next batch of stories with no unfinished prerequisites.
350
- 2. **Pre-create worktrees** — `dispatch-layer.js` creates one worktree per story and writes `.layer-plan.json` so each sub-agent knows its scope.
351
- 3. **Spawn N sub-agents in a single message** — each runs the full per-story flow (`bmad-create-story` → `bmad-dev-story` RED/GREEN → `bmad-code-review` → patches → commit/push/PR) inside its assigned worktree.
352
- 4. **Merge shards on return** — per-story state lives in `.autopilot-state/<story>.yaml` and `.decision-log/<story>.yaml` shards. `merge-shards.js --archive` collapses them into the project YAMLs atomically; the merged shards are archived under `.archive/layer-<id>/` for debugging.
353
- 5. **Loop to the next layer** — `parallel_batch` is a resolver in the state machine, not a one-shot. The orchestrator loops back to step 1 until the DAG is exhausted.
207
+ **Tools.** Sprintpilot uses the universal `SKILL.md` format same skills work everywhere:
354
208
 
355
- Per-story shards make this safe under contention: each sub-agent is the only writer of its shard, so concurrent YAML writes never corrupt each other. The coordinator (parent autopilot) is the only process that ever merges, and only at layer boundaries.
209
+ | Tool | Directory | Tool | Directory |
210
+ |---|---|---|---|
211
+ | Claude Code | `.claude/skills/` | Roo Code | `.roo/skills/` |
212
+ | Cursor | `.cursor/skills/` | Trae | `.trae/skills/` |
213
+ | Windsurf | `.windsurf/skills/` | Kiro | `.kiro/skills/` |
214
+ | Gemini CLI | `.gemini/skills/` | GitHub Copilot | `.github/copilot/skills/` |
215
+ | Cline | `.cline/skills/` | | |
356
216
 
357
- ### Steering the DAG
217
+ Non-interactive: `--tools <tool1>,<tool2>` (or `all`). Valid values: `claude-code`, `cursor`, `windsurf`, `gemini-cli`, `cline`, `roo`, `trae`, `kiro`, `github-copilot`.
358
218
 
359
- After `bmad-sprint-planning`, the autopilot writes `_Sprintpilot/sprints/dependencies.yaml` with one inferred edge set per epic. Each story entry has a one-sentence `rationale` — review them once before parallel dispatch begins, because over-serialization (a spurious dependency the LLM inferred) silently slows the sprint instead of breaking it.
219
+ **Git platforms.**
360
220
 
361
- If detection got something wrong, edit the `overrides:` block:
221
+ | Platform | CLI | Auto-detect | API fallback |
222
+ |---|---|---|---|
223
+ | GitHub | `gh` | `github.com` | No |
224
+ | GitLab | `glab` | `gitlab.*` | No |
225
+ | Bitbucket | `bb` | `bitbucket.org` | Yes (`BITBUCKET_TOKEN`) |
226
+ | Gitea | `tea` | Explicit config | Yes (`GITEA_TOKEN` + `base_url`) |
362
227
 
363
- ```yaml
364
- overrides:
365
- - epic: 2
366
- force_independent: ["2-1", "2-2"] # detection was over-cautious
367
- force_sequential: ["2-3", "2-4"] # detection missed a known conflict
368
- ```
228
+ No CLI installed? Falls back to **git_only mode** (direct merge, no PRs).
369
229
 
370
- The next planning cycle regenerates only the `stories:` block; `overrides:` and `epics:` are preserved verbatim. Hand-authored sidecars (no `# AUTO-INFERRED` marker) are detected and respected silently no inference runs on top of them.
230
+ **Linters** (auto-detected on changed files only). First found per language wins.
371
231
 
372
- ### Failure handling
232
+ | Language | Linters | Language | Linters |
233
+ |---|---|---|---|
234
+ | Python | ruff, flake8, pylint | Java | checkstyle, pmd |
235
+ | JavaScript / TS | eslint, biome | C / C++ | cppcheck, clang-tidy |
236
+ | Rust | cargo clippy | C# | dotnet format |
237
+ | Go | golangci-lint | Swift | swiftlint |
238
+ | Ruby | rubocop | PL/SQL | sqlfluff |
239
+ | Kotlin | ktlint, detekt | PHP | phpstan, phpcs |
373
240
 
374
- | Failure | Response |
375
- |---|---|
376
- | One parallel story's tests fail | That story is isolated; siblings in the layer continue; downstream stories that depend on the failed one are blocked; reported at layer boundary |
377
- | Merge conflict at layer boundary | Retry once after rebase; on second failure, abort that story and force sequential for the rest of the epic |
378
- | `max_consecutive_conflicts` reached *(default 2)* | Parallelism auto-disables for the rest of the session, logged to `decision-log.yaml` |
379
- | Worktree disk / permission failure | `parallel_batch` resolver downgrades to sequential per-profile |
241
+ Multi-language monorepos lint all languages in one pass. Override priority via `git.lint.linters.<lang>: [list]`. See [docs/EXTENDING.md](docs/EXTENDING.md) to add more.
380
242
 
381
- ## Multi-Agent Intelligence
243
+ ## Troubleshooting
382
244
 
383
- Beyond the autopilot, Sprintpilot includes 7 multi-agent skills that launch parallel subagents for tasks that benefit from diverse perspectives.
245
+ **`resume_divergence` halts on every start.** Sprint-status or the working tree moved between sessions. If the persisted `current_story` is now `done`, the autopilot auto-acknowledges and proceeds no action needed. For other divergences, pass `--accept-divergence`, or finish the externally-merged story first so sprint-status reflects reality.
384
246
 
385
- ### Parallel Code Review (`/sprintpilot-code-review`)
247
+ **`verify_rejected` on `dev_red`: "no test_files reported".** The verifier auto-detects test files from `git diff` + untracked files by language convention — if it still can't find any, the work didn't produce a test-shaped file. Check the actual changes; re-run `bmad-dev-story` if needed.
386
248
 
387
- Three independent reviewers run **simultaneously** on the same diff not serially. Each comes with a different bias by design:
249
+ **`verify_rejected` on `dev_red`: "test file missing: \<path\>".** The LLM reported a path that doesn't exist. Relative paths resolve against `projectRoot` verify the file is where the LLM said.
388
250
 
389
- | Agent | Perspective | Access |
390
- |-------|------------|--------|
391
- | **Blind Hunter** | Pure adversarial — finds bugs from code alone | Diff only, no project context |
392
- | **Edge Case Hunter** | Boundary conditions, race conditions, missing validation | Full codebase access |
393
- | **Acceptance Auditor** | Verifies every acceptance criterion is met | Diff + story spec |
251
+ **`verify_rejected` on `story_done`: "git_steps_completed must be true".** The flag is the canonical signal but the verifier also probes `git cat-file -e <commit>` + `git ls-remote --heads origin <branch>`. If both pass, the signal is accepted. If the probe fails, `git push` likely didn't complete — re-run the push step manually.
394
252
 
395
- Results are triaged: duplicates merged, contradictions flagged, findings classified as **PATCH / WARN / DISMISS**. The autopilot auto-accepts every PATCH finding and commits each fix separately.
253
+ **Epic won't close out with retrospective.** `remaining_stories_in_epic > 0`. Either mark the deferred stories as `skipped` / `deferred` / `cancelled` / `wont_do` in sprint-status (all are accepted as terminal), or emit `trigger_retrospective` to force-route to RETROSPECTIVE.
396
254
 
397
- ### Brownfield Analysis Pipeline
255
+ **`.autopilot.lock` held but no session is running.** The previous session crashed before releasing. Wait `git.lock.stale_timeout_minutes` (default 30) and the next `autopilot start` will auto-take-over. To skip the wait, `rm .autopilot.lock`.
398
256
 
399
- > Codebase mapping inspired by [GSD's map-codebase](https://github.com/gsd-build/get-shit-done). Adapted with a distinct output format, enriched agent prompts, and BMad Method-specific downstream integration.
257
+ **LLM keeps inventing pause justifications ("context budget", "natural checkpoint").** The autopilot's `workflow.orchestrator.md` contract forbids LLM-initiated pause. If you're seeing this pattern in your ledger, the LLM isn't reading the contract — `/sprintpilot-update` may help, or check `_Sprintpilot/skills/sprint-autopilot-on/SKILL.md` is current.
400
258
 
401
- For existing codebases, three skills chain together:
259
+ More scenarios: [docs/USAGE.md](docs/USAGE.md#troubleshooting).
402
260
 
403
- **`/sprintpilot-codebase-map`** 5 parallel agents scan the codebase simultaneously:
404
- - Stack Analyzer (languages, frameworks, versions)
405
- - Architecture Mapper (modules, patterns, data flow)
406
- - Quality Assessor (tests, CI/CD, conventions)
407
- - Concerns Hunter (TODOs, deprecated APIs, security issues, dead code)
408
- - Integration Mapper (external APIs, databases, env vars)
261
+ ## How it works
409
262
 
410
- Output files (`_bmad-output/codebase-analysis/`):
263
+ The orchestrator emits one typed Action at a time (`invoke_skill`, `run_script`, `git_op`, `parallel_batch`, `user_prompt`, `halt`) and consumes typed Signals from the LLM (`success`, `failure`, `blocked`, `propose_alternative`, `user_input`, `verify_override`). State writes go through a single chokepoint with critical-key carve-outs for crash recovery; non-critical writes coalesce at story boundaries.
411
264
 
412
- | File | Content |
413
- |------|---------|
414
- | `stack-analysis.md` | Languages, frameworks, versions, runtime requirements, package health |
415
- | `architecture-analysis.md` | Project structure, architectural pattern, module boundaries, data flow |
416
- | `quality-analysis.md` | Test coverage, CI/CD pipeline, code conventions, complexity metrics |
417
- | `concerns-analysis.md` | TODOs/FIXMEs, security issues, dead code, deprecated patterns, error handling gaps |
418
- | `integrations-analysis.md` | External APIs, databases, message queues, cloud services, env vars |
265
+ `verify.js` enforces BMad bookkeeping after every `success` signal: acceptance-criteria bullets exist, `[ ]` task boxes are flipped to `[x]`, `commit_sha` + `branch` are reported and verified, review findings are recorded. Auto-recovery paths handle common signal-format omissions (test_files / tests_run / git_steps_completed) by probing the underlying world rather than punishing the LLM for missing echo fields.
419
266
 
420
- Scanned file types: TypeScript, JavaScript, Python, Java, Go, Rust, Ruby, C, C++, C#, SQL, PL/SQL (`.sps`, `.spb`), XML, Shell.
267
+ Full architecture: [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). State-machine diagram, action / signal vocabulary, verify contracts, and the LLM-as-peer protocol.
421
268
 
422
- **`/sprintpilot-assess`** 3 parallel agents produce actionable findings:
423
- - Dependency Auditor (CVEs, outdated packages, upgrade paths)
424
- - Debt Classifier (prioritized tech debt with effort estimates)
425
- - Migration Analyzer (framework upgrade paths and phased roadmap)
269
+ ## Git workflow (detailed)
426
270
 
427
- Output: `_bmad-output/codebase-analysis/brownfield-assessment.md` prioritized findings with severity, confidence, effort, and migration paths.
271
+ The 4 modes from [Choose your workflow](#choose-your-workflow) with their full branch graphs.
428
272
 
429
- **`/sprintpilot-reverse-architect`** 3 parallel agents extract architecture from code:
430
- - Component Mapper (module boundaries, dependency graph)
431
- - Data Flow Tracer (request lifecycle, state management)
432
- - Pattern Extractor (design patterns, conventions, error handling)
273
+ ### Stacked PRs (default)
433
274
 
434
- Output: `{planning_artifacts}/architecture.md` BMad Method-compatible, feeds directly into `bmad-create-epics-and-stories`.
275
+ Each story branches from the previous story's branch and targets it. Reviewers see each story's diff in isolation while the next story is already in progress. When a PR merges on the platform, subsequent PRs auto-retarget.
435
276
 
436
- ### Migration Planning (`/sprintpilot-migrate`)
277
+ ```
278
+ main ─────────────────────────────────────────────────────────
279
+ │ (artifacts only)
280
+ ├── story/1-1 ──→ push + PR #42 (→ main)
281
+ │ │
282
+ │ └── story/1-2 ──→ push + PR #43 (→ story/1-1)
283
+ │ │
284
+ │ └── story/1-3 ──→ push + PR #44 (→ story/1-2)
285
+
286
+ Epic 1 complete → retrospective
287
+ → "Ready to merge: PR #42, #43, #44"
288
+ ```
437
289
 
438
- A 12-step workflow for taking a codebase from one stack to another, with 4 subagent fan-outs:
290
+ Trade-off: zero waiting for review during the sprint, but you end up with a stack to merge afterward.
439
291
 
440
- 1. Validate prerequisites and get target stack from user
441
- 2. Auto-recommend migration strategy (strangler fig / big bang / branch-by-abstraction / parallel run)
442
- 3. **Parallel**: Stack Mapper + Dependency Analyzer produce compatibility matrix
443
- 4. Design coexistence layer (old + new code running together)
444
- 5. Build phased roadmap ordered by dependency graph
445
- 6. Generate per-component migration cards with effort/risk
446
- 7. Plan data migration (schema changes, dual-write, backfill)
447
- 8. Design API compatibility (versioning, deprecation timeline)
448
- 9. **Parallel**: Test Parity Analyzer maps old tests to new equivalents
449
- 10. **Parallel**: Risk Assessor produces per-phase risk matrix with rollback triggers
450
- 11. Generate BMad Method-compatible epics for sprint planning
451
- 12. Finalize migration plan, epics, and tracking artifacts
292
+ ### Land-as-you-go
452
293
 
453
- Output:
294
+ After every `STORY_DONE`, the orchestrator runs a `STORY_LAND` state to merge that story's PR immediately. Each subsequent story branches from the already-merged base, so there's no stack to unwind.
454
295
 
455
- | File | Location | Content |
456
- |------|----------|---------|
457
- | `migration-plan.md` | `{planning_artifacts}/` | Strategy, compatibility matrix, coexistence design, phased roadmap, component cards, data/API migration, risk matrix |
458
- | `migration-epics.md` | `{planning_artifacts}/` | Epics with stories, acceptance criteria, effort estimates (BMad Method-compatible) |
459
- | `migration-tracking.yaml` | `{implementation_artifacts}/` | Phase-by-phase progress tracking for sprint execution |
296
+ ```
297
+ main ── story/1-1 ──→ PR #42 ──→ ✓ CI / review ──→ merge ──→
298
+ │ ╲
299
+ ├── story/1-2 ──→ PR #43 ──→ CI / review ──→ merge ──→ ╲
300
+ │ ╲
301
+ └── story/1-3 ──→ PR #44 ──→ ✓ CI / review ──→ merge ──→ done
302
+ ```
460
303
 
461
- ### Research and Discussion
304
+ Knobs: `git.land_when` (`no_wait` / `ci_pass` / `ci_and_review`), `git.land_wait_minutes` (default 30). Rebase recovery is automatic; conflicts halt with a `user_prompt`.
462
305
 
463
- **`/sprintpilot-research`** fan out research across multiple topics in parallel, each with web search access. Results synthesized into a unified report.
306
+ Trade-off: cleaner history, no end-of-sprint merge marathon but each story blocks on CI before the next starts.
464
307
 
465
- **`/sprintpilot-party-mode`** launch 2–3 BMad personas (architect, PM, QA, dev, etc.) as parallel agents debating a topic. Multiple rounds where personas respond to each other. Produces consensus points, disagreements, and action items.
308
+ ### Direct merge (no PR)
466
309
 
467
- ## Skills Reference
310
+ Stories merge straight into the base after push — no PR, no human review gate. Use only for prototypes / tutorials / dev branches.
468
311
 
469
- | Skill | What it does |
470
- |-------|--------------|
471
- | `/sprint-autopilot-on` | Engage autonomous sprint execution |
472
- | `/sprint-autopilot-off` | Disengage and show status |
473
- | `/sprintpilot-update` | Check for updates and install the latest version |
474
- | `/sprintpilot-code-review` | Parallel 3-layer adversarial code review |
475
- | `/sprintpilot-codebase-map` | 5-stream brownfield codebase analysis |
476
- | `/sprintpilot-assess` | Tech debt, dependency audit, migration assessment |
477
- | `/sprintpilot-reverse-architect` | Extract architecture document from existing code |
478
- | `/sprintpilot-migrate` | 12-step legacy migration planning |
479
- | `/sprintpilot-research` | Parallel web research fan-out |
480
- | `/sprintpilot-party-mode` | Multi-persona BMad agent discussions |
312
+ ```
313
+ main ── story/1-1 ──→ merge ── story/1-2 ──→ merge ── story/1-3 ──→ merge
314
+ ```
481
315
 
482
- ## Compatibility
316
+ ### Reuse your branch
483
317
 
484
- ### Tools (9 supported)
318
+ You create the branch; the autopilot detects it on boot and commits every story directly onto it. No `story/*` branches. One PR opens against `base_branch` at sprint-end.
485
319
 
486
- Sprintpilot uses the universal SKILL.md format — same skills work everywhere:
320
+ ```
321
+ main ─────────────────────────────────────────────────
322
+
323
+ └── feature/payments-rewrite (your branch, you created it)
324
+ ├── feat(1): story 1-1 ─→ commit
325
+ ├── feat(1): story 1-2 ─→ commit
326
+ └── … ─→ push + PR (→ main, at sprint-end)
327
+ ```
487
328
 
488
- | Tool | Directory | Tool | Directory |
489
- |------|-----------|------|-----------|
490
- | Claude Code | `.claude/skills/` | Roo Code | `.roo/skills/` |
491
- | Cursor | `.cursor/skills/` | Trae | `.trae/skills/` |
492
- | Windsurf | `.windsurf/skills/` | Kiro | `.kiro/skills/` |
493
- | Gemini CLI | `.gemini/skills/` | GitHub Copilot | `.github/copilot/skills/` |
494
- | Cline | `.cline/skills/` | | |
329
+ ### Branch naming
495
330
 
496
- For non-interactive installs:
331
+ - Story granularity (default): `<branch_prefix><story-key>` → `story/1-3-add-auth`
332
+ - Epic granularity (nano): `<branch_prefix>epic-<epic-id>` → `story/epic-1`
333
+ - Reuse mode: no autopilot branches; your branch is used as-is
497
334
 
498
- ```bash
499
- npx @ikunin/sprintpilot@latest install --tools <tool1>,<tool2> --yes
500
- ```
335
+ ### Pre-commit safety
501
336
 
502
- Valid values: `claude-code`, `cursor`, `windsurf`, `gemini-cli`, `cline`, `roo`, `trae`, `kiro`, `github-copilot`, or `all`.
337
+ Before every commit, deterministic Node scripts run against staged files:
503
338
 
504
- ### Git platforms
339
+ | Check | What it does |
340
+ |---|---|
341
+ | Explicit staging | `git add -- file1 file2` — never `-A`/`-u`/`.`. Cross-referenced against the story's `## File List`. |
342
+ | Secrets scan | Greps for `API_KEY`, `SECRET`, `TOKEN`, `PASSWORD`, `aws_access`, `private_key`. WARN severity; allowlist via `.secrets-allowlist`. |
343
+ | File size | Rejects files over `staging.max_file_size_mb` (default 1). |
344
+ | Binary detection | Warns on binary files. |
345
+ | Gitignore check | Verifies `.gitignore` covers `.autopilot.lock` and `.claude/.sprintpilot-backups/`. |
505
346
 
506
- | Platform | CLI | Auto-detect | API fallback |
507
- |----------|-----|-------------|--------------|
508
- | GitHub | `gh` | `github.com` | No |
509
- | GitLab | `glab` | `gitlab.*` | No |
510
- | Bitbucket | `bb` | `bitbucket.org` | Yes (`BITBUCKET_TOKEN`) |
511
- | Gitea | `tea` | Explicit config | Yes (`GITEA_TOKEN` + `base_url`) |
347
+ Decision matrix and additional knobs: [`modules/git/branching-and-pr-strategy.md`](_Sprintpilot/modules/git/branching-and-pr-strategy.md).
512
348
 
513
- No CLI installed? Falls back to **git_only mode** (direct merge, no PRs).
349
+ ## Multi-Agent Intelligence
514
350
 
515
- ### Linters (auto-detected, changed files only)
351
+ Beyond the autopilot, 7 multi-agent skills launch parallel subagents for tasks that benefit from diverse perspectives.
516
352
 
517
- | Language | Linters | Language | Linters |
518
- |----------|---------|----------|---------|
519
- | Python | ruff, flake8, pylint | Java | checkstyle, pmd |
520
- | JavaScript/TS | eslint, biome | C/C++ | cppcheck, clang-tidy |
521
- | Rust | cargo clippy | C# | dotnet format |
522
- | Go | golangci-lint | Swift | swiftlint |
523
- | Ruby | rubocop | PL/SQL | sqlfluff |
524
- | Kotlin | ktlint, detekt | PHP | phpstan, phpcs |
353
+ **`/sprintpilot-code-review`** 3 reviewers run simultaneously: Blind Hunter (adversarial, diff only), Edge Case Hunter (codebase access), Acceptance Auditor (story spec). Findings triaged as **PATCH / WARN / DISMISS**. PATCH findings auto-applied as separate commits.
525
354
 
526
- First found wins per language. Multi-language monorepos lint all languages in one pass. See [Extending](docs/EXTENDING.md) to add more.
355
+ **`/sprintpilot-codebase-map`** 5 parallel agents scan an existing codebase: stack, architecture, quality, concerns, integrations. Output under `_bmad-output/codebase-analysis/`.
527
356
 
528
- ## Configuration
357
+ **`/sprintpilot-assess`** — Dependency auditor (CVEs), debt classifier (prioritized), migration analyzer. Output: prioritized findings with severity / confidence / effort.
529
358
 
530
- All settings live in YAML files under `_Sprintpilot/modules/`. Most projects only ever change a handful the rest have sensible profile-aware defaults.
359
+ **`/sprintpilot-reverse-architect`** Component mapper + data flow tracer + pattern extractor. Output: BMad Method-compatible `architecture.md` that feeds `bmad-create-epics-and-stories`.
531
360
 
532
- **Most-tweaked settings:**
361
+ **`/sprintpilot-migrate`** — 12-step migration planner with 4 subagent fan-outs. Strategy, compatibility matrix, phased roadmap, per-component cards, data + API migration, risk matrix.
533
362
 
534
- | Setting | File | Default | What it controls |
535
- |---------|------|---------|------------------|
536
- | `complexity_profile` | `autopilot/config.yaml` | `medium` | One of `nano`/`small`/`medium`/`large`/`legacy` — picks the per-story flow + which v2 layers are enabled |
537
- | `autopilot.implementation_flow` | `autopilot/config.yaml` | `full` (nano: `quick`) | `full` runs the 7-step BMad cycle; `quick` routes every story through `bmad-quick-dev` and boots fresh sessions directly at `NANO_QUICK_DEV` |
538
- | `git.push.create_pr` | `git/config.yaml` | `true` | `true` = push + PR (no auto-merge), `false` = direct merge to base branch |
539
- | `git.merge_strategy` | `git/config.yaml` | `stacked` | `stacked` keeps every story branch open until sprint-end; `land_as_you_go` merges each PR right after `STORY_DONE` (gated by `land_when` / `land_wait_minutes`) |
540
- | `git.reuse_user_branch` | `git/config.yaml` | `false` | When `true`, autopilot commits every story onto the user's current branch instead of creating per-story / per-epic branches; one PR opens at sprint-end |
541
- | `git.branch_prefix` | `git/config.yaml` | `story/` | Prefix for autopilot-created branches (e.g., `story/1-3-add-auth`, `story/epic-1`) |
542
- | `git.lint.blocking` | `git/config.yaml` | `false` | `true` = lint errors halt the autopilot |
543
- | `autopilot.session_story_limit` | `autopilot/config.yaml` | `3` (nano: `5`) | Stories per session before checkpoint. `0` = unlimited |
544
- | `multi_agent.enabled` | `ma/config.yaml` | `true` | Enable parallel agent skills |
363
+ **`/sprintpilot-research`** Fan out research across multiple topics in parallel; synthesized into a unified report.
545
364
 
546
- **Profile-level overrides** settings like `parallel_stories`, `state_sharding`, `phase_timings`, `cache_shared_reads`, and `conditional_boot_work` live in profile files at `_Sprintpilot/modules/autopilot/profiles/<profile>.yaml`, not in `autopilot/config.yaml` or `ma/config.yaml`. Their effective value depends on the active `complexity_profile`.
365
+ **`/sprintpilot-party-mode`**2–3 BMad personas (architect, PM, QA, dev) debate a topic over multiple rounds. Output: consensus points, disagreements, action items.
547
366
 
548
- See the [Configuration Reference](docs/CONFIGURATION.md) for every setting, default, and profile-level override.
367
+ Skill internals + output schemas: [docs/USAGE.md](docs/USAGE.md#multi-agent-skills).
549
368
 
550
369
  ## Requirements
551
370
 
552
371
  - [BMad Method](https://github.com/bmad-code-org/BMAD-METHOD) v6.2.0+
553
- - A supported AI code agent (see [Tools](#tools-9-supported))
372
+ - A supported AI code agent (see [Compatibility](#compatibility))
554
373
  - Git repository with at least one commit
555
- - Platform CLI for PR creation (optional — see [Git platforms](#git-platforms))
374
+ - Platform CLI for PR creation (optional — falls back to git_only mode)
556
375
 
557
376
  ## Documentation
558
377
 
559
378
  - [Installation Guide](docs/INSTALLATION.md)
560
- - [Usage Guide](docs/USAGE.md)
561
- - [Architecture](docs/ARCHITECTURE.md)
562
- - [Configuration Reference](docs/CONFIGURATION.md)
379
+ - [Usage Guide](docs/USAGE.md) — handoff report, user commands, multi-agent skill internals, troubleshooting
380
+ - [Architecture](docs/ARCHITECTURE.md) — state machine, action / signal vocabulary, verify contracts
381
+ - [Configuration Reference](docs/CONFIGURATION.md) — every setting, default, profile override
563
382
  - [Extending (Platforms & Languages)](docs/EXTENDING.md)
564
383
  - [Contributing](docs/CONTRIBUTING.md)
565
384
  - [Changelog](CHANGELOG.md)