@mmerterden/multi-agent-pipeline 20.36.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 (191) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/docs/facts.json +1 -1
  3. package/install/catalog-history.json +1 -1
  4. package/manifest.json +194 -122
  5. package/package.json +1 -1
  6. package/pipeline/commands/multi-agent/SKILL.md +33 -154
  7. package/pipeline/commands/multi-agent/analysis/SKILL.md +14 -68
  8. package/pipeline/commands/multi-agent/analysis-jira/SKILL.md +5 -8
  9. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +38 -109
  10. package/pipeline/commands/multi-agent/channels/SKILL.md +38 -167
  11. package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +37 -144
  12. package/pipeline/commands/multi-agent/design-check/SKILL.md +27 -131
  13. package/pipeline/commands/multi-agent/garbage-collect/SKILL.md +22 -48
  14. package/pipeline/commands/multi-agent/ios-coding-standard/SKILL.md +37 -180
  15. package/pipeline/commands/multi-agent/jira/SKILL.md +16 -46
  16. package/pipeline/commands/multi-agent/refactor/SKILL.md +23 -184
  17. package/pipeline/commands/multi-agent/resume/SKILL.md +30 -136
  18. package/pipeline/commands/multi-agent/review/SKILL.md +24 -199
  19. package/pipeline/commands/multi-agent/setup/SKILL.md +25 -181
  20. package/pipeline/commands/multi-agent/stack/SKILL.md +9 -53
  21. package/pipeline/commands/multi-agent/status/SKILL.md +13 -2
  22. package/pipeline/commands/multi-agent/store-ready/SKILL.md +27 -226
  23. package/pipeline/commands/multi-agent/sync/SKILL.md +35 -164
  24. package/pipeline/commands/multi-agent/test-gen/SKILL.md +2 -4
  25. package/pipeline/commands/multi-agent/update/SKILL.md +18 -60
  26. package/pipeline/contract/CHANGELOG.md +9 -0
  27. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  28. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  29. package/pipeline/contract/fixtures/error-unsigned.json +1 -1
  30. package/pipeline/contract/fixtures/runs-awaiting-question.json +1 -1
  31. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  32. package/pipeline/contract/fixtures/runs-failed.json +1 -1
  33. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +1 -1
  34. package/pipeline/contract/fixtures/runs-pr-opened.json +1 -1
  35. package/pipeline/contract/fixtures/runs-running.json +1 -1
  36. package/pipeline/contract/manifest.json +5 -5
  37. package/pipeline/contract/types/index.d.ts +3 -2
  38. package/pipeline/multi-agent-refs/autopilot-on/details.md +148 -0
  39. package/pipeline/multi-agent-refs/channels/generator.md +14 -0
  40. package/pipeline/multi-agent-refs/channels/preview.md +13 -0
  41. package/pipeline/multi-agent-refs/channels/reference.md +46 -0
  42. package/pipeline/multi-agent-refs/complaint-analysis/phases.md +159 -0
  43. package/pipeline/multi-agent-refs/design-check/export.md +1 -0
  44. package/pipeline/multi-agent-refs/design-check/init-inventory.md +1 -1
  45. package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +64 -0
  46. package/pipeline/multi-agent-refs/features/analysis-command-notes.md +53 -0
  47. package/pipeline/multi-agent-refs/garbage-collect/phases.md +60 -0
  48. package/pipeline/multi-agent-refs/ios-coding-standard/plan.md +71 -0
  49. package/pipeline/multi-agent-refs/ios-coding-standard/resolve-and-scan.md +135 -0
  50. package/pipeline/multi-agent-refs/jira/picker-detail.md +71 -0
  51. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +88 -0
  52. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +96 -1
  53. package/pipeline/multi-agent-refs/refactor/sweep.md +190 -0
  54. package/pipeline/multi-agent-refs/resume/details.md +115 -2
  55. package/pipeline/multi-agent-refs/review/inputs.md +33 -1
  56. package/pipeline/multi-agent-refs/review/module-guides.md +9 -1
  57. package/pipeline/multi-agent-refs/review/panel.md +75 -0
  58. package/pipeline/multi-agent-refs/review/valven.md +5 -1
  59. package/pipeline/multi-agent-refs/setup/hooks-and-plugins.md +4 -0
  60. package/pipeline/multi-agent-refs/setup/token-save-flow.md +13 -0
  61. package/pipeline/multi-agent-refs/stack/background.md +72 -0
  62. package/pipeline/multi-agent-refs/store-ready/gates.md +139 -0
  63. package/pipeline/multi-agent-refs/store-ready/report.md +40 -2
  64. package/pipeline/multi-agent-refs/sync/office.md +10 -0
  65. package/pipeline/multi-agent-refs/sync/overview.md +61 -0
  66. package/pipeline/multi-agent-refs/sync/repo.md +91 -0
  67. package/pipeline/multi-agent-refs/update/details.md +83 -0
  68. package/pipeline/schemas/runs-index.schema.json +2 -1
  69. package/pipeline/scripts/contract-server.mjs +1 -1
  70. package/pipeline/scripts/runs-index.mjs +34 -7
  71. package/pipeline/scripts/status-overview.mjs +401 -0
  72. package/pipeline/skills/.skill-manifest.json +63 -63
  73. package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +7 -70
  74. package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +67 -0
  75. package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +8 -0
  76. package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +10 -72
  77. package/pipeline/skills/shared/core/google-play-compliance/references/examples.md +69 -0
  78. package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +7 -0
  79. package/pipeline/skills/shared/core/google-play-compliance/references/version-history.md +5 -0
  80. package/pipeline/skills/shared/core/multi-agent/SKILL.md +39 -262
  81. package/pipeline/skills/shared/core/multi-agent-autopilot-on/SKILL.md +35 -73
  82. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +37 -337
  83. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +27 -122
  84. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +8 -340
  85. package/pipeline/skills/shared/core/multi-agent-ios-coding-standard/SKILL.md +37 -180
  86. package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +23 -184
  87. package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +14 -82
  88. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +25 -277
  89. package/pipeline/skills/shared/core/multi-agent-status/SKILL.md +13 -2
  90. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +73 -217
  91. package/pipeline/skills/shared/external/alarmkit/SKILL.md +11 -162
  92. package/pipeline/skills/shared/external/alarmkit/references/alarmkit-code.md +257 -0
  93. package/pipeline/skills/shared/external/android-architecture/SKILL.md +7 -58
  94. package/pipeline/skills/shared/external/android-architecture/references/code-examples.md +68 -0
  95. package/pipeline/skills/shared/external/app-intents/SKILL.md +3 -45
  96. package/pipeline/skills/shared/external/app-intents/references/code-examples.md +54 -0
  97. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +5 -81
  98. package/pipeline/skills/shared/external/app-store-optimization/references/engagement-and-localization.md +96 -0
  99. package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -112
  100. package/pipeline/skills/shared/external/app-store-review/references/monetization-and-submission.md +138 -0
  101. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +10 -117
  102. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models-code.md +186 -0
  103. package/pipeline/skills/shared/external/authentication/SKILL.md +3 -50
  104. package/pipeline/skills/shared/external/authentication/references/code-examples.md +59 -0
  105. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +3 -84
  106. package/pipeline/skills/shared/external/callkit-voip/references/code-examples.md +93 -0
  107. package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +7 -263
  108. package/pipeline/skills/shared/external/ci-cd-pipelines/references/pipeline-examples.md +281 -0
  109. package/pipeline/skills/shared/external/clean-code/SKILL.md +8 -41
  110. package/pipeline/skills/shared/external/clean-code/references/code-examples.md +56 -0
  111. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +8 -146
  112. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-code.md +214 -0
  113. package/pipeline/skills/shared/external/compose-components/SKILL.md +6 -80
  114. package/pipeline/skills/shared/external/compose-components/references/code-examples.md +89 -0
  115. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +5 -64
  116. package/pipeline/skills/shared/external/compose-navigation/references/code-examples.md +70 -0
  117. package/pipeline/skills/shared/external/core-data/SKILL.md +9 -157
  118. package/pipeline/skills/shared/external/core-data/references/core-data-code.md +221 -0
  119. package/pipeline/skills/shared/external/core-nfc/SKILL.md +3 -89
  120. package/pipeline/skills/shared/external/core-nfc/references/code-examples.md +98 -0
  121. package/pipeline/skills/shared/external/coreml/SKILL.md +17 -133
  122. package/pipeline/skills/shared/external/coreml/references/coreml-code.md +208 -0
  123. package/pipeline/skills/shared/external/css-modern/SKILL.md +8 -131
  124. package/pipeline/skills/shared/external/css-modern/references/code-examples.md +142 -0
  125. package/pipeline/skills/shared/external/database-patterns/SKILL.md +6 -103
  126. package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +112 -0
  127. package/pipeline/skills/shared/external/html-semantic/SKILL.md +7 -48
  128. package/pipeline/skills/shared/external/html-semantic/references/code-examples.md +54 -0
  129. package/pipeline/skills/shared/external/humanizer/SKILL.md +6 -19
  130. package/pipeline/skills/shared/external/humanizer/references/voice.md +24 -0
  131. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +13 -170
  132. package/pipeline/skills/shared/external/ios-accessibility/references/assistive-tech-review.md +224 -0
  133. package/pipeline/skills/shared/external/ios-localization/SKILL.md +2 -24
  134. package/pipeline/skills/shared/external/ios-localization/references/code-examples.md +30 -0
  135. package/pipeline/skills/shared/external/ios-networking/SKILL.md +3 -58
  136. package/pipeline/skills/shared/external/ios-networking/references/code-examples.md +67 -0
  137. package/pipeline/skills/shared/external/ios-security/SKILL.md +4 -64
  138. package/pipeline/skills/shared/external/ios-security/references/code-examples.md +74 -0
  139. package/pipeline/skills/shared/external/live-activities/SKILL.md +4 -90
  140. package/pipeline/skills/shared/external/live-activities/references/code-examples.md +108 -0
  141. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +9 -23
  142. package/pipeline/skills/shared/external/localization-reuse-map/references/project-settings.md +22 -0
  143. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +5 -95
  144. package/pipeline/skills/shared/external/mapkit-location/references/code-examples.md +117 -0
  145. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +7 -106
  146. package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +124 -0
  147. package/pipeline/skills/shared/external/permissionkit/SKILL.md +2 -31
  148. package/pipeline/skills/shared/external/permissionkit/references/code-examples.md +37 -0
  149. package/pipeline/skills/shared/external/play-store-review/SKILL.md +6 -74
  150. package/pipeline/skills/shared/external/play-store-review/references/signing-and-policies.md +83 -0
  151. package/pipeline/skills/shared/external/push-notifications/SKILL.md +8 -125
  152. package/pipeline/skills/shared/external/push-notifications/references/notification-code.md +176 -0
  153. package/pipeline/skills/shared/external/python-patterns/SKILL.md +7 -158
  154. package/pipeline/skills/shared/external/python-patterns/references/python-examples.md +176 -0
  155. package/pipeline/skills/shared/external/rest-api-design/SKILL.md +7 -157
  156. package/pipeline/skills/shared/external/rest-api-design/references/api-examples.md +175 -0
  157. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +11 -230
  158. package/pipeline/skills/shared/external/swift-architecture/references/pattern-examples.md +295 -0
  159. package/pipeline/skills/shared/external/swift-codable/SKILL.md +17 -149
  160. package/pipeline/skills/shared/external/swift-codable/references/codable-recipes.md +207 -0
  161. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +12 -99
  162. package/pipeline/skills/shared/external/swift-concurrency/references/code-examples.md +100 -0
  163. package/pipeline/skills/shared/external/swift-concurrency/references/swift-6-2-additions.md +18 -0
  164. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +9 -78
  165. package/pipeline/skills/shared/external/swift-formatstyle/references/formatstyle-examples.md +113 -0
  166. package/pipeline/skills/shared/external/swift-language/SKILL.md +3 -56
  167. package/pipeline/skills/shared/external/swift-language/references/code-examples.md +65 -0
  168. package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +1 -0
  169. package/pipeline/skills/shared/external/swiftdata/SKILL.md +6 -122
  170. package/pipeline/skills/shared/external/swiftdata/references/code-examples.md +140 -0
  171. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +12 -139
  172. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/interop-code.md +198 -0
  173. package/pipeline/skills/shared/external/tailwind-css/SKILL.md +9 -81
  174. package/pipeline/skills/shared/external/tailwind-css/references/code-examples.md +91 -0
  175. package/pipeline/skills/shared/external/testing-backend/SKILL.md +7 -207
  176. package/pipeline/skills/shared/external/testing-backend/references/testing-examples.md +225 -0
  177. package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +8 -89
  178. package/pipeline/skills/shared/external/typescript-patterns/references/code-examples.md +100 -0
  179. package/pipeline/skills/shared/external/vision-framework/SKILL.md +2 -20
  180. package/pipeline/skills/shared/external/vision-framework/references/code-examples.md +26 -0
  181. package/pipeline/skills/shared/external/vue-composition/SKILL.md +7 -169
  182. package/pipeline/skills/shared/external/vue-composition/references/vue-examples.md +187 -0
  183. package/pipeline/skills/shared/external/web-accessibility/SKILL.md +7 -174
  184. package/pipeline/skills/shared/external/web-accessibility/references/a11y-examples.md +192 -0
  185. package/pipeline/skills/shared/external/web-performance/SKILL.md +8 -66
  186. package/pipeline/skills/shared/external/web-performance/references/code-examples.md +77 -0
  187. package/pipeline/skills/shared/external/web-testing/SKILL.md +11 -186
  188. package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +213 -0
  189. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/format-and-output.md +0 -0
  190. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/publish-and-snapshot.md +0 -0
  191. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/sources-and-recipes.md +0 -0
