@nklisch/pi-agile-workflow 0.15.3

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 (203) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/.codex-plugin/plugin.json +28 -0
  3. package/CHANGELOG.md +591 -0
  4. package/README.md +107 -0
  5. package/docs/ARCHITECTURE.md +716 -0
  6. package/docs/MIGRATION.md +419 -0
  7. package/docs/PRINCIPLES.md +464 -0
  8. package/docs/ROADMAP.md +95 -0
  9. package/docs/SPEC.md +855 -0
  10. package/docs/VISION.md +106 -0
  11. package/extensions/agile-workflow.test.ts +419 -0
  12. package/extensions/agile-workflow.ts +467 -0
  13. package/hooks/hooks.json +52 -0
  14. package/hooks/scripts/prompt-context.py +628 -0
  15. package/hooks/scripts/substrate-maintainer.py +359 -0
  16. package/hooks/scripts/test_prompt_context.py +757 -0
  17. package/package.json +30 -0
  18. package/scripts/install-work-view.sh +165 -0
  19. package/scripts/tests/agent-metadata.test.sh +75 -0
  20. package/scripts/tests/bump-version.test.sh +552 -0
  21. package/scripts/tests/channel-parity.test.sh +117 -0
  22. package/scripts/tests/convert-content-integrity.test.sh +246 -0
  23. package/scripts/tests/convert-install-routing.test.sh +159 -0
  24. package/scripts/tests/install-work-view.test.sh +411 -0
  25. package/scripts/tests/pi-package-metadata.test.sh +119 -0
  26. package/scripts/tests/work-board-shim.test.sh +239 -0
  27. package/scripts/tests/work-view-dist-version.test.sh +105 -0
  28. package/scripts/work-board.sh +64 -0
  29. package/scripts/work-view.sh +423 -0
  30. package/skills/autopilot/SKILL.md +330 -0
  31. package/skills/autopilot/agents/openai.yaml +6 -0
  32. package/skills/board/SKILL.md +62 -0
  33. package/skills/board/agents/openai.yaml +6 -0
  34. package/skills/bold-refactor/SKILL.md +244 -0
  35. package/skills/bold-refactor/agents/openai.yaml +6 -0
  36. package/skills/bug-scan/SKILL.md +378 -0
  37. package/skills/bug-scan/agents/openai.yaml +6 -0
  38. package/skills/bug-scan/references/async-promises.md +119 -0
  39. package/skills/bug-scan/references/concurrency-races.md +148 -0
  40. package/skills/bug-scan/references/data-layer.md +167 -0
  41. package/skills/bug-scan/references/error-handling.md +197 -0
  42. package/skills/bug-scan/references/gate-item-template.md +94 -0
  43. package/skills/bug-scan/references/language-footguns.md +219 -0
  44. package/skills/bug-scan/references/parked-item-template.md +103 -0
  45. package/skills/bug-scan/references/report-template.md +115 -0
  46. package/skills/bug-scan/references/resource-leaks.md +199 -0
  47. package/skills/bug-scan/references/state-closures.md +148 -0
  48. package/skills/bug-scan/references/time-numbers.md +158 -0
  49. package/skills/convert/SKILL.md +1463 -0
  50. package/skills/convert/agents/openai.yaml +6 -0
  51. package/skills/convert/references/legacy-overlap-migration.md +179 -0
  52. package/skills/deep-code-scan/SKILL.md +378 -0
  53. package/skills/deep-code-scan/agents/openai.yaml +6 -0
  54. package/skills/deep-code-scan/references/artifact-ledger.md +148 -0
  55. package/skills/deep-code-scan/references/consolidation.md +91 -0
  56. package/skills/deep-code-scan/references/decomposition.md +127 -0
  57. package/skills/deep-code-scan/references/item-templates.md +263 -0
  58. package/skills/deep-code-scan/references/lane-catalog.md +129 -0
  59. package/skills/deep-code-scan/references/review-gauntlet.md +108 -0
  60. package/skills/deep-code-scan/references/scanner-brief.md +152 -0
  61. package/skills/e2e-test-design/SKILL.md +517 -0
  62. package/skills/e2e-test-design/references/anti-tautology.md +261 -0
  63. package/skills/e2e-test-design/references/service-mocks.md +234 -0
  64. package/skills/e2e-test-design/references/test-taxonomy.md +211 -0
  65. package/skills/epic-design/SKILL.md +476 -0
  66. package/skills/epicize/SKILL.md +210 -0
  67. package/skills/epicize/agents/openai.yaml +6 -0
  68. package/skills/feature-design/SKILL.md +472 -0
  69. package/skills/fix/SKILL.md +173 -0
  70. package/skills/gate-cruft/SKILL.md +258 -0
  71. package/skills/gate-docs/SKILL.md +278 -0
  72. package/skills/gate-patterns/SKILL.md +389 -0
  73. package/skills/gate-refactor/SKILL.md +408 -0
  74. package/skills/gate-security/SKILL.md +275 -0
  75. package/skills/gate-tests/SKILL.md +367 -0
  76. package/skills/groom/SKILL.md +162 -0
  77. package/skills/groom/agents/openai.yaml +6 -0
  78. package/skills/ideate/SKILL.md +185 -0
  79. package/skills/ideate/agents/openai.yaml +6 -0
  80. package/skills/implement/SKILL.md +288 -0
  81. package/skills/implement-orchestrator/SKILL.md +604 -0
  82. package/skills/park/SKILL.md +111 -0
  83. package/skills/perf-design/SKILL.md +427 -0
  84. package/skills/perf-scout/SKILL.md +404 -0
  85. package/skills/perf-scout/agents/openai.yaml +6 -0
  86. package/skills/perf-scout/references/algorithmic-and-data-structures.md +126 -0
  87. package/skills/perf-scout/references/approximation-and-precomputation.md +136 -0
  88. package/skills/perf-scout/references/caching-and-memoization.md +123 -0
  89. package/skills/perf-scout/references/compiler-runtime-and-language.md +136 -0
  90. package/skills/perf-scout/references/database-and-storage-internals.md +144 -0
  91. package/skills/perf-scout/references/distributed-systems.md +150 -0
  92. package/skills/perf-scout/references/game-engine-and-realtime.md +136 -0
  93. package/skills/perf-scout/references/gpu-and-accelerators.md +130 -0
  94. package/skills/perf-scout/references/idea-ranking.md +75 -0
  95. package/skills/perf-scout/references/io-and-batching.md +135 -0
  96. package/skills/perf-scout/references/memory-and-data-locality.md +137 -0
  97. package/skills/perf-scout/references/parallelism-and-vectorization.md +126 -0
  98. package/skills/perf-scout/references/parked-item-template.md +117 -0
  99. package/skills/perf-scout/references/peer-review-pass.md +150 -0
  100. package/skills/perf-scout/references/report-template.md +148 -0
  101. package/skills/principles/SKILL.md +678 -0
  102. package/skills/principles/references/models.md +191 -0
  103. package/skills/principles/references/subagents.md +158 -0
  104. package/skills/prose-author/SKILL.md +185 -0
  105. package/skills/refactor-conventions-creator/SKILL.md +359 -0
  106. package/skills/refactor-conventions-creator/agents/openai.yaml +6 -0
  107. package/skills/refactor-conventions-creator/references/common-structures.md +91 -0
  108. package/skills/refactor-conventions-creator/references/common-styles.md +90 -0
  109. package/skills/refactor-design/SKILL.md +384 -0
  110. package/skills/release-deploy/SKILL.md +667 -0
  111. package/skills/release-deploy/agents/openai.yaml +6 -0
  112. package/skills/research/SKILL.md +166 -0
  113. package/skills/research/agents/openai.yaml +6 -0
  114. package/skills/review/SKILL.md +267 -0
  115. package/skills/review/references/deep-review.md +98 -0
  116. package/skills/review/references/review-lenses.md +68 -0
  117. package/skills/review/references/substrate-side-effects.md +161 -0
  118. package/skills/review/references/target-resolution.md +52 -0
  119. package/skills/scope/SKILL.md +486 -0
  120. package/work-view/Cargo.lock +486 -0
  121. package/work-view/Cargo.toml +9 -0
  122. package/work-view/crates/cli/.work-view-version +1 -0
  123. package/work-view/crates/cli/Cargo.toml +18 -0
  124. package/work-view/crates/cli/src/actionable.rs +500 -0
  125. package/work-view/crates/cli/src/args.rs +792 -0
  126. package/work-view/crates/cli/src/board/assets/board.css +855 -0
  127. package/work-view/crates/cli/src/board/assets/board.js +259 -0
  128. package/work-view/crates/cli/src/board/assets/card.js +139 -0
  129. package/work-view/crates/cli/src/board/assets/components.css +290 -0
  130. package/work-view/crates/cli/src/board/assets/dependency.js +1193 -0
  131. package/work-view/crates/cli/src/board/assets/detail.js +256 -0
  132. package/work-view/crates/cli/src/board/assets/filters.js +389 -0
  133. package/work-view/crates/cli/src/board/assets/index.html +77 -0
  134. package/work-view/crates/cli/src/board/assets/kanban.js +231 -0
  135. package/work-view/crates/cli/src/board/assets/markdown.js +260 -0
  136. package/work-view/crates/cli/src/board/assets/motion.css +131 -0
  137. package/work-view/crates/cli/src/board/assets/state.js +245 -0
  138. package/work-view/crates/cli/src/board/assets/table.js +304 -0
  139. package/work-view/crates/cli/src/board/assets/tokens.css +602 -0
  140. package/work-view/crates/cli/src/board/assets/views.js +41 -0
  141. package/work-view/crates/cli/src/board/assets.rs +162 -0
  142. package/work-view/crates/cli/src/board/feed.rs +204 -0
  143. package/work-view/crates/cli/src/board/mod.rs +246 -0
  144. package/work-view/crates/cli/src/board/open.rs +144 -0
  145. package/work-view/crates/cli/src/board/server.rs +407 -0
  146. package/work-view/crates/cli/src/main.rs +195 -0
  147. package/work-view/crates/cli/src/render.rs +354 -0
  148. package/work-view/crates/cli/src/scope.rs +157 -0
  149. package/work-view/crates/cli/src/stale.rs +581 -0
  150. package/work-view/crates/cli/tests/board-js/dependency-table.test.mjs +64 -0
  151. package/work-view/crates/cli/tests/board-js/expanded-browsing.test.mjs +79 -0
  152. package/work-view/crates/cli/tests/board-js/harness-smoke.test.mjs +11 -0
  153. package/work-view/crates/cli/tests/board-js/harness.mjs +437 -0
  154. package/work-view/crates/cli/tests/board-js/kanban-detail.test.mjs +75 -0
  155. package/work-view/crates/cli/tests/board-js/markdown-filter.test.mjs +60 -0
  156. package/work-view/crates/cli/tests/fixtures/golden/.work/CONVENTIONS.md +3 -0
  157. package/work-view/crates/cli/tests/fixtures/golden/.work/active/epics/epic-alpha.md +16 -0
  158. package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-a.md +16 -0
  159. package/work-view/crates/cli/tests/fixtures/golden/.work/active/features/feat-b.md +16 -0
  160. package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-alpha-1.md +16 -0
  161. package/work-view/crates/cli/tests/fixtures/golden/.work/active/stories/story-research-1.md +19 -0
  162. package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-done.md +16 -0
  163. package/work-view/crates/cli/tests/fixtures/golden/.work/archive/feat-shipped.md +18 -0
  164. package/work-view/crates/cli/tests/fixtures/golden/.work/backlog/idea-backlog.md +7 -0
  165. package/work-view/crates/cli/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
  166. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/CONVENTIONS.md +6 -0
  167. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-dep-done.md +17 -0
  168. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-design-ready.md +17 -0
  169. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/features/feat-impl-ready.md +17 -0
  170. package/work-view/crates/cli/tests/fixtures/ready-drafting/.work/active/stories/story-review-ready.md +17 -0
  171. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/CONVENTIONS.md +4 -0
  172. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/epics/malformed-no-closing-fence.md +8 -0
  173. package/work-view/crates/cli/tests/fixtures/with-malformed/.work/active/features/good-item.md +16 -0
  174. package/work-view/crates/cli/tests/integration.rs +2833 -0
  175. package/work-view/crates/core/Cargo.toml +13 -0
  176. package/work-view/crates/core/src/error.rs +61 -0
  177. package/work-view/crates/core/src/filter.rs +804 -0
  178. package/work-view/crates/core/src/graph.rs +324 -0
  179. package/work-view/crates/core/src/index.rs +590 -0
  180. package/work-view/crates/core/src/lib.rs +54 -0
  181. package/work-view/crates/core/src/model.rs +202 -0
  182. package/work-view/crates/core/src/parse.rs +494 -0
  183. package/work-view/crates/core/tests/fixtures/golden/.work/CONVENTIONS.md +15 -0
  184. package/work-view/crates/core/tests/fixtures/golden/.work/active/epics/epic-core.md +16 -0
  185. package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-parser.md +16 -0
  186. package/work-view/crates/core/tests/fixtures/golden/.work/active/features/feat-query.md +16 -0
  187. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/malformed-no-id.md +15 -0
  188. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-parse-unit.md +16 -0
  189. package/work-view/crates/core/tests/fixtures/golden/.work/active/stories/story-security-gate.md +16 -0
  190. package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-old.md +16 -0
  191. package/work-view/crates/core/tests/fixtures/golden/.work/archive/feat-parser.md +17 -0
  192. package/work-view/crates/core/tests/fixtures/golden/.work/backlog/idea-future-board.md +7 -0
  193. package/work-view/crates/core/tests/fixtures/golden/.work/releases/v1.0/v1.0.md +16 -0
  194. package/work-view/crates/core/tests/fixtures/precedence/.work/CONVENTIONS.md +10 -0
  195. package/work-view/crates/core/tests/fixtures/precedence/.work/archive/dup-item.md +18 -0
  196. package/work-view/crates/core/tests/fixtures/precedence/.work/releases/v2.0/dup-item.md +18 -0
  197. package/work-view/crates/core/tests/integration.rs +541 -0
  198. package/work-view/dist/.gitattributes +1 -0
  199. package/work-view/dist/README.md +42 -0
  200. package/work-view/dist/aarch64-apple-darwin/work-view +0 -0
  201. package/work-view/dist/aarch64-unknown-linux-musl/work-view +0 -0
  202. package/work-view/dist/x86_64-apple-darwin/work-view +0 -0
  203. package/work-view/dist/x86_64-unknown-linux-musl/work-view +0 -0
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Convert"
3
+ short_description: "Use Convert for repo workflows"
4
+ default_prompt: "Use $convert for this repository."
5
+ policy:
6
+ allow_implicit_invocation: false
@@ -0,0 +1,179 @@
1
+ # Legacy & Overlap Migration
2
+
3
+ Convert is **discovery-driven**, not a fixed checklist. Bespoke DIY skills,
4
+ rules files, and plan-doc generators that predate the plugin are usually
5
+ *convergence signals* — the project hand-rolled a concept the plugin now owns —
6
+ not intentional divergence to preserve. This reference holds the detection
7
+ sweep, the DIY→canonical mapping, the classification taxonomy, the
8
+ reference-integrity rule, and the single-owner deferral table that the
9
+ convert workflow points at.
10
+
11
+ ## Detection sweep
12
+
13
+ Do not glob a hardcoded known-set. Enumerate both skill roots and the rules
14
+ tree, then classify every entry:
15
+
16
+ ```bash
17
+ ls -d .agents/skills/*/ 2>/dev/null
18
+ ls -d .claude/skills/*/ 2>/dev/null
19
+ ls .claude/rules/*.md 2>/dev/null
20
+ ```
21
+
22
+ For each entry, read its `SKILL.md`/file header (name + description) and decide
23
+ whether it mirrors a plugin-owned concept. Flag an **overlap candidate** when
24
+ any of these hold:
25
+
26
+ - The name or description mirrors a plugin-owned concept: patterns, refactor /
27
+ refactor-conventions, code conventions, cleanup / cruft, security review,
28
+ docs drift, test quality.
29
+ - The skill instructs writing a **standalone plan doc** (e.g.
30
+ `docs/*-refactor-plan.md`, `docs/*-plan.md`, `docs/*-design.md` outside the
31
+ substrate). The plugin forbids plan docs — work lives in `.work/` items —
32
+ so any plan-doc generator is a convergence candidate regardless of name.
33
+ - It is a **user-invocable command/skill superseded by a plugin gate** (e.g.
34
+ `/extract-patterns` → `gate-patterns`). A migration that retires a slash
35
+ command the user types must always be surfaced, never silently removed.
36
+
37
+ ## DIY → canonical mapping
38
+
39
+ | Bespoke artifact shapes (examples) | Plugin concept | Canonical owner | Canonical destination |
40
+ |---|---|---|---|
41
+ | `extract-patterns`, bespoke `patterns` skill, structural-pattern content inside `.claude/rules/patterns.md` | reusable code patterns | `gate-patterns` (file/index *format*, Phase 4-5) — but convert *imports* verbatim, see below | `.agents/skills/patterns/` (+ optional `.claude/skills/patterns/` symlink mirror) |
42
+ | `structural-refactor`, `stylistic-refactor`, bespoke `refactor-conventions`, any refactor-rule skill or `*-refactor-plan.md` generator | refactor conventions | `refactor-conventions-creator` (Phase 1, 5) | style rules → canonical instruction file `## Refactor Style Conventions`; detailed references → `.agents/skills/refactor-conventions/` (+ optional Claude mirror) |
43
+ | project style / agent-rule prose in `.claude/rules/*` or a hand-rolled CLAUDE.md section | project agent rules | convert owns | `.agents/rules/<name>.md` (e.g. `project.md`) — a user-owned rules file the hook force-loads, OUTSIDE the plugin `agile-workflow:rules` markers; NOT the canonical instruction file |
44
+
45
+ > **"Canonical instruction file"** throughout this reference = `AGENTS.md` in
46
+ > the default `agents-canonical` model, or `CLAUDE.md` in a `claude-source`
47
+ > repo. Convert resolves it in Phase 2.5 from `entrypoint_model`; never assume
48
+ > it is literally `AGENTS.md`. **Legacy non-pattern rule prose does NOT route
49
+ > here** — it routes to `.agents/rules/<name>.md`. The canonical instruction
50
+ > file receives only the slim plugin-managed section, imported legacy Claude
51
+ > *entrypoint* instructions, and confirmed refactor-style summaries.
52
+
53
+ **Verbatim legacy-pattern import (convert-owned, NO discovery filter).**
54
+ `gate-patterns` is a *discovery* writer: its sub-agent only emits patterns that
55
+ recur 3+ times and explicitly defers legacy `.claude/rules/patterns.md` to
56
+ convert. Routing legacy patterns "through gate-patterns Phase 1" would therefore
57
+ silently drop single-use and two-use legacy patterns. Convert owns the lossless
58
+ *import*: write each legacy structural-pattern block to
59
+ `.agents/skills/patterns/<slug>.md` **verbatim**, in the gate-patterns Phase 4
60
+ file format and Phase 5 index format, applying **no occurrence filter**.
61
+ gate-patterns stays the discovery writer for NEW patterns in release bundles;
62
+ convert imports EXISTING legacy ones.
63
+
64
+ `.claude/rules/patterns.md` is **not** a single-destination file — build the
65
+ block-level preservation manifest and classify its *content*: structural-pattern
66
+ blocks go to `.agents/skills/patterns/` (via the verbatim importer above),
67
+ rule-prose blocks go to `.agents/rules/<name>.md`, ambiguous blocks are preserved
68
+ in place. Never dump the whole file into the canonical instruction file; that
69
+ contradicts the layout convert itself advertises.
70
+
71
+ ## Classification taxonomy
72
+
73
+ Classify each discovered skill-root entry into exactly one bucket:
74
+
75
+ | Bucket | Shape | Action |
76
+ |---|---|---|
77
+ | `canonical` | Already at the plugin-canonical location in canonical form (e.g. `.agents/skills/patterns/`) | No action. |
78
+ | `plugin-mirror-symlink` | `.claude/skills/<x>` is a symlink to the `.agents` canonical | Healthy compatibility mirror. Leave it (refresh the link only if dangling). |
79
+ | `plugin-mirror-divergent-copy` | A skill that mirrors a plugin-owned concept where both `.agents` and `.claude` copies exist and differ, OR a `.claude`-only copy of a plugin-owned concept exists with no `.agents` source | Drift risk. Enters the `converge` set (alongside `bespoke`): reconcile unique content into `.agents`, then re-establish the mirror. Ask before discarding either side. |
80
+ | `bespoke` | A DIY skill/rules file that **overlaps a plugin concept** (per the overlap-candidate rules) but lives outside the canonical layout (`structural-refactor`, `extract-patterns`, hand-rolled `patterns`) | Convergence candidate. Map via the table above and surface in the convergence question. |
81
+ | `unrelated` | A project-specific skill that does **not** mirror any plugin-owned concept, isn't a plan-doc generator, and doesn't shadow a plugin command | Leave it untouched. Not a convergence candidate; report in the inventory but never offer it for convergence. |
82
+
83
+ **Precedence — apply the overlap test FIRST.** Classification is gated on
84
+ whether the entry mirrors a plugin-owned concept (per the overlap-candidate
85
+ rules above). Only if it does can it be `canonical`, `plugin-mirror-symlink`,
86
+ `plugin-mirror-divergent-copy`, or `bespoke`. A skill that does NOT mirror any
87
+ plugin concept is `unrelated` and left untouched — even if it happens to live
88
+ only in `.claude/skills/` with no `.agents` twin. A `.claude`-only skill is
89
+ `plugin-mirror-divergent-copy` (a convergence candidate) **only** when it
90
+ mirrors a plugin concept; otherwise it is just an `unrelated` Claude-only
91
+ project skill. This stops convergence from swallowing legitimately Claude-only
92
+ project skills.
93
+
94
+ This repo's real-world shape included duplicated copies in **both** `.agents`
95
+ and `.claude` (the `plugin-mirror-divergent-copy` case) — a fixed-path audit
96
+ never looks for that. Diff actual contents; do not assume a single location.
97
+
98
+ ## Content integrity on move (mandatory, runs first)
99
+
100
+ Reference integrity preserves *pointers*; content integrity preserves *content*.
101
+ A path can be cleanly repointed (no dangling link) while the content it held is
102
+ silently dropped — content integrity closes that hole, and it runs BEFORE
103
+ reference integrity. Before ANY destructive op on a legacy artifact `P` —
104
+ `git rm` / delete, `git mv` / move, replace-with-symlink, replace-with-shim,
105
+ copy-over (overwriting bytes), managed-section overwrite (rewriting content
106
+ between `<!-- ...:start/end -->` markers), or mirror replacement (overwriting or
107
+ symlinking a `.claude` mirror):
108
+
109
+ 1. **Build the block-level preservation manifest** for `P` (Markdown-aware
110
+ blocks; see the convert SKILL Phase 1.8 manifest):
111
+ - YAML frontmatter is one block; each heading section is one block; fenced
112
+ code, tables, and lists are atomic (keep an intro line with the fence it
113
+ introduces); HTML marker regions are atomic; with no headings, group by
114
+ blank-line-separated paragraphs.
115
+ 2. **Classify and route each block:** `structural-pattern` →
116
+ `.agents/skills/patterns/` (verbatim importer, no filter); `rule-prose` →
117
+ `.agents/rules/<name>.md`; `ambiguous` → preserve in place.
118
+ 3. **Verify by provenance, not byte-hash** (destinations legitimately
119
+ reformat): write `sha256(normalized source block)` into the destination as a
120
+ trailing HTML comment (`<!-- agile-workflow:provenance src-sha256=<digest> -->`)
121
+ and confirm the destination holds (a) that digest and (b) the block's required
122
+ semantic anchors (pattern name/slug, or heading text + fenced payload). If no
123
+ trustworthy provenance can be written, the block is NOT landed — keep `P`.
124
+ 4. **Record a terminal state per block** — `landed_existing`,
125
+ `landed_this_run`, or `preserved_in_place` — idempotently; re-running convert
126
+ must never duplicate an already-landed block. `empty` files migrate nothing;
127
+ already-shimmed files are verified non-dangling and left; symlink loops /
128
+ dangling targets are `unsafe` and left in place.
129
+ 5. **Gate:** if any block is `ambiguous` / `unsafe` / unaccounted-for, do NOT
130
+ perform the destructive op — leave `P` and report it preserved-pending-review.
131
+ Content inside plugin-managed markers never counts as preserved user-content.
132
+ 6. **Atomic ordering** for `drift_user` / ambiguous content: **confirm → import
133
+ → verify → shim**. Never shim before a verified import.
134
+
135
+ Only once content integrity passes do you proceed to reference integrity.
136
+
137
+ ## Reference integrity on move (mandatory, runs after content integrity)
138
+
139
+ Relocating or removing a path dangles every inbound reference to it. Before ANY
140
+ `git mv`, `git rm`, replace-with-symlink, or replace-with-shim of a path `P`
141
+ (and after the content-integrity gate above has passed):
142
+
143
+ 1. **Grep the repo for inbound references:**
144
+ ```bash
145
+ grep -rIl --exclude-dir=.git -- "<P>" .
146
+ ```
147
+ Pay special attention to `.work/` item bodies and frontmatter, `docs/`,
148
+ the selected AGENTS target, CLAUDE entrypoints, and other skills.
149
+ 2. **If references exist, pick one per the user's cleanup intent:**
150
+ - **Rewrite** — repoint each reference to the new canonical path when that
151
+ path is stable and you can reach every referrer safely.
152
+ - **Redirect shim** — leave a short stub at `P` pointing to the new location
153
+ when references are numerous, live, or you cannot rewrite them all in this
154
+ pass. A shim is strictly better than a dangling pointer.
155
+ 3. **Never** move or remove `P` while live references point at it without doing
156
+ step 2.
157
+ 4. **Report** the outcome: path moved/removed, number of inbound references
158
+ found, action taken (rewritten / shimmed), and any references intentionally
159
+ left in place and why.
160
+
161
+ This rule is unconditional — it applies even under `cleanup_scope:
162
+ legacy-cleanup` and even for "obviously dead" paths. The grep is cheap; a
163
+ silently broken `.work/` pointer is not.
164
+
165
+ ## Single-owner deferral
166
+
167
+ Each plugin-owned concept has exactly one owning skill that defines its
168
+ canonical location. Convert **places content** at those locations but does not
169
+ re-author the rules for where they live — read the owner instead of carrying a
170
+ divergent copy of the rule, so the layout has one source of truth.
171
+
172
+ | Concept | Owner (read its phase) | Convert's job |
173
+ |---|---|---|
174
+ | reusable code patterns | `gate-patterns` (file/index *format*, Phase 4-5) | import legacy structural-pattern content verbatim into `.agents/skills/patterns/` (no occurrence filter); never invent a divergent location. gate-patterns discovers NEW patterns; convert imports EXISTING ones |
175
+ | refactor conventions | `refactor-conventions-creator` Phase 1 & 5 | style rules → canonical instruction file `## Refactor Style Conventions`; detailed refs → `.agents/skills/refactor-conventions/` |
176
+ | project agent rules | convert owns | `.agents/rules/<name>.md` (e.g. `project.md`), OUTSIDE the plugin `agile-workflow:rules` markers — NOT the canonical instruction file |
177
+
178
+ When in doubt about a destination for a plugin-owned concept, defer to the
179
+ owner's Phase 1 / "existing artifacts" section rather than convert's own prose.
@@ -0,0 +1,378 @@
1
+ ---
2
+ name: deep-code-scan
3
+ description: >
4
+ Multi-lane, decomposition-first codebase scan campaign for agile-workflow. Use when the user asks
5
+ for a deep code scan, comprehensive audit, whole-repo issue hunt, or organized fix plan that spans
6
+ multiple lanes such as correctness, tests, performance, security, quality, structure, or
7
+ architecture. Interviews for goal, lanes, rigor, scanner tier, and altitude bands; maps the repo
8
+ from leaf to system scope; fans out scoped scanners; runs a review gauntlet; and consolidates
9
+ surviving findings into one fix epic. For a single-domain scan, route to the specialist instead.
10
+ ---
11
+
12
+ # Deep Code Scan
13
+
14
+ You orchestrate a **scan campaign**: a goal-driven, decomposition-first sweep of a codebase
15
+ that starts at the smallest units and scopes outward, dispatches multi-model scanner agents
16
+ (a generic sub-agent prompted with the scanner posture from `../principles/references/subagents.md`) in parallel, verifies what they find,
17
+ and returns an organized remediation plan instead of a
18
+ pile of loose findings.
19
+
20
+ This is the **campaign layer above** the depth scanners. It does not re-implement them. Its
21
+ unique work is the four things none of the specialists do on their own:
22
+
23
+ 1. **Decomposition-first planning** — map the repo into altitude bands and turn that map into a
24
+ reviewable epic before any scanning tokens burn.
25
+ 2. **The small→large sweep** — scan leaves first, then let each wider altitude consume the
26
+ findings below it, so module- and system-level scanners are primed by what the leaves
27
+ revealed.
28
+ 3. **Temporary durable scan artifacts** — preallocate per-scanner artifact paths and require scanners
29
+ to write their own packets/findings there, so compaction cannot erase in-flight evidence; prune
30
+ those raw artifacts after the final summary and fix epic are collated.
31
+ 4. **Cross-model verification** — a different-model adversarial/peer pass over findings, so the
32
+ campaign's output is hardened, not just generated.
33
+ 5. **Intelligent fix bundling** — consolidate everything into one coherent fix epic clustered by
34
+ locality and theme, not 200 backlog stubs.
35
+
36
+ ## Composition, not replacement (read this before worrying about overlap)
37
+
38
+ The depth specialists stay exactly where they are. In-campaign, `deep-code-scan` **only reuses their
39
+ reference catalogs as scanner knowledge** — it does **not** invoke the specialist skills mid-campaign.
40
+ Several of them mint and commit their own `.work/` items (bold-refactor commits epics, refactor-design
41
+ emits stories, bug-scan gate-writes); invoking them in-campaign would bypass the gauntlet and create
42
+ items outside `fix-<goal>`. The rightmost column is the **standalone alternative** — what to run
43
+ *instead of* a campaign when the user only needs that one specialist:
44
+
45
+ | Lane | Reuses (loaded as scanner knowledge) | Standalone alternative (instead of a campaign) |
46
+ |---|---|---|
47
+ | correctness | `bug-scan/references/*` (8 bug domains) | `/agile-workflow:bug-scan <path>` |
48
+ | tests | `gate-tests` coverage analysis (bad tests, gaps, stale fixtures, weak assertions) | `/agile-workflow:gate-tests` |
49
+ | performance | `perf-scout/references/*` (11 perf lenses) | `/agile-workflow:perf-scout <path>` |
50
+ | quality / holistic | `code-audit/skills/repo-eval/references/*` (9 dimensions) | `/code-audit:repo-eval <path>` |
51
+ | structure / refactor | `refactor-design` discovery heuristics | `/agile-workflow:refactor-design <path>` |
52
+ | architecture / bold | `bold-refactor` conceptual lenses (elimination, unification, inversion, algebraic, declarative, domain crystallization) | `/agile-workflow:bold-refactor` |
53
+ | security | `gate-security` audit domains | `/agile-workflow:gate-security` |
54
+ | custom | a bespoke brief built from the user's goal | — |
55
+
56
+ **When NOT to use this skill:** a **single-domain scan — even whole-repo** (just correctness, just
57
+ tests, just perf, just security), a single directory, or a one-shot report. Those are exactly what
58
+ the specialists are *for* (`bug-scan` already scans the whole repo for correctness, `gate-tests` for
59
+ test gaps, etc.) — point the user at them. `deep-code-scan` earns its weight only when the scan
60
+ **spans multiple lanes**, or is a **custom cross-cutting goal that genuinely needs the
61
+ decompose → scan → gauntlet → consolidate campaign**. If the request is narrower, say so and route
62
+ it to the specialist instead of spinning up a campaign.
63
+
64
+ ## The structure it builds
65
+
66
+ ```
67
+ EPIC scan-<goal> the campaign (goal encoded; engagement-owned scaffold)
68
+ ├─ FEATURE scan-<goal>-correctness a LANE (one selected domain/mode; locks its scanner tier)
69
+ │ ├─ STORY scan-<goal>-correctness-leaf altitude: functions / single files deps: []
70
+ │ ├─ STORY scan-<goal>-correctness-module altitude: dirs / modules deps: [leaf]
71
+ │ ├─ STORY scan-<goal>-correctness-subsystem altitude: bounded contexts deps: [module]
72
+ │ └─ STORY scan-<goal>-correctness-system altitude: cross-cutting / whole repo deps: [subsystem]
73
+ ├─ FEATURE scan-<goal>-performance another lane (same altitude story spine)
74
+ └─ FEATURE scan-<goal>-security another lane
75
+ within each altitude story: fan out N parallel multi-model scanners
76
+ across that altitude's components; each scanner loads the lane's references.
77
+ later altitudes read the findings recorded by earlier ones.
78
+
79
+ ── then consolidation ──>
80
+
81
+ EPIC fix-<goal> the OUTPUT: one organized remediation plan
82
+ ├─ FEATURE clustered by locality/theme (body cites Source: scan-<goal>)
83
+ └─ STORY concrete fixes
84
+ ```
85
+
86
+ - **Epic = the campaign** (one per goal). **Feature = a lane** (the user-selected domains/modes;
87
+ each locks its scanner tier). **Story = an altitude band**, `depends_on`-chained leaf→system so
88
+ the sweep is a visible, ordered structure and wider scans inherit narrower findings.
89
+ - **Fan-out happens inside an altitude story**, across the components at that altitude — that is
90
+ where the parallel multi-model agents live.
91
+ - The **scan scaffold is engagement-owned working state** ("we're looking") — `deep-code-scan`
92
+ creates it, drives it, and closes it to `done` within the same run; it is not a queue for
93
+ `autopilot`. The **fix epic is the durable deliverable** ("here's the organized work"), carrying
94
+ the audit summary that outlives the (prunable) scan epic. Keeping them separate mirrors
95
+ research → handoff.
96
+ - The **scanner packets, candidate findings, and intermediate rollups are temporary durable working
97
+ artifacts** under `.work/scan-artifacts/scan-<goal>/`. Scanners write their own unique files there;
98
+ story/fix bodies carry the durable summaries. After Phase 6 collates the final record, remove the
99
+ artifact root so the git tree does not retain raw scan junk.
100
+
101
+ ## Dials (settle these WITH the user at kickoff — never silently)
102
+
103
+ Five dials shape the campaign. Propose, discuss, settle — this is an interview, and a
104
+ mispositioned dial costs the whole campaign.
105
+
106
+ - **`goal`** — the campaign's north star, captured free-form from the conversation ("find every
107
+ place we drop cancellation", "all correctness risk", "everything"). Presets exist
108
+ (`all-issues`, `correctness`, `tests`, `security`, `performance`, `quality`) but the goal can be
109
+ any target the user names. It frames what counts as a finding and becomes the epic slug.
110
+ - **`lanes`** — which scan lanes are in scope (the menu in the table above). The user's picks
111
+ *become the features*. `all-issues` selects correctness, tests, performance, security, quality, and
112
+ structure; **`architecture` (bold-refactor) is opt-in even under `all-issues`** — it's the
113
+ highest-risk, highest-review-cost lane, so the user adds it deliberately. A focused goal may select
114
+ one lane.
115
+ - **`rigor`** — `floor` / `standard` / `full`, the verification depth (see Verification). Infer
116
+ from how load-bearing the output is; surface your inference.
117
+ - **`scanner tier`** — which agent/model tier the scanner fan-out uses, **locked per lane** at plan
118
+ time (recorded in each lane feature's body, not frontmatter). One enum, used everywhere:
119
+ `opus | mixed | sonnet | codex-high | codex-xhigh | gemini | zai-high | zai-xhigh`. `mixed`
120
+ (default) gives model diversity — opus on dense/high-altitude components + sonnet on leaves,
121
+ drawing on the host's available classes; `opus`/`sonnet` pin one Claude model; `codex-high`/
122
+ `codex-xhigh` set Codex reasoning effort; `gemini` pins Gemini; `zai-high`/`zai-xhigh` set
123
+ Z.AI GLM 5.2 reasoning effort (model fixed `glm-5.2`). Offer it per lane or once for all. The
124
+ role→capability→model mapping and which classes count as distinct is in
125
+ [../principles/references/models.md](../principles/references/models.md). The choice binds that
126
+ lane's scanners; the cross-model gauntlet still uses a *different* class regardless, and for a
127
+ deep/complex campaign uses **two** different classes if available (advisory phase + adversarial
128
+ phase) — independence is non-negotiable.
129
+ - **`altitude bands`** — the default sweep is `leaf → module → subsystem → system`. Trim or
130
+ rename to fit the repo (a tiny library may be just `file → repo`; a monorepo may add
131
+ `package`). The bands become each lane's story spine.
132
+
133
+ ## The walk
134
+
135
+ ### Phase 0 — Substrate check + scan-aware preflight
136
+ `deep-code-scan` is substrate-first. If `.work/CONVENTIONS.md` is absent, stop and tell the user
137
+ to run `/agile-workflow:convert` first — the campaign's whole output is substrate items. Do not
138
+ fall back to a loose report; that is what standalone `bug-scan` is for.
139
+
140
+ Then preflight the **paired scan-aware substrate** this skill assumes (all ship together with it):
141
+ (1) the `scan_origin` field in SPEC + the `work-view --scan-origin` flag; (2) `scan` / lane / band
142
+ tags registered in `.work/CONVENTIONS.md`; (3) **autopilot excludes `[scan]` items from its ready
143
+ queue** — the structural guarantee the scaffold isn't misrouted. Probe cheaply (e.g.
144
+ `work-view --scan-origin x` exits cleanly; CONVENTIONS lists the scan tags). **If the scan-aware
145
+ substrate is missing, do not silently proceed** — warn that active scan items would be
146
+ autopilot-grabbable on this install, and get explicit user acknowledgment (or have them land the
147
+ paired feature first). This is a hard checkpoint, not a footnote.
148
+
149
+ ### Phase 1 — Kickoff interview (set the dials)
150
+ Use the available structured question tool when the harness provides one; otherwise ask concise
151
+ direct questions. Drive the conversation to settle `goal`, `lanes`, `rigor`, `scanner tier`, and
152
+ `altitude bands`.
153
+ Read enough of the repo first (languages, frameworks, top-level layout, entry points —
154
+ `git ls-files`, manifests) to propose *grounded* lanes and bands, not generic ones. Confirm before
155
+ proceeding.
156
+
157
+ ### Phase 2 — Decompose the codebase
158
+ Build the **altitude component map**: for each band, the concrete list of components to scan.
159
+ This is the skill's signature move — get it right and everything downstream is scoped cleanly.
160
+ See [references/decomposition.md](references/decomposition.md) for the method (module-boundary
161
+ detection, dependency-graph cues, `ast-grep` structural probes, how to keep the leaf set
162
+ tractable). Spawn 1–3 parallel exploratory sub-agents for a large repo; do it inline
163
+ for a small one. The output is a map: `band → [components]` with a one-line role per component.
164
+
165
+ ### Phase 3 — Write the scan plan (FIRST DELIVERABLE) + checkpoint
166
+ Create the scan campaign epic, its lane features (each recording its locked scanner tier), and
167
+ their altitude stories, using the frontmatter in
168
+ [references/item-templates.md](references/item-templates.md). Wire `depends_on` leaf→system within
169
+ each lane; lanes are independent (parallel) unless the user says one informs another. Write the
170
+ component map into the relevant story bodies as their scope.
171
+
172
+ Create the campaign artifact root before fan-out:
173
+ `.work/scan-artifacts/scan-<goal>/`. Record that path in the scan epic body and initialize the
174
+ directory structure described in [references/artifact-ledger.md](references/artifact-ledger.md).
175
+ Before each scanner wave, preallocate one unique `raw`, `candidates`, and `status` path per scanner
176
+ and include those paths in its brief. Treat this directory as durable **in-flight** campaign state:
177
+ leave it untracked/ignored, reload from it after compaction or context reset, and delete it after
178
+ final collation. Checkpoint commits include only the summaries copied into `.work` item bodies, not
179
+ the ignored scanner artifact files.
180
+
181
+ **Compute and record an agent budget.** The fan-out is `components × (domains per lane)` and can
182
+ explode — eight bug domains across hundreds of leaf files is thousands of agent calls. Before the
183
+ checkpoint, estimate and write into the epic body: max scanners per wave, leaf batch size (files per
184
+ scanner), the total **scanner** calls, AND the **verification/review** calls the rigor dial implies
185
+ (Gate 1 + Gate 2 rounds, revisions, the `full`-rigor campaign evaluate) — the gauntlet is not free.
186
+ Report the **total estimated agent calls**. If it exceeds a sane threshold (rule of thumb: >150 total
187
+ agent calls, or >20 scanners per wave), surface it so the user can narrow lanes, coarsen bands, raise
188
+ the batch size, or drop rigor. The budget — both numbers — is part of what they approve.
189
+
190
+ Then **stop and present the plan** (the epic/feature/story layout + the component map + the budget)
191
+ for review. This is the plan-first gate: the user approves or adjusts the shape before any scanning
192
+ runs. Adjust and re-confirm if they redirect. Commit the plan:
193
+ `deep-code-scan: plan <goal> (<L> lanes, <B> bands, ~<N> agent calls)`.
194
+
195
+ > **Engagement-owned, enforced structurally.** The scan scaffold is owned by `deep-code-scan`: it
196
+ > drives the scaffold in Phase 4 and closes it within the run, like research-orchestrator owning its
197
+ > engagement. This is **not** left to a documentation warning — the paired substrate change ships
198
+ > autopilot **scan-awareness**: `autopilot` excludes `[scan]`-tagged items from its ready queue by
199
+ > construction, so a stray `autopilot --all` cannot grab a `stage: implementing` scan story and route
200
+ > it to `implement-orchestrator`. The discriminator is the `[scan]` tag; the **fix** epic carries
201
+ > project routing tags (not `[scan]`), so it drains through normal autopilot like any other work.
202
+ > Until that substrate change lands in a given install, `[scan]` items are still grabbable — so on an
203
+ > un-upgraded install, do not run `autopilot --all` against an in-flight campaign.
204
+
205
+ ### Phase 4 — Drive the scan (the fan-out)
206
+ Walk lanes; within a lane, walk altitude stories **leaf → system in dependency order** (each band
207
+ reads the findings the band below recorded). For each altitude story, fan out **parallel
208
+ multi-model scanner agents across that altitude's components** — use a generic sub-agent prompted with the scanner posture from `../principles/references/subagents.md`, and see
209
+ [references/scanner-brief.md](references/scanner-brief.md) for the brief, the model-diversity
210
+ rule, and the finding schema. Each scanner loads the lane's references (per the
211
+ [lane catalog](references/lane-catalog.md)).
212
+
213
+ Each scanner writes its own packet, candidate findings, and status files directly to its assigned
214
+ paths, then replies with only a compact status line. The orchestrator must never receive or hold the
215
+ full scanner output in chat. At the band checkpoint, collate scanner status files, spot-check from
216
+ the saved packets/candidates, write accepted findings to the altitude story and rollup, and advance
217
+ only after the artifact manifest is current. A finding is not a finding without a confirmed
218
+ `file:line` and a read-in-context rationale — grep hits alone never count. The full multi-round
219
+ gauntlet runs at **Gate 1** once all lanes/bands have scanned, just before consolidation.
220
+
221
+ ### Phase 5 — Consolidate into the fix epic (gauntleted, operator-confirmed)
222
+ This is what makes the output usable. First materialize the Gate 1 input packet from the artifact
223
+ rollups, then run the **review gauntlet's Gate 1** over that packet (multi-round, cross-model — see
224
+ Verification) so only survivors proceed. Then collect, dedupe by `file:line`, and **cluster** into a
225
+ coherent remediation plan — by fix-locality, by theme, by shared root cause — rather than emitting
226
+ one item per finding. See
227
+ [references/consolidation.md](references/consolidation.md) for the clustering method and the fix
228
+ epic's shape. Persist the proposed plan as a **fix-epic draft packet** inside the artifact root and
229
+ run *that* through the **gauntlet's Gate 2** — fresh-context reviewers need a concrete artifact, and
230
+ clustering can introduce new context/intent problems a single finding didn't have. **Then propose
231
+ the fix epic and ask before materializing it** (like `research-handoff` — never an auto-flood). On
232
+ confirmation, write `fix-<goal>` + its clustered features/stories, each carrying `scan_origin:
233
+ scan-<goal>` back to the campaign. Commit:
234
+ `deep-code-scan: emit fix epic for <goal> (<N> findings -> <M> features)`.
235
+
236
+ ### Phase 6 — Close and report
237
+ Append a campaign record to the scan epic body (lanes run, components scanned, finding counts by
238
+ severity, verification outcomes, artifact root status, fix-epic id) and advance the scan epic to
239
+ `stage: done` — the audit is complete; it is not release-bound, and verification ran inline. Once the
240
+ fix epic and campaign record contain the collated durable summary, delete
241
+ `.work/scan-artifacts/scan-<goal>/`; the closeout commit should contain only the collated `.work`
242
+ item changes. Report to the user:
243
+ goal, lanes, components scanned, findings by severity, the fix epic id + its feature breakdown,
244
+ and the suggested next step (`/agile-workflow:autopilot` scoped to `fix-<goal>`, or
245
+ `/agile-workflow:scope` to reprioritize).
246
+
247
+ ## Scanner dispatch (the fan-out spec)
248
+
249
+ The scanning happens **in the scanner agents, not in your context** — your job is mapping,
250
+ dispatch, artifact-path preallocation, checkpoint collation, verification, and consolidation. Do
251
+ not re-do a scanner's work in the orchestrator.
252
+
253
+ - **Parallel, single message.** Dispatch all of an altitude's component-scanners in one message so
254
+ they run concurrently. Do not serialize.
255
+ - **Honor the lane's locked scanner tier** (the kickoff dial, in the lane feature body). `mixed`
256
+ is the default for model diversity; `codex-high`/`codex-xhigh` set Codex reasoning effort; other
257
+ hosts map the same dial to their native high-quality scanner options. The gauntlet still runs with
258
+ independent fresh context regardless of the scanner tier.
259
+ - **Scoped tight.** Each scanner gets only its component's file list plus the findings inherited
260
+ from the band below. Never the whole repo per scanner.
261
+ - **References, not re-derivation.** Each scanner loads the lane's reference file(s) and applies
262
+ their named patterns. That is the progressive-disclosure win — keep it.
263
+ - **Scanners write artifacts themselves.** Each scanner receives unique `raw`, `candidates`, and
264
+ `status` paths and writes them directly. It returns only a terse completion line to chat. If
265
+ context compacts mid-campaign, restart from the status files, manifest, and story links, not from
266
+ memory.
267
+
268
+ Full brief template, severity rubric, and output format: [references/scanner-brief.md](references/scanner-brief.md).
269
+ Artifact paths, manifest schema, rollups, checkpoint commits, and final cleanup:
270
+ [references/artifact-ledger.md](references/artifact-ledger.md).
271
+
272
+ ## Verification — the multi-round review gauntlet (the rigor dial)
273
+
274
+ Scanners *generate*; a separate, **iterative, cross-model** pass *hardens*. This is the most
275
+ important quality mechanism in the skill. Auto-generated findings are riddled with three failure
276
+ modes, and each produces a "fix" that is worse than leaving the code alone: **false positives**,
277
+ **context-ignorant fixes** (locally real, but the remedy breaks the wider system), and — worst —
278
+ **goal-fighting fixes** that undo a *deliberate* design choice (swapping out the repo's
279
+ intentionally hand-rolled, dependency-free code for a library it avoids on purpose). The gauntlet
280
+ exists to kill all three before any fix is proposed. It is multi-round on purpose: one pass
281
+ rationalizes, several fresh passes converge on what's true.
282
+
283
+ Three lenses, applied every round at `rigor ≥ standard`:
284
+ - **Reality** — is the problem real and reachable *here*, or theoretical / already handled?
285
+ - **Context** — does the fix respect callers, invariants, and existing abstractions, or does treating
286
+ it in isolation break the wider system?
287
+ - **Intent** — does the finding or its fix contradict a *deliberate* choice (foundation docs,
288
+ `.work/CONVENTIONS.md`, `.agents/skills/patterns/`, "intentionally X" comments)? A documented
289
+ pattern is **not** a finding; a fix that undoes an intentional decision is a regression wearing a
290
+ fix's clothes — drop it.
291
+
292
+ | `rigor` | spot-check (you) | review gauntlet | campaign evaluate |
293
+ |---|---|---|---|
294
+ | `floor` | ✓ always | 1 combined pass (Reality min) | — |
295
+ | `standard` | ✓ always | ≥ 2 rounds, all 3 lenses, cross-model | — |
296
+ | `full` | ✓ always | rounds to convergence (cap 4), all lenses, cross-model, fresh ctx each | ✓ |
297
+
298
+ - **Independence is the whole game.** Each round runs in **fresh context** and, where a different
299
+ model class is available, via `peeragent` (pre-approved for cross-review); same-model falls back to
300
+ a fresh-context sub-agent. A round that re-reads its own prior reasoning converges by fatigue, not
301
+ truth.
302
+ - **Two gates, same gauntlet.** *Gate 1* culls the raw findings before consolidation. *Gate 2*
303
+ re-runs on the **drafted fix epic** — clustering can introduce new context/intent problems a single
304
+ finding didn't have. The fix epic is emitted only after Gate 2 passes.
305
+ - **Persistent dissent → advisory, never forced.** A finding the rounds can't agree on is demoted to
306
+ a human-judgment note on the scan epic, not shipped as a fix.
307
+ - **spot-check** (always, you, full context) samples survivors and re-reads the cited code, dropping
308
+ anything grep-only or fabricated in place. **campaign evaluate** (at `full`, isolated context)
309
+ judges whether the campaign *as a whole* met the goal — coverage gaps, lanes that under-delivered.
310
+ - Escalate upward freely on evidence; never prune below the spot-check floor.
311
+
312
+ Full loop, lens detail, and the ledger format: [references/review-gauntlet.md](references/review-gauntlet.md).
313
+
314
+ ## Idempotency
315
+
316
+ Re-running a campaign must not duplicate items. Recall the prior campaign with
317
+ `work-view --scan-origin scan-<goal> --scope all` (or `grep -rl 'scan-<goal>' .work/` if the flag
318
+ isn't installed yet). Match findings by `file:line` against the fix epic's durable **`## Resolved finding index`** — not
319
+ the scan story bodies, which may have been pruned to bodyless archive stubs once `done` (SPEC
320
+ archival). If you must read an archived item's findings, hydrate its body from its `git_ref`.
321
+ Skip duplicates; tally and report skips, as `bug-scan` does for its parked items.
322
+
323
+ ## Guardrails
324
+
325
+ - **Plan before scanning.** Phase 3's checkpoint is load-bearing — never skip straight to fan-out.
326
+ The user approving the map is what makes a large campaign safe to run.
327
+ - **Reuse, don't reimplement; never invoke specialists in-campaign.** Load the specialists'
328
+ references as scanner knowledge; do not paste their catalogs into this skill. If the user needs a
329
+ single deep scoped pass, route out to the specialist *before* starting a campaign — once
330
+ in-campaign, every lane is references-only fan-out (invoking an item-minting specialist would bypass
331
+ the gauntlet and create items outside `fix-<goal>`).
332
+ - **Findings need `file:line` + context.** No fabrication; an empty lane is a valid, honest result.
333
+ Score and report it as clean, not as ten weak findings.
334
+ - **Consolidate, never flood.** The deliverable is a clustered fix epic, confirmed before writing —
335
+ not one backlog item per finding. This is the explicit reason `deep-code-scan` exists over a raw
336
+ scan.
337
+ - **Gauntlet before you propose a single fix.** Every finding clears the multi-round, cross-model
338
+ review gauntlet (Reality / Context / Intent) before it can become fix work, and the drafted fix
339
+ epic clears it again. A fix that fights a deliberate repo choice is the worst output this skill can
340
+ produce — the Intent lens exists to catch exactly that, and contested findings go to a human, not
341
+ into the epic.
342
+ - **Budget the fan-out.** Compute and get the scanner budget approved at the checkpoint. A campaign
343
+ that quietly spawns thousands of agents (domains × hundreds of leaves) is a footgun — batch leaves,
344
+ prune irrelevant scope, and surface the estimate.
345
+ - **Persist before summarizing.** Every scanner packet, scanner candidate-finding file, accepted
346
+ finding rollup, gauntlet input, and draft fix packet must exist on disk under
347
+ `.work/scan-artifacts/scan-<goal>/` before you depend on it. The chat transcript is not durable
348
+ storage; compaction is expected on large campaigns.
349
+ - **Clean after collating.** `.work/scan-artifacts/scan-<goal>/` is temporary campaign state, not the
350
+ final audit record. After the fix epic, resolved finding index, campaign record, and gauntlet
351
+ summary are written, remove the artifact root so raw scanner packets do not dirty the repo long
352
+ term.
353
+ - **Scan scaffold is engagement-owned, enforced by the `[scan]` tag.** The paired substrate change
354
+ makes `autopilot` skip `[scan]` items, so the scaffold can't be misrouted to `implement-orchestrator`.
355
+ `deep-code-scan` drives scan execution; only the **fix** epic (no `[scan]` tag) is autopilot work.
356
+ Never tag a fix item `[scan]`, or autopilot will skip the work you want done.
357
+ - **Not release-bound.** A scan is an input/audit; the scan epic carries `release_binding: null`
358
+ and verification runs inline. Release gating is `release-deploy`'s job, on the *fix* work.
359
+ - **Respect scope.** Honor the chosen lanes, bands, and component map. Don't widen mid-campaign
360
+ without surfacing it.
361
+ - **No fixes here.** This skill produces the scan ledger and the fix *plan*. Implementation flows
362
+ through `/agile-workflow:autopilot` or `/agile-workflow:implement` over the fix epic.
363
+
364
+ ## Related
365
+
366
+ - [`bug-scan`](../bug-scan/SKILL.md) — single-pass correctness hunt; its references are the
367
+ correctness lane's knowledge.
368
+ - [`gate-tests`](../gate-tests/SKILL.md) — coverage-gap analysis; the tests lane's method.
369
+ - [`perf-scout`](../perf-scout/SKILL.md) — perf idea generation; its references + peer pass are the
370
+ performance lane's knowledge.
371
+ - [`bold-refactor`](../bold-refactor/SKILL.md) — conceptual architecture lenses; the architecture
372
+ lane's knowledge (and it already emits a `[refactor]` epic for a direct pass).
373
+ - [`repo-eval`](../../../code-audit/skills/repo-eval/SKILL.md) — holistic scorecard; the quality
374
+ lane's knowledge.
375
+ - [`research-orchestrator`](../../../agentic-research/skills/research-orchestrator/SKILL.md) — the
376
+ dial/checkpoint/verification model this skill mirrors, pointed at code instead of external sources.
377
+ - [`epic-design`](../epic-design/SKILL.md) / [`scope`](../scope/SKILL.md) — the substrate
378
+ decomposition mechanics this skill writes against.
@@ -0,0 +1,6 @@
1
+ interface:
2
+ display_name: "Deep Code Scan"
3
+ short_description: "Plan multi-lane code scan campaigns"
4
+ default_prompt: "Use $deep-code-scan to plan a multi-lane scan campaign for this repository."
5
+ policy:
6
+ allow_implicit_invocation: true