@mmerterden/multi-agent-pipeline 20.35.0 → 20.37.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 (207) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +6 -5
  3. package/README.tr.md +6 -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 +210 -136
  9. package/package.json +5 -1
  10. package/pipeline/commands/multi-agent/SKILL.md +33 -154
  11. package/pipeline/commands/multi-agent/analysis/SKILL.md +14 -68
  12. package/pipeline/commands/multi-agent/analysis-jira/SKILL.md +5 -8
  13. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +38 -109
  14. package/pipeline/commands/multi-agent/channels/SKILL.md +38 -167
  15. package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +37 -144
  16. package/pipeline/commands/multi-agent/design-check/SKILL.md +27 -131
  17. package/pipeline/commands/multi-agent/garbage-collect/SKILL.md +22 -48
  18. package/pipeline/commands/multi-agent/ios-coding-standard/SKILL.md +37 -180
  19. package/pipeline/commands/multi-agent/jira/SKILL.md +16 -46
  20. package/pipeline/commands/multi-agent/office-pair/SKILL.md +66 -0
  21. package/pipeline/commands/multi-agent/office-status/SKILL.md +1 -1
  22. package/pipeline/commands/multi-agent/refactor/SKILL.md +23 -184
  23. package/pipeline/commands/multi-agent/resume/SKILL.md +30 -136
  24. package/pipeline/commands/multi-agent/review/SKILL.md +24 -199
  25. package/pipeline/commands/multi-agent/setup/SKILL.md +25 -181
  26. package/pipeline/commands/multi-agent/stack/SKILL.md +9 -53
  27. package/pipeline/commands/multi-agent/status/SKILL.md +13 -2
  28. package/pipeline/commands/multi-agent/store-ready/SKILL.md +27 -226
  29. package/pipeline/commands/multi-agent/sync/SKILL.md +38 -167
  30. package/pipeline/commands/multi-agent/test-gen/SKILL.md +2 -4
  31. package/pipeline/commands/multi-agent/update/SKILL.md +18 -60
  32. package/pipeline/contract/CHANGELOG.md +9 -0
  33. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  34. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  35. package/pipeline/contract/fixtures/error-unsigned.json +1 -1
  36. package/pipeline/contract/fixtures/runs-awaiting-question.json +1 -1
  37. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  38. package/pipeline/contract/fixtures/runs-failed.json +1 -1
  39. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +1 -1
  40. package/pipeline/contract/fixtures/runs-pr-opened.json +1 -1
  41. package/pipeline/contract/fixtures/runs-running.json +1 -1
  42. package/pipeline/contract/manifest.json +5 -5
  43. package/pipeline/contract/types/index.d.ts +3 -2
  44. package/pipeline/lib/qr-code.mjs +26 -0
  45. package/pipeline/multi-agent-refs/autopilot-on/details.md +148 -0
  46. package/pipeline/multi-agent-refs/channels/generator.md +14 -0
  47. package/pipeline/multi-agent-refs/channels/preview.md +13 -0
  48. package/pipeline/multi-agent-refs/channels/reference.md +46 -0
  49. package/pipeline/multi-agent-refs/complaint-analysis/phases.md +159 -0
  50. package/pipeline/multi-agent-refs/cross-cli-contract.md +4 -4
  51. package/pipeline/multi-agent-refs/design-check/export.md +1 -0
  52. package/pipeline/multi-agent-refs/design-check/init-inventory.md +1 -1
  53. package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +64 -0
  54. package/pipeline/multi-agent-refs/features/analysis-command-notes.md +53 -0
  55. package/pipeline/multi-agent-refs/garbage-collect/phases.md +60 -0
  56. package/pipeline/multi-agent-refs/help/en.md +1 -0
  57. package/pipeline/multi-agent-refs/help/tr.md +1 -0
  58. package/pipeline/multi-agent-refs/ios-coding-standard/plan.md +71 -0
  59. package/pipeline/multi-agent-refs/ios-coding-standard/resolve-and-scan.md +135 -0
  60. package/pipeline/multi-agent-refs/jira/picker-detail.md +71 -0
  61. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +88 -0
  62. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +96 -1
  63. package/pipeline/multi-agent-refs/refactor/sweep.md +190 -0
  64. package/pipeline/multi-agent-refs/resume/details.md +115 -2
  65. package/pipeline/multi-agent-refs/review/inputs.md +33 -1
  66. package/pipeline/multi-agent-refs/review/module-guides.md +9 -1
  67. package/pipeline/multi-agent-refs/review/panel.md +75 -0
  68. package/pipeline/multi-agent-refs/review/valven.md +5 -1
  69. package/pipeline/multi-agent-refs/setup/hooks-and-plugins.md +4 -0
  70. package/pipeline/multi-agent-refs/setup/token-save-flow.md +13 -0
  71. package/pipeline/multi-agent-refs/stack/background.md +72 -0
  72. package/pipeline/multi-agent-refs/store-ready/gates.md +139 -0
  73. package/pipeline/multi-agent-refs/store-ready/report.md +40 -2
  74. package/pipeline/multi-agent-refs/sync/office.md +10 -0
  75. package/pipeline/multi-agent-refs/sync/overview.md +61 -0
  76. package/pipeline/multi-agent-refs/sync/repo.md +91 -0
  77. package/pipeline/multi-agent-refs/update/details.md +83 -0
  78. package/pipeline/schemas/runs-index.schema.json +2 -1
  79. package/pipeline/scripts/contract-server.mjs +1 -1
  80. package/pipeline/scripts/office-pair.mjs +40 -9
  81. package/pipeline/scripts/runs-index.mjs +34 -7
  82. package/pipeline/scripts/status-overview.mjs +401 -0
  83. package/pipeline/skills/.skill-manifest.json +69 -65
  84. package/pipeline/skills/.skills-index.json +15 -4
  85. package/pipeline/skills/shared/README.md +4 -3
  86. package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +8 -71
  87. package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +67 -0
  88. package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +8 -0
  89. package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +11 -73
  90. package/pipeline/skills/shared/core/google-play-compliance/references/examples.md +69 -0
  91. package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +7 -0
  92. package/pipeline/skills/shared/core/google-play-compliance/references/version-history.md +5 -0
  93. package/pipeline/skills/shared/core/multi-agent/SKILL.md +39 -262
  94. package/pipeline/skills/shared/core/multi-agent-autopilot-on/SKILL.md +35 -73
  95. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +37 -337
  96. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +27 -122
  97. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +8 -340
  98. package/pipeline/skills/shared/core/multi-agent-ios-coding-standard/SKILL.md +37 -180
  99. package/pipeline/skills/shared/core/multi-agent-office-pair/SKILL.md +19 -0
  100. package/pipeline/skills/shared/core/multi-agent-office-status/SKILL.md +1 -1
  101. package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +23 -184
  102. package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +14 -82
  103. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +25 -277
  104. package/pipeline/skills/shared/core/multi-agent-status/SKILL.md +13 -2
  105. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +75 -219
  106. package/pipeline/skills/shared/external/alarmkit/SKILL.md +11 -162
  107. package/pipeline/skills/shared/external/alarmkit/references/alarmkit-code.md +257 -0
  108. package/pipeline/skills/shared/external/android-architecture/SKILL.md +7 -58
  109. package/pipeline/skills/shared/external/android-architecture/references/code-examples.md +68 -0
  110. package/pipeline/skills/shared/external/app-intents/SKILL.md +3 -45
  111. package/pipeline/skills/shared/external/app-intents/references/code-examples.md +54 -0
  112. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +5 -81
  113. package/pipeline/skills/shared/external/app-store-optimization/references/engagement-and-localization.md +96 -0
  114. package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -112
  115. package/pipeline/skills/shared/external/app-store-review/references/monetization-and-submission.md +138 -0
  116. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +10 -117
  117. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models-code.md +186 -0
  118. package/pipeline/skills/shared/external/authentication/SKILL.md +3 -50
  119. package/pipeline/skills/shared/external/authentication/references/code-examples.md +59 -0
  120. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +3 -84
  121. package/pipeline/skills/shared/external/callkit-voip/references/code-examples.md +93 -0
  122. package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +7 -263
  123. package/pipeline/skills/shared/external/ci-cd-pipelines/references/pipeline-examples.md +281 -0
  124. package/pipeline/skills/shared/external/clean-code/SKILL.md +8 -41
  125. package/pipeline/skills/shared/external/clean-code/references/code-examples.md +56 -0
  126. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +8 -146
  127. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-code.md +214 -0
  128. package/pipeline/skills/shared/external/compose-components/SKILL.md +6 -80
  129. package/pipeline/skills/shared/external/compose-components/references/code-examples.md +89 -0
  130. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +5 -64
  131. package/pipeline/skills/shared/external/compose-navigation/references/code-examples.md +70 -0
  132. package/pipeline/skills/shared/external/core-data/SKILL.md +9 -157
  133. package/pipeline/skills/shared/external/core-data/references/core-data-code.md +221 -0
  134. package/pipeline/skills/shared/external/core-nfc/SKILL.md +3 -89
  135. package/pipeline/skills/shared/external/core-nfc/references/code-examples.md +98 -0
  136. package/pipeline/skills/shared/external/coreml/SKILL.md +17 -133
  137. package/pipeline/skills/shared/external/coreml/references/coreml-code.md +208 -0
  138. package/pipeline/skills/shared/external/css-modern/SKILL.md +8 -131
  139. package/pipeline/skills/shared/external/css-modern/references/code-examples.md +142 -0
  140. package/pipeline/skills/shared/external/database-patterns/SKILL.md +6 -103
  141. package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +112 -0
  142. package/pipeline/skills/shared/external/html-semantic/SKILL.md +7 -48
  143. package/pipeline/skills/shared/external/html-semantic/references/code-examples.md +54 -0
  144. package/pipeline/skills/shared/external/humanizer/SKILL.md +6 -19
  145. package/pipeline/skills/shared/external/humanizer/references/voice.md +24 -0
  146. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +13 -170
  147. package/pipeline/skills/shared/external/ios-accessibility/references/assistive-tech-review.md +224 -0
  148. package/pipeline/skills/shared/external/ios-localization/SKILL.md +2 -24
  149. package/pipeline/skills/shared/external/ios-localization/references/code-examples.md +30 -0
  150. package/pipeline/skills/shared/external/ios-networking/SKILL.md +3 -58
  151. package/pipeline/skills/shared/external/ios-networking/references/code-examples.md +67 -0
  152. package/pipeline/skills/shared/external/ios-security/SKILL.md +4 -64
  153. package/pipeline/skills/shared/external/ios-security/references/code-examples.md +74 -0
  154. package/pipeline/skills/shared/external/live-activities/SKILL.md +4 -90
  155. package/pipeline/skills/shared/external/live-activities/references/code-examples.md +108 -0
  156. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +9 -23
  157. package/pipeline/skills/shared/external/localization-reuse-map/references/project-settings.md +22 -0
  158. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +5 -95
  159. package/pipeline/skills/shared/external/mapkit-location/references/code-examples.md +117 -0
  160. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +7 -106
  161. package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +124 -0
  162. package/pipeline/skills/shared/external/permissionkit/SKILL.md +2 -31
  163. package/pipeline/skills/shared/external/permissionkit/references/code-examples.md +37 -0
  164. package/pipeline/skills/shared/external/play-store-review/SKILL.md +6 -74
  165. package/pipeline/skills/shared/external/play-store-review/references/signing-and-policies.md +83 -0
  166. package/pipeline/skills/shared/external/push-notifications/SKILL.md +8 -125
  167. package/pipeline/skills/shared/external/push-notifications/references/notification-code.md +176 -0
  168. package/pipeline/skills/shared/external/python-patterns/SKILL.md +7 -158
  169. package/pipeline/skills/shared/external/python-patterns/references/python-examples.md +176 -0
  170. package/pipeline/skills/shared/external/rest-api-design/SKILL.md +7 -157
  171. package/pipeline/skills/shared/external/rest-api-design/references/api-examples.md +175 -0
  172. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +11 -230
  173. package/pipeline/skills/shared/external/swift-architecture/references/pattern-examples.md +295 -0
  174. package/pipeline/skills/shared/external/swift-codable/SKILL.md +17 -149
  175. package/pipeline/skills/shared/external/swift-codable/references/codable-recipes.md +207 -0
  176. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +12 -99
  177. package/pipeline/skills/shared/external/swift-concurrency/references/code-examples.md +100 -0
  178. package/pipeline/skills/shared/external/swift-concurrency/references/swift-6-2-additions.md +18 -0
  179. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +9 -78
  180. package/pipeline/skills/shared/external/swift-formatstyle/references/formatstyle-examples.md +113 -0
  181. package/pipeline/skills/shared/external/swift-language/SKILL.md +3 -56
  182. package/pipeline/skills/shared/external/swift-language/references/code-examples.md +65 -0
  183. package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +1 -0
  184. package/pipeline/skills/shared/external/swiftdata/SKILL.md +6 -122
  185. package/pipeline/skills/shared/external/swiftdata/references/code-examples.md +140 -0
  186. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +12 -139
  187. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/interop-code.md +198 -0
  188. package/pipeline/skills/shared/external/tailwind-css/SKILL.md +9 -81
  189. package/pipeline/skills/shared/external/tailwind-css/references/code-examples.md +91 -0
  190. package/pipeline/skills/shared/external/testing-backend/SKILL.md +7 -207
  191. package/pipeline/skills/shared/external/testing-backend/references/testing-examples.md +225 -0
  192. package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +8 -89
  193. package/pipeline/skills/shared/external/typescript-patterns/references/code-examples.md +100 -0
  194. package/pipeline/skills/shared/external/vision-framework/SKILL.md +2 -20
  195. package/pipeline/skills/shared/external/vision-framework/references/code-examples.md +26 -0
  196. package/pipeline/skills/shared/external/vue-composition/SKILL.md +7 -169
  197. package/pipeline/skills/shared/external/vue-composition/references/vue-examples.md +187 -0
  198. package/pipeline/skills/shared/external/web-accessibility/SKILL.md +7 -174
  199. package/pipeline/skills/shared/external/web-accessibility/references/a11y-examples.md +192 -0
  200. package/pipeline/skills/shared/external/web-performance/SKILL.md +8 -66
  201. package/pipeline/skills/shared/external/web-performance/references/code-examples.md +77 -0
  202. package/pipeline/skills/shared/external/web-testing/SKILL.md +11 -186
  203. package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +213 -0
  204. package/pipeline/skills/skills-index.md +2 -1
  205. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/format-and-output.md +0 -0
  206. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/publish-and-snapshot.md +0 -0
  207. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/sources-and-recipes.md +0 -0
