@mmerterden/multi-agent-pipeline 13.1.0 → 13.3.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.
@@ -0,0 +1,258 @@
1
+ ---
2
+ name: multi-agent-ios-coding-standard
3
+ language: en
4
+ description: "Audit an iOS module against the shared coding-standard registry (95 stable-ID rules), produce a remediation plan, then hand off to dev/dev-local. Use for a standards pass on a module, or when a review needs rule IDs rather than opinions."
5
+ user-invocable: true
6
+ argument-hint: "[module name or path]"
7
+ ---
8
+
9
+ # multi-agent ios-coding-standard - Module audit → plan → dev handoff
10
+
11
+ **Input**: $ARGUMENTS - optionally a module name or path. When absent, Phase 1 discovers and asks.
12
+
13
+ This routine is the **procedure**. The rules live in the `ios-coding-standard` skill, whose registry is
14
+ `references/rules.yml` and whose teaching doc is `references/STANDARD.md`. Load that
15
+ skill first; it is installed on every host and carried by the iOS stack plugin, so
16
+ there is one registry rather than a copy per CLI. Never restate a rule here - cite its ID. A rule that is not in the
17
+ registry is not a rule; if the audit needs one, propose it as `status: proposed` and say so.
18
+
19
+ Read-only + planning. This routine never edits source - the dev pipeline does.
20
+
21
+ **Goal.** A developer new to the repo can open any file in the module and understand it without a
22
+ guided tour, and nothing sensitive leaks on the way. Rank every finding by "does fixing this
23
+ shorten the time to first productive PR, or close a real risk?"
24
+
25
+ Render assistant-facing prose in `outputLanguage`. External payloads (branch names, plan file,
26
+ dev task) stay English.
27
+
28
+ ---
29
+
30
+ ## Phase 1 - Discover and pick the module
31
+
32
+ 1. Repo root via `git rev-parse --show-toplevel`.
33
+ 2. **Discover module roots** - any directory with a `Package.swift`, a `Sources/` subtree or an
34
+ `.xcodeproj`. Sweep the container dirs that exist (`Domains/`, `Packages/`, `Modules/`,
35
+ `Features/`, `Core/`, `Common/`, top-level module dirs) one level deep, then two if empty.
36
+ 3. Record per module: name · path · Swift files · lines · governance docs present · SPM targets.
37
+ Keep this **module registry** for the whole run - `MOD-*` greps every import against it.
38
+ Classify each module's role, because the role decides which dependency edges are legal:
39
+ **feature** · **core/common** · **seam** (cross-module contracts/bridges/navigation) ·
40
+ **composition root** (legitimately knows every module).
41
+ 4. If `$ARGUMENTS` resolves to a module, skip the prompt. Otherwise `AskUserQuestion`
42
+ (single-select, `outputLanguage`), documented modules first, each option showing file/line
43
+ counts and `docs: yes/no`. If the list exceeds the question limit, group the smallest into an
44
+ "other" option and ask again - never truncate silently.
45
+ 5. Scope = the whole module's sources across all its targets, unless the user narrows it.
46
+
47
+ ## Phase 2 - Resolve what applies to THIS module
48
+
49
+ ### 2a. The registry is the standard - in-module prose docs are NOT consulted
50
+
51
+ The skill's `references/rules.yml` (+ a project `modules/<Module>.yml` overlay) is the single source of truth. **Do not read, cite, or
52
+ derive rules from a module's own `*-CLAUDE.md`, `docs/` set or any other in-repo prose.** They are
53
+ being retired precisely so there is one place a rule can live; consulting them re-creates the
54
+ split this command exists to remove. If such a file exists and contradicts the registry, that is a
55
+ finding against the file, not against the code.
56
+
57
+ The only in-repo inputs are **code and manifests**: sources, tests, `Package.swift`, `Info.plist`,
58
+ the specs the generator reads, and the module registry from Phase 1.
59
+
60
+ ### 2b. Per-module overlay, then inference
61
+
62
+ 1. **`modules/<Module>.yml`** beside the project's own config carries what code cannot state: the vocabulary
63
+ bindings, the module's role, prohibitions that currently have **zero** instances, deliberate
64
+ carve-outs, name locks, and the real verification command. Registry-backed, so its findings may
65
+ be `blocking`.
66
+ *Why prohibitions need to be written down:* inference reads dominant patterns, and a rule
67
+ obeyed everywhere has no counter-example to infer from. A ban at 100% compliance is invisible
68
+ to a scan - it survives only if the overlay states it.
69
+ 2. **Repo-level rules** (root `CLAUDE.md`, contributing docs) apply to every module.
70
+ 3. **The module's own dominant pattern is its de-facto convention.** Count variants per dimension;
71
+ the minority instances are the finding. Internal consistency beats conformity to a sibling.
72
+ 4. No majority (even split, single instance) → not a finding. Record an Open Question.
73
+
74
+ Findings from step 3 are tagged `inferred` and capped at **suggestion**. Only registry- or
75
+ overlay-backed rules may be `blocking`.
76
+
77
+ **When the overlay is missing**, generate a draft from code evidence, print it for confirmation,
78
+ and mark every slot it could not derive - a frozen UI target, a name lock, a carve-out and an
79
+ operational constraint all look like ordinary code from the outside. Do not guess them; list them
80
+ as Open Questions.
81
+
82
+ ### 2c. Vocabulary
83
+
84
+ Bind each slot to a real symbol by grepping the module, then the reference module. **An unbound
85
+ slot disables its rules** - never invent a name, never import a sibling's.
86
+
87
+ `HandlerName` · `EventParam` · `CoordinatorType` · `ResultType` / `ErrorType` / `ErrorFactory` ·
88
+ `DIResolver` / `DIConfigurator` · `RequestModelSuffix` / `ResponseModelSuffix` / `TransportSuffix` ·
89
+ `MapperShape` · `SafeEnumProtocol` / `UnknownCase` · `CopySurface` · `AnalyticsSurface` ·
90
+ `A11yIdentifierSource` · `GeneratedServiceRoot` · `SharedComponentsDir` / `SharedEntitiesDir` ·
91
+ `MicroComponentLibrary` · `FrozenUITarget` · `DesignTokenNamespaces` · `CalendarDayHelper` ·
92
+ `LoggerAPI` · `FileHeaderShape` · `ScreenRoot` · `ScreenRoleSuffixes` · `AsyncStyle` ·
93
+ `CompositionRoot` · `SeamLayer` · `ModuleEntrySurface` · `ConcurrencyPosture` · `LintToolchain` ·
94
+ `CredentialStore` (the module's Keychain wrapper, if any).
95
+
96
+ Print the resolved table before scanning so a wrong binding is caught early.
97
+
98
+ ### 2d. Sensitive-data inventory - required before any SEC rule runs
99
+
100
+ The `SEC-*` rules are written against the **data classes** in `references/rules.yml →
101
+ sensitive_data_classes`, never against one module's field names. Resolve the module's concrete
102
+ instances of each class: grep entities, request/response models, storage calls and analytics
103
+ events for the values the module actually handles, and map each to its class.
104
+
105
+ Produce the inventory as a table - **class · concrete symbols · where it enters · required
106
+ lifetime (transient / survives-restart / survives-reinstall) · where it is actually stored ·
107
+ where it is logged · where it leaves (network, analytics, pasteboard, another module)**.
108
+
109
+ The **lifetime column is the one that decides SEC-01**, and it is filled by walking
110
+ `references/rules.yml → persistence_decision`, not by looking at what the code currently does. Compare it
111
+ against the storage column and report both mismatches:
112
+ - required transient but persisted anywhere (including the Keychain) → **over-persistence**;
113
+ - required to survive a restart but stored outside the Keychain → **under-protection**.
114
+
115
+ Then generate the SEC lint patterns *from this inventory*, so the checks match this module's real
116
+ vocabulary. A class with no instance here yields no finding; a symbol you cannot classify, or one
117
+ whose required lifetime nobody can state, is an Open Question, not a silent pass.
118
+
119
+ This table is a deliverable in its own right, independent of whether any violation is found.
120
+
121
+ ## Phase 3 - Scan
122
+
123
+ Apply the rules in `references/rules.yml` that survived Phase 2 binding, plus the module's own `validation`
124
+ gate. Tag every finding: **rule ID · severity · source (`registry` / `doc` / `inferred`) ·
125
+ onboarding impact (high/medium/low)**.
126
+
127
+ ### Coverage gate - on disk, not in memory
128
+
129
+ Before scanning, write `.<module>-audit-coverage.tsv` to the scratch dir: one row per target
130
+ (every screen under `ScreenRoot`, every shared component, every entity, every file in every
131
+ target) with columns `path · status · rules-applied`. Mark rows as you go.
132
+
133
+ - Each target is **audited** or **explicitly skipped with a reason** (generated, fixture,
134
+ vendored). No third state.
135
+ - **The run is incomplete while any row is unmarked** - and the file, not a claim, is the proof.
136
+ Chunk the module if it is too large for one pass; the checklist survives a context reset.
137
+ - No sampling. A partial audit reported as complete certifies the unscanned screens as clean.
138
+
139
+ ### Grep hygiene
140
+
141
+ Registry `mechanism` patterns are line-based and match doc comments. Filter
142
+ `^[[:space:]]*//` - BSD grep does not understand `\s`, so a `\s*//` filter silently lets `/// ...`
143
+ through - then open each surviving hit and confirm it is real code. Report pre-filter and
144
+ post-verification counts separately; a table padded with comment matches destroys trust.
145
+
146
+ ### Judgement rules need evidence, not assertion
147
+
148
+ For any rule marked `enforcement: judgement`, a finding must carry the measurement its `check`
149
+ names - a reference count, a call-site count, a consumer count, a file list. **No count, no
150
+ finding.** This is what keeps a subjective rule from becoming an opinion.
151
+
152
+ Every judgement rule has a worked ✗/✓ pair in `EXAMPLES.md`, keyed by ID. Cite it in the finding's
153
+ proposed fix rather than re-describing the shape - the developer applying the fix should be
154
+ reading the same picture the audit used.
155
+
156
+ ### Module-specific overrides
157
+
158
+ The module's own docs win over the registry, including where they contradict a sibling module.
159
+ Never apply one module's dialect to another. List every override honoured, so the reader sees why
160
+ a registry rule was not raised.
161
+
162
+ ## Phase 4 - Produce the plan
163
+
164
+ No findings → report compliant and stop. Otherwise write
165
+ `<ModulePath>/ios-coding-standard-plan-<module>.md` (or the repo's scratch/docs dir if the module
166
+ tree must stay clean), containing, in order:
167
+
168
+ 1. **Coverage ledger** - total targets · audited · skipped with reasons. Not 100% accounted for
169
+ means the plan is not deliverable.
170
+ 2. **Summary** - counts by severity and source, resolved vocabulary, branch to create.
171
+ 3. **Sensitive-data inventory** (Phase 2d) - first, because it is the highest-risk content.
172
+ 4. **Screen × role matrix** `[STRUCT-02]` - screens as rows, manifest roles as columns, cells
173
+ `✓ / missing / misplaced`. The structural map a newcomer reads first.
174
+ 5. **Type placement table** `[STRUCT-05]` - type · location · consumer count · correct tier ·
175
+ move required. Paired with the nested-type list `[STRUCT-01]`: owner · nested type · kind ·
176
+ reference count · verdict.
177
+ 6. **Visibility report** `[VIS-01, VIS-02]` - over-exposed declarations per file, non-final
178
+ classes with no subclass.
179
+ 7. **Boundary report** `[MOD-*]` - import graph (allowed vs forbidden, with coupling depth) ·
180
+ manifest graph (declared vs legal for the role, plus dead edges) · **removability delta**
181
+ ("removing X touches N files: ...") · inbound test (tests compile with no sibling present).
182
+ 8. **Testability seam report** `[TEST-*]` - types reaching for the environment, logic requiring a
183
+ view to execute, doubles whose signatures have drifted.
184
+ 9. **Change-cost probe** `[FLEX-*]` - pick two plausible upcoming changes (a new variant of an
185
+ existing screen; a new field on a shared entity) and state what each costs in files today.
186
+ 10. **Findings table** - rule ID · `file:line` · current state · proposed fix · severity · source ·
187
+ onboarding impact.
188
+ 11. **Per-file work** - grouped per file, blocking → important → suggestion; within a severity,
189
+ highest onboarding impact first.
190
+ 12. **Behaviour-preservation guard** - splitting files, adding MARKs, extracting extensions and
191
+ moving types must not change behaviour. Anything requiring a behaviour change (a missing
192
+ analytics event, a wrong result type, a timezone fix, a storage migration) goes in a
193
+ **separate group**, reviewed and tested on its own, never inside a mechanical split commit.
194
+ 13. **Tooling delegation & the ratchet** - the section that decides whether any of this survives.
195
+ - Classify each applied rule by its registry `enforcement`. For every `lint` / `format` /
196
+ `scan` rule, state the concrete mechanism and whether that toolchain exists in the repo
197
+ (`LintToolchain`). **When it does not exist, saying so is a finding**, ranked above most
198
+ individual violations it would have caught.
199
+ - Recommend **baseline-and-ratchet, never big-bang**: grandfather existing violations, surface
200
+ only new ones, drain the backlog behind a green build. Order the plan the same way - stop
201
+ the bleeding, then clean up.
202
+ - Custom lint rule identifiers **are** the registry IDs (`sec_01_no_plaintext_persistence`,
203
+ `mod_01_no_sibling_import`) so a violation points straight at the rule entry.
204
+ - **Linting is local-only by decision** - the skill's `references/lint-local.sh` with `references/swiftlint.draft.yml`, config
205
+ and baseline kept outside the repository; no committed config, no build phase, no CI job.
206
+ State this honestly in the plan rather than describing a gate that does not exist: a
207
+ pre-PR habit catches less than a wall, so the residual risk is real and belongs in the
208
+ report. Adopting it project-wide remains an open decision - record it as one so it stays
209
+ visible instead of quietly lapsing.
210
+ - Never imply the audit substitutes for the linter, or the linter for a gate. The audit finds
211
+ the debt once; the linter keeps a developer honest; only a gate stops it returning.
212
+ 14. **Numeric exit criteria** - target and today's measured value side by side: lint violations
213
+ per 1k lines (<1) · public-surface ratio, public declarations ÷ externally consumed symbols
214
+ (≈1) · forbidden cross-module imports (0) · removability delta · files over threshold and
215
+ files >120 lines with no sectioning (0) · screens missing a manifest role (0) · escape-hatch
216
+ count `[CONC-03]` (flat or falling) · exception-marker count (flat or falling) · dead code (0)
217
+ · screens with logic and no mirrored tests (0) · unclassified sensitive symbols (0).
218
+ 15. **Exception ledger** - every `// standard:exception(<ID>)` in the module: rule · reason ·
219
+ expiry · expired yes/no.
220
+ 16. **Open Questions** - Phase 2b dimensions with no majority, and unclassifiable symbols.
221
+ 17. **Suggested commit slicing** - one commit per file-group / concern.
222
+ 18. **Scope guard** - only this module is touched; definition of done is the module's own
223
+ verification path.
224
+
225
+ Then write a **separate one-page onboarding summary** beside the plan, aimed at a developer
226
+ joining next week rather than at whoever does the remediation: the ten always/never lines
227
+ specialised to this module, the screen file manifest, the placement ladder, the sensitive-data
228
+ classes in play, and the verification command. Nobody learns a codebase from a 40-finding audit -
229
+ this page is the actual deliverable, and the audit is how you earn the right to write it
230
+ accurately. Derive it from `references/STANDARD.md section 0`, do not re-invent it.
231
+
232
+ Show a concise version of the plan to the user too.
233
+
234
+ ## Phase 5 - Hand off
235
+
236
+ `AskUserQuestion` (single-select, `outputLanguage`):
237
+
238
+ | Option | What it does |
239
+ |---|---|
240
+ | `/multi-agent:dev-local` | No worktree; branches from the main development branch, fixes on the current checkout |
241
+ | `/multi-agent:dev` | Opens a worktree; Opus fixes on a fresh branch + PR |
242
+
243
+ Invoke the chosen command with the plan file as the task input, branching off the repo's main
244
+ development branch (e.g. `chore/<module>-coding-standard`). The dev pipeline applies the fixes,
245
+ verifies, and commits only when asked. This routine ends at the handoff.
246
+
247
+ ## Notes
248
+
249
+ - **Verification reality is per-module - establish it, do not assume it.** Some targets cannot be
250
+ compiled from the CLI (asset symbol generation, UIKit-dependent packages, a dependency failing
251
+ earlier in the graph); there, verification is Xcode and a manifest dump validates the manifest
252
+ only. Never trust a piped build's exit code - a pipe reports the tail's status. Record the
253
+ module's actual verification command in the plan.
254
+ - One module per run. Several modules means several runs and several plans, never one
255
+ cross-module churn commit.
256
+ - If the audit wants a rule the registry lacks, add it to the skill's `references/rules.yml` as `status: proposed` with a
257
+ rationale and surface it in Open Questions. Do not enforce an unregistered rule.
258
+ - No AI attribution anywhere (code, commits, PRs). Author = git identity.
@@ -31,8 +31,8 @@ Run all steps automatically:
31
31
 
32
32
  ```
33
33
  Step 1: DETECT Compare timestamps, find stale targets
34
- Step 2: COPILOT Claude Code -> Copilot CLI (instructions + 43 sub-command skills)
35
- Step 2b: CODEX Claude Code -> Codex CLI (1 router skill + 43 specs as refs + 8 agent TOML)
34
+ Step 2: COPILOT Claude Code -> Copilot CLI (instructions + 44 sub-command skills)
35
+ Step 2b: CODEX Claude Code -> Codex CLI (1 router skill + 44 specs as refs + 8 agent TOML)
36
36
  Step 3: REPO Claude Code -> pipeline repo (genericized, personal data scrub)
37
37
  Step 3d: DEV-TOOLKIT Companion MCP server -> detect movement, ship gates, commit + publish
38
38
  Step 4: WEBSITE Version + phase/model counts -> {website-host} (i18n + projects.ts)
@@ -223,12 +223,12 @@ When invoked with the `release` argument:
223
223
  |-------------|-------------|
224
224
  | `~/.claude/commands/multi-agent/{cmd}.md` | `~/.copilot/skills/multi-agent-{cmd}/SKILL.md` |
225
225
 
226
- **43 commands are synced** (canonical inventory - must match `cross-cli-contract.md` section 1; drift = contract violation):
226
+ **44 commands are synced** (canonical inventory - must match `cross-cli-contract.md` section 1; drift = contract violation):
227
227
 
228
228
  ```
229
229
  analysis, analysis-resolve, autopilot, build-optimize, channels, create-jira, design-check, dev,
230
230
  dev-autopilot, dev-local, dev-local-autopilot, diff-explain, finish, forget, garbage-collect,
231
- help, issue, jira, kill, language, local,
231
+ help, ios-coding-standard, issue, jira, kill, language, local,
232
232
  local-autopilot, log, manual-test, prune-logs, purge, refactor, resume, review, review-issue, review-jira,
233
233
  routines, save, scan, search, setup, stack, status, sync, test, testflight-validation, uninstall, update
234
234
  ```
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: ios-coding-standard
3
+ description: "The iOS coding-standard rule registry: 95 stable-ID rules across readability, security, service layer, concurrency, testing, module boundaries, naming and visibility, each with a severity and enforcement kind. Use when writing or reviewing Swift and you need the project rule rather than an opinion, or on a persistence or logging question."
4
+ user-invocable: true
5
+ ---
6
+
7
+ # iOS coding standard
8
+
9
+ The registry is `references/rules.yml`. It is the source of truth, and it is
10
+ the reason to load this skill: a rule cited by ID is checkable and a remembered rule
11
+ is not.
12
+
13
+ | File | What it is | When to read it |
14
+ |---|---|---|
15
+ | `references/rules.yml` | 95 rules with stable IDs, severity, enforcement kind and a `check` describing what counts as a violation | before asserting that something is or is not a violation |
16
+ | `references/STANDARD.md` | the same rules taught with before/after Swift, for a human | when you need the reasoning or an example, not just the rule |
17
+ | `references/swiftlint.draft.yml` | the mechanically-enforceable subset as a SwiftLint config | when wiring lint into a project |
18
+ | `references/lint-local.sh` | runs that config over one module, with a baseline mode | when grandfathering existing violations so only new ones surface |
19
+
20
+ ## How to use it
21
+
22
+ 1. **Cite, do not paraphrase.** Reference `SEC-04`, `READ-01`, `SVC-02`. A finding
23
+ without an ID is an opinion, and the author cannot look it up to disagree.
24
+ 2. **A rule not in the registry is not a rule.** If a review wants one, propose it
25
+ as `status: proposed` with a rationale rather than enforcing it silently.
26
+ 3. **Severity decides whether it blocks.** `blocking` stops the change,
27
+ `important` is fixed in the same pass, `suggestion` is optional. Do not promote a
28
+ suggestion to blocking because it happens to bother you.
29
+ 4. **Enforcement kind decides who checks it.** `format` belongs to the formatter,
30
+ `lint` to the linter, `scan` to a tool, `judgement` to a person or an audit run.
31
+ Reviewing a `format` rule by hand wastes the review.
32
+ 5. **Exceptions are marked in code, with an expiry:**
33
+ `// standard:exception(<RULE-ID>) <reason> <expiry:YYYY-MM-DD>`. An unmarked
34
+ deviation is a finding; a marked one is a decision.
35
+
36
+ ## Two decisions the registry answers, and code usually gets wrong
37
+
38
+ **Persistence.** Read `references/rules.yml → persistence_decision` before reaching for
39
+ storage. The ladder starts at "does this value need to outlive the current flow?"
40
+ with the default answer *no*. The Keychain answers "where does a persisted secret
41
+ live", not "this value is sensitive" - most sensitive values in a flow never need to
42
+ persist, and persisting them is the more expensive mistake, because the item
43
+ outlives the flow and the cleanup belongs to nobody.
44
+
45
+ **What a mapper may do.** A mapper lowers one shape onto another. Unwrapping an
46
+ optional wire field to an empty value is lowering. Arithmetic and unit conversion, a
47
+ clamp or threshold, choosing a screen state, and policy defaults are **not** - each
48
+ belongs to the view model, or to a named domain rule when several screens share it.
49
+ Carry the wire value with its unit in the name and convert where it is read.
50
+
51
+ ## Rule families
52
+
53
+ `READ` readability and section structure · `SEC` secrets, logging, storage ·
54
+ `SVC` service layer and mapping · `TEST` testability seams · `MOD` module
55
+ boundaries and imports · `NAME` naming · `FLEX` flexibility and extension points ·
56
+ `CONC` concurrency · `VIS` visibility and access level · `UI` view construction ·
57
+ `PERF` performance · `DEPR` deprecation and retirement.
58
+
59
+ ## Scope note
60
+
61
+ The registry is project-configurable, not project-specific: rule bodies describe
62
+ shapes (a mapper doing arithmetic, a logger interpolating a token) rather than named
63
+ modules. A project adds its own vocabulary through a `modules/<Module>.yml` overlay
64
+ beside `references/rules.yml` - the module's terms, its allowed dependencies, its validation
65
+ rules - which the audit binds on top of the shared registry. Nothing in the shared
66
+ registry names a module, so it applies unchanged to any SwiftUI codebase.
67
+
68
+ `references/swiftlint.draft.yml` carries one placeholder worth changing per project: the remote
69
+ image-host allowlist is set to `example.com`. Point it at your own CDN, or the rule
70
+ flags every remote image.
71
+
72
+ ## Running a full audit
73
+
74
+ For a module-wide pass with a plan and a handoff, the pipeline ships
75
+ `/multi-agent:ios-coding-standard`, which builds the module registry, binds the
76
+ overlay, applies the surviving rules and produces a remediation plan. This skill is
77
+ the registry that audit reads; use the skill directly when you are writing or
78
+ reviewing code rather than auditing a whole module.