scip-query 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +2 -1
  3. package/dist/chunk-2GX3TNOW.js +38 -0
  4. package/dist/{chunk-Y4BBVPRK.js → chunk-35TZERMO.js} +2 -2
  5. package/dist/{chunk-PPAT3XUL.js → chunk-43QUXX3E.js} +2 -2
  6. package/dist/{chunk-O27267B6.js → chunk-45XOH33S.js} +2 -2
  7. package/dist/{chunk-SQJ72PQW.js → chunk-4MFMTEJ4.js} +5 -5
  8. package/dist/chunk-4XTPZ5CR.js +9 -0
  9. package/dist/chunk-6JSTKSZH.js +3 -0
  10. package/dist/{chunk-75H6GOND.js → chunk-7ROLM67J.js} +2 -2
  11. package/dist/{chunk-35DURZXI.js → chunk-ABDXTPCT.js} +2 -2
  12. package/dist/{chunk-HYRSGWFX.js → chunk-AV54WZUK.js} +2 -2
  13. package/dist/chunk-AWYKDRYV.js +2 -0
  14. package/dist/{chunk-O56VBJKB.js → chunk-BAMVG4WQ.js} +2 -2
  15. package/dist/{chunk-RPPV6Y4K.js → chunk-BECOMXAL.js} +2 -2
  16. package/dist/{chunk-W3HSUCRG.js → chunk-BJJHBKEC.js} +2 -2
  17. package/dist/{chunk-IZLWLO4X.js → chunk-D5F3IQYP.js} +2 -2
  18. package/dist/{chunk-2TM23JYJ.js → chunk-DDGO34I2.js} +2 -2
  19. package/dist/{chunk-G4IUQW27.js → chunk-DUKRAHV2.js} +2 -2
  20. package/dist/{chunk-MBDBNQBW.js → chunk-EJ65IVPV.js} +2 -2
  21. package/dist/{chunk-MON5XXTG.js → chunk-EMEXMHOP.js} +2 -2
  22. package/dist/{chunk-JYBP5ZIR.js → chunk-FMD46HAG.js} +2 -2
  23. package/dist/{chunk-WENI5ZDR.js → chunk-GTANVH72.js} +2 -2
  24. package/dist/{chunk-FZXN37RN.js → chunk-GWCW25ON.js} +2 -2
  25. package/dist/chunk-GWNE2WJN.js +3 -0
  26. package/dist/{chunk-CSMPXDYE.js → chunk-H4JNB7RT.js} +2 -2
  27. package/dist/{chunk-WGDIA2TU.js → chunk-HOZ3IXZ5.js} +2 -2
  28. package/dist/{chunk-OP5JXGDV.js → chunk-IG6X65MG.js} +2 -2
  29. package/dist/{chunk-KZ2LZBQT.js → chunk-IKMOYFUM.js} +2 -2
  30. package/dist/{chunk-HGO3D2JD.js → chunk-J7IMQRCU.js} +2 -2
  31. package/dist/{chunk-5N5ZC566.js → chunk-K65T4TJS.js} +2 -2
  32. package/dist/{chunk-BTYDBDX5.js → chunk-L2RE5P3X.js} +2 -2
  33. package/dist/{chunk-2DUWNJKE.js → chunk-L2TSLMPT.js} +2 -2
  34. package/dist/{chunk-OC7XDK62.js → chunk-LADYDOS5.js} +2 -2
  35. package/dist/{chunk-Y5BOEWAE.js → chunk-LL5NQB5V.js} +2 -2
  36. package/dist/{chunk-QYBCGCY5.js → chunk-MN54AGZ3.js} +2 -2
  37. package/dist/chunk-MNRKD3WP.js +18 -0
  38. package/dist/chunk-MPBN5DO4.js +2 -0
  39. package/dist/{chunk-IKAJI4SI.js → chunk-NQBMGFFD.js} +2 -2
  40. package/dist/{chunk-LG33DNTZ.js → chunk-NX2YAXVQ.js} +2 -2
  41. package/dist/{chunk-VDHEX6YO.js → chunk-O5A7BTMA.js} +2 -2
  42. package/dist/{chunk-OBPR6E5Z.js → chunk-O5Y3ISO3.js} +2 -2
  43. package/dist/{chunk-WT34AUWL.js → chunk-ODH4FT3P.js} +2 -2
  44. package/dist/{chunk-U3JW5AYG.js → chunk-OINSINYW.js} +2 -2
  45. package/dist/{chunk-FY6RCFDH.js → chunk-OM6JHEW3.js} +2 -2
  46. package/dist/{chunk-DQYG5JHT.js → chunk-OQFPCIXO.js} +2 -2
  47. package/dist/{chunk-BW4VDICR.js → chunk-OSBLECSI.js} +2 -2
  48. package/dist/{chunk-5QSMW5IO.js → chunk-OTTHMUMV.js} +2 -2
  49. package/dist/{chunk-W2I4QAW7.js → chunk-OUXPJ4H5.js} +2 -2
  50. package/dist/{chunk-BBTVIIOI.js → chunk-OWXNDSG3.js} +2 -2
  51. package/dist/{chunk-CKRVVBM6.js → chunk-P4L5QQT5.js} +2 -2
  52. package/dist/{chunk-E5HPTSRD.js → chunk-POGZSZPX.js} +2 -2
  53. package/dist/{chunk-V7MX6YUF.js → chunk-PV3GKBO5.js} +2 -2
  54. package/dist/{chunk-KWMRY4RN.js → chunk-PZV2PGBR.js} +3 -3
  55. package/dist/{chunk-KWQKWY6M.js → chunk-Q4UM4JJP.js} +2 -2
  56. package/dist/{chunk-7H37Z4UO.js → chunk-QPF7CS5W.js} +2 -2
  57. package/dist/chunk-R4VPIS4D.js +10 -0
  58. package/dist/{chunk-623AZLTE.js → chunk-RDX6WWHN.js} +2 -2
  59. package/dist/{chunk-HJYHSTCP.js → chunk-S43DIBME.js} +2 -2
  60. package/dist/chunk-SALRDXWM.js +121 -0
  61. package/dist/{chunk-PA2MQKXD.js → chunk-SUYCF4SX.js} +2 -2
  62. package/dist/{chunk-SSH2NPYS.js → chunk-SW7LKHRU.js} +2 -2
  63. package/dist/{chunk-HZVG4KID.js → chunk-SWJEREML.js} +2 -2
  64. package/dist/{chunk-TR7C5HOC.js → chunk-T4P27T6S.js} +2 -2
  65. package/dist/chunk-VQWDZ34M.js +928 -0
  66. package/dist/chunk-VXDMXZKC.js +5 -0
  67. package/dist/chunk-W3557RPL.js +3 -0
  68. package/dist/chunk-W3SKYOTF.js +2 -0
  69. package/dist/{chunk-UKUISUS6.js → chunk-XEEQX5X3.js} +2 -2
  70. package/dist/{chunk-7Z5UT44B.js → chunk-YMFHC5J2.js} +2 -2
  71. package/dist/cli.js +3 -1528
  72. package/dist/command-descriptors-AQWWJNTT.js +599 -0
  73. package/dist/direct-navigation-K3CTVVBU.js +3 -0
  74. package/dist/index.js +1 -1
  75. package/dist/postinstall.js +1 -1
  76. package/dist/queries/affected.js +1 -1
  77. package/dist/queries/bottlenecks.js +1 -1
  78. package/dist/queries/call-graph.js +1 -1
  79. package/dist/queries/change-surface.js +1 -1
  80. package/dist/queries/cleanup-plan.js +1 -1
  81. package/dist/queries/co-change.d.ts +2 -0
  82. package/dist/queries/co-change.js +1 -1
  83. package/dist/queries/code.js +1 -1
  84. package/dist/queries/complexity-hotspots.js +1 -1
  85. package/dist/queries/complexity.js +1 -1
  86. package/dist/queries/convergence.js +1 -1
  87. package/dist/queries/coupling.js +1 -1
  88. package/dist/queries/dataflow.js +1 -1
  89. package/dist/queries/dead.js +1 -1
  90. package/dist/queries/decorative-checkers.js +1 -1
  91. package/dist/queries/deps.js +1 -1
  92. package/dist/queries/diff-gate.js +1 -1
  93. package/dist/queries/diff-impact.js +1 -1
  94. package/dist/queries/doc-drift.js +1 -1
  95. package/dist/queries/drift.js +1 -1
  96. package/dist/queries/duplicate-bodies.js +1 -1
  97. package/dist/queries/extract-candidates.js +1 -1
  98. package/dist/queries/fan.js +1 -1
  99. package/dist/queries/health.js +1 -1
  100. package/dist/queries/hierarchy.js +1 -1
  101. package/dist/queries/hotspots.js +1 -1
  102. package/dist/queries/imports.js +1 -1
  103. package/dist/queries/incomplete-migration.js +1 -1
  104. package/dist/queries/index.js +1 -1
  105. package/dist/queries/isolated.js +1 -1
  106. package/dist/queries/locality-candidates.js +1 -1
  107. package/dist/queries/members.js +1 -1
  108. package/dist/queries/methods.js +1 -1
  109. package/dist/queries/not-implemented.js +1 -1
  110. package/dist/queries/outline.js +1 -1
  111. package/dist/queries/passthrough-candidates.js +1 -1
  112. package/dist/queries/plan-context.d.ts +2 -0
  113. package/dist/queries/plan-context.js +1 -1
  114. package/dist/queries/recent-duplicates.js +1 -1
  115. package/dist/queries/redundant-reexports.js +1 -1
  116. package/dist/queries/refs.js +1 -1
  117. package/dist/queries/self-audit.js +1 -1
  118. package/dist/queries/similar-signatures.js +1 -1
  119. package/dist/queries/similar.js +1 -1
  120. package/dist/queries/slice.js +1 -1
  121. package/dist/queries/stale-abstractions.js +1 -1
  122. package/dist/queries/surface.js +1 -1
  123. package/dist/queries/symbols.js +1 -1
  124. package/dist/queries/system.js +1 -1
  125. package/dist/queries/test-quality.js +1 -1
  126. package/dist/queries/trace.js +1 -1
  127. package/dist/queries/twin-ab.js +1 -1
  128. package/dist/queries/twin-drift.js +1 -1
  129. package/dist/queries/unused-imports.js +1 -1
  130. package/dist/queries/unused-params.js +1 -1
  131. package/dist/queries/wrapper-candidates.js +1 -1
  132. package/dist/reindex-worker.js +24 -24
  133. package/dist/reindex.js +36 -36
  134. package/dist/runtime.js +1 -1
  135. package/dist/watch-server.js +4 -4
  136. package/docs/COMMAND_REFERENCE.md +4 -1
  137. package/package.json +1 -1
  138. package/skills/_shared/SKILL.md +1 -1
  139. package/skills/scip-api-impact/SKILL.md +5 -1
  140. package/skills/scip-claim-audit/SKILL.md +1 -0
  141. package/skills/scip-cleanup-audit/SKILL.md +4 -0
  142. package/skills/scip-concrete-plan/SKILL.md +129 -48
  143. package/skills/scip-debug/SKILL.md +6 -1
  144. package/skills/scip-explore/SKILL.md +2 -1
  145. package/skills/scip-integrity-audit/SKILL.md +17 -0
  146. package/skills/scip-maintainability/SKILL.md +6 -1
  147. package/skills/scip-query/SKILL.md +3 -0
  148. package/skills/scip-root-cause/SKILL.md +150 -0
  149. package/skills/scip-root-cause/agents/openai.yaml +4 -0
  150. package/skills/scip-tla-model-system/SKILL.md +7 -9
  151. package/skills/scip-verify/SKILL.md +19 -2
  152. package/dist/chunk-2HCWAL42.js +0 -3
  153. package/dist/chunk-3YEBIYXL.js +0 -38
  154. package/dist/chunk-6TJERPN3.js +0 -2
  155. package/dist/chunk-E7BTIEAY.js +0 -2
  156. package/dist/chunk-EUMETOTD.js +0 -21
  157. package/dist/chunk-GRHA5NGF.js +0 -2
  158. package/dist/chunk-IHD2CHMX.js +0 -10
  159. package/dist/chunk-TFWDJDGO.js +0 -2
  160. package/dist/chunk-U267E6YN.js +0 -120
  161. package/dist/chunk-X566NT42.js +0 -9
