scip-query 0.18.0 → 0.19.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 (290) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +1 -0
  3. package/dist/augment-vue-worker.js +1 -1
  4. package/dist/{chunk-OTTHMUMV.js → chunk-2FAJTZSX.js} +2 -2
  5. package/dist/{chunk-EJ65IVPV.js → chunk-2ZNZSNVW.js} +2 -2
  6. package/dist/chunk-35NLDRZC.js +2 -0
  7. package/dist/{chunk-QPF7CS5W.js → chunk-3KQOIXLO.js} +2 -2
  8. package/dist/{chunk-VCRMI56V.js → chunk-3OSRXJKK.js} +2 -2
  9. package/dist/chunk-42QYU6FD.js +3 -0
  10. package/dist/{chunk-ODH4FT3P.js → chunk-4ZCNFENR.js} +2 -2
  11. package/dist/{chunk-GWCW25ON.js → chunk-4ZHJAHLE.js} +2 -2
  12. package/dist/chunk-547VY366.js +18 -0
  13. package/dist/{chunk-NX2YAXVQ.js → chunk-54UYBTZW.js} +2 -2
  14. package/dist/{chunk-7ROLM67J.js → chunk-6DHPQS72.js} +2 -2
  15. package/dist/chunk-6SHX42QQ.js +6 -0
  16. package/dist/{chunk-ABDXTPCT.js → chunk-7EI4MU5A.js} +2 -2
  17. package/dist/{chunk-J7IMQRCU.js → chunk-7FG5M53V.js} +2 -2
  18. package/dist/chunk-A45K6VUK.js +2 -0
  19. package/dist/{chunk-MPBN5DO4.js → chunk-AEDB4WXE.js} +2 -2
  20. package/dist/{chunk-O5A7BTMA.js → chunk-AERYQJ52.js} +2 -2
  21. package/dist/chunk-AM2LGOEX.js +3 -0
  22. package/dist/{chunk-43QUXX3E.js → chunk-AWSRND4W.js} +2 -2
  23. package/dist/{chunk-5GAUXLOE.js → chunk-BOXAKNN6.js} +2 -2
  24. package/dist/{chunk-IKMOYFUM.js → chunk-BYPVNKJT.js} +2 -2
  25. package/dist/chunk-DQIJMKNE.js +3 -0
  26. package/dist/{chunk-K65T4TJS.js → chunk-DV6B262O.js} +2 -2
  27. package/dist/chunk-DWN7QDTV.js +26 -0
  28. package/dist/{chunk-HOZ3IXZ5.js → chunk-EZGT3NJX.js} +2 -2
  29. package/dist/{chunk-SW7LKHRU.js → chunk-EZHARAL4.js} +2 -2
  30. package/dist/chunk-F334Z5UA.js +38 -0
  31. package/dist/{chunk-SWJEREML.js → chunk-F5L7WEZF.js} +2 -2
  32. package/dist/{chunk-5CJ6AQN7.js → chunk-FLIF3JWA.js} +2 -2
  33. package/dist/chunk-FMC3BI4I.js +2 -0
  34. package/dist/{chunk-YMFHC5J2.js → chunk-G6QQCX45.js} +2 -2
  35. package/dist/{chunk-35TZERMO.js → chunk-G6RQVDTI.js} +2 -2
  36. package/dist/chunk-GBB2RUDN.js +927 -0
  37. package/dist/{chunk-LL5NQB5V.js → chunk-GJ3FR5WG.js} +2 -2
  38. package/dist/chunk-GMZYT44R.js +5 -0
  39. package/dist/{chunk-OQFPCIXO.js → chunk-GNJHHPZE.js} +2 -2
  40. package/dist/chunk-HOXI4F5I.js +4 -0
  41. package/dist/{chunk-PV3GKBO5.js → chunk-IWK562KR.js} +2 -2
  42. package/dist/chunk-IXORBCMR.js +120 -0
  43. package/dist/chunk-J3U47L4Q.js +2 -0
  44. package/dist/{chunk-O5Y3ISO3.js → chunk-J65FQLDL.js} +2 -2
  45. package/dist/{chunk-45QWQSWS.js → chunk-J6BR4MD6.js} +2 -2
  46. package/dist/{chunk-J7WYG63U.js → chunk-JFGUBZWE.js} +2 -2
  47. package/dist/{chunk-FMD46HAG.js → chunk-KD6TPIXM.js} +2 -2
  48. package/dist/{chunk-3M2UCPFS.js → chunk-KHE7J5ZN.js} +1 -1
  49. package/dist/{chunk-IG6X65MG.js → chunk-KWBA6FDD.js} +2 -2
  50. package/dist/{chunk-LADYDOS5.js → chunk-LJD7V7UO.js} +2 -2
  51. package/dist/{chunk-D5F3IQYP.js → chunk-MDDF67O2.js} +2 -2
  52. package/dist/{chunk-BAMVG4WQ.js → chunk-MFBXBLHA.js} +2 -2
  53. package/dist/{chunk-VXDMXZKC.js → chunk-MTFHE7ZO.js} +2 -2
  54. package/dist/chunk-NEG77KKH.js +4 -0
  55. package/dist/{chunk-WA64GKWB.js → chunk-NH7WNNQC.js} +3 -3
  56. package/dist/{chunk-K3UVTL3J.js → chunk-OGHGTD6Z.js} +2 -2
  57. package/dist/chunk-OYYZLJVT.js +2 -0
  58. package/dist/{chunk-MNRKD3WP.js → chunk-PAZFJMXB.js} +2 -2
  59. package/dist/{chunk-U244OVE6.js → chunk-PBADFBRR.js} +2 -2
  60. package/dist/{chunk-UWR52GNZ.js → chunk-PKAPOFF5.js} +2 -2
  61. package/dist/{chunk-POGZSZPX.js → chunk-PXJIEMND.js} +2 -2
  62. package/dist/{chunk-PZV2PGBR.js → chunk-QB5WSOTY.js} +2 -2
  63. package/dist/{chunk-MN54AGZ3.js → chunk-QHOUNTDZ.js} +2 -2
  64. package/dist/chunk-QN67MWDU.js +2 -0
  65. package/dist/{chunk-JLZUM476.js → chunk-QNMOZ3CJ.js} +2 -2
  66. package/dist/{chunk-AWYKDRYV.js → chunk-RIGY5DDE.js} +2 -2
  67. package/dist/chunk-RJLU7IMR.js +10 -0
  68. package/dist/{chunk-AV54WZUK.js → chunk-S65OEY2G.js} +2 -2
  69. package/dist/chunk-SATRCB5O.js +20 -0
  70. package/dist/chunk-T5CSWYAZ.js +2 -0
  71. package/dist/{chunk-H4T2AST4.js → chunk-TC3X33N6.js} +2 -2
  72. package/dist/{chunk-3CJXFMR5.js → chunk-TCVRJ56J.js} +2 -2
  73. package/dist/{chunk-7XP7ZRSI.js → chunk-TDGCALH6.js} +2 -2
  74. package/dist/chunk-TDZXQAH7.js +2 -0
  75. package/dist/{chunk-SUYCF4SX.js → chunk-TOYQTO44.js} +2 -2
  76. package/dist/chunk-UJL3N6TC.js +5 -0
  77. package/dist/chunk-UVMME4FI.js +16 -0
  78. package/dist/{chunk-6JSTKSZH.js → chunk-UXOVHGT6.js} +2 -2
  79. package/dist/chunk-VV5WJLRO.js +67 -0
  80. package/dist/{chunk-GTANVH72.js → chunk-WT7TOU2C.js} +2 -2
  81. package/dist/{chunk-4FLF7BHJ.js → chunk-X36LKKVG.js} +2 -2
  82. package/dist/{chunk-OSBLECSI.js → chunk-X3OOU7CF.js} +2 -2
  83. package/dist/chunk-X65VYV2S.js +2 -0
  84. package/dist/chunk-XBN5VO53.js +2 -0
  85. package/dist/{chunk-TLTLJ4SW.js → chunk-XDSB47KO.js} +2 -2
  86. package/dist/{chunk-4L4X66GE.js → chunk-XDVT7QPG.js} +2 -2
  87. package/dist/chunk-XESK6725.js +2 -0
  88. package/dist/{chunk-P4L5QQT5.js → chunk-XPYXEEDO.js} +2 -2
  89. package/dist/{chunk-T4P27T6S.js → chunk-XTSVYYAL.js} +2 -2
  90. package/dist/{chunk-27YDE22N.js → chunk-YBAC3RON.js} +2 -2
  91. package/dist/{chunk-2DBY4MO7.js → chunk-YHYTDWFT.js} +2 -2
  92. package/dist/chunk-YYR7ADNB.js +2 -0
  93. package/dist/chunk-ZL5Y23AJ.js +3 -0
  94. package/dist/{chunk-CMLHZWRS.js → chunk-ZNSLF5AC.js} +2 -2
  95. package/dist/chunk-ZXWFN7CK.js +2 -0
  96. package/dist/cli.js +2 -2
  97. package/dist/{command-descriptors-AQWWJNTT.js → command-descriptors-SWFWGIFK.js} +173 -167
  98. package/dist/{config-types-70s7NxKB.d.ts → config-types-BA3xLCfG.d.ts} +28 -1
  99. package/dist/{db-BBmJ0v3b.d.ts → db-CzA-9_rL.d.ts} +6 -18
  100. package/dist/direct-navigation-RKMPBXMI.js +3 -0
  101. package/dist/{health-CWpFL_6z.d.ts → health-DYy13GAe.d.ts} +3 -1
  102. package/dist/index.d.ts +23 -41
  103. package/dist/index.js +1 -1
  104. package/dist/postinstall.js +1 -1
  105. package/dist/queries/affected.d.ts +2 -2
  106. package/dist/queries/affected.js +1 -1
  107. package/dist/queries/architecture.d.ts +83 -0
  108. package/dist/queries/architecture.js +2 -0
  109. package/dist/queries/bottlenecks.d.ts +2 -2
  110. package/dist/queries/bottlenecks.js +1 -1
  111. package/dist/queries/by-kind.d.ts +2 -2
  112. package/dist/queries/by-kind.js +1 -1
  113. package/dist/queries/call-graph.d.ts +2 -2
  114. package/dist/queries/call-graph.js +1 -1
  115. package/dist/queries/change-surface.d.ts +2 -2
  116. package/dist/queries/change-surface.js +1 -1
  117. package/dist/queries/cleanup-plan.d.ts +2 -2
  118. package/dist/queries/cleanup-plan.js +1 -1
  119. package/dist/queries/co-change.d.ts +2 -2
  120. package/dist/queries/co-change.js +1 -1
  121. package/dist/queries/code.d.ts +2 -2
  122. package/dist/queries/code.js +1 -1
  123. package/dist/queries/complexity-hotspots.d.ts +2 -2
  124. package/dist/queries/complexity-hotspots.js +1 -1
  125. package/dist/queries/complexity.d.ts +2 -2
  126. package/dist/queries/complexity.js +1 -1
  127. package/dist/queries/convergence.d.ts +2 -2
  128. package/dist/queries/convergence.js +1 -1
  129. package/dist/queries/coupling.d.ts +2 -2
  130. package/dist/queries/coupling.js +1 -1
  131. package/dist/queries/cycles.d.ts +2 -2
  132. package/dist/queries/cycles.js +1 -1
  133. package/dist/queries/dataflow.d.ts +2 -2
  134. package/dist/queries/dataflow.js +1 -1
  135. package/dist/queries/dead.d.ts +2 -2
  136. package/dist/queries/dead.js +1 -1
  137. package/dist/queries/decorative-checkers.d.ts +2 -2
  138. package/dist/queries/decorative-checkers.js +1 -1
  139. package/dist/queries/deep-chains.d.ts +2 -2
  140. package/dist/queries/deep-chains.js +1 -1
  141. package/dist/queries/deps.d.ts +2 -2
  142. package/dist/queries/deps.js +1 -1
  143. package/dist/queries/diff-gate.d.ts +5 -3
  144. package/dist/queries/diff-gate.js +1 -1
  145. package/dist/queries/diff-impact.d.ts +2 -2
  146. package/dist/queries/diff-impact.js +1 -1
  147. package/dist/queries/doc-drift.d.ts +2 -2
  148. package/dist/queries/doc-drift.js +1 -1
  149. package/dist/queries/drift.d.ts +27 -10
  150. package/dist/queries/drift.js +1 -1
  151. package/dist/queries/duplicate-bodies.d.ts +2 -2
  152. package/dist/queries/duplicate-bodies.js +1 -1
  153. package/dist/queries/extract-candidates.d.ts +2 -2
  154. package/dist/queries/extract-candidates.js +1 -1
  155. package/dist/queries/fan.d.ts +2 -2
  156. package/dist/queries/fan.js +1 -1
  157. package/dist/queries/files.d.ts +2 -2
  158. package/dist/queries/health.d.ts +3 -3
  159. package/dist/queries/health.js +1 -1
  160. package/dist/queries/hierarchy.d.ts +2 -2
  161. package/dist/queries/hierarchy.js +1 -1
  162. package/dist/queries/hotspots.d.ts +2 -2
  163. package/dist/queries/hotspots.js +1 -1
  164. package/dist/queries/imports.d.ts +2 -2
  165. package/dist/queries/imports.js +1 -1
  166. package/dist/queries/incomplete-migration.d.ts +2 -2
  167. package/dist/queries/incomplete-migration.js +1 -1
  168. package/dist/queries/index.d.ts +5 -4
  169. package/dist/queries/index.js +1 -1
  170. package/dist/queries/isolated.d.ts +2 -2
  171. package/dist/queries/isolated.js +1 -1
  172. package/dist/queries/locality-candidates.d.ts +2 -2
  173. package/dist/queries/locality-candidates.js +1 -1
  174. package/dist/queries/members.d.ts +2 -2
  175. package/dist/queries/members.js +1 -1
  176. package/dist/queries/methods.d.ts +2 -2
  177. package/dist/queries/methods.js +1 -1
  178. package/dist/queries/not-implemented.d.ts +2 -2
  179. package/dist/queries/not-implemented.js +1 -1
  180. package/dist/queries/outline.d.ts +2 -2
  181. package/dist/queries/outline.js +1 -1
  182. package/dist/queries/passthrough-candidates.d.ts +2 -2
  183. package/dist/queries/passthrough-candidates.js +1 -1
  184. package/dist/queries/plan-context.d.ts +2 -2
  185. package/dist/queries/plan-context.js +1 -1
  186. package/dist/queries/react-component-duplicates.d.ts +2 -2
  187. package/dist/queries/react-component-duplicates.js +1 -1
  188. package/dist/queries/react-hook-candidates.d.ts +2 -2
  189. package/dist/queries/react-hook-candidates.js +1 -1
  190. package/dist/queries/react-large-component-pressure.d.ts +2 -2
  191. package/dist/queries/react-large-component-pressure.js +1 -1
  192. package/dist/queries/recent-duplicates.d.ts +2 -2
  193. package/dist/queries/recent-duplicates.js +1 -1
  194. package/dist/queries/redundant-reexports.d.ts +2 -2
  195. package/dist/queries/redundant-reexports.js +1 -1
  196. package/dist/queries/refs.d.ts +2 -2
  197. package/dist/queries/refs.js +1 -1
  198. package/dist/queries/self-audit.d.ts +2 -2
  199. package/dist/queries/self-audit.js +1 -1
  200. package/dist/queries/similar-chains.d.ts +2 -2
  201. package/dist/queries/similar-chains.js +1 -1
  202. package/dist/queries/similar-files.d.ts +2 -2
  203. package/dist/queries/similar-files.js +1 -1
  204. package/dist/queries/similar-signatures.d.ts +2 -2
  205. package/dist/queries/similar-signatures.js +1 -1
  206. package/dist/queries/similar.d.ts +2 -2
  207. package/dist/queries/similar.js +1 -1
  208. package/dist/queries/slice.d.ts +2 -2
  209. package/dist/queries/slice.js +1 -1
  210. package/dist/queries/stale-abstractions.d.ts +2 -2
  211. package/dist/queries/stale-abstractions.js +1 -1
  212. package/dist/queries/stats.d.ts +2 -2
  213. package/dist/queries/surface.d.ts +2 -2
  214. package/dist/queries/surface.js +1 -1
  215. package/dist/queries/symbols.d.ts +2 -2
  216. package/dist/queries/symbols.js +1 -1
  217. package/dist/queries/system.d.ts +2 -2
  218. package/dist/queries/system.js +1 -1
  219. package/dist/queries/test-quality.d.ts +2 -2
  220. package/dist/queries/test-quality.js +1 -1
  221. package/dist/queries/trace.d.ts +2 -2
  222. package/dist/queries/trace.js +1 -1
  223. package/dist/queries/twin-ab.d.ts +2 -2
  224. package/dist/queries/twin-ab.js +1 -1
  225. package/dist/queries/twin-drift.d.ts +2 -2
  226. package/dist/queries/twin-drift.js +1 -1
  227. package/dist/queries/unused-imports.d.ts +2 -2
  228. package/dist/queries/unused-imports.js +1 -1
  229. package/dist/queries/unused-params.d.ts +2 -2
  230. package/dist/queries/unused-params.js +1 -1
  231. package/dist/queries/vue-component-duplicates.d.ts +2 -2
  232. package/dist/queries/vue-component-duplicates.js +1 -1
  233. package/dist/queries/vue-composable-candidates.d.ts +2 -2
  234. package/dist/queries/vue-composable-candidates.js +1 -1
  235. package/dist/queries/vue-large-view-pressure.d.ts +2 -2
  236. package/dist/queries/vue-large-view-pressure.js +1 -1
  237. package/dist/queries/wrapper-candidates.d.ts +2 -2
  238. package/dist/queries/wrapper-candidates.js +1 -1
  239. package/dist/reindex-worker.js +24 -24
  240. package/dist/reindex.d.ts +12 -10
  241. package/dist/reindex.js +38 -38
  242. package/dist/runtime.d.ts +10 -9
  243. package/dist/runtime.js +2 -1
  244. package/dist/rust-semantic-session-server.js +1 -1
  245. package/dist/{scip-cli-CoMzb7Zu.d.ts → scip-cli-1bVKJgXi.d.ts} +1 -1
  246. package/dist/watch-server.js +7 -6
  247. package/docs/AI_FAILURE_MODES.md +1 -0
  248. package/docs/COMMAND_REFERENCE.md +3 -2
  249. package/docs/DETECTOR_GUIDE.md +5 -3
  250. package/docs/analyzer-inventory.md +16 -6
  251. package/docs/analyzer-validation-ledger.md +12 -1
  252. package/docs/architecture-coherence-vision.md +219 -0
  253. package/package.json +5 -1
  254. package/skills/_shared/SKILL.md +4 -3
  255. package/skills/scip-conductor/SKILL.md +1 -1
  256. package/skills/scip-directory-architecture/SKILL.md +116 -2
  257. package/skills/scip-maintainability/SKILL.md +3 -3
  258. package/skills/scip-query/SKILL.md +1 -1
  259. package/skills/scip-twin-drift/SKILL.md +1 -1
  260. package/skills/scip-verify/SKILL.md +1 -1
  261. package/dist/chunk-2GX3TNOW.js +0 -38
  262. package/dist/chunk-45XOH33S.js +0 -2
  263. package/dist/chunk-4MFMTEJ4.js +0 -5
  264. package/dist/chunk-BECOMXAL.js +0 -2
  265. package/dist/chunk-BJJHBKEC.js +0 -2
  266. package/dist/chunk-DDGO34I2.js +0 -26
  267. package/dist/chunk-DUKRAHV2.js +0 -2
  268. package/dist/chunk-EMEXMHOP.js +0 -7
  269. package/dist/chunk-GWNE2WJN.js +0 -3
  270. package/dist/chunk-H4JNB7RT.js +0 -3
  271. package/dist/chunk-L2RE5P3X.js +0 -2
  272. package/dist/chunk-L2TSLMPT.js +0 -5
  273. package/dist/chunk-NQBMGFFD.js +0 -2
  274. package/dist/chunk-OINSINYW.js +0 -2
  275. package/dist/chunk-OM6JHEW3.js +0 -16
  276. package/dist/chunk-OUXPJ4H5.js +0 -3
  277. package/dist/chunk-OWXNDSG3.js +0 -2
  278. package/dist/chunk-Q4UM4JJP.js +0 -2
  279. package/dist/chunk-QEIGJJBC.js +0 -20
  280. package/dist/chunk-R4VPIS4D.js +0 -10
  281. package/dist/chunk-RDX6WWHN.js +0 -4
  282. package/dist/chunk-RUQE7DZT.js +0 -2
  283. package/dist/chunk-S43DIBME.js +0 -18
  284. package/dist/chunk-SALRDXWM.js +0 -121
  285. package/dist/chunk-SMBIGBGN.js +0 -67
  286. package/dist/chunk-VQWDZ34M.js +0 -928
  287. package/dist/chunk-W3557RPL.js +0 -3
  288. package/dist/chunk-W3SKYOTF.js +0 -2
  289. package/dist/chunk-XEEQX5X3.js +0 -3
  290. package/dist/direct-navigation-K3CTVVBU.js +0 -3
