@specship/specship-win32-arm64 0.25.0 → 0.28.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 (274) hide show
  1. package/bin/specship.cmd +31 -1
  2. package/lib/dist/activation/cheatsheet.d.ts +17 -1
  3. package/lib/dist/activation/cheatsheet.d.ts.map +1 -1
  4. package/lib/dist/activation/cheatsheet.js +47 -3
  5. package/lib/dist/activation/cheatsheet.js.map +1 -1
  6. package/lib/dist/activation/hook-output.d.ts +80 -0
  7. package/lib/dist/activation/hook-output.d.ts.map +1 -0
  8. package/lib/dist/activation/hook-output.js +103 -0
  9. package/lib/dist/activation/hook-output.js.map +1 -0
  10. package/lib/dist/activation/search-intercept.d.ts +60 -29
  11. package/lib/dist/activation/search-intercept.d.ts.map +1 -1
  12. package/lib/dist/activation/search-intercept.js +159 -55
  13. package/lib/dist/activation/search-intercept.js.map +1 -1
  14. package/lib/dist/activation/steering.d.ts +8 -10
  15. package/lib/dist/activation/steering.d.ts.map +1 -1
  16. package/lib/dist/activation/steering.js +21 -6
  17. package/lib/dist/activation/steering.js.map +1 -1
  18. package/lib/dist/behaviour/behaviour-surface.d.ts +47 -0
  19. package/lib/dist/behaviour/behaviour-surface.d.ts.map +1 -1
  20. package/lib/dist/behaviour/behaviour-surface.js +108 -2
  21. package/lib/dist/behaviour/behaviour-surface.js.map +1 -1
  22. package/lib/dist/bin/node-version-check.d.ts +22 -7
  23. package/lib/dist/bin/node-version-check.d.ts.map +1 -1
  24. package/lib/dist/bin/node-version-check.js +39 -9
  25. package/lib/dist/bin/node-version-check.js.map +1 -1
  26. package/lib/dist/bin/specship.js +762 -81
  27. package/lib/dist/bin/specship.js.map +1 -1
  28. package/lib/dist/commands/specship/learn.md +22 -0
  29. package/lib/dist/commands/specship/spec.md +12 -0
  30. package/lib/dist/db/sqlite-adapter.d.ts +7 -5
  31. package/lib/dist/db/sqlite-adapter.d.ts.map +1 -1
  32. package/lib/dist/db/sqlite-adapter.js +11 -9
  33. package/lib/dist/db/sqlite-adapter.js.map +1 -1
  34. package/lib/dist/enforce/changed-files.d.ts +11 -0
  35. package/lib/dist/enforce/changed-files.d.ts.map +1 -1
  36. package/lib/dist/enforce/changed-files.js +42 -0
  37. package/lib/dist/enforce/changed-files.js.map +1 -1
  38. package/lib/dist/enforce/enforce.d.ts +25 -1
  39. package/lib/dist/enforce/enforce.d.ts.map +1 -1
  40. package/lib/dist/enforce/enforce.js +58 -3
  41. package/lib/dist/enforce/enforce.js.map +1 -1
  42. package/lib/dist/enforce/mutation.d.ts +46 -0
  43. package/lib/dist/enforce/mutation.d.ts.map +1 -0
  44. package/lib/dist/enforce/mutation.js +104 -0
  45. package/lib/dist/enforce/mutation.js.map +1 -0
  46. package/lib/dist/enforce/suppressions.d.ts +33 -0
  47. package/lib/dist/enforce/suppressions.d.ts.map +1 -0
  48. package/lib/dist/enforce/suppressions.js +159 -0
  49. package/lib/dist/enforce/suppressions.js.map +1 -0
  50. package/lib/dist/extraction/specs/markdown-spec-extractor.d.ts.map +1 -1
  51. package/lib/dist/extraction/specs/markdown-spec-extractor.js +16 -2
  52. package/lib/dist/extraction/specs/markdown-spec-extractor.js.map +1 -1
  53. package/lib/dist/graph/spec-coverage.d.ts +57 -1
  54. package/lib/dist/graph/spec-coverage.d.ts.map +1 -1
  55. package/lib/dist/graph/spec-coverage.js +129 -5
  56. package/lib/dist/graph/spec-coverage.js.map +1 -1
  57. package/lib/dist/health/smoke-check.js +2 -2
  58. package/lib/dist/health/smoke-check.js.map +1 -1
  59. package/lib/dist/index.d.ts +8 -3
  60. package/lib/dist/index.d.ts.map +1 -1
  61. package/lib/dist/index.js +65 -9
  62. package/lib/dist/index.js.map +1 -1
  63. package/lib/dist/installer/gemini-commands.d.ts +107 -0
  64. package/lib/dist/installer/gemini-commands.d.ts.map +1 -0
  65. package/lib/dist/installer/gemini-commands.js +264 -0
  66. package/lib/dist/installer/gemini-commands.js.map +1 -0
  67. package/lib/dist/installer/index.d.ts +23 -1
  68. package/lib/dist/installer/index.d.ts.map +1 -1
  69. package/lib/dist/installer/index.js +22 -3
  70. package/lib/dist/installer/index.js.map +1 -1
  71. package/lib/dist/installer/install-defaults.d.ts +19 -0
  72. package/lib/dist/installer/install-defaults.d.ts.map +1 -1
  73. package/lib/dist/installer/install-defaults.js +28 -0
  74. package/lib/dist/installer/install-defaults.js.map +1 -1
  75. package/lib/dist/installer/instructions-template.d.ts +22 -0
  76. package/lib/dist/installer/instructions-template.d.ts.map +1 -1
  77. package/lib/dist/installer/instructions-template.js +37 -1
  78. package/lib/dist/installer/instructions-template.js.map +1 -1
  79. package/lib/dist/installer/targets/claude.d.ts +4 -0
  80. package/lib/dist/installer/targets/claude.d.ts.map +1 -1
  81. package/lib/dist/installer/targets/claude.js +8 -25
  82. package/lib/dist/installer/targets/claude.js.map +1 -1
  83. package/lib/dist/installer/targets/gemini.d.ts +85 -12
  84. package/lib/dist/installer/targets/gemini.d.ts.map +1 -1
  85. package/lib/dist/installer/targets/gemini.js +527 -30
  86. package/lib/dist/installer/targets/gemini.js.map +1 -1
  87. package/lib/dist/installer/targets/shared.d.ts +13 -0
  88. package/lib/dist/installer/targets/shared.d.ts.map +1 -1
  89. package/lib/dist/installer/targets/shared.js +18 -0
  90. package/lib/dist/installer/targets/shared.js.map +1 -1
  91. package/lib/dist/installer/targets/types.d.ts +12 -0
  92. package/lib/dist/installer/targets/types.d.ts.map +1 -1
  93. package/lib/dist/jira/auto-publish.d.ts +71 -4
  94. package/lib/dist/jira/auto-publish.d.ts.map +1 -1
  95. package/lib/dist/jira/auto-publish.js +186 -17
  96. package/lib/dist/jira/auto-publish.js.map +1 -1
  97. package/lib/dist/jira/reconcile.d.ts +24 -1
  98. package/lib/dist/jira/reconcile.d.ts.map +1 -1
  99. package/lib/dist/jira/reconcile.js +46 -2
  100. package/lib/dist/jira/reconcile.js.map +1 -1
  101. package/lib/dist/jira/repo-config.d.ts +9 -0
  102. package/lib/dist/jira/repo-config.d.ts.map +1 -1
  103. package/lib/dist/jira/repo-config.js +11 -0
  104. package/lib/dist/jira/repo-config.js.map +1 -1
  105. package/lib/dist/jira/types.d.ts +7 -0
  106. package/lib/dist/jira/types.d.ts.map +1 -1
  107. package/lib/dist/jira/types.js.map +1 -1
  108. package/lib/dist/knowledge/enforce.d.ts +75 -0
  109. package/lib/dist/knowledge/enforce.d.ts.map +1 -0
  110. package/lib/dist/knowledge/enforce.js +250 -0
  111. package/lib/dist/knowledge/enforce.js.map +1 -0
  112. package/lib/dist/knowledge/facts.d.ts +33 -0
  113. package/lib/dist/knowledge/facts.d.ts.map +1 -0
  114. package/lib/dist/knowledge/facts.js +117 -0
  115. package/lib/dist/knowledge/facts.js.map +1 -0
  116. package/lib/dist/knowledge/proposals.d.ts +88 -0
  117. package/lib/dist/knowledge/proposals.d.ts.map +1 -0
  118. package/lib/dist/knowledge/proposals.js +360 -0
  119. package/lib/dist/knowledge/proposals.js.map +1 -0
  120. package/lib/dist/knowledge/stale.d.ts +64 -0
  121. package/lib/dist/knowledge/stale.d.ts.map +1 -0
  122. package/lib/dist/knowledge/stale.js +174 -0
  123. package/lib/dist/knowledge/stale.js.map +1 -0
  124. package/lib/dist/mcp/gemini-session.d.ts +50 -0
  125. package/lib/dist/mcp/gemini-session.d.ts.map +1 -0
  126. package/lib/dist/mcp/gemini-session.js +159 -0
  127. package/lib/dist/mcp/gemini-session.js.map +1 -0
  128. package/lib/dist/mcp/jira-tools.d.ts.map +1 -1
  129. package/lib/dist/mcp/jira-tools.js +25 -0
  130. package/lib/dist/mcp/jira-tools.js.map +1 -1
  131. package/lib/dist/mcp/model-context.d.ts +22 -9
  132. package/lib/dist/mcp/model-context.d.ts.map +1 -1
  133. package/lib/dist/mcp/model-context.js +35 -13
  134. package/lib/dist/mcp/model-context.js.map +1 -1
  135. package/lib/dist/mcp/proxy.js +1 -1
  136. package/lib/dist/mcp/proxy.js.map +1 -1
  137. package/lib/dist/mcp/server-instructions.d.ts +16 -15
  138. package/lib/dist/mcp/server-instructions.d.ts.map +1 -1
  139. package/lib/dist/mcp/server-instructions.js +67 -1
  140. package/lib/dist/mcp/server-instructions.js.map +1 -1
  141. package/lib/dist/mcp/session.js +1 -1
  142. package/lib/dist/mcp/session.js.map +1 -1
  143. package/lib/dist/mcp/spec-tools.d.ts +9 -1
  144. package/lib/dist/mcp/spec-tools.d.ts.map +1 -1
  145. package/lib/dist/mcp/spec-tools.js +69 -21
  146. package/lib/dist/mcp/spec-tools.js.map +1 -1
  147. package/lib/dist/mcp/tools.d.ts +37 -1
  148. package/lib/dist/mcp/tools.d.ts.map +1 -1
  149. package/lib/dist/mcp/tools.js +120 -9
  150. package/lib/dist/mcp/tools.js.map +1 -1
  151. package/lib/dist/pulse/pulse.d.ts +93 -0
  152. package/lib/dist/pulse/pulse.d.ts.map +1 -0
  153. package/lib/dist/pulse/pulse.js +401 -0
  154. package/lib/dist/pulse/pulse.js.map +1 -0
  155. package/lib/dist/reflect/apply.d.ts.map +1 -1
  156. package/lib/dist/reflect/apply.js +38 -3
  157. package/lib/dist/reflect/apply.js.map +1 -1
  158. package/lib/dist/reflect/auto-sweep.d.ts +26 -0
  159. package/lib/dist/reflect/auto-sweep.d.ts.map +1 -0
  160. package/lib/dist/reflect/auto-sweep.js +90 -0
  161. package/lib/dist/reflect/auto-sweep.js.map +1 -0
  162. package/lib/dist/reflect/cli.d.ts +62 -0
  163. package/lib/dist/reflect/cli.d.ts.map +1 -0
  164. package/lib/dist/reflect/cli.js +163 -0
  165. package/lib/dist/reflect/cli.js.map +1 -0
  166. package/lib/dist/reflect/miner.d.ts.map +1 -1
  167. package/lib/dist/reflect/miner.js +119 -0
  168. package/lib/dist/reflect/miner.js.map +1 -1
  169. package/lib/dist/reflect/sweep.d.ts +1 -0
  170. package/lib/dist/reflect/sweep.d.ts.map +1 -1
  171. package/lib/dist/reflect/sweep.js +62 -13
  172. package/lib/dist/reflect/sweep.js.map +1 -1
  173. package/lib/dist/reflect/targets.d.ts +2 -0
  174. package/lib/dist/reflect/targets.d.ts.map +1 -1
  175. package/lib/dist/reflect/targets.js +33 -0
  176. package/lib/dist/reflect/targets.js.map +1 -1
  177. package/lib/dist/reflect/types.d.ts +19 -2
  178. package/lib/dist/reflect/types.d.ts.map +1 -1
  179. package/lib/dist/resolution/test-title-links.d.ts.map +1 -1
  180. package/lib/dist/resolution/test-title-links.js +3 -14
  181. package/lib/dist/resolution/test-title-links.js.map +1 -1
  182. package/lib/dist/server/routes/claude.js +15 -7
  183. package/lib/dist/server/routes/knowledge.js +118 -0
  184. package/lib/dist/server/server.js +2 -0
  185. package/lib/dist/spec-lint/lint.d.ts +1 -1
  186. package/lib/dist/spec-lint/lint.d.ts.map +1 -1
  187. package/lib/dist/spec-lint/lint.js +63 -2
  188. package/lib/dist/spec-lint/lint.js.map +1 -1
  189. package/lib/dist/spec-quality/criterion-ids.d.ts +13 -0
  190. package/lib/dist/spec-quality/criterion-ids.d.ts.map +1 -0
  191. package/lib/dist/spec-quality/criterion-ids.js +38 -0
  192. package/lib/dist/spec-quality/criterion-ids.js.map +1 -0
  193. package/lib/dist/spec-quality/evidence-kind.d.ts +54 -0
  194. package/lib/dist/spec-quality/evidence-kind.d.ts.map +1 -0
  195. package/lib/dist/spec-quality/evidence-kind.js +183 -0
  196. package/lib/dist/spec-quality/evidence-kind.js.map +1 -0
  197. package/lib/dist/spec-quality/link-persist.d.ts +65 -0
  198. package/lib/dist/spec-quality/link-persist.d.ts.map +1 -0
  199. package/lib/dist/spec-quality/link-persist.js +249 -0
  200. package/lib/dist/spec-quality/link-persist.js.map +1 -0
  201. package/lib/dist/spec-quality/plan-scope.d.ts +38 -0
  202. package/lib/dist/spec-quality/plan-scope.d.ts.map +1 -0
  203. package/lib/dist/spec-quality/plan-scope.js +129 -0
  204. package/lib/dist/spec-quality/plan-scope.js.map +1 -0
  205. package/lib/dist/spec-quality/postcheck.d.ts +85 -0
  206. package/lib/dist/spec-quality/postcheck.d.ts.map +1 -0
  207. package/lib/dist/spec-quality/postcheck.js +390 -0
  208. package/lib/dist/spec-quality/postcheck.js.map +1 -0
  209. package/lib/dist/spec-quality/readiness.d.ts +72 -0
  210. package/lib/dist/spec-quality/readiness.d.ts.map +1 -0
  211. package/lib/dist/spec-quality/readiness.js +226 -0
  212. package/lib/dist/spec-quality/readiness.js.map +1 -0
  213. package/lib/dist/workflows/agents/claude.d.ts +16 -0
  214. package/lib/dist/workflows/agents/claude.d.ts.map +1 -0
  215. package/lib/dist/workflows/agents/claude.js +82 -0
  216. package/lib/dist/workflows/agents/claude.js.map +1 -0
  217. package/lib/dist/workflows/agents/gemini.d.ts +21 -0
  218. package/lib/dist/workflows/agents/gemini.d.ts.map +1 -0
  219. package/lib/dist/workflows/agents/gemini.js +124 -0
  220. package/lib/dist/workflows/agents/gemini.js.map +1 -0
  221. package/lib/dist/workflows/agents/index.d.ts +28 -0
  222. package/lib/dist/workflows/agents/index.d.ts.map +1 -0
  223. package/lib/dist/workflows/agents/index.js +104 -0
  224. package/lib/dist/workflows/agents/index.js.map +1 -0
  225. package/lib/dist/workflows/agents/types.d.ts +55 -0
  226. package/lib/dist/workflows/agents/types.d.ts.map +1 -0
  227. package/lib/dist/workflows/agents/types.js +46 -0
  228. package/lib/dist/workflows/agents/types.js.map +1 -0
  229. package/lib/dist/workflows/batch.d.ts +63 -0
  230. package/lib/dist/workflows/batch.d.ts.map +1 -0
  231. package/lib/dist/workflows/batch.js +151 -0
  232. package/lib/dist/workflows/batch.js.map +1 -0
  233. package/lib/dist/workflows/defaults/claude-design-implement.yaml +3 -4
  234. package/lib/dist/workflows/defaults/spec-author.yaml +11 -9
  235. package/lib/dist/workflows/defaults/spec-implement-mixed.yaml +21 -436
  236. package/lib/dist/workflows/defaults/spec-implement.yaml +465 -46
  237. package/lib/dist/workflows/discovery.d.ts +13 -0
  238. package/lib/dist/workflows/discovery.d.ts.map +1 -1
  239. package/lib/dist/workflows/discovery.js +79 -17
  240. package/lib/dist/workflows/discovery.js.map +1 -1
  241. package/lib/dist/workflows/executor.d.ts +18 -0
  242. package/lib/dist/workflows/executor.d.ts.map +1 -1
  243. package/lib/dist/workflows/executor.js +130 -33
  244. package/lib/dist/workflows/executor.js.map +1 -1
  245. package/lib/dist/workflows/gc.d.ts +50 -0
  246. package/lib/dist/workflows/gc.d.ts.map +1 -0
  247. package/lib/dist/workflows/gc.js +120 -0
  248. package/lib/dist/workflows/gc.js.map +1 -0
  249. package/lib/dist/workflows/merge-queue.d.ts +64 -0
  250. package/lib/dist/workflows/merge-queue.d.ts.map +1 -0
  251. package/lib/dist/workflows/merge-queue.js +162 -0
  252. package/lib/dist/workflows/merge-queue.js.map +1 -0
  253. package/lib/dist/workflows/runners/approval.d.ts +1 -1
  254. package/lib/dist/workflows/runners/approval.d.ts.map +1 -1
  255. package/lib/dist/workflows/runners/approval.js +11 -2
  256. package/lib/dist/workflows/runners/approval.js.map +1 -1
  257. package/lib/dist/workflows/runners/bash.d.ts +15 -0
  258. package/lib/dist/workflows/runners/bash.d.ts.map +1 -1
  259. package/lib/dist/workflows/runners/bash.js +50 -1
  260. package/lib/dist/workflows/runners/bash.js.map +1 -1
  261. package/lib/dist/workflows/runners/prompt.d.ts +16 -41
  262. package/lib/dist/workflows/runners/prompt.d.ts.map +1 -1
  263. package/lib/dist/workflows/runners/prompt.js +55 -120
  264. package/lib/dist/workflows/runners/prompt.js.map +1 -1
  265. package/lib/dist/workflows/runners/types.d.ts +12 -0
  266. package/lib/dist/workflows/runners/types.d.ts.map +1 -1
  267. package/lib/dist/workflows/schemas/workflow.d.ts +17 -0
  268. package/lib/dist/workflows/schemas/workflow.d.ts.map +1 -1
  269. package/lib/dist/workflows/schemas/workflow.js +27 -0
  270. package/lib/dist/workflows/schemas/workflow.js.map +1 -1
  271. package/lib/node_modules/.package-lock.json +1 -1
  272. package/lib/package.json +2 -2
  273. package/package.json +5 -3
  274. package/node.exe +0 -4
