@mmerterden/multi-agent-pipeline 20.13.0 → 20.15.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 (153) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +8 -6
  3. package/README.tr.md +7 -5
  4. package/docs/architecture.md +3 -3
  5. package/docs/ecosystem.md +5 -5
  6. package/docs/facts.json +4 -4
  7. package/install/catalog-history.json +1 -1
  8. package/manifest.json +156 -96
  9. package/package.json +1 -1
  10. package/pipeline/commands/multi-agent/analysis/SKILL.md +11 -80
  11. package/pipeline/commands/multi-agent/autopilot/SKILL.md +2 -23
  12. package/pipeline/commands/multi-agent/autopilot-off/SKILL.md +24 -45
  13. package/pipeline/commands/multi-agent/channels/SKILL.md +11 -63
  14. package/pipeline/commands/multi-agent/design-check/SKILL.md +43 -178
  15. package/pipeline/commands/multi-agent/diff-explain/SKILL.md +2 -0
  16. package/pipeline/commands/multi-agent/estimate/SKILL.md +65 -0
  17. package/pipeline/commands/multi-agent/help/SKILL.md +5 -546
  18. package/pipeline/commands/multi-agent/kill/SKILL.md +13 -18
  19. package/pipeline/commands/multi-agent/refactor/SKILL.md +7 -76
  20. package/pipeline/commands/multi-agent/review-analysis/SKILL.md +1 -1
  21. package/pipeline/commands/multi-agent/scenario-audit/SKILL.md +79 -0
  22. package/pipeline/commands/multi-agent/serve/SKILL.md +6 -3
  23. package/pipeline/commands/multi-agent/setup/SKILL.md +12 -365
  24. package/pipeline/commands/multi-agent/status/SKILL.md +2 -0
  25. package/pipeline/commands/multi-agent/store-ready/SKILL.md +56 -184
  26. package/pipeline/commands/multi-agent/sync/SKILL.md +14 -267
  27. package/pipeline/contract/CHANGELOG.md +52 -0
  28. package/pipeline/contract/README.md +41 -1
  29. package/pipeline/contract/build.mjs +49 -7
  30. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  31. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  32. package/pipeline/contract/fixtures/error-unsigned.json +1 -1
  33. package/pipeline/contract/fixtures/launch-plan.json +1 -2
  34. package/pipeline/contract/fixtures/runs-awaiting-question.json +10 -3
  35. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  36. package/pipeline/contract/fixtures/runs-failed.json +19 -6
  37. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +25 -8
  38. package/pipeline/contract/fixtures/runs-pr-opened.json +25 -8
  39. package/pipeline/contract/fixtures/runs-running.json +31 -4
  40. package/pipeline/contract/frozen/toolbox.json +13 -0
  41. package/pipeline/contract/manifest.json +112 -10
  42. package/pipeline/contract/types/index.d.ts +186 -17
  43. package/pipeline/lib/claude-sessions.mjs +93 -0
  44. package/pipeline/lib/credential-resolve.mjs +39 -0
  45. package/pipeline/lib/gc-report.sh +64 -0
  46. package/pipeline/lib/unattended-settings-location.mjs +4 -0
  47. package/pipeline/lib/workspace-trust.mjs +73 -0
  48. package/pipeline/multi-agent-refs/analysis/intake.md +5 -3
  49. package/pipeline/multi-agent-refs/analysis/locked.md +8 -7
  50. package/pipeline/multi-agent-refs/analysis/render.md +4 -3
  51. package/pipeline/multi-agent-refs/analysis/resolve.md +1 -1
  52. package/pipeline/multi-agent-refs/analysis/resume.md +37 -0
  53. package/pipeline/multi-agent-refs/analysis/reusable-refs.md +25 -0
  54. package/pipeline/multi-agent-refs/channels/board.md +17 -0
  55. package/pipeline/multi-agent-refs/channels/multi-repo.md +15 -0
  56. package/pipeline/multi-agent-refs/cross-cli-contract.md +4 -4
  57. package/pipeline/multi-agent-refs/design-check/build-launch.md +14 -0
  58. package/pipeline/multi-agent-refs/design-check/compare.md +44 -0
  59. package/pipeline/multi-agent-refs/design-check/drive-capture.md +35 -0
  60. package/pipeline/multi-agent-refs/design-check/export.md +37 -0
  61. package/pipeline/multi-agent-refs/design-check/figma-mapping.md +11 -0
  62. package/pipeline/multi-agent-refs/design-check/init-inventory.md +56 -0
  63. package/pipeline/multi-agent-refs/design-check/mcp-currency-gate.md +41 -0
  64. package/pipeline/multi-agent-refs/features/analysis-outline.md +55 -0
  65. package/pipeline/multi-agent-refs/features/analysis-sources.md +60 -0
  66. package/pipeline/multi-agent-refs/help/en.md +273 -0
  67. package/pipeline/multi-agent-refs/help/tr.md +271 -0
  68. package/pipeline/multi-agent-refs/orchestrator/operations.md +99 -0
  69. package/pipeline/multi-agent-refs/orchestrator/phase-0-projects.md +72 -0
  70. package/pipeline/multi-agent-refs/orchestrator/phase-3-user-test.md +40 -0
  71. package/pipeline/multi-agent-refs/orchestrator/phase-4-5-projects.md +68 -0
  72. package/pipeline/multi-agent-refs/orchestrator/skill-loading.md +99 -0
  73. package/pipeline/multi-agent-refs/phases/phase-0-init.md +3 -2
  74. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +1 -1
  75. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +1 -1
  76. package/pipeline/multi-agent-refs/picker-contract.md +29 -0
  77. package/pipeline/multi-agent-refs/refactor/drift.md +49 -0
  78. package/pipeline/multi-agent-refs/refactor/run-errors.md +46 -0
  79. package/pipeline/multi-agent-refs/setup/discovery.md +84 -0
  80. package/pipeline/multi-agent-refs/setup/figma.md +27 -0
  81. package/pipeline/multi-agent-refs/setup/identity-routing.md +60 -0
  82. package/pipeline/multi-agent-refs/setup/token-save-flow.md +201 -0
  83. package/pipeline/multi-agent-refs/store-ready/build.md +49 -0
  84. package/pipeline/multi-agent-refs/store-ready/gate-1-static.md +37 -0
  85. package/pipeline/multi-agent-refs/store-ready/gate-3-policy.md +31 -0
  86. package/pipeline/multi-agent-refs/store-ready/preflight.md +50 -0
  87. package/pipeline/multi-agent-refs/store-ready/report.md +40 -0
  88. package/pipeline/multi-agent-refs/sync/codex.md +43 -0
  89. package/pipeline/multi-agent-refs/sync/dev-toolkit.md +174 -0
  90. package/pipeline/multi-agent-refs/sync/stack-plugins.md +51 -0
  91. package/pipeline/multi-agent-refs/tracker-contract.md +29 -4
  92. package/pipeline/schemas/agent-state.schema.json +13 -4
  93. package/pipeline/schemas/analysis-spec.schema.json +56 -4
  94. package/pipeline/schemas/autopilot-off-request.schema.json +20 -0
  95. package/pipeline/schemas/autopilot-off.schema.json +24 -0
  96. package/pipeline/schemas/autopilot-status.schema.json +63 -0
  97. package/pipeline/schemas/contract-error.schema.json +13 -2
  98. package/pipeline/schemas/gc-request.schema.json +31 -0
  99. package/pipeline/schemas/gc.schema.json +116 -0
  100. package/pipeline/schemas/kill-request.schema.json +22 -0
  101. package/pipeline/schemas/kill.schema.json +118 -0
  102. package/pipeline/schemas/launch-plan.schema.json +11 -2
  103. package/pipeline/schemas/launch-request.schema.json +7 -2
  104. package/pipeline/schemas/launch.json +65 -4
  105. package/pipeline/schemas/launch.schema.json +23 -8
  106. package/pipeline/schemas/prefs.schema.json +3 -3
  107. package/pipeline/schemas/repos.schema.json +39 -0
  108. package/pipeline/schemas/resume-request.schema.json +37 -0
  109. package/pipeline/schemas/run-log.schema.json +32 -0
  110. package/pipeline/schemas/run-questions.json +5 -1
  111. package/pipeline/schemas/run-questions.schema.json +1 -1
  112. package/pipeline/schemas/runs-index.schema.json +59 -3
  113. package/pipeline/scripts/_run-paths.mjs +8 -2
  114. package/pipeline/scripts/analysis-conform-coverage.mjs +96 -0
  115. package/pipeline/scripts/analysis-sources.mjs +264 -0
  116. package/pipeline/scripts/autopilot-control.mjs +223 -0
  117. package/pipeline/scripts/autopilot-runner.mjs +14 -39
  118. package/pipeline/scripts/build-references.mjs +5 -1
  119. package/pipeline/scripts/confluence-readback.mjs +4 -23
  120. package/pipeline/scripts/contract-server.mjs +373 -7
  121. package/pipeline/scripts/doctor.mjs +5 -2
  122. package/pipeline/scripts/estimate.mjs +223 -0
  123. package/pipeline/scripts/gate-ledger.mjs +64 -3
  124. package/pipeline/scripts/gc-plan.mjs +288 -0
  125. package/pipeline/scripts/gc-refs.sh +33 -2
  126. package/pipeline/scripts/gc-tmp.sh +33 -2
  127. package/pipeline/scripts/gc-worktrees.sh +42 -3
  128. package/pipeline/scripts/gen-mode-dispatch.mjs +3 -24
  129. package/pipeline/scripts/launch-request.mjs +182 -10
  130. package/pipeline/scripts/phase-tracker.sh +62 -1
  131. package/pipeline/scripts/run-kill.mjs +232 -0
  132. package/pipeline/scripts/run-log.mjs +111 -0
  133. package/pipeline/scripts/runs-index.mjs +177 -11
  134. package/pipeline/scripts/scenario-audit.mjs +245 -0
  135. package/pipeline/scripts/validate-analysis-doc.mjs +84 -6
  136. package/pipeline/skills/.skill-manifest.json +24 -16
  137. package/pipeline/skills/shared/README.md +5 -3
  138. package/pipeline/skills/shared/core/multi-agent/SKILL.md +51 -450
  139. package/pipeline/skills/shared/core/multi-agent-analysis/SKILL.md +7 -1
  140. package/pipeline/skills/shared/core/multi-agent-autopilot-off/SKILL.md +26 -44
  141. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +31 -127
  142. package/pipeline/skills/shared/core/multi-agent-estimate/SKILL.md +61 -0
  143. package/pipeline/skills/shared/core/multi-agent-kill/SKILL.md +14 -19
  144. package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +7 -76
  145. package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +1 -1
  146. package/pipeline/skills/shared/core/multi-agent-review-analysis/SKILL.md +1 -1
  147. package/pipeline/skills/shared/core/multi-agent-review-issue/SKILL.md +1 -1
  148. package/pipeline/skills/shared/core/multi-agent-review-jira/SKILL.md +1 -1
  149. package/pipeline/skills/shared/core/multi-agent-scenario-audit/SKILL.md +77 -0
  150. package/pipeline/skills/shared/core/multi-agent-serve/SKILL.md +6 -3
  151. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +205 -324
  152. package/pipeline/skills/shared/core/multi-agent-store-ready/SKILL.md +5 -0
  153. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmerterden/multi-agent-pipeline",
