scip-query 0.19.4 → 0.19.5

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 (41) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-SVLTAG5O.js → chunk-7UY7SD7D.js} +119 -119
  4. package/dist/{chunk-VMNZB6WI.js → chunk-TW4OG5FC.js} +2 -2
  5. package/dist/chunk-XAGAZSFE.js +6 -0
  6. package/dist/cli.js +3 -3
  7. package/dist/command-descriptors-N2TL4XM2.js +613 -0
  8. package/dist/direct-navigation-DUCZCTOE.js +3 -0
  9. package/docs/AI_FAILURE_MODES.md +1 -1
  10. package/docs/COMMAND_REFERENCE.md +5 -5
  11. package/docs/DETECTOR_GUIDE.md +1 -1
  12. package/package.json +1 -1
  13. package/skills/_shared/SKILL.md +6 -16
  14. package/skills/scip-api-impact/SKILL.md +22 -21
  15. package/skills/scip-claim-audit/SKILL.md +18 -17
  16. package/skills/scip-cleanup-audit/SKILL.md +24 -20
  17. package/skills/scip-cleanup-improve/SKILL.md +19 -18
  18. package/skills/scip-concrete-plan/HIGH_ASSURANCE.md +317 -0
  19. package/skills/scip-concrete-plan/SKILL.md +70 -227
  20. package/skills/scip-conductor/SKILL.md +14 -14
  21. package/skills/scip-debug/SKILL.md +21 -21
  22. package/skills/scip-diagram/SKILL.md +27 -27
  23. package/skills/scip-directory-architecture/SKILL.md +44 -32
  24. package/skills/scip-doc-reconcile/SKILL.md +17 -17
  25. package/skills/scip-explore/SKILL.md +23 -23
  26. package/skills/scip-hyper-optimization/SKILL.md +23 -23
  27. package/skills/scip-language-playbook/SKILL.md +34 -34
  28. package/skills/scip-maintainability/SKILL.md +21 -21
  29. package/skills/scip-probe-reachability/SKILL.md +10 -9
  30. package/skills/scip-query/SKILL.md +39 -39
  31. package/skills/scip-react-maintainability/SKILL.md +21 -21
  32. package/skills/scip-root-cause/SKILL.md +21 -20
  33. package/skills/scip-setup/SKILL.md +25 -24
  34. package/skills/scip-tla-model-system/SKILL.md +7 -7
  35. package/skills/scip-triage-issue/SKILL.md +27 -20
  36. package/skills/scip-twin-drift/SKILL.md +18 -16
  37. package/skills/scip-verify/SKILL.md +25 -9
  38. package/skills/scip-vue-maintainability/SKILL.md +21 -21
  39. package/dist/chunk-ZAIILQNP.js +0 -5
  40. package/dist/command-descriptors-MFU4BCJ7.js +0 -612
  41. package/dist/direct-navigation-MRMQFIRB.js +0 -3