@@ -73,15 +73,16 @@ gaps:
73
73
 
74
74
  | Command | Watches the gap between | Evidence |
75
75
  |---|---|---|
76
- | `drift` | a file and its **siblings/architecture** | reference graph: unused imports, layer violations, "no sibling imports this" deviations |
76
+ | `drift` | a file and its **siblings/declared architecture** | reference graph: unused imports, project-owned forbidden boundary edges, "no sibling imports this" deviations |
77
77
  | `doc-drift` | **docs** and the code they describe | doc file-citations + doc↔code co-change history; flags broken references and staleness scores |
78
78
  | `co-change` | two **files** with an invisible contract | git history: pairs that change together with no dependency edge |
79
79
 
80
80
  How to keep them straight: `drift` is structural and intra-code, `doc-drift`
81
81
  is prose-vs-code, `co-change` is code-vs-code where the connection exists only
82
82
  in commit history. The diff gate includes doc/code and hidden-coupling coverage
83
- through the `doc-reference` and `co-change-partner` checks; run `drift`
84
- directly when you need directory-pattern or layer-policy analysis.
83
+ through the `doc-reference` and `co-change-partner` checks; run `drift
84
+ --architecture` when you need direct dependency-rule findings beside boundary
85
+ coverage, reciprocity, and connected-group signals.
85
86
 