@@ -1,22 +1,24 @@
1
1
  ---
2
2
  name: scip-concrete-plan
3
- description: Plan code changes with scip-query evidence and testable design. Use for non-trivial implementation, refactor, migration, API, or bug-fix plans before editing code; require source citations, reuse audit, test seams, side-effect boundaries, contracts, and verification.
3
+ description: Plan code changes with scip-query evidence and testable design. Use for non-trivial implementation, refactor, migration, API, or bug-fix plans before editing code; require contextual definitions, cited premises, reuse audit, test seams, counterexample attacks, and a derived verdict.
4
4
  commands:
5
5
  - template: "scip-query status --capabilities"
6
6
  when: "Discover: confirm the index is fresh before citing graph facts."
7
7
  - template: "scip-query plan-context <target>"
8
8
  when: "Discover: anchor the plan with pre-edit context for the target."
9
9
  - template: "scip-query refs <symbol>"
10
- when: "Reuse audit: find existing consumers before proposing a new unit."
10
+ when: "Premises: enumerate every writer and reader of a touched state surface; reuse audit: find existing consumers."
11
+ - template: "scip-query dataflow <symbol-or-variable>"
12
+ when: "Premises: producers and consumers backing a state-authority premise."
11
13
  - template: "scip-query code <symbol>"
12
- when: "Reuse audit: read source before citing a behavior claim."
14
+ when: "Premises: read source before citing a behavior claim."
13
15
  - template: "scip-query trace <symbol>"
14
16
  when: "Verify the plan: rerun source-producing context for cited targets."