@@ -0,0 +1,317 @@
1
+ # High-Assurance Planning
2
+
3
+ Load this only when the change meets a trigger in `SKILL.md` — security boundary, authorization,
4
+ money, destructive operation, persistent-data migration, shared-state concurrency, broad public
5
+ API change, irreversible rollout, or an explicit request for it. For ordinary work the protocol
6
+ here costs more than it protects, and its weight is why planning stopped happening at all.
7
+
8
+ A high-assurance plan is a **certificate**: a dated Markdown document whose conclusion — ready to
9
+ implement — is derived from numbered, source-cited premises, defended against constructed
10
+ counterexamples, and shaped so the intended behavior is easy to test before it is easy to ship.
11
+
12
+ ## Rules
13
+
14
+ 1. Define every load-bearing concept contextually and state every invariant in `iff` or
15
+ `must always` form. A definition without referents (a `Source:` line) is a guess.
16
+ 2. Evidence lives in numbered premises (`P1`, `P2`, ...), each naming the source appropriate to
17
+ its claim. Literal source facts may cite a native file read; compiler-resolved identity and
18
+ complete writer, reader, caller, dependency, consumer, or impact sets cite scip-query. Every
19
+ shared-state surface the plan touches gets a state-authority premise enumerating its complete
20
+ writer and reader sets.
21
+ 3. Steps and defenses cite the premises they depend on. A claim no premise supports is either new
22
+ evidence to gather or an explicit `ASSUMPTION` — never silent.
23
+ 4. Do not propose a new helper, wrapper, type, parameter, config flag, component, hook, or module
24
+ until the reuse audit proves reuse or extension is not the better move.
25
+ 5. Every behavior-changing step includes a testability design: test seam, injected dependencies,
26
+ pure core, side-effect boundary, and validation.
27
+ 6. Attack entries must be constructed scenarios — actor, starting state, sequence — each ending in
28
+ a recorded outcome: `HELD` citing the defending step and premises, or `HOLE` with its repair
29
+ step or accepted reason. An assertion of absence ("no new shared mutable state") is not a
30
+ defense; it cannot fail, so it cannot catch anything.
31
+ 7. Installing an enforcer — trigger, constraint, guard, gate — opens an enforcement window: every
32
+ existing writer in the relevant state-authority premise must be brought into compliance in the
33
+ same or an earlier step, or the window recorded as an accepted hole. Every step declares
34
+ `Deployable`.
35
+ 8. The verdict is derived, not asserted: `PLANNED-COMPLETE` only when the coverage matrix has no
36
+ blank rows and every attack ends in `HELD` with citations or an accepted hole. An attack record
37
+ where nothing ever broke is a red flag — attacks run against a draft should find holes; if none
38
+ did, rerun the pass as falsification, preferably in a fresh subagent context.
39
+
40
+ ## Planning Terms
41
+
42
+ A **reuse audit** is the part of a plan that proves a proposed new symbol, file, option, wrapper,
43
+ or contract is needed; what makes it useful is that it ties the new shape to existing definitions,
44
+ consumers, and rejected extension points.
45
+
46
+ A **test seam** is the entry point a test can call to prove a behavior without replaying the whole
47
+ product path; what makes it valuable in a plan is that it names the exact unit or boundary where
48
+ correctness will be observed.
49
+
50
+ A **side-effect boundary** is the edge where deterministic program decisions meet files,
51
+ processes, clocks, networks, databases, or other external capabilities; what makes it important is
52
+ that failures and fakes can be isolated there while core decisions stay easy to test.
53
+
54
+ A **contract** is the stable promise one code unit exposes to another, including accepted inputs,
55
+ returned outputs, errors, timing expectations, and side effects that callers may rely on.
56
+
57
+ An **invariant** is a property of the changed system that must hold at every observable moment;
58
+ what makes it load-bearing is that attacks are judged against it and the final verdict is derived
59
+ from whether it survives them all.
60
+
61
+ A **premise** is a numbered, source-cited statement of fact about the current code; what makes it
62
+ a premise rather than a note is that steps and defenses cite it by ID, so a false premise is
63
+ traceable to everything built on it.
64
+
65
+ A **state-authority premise** is a premise that enumerates the complete writer and reader sets of
66
+ one shared state surface; what makes it powerful is that "complete" is falsifiable with `refs` and
67
+ `dataflow`, turning a forgotten write path from an unknowable into a checkable omission.
68
+
69
+ A **counterexample attack** is a concrete actor, starting state, and action sequence constructed
70
+ to violate an invariant; what makes it evidence is that its defense cites premises and steps, so
71
+ "we considered failure" becomes "this specific failure is blocked here."
72
+
73
+ An **enforcement window** is the interval between the step that installs an invariant enforcer and
74
+ the step that brings the last existing writer into compliance; what makes it dangerous is that
75
+ during it, every unupdated writer fails the new check in production, so the plan that adds safety
76
+ is itself the outage.
77
+
78
+ ## Workflow
79
+
80
+ ### 1. Discover
81
+
82
+ ```bash
83
+ scip-query status --capabilities
84
+ scip-query plan-context <target>
85
+ ```
86
+
87
+ Fill four gates before designing:
88
+
89
+ ```markdown
90
+ ## Goal
91
+
92
+ What the user is trying to accomplish and what done looks like for them.
93
+
94
+ ## Definitions & Invariants
95
+
96
+ For each load-bearing concept: its wider class, then the one trait that causally
97
+ explains its other traits in this codebase — with the referents. Then the
98
+ invariants the change must preserve, in iff / must-always form.
99
+
100
+ ## Current State
101
+
102
+ A short narrative of the affected end-to-end flow. Every factual sentence
103
+ cites a premise by ID.
104
+
105
+ ## Reuse Audit
106
+
107
+ For every new symbol or file being considered: reuse target, extension target,
108
+ or evidence-backed reason new code is justified.
109
+ ```
110
+
111
+ Definition discipline: place the concept in its wider class, then name the essential trait — the
112
+ one that makes the concept's other traits in this codebase possible and explains them. Do not
113
+ label genus or differentia; write it as prose. Ban circular and synonym definitions ("the refresh
114
+ coordinator coordinates refreshes" defines nothing). Any new term the plan introduces gets defined
115
+ the same way. Good definitions condense: they imply the concept's other traits instead of listing
116
+ them, and derived requirements fall out of them — if restore is defined as the inverse of cancel,
117
+ then the privilege to restore must not be weaker than the privilege to cancel, and a plan that
118
+ gates them asymmetrically must defend that asymmetry.
119
+
120
+ Complete only when the concepts are defined with referents, the invariants are stated formally,
121
+ and every proposed new unit has a reuse decision with citations.
122
+
123
+ ### 2. Establish Premises
124
+
125
+ ```markdown
126
+ ## Premises
127
+
128
+ - P1. <current behavior fact> — Source: `scip-query code <symbol>`
129
+ - P2. Writers of `<state surface>`: <complete list>. Readers: <complete list>.
130
+ — Source: `scip-query refs <symbol>` + `scip-query dataflow <symbol>`
131
+ - P3. ASSUMPTION: <belief the evidence cannot yet confirm, and what would confirm it>
132
+ ```
133
+
134
+ State-authority rule: for every state surface the plan touches — database column, store field,
135
+ event topic, endpoint, cache entry — write one premise enumerating its complete writer and reader
136
+ sets. Completeness comes from `refs` and `dataflow`, not memory.
137
+
138
+ Why this premise class exists: a sprint-restore plan hardened `restore()` and the cancellation
139
+ path but never enumerated the writers of sprint status. Review found `PATCH /sprints/:id` could
140
+ set `status: 'active'` around every restore invariant, and transition automations wrote `sprintId`
141
+ straight past the new membership guard — two of that review's five ship-blockers, both sitting in
142
+ the writer list one `refs` call would have produced. With a state-authority premise, each writer
143
+ in the list must be visited by an attack; without it, the side doors are invisible until review.
144
+
145
+ Complete only when every state surface named in any phase has a state-authority premise and every
146
+ remaining unknown is an explicit `ASSUMPTION`.
147
+
148
+ ### 3. Shape for Tests
149
+
150
+ ```markdown
151
+ ## Testability Design
152
+
153
+ | Behavior | Test seam | Dependencies to inject | Pure core | Side-effect shell | Contract |
154
+ | ---------- | ------------------ | --------------------------- | ------------------------------- | ----------------- | ------------------------------- |
155
+ | <behavior> | <test entry point> | <clock/db/http/logger/etc.> | <calculation/decision function> | <I/O wrapper> | <small interface or call shape> |
156
+ ```
157
+
158
+ Plan the code so tests can call the pure core directly and exercise the side-effect shell with
159
+ injected replacements. Prefer this shape:
160
+
161
+ 1. Parse and validate at the boundary.
162
+ 2. Pass domain data and injected dependencies into a small orchestrator.
163
+ 3. Put calculations, filtering, selection, formatting decisions, and state transitions in pure
164
+ functions.
165
+ 4. Keep database, network, filesystem, clock, randomness, logging, email, and payment calls in
166
+ thin side-effect shells.
167
+ 5. Depend on small contracts at boundaries; avoid broad option objects, booleans that hide
168
+ behavior, and wrappers that merely forward.
169
+
170
+ Complete only when every changed behavior has a named test seam and the plan makes clear which
171
+ logic can be tested without real external services.
172
+
173
+ ### 4. Design the Checklist
174
+
175
+ Write phases in execution order. Keep each phase deployable or explicitly mark why it is not.
176
+
177
+ ```markdown
178
+ ### N.M - Imperative title
179
+
180
+ - [ ] **File**: `path/to/file.ts:LINE-LINE`
181
+ - **Premises**: P<n>, P<m>
182
+ - **Deployable**: yes | no — <reason> | part of single-deploy group <name>
183
+ - **What**: Current behavior verified from source.
184
+ - **Change**: Exact edit to make.
185
+ - **Testability**:
186
+ - Test seam:
187
+ - Injected dependencies:
188
+ - Pure core:
189
+ - Side-effect shell:
190
+ - Contract:
191
+ - **Validation**: Targeted test, smoke command, or manual check that proves the behavior.
192
+ - **Why**: Why this step is needed and why this order is safe, citing the premises it rests on.
193
+ ```
194
+
195
+ If a step installs an enforcer, check its enforcement window here: every existing writer in the
196
+ relevant state-authority premise is brought into compliance in the same or an earlier step, or the
197
+ window is carried into the attack record as a hole to accept or repair.
198
+
199
+ Complete only when no checklist item says "update this file" without exact current behavior,
200
+ target behavior, cited premises, a deployability declaration, and validation.
201
+
202
+ ### 5. Attack the Plan
203
+
204
+ Construct counterexamples against every invariant. This pass is falsification, not defense: it
205
+ succeeds by finding holes, and against a draft it should find some. Prefer delegating it to a
206
+ fresh subagent when the environment can spawn one — give the adversary only the Definitions &
207
+ Invariants, Premises, state-authority maps, and the checklist, not your design rationale, and
208
+ brief it that it wins by producing holes; fold its findings back as HOLE entries and repair steps.
209
+ Solo fallback: enumerate the full attack list from the coverage-matrix rows below before writing
210
+ any Outcome line, so attacks cannot be shaped around defenses you already have.
211
+
212
+ Use the lenses as attack prompts — purpose, blast radius, valid intermediate state, reversibility,
213
+ failure, concurrency, boundaries, data integrity, observability, human experience, efficiency,
214
+ reuse, testability — and record each attack in this form:
215
+
216
+ ```markdown
217
+ ### A<n>. <invariant> via <lens>
218
+
219
+ - Attack: <actor> + <starting state> + <action sequence>
220
+ - Outcome: HELD — defended by step <N.M> (P<i>, P<j>)
221
+ | HOLE — repaired by new step <N.M>
222
+ | HOLE — accepted: <reason>
223
+ ```
224
+
225
+ A `HELD` that cannot name its defending step and premises is not `HELD`; it is a hole wearing
226
+ confidence. A repaired hole keeps its `HOLE — repaired by step N.M` label permanently — do not
227
+ rewrite it to `HELD` after the repair, because the repair history is the evidence that the pass
228
+ falsified. The verdict's repaired count must equal the number of `HOLE — repaired` entries.
229
+
230
+ Close the record with a coverage matrix — one row per writer in every state-authority premise and
231
+ per applicable lens (valid intermediate state is always applicable when any step installs an
232
+ enforcer or migration):
233
+
234
+ ```markdown
235
+ | Surface or lens | Attacks |
236
+ | ------------------------- | ------- |
237
+ | <writer, reader, or lens> | A2, A7 |
238
+ ```
239
+
240
+ A blank row is an unattacked writer. The record is incomplete until every row names an attack or
241
+ carries an accepted reason. Spread attacks across rows before deepening one: depth on the axis you
242
+ already anticipated does not protect the axes you did not — the leaks come from blank rows, not
243
+ from the tenth variation of the race you already modeled.
244
+
245
+ Invalid entry — this exact shape preceded three post-review remediation rounds on a real plan:
246
+
247
+ > **Concurrency**: Validation happens before database writes; no new shared mutable state or retry
248
+ > behavior is introduced.
249
+
250
+ It names no actor, no interleaving, and cites nothing. It is an assertion of absence: it cannot
251
+ fail, so it caught nothing — review later found exactly the race it waved away. A valid entry for
252
+ the same phase:
253
+
254
+ > ### A3. "Every stored value is a member of its field's option set" via concurrency
255
+ >
256
+ > - Attack: admin removes option O in transaction A while a user writes value O in transaction B;
257
+ > interleaving B-validates → A-commits → B-commits persists an orphaned value.
258
+ > - Outcome: HOLE — repaired by new step 2.2: validation reads the option definition outside B's
259
+ > lock (P4), so serialize definition changes with every value writer via FOR UPDATE on the
260
+ > definition row; regression proves both interleavings against PostgreSQL.
261
+
262
+ Complete only when the coverage matrix has no blank rows and every attack entry ends in a cited
263
+ `HELD` or a recorded `HOLE`.
264
+
265
+ ### 6. Verify and Derive the Verdict
266
+
267
+ Run or delegate phase-by-phase reference checks. Each verifier confirms:
268
+
269
+ - every path exists;
270
+ - every line range is still within about five lines;
271
+ - every premise reproduces when its `Source` command is rerun — a premise that no longer
272
+ reproduces is false, and everything citing it is suspect until fixed;
273
+ - every behavior claim matches source;
274
+ - every new unit has reuse evidence;
275
+ - every behavior-changing step has cited premises, a validation command, and a testability design.
276
+
277
+ Then rerun the source-producing context for the cited targets:
278
+
279
+ ```bash
280
+ scip-query plan-context <target>
281
+ ```
282
+
283
+ Use the shared reference for subagent briefing text when delegating. Close the plan by applying
284
+ the definitions to the record — do not summarize feelings:
285
+
286
+ ```markdown
287
+ ## Verdict
288
+
289
+ A plan is PLANNED-COMPLETE iff the coverage matrix has no blank rows, every
290
+ attack ends in HELD with cited steps and premises or an accepted hole with a
291
+ written reason, and no premise failed reverification.
292
+
293
+ Result: PLANNED-COMPLETE | INCOMPLETE — <n> attacks, <x> holes repaired,
294
+ <y> holes accepted; <unresolved items>
295
+ ```
296
+
297
+ The counts are part of the verdict. "16 attacks, 0 holes repaired" against a fresh draft is not a
298
+ strong plan; it is an attack pass that defended instead of falsified — rerun it before shipping.
299
+
300
+ Complete only when stale references are fixed, every premise reverified, and the verdict line is
301
+ derived from the attack record.
302
+
303
+ ## Output Shape
304
+
305
+ 1. Title and date.
306
+ 2. Goal.
307
+ 3. Definitions & Invariants.
308
+ 4. Premises (including state-authority premises and explicit assumptions).
309
+ 5. Current State (narrative citing premise IDs).
310
+ 6. Reuse Audit.
311
+ 7. Testability Design.
312
+ 8. Design Phases (steps citing premises, each with a deployability declaration).
313
+ 9. Attack Record (attacks with outcomes, holes repaired or accepted, coverage matrix).
314
+ 10. Execution Order and deployable phase notes.
315
+ 11. Ship Order with one-way doors flagged.
316
+ 12. Verdict with attack and hole counts.
317
+ 13. Summary of files to create, edit, delete, and verify.