3
- "version": "20.13.0",
3
+ "version": "20.15.0",
4
4
  "description": "6-phase AI development pipeline with full orchestration on Claude Code, Copilot CLI and Codex 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",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: "Standalone feature-spec analysis. Two profiles picked at intake: global (23-section development handoff, evidence-trimmed) or corporate (IG/UC/FG requirements document with traceability matrices). Platform-agnostic concept layer with repo-driven convention extraction (Phase 1c) and per-platform Pass B render; stack selection is optional. Collects Figma / Swagger / Confluence / Jira / Standards (Confluence + Wiki + local file) / Firebase / repo inputs. Stops after emit - does not chain into a dev run. Use when a feature needs a written specification before any code."
3
3
  description-tr: "Bağımsız özellik-spesifikasyonu analizi. Girişte iki profil: global (23 bölümlük geliştirme dokümanı, kanıta göre budanır) veya kurumsal (izlenebilirlik matrisleriyle IG/UC/FG gereksinim dokümanı). Repo'dan konvansiyon çıkarımıyla (Faz 1c) platform-bağımsız kavram katmanı ve platform başına Pass B render; stack seçimi opsiyonel. Figma / Swagger / Confluence / Jira / Standartlar (Confluence + Wiki + yerel dosya) / Firebase / repo girdilerini toplar. Çıktıyı üretince durur - dev koşusuna zincirlenmez."
