@mmerterden/multi-agent-pipeline 20.36.0 → 20.37.1

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 (222) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/docs/facts.json +2 -2
  3. package/docs/features.md +1 -1
  4. package/docs/recovery-guide.md +1 -1
  5. package/install/catalog-history.json +1 -1
  6. package/manifest.json +225 -148
  7. package/package.json +1 -1
  8. package/pipeline/commands/multi-agent/SKILL.md +33 -154
  9. package/pipeline/commands/multi-agent/analysis/SKILL.md +14 -68
  10. package/pipeline/commands/multi-agent/analysis-jira/SKILL.md +5 -8
  11. package/pipeline/commands/multi-agent/autopilot-on/SKILL.md +38 -109
  12. package/pipeline/commands/multi-agent/channels/SKILL.md +38 -167
  13. package/pipeline/commands/multi-agent/complaint-analysis/SKILL.md +37 -144
  14. package/pipeline/commands/multi-agent/design-check/SKILL.md +27 -131
  15. package/pipeline/commands/multi-agent/garbage-collect/SKILL.md +22 -48
  16. package/pipeline/commands/multi-agent/ios-coding-standard/SKILL.md +37 -180
  17. package/pipeline/commands/multi-agent/jira/SKILL.md +16 -46
  18. package/pipeline/commands/multi-agent/manual-test/SKILL.md +12 -7
  19. package/pipeline/commands/multi-agent/refactor/SKILL.md +23 -184
  20. package/pipeline/commands/multi-agent/resume/SKILL.md +30 -136
  21. package/pipeline/commands/multi-agent/review/SKILL.md +24 -199
  22. package/pipeline/commands/multi-agent/setup/SKILL.md +25 -181
  23. package/pipeline/commands/multi-agent/stack/SKILL.md +9 -53
  24. package/pipeline/commands/multi-agent/status/SKILL.md +13 -2
  25. package/pipeline/commands/multi-agent/store-ready/SKILL.md +27 -226
  26. package/pipeline/commands/multi-agent/sync/SKILL.md +35 -164
  27. package/pipeline/commands/multi-agent/test-gen/SKILL.md +2 -4
  28. package/pipeline/commands/multi-agent/update/SKILL.md +18 -60
  29. package/pipeline/contract/CHANGELOG.md +9 -0
  30. package/pipeline/contract/fixtures/error-invalid-request.json +1 -1
  31. package/pipeline/contract/fixtures/error-unauthorized.json +1 -1
  32. package/pipeline/contract/fixtures/error-unsigned.json +1 -1
  33. package/pipeline/contract/fixtures/runs-awaiting-question.json +1 -1
  34. package/pipeline/contract/fixtures/runs-empty.json +1 -1
  35. package/pipeline/contract/fixtures/runs-failed.json +1 -1
  36. package/pipeline/contract/fixtures/runs-pr-opened-redacted.json +1 -1
  37. package/pipeline/contract/fixtures/runs-pr-opened.json +1 -1
  38. package/pipeline/contract/fixtures/runs-running.json +1 -1
  39. package/pipeline/contract/manifest.json +5 -5
  40. package/pipeline/contract/types/index.d.ts +3 -2
  41. package/pipeline/multi-agent-refs/audit-guide.md +20 -0
  42. package/pipeline/multi-agent-refs/autopilot-on/details.md +148 -0
  43. package/pipeline/multi-agent-refs/channels/generator.md +14 -0
  44. package/pipeline/multi-agent-refs/channels/preview.md +13 -0
  45. package/pipeline/multi-agent-refs/channels/reference.md +46 -0
  46. package/pipeline/multi-agent-refs/complaint-analysis/phases.md +159 -0
  47. package/pipeline/multi-agent-refs/design-check/export.md +1 -0
  48. package/pipeline/multi-agent-refs/design-check/init-inventory.md +1 -1
  49. package/pipeline/multi-agent-refs/design-check/scope-and-ledger.md +64 -0
  50. package/pipeline/multi-agent-refs/features/analysis-command-notes.md +53 -0
  51. package/pipeline/multi-agent-refs/features/commit-multi-repo.md +63 -0
  52. package/pipeline/multi-agent-refs/features/dev-multi-repo.md +51 -0
  53. package/pipeline/multi-agent-refs/features/test-gap.md +40 -0
  54. package/pipeline/multi-agent-refs/features/worktree-finalize.md +1 -1
  55. package/pipeline/multi-agent-refs/garbage-collect/phases.md +60 -0
  56. package/pipeline/multi-agent-refs/ios-coding-standard/plan.md +71 -0
  57. package/pipeline/multi-agent-refs/ios-coding-standard/resolve-and-scan.md +135 -0
  58. package/pipeline/multi-agent-refs/jira/picker-detail.md +71 -0
  59. package/pipeline/multi-agent-refs/orchestrator/copilot-pipeline.md +88 -0
  60. package/pipeline/multi-agent-refs/orchestrator/dispatcher.md +96 -1
  61. package/pipeline/multi-agent-refs/orchestrator/phase-3-user-test.md +12 -9
  62. package/pipeline/multi-agent-refs/phases/phase-1-plan.md +4 -4
  63. package/pipeline/multi-agent-refs/phases/phase-2-dev.md +8 -47
  64. package/pipeline/multi-agent-refs/phases/phase-3-review.md +21 -65
  65. package/pipeline/multi-agent-refs/phases/phase-4-commit.md +9 -59
  66. package/pipeline/multi-agent-refs/phases/phase-5-report.md +0 -31
  67. package/pipeline/multi-agent-refs/refactor/sweep.md +190 -0
  68. package/pipeline/multi-agent-refs/resume/details.md +115 -2
  69. package/pipeline/multi-agent-refs/review/inputs.md +33 -1
  70. package/pipeline/multi-agent-refs/review/module-guides.md +9 -1
  71. package/pipeline/multi-agent-refs/review/panel.md +75 -0
  72. package/pipeline/multi-agent-refs/review/valven.md +5 -1
  73. package/pipeline/multi-agent-refs/rules.md +1 -1
  74. package/pipeline/multi-agent-refs/setup/hooks-and-plugins.md +4 -0
  75. package/pipeline/multi-agent-refs/setup/token-save-flow.md +13 -0
  76. package/pipeline/multi-agent-refs/stack/background.md +72 -0
  77. package/pipeline/multi-agent-refs/store-ready/gates.md +139 -0
  78. package/pipeline/multi-agent-refs/store-ready/report.md +40 -2
  79. package/pipeline/multi-agent-refs/sync/office.md +10 -0
  80. package/pipeline/multi-agent-refs/sync/overview.md +61 -0
  81. package/pipeline/multi-agent-refs/sync/repo.md +91 -0
  82. package/pipeline/multi-agent-refs/update/details.md +83 -0
  83. package/pipeline/office/index.html +6 -3
  84. package/pipeline/office/toolkit.json +1 -1
  85. package/pipeline/rules/figma-pipeline.md +6 -3
  86. package/pipeline/schemas/prefs.schema.json +1 -1
  87. package/pipeline/schemas/runs-index.schema.json +2 -1
  88. package/pipeline/scripts/_memory-policy.mjs +27 -5
  89. package/pipeline/scripts/checkpoint-fold.sh +59 -0
  90. package/pipeline/scripts/contract-server.mjs +1 -1
  91. package/pipeline/scripts/gate-ledger.mjs +1 -1
  92. package/pipeline/scripts/office-control.mjs +41 -15
  93. package/pipeline/scripts/offload-ref.sh +1 -1
  94. package/pipeline/scripts/rework-rulings.mjs +5 -3
  95. package/pipeline/scripts/runs-index.mjs +34 -7
  96. package/pipeline/scripts/scope-check-gate.mjs +15 -2
  97. package/pipeline/scripts/status-overview.mjs +401 -0
  98. package/pipeline/scripts/user-test-handoff.sh +203 -0
  99. package/pipeline/scripts/validate-planning.mjs +5 -3
  100. package/pipeline/scripts/validate-triage.mjs +2 -1
  101. package/pipeline/scripts/write-state.mjs +13 -4
  102. package/pipeline/skills/.skill-manifest.json +64 -64
  103. package/pipeline/skills/shared/core/apple-archive-compliance/SKILL.md +7 -70
  104. package/pipeline/skills/shared/core/apple-archive-compliance/references/examples.md +67 -0
  105. package/pipeline/skills/shared/core/apple-archive-compliance/references/version-history.md +8 -0
  106. package/pipeline/skills/shared/core/google-play-compliance/SKILL.md +10 -72
  107. package/pipeline/skills/shared/core/google-play-compliance/references/examples.md +69 -0
  108. package/pipeline/skills/shared/core/google-play-compliance/references/notes.md +7 -0
  109. package/pipeline/skills/shared/core/google-play-compliance/references/version-history.md +5 -0
  110. package/pipeline/skills/shared/core/multi-agent/SKILL.md +39 -262
  111. package/pipeline/skills/shared/core/multi-agent-autopilot-on/SKILL.md +35 -73
  112. package/pipeline/skills/shared/core/multi-agent-channels/SKILL.md +37 -337
  113. package/pipeline/skills/shared/core/multi-agent-design-check/SKILL.md +27 -122
  114. package/pipeline/skills/shared/core/multi-agent-help/SKILL.md +8 -340
  115. package/pipeline/skills/shared/core/multi-agent-ios-coding-standard/SKILL.md +37 -180
  116. package/pipeline/skills/shared/core/multi-agent-manual-test/SKILL.md +12 -7
  117. package/pipeline/skills/shared/core/multi-agent-refactor/SKILL.md +23 -184
  118. package/pipeline/skills/shared/core/multi-agent-review/SKILL.md +14 -82
  119. package/pipeline/skills/shared/core/multi-agent-setup/SKILL.md +25 -277
  120. package/pipeline/skills/shared/core/multi-agent-status/SKILL.md +13 -2
  121. package/pipeline/skills/shared/core/multi-agent-sync/SKILL.md +73 -217
  122. package/pipeline/skills/shared/external/alarmkit/SKILL.md +11 -162
  123. package/pipeline/skills/shared/external/alarmkit/references/alarmkit-code.md +257 -0
  124. package/pipeline/skills/shared/external/android-architecture/SKILL.md +7 -58
  125. package/pipeline/skills/shared/external/android-architecture/references/code-examples.md +68 -0
  126. package/pipeline/skills/shared/external/app-intents/SKILL.md +3 -45
  127. package/pipeline/skills/shared/external/app-intents/references/code-examples.md +54 -0
  128. package/pipeline/skills/shared/external/app-store-optimization/SKILL.md +5 -81
  129. package/pipeline/skills/shared/external/app-store-optimization/references/engagement-and-localization.md +96 -0
  130. package/pipeline/skills/shared/external/app-store-review/SKILL.md +6 -112
  131. package/pipeline/skills/shared/external/app-store-review/references/monetization-and-submission.md +138 -0
  132. package/pipeline/skills/shared/external/apple-on-device-ai/SKILL.md +10 -117
  133. package/pipeline/skills/shared/external/apple-on-device-ai/references/foundation-models-code.md +186 -0
  134. package/pipeline/skills/shared/external/authentication/SKILL.md +3 -50
  135. package/pipeline/skills/shared/external/authentication/references/code-examples.md +59 -0
  136. package/pipeline/skills/shared/external/callkit-voip/SKILL.md +3 -84
  137. package/pipeline/skills/shared/external/callkit-voip/references/code-examples.md +93 -0
  138. package/pipeline/skills/shared/external/ci-cd-pipelines/SKILL.md +7 -263
  139. package/pipeline/skills/shared/external/ci-cd-pipelines/references/pipeline-examples.md +281 -0
  140. package/pipeline/skills/shared/external/clean-code/SKILL.md +8 -41
  141. package/pipeline/skills/shared/external/clean-code/references/code-examples.md +56 -0
  142. package/pipeline/skills/shared/external/cloudkit-sync/SKILL.md +8 -146
  143. package/pipeline/skills/shared/external/cloudkit-sync/references/cloudkit-code.md +214 -0
  144. package/pipeline/skills/shared/external/compose-components/SKILL.md +6 -80
  145. package/pipeline/skills/shared/external/compose-components/references/code-examples.md +89 -0
  146. package/pipeline/skills/shared/external/compose-navigation/SKILL.md +5 -64
  147. package/pipeline/skills/shared/external/compose-navigation/references/code-examples.md +70 -0
  148. package/pipeline/skills/shared/external/core-data/SKILL.md +9 -157
  149. package/pipeline/skills/shared/external/core-data/references/core-data-code.md +221 -0
  150. package/pipeline/skills/shared/external/core-nfc/SKILL.md +3 -89
  151. package/pipeline/skills/shared/external/core-nfc/references/code-examples.md +98 -0
  152. package/pipeline/skills/shared/external/coreml/SKILL.md +17 -133
  153. package/pipeline/skills/shared/external/coreml/references/coreml-code.md +208 -0
  154. package/pipeline/skills/shared/external/css-modern/SKILL.md +8 -131
  155. package/pipeline/skills/shared/external/css-modern/references/code-examples.md +142 -0
  156. package/pipeline/skills/shared/external/database-patterns/SKILL.md +6 -103
  157. package/pipeline/skills/shared/external/database-patterns/references/orm-examples.md +112 -0
  158. package/pipeline/skills/shared/external/html-semantic/SKILL.md +7 -48
  159. package/pipeline/skills/shared/external/html-semantic/references/code-examples.md +54 -0
  160. package/pipeline/skills/shared/external/humanizer/SKILL.md +6 -19
  161. package/pipeline/skills/shared/external/humanizer/references/voice.md +24 -0
  162. package/pipeline/skills/shared/external/ios-accessibility/SKILL.md +13 -170
  163. package/pipeline/skills/shared/external/ios-accessibility/references/assistive-tech-review.md +224 -0
  164. package/pipeline/skills/shared/external/ios-localization/SKILL.md +2 -24
  165. package/pipeline/skills/shared/external/ios-localization/references/code-examples.md +30 -0
  166. package/pipeline/skills/shared/external/ios-networking/SKILL.md +3 -58
  167. package/pipeline/skills/shared/external/ios-networking/references/code-examples.md +67 -0
  168. package/pipeline/skills/shared/external/ios-security/SKILL.md +4 -64
  169. package/pipeline/skills/shared/external/ios-security/references/code-examples.md +74 -0
  170. package/pipeline/skills/shared/external/live-activities/SKILL.md +4 -90
  171. package/pipeline/skills/shared/external/live-activities/references/code-examples.md +108 -0
  172. package/pipeline/skills/shared/external/localization-reuse-map/SKILL.md +9 -23
  173. package/pipeline/skills/shared/external/localization-reuse-map/references/project-settings.md +22 -0
  174. package/pipeline/skills/shared/external/mapkit-location/SKILL.md +5 -95
  175. package/pipeline/skills/shared/external/mapkit-location/references/code-examples.md +117 -0
  176. package/pipeline/skills/shared/external/nextjs-app-router/SKILL.md +7 -106
  177. package/pipeline/skills/shared/external/nextjs-app-router/references/app-router-examples.md +124 -0
  178. package/pipeline/skills/shared/external/permissionkit/SKILL.md +2 -31
  179. package/pipeline/skills/shared/external/permissionkit/references/code-examples.md +37 -0
  180. package/pipeline/skills/shared/external/play-store-review/SKILL.md +6 -74
  181. package/pipeline/skills/shared/external/play-store-review/references/signing-and-policies.md +83 -0
  182. package/pipeline/skills/shared/external/push-notifications/SKILL.md +8 -125
  183. package/pipeline/skills/shared/external/push-notifications/references/notification-code.md +176 -0
  184. package/pipeline/skills/shared/external/python-patterns/SKILL.md +7 -158
  185. package/pipeline/skills/shared/external/python-patterns/references/python-examples.md +176 -0
  186. package/pipeline/skills/shared/external/rest-api-design/SKILL.md +7 -157
  187. package/pipeline/skills/shared/external/rest-api-design/references/api-examples.md +175 -0
  188. package/pipeline/skills/shared/external/swift-architecture/SKILL.md +11 -230
  189. package/pipeline/skills/shared/external/swift-architecture/references/pattern-examples.md +295 -0
  190. package/pipeline/skills/shared/external/swift-codable/SKILL.md +17 -149
  191. package/pipeline/skills/shared/external/swift-codable/references/codable-recipes.md +207 -0
  192. package/pipeline/skills/shared/external/swift-concurrency/SKILL.md +12 -99
  193. package/pipeline/skills/shared/external/swift-concurrency/references/code-examples.md +100 -0
  194. package/pipeline/skills/shared/external/swift-concurrency/references/swift-6-2-additions.md +18 -0
  195. package/pipeline/skills/shared/external/swift-formatstyle/SKILL.md +9 -78
  196. package/pipeline/skills/shared/external/swift-formatstyle/references/formatstyle-examples.md +113 -0
  197. package/pipeline/skills/shared/external/swift-language/SKILL.md +3 -56
  198. package/pipeline/skills/shared/external/swift-language/references/code-examples.md +65 -0
  199. package/pipeline/skills/shared/external/swift-testing-pro/SKILL.md +1 -0
  200. package/pipeline/skills/shared/external/swiftdata/SKILL.md +6 -122
  201. package/pipeline/skills/shared/external/swiftdata/references/code-examples.md +140 -0
  202. package/pipeline/skills/shared/external/swiftui-uikit-interop/SKILL.md +12 -139
  203. package/pipeline/skills/shared/external/swiftui-uikit-interop/references/interop-code.md +198 -0
  204. package/pipeline/skills/shared/external/tailwind-css/SKILL.md +9 -81
  205. package/pipeline/skills/shared/external/tailwind-css/references/code-examples.md +91 -0
  206. package/pipeline/skills/shared/external/testing-backend/SKILL.md +7 -207
  207. package/pipeline/skills/shared/external/testing-backend/references/testing-examples.md +225 -0
  208. package/pipeline/skills/shared/external/typescript-patterns/SKILL.md +8 -89
  209. package/pipeline/skills/shared/external/typescript-patterns/references/code-examples.md +100 -0
  210. package/pipeline/skills/shared/external/vision-framework/SKILL.md +2 -20
  211. package/pipeline/skills/shared/external/vision-framework/references/code-examples.md +26 -0
  212. package/pipeline/skills/shared/external/vue-composition/SKILL.md +7 -169
  213. package/pipeline/skills/shared/external/vue-composition/references/vue-examples.md +187 -0
  214. package/pipeline/skills/shared/external/web-accessibility/SKILL.md +7 -174
  215. package/pipeline/skills/shared/external/web-accessibility/references/a11y-examples.md +192 -0
  216. package/pipeline/skills/shared/external/web-performance/SKILL.md +8 -66
  217. package/pipeline/skills/shared/external/web-performance/references/code-examples.md +77 -0
  218. package/pipeline/skills/shared/external/web-testing/SKILL.md +11 -186
  219. package/pipeline/skills/shared/external/web-testing/references/testing-examples.md +213 -0
  220. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/format-and-output.md +0 -0
  221. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/publish-and-snapshot.md +0 -0
  222. /package/pipeline/skills/shared/external/localization-reuse-map/{reference → references}/sources-and-recipes.md +0 -0