86
87
  <!-- BEGIN GENERATED DIFF-GATE CHECKS -->
87
88
  | Check | What it catches | When it runs |
@@ -91,6 +92,7 @@ directly when you need directory-pattern or layer-policy analysis.
91
92
  | `co-change-partner` | Historically coupled files that usually change together but are missing from this diff. | Default diff gate. |
92
93
  | `twin-partner` | A changed symbol has a same-(near-)name twin (identical or already-divergent) elsewhere that this diff left untouched. | Default diff gate. Advisory: findings print but never cause a nonzero exit by themselves. |
93
94
  | `coverage-contract` | A configured `coverageContracts` entry (.scipquery.json) drifted: its declared key set no longer matches its ground-truth source. | Default diff gate, only when either side of a configured contract changed. |
95
+ | `architecture` | A declared architecture boundary rule has a violation absent from the committed health baseline. | Default diff gate when closed dependency rows, requireCompletePolicy, or requireAcyclic are configured and a baseline exists. |
94
96
  | `doc-reference` | Docs that cite changed files and may need a matching update. Dated snapshot docs (docs.snapshotPaths) are excluded by policy. | Default diff gate. Advisory (21.2) for bare file-mention citations; blocking when the citation has a line anchor or the cited file was deleted/renamed. |
95
97
  | `unused-params` | Fresh trailing parameters or options that no changed body uses. | Default diff gate. |
96
98
  | `new-dead` | Changed production symbols with zero indexed consumers. | Default diff gate. |
@@ -20,7 +20,7 @@ The action tiers are:
20
20
 
21
21
  ## Current Surfaces
22
22
 
23
- The published query surface and private query-helper manifest live in `src/queries/public-query-entries.ts`. The CLI command order and families live in `src/runtime/commands/query-command-specs.ts`. The composite health score runs the phases listed in `HEALTH_PHASES` in `src/queries/health/health.ts`; that health path also carries the full-vs-bounded semantic enrichment budget used by semantic-capable detectors. The diff gate runs the default diff-scoped checks listed in `DIFF_GATE_CHECKS` in `src/queries/impact/diff-gate.ts`; the baseline policy helper remains private to the query tree and runs only for the explicit full health-baseline ratchet. The `tla` command is also ordered in that command registry as an on-demand formal-model verifier, not as a health-scored analyzer.
23
+ The published query surface and private query-helper manifest live in `src/queries/public-query-entries.ts`. The CLI command order and families live in `src/runtime/commands/query-command-specs.ts`. The composite health score runs the phases listed in `HEALTH_PHASES` in `src/queries/health/health.ts`; that health path also carries the full-vs-bounded semantic enrichment budget used by semantic-capable detectors. The diff gate runs the default diff-scoped checks listed in `DIFF_GATE_CHECKS` in `src/queries/impact/diff-gate.ts`; its private baseline-policy helper supplies evidence for both the narrow default architecture ratchet and the opt-in full health-baseline ratchet. The `tla` command is also ordered in that command registry as an on-demand formal-model verifier, not as a health-scored analyzer.
24
24
 
25
25
  An earlier `health --json` run on this repository reported:
26
26
 
@@ -52,7 +52,7 @@ The declared-coupling config has been refreshed after the inventory surfaced old
52
52
  | `wrapper-candidates` | Small production callables with one real external caller, caller fan-in, and boundary-token evidence | Hygiene | Contextual signal, sometimes direct | Single-caller wrappers can be needless indirection, but may also be names, domain/lifecycle boundaries, test seams, or API shaping. Boundary evidence discounts those without hiding them. |