@@ -12,19 +12,9 @@ confirm: none
12
12
 
13
13
  **Input**: $ARGUMENTS
14
14
 
15
- Skip Phase 0-3 and review a diff only. Five input shapes, two providers:
15
+ Skip Phase 0-3 and review a diff only: empty input (PR picker, or the current branch in autopilot), a branch, or a PR (`#N`, `repo#N`, GitHub or Bitbucket Server URL). Input matrix: `$HOME/.claude/multi-agent-refs/review/inputs.md`.
16
16
 
17
- | Input | Resolution | PR action? |
18
- |---|---|---|
19
- | (empty), interactive | **PR picker** - list open GitHub + Bitbucket PRs, multi-select which to review | Yes (per selected PR) |
20
- | (empty), autopilot / no PRs found | Current branch (`HEAD` vs `origin/develop`) | No (chat only) |
21
- | `feature/foo` | Named local branch | No (chat only) |
22
- | `#1250` | PR number on the current repo | Yes |
23
- | `repo#1250` | PR on a specific repo (GitHub `org/repo`) | Yes |
24
- | `https://github.com/.../pull/1250` | GitHub PR URL | Yes |
25
- | `https://bitbucket.<host>/projects/<KEY>/repos/<slug>/pull-requests/<N>/...` | Bitbucket Server PR URL | Yes |
26
-
27
- Branch-mode runs print to chat only. PR-mode runs print to chat AND post the verdict to the PR per `$HOME/.claude/multi-agent-refs/channels/pr-review-actions.md`: per-finding inline comments + an explicit approve / needs-work state. **No monolithic advisory comment** is ever posted.
17
+ Branch mode prints to chat only. PR mode also posts per `$HOME/.claude/multi-agent-refs/channels/pr-review-actions.md`: inline comments + an approve / needs-work state.
28
18
 
29
19
  ## Gotchas
30
20
 
@@ -33,14 +23,11 @@ Branch-mode runs print to chat only. PR-mode runs print to chat AND post the ver
33
23
 