@@ -26,6 +26,13 @@ shorten the time to first productive PR, or close a real risk?"
26
26
  Render assistant-facing prose in `outputLanguage`. External payloads (branch names, plan file,
27
27
  dev task) stay English.
28
28
 
29
+ Procedure detail, read when the phase starts:
30
+
31
+ ```
32
+ $HOME/.claude/multi-agent-refs/ios-coding-standard/resolve-and-scan.md (Phases 2 and 3)
33
+ $HOME/.claude/multi-agent-refs/ios-coding-standard/plan.md (Phase 4)
34
+ ```
35
+
29
36
  ---
30
37
 
31
38
  ## Phase 1 - Discover and pick the module
@@ -36,9 +43,7 @@ dev task) stay English.
36
43
  `Features/`, `Core/`, `Common/`, top-level module dirs) one level deep, then two if empty.
37
44
  3. Record per module: name · path · Swift files · lines · governance docs present · SPM targets.
38
45
  Keep this **module registry** for the whole run - `MOD-*` greps every import against it.
39
- Classify each module's role, because the role decides which dependency edges are legal:
40
- **feature** · **core/common** · **seam** (cross-module contracts/bridges/navigation) ·
41
- **composition root** (legitimately knows every module).
46
+ Classify each module's role: **feature** · **core/common** · **seam** · **composition root**.
42
47
  4. If `$ARGUMENTS` resolves to a module, skip the prompt. Otherwise `AskUserQuestion`
