scip-query 0.1.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 (330) hide show
  1. package/IMPROVEMENTS.md +143 -0
  2. package/PLAN.md +320 -0
  3. package/README.md +1213 -0
  4. package/dist/chunk-2QZ23IBN.js +55 -0
  5. package/dist/chunk-2QZ23IBN.js.map +1 -0
  6. package/dist/chunk-36OMT7ZJ.js +144 -0
  7. package/dist/chunk-36OMT7ZJ.js.map +1 -0
  8. package/dist/chunk-3E2X7RIE.js +101 -0
  9. package/dist/chunk-3E2X7RIE.js.map +1 -0
  10. package/dist/chunk-3UOUTZQT.js +45 -0
  11. package/dist/chunk-3UOUTZQT.js.map +1 -0
  12. package/dist/chunk-3ZZJVBIO.js +88 -0
  13. package/dist/chunk-3ZZJVBIO.js.map +1 -0
  14. package/dist/chunk-4TYLS5XX.js +10 -0
  15. package/dist/chunk-4TYLS5XX.js.map +1 -0
  16. package/dist/chunk-5FGUEU7N.js +101 -0
  17. package/dist/chunk-5FGUEU7N.js.map +1 -0
  18. package/dist/chunk-5WTJAXY2.js +61 -0
  19. package/dist/chunk-5WTJAXY2.js.map +1 -0
  20. package/dist/chunk-6NBLIDF4.js +24 -0
  21. package/dist/chunk-6NBLIDF4.js.map +1 -0
  22. package/dist/chunk-6SXADWLW.js +43 -0
  23. package/dist/chunk-6SXADWLW.js.map +1 -0
  24. package/dist/chunk-6VJ6Q7IE.js +65 -0
  25. package/dist/chunk-6VJ6Q7IE.js.map +1 -0
  26. package/dist/chunk-7OZPA5OO.js +258 -0
  27. package/dist/chunk-7OZPA5OO.js.map +1 -0
  28. package/dist/chunk-BEPIEVLR.js +76 -0
  29. package/dist/chunk-BEPIEVLR.js.map +1 -0
  30. package/dist/chunk-BFSCMC22.js +42 -0
  31. package/dist/chunk-BFSCMC22.js.map +1 -0
  32. package/dist/chunk-BP2ATLK2.js +110 -0
  33. package/dist/chunk-BP2ATLK2.js.map +1 -0
  34. package/dist/chunk-CM454WL3.js +114 -0
  35. package/dist/chunk-CM454WL3.js.map +1 -0
  36. package/dist/chunk-DCKMSTJ4.js +74 -0
  37. package/dist/chunk-DCKMSTJ4.js.map +1 -0
  38. package/dist/chunk-DEZKCZXD.js +40 -0
  39. package/dist/chunk-DEZKCZXD.js.map +1 -0
  40. package/dist/chunk-DVWGWHFW.js +99 -0
  41. package/dist/chunk-DVWGWHFW.js.map +1 -0
  42. package/dist/chunk-EMDQWNYR.js +102 -0
  43. package/dist/chunk-EMDQWNYR.js.map +1 -0
  44. package/dist/chunk-FFSWWE5O.js +33 -0
  45. package/dist/chunk-FFSWWE5O.js.map +1 -0
  46. package/dist/chunk-FGXRVW7G.js +73 -0
  47. package/dist/chunk-FGXRVW7G.js.map +1 -0
  48. package/dist/chunk-FUHJCHS4.js +158 -0
  49. package/dist/chunk-FUHJCHS4.js.map +1 -0
  50. package/dist/chunk-GJFURBEW.js +64 -0
  51. package/dist/chunk-GJFURBEW.js.map +1 -0
  52. package/dist/chunk-GTILYBH6.js +102 -0
  53. package/dist/chunk-GTILYBH6.js.map +1 -0
  54. package/dist/chunk-JJP7KQND.js +1 -0
  55. package/dist/chunk-JJP7KQND.js.map +1 -0
  56. package/dist/chunk-JKP5GH6T.js +213 -0
  57. package/dist/chunk-JKP5GH6T.js.map +1 -0
  58. package/dist/chunk-KCBMVQL5.js +38 -0
  59. package/dist/chunk-KCBMVQL5.js.map +1 -0
  60. package/dist/chunk-KVSW5KYP.js +78 -0
  61. package/dist/chunk-KVSW5KYP.js.map +1 -0
  62. package/dist/chunk-LAWMH22O.js +172 -0
  63. package/dist/chunk-LAWMH22O.js.map +1 -0
  64. package/dist/chunk-LB7OS35Q.js +72 -0
  65. package/dist/chunk-LB7OS35Q.js.map +1 -0
  66. package/dist/chunk-LUSIFBXO.js +57 -0
  67. package/dist/chunk-LUSIFBXO.js.map +1 -0
  68. package/dist/chunk-MBVNHJVN.js +44 -0
  69. package/dist/chunk-MBVNHJVN.js.map +1 -0
  70. package/dist/chunk-MGNMHKX3.js +15 -0
  71. package/dist/chunk-MGNMHKX3.js.map +1 -0
  72. package/dist/chunk-N5KEREIA.js +41 -0
  73. package/dist/chunk-N5KEREIA.js.map +1 -0
  74. package/dist/chunk-NDSQYIWT.js +71 -0
  75. package/dist/chunk-NDSQYIWT.js.map +1 -0
  76. package/dist/chunk-NUZ4OMU3.js +28 -0
  77. package/dist/chunk-NUZ4OMU3.js.map +1 -0
  78. package/dist/chunk-QOV2R2WT.js +170 -0
  79. package/dist/chunk-QOV2R2WT.js.map +1 -0
  80. package/dist/chunk-SEFSL2GF.js +78 -0
  81. package/dist/chunk-SEFSL2GF.js.map +1 -0
  82. package/dist/chunk-T6ARFSBZ.js +103 -0
  83. package/dist/chunk-T6ARFSBZ.js.map +1 -0
  84. package/dist/chunk-TBP6BICL.js +46 -0
  85. package/dist/chunk-TBP6BICL.js.map +1 -0
  86. package/dist/chunk-TDNNOR6D.js +97 -0
  87. package/dist/chunk-TDNNOR6D.js.map +1 -0
  88. package/dist/chunk-TSPZOMHC.js +195 -0
  89. package/dist/chunk-TSPZOMHC.js.map +1 -0
  90. package/dist/chunk-UNTPVD36.js +55 -0
  91. package/dist/chunk-UNTPVD36.js.map +1 -0
  92. package/dist/chunk-VRUJH4BO.js +88 -0
  93. package/dist/chunk-VRUJH4BO.js.map +1 -0
  94. package/dist/chunk-VZ7AMAFL.js +76 -0
  95. package/dist/chunk-VZ7AMAFL.js.map +1 -0
  96. package/dist/chunk-XFXDXEUN.js +24 -0
  97. package/dist/chunk-XFXDXEUN.js.map +1 -0
  98. package/dist/chunk-YZAA4LYG.js +169 -0
  99. package/dist/chunk-YZAA4LYG.js.map +1 -0
  100. package/dist/chunk-Z73NYSBZ.js +92 -0
  101. package/dist/chunk-Z73NYSBZ.js.map +1 -0
  102. package/dist/chunk-ZJRYBOEE.js +125 -0
  103. package/dist/chunk-ZJRYBOEE.js.map +1 -0
  104. package/dist/cli.js +5798 -0
  105. package/dist/cli.js.map +1 -0
  106. package/dist/db-BxaevAyc.d.ts +683 -0
  107. package/dist/index.d.ts +254 -0
  108. package/dist/index.js +1271 -0
  109. package/dist/index.js.map +1 -0
  110. package/dist/postinstall.js +167 -0
  111. package/dist/postinstall.js.map +1 -0
  112. package/dist/queries/affected.d.ts +14 -0
  113. package/dist/queries/affected.js +9 -0
  114. package/dist/queries/affected.js.map +1 -0
  115. package/dist/queries/bottlenecks.d.ts +18 -0
  116. package/dist/queries/bottlenecks.js +8 -0
  117. package/dist/queries/bottlenecks.js.map +1 -0
  118. package/dist/queries/by-kind.d.ts +20 -0
  119. package/dist/queries/by-kind.js +10 -0
  120. package/dist/queries/by-kind.js.map +1 -0
  121. package/dist/queries/call-graph.d.ts +13 -0
  122. package/dist/queries/call-graph.js +9 -0
  123. package/dist/queries/call-graph.js.map +1 -0
  124. package/dist/queries/change-surface.d.ts +10 -0
  125. package/dist/queries/change-surface.js +9 -0
  126. package/dist/queries/change-surface.js.map +1 -0
  127. package/dist/queries/clean-signature.d.ts +9 -0
  128. package/dist/queries/clean-signature.js +7 -0
  129. package/dist/queries/clean-signature.js.map +1 -0
  130. package/dist/queries/code.d.ts +17 -0
  131. package/dist/queries/code.js +9 -0
  132. package/dist/queries/code.js.map +1 -0
  133. package/dist/queries/complexity-hotspots.d.ts +19 -0
  134. package/dist/queries/complexity-hotspots.js +9 -0
  135. package/dist/queries/complexity-hotspots.js.map +1 -0
  136. package/dist/queries/complexity.d.ts +13 -0
  137. package/dist/queries/complexity.js +9 -0
  138. package/dist/queries/complexity.js.map +1 -0
  139. package/dist/queries/convergence.d.ts +11 -0
  140. package/dist/queries/convergence.js +9 -0
  141. package/dist/queries/convergence.js.map +1 -0
  142. package/dist/queries/coupling.d.ts +17 -0
  143. package/dist/queries/coupling.js +9 -0
  144. package/dist/queries/coupling.js.map +1 -0
  145. package/dist/queries/cycles.d.ts +16 -0
  146. package/dist/queries/cycles.js +8 -0
  147. package/dist/queries/cycles.js.map +1 -0
  148. package/dist/queries/dataflow.d.ts +19 -0
  149. package/dist/queries/dataflow.js +9 -0
  150. package/dist/queries/dataflow.js.map +1 -0
  151. package/dist/queries/dead.d.ts +10 -0
  152. package/dist/queries/dead.js +9 -0
  153. package/dist/queries/dead.js.map +1 -0
  154. package/dist/queries/deep-chains.d.ts +16 -0
  155. package/dist/queries/deep-chains.js +8 -0
  156. package/dist/queries/deep-chains.js.map +1 -0
  157. package/dist/queries/deps.d.ts +9 -0
  158. package/dist/queries/deps.js +9 -0
  159. package/dist/queries/deps.js.map +1 -0
  160. package/dist/queries/diff-impact.d.ts +13 -0
  161. package/dist/queries/diff-impact.js +9 -0
  162. package/dist/queries/diff-impact.js.map +1 -0
  163. package/dist/queries/doc-coverage.d.ts +14 -0
  164. package/dist/queries/doc-coverage.js +8 -0
  165. package/dist/queries/doc-coverage.js.map +1 -0
  166. package/dist/queries/drift.d.ts +25 -0
  167. package/dist/queries/drift.js +8 -0
  168. package/dist/queries/drift.js.map +1 -0
  169. package/dist/queries/extract-candidates.d.ts +25 -0
  170. package/dist/queries/extract-candidates.js +9 -0
  171. package/dist/queries/extract-candidates.js.map +1 -0
  172. package/dist/queries/fan.d.ts +29 -0
  173. package/dist/queries/fan.js +14 -0
  174. package/dist/queries/fan.js.map +1 -0
  175. package/dist/queries/files.d.ts +6 -0
  176. package/dist/queries/files.js +7 -0
  177. package/dist/queries/files.js.map +1 -0
  178. package/dist/queries/health.d.ts +18 -0
  179. package/dist/queries/health.js +21 -0
  180. package/dist/queries/health.js.map +1 -0
  181. package/dist/queries/hierarchy.d.ts +13 -0
  182. package/dist/queries/hierarchy.js +8 -0
  183. package/dist/queries/hierarchy.js.map +1 -0
  184. package/dist/queries/hotspots.d.ts +13 -0
  185. package/dist/queries/hotspots.js +8 -0
  186. package/dist/queries/hotspots.js.map +1 -0
  187. package/dist/queries/imports.d.ts +19 -0
  188. package/dist/queries/imports.js +12 -0
  189. package/dist/queries/imports.js.map +1 -0
  190. package/dist/queries/index.d.ts +47 -0
  191. package/dist/queries/index.js +207 -0
  192. package/dist/queries/index.js.map +1 -0
  193. package/dist/queries/isolated.d.ts +14 -0
  194. package/dist/queries/isolated.js +9 -0
  195. package/dist/queries/isolated.js.map +1 -0
  196. package/dist/queries/members.d.ts +10 -0
  197. package/dist/queries/members.js +8 -0
  198. package/dist/queries/members.js.map +1 -0
  199. package/dist/queries/methods.d.ts +6 -0
  200. package/dist/queries/methods.js +8 -0
  201. package/dist/queries/methods.js.map +1 -0
  202. package/dist/queries/outline.d.ts +10 -0
  203. package/dist/queries/outline.js +8 -0
  204. package/dist/queries/outline.js.map +1 -0
  205. package/dist/queries/passthrough-candidates.d.ts +18 -0
  206. package/dist/queries/passthrough-candidates.js +9 -0
  207. package/dist/queries/passthrough-candidates.js.map +1 -0
  208. package/dist/queries/redundant-reexports.d.ts +22 -0
  209. package/dist/queries/redundant-reexports.js +8 -0
  210. package/dist/queries/redundant-reexports.js.map +1 -0
  211. package/dist/queries/refs.d.ts +6 -0
  212. package/dist/queries/refs.js +7 -0
  213. package/dist/queries/refs.js.map +1 -0
  214. package/dist/queries/similar-chains.d.ts +29 -0
  215. package/dist/queries/similar-chains.js +8 -0
  216. package/dist/queries/similar-chains.js.map +1 -0
  217. package/dist/queries/similar-files.d.ts +19 -0
  218. package/dist/queries/similar-files.js +8 -0
  219. package/dist/queries/similar-files.js.map +1 -0
  220. package/dist/queries/similar-signatures.d.ts +21 -0
  221. package/dist/queries/similar-signatures.js +8 -0
  222. package/dist/queries/similar-signatures.js.map +1 -0
  223. package/dist/queries/similar.d.ts +34 -0
  224. package/dist/queries/similar.js +11 -0
  225. package/dist/queries/similar.js.map +1 -0
  226. package/dist/queries/slice.d.ts +21 -0
  227. package/dist/queries/slice.js +9 -0
  228. package/dist/queries/slice.js.map +1 -0
  229. package/dist/queries/stale-abstractions.d.ts +18 -0
  230. package/dist/queries/stale-abstractions.js +9 -0
  231. package/dist/queries/stale-abstractions.js.map +1 -0
  232. package/dist/queries/stats.d.ts +6 -0
  233. package/dist/queries/stats.js +7 -0
  234. package/dist/queries/stats.js.map +1 -0
  235. package/dist/queries/surface.d.ts +7 -0
  236. package/dist/queries/surface.js +8 -0
  237. package/dist/queries/surface.js.map +1 -0
  238. package/dist/queries/symbols.d.ts +6 -0
  239. package/dist/queries/symbols.js +9 -0
  240. package/dist/queries/symbols.js.map +1 -0
  241. package/dist/queries/system.d.ts +7 -0
  242. package/dist/queries/system.js +9 -0
  243. package/dist/queries/system.js.map +1 -0
  244. package/dist/queries/test-coverage.d.ts +22 -0
  245. package/dist/queries/test-coverage.js +11 -0
  246. package/dist/queries/test-coverage.js.map +1 -0
  247. package/dist/queries/trace.d.ts +6 -0
  248. package/dist/queries/trace.js +8 -0
  249. package/dist/queries/trace.js.map +1 -0
  250. package/dist/queries/wrapper-candidates.d.ts +17 -0
  251. package/dist/queries/wrapper-candidates.js +9 -0
  252. package/dist/queries/wrapper-candidates.js.map +1 -0
  253. package/dist/reindex-worker.js +368 -0
  254. package/dist/reindex-worker.js.map +1 -0
  255. package/docs/AGENT_GUIDE.md +359 -0
  256. package/package.json +70 -0
  257. package/reports/debloat/2026-04-10-scip-query-self-audit.md +161 -0
  258. package/skills/concrete-plan/SKILL.md +318 -0
  259. package/skills/scip-debloat/SKILL.md +413 -0
  260. package/skills/scip-explore/SKILL.md +235 -0
  261. package/skills/scip-verify/SKILL.md +323 -0
  262. package/src/cli.ts +1480 -0
  263. package/src/config.ts +117 -0
  264. package/src/db.ts +127 -0
  265. package/src/gitignore-filter.ts +143 -0
  266. package/src/index.ts +11 -0
  267. package/src/postinstall.ts +8 -0
  268. package/src/queries/affected.ts +86 -0
  269. package/src/queries/bottlenecks.ts +67 -0
  270. package/src/queries/by-kind.ts +204 -0
  271. package/src/queries/call-graph.ts +66 -0
  272. package/src/queries/change-surface.ts +110 -0
  273. package/src/queries/clean-signature.ts +22 -0
  274. package/src/queries/code.ts +101 -0
  275. package/src/queries/complexity-hotspots.ts +119 -0
  276. package/src/queries/complexity.ts +152 -0
  277. package/src/queries/convergence.ts +82 -0
  278. package/src/queries/coupling.ts +99 -0
  279. package/src/queries/cycles.ts +78 -0
  280. package/src/queries/dataflow.ts +128 -0
  281. package/src/queries/dead.ts +122 -0
  282. package/src/queries/deep-chains.ts +59 -0
  283. package/src/queries/deps.ts +46 -0
  284. package/src/queries/diff-impact.ts +204 -0
  285. package/src/queries/doc-coverage.ts +86 -0
  286. package/src/queries/drift.ts +224 -0
  287. package/src/queries/extract-candidates.ts +167 -0
  288. package/src/queries/fan.ts +148 -0
  289. package/src/queries/files.ts +16 -0
  290. package/src/queries/health.ts +324 -0
  291. package/src/queries/hierarchy.ts +49 -0
  292. package/src/queries/hotspots.ts +53 -0
  293. package/src/queries/imports.ts +95 -0
  294. package/src/queries/index.ts +45 -0
  295. package/src/queries/isolated.ts +67 -0
  296. package/src/queries/members.ts +54 -0
  297. package/src/queries/methods.ts +27 -0
  298. package/src/queries/outline.ts +52 -0
  299. package/src/queries/passthrough-candidates.ts +94 -0
  300. package/src/queries/redundant-reexports.ts +170 -0
  301. package/src/queries/refs.ts +27 -0
  302. package/src/queries/similar-chains.ts +314 -0
  303. package/src/queries/similar-files.ts +140 -0
  304. package/src/queries/similar-signatures.ts +151 -0
  305. package/src/queries/similar.ts +305 -0
  306. package/src/queries/slice.ts +154 -0
  307. package/src/queries/stale-abstractions.ts +82 -0
  308. package/src/queries/stats.ts +22 -0
  309. package/src/queries/surface.ts +34 -0
  310. package/src/queries/symbols.ts +39 -0
  311. package/src/queries/system.ts +86 -0
  312. package/src/queries/test-coverage.ts +106 -0
  313. package/src/queries/trace.ts +55 -0
  314. package/src/queries/wrapper-candidates.ts +112 -0
  315. package/src/query-support.ts +226 -0
  316. package/src/reindex/detect.ts +58 -0
  317. package/src/reindex/index.ts +153 -0
  318. package/src/reindex/indexers.ts +220 -0
  319. package/src/reindex/install.ts +125 -0
  320. package/src/reindex-worker.ts +35 -0
  321. package/src/setup.ts +202 -0
  322. package/src/symbol-parser.ts +278 -0
  323. package/src/types.ts +654 -0
  324. package/src/watch.ts +274 -0
  325. package/tests/gitignore-filter.test.ts +48 -0
  326. package/tests/queries.test.ts +300 -0
  327. package/tests/symbol-parser.test.ts +157 -0
  328. package/tsconfig.json +20 -0
  329. package/tsup.config.ts +40 -0
  330. package/vitest.config.ts +7 -0