15
17
  ---
16
18
 
17
19
  # Concrete Plan
18
20
 
19
- Use this skill to write an implementation plan that another agent can execute without guessing. A concrete plan is a dated Markdown checklist whose code claims come from scip-query evidence and whose design makes the intended behavior easy to test before it is easy to ship.
21
+ Use this skill to write an implementation plan that another agent can execute without guessing and a reviewer can check without re-deriving. A concrete plan is a certificate: a dated Markdown document whose conclusion ready to implement — is derived from numbered, source-cited premises, defended against constructed counterexamples, and shaped so the intended behavior is easy to test before it is easy to ship.
20
22
 
21
23
  Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md) when you need lookup tips, command families, postchecks, or subagent rules.
22
24
 
@@ -27,8 +29,9 @@ Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md) when you
27
29
  | --- | --- | --- |
28
30
  | `scip-query status --capabilities` | Show index status for this project | Discover: confirm the index is fresh before citing graph facts. |
29
31
  | `scip-query plan-context <target>` | Pre-edit planning context for a symbol, file, or module | Discover: anchor the plan with pre-edit context for the target. |
30
- | `scip-query refs <symbol>` | Find all files referencing a symbol | Reuse audit: find existing consumers before proposing a new unit. |
31
- | `scip-query code <symbol>` | Read the source code for a symbol (bounded to its definition range) | Reuse audit: read source before citing a behavior claim. |
32
+ | `scip-query refs <symbol>` | Find all files referencing a symbol | Premises: enumerate every writer and reader of a touched state surface; reuse audit: find existing consumers. |
33
+ | `scip-query dataflow <symbol-or-variable>` | Reference-level dataflow: definition sites, usage sites, producers, consumers | Premises: producers and consumers backing a state-authority premise. |
34
+ | `scip-query code <symbol>` | Read the source code for a symbol (bounded to its definition range) | Premises: read source before citing a behavior claim. |
32
35
  | `scip-query trace <symbol>` | Trace a symbol: definition + all references | Verify the plan: rerun source-producing context for cited targets. |
33
36
 
34
37
  Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
@@ -39,9 +42,14 @@ Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only
39
42
  1. Start with `scip-query status --capabilities`; reindex only when freshness is `stale`, `missing`, or `unknown`.
40
43
  2. Anchor the plan with `scip-query plan-context <target>`. If the target is not indexed, record that fact and use scip-query for every code-adjacent claim it can answer.
41
44
  3. Put the plan in `docs/plans/YYYY-MM-DD-<short-name>.md`.
42
- 4. Every code step includes a `Source` field naming the scip-query command that produced the path, line range, and behavior claim.
43
- 5. Every behavior-changing step includes a testability design: test seam, injected dependencies, pure core, side-effect boundary, and validation.
44
- 6. Do not propose a new helper, wrapper, type, parameter, config flag, component, hook, or module until the reuse audit proves reuse or extension is not the better move.
45
+ 4. Define every load-bearing concept contextually and state every invariant in `iff` or `must always` form. A definition without referents (a `Source:` line) is a guess.
46
+ 5. Evidence lives in numbered premises (`P1`, `P2`, ...), each with a `Source` naming the scip-query command that produced it. Every shared-state surface the plan touches gets a state-authority premise enumerating its complete writer and reader sets.
47
+ 6. Steps and defenses cite the premises they depend on. A claim no premise supports is either new evidence to gather or an explicit `ASSUMPTION` never silent.
48
+ 7. Do not propose a new helper, wrapper, type, parameter, config flag, component, hook, or module until the reuse audit proves reuse or extension is not the better move.
49
+ 8. Every behavior-changing step includes a testability design: test seam, injected dependencies, pure core, side-effect boundary, and validation.
50
+ 9. Attack entries must be constructed scenarios — actor, starting state, sequence — and each ends in a recorded outcome: `HELD` citing the defending step and premises, or `HOLE` with its repair step or accepted reason. An assertion of absence ("no new shared mutable state") is not a defense; it cannot fail, so it cannot catch anything.
51
+ 10. Installing an enforcer — trigger, constraint, guard, gate — opens an enforcement window: every existing writer in the relevant state-authority premise must be brought into compliance in the same or an earlier step, or the window recorded as an accepted hole. Every step declares `Deployable`.
52
+ 11. The verdict is derived, not asserted: `PLANNED-COMPLETE` only when the coverage matrix has no blank rows and every attack ends in `HELD` with citations or an accepted hole. An attack record where nothing ever broke is a red flag — attacks run against a draft should find holes; if none did, rerun the pass as falsification, preferably in a fresh subagent context.
45
53
 
46
54
  ## Planning Terms
47
55
 
@@ -53,6 +61,16 @@ A side-effect boundary is the edge where deterministic program decisions meet fi
53
61
 
54
62
  A contract is the stable promise one code unit exposes to another, including accepted inputs, returned outputs, errors, timing expectations, and side effects that callers may rely on.
55
63
 
64
+ An invariant is a property of the changed system that must hold at every observable moment; what makes it load-bearing is that attacks are judged against it and the final verdict is derived from whether it survives them all.
65
+
66
+ A premise is a numbered, source-cited statement of fact about the current code; what makes it a premise rather than a note is that steps and defenses cite it by ID, so a false premise is traceable to everything built on it.
67
+
68
+ A state-authority premise is a premise that enumerates the complete writer and reader sets of one shared state surface; what makes it powerful is that "complete" is falsifiable with `refs` and `dataflow`, turning a forgotten write path from an unknowable into a checkable omission.
69
+
70
+ A counterexample attack is a concrete actor, starting state, and action sequence constructed to violate an invariant; what makes it evidence is that its defense cites premises and steps, so "we considered failure" becomes "this specific failure is blocked here."
71
+
72
+ An enforcement window is the interval between the step that installs an invariant enforcer and the step that brings the last existing writer into compliance; what makes it dangerous is that during it, every unupdated writer fails the new check in production, so the plan that adds safety is itself the outage.
73
+
56
74
  ## Workflow
57
75
 
58
76
  ### 1. Discover
@@ -64,22 +82,50 @@ scip-query status --capabilities
64
82
  scip-query plan-context <target>
65
83
  ```
66
84
 
67
- Use the shared reference for follow-up commands. Fill three gates before designing:
85
+ Use the shared reference for follow-up commands. Fill four gates before designing:
68
86
 
69
87
  ```markdown
70
88
  ## Goal
71
89
  What the user is trying to accomplish and what done looks like for them.
72
90
 
91
+ ## Definitions & Invariants
92
+ For each load-bearing concept: its wider class, then the one trait that causally
93
+ explains its other traits in this codebase — with the referents. Then the
94
+ invariants the change must preserve, in iff / must-always form.
95
+
73
96
  ## Current State
74
- The affected end-to-end flow, with scip-query citations for entry points, callers, data flow, dependencies, downstream impact, and non-obvious invariants.
97
+ A short narrative of the affected end-to-end flow. Every factual sentence
98
+ cites a premise by ID.
75
99
 