@@ -111,7 +111,36 @@ export declare const MAX_PINNED_FILES = 4;
111
111
  * query order (earliest-named pins first) and are capped.
112
112
  */
113
113
  export declare function resolveNamedFilePaths(tokens: readonly string[], filePaths: readonly string[], cap?: number): string[];
114
- export declare function getExploreOutputBudget(fileCount: number): ExploreOutputBudget;
114
+ /**
115
+ * Lite-tier overlay on a size-tier budget (REQ-LOWEND-004).
116
+ *
117
+ * A low-end model abandons a tool chain the instant an answer looks partial,
118
+ * so it needs the top cluster COMPLETE far more than it needs a wide survey.
119
+ * The overlay therefore concentrates the tier's existing budget rather than
120
+ * enlarging it: `maxOutputChars` is untouched (it is the ~24K inline
121
+ * tool-result ceiling — exceeding it makes the host externalize the payload
122
+ * to a file the agent Reads back, re-introducing the very read this exists to
123
+ * prevent), while `maxCharsPerFile` rises and `defaultMaxFiles` falls so the
124
+ * same bytes land as fuller bodies on fewer files. `maxCharsPerFile` is a
125
+ * `max()` and `defaultMaxFiles` a `min()`, so the overlay can never shrink a
126
+ * body below what its size tier already returns (the monotonicity invariant
127
+ * in `src/mcp/CLAUDE.md`).
128
+ *
129
+ * The meta-text flags are the INVERSE of the small-repo tiers, hence explicit
130
+ * overrides rather than reuse: the trailing lists (additional files, budget
131
+ * note) are breadth pointers a lite model won't productively follow, but the
132
+ * completeness signal — "this source is complete, do NOT re-read" — is the one
133
+ * line that stops the Read fallback, so it is always on regardless of size.
134
+ */
135
+ export declare function applyLiteExploreBudget(base: ExploreOutputBudget): ExploreOutputBudget;
136
+ /**
137
+ * Output budget for one `specship_explore` call: the project-size tier,
138
+ * optionally overlaid by the session's model tier.
139
+ *
140
+ * `tier` defaults to `full`, and `standard` is a pass-through, so full- and
141
+ * standard-tier output stays byte-identical to today (REQ-LOWEND-004.A3).
142
+ */
143
+ export declare function getExploreOutputBudget(fileCount: number, tier?: ModelTier): ExploreOutputBudget;
115
144
  /**
116
145
  * Per-file staleness banner emitted at the top of a tool response when the
117
146
  * file watcher has pending events for files referenced by the response.
@@ -226,6 +255,13 @@ export declare class ToolHandler {
226
255
  private toolAllowlist;
227
256
  /** Whether a tool name passes the SPECSHIP_MCP_TOOLS allowlist (if any). */