53
53
  | `passthrough-candidates` | Small production callables with exactly one callee, literal pass-through body, runtime-boundary evidence, public-facade evidence, action tier, recommendation, and score count | Hygiene, with `scoreCount` discount | Direct when no boundary or public-facade evidence is present; contextual signal when either exists | Body-shape gate is real. Boundary evidence distinguishes adapter, provider, public, capability, transport, lifecycle, access-policy, and facade-shaped forwarders; public-facade evidence separately identifies package-public or rooted exported passthroughs. |
54
54
  | `stale-abstractions` | Type-like definitions, real consumers, barrel consumers, transitive reachability, definer usage, confidence, staleness kind, action tier, and recommendation | Hygiene | Direct for unused abstractions; contextual signal for one-consumer ownership rows | `0 consumers` is direct repair. `1 consumer` is contextual, including high-confidence misplaced types, because the repair may be move, inline, keep, or document as public contract. |
55
- | `drift` | File dep graph, symbol ref graph, semantic/source import usage, explicit or inferred layer policy, sibling patterns, action tier, policy basis, recommendation | Hygiene | Split by kind | `unused-import` is direct repair. Explicit `layer-violation` is direct; inferred layer policy and `pattern-deviation` rows are contextual signal. Pattern deviations remain excluded from health scoring. |
55
+ | `drift` | File dep graph, symbol ref graph, semantic/source import usage, project-owned architecture report, sibling patterns, action tier, policy basis, recommendation | Hygiene | Split by kind | `unused-import` and grouped `architecture-violation` rows are direct repair. `pattern-deviation` rows are contextual signals and remain excluded from health scoring. Undeclared boundary edges, reciprocity, and connected groups appear only in architecture context. |
56
56
  | `complexity-hotspots` | Production callable LOC, fan-in, fan-out, callee count | Risk | Direct repair pressure | Complexity pressure usually means refactor, but the current score is structural, not cyclomatic. It should be separate from branch-count complexity. |
57
57
  | `co-change` / hidden coupling | Git co-change pairs, dependency edges, declared couplings, file noise filters, partner-class labels, declared-coupling suggestions, commit scope, recency context, commit-subject context, and score-weighted count | Risk, weighted by history strength | Contextual signal | Strong evidence that coordination may be missing, but not proof that extraction or unification is correct. Partner classes, history context, subject context, and score weighting now separate contract-like focused current pairs from broad, stale, or unlabeled history before suggesting declared coupling. |
58
58
  | Suppression inventory | `scip-query: ignore-*` comments in source, plus structured `.scipquery.json` suppressions | Evidence quality axis | Meta signal | Useful precision feedback. High suppressions should reduce trust or weight for that detector family. Structured file-scoped suppressions now validate path freshness. |
@@ -94,6 +94,7 @@ The declared-coupling config has been refreshed after the inventory surfaced old
94
94
  | `hotspots` | Most referenced symbols | Support/contextual signal | Identifies choke points. Not a smell alone. |
95
95
  | `fan-in` / `fan-out` | Reference counts into symbols or out of files | Support analysis | Raw graph metrics. |
96
96
  | `coupling` | Shared symbols between two files or top coupled pairs, coupling kind, action tier, evidence reasons, recommendation | Contextual signal | May reveal boundary problems, but shared symbols can be intended. Output now makes the coordination-pressure interpretation explicit. |
97
+ | `architecture` | Project-owned boundary paths and dependency rules applied to resolved import and re-export edges, with mapping coverage, policy-row coverage, edge breadth, reciprocity, and SCCs | Split by evidence | Forbidden edges, required-but-missing policy rows, and cycles under `requireAcyclic` are direct policy findings. Unmapped files, reciprocity, and advisory cycles remain report-only signals. |
97
98
  | `deep-chains` | Longest dependency chains after SCC condensation, suffix de-duplication, chain kind, action tier, evidence reasons, recommendation | Contextual signal | Long chains imply propagation risk, but action depends on layers and ownership. Strict suffix duplicates are now removed from top results. |
98
99
  | `complexity` | Branch count, cyclomatic estimate, callee count, fan-in, fan-out for one symbol | Direct repair pressure | This is closer to the user-specified "cyclomatic complexity" analyzer than `complexity-hotspots`. Should score strongly when branches/cyclomatic exceed thresholds. |
99
100
  | `self-audit` | Cheap evidence paths checked against TypeScript compiler oracle | Meta analysis | Measures analyzer accuracy. Should guide trust/weight, not code health directly. |
@@ -128,8 +129,8 @@ The remaining conceptual overlap is mostly healthy, but needs product labels:
128
129
  | Similarity and reuse | `similar`, `similar-files`, `similar-chains`, `similar-signatures`, `convergence`, React/Vue duplicates, `recent-duplicates`, `echo` | Distinct evidence bases. The risk is UX confusion, not implementation duplication. | Keep separate, but expose basis, action tier, and root-cause groups where pairwise rows repeat. |
129
130
  | Extraction pressure | `extract-candidates`, React/Vue behavior candidates, large component/view pressure, `incomplete-migration` | Different stages: discover seam, detect duplicated behavior, detect excessive size, catch unfinished migration. | Score unfinished migrations higher than discovery leads. |
130
131
  | Indirection | `wrapper-candidates`, `passthrough-candidates`, `stale-abstractions` | Related but not the same: single caller, literal forwarding, low-consumer types. | Passthrough and wrapper rows now split by boundary evidence; stale should split by confidence. |
131
- | Architecture/history drift | `drift`, `doc-drift`, `co-change`, `co-change-partner`, `doc-reference` | Same broad problem of things moving out of sync, but sources differ. | Co-change should remain signal; doc-reference is direct only for behavioral cited claims and support for configuration examples or intentional records. |
132
- | Graph risk | `fan-in`, `fan-out`, `hotspots`, `bottlenecks`, `coupling`, `deep-chains`, `change-surface`, `affected` | Mostly layered views of graph pressure. | Treat as support/context, except `cycles` and high cyclomatic complexity. |
132
+ | Architecture/history drift | `architecture`, `drift`, `doc-drift`, `co-change`, `co-change-partner`, `doc-reference` | Same broad problem of things moving out of sync, but sources differ. | Explicit architecture rules are direct; co-change remains signal; doc-reference strength depends on citation kind. |
133
+ | Graph risk | `architecture`, `fan-in`, `fan-out`, `hotspots`, `bottlenecks`, `coupling`, `deep-chains`, `change-surface`, `affected` | Mostly layered views of graph pressure. | Treat inferred graph shape as support/context; declared forbidden edges and acyclicity violations are direct policy disagreements. |
133
134
 
134
135
  ## Score Model Implications
135
136
 
@@ -146,8 +147,8 @@ Recommended model:
146
147
 
147
148
  Suggested initial tier map:
148
149
 
149
- - Direct: `cleanup-plan`, `dead-code`, `isolated`, `real cycles`, `unused-params`, `new-dead`, `incomplete-migration`, behavioral/current `doc-reference` claims, broken `doc-drift` references, `redundant-reexports` with zero consumers, direct passthrough rows with no boundary or public-facade role, `unused-import` drift, high branch/cyclomatic `complexity`, large React/Vue pressure.
150
- - Signal: `co-change`, `co-change-partner`, ordinary `similar`, `similar-files`, `similar-chains`, `similar-signatures`, `convergence`, `extract-candidates`, `locality-candidates`, `wrapper-candidates`, `passthrough-candidates` with boundary or public-facade roles, single-consumer `stale-abstractions`, React/Vue duplicate or behavior candidates, bottlenecks, hotspots, coupling, deep chains, inferred layer or pattern drift, doc staleness from churn.
150
+ - Direct: `cleanup-plan`, `dead-code`, `isolated`, `real cycles`, `unused-params`, `new-dead`, `incomplete-migration`, behavioral/current `doc-reference` claims, broken `doc-drift` references, `redundant-reexports` with zero consumers, direct passthrough rows with no boundary or public-facade role, `unused-import` drift, declared `architecture-violation` drift, high branch/cyclomatic `complexity`, large React/Vue pressure.
151
+ - Signal: `co-change`, `co-change-partner`, ordinary `similar`, `similar-files`, `similar-chains`, `similar-signatures`, `convergence`, `extract-candidates`, `locality-candidates`, `wrapper-candidates`, `passthrough-candidates` with boundary or public-facade roles, single-consumer `stale-abstractions`, React/Vue duplicate or behavior candidates, bottlenecks, hotspots, coupling, deep chains, undeclared/reciprocal/connected architecture context, pattern drift, doc staleness from churn.
151
152
  - Support: navigation commands, `affected`, `change-surface`, `plan-context`, `stats`, `self-audit`, suppression inventory, baseline comparison mechanics, configuration-example and intentional-record `doc-reference` rows.
152
153
 
153
154
  ## Directory Locality Analyzer
@@ -262,3 +263,12 @@ semantic parity slice. Health still owns the composite phase inventory and
262
263
  score model, and it now threads semantic enrichment through the health budget:
263
264
  full/default health enables semantic facts, while bounded large-index health
264
265
  can explicitly disable them.
266
+
267
+ ## 2026-07-23 Architecture Coherence Follow-Up
268
+
269
+ The public query manifest and command-order references remain canonical after
270
+ the graph family gained `architecture`. The command applies project-owned
271
+ boundary paths and dependency rows to import-only file edges, retaining edge
272
+ breadth and representative files. It is report-only in this slice: inferred
273
+ reciprocity and strongly connected groups do not affect health or diff-gate,
274
+ and an unconfigured repository receives no implicit source-layer policy.
@@ -72,7 +72,7 @@ The canonical source is `src/runtime/commands/query-command-specs.ts:11-78`, whe
72
72
  - Direct cleanup and deletion analyzers: `dead`, `isolated`, `unused-imports`, `cleanup-plan`, `unused-params`, `passthrough-candidates`, `redundant-reexports`
73
73
  - Similarity, reuse, extraction, and locality analyzers: `similar`, `similar-files`, `similar-chains`, `similar-signatures`, `recent-duplicates`, `duplicate-bodies`, `twin-drift`, `twin-ab`, `extract-candidates`, `locality-candidates`, `wrapper-candidates`, `stale-abstractions`, `doc-drift`, `drift`, `convergence`
74
74
  - Frontend analyzers: `react-component-duplicates`, `react-hook-candidates`, `react-large-component-pressure`, `vue-component-duplicates`, `vue-composable-candidates`, `vue-large-view-pressure`
75
- - Graph, risk, and complexity analyzers: `hotspots`, `fan-in`, `fan-out`, `coupling`, `cycles`, `bottlenecks`, `deep-chains`, `complexity-hotspots`, `complexity`
75
+ - Graph, risk, and complexity analyzers: `architecture`, `hotspots`, `fan-in`, `fan-out`, `coupling`, `cycles`, `bottlenecks`, `deep-chains`, `complexity-hotspots`, `complexity`
76
76
  - Diff, impact, and planning analyzers: `affected`, `change-surface`, `co-change`, `diff-gate`, `incomplete-migration`, `plan-context`
77
77
  - Formal model verification: `tla`
78
78
  - Meta and action commands: `self-audit`, `cleanup-apply`
@@ -364,3 +364,14 @@ repository-dead candidates, while `file-internal`, other detector families,
364
364
  Rust, Python, and the aggregate health score retain independent status. The
365
365
  full evidence is in
366
366
  `docs/validation/2026-07-10-typescript-dead-certification.md`.