34
24
  ## Steps
35
25
 
36
- ### 0. Session bootstrap - TASK_ID + tmp cleanup
26
+ ### 0. Session bootstrap
37
27
 
38
28
  ```bash
39
- # Standalone /multi-agent:review invocations may not inherit a pipeline TASK_ID.
40
- # Seed one so /tmp paths don't collide across concurrent reviews.
41
29
  : "${TASK_ID:=review-$(date +%s)-$$}"
42
30
  export TASK_ID
43
-
44
31
  trap 'rm -f /tmp/multi-agent-review-${TASK_ID}-*' EXIT
45
32
  ```
46
33
 
@@ -48,227 +35,65 @@ Standalone only (a `review-` id): register a tracker record per `$HOME/.claude/m
48
35
 
49
36
  ### 1. Parse the input - pick a resolution path
50
37
 
51
- ```bash
52
- # Pseudocode - orchestrator implements this:
53
- input="$ARGUMENTS"
54
- case "$input" in
55
- "") kind=pick # interactive: go to Step 1a PR picker; autopilot/no-PRs falls back to branch (see 1a)
56
- ;;
57
- https://github.com/*/pull/*) kind=pr; provider=github; org_repo=<extracted>; pr_number=<extracted> ;;
58
- https://bitbucket.*/projects/*/repos/*/pull-requests/*)
59
- kind=pr; provider=bitbucket-server
60
- bb_server_host=<extracted host>
61
- bb_project_key=<extracted KEY>
62
- bb_repo_slug=<extracted slug>
63
- pr_number=<extracted N>
64
- ;;
65
- *#[0-9]*) kind=pr; provider=github; org_repo="${input%%#*}"; pr_number="${input##*#}" ;;
66
- '#'[0-9]*) kind=pr; provider=github; org_repo=$(gh repo view --json nameWithOwner -q .nameWithOwner); pr_number="${input#'#'}" ;;
67
- [0-9]*) kind=pr; provider=github; org_repo=$(gh repo view --json nameWithOwner -q .nameWithOwner); pr_number="$input" ;;
68
- *) kind=branch; provider=local; ref="$input" ;;
69
- esac
70
- ```
38
+ Empty -> `kind=pick`; `https://github.com/*/pull/*`, `repo#N`, `#N` or a bare number -> `kind=pr; provider=github`; `https://bitbucket.*/projects/*/repos/*/pull-requests/*` -> `kind=pr; provider=bitbucket-server`; anything else -> `kind=branch; provider=local`. Before parsing, read `review/inputs.md` "Step 1": the case block and field extraction.
71
39
 
72
- Save to `agent-state.review.input = { kind, provider, ref?, orgRepo?, bbServerHost?, bbProjectKey?, bbRepoSlug?, prNumber?, raw }`.
73
-
74
- When `provider=github` and the diff is fetched in Step 2, also persist `agent-state.review.headCommitSha` - GitHub inline-comment posts (`POST /repos/{o}/{r}/pulls/{n}/comments`) require `commit_id`. Bitbucket Server's anchor API does not.
40
+ Save to `agent-state.review.input = { kind, provider, ref?, orgRepo?, bbServerHost?, bbProjectKey?, bbRepoSlug?, prNumber?, raw }`. For `github`, Step 2 also persists `agent-state.review.headCommitSha` (inline comments need `commit_id`).
75
41
 
76
42
  ### 1a. No-input PR picker - interactive only
77
43
 
78
- Reached when `kind=pick` (empty input). Skipped entirely in autopilot: autopilot with no ref goes straight to branch mode (`kind=branch; provider=local; ref=$(git rev-parse --abbrev-ref HEAD)`) so nothing prompts.
79
-
80
- List open PRs from both providers (a provider whose token or CLI is absent contributes nothing - never hard-fail on one provider), merge, dedupe and sort by `updatedAt` desc; an empty list falls back to branch mode. Ask with `AskUserQuestion` `multiSelect: true` per `$HOME/.claude/multi-agent-refs/picker-contract.md`, then **loop Steps 2-7 once per selected PR**; selecting none falls back to branch mode. Read `$HOME/.claude/multi-agent-refs/review/inputs.md` before Step 1a: the list commands, the picker fields and the descriptor mapping.
44
+ Autopilot skips it: no ref means branch mode on the current branch, no prompt. Otherwise list open PRs from both providers (an absent token or CLI contributes nothing, never a hard failure), ask `AskUserQuestion` `multiSelect: true` per `$HOME/.claude/multi-agent-refs/picker-contract.md`, and **loop Steps 2-7 once per selected PR**. An empty list or no selection falls back to branch mode. Commands and fields: `review/inputs.md` "Step 1a".
81
45
 
82
46
  ### 2. Fetch the diff - kind-aware
83
47
 
84
- Branch mode: `git diff origin/develop...{ref}`. PR mode fetches through the provider: `gh pr diff` for `github`, which also persists `agent-state.review.headCommitSha`; the Bitbucket Server REST diff endpoint for `bitbucket-server`, with credentials resolved through `prefs.global.keychainMapping` (never hardcoded key names) and any non-200 response a hard failure. Read `$HOME/.claude/multi-agent-refs/review/inputs.md` "Step 2" before fetching: the exact commands per provider.
85
-
86
- Save the diff to `/tmp/multi-agent-review-${TASK_ID}-diff.patch` so reviewers can re-read it.
48
+ Branch: `git diff origin/develop...{ref}`. GitHub: `gh pr diff`, plus `headCommitSha`. Bitbucket Server: the REST diff endpoint, credentials through `prefs.global.keychainMapping` (never hardcoded key names, never on argv), any non-200 a hard failure. Read `review/inputs.md` "Step 2" before fetching. Save to `/tmp/multi-agent-review-${TASK_ID}-diff.patch`.
87
49
 
88
- ### 2b. Module review guides - path-scoped convention files
50
+ ### 2b. Module review guides
89
51
 
90
- A module in the repo may carry its own CLAUDE guide - a convention/checklist file living somewhere in the module's directory tree that the host CLI never auto-loads. When a changed file's module has such a guide, the review must consult it. Discovery is deterministic, from the diff's changed paths:
91
-
92
- Read `$HOME/.claude/multi-agent-refs/review/module-guides.md` before Step 2b: the discovery walk (guide file names, the root-level exclusion, the cap of 5 with dropped guides logged) and the provider-API probe for PR mode without a local checkout. No hit: the step is a silent no-op.
93
-
94
- Persist `agent-state.review.moduleGuides = [<repo-relative paths>]` and inject into every reviewer prompt (Step 3):
95
-
96
- > MODULE REVIEW GUIDES: before reviewing, read each of these guide files. Apply a guide's rules/checklist to every changed file under its directory. Guide violations are findings like any other - triage them by severity.
97
-
98
- Scope note: a guide governs only files under its own directory - a guide found under one module must not be applied to a sibling module's changes in the same PR.
52
+ A changed module's own CLAUDE guide must be consulted. Read `$HOME/.claude/multi-agent-refs/review/module-guides.md` before Step 2b: discovery, the cap of 5, the PR-mode probe, and the prompt block injected into every Step 3 reviewer. No hit: silent no-op. Persist `agent-state.review.moduleGuides`. A guide governs only files under its own directory.
99
53
 
100
54
  ### 2c. Valven delivery rules - required on every input
101
55
 
102
- The `valven-rules` registry (`ai-common-toolkit`) is applied to every review, in `review` mode. Collect what the gate needs, then run it:
103
-
104
- Read `$HOME/.claude/multi-agent-refs/review/valven.md` before Step 2c: the per-input gate arguments, the checkout-vs-diff-file choice, and the handling of the split, old-work, judgement (`VLV-SCOPE-02`, `VLV-PRDESC-02`, injected into every Step 3 reviewer prompt), cycle and pickup rules. Two rules hold on every input:
105
-
106
- - Exit 2: print the stderr line and continue the review with `Valven: not measured (<reason>)` in the Step 6 summary. Never print it as passed.
107
- - The gate's `findings[]` join the reviewer findings at Step 5 with `tag: valven`. They are measurements, so triage accepts them unless the task is exempt; an accepted `important` or `blocking` one makes the Step 7 decision NEEDS WORK.
56
+ Read `$HOME/.claude/multi-agent-refs/review/valven.md` before Step 2c: gate arguments per input, every rule family, and the judgement rules each Step 3 prompt gets. Always:
108
57
 