43
48
  (single-select, `outputLanguage`), documented modules first, each option showing file/line
44
49
  counts and `docs: yes/no`. If the list exceeds the question limit, group the smallest into an
@@ -47,189 +52,43 @@ dev task) stay English.
47
52
 
48
53
  ## Phase 2 - Resolve what applies to THIS module
49
54
 
50
- ### 2a. The registry is the standard - in-module prose docs are NOT consulted
51
-
52
- The skill's `references/rules.yml` (+ a project `modules/<Module>.yml` overlay) is the single source of truth. **Do not read, cite, or
53
- derive rules from a module's own `*-CLAUDE.md`, `docs/` set or any other in-repo prose.** They are
54
- being retired precisely so there is one place a rule can live; consulting them re-creates the
55
- split this command exists to remove. If such a file exists and contradicts the registry, that is a
56
- finding against the file, not against the code.
57
-
58
- The only in-repo inputs are **code and manifests**: sources, tests, `Package.swift`, `Info.plist`,
59
- the specs the generator reads, and the module registry from Phase 1.
60
-
61
- ### 2b. Per-module overlay, then inference
62
-
63
- 1. **`modules/<Module>.yml`** beside the project's own config carries what code cannot state: the vocabulary
64
- bindings, the module's role, prohibitions that currently have **zero** instances, deliberate
65
- carve-outs, name locks, and the real verification command. Registry-backed, so its findings may
66
- be `blocking`.
67
- *Why prohibitions need to be written down:* inference reads dominant patterns, and a rule
68
- obeyed everywhere has no counter-example to infer from. A ban at 100% compliance is invisible
69
- to a scan - it survives only if the overlay states it.
70
- 2. **Repo-level rules** (root `CLAUDE.md`, contributing docs) apply to every module.
71
- 3. **The module's own dominant pattern is its de-facto convention.** Count variants per dimension;
72
- the minority instances are the finding. Internal consistency beats conformity to a sibling.
73
- 4. No majority (even split, single instance) → not a finding. Record an Open Question.
74
-
75
- Findings from step 3 are tagged `inferred` and capped at **suggestion**. Only registry- or
76
- overlay-backed rules may be `blocking`.
77
-
78
- **When the overlay is missing**, generate a draft from code evidence, print it for confirmation,
79
- and mark every slot it could not derive - a frozen UI target, a name lock, a carve-out and an
80
- operational constraint all look like ordinary code from the outside. Do not guess them; list them
81
- as Open Questions.
82
-
83
- ### 2c. Vocabulary
84
-
85
- Bind each slot to a real symbol by grepping the module, then the reference module. **An unbound
86
- slot disables its rules** - never invent a name, never import a sibling's.
87
-
88
- `HandlerName` · `EventParam` · `CoordinatorType` · `ResultType` / `ErrorType` / `ErrorFactory` ·
89
- `DIResolver` / `DIConfigurator` · `RequestModelSuffix` / `ResponseModelSuffix` / `TransportSuffix` ·
90
- `MapperShape` · `SafeEnumProtocol` / `UnknownCase` · `CopySurface` · `AnalyticsSurface` ·
91
- `A11yIdentifierSource` · `GeneratedServiceRoot` · `SharedComponentsDir` / `SharedEntitiesDir` ·
92
- `MicroComponentLibrary` · `FrozenUITarget` · `DesignTokenNamespaces` · `CalendarDayHelper` ·
93
- `LoggerAPI` · `FileHeaderShape` · `ScreenRoot` · `ScreenRoleSuffixes` · `AsyncStyle` ·
94
- `CompositionRoot` · `SeamLayer` · `ModuleEntrySurface` · `ConcurrencyPosture` · `LintToolchain` ·
95
- `CredentialStore` (the module's Keychain wrapper, if any).
96
-
97
- Print the resolved table before scanning so a wrong binding is caught early.
98
-
99
- ### 2d. Sensitive-data inventory - required before any SEC rule runs
100
-
101
- The `SEC-*` rules are written against the **data classes** in `references/rules.yml →
102
- sensitive_data_classes`, never against one module's field names. Resolve the module's concrete
103
- instances of each class: grep entities, request/response models, storage calls and analytics
104
- events for the values the module actually handles, and map each to its class.
105
-
106
- Produce the inventory as a table - **class · concrete symbols · where it enters · required
107
- lifetime (transient / survives-restart / survives-reinstall) · where it is actually stored ·
108
- where it is logged · where it leaves (network, analytics, pasteboard, another module)**.
109
-
110
- The **lifetime column is the one that decides SEC-01**, and it is filled by walking
111
- `references/rules.yml → persistence_decision`, not by looking at what the code currently does. Compare it
112
- against the storage column and report both mismatches:
113
- - required transient but persisted anywhere (including the Keychain) → **over-persistence**;
114
- - required to survive a restart but stored outside the Keychain → **under-protection**.
115
-
116
- Then generate the SEC lint patterns *from this inventory*, so the checks match this module's real
117
- vocabulary. A class with no instance here yields no finding; a symbol you cannot classify, or one
118
- whose required lifetime nobody can state, is an Open Question, not a silent pass.
119
-
120
- This table is a deliverable in its own right, independent of whether any violation is found.
55
+ - **The registry is the standard.** `references/rules.yml` (+ a project `modules/<Module>.yml`
56
+ overlay) is the single source of truth. **Do not read, cite, or derive rules from a module's own
57
+ `*-CLAUDE.md`, `docs/` set or any other in-repo prose.** A file that contradicts the registry is a
58
+ finding against the file. The only in-repo inputs are code and manifests.
59
+ - **Overlay, then inference.** Overlay- and registry-backed findings may be `blocking`; findings
60
+ inferred from the module's dominant pattern are tagged `inferred` and capped at **suggestion**.
61
+ No majority → Open Question, not a finding. A missing overlay gets a draft from code evidence,
62
+ printed for confirmation, with every slot it could not derive listed as an Open Question.
63
+ - **Vocabulary.** Bind each slot to a real symbol by grepping. **An unbound slot disables its
64
+ rules** - never invent a name, never import a sibling's. Print the resolved table before scanning.
65
+ - **Sensitive-data inventory, required before any SEC rule runs.** Map the module's real symbols to
66
+ `sensitive_data_classes`; the lifetime column, filled from `persistence_decision`, decides
67
+ SEC-01. A symbol you cannot classify is an Open Question, not a silent pass.
121
68
 
122
69
  ## Phase 3 - Scan
123
70
 
124
- Apply the rules in `references/rules.yml` that survived Phase 2 binding, plus the module's own `validation`
125
- gate. Tag every finding: **rule ID · severity · source (`registry` / `doc` / `inferred`) ·
126
- onboarding impact (high/medium/low)**.
127
-
128
- ### Coverage gate - on disk, not in memory
129
-
130
- Before scanning, write `.<module>-audit-coverage.tsv` to the scratch dir: one row per target
131
- (every screen under `ScreenRoot`, every shared component, every entity, every file in every
132
- target) with columns `path · status · rules-applied`. Mark rows as you go.
133
-
134
- - Each target is **audited** or **explicitly skipped with a reason** (generated, fixture,
135
- vendored). No third state.
136
- - **The run is incomplete while any row is unmarked** - and the file, not a claim, is the proof.
137
- Chunk the module if it is too large for one pass; the checklist survives a context reset.
138
- - No sampling. A partial audit reported as complete certifies the unscanned screens as clean.
71
+ Apply the rules that survived Phase 2 binding, plus the module's own `validation` gate. Tag every
72
+ finding: **rule ID · severity · source (`registry` / `doc` / `inferred`) · onboarding impact**.
139
73
 
140
- ### Grep hygiene
141
-
142
- Registry `mechanism` patterns are line-based and match doc comments. Filter
143
- `^[[:space:]]*//` - BSD grep does not understand `\s`, so a `\s*//` filter silently lets `/// ...`
144
- through - then open each surviving hit and confirm it is real code. Report pre-filter and
145
- post-verification counts separately; a table padded with comment matches destroys trust.
146
-
147
- ### Judgement rules need evidence, not assertion
148
-
149
- For any rule marked `enforcement: judgement`, a finding must carry the measurement its `check`
150
- names - a reference count, a call-site count, a consumer count, a file list. **No count, no
151
- finding.** This is what keeps a subjective rule from becoming an opinion.
152
-
153
- Every judgement rule has a worked ✗/✓ pair in `EXAMPLES.md`, keyed by ID. Cite it in the finding's
154
- proposed fix rather than re-describing the shape - the developer applying the fix should be
155
- reading the same picture the audit used.
156
-
157
- ### Module-specific overrides
158
-
159
- The module's own docs win over the registry, including where they contradict a sibling module.
160
- Never apply one module's dialect to another. List every override honoured, so the reader sees why
161
- a registry rule was not raised.
74
+ - **Coverage gate on disk**: `.<module>-audit-coverage.tsv`, one row per target, each **audited**
75
+ or **explicitly skipped with a reason**. The run is incomplete while any row is unmarked. No
76
+ sampling.
77
+ - **Grep hygiene**: filter comment lines, confirm every hit, report pre-filter and verified counts.
78
+ - **Judgement rules**: no count, no finding; cite the `EXAMPLES.md` pair by ID.
162
79
 
163
80
  ## Phase 4 - Produce the plan
164
81
 
165
82
  No findings → report compliant and stop. Otherwise write
166
83
  `<ModulePath>/ios-coding-standard-plan-<module>.md` (or the repo's scratch/docs dir if the module
167
- tree must stay clean), containing, in order:
168
-
169
- 1. **Coverage ledger** - total targets · audited · skipped with reasons. Not 100% accounted for
170
- means the plan is not deliverable.
171
- 2. **Summary** - counts by severity and source, resolved vocabulary, branch to create.
172
- 3. **Sensitive-data inventory** (Phase 2d) - first, because it is the highest-risk content.
173
- 4. **Screen × role matrix** `[STRUCT-02]` - screens as rows, manifest roles as columns, cells
174
- `✓ / missing / misplaced`. The structural map a newcomer reads first.
175
- 5. **Type placement table** `[STRUCT-05]` - type · location · consumer count · correct tier ·
176
- move required. Paired with the nested-type list `[STRUCT-01]`: owner · nested type · kind ·
177
- reference count · verdict.
178
- 6. **Visibility report** `[VIS-01, VIS-02]` - over-exposed declarations per file, non-final
179
- classes with no subclass.
180
- 7. **Boundary report** `[MOD-*]` - import graph (allowed vs forbidden, with coupling depth) ·
181
- manifest graph (declared vs legal for the role, plus dead edges) · **removability delta**
182
- ("removing X touches N files: ...") · inbound test (tests compile with no sibling present).
183
- 8. **Testability seam report** `[TEST-*]` - types reaching for the environment, logic requiring a
184
- view to execute, doubles whose signatures have drifted.
185
- 9. **Change-cost probe** `[FLEX-*]` - pick two plausible upcoming changes (a new variant of an
186
- existing screen; a new field on a shared entity) and state what each costs in files today.
187
- 10. **Findings table** - rule ID · `file:line` · current state · proposed fix · severity · source ·
188
- onboarding impact.
189
- 11. **Per-file work** - grouped per file, blocking → important → suggestion; within a severity,
190
- highest onboarding impact first.
191
- 12. **Behaviour-preservation guard** - splitting files, adding MARKs, extracting extensions and
192
- moving types must not change behaviour. Anything requiring a behaviour change (a missing
193
- analytics event, a wrong result type, a timezone fix, a storage migration) goes in a
194
- **separate group**, reviewed and tested on its own, never inside a mechanical split commit.
195
- 13. **Tooling delegation & the ratchet** - the section that decides whether any of this survives.
196
- - Classify each applied rule by its registry `enforcement`. For every `lint` / `format` /
197
- `scan` rule, state the concrete mechanism and whether that toolchain exists in the repo
198
- (`LintToolchain`). **When it does not exist, saying so is a finding**, ranked above most
199
- individual violations it would have caught.
200
- - Recommend **baseline-and-ratchet, never big-bang**: grandfather existing violations, surface
201
- only new ones, drain the backlog behind a green build. Order the plan the same way - stop
202
- the bleeding, then clean up.
203
- - Custom lint rule identifiers **are** the registry IDs (`sec_01_no_plaintext_persistence`,
204
- `mod_01_no_sibling_import`) so a violation points straight at the rule entry.
205
- - **Linting is local-only by decision** - the skill's `references/lint-local.sh` with `references/swiftlint.draft.yml`, config
206
- and baseline kept outside the repository; no committed config, no build phase, no CI job.
207
- State this honestly in the plan rather than describing a gate that does not exist: a
208
- pre-PR habit catches less than a wall, so the residual risk is real and belongs in the
209
- report. Adopting it project-wide remains an open decision - record it as one so it stays
210
- visible instead of quietly lapsing.
211
- - Never imply the audit substitutes for the linter, or the linter for a gate. The audit finds
212
- the debt once; the linter keeps a developer honest; only a gate stops it returning.
213
- 14. **Numeric exit criteria** - target and today's measured value side by side: lint violations
214
- per 1k lines (<1) · public-surface ratio, public declarations ÷ externally consumed symbols
215
- (≈1) · forbidden cross-module imports (0) · removability delta · files over threshold and
216
- files >120 lines with no sectioning (0) · screens missing a manifest role (0) · escape-hatch
217
- count `[CONC-03]` (flat or falling) · exception-marker count (flat or falling) · dead code (0)
218
- · screens with logic and no mirrored tests (0) · unclassified sensitive symbols (0).
219
- 15. **Exception ledger** - every `// standard:exception(<ID>)` in the module: rule · reason ·
220
- expiry · expired yes/no.
221
- 16. **Open Questions** - Phase 2b dimensions with no majority, and unclassifiable symbols.
222
- 17. **Suggested commit slicing** - one commit per file-group / concern.
223
- 18. **Scope guard** - only this module is touched; definition of done is the module's own
224
- verification path.
84
+ tree must stay clean) with the 18 sections of `plan.md`, in order. Hard rules from it:
225
85
 