367
+
368
+ ## 2026-07-23 Architecture Coherence Follow-Up
369
+
370
+ `src/runtime/commands/query-command-specs.ts` remains the canonical public
371
+ query order after adding `architecture` to the graph family. The enforcement
372
+ follow-up replaced drift's repository-specific policy with project-owned
373
+ configuration and added stable boundary-pair identities to the shared health
374
+ baseline. The default diff gate now blocks only new configured forbidden edges
375
+ or explicitly forbidden cycles; accepted existing identities remain ratcheted.
376
+ Reciprocal pairs, unmapped files, undeclared edges, and undeclared cycles remain
377
+ contextual signals until external calibration.
@@ -0,0 +1,219 @@
1
+ # Architecture Coherence Vision
2
+
3
+ ## Purpose
4
+
5
+ scip-query should help a maintainer answer two different questions:
6
+
7
+ 1. What architecture does this codebase actually have?
8
+ 2. Where does the implementation contradict the architecture the project intends to preserve?
9
+
10
+ The dependency graph can answer neither question alone. It records which files rely on which other files. Architectural judgment connects those facts to the real responsibilities, public contracts, runtime boundaries, and maintenance work that gave the code its structure.
11
+
12
+ The product vision is therefore a combination of:
13
+
14
+ - an `architecture` query that measures declared boundaries and dependency rules;
15
+ - a directory-architecture skill that helps an agent discover, name, test, and gradually enforce those rules;
16
+ - drift and health integrations that expose architectural changes without pretending every unusual import is a defect.
17
+
18
+ ## Vocabulary
19
+
20
+ An architectural boundary is a named group of code with one stable reason to change, such as a domain model, rendering subsystem, persistence adapter, compiler frontend, or deployable service. A folder often represents a boundary, but a folder is only evidence of one: the decisive fact is the responsibility its files jointly serve.
21
+
22
+ A dependency edge is a directed relationship from code that relies on something to the code it relies on. For an import, `A -> B` means file A imports file B. The direction matters because changes to B can force changes in A.
23
+
24
+ A boundary edge is the same relationship after file edges are grouped by their architectural boundaries. Ten imports from UI files into domain files form one `ui -> domain` boundary edge with ten pieces of file-level evidence.
25
+
26
+ An allowed edge is a boundary dependency that agrees with a declared rule. A forbidden edge is an actual dependency that contradicts a declared rule about which responsibilities may rely on which others. Files being far apart or living under different directories does not by itself make the edge forbidden.
27
+
28
+ A reciprocal dependency is a pair of boundary edges in both directions, such as `source -> parser` and `parser -> source`. It is a review signal because neither boundary can change independently, but it can be intentional when the named boundaries are really one subsystem or meet through a deliberately shared contract.
29
+
30
+ A strongly connected component is a group of boundaries where every member can reach every other member through dependency edges. Its essential consequence is mutual change pressure: no member is directionally independent of the group. A component with many boundaries is evidence that the current names may not describe real separation.
31
+
32
+ A cycle-break candidate is a boundary edge inside a dependency cycle whose small amount of file-level evidence makes it a plausible place to inspect first. It is not automatically the correct edge to remove; a single import can expose either an accidental shortcut or a legitimate contract that the boundary model failed to name.
33
+
34
+ An architecture policy is the project-owned configuration that names boundaries and records dependency directions the maintainers are prepared to defend. Its rules are stronger than inferred folder conventions because the project explicitly chose them.
35
+
36
+ An architecture ratchet is an enforcement rule that permits recorded existing debt while preventing new violations. It lets a large codebase improve incrementally without requiring a speculative rewrite before the policy becomes useful.
37
+
38
+ Architectural coherence is the degree to which actual dependencies, named responsibilities, and declared dependency rules describe the same system. The tool should report the evidence needed to improve that alignment, not reduce coherence to a single score.
39
+
40
+ ## Why `drift` Is Not Enough
41
+
42
+ Drift is movement away from a reference state or established pattern. A system can be statically incoherent without having changed recently, and it can change while remaining coherent. Therefore architecture needs a first-class report rather than being hidden inside `drift`.
43
+
44
+ `scip-query architecture` owns the complete boundary graph and policy
45
+ evaluation. `scip-query drift --architecture` reuses that report to show
46
+ direct declared violations together with mapping coverage and report-only
47
+ signals; it does not maintain a second policy engine.
48
+
49
+ Before this work, the source-layer table in
50
+ `src/queries/cleanup/drift-policy.ts` embedded repository-specific knowledge in
51
+ a general-purpose command. An unrelated repository using folders such as
52
+ `src/core` and `src/runtime` could therefore inherit scip-query's rules. That
53
+ table has now been removed: drift consumes only explicit project
54
+ configuration, and an unconfigured repository receives no architecture
55
+ violations.
56
+
57
+ ## Configuration Model
58
+
59
+ The first configuration shape should be small enough to understand without learning a policy language:
60
+
61
+ ```json
62
+ {
63
+ "architecture": {
64
+ "boundaries": [
65
+ { "name": "domain", "paths": ["src/domain/**"] },
66
+ { "name": "source", "paths": ["src/source/**"] },
67
+ { "name": "runtime", "paths": ["src/runtime/**"] }
68
+ ],
69
+ "allowedDependencies": {
70
+ "domain": [],
71
+ "source": ["domain"],
72
+ "runtime": ["domain", "source"]
73
+ },
74
+ "requireCompletePolicy": true,
75
+ "requireAcyclic": true
76
+ }
77
+ }
78
+ ```
79
+
80
+ A boundary row names code; it does not yet prohibit anything. An `allowedDependencies` row is closed: when a row exists for `source`, every cross-boundary dependency not listed in that row is forbidden. A missing row means the project has not made a rule for that boundary yet. Same-boundary dependencies remain allowed.
81
+
82
+ This distinction lets a large repository describe mature boundaries first while leaving emerging or disputed areas in discovery mode.
83
+
84
+ `requireCompletePolicy` turns that gradual-discovery model into a finished
85
+ contract: every configured boundary must have a closed row, including an empty
86
+ row for a boundary that may depend on nothing. `requireAcyclic` independently
87
+ forbids multi-boundary strongly connected components. A project should enable
88
+ both only after the observed graph has been classified and repaired.
89
+
90
+ ## What the Analyzer Should Report
91
+
92
+ The report should preserve both policy truth and graph evidence:
93
+
94
+ - mapped, unmapped, and ambiguously mapped files;
95
+ - boundary edges with importer count, imported-file count, total file-edge count, and representative file edges;
96
+ - forbidden edges, grouped by boundary pair rather than emitted as a flood of individual imports;
97
+ - reciprocal boundary pairs;
98
+ - strongly connected boundary components;
99
+ - the narrowest internal edges to inspect first for each component;
100
+ - policy coverage: which boundaries have closed dependency rows and which remain descriptive only.
101
+ - resolved `export ... from` dependencies as well as ordinary imports, so
102
+ published barrel and package surfaces are governed;
103
+
104
+ The output tiers should remain explicit:
105
+
106
+ - **Direct finding:** an actual edge contradicts a declared rule, or a declared acyclicity rule is violated.
107
+ - **Signal:** reciprocity, a large connected component, low policy coverage, an unmapped file, or a narrow cycle-break candidate.
108
+
109
+ Inferred signals should not reduce health scores or block diffs until external calibration shows that acting on them reliably improves real codebases.
110
+
111
+ ## Applying This to an Existing Large Codebase
112
+
113
+ The tool cannot discover the “best architecture” by optimizing graph shape. The best available architecture is the clearest model that preserves the system's real responsibilities and necessary behavior while reducing accidental change pressure. Finding it requires a staged investigation.
114
+
115
+ ### 1. Inventory the system's referents
116
+
117
+ Read the repository guidance, package manifests, deployable entry points, routes, public exports, databases, message boundaries, tests, and build graph. Use scip-query to map consumers, dependencies, change surfaces, cycles, locality candidates, and historical co-change.
118
+
119
+ This identifies what the code actually does and which units already behave as maintenance units.
120
+
121
+ ### 2. Name candidate boundaries
122
+
123
+ Do not assume every top-level directory is a layer. A layer is a responsibility ordered by dependency direction, such as presentation over application over domain. A subsystem is a responsibility that owns an end-to-end capability, such as authentication or a compiler. A package is a publication or build unit. A service is an independently running unit.
124
+
125
+ The architecture model may contain all four. The useful name is the one that predicts why its code changes and what it may depend on.
126
+
127
+ ### 3. Classify boundary maturity
128
+
129
+ - A mature boundary is repeatedly expressed by code, documentation, tests, entry points, ownership, or history.
130
+ - An emerging boundary has a coherent responsibility but inconsistent placement or dependencies.
131
+ - An accidental boundary is mainly a convenience bucket, legacy pile, generated directory, or recent edit cluster.
132
+
133
+ Only mature boundaries should receive closed dependency rules initially.
134
+
135
+ ### 4. Build a descriptive model first
136
+
137
+ Add boundary path patterns without `allowedDependencies` rows. Run `scip-query architecture --json` to inspect mapping coverage, actual boundary edges, reciprocal pairs, and connected components.
138
+
139
+ Revise names and path membership when the graph reveals that a supposed boundary has no independent responsibility or that one responsibility is split across several folders.
140
+
141
+ ### 5. Declare the rules supported by evidence
142
+
143
+ For each mature boundary, state which other boundaries it is allowed to depend on and why. Record uncertain edges as unresolved decisions instead of silently allowing the entire current graph.
144
+
145
+ Run the report again. A forbidden edge is now a testable disagreement between implementation and policy, not the tool's opinion about directory distance.
146
+
147
+ ### 6. Baseline and ratchet
148
+
149
+ Record reviewed existing violations with `scip-query health
150
+ --write-baseline`. Architecture identities name a forbidden boundary pair or
151
+ an explicitly forbidden boundary cycle, so moving a representative file does
152
+ not churn the ratchet. The default `scip-query diff-gate` architecture check
153
+ then rejects new identities while preserving visibility into recorded debt.
154
+ This turns architecture from a one-time diagram into a maintained contract.
155
+
156
+ ### 7. Migrate narrow seams
157
+
158
+ Start with a narrow edge whose few file dependencies cross a mature rule. Determine whether the right repair is to move code, invert a dependency, extract a genuinely shared contract, combine falsely separated boundaries, or revise the policy.
159
+
160
+ Verify each slice with tests, typechecking, incomplete-migration checks, architecture analysis, and diff-gate before taking the next one.
161
+
162
+ ## Example: Vega 2.0
163
+
164
+ For a codebase the size of Vega 2.0, the first pass should not invent a universal stack of layers. It should:
165
+
166
+ 1. identify workspace packages, applications, servers, public entry points, data stores, and major feature or compiler/rendering subsystems;
167
+ 2. map actual dependency traffic between those units;
168
+ 3. read the architecture and ownership claims already present in docs and package surfaces;
169
+ 4. classify candidate boundaries as mature, emerging, or accidental;
170
+ 5. configure the mature boundaries descriptively;
171
+ 6. inspect reciprocal pairs and large connected components with their file-edge breadth;
172
+ 7. close dependency rows only where the intended direction is supported;
173
+ 8. baseline existing violations and prevent new ones;
174
+ 9. migrate one narrow, high-confidence seam at a time.
175
+
176
+ The initial result may be a mixture of layers and subsystems. That is preferable to forcing a neat diagram that contradicts the software. The model becomes stronger as verified migrations and maintenance history provide new facts.
177
+
178
+ ## Delivery Sequence
179
+
180
+ ### Slice 1: explicit measurement — implemented
181
+
182
+ - Add architecture configuration types and validation.
183
+ - Extract the reusable strongly-connected-component algorithm already embedded in `deep-chains`.
184
+ - Add a pure architecture graph analyzer and `scip-query architecture`.
185
+ - Extend the directory-architecture skill with the discover, declare, measure, and ratchet workflow.
186
+ - Keep architecture outside health scoring and diff-gate blocking.
187
+
188
+ ### Slice 2: replace implicit drift policy — implemented
189
+
190
+ - Move scip-query's source-boundary rules into its `.scipquery.json`.
191
+ - Make drift consume architecture findings instead of repository-specific hardcoded folder rules.
192
+ - Add `drift --architecture` as a summary view.
193
+ - Preserve unused-import drift and keep sibling-pattern deviation opt-in.
194
+
195
+ ### Slice 3: baselines and enforcement — implemented locally; external calibration remains
196
+
197
+ - Give architecture findings stable identities.
198
+ - Add report-only health visibility.
199
+ - Add a narrow default diff-gate ratchet for newly introduced declared violations, backed by the shared health baseline.
200
+ - Calibrate on scip-query, Vega 2.0, Stable Management, and structurally different external repositories before any score deduction.
201
+
202
+ ### Slice 4: discovery assistance
203
+
204
+ - Add candidate-boundary evidence that combines paths, entry points, public surfaces, dependency neighborhoods, and co-change history.
205
+ - Have the skill produce a reviewable architecture draft, never silently write closed rules.
206
+ - Measure whether suggested boundaries and repairs survive maintainer review and reduce future cross-boundary churn.
207
+
208
+ ## Success Criteria
209
+
210
+ The architecture feature is effective when:
211
+
212
+ - an unconfigured repository never inherits scip-query-specific rules;
213
+ - a configured forbidden edge is reported with concrete import evidence;
214
+ - broad and narrow boundary edges are distinguishable;
215
+ - large cycles are summarized without flooding the user;
216
+ - the agent can explain why each proposed boundary exists in the running system;
217
+ - existing debt can be ratcheted without a rewrite;
218
+ - acting on a recommendation improves ownership or dependency direction in externally reviewed codebases;
219
+ - the tool is willing to say “the policy is incomplete” instead of manufacturing certainty.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scip-query",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Evidence and verification for AI coding agents: map code, reuse concepts, finish migrations, and gate diffs.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -33,6 +33,10 @@
33
33
  "import": "./dist/queries/affected.js",
34
34
  "types": "./dist/queries/affected.d.ts"
35
35
  },