109
- Step 6 adds one line under the table: `Valven: <n> finding(s) · <changedLines> lines / <fileCount> files · split: <yes N slices|no>`, plus for a PR `Valven scores: churn · coding · pickup · review` from `scores` (`-` when absent).
58
+ - Exit 2: print the stderr line and continue with `Valven: not measured (<reason>)` in the Step 6 summary. Never print it as passed.
59
+ - `findings[]` join at Step 5 with `tag: valven`, accepted unless the task is exempt; an accepted `important` or `blocking` one makes Step 7 NEEDS WORK. Step 6 adds its "Summary lines".
110
60
 
111
61
  ### 3. Launch parallel reviewers - host-CLI dependent
112
62
 
113
- Every host runs three reviewers; only the second slot differs, because GPT-5.4 exists on Copilot and Codex but not on Claude Code, where Opus fills it.
114
-
115
- **Resolve the fable slots first (Claude Code).** This command has no Phase 0, so
116
- the `prefs.global.modelFallback.fableEnabled` switch is applied here, once, before
117
- any dispatch:
63
+ Resolve the fable slots first on Claude Code (this command has no Phase 0):
118
64
 
119
65
  ```bash
120
66
  REVIEW_RUNG=$(bash "$HOME/.claude/lib/model-dispatch.sh" subagent --persona reviewer --default fable)
121
67
  TRIAGE_RUNG=$(bash "$HOME/.claude/lib/model-dispatch.sh" subagent --persona triage --default fable)
122
68
  ```
123
69
 
124
- `fable` means the rung is on and Agent 1 runs on Fable. Anything else means it is
125
- off: Agent 1 is dropped, the panel is Agent 2 + Agent 3, triage runs on
126
- `$TRIAGE_RUNG`, and one line is printed:
127
- `INFO: fable rung disabled by prefs; review panel = Opus + Sonnet, triage on <rung>.`
128
- Never dispatch a Fable reviewer or a Fable triage on the model list below alone.
129
-
130
- **Claude Code (3 in parallel while the fable rung is on, 2 while it is off):**
131
- - Agent 1: `claude-fable-5-1` → security + architecture (only when `REVIEW_RUNG` is `fable`)
132
- - Agent 2: `claude-opus-5-5` → edge cases, alternate perspective
133
- - Agent 3: `claude-sonnet-5-5` → general quality
134
-
135
- **Copilot CLI (3 in parallel):**
136
- - Agent 1: `claude-opus-4.7` → security + architecture (Fable is not offered on Copilot CLI)
137
- - Agent 2: `gpt-5.4` → edge cases, alternate perspective
138
- - Agent 3: `claude-sonnet-4.6` → general quality
139
-
140
- **Codex CLI (3 in parallel, single vendor):**
141
- - Agent 1: `gpt-5.6` @ `xhigh` → security + architecture
142
- - Agent 2: `gpt-5.4` @ `high` → edge cases, alternate perspective
143
- - Agent 3: `gpt-5.6` @ `medium` → general quality
70
+ Anything but `fable` drops Agent 1, runs triage on `$TRIAGE_RUNG`, and prints `INFO: fable rung disabled by prefs; review panel = Opus + Sonnet, triage on <rung>.` Never dispatch a Fable reviewer or a Fable triage on the model list alone. Read `$HOME/.claude/multi-agent-refs/review/panel.md` "Reviewers" before dispatch: the per-host panels. Rung switch: `$HOME/.claude/multi-agent-refs/features/model-fallback.md`.
144
71
 
145
- The rung switch and its resolution: `$HOME/.claude/multi-agent-refs/features/model-fallback.md`.
146
-
147
- Each reviewer receives the diff, the module review guides from Step 2b (when any were found), the Valven judgement rules from Step 2c, plus the standard reviewer system prompt (see `$HOME/.claude/multi-agent-refs/phases/phase-3-review.md` for the prompt contract). Output: structured `findings[]` per reviewer.
72
+ Each reviewer gets the diff, the 2b guides, the 2c judgement rules and the prompt from `$HOME/.claude/multi-agent-refs/phases/phase-3-review.md`, and returns `findings[]`.
148
73
 
149
74
  ### 4. Store-compliance cross-reference
150
75
 
151
- When release-relevant iOS/Android files change, load the matching catalog:
152
-
153
- | Platform | Trigger files | Catalog |
154
- |---|---|---|
155
- | iOS | `**/Info.plist`, `**/PrivacyInfo.xcprivacy`, `**/*.entitlements`, `**/*App.swift`, `**/AppDelegate*.swift`, `**/SceneDelegate*.swift`, `**/project.pbxproj` | `$HOME/.claude/skills/apple-archive-compliance/SKILL.md` - 18 rules + ITMS refs |
156
- | Android | `**/AndroidManifest.xml`, `**/build.gradle(.kts)`, `**/proguard-rules.pro`, `**/network_security_config.xml` | `$HOME/.claude/skills/google-play-compliance/SKILL.md` - 21 rules + Play policy refs |
157
-
158
- Each finding gets the `ruleID` from the catalog plus the platform policy ref:
159
- - iOS: `(apple-archive-compliance / info-plist - Guideline 5.1.1)`
160
- - Android: `(google-play-compliance / dangerous-permissions - Policy - Permissions)`
161
-
162
- Catalog-only - does NOT invoke binaries. For a full scan, use `/multi-agent:test "store-ready"`.
76
+ Release-relevant files load the catalog (`apple-archive-compliance` for iOS, `google-play-compliance` for Android); each finding gets its `ruleID` plus the policy ref. Catalog-only, no binaries; a full scan is `/multi-agent:test "store-ready"`. Triggers and paths: `review/panel.md` "Store compliance".
163
77
 
164
78
  ### 4b. Platform parity cross-check (advisory, read-only)
165
79
 
166
- When a counterpart repo resolves whose `stack` is the other mobile platform and
167
- the diff touches a screen, a service, a request model or a localization file,
168
- compare the change against that repo on four axes: endpoints called, parameters
169
- sent, business rules around the call, localization keys used.
170
-
171
- In a product, counterparts are its other repos via `product-context.mjs refs`
172
- and `repo_*`. Otherwise the counterpart is resolved automatically, in both directions (ios ↔ android),
173
- from four sources in this order, first hit wins: `--with <path|owner/repo>` (a
174
- one-off override, remembered like any other resolution), then a remembered
175
- `prefs.projects[<slug>].counterpartRoots[]`, then the primary checkout's sibling
176
- directories, then `state.siblings[]` from the Phase 0 dev-context picker. None of
177
- them is a precondition for the others. One match is used and remembered, so the
178
- next review of the same project asks nothing.
179
-
180
- Several candidates → interactive runs ask once; autopilot and non-interactive
181
- runs skip silently, because an unattended run must not block on a picker. No
182
- candidate → skip silently, run unaffected. Stack comes from marker files, and
183
- you never guess a stack from the repo name.
184
-
185
- Contract: `$HOME/.claude/multi-agent-refs/platform-parity.md`.
186
-
187
- ### 5. Triage (`$TRIAGE_RUNG`: Fable while the rung is on, Opus while it is off)
188
-
189
- Classify findings into:
190
- - 🔴 **Blocking** → must fix
191
- - 🟡 **Important** → fix recommended
192
- - 🟢 **Suggestion** → optional
80
+ When a counterpart repo on the other mobile platform resolves and the diff touches a screen, service, request model or localization file, compare endpoints, parameters, business rules and localization keys. Several candidates ask once interactively and skip silently unattended; none skips silently; the counterpart is never edited. Resolution order (including `--with` and `counterpartRoots`) and output: `$HOME/.claude/multi-agent-refs/platform-parity.md`.
193
81
 