76
100
  ## Reuse Audit
77
- For every new symbol or file being considered: reuse target, extension target, or evidence-backed reason new code is justified.
101
+ For every new symbol or file being considered: reuse target, extension target,
102
+ or evidence-backed reason new code is justified.
78
103
  ```
79
104
 
80
- This step is complete only when the plan can explain the current flow, its consumers, and every proposed new unit's reuse decision with citations.
105
+ Definition discipline: place the concept in its wider class, then name the essential trait the one that makes the concept's other traits in this codebase possible and explains them. Do not label genus or differentia; write it as prose. Ban circular and synonym definitions ("the refresh coordinator coordinates refreshes" defines nothing). Any new term the plan introduces gets defined the same way. Good definitions condense: they imply the concept's other traits instead of listing them, and derived requirements fall out of them — if restore is defined as the inverse of cancel, then the privilege to restore must not be weaker than the privilege to cancel, and a plan that gates them asymmetrically must defend that asymmetry.
106
+
107
+ This step is complete only when the concepts are defined with referents, the invariants are stated formally, and every proposed new unit has a reuse decision with citations.
108
+
109
+ ### 2. Establish Premises
81
110
 
82
- ### 2. Shape for Tests
111
+ Number every fact the plan depends on:
112
+
113
+ ```markdown
114
+ ## Premises
115
+
116
+ - P1. <current behavior fact> — Source: `scip-query code <symbol>`
117
+ - P2. Writers of `<state surface>`: <complete list>. Readers: <complete list>.
118
+ — Source: `scip-query refs <symbol>` + `scip-query dataflow <symbol>`
119
+ - P3. ASSUMPTION: <belief the evidence cannot yet confirm, and what would confirm it>
120
+ ```
121
+
122
+ State-authority rule: for every state surface the plan touches — database column, store field, event topic, endpoint, cache entry — write one premise enumerating its complete writer and reader sets. Completeness comes from `refs` and `dataflow`, not memory.
123
+
124
+ Why this premise class exists: a sprint-restore plan hardened `restore()` and the cancellation path but never enumerated the writers of sprint status. Review found `PATCH /sprints/:id` could set `status: 'active'` around every restore invariant, and transition automations wrote `sprintId` straight past the new membership guard — two of that review's five ship-blockers, both sitting in the writer list one `refs` call would have produced. With a state-authority premise, each writer in the list must be visited by an attack; without it, the side doors are invisible until review.
125
+
126
+ This step is complete only when every state surface named in any phase has a state-authority premise and every remaining unknown is an explicit `ASSUMPTION`.
127
+
128
+ ### 3. Shape for Tests
83
129
 
84
130
  Before writing implementation phases, add:
85
131
 
@@ -101,7 +147,7 @@ Plan the code so tests can call the pure core directly and exercise the side-eff
101
147
 
102
148
  This step is complete only when every changed behavior has a named test seam and the plan makes clear which logic can be tested without real external services.
103
149
 
104
- ### 3. Design the Checklist
150
+ ### 4. Design the Checklist
105
151
 
106
152
  Write phases in execution order. Keep each phase deployable or explicitly mark why it is not. Use this step format:
107
153
 
@@ -109,7 +155,8 @@ Write phases in execution order. Keep each phase deployable or explicitly mark w
109
155
  ### N.M - Imperative title
110
156
 
111
157
  - [ ] **File**: `path/to/file.ts:LINE-LINE`
112
- - **Source**: `scip-query <command>`
158
+ - **Premises**: P<n>, P<m>
159
+ - **Deployable**: yes | no — <reason> | part of single-deploy group <name>
113
160
  - **What**: Current behavior verified from source.
114
161
  - **Change**: Exact edit to make.
115
162
  - **Testability**:
@@ -119,41 +166,59 @@ Write phases in execution order. Keep each phase deployable or explicitly mark w
119
166
  - Side-effect shell:
120
167
  - Contract:
121
168
  - **Validation**: Targeted test, smoke command, or manual check that proves the behavior.
122
- - **Why**: Why this step is needed and why this order is safe.
169
+ - **Why**: Why this step is needed and why this order is safe, citing the premises it rests on.
123
170
  ```
124
171
 
125
- This step is complete only when no checklist item says "update this file" without exact current behavior, target behavior, and validation.
172
+ If a step installs an enforcer trigger, constraint, guard, gate check its enforcement window here: every existing writer in the relevant state-authority premise is brought into compliance in the same or an earlier step, or the window is carried into the attack record as a hole to accept or repair.
173
+
174
+ This step is complete only when no checklist item says "update this file" without exact current behavior, target behavior, cited premises, a deployability declaration, and validation.
126
175
 
127
- ### 4. Stress-Test
176
+ ### 5. Attack the Plan
128
177
 
129
- Apply these lenses to every phase. Add or change steps until each answer is concrete:
178
+ Construct counterexamples against every invariant. This pass is falsification, not defense: it succeeds by finding holes, and against a draft it should find some. Prefer delegating it to a fresh subagent when the environment can spawn one — give the adversary only the Definitions & Invariants, Premises, state-authority maps, and the checklist, not your design rationale, and brief it that it wins by producing holes; fold its findings back as HOLE entries and repair steps. Solo fallback: enumerate the full attack list from the coverage-matrix rows below before writing any Outcome line, so attacks cannot be shaped around defenses you already have.
130
179
 