226
- Then write a **separate one-page onboarding summary** beside the plan, aimed at a developer
227
- joining next week rather than at whoever does the remediation: the ten always/never lines
228
- specialised to this module, the screen file manifest, the placement ladder, the sensitive-data
229
- classes in play, and the verification command. Nobody learns a codebase from a 40-finding audit -
230
- this page is the actual deliverable, and the audit is how you earn the right to write it
231
- accurately. Derive it from `references/STANDARD.md section 0`, do not re-invent it.
86
+ - A coverage ledger short of 100% accounted for means the plan is not deliverable.
87
+ - Behaviour changes go in a **separate group**, never inside a mechanical split commit.
88
+ - Linting is **local-only by decision**; never describe a gate that does not exist, and never imply
89
+ the audit substitutes for the linter or the linter for a gate.
232
90
 
91
+ Then write the one-page onboarding summary beside the plan (`plan.md`, "Onboarding summary").
233
92
  Show a concise version of the plan to the user too.
234
93
 
235
94
  ## Phase 5 - Hand off
@@ -248,11 +107,9 @@ verifies, and commits only when asked. This routine ends at the handoff.
248
107
 
249
108
  ## Notes
250
109
 
251
- - **Verification reality is per-module - establish it, do not assume it.** Some targets cannot be
252
- compiled from the CLI (asset symbol generation, UIKit-dependent packages, a dependency failing
253
- earlier in the graph); there, verification is Xcode and a manifest dump validates the manifest
254
- only. Never trust a piped build's exit code - a pipe reports the tail's status. Record the
255
- module's actual verification command in the plan.
110
+ - **Verification reality is per-module - establish it, do not assume it.** Never trust a piped
111
+ build's exit code. Record the module's actual verification command in the plan
112
+ (`resolve-and-scan.md`, "Verification reality").
256
113
  - One module per run. Several modules means several runs and several plans, never one