194
- Triage also marks each finding as `accepted` (real issue), `deferred` (real but out of scope), or `rejected` (false positive). Only `accepted` findings appear in the body of the PR comment; `deferred` items go in the Triage notes section.
82
+ ### 5. Triage (`$TRIAGE_RUNG`)
195
83
 
196
- Triage settles every reviewer `cannotVerify` row the way Phase 3 does (`phase-3-review.md` 3.2): `verified` with the file:line read, `finding` with the file:line of the accepted or deferred finding, or `out-of-scope`. Rows left unsettled are listed in the chat summary and in the Triage notes section.
84
+ Classify 🔴 Blocking / 🟡 Important / 🟢 Suggestion; mark each `accepted`, `deferred` (Triage notes) or `rejected`. Only `accepted` reach the PR. Settle every `cannotVerify` row per `phase-3-review.md` 3.2 (`verified` / `finding` / `out-of-scope`, each with its file:line); list unsettled rows.
197
85
 
198
86
  ### 6. Print the chat summary (always)
199
87
 
200
- ```
201
- 🔍 Review Complete · PR #1250 · 3 files +120 -45
202
- | Model | Verdict | Blocking | Important | Suggestion |
203
- |----------|-----------|----------|-----------|------------|
204
- | Fable | approved | 0 | 1 | 3 |
205
- | Opus | approved | 0 | 2 | 2 |
206
- | Sonnet | rejected | 1 | 2 | 5 |
207
-
208
- Consensus: ⚠ DISAGREEMENT - see triage
209
- ```
210
-
211
- One row per reviewer that ran: Fable + Opus + Sonnet on Claude Code (Opus + Sonnet while the fable rung is off), Opus + GPT-5.4 + Sonnet on Copilot CLI, the three GPT rows on Codex CLI. This summary ALWAYS prints, regardless of input mode. The chat is the live conversation; on the PR side, the durable artifacts are inline comments + the review state (Step 7).
88
+ One row per reviewer that ran, then consensus; this ALWAYS prints, in every input mode. Template: `review/panel.md` "Summary".
212
89
 
213
90
  ### 7. Post to PR - only when input.kind === "pr"
214
91
 
215
- The contract (full spec: `$HOME/.claude/multi-agent-refs/channels/pr-review-actions.md`):
216
-
217
- - **Decision** - purely from `accepted` finding counts:
218
- - 0 accepted blocking AND 0 accepted important → **APPROVE**
219
- - ≥1 accepted blocking OR ≥1 accepted important → **NEEDS WORK / REQUEST CHANGES**
220
- - Suggestions never block and never post inline; they stay in chat only.
92
+ - **Decision** from `accepted` counts: 0 accepted blocking AND 0 accepted important -> **APPROVE**; ≥1 accepted blocking OR ≥1 accepted important -> **NEEDS WORK** (`NEEDS_WORK`). Suggestions never block and never post inline.
93
+ - **No monolith advisory comment** (never one body via `gh pr comment`); findings are inline comments at `file:line`, in `outputLanguage`.
221
94
 
222
- - **No monolith advisory comment.** "Render one big body and post via `gh pr comment`" is forbidden. Findings that need to surface on the PR become inline comments anchored to `file:line`.
223
-
224
- - **Body language follows `outputLanguage`.** Per `$HOME/.claude/multi-agent-refs/rules.md` Language Application matrix, external payloads (PR comment bodies are external) render in `prefs.global.outputLanguage`. The renderer in `lib/post-pr-review.sh` honors this.
225
-
226
- Optional opt-out prompt (interactive mode only; autopilot skips and posts):
227
-
228
- ```
229
- question (outputLanguage): "PR #{N} için review action gönderilsin mi?"
230
- header (English): "Post review"
231
- options (label + description in outputLanguage; semantics, not literals):
232
- - option 1 - "Post review": inline comments + Request changes when there are
233
- findings, Approve when there are none
234
- - option 2 - "Chat only": leave the PR untouched, the chat summary is enough
235
- default: option 1
236
- ```
237
-
238
- Defaults:
239
- - Interactive mode: prompt with default option 1
240
- - Autopilot mode: auto-post (no prompt)
241
- - `--no-comment` / `--no-post` flag: skip the post entirely
242
-
243
- If the user picks option 1 (post the review):
244
-
245
- ```bash
246
- bash $HOME/.claude/lib/post-pr-review.sh "$TASK_ID"
247
- ```
248
-
249
- `post-pr-review.sh` reads `agent-state.review.{input, findings, iterationNumber, headCommitSha}`, decides APPROVE vs NEEDS_WORK from the rule above, posts one inline comment per accepted blocking + important finding (in `outputLanguage`), then sets the review state via the provider's API:
250
-
251
- | Provider | Inline comment | State |
252
- |---|---|---|
253
- | `github` | `gh api -X POST /repos/{o}/{r}/pulls/{n}/comments` (path + line + commit_id) | `gh pr review --approve` / `--request-changes` |
254
- | `bitbucket-server` | `POST /pull-requests/{n}/comments` with `anchor: { path, line, lineType:"ADDED", fileType:"TO" }` | `PUT /pull-requests/{n}/participants/{user}` body `{"status":"APPROVED"}` or `{"status":"NEEDS_WORK"}` |
255
-
256
- If a finding's `line` lies outside the diff or `headCommitSha` is missing, the comment falls back to a top-level PR comment with the same body.
257
-
258
- If the post fails (network, token, harness block), `post-pr-review.sh` exits non-zero and surfaces the failing endpoint on stderr - the chat summary remains the source of truth.
95
+ Interactive asks first (default: post); autopilot posts; `--no-comment` / `--no-post` skips. Post with `bash $HOME/.claude/lib/post-pr-review.sh "$TASK_ID"`. Prompt shape, `github` / `bitbucket-server` endpoints and fallbacks: `review/panel.md` "Posting". A failed post exits non-zero; the chat summary stays the source of truth.
259
96
 
260
97
  ### 8. Token telemetry
261
98
 