4
- argument-hint: "[\"<analysis-name>\"] [--no-cache] [--preview-conventions]"
4
+ argument-hint: "[\"<analysis-name>\" | check <doc.md> | refresh <doc.md> | conform <doc.md>] [--no-cache] [--preview-conventions]"
5
5
  parameters: [{"name":"name","kind":"text"},{"name":"--no-cache","kind":"flag"},{"name":"--preview-conventions","kind":"flag"}]
6
6
  gui: form
7
7
  destructive: false
@@ -11,6 +11,8 @@ confirm: none
11
11
  # multi-agent analysis - Feature Spec Analysis (v3)
12
12
 
13
13
  > **Pickers follow** `$HOME/.claude/multi-agent-refs/picker-contract.md`: never a one-option call, and branch on the option selected, not on its text.
14
+ >
15
+ > **Background runs** (`MULTI_AGENT_UNATTENDED=1`, no `autopilot`): never ask or default a picker; write `agent-state.json`, park on the question, stop (`$HOME/.claude/multi-agent-refs/picker-contract.md`, Background).
14
16
 
15
17
  This command is **independent** from the orchestrator's Phase 1 analysis (which is a stack/findings detector inside `/multi-agent`). It produces a stakeholder-ready, platform-agnostic feature-spec document - up to 23 sections, trimmed to whatever the evidence supports - before any implementation starts. Each per-platform file is rendered by projecting concept-layer content onto repo-extracted conventions (Pass B).
16
18
 
@@ -29,13 +31,15 @@ This command is **independent** from the orchestrator's Phase 1 analysis (which
29
31
 
30
32
  These decisions are settled. Do not surface them as `AskUserQuestion` items, do not re-derive them from context, do not invite the user to override mid-run. If the user explicitly wants one of them changed, treat that as a separate request and update this list.
31
33
 
32
- The full list of 36, with the category index, lives in `$HOME/.claude/multi-agent-refs/analysis/locked.md`. Read it before the run starts; it is the contract the whole flow is judged against. `/multi-agent:analysis-resolve` inherits the same list.
34
+ The full list of 37, with the category index, lives in `$HOME/.claude/multi-agent-refs/analysis/locked.md`. Read it before the run starts; it is the contract the whole flow is judged against. `/multi-agent:analysis-resolve` inherits the same list.
33
35
 
34
36
  Cite a decision as `Locked <n> (<short label>)` so the category is inferable.
35
37
 
36
38
  ## Input
37
39
 
38
40
  - `$ARGUMENTS` - optional analysis name (e.g. `"UserProfile"`). If empty, asked at Phase 0 Step 1. Stored internally as `state.analysisSpec.featureName` for backward compatibility.
41
+ - `check <doc.md>` / `refresh <doc.md>` - not a name: compare the document with its sources, or redraft from the stale ones. Read `$HOME/.claude/multi-agent-refs/features/analysis-sources.md` and follow it instead of the steps below.
42
+ - `conform <doc.md>` - not a name: map an existing document onto a template without changing what it says. Follow `$HOME/.claude/multi-agent-refs/features/analysis-outline.md` instead of the steps below.
39
43
 
40
44
  ## Profile
41
45
 
@@ -78,63 +82,11 @@ Full contract: `$HOME/.claude/multi-agent-refs/analysis/render.md`. Renders one
78
82
 
79
83
  ### Resume contract
80
84
 