257
114
  cross-module churn commit.
258
115
  - If the audit wants a rule the registry lacks, add it to the skill's `references/rules.yml` as `status: proposed` with a
@@ -20,12 +20,13 @@ Lets you switch to the task branch for manual testing in Xcode before the PR is
20
20
  2. **Check the state** - the task must have completed Phase 2 (Dev) or later
21
21
  - Phase < 2 → "No code has been written yet, run `resume #N` first"
22
22
 
23
- 3. **Remove the worktree and switch to the branch**:
23
+ 3. **Hand the branch over**. Make the WIP commit yourself (Standard path item 3 of Phase 4 Step 2 folds it back), then let the script hold the run artefacts and the project root's current branch, remove the worktree and check the branch out. `{worktree-path}` and `{jiraId}` come from the task's state (`worktreePath`, `jiraId`):
24
24
  ```bash
25
- cd {project-root}
26
- git worktree remove .worktrees/PROJ-{id} 2>/dev/null
27
- git checkout {branch-name}
25
+ git -C "{worktree-path}" add -A
26
+ git -C "{worktree-path}" diff --cached --quiet || git -C "{worktree-path}" commit -m "WIP: {jiraId} - changes for user test"
27
+ bash $HOME/.claude/scripts/user-test-handoff.sh checkout --task "{jiraId}" --worktree "{worktree-path}" --root "{project-root}" --branch "{branch-name}"
28
28
  ```
