@mmerterden/multi-agent-pipeline 10.8.0 → 10.12.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 (49) hide show
  1. package/CHANGELOG.md +182 -0
  2. package/README.md +3 -1
  3. package/docs/engineering.md +76 -0
  4. package/docs/features.md +40 -36
  5. package/package.json +1 -1
  6. package/pipeline/commands/multi-agent/channels.md +42 -6
  7. package/pipeline/commands/multi-agent/finish.md +15 -6
  8. package/pipeline/commands/multi-agent/generate-bug.md +33 -0
  9. package/pipeline/commands/multi-agent/generate-task.md +33 -0
  10. package/pipeline/commands/multi-agent/help.md +12 -0
  11. package/pipeline/commands/multi-agent/manual-test.md +9 -2
  12. package/pipeline/commands/multi-agent/refs/channels/pr.md +1 -1
  13. package/pipeline/commands/multi-agent/refs/cross-cli-contract.md +7 -6
  14. package/pipeline/commands/multi-agent/refs/generate-issue.md +197 -0
  15. package/pipeline/commands/multi-agent/refs/keychain.md +12 -0
  16. package/pipeline/commands/multi-agent/refs/phases/phase-0-init.md +40 -2
  17. package/pipeline/commands/multi-agent/refs/phases/phase-3-dev.md +12 -0
  18. package/pipeline/commands/multi-agent/refs/phases/phase-4-review.md +4 -23
  19. package/pipeline/commands/multi-agent/refs/phases/phase-5-test.md +6 -1
  20. package/pipeline/commands/multi-agent/refs/phases/phase-7-report.md +5 -1
  21. package/pipeline/commands/multi-agent/refs/progress-contract.md +1 -0
  22. package/pipeline/commands/multi-agent/refs/tracker-contract.md +56 -13
  23. package/pipeline/commands/multi-agent/resume.md +6 -2
  24. package/pipeline/commands/multi-agent/sync.md +5 -5
  25. package/pipeline/commands/multi-agent.md +4 -0
  26. package/pipeline/lib/figma-mcp-refresh.sh +79 -0
  27. package/pipeline/preferences-template.json +2 -1
  28. package/pipeline/schemas/prefs.schema.json +35 -0
  29. package/pipeline/schemas/token-budget.json +7 -7
  30. package/pipeline/scripts/README.md +1 -0
  31. package/pipeline/scripts/fixtures/install-layout.tsv +6 -6
  32. package/pipeline/scripts/phase-tracker.sh +134 -22
  33. package/pipeline/scripts/smoke-channels-approval-gate.sh +60 -0
  34. package/pipeline/scripts/smoke-generate-issue.sh +114 -0
  35. package/pipeline/scripts/smoke-phase-tracker.sh +69 -0
  36. package/pipeline/scripts/smoke-progress-contract.sh +9 -0
  37. package/pipeline/scripts/smoke-tasklist-ordering.sh +1 -0
  38. package/pipeline/scripts/smoke-token-preflight.sh +82 -0
  39. package/pipeline/scripts/smoke-tracker-contract.sh +62 -0
  40. package/pipeline/scripts/smoke-update-check.sh +122 -0
  41. package/pipeline/scripts/update-check.sh +82 -0
  42. package/pipeline/skills/.skills-index.json +22 -4
  43. package/pipeline/skills/shared/core/multi-agent/SKILL.md +2 -1
  44. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +4 -2
  45. package/pipeline/skills/shared/core/multi-agent-generate-bug/SKILL.md +39 -0
  46. package/pipeline/skills/shared/core/multi-agent-generate-task/SKILL.md +39 -0
  47. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +4 -0
  48. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +5 -5
  49. package/pipeline/skills/skills-index.md +5 -3
package/CHANGELOG.md CHANGED
@@ -14,6 +14,188 @@ Internal file-layout changes that don't affect the slash-command surface are sti
14
14
 
15
15
  ---
16
16
 
17
+ ## [10.12.0] - 2026-07-06
18
+
19
+ Two trust upgrades: every external channel post now shows a plan-mode-style
20
+ preview + approval gate before anything is written (autopilot posts directly),
21
+ and Phase 0 gains a proactive token expiry pre-flight with silent Figma MCP
22
+ renewal via OAuth refresh grant.
23
+
24
+ ### Added
25
+
26
+ - **Channels Step 6 body preview + approval gate** (dispatch → Step 7,
27
+ summary → Step 8) - interactive runs render
28
+ every selected channel's final body (PR description, Jira comment,
29
+ Confluence page, Wiki, Board move, GitHub issue comment) and ask
30
+ Approve & post / Edit (loop) / Skip channels / Cancel before dispatch.
31
+ Bypassed only by autopilot and `--dry-run`. What is posted is byte-identical
32
+ to the approved preview; regeneration after approval re-runs the gate.
33
+ Phase 7 Step 1.5 (issue comment + progress flags) routes through the same
34
+ gate. Contract: `smoke-channels-approval-gate.sh`.
35
+ - **Phase 0 Step 0.7 token expiry pre-flight** - probes every token the run
36
+ will need (jira/github/bitbucket/confluence/figma/figma_mcp) with one cheap
37
+ call each (cached via `serviceStatus`, TTL 300s) and resolves expiry AT INIT
38
+ instead of on the first mid-run 401. Figma MCP is the critical path: silent
39
+ renewal first, then an init-time question (Regenerate now via script / Save
40
+ Flow / Continue degraded). Autopilot never prompts - silent renewal or
41
+ logged degrade. Contract: `smoke-token-preflight.sh`.
42
+ - **`lib/figma-mcp-refresh.sh`** - silent Figma MCP (`figu_`) renewal via
43
+ OAuth refresh grant: reads `<key>_Refresh` from the Keychain + client
44
+ credentials from the `.figma-oauth.json` next to
45
+ `prefs.global.tokenScripts.figma_mcp`, saves the new access (and rotated
46
+ refresh) token back. Status lines only - token values never printed.
47
+ Live-verified end-to-end (renewed + mcp.figma.com probe 200).
48
+ - **`prefs.global.tokenScripts`** (schema + template) - maps service ids to
49
+ user-owned token generation scripts; personal paths stay in the local
50
+ preferences file, never in synced command files.
51
+ - **keychain.md Figma MCP lifecycle section** - refresh-entry convention,
52
+ silent-renewal-first rule, generation-script escalation, init cross-ref.
53
+
54
+ ### Fixed
55
+
56
+ - Copilot parity catch-ups the 10.11.0 sweep missed: `multi-agent-sync/SKILL.md`
57
+ inventory 35 -> 37 + list, `multi-agent-help/SKILL.md` generator entries
58
+ (EN + TR), `multi-agent-channels/SKILL.md` flow now includes the approval
59
+ gate (steps 6-8). `smoke-generate-issue.sh` now asserts the SKILL-side
60
+ counts too.
61
+ - `figma-mcp-refresh.sh` form fields sent via `--data-urlencode` (robust to
62
+ special characters in tokens); re-verified live.
63
+
64
+ ## [10.11.0] - 2026-07-06
65
+
66
+ Jira issue generators: `/multi-agent:generate-task` and `/multi-agent:generate-bug` create standards-compliant Jira issues by learning the target project's own conventions before drafting, with a hard preview + approval gate before anything is created.
67
+
68
+ ### Added
69
+
70
+ - **`/multi-agent:generate-task` + `/multi-agent:generate-bug`** - one-shot
71
+ Jira issue creators (no worktree, no commits, no pipeline chaining). Inputs:
72
+ optional free-text description + optional Figma URL; both asked
73
+ interactively when missing.
74
+ - **Convention mining** - samples the project's 30 most recent same-type
75
+ issues (JQL) and adopts the team's summary prefix pattern, dominant
76
+ description heading set, top labels/components, and priority norm.
77
+ createmeta discovery surfaces required custom fields (allowedValues become
78
+ picker options) and detects Sprint/Epic/Team fields generically by
79
+ `schema.custom` id.
80
+ - **Active-sprint placement** - Agile REST board + `sprint?state=active`
81
+ detection; the user chooses active sprint vs backlog. Sprint assignment
82
+ happens post-create via `POST /rest/agile/1.0/sprint/{id}/issue`
83
+ (field-id-agnostic). No board / no active sprint degrades to backlog with
84
+ an explicit note.
85
+ - **Hard approval gate** - a full draft preview (every field + complete
86
+ description) renders before create; Approve / Edit (loop) / Cancel. The
87
+ gate has no bypass: no autopilot variant exists for these commands.
88
+ Genuinely unknown fields (component, epic, priority, labels, assignee,
89
+ sprint, required customs, missing Bug repro/environment) are asked, never
90
+ invented.
91
+ - **Figma context (optional)** - the 3-tier chain (MCP -> REST PAT -> user
92
+ screenshot) resolves frame name + node id for a Design Reference section,
93
+ a remote link on the created issue, and an opt-in screenshot attachment.
94
+ Standalone command, so MCP use is allowed (analysis-class); Figma failures
95
+ never block issue creation.
96
+ - **Language rule** - issue summary + description follow
97
+ `prefs.global.outputLanguage` (intentional exception to the
98
+ external-payloads-English default; the issue is authored for the user's
99
+ team). Documented in both command files and the shared ref.
100
+ - **Shared flow ref** `refs/generate-issue.md` - single 11-step contract
101
+ consumed by both commands via profile blocks (`ISSUE_TYPE`, default
102
+ sections, JQL filter); UTF-8 verbatim POST path (`jq --rawfile` +
103
+ `--data-binary @file`) and humanizer pass reused from the Jira channel
104
+ adapter.
105
+ - **Smoke gate** `smoke-generate-issue.sh` - 66 assertions: file/frontmatter
106
+ presence, profile declarations, approval-gate markers, endpoint markers,
107
+ UTF-8 path, section vocabulary, 37-command count consistency across
108
+ dispatcher/contract/sync/help, forbidden-string scan.
109
+
110
+ ### Changed
111
+
112
+ - Command inventory 35 -> 37 across `cross-cli-contract.md`, `sync.md`,
113
+ dispatcher routing/loading tables, `help.md` (EN + TR), README.
114
+
115
+ ## [10.10.0] - 2026-07-03
116
+
117
+ Live tracker UX: per-tile cost, a real "currently doing X" line, and tracker continuity across the local-test handover. Shaped by a market sweep of 2026 agent-UX practice (transparency-first live status; per-step cost visibility).
118
+
119
+ ### Added
120
+
121
+ - **`phase-tracker.sh now <N> "<text>"`** - dedicated live current-action
122
+ line for the active phase (quiet: writes `meta.Now`, never renders, 60-char
123
+ cap). The bordered card shows it as `Now: <text>` under the active tile.
124
+ - **`phase-tracker.sh cost <N>|total`** - single pricing implementation
125
+ (cost-table.json rates, cached tokens at the discounted cacheRead rate,
126
+ floored to cents; `-` when unpriceable). The completion narration line,
127
+ the card, and finish's summary all reuse it - no more inline USD math.
128
+ - **Per-tile est. USD + cached footer on the bash card.** Tiles render
129
+ `<elapsed> · <tok> tok · ~$<usd>` when the phase has a priced model; the
130
+ footer adds total USD and cached tokens. Render survives a missing cost
131
+ table. Tiles now sort by numeric phase id so continuation sets stay ordered.
132
+ - **Progress-line mirror rule** (tracker-contract "Active phase" +
133
+ progress-contract cross-link): every normal-tier `→ verb object` line is
134
+ mirrored to the active phase - `TaskUpdate activeForm` on Claude Code,
135
+ `now` elsewhere - so the tracker always answers "what is it doing right
136
+ now". Throttled: canonical lines only, dedupe, no renders.
137
+ - **Completion tile suffix (Claude Code):** on phase completion the tile
138
+ subject gains the spend (`Phase 3: Dev · ~35k tok · ~$0.58`); subject edits
139
+ do not reorder tiles.
140
+ - **Tracker continuity across the local-test handover.** Phase 5 and
141
+ `/multi-agent:manual-test` mark the waiting state
142
+ (`now 5 "awaiting local test (user)"`); `/multi-agent:finish` now runs
143
+ load-or-continue instead of an unconditional `init` - prior phase 0-3
144
+ history (elapsed, tokens, USD) survives, Phase 5 is closed with a Result
145
+ meta, the Claude Code TaskList is rebuilt from state, and one line
146
+ summarizes the inherited history (`Continuing <id>: phases 0-3 finished
147
+ earlier (12m, 38.4k tok, ~$0.74)`). `add` is idempotent to make this safe.
148
+ - **`/multi-agent:resume` rebuilds the phase tiles** from `tracker-state.json`
149
+ (the contract documented it; the command now actually does it).
150
+ - **Phase 0 + 7 token forwarding**: the clarifier call and the Phase 7 report
151
+ compose call forward tokens to the tracker, completing all 8 tiles.
152
+
153
+ ### Fixed
154
+
155
+ - Tracker doc drift: the `tokens` action's 4th `[cached]` arg and the `model`
156
+ action are now documented in the contract and the script usage text.
157
+
158
+ ---
159
+
160
+ ## [10.9.0] - 2026-07-03
161
+
162
+ ### Added
163
+
164
+ - **Update check at run start (Phase 0 Step 0.6, opt-out via
165
+ `prefs.global.updateCheck`).** Once per `ttlHours` window (default 24h,
166
+ cached, 3s-bounded curl straight to the npm registry - never `npm view`),
167
+ the pipeline compares the installed version against `dist-tags.latest`.
168
+ Newer version found: interactive modes ask ONE question ("Update now?" ->
169
+ yes runs the `/multi-agent:update` flow and the run continues; the update
170
+ takes full effect next session); autopilot logs one line and never asks
171
+ (zero-interaction contract). `autoUpdate: true` skips the question and
172
+ updates before the worktree is created. Offline, ahead-of-registry, and
173
+ failed checks are silent - the step never blocks. New
174
+ `pipeline/scripts/update-check.sh` + `smoke-update-check.sh` (13 assertions).
175
+ - **Design fidelity contract (Phase 3, BLOCKING on Figma-referenced tasks).**
176
+ The analysis doc's captured frames are the 1:1 reference for every UI line:
177
+ a Code Connect-mapped component must be used verbatim (no sound-alikes,
178
+ missing modifiers go into `+Modifiers`, never forks), unmapped UI becomes a
179
+ NEW component under the standard architecture, and inter-component spacing
180
+ comes from the design's measured values mapped to tokens - never invented.
181
+ Missing design data halts with a re-run-analysis instruction; Figma MCP
182
+ stays forbidden outside analysis.
183
+ - **`docs/engineering.md`** - version-free catalog of the discipline layer
184
+ (bounded loops, evidence gates, token-budgeted phase docs, immutable tests,
185
+ fresh-context handoffs, memory hedges, install hygiene), linked from README.
186
+
187
+ ### Changed
188
+
189
+ - **Docs drop inline version markers.** `docs/features.md` headers and bullets
190
+ no longer carry `(vX.Y.Z)` tags - the docs describe the current state;
191
+ history lives in this CHANGELOG. Same principle applied to the website copy.
192
+ - **Phase-doc token budgets recalibrated** (`token-budget.json`, total
193
+ 46500 -> 50000) after the verify-by-test, update-check, immutable-test, and
194
+ design-fidelity contracts landed - Step 3.7 prose was compressed to a
195
+ pointer into `refs/features/verify-by-test.md` before recalibration.
196
+
197
+ ---
198
+
17
199
  ## [10.8.0] - 2026-07-02
18
200
 
19
201
  Three additive loop-quality features, all sourced from the 2026 agentic-loop research sweep (Anthropic long-running-agent harness guidance + adversarial-review findings): empirical verification of blocking findings, an immutable-test contract, and structured phase-boundary handoffs.
package/README.md CHANGED
@@ -51,6 +51,8 @@ One command runs 8 phases, with a gate between the risky ones:
51
51
 
52
52
  Under the hood: each task runs in its own **git worktree** (or the current branch with `:local`), commits use the **git identity routed from the repo's origin URL**, and **multi-repo** tasks get per-repo worktrees plus an integration build. Tokens stay in the OS keychain; nothing is committed or logged. `/multi-agent:review` can also review an existing GitHub/Bitbucket PR — per-finding inline comments anchored to `file:line` + an explicit Approve / Needs-Work state.
53
53
 
54
+ The discipline behind all of this — bounded loops, evidence gates, token-budgeted phase docs, immutable tests, fresh-context handoffs — is catalogued in [docs/engineering.md](./docs/engineering.md). The full feature list lives in [docs/features.md](./docs/features.md).
55
+
54
56
  ## Modes
55
57
 
56
58
  | Mode | Command | Flow |
@@ -61,7 +63,7 @@ Under the hood: each task runs in its own **git worktree** (or the current branc
61
63
  | Local | `/multi-agent:local "task"` | Full pipeline, current branch (no worktree) |
62
64
  | Finish | `/multi-agent:finish` | Run the review→test→commit→report tail over local work |
63
65
 
64
- Helpers: `setup`, `status`, `resume #N`, `review`, `test`, `channels`, `stack`, `update`, `sync`, `jira`, `issue`, `analysis`. Full list: `/multi-agent:help`.
66
+ Helpers: `setup`, `status`, `resume #N`, `review`, `test`, `channels`, `stack`, `update`, `sync`, `jira`, `issue`, `analysis`, `generate-task`, `generate-bug`. Full list: `/multi-agent:help`.
65
67
 
66
68
  ## Stacks
67
69
 
@@ -0,0 +1,76 @@
1
+ # Engineering Discipline
2
+
3
+ The pipeline's output quality comes less from any single model call and more from the constraints wrapped around every call. This page lists those constraints - the internals that keep long agentic runs correct, cheap, and auditable. No version markers here; this document always describes the current state (history lives in the [CHANGELOG](../CHANGELOG.md)).
4
+
5
+ ## Loop discipline
6
+
7
+ Every loop in the pipeline has a deterministic exit condition and a hard iteration cap. Nothing "keeps trying".
8
+
9
+ - **TDD micro-loop** (Phase 3): red -> green -> refactor per task; build-fix retries capped at 3 attempts.
10
+ - **Dev-critic loop** (Phase 3.5, opt-in): generator vs critic on deterministic criteria; max 2 iterations, round 3 escalates to the user.
11
+ - **Review-fix macro-loop** (Phase 3 <-> 4): only triage-accepted blocking findings re-enter development; max 3 iterations, then hard-kill and escalate.
12
+ - **Disagreement round** (Phase 4, opt-in): when reviewers split, exactly one rebuttal round - never more.
13
+ - **Global rule**: any retry loop stops after 3 attempts and asks the user. No exceptions, no infinite loops.
14
+
15
+ ## Evidence over claims
16
+
17
+ - **Default-FAIL evidence gate**: a "build passed" or "tests passed" claim is rejected unless the captured log actually shows success. Missing, empty, or failure-marked logs fail CLOSED.
18
+ - **Verify-by-test** (opt-in): an accepted blocking review finding can be empirically confirmed - a verifier agent writes a minimal repro test and runs it. Test fails as predicted: the finding stands and the failing test is handed to the rework loop as its RED test. Test passes: the finding is downgraded, and even the downgrade must pass the evidence gate.
19
+ - **Deterministic validator gates**: triage output, reviewer output, diff-risk output, and agent state are schema-validated by zero-dependency scripts whose exit codes decide the flow - one self-correction rework, then halt with a recovery hint. The LLM never grades its own homework.
20
+
21
+ ## Test integrity
22
+
23
+ - **Immutable tests**: deleting, renaming, or weakening an existing test to get a green run is a rule violation. A test changes only when the task changes the spec it encodes, named in the commit body.
24
+ - **Deterministic backstop**: the diff-risk scorer flags any test file whose diff removes more lines than it adds (`test_lines_removed`), so a shrinking test suite surfaces to reviewers even if the rule is ignored.
25
+ - **Test-gap detection**: newly added public symbols with no paired test are reported before the test phase.
26
+
27
+ ## Context management
28
+
29
+ - **Token-budgeted phase docs**: every phase document has a per-file and total token budget enforced by a smoke gate (`token-budget.json`). Growth is compressed first; budgets are recalibrated only when real contract text lands. This keeps the orchestrator's working context lean across an 8-phase run.
30
+ - **Lazy loading**: only the active phase's document is in context; references load on demand.
31
+ - **Structured handoff blocks**: at every phase boundary the orchestrator appends a Done / Remaining / Decisions / Open findings / Next block to the run log - written from state it already holds, no extra model call. Resume and post-compaction re-entry read the latest handoff plus the state file, never the conversation history.
32
+ - **Proactive compaction**: past ~50% context usage the run compacts itself and re-grounds from durable artifacts instead of waiting for lossy auto-compaction.
33
+
34
+ ## Review architecture
35
+
36
+ - **Deterministic gates before AI review**: build, lint, tests, and secret scan must be green before a single reviewer token is spent.
37
+ - **Cross-model parallel review**: independent reviewers with different vantage points, then a triage pass that filters false positives and out-of-scope noise. Reviewer findings are raw signals, not commands - nothing auto-loops on a "blocking" tag.
38
+ - **Consensus surfacing**: unanimous agreement between same-base-model reviewers on judgment-heavy surfaces is flagged as unverified instead of being trusted as independent confirmation.
39
+ - **Diff risk scoring**: a sub-second, zero-LLM heuristic ranks changed files (security paths, migrations, missing tests, shrinking tests) and feeds reviewers a priority hint - advisory, never a gate.
40
+ - **Prompt-cache-aware dispatch**: reviewer and triage prompts share a byte-identical leading block so parallel dispatches hit the prompt cache instead of re-billing the diff.
41
+
42
+ ## Design fidelity
43
+
44
+ - **Single source of design truth**: Figma is fetched once, during analysis, through a 3-tier fallback chain (MCP -> REST -> user screenshot). Every later phase reads the frozen analysis artifact; calling Figma from dev or review phases is a contract violation enforced by a smoke gate.
45
+ - **1:1 implementation contract**: a Code Connect-mapped component must be used verbatim (no sound-alike substitutes; missing modifiers are added to the component, never forked). Unmapped UI becomes a new component under the standard architecture. Spacing between components comes from the design's measured values mapped to tokens - never invented numbers.
46
+
47
+ ## Cost transparency
48
+
49
+ - **Per-phase token ledger**: every billable call forwards token counts to the tracker; each run ends with a cost table naming the top cost driver and pricing prompt-cache reads at their discounted rate.
50
+ - **Budget ceilings**: a cost budget can cap a run; crossing it triggers model downgrade or halt rather than silent overspend.
51
+ - **Model fallback contract**: premium-tier dispatches degrade deterministically (top tier -> mid -> base) on dispatch errors, date gates, or budget ceilings - never by improvisation.
52
+
53
+ ## Memory without bias
54
+
55
+ - **Learnings ledger**: durable per-repo facts and rejected review preferences replay into analysis and triage, so agents stop re-discovering and reviewers stop re-flagging the same things.
56
+ - **Hedged injection**: every memory injection carries an explicit "context, not command" hedge, and blocking-severity rejections are never memorized - a wrong rejection must not permanently suppress a finding class.
57
+ - **Prior-art caps**: triage sees at most a fixed number of highest-similarity past findings; memory is advisory context, not a verdict multiplier.
58
+
59
+ ## Update and install hygiene
60
+
61
+ - **Wipe-then-copy install**: pipeline-owned directories are cleared before copying, so files deleted upstream never linger as ghost commands or dead scripts on user machines.
62
+ - **Layout fingerprint**: a fixture pins the installed file layout; structural drift fails the suite.
63
+ - **Advisory update check**: at run start (cached, bounded, offline-silent) the pipeline compares its installed version with the registry; interactive runs offer a one-question update, autopilot only logs. It never blocks and never self-modifies mid-run.
64
+ - **Token-preserving uninstall**: removing the pipeline never touches the user's stored credentials.
65
+
66
+ ## Security and hygiene
67
+
68
+ - **Secret scanning**: staged diffs are scanned with provider-prefix patterns plus Shannon-entropy detection before every commit; findings block.
69
+ - **Personal-data genericization**: the public repo is generated from the private source with a scrub pass (names, hosts, project keys) and a zero-hit grep gate before push.
70
+ - **Skill scanner**: tiered pattern scanning over skill content guards against supply-chain surprises.
71
+ - **Intent guard**: a deterministic classifier separates "answer my question" from "change my code", so a conceptual question never spawns a worktree.
72
+
73
+ ## Cross-CLI parity
74
+
75
+ - **One source of truth, two runtimes**: Claude Code and Copilot CLI command surfaces are byte-identical where shared; a parity smoke fails on drift.
76
+ - **Portability gates**: every shell script passes `bash -n` and a GNU/BSD portability grep; the CI matrix runs macOS, Linux, and Windows.
package/docs/features.md CHANGED
@@ -43,7 +43,7 @@ Compose freely: `--dev --local autopilot` = shortest, least-friction path.
43
43
 
44
44
  Build commands, test runners, lint tools, and review focus areas all adapt to the detected stack.
45
45
 
46
- ### Stack Selection (marketplace plugins, v10.5.0+)
46
+ ### Stack Selection (marketplace plugins)
47
47
 
48
48
  Stack skill sets ship as versioned plugins in the `multi-agent-plugins` marketplace. Selecting a stack enables the matching plugin(s) in the current repo's `.claude/settings.json` `enabledPlugins` — no skill copying, no session restart tricks, no directory shuffling. The `ai-common-engineering-toolkit` (accessibility audit, humanizer, Firebase) is always enabled alongside the stack plugin.
49
49
 
@@ -57,7 +57,7 @@ Stack skill sets ship as versioned plugins in the `multi-agent-plugins` marketpl
57
57
  /multi-agent:stack all # every stack plugin
58
58
  ```
59
59
 
60
- ### Task Type Detection (v2.0.0)
60
+ ### Task Type Detection
61
61
 
62
62
  Phase 0 Step 9 classifies every task before Phase 1 starts. Deterministic priority order: Figma URL → instruction file path → git diff heuristic → Jira issue type → branch name → description keywords → user prompt (autopilot defaults to `feature`).
63
63
 
@@ -71,26 +71,26 @@ Result persisted to `agent-state.taskType`:
71
71
  | `refactor` | Phase 4 emphasizes behavior preservation; Phase 6 uses `refactor(...)` prefix |
72
72
  | `chore` | Lightweight flow; Phase 6 uses `chore(...)` prefix |
73
73
 
74
- ### SubPhase Convention (v2.0.0)
74
+ ### SubPhase Convention
75
75
 
76
- When a specialized skill takes over a main pipeline phase, progress is reported as SubPhases (e.g. `SubPhase 3.0: Init`, `SubPhase 3.1: Gather`). The top-level pipeline stays fixed at 8 phases (0-7 — Phase 6.5 was merged into Phase 7 REPORT in v5.1.0) — specialized work slots into its parent phase without inflating the count.
76
+ When a specialized skill takes over a main pipeline phase, progress is reported as SubPhases (e.g. `SubPhase 3.0: Init`, `SubPhase 3.1: Gather`). The top-level pipeline stays fixed at 8 phases (0-7) — specialized work slots into its parent phase without inflating the count.
77
77
 
78
78
  ## PR & Review Flow
79
79
 
80
- ### Default Reviewers (v1.6.1, hardened in v2.0.0)
80
+ ### Default Reviewers
81
81
 
82
82
  - **Bitbucket**: Fetches via `/rest/default-reviewers/1.0/`. Every PUT must re-send `reviewers`, `fromRef`, `toRef`, `draft` (regression guarded by smoke test).
83
83
  - **GitHub**: Honors `CODEOWNERS` + falls back to `prefs.projects[].githubDefaultReviewers`.
84
84
  - PR author always filtered out (Bitbucket: 409, GitHub: GraphQL error).
85
85
 
86
- ### Draft vs Ready Prompt (v1.7.0)
86
+ ### Draft vs Ready Prompt
87
87
 
88
88
  Phase 6 asks `DRAFT or READY?` before creating the PR and persists the choice in `prefs.projects[].defaultPrMode`.
89
89
 
90
90
  - Bitbucket: `draft: true` flag (DC 8.x+) with `[DRAFT]` title fallback for older servers.
91
91
  - GitHub: `gh pr create --draft` + `gh pr ready` for promotion.
92
92
 
93
- ### `channels` Command (v5.7.0 — replaces `enrich`)
93
+ ### `channels` Command
94
94
 
95
95
  Multi-channel reporter — Phase 7 delegates to it, and it's also invocable post-hoc for fixes closed outside the pipeline:
96
96
 
@@ -102,9 +102,9 @@ Multi-channel reporter — Phase 7 delegates to it, and it's also invocable post
102
102
  /multi-agent:channels ABC-1234 --channels jira,confluence --content test
103
103
  ```
104
104
 
105
- Multi-select **channels** (Jira / Confluence / Wiki / PR description) × multi-select **content** (normal analysis / test scenarios / auto-diff summary / manual note). Each body runs through the humanizer skill per-channel. Bitbucket PR updates use the reviewer-preserving PUT pattern (title + description + reviewers + fromRef + toRef + version mandatory). Replaces the pre-v5.7 `enrich` command — all its capabilities (diff auto-summarize, manual mode, reviewer-preserving) are preserved; Confluence + Wiki are new.
105
+ Multi-select **channels** (Jira / Confluence / Wiki / PR description) × multi-select **content** (normal analysis / test scenarios / auto-diff summary / manual note). Each body runs through the humanizer skill per-channel. Bitbucket PR updates use the reviewer-preserving PUT pattern (title + description + reviewers + fromRef + toRef + version mandatory). Replaces the earlier `enrich` command — all its capabilities (diff auto-summarize, manual mode, reviewer-preserving) are preserved; Confluence + Wiki are new.
106
106
 
107
- ### Body Preservation Contract (v1.6.1, verified by smoke test in v2.0.0)
107
+ ### Body Preservation Contract (smoke-verified)
108
108
 
109
109
  Every external-system body (PR description, Jira comment, GitHub issue) uses `jq -n --rawfile body body.md '{description: $body}'` → `curl --data-binary @payload.json`. No literal `\n` strings, no HTML entities (`&amp;`, `&lt;`, `&quot;`). UTF-8 preserved end-to-end. `scripts/smoke-add-detail.sh` runs 14 contract assertions.
110
110
 
@@ -137,7 +137,7 @@ The reviewer set is **CLI-aware**: Claude Code dispatches 2 reviewers in paralle
137
137
 
138
138
  **Fable Triage** (Phase 4 Step 3, Opus on Copilot CLI): Evaluates merged raw findings against task scope. Classifies each as `accepted` (fix now), `deferred` (out of scope, log for later), or `rejected` (false positive / noise). Only triage-accepted blocking items loop back to Phase 3.
139
139
 
140
- ### Runtime Triage Validator (v2.3.0)
140
+ ### Runtime Triage Validator
141
141
 
142
142
  After triage returns, output is validated by `validate-triage.mjs`:
143
143
 
@@ -148,19 +148,23 @@ After triage returns, output is validated by `validate-triage.mjs`:
148
148
  | **2** | Over-rejection guard tripped — pause for human |
149
149
  | **3** | Contradiction auto-corrected — proceed with corrected output |
150
150
 
151
- ### Bidirectional Approved↔Blocking Auto-Correction (v2.6.1)
151
+ ### Bidirectional Approved↔Blocking Auto-Correction
152
152
 
153
- If triage returns `approved: false` but has no blocking items, the validator forces `approved: true`. Conversely, if `approved: true` but blocking items exist, it forces `approved: false`. Hardened with `if`/`then` constraint in schema v3.0.0.
153
+ If triage returns `approved: false` but has no blocking items, the validator forces `approved: true`. Conversely, if `approved: true` but blocking items exist, it forces `approved: false`. Hardened with an `if`/`then` constraint in the schema itself.
154
154
 
155
- ### Verify-by-Test Triage (Phase 4 Step 3.7, v10.8.0, opt-in)
155
+ ### Verify-by-Test Triage (Phase 4 Step 3.7, opt-in)
156
156
 
157
157
  A triage verdict is a judgment call; a failing repro test is proof. When `prefs.global.verifyByTest.enabled` is on, one verifier agent (default Sonnet) writes a minimal repro test per accepted blocking finding (cap: `maxFindings`=3) and runs only that test. Fails as predicted -> finding confirmed, the repro test becomes the Phase 3 rework RED test. Passes under `evidence-gate.mjs` -> finding downgraded to `deferred`. Compile error / timeout -> `inconclusive`, judgment stands. Timeout-bounded, never blocks. Full spec: `refs/features/verify-by-test.md`.
158
158
 
159
- ### Immutable-Test Rule + `test_lines_removed` Signal (v10.8.0)
159
+ ### Immutable-Test Rule + `test_lines_removed` Signal
160
160
 
161
161
  Existing tests are immutable during a task: deleting, renaming, or weakening an assertion to reach green is a violation (`refs/rules.md`, Phase 3 GREEN step). A test changes only when the task changes the spec it encodes, named in the commit body. Deterministic backstop: `diff-risk-score.mjs` emits `test_lines_removed` (w=3.0) for any test-classified file whose diff removes more lines than it adds.
162
162
 
163
- ### Structured Handoff Blocks (v10.8.0)
163
+ ### Update Check at Run Start
164
+
165
+ Phase 0 Step 0.6, opt-out via `prefs.global.updateCheck`. Once per `ttlHours` window (cached, 3s-bounded curl to the npm registry), the installed version is compared against `dist-tags.latest`. Newer version: interactive modes ask "Update now?" (yes runs the `/multi-agent:update` flow, then the run continues); autopilot logs one line and never asks. `autoUpdate: true` updates silently before the worktree exists. Offline and failed checks are silent - never blocks.
166
+
167
+ ### Structured Handoff Blocks
164
168
 
165
169
  Every phase transition appends a `## Handoff` block (Done / Remaining / Decisions / Open findings / Next) to `agent-log.md` - orchestrator-written from existing state, no LLM call. `/multi-agent:resume` and post-`/compact` re-grounding read the latest handoff first, so long runs re-enter from durable artifacts instead of conversation memory (fresh-context discipline from Anthropic's long-running-agent harness guidance).
166
170
 
@@ -174,7 +178,7 @@ If changes include UI files, reviewers check for:
174
178
 
175
179
  Pure code analysis — no simulator needed. Device-level audits run in Phase 5 when requested.
176
180
 
177
- ### Status Enforcement (v1.5.0)
181
+ ### Status Enforcement
178
182
 
179
183
  Phase 3 marks issue-tracker status update as MANDATORY with a post-mutation verify step that re-reads the field and retries once on silent `VALIDATION` failures (e.g. stale Projects V2 option IDs after a board rebuild).
180
184
 
@@ -187,49 +191,49 @@ Phase 3 marks issue-tracker status update as MANDATORY with a post-mutation veri
187
191
 
188
192
  ## Testing & Quality
189
193
 
190
- ### Schema-Validated State (v2.0.0)
194
+ ### Schema-Validated State
191
195
 
192
196
  All critical state files are schema-validated at read and write time:
193
197
 
194
198
  - `agent-state.schema.json` — validates `$HOME/.claude/logs/multi-agent/.../agent-state.json`
195
- - `prefs.schema.json` — validates `$HOME/.claude/multi-agent-preferences.json` (extended v2.5.0)
196
- - `triage-output.schema.json` — validates triage output (v2.3.0, hardened v2.6.1, `if`/`then` constraint v3.0.0)
199
+ - `prefs.schema.json` — validates `$HOME/.claude/multi-agent-preferences.json`
200
+ - `triage-output.schema.json` — validates triage output (contradiction `if`/`then` constraint built in)
197
201
 
198
- ### Smoke Test Suites (v2.0.0–v2.5.0)
202
+ ### Smoke Test Suites
199
203
 
200
204
  10 suites: add-detail (14 body-preservation assertions), review-triage (validator exit codes), prefs (schema round-trip), state (agent-state lifecycle), metrics (telemetry emission), sync (instruction parity), secret-scan (hook patterns), phase-banner (terminal UI), token-budget (per-phase limits), phase-tracker (progress tracking).
201
205
 
202
- ### Adversarial Eval Fixtures (v2.5.0–v2.6.0)
206
+ ### Adversarial Eval Fixtures
203
207
 
204
208
  10 fixtures that test triage resilience against adversarial reviewer output: over-rejection, hallucinated findings, contradictions, invalid JSON, schema violations, duplicate findings, scope creep, empty results, timeout simulation, and combined edge cases.
205
209
 
206
- ### Sync Parity Check (v2.3.0)
210
+ ### Sync Parity Check
207
211
 
208
212
  Detects drift between Claude Code instructions (`~/.claude/commands/multi-agent.md`), Copilot CLI instructions (`~/.copilot/copilot-instructions.md`), and the repo's pipeline spec files. Reports discrepancies during Phase 0 Init.
209
213
 
210
- ### Token Budget Enforcement (v3.0.0)
214
+ ### Token Budget Enforcement
211
215
 
212
216
  Per-phase token budgets prevent runaway sessions. If a phase exceeds its budget, the pipeline pauses and offers: continue (extend budget), skip phase, or abort. Budgets are configurable in `prefs.global.tokenBudgets`.
213
217
 
214
218
  ## Telemetry & Observability
215
219
 
216
- - **Pipeline Metrics** (v2.3.0): Structured metrics to `metrics.jsonl` via `log-metric.sh`. Aggregated by `aggregate-metrics.mjs`.
217
- - **Cost Telemetry** (v2.5.0): Per-phase token cost tracking (`tokens_in`, `tokens_out`, `model`, `duration_ms`). Omitted fields handled gracefully.
218
- - **Phase Tracker** (v2.4.0): Cross-CLI visual progress (current phase, elapsed time, iteration count).
219
- - **Phase Banner** (v2.4.0): Terminal UI for phase transitions with Unicode box-drawing characters.
220
- - **Per-task Cost Breakdown in agent-log.md** (v8.3.0): Phase 7 appends a 4-column block (Phase · Model · Tokens in/out · Est. USD) to every run's `agent-log.md`. Sourced from `phase-tracker.sh tokens` accumulators × `cost-table.json` prices. Independent of the channels-side `reportContent.costSummary` toggle. The `LOG_METRIC_FORWARD_TO_TRACKER=1` env flag mirrors `tokens_in`/`tokens_out`/`model` from `log-metric.sh` into the tracker so JSONL metrics and the cost block stay in sync from one call site.
220
+ - **Pipeline Metrics**: Structured metrics to `metrics.jsonl` via `log-metric.sh`. Aggregated by `aggregate-metrics.mjs`.
221
+ - **Cost Telemetry**: Per-phase token cost tracking (`tokens_in`, `tokens_out`, `model`, `duration_ms`). Omitted fields handled gracefully.
222
+ - **Phase Tracker**: Cross-CLI visual progress (current phase, elapsed time, iteration count).
223
+ - **Phase Banner**: Terminal UI for phase transitions with Unicode box-drawing characters.
224
+ - **Per-task Cost Breakdown in agent-log.md**: Phase 7 appends a 4-column block (Phase · Model · Tokens in/out · Est. USD) to every run's `agent-log.md`. Sourced from `phase-tracker.sh tokens` accumulators × `cost-table.json` prices. Independent of the channels-side `reportContent.costSummary` toggle. The `LOG_METRIC_FORWARD_TO_TRACKER=1` env flag mirrors `tokens_in`/`tokens_out`/`model` from `log-metric.sh` into the tracker so JSONL metrics and the cost block stay in sync from one call site.
221
225
 
222
- ### Diff Risk Scoring (v8.3.0)
226
+ ### Diff Risk Scoring
223
227
 
224
228
  `pipeline/scripts/diff-risk-score.mjs` runs at Phase 4 Step 1.75 — before reviewer dispatch. Heuristic, deterministic, sub-second, no LLM. Top-N risk-ranked files inject into each reviewer's prompt as a `${PRIORITY_FILES}` block; reviewers read those files first but still review the entire diff.
225
229
 
226
- Signals + weights: `security_path` ×3, `migration` ×4, `public_api` ×2, `no_test_change` ×2.5, `test_lines_removed` ×3 (v10.8.0: test file shrinks - immutable-test backstop), `complexity_delta` ×1.5, `ui_critical` ×1.5, `loc_changed` ×1. Toggle via `prefs.global.diffRiskAdvisory` (default ON).
230
+ Signals + weights: `security_path` ×3, `migration` ×4, `public_api` ×2, `no_test_change` ×2.5, `test_lines_removed` ×3 (test file shrinks - immutable-test backstop), `complexity_delta` ×1.5, `ui_critical` ×1.5, `loc_changed` ×1. Toggle via `prefs.global.diffRiskAdvisory` (default ON).
227
231
 
228
- ### Test Gap Detection (v8.3.0)
232
+ ### Test Gap Detection
229
233
 
230
234
  `pipeline/scripts/test-gap-scan.mjs` runs at Phase 5 Step 0. Walks the diff for newly added public symbols and reports those with no paired test. Stack-specific rules ship for iOS, Android, Python, Node.js. iOS Views and Android `@Composable` symbols default to `important`; other public API additions to `suggestion`. Optional gating via `prefs.testGap.blockingThreshold` — when set, the report becomes a Phase 4 rework finding once `important + blocking` count exceeds the threshold.
231
235
 
232
- ### Triage Memory (v8.3.0)
236
+ ### Triage Memory
233
237
 
234
238
  Per-repo append-only JSONL corpus at `~/.claude/memory/multi-agent/<repo-slug>/triage-corpus.jsonl`. Phase 7 ingests every triage output (idempotent), Phase 1 enriches the analysis with similar past tasks, Phase 4 triage attaches prior-art hits to each raw finding with an explicit bias hedge. Token-overlap recall, zero deps, Node-18-compatible. `/multi-agent:search "<text>" --semantic` routes the query to the corpus instead of agent-log grep. Toggle via `prefs.global.priorArtEnrichment.enabled` (default ON).
235
239
 
@@ -280,10 +284,10 @@ Token registry maps logical names (`jira`, `bitbucket`, `github`, `confluence`)
280
284
 
281
285
  ## Schemas & Validation
282
286
 
283
- - `pipeline/schemas/agent-state.schema.json` — validates agent state lifecycle (v2.0.0)
284
- - `pipeline/schemas/prefs.schema.json` — validates preferences (v2.0.0, extended v2.5.0)
285
- - `pipeline/schemas/triage-output.schema.json` — validates triage output (v2.3.0, hardened v2.6.1, `if`/`then` constraint v3.0.0)
287
+ - `pipeline/schemas/agent-state.schema.json` — validates agent state lifecycle
288
+ - `pipeline/schemas/prefs.schema.json` — validates preferences
289
+ - `pipeline/schemas/triage-output.schema.json` — validates triage output (contradiction `if`/`then` constraint built in)
286
290
 
287
- ## File Layout (v1.9.0)
291
+ ## File Layout
288
292
 
289
293
  `commands/multi-agent/{add-detail,setup,help}.md` → slash commands. `commands/multi-agent/refs/**` → guides, phase specs, rules (`refs:` prefix signals "not an action"). Modifier flags and ops stay inline in `multi-agent.md`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmerterden/multi-agent-pipeline",
3
- "version": "10.8.0",
3
+ "version": "10.12.0",
4
4
  "description": "8-phase AI development pipeline with full orchestration on Claude Code and Copilot CLI. Analysis, planning, TDD, CLI-aware parallel review with consensus surfacing + Fable triage, default-FAIL evidence gates, secret + intent guards, per-phase cost ledger, persistent learnings memory, wiki generation, commit automation. Token-preserving uninstall.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -34,7 +34,7 @@ Target resolution is identical to the pre-existing enrich flow - any of the 6
34
34
 
35
35
  ## Flow
36
36
 
37
- `resolve target → fetch context → menu (or flags) → generator → humanizer → dispatch → summary`. Channels: Jira comment, Confluence page, Wiki pages, PR description, Board status (GitHub Projects v2).
37
+ `resolve target → fetch context → menu (or flags) → generator → humanizer → approval → dispatch → summary`. Channels: Jira comment, Confluence page, Wiki pages, PR description, Board status (GitHub Projects v2).
38
38
 
39
39
  ### Step 1 - Target resolution
40
40
 
@@ -49,7 +49,7 @@ Target resolution is identical to the pre-existing enrich flow - any of the 6
49
49
 
50
50
  **Multi-repo:** when `agent-state.json` `projects[].length > 1`, Step 1 builds **one target per project**. Each project's PR is resolved via `pr` field in its projects[] entry; if missing, the Jira/Issue link query returns multiple PRs (one per repo) - all are added to `targets[]`. The project at `projects[0]` (or whose name matches `state.project`) is marked `isPrimary: true`; others are `isPrimary: false`.
51
51
 
52
- For single-repo tasks, `targets` has exactly one entry. The rest of the flow is target-aware: Step 5 generates one body, Step 6 dispatches to each target, with cross-links (see below).
52
+ For single-repo tasks, `targets` has exactly one entry. The rest of the flow is target-aware: Step 5 generates one body, Step 7 dispatches to each target, with cross-links (see below).
53
53
 
54
54
  ### Step 2 - Context source detection
55
55
 
@@ -298,9 +298,44 @@ Generated by `pipeline/scripts/render-cost-summary.sh <task-id>` using prices fr
298
298
 
299
299
  **Target length rule:** full body fits one screen on a typical laptop (< 80 lines). Auto-diff summary capped at 5 lines per section. No framework-theory paragraphs, no numbered "why this approach" lists.
300
300
 
301
- ### Step 6 - Channel dispatch
301
+ ### Step 6 - Body preview + approval gate (interactive modes)
302
302
 
303
- For each selected **channel**, call the corresponding adapter. Adapters run **in parallel** - one failure does not block others.
303
+ Plan-mode-style gate: the user sees exactly what will be posted BEFORE any external write. Runs after the generator + humanizer, before Step 7 dispatch, in every interactive invocation - menu mode AND `--channels`/`--content` flag mode alike (flags pick the targets, they do not waive the content approval).
304
+
305
+ Skipped in exactly two cases:
306
+
307
+ | Case | Why |
308
+ |---|---|
309
+ | Autopilot (`state.autopilot === true` or `MULTI_AGENT_AUTOPILOT=1`) | Explicit consent for side-effect creation - posts directly with prefs/flag selections, zero interaction |
310
+ | `--dry-run` | Already prints without posting; a question would be redundant |
311
+
312
+ **Preview render** (one block per selected channel, final body after humanizer - shown in readable Markdown, channel-specific markup conversion happens after approval):
313
+
314
+ ```
315
+ ── PR description ({repoName} #{prNumber}, replace) ─────────
316
+ {body}
317
+ ── Jira comment ({jiraId}) ──────────────────────────────────
318
+ {body}
319
+ ── Confluence page ("{title}" under {parentUrl}) ────────────
320
+ {body}
321
+ ```
322
+
323
+ Secondary artifacts ride along as one-line intents at the bottom of the preview: Wiki page list, wiki → Jira triad comment (when Wiki is selected and the triad is active per `refs/issue-jira-triad.md`), Board status move (`{from} → {to}`), GitHub issue comment + Progress-flag sync (Phase 7 Step 1.5 - same gate, see `refs/phases/phase-7-report.md`).
324
+
325
+ **Then a single AskUserQuestion** (`question`/`description` in `outputLanguage`; `label`/`header` English):
326
+
327
+ | Option | Behavior |
328
+ |---|---|
329
+ | `Approve & post` | Step 7 dispatches every previewed body verbatim |
330
+ | `Edit` | Free-text "which channel, what should change" → apply → re-render the FULL preview → re-ask (loop, no cap) |
331
+ | `Skip channels` | multiSelect which channels to drop this run → re-render remaining → re-ask |
332
+ | `Cancel` | Abort dispatch entirely - nothing posted anywhere. Internal capture (agent-log, knowledge) is unaffected |
333
+
334
+ **Hard rule:** what is posted is byte-identical to the approved preview (markup conversion excepted). Any body regeneration after approval invalidates the approval and re-runs the gate. Persisting channel prefs (Step 8) still happens on `Cancel` - selection memory and content approval are independent.
335
+
336
+ ### Step 7 - Channel dispatch
337
+
338
+ For each selected **channel**, call the corresponding adapter. Adapters run **in parallel** - one failure does not block others. Dispatch NEVER starts before the Step 6 gate resolves (`Approve & post`), except in the two documented skip cases (autopilot, `--dry-run`).
304
339
 
305
340
  **Multi-repo dispatch:** When `state.projects[].length > 1`, the dispatcher delegates per-channel rendering to `~/.claude/lib/channels-multi-repo.sh`:
306
341
 
@@ -358,7 +393,7 @@ Full contract: [`refs/channels/confluence.md`](refs/channels/confluence.md) -
358
393
 
359
394
  Full contract: [`refs/channels/wiki.md`](refs/channels/wiki.md) - all four `figma-config.wiki.mode` adapters (submodule / in-repo / github-wiki / separate-repo), full Case A scope menu, screenshot quadrant gate.
360
395
 
361
- ### Step 7 - Summary
396
+ ### Step 8 - Summary
362
397
 
363
398
  After all adapters complete (or fail non-blocking):
364
399
 
@@ -397,6 +432,7 @@ Persist selections to `prefs.global.reportChannels` + `prefs.global.reportConten
397
432
  - **No markers** - channels does a full replace each run; no `<!-- channels:start -->` bookmarks.
398
433
  - **Every body item references a symbol/file/line** from diff or pipeline log. No generic "tested the feature" sentences.
399
434
  - **Adapter failures are non-blocking** - one channel failing does not abort others. Final summary shows per-adapter status.
435
+ - **Approval before post** - interactive runs never write to an external channel without the Step 6 preview + approval. Autopilot and `--dry-run` are the only bypasses.
400
436
 
401
437
  ## Error handling
402
438
 
@@ -423,7 +459,7 @@ Phase 7 invokes this command internally instead of running its own inline Jira/C
423
459
 
424
460
  Phase 7 passes a runtime state bundle: `{jiraId, prUrl, remoteType, taskType, figmaConfig, agentState, pipelineLogPath}`. `channels` reads these directly, skips target-resolution Step 1.
425
461
 
426
- **Autopilot contract:** Phase 7 ALWAYS pauses at the channels menu (breaks generic autopilot zero-interaction). 30-min timeout → session ends cleanly, task resumable via `/multi-agent:resume`. See `refs/phases/modes.md` for full contract.
462
+ **Autopilot contract:** Phase 7 ALWAYS pauses at the channels menu (breaks generic autopilot zero-interaction). 30-min timeout → session ends cleanly, task resumable via `/multi-agent:resume`. See `refs/phases/modes.md` for full contract. The Step 6 body preview + approval gate follows the same split: interactive runs approve the composed bodies before dispatch; autopilot posts directly after the menu resolves.
427
463
 
428
464
  ## Cross-CLI parity
429
465
 
@@ -65,25 +65,34 @@ Phases 1-3 (Analysis / Planning / Dev) are skipped by design - `finish` treats
65
65
 
66
66
  ## Required: Phase Tracker Contract
67
67
 
68
- **The phase tracker is mandatory.** Full spec: [`refs/tracker-contract.md`](./refs/tracker-contract.md). `finish` registers only its active phase set - `0:Init 4:Review 5:Build+Test 6:Commit 7:Report` (phases 1-3 are not part of the finish set; do not register tiles for them).
68
+ **The phase tracker is required.** Full spec: [`refs/tracker-contract.md`](./refs/tracker-contract.md). `finish` registers its active phase set - `0:Init 4:Review 5:Build+Test 6:Commit 7:Report` - but NEVER resets a tracker that an earlier run already built (load-or-continue; contract section "Continuation runs"):
69
69
 
70
70
  ```bash
71
- # Phase 0, first shell call (every CLI):
72
- bash $HOME/.claude/scripts/phase-tracker.sh init "$TASK_ID"
71
+ # Phase 0, first shell call (every CLI). init ONLY when no prior state exists -
72
+ # a task handed off from Phase 5 ("awaiting local test") keeps its full
73
+ # phase 0-3 history (elapsed, tokens, USD).
74
+ STATE="$HOME/.claude/logs/multi-agent/${TASK_ID}/tracker-state.json"
75
+ if [ ! -f "$STATE" ]; then
76
+ bash $HOME/.claude/scripts/phase-tracker.sh init "$TASK_ID"
77
+ fi
73
78
  for p in "0:Init" "4:Review" "5:Build+Test" "6:Commit" "7:Report"; do
74
- bash $HOME/.claude/scripts/phase-tracker.sh add "${p%%:*}" "${p#*:}"
79
+ bash $HOME/.claude/scripts/phase-tracker.sh add "${p%%:*}" "${p#*:}" # idempotent: existing phases keep their history
75
80
  done
76
81
  bash $HOME/.claude/scripts/phase-tracker.sh update 0 in_progress
77
82
 
78
83
  # Every phase boundary (every CLI):
79
84
  bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress|completed|failed|skipped
80
85
  # After every LLM call (every CLI):
81
- bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out>
86
+ bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out> [cached]
82
87
  ```
83
88
 
89
+ **Continuation path (prior state existed):** (1) if Phase 5 was left `in_progress` with `Now: awaiting local test (user)`, mark it `update 5 completed` + `meta 5 Result "local test done (user)"` before finish's own work (finish re-opens it with `update 5 in_progress` when its Build+Test gate runs; elapsed keeps the original `started_at`, which is expected); (2) print ONE line in `outputLanguage` summarizing the inherited history, e.g. `Continuing PROJ-12345: phases 0-3 finished earlier (12m, 38.4k tok, ~$0.74)` (USD via `phase-tracker.sh cost total`); (3) `render`.
90
+
84
91
  ### Visual channel - Claude Code (native TaskList widget, required)
85
92
 
86
- Register one tile per phase in **strict creation order** (`0 → 4 → 5 → 6 → 7`) BEFORE any TaskUpdate, capture each `taskId`, persist via `phase-tracker.sh meta <N> tasklist_id "<taskId>"`, then flip status with `TaskUpdate` at each boundary. Out-of-order TaskCreate scrambles the tile stack. Full contract: `refs/tracker-contract.md` "TaskCreate ordering (strict)".
93
+ Fresh state: register one tile per phase in strict phase-number order (`0 → 4 → 5 → 6 → 7`) BEFORE any TaskUpdate, capture each `taskId`, persist via `phase-tracker.sh meta <N> tasklist_id "<taskId>"`, then flip status with `TaskUpdate` at each boundary. Out-of-order TaskCreate scrambles the tile stack. Full contract: `refs/tracker-contract.md` "TaskCreate ordering (strict)".
94
+
95
+ Continuation: rebuild the FULL TaskList from the state file (completed 0-3 tiles included) in phase order before any `TaskUpdate`, refreshing every `tasklist_id` meta - same as the contract's "Resume behaviour".
87
96
 
88
97
  ### Visual channel - Copilot CLI / plain shell
89
98