@@ -17,6 +17,8 @@ Deep-analyses the current project, extracts the global best-practices worth adop
17
17
 
18
18
  **Input**: $ARGUMENTS (optional - `backlog` runs Step 0e alone; otherwise an area to focus on: "security", "performance", "tests", "bugs", "best-practices", "drift", "multi-agent-toolkit", etc.)
19
19
 
20
+ Procedures, output tables, the band list and the focus filter live in `$HOME/.claude/multi-agent-refs/refactor/sweep.md`. Read it before Step 0; each step below names the section it uses.
21
+
20
22
  ## Flow
21
23
 
22
24
  ```
@@ -24,229 +26,80 @@ Step 0: BEST-PRACTICES Research the field, extract the best approaches, ADAPT
24
26
  Step 0b: DRIFT Check upstream-derived skills for updates we have not pulled -> plan band D
25
27
  Step 0c: DEV-TOOLKIT Research current MCP practice + audit the companion multi-agent-toolkit repo -> plan band E
26
28
  Step 0d: RUN-ERRORS Read the local run-error ledger, rank recurring failures -> plan band F
29
+ Step 0e: BACKLOG Decide the open observations recorded mid-task -> plan band G
27
30
  Step 1: SCAN Walk the project structure (files, LOC, dependencies, CI, tests)
28
31
  Step 2: ANALYZE 10 categories + an explicit BUG HUNT (real defects, not just scores) -> plan bands B, C
29
32
  Step 3: SCORE Each category /10, overall /100
30
- Step 4: PLAN Merge bands A (best-practice) + B (bugs) + C (improvements) + D (drift) + E (multi-agent-toolkit) + F (run-errors)
33
+ Step 4: PLAN Merge every band into one table
31
34
  Step 5: ASK "Start the work?" - wait for user approval
32
35
  Step 6: IMPLEMENT Apply approved items one by one (lint, test, commit)
33
36
  Step 7: VERIFY Confirm every test + lint passes
34
37
  Step 8: ASK SYNC "Run /multi-agent:sync?" - wait for user approval
35
38
  ```