29
+ A refused commit stops here with nothing moved. Script exits: 3 the project root has uncommitted changes; 5 the worktree or a submodule holds uncommitted, unpushed or stashed work (a submodule with no remote needs one added); both move nothing. 6 a handoff is already held, or git refused part way: run `restore` below (if it answers 7, nothing had moved). 1 the worktree is not on the branch.
29
30
 
30
31
  4. **Give test instructions**:
31
32
  ```
@@ -41,7 +42,11 @@ Lets you switch to the task branch for manual testing in Xcode before the PR is
41
42
  ❌ "fix: ..." → the worktree is recreated and the fix is applied
42
43
  ```
43
44
 
44
- 5. **Wait for the user's response**
45
+ 5. **Wait for the user's response**, then hand the branch back before acting on it:
46
+ ```bash
47
+ bash $HOME/.claude/scripts/user-test-handoff.sh restore --task "{jiraId}" --worktree "{worktree-path}" --root "{project-root}" --branch "{branch-name}"
48
+ ```
49
+ Exit 3: the user edited files on the branch in the project root. Ask them to `git stash`, run `restore` again, then `git -C "{worktree-path}" stash pop`; a commit made there instead would stop Phase 4 from folding the checkpoints. Exit 6: the project root could not leave the branch (an untracked file in the way) or the worktree could not be re-added; the message names the cause, the hold is kept, and `restore` runs again once it is cleared. Exit 7: nothing was held, so the worktree was never removed.
45
50
 
46
51
  6. **Based on the result**:
47
52
  - **OK** → an "ok" is a claim, and the pass has to be substantiated before it is recorded. First write `$WORKTREE/.pipeline/manual-test.json`, one entry per acceptance criterion taken from the analysis doc test plan, the plan tasks, or the user's own words:
@@ -53,5 +58,5 @@ Lets you switch to the task branch for manual testing in Xcode before the PR is
53
58
  node $HOME/.claude/scripts/evidence-gate.mjs --claim manual --status passed \
54
59
  --evidence "$WORKTREE/.pipeline/manual-test.json"