228
257
  private isToolAllowed;
258
+ /**
259
+ * Whether the default project has at least one indexed spec. One
260
+ * `LIMIT 1` probe on the `specs` primary key — cheap enough for every
261
+ * ListTools call. Any failure (pre-spec schema, closed DB) reads as "no
262
+ * specs", which keeps the tiny-repo list unchanged.
263
+ */
264
+ private hasIndexedSpecs;
229
265
  /**
230
266
  * Get tool definitions with dynamic descriptions based on project size.
231
267
  * The specship_explore tool description includes a budget recommendation
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAsC,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAgBrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAyD3C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAC;IACxB,4EAA4E;IAC5E,eAAe,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0EAA0E;IAC1E,2BAA2B,EAAE,MAAM,CAAC;IACpC,2CAA2C;IAC3C,oBAAoB,EAAE,OAAO,CAAC;IAC9B,yEAAyE;IACzE,sBAAsB,EAAE,OAAO,CAAC;IAChC,sEAAsE;IACtE,yBAAyB,EAAE,OAAO,CAAC;IACnC,sDAAsD;IACtD,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;;;;OAOG;IACH,oBAAoB,EAAE,OAAO,CAAC;CAC/B;A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IACH,OAAO,CAAC,eAAe;IAcvB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA4EvB;;;OAGG;IACH;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,aAAa;IAqCrB;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB;IA+CzB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAsCtB;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,mBAAmB;IAgB3B,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,YAAY;IA4BpB;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAe7B,OAAO,CAAC,iBAAiB;IA8BzB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;CAMpB"}
@@ -9,6 +9,7 @@ exports.ToolHandler = exports.tools = exports.MAX_PINNED_FILES = exports.SEEDABL
9
9
  exports.getExploreBudget = getExploreBudget;
10
10
  exports.extractNamedTokens = extractNamedTokens;
11
11
  exports.resolveNamedFilePaths = resolveNamedFilePaths;
12
+ exports.applyLiteExploreBudget = applyLiteExploreBudget;
12
13
  exports.getExploreOutputBudget = getExploreOutputBudget;
13
14
  exports.formatStaleBanner = formatStaleBanner;
14
15
  exports.formatStaleFooter = formatStaleFooter;
@@ -213,7 +214,66 @@ function resolveNamedFilePaths(tokens, filePaths, cap = exports.MAX_PINNED_FILES
213
214
  }
214
215
  return out;
215
216
  }
216
- function getExploreOutputBudget(fileCount) {
217
+ /** Breadth ceiling on the lite tier — depth over breadth (REQ-LOWEND-004). */
218
+ const LITE_MAX_FILES = 3;
219
+ /**
220
+ * Floor on the lite tier's per-file body cap. Sized so the top-ranked file's
221
+ * relevant clusters come back whole (~200 lines) instead of tail-trimmed,
222
+ * which is what sends a low-end model to Read (REQ-LOWEND-004.A1).
223
+ */
224
+ const LITE_MIN_CHARS_PER_FILE = 8000;
225
+ /**
226
+ * Lite-tier overlay on a size-tier budget (REQ-LOWEND-004).
227
+ *
228
+ * A low-end model abandons a tool chain the instant an answer looks partial,
229
+ * so it needs the top cluster COMPLETE far more than it needs a wide survey.
230
+ * The overlay therefore concentrates the tier's existing budget rather than
231
+ * enlarging it: `maxOutputChars` is untouched (it is the ~24K inline
232
+ * tool-result ceiling — exceeding it makes the host externalize the payload
233
+ * to a file the agent Reads back, re-introducing the very read this exists to
234
+ * prevent), while `maxCharsPerFile` rises and `defaultMaxFiles` falls so the
235
+ * same bytes land as fuller bodies on fewer files. `maxCharsPerFile` is a
236
+ * `max()` and `defaultMaxFiles` a `min()`, so the overlay can never shrink a
237
+ * body below what its size tier already returns (the monotonicity invariant
238
+ * in `src/mcp/CLAUDE.md`).
239
+ *
240
+ * The meta-text flags are the INVERSE of the small-repo tiers, hence explicit
241
+ * overrides rather than reuse: the trailing lists (additional files, budget
242
+ * note) are breadth pointers a lite model won't productively follow, but the
243
+ * completeness signal — "this source is complete, do NOT re-read" — is the one
244
+ * line that stops the Read fallback, so it is always on regardless of size.
245
+ */
246
+ function applyLiteExploreBudget(base) {
247
+ return {
248
+ ...base,
249
+ // Breadth down, depth up — same byte ceiling, concentrated.
250
+ defaultMaxFiles: Math.max(1, Math.min(base.defaultMaxFiles, LITE_MAX_FILES)),
251
+ maxCharsPerFile: Math.max(base.maxCharsPerFile, LITE_MIN_CHARS_PER_FILE),
252
+ maxOutputChars: base.maxOutputChars,
253
+ gapThreshold: base.gapThreshold,
254
+ // Breadth pointers off, stop-reading signal on. Relationships stay AT
255
+ // THE BASE VALUE: the section is the cheapest structural signal (see the
256
+ // explore doctrine test) and is not one of the trailing meta-sections
257
+ // REQ-LOWEND-004.A2 suppresses.
258
+ includeRelationships: base.includeRelationships,
259
+ includeAdditionalFiles: false,
260
+ includeBudgetNote: false,
261
+ includeCompletenessSignal: true,
262
+ excludeLowValueFiles: true,
263
+ };
264
+ }
265
+ /**
266
+ * Output budget for one `specship_explore` call: the project-size tier,
267
+ * optionally overlaid by the session's model tier.
268
+ *
269
+ * `tier` defaults to `full`, and `standard` is a pass-through, so full- and
270
+ * standard-tier output stays byte-identical to today (REQ-LOWEND-004.A3).
271
+ */
272
+ function getExploreOutputBudget(fileCount, tier = 'full') {
273
+ const base = baseExploreOutputBudget(fileCount);
274
+ return tier === 'lite' ? applyLiteExploreBudget(base) : base;
275
+ }
276
+ function baseExploreOutputBudget(fileCount) {
217
277
  // Tiered budget, scaled to project size. The budget is a CEILING (relevance
218
278
  // still gates WHAT is included), and it MUST stay under the agent's INLINE
219
279
  // tool-result cap (~25K chars). Above that, the host externalizes the result
@@ -647,6 +707,14 @@ const CODE_GRAPH_GROUP = new Set([
647
707
  'specship_files',
648
708
  'specship_health',
649
709
  ]);
710
+ /**
711
+ * Spec-layer tools that survive the tiny-repo trim when the project has ≥1
712
+ * indexed spec (REQ-AUDFIX-009). `specship_jira_*` tools join them by prefix,
713
+ * but only when the JIRA integration is enabled.
714
+ */
715
+ const SPEC_LAYER_TOOLS = new Set([
716
+ 'specship_spec', 'specship_link_assert', 'specship_link_verify', 'specship_drifted',
717
+ ]);
650
718
  function applyLiteTierTrim(list, hint) {
651
719
  if (!hint)
652
720
  return list;
@@ -757,6 +825,23 @@ class ToolHandler {
757
825
  const allow = this.toolAllowlist();
758
826
  return !allow || allow.has(name.replace(/^specship_/, ''));
759
827
  }
828
+ /**
829
+ * Whether the default project has at least one indexed spec. One
830
+ * `LIMIT 1` probe on the `specs` primary key — cheap enough for every
831
+ * ListTools call. Any failure (pre-spec schema, closed DB) reads as "no
832
+ * specs", which keeps the tiny-repo list unchanged.
833
+ */
834
+ hasIndexedSpecs() {
835
+ if (!this.cg)
836
+ return false;
837
+ try {
838
+ return this.cg.getSpecQueries().getRawDb()
839
+ .prepare('SELECT 1 FROM specs LIMIT 1').get() != null;
840
+ }
841
+ catch {
842
+ return false;
843
+ }
844
+ }
760
845
  /**
761
846
  * Get tool definitions with dynamic descriptions based on project size.
762
847
  * The specship_explore tool description includes a budget recommendation
@@ -810,7 +895,14 @@ class ToolHandler {
810
895
  if (stats.fileCount < TINY_REPO_FILE_THRESHOLD) {
811
896
  // Designer tools are not code-graph tools — the tiny-repo flow-question
812
897
  // economics that justify trimming don't apply, so they always survive.
813
- visible = visible.filter(t => TINY_REPO_CORE_TOOLS.has(t.name) || t.name.startsWith('designer_'));
898
+ // Neither is the spec layer: when the project has ≥1 indexed spec, the
899
+ // spec/link/drift tools (and JIRA tools, only if already enabled —
900
+ // `visible` is post-integration-filter) survive too (REQ-AUDFIX-009).
901
+ // With no specs the list is exactly today's trim (A2).
902
+ const keepSpecLayer = this.hasIndexedSpecs();
903
+ visible = visible.filter(t => TINY_REPO_CORE_TOOLS.has(t.name)
904
+ || t.name.startsWith('designer_')
905
+ || (keepSpecLayer && (SPEC_LAYER_TOOLS.has(t.name) || t.name.startsWith('specship_jira_'))));
814
906
  }
815
907
  // Lite-tier menu trim — shared with the proxy's static list (A4);
816
908
  // see applyLiteTierTrim above for the full contract.
@@ -2073,17 +2165,28 @@ class ToolHandler {
2073
2165
  return query;
2074
2166
  const cg = this.getSpecShip(args.projectPath);
2075
2167
  const projectRoot = cg.getProjectRoot();
2076
- // Resolve adaptive output budget from project size. Falls back to the
2168
+ // Resolve the session's model tier ONCE and reuse it for both the output
2169
+ // budget and the flow spine below — detection is a couple of cheap file
2170
+ // reads, but calling it twice would add latency for nothing
2171
+ // (REQ-LOWEND-004.A4).
2172
+ const modelTier = (0, model_context_1.detectModelTier)(projectRoot);
2173
+ // Resolve adaptive output budget from project size, overlaid by the model
2174
+ // tier (lite trades breadth for depth — REQ-LOWEND-004). Falls back to the
2077
2175
  // largest-tier defaults if stats aren't available, which preserves
2078
2176
  // pre-#185 behavior for callers that hit the rare stats failure.
2079
2177
  let budget;
2080
2178
  try {
2081
- budget = getExploreOutputBudget(cg.getStats().fileCount);
2179
+ budget = getExploreOutputBudget(cg.getStats().fileCount, modelTier);
2082
2180
  }
2083
2181
  catch {
2084
- budget = getExploreOutputBudget(Infinity);
2085
- }
2086
- const maxFiles = (0, utils_1.clamp)(args.maxFiles || budget.defaultMaxFiles, 1, 20);
2182
+ budget = getExploreOutputBudget(Infinity, modelTier);
2183
+ }
2184
+ // On lite tier a caller-supplied maxFiles may narrow but never widen the
2185
+ // overlay's breadth cut — otherwise the schema's advertised default (12)
2186
+ // hands the weakest model MORE output than full tier gets, inverting
2187
+ // REQ-LOWEND-004 (adversarial-review finding).
2188
+ const maxFilesCeiling = modelTier === 'lite' ? budget.defaultMaxFiles : 20;
2189
+ const maxFiles = (0, utils_1.clamp)(args.maxFiles || budget.defaultMaxFiles, 1, maxFilesCeiling);
2087
2190
  // Step 1: Find relevant context with generous parameters.
2088
2191
  // Use a large maxNodes budget — explore has its own 35k char output limit
2089
2192
  // that prevents context bloat, so more nodes just means better coverage
@@ -2512,7 +2615,7 @@ class ToolHandler {
2512
2615
  // Compute the flow spine once — used both to prepend the Flow section (below)
2513
2616
  // and to gate adaptive source sizing: files on the spine get full source,
2514
2617
  // off-spine peers skeletonize.
2515
- const flow = this.buildFlowFromNamedSymbols(cg, query, (0, model_context_1.detectModelTier)(cg.getProjectRoot()));
2618
+ const flow = this.buildFlowFromNamedSymbols(cg, query, modelTier);
2516
2619
  // Polymorphic-sibling detector for adaptive sizing. A class that implements/
2517
2620
  // extends a supertype shared by >= MIN_SIBLINGS classes is one of many
2518
2621
  // INTERCHANGEABLE implementations (OkHttp's 14 `: Interceptor` classes —
@@ -3059,7 +3162,15 @@ class ToolHandler {
3059
3162
  if (budget.includeCompletenessSignal) {
3060
3163
  lines.push('');
3061
3164
  lines.push('---');
3062
- lines.push(`> **Complete source for ${filesIncluded} files is included above — do NOT re-read them.** If your question also needs files/symbols listed under "Not shown above" (or any area this call didn't cover), make ANOTHER specship_explore targeting those names — it returns the same source with line numbers and is cheaper and more complete than reading. Reserve Read for a single specific line range explore can't surface.`);
3165
+ if (budget.includeAdditionalFiles) {
3166
+ lines.push(`> **Complete source for ${filesIncluded} files is included above — do NOT re-read them.** If your question also needs files/symbols listed under "Not shown above" (or any area this call didn't cover), make ANOTHER specship_explore targeting those names — it returns the same source with line numbers and is cheaper and more complete than reading. Reserve Read for a single specific line range explore can't surface.`);
3167
+ }
3168
+ else {
3169
+ // Lite tier keeps the signal but renders no "Not shown above" list
3170
+ // (REQ-LOWEND-004.A2), so the clause pointing at it would name a
3171
+ // section that isn't there. Same one-line shape, no dangling reference.
3172
+ lines.push(`> **Complete source for ${filesIncluded} files is included above — do NOT re-read them.** If your question needs an area this call didn't cover, make ANOTHER specship_explore naming those symbols or files — it returns the same source with line numbers and is cheaper and more complete than reading. Reserve Read for a single specific line range explore can't surface.`);
3173
+ }
3063
3174
  }
3064
3175
  else if (anyFileTrimmed) {
3065
3176
  lines.push('');