131
- | Lens | Plan must answer |
180
+ Use the lenses as attack prompts — purpose, blast radius, valid intermediate state, reversibility, failure, concurrency, boundaries, data integrity, observability, human experience, efficiency, reuse, testability — and record each attack in this form:
181
+
182
+ ```markdown
183
+ ### A<n>. <invariant> via <lens>
184
+ - Attack: <actor> + <starting state> + <action sequence>
185
+ - Outcome: HELD — defended by step <N.M> (P<i>, P<j>)
186
+ | HOLE — repaired by new step <N.M>
187
+ | HOLE — accepted: <reason>
188
+ ```
189
+
190
+ A `HELD` that cannot name its defending step and premises is not `HELD`; it is a hole wearing confidence. A repaired hole keeps its `HOLE — repaired by step N.M` label permanently — do not rewrite it to `HELD` after the repair, because the repair history is the evidence that the pass falsified. The verdict's repaired count must equal the number of `HOLE — repaired` entries in the record. Close the record with a coverage matrix — one row per writer in every state-authority premise and per applicable lens (valid intermediate state is always applicable when any step installs an enforcer or migration):
191
+
192
+ ```markdown
193
+ | Surface or lens | Attacks |
132
194
  | --- | --- |
133
- | Purpose | Why does the current code exist, and what invariant must survive? |
134
- | Blast radius | Which direct and transitive consumers move with this change? |
135
- | Valid intermediate state | Would the project still work after only this phase? |
136
- | Reversibility | Is this a one-way or two-way door, and what rollback exists? |
137
- | Failure | What happens when I/O, external APIs, malformed data, retries, or crashes occur? |
138
- | Concurrency | What shared state can be touched twice or out of order? |
139
- | Boundaries | Who can call this entry point, and where is input validated? |
140
- | Data integrity | What existing data, generated artifacts, or persisted contracts are affected? |
141
- | Observability | Can a maintainer diagnose failures from logs/errors without rereading the source? |
142
- | Human experience | What would surprise, confuse, or block a real user? |
143
- | Reuse | Does existing code already solve this problem or most of it? |
144
- | Testability | Are dependencies injectable, logic pure where practical, concerns separated, and contracts small? |
145
-
146
- This step is complete only when every discovered gap has either a new plan step or a written reason it is accepted.
147
-
148
- ### 5. Verify the Plan
195
+ | <writer, reader, or lens> | A2, A7 |
196
+ ```
197
+
198
+ A blank row is an unattacked writer. The record is incomplete until every row names an attack or carries an accepted reason. Spread attacks across rows before deepening one: depth on the axis you already anticipated does not protect the axes you did not — the leaks come from blank rows, not from the tenth variation of the race you already modeled.
199
+
200
+ Invalid entry this exact shape preceded three post-review remediation rounds on a real plan:
201
+
202
+ > **Concurrency**: Validation happens before database writes; no new shared mutable state or retry behavior is introduced.
203
+
204
+ It names no actor, no interleaving, and cites nothing. It is an assertion of absence: it cannot fail, so it caught nothing review later found exactly the race it waved away. A valid entry for the same phase:
205
+
206
+ > ### A3. "Every stored value is a member of its field's option set" via concurrency
207
+ > - Attack: admin removes option O in transaction A while a user writes value O in transaction B; interleaving B-validates → A-commits → B-commits persists an orphaned value.
208
+ > - Outcome: HOLE — repaired by new step 2.2: validation reads the option definition outside B's lock (P4), so serialize definition changes with every value writer via FOR UPDATE on the definition row; regression proves both interleavings against PostgreSQL.
209
+
210
+ This step is complete only when the coverage matrix has no blank rows and every attack entry ends in a cited `HELD` or a recorded `HOLE`.
211
+
212
+ ### 6. Verify the Plan and Derive the Verdict
149
213
 
150
214
  Run or delegate phase-by-phase reference checks. Each verifier confirms:
151
215
 
152
216
  - every path exists;
153
217
  - every line range is still within about five lines;
218
+ - every premise reproduces when its `Source` command is rerun — a premise that no longer reproduces is false, and everything citing it is suspect until fixed;
154
219
  - every behavior claim matches source;
155
220
  - every new unit has reuse evidence;
156
- - every behavior-changing step has a validation command and testability design.
221
+ - every behavior-changing step has cited premises, a validation command, and a testability design.
157
222
 
158
223
  Then rerun the source-producing context for the cited targets:
159
224
 
@@ -161,9 +226,22 @@ Then rerun the source-producing context for the cited targets:
161
226
  scip-query plan-context <target>
162
227
  ```
163
228
 
164
- Use the shared reference for subagent briefing text when delegating.
229
+ Use the shared reference for subagent briefing text when delegating. Close the plan by applying the definitions to the record — do not summarize feelings:
230
+
231
+ ```markdown
232
+ ## Verdict
233
+
234
+ A plan is PLANNED-COMPLETE iff the coverage matrix has no blank rows, every
235
+ attack ends in HELD with cited steps and premises or an accepted hole with a
236
+ written reason, and no premise failed reverification.
237
+
238
+ Result: PLANNED-COMPLETE | INCOMPLETE — <n> attacks, <x> holes repaired,
239
+ <y> holes accepted; <unresolved items>
240
+ ```
241
+
242
+ The counts are part of the verdict. "16 attacks, 0 holes repaired" against a fresh draft is not a strong plan; it is an attack pass that defended instead of falsified — rerun it before shipping the plan.
165
243
 
166
- This step is complete only when stale references are fixed and every phase has a validation path.
244
+ This step is complete only when stale references are fixed, every premise reverified, and the verdict line is derived from the attack record.
167
245
 
168
246
  ## Output Shape
169
247
 
@@ -171,11 +249,14 @@ The plan file contains:
171
249
 
172
250
  1. Title and date.
173
251
  2. Goal.
174
- 3. Current State.
175
- 4. Reuse Audit.
176
- 5. Testability Design.
177
- 6. Design Phases.
178
- 7. Stress-Test Findings.
179
- 8. Execution Order and deployable phase notes.
180
- 9. Ship Order with one-way doors flagged.
181
- 10. Summary of files to create, edit, delete, and verify.
252
+ 3. Definitions & Invariants.
253
+ 4. Premises (including state-authority premises and explicit assumptions).
254
+ 5. Current State (narrative citing premise IDs).
255
+ 6. Reuse Audit.
256
+ 7. Testability Design.
257
+ 8. Design Phases (steps citing premises, each with a deployability declaration).
258
+ 9. Attack Record (attacks with outcomes, holes repaired or accepted, coverage matrix).
259
+ 10. Execution Order and deployable phase notes.
260
+ 11. Ship Order with one-way doors flagged.
261
+ 12. Verdict with attack and hole counts.
262
+ 13. Summary of files to create, edit, delete, and verify.
@@ -43,6 +43,7 @@ Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only
43
43
  2. Use scip-query to find entry points, call paths, data flow, and blast radius.
44
44
  3. Prefer one narrow fix over broad cleanup.
45
45
  4. Verify with the narrowest repo test or smoke command, then invoke `scip-verify`.
46
+ 5. A root-cause claim whose fix crosses a file boundary requires a rival: state the next-most-plausible explanation for the same symptom and run the observation that separates them. A root cause with no rival considered is a guess with confidence.
46
47
 
47
48
  ## Workflow
48
49
 
@@ -82,6 +83,8 @@ scip-query slice <symbol-or-variable> --forward
82
83
 
83
84
  Stop expanding when the first code fact that can cause the symptom is found.
84
85
 
86
+ When a candidate cause emerges, state it as a hypothesis alongside one rival — the next-most-plausible explanation for the same symptom. Name the observation that distinguishes them (a log line, a probe, a narrower test) and execute it. Choose the discriminator that is cheapest to run, not the one most likely to confirm.
87
+
85
88
  This step is complete only when the path explains the symptom or the missing evidence is explicit.
86
89
 
87
90
  ### 4. Compare nearby implementations
@@ -117,9 +120,11 @@ Run the reproduction, narrow test or smoke command, and invoke `scip-verify`.
117
120
  Bug:
118
121
  Entry point:
119
122
  Root cause:
123
+ Rival considered:
124
+ Discriminator: <the executed observation that separated them>
120
125
  Fix:
121
126
  Verification:
122
127
  Remaining risk:
123
128
  ```
124
129
 
125
- Do not present a guess as a root cause. If no root cause is proven, report the missing evidence.
130
+ Do not present a guess as a root cause. A root cause with no rival considered and no executed discriminator is a guess. If no root cause is proven, report the missing evidence.
@@ -44,6 +44,7 @@ Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only
44
44
  3. Read source with `scip-query code`; do not describe what a function probably does.