55
60
  ```
56
- Exit 1 means the "ok" is not accepted: name the criterion that lacks evidence and wait for the next reply. Exit 0 → recreate the worktree, proceed to Phase 4. Full contract: `$HOME/.claude/multi-agent-refs/phases/phase-3-review.md` step 5.
57
- - **Fix needed** → recreate the worktree, apply the fix
61
+ Exit 1 means the "ok" is not accepted: name the criterion that lacks evidence and wait for the next reply. Exit 0 → proceed to Phase 4. Full contract: `$HOME/.claude/multi-agent-refs/phases/phase-3-review.md` step 5.
62
+ - **Fix needed** → apply the fix in the restored worktree
@@ -15,6 +15,8 @@ Deep-analyses the current project, extracts the global best-practices worth adop
15
15
 
16
16
  **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.)
17
17
 
18
+ 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.
19
+
18
20
  ## Flow
19
21
 
20
22
  ```
@@ -22,229 +24,80 @@ Step 0: BEST-PRACTICES Research the field, extract the best approaches, ADAPT
22
24
  Step 0b: DRIFT Check upstream-derived skills for updates we have not pulled -> plan band D
23
25
  Step 0c: DEV-TOOLKIT Research current MCP practice + audit the companion multi-agent-toolkit repo -> plan band E
24
26
  Step 0d: RUN-ERRORS Read the local run-error ledger, rank recurring failures -> plan band F
27
+ Step 0e: BACKLOG Decide the open observations recorded mid-task -> plan band G
25
28
  Step 1: SCAN Walk the project structure (files, LOC, dependencies, CI, tests)
26
29
  Step 2: ANALYZE 10 categories + an explicit BUG HUNT (real defects, not just scores) -> plan bands B, C
27
30
  Step 3: SCORE Each category /10, overall /100
28
- Step 4: PLAN Merge bands A (best-practice) + B (bugs) + C (improvements) + D (drift) + E (multi-agent-toolkit) + F (run-errors)
31
+ Step 4: PLAN Merge every band into one table
29
32
  Step 5: ASK "Start the work?" - wait for user approval
30
33
  Step 6: IMPLEMENT Apply approved items one by one (lint, test, commit)
31
34
  Step 7: VERIFY Confirm every test + lint passes
32
35
  Step 8: ASK SYNC "Run /multi-agent:sync?" - wait for user approval
33
36
  ```
34
37
 
35
- Plan bands (all five feed the single Step 4 table):
36
- - **A - Best-practice**: the best field approaches, adapted so they actually fit this repo.
37
- - **B - Bug**: real defects found in the code (correctness, security, data-loss, crashes).
38
- - **C - Improvement**: quality/perf/DX gaps surfaced by the 10-category analysis.
39
- - **D - Drift**: upstream updates to skills we derived from an external source.
40
- - **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.
41
- - **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.
42
-
43
- ## Step 0: BEST-PRACTICES - research the field, adapt to us
44
-
45
- Do not copy features blindly. The goal is the best *approaches*, reshaped so they are applicable to THIS project's stack, size, and constraints.
46
-
47
- 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.
48
- 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.
49
- - **GitHub**: search the domain terms + `stars:>50`; read the top repos' READMEs, architecture docs, CI configs, test layout.
50
- - **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).
51
- - **Reddit**: relevant subreddits for real-world pain points and adopted patterns.
52
- - **Web**: "<domain> best practices <current-year>", official style guides, and the platform's own guidance.
53
- 3. **For each candidate approach, record**:
54
- - what it is, who does it well (source link)
55
- - the concrete benefit
56
- - **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/`"
57
- - effort (Low/Med/High) and impact (Low/Med/High/Critical)
58
- 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).
59
-
60
- Output (plan band A):
61
- ```
62
- | Source | Approach | Adaptation to our repo | Effort | Impact | In plan? |
63
- |--------|----------|------------------------|--------|--------|----------|
64
- | <repo> | <what> | <concrete change here> | Low | High | Yes (P1) |
65
- | <repo> | <what> | does not fit: <reason> | - | - | No |
66
- ```
67
- Roll the high-impact + low/med-effort survivors into the Step 4 plan as band-A items.
38
+ ## Step 0: BEST-PRACTICES
68
39
 
69
- ## Step 0b: DRIFT - upstream-derived skill check
40
+ 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".
70
41
 
71
- 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.
42
+ ## Step 0b: DRIFT - upstream-derived skill check
72
43
 
73
44
  Rules that hold for every entry:
74
45
  - 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.
75
46
  - **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.
76
47
  - 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`.
77
48
 
78
- 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).
49
+ Full procedure: `$HOME/.claude/multi-agent-refs/refactor/drift.md`. Read it when `global.derivedSkillSources` has at least one entry.
79
50
 
80
- ## Step 0c: DEV-TOOLKIT - current MCP practice for the companion toolkit
51
+ ## Step 0c: DEV-TOOLKIT
81
52
 
82
- 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.
53
+ 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.
83
54
 
84
- 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.
55
+ ## Step 0d: RUN-ERRORS
85
56
 
86
- ## Step 0d: RUN-ERRORS - what the pipeline actually failed on
57
+ 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.
87
58
 
88
- 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.
89
-
90
- 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).
91
-
92
- ## Step 0e: BACKLOG - friction this pipeline already noticed
93
-
94
- 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.
59
+ ## Step 0e: BACKLOG
95
60
 
96
61
  ```bash
97
62
  node "$HOME/.claude/scripts/observations.mjs" scan --status open --json
98
63
  ```
99
64
 
100
- 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".
101
-
102
- 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.
103
-
104
- `/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`.
65
+ 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`.
105
66
 
106
67
  ## Step 1: SCAN
107
68
 
108
- ```
109
- - file count, LOC (cloc or wc -l)
110
- - package.json / Package.swift / build.gradle analysis
111
- - dependency count (runtime vs dev)
112
- - Is there a CI/CD pipeline? (.github/workflows/, fastlane/, Makefile)
113
- - Is there test infrastructure? How many tests? Coverage?
114
- - Is a linter/formatter config in place?
115
- - Do README, LICENSE, SECURITY.md, CHANGELOG.md exist?
116
- - Git state: branch count, last commit date, tags
117
- ```
69
+ Walk files, LOC, manifests, dependencies, CI, tests, linters, repo docs and git state (`sweep.md` "Step 1").
118
70
 
119
71
  ## Step 2: ANALYZE - 10 categories + BUG HUNT
120
72
 