262
- Per the `$HOME/.claude/multi-agent-refs/tracker-contract.md` tokens contract, after each reviewer LLM call:
263
-
264
- ```bash
265
- bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <input_count> <output_count>
266
- ```
267
-
268
- `<N>`: the run's Review phase, or step 2 for a standalone review.
269
-
270
- ## Input matrix
271
-
272
- The input table at the top, by mode and PR action: `$HOME/.claude/multi-agent-refs/review/inputs.md` "Input matrix".
273
-
274
- PR-mode body language honors `prefs.global.outputLanguage`. The orchestrator entry point is `lib/post-pr-review.sh "$TASK_ID"` - it reads `agent-state.review` and handles diff fetch, finding render, comment posts, and review state end-to-end.
99
+ After each reviewer call: `bash $HOME/.claude/scripts/phase-tracker.sh tokens <N> <in> <out>` (`<N>` = the run's Review phase, or step 2 standalone; `tracker-contract.md`).
@@ -18,11 +18,7 @@ allowed-tools: Bash, Read, Write, AskUserQuestion, WebFetch
18
18
 
19
19
  ## Step 0 - What is actually wrong
20
20
 
21
- ```bash
22
- node "$HOME/.claude/scripts/doctor.mjs"
23
- ```
24
-
25
- Run it before the first question and again at the end. The first run turns setup from a fixed script into a targeted one: there is no point asking for a token that is already mapped and answering. The second run is the only honest way to end - "setup complete" is a claim, and the doctor's exit code is the evidence for or against it. Report both in `outputLanguage`, and if the second run still shows a BLOCK, say so plainly rather than closing on the word "complete".
21
+ Run `node "$HOME/.claude/scripts/doctor.mjs"` before the first question (never ask for a token that is already mapped and answering) and again at the end: its exit code, not the word "complete", decides how setup ends. Report both in `outputLanguage`; a remaining BLOCK is said plainly.
26
22
 
27
23
  ## Sections
28
24
 
@@ -30,225 +26,77 @@ Run it before the first question and again at the end. The first run turns setup
30
26
 
31
27
  ## Setup (Credential Store + Git Identity Onboarding)
32
28
 
33
- Uses `$HOME/.claude/lib/credential-store.sh` to read/write secrets in the macOS Keychain (`security`, built in). The pipeline is macOS only (ADR-0012).
34
-
35
- Run `~/.claude/lib/credential-store.sh doctor` first - it prints the platform and whether the backend is usable.
36
-
37
- The shell driver delegates to the Python helper `$HOME/.claude/scripts/keychain.py`; what it writes and the `KEYCHAIN_DELEGATE=0` override: `$HOME/.claude/multi-agent-refs/setup/token-save-flow.md` "Inline Token Save Pattern".
38
-
39
29
  ### Step 0 - Language Selection
40
30
 
41
- Ask BEFORE anything else: one question, `outputLanguage` (`en` / `tr`). `promptLanguage` is fixed to `"en"` and never offered to the user. Commits, branch names and agent prompts stay English; PR, Jira and wiki bodies follow `outputLanguage`. Already set in prefs: skip silently. From this point forward `question`, `label` and `description` render in `outputLanguage`; `header` stays English.
42
-
43
- Read `$HOME/.claude/multi-agent-refs/setup/language.md` before Step 0: the two language axes, the exact prompt, validation, the confirmation lines and the unknown-input rule.
31
+ Ask BEFORE anything else: one question, `outputLanguage` (`en` / `tr`); already set: skip silently. `promptLanguage` is fixed to `"en"` and never offered. From here on `question`, `label` and `description` render in `outputLanguage`; `header` stays English. Read `$HOME/.claude/multi-agent-refs/setup/language.md` before Step 0.
44
32
 
45
33
  ### Step 0.5 - Dependency check
46
34
 
47
- ```bash
48
- ~/.claude/lib/credential-store.sh doctor
49
- command -v pdftotext >/dev/null 2>&1 || echo "pdftotext: MISSING"
50
- ```
51
-
52
- | Output | Action |
53
- |--------|--------|
54
- | `Backend: ✓` | Continue to Step 1 |
55
- | Platform `unknown` or `ERR: macOS only` | Halt - the pipeline runs on macOS only (ADR-0012). |
56
- | `pdftotext: MISSING` | Advisory. Print `brew install poppler`, continue. `.docx` needs nothing. |
35
+ Run `~/.claude/lib/credential-store.sh doctor` and `command -v pdftotext`. `Backend: ✓`: continue. Platform `unknown` or `ERR: macOS only`: **halt**. `pdftotext` missing: advise `brew install poppler`, continue.
57
36
 
58
37
  ### Credential Key Naming Rule
59
38
 
60
- - **New token** (first-time creation in Step 3): ALWAYS use the standard key name (`${USER}_Jira_Access_Token`, etc.). This ensures cross-machine consistency.
61
- - **Existing token** (discovered in Step 1): NEVER rename or migrate. Map the discovered key name as-is into `keychainMapping`. The mapping layer abstracts the actual key name - the pipeline never reads the credential store directly by standard name.
39
+ - **New token** (Step 3): ALWAYS the standard key name (`${USER}_Jira_Access_Token`, etc.).
40
+ - **Existing token** (Step 1): NEVER rename or migrate; map the discovered name as-is into `keychainMapping`.
62
41
 
63
42
  ### Step 1 - Dynamic Credential Discovery
64
43
 
65
- Full procedure: `$HOME/.claude/multi-agent-refs/setup/discovery.md`. Read it for Step 1.
44
+ Read `$HOME/.claude/multi-agent-refs/setup/discovery.md` for Step 1.
66
45
 
67
46
  ### Step 2 - Show Discovery Summary + Save Mapping
68
47
 
69
- Show results grouped by status: one line per service with its mapped key or `MISSING`, then the mapped / missing counts. Layout: `$HOME/.claude/multi-agent-refs/setup/summaries.md` "Step 2 discovery summary".
70
-
71
- Non-standard key names are perfectly valid - the mapping handles resolution. No rename or migration is offered.
72
-
73
- Save the resolved mapping to `prefs.global.keychainMapping` - every service ID gets an entry, the discovered key name verbatim or `null` when nothing was found:
74
-
75
- ```json
76
- { "jira": "${USER}_Jira_Access_Token", "github": "${USER}_Github", "confluence": null, "...": "..." }
77
- ```
78
-
79
- Full key list and shape: `$HOME/.claude/multi-agent-refs/keychain.md`.
80
-
81
- `null` = not mapped (missing or skipped). Pipeline phases read this mapping to retrieve tokens dynamically - never hardcoded key names.
48
+ Show one line per service with its key or `MISSING`, then the counts (`$HOME/.claude/multi-agent-refs/setup/summaries.md`). Save every service ID to `prefs.global.keychainMapping`, the discovered key name verbatim or `null` (key list: `$HOME/.claude/multi-agent-refs/keychain.md`). Phases read this mapping, never hardcoded key names.
82
49
 
83
50
  ### Step 2.7 - Operational reporting
84
51
 
85
- Ask (in `outputLanguage`), and proceed only on an explicit yes:
86
-
87
- ```
88
- Do you have an operational-reporting token from your admin?
89
- [ Paste token / Skip ]
90
- ```
91
-
92
- On paste, store it in the credential store ONLY - never in a file, prefs value,
93
- git or any synced tree - under the standard per-user name, so it is revocable on
94
- its own:
95
-
96
- ```bash
97
- pbpaste | ~/.claude/lib/credential-store.sh set "${USER}_Usage_Ingest_Token" -
98
- pbcopy < /dev/null
99
- ```
100
-
101
- Then, **whether they pasted or skipped**, run:
52
+ Ask whether the user has an operational-reporting token; proceed only on an explicit yes. On paste, store it in the credential store ONLY (never a file, prefs value, git or synced tree): `pbpaste | ~/.claude/lib/credential-store.sh set "${USER}_Usage_Ingest_Token" -` then `pbcopy < /dev/null`. Pasted or skipped, run `node "$HOME/.claude/scripts/usage-register.mjs" --json`; on `"needsPersonalAccount":true` ask once for a GitHub username (Skip leaves reporting off) and re-run with `--login <name>`. What is sent: `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
102
53
 
103
- ```bash
104
- node "$HOME/.claude/scripts/usage-register.mjs" --json
105
- ```
106
-
107
- If its JSON line says `"needsPersonalAccount":true`, ask once for the person's
108
- GitHub username (free text; Skip leaves reporting off) and run
109
- `node "$HOME/.claude/scripts/usage-register.mjs" --login <name> --json`.
110
-
111
- It maps whatever token exists and switches reporting on, and requests a
112
- per-machine write-only one when none resolves, so a machine that runs setup and
113
- never runs update still reports. What is sent, what never is, and
114
- `usageLog.optOut`:
115
- `$HOME/.claude/multi-agent-refs/features/usage-reporting.md`.
116
-
117
- ### Auto-learned fields (no setup step needed)
118
-
119
- The Jira project key and the git identity are learned from use, never asked here. How each is captured: `$HOME/.claude/multi-agent-refs/setup/accounts.md` "Auto-learned fields".
54
+ The Jira project key and git identity are learned from use, never asked (`$HOME/.claude/multi-agent-refs/setup/accounts.md` "Auto-learned fields").
120
55
 
121
56
  ### Step 3 - Interactive token onboarding (for missing tokens)
122
57
 
123
- Git identities are NOT asked as a separate step. They are learned when tokens are added via the Token Save Flow: each token save triggers an identity prompt (Step C), the identity is stored in `prefs.global.identities[]` and the token binding in `identity.servicePatMap`. Multiple accounts per platform are supported. The prompt, the binding rules and the legacy `gitIdentities` migration: `$HOME/.claude/multi-agent-refs/setup/token-save-flow.md` "Identity learning (Step 3)".
124
-
125
- For each MISSING service, run the **Token Save Flow** below. When creating new tokens, use the **standard key name** from Step 1b table.
126
-
127
- #### Sequential onboarding loop (strict)
128
-
129
- The Step 2 discovery summary is never the end of setup. Immediately after showing it, walk the missing services ONE BY ONE in this fixed order and run the Token Save Flow for each:
130
-
131
- 1. `jira`
132
- 2. `bitbucket_token` (then `bitbucket_user` right after, if missing)
133
- 3. `github`
134
- 4. `confluence`
135
- 5. `figma` - Figma Personal Access Token (Tier 2, REST)
136
- 6. `figma_mcp` - Figma MCP auth (Tier 1); its own prompt, never folded into the PAT prompt
137
- 7. `fortify`
138
- 8. `graylog`
139
- 9. `firebase`
140
- 10. `jenkins`
141
- 11. App Store Connect block (Step 3b; only when the target repo is iOS)
142
- 12. Google Play block (Step 3d; only when the target repo is Android)
143
- 13. Free-model keys `llm-<id>` (only after `route-on --free`): `$HOME/.claude/multi-agent-refs/setup/free-models.md`
144
-
145
- Loop rules:
146
-
147
- - **One prompt per service.** Never collapse the list into a single "add missing tokens now?" yes/no, and never offer one multi-select covering all services: each service has its own source URL, key name, identity binding and host prompt, so each gets its own Token Save Flow pass.
148
- - **Each service pass asks, in order: token → author → host → read binding (GitHub, Bitbucket; Token Save Flow Step 3.7).** Step A/B collect the secret, Step C binds the git identity (author) - Bitbucket and GitHub included; every saved token gets an author - and Step 3.5 asks the host domain inline for hosted services (jira, confluence, bitbucket, fortify, graylog) - plus the Fortify project versions and the optional Graylog test instance. GitHub and Figma skip the host question (fixed domains); `bitbucket_user` skips author binding (username, not a PAT). Never end a service pass with the token saved but the author or a required host unasked.
149
- - **Skip is per-service.** A Skip answer leaves that service's `keychainMapping` at `null` and the loop continues with the next service. Skips never abort the loop.
150
- - **`figma` and `figma_mcp` are distinct credentials for distinct tiers - ask both.** Skipping the PAT does not imply skipping MCP, and vice versa. The `figma_mcp` pass opens with a Remote / Local mode question instead of a clipboard paste (see "Figma MCP Setup" below): Remote generates a `figu_` OAuth token for the current user, Local wires the PAT-based local server.
151
- - The loop ends only when every missing service has been asked exactly once; then continue to Step 4 (Verify all).
152
-
153
- ---
154
-
155
- ### Token Save Flow (reusable)
156
-
157
- Full procedure: `$HOME/.claude/multi-agent-refs/setup/token-save-flow.md`. Read it for every token prompt (Steps 3, 3b, 3c and any command that saves a token).
58
+ Identities are learned in the Token Save Flow (Step C), never asked separately.
158
59
 
159
- ### Step 3b - App Store Connect onboarding (iOS only, optional)
60
+ Walk the missing services ONE BY ONE, in this order: `jira`, `bitbucket_token` (then `bitbucket_user`), `github`, `confluence`, `figma` (PAT), `figma_mcp` (its own prompt), `fortify`, `graylog`, `firebase`, `jenkins`, App Store Connect (3b, iOS), Google Play (3d, Android), free-model keys `llm-<id>` (only after `route-on --free`: `$HOME/.claude/multi-agent-refs/setup/free-models.md`). One prompt per service, never one yes/no or multi-select for all; each pass asks token, author, host, read binding; Skip is per-service and never aborts the loop. Read `$HOME/.claude/multi-agent-refs/setup/token-save-flow.md` before the loop and for every token prompt: the loop rules, Steps 3.5 / 3.7 and identity learning.
160
61
 
161
- Runs inside Step 3, iOS target only. Every part of the API key, the `.p8` included, lives in the Keychain, and the key is validated BEFORE it is saved. Read `$HOME/.claude/multi-agent-refs/setup/app-store-connect.md` before Step 3b. On Skip, nothing is written.
62
+ ### Steps 3b-3d - Store and Firebase onboarding (optional)
162
63
 
163
- ### Step 3c - Firebase / Crashlytics onboarding (optional)
164
-
165
- Runs inside Step 3. Measure first with `bash "$HOME/.claude/lib/fetch-crashlytics.sh" --probe`, then ask by that answer, never blind; store the JSON as issued, never base64 it. Read `$HOME/.claude/multi-agent-refs/setup/firebase.md` before Step 3c. Skip writes nothing.
166
-
167
- ### Step 3d - Google Play onboarding (Android only, optional)
168
-
169
- Runs inside Step 3, only when the target repo is Android: one entry, `google_play`, validated BEFORE saving. Read `$HOME/.claude/multi-agent-refs/setup/google-play.md` before Step 3d. Skip writes nothing.
170
-
171
- ### Step 3.5 - Host Prompt (embedded in Token Save Flow)
172
-
173
- Full procedure: `$HOME/.claude/multi-agent-refs/setup/token-save-flow.md`. Read it for the host question inside the Token Save Flow.
64
+ Each key is validated BEFORE it is saved and lives only in the Keychain; Skip writes nothing. Read the matching file under `$HOME/.claude/multi-agent-refs/setup/` first: `app-store-connect.md` (3b, iOS, `.p8` included), `firebase.md` (3c: probe with `fetch-crashlytics.sh --probe` before asking; store the JSON as issued), `google-play.md` (3d, Android).
174
65
 
175
66
  ### Step 3.6 - Per-account host overrides (optional)
176
67
 
177
- **Runs only when** `~/.claude/lib/account-resolver.sh` returns **more than one** account AND at least one account has Jira or Bitbucket tokens.
178
-
179
- For each non-default account, ask once whether to keep the global default host or set per-account hosts; read `$HOME/.claude/multi-agent-refs/setup/accounts.md` "Per-account host overrides (Step 3.6)" before Step 3.6 for the prompt, the saved `prefs.global.accounts[]` shape and the precedence. Skip this step on autopilot - `accounts[]` stays empty until the user opts in via `/multi-agent:setup accounts`.
180
-
181
- ---
68
+ Only when `~/.claude/lib/account-resolver.sh` returns more than one account and one has Jira or Bitbucket tokens. Read `accounts.md` "Per-account host overrides (Step 3.6)" (setup refs). Skipped on autopilot; `/multi-agent:setup accounts` opens it later.
182
69
 
183
70
  ### Step 4 - Verify all
184
71
 
185
- Re-run scan from Step 1 and show the final status: tokens present, the optional per-project features, the next-step commands. Layout: `$HOME/.claude/multi-agent-refs/setup/summaries.md` "Step 4 final status".
186
-
187
- If still missing, show which ones and let user skip (pipeline will re-ask for any needed token at Phase 0).
188
-
189
- ### Step 5 - Repo Discovery (optional)
190
-
191
- Pre-populates the Phase 0 project picker with repos the user is active in. Three independent sources merge into one flat list: local `$HOME` scan (depth 3, repo markers), Bitbucket (last 90 days, token-gated), GitHub (owner + collaborator, push in last 90 days, token-gated). Any source failing skips that source only, is reported (never swallowed), and discovery is never destructive and idempotent.
192
-
193
- The scan commands, merge-by-origin dedup, the multi-select picker, the `recentProjects` / `serviceStatus` prefs shapes and the skip / degrade rules live in `$HOME/.claude/multi-agent-refs/setup/repo-discovery.md` - read that file when the user opts in.
194
-
195
- ### Step 6 - Remember as Multi-Repo Group (optional)
196
-
197
- After Step 5, if the user picked **2 or more** repos, offer to remember the combination as a named group in `global.recentGroups[]`, so Phase 0's project picker surfaces it at the top. Auto-skipped if Step 5 was skipped or fewer than 2 repos were selected.
198
-
199
- Read `$HOME/.claude/multi-agent-refs/setup/multi-repo-group.md` before Step 6: the prompt, the auto-name heuristic, the saved shape, the LRU + dedup rules and the skip rules.
72
+ Re-run the Step 1 scan and show the final status (`summaries.md` "Step 4 final status"). Still missing: show which and let the user skip; Phase 0 re-asks.
200
73
 
201
- ### Step 7 - Platform Identity Routing (optional)
74
+ ### Steps 5-7 - Repo discovery, groups, identity routing (optional)
202
75
 
203
- Full procedure: `$HOME/.claude/multi-agent-refs/setup/identity-routing.md`. Read it for Step 7.
76
+ Read the file under `$HOME/.claude/multi-agent-refs/setup/` for each step the user opts into: `repo-discovery.md` (5: local, Bitbucket, GitHub; a failing source skips only itself and is reported), `multi-repo-group.md` (6: only after 2+ repos), `identity-routing.md` (7).
204
77
 
205
- ### Cross-Platform Notes (Step 1-9)
78
+ ### Credential store, token sources, Figma MCP
206
79
 
207
- Every read and write goes through `~/.claude/lib/credential-store.sh`, which wraps the macOS Keychain; stay on the helper rather than calling `security` directly. The clipboard handling and what happens when no backend exists: `$HOME/.claude/multi-agent-refs/keychain.md` "Credential store mechanics".
208
-
209
- ### Token -> Source Mapping
210
-
211
- Standard key names are a convention for NEW tokens; discovery may find existing keys under other names, and the mapping in preferences handles that. The key names, the token types and where to generate each one all live in one table: `$HOME/.claude/multi-agent-refs/keychain.md` "Standard key names". Git identities are stored in preferences, never in the credential store.
212
-
213
- ### Inline Token Save Pattern
214
-
215
- All tokens go through `~/.claude/lib/credential-store.sh`: a secret from the clipboard via `pbpaste | ~/.claude/lib/credential-store.sh set "<SERVICE_NAME>" -` followed by `pbcopy < /dev/null`, a key file via `- < /path/to/file`, never a secret on argv. Every form, and the Python helper: `$HOME/.claude/multi-agent-refs/setup/token-save-flow.md` "Inline Token Save Pattern".
216
-
217
- ### Figma MCP Setup (Remote / Local question)
218
-
219
- Full procedure: `$HOME/.claude/multi-agent-refs/setup/figma.md`. Read it for the Figma MCP question.
80
+ Always `~/.claude/lib/credential-store.sh` (macOS Keychain, macOS only, ADR-0012), never `security` directly; secrets from the clipboard or a file, never argv. Key names, token sources and store mechanics: `$HOME/.claude/multi-agent-refs/keychain.md`. Identities live in preferences. Figma MCP Remote / Local: `$HOME/.claude/multi-agent-refs/setup/figma.md`.
220
81
 
221
82
  ### Security Rules
222
83
 
223
- - Never paste tokens into terminal or chat - use `pbpaste` for input
84
+ - Never paste tokens into terminal or chat - use `pbpaste` for input
224
85
  - Never hardcode tokens in source code
225
86
  - Never commit tokens to git history
226
87
  - Clear clipboard immediately: `pbcopy < /dev/null`
227
88
  - `2>/dev/null` suppresses stderr (prevents metadata leakage)
228
89
 
229
- ### Setup from Scratch Summary
230
-
231
- Install the toolkit (`npx @{npm-scope}/multi-agent-pipeline install`), run `/multi-agent setup`, follow the interactive flow, then start a task. Walkthrough: `$HOME/.claude/multi-agent-refs/setup/summaries.md` "Setup from scratch".
232
-
233
- All tokens are optional in the sense that every service can be answered with Skip - but the ASKING is not optional: the Step 3 sequential loop still walks every missing service one by one (token → author → host). Phase 0 re-asks at runtime only for tokens the user skipped here.
90
+ From scratch: `npx @{npm-scope}/multi-agent-pipeline install`, `/multi-agent setup`, then a task (`summaries.md` "Setup from scratch").
234
91
 
235
92
  ### Step 8 - Enforcement hooks (optional)
236
93
 
237
- On Claude Code, offer to merge `$HOME/.claude/templates/claude-hooks.json`: three blocking `PreToolUse` gates (secret scan, agent-guard, read-size) plus non-blocking hooks on `PreCompact`, `SessionEnd`, `SessionStart` and `PostToolUse`, and a `Stop` hook (`run-stop-guard.sh`) that holds a session from stopping mid-run. What each does: `$HOME/.claude/multi-agent-refs/picker-contract.md`.
238
-
239
- Ask (picker) whether to install the hooks into `~/.claude/settings.json`, default Yes. On Yes, deep-merge EVERY event in the template's `hooks` object and never duplicate a matcher calling the same script. Read `$HOME/.claude/multi-agent-refs/setup/hooks-and-plugins.md` before Step 8: the merge rules and what to tell the user about the gates.
240
-
241
- Codex: offer only the syntax gate, then run `node "$HOME/.codex/scripts/host-hooks.mjs" install --host codex`. Copilot CLI: offer no hook (it discards `postToolUse` output as of 1.0.45).
94
+ Claude Code: offer (picker, default Yes) to merge `$HOME/.claude/templates/claude-hooks.json` into `~/.claude/settings.json`; deep-merge EVERY event, never duplicate a matcher. Read `$HOME/.claude/multi-agent-refs/setup/hooks-and-plugins.md` before Step 8. Codex: only the syntax gate, via `node "$HOME/.codex/scripts/host-hooks.mjs" install --host codex`. Copilot CLI: no hook.
242
95
 
243
96
  ### Step 9 - Default stack plugin enablement
244
97
 
245
- Stack skills ship as versioned plugins in the `{owner}/multi-agent-plugins` marketplace. On first setup, wire the stack so the pipeline works out of the box.
246
-
247
- 1. Ensure the marketplace is known (idempotent):
248
- ```bash
249
- bash "$HOME/.claude/scripts/plugin-refresh.sh" {owner} --add-only
250
- ```
251
- 2. Ask the detector, then derive (no marker list in this file):
98
+ 1. `bash "$HOME/.claude/scripts/plugin-refresh.sh" {owner} --add-only` (idempotent).
99
+ 2. Ask the detector, then derive; no marker list here:
252
100
 
253
101
  ```bash
254
102
  eval "$(bash $HOME/.claude/lib/stack-detect.sh "$PROJECT_ROOT")" # MA_STACKS, MA_STACK_WHY
@@ -256,8 +104,4 @@ Stack skills ship as versioned plugins in the `{owner}/multi-agent-plugins` mark
256
104
  console.log(m.pluginsForStacks(process.argv[1].split(" ").filter(Boolean)).plugins.join(" ")))' "$MA_STACKS"
257
105
  ```
258
106
 
259
- Report `MA_STACK_WHY` with the result. `ai-common-toolkit` and
260
- `ai-analyst-toolkit` are in every answer, the empty one included. How the answer is read (empty answers, `dropped[]`): `$HOME/.claude/multi-agent-refs/setup/hooks-and-plugins.md` "Step 9".
261
- 3. Report the enabled set. To change later, run `/multi-agent:stack <ios|android|web|backend|...>` in the repo. Pipeline Phase 1 auto-detects the stack for its own routing regardless of enablement.
262
-
263
- The marketplace repo name (`multi-agent-plugins`) is generic; a different org points `{owner}` at its own fork - nothing in the pipeline is coupled to a specific account.
107
+ 3. Report `MA_STACK_WHY` and the enabled set (`hooks-and-plugins.md` "Step 9"); change later with `/multi-agent:stack <stack>`.