81
- `state.analysisSpec.phase` enumeration:
82
-
83
- - `intake` (Phase 0 in progress)
84
- - `fetching` (Phase 1 in progress)
85
- - `collecting_repo_evidence` (Phase 1b)
86
- - `extracting_conventions` (Phase 1c)
87
- - `synthesizing_pass_a` (Phase 2 Pass A)
88
- - `awaiting_pass_b_approval` (Phase 2a - preview not yet answered)
89
- - `rendering_pass_b` (Phase 2b)
90
- - `drafting` (Phase 3)
91
- - `awaiting_output_decision` (Phase 3.5 - drafts written, picker not yet answered)
92
- - `dispatching` (Phase 4)
93
- - `reporting` (Phase 5)
94
- - `done`
95
- - `cancelled_at_pass_b_preview` (user cancelled at Phase 2a)
96
-
97
- When `/multi-agent:resume` is invoked and `phase == "awaiting_output_decision"`:
98
-
99
- 1. Check `state.analysisSpec.outputs.draftDir` exists on disk and contains the expected per-platform `.md` files.
100
- 2. If present, jump directly to Phase 3.5 (re-prompt the output picker; do not re-fetch evidence, do not re-synthesize).
101
- 3. If missing, print `WARN: scratch drafts at <draftDir> are gone; re-running Phase 2 synthesis from fetched evidence.` and restart from Phase 2 (cheap: evidence is still in state).
102
-
103
- When `phase == "awaiting_pass_b_approval"`:
104
-
105
- 1. Re-present the convention preview table (Phase 2a) with the same options.
106
- 2. Pass A synthesis results are kept in state; Phase 1b / 1c results are kept too.
107
- 3. Approval continues to Phase 2b without re-running anything.
108
-
109
- When `phase == "cancelled_at_pass_b_preview"`:
110
-
111
- 1. Print `state.analysisSpec.outputs.draftDir` (likely empty unless prior drafts exist from a previous run).
112
- 2. Show the convention preview that was rejected (for context).
113
- 3. Ask whether to restart from Phase 0, retry Phase 1c with fresh evidence, or abort.
85
+ Full procedure: `$HOME/.claude/multi-agent-refs/analysis/resume.md`. Read it when `/multi-agent:resume` is invoked on an analysis run (`state.analysisSpec.phase` enumeration and the re-entry rule per paused phase; evidence and synthesis already in state are never re-fetched).
114
86
 
115
87
  ## Reusable refs
116
88
 