121
- ### 2a. 10 categories (quality lens)
122
-
123
- | # | Category | What to check |
124
- |---|----------|---------------|
125
- | 1 | **Architecture** | Layer separation, modularity, SOLID, dependency direction |
126
- | 2 | **Code Quality** | Naming, magic numbers, dead code, complexity, DRY |
127
- | 3 | **Security** | Hardcoded secrets, input validation, Keychain, ATS, ATT |
128
- | 4 | **Tests** | Coverage, test pyramid, edge cases, mock/stub quality |
129
- | 5 | **CI/CD** | Build matrix, lint job, release automation, artifact caching |
130
- | 6 | **Docs** | README quality, JSDoc / Swift docs, API docs, CHANGELOG |
131
- | 7 | **Performance** | Bundle size, lazy loading, memory leaks, unnecessary re-renders |
132
- | 8 | **Accessibility** | a11y labels, tap targets, VoiceOver, Dynamic Type |
133
- | 9 | **Dependency Management** | Outdated deps, vulnerability scan, lockfile, version pinning |
134
- | 10 | **DevEx** | Onboarding time, script ergonomics, error messages, debug tooling |
135
-
136
- ### 2b. BUG HUNT (real defects, not scores)
137
-
138
- Category scores measure quality; they do not find the bug that ships. Run an explicit defect hunt IN ADDITION to the scoring:
139
-
140
- - 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.
141
- - For each candidate defect, record: **file:line**, the concrete failure scenario (inputs/state -> wrong output/crash), and severity.
142
- - **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.
143
-
144
- Output (plan band B) - every confirmed defect becomes a P0/P1 item:
145
- ```
146
- | # | Severity | File:line | Defect | Failure scenario |
147
- |---|----------|-----------|--------|------------------|
148
- | 1 | Blocking | src/x.ts:42 | unchecked nil deref | empty response -> crash |
149
- ```
150
-
151
- Improvement areas surfaced by 2a that are not outright bugs become band-C items.
73
+ 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.
152
74
 
153
75
  ## Step 3: SCORE
154
76
 
155
- Each category is scored out of 10. Output:
77
+ Each category /10, total /100 (`sweep.md` "Step 3").
156
78
 
157
- ```
158
- +---------------------+-------+
159
- | Category | Score |
160
- +---------------------+-------+
161
- | Architecture | 9/10 |
162
- | Code Quality | 8/10 |
163
- | Security | 9/10 |
164
- | Tests | 7/10 |
165
- | CI/CD | 8/10 |
166
- | Docs | 7/10 |
167
- | Performance | 9/10 |
168
- | Accessibility | 6/10 |
169
- | Dependency Mgmt | 8/10 |
170
- | DevEx | 9/10 |
171
- +---------------------+-------+
172
- | TOTAL | 80/100|
173
- +---------------------+-------+
174
- ```
79
+ ## Step 4: PLAN
175
80
 
176
- ## Step 4: PLAN - one merged, prioritized table
177
-
178
- 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.
179
-
180
- ```
181
- | # | Priority | Band | Category | Item | Impact |
182
- |---|----------|------|----------|------|--------|
183
- | 1 | P0 | B | Security | Remove hardcoded API key (src/x:12) | Critical |
184
- | 2 | P0 | B | Tests | Fix nil-deref on empty response (src/y:42) | High |
185
- | 3 | P1 | A | CI/CD | Adopt matrix build (adapt: .github/workflows/ci.yml) | Medium |
186
- | 4 | P1 | D | Skills | Port upstream <plugin> 0.3.0 fixes into <localPath> | Medium |
187
- | 5 | P1 | E | Toolkit | Add read-only annotations to the multi-agent-toolkit device tools | Medium |
188
- | 6 | P2 | C | DevEx | Rename npm scripts for consistency | Low |
189
- ```
190
-
191
- Priority levels:
192
- - **P0**: bugs, security holes, broken functionality - must fix
193
- - **P1**: clear quality improvement or high-value adopted best-practice / drift port - should be done
194
- - **P2**: nice-to-have - if time allows
81
+ One merged table, every row tagged with its band, priorities P0 / P1 / P2 (`sweep.md` "Step 4").
195
82
 
196
83
  ## Step 5: ASK - user approval
197
84
 
198
- After showing the plan, ask:
199
-
200
85
  > "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?"
201
86
 
202
- Options:
203
- - "Yes, do all"
204
- - "Only P0"
205
- - "P0 + P1 only"
206
- - "Only bugs (band B)"
207
- - "Only the multi-agent-toolkit (band E)"
208
- - (the user may pick specific items)
87
+ Options: "Yes, do all" / "Only P0" / "P0 + P1 only" / "Only bugs (band B)" / "Only the multi-agent-toolkit (band E)" / specific items.
209
88
 
210
89
  **Never start the work without approval.**
211
90
 
212
91
  ## Step 6: IMPLEMENT
213
92
 
214
- Apply the approved items one by one:
215
-
216
- 1. For each item:
217
- - apply the change (for band D, port the upstream diff into `localPath`, then bump that entry's `derivedFromVersion` in preferences)
218
- - 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.
219
- - run the relevant tests
220
- - on success, move to the next
221
- - on failure, roll back and notify the user
222
- 2. After all changes are done:
223
- - run the full lint + test suite
224
- - on success, commit
225
-
226
- Commit format: `refactor(scope): {short description}`
93
+ 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}`.
227
94
 
228
95
  ## Step 7: VERIFY
229
96
 
230
- ```bash
231
- # Lint
232
- npm run lint 2>/dev/null || swift build 2>/dev/null
233
-
234
- # Test
235
- npm test 2>/dev/null || swift test 2>/dev/null || xcodebuild test 2>/dev/null
236
-
237
- # Result
238
- echo "Lint: PASS/FAIL"
239
- echo "Test: PASS/FAIL (X/Y passed)"
240
- ```
241
-
242
- 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.
97
+ Full lint + test must pass; band-E work also re-verifies the toolkit (`sweep.md` "Step 7").
243
98
 
244
99
  ## Step 8: ASK SYNC
245
100
 
246
- After every approved item is applied, ask:
247
-
248
101
  > "Work is complete. Should I run /multi-agent:sync?"
249
102
 
250
103
  Options:
@@ -254,18 +107,4 @@ Options:
254
107
 
255
108
  ## Focus filter
256
109
 
257
- If $ARGUMENTS is set, focus on that band/category only:
258
-
259
- | Input | Focus |
260
- |-------|-------|
261
- | `bugs` | Bug hunt only (band B) |
262
- | `best-practices` | Field research + adapted plan only (band A) |
263
- | `drift` | Upstream derived-skill drift only (band D) |
264
- | `multi-agent-toolkit` | Companion MCP toolkit research + audit only (band E) |
265
- | `security` | Security analysis only |
266
- | `tests` | Test coverage and quality only |
267
- | `performance` | Performance optimisation only |
268
- | `docs` | Docs only |
269
- | `ci` | CI/CD pipeline only |
270
- | `deps` | Dependency updates only |
271
- | (empty) | Everything (default) |
110
+ If $ARGUMENTS is set, focus on that band/category only; the mapping is `sweep.md` "Focus filter". Empty runs everything.