45
45
  4. Follow the graph before trusting folder structure.
46
46
  5. Start wide, then narrow.
47
+ 6. Descriptions need citations; conclusions need discriminators. A conclusion — why something happens, what a unit is for, which intent explains a shape — states one rival explanation and the trace evidence that rules it out.
47
48
 
48
49
  ## Workflow
49
50
 
@@ -117,4 +118,4 @@ This step is complete only when the explanation includes the risky symbols or st
117
118
 
118
119
  ## Report
119
120
 
120
- Report overview, entry points, call flow, data flow, dependencies, consumers, risk areas, and the command citations that prove each claim. Exploration is complete only when the user can see what was proven and what remains unverified.
121
+ Report overview, entry points, call flow, data flow, dependencies, consumers, risk areas, and the command citations that prove each claim. For each conclusion-bearing claim, name the rival explanation considered and the evidence that ruled it out. Exploration is complete only when the user can see what was proven, what remains unverified, and which conclusions rest on a discriminator rather than a single story.
@@ -43,6 +43,12 @@ validates (checkers, gates, verifiers, validators — find producers with
43
43
  an input that MUST fail — a wrong binding, a corrupt file, an impossible
44
44
  value — and run it. A checker that passes its should-fail input is
45
45
  decorative: file it as a defect, not a note.
46
+ Before filing, attempt the defense: an accusation triggers a rewrite, so
47
+ search for the failure exit the drill may have missed — a config-gated
48
+ branch, an async rejection, one-hop delegation (the calibration's known
49
+ noise archetypes). File the defect with the executed should-fail input
50
+ attached and the defense attempt noted; a defense that succeeds clears the
51
+ checker and stays in the record as its witness.
46
52
  Complete only when every checker in scope has been witnessed rejecting a
47
53
  constructed should-fail input, or is listed with a reason it cannot be.
48
54
 
@@ -121,6 +127,17 @@ the fix. The audit is complete only when every drill's exit criterion is
121
127
  met for the scope, and every defect found has a regression artifact — a
122
128
  test, fixture, or model that fails on the pre-fix behavior.
123
129
 
130
+ End with a derived verdict, not an impression:
131
+
132
+ ```markdown
133
+ Integrity: <scope> — <c> checkers witnessed failing, <a> adapters diffed
134
+ against reality, <f> fallback primaries witnessed live, <m> metrics
135
+ recomputed, <t> twins compared; <d> defects filed, <u> unverifiable (reasons)
136
+ ```
137
+
138
+ A suspect scope that produces zero defects is itself a claim: state what
139
+ made the suspicion wrong, or rerun the drill that should have caught it.
140
+
124
141
  A regression artifact that doesn't actually assert anything, or asserts the
125
142
  same literal it stubbed into its own mock, is a fake witness — the same
126
143
  "reports success without doing the work" failure mode this skill hunts in
@@ -53,6 +53,8 @@ Essential variation is difference that must remain because the real units differ
53
53
 
54
54
  System compression is replacing several mechanisms that perform the same role, policy, lifecycle, or surface job with fewer named mechanisms that preserve behavior.
55
55
 
56
+ A unifying definition is the single essential trait that makes several code sites one concept; what makes it a test is that failing to state it proves the sites are not one concept, and consolidating them anyway would package-deal essential variation into a false abstraction.
57
+
56
58
  ## Rules
57
59
 
58
60
  1. Ground claims in files, symbols, references, call graphs, dependencies, surfaces, and blast radius.
@@ -61,6 +63,7 @@ System compression is replacing several mechanisms that perform the same role, p
61
63
  4. Preserve essential variation.
62
64
  5. Add an abstraction only when it removes hidden policy, names a lifecycle, enforces a rule, or reduces concept count.
63
65
  6. Prefer deletion, inlining, merging, generation, or enforcement before broad frameworks.
66
+ 7. A scattered-concept or consolidation claim ships its unifying definition. If no single essential trait covers every cited site, the variation is essential: record it and do not consolidate.
64
67
 
65
68
  ## Workflow
66
69
 
@@ -100,7 +103,7 @@ This step is complete only when concrete units, consumers, tests, fallbacks, ada
100
103
 
101
104
  For each cluster, ask:
102
105
 
103
- - What one concept appears in several places?
106
+ - What one concept appears in several places — and what single essential trait makes them one concept? If the trait cannot be stated, they are not one concept.
104
107
  - What policy is hidden?
105
108
  - What lifecycle is unnamed?
106
109
  - Which differences are essential?
@@ -144,6 +147,8 @@ For broad review, write a register under `docs/plans/` unless the user asks not
144
147
 
145
148
  Use dispositions: `merge`, `delete`, `inline`, `extract`, `generate`, `enforce`, `supersede`, `defer`, `skip`.
146
149
 
150
+ Every `merge`, `extract`, or `generate` entry carries its unifying definition and its strongest dissenter — the cited site most likely to differ essentially — with the evidence that it does not. A dissenter that survives moves the entry to `skip` with reason `essential variation`; the dissenter stays in the register either way.
151
+
147
152
  This step is complete only when each opportunity has evidence, disposition, dependency order, touch map, and validation plan.
148
153
 
149
154
  ### 7. Implement and verify when asked
@@ -44,6 +44,7 @@ The loop is complete only when `scip-verify` passes or each remaining finding ha
44
44
  | --- | --- | --- |
45
45
  | Understand a system before answering or editing | `scip-explore` | `system`, `trace`, `call-graph`, `dataflow` |
46
46
  | Root-cause a bug or regression | `scip-debug` | `trace`, `dataflow`, `change-surface` |
47
+ | Diagnose the design flaw behind a family of recurring bugs | `scip-root-cause` | `co-change`, `similar`, `refs` |
47
48
  | Turn a report into a fix packet | `scip-triage-issue` | `files`, `trace`, `affected` |
48
49
  | Create a code flow, dependency, or blast-radius diagram | `scip-diagram` | `call-graph`, `dataflow`, `affected` |
49
50
  | Plan a feature, fix, or refactor | `scip-concrete-plan` | `plan-context` |
@@ -72,6 +73,7 @@ Routing is complete only when one owning skill is selected or the task is small
72
73
 
73
74
  - "Is this implementation real / does it actually work" → `scip-integrity-audit`; "is this well-organized" → `scip-maintainability`; same-name drifted twins specifically → `scip-twin-drift`.
74
75
  - One change → `scip-concrete-plan`; a program of changes with delegation → `scip-conductor`.
76
+ - One failing behavior → `scip-debug`; a family of similar bugs whose fixes keep recurring, or "what is really wrong with this system" backed by bug history → `scip-root-cause`; structure smells with no bug evidence → `scip-maintainability`.
75
77
 
76
78
  - Use `scip-cleanup-audit` for reports, ranking, confirmation, or recent AI-residue triage without edits.
77
79
  - Use `scip-cleanup-improve` when the user asks to fix, improve, continue cleaning, or raise health autonomously.
@@ -105,6 +107,7 @@ Top commands per routed skill, generated from each skill's own `commands:` front
105
107
  | `scip-maintainability` | `scip-query stats`, `scip-query system <scope>`, `scip-query surface <scope>` |
106
108
  | `scip-probe-reachability` | `scip-query outline <file> --signatures`, `scip-query code <symbol>`, `scip-query trace <symbol>` |
107
109
  | `scip-react-maintainability` | `scip-query react-component-duplicates --scope <scope> --full --json`, `scip-query react-hook-candidates --scope <scope> --full --json`, `scip-query react-large-component-pressure --scope <scope> --full --json` |
110
+ | `scip-root-cause` | `scip-query trace <mechanism-symbol>`, `scip-query co-change <fix-site-file>`, `scip-query system <system-scope>` |
108
111
  | `scip-setup` | `scip-query setup --json`, `scip-query doctor`, `scip-query status --json` |
109
112
  | `scip-tla-model-system` | `scip-query tla scaffold <file>`, `scip-query tla verify <spec>`, `scip-query tla instrument <spec>` |
110
113
  | `scip-triage-issue` | `scip-query files <issue-term>`, `scip-query trace <entry-or-error-symbol>`, `scip-query code <entry-or-error-symbol>` |
@@ -0,0 +1,150 @@
1
+ ---
2
+ name: scip-root-cause
3
+ description: Diagnose the design flaw behind a family of related bugs with scip-query evidence. Use when similar bugs keep recurring, the same subsystem keeps needing patches, or the user lists fixed/observed bugs and asks what is really wrong; produces a falsifiable flaw diagnosis, a latent-instance hunt, and the least invasive remedy that kills the class.
4
+ commands:
5
+ - template: "scip-query trace <mechanism-symbol>"
6
+ when: "Assemble the family: mechanism and violated invariant for each bug."
7
+ - template: "scip-query co-change <fix-site-file>"
8
+ when: "Assemble the family: files that historically changed with each fix site."
9
+ - template: "scip-query system <system-scope>"
10
+ when: "Define the system: real responsibilities, files, dependencies in and out."
11
+ - template: "scip-query similar <fixed-symbol> --json --full"
12
+ when: "Predict: hunt latent instances among sibling implementations of the fixed code."
13
+ - template: "scip-query refs <invariant-carrier>"
14
+ when: "Predict: every site that touches the violated invariant's state."
15
+ - template: "scip-query affected <remedy-symbol> --json"
16
+ when: "Choose the rung: blast radius of the candidate remedy."
17
+ ---
18
+
19
+ # scip-root-cause
20
+
21
+ Use this skill to move from a family of related bugs to the design flaw that produces them, and to the least invasive remedy that eliminates the class. `scip-debug` takes one failure to one minimal fix; `scip-maintainability` finds structural smells without bug evidence; this skill starts from the evidence that patching has not worked — the same kind of bug keeps coming back — and asks what the system's design gets wrong.
22
+
23
+ Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
24
+
25
+ <!-- BEGIN GENERATED SKILL COMMANDS -->
26
+ ## Commands for this skill
27
+
28
+ | Command | Purpose | When |
29
+ | --- | --- | --- |
30
+ | `scip-query trace <mechanism-symbol>` | Trace a symbol: definition + all references | Assemble the family: mechanism and violated invariant for each bug. |
31
+ | `scip-query co-change <fix-site-file>` | Files that change together in git history without a dependency edge — hidden coupling candidates | Assemble the family: files that historically changed with each fix site. |
32
+ | `scip-query system <system-scope>` | Full module map: files, symbols, deps in/out | Define the system: real responsibilities, files, dependencies in and out. |
33
+ | `scip-query similar <fixed-symbol> --json --full` | Find heuristic function similarity candidates from callee fingerprints | Predict: hunt latent instances among sibling implementations of the fixed code. |
34
+ | `scip-query refs <invariant-carrier>` | Find all files referencing a symbol | Predict: every site that touches the violated invariant's state. |
35
+ | `scip-query affected <remedy-symbol> --json` | Transitive closure of symbols that could break if this symbol changes | Choose the rung: blast radius of the candidate remedy. |
36
+
37
+ Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
38
+ <!-- END GENERATED SKILL COMMANDS -->
39
+
40
+ ## Terms
41
+
42
+ A bug family is a set of failures whose mechanisms violate the same invariant; what makes it a family rather than a coincidence is that one stated flaw derives every member, so fixing members one at a time treats symptoms of a shared cause.
43
+
44
+ A design flaw is a mismatch between what a system's design assumes and what its real responsibilities require; what makes it the root cause is that it is the earliest fact from which every family member's mechanism follows, so removing it removes the class.
45
+
46
+ Retrodiction is deriving each already-known bug from the hypothesized flaw; what makes it a test is that a family member the flaw cannot derive either shrinks the family or kills the hypothesis.
47
+
48
+ A latent instance is a not-yet-reported bug the flaw predicts must exist in unfixed code; what makes it decisive is that it is checkable now — finding one confirms the diagnosis and becomes a fix target, while an honest hunt that finds none weakens the diagnosis and must be reported as weakening it.
49
+
50
+ The remedy ladder is the ordered set of interventions from least to most invasive; what makes the order binding is that each rung is only justified when a constructed family member survives the rung below it.
51
+
52
+ ## Rules
53
+
54
+ 1. Every bug in the family gets a mechanism traced to source, not a symptom description: which invariant broke, where, and what the fix did. Sources: fix commits (`git log`, `git show`) plus `trace`/`code`/`dataflow`.
55
+ 2. The flaw hypothesis must be falsifiable and stated as a design claim — "the design assumes X, but the system's responsibilities include Y" — never as a narrative about unlucky bugs.
56
+ 3. State at least two rivals and kill them with evidence: unrelated coincidences, caller misuse rather than design, one missed edge case rather than a structural flaw.
57
+ 4. The hypothesis must retrodict every family member and predict at least one latent instance, and the latent-instance hunt must be executed (`similar`, `refs` over the invariant's carriers, or a constructed probe), not argued.
58
+ 5. Choose the lowest remedy rung that kills the whole class — retrodicted and latent members both. Climb a rung only when a constructed family member survives the rung below, and keep that counterexample in the record.
59
+ 6. Root-cause stories are the most rationalization-prone artifact in software: prefer delegating the attack on the diagnosis and the remedy to a fresh subagent given only the family table, system definition, and hypothesis — briefed to win by refuting. Solo fallback: write the rival hypotheses and the latent-instance predictions before reading any more code.
60
+ 7. The verdict is derived with counts, and the diagnosis hands off to `scip-concrete-plan` for implementation — this skill does not edit application code.
61
+
62
+ ## Workflow
63
+
64
+ ### 1. Assemble the bug family
65
+
66
+ For each reported or fixed bug, fill one row:
67
+
68
+ ```markdown
69
+ | Bug | Symptom | Mechanism (file:symbol) | Invariant violated | Fix applied | Source |
70
+ | --- | --- | --- | --- | --- | --- |
71
+ ```
72
+
73
+ Evidence: the user's description, fix commits (`git log --follow`, `git show`), `scip-query trace`/`code` on the mechanism symbols, `scip-query co-change` on fix sites to find members the user forgot.
74
+
75
+ This step is complete only when every row has a source-traced mechanism and a named invariant — a bug whose mechanism cannot be traced is listed as `unconfirmed member`, not silently included.
76
+
77
+ ### 2. Define the system
78
+
79
+ Define the system that owns the family, contextually: its wider class, then the essential responsibility that explains its other traits in this codebase — with referents from `scip-query system <scope>` and `surface <scope>`. Then list the design's load-bearing assumptions as the code actually embodies them (not as the README states them), each with a `Source:` citation.
80
+
81
+ This step is complete only when the system's real responsibilities and embodied assumptions are stated with citations.
82
+
83
+ ### 3. Hypothesize the flaw — and its rivals
84
+
85
+ State the flaw as a falsifiable design claim:
86
+
87
+ ```markdown
88
+ Flaw hypothesis: the design assumes <X> (Source: <citation>), but the system's
89
+ responsibilities include <Y> (Source: <citation>); every family member is an
90
+ instance of the X∧Y collision.
91
+
92
+ Rivals:
93
+ - R1. Coincidence — the members have unrelated causes. Killed by: <evidence> | ALIVE
94
+ - R2. Misuse — callers hold the bug, the design is sound. Killed by: <evidence> | ALIVE
95
+ - R3. <next-most-plausible> — Killed by: <evidence> | ALIVE
96
+ ```
97
+
98
+ A rival still marked `ALIVE` at the end of the workflow caps the diagnosis at `CANDIDATE`, not `CONFIRMED`.
99
+
100
+ ### 4. Retrodict and predict
101
+
102
+ Retrodiction: derive each family-table row from the flaw in one sentence each. A member that cannot be derived is removed from the family (say so) or refutes the hypothesis (start over).
103
+
104
+ Prediction: the flaw implies unfixed instances exist. Name where they must be, then hunt:
105
+
106
+ ```bash
107
+ scip-query similar <fixed-symbol> --json --full
108
+ scip-query refs <invariant-carrier>
109
+ ```
110
+
111
+ plus a constructed probe when the claim is cheaply executable. Record each prediction with an executed result:
112
+
113
+ ```markdown
114
+ - L1. <predicted latent instance> → FOUND at <file:line> (new fix target) | NOT FOUND after <hunt executed>
115
+ ```
116
+
117
+ This step is complete only when every family member is retrodicted and every prediction has an executed hunt result. Zero latent instances found is a reportable weakness of the diagnosis, not a detail to omit.
118
+
119
+ ### 5. Choose the lowest rung
120
+
121
+ The remedy ladder, in order:
122
+
123
+ 1. **Enforce the invariant at a boundary** — type, guard, constraint, lint, trigger — without moving code.
124
+ 2. **Consolidate the responsibility into one owner** — the scattered decision gets one named mechanism.
125
+ 3. **Redesign the core behind its existing interface** — consumers untouched.
126
+ 4. **Redesign the interfaces** — last resort; consumers migrate.
127
+
128
+ For the chosen rung, run the attack: construct a family member — retrodicted or latent — that survives the rung. If one survives, keep the counterexample in the record and climb one rung. Check blast radius with `scip-query affected` before proposing any rung above 1. For protocol- or lifecycle-shaped flaws whose remedy must hold across interleavings, note the escalation path to `scip-tla-model-system`.
129
+
130
+ This step is complete only when the chosen rung has an attack record showing no family member survives it, and every rejected lower rung keeps its surviving counterexample.
131
+
132
+ ### 6. Report and hand off
133
+
134
+ ```markdown
135
+ ## Root-cause diagnosis
136
+
137
+ System: <definition with referents>
138
+ Bug family: <n> members traced, <u> unconfirmed
139
+ Flaw: <the design claim> — CONFIRMED | CANDIDATE (rival <id> alive)
140
+ Rivals: <r> stated, <k> killed with evidence
141
+ Retrodiction: <n>/<n> members derived
142
+ Latent instances: <p> predicted, <f> found (each a fix target), hunts executed
143
+ Remedy: rung <1-4> — <the intervention>; lower rungs rejected by <counterexamples>
144
+ Blast radius: <affected summary>
145
+ Escalation: <none | scip-tla-model-system for <property>>
146
+ ```
147
+
148
+ Hand the diagnosis to `scip-concrete-plan`: the flaw and invariants become its Definitions & Invariants, the family table and hunt results become premises, and the surviving-counterexample record seeds its attack pass.
149
+
150
+ The diagnosis is complete only when the verdict line carries the counts and every count is backed by an entry in the record above it.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SCIP Root Cause"
3
+ short_description: "Diagnose the design flaw behind a family of recurring bugs"
4
+ default_prompt: "Use scip-query to trace a family of related bugs to the design flaw that produces them: retrodict every member, hunt the latent instances the flaw predicts, and propose the least invasive remedy that eliminates the class."
@@ -21,19 +21,17 @@ Use this skill when a TypeScript system needs a TLA+ model tied to code evidence
21
21
  Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
22
22
 
23
23
  <!-- BEGIN GENERATED SKILL COMMANDS -->
24
-
25
24
  ## Commands for this skill
26
25
 
27
- | Command | Purpose | When |
28
- | -------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
29
- | `scip-query tla scaffold <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Start here for a new model: derive a draft spec, config, and mapping from indexed code. |
30
- | `scip-query tla verify <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Mechanical conformance: referents, reads/writes, calls, and the model checker. |
31
- | `scip-query tla instrument <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Generate a trace recorder plus wiring sites for each mapped action. |
32
- | `scip-query tla trace-check <spec> --trace <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Semantic conformance: check a recorded execution against the model's Next relation. |
33
- | `scip-query tla fetch-tools` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Download the pinned tla2tools.jar into the cache when the checker is unavailable. |
26
+ | Command | Purpose | When |
27
+ | --- | --- | --- |
28
+ | `scip-query tla scaffold <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Start here for a new model: derive a draft spec, config, and mapping from indexed code. |
29
+ | `scip-query tla verify <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Mechanical conformance: referents, reads/writes, calls, and the model checker. |
30
+ | `scip-query tla instrument <spec>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Generate a trace recorder plus wiring sites for each mapped action. |
31
+ | `scip-query tla trace-check <spec> --trace <file>` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Semantic conformance: check a recorded execution against the model's Next relation. |
32
+ | `scip-query tla fetch-tools` | TLA+ model workflow: verify a model and mapping contract, scaffold a draft model from indexed code, generate a trace recorder, or check a recorded trace against the next-state relation | Download the pinned tla2tools.jar into the cache when the checker is unavailable. |
34
33
 
35
34
  Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
36
-
37
35
  <!-- END GENERATED SKILL COMMANDS -->
38
36
 
39
37
  ## Choose the Slice