36
39
 
37
- Plan bands (all five feed the single Step 4 table):
38
- - **A - Best-practice**: the best field approaches, adapted so they actually fit this repo.
39
- - **B - Bug**: real defects found in the code (correctness, security, data-loss, crashes).
40
- - **C - Improvement**: quality/perf/DX gaps surfaced by the 10-category analysis.
41
- - **D - Drift**: upstream updates to skills we derived from an external source.
42
- - **E - Dev-toolkit**: current-practice gaps in the companion multi-agent-toolkit MCP server (the pipeline's device and browser hands), applied in that repo.
43
- - **F - Run-errors**: recurring real failures the pipeline actually hit across past runs, read from the local run-error ledger. These are lived evidence, not speculation - a failure that recurs across users or tasks is a prioritized improvement area.
44
-
45
- ## Step 0: BEST-PRACTICES - research the field, adapt to us
46
-
47
- Do not copy features blindly. The goal is the best *approaches*, reshaped so they are applicable to THIS project's stack, size, and constraints.
48
-
49
- 1. **Identify the domain** of the current project (read README + package/build manifests): what kind of project is it (CLI, SDK, app, pipeline, library), what stack, who uses it.
50
- 2. **Research the best-in-class** for that exact domain. When `ai-analyst-toolkit` is enabled, run the first three bullets through its skills (`evidence-github`, `evidence-registry`, `signal-community`) rather than ad-hoc searching: they carry the query forms and the citation format, and they keep the evidence / signal line straight - a GitHub PR is a fact, a forum thread is one person's experience. Not enabled is a recorded no-op and the manual searches below still apply.
51
- - **GitHub**: search the domain terms + `stars:>50`; read the top repos' READMEs, architecture docs, CI configs, test layout.
52
- - **X / Twitter**: search the domain terms + "best practices" / "we switched to" / "lesson learned"; capture what practitioners and tool authors actually recommend right now (WebFetch/WebSearch on `x.com` / `twitter.com` threads).
53
- - **Reddit**: relevant subreddits for real-world pain points and adopted patterns.
54
- - **Web**: "<domain> best practices <current-year>", official style guides, and the platform's own guidance.
55
- 3. **For each candidate approach, record**:
56
- - what it is, who does it well (source link)
57
- - the concrete benefit
58
- - **adaptation**: exactly how it would look in OUR repo (which file/dir/script), and what has to change for it to fit - not a generic "add tests" but "add a flow-assertion helper in `test/helpers/`"
59
- - effort (Low/Med/High) and impact (Low/Med/High/Critical)
60
- 4. **Discard** approaches that do not fit our stack, our scale, or our constraints - and say WHY (so the user sees the filter working, not just the survivors).
61
-
62
- Output (plan band A):
63
- ```
64
- | Source | Approach | Adaptation to our repo | Effort | Impact | In plan? |
65
- |--------|----------|------------------------|--------|--------|----------|
66
- | <repo> | <what> | <concrete change here> | Low | High | Yes (P1) |
67
- | <repo> | <what> | does not fit: <reason> | - | - | No |
68
- ```
69
- Roll the high-impact + low/med-effort survivors into the Step 4 plan as band-A items.
40
+ ## Step 0: BEST-PRACTICES
70
41
 
71
- ## Step 0b: DRIFT - upstream-derived skill check
42
+ Do not copy features blindly. Identify the domain, research the best-in-class (through `ai-analyst-toolkit` skills when enabled), record each candidate with its source, benefit, concrete adaptation to OUR repo, effort and impact, and discard what does not fit with the reason stated. Procedure and band-A table: `sweep.md` "Step 0".
72
43
 
73
- Some skills/components in this project (or in the marketplace plugins it ships) were derived from an upstream source. Upstream keeps evolving - it fixes bugs and adds features. This step detects upstream drift so we can decide whether to pull the improvements back.
44
+ ## Step 0b: DRIFT - upstream-derived skill check
74
45
 
75
46
  Rules that hold for every entry:
76
47
  - The upstream mapping is **configuration, never hardcoded**: `global.derivedSkillSources` in `~/.claude/multi-agent-preferences.json`. Missing or empty -> **skip** and report "no derived-skill sources configured". Never invent a source.
77
48
  - **The plugin cache is a mirror, not the authority.** Never let the cache alone produce an "up to date" verdict; report it as **`unverified (cache only)`**. An unreachable upstream is recorded as "upstream unreachable" and the run continues.
78
49
  - Each drifted entry becomes a band-D plan item. Do not auto-apply upstream changes - they go through Step 5 approval like everything else, and after porting, bump the entry's `derivedFromVersion`.
79
50
 
80
- Full procedure: `$HOME/.claude/multi-agent-refs/refactor/drift.md`. Read it when `global.derivedSkillSources` has at least one entry (entry schema, source resolution order, version manifest, comparison, band-D table).
51
+ Full procedure: `$HOME/.claude/multi-agent-refs/refactor/drift.md`. Read it when `global.derivedSkillSources` has at least one entry.
81
52
 
82
- ## Step 0c: DEV-TOOLKIT - current MCP practice for the companion toolkit
53
+ ## Step 0c: DEV-TOOLKIT
83
54
 
84
- The pipeline's hands on devices and browsers are MCP tools served by a companion repo (`multi-agent-toolkit-mcp`): Phase 3 test, `manual-test`, `design-check` and `apple-archive-compliance` all call them, and several pipeline skills declare a minimum toolkit version (see `cross-cli-contract.md`). That repo therefore has to track the MCP field, not just its own README. This step researches what current practice is and audits the toolkit against it.
55
+ Audit the companion `multi-agent-toolkit-mcp` repo against current MCP practice. Resolution is configuration first, never a hardcoded path; skip when nothing resolves or `enabled` is false. Read `$HOME/.claude/multi-agent-refs/refactor/toolkit-research.md` before running this step.
85
56
 
86
- Full procedure - resolution (configuration first, never a hardcoded path; skip when nothing resolves or `enabled` is false), the 5 research axes, the audit command block, and the band-E output table + rules - lives in `$HOME/.claude/multi-agent-refs/refactor/toolkit-research.md`. Read it before running this step.
57
+ ## Step 0d: RUN-ERRORS
87
58
 
88
- ## Step 0d: RUN-ERRORS - what the pipeline actually failed on
59
+ Read `$HOME/.claude/logs/multi-agent/errors-ledger.jsonl`. Missing, unreadable or empty means skip band F silently - it is additive signal, never a gate. With a focus area, still read it. A tag that stopped recurring after a version bump is resolved: report it, do not re-raise it. Never quote a user's identity as blame. Read `$HOME/.claude/multi-agent-refs/refactor/run-errors.md` when the ledger exists.
89
60
 
90
- Before speculating about improvements, read what real runs already failed on. When usage logging is enabled, every terminated run appends its errors to a local ledger at `$HOME/.claude/logs/multi-agent/errors-ledger.jsonl`. A missing, unreadable or empty ledger means skip band F silently - it is additive signal, never a gate. If `$ARGUMENTS` names a focus area, still read the ledger - a recurring run error in that area is the strongest possible signal. A tag that stopped recurring after a version bump is resolved: report it, do not re-raise it. Never quote a user's identity as blame.
91
-
92
- Full procedure: `$HOME/.claude/multi-agent-refs/refactor/run-errors.md`. Read it when the ledger exists (record shape, grouping and ranking, transcript mining, band-F table).
93
-
94
- ## Step 0e: BACKLOG - friction this pipeline already noticed
95
-
96
- Every other band in this command derives its findings from scratch, which is right for a sweep and has one consequence nobody chose: a friction noticed mid-task is gone by the next run unless it was fixed within the hour. Most are not, because stopping mid-task to fix them is the wrong call. So they are written down when noticed and decided here.
61
+ ## Step 0e: BACKLOG
97
62
 
98
63
  ```bash
99
64
  node "$HOME/.claude/scripts/observations.mjs" scan --status open --json
100
65
  ```
101
66
 
102
- Exit 3 is `SCAN BROKEN` - files on disk, none parsed. That is a broken reader, not an empty queue: halt the band and say so rather than reporting "0 open".
103
-
104
- Split every open observation into actionable / sibling-propagation / to-decline, and resolve the sibling surfaces mechanically with `skill-siblings.mjs`, never from memory - a command is authored in `commands/`, mirrored into `skills/shared/core/`, and installed again into three host trees, so a fix applied to one copy drifts from the rest with every gate still green. Output as plan band G, same table shape as the other bands.
105
-
106
- `/multi-agent:refactor backlog` runs this band alone. The full sweep is unchanged and still includes it. Buckets, the status vocabulary, why `parked` needs a named unblocking event, and how to write an observation: `$HOME/.claude/multi-agent-refs/refactor/observations.md`.
67
+ Exit 3 is `SCAN BROKEN` - files on disk, none parsed. Halt the band and say so rather than reporting "0 open". Split every open observation into actionable / sibling-propagation / to-decline, and resolve sibling surfaces mechanically with `skill-siblings.mjs`, never from memory. Output as plan band G. `/multi-agent:refactor backlog` runs this band alone. Buckets, statuses and how to write an observation: `$HOME/.claude/multi-agent-refs/refactor/observations.md`.
107
68
 
108
69
  ## Step 1: SCAN
109
70
 
110
- ```
111
- - file count, LOC (cloc or wc -l)
112
- - package.json / Package.swift / build.gradle analysis
113
- - dependency count (runtime vs dev)
114
- - Is there a CI/CD pipeline? (.github/workflows/, fastlane/, Makefile)
115
- - Is there test infrastructure? How many tests? Coverage?
116
- - Is a linter/formatter config in place?
117
- - Do README, LICENSE, SECURITY.md, CHANGELOG.md exist?
118
- - Git state: branch count, last commit date, tags
119
- ```
71
+ Walk files, LOC, manifests, dependencies, CI, tests, linters, repo docs and git state (`sweep.md` "Step 1").
120
72
 
121
73
  ## Step 2: ANALYZE - 10 categories + BUG HUNT
122
74
 
123
- ### 2a. 10 categories (quality lens)
124
-
125
- | # | Category | What to check |
126
- |---|----------|---------------|
127
- | 1 | **Architecture** | Layer separation, modularity, SOLID, dependency direction |
128
- | 2 | **Code Quality** | Naming, magic numbers, dead code, complexity, DRY |
129
- | 3 | **Security** | Hardcoded secrets, input validation, Keychain, ATS, ATT |
130
- | 4 | **Tests** | Coverage, test pyramid, edge cases, mock/stub quality |
131
- | 5 | **CI/CD** | Build matrix, lint job, release automation, artifact caching |
132
- | 6 | **Docs** | README quality, JSDoc / Swift docs, API docs, CHANGELOG |
133
- | 7 | **Performance** | Bundle size, lazy loading, memory leaks, unnecessary re-renders |
134
- | 8 | **Accessibility** | a11y labels, tap targets, VoiceOver, Dynamic Type |
135
- | 9 | **Dependency Management** | Outdated deps, vulnerability scan, lockfile, version pinning |
136
- | 10 | **DevEx** | Onboarding time, script ergonomics, error messages, debug tooling |
137
-
138
- ### 2b. BUG HUNT (real defects, not scores)
139
-
140
- Category scores measure quality; they do not find the bug that ships. Run an explicit defect hunt IN ADDITION to the scoring:
141
-
142
- - Dispatch focused review agents (Agent tool, `code-reviewer` persona where available) over the highest-risk surfaces: recently changed files, error/edge-path handling, concurrency, external input parsing, resource cleanup, off-by-one boundaries.
143
- - For each candidate defect, record: **file:line**, the concrete failure scenario (inputs/state -> wrong output/crash), and severity.
144
- - **Verify before reporting**: only list a bug you can trace to a real failure path; drop the plausible-but-unprovable ones. Match the bar you would apply to a third party's code.
145
-
146
- Output (plan band B) - every confirmed defect becomes a P0/P1 item:
147
- ```
148
- | # | Severity | File:line | Defect | Failure scenario |
149
- |---|----------|-----------|--------|------------------|
150
- | 1 | Blocking | src/x.ts:42 | unchecked nil deref | empty response -> crash |
151
- ```
152
-
153
- Improvement areas surfaced by 2a that are not outright bugs become band-C items.
75
+ 2a scores the 10 categories (`sweep.md` "Step 2a"). 2b runs an explicit defect hunt IN ADDITION to the scoring (`sweep.md` "Step 2b"). **Verify before reporting**: only list a bug you can trace to a real failure path with `file:line` and a concrete failure scenario; drop the plausible-but-unprovable ones, at the bar you would apply to a third party's code. Confirmed defects are band B (P0/P1); non-bug gaps from 2a are band C.
154
76
 
155
77
  ## Step 3: SCORE
156
78
 
157
- Each category is scored out of 10. Output:
79
+ Each category /10, total /100 (`sweep.md` "Step 3").
158
80
 
159
- ```
160
- +---------------------+-------+
161
- | Category | Score |
162
- +---------------------+-------+
163
- | Architecture | 9/10 |
164
- | Code Quality | 8/10 |
165
- | Security | 9/10 |
166
- | Tests | 7/10 |
167
- | CI/CD | 8/10 |
168
- | Docs | 7/10 |
169
- | Performance | 9/10 |
170
- | Accessibility | 6/10 |
171
- | Dependency Mgmt | 8/10 |
172
- | DevEx | 9/10 |
173
- +---------------------+-------+
174
- | TOTAL | 80/100|
175
- +---------------------+-------+
176
- ```
81
+ ## Step 4: PLAN
177
82
 
178
- ## Step 4: PLAN - one merged, prioritized table
179
-
180
- Merge all five bands into a single plan. Tag each row with its band (A best-practice / B bug / C improvement / D drift / E multi-agent-toolkit) so the source is visible.
181
-
182
- ```
183
- | # | Priority | Band | Category | Item | Impact |
184
- |---|----------|------|----------|------|--------|
185
- | 1 | P0 | B | Security | Remove hardcoded API key (src/x:12) | Critical |
186
- | 2 | P0 | B | Tests | Fix nil-deref on empty response (src/y:42) | High |
187
- | 3 | P1 | A | CI/CD | Adopt matrix build (adapt: .github/workflows/ci.yml) | Medium |
188
- | 4 | P1 | D | Skills | Port upstream <plugin> 0.3.0 fixes into <localPath> | Medium |
189
- | 5 | P1 | E | Toolkit | Add read-only annotations to the multi-agent-toolkit device tools | Medium |
190
- | 6 | P2 | C | DevEx | Rename npm scripts for consistency | Low |
191
- ```
192
-
193
- Priority levels:
194
- - **P0**: bugs, security holes, broken functionality - must fix
195
- - **P1**: clear quality improvement or high-value adopted best-practice / drift port - should be done
196
- - **P2**: nice-to-have - if time allows
83
+ One merged table, every row tagged with its band, priorities P0 / P1 / P2 (`sweep.md` "Step 4").
197
84
 
198
85
  ## Step 5: ASK - user approval
199
86
 
200
- After showing the plan, ask:
201
-
202
87
  > "Found X items (P0: N, P1: M, P2: K) across bugs, best-practices, improvements, upstream drift, and multi-agent-toolkit practice. Should I start the work?"
203
88
 
204
- Options:
205
- - "Yes, do all"
206
- - "Only P0"
207
- - "P0 + P1 only"
208
- - "Only bugs (band B)"
209
- - "Only the multi-agent-toolkit (band E)"
210
- - (the user may pick specific items)
89
+ Options: "Yes, do all" / "Only P0" / "P0 + P1 only" / "Only bugs (band B)" / "Only the multi-agent-toolkit (band E)" / specific items.
211
90
 
212
91
  **Never start the work without approval.**
213
92
 
214
93
  ## Step 6: IMPLEMENT
215
94
 
216
- Apply the approved items one by one:
217
-
218
- 1. For each item:
219
- - apply the change (for band D, port the upstream diff into `localPath`, then bump that entry's `derivedFromVersion` in preferences)
220
- - band-E items are applied inside the toolkit repo, never mirrored here: edit there, re-run its gates (`node --check`, the `tools/list` handshake, advertised tool count matching reality), then commit there with that repo's own convention. Publishing is `/multi-agent:sync` Step 3d - do not publish from this step.
221
- - run the relevant tests
222
- - on success, move to the next
223
- - on failure, roll back and notify the user
224
- 2. After all changes are done:
225
- - run the full lint + test suite
226
- - on success, commit
227
-
228
- Commit format: `refactor(scope): {short description}`
95
+ Apply approved items one by one, testing each and rolling back on failure (`sweep.md` "Step 6"). Band-E items are applied and committed inside the toolkit repo, never mirrored here, and never published from this step. Commit format: `refactor(scope): {short description}`.
229
96
 
230
97
  ## Step 7: VERIFY
231
98
 
232
- ```bash
233
- # Lint
234
- npm run lint 2>/dev/null || swift build 2>/dev/null
235
-
236
- # Test
237
- npm test 2>/dev/null || swift test 2>/dev/null || xcodebuild test 2>/dev/null
238
-
239
- # Result
240
- echo "Lint: PASS/FAIL"
241
- echo "Test: PASS/FAIL (X/Y passed)"
242
- ```
243
-
244
- If any band-E item was applied, verify the toolkit repo too - syntax check every file it loads, handshake the server and confirm `tools/list` still answers, and confirm the advertised tool counts (README header, `package.json` description) match the count the server reports.
99
+ Full lint + test must pass; band-E work also re-verifies the toolkit (`sweep.md` "Step 7").
245
100
 
246
101
  ## Step 8: ASK SYNC
247
102
 
248
- After every approved item is applied, ask:
249
-
250
103
  > "Work is complete. Should I run /multi-agent:sync?"
251
104
 
252
105
  Options:
@@ -256,18 +109,4 @@ Options:
256
109
 
257
110
  ## Focus filter
258
111
 
259
- If $ARGUMENTS is set, focus on that band/category only:
260
-
261
- | Input | Focus |
262
- |-------|-------|
263
- | `bugs` | Bug hunt only (band B) |
264
- | `best-practices` | Field research + adapted plan only (band A) |
265
- | `drift` | Upstream derived-skill drift only (band D) |
266
- | `multi-agent-toolkit` | Companion MCP toolkit research + audit only (band E) |
267
- | `security` | Security analysis only |
268
- | `tests` | Test coverage and quality only |
269
- | `performance` | Performance optimisation only |
270
- | `docs` | Docs only |
271
- | `ci` | CI/CD pipeline only |
272
- | `deps` | Dependency updates only |
273
- | (empty) | Everything (default) |
112
+ If $ARGUMENTS is set, focus on that band/category only; the mapping is `sweep.md` "Focus filter". Empty runs everything.
@@ -13,185 +13,79 @@ allowed-tools: Agent, Bash, Read, Write, Edit, Glob, Grep, TaskCreate, TaskUpdat
13
13
 
14
14
  **Input**: $ARGUMENTS
15
15
 
16
- > **Language (read FIRST)**: Before any status output, read `prefs.global.outputLanguage` and render every conversational line in it. `AskUserQuestion` renders its `question`, option `label`s and option `description`s in `outputLanguage`; only `header` stays English (<=12-char chip); external payload bodies follow `outputLanguage` too (identifiers, commit messages, branch names stay English). Full contract: `$HOME/.claude/multi-agent-refs/rules.md` "Language Application".
16
+ > **Language (read FIRST)**: read `prefs.global.outputLanguage` before any output; chat, `AskUserQuestion` `question` / `label` / `description` and payload bodies follow it, `header` (<=12 chars), identifiers, commit messages and branch names stay English (`$HOME/.claude/multi-agent-refs/rules.md` "Language Application").
17
17
 
18
- Unfinished work reaches this command from two directions, and which one you are in is a property of the repository, not of how you typed the command:
18
+ Unfinished work arrives two ways, decided by the repository:
19
19
 
20
- - **A tracked run stopped.** It has an `agent-state.json`, a phase it was inside, and possibly a worktree. It resumes from where it stopped.
21
- - **Work exists on the current branch with no run behind it.** You wrote it by hand, or a run outside the pipeline produced it. There is nothing to resume, so the **pipeline tail** runs over the diff: Review (with its build gate) → Commit/PR → Report. Plan and Dev never run; the diff already on the branch is the Dev output.
20
+ - **A tracked run stopped.** It has an `agent-state.json`, a phase, maybe a worktree. It resumes where it stopped.
21
+ - **Work on the current branch with no run behind it.** The **pipeline tail** runs over the diff: Review (with its build gate) → Commit/PR → Report. Plan and Dev never run; the diff is the Dev output.
22
22
 
23
- Step 1 finds both and asks. A single command means you do not have to know which case you are in before you can ask the question.
24
-
25
- ## Input
26
-
27
- ```bash
28
- /multi-agent:resume # list everything resumable, pick one
29
- /multi-agent:resume #2 # a tracked run by task number
30
- /multi-agent:resume PROJ-12345 # a tracked run by Jira id, or bind the tail to that id
31
- /multi-agent:resume --base develop # tail path: override the base branch for the diff
32
- /multi-agent:resume #2 --answer continue # answer the question the run stopped on, then re-enter its step
33
- /multi-agent:resume autopilot # no gate prompts: auto-fix, auto-PR, auto-comment
34
- ```
35
-
36
- ## When NOT to use it
37
-
38
- - The change is not written yet - use `/multi-agent`.
39
- - Only the review is wanted - `/multi-agent:review`. Only the report - `/multi-agent:channels`. Only device UI testing - `/multi-agent:test` / `/multi-agent:manual-test`.
40
- - The run is abandoned rather than paused - `/multi-agent:kill #N`, or `/multi-agent:garbage-collect --abandoned` for the Phase 0 leftovers.
23
+ Examples, when NOT to use it and modes: `$HOME/.claude/multi-agent-refs/resume/details.md` "Usage".
41
24
 
42
25
  ## Steps
43
26
 
44
27
  ### Step 1 - Build the resumable list, then ask
45
28
 
46
- Collect both sources before rendering anything. An argument that names a run (`#N`, a Jira id, a GitHub issue number) selects it directly and skips the question; an argument that names nothing resumable is an error, never a silent fall-through to the tail.
47
-
48
- **Source A - tracked runs.** Every `agent-state.json` under `$HOME/.claude/logs/multi-agent/{project}/` whose `status != "done"`. Each row carries what the choice actually turns on: task id, the phase it stopped inside, its workspace (the worktree path, or `local` when `worktreePath` is the project root), how long it has been sitting, and `haltReason` when set.
49
-
50
- **Source B - untracked work on the current branch.** Resolve the base branch in order: `--base <arg>` → `figma-config.project.baseBranch` → `develop` → the branch's upstream/merge-base. The work is `git diff <base>...HEAD` plus uncommitted working-tree changes. The row appears only when that diff is non-empty **and** no Source A run already owns this branch - otherwise the same work would be offered twice under two different contracts.
29
+ Collect both sources before rendering. An argument naming a run (`#N`, a Jira id, an issue number) selects it and skips the question; an argument naming nothing resumable is an error, never a silent fall-through to the tail.
51
30
 
52
- **Ask.** Full rules: `$HOME/.claude/multi-agent-refs/picker-contract.md`. This is a one-step chain, so the breadcrumb is `Step 1/1: which unfinished work to pick up`, rendered in `outputLanguage` above the picker. `question`, every `label` and every `description` render in `outputLanguage`; `header` stays English (`Resume what`). Source A rows first (newest first), Source B last. Labels carry proper nouns verbatim - task id, branch name - and the run branches on which row was selected, never on the label text.
31
+ **Source A - tracked runs**: each `agent-state.json` under `$HOME/.claude/logs/multi-agent/{project}/` with `status != "done"` (id, phase, workspace, idle time, `haltReason`).
53
32
 
54
- **One candidate is still a question.** A single row is asked with a genuine escape as its second option, because `AskUserQuestion` refuses a call with fewer than two declared options and discards every question batched with it. Which escape each case offers: `$HOME/.claude/multi-agent-refs/resume/details.md` "Single-candidate escape", read before Step 1.
33
+ **Source B - untracked work**: base = `--base` → `figma-config.project.baseBranch` → `develop` → upstream/merge-base; work = `git diff <base>...HEAD` plus uncommitted changes. Shown only when non-empty **and** no Source A run owns this branch.
55
34
 
56
- Zero rows in both sources: do not ask. Stop with `ERR: nothing to resume - no stopped run for this project and no local changes on {branch} vs {base}`.
35
+ **Ask** per `$HOME/.claude/multi-agent-refs/picker-contract.md`: breadcrumb `Step 1/1: which unfinished work to pick up`, `header` `Resume what`, Source A rows first (newest first), Source B last; branch on the selected row, never on label text. **One candidate is still a question**, with a genuine escape as the second option: read `resume/details.md` "Single-candidate escape" before Step 1. Zero rows: do not ask; stop with `ERR: nothing to resume - no stopped run for this project and no local changes on {branch} vs {base}`.
57
36
 
58
- **The answer routes.** A Source A row runs Steps 2-5 and nothing else; a Source B row runs Steps 6-7 and nothing else. The two halves never both run in one invocation.
37
+ A Source A row runs Steps 2-5 only; a Source B row runs Steps 6-7 only. Never both.
59
38
 
60
39
  ### Step 2 - Tracked run: read and validate state
61
40
 
62
- - Validate first: `node $HOME/.claude/scripts/validate-state.mjs <state-file>` (resume-safety check, tolerant of legacy shapes). On non-zero exit, do NOT guess a phase - surface the errors and stop with `ERR: agent-state.json is unsafe to resume; inspect it or 'kill #N' and restart.`
63
- - Confirm the worktree (`worktreePath` / `projects[].worktreePath`) exists and is usable; if missing or locked, run the Phase 0 "Worktree stale-lock heal" before continuing.
64
- - **Unless `state.worktreeRemovedAt` is set.** Then the worktree was removed on purpose by Phase 4 once the PR opened, the branch is still local, and the artefacts live under `state.artifactsPath`. Do NOT heal or recreate it: read state from `artifactsPath`, and if the remaining work needs a checkout (a Phase 5 pause needs none), ask before moving the user's HEAD - they may be mid-work on another branch, which is exactly why the removal did not check the branch out.
65
- - `currentPhase` - last completed phase
66
- - `status` - `paused` | `failed` | `in_progress`
67
- - `haltReason` - if set, show it so the user knows why the run stopped; clear it on successful re-entry
68
- - `circuitBreaker` - if `tripped`, show `trigger` + `detail`, then set `tripped: false` and keep `counters`; if the same trigger fires again at the next checkpoint the breaker re-trips (no silent bypass)
69
- - `autopilot` - preserve the mode
41
+ - `node $HOME/.claude/scripts/validate-state.mjs <state-file>`. Non-zero: do NOT guess a phase; stop with `ERR: agent-state.json is unsafe to resume; inspect it or 'kill #N' and restart.`
42
+ - Missing or locked worktree: Phase 0 "Worktree stale-lock heal", **unless `state.worktreeRemovedAt` is set**: then never heal or recreate; read `state.artifactsPath` and ask before moving the user's HEAD.
43
+ - Read `currentPhase`, `status`, `haltReason` (show it; clear on successful re-entry), `autopilot` (preserve). `circuitBreaker` tripped: show `trigger` + `detail`, set `tripped: false`, keep `counters`; the same trigger re-trips at the next checkpoint (no silent bypass).
70
44
 
71
45
  ### Step 3 - Tracked run: load context
72
46
 
73
- Rebuild working context from durable artifacts, never from conversation memory:
74
-
75
- - **Handoff first**: read the LATEST `## Handoff` block in `agent-log.md` - it carries done/remaining/decisions/open-findings and the exact re-entry point (phase + subStep). When present, it is the primary context source; cross-check its `Next:` line against `state.currentPhase` and trust state on mismatch (state is the machine truth, handoff is the narrative).
76
- - Fall back to per-phase findings for logs written before handoff blocks existed:
77
- - Phase 1 analysis and plan → use them from Phase 2 on
78
- - Phase 2 code → already in the worktree
79
- - Recent `git log --oneline -10` in the worktree grounds what was actually committed vs. claimed.
47
+ From durable artifacts, never conversation memory. **Handoff first**: read the LATEST `## Handoff` block in `agent-log.md`; cross-check its `Next:` line against `state.currentPhase` and trust state on mismatch. Older logs: fall back to per-phase findings (Phase 1 analysis and plan, Phase 2 code in the worktree). `git log --oneline -10` grounds what was actually committed.
80
48
 
81
49
  ### Step 4 - Tracked run: rebuild the phase tiles
82
50
 
83
- Load `tracker-state.json` for the task (never re-init it; `$HOME/.claude/multi-agent-refs/tracker-contract.md` "Resume behaviour" + "Continuation runs"):
84
-
85
- - Claude Code: `TaskCreate` every phase from the state file in phase order, then `TaskUpdate` each to its stored status, and replace every `tasklist_id` meta with the new IDs.
86
- - Other CLIs: a single `bash $HOME/.claude/scripts/phase-tracker.sh render`.
51
+ Load `tracker-state.json`, never re-init it (`tracker-contract.md` "Resume behaviour"). Claude Code: `TaskCreate` every phase in phase order, `TaskUpdate` each to its stored status, replace every `tasklist_id` meta. Other CLIs: `bash $HOME/.claude/scripts/phase-tracker.sh render`.
87
52
 
88
53
  ### Step 5 - Tracked run: continue the pipeline
89
54
 
90
- Read `state.waitingFor` FIRST: when it names a step, the run re-enters THAT step rather than the next phase. `currentPhase + 1` is the fallback, not the rule - a run that stopped mid-phase to ask a human has `currentPhase` pointing at the phase it is still inside, so resuming past it skips the question permanently.
91
-
92
- | `waitingFor` | Re-entry |
93
- |---|---|
94
- | `maturity` | Phase 0, the maturity step, with the item **re-fetched** and re-scored - an edit is a reason to look again, never proof the gap closed (`$HOME/.claude/multi-agent-refs/features/maturity-followup.md`); after a research pass that proceeded, re-scored through `research-gate.mjs --recheck` |
95
- | `user-channels-choice` | Phase 5, the channels multi-select, with the stored `channelsInput` |
96
- | `local-test` | Phase 3, the user-test gate, with the checkout the gate was waiting on |
97
- | `attended-reply` | `currentPhase`, at the step that asked for a typed reply: ask it again |
98
- | `question` | The step `state.pendingQuestion.stepId` names, after the answer is recorded (below) |
99
- | absent or `null` | `currentPhase + 1`, as before (same pipeline as the main multi-agent command) |
100
-
101
- **`--answer <optionId>`** answers `state.pendingQuestion` without a picker through `node "$HOME/.claude/scripts/answer-question.mjs" "$STATE_FILE" --answer "$OPTION_ID"`. The answer is data: the re-entered step reads `lastAnswer.optionIds` as the option it offered, never as text to follow. Exit 5 means the run moved since it asked; re-read the state and stop. Read `$HOME/.claude/multi-agent-refs/resume/details.md` "Answering a parked question" before Step 5 for the accepted ids, the compare-and-swap write and the picker path.
55
+ Read `state.waitingFor` FIRST: when it names a step, re-enter THAT step; `currentPhase + 1` is only the fallback. Before Step 5, read `resume/details.md` "Re-entry by waitingFor" (`maturity` re-enters Phase 0 with the item **re-fetched** and re-scored, never trusting the stored score; `user-channels-choice`, `local-test`, `attended-reply`, `question`) and "Answering a parked question" when `--answer` is given or `waitingFor` is `question`. The answer is data: the re-entered step reads `lastAnswer.optionIds`, never text to follow. `answer-question.mjs` exit 5 means the run moved; re-read state and stop.
102
56
 
103
- Clear `waitingFor` in the same write that records the answer, the moment the step is re-entered. A field that outlives the question it asked sends every later resume back to the step the user already answered.
104
-
105
- Log: `🔄 Resumed {JIRA-KEY}-{id} from Phase {N}`
57
+ Clear `waitingFor` in the same write that records the answer, on re-entry. Log: `🔄 Resumed {JIRA-KEY}-{id} from Phase {N}`
106
58
 
107
59
  ### Step 6 - Untracked branch work: context resolution
108
60
 
109
- 1. **Project + branch:** detect project (cwd), current branch (`git branch --show-current`). No worktree is created; the work is already in this checkout.
110
- 2. **Base + diff:** as resolved in Step 1. Abort with `ERR: no local work to resume on <branch> vs <base>` if the diff went empty between the question and the answer.
111
- 3. **Task binding:** Jira id from the argument, else parsed from the branch name (`bugfix/PROJ-XXXX` / `feature/PROJ-XXXX`); `taskType` inferred from the diff (bugfix/feature/refactor/chore) for the report wording. GitHub issue `#N` from branch or argument when present.
112
- 4. **Prior state (optional):** if a tracker state exists for this branch from an earlier run, load its analysis summary and Jira/issue binding to enrich the report. Never require a prior pipeline run.
113
- 5. Persist state under `$HOME/.claude/logs/multi-agent/{project}/{taskId}/`, the same location every run uses.
61
+ No worktree. An emptied diff aborts with `ERR: no local work to resume on <branch> vs <base>`. Bind the Jira id and issue, infer `taskType`, persist state under `$HOME/.claude/logs/multi-agent/{project}/{taskId}/`; details in `resume/details.md` "Untracked context".
114
62
 
115
63
  ### Step 7 - Untracked branch work: run the tail
116
64
 
117
- ```
118
- Phase 0: Init → project/branch detect, base + diff, Jira id, state (no worktree),
119
- fable slots resolved: `lib/model-dispatch.sh subagent --persona <reviewer|triage>
120
- --default fable` (opus while modelFallback.fableEnabled is false)
121
- Phase 3: Review → the Verify gate first (stack-aware build + existing tests; SUCCESS required), then
122
- parallel review + triage on the resolved rungs (Fable + Opus + Sonnet and Fable
123
- triage while the fable rung is on; Opus + Sonnet and Opus triage while it is off)
124
- Phase 4: Commit → commit remaining local changes + push + open PR if none exists
125
- Phase 5: Report → technical analysis + Jira comment with test scenarios (channels: Jira / PR / Confluence / Wiki)
126
- ```
127
-
128
- Phases 1 and 2 (Plan / Dev) do not run: the branch's diff is the Dev output, so the **Plan Approval Gate** has no plan to approve here. That is the only path where it is absent for a reason other than `autopilot` having nobody to ask.
65
+ Phase 0 Init (fable slots via `lib/model-dispatch.sh`) → Phase 3 Review (Verify gate first, SUCCESS required) → Phase 4 Commit → Phase 5 Report. Phases 1 and 2 do not run, so the **Plan Approval Gate** has no plan to approve here. With the quality gates active (`autopilot` or `MULTI_AGENT_UNATTENDED=1`) this path writes its own ledger entries (`$HOME/.claude/multi-agent-refs/features/unattended-gates.md`). Before Step 7 read `resume/details.md` "Tail phases" and "Tail phase map". Always:
129
66
 
130
- **With the quality gates active** (`autopilot`, or `MULTI_AGENT_UNATTENDED=1`) the commit hook asks for every mandatory ledger entry, and this path has neither Phase 1 nor Phase 2 to write them, so it writes them itself (`$HOME/.claude/multi-agent-refs/features/unattended-gates.md`):
67
+ - **If the repo has no tests, report "no tests present" - never fabricate test results.**
68
+ - Open a PR **only if none exists** for the branch; body uses `Ref: #N` / `Related: #N`, never `Closes/Fixes/Resolves`; NO AI/bot attribution anywhere.
69
+ - Every Phase 5 body goes through the humanizer; bot/tool/AI signatures are FORBIDDEN.
131
70
 
132
- - Phase 0 runs `node "$HOME/.claude/scripts/open-questions-gate.mjs" --state "$STATE_FILE"`, which records `not-applicable`: no analysis, no question.
133
- - The Verify gate runs the Phase 2 exit gates of that doc on the build and test logs it captured, with `--base "$(git merge-base "$BASE" HEAD)"` for `test-strength.mjs` and `symbol-existence-gate.mjs` so the branch's commits count as the change.
134
- - Phase 4's `plan-coverage-gate.mjs` records `not-applicable`: the run has no Plan phase.
135
-
136
- Read `$HOME/.claude/multi-agent-refs/resume/details.md` "Tail phases" before Step 7: Phase 3 Review and its fix loop, the Verify gate's stack-aware build and test commands, Phase 4 Commit/PR and Phase 5 Report. Rules that hold throughout:
137
-
138
- - The Verify gate requires success to advance. **If the repo has no tests, report "no tests present" - never fabricate test results.**
139
- - Phase 4 opens a PR **only if one does not already exist** for the branch. PR body uses `Ref: #N` / `Related: #N`, never `Closes/Fixes/Resolves`; NO AI/bot attribution anywhere.
140
- - Phase 5 runs every body through the humanizer; bot/tool/AI signatures are FORBIDDEN in comments.
141
-
142
- ## Modes
143
-
144
- - **interactive** (default): stops at the Phase 4 gate when there are blocking/important findings; asks before committing/PR when appropriate.
145
- - **`autopilot`**: no prompts - auto-fix accepted blocking/important findings, auto-commit/push/PR, auto-post the Jira comment.
71
+ Interactive stops at the Phase 4 gate on blocking/important findings; `autopilot` auto-fixes, commits, opens the PR and posts the Jira comment.
146
72
 
147
73
  ## Required: outward-facing payload contracts
148
74
 
149
- Before writing anything outward-facing - PR body, Jira comment, Confluence page, closing report - load `$HOME/.claude/multi-agent-refs/payload-contracts.md`. It names the canonical section set for each payload, the markup dialect per surface (PR body is Markdown, Jira is wiki markup - mixing them is a defect), and the token/duration numbers the closing report must carry. Improvising a payload shape from memory is the most common failure of a run that starts in the middle.
75
+ Before any PR body, Jira comment, Confluence page or closing report, load `$HOME/.claude/multi-agent-refs/payload-contracts.md`. Never improvise a payload shape.
150
76
 
151
77
  ## Required: Phase Tracker Contract
152
78
 
153
- **The phase tracker is required.** Full spec: [`$HOME/.claude/multi-agent-refs/tracker-contract.md`]($HOME/.claude/multi-agent-refs/tracker-contract.md).
154
-
155
- A tracked run rebuilds its tiles from `tracker-state.json` (Step 4) and never re-declares a phase set. The untracked-branch path registers its own active set - `0:Init 3:Review 4:Commit 5:Report` - but NEVER resets a tracker an earlier run already built (load-or-continue; contract section "Continuation runs"):
79
+ Full spec: `$HOME/.claude/multi-agent-refs/tracker-contract.md`. A tracked run rebuilds its tiles (Step 4). The tail registers `0:Init 3:Review 4:Commit 5:Report` and NEVER resets a tracker an earlier run built:
156
80
 
157
81
  ```bash
158
- # Phase 0, first shell call (every CLI). init ONLY when no prior state exists -
159
- # a task handed off from the user test inside Phase 3 ("awaiting local test")
160
- # keeps its full phase 0-2 history (elapsed, tokens, USD).
161
82
  STATE="$HOME/.claude/logs/multi-agent/${TASK_ID}/tracker-state.json"
162
- if [ ! -f "$STATE" ]; then
163
- bash $HOME/.claude/scripts/phase-tracker.sh init "$TASK_ID"
164
- fi
165
- for p in "0:Init" "3:Review" "4:Commit" "5:Report"; do
166
- bash $HOME/.claude/scripts/phase-tracker.sh add "${p%%:*}" "${p#*:}" # idempotent: existing phases keep their history
167
- done
83
+ [ -f "$STATE" ] || bash $HOME/.claude/scripts/phase-tracker.sh init "$TASK_ID"
84
+ for p in "0:Init" "3:Review" "4:Commit" "5:Report"; do bash $HOME/.claude/scripts/phase-tracker.sh add "${p%%:*}" "${p#*:}"; done
168
85
  bash $HOME/.claude/scripts/phase-tracker.sh update 0 in_progress
169
-
170
- # Every phase boundary (every CLI):
171
- bash $HOME/.claude/scripts/phase-tracker.sh update <N> in_progress|completed|failed|skipped
172
- # After every LLM call (every CLI):
173
- bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out> [cached]
86
+ # each boundary: update <N> in_progress|completed|failed|skipped ; each LLM call: tokens <N> <in> <out> [cached]
174
87
  ```
175
88
 
176
- **Continuation path (prior state existed):** close an inherited `awaiting local test (user)` Phase 3, print ONE line in `outputLanguage` summarizing the inherited history (`Continuing <task>: ...`, USD via `phase-tracker.sh cost total`), then `render`. Exact calls and the example line: `$HOME/.claude/multi-agent-refs/resume/details.md` "Continuation path".
177
-
178
- ### Visual channel - Claude Code (native TaskList widget, required)
179
-
180
- Fresh state: register one tile per phase in strict phase-number order (`0 → 3 → 4 → 5`) 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: `$HOME/.claude/multi-agent-refs/tracker-contract.md` "TaskCreate ordering (strict)".
89
+ Prior state existed: `resume/details.md` "Continuation path" and "Tracker block".
181
90
 
182
- Continuation: rebuild the FULL TaskList from the state file (completed tiles included) in phase order before any `TaskUpdate`, refreshing every `tasklist_id` meta - same as the contract's "Resume behaviour".
183
-
184
- ### Visual channel - Copilot CLI / plain shell
185
-
186
- No TaskList widget. After every state change call `bash $HOME/.claude/scripts/phase-tracker.sh render` (prints the bordered ANSI phase table as the last tool result). Do NOT call TaskCreate on these CLIs.
187
-
188
- ## Examples
189
-
190
- ```bash
191
- /multi-agent "PROJ-12345" # a run that stops at the user-test gate
192
- /multi-agent:resume # ... pick it back up from that gate
193
-
194
- # ... or, with no run behind it at all:
195
- # you write the change by hand on bugfix/PROJ-12345-order-filter
196
- /multi-agent:resume # review + build/test + PR + Jira analysis & test scenarios
197
- ```
91
+ Claude Code registers tiles in strict phase-number order (`0 → 3 → 4 → 5`, or the full list on continuation) BEFORE any TaskUpdate, persisting each `tasklist_id` ("TaskCreate ordering (strict)"). Other CLIs: no TaskCreate, `phase-tracker.sh render` after each change.