36
+ "./queries/architecture": {
37
+ "import": "./dist/queries/architecture.js",
38
+ "types": "./dist/queries/architecture.d.ts"
39
+ },
36
40
  "./queries/bottlenecks": {
37
41
  "import": "./dist/queries/bottlenecks.js",
38
42
  "types": "./dist/queries/bottlenecks.d.ts"
@@ -110,7 +110,7 @@ scip-query cleanup-apply # Apply a compiler-verified cleanup-plan batch to the w
110
110
  scip-query recent-duplicates # Directional duplicate candidates: recent code that re-implements established callable, React, or Vue code
111
111
  scip-query doc-drift [doc] # Stale-doc candidates: code the doc references or co-changed with kept changing after the doc stopped
112
112
  scip-query unused-params # Speculative-generality candidates: trailing parameters no body ever uses (TS/JS)
113
- scip-query drift [module] # Detect heuristic drift candidates: unused imports and layer violations by default; pass --patterns for pattern deviations too
113
+ scip-query drift [module] # Detect drift candidates: unused imports and declared architecture violations; pass --architecture for boundary context
114
114
  scip-query wrapper-candidates # Find heuristic wrapper candidates only called by one consumer (high false-positive rate on codebases with intentional layering/ambient types — treat as exploration, not findings)
115
115
  scip-query passthrough-candidates # Find heuristic passthrough candidates that forward to one callee
116
116
  scip-query stale-abstractions # Find heuristic stale abstraction candidates with 0-1 consumers (high false-positive rate on codebases with intentional layering/ambient types — treat as exploration, not findings)
@@ -134,6 +134,7 @@ scip-query fan-in [symbol] # Count files referencing an exact symbol; top JSON r
134
134
  scip-query fan-out [file] # How many external symbols a file uses (or top fan-out across codebase)
135
135
  scip-query coupling [file1] [file2] # Coupling between two files, or top coupled pairs in codebase
136
136
  scip-query cycles # Detect circular dependency chains between files
137
+ scip-query architecture # Evaluate project-owned architectural boundaries and dependency rules
137
138
  scip-query bottlenecks # Find coupling hubs: high fan-in AND high fan-out
138
139
  scip-query deep-chains # Find the longest condensed dependency-component chains
139
140
  scip-query call-graph <symbol> # Show incoming callers and outgoing callees for a symbol
@@ -145,7 +146,7 @@ scip-query call-graph <symbol> # Show incoming callers and outgoing callees for
145
146
  scip-query affected <symbol> # Transitive closure of symbols that could break if this symbol changes
146
147
  scip-query change-surface <file> # Pre-change briefing: exports, consumers, and blast-radius risk
147
148
  scip-query co-change [file] # Files that change together in git history without a dependency edge — hidden coupling candidates
148
- scip-query diff-gate # Gate the current diff: echo candidates, incomplete migrations, missing co-change partners, unedited twin partners (advisory), uncited doc updates, unused params, new dead symbols; exit 1 on blocking findings
149
+ scip-query diff-gate # Gate the current diff: architecture regressions plus echo, migration, coordination, doc-drift, unused-param, and new-dead candidates; exit 1 on blocking findings
149
150
  scip-query incomplete-migration # Partially-completed extraction candidates: new helpers in the diff wired into some sites while similar un-migrated sites remain
150
151
  scip-query diff-impact # Compute changed symbols and downstream consumers from current git diff
151
152
  ```
@@ -211,7 +212,7 @@ measured precision, not by volume:
211
212
 
212
213
  ## Diff Gate Checks
213
214
 
214
- `diff-gate` runs nine checks (`--skip <check>` accepts any of these): `echo` (recent-duplicate-style echoes in the diff), `incomplete-migration`, `co-change-partner` (missing historically-paired file), `twin-partner` (advisory — unedited same-name twin), `coverage-contract` (a configured `coverageContracts` enumeration drifted from its ground truth — see `scip-setup`), `doc-reference` (uncited or stale doc claim), `unused-params`, `new-dead` (dead code introduced by this diff), and `baseline` (only with `--baseline`: compares against the committed `.scipquery-baseline.json`, distinct from `health --baseline`). Findings print grouped under a `Root-cause groups (N):` header before the flat list — a group's remediation usually clears every finding under it, and the same remediation may then repeat in the flat list below; that repetition is expected, not a separate issue. `--baseline` findings additionally carry an `actionTier`: `direct` (act on this finding alone), `signal` (corroborating evidence — read before acting), `support` (context only).
215
+ `diff-gate` recognizes ten checks (`--skip <check>` accepts any of these): `echo` (recent-duplicate-style echoes in the diff), `incomplete-migration`, `co-change-partner` (missing historically-paired file), `twin-partner` (advisory — unedited same-name twin), `coverage-contract` (a configured `coverageContracts` enumeration drifted from its ground truth — see `scip-setup`), `architecture` (a declared boundary violation absent from the shared baseline), `doc-reference` (uncited or stale doc claim), `unused-params`, `new-dead` (dead code introduced by this diff), and `baseline` (only with `--baseline`: compares all non-architecture health identities against the committed `.scipquery-baseline.json`, distinct from `health --baseline`). The architecture check runs by default only when enforceable architecture rules and a baseline exist; it uses that same file without running the full health suite. Findings print grouped under a `Root-cause groups (N):` header before the flat list — a group's remediation usually clears every finding under it, and the same remediation may then repeat in the flat list below; that repetition is expected, not a separate issue. Baseline-backed findings additionally carry an `actionTier`: `direct` (act on this finding alone), `signal` (corroborating evidence — read before acting), `support` (context only).
215
216
 
216
217
  ## Postchecks
217
218
 
@@ -24,7 +24,7 @@ Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
24
24
  | Command | Purpose | When |
25
25
  | --- | --- | --- |
26
26
  | `scip-query plan-context <target>` | Pre-edit planning context for a symbol, file, or module | Anchor each phase's step before delegating it. |
27
- | `scip-query diff-gate --json` | Gate the current diff: echo candidates, incomplete migrations, missing co-change partners, unedited twin partners (advisory), uncited doc updates, unused params, new dead symbols; exit 1 on blocking findings | Verify a handoff before accepting it and before closing the program. |
27
+ | `scip-query diff-gate --json` | Gate the current diff: architecture regressions plus echo, migration, coordination, doc-drift, unused-param, and new-dead candidates; exit 1 on blocking findings | Verify a handoff before accepting it and before closing the program. |
28
28
  | `scip-query health --json` | Composite codebase health report with prioritized action list | Pre-register or check a program-level health benchmark. |
29
29
 
30
30
  Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
@@ -10,8 +10,16 @@ commands:
10
10
  when: "Inventory evidence: files with overlapping dependency profiles."
11
11
  - template: "scip-query cycles"
12
12
  when: "Inventory evidence: circular dependency chains between files."
13
+ - template: "scip-query architecture --json"
14
+ when: "Measure configured boundaries, actual dependency traffic, forbidden edges, reciprocal pairs, and boundary cycles."
15
+ - template: "scip-query drift --architecture"
16
+ when: "Review direct drift findings together with boundary coverage and architecture signals."
13
17
  - template: "scip-query co-change --json --full"
14
18
  when: "Inventory evidence: hidden file-level coupling from git history."
19
+ - template: "scip-query health --write-baseline"
20
+ when: "Record reviewed existing debt before enabling architecture regression enforcement."
21
+ - template: "scip-query diff-gate"
22
+ when: "Verify that the current diff introduces no new declared architecture violation."
15
23
  - template: "scip-query config-validate --json"
16
24
  when: "Implement a slice: validate locality config after a move."
17
25
  ---
@@ -31,7 +39,11 @@ Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
31
39
  | `scip-query locality-candidates --json --full` | Find directory-locality and ancestry candidates from consumer ownership | Inventory evidence: directory-locality candidates from consumer ownership. |
32
40
  | `scip-query similar-files --full --json` | Find heuristic similar-file candidates from dependency profiles | Inventory evidence: files with overlapping dependency profiles. |
33
41
  | `scip-query cycles` | Detect circular dependency chains between files | Inventory evidence: circular dependency chains between files. |
42
+ | `scip-query architecture --json` | Evaluate project-owned architectural boundaries and dependency rules | Measure configured boundaries, actual dependency traffic, forbidden edges, reciprocal pairs, and boundary cycles. |
43
+ | `scip-query drift --architecture` | Detect drift candidates: unused imports and declared architecture violations; pass --architecture for boundary context | Review direct drift findings together with boundary coverage and architecture signals. |
34
44
  | `scip-query co-change --json --full` | Files that change together in git history without a dependency edge — hidden coupling candidates | Inventory evidence: hidden file-level coupling from git history. |
45
+ | `scip-query health --write-baseline` | Composite codebase health report with prioritized action list | Record reviewed existing debt before enabling architecture regression enforcement. |
46
+ | `scip-query diff-gate` | Gate the current diff: architecture regressions plus echo, migration, coordination, doc-drift, unused-param, and new-dead candidates; exit 1 on blocking findings | Verify that the current diff introduces no new declared architecture violation. |
35
47
  | `scip-query config-validate --json` | Validate .scipquery.json, including structured suppressions and declared coupling groups | Implement a slice: validate locality config after a move. |
36
48
 
37
49
  Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
@@ -41,6 +53,16 @@ Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only
41
53
 
42
54
  An ownership boundary is a folder, package, module, or convention that groups code around one stable responsibility.
43
55
 
56
+ A dependency edge points from code that relies on something to the code it relies on. For imports, `A -> B` means A imports B.
57
+
58
+ A forbidden edge is an actual cross-boundary dependency rejected by an explicit project rule. Directory distance or an unusual import does not make an edge forbidden by itself.
59
+
60
+ A layer is a responsibility ordered by dependency direction, such as presentation depending on application. A subsystem is a responsibility that owns an end-to-end capability, such as authentication or rendering. A package is a publication or build unit. A service is an independently running unit. Do not force all four into one layer hierarchy.
61
+
62
+ A reciprocal dependency is dependency traffic in both directions between two boundaries. It is a review signal because the boundaries exert mutual change pressure, not proof that either import is wrong.
63
+
64
+ An architecture ratchet is an enforcement rule that records existing violations while preventing new ones, allowing a large codebase to improve without a speculative rewrite.
65
+
44
66
  A target structure is a proposed future layout that expresses an ownership model, not merely a prettier tree.
45
67
 
46
68
  A migration slice is the smallest set of file moves and import updates that can be verified independently.
@@ -55,6 +77,8 @@ A slop codebase is a codebase whose files are arranged by accident, convenience,
55
77
  4. Do not reward generic `shared` unless the shared concept has a name, owner, and cross-boundary consumers.
56
78
  5. For messy repos, produce a discovery map and decisions instead of pretending the target is obvious.
57
79
  6. Prefer small verified moves.
80
+ 7. Configure descriptive boundaries before closing dependency rules.
81
+ 8. Treat graph shape as evidence about responsibilities, never as a substitute for identifying them.
58
82
 
59
83
  ## Workflow
60
84
 
@@ -77,6 +101,8 @@ scip-query change-surface <file>
77
101
  scip-query plan-context <file-or-symbol>
78
102
  scip-query locality-candidates --json --full
79
103
  scip-query cycles
104
+ scip-query architecture --json
105
+ scip-query drift --architecture
80
106
  scip-query co-change
81
107
  scip-query similar-files --min-similarity 0.6 --min-deps 3
82
108
  scip-query similar-chains --min-similarity 0.5
@@ -98,7 +124,66 @@ Classify each candidate:
98
124
 
99
125
  This step is complete only when mature, emerging, and accidental boundaries are separated.
100
126
 
101
- ### 4. Propose structure or decisions
127
+ ### 4. Build a descriptive architecture model
128
+
129
+ For a large existing codebase, identify real system units before calling them layers. Inventory:
130
+
131
+ - workspace packages and public exports;
132
+ - applications, services, and deployable entry points;
133
+ - domain capabilities and end-to-end subsystems;
134
+ - persistence, network, rendering, compiler, and other technical responsibilities;
135
+ - tests, routes, contracts, and ownership or architecture documentation;
136
+ - dependency and co-change evidence that shows which files already move as a unit.
137
+
138
+ Add mature boundary path patterns to `.scipquery.json` without `allowedDependencies` rows first:
139
+
140
+ ```json
141
+ {
142
+ "architecture": {
143
+ "boundaries": [
144
+ { "name": "domain", "paths": ["src/domain/**"] },
145
+ { "name": "runtime", "paths": ["src/runtime/**"] }
146
+ ]
147
+ }
148
+ }
149
+ ```
150
+
151
+ Then run:
152
+
153
+ ```bash
154
+ scip-query config-validate --json
155
+ scip-query architecture --json
156
+ ```
157
+
158
+ Use unmapped and ambiguous files to repair boundary membership. Use actual boundary edges, reciprocal pairs, and strongly connected groups to test whether the names describe real separation.
159
+
160
+ This step is complete only when every configured boundary has a stated responsibility and the mapping gaps are understood.
161
+
162
+ ### 5. Declare only supported dependency rules
163
+
164
+ An `allowedDependencies` row is closed: an outgoing target omitted from a present row is forbidden. A missing row makes no dependency claim.
165
+
166
+ ```json
167
+ {
168
+ "architecture": {
169
+ "boundaries": [
170
+ { "name": "domain", "paths": ["src/domain/**"] },
171
+ { "name": "runtime", "paths": ["src/runtime/**"] }
172
+ ],
173
+ "allowedDependencies": {
174
+ "domain": [],
175
+ "runtime": ["domain"]
176
+ },
177
+ "requireAcyclic": true
178
+ }
179
+ }
180
+ ```
181
+
182
+ For each closed row, record the evidence for its intended direction. Do not copy the current dependency graph into the allow-list merely to obtain zero findings. Leave emerging or disputed rows undeclared.
183
+
184
+ This step is complete only when every forbidden edge is understood as either implementation debt, a false boundary, or a policy mistake.
185
+
186
+ ### 6. Propose structure or decisions
102
187
 
103
188
  Use this shape:
104
189
 
@@ -108,6 +193,10 @@ Use this shape:
108
193
  ## Scope
109
194
  ## Current Structure Map
110
195
  ## Boundary Maturity
196
+ ## Descriptive Architecture Model
197
+ ## Dependency Rules
198
+ ## Forbidden-Edge Ledger
199
+ ## Reciprocal and Cycle Review
111
200
  ## Target Structure
112
201
  ## Move Ledger
113
202
  ## Locality Config
@@ -120,7 +209,29 @@ List no-move decisions when broad consumers, route/package/contract surfaces, in
120
209
 
121
210
  This step is complete only when every proposed move has a reason and verification path.
122
211
 
123
- ### 5. Implement one slice when asked
212
+ ### 7. Ratchet, then implement one slice when asked
213
+
214
+ For a large repository with existing violations, review the direct findings and
215
+ write the shared health baseline:
216
+
217
+ ```bash
218
+ scip-query drift --architecture
219
+ scip-query health --write-baseline
220
+ ```
221
+
222
+ The baseline records stable architecture identities by boundary pair, not by
223
+ whichever example file happens to sort first. The default `scip-query
224
+ diff-gate` architecture check then compares only architecture identities; it
225
+ does not run every health detector. `diff-gate --baseline` remains the opt-in
226
+ full health ratchet and does not duplicate architecture findings.
227
+
228
+ Commit `.scipquery-baseline.json` with `.scipquery.json`. A missing baseline
229
+ causes the architecture gate to report that enforcement is not enabled; it
230
+ does not silently treat the current graph as accepted.
231
+
232
+ Prefer inspecting the least-broad edge inside a boundary cycle first, but
233
+ determine whether the repair is a move, dependency inversion, named shared
234
+ contract, boundary merge, or policy correction.
124
235
 
125
236
  Before editing, state files to move, imports/exports/tests/docs to update, expected verification, and rollback risk. Then move the smallest high-confidence slice and run:
126
237
 
@@ -135,6 +246,9 @@ Also run project tests or typecheck for the affected workspace. If `.scipquery.j
135
246
  ```bash
136
247
  scip-query config-validate
137
248
  scip-query locality-candidates --json --full
249
+ scip-query architecture --json
250
+ scip-query drift --architecture
251
+ scip-query diff-gate
138
252
  ```
139
253
 
140
254
  Then invoke `scip-verify`. The implementation is complete only when imports, tests, locality signals, and verification are checked.
@@ -12,8 +12,8 @@ commands:
12
12
  when: "Map evidence: exports, consumers, and blast-radius risk."
13
13
  - template: "scip-query affected <symbol>"
14
14
  when: "Map evidence: transitive consumers of a candidate symbol."
15
- - template: "scip-query drift --patterns"
16
- when: "Map evidence: layer violations and pattern deviations as probes (--patterns is off by default and near-zero precision; treat hits as leads, not findings)."
15
+ - template: "scip-query drift --patterns --architecture"
16
+ when: "Map evidence: declared architecture violations plus boundary and pattern signals; treat opt-in pattern hits as leads, not findings."
17
17
  ---
18
18
 
19
19
  # scip-maintainability
@@ -32,7 +32,7 @@ Load shared mechanics from [`../_shared/SKILL.md`](../_shared/SKILL.md).
32
32
  | `scip-query surface <scope>` | What symbols consumers actually use from this module | Map evidence: what consumers actually use from the scope. |
33
33
  | `scip-query change-surface <file>` | Pre-change briefing: exports, consumers, and blast-radius risk | Map evidence: exports, consumers, and blast-radius risk. |
34
34
  | `scip-query affected <symbol>` | Transitive closure of symbols that could break if this symbol changes | Map evidence: transitive consumers of a candidate symbol. |
35
- | `scip-query drift --patterns` | Detect heuristic drift candidates: unused imports and layer violations by default; pass --patterns for pattern deviations too | Map evidence: layer violations and pattern deviations as probes (--patterns is off by default and near-zero precision; treat hits as leads, not findings). |
35
+ | `scip-query drift --patterns --architecture` | Detect drift candidates: unused imports and declared architecture violations; pass --architecture for boundary context | Map evidence: declared architecture violations plus boundary and pattern signals; treat opt-in pattern hits as leads, not findings. |
36
36
 
37
37
  Use this shortlist first. Open [`../_shared/SKILL.md`](../_shared/SKILL.md) only when it is insufficient.
38
38
  <!-- END GENERATED SKILL COMMANDS -->