@@ -0,0 +1,318 @@
1
+ ---
2
+ name: concrete-plan
3
+ description: Build concrete, checklist-driven implementation plans using scip-query for every code reference. Plans are stress-tested against 11 engineering principles before shipping.
4
+ allowed-tools: [Bash, Write, Edit, Glob, Agent, TaskCreate, TaskUpdate, TaskGet, TaskList]
5
+ keywords: [plan, design, architecture, implementation, checklist, blueprint, proposal, rfc, spec]
6
+ ---
7
+
8
+ # Concrete Implementation Planning
9
+
10
+ You are writing a production implementation plan as a markdown checklist. Every step must be concrete — exact file paths, line numbers, what the code does today, what it should do after the change. No hand-waving. No "consider doing X." Every claim about existing code must be verified against the actual codebase using `scip-query`.
11
+
12
+ ---
13
+
14
+ ## Hard Rules
15
+
16
+ 1. **Every code reference must come from scip-query.** Run `scip-query reindex` before starting. Re-run if significant code has changed during the session. No reference from memory, grep, or file reads.
17
+
18
+ 2. **Every step must cite its source.** Each step in the plan includes a `Source` field naming the scip-query command that produced the file path, line number, and behavioral claim. A step without a Source is unverified and must not appear in the plan.
19
+
20
+ 3. **Every step must be actionable.** Never write "update this file." Write "In `foo.service.ts:142-158`, the `catch` block swallows `AbortError` — re-throw it instead of logging." Exact lines, current behavior, target behavior.
21
+
22
+ 4. **The plan goes in `docs/plans/YYYY-MM-DD-<short-name>.md`.** Use today's date. The file is a living document — update it as stress-testing reveals new steps.
23
+
24
+ ---
25
+
26
+ ## Symbol Lookup Tips
27
+
28
+ scip-query accepts partial symbol names — you don't need the full SCIP symbol path. These all work:
29
+
30
+ ```bash
31
+ scip-query code processVegaMention # just the function name
32
+ scip-query call-graph ChatService # just the class name
33
+ scip-query trace getActiveInferenceConfig # any unique substring
34
+ ```
35
+
36
+ **Avoid parentheses** — `()` causes shell parse errors in zsh/bash:
37
+ ```bash
38
+ # BAD — shell tries to execute a subshell
39
+ scip-query code processVegaMention()
40
+
41
+ # GOOD — no parens needed, scip-query strips them internally
42
+ scip-query code processVegaMention
43
+
44
+ # ALSO GOOD — single quotes protect special characters
45
+ scip-query code 'processVegaMention'
46
+ ```
47
+
48
+ **Read source by file + line range** when the symbol name is ambiguous:
49
+ ```bash
50
+ scip-query code 'src/modules/chat/chat.service.ts:100-200'
51
+ ```
52
+
53
+ **If "Symbol not found":**
54
+ 1. Try a shorter/simpler name — `login` instead of `AuthService:login`
55
+ 2. Try `scip-query symbols <file>` to see what symbols exist in the file
56
+ 3. Try `scip-query trace <name>` which uses a different lookup path
57
+ 4. Use the `file:line-line` syntax for `code` if you know the location
58
+
59
+ ---
60
+
61
+ ## Forbidden Tools and Patterns
62
+
63
+ This skill deliberately excludes `Grep` and `Read` from its allowed tools. This is intentional.
64
+
65
+ **DO NOT work around this by:**
66
+ - Running `grep`, `rg`, or `cat` through Bash. If you catch yourself typing `grep` or `rg`, stop — you are doing it wrong.
67
+ - Using `Read` via a subagent to browse files for discovery. Subagents must also use scip-query.
68
+ - Spawning Explore agents that fall back to grep and file reads. If a subagent's output does not cite scip-query commands, reject its findings and re-run.
69
+
70
+ **Instead, use scip-query (48 commands — full reference at `/Users/aydansalois/Documents/GitHub/scip-query/README.md`):**
71
+
72
+ | You want to... | Use this |
73
+ |---|---|
74
+ | **Read source code** | `scip-query code <symbol>` (reads file, bounded to definition range) |
75
+ | **Read source with context** | `scip-query code <symbol> -C 5` (5 extra lines above/below) |
76
+ | Find a symbol / list file contents | `scip-query symbols <file>` (all symbols with line ranges + signatures) |
77
+ | Find files by name | `scip-query files <pattern>` |
78
+ | See callers + callees | `scip-query call-graph <symbol>` |
79
+ | Full module map | `scip-query system <module>` |
80
+ | True public API | `scip-query surface <module>` |
81
+ | Every file referencing a symbol | `scip-query refs <symbol>` |
82
+ | Definition + all references | `scip-query trace <symbol>` |
83
+ | Forward dependencies | `scip-query deps <file>` |
84
+ | Reverse dependencies | `scip-query rdeps <file>` |
85
+ | **Full transitive blast radius** | `scip-query affected <symbol>` |
86
+ | **Pre-change risk briefing** | `scip-query change-surface <file>` |
87
+ | **Git diff impact analysis** | `scip-query diff-impact` |
88
+ | **Complexity analysis** | `scip-query complexity <symbol>` (branches, cyclomatic, fan-in/out) |
89
+ | **Dataflow: what feeds in/out** | `scip-query dataflow <symbol>` (producers, consumers, usage sites) |
90
+ | **Backward slice (what affects this)** | `scip-query slice <symbol>` |
91
+ | **Forward slice (what this affects)** | `scip-query slice <symbol> --forward` |
92
+ | Find similar functions | `scip-query similar <symbol>` |
93
+ | Find same-shape functions | `scip-query similar-signatures` |
94
+ | Refactoring prescription | `scip-query convergence <a> <b>` |
95
+ | Find redundant re-exports | `scip-query redundant-reexports` |
96
+ | Find dead code | `scip-query dead --min-loc 10 --skip-barrels` |
97
+ | Codebase health report | `scip-query health` |
98
+ | Coupling pressure points | `scip-query bottlenecks` |
99
+ | Complexity hotspots | `scip-query complexity-hotspots` |
100
+ | Circular dependencies | `scip-query cycles` |
101
+ | Pattern drift | `scip-query drift` |
102
+ | Unnecessary wrappers | `scip-query wrapper-candidates` |
103
+ | Stale abstractions | `scip-query stale-abstractions` |
104
+ | Check if a file exists | `Glob` with the exact path pattern |
105
+
106
+ If none of these can answer your question, say so explicitly in the plan rather than silently falling back to grep.
107
+
108
+ ### Full Documentation
109
+
110
+ - **All 48 commands with options and examples:** `/Users/aydansalois/Documents/GitHub/scip-query/README.md`
111
+ - **Goal-oriented agent workflows:** `/Users/aydansalois/Documents/GitHub/scip-query/docs/AGENT_GUIDE.md`
112
+
113
+ ---
114
+
115
+ ## The 11 Principles
116
+
117
+ After designing the core implementation, stress-test it against every principle below. Each principle is a lens — apply it to every step in the plan and ask whether the design holds up. If it doesn't, add steps until it does. Use scip-query to verify your answers, not assumptions.
118
+
119
+ ### 1. Understand before you touch
120
+
121
+ Why does this code exist? What production failure shaped it? What does it handle that isn't obvious? You don't earn the right to change something until you can explain why it was written that way.
122
+
123
+ **Key question**: Can you explain the purpose of every piece of code you're modifying or removing?
124
+ **Tools**: `scip-query call-graph <symbol>` for callers/callees. `scip-query code <symbol>` to read the implementation.
125
+
126
+ ### 2. Map the blast radius
127
+
128
+ Every symbol you change has consumers. Find all of them — direct callers, transitive dependents, tests that mock it, types that reference it, re-exports. The question isn't "what am I changing" — it's "what else moves when I move this."
129
+
130
+ **Key question**: For every changed symbol, do you know every consumer?
131
+ **Tools**: `scip-query affected <symbol>` for full transitive closure. `scip-query rdeps` on every modified file. `scip-query surface` on every modified module. `scip-query change-surface <file>` for a per-file risk briefing.
132
+
133
+ ### 3. Every intermediate state must be valid
134
+
135
+ You can't teleport from old to new. Every commit, every deploy between here and there must leave the system working. No "it'll work once we finish all the steps." If the migration has 5 phases, each of the 5 intermediate states must build, pass tests, and be deployable.
136
+
137
+ **Key question**: If you deployed only Phase 1, would the system still work?
138
+ **Tools**: `scip-query deps` to verify no phase depends on code that hasn't been written yet.
139
+
140
+ ### 4. Reversibility determines rigor
141
+
142
+ One-way doors (dropping tables, changing public APIs, deleting data) get maximum scrutiny. Two-way doors (internal refactors, new internal functions) get proportional scrutiny. Know which kind of door you're walking through at every step, and say so in the plan.
143
+
144
+ **Key question**: For each step, can you undo it? What's the rollback plan if it goes wrong?
145
+
146
+ ### 5. Design for failure, not success
147
+
148
+ The happy path works — that's the easy part. What happens when the database is slow? The network drops? The API returns garbage? The process crashes mid-write? A user hits the button twice? Every new path needs a concrete failure mode answer.
149
+
150
+ **Key question**: For every new async path, what's the worst that happens and does the system recover?
151
+ **Tools**: `scip-query dataflow <symbol>` to trace data flow through error paths. `scip-query code <symbol>` to read existing catch blocks.
152
+
153
+ ### 6. Assume concurrency
154
+
155
+ Can this run twice at the same time? Can events arrive out of order? Can state be half-written when something else reads it? Can a cleanup path fire after a retry already recovered? Can a "done" signal arrive before its prerequisite state is written?
156
+
157
+ **Key question**: What shared mutable state does this touch, and what happens when two things touch it at once?
158
+ **Tools**: `scip-query dataflow <symbol>` to find what flows through shared state. `scip-query slice <symbol>` to trace what affects a variable.
159
+
160
+ ### 7. Defend the boundaries
161
+
162
+ Every entry point — API endpoint, WebSocket message, webhook, CLI command — is a trust boundary. Who can trigger this? On whose resources? With what input? Can user A act on user B's resources? Is the payload validated? Validate at the boundary, trust internally.
163
+
164
+ **Key question**: For every entry point, who is allowed to call it, and what happens when someone who isn't allowed tries?
165
+ **Tools**: `scip-query code <handler>` to read the handler. `scip-query refs <authFunction>` to see where auth middleware is applied.
166
+
167
+ ### 8. Protect data integrity
168
+
169
+ When you remove something, what references it? Foreign keys, orphaned rows, in-flight operations, unique constraints. When you change a schema, what happens to existing data? Data outlives code — you can revert a deploy but you can't un-corrupt a database.
170
+
171
+ **Key question**: What happens to existing data during and after this change?
172
+ **Tools**: `scip-query refs` on table/column names. `scip-query files` to find schema references.
173
+
174
+ ### 9. Make it observable
175
+
176
+ When this breaks at 3am, can the on-call engineer diagnose it from logs alone without reading the source code? Every error path needs structured context. Every state transition should be traceable. If you can't tell what happened, you can't fix it.
177
+
178
+ **Key question**: For every new error path, is there a log line with enough context to diagnose the problem?
179
+ **Tools**: `scip-query code <symbol>` to check existing logging patterns.
180
+
181
+ ### 10. Consider the human
182
+
183
+ What does the user experience during and after this change? Features that disappear without explanation, loading states that lie, error messages that confuse, flows that silently change behavior — these are bugs, not polish items.
184
+
185
+ **Key question**: If a real user walked through this flow, would anything surprise, confuse, or frustrate them?
186
+
187
+ ### 11. Match the existing system
188
+
189
+ Before designing any new code path, find 2-3 existing examples of the same problem class in the codebase. How does it already handle errors in this layer? What utilities does it already use? What's the naming convention? What abstraction level do similar modules operate at? Your implementation should be indistinguishable from the surrounding code — same patterns, same utilities, same conventions, same libraries. If you need to diverge, justify why in the plan. Two patterns for the same thing is worse than either pattern alone.
190
+
191
+ **Key question**: Does every new code path in the plan follow the conventions already established by the codebase, and can you point to the existing examples it's matching?
192
+ **Tools**: `scip-query similar <symbol>` to find functions with overlapping callee sets. `scip-query surface` to see what utilities a module already uses. `scip-query deps` to see what libraries are already adopted. `scip-query code` to read the canonical implementation.
193
+
194
+ ---
195
+
196
+ ## Workflow
197
+
198
+ ### 1. Discover
199
+
200
+ Start from the user's request. Use scip-query to map the system around the change:
201
+
202
+ - `scip-query system <module>` for the full module map.
203
+ - `scip-query call-graph <symbol>` for callers and callees.
204
+ - `scip-query rdeps` and `scip-query surface` to find all consumers.
205
+ - `scip-query affected <symbol>` for the full transitive blast radius.
206
+ - `scip-query change-surface <file>` for a pre-change risk briefing on each file you'll modify.
207
+
208
+ Then find the existing conventions before designing anything new:
209
+
210
+ - `scip-query similar <symbol>` to find functions with overlapping patterns you can reuse.
211
+ - `scip-query deps` to see what libraries and utilities the surrounding code already uses.
212
+ - `scip-query code <symbol>` to read the canonical examples.
213
+
214
+ Write a clear problem statement: what needs to change, why, and what the target state looks like. Include a **Conventions** section listing the existing patterns the implementation must follow, with source citations.
215
+
216
+ ### 2. Design
217
+
218
+ Write the implementation as a numbered checklist grouped into phases (5-8 files max per phase). Each step uses this format:
219
+
220
+ ```markdown
221
+ ### N.M — Short imperative title
222
+
223
+ - [ ] **File**: `path/to/file.ts:LINE-LINE`
224
+ - **Source**: `scip-query trace <symbol>` (the command that found this)
225
+ - **What**: What the code does today (verified via scip-query code).
226
+ - **Change**: Exactly what to change. Include code snippets for non-obvious changes.
227
+ - **Why**: Why this step is necessary.
228
+ ```
229
+
230
+ Include an execution order showing dependencies between phases. Mark which phases can be deployed independently.
231
+
232
+ ### 3. Stress-test
233
+
234
+ Apply the 11 Principles against every step in the design. For each principle, ask the key question and use the listed scip-query commands to verify the answer. If a principle reveals a gap, add steps to the plan until the gap is closed. Document what you checked and what you found.
235
+
236
+ ### 4. Verify
237
+
238
+ After stress-testing is complete:
239
+
240
+ 1. **Reindex**: Run `scip-query reindex`.
241
+ 2. **Verify references**: Spawn parallel subagents (one per phase) using the **Subagent Briefing Template**. Each agent confirms that every file path exists, every line number is within +-5 lines, and every described behavior matches reality. Reject output that doesn't cite scip-query commands.
242
+ 3. **Fix drift**: Update any stale references.
243
+ 4. **Check execution order**: No phase depends on a later phase. No step within a phase depends on a later step.
244
+ 5. **Check test coverage**: Every behavior-changing step should have a corresponding test step. Flag gaps.
245
+ 6. **Run diff-impact**: `scip-query diff-impact` to verify the blast radius matches what the plan predicted.
246
+
247
+ ---
248
+
249
+ ## Subagent Briefing Template
250
+
251
+ When spawning any subagent for this planning process, **include the following block verbatim** — subagents do not inherit your instructions.
252
+
253
+ ```
254
+ ## Code Intelligence Tool — Required
255
+
256
+ You have the `scip-query` CLI for compiler-resolved code intelligence. Use it for ALL code references — do not use grep, rg, Read, or cat.
257
+
258
+ ### scip-query commands (48 total)
259
+
260
+ Navigation:
261
+ - `scip-query code <symbol>` — read source code (bounded to definition range)
262
+ - `scip-query code <symbol> -C 5` — read source with 5 extra context lines
263
+ - `scip-query symbols <file>` — all symbols in a file with line ranges + signatures
264
+ - `scip-query files <pattern>` — find files by name
265
+ - `scip-query refs <symbol>` — every file referencing a symbol
266
+ - `scip-query trace <symbol>` — definition + signature + all references
267
+ - `scip-query call-graph <symbol>` — incoming callers + outgoing callees
268
+ - `scip-query system <module>` — full module map: files, symbols, deps in/out
269
+ - `scip-query surface <module>` — symbols consumers actually use
270
+
271
+ Dependencies & Impact:
272
+ - `scip-query deps <file>` — files this file depends on
273
+ - `scip-query rdeps <file>` — files that depend on this file
274
+ - `scip-query affected <symbol>` — transitive closure of breakage
275
+ - `scip-query change-surface <file>` — pre-change risk briefing
276
+ - `scip-query diff-impact` — git diff impact analysis
277
+
278
+ Analysis:
279
+ - `scip-query complexity <symbol>` — branches, cyclomatic estimate, fan-in/out
280
+ - `scip-query dataflow <symbol>` — definition sites, usage sites, producers, consumers
281
+ - `scip-query slice <symbol>` — backward slice (what affects this)
282
+ - `scip-query slice <symbol> --forward` — forward slice (what this affects)
283
+ - `scip-query similar <symbol>` — find functions with similar callee patterns
284
+ - `scip-query convergence <a> <b>` — refactoring prescription for similar pair
285
+
286
+ Quality:
287
+ - `scip-query health` — composite codebase health report
288
+ - `scip-query dead --min-loc 10` — find dead code
289
+ - `scip-query bottlenecks` — coupling pressure points
290
+ - `scip-query complexity-hotspots` — riskiest symbols
291
+ - `scip-query cycles` — circular dependencies
292
+
293
+ Full command reference: /Users/aydansalois/Documents/GitHub/scip-query/README.md
294
+ Agent workflows guide: /Users/aydansalois/Documents/GitHub/scip-query/docs/AGENT_GUIDE.md
295
+
296
+ ### Rules
297
+ - Use scip-query for ALL discovery. Do NOT use grep, rg, or Read.
298
+ - To read source code, use `scip-query code <symbol>`.
299
+ - Every file path, line number, and behavioral claim must cite the specific scip-query command that produced it.
300
+ - If you cannot verify a claim with scip-query, say so explicitly — do not guess.
301
+ - Your output will be rejected if it contains findings without scip-query citations.
302
+ ```
303
+
304
+ **Reject any subagent output that cites grep, rg, cat, or Read as evidence instead of scip-query.**
305
+
306
+ ---
307
+
308
+ ## Output Format
309
+
310
+ The plan is a single markdown file with:
311
+
312
+ 1. Title and date
313
+ 2. Problem statement (what, why, target state)
314
+ 3. Design phases (numbered checklists with Source fields)
315
+ 4. Stress-test findings (inline with the relevant phase or as addenda)
316
+ 5. Execution order (dependency graph between phases)
317
+ 6. Ship order (recommended deployment sequence, one-way doors flagged)
318
+ 7. Summary (files modified/created/deleted, net code delta)