117
- | Path | Reason |
118
- |------|--------|
119
- | `~/.claude/lib/submodule-detector.sh` | Phase 0 Step 4 repo discovery |
120
- | `~/.claude/lib/context-link-extractor.sh` | Phase 0 Step 5 source classifier for every question's Other input (handles `local-file`, `document`, `wiki`, `standards-confluence`, `generic-doc`, `firebase-events:names`, `firebase-events:schema`, `firebase-events:console` types) |
121
- | `~/.claude/lib/fetch-swagger.sh`, `fetch-confluence.sh` | Phase 1 fetchers |
122
- | Phase 1 wiki fetch chain (inline, no standalone script) | `git clone --depth 1 <repo>.wiki.git` first, `gh api repos/.../contents/<file>.md` second, WebFetch third - see the Phase 1 type table `wiki` row |
123
- | `~/.claude/lib/extract-conventions.sh` | Phase 1c convention extractor (7 pattern groups, JSON output, confidence levels) |
124
- | `~/.claude/lib/figma-screenshot.sh` | Phase 2b Tier 2 Figma image downloader (REST API, section drill, 2x scale PNG, manifest.json) |
125
- | `~/.claude/lib/md2confluence-v3.py` | Phase 4 Confluence dispatch (multipart attachments, `<ac:image>` injection, mermaid macro + fallback, tooltip footnote macro, punctuation gate) |
126
- | `ai-common-toolkit:humanizer` | Phase 3 tone pass |
127
- | 8-locale set (ar, de, en, es, fr, it, ru, tr) + localization-key naming (inline) | Section 10 localization generation |
128
- | `$HOME/.claude/multi-agent-refs/channels/confluence.md` | Phase 4 Confluence dispatch |
129
- | `$HOME/.claude/multi-agent-refs/channels/jira.md` | Phase 4 Jira dispatch |
130
- | `$HOME/.claude/rules/tdd.md` | Section 15 test naming |
131
- | `$HOME/.claude/multi-agent-refs/analysis-template.md` | Template master copy + language matrix (v3 - 23 sections) |
132
- | `$HOME/.claude/multi-agent-refs/conventions-defaults.md` | Pass B fallback defaults (4 platforms x 7 pattern groups) - applied when convention confidence is none AND standards binding is silent |
133
- | `$HOME/.claude/lib/jira-publish.sh` | Phase 4 Jira write: comment by default, description only on explicit choice - reads the current description first, backs it up, appends below a rule, refuses a non-empty replace without `--confirm-overwrite` |
134
- | `$HOME/.claude/scripts/validate-analysis-doc.mjs` | Phase 4 pre-dispatch gate: deterministic check of the emitted per-platform doc (front-matter, never-omitted sections, humanizer punctuation, BR traceability) |
135
- | a project-supplied Confluence-embedded API-table parser (optional) | Parse endpoints from a Confluence page's Request Path / Service Name / Response Body table columns |
136
- | `~/<project>-Standards.md` | Canonical home-dir standards reference (auto-detected by the Standards question's option 2; exact filename from `prefs.projects[<project>].standardsFile`) |
137
- | `~/.claude/rules/*.md` | Fallback rules when `evidence.standards[]` is empty |
89
+ Full table: `$HOME/.claude/multi-agent-refs/analysis/reusable-refs.md`. Read it when a phase needs a fetcher, extractor, dispatcher, validator or fallback ref and the phase ref does not name its path.
138
90
 
139
91
  ## Notes
140
92
 
@@ -177,34 +129,13 @@ bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out> [cached]
177
129
 
178
130
  ### Visual channel - Claude Code (native TaskList widget, required)
179
131
 
180
- In Claude Code the agent MUST also drive the native TaskList widget so the user sees a sticky phase tile stack - this is the only progress signal Claude Code surfaces. Skipping these calls is the #1 source of "I don't see any phases" complaints.
181
-
182
- **TaskCreate ordering (strict)**: All TaskCreate calls in a registration batch fire in strict phase-number order BEFORE any TaskUpdate in that batch, and a later batch only ever appends phases numbered above everything already registered. The native widget renders by creation order, not by phase number - out-of-order calls produce visually scrambled tile stacks (e.g. `1 ✓ · 2 ✓ · 4 ✓ · 0 ▶ · 3 ☐`) even when the underlying state is correct. Pre-marking phases as completed/skipped before Phase 0 starts is FORBIDDEN - register the tile in order, then flip status via TaskUpdate when the phase actually short-circuits. Full contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".
183
-
184
- ```text
185
- # Register one tile per phase, capture the taskId, persist it:
186
- for each phase in 0:Init, 1:Plan, 3:Review, 4:Commit, 5:Report:
187
- TaskCreate({ subject: "Phase <N>: <Name>", activeForm: "<doing-form>" })
188
- -> returns taskId
189
- bash $HOME/.claude/scripts/phase-tracker.sh meta <N> tasklist_id "<taskId>"
190
-
191
- # Phase entry - flip the tile to in_progress alongside the state update:
192
- TaskUpdate({ taskId: <saved>, status: "in_progress" })
193
- bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress
194
-
195
- # Active sub-step inside a phase - update activeForm so the spinner header reflects what's happening now:
196
- TaskUpdate({ taskId: <saved>, activeForm: "Editing TopBarView.swift" })
197
-
198
- # Phase exit - flip to completed/failed/skipped on both channels:
199
- TaskUpdate({ taskId: <saved>, status: "completed" })
200
- bash $HOME/.claude/scripts/phase-tracker.sh update <N> completed
201
- ```
132
+ In Claude Code the agent MUST also drive the native TaskList widget so the user sees a sticky phase tile stack - this is the only progress signal Claude Code surfaces. Register one tile per phase of the active set (`0:Init 1:Plan 3:Review 4:Commit 5:Report`) with `TaskCreate`, persist each `taskId` via `phase-tracker.sh meta <N> tasklist_id "<taskId>"`, and at every phase entry, sub-step and exit pair a `TaskUpdate` (status or `activeForm`) with the matching `phase-tracker.sh update`. Call pattern: `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "Call pattern". Mirror each with `phase-tracker.sh task` ("Mirroring the host's task list").
202
133
 
203
- `analysis` mode does NOT TaskCreate phases 2 - those are not part of the `analysis` phase set (`0:Init 1:Plan 3:Review 4:Commit 5:Report`). Only register tiles for the active set.
134
+ `analysis` mode does NOT TaskCreate phase 2: register tiles for the active set only.
204
135
 
205
136
  #### TaskCreate ordering (strict)
206
137
 
207
- **All TaskCreate calls in a batch fire in strict phase-number order BEFORE any TaskUpdate is applied.** For `analysis` that means: Phase 0 → Phase 1 → Phase 3 → Phase 4 → Phase 5. The native widget renders by creation order, not by phase number - out-of-order calls produce visually scrambled tile stacks. Full ordering contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".
138
+ **All TaskCreate calls in a batch fire in strict phase-number order BEFORE any TaskUpdate is applied**, and a later batch only ever appends phases numbered above everything already registered. For `analysis` that means: Phase 0 → Phase 1 → Phase 3 → Phase 4 → Phase 5. The native widget renders by creation order, not by phase number - out-of-order calls produce visually scrambled tile stacks (e.g. `1 ✓ · 2 ✓ · 4 ✓ · 0 ▶ · 3 ☐`) even when the underlying state is correct. Pre-marking phases as completed/skipped before Phase 0 starts is FORBIDDEN - register the tile in order, then flip status via TaskUpdate when the phase actually short-circuits. Full ordering contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".
208
139
 
209
140
  ### Visual channel - Copilot CLI / plain shell
210
141
 
@@ -93,34 +93,13 @@ bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out> [cached]
93
93
 
94
94
  ### Visual channel - Claude Code (native TaskList widget, required)
95
95
 
96
- In Claude Code the agent MUST also drive the native TaskList widget so the user sees a sticky phase tile stack - this is the only progress signal Claude Code surfaces. Skipping these calls is the #1 source of "I don't see any phases" complaints.
97
-
98
- **TaskCreate ordering (strict)**: All TaskCreate calls in a registration batch fire in strict phase-number order BEFORE any TaskUpdate in that batch, and a later batch only ever appends phases numbered above everything already registered. The native widget renders by creation order, not by phase number - out-of-order calls produce visually scrambled tile stacks (e.g. `1 ✓ · 2 ✓ · 4 ✓ · 0 ▶ · 3 ☐`) even when the underlying state is correct. Pre-marking phases as completed/skipped before Phase 0 starts is FORBIDDEN - register the tile in order, then flip status via TaskUpdate when the phase actually short-circuits. Full contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".
99
-
100
- ```text
101
- # Register one tile per phase, capture the taskId, persist it:
102
- for each phase in 0:Init, 1:Plan, 2:Dev, 3:Review, 4:Commit, 5:Report:
103
- TaskCreate({ subject: "Phase <N>: <Name>", activeForm: "<doing-form>" })
104
- -> returns taskId
105
- bash $HOME/.claude/scripts/phase-tracker.sh meta <N> tasklist_id "<taskId>"
106
-
107
- # Phase entry - flip the tile to in_progress alongside the state update:
108
- TaskUpdate({ taskId: <saved>, status: "in_progress" })
109
- bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress
110
-
111
- # Active sub-step inside a phase - update activeForm so the spinner header reflects what's happening now:
112
- TaskUpdate({ taskId: <saved>, activeForm: "Editing TopBarView.swift" })
113
-
114
- # Phase exit - flip to completed/failed/skipped on both channels:
115
- TaskUpdate({ taskId: <saved>, status: "completed" })
116
- bash $HOME/.claude/scripts/phase-tracker.sh update <N> completed
117
- ```
96
+ In Claude Code the agent MUST also drive the native TaskList widget so the user sees a sticky phase tile stack - this is the only progress signal Claude Code surfaces. Register one tile per phase of the active set (`0:Init 1:Plan 2:Dev 3:Review 4:Commit 5:Report`) with `TaskCreate`, persist each `taskId` via `phase-tracker.sh meta <N> tasklist_id "<taskId>"`, and at every phase entry, sub-step and exit pair a `TaskUpdate` (status or `activeForm`) with the matching `phase-tracker.sh update`. Call pattern: `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "Call pattern". Mirror each with `phase-tracker.sh task` ("Mirroring the host's task list").
118
97
 
119
98
  `autopilot` mode TaskCreates all 6 phases (no phase is skipped).
120
99
 
121
100
  #### TaskCreate ordering (strict)
122
101
 
123
- **All TaskCreate calls in a batch fire in strict phase-number order BEFORE any TaskUpdate is applied.** For `autopilot` that means: Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5. The native widget renders by creation order, not by phase number - out-of-order calls produce visually scrambled tile stacks. Full ordering contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".
102
+ **All TaskCreate calls in a batch fire in strict phase-number order BEFORE any TaskUpdate is applied**, and a later batch only ever appends phases numbered above everything already registered. For `autopilot` that means: Phase 0 → Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5. The native widget renders by creation order, not by phase number - out-of-order calls produce visually scrambled tile stacks (e.g. `1 ✓ · 2 ✓ · 4 ✓ · 0 ▶ · 3 ☐`) even when the underlying state is correct. Pre-marking phases as completed/skipped before Phase 0 starts is FORBIDDEN - register the tile in order, then flip status via TaskUpdate when the phase actually short-circuits. Full ordering contract in `$HOME/.claude/multi-agent-refs/tracker-contract.md` section "TaskCreate ordering (strict)".
124
103
 
125
104
  ### Visual channel - Copilot CLI / plain shell
126
105
 
@@ -27,61 +27,40 @@ When something is running, name it and how long it has been going. "Stopped"
27
27
  means something different when an item is 2 minutes from a PR than when the queue
28
28
  is idle, and the user is the one who knows which.
29
29
 
30
- ### 2. Remove the schedule
30
+ ### 2. Turn it off
31
31
 
32
32
  ```bash
33
- L="com.multi-agent.autopilot"
34
- launchctl bootout "gui/$(id -u)/$L" 2>/dev/null || launchctl unload "$HOME/Library/LaunchAgents/$L.plist" 2>/dev/null
35
- rm -f "$HOME/Library/LaunchAgents/$L.plist"
33
+ node "$HOME/.claude/scripts/autopilot-control.mjs" off
36
34
  ```
37
35
 
38
- The plist is removed rather than left disabled, because its presence is the
39
- definition of on: a disabled-but-present job is a third state nobody can read
40
- from the outside.
36
+ One script does every step, the same one `POST /v1/autopilot/off` runs, so the
37
+ command and a client turn the mode off the same way: the schedule's job is
38
+ booted out and its plist removed (its presence is the definition of on, so it is
39
+ removed rather than disabled), the awake agent goes with it (it would keep a Mac
40
+ awake for a mode that is off), an in-flight sleep lock is released only when the
41
+ tick that holds it has ended, and the menu bar indicator stops. It prints
42
+ `{"enabled": false, "stoppedInFlight": false}`.
41
43
 
42
- The awake agent goes with it, the same way:
44
+ ### 3. `--now` only: end the in-flight item deliberately
43
45
 
44
- ```bash
45
- . "$HOME/.claude/lib/autopilot-state.sh"
46
- node "$(ma_ap_asset scripts/autopilot-awake.mjs)" remove
47
- ```
48
-
49
- It holds sleep off for as long as it is loaded, and it has no meaning without
50
- the schedule: left behind, it keeps a Mac awake for a mode that is off.
51
-
52
- ### 3. Release the in-flight sleep lock and the indicator
46
+ Without `--now` nothing in flight is touched. With it, first name the item, its
47
+ worktree and whether it holds uncommitted work, and ask before stopping
48
+ anything; the command is declared `destructive: true` with `confirm: required`,
49
+ so a client confirms before it even starts. On a yes:
53
50
 
54
51
  ```bash
55
- INH="$HOME/.claude/autopilot/inhibitor.json"
56
- if [ -f "$INH" ]; then
57
- RP=$(jq -r '.runnerPid // empty' "$INH"); IP=$(jq -r '.pid // empty' "$INH")
58
- if [ -n "$RP" ] && kill -0 "$RP" 2>/dev/null; then
59
- echo "the tick in flight holds sleep until it ends"
60
- else
61
- [ -n "$IP" ] && kill "$IP" 2>/dev/null; rm -f "$INH"
62
- fi
63
- fi
64
- pkill -f "$HOME/.claude/autopilot/bin/menubar" 2>/dev/null || true
52
+ node "$HOME/.claude/scripts/autopilot-control.mjs" off --now
65
53
  ```
66
54
 
67
- The in-flight sleep lock belongs to a tick, not to the mode: the runner releases it
68
- when the tick ends and it exits with the runner's pid, so the only one left to
69
- stop is one whose runner is already gone - by the pid it recorded, never by name.
70
-
71
- ### 4. `--now` only: end the in-flight item deliberately
72
-
73
- Without `--now` nothing here runs. With it, first name the item, its worktree and
74
- whether it holds uncommitted work, and ask before stopping anything; the command
75
- is declared `destructive: true` with `confirm: required`, so a client confirms
76
- before it even starts. On a yes, the child session is stopped and the run is
77
- marked `abandoned`, its worktree is removed **unless it holds uncommitted
78
- work**, in which case the work goes into a stash entry labelled
79
- `autopilot/abandoned/<task-id>` (find it with `git stash list`) and the worktree
80
- is kept. Same contract as `gc-abandoned.sh` and `autopilot-runner.mjs`; losing a
81
- day of edits is worse than 750 MB. No branch is created - one made after
82
- `stash push` would point at HEAD and contain none of the work.
55
+ The child session is stopped and the run is marked `abandoned`; its worktree is
56
+ removed **unless it holds uncommitted work**, in which case the work goes into a
57
+ stash entry labelled `autopilot/abandoned/<task-id>` (find it with
58
+ `git stash list`) and the worktree is kept. Same contract as `gc-abandoned.sh`
59
+ and `autopilot-runner.mjs`; losing a day of edits is worse than 750 MB. No
60
+ branch is created - one made after `stash push` would point at HEAD and contain
61
+ none of the work. `stoppedInFlight` says whether a session was stopped.
83
62
 
84
- ### 5. Keep the selection
63
+ ### 4. Keep the selection
85
64
 
86
65
  `~/.claude/autopilot/config.json`, `queue.json` and `attempted.jsonl` all stay.
87
66
  Turning the mode back on must not re-ask which repos, and the attempt history is
@@ -90,7 +69,7 @@ what stops an item that already failed twice from being retried forever.
90
69
  To forget the selection as well: `rm -rf ~/.claude/autopilot`. Say that rather
91
70
  than doing it - "off" and "forget everything" are different requests.
92
71
 
93
- ### 6. Report
72
+ ### 5. Report
94
73
 
95
74
  State that it is off, what was left running or finishing, and that the repo
96
75
  selection is kept. If an item was stashed, name the stash entry
@@ -16,6 +16,13 @@ allowed-tools: Read, Write, Edit, Bash, Grep, WebFetch, AskUserQuestion
16
16
  **Claude Code invocation:** `/multi-agent:channels <target>`
17
17
  **Copilot CLI invocation:** `multi-agent-channels <target>` (top-level command, dash-separated per Copilot no-namespace convention)
18
18
 
19
+ ## Gotchas
20
+
21
+ - Nothing is posted before the Step 6 approval gate resolves, in every interactive mode. Under `MULTI_AGENT_UNATTENDED=1` nothing is posted at all.
22
+ - Jira renders `:)` `(x)` `(!)` as emoticons, so a Swift selector like `login(source:input:)` breaks. Post through `jira-publish.sh`, which escapes the body; never assemble the request by hand.
23
+ - A Bitbucket PR update must carry the reviewer list back, or the PUT removes every reviewer.
24
+ - With several repos, the PR description goes to every PR but Jira and Confluence get one post each.
25
+
19
26
  ## Input
20
27
 
21
28
  ```
@@ -90,42 +97,9 @@ When the preview renders:
90
97
  When the preview does NOT render (no state, or pref explicitly off at global level with no override):
91
98
  - Skip 3a silently, go straight to the channels picker. The workSummary row in 3b stays at its pref default (`false`).
92
99
 
93
- **Visual flow (TR, pref on + state available):**
94
-
95
- ```
96
- Yapılan iş özeti - PROJ-12345
97
- ──────────────────────────────────────────────────────────
98
- {rendered Work Summary block - header + scope + diffstat + review + phases}
99
- ──────────────────────────────────────────────────────────
100
-
101
- [done] İş özetini gördün. Şimdi nereye rapor gönderelim?
102
- ```
103
-
104
- Then 3b renders:
105
-
106
- ```
107
- ┌─ Kanallar ────────────────────────────────────────────
108
- │ Nereye rapor gönderilsin?
109
- │ [x] PR description (replace / append)
110
- │ [x] Jira comment (jiraId: PROJ-12345)
111
- │ [ ] Confluence page
112
- │ [ ] Wiki (taskType=component + wiki.enabled gerekli)
113
- │ [ ] Board (figmaConfig.board.enabled + projectV2Id gerekli)
114
- └───────────────────────────────────────────────────────
115
-
116
- ┌─ İçerik ──────────────────────────────────────────────
117
- │ Ne eklensin?
118
- │ [x] Normal analiz (Phase 1+2+4'ten - high-level impact + risks)
119
- │ [ ] Teknik analiz (Changes · Architecture · Dependencies - PR body'deki Technical Details özeti)
120
- │ [x] Test senaryoları (Phase 1+2+4'ten)
121
- │ [ ] PR diff'ten auto-gen (PR varsa diff'i summarize eder)
122
- │ [ ] Manuel not (--message / --message-file)
123
- │ [ ] Cost özeti (per-phase token + est. USD - tracker data gerekli)
124
- │ [x] Yapılan iş özeti (executive summary - yukarıda gösterilen block)
125
- └───────────────────────────────────────────────────────
126
- ```
100
+ After the preview prints, 3b renders the two pickers: **Channels** (PR description, Jira comment, Confluence page, Wiki, Board; each unavailable one greyed with its reason) and **Content** (normal analysis, technical analysis, test scenarios, PR auto-diff, manual note, cost summary, work summary).
127
101
 
128
- **Why auto-tick:** the user JUST saw the summary and is likely sending it somewhere - otherwise they would have stopped before running `/multi-agent:channels`. Auto-tick matches the 80% case; the 20% case (preview was enough, no remote post needed) is a single keystroke to uncheck.
102
+ **Why auto-tick:** the user just saw the summary and is most likely sending it; the explicit pref still wins.
129
103
 
130
104
  **Autopilot interaction (Step 4):** `state.autopilot === true` still pauses at channels (documented exception to zero-interaction contract), preview in-line. Under `MULTI_AGENT_UNATTENDED=1` it posts nothing: `$HOME/.claude/multi-agent-refs/features/unattended-security.md`.
131
105
 
@@ -370,19 +344,7 @@ Secondary artifacts ride along as one-line intents at the bottom of the preview:
370
344
 
371
345
  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`).
372
346
 
373
- **Multi-repo dispatch:** When `state.projects[].length > 1`, the dispatcher delegates per-channel rendering to `~/.claude/lib/channels-multi-repo.sh`:
374
-
375
- | Channel | Behavior | Adapter call |
376
- |---------|----------|--------------|
377
- | **PR description** | Posted to **every** target's PR. Primary's body lists extras as `Related: <url>`; each extra's body lists primary as `Part of: <url>`. | `channels-multi-repo.sh render-pr <state> <body> <repoName>` per target |
378
- | **Jira comment** | Posted **once** (Jira ticket is shared by all repos). Body prepended with bulleted `* PR:` list - primary first, extras after. | `channels-multi-repo.sh render-jira <state> <body>` once |
379
- | **Confluence page** | Posted **once** to the primary's component slug. `## Related PRs` heading block prepended. | `channels-multi-repo.sh render-conf <state> <body>` once |
380
- | **Wiki** | Posted **once** to the primary repo's wiki, since wiki scope is `figma-config.wikiRepo` (single repo). | No adapter - body unchanged |
381
- | **Board** | Posted **once** - board status is keyed off the GitHub Issue, not per-PR. Primary repo's issue is the target. | No adapter - single mutation |
382
-
383
- **Target enumeration:** `channels-multi-repo.sh targets <state>` returns a JSON array `[{repoName, prUrl, prNumber, isPrimary, crossLinks}]` for the dispatch loop. Single-repo tasks return one entry with empty `crossLinks` - every render-* call falls through to the body unchanged, so the loop is uniform across single-repo and multi-repo paths.
384
-
385
- **Logging hint:** `channels-multi-repo.sh summary <state>` produces a one-line autopilot log entry (`1 primary (foo) + 2 extras: <url> <url>` or `single-repo task`).
347
+ **Multi-repo dispatch** (`state.projects[].length > 1`): which channel posts once and which per repo, and the `channels-multi-repo.sh` calls: `$HOME/.claude/multi-agent-refs/channels/multi-repo.md`.
386
348
 
387
349
  #### Adapter: PR description
388
350
  Aggregated Markdown from Step 5 → PR description. GitHub uses `gh pr edit --body-file`; Bitbucket uses a **reviewer-preserving (required)** `PUT /pull-requests/{id}` payload (must re-send `reviewers`, `fromRef`, `toRef`, `draft`, `version` - omitting any one resets that field server-side). Default is **replace**; `--append` opt-in. Multi-repo cross-links handled by `channels-multi-repo.sh render-pr`.
@@ -409,21 +371,7 @@ Full contract: [`$HOME/.claude/multi-agent-refs/channels/confluence.md`]($HOME/.
409
371
 
410
372
  #### Adapter: Board (GitHub Projects v2 status move)
411
373
 
412
- **Precondition gate:** `figmaConfig.board.enabled === true` AND `figmaConfig.board.provider === "github-projects-v2"` AND `figmaConfig.github.projectV2Id` non-empty. If not met, the channel is greyed in the menu (Step 3b rule) and the adapter is skipped silently in flag-mode dispatch.
413
-
414
- **Default target column:** `inReview` - read from `figmaConfig.github.fieldOptions.status.inReview` (the option ID, e.g. `bdb0d8ef`). Other column targets (e.g. `done`, `bugfix`) overridable via flag `--board-status <key>` where `<key>` matches a key under `fieldOptions.status`.
415
-
416
- **Token:** `prefs.global.keychainMapping.github_projects` (preferred - must include `project,read:project` scopes). Fallback chain: `keychainMapping.github` → standard key `${USER}_Github_Access_Token`. Resolve via `~/.claude/lib/credential-store.sh get <key>` (reads the macOS Keychain). Token must NOT be passed on the CLI - export as `GH_TOKEN` env var only (per memory rule on token leakage).
417
-
418
- **Item lookup:** the issue's project item ID is fetched via GraphQL `repository.issue(number).projectItems(first:5)` filtered to `project.id === figmaConfig.github.projectV2Id`. If the issue is not yet in the project, dispatch silently no-ops with reason `"issue not on board"` in the summary.
419
-
420
- **Mutation:** GraphQL `updateProjectV2ItemFieldValue(input: { projectId, itemId, fieldId: figmaConfig.github.projectV2Fields.status, value: { singleSelectOptionId: <target> } })`. Verify by re-querying `fieldValueByName(name: "Status")` on the same item; assert `name === target column label` from `figmaConfig.board.columns`.
421
-
422
- **Multi-repo:** runs **once** (board status is keyed off the GitHub Issue, not per-PR). When `state.projects[].length > 1`, the primary repo's issue is the target; extras' PRs do not trigger additional moves.
423
-
424
- **Idempotency:** if the issue is already on the target column, the mutation is a no-op and the adapter reports `"already in <column>"` in the summary.
425
-
426
- **Additional behaviors handled inline by this adapter** (no separate contract file): token scope upgrade flow (`gh auth refresh -s project,read:project`), field-ID auto-discovery for repos missing `projectV2Fields.status` in figma-config, error-recovery (token expired vs scope insufficient).
374
+ Precondition, token, item lookup, mutation and idempotency: `$HOME/.claude/multi-agent-refs/channels/board.md`.
427
375
 
428
376
  #### Adapter: Wiki
429
377
  **Precondition gate:** `state.taskType === "component"` AND `figmaConfig.wiki.enabled === true`. If not met, shows the Case B menu from `$HOME/.claude/multi-agent-refs/wiki-capture.md` (setup / skip / disable / manual-note).