seer-mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (371) hide show
  1. package/.vscode/settings.json +3 -0
  2. package/LICENSE +176 -0
  3. package/README.md +272 -0
  4. package/README_dev.md +199 -0
  5. package/dist/bundle/ci.d.ts +47 -0
  6. package/dist/bundle/ci.d.ts.map +1 -0
  7. package/dist/bundle/ci.js +113 -0
  8. package/dist/bundle/ci.js.map +1 -0
  9. package/dist/bundle/contract.d.ts +111 -0
  10. package/dist/bundle/contract.d.ts.map +1 -0
  11. package/dist/bundle/contract.js +352 -0
  12. package/dist/bundle/contract.js.map +1 -0
  13. package/dist/bundle/export.d.ts +36 -0
  14. package/dist/bundle/export.d.ts.map +1 -0
  15. package/dist/bundle/export.js +152 -0
  16. package/dist/bundle/export.js.map +1 -0
  17. package/dist/bundle/external.d.ts +66 -0
  18. package/dist/bundle/external.d.ts.map +1 -0
  19. package/dist/bundle/external.js +238 -0
  20. package/dist/bundle/external.js.map +1 -0
  21. package/dist/bundle/format.d.ts +94 -0
  22. package/dist/bundle/format.d.ts.map +1 -0
  23. package/dist/bundle/format.js +42 -0
  24. package/dist/bundle/format.js.map +1 -0
  25. package/dist/bundle/import.d.ts +49 -0
  26. package/dist/bundle/import.d.ts.map +1 -0
  27. package/dist/bundle/import.js +116 -0
  28. package/dist/bundle/import.js.map +1 -0
  29. package/dist/cli/index.d.ts +3 -0
  30. package/dist/cli/index.d.ts.map +1 -0
  31. package/dist/cli/index.js +1402 -0
  32. package/dist/cli/index.js.map +1 -0
  33. package/dist/cli/init.d.ts +48 -0
  34. package/dist/cli/init.d.ts.map +1 -0
  35. package/dist/cli/init.js +284 -0
  36. package/dist/cli/init.js.map +1 -0
  37. package/dist/db/schema.d.ts +3 -0
  38. package/dist/db/schema.d.ts.map +1 -0
  39. package/dist/db/schema.js +616 -0
  40. package/dist/db/schema.js.map +1 -0
  41. package/dist/db/store.d.ts +1011 -0
  42. package/dist/db/store.d.ts.map +1 -0
  43. package/dist/db/store.js +3888 -0
  44. package/dist/db/store.js.map +1 -0
  45. package/dist/graph/pagerank.d.ts +9 -0
  46. package/dist/graph/pagerank.d.ts.map +1 -0
  47. package/dist/graph/pagerank.js +47 -0
  48. package/dist/graph/pagerank.js.map +1 -0
  49. package/dist/indexer/architecture.d.ts +72 -0
  50. package/dist/indexer/architecture.d.ts.map +1 -0
  51. package/dist/indexer/architecture.js +112 -0
  52. package/dist/indexer/architecture.js.map +1 -0
  53. package/dist/indexer/behavior.d.ts +75 -0
  54. package/dist/indexer/behavior.d.ts.map +1 -0
  55. package/dist/indexer/behavior.js +395 -0
  56. package/dist/indexer/behavior.js.map +1 -0
  57. package/dist/indexer/boundaries.d.ts +60 -0
  58. package/dist/indexer/boundaries.d.ts.map +1 -0
  59. package/dist/indexer/boundaries.js +366 -0
  60. package/dist/indexer/boundaries.js.map +1 -0
  61. package/dist/indexer/churn.d.ts +15 -0
  62. package/dist/indexer/churn.d.ts.map +1 -0
  63. package/dist/indexer/churn.js +49 -0
  64. package/dist/indexer/churn.js.map +1 -0
  65. package/dist/indexer/classify.d.ts +9 -0
  66. package/dist/indexer/classify.d.ts.map +1 -0
  67. package/dist/indexer/classify.js +90 -0
  68. package/dist/indexer/classify.js.map +1 -0
  69. package/dist/indexer/context.d.ts +176 -0
  70. package/dist/indexer/context.d.ts.map +1 -0
  71. package/dist/indexer/context.js +193 -0
  72. package/dist/indexer/context.js.map +1 -0
  73. package/dist/indexer/continuity.d.ts +67 -0
  74. package/dist/indexer/continuity.d.ts.map +1 -0
  75. package/dist/indexer/continuity.js +288 -0
  76. package/dist/indexer/continuity.js.map +1 -0
  77. package/dist/indexer/detectchanges.d.ts +32 -0
  78. package/dist/indexer/detectchanges.d.ts.map +1 -0
  79. package/dist/indexer/detectchanges.js +74 -0
  80. package/dist/indexer/detectchanges.js.map +1 -0
  81. package/dist/indexer/discovery.d.ts +37 -0
  82. package/dist/indexer/discovery.d.ts.map +1 -0
  83. package/dist/indexer/discovery.js +136 -0
  84. package/dist/indexer/discovery.js.map +1 -0
  85. package/dist/indexer/externaldeps.d.ts +18 -0
  86. package/dist/indexer/externaldeps.d.ts.map +1 -0
  87. package/dist/indexer/externaldeps.js +288 -0
  88. package/dist/indexer/externaldeps.js.map +1 -0
  89. package/dist/indexer/freshness.d.ts +48 -0
  90. package/dist/indexer/freshness.d.ts.map +1 -0
  91. package/dist/indexer/freshness.js +128 -0
  92. package/dist/indexer/freshness.js.map +1 -0
  93. package/dist/indexer/git.d.ts +144 -0
  94. package/dist/indexer/git.d.ts.map +1 -0
  95. package/dist/indexer/git.js +444 -0
  96. package/dist/indexer/git.js.map +1 -0
  97. package/dist/indexer/index.d.ts +145 -0
  98. package/dist/indexer/index.d.ts.map +1 -0
  99. package/dist/indexer/index.js +930 -0
  100. package/dist/indexer/index.js.map +1 -0
  101. package/dist/indexer/modules.d.ts +62 -0
  102. package/dist/indexer/modules.d.ts.map +1 -0
  103. package/dist/indexer/modules.js +293 -0
  104. package/dist/indexer/modules.js.map +1 -0
  105. package/dist/indexer/preflight.d.ts +154 -0
  106. package/dist/indexer/preflight.d.ts.map +1 -0
  107. package/dist/indexer/preflight.js +399 -0
  108. package/dist/indexer/preflight.js.map +1 -0
  109. package/dist/indexer/protoScanner.d.ts +34 -0
  110. package/dist/indexer/protoScanner.d.ts.map +1 -0
  111. package/dist/indexer/protoScanner.js +133 -0
  112. package/dist/indexer/protoScanner.js.map +1 -0
  113. package/dist/indexer/risk.d.ts +115 -0
  114. package/dist/indexer/risk.d.ts.map +1 -0
  115. package/dist/indexer/risk.js +194 -0
  116. package/dist/indexer/risk.js.map +1 -0
  117. package/dist/indexer/serviceHostScanner.d.ts +25 -0
  118. package/dist/indexer/serviceHostScanner.d.ts.map +1 -0
  119. package/dist/indexer/serviceHostScanner.js +95 -0
  120. package/dist/indexer/serviceHostScanner.js.map +1 -0
  121. package/dist/indexer/serviceLinks.d.ts +105 -0
  122. package/dist/indexer/serviceLinks.d.ts.map +1 -0
  123. package/dist/indexer/serviceLinks.js +509 -0
  124. package/dist/indexer/serviceLinks.js.map +1 -0
  125. package/dist/indexer/shapehash.d.ts +98 -0
  126. package/dist/indexer/shapehash.d.ts.map +1 -0
  127. package/dist/indexer/shapehash.js +354 -0
  128. package/dist/indexer/shapehash.js.map +1 -0
  129. package/dist/indexer/skeleton.d.ts +15 -0
  130. package/dist/indexer/skeleton.d.ts.map +1 -0
  131. package/dist/indexer/skeleton.js +136 -0
  132. package/dist/indexer/skeleton.js.map +1 -0
  133. package/dist/indexer/symbolhistory.d.ts +41 -0
  134. package/dist/indexer/symbolhistory.d.ts.map +1 -0
  135. package/dist/indexer/symbolhistory.js +124 -0
  136. package/dist/indexer/symbolhistory.js.map +1 -0
  137. package/dist/indexer/watcher.d.ts +68 -0
  138. package/dist/indexer/watcher.d.ts.map +1 -0
  139. package/dist/indexer/watcher.js +179 -0
  140. package/dist/indexer/watcher.js.map +1 -0
  141. package/dist/mcp/server.d.ts +80 -0
  142. package/dist/mcp/server.d.ts.map +1 -0
  143. package/dist/mcp/server.js +1610 -0
  144. package/dist/mcp/server.js.map +1 -0
  145. package/dist/parser/index.d.ts +8 -0
  146. package/dist/parser/index.d.ts.map +1 -0
  147. package/dist/parser/index.js +33 -0
  148. package/dist/parser/index.js.map +1 -0
  149. package/dist/parser/languages/cpp.d.ts +3 -0
  150. package/dist/parser/languages/cpp.d.ts.map +1 -0
  151. package/dist/parser/languages/cpp.js +350 -0
  152. package/dist/parser/languages/cpp.js.map +1 -0
  153. package/dist/parser/languages/csharp.d.ts +3 -0
  154. package/dist/parser/languages/csharp.d.ts.map +1 -0
  155. package/dist/parser/languages/csharp.js +239 -0
  156. package/dist/parser/languages/csharp.js.map +1 -0
  157. package/dist/parser/languages/go.d.ts +3 -0
  158. package/dist/parser/languages/go.d.ts.map +1 -0
  159. package/dist/parser/languages/go.js +259 -0
  160. package/dist/parser/languages/go.js.map +1 -0
  161. package/dist/parser/languages/java.d.ts +3 -0
  162. package/dist/parser/languages/java.d.ts.map +1 -0
  163. package/dist/parser/languages/java.js +391 -0
  164. package/dist/parser/languages/java.js.map +1 -0
  165. package/dist/parser/languages/python.d.ts +3 -0
  166. package/dist/parser/languages/python.d.ts.map +1 -0
  167. package/dist/parser/languages/python.js +396 -0
  168. package/dist/parser/languages/python.js.map +1 -0
  169. package/dist/parser/languages/rust.d.ts +3 -0
  170. package/dist/parser/languages/rust.d.ts.map +1 -0
  171. package/dist/parser/languages/rust.js +159 -0
  172. package/dist/parser/languages/rust.js.map +1 -0
  173. package/dist/parser/languages/typescript.d.ts +3 -0
  174. package/dist/parser/languages/typescript.d.ts.map +1 -0
  175. package/dist/parser/languages/typescript.js +1442 -0
  176. package/dist/parser/languages/typescript.js.map +1 -0
  177. package/dist/parser/parserContext.d.ts +77 -0
  178. package/dist/parser/parserContext.d.ts.map +1 -0
  179. package/dist/parser/parserContext.js +354 -0
  180. package/dist/parser/parserContext.js.map +1 -0
  181. package/dist/parser/walker.d.ts +81 -0
  182. package/dist/parser/walker.d.ts.map +1 -0
  183. package/dist/parser/walker.js +217 -0
  184. package/dist/parser/walker.js.map +1 -0
  185. package/dist/parser/worker.d.ts +66 -0
  186. package/dist/parser/worker.d.ts.map +1 -0
  187. package/dist/parser/worker.js +129 -0
  188. package/dist/parser/worker.js.map +1 -0
  189. package/dist/parser/workerpool.d.ts +107 -0
  190. package/dist/parser/workerpool.d.ts.map +1 -0
  191. package/dist/parser/workerpool.js +383 -0
  192. package/dist/parser/workerpool.js.map +1 -0
  193. package/dist/scip/format.d.ts +87 -0
  194. package/dist/scip/format.d.ts.map +1 -0
  195. package/dist/scip/format.js +31 -0
  196. package/dist/scip/format.js.map +1 -0
  197. package/dist/scip/import.d.ts +37 -0
  198. package/dist/scip/import.d.ts.map +1 -0
  199. package/dist/scip/import.js +180 -0
  200. package/dist/scip/import.js.map +1 -0
  201. package/dist/types.d.ts +392 -0
  202. package/dist/types.d.ts.map +1 -0
  203. package/dist/types.js +4 -0
  204. package/dist/types.js.map +1 -0
  205. package/docs/architecture.md +105 -0
  206. package/docs/benchmarks/methodology.md +134 -0
  207. package/docs/benchmarks/raw-results.md +71 -0
  208. package/docs/benchmarks.md +74 -0
  209. package/docs/cli.md +148 -0
  210. package/docs/examples/behavior-tests.md +70 -0
  211. package/docs/examples/change-history.md +85 -0
  212. package/docs/examples/pre-edit-context.md +81 -0
  213. package/docs/examples/service-links.md +88 -0
  214. package/docs/examples.md +80 -0
  215. package/docs/faq.md +70 -0
  216. package/docs/internals.md +104 -0
  217. package/docs/languages.md +70 -0
  218. package/docs/limits.md +52 -0
  219. package/docs/mcp.md +199 -0
  220. package/docs/quickstart.md +119 -0
  221. package/docs/testing.md +123 -0
  222. package/docs/tools.md +115 -0
  223. package/package.json +52 -0
  224. package/research-codebase.md +578 -0
  225. package/seer-cli-docs.md +326 -0
  226. package/seer-master-guide.md +246 -0
  227. package/src/bundle/ci.ts +141 -0
  228. package/src/bundle/contract.ts +387 -0
  229. package/src/bundle/export.ts +175 -0
  230. package/src/bundle/external.ts +285 -0
  231. package/src/bundle/format.ts +92 -0
  232. package/src/bundle/import.ts +157 -0
  233. package/src/cli/index.ts +1249 -0
  234. package/src/cli/init.ts +389 -0
  235. package/src/db/schema.ts +614 -0
  236. package/src/db/store.ts +4306 -0
  237. package/src/graph/pagerank.ts +53 -0
  238. package/src/indexer/architecture.ts +148 -0
  239. package/src/indexer/behavior.ts +466 -0
  240. package/src/indexer/boundaries.ts +374 -0
  241. package/src/indexer/churn.ts +58 -0
  242. package/src/indexer/classify.ts +96 -0
  243. package/src/indexer/context.ts +340 -0
  244. package/src/indexer/continuity.ts +322 -0
  245. package/src/indexer/detectchanges.ts +94 -0
  246. package/src/indexer/discovery.ts +176 -0
  247. package/src/indexer/externaldeps.ts +243 -0
  248. package/src/indexer/freshness.ts +166 -0
  249. package/src/indexer/git.ts +453 -0
  250. package/src/indexer/index.ts +1092 -0
  251. package/src/indexer/modules.ts +358 -0
  252. package/src/indexer/preflight.ts +548 -0
  253. package/src/indexer/protoScanner.ts +147 -0
  254. package/src/indexer/risk.ts +304 -0
  255. package/src/indexer/serviceHostScanner.ts +92 -0
  256. package/src/indexer/serviceLinks.ts +543 -0
  257. package/src/indexer/shapehash.ts +370 -0
  258. package/src/indexer/skeleton.ts +169 -0
  259. package/src/indexer/symbolhistory.ts +172 -0
  260. package/src/indexer/watcher.ts +206 -0
  261. package/src/mcp/server.ts +1659 -0
  262. package/src/parser/index.ts +37 -0
  263. package/src/parser/languages/cpp.ts +361 -0
  264. package/src/parser/languages/csharp.ts +235 -0
  265. package/src/parser/languages/go.ts +259 -0
  266. package/src/parser/languages/java.ts +382 -0
  267. package/src/parser/languages/python.ts +370 -0
  268. package/src/parser/languages/rust.ts +164 -0
  269. package/src/parser/languages/typescript.ts +1435 -0
  270. package/src/parser/parserContext.ts +392 -0
  271. package/src/parser/walker.ts +306 -0
  272. package/src/parser/worker.ts +181 -0
  273. package/src/parser/workerpool.ts +448 -0
  274. package/src/scip/format.ts +83 -0
  275. package/src/scip/import.ts +216 -0
  276. package/src/types.ts +457 -0
  277. package/tests/benchmark-service-links.ts +244 -0
  278. package/tests/bug-regressions.ts +626 -0
  279. package/tests/filters.ts +264 -0
  280. package/tests/fixtures/Counter.tsx +38 -0
  281. package/tests/fixtures/caller.ts +7 -0
  282. package/tests/fixtures/collisions.ts +23 -0
  283. package/tests/fixtures/local_helper.ts +5 -0
  284. package/tests/fixtures/overloads.java +17 -0
  285. package/tests/fixtures/remote_helper.ts +4 -0
  286. package/tests/fixtures/sample.c +15 -0
  287. package/tests/fixtures/sample.cpp +47 -0
  288. package/tests/fixtures/sample.cs +62 -0
  289. package/tests/fixtures/sample.go +68 -0
  290. package/tests/fixtures/sample.h +30 -0
  291. package/tests/fixtures/sample.java +85 -0
  292. package/tests/fixtures/sample.py +46 -0
  293. package/tests/fixtures/sample.rs +78 -0
  294. package/tests/fixtures/sample.ts +76 -0
  295. package/tests/fixtures-service/HttpClients.cs +30 -0
  296. package/tests/fixtures-service/HttpClients.java +24 -0
  297. package/tests/fixtures-service/billing.ts +15 -0
  298. package/tests/fixtures-service/docker-compose.yml +15 -0
  299. package/tests/fixtures-service/gateway.ts +10 -0
  300. package/tests/fixtures-service/get_user.ts +11 -0
  301. package/tests/fixtures-service/graphql_client.ts +63 -0
  302. package/tests/fixtures-service/graphql_server.ts +30 -0
  303. package/tests/fixtures-service/grpc_client.go +30 -0
  304. package/tests/fixtures-service/http_clients.go +23 -0
  305. package/tests/fixtures-service/http_clients.py +38 -0
  306. package/tests/fixtures-service/http_clients.ts +49 -0
  307. package/tests/fixtures-service/k8s/payment-service.yaml +22 -0
  308. package/tests/fixtures-service/k8s_calls.ts +20 -0
  309. package/tests/fixtures-service/messaging.ts +87 -0
  310. package/tests/fixtures-service/trpc_client.ts +39 -0
  311. package/tests/fixtures-service/trpc_server.ts +39 -0
  312. package/tests/fixtures-service/user_service.proto +33 -0
  313. package/tests/fixtures-trackcd/Cargo.toml +11 -0
  314. package/tests/fixtures-trackcd/SpringController.java +36 -0
  315. package/tests/fixtures-trackcd/auth_service.ts +19 -0
  316. package/tests/fixtures-trackcd/complex_module.py +50 -0
  317. package/tests/fixtures-trackcd/express_app.js +30 -0
  318. package/tests/fixtures-trackcd/fastapi_app.py +49 -0
  319. package/tests/fixtures-trackcd/fastify_object_routes.js +32 -0
  320. package/tests/fixtures-trackcd/go.mod +8 -0
  321. package/tests/fixtures-trackcd/package.json +15 -0
  322. package/tests/fixtures-trackcd/requirements.txt +4 -0
  323. package/tests/fixtures-trackcd/tests/auth_service.test.ts +13 -0
  324. package/tests/fixtures-tracke/auth/AuthService.ts +23 -0
  325. package/tests/fixtures-tracke/auth/crypto.ts +7 -0
  326. package/tests/fixtures-tracke/billing/Billing.ts +20 -0
  327. package/tests/fixtures-tracke/billing/Invoice.ts +10 -0
  328. package/tests/fixtures-tracke/billing/server.ts +17 -0
  329. package/tests/fixtures-tracke/package.json +7 -0
  330. package/tests/fixtures-tracke/tests/auth.test.ts +23 -0
  331. package/tests/fixtures-tracke/tests/billing.test.ts +14 -0
  332. package/tests/fixtures-trackf/package.json +5 -0
  333. package/tests/fixtures-trackf/src/auth.ts +26 -0
  334. package/tests/fixtures-trackf/src/handlers.ts +35 -0
  335. package/tests/fixtures-tracki/billing/routes.ts +12 -0
  336. package/tests/fixtures-tracki/gateway/client.ts +13 -0
  337. package/tests/git-features.ts +267 -0
  338. package/tests/init.ts +141 -0
  339. package/tests/mcp-jit.ts +130 -0
  340. package/tests/mcp-smoke.ts +191 -0
  341. package/tests/mcp-trackcd.ts +169 -0
  342. package/tests/mcp-tracke.ts +229 -0
  343. package/tests/mcp-trackf.ts +330 -0
  344. package/tests/mcp-trackg.ts +219 -0
  345. package/tests/mcp-tracki.ts +174 -0
  346. package/tests/mcp-watcher.ts +126 -0
  347. package/tests/optspec.ts +194 -0
  348. package/tests/parallel-index.ts +333 -0
  349. package/tests/parallel-read.ts +125 -0
  350. package/tests/parallel-recovery.ts +241 -0
  351. package/tests/perf-callers.ts +145 -0
  352. package/tests/query-parity.ts +184 -0
  353. package/tests/query-perf.ts +55 -0
  354. package/tests/scale-parallel-parity.ts +225 -0
  355. package/tests/scale-test.ts +523 -0
  356. package/tests/smoke.ts +396 -0
  357. package/tests/trackcd.ts +325 -0
  358. package/tests/tracke-collisions.ts +255 -0
  359. package/tests/tracke.ts +314 -0
  360. package/tests/trackf-bugs.ts +406 -0
  361. package/tests/trackf.ts +390 -0
  362. package/tests/trackg.ts +1372 -0
  363. package/tests/tracki-boundaries.ts +202 -0
  364. package/tests/tracki-continuity.ts +253 -0
  365. package/tests/tracki-contract-diff.ts +249 -0
  366. package/tests/tracki-external-bundles.ts +341 -0
  367. package/tests/tracki-preflight.ts +251 -0
  368. package/tests/verify-roles.ts +51 -0
  369. package/tests/worker-parity.ts +286 -0
  370. package/tests/worker-pool.ts +262 -0
  371. package/tsconfig.json +20 -0
@@ -0,0 +1,326 @@
1
+ # Seer CLI & MCP Docs For AI Agents
2
+
3
+ This file is a compact command guide for agents using Seer from a shell or MCP client. Seer-Core is deterministic and non-AI: commands return structural facts, metrics, and relationships from a local SQLite index.
4
+
5
+ Default database location: `<repo>/.seer/graph.db`.
6
+ Most query commands auto-detect `.seer/graph.db` by walking upward from the current directory. Use `--db <path>` when querying a saved DB or a repo from outside its root.
7
+
8
+ ---
9
+
10
+ ## 1. First Call & Reindexing
11
+
12
+ ```bash
13
+ seer index <repo-path>
14
+ ```
15
+
16
+ Builds or refreshes the index. Run this before query commands unless an MCP server has already created the index.
17
+
18
+ ### Useful Options:
19
+ ```bash
20
+ seer index <repo-path> --db <path>
21
+ seer index <repo-path> --reset
22
+ seer index <repo-path> --verbose
23
+ seer index <repo-path> --max-file-kb 1024
24
+ seer index <repo-path> --mode fast
25
+ seer index <repo-path> --mode full --include-vendor --include-generated
26
+ seer index <repo-path> --parallel
27
+ seer index <repo-path> --no-parallel
28
+ seer index <repo-path> --jobs 4
29
+ ```
30
+
31
+ * **Discovery Modes (`--mode`):** `standard` (default, excludes massive dependencies/generated files), `fast` (excludes docs/examples/static assets), or `full` (indexes everything).
32
+ * **Worker Parsing:** Enabled automatically for normal/large repos. Tiny repos stay serial unless forced via `--parallel`. Disable worker parsing via `--no-parallel`.
33
+
34
+ ---
35
+
36
+ ## 2. Health, Stats & Architecture
37
+
38
+ ```bash
39
+ seer health [--db <path>]
40
+ seer stats [--db <path>]
41
+ seer architecture [--db <path>]
42
+ ```
43
+
44
+ * **`health`:** Quick check of database status, schema version (now **v10**), and role counts. Cheap; never blocks on freshness.
45
+ * **`stats`:** Numeric counts of files, symbols, edges, routes, and config keys.
46
+ * **`architecture`** (or `arch`): High-level snapshot of the codebase including top symbols, Louvain module sizes, entry points, and API frameworks.
47
+
48
+ ---
49
+
50
+ ## 3. Search & Symbols
51
+
52
+ ```bash
53
+ seer symbols [query] [--db <path>] [--file <path>] [--top <n>]
54
+ ```
55
+
56
+ * Without a query, lists top PageRank symbols (rankable kinds only: functions, methods, constructors, classes).
57
+ * With a query, performs a substring search across names and qualified names.
58
+
59
+ ### Filtering Options:
60
+ Default queries hide vendor, generated, test-file symbols, forward declarations, and type references. Opt in explicitly:
61
+ ```bash
62
+ seer symbols <query> --include-tests
63
+ seer symbols <query> --include-declarations
64
+ seer symbols <query> --include-vendor
65
+ seer symbols <query> --include-generated
66
+ seer symbols <query> --include-type-refs
67
+ ```
68
+
69
+ ---
70
+
71
+ ## 4. Call Graph (Legacy vs. Id-Scoped)
72
+
73
+ ```bash
74
+ # Legacy, name-based (broad, returns all symbols matching short name)
75
+ seer callers <symbol> [--db <path>] [--limit <n>]
76
+ seer callees <symbol> [--db <path>] [--limit <n>]
77
+ ```
78
+
79
+ For high-precision queries, prefer the **Track E/v10 consolidated tools** (`preflight`, `context`, `risk`) which map call graphs to resolved, exact IDs.
80
+
81
+ ---
82
+
83
+ ## 5. Routes, Dependencies, Config
84
+
85
+ ```bash
86
+ seer routes [--db <path>] [--method POST] [--framework express] [--path checkout] [--limit <n>]
87
+ seer deps [--db <path>] [--ecosystem npm] [--name react] [--limit <n>]
88
+ seer config [--db <path>] [--key DATABASE_URL] [--limit <n>]
89
+ ```
90
+
91
+ * **`routes`:** Static API registrations (Express, Fastify, FastAPI, Flask, Spring, gRPC, tRPC, GraphQL, and message brokers).
92
+ * **`deps`:** External dependencies parsed from manifests (`package.json`, `Cargo.toml`, `pyproject.toml`, etc.).
93
+ * **`config`:** Deterministic environment variable or configuration reads mapped back to their enclosing symbol.
94
+
95
+ ---
96
+
97
+ ## 6. Monorepo Boundaries (New in v10)
98
+
99
+ Detects logical barriers in monorepos based on package manifests (`package.json`, `go.mod`, `Cargo.toml`, etc.) or fallback paths (`packages/*`, `services/*`).
100
+
101
+ ```bash
102
+ seer boundaries [--db <path>] [--limit <n>]
103
+ ```
104
+
105
+ *Advisory only. Edges crossing logical boundaries are flagged as `boundaryCrossings` in risk profiles.*
106
+
107
+ ---
108
+
109
+ ## 7. Preflight, Context & Risk (Consolidated Workspace Intelligence)
110
+
111
+ ```bash
112
+ # Consolidated Context (Symbol mode)
113
+ seer preflight --symbol <symbol> [--file <path>]
114
+
115
+ # Consolidated Context (Range/Change mode)
116
+ seer preflight --from <ref> --to <ref> [--old-bundle <path>] [--new-bundle <path>]
117
+ ```
118
+
119
+ ### Preflight Command Options:
120
+ * `--symbol <name>` / `--file <path>`: Build a pre-edit packet for the specific symbol.
121
+ * `--from <ref>` / `--to <ref>`: Diff-range packet. Translates Git diff line changes into affected AST symbols via `detectChanges` to map downstream blast radius.
122
+ * `--old-bundle <path>` / `--new-bundle <path>`: Optional bundle pair to attach a **Contract Diff** preview automatically.
123
+ * `--max-symbols <n>` / `--max-tests <n>` / `--max-history <n>`: Caps for returned segments.
124
+ * `--json`: Print machine-readable JSON output.
125
+
126
+ ### Legacy/Specific Queries:
127
+ ```bash
128
+ seer context <symbol> [--db <path>] [--file <path>] # Pre-edit evidence bundle (use --file to disambiguate)
129
+ seer risk <symbol> [--db <path>] [--depth <n>] # Decomposed risk scores (cyclomatic, complexity, boundary crossings)
130
+ seer behavior <symbol> [--db <path>] [--limit <n>] [--depth <n>] # Ranked tests-as-behavioral-spec exercising the symbol
131
+ seer detect-changes [--db <path>] [--from <ref>] [--to <ref>] [--depth <n>] # Stands-alone blast-radius diff
132
+ ```
133
+
134
+ ---
135
+
136
+ ## 8. Git History, Churn & Continuity (v10 Refinement)
137
+
138
+ ```bash
139
+ # File-level git stats
140
+ seer churn [--db <path>] [--workspace <path>]
141
+
142
+ # Build the symbol-history index (opt-in pass)
143
+ seer symbol-history [--db <path>] [--workspace <path>] [--max-commits <n>] [--force]
144
+
145
+ # Query exact symbol-level git blame chain
146
+ seer history <symbol> [--db <path>] [--limit <n>]
147
+ ```
148
+
149
+ ### Rename & Move Continuity (New in v10)
150
+ Seer tracks symbol renames and cross-file moves using structural shape-hash comparison, Hamming distance, and scope analysis.
151
+ ```bash
152
+ seer continuity <symbol> [--db <path>]
153
+ ```
154
+ * Continuity is folded automatically into `seer history` and `seer preflight` to stitch together unbroken, historical blame chains across refactorings.
155
+
156
+ ---
157
+
158
+ ## 9. Portability, Precision & Diffing (v10 Restructure)
159
+
160
+ ```bash
161
+ # Export / Import portable bundles
162
+ seer bundle export [--workspace <path>] [--db <path>] [--out <path>] [--level <n>] [--built-at <ms>]
163
+ seer bundle import <bundle> [--workspace <path>] [--db <path>] [--overwrite] [--skip-integrity-check] [--skip-schema-check]
164
+ seer bundle info <bundle>
165
+ ```
166
+
167
+ ### External Bundle Layers (New in v10)
168
+ Imports external contracts (like dependent microservices) additively as read-only virtual "phantom files" so they participate in local service-link resolution.
169
+ ```bash
170
+ seer bundle import billing.seerbundle --external [--alias <name>] [--force]
171
+ seer bundle external [--db <path>] # Lists currently active external bundle layers
172
+ ```
173
+ * Additive and idempotent (skips if hashes match; forced re-imports safely delete the old phantom file).
174
+
175
+ ### Contract Diff (New in v10)
176
+ Compares two `.seerbundle` files directly on disk without importing them, identifying API changes across all protocols.
177
+ ```bash
178
+ seer contract diff <old-bundle> <new-bundle> [--json] [--include-callers]
179
+ ```
180
+ * Use `--include-callers` to enrich the diff with a list of local service-link callers impacted by API contract modifications.
181
+
182
+ ### Continuous Integration:
183
+ ```bash
184
+ seer ci bundle [--workspace <path>] [--out <path>] [--mode <mode>] [--no-reset] [--no-parallel] [--built-at <ms>]
185
+ seer ci workflow # Prints a ready-to-paste GitHub Actions YAML workflow
186
+ ```
187
+
188
+ ### Precision overlays & Duplicates:
189
+ ```bash
190
+ seer scip-import <scip-path> [--workspace <path>] [--db <path>] [--require-file-in-index]
191
+ seer duplicates [--db <path>] [--max-distance <n>] [--min-loc <n>] [--include-tests] [--limit <n>]
192
+ ```
193
+
194
+ ---
195
+
196
+ ## 10. Service Links
197
+
198
+ Resolves client-side outbound network calls (`fetch`, `axios`, gRPC, tRPC, GraphQL, SQS, RabbitMQ, Redis, etc.) to concrete indexed framework route handlers.
199
+
200
+ ```bash
201
+ seer service-calls [--db <path>] [--protocol <p>] [--method <m>] [--framework <f>] [--path <substr>] [--limit <n>]
202
+ seer service-links [--db <path>] [--protocol <p>] [--method <m>] [--path <substr>] [--match-kind <k>] [--limit <n>]
203
+ seer trace-service <from> <to> [--db <path>] [--depth <n>]
204
+ ```
205
+
206
+ ---
207
+
208
+ ## 11. MCP Server
209
+
210
+ ```bash
211
+ seer mcp --workspace <repo-path> [--db <path>] [--no-watch] [--no-jit]
212
+ ```
213
+
214
+ Runs the stdio JSON-RPC MCP server. This is the primary interface for developer agents, supporting **54 high-fidelity tools**:
215
+
216
+ ### Reliability & Optimization Features (New in v10)
217
+
218
+ To minimize context window bloating, improve resilience against agent spelling mistakes, and optimize network overhead, Seer-Core includes several developer-agent specific optimization features:
219
+
220
+ * **Dynamic Token Budgeting (`tokenBudget`):** The 7 high-volume list tools (`seer_symbols`, `seer_definition`, `seer_callers`, `seer_callees`, `seer_service_calls`, `seer_service_links`, and `seer_complexity`) accept an optional `tokenBudget` parameter. If supplied, Seer dynamically packs the pre-sorted items so that the serialized JSON payload remains under the specified token budget (assumed at ~4 characters per token). Truncated payloads carry `truncated: true`, an `omitted` count, and a helpful note, whilst guaranteeing that at least one matching item is returned. If omitted, lists are returned without trimming.
221
+ * **Failsafe "Did-You-Mean" Suggestions:** When query tools (`definition`, `symbols`, `callers`, `risk`, `context`, `behavior`, `symbol_module`, `continuity`) return zero results, they perform a fuzzy FTS query and return up to 5 matching suggestion candidates in a `didYouMean` block. Candidates are never auto-substituted, preserving deterministic query integrity.
222
+ * **Lazy Lifecycle Rebuilds:** Heavy analytical indexes (Louvain modules, SimHash shape hashes, and symbol history) are automatically computed once-per-process on the first dependent query if the index is blank, recovering instantly from blank imported indices.
223
+ * **Batch Execution & Umbrella Tracing:** Allows running up to 25 read-only tools sequentially in-process in a single round-trip using `seer_batch`, and provides a single entry point for all graph traces using `seer_trace`.
224
+
225
+ ### MCP Tool Index:
226
+
227
+ #### A. Core Navigation & Search
228
+ 1. `seer_health`: Watcher status, schema versions, role counts. Cheap (no JIT).
229
+ 2. `seer_stats`: Detailed table-by-table database statistics.
230
+ 3. `seer_symbols` (`query?`, `top?`, `limit?`, `include*?`): BM25 or PageRank symbol list.
231
+ 4. `seer_definition` (`name`, `file?`, `include*?`): Exact definition lookup.
232
+ 5. `seer_file_symbols` (`file`, `limit?`): File's symbol list sorted by line.
233
+ 6. `seer_callers` (`symbol`, `limit?`): Direct caller preview + true count.
234
+ 7. `seer_callees` (`symbol`, `limit?`): Bounded direct callees.
235
+ 8. `seer_search` (`query`, `limit?`, `include*?`): Combined BM25 search across files and symbols.
236
+ 9. `seer_reindex` (`reset?`): Force an incremental or full index rebuild.
237
+
238
+ #### B. API Routes & Environment
239
+ 10. `seer_routes` (`method?`, `framework?`, `pathSubstr?`, `limit?`): Framework routes list.
240
+ 11. `seer_dependencies` (`ecosystem?`, `nameSubstr?`, `limit?`): External packages list.
241
+ 12. `seer_config` (`key?`, `source?`, `limit?`): Config/env reads list.
242
+
243
+ #### C. Complexity & Blast Radius
244
+ 13. `seer_complexity` (`by?`, `minValue?`, `limit?`, `include*?`): Complexity rankings.
245
+ 14. `seer_behavior` (`symbol`, `limit?`, `indirectDepth?`, `include*?`): Behavioral test spec list.
246
+ 15. `seer_trace_path` (`from`, `to`, `maxDepth?`): Bounded BFS call path.
247
+ 16. `seer_trace_callers` (`symbol`, `maxDepth?`, `maxNodes?`, `limit?`): Transitive callers.
248
+ 17. `seer_trace_callees` (`symbol`, `maxDepth?`, `maxNodes?`, `limit?`): Transitive callees.
249
+ 18. `seer_architecture`: One-page architecture snapshot.
250
+ 19. `seer_detect_changes` (`fromRef?`, `toRef?`, `callerDepth?`): Blast radius for diffs.
251
+
252
+ #### D. Louvain Modules
253
+ 20. `seer_modules` (`limit?`, `sortBy?`): Lists Louvain module clusters.
254
+ 21. `seer_module_members` (`id?`, `label?`, `fileLimit?`, `symbolLimit?`): Files/top symbols.
255
+ 22. `seer_symbol_module` (`symbol`, `file?`): Resolves the module housing a symbol.
256
+ 23. `seer_module_dependencies` (`id?`, `label?`, `direction?`, `limit?`): Module edges.
257
+ 24. `seer_trace_file_dependencies` (`file`, `maxDepth?`, `maxNodes?`): Transitive imports.
258
+ 25. `seer_trace_module_dependencies` (`id?`, `label?`, `maxDepth?`, `direction?`): BFS module edges.
259
+ 26. `seer_modules_build`: (Advanced — usually unnecessary.) Rebuild Louvain module clusters.
260
+
261
+ #### E. Monorepo Boundaries (v10)
262
+ 27. `seer_boundaries` (`limit?`): Lists detected package boundaries.
263
+ 28. `seer_boundary_for_file` (`file`): Identifies the boundary containing a file.
264
+ 29. `seer_boundary_dependencies` (`boundaryId`, `direction?`, `limit?`): Inter-boundary dependency edges.
265
+
266
+ #### F. Git History & Continuity (v10)
267
+ 30. `seer_churn`: Triggers file-level git churn collection.
268
+ 31. `seer_history` (`symbol`, `limit?`, `since?`, `file?`): Overlapping commits.
269
+ 32. `seer_symbol_history_build` (`maxCommitsPerFile?`, `force?`): (Advanced — usually unnecessary.) Rebuilds symbol history database.
270
+ 33. `seer_continuity` (`symbol`, `file?`): Rename/move continuity candidates.
271
+
272
+ #### G. Portability & Precision (v10)
273
+ 34. `seer_bundle_export` (`out?`, `compressionLevel?`, `builtAt?`): Exports portable `.seerbundle`.
274
+ 35. `seer_bundle_info` (`bundle`): Reads manifest headers.
275
+ 36. `seer_bundle_import` (`bundle`, `overwrite?`, `skip*?`, `external?`, `alias?`, `force?`): Destructive or additive peer import.
276
+ 37. `seer_external_bundles` (`includeRoutes?`, `routesPreviewLimit?`): Lists peer-repo layers.
277
+ 38. `seer_contract_diff` (`oldBundle`, `newBundle`, `includeAffectedCallers?`): Advisory API diff.
278
+ 39. `seer_scip_import` (`scipPath`, `requireFileInIndex?`): Adds SCIP precise overlay.
279
+ 40. `seer_scip_imports`: Lists imported SCIP layers.
280
+ 41. `seer_provenance`: Breakdown of symbols/edges by precision source.
281
+ 42. `seer_duplicates` (`maxDistance?`, `minLoc?`, `includeTests?`, `limit?`): Near-duplicate clusters.
282
+ 43. `seer_shape_hash_build` (`force?`, `minLoc?`): (Advanced — usually unnecessary.) Force SimHash recalculation.
283
+
284
+ #### H. Service Rendezvous (Track G + H)
285
+ 44. `seer_service_calls` (`protocol?`, `method?`, `framework?`, `pathSubstr?`, `callerSymbolId?`, `minConfidence?`, `limit?`, `offset?`, `summaryOnly?`): Client calls.
286
+ 45. `seer_service_links` (`protocol?`, `method?`, `pathSubstr?`, `callerSymbolId?`, `handlerSymbolId?`, `matchKind?`, `minConfidence?`, `limit?`, `offset?`, `summaryOnly?`): Resolved edges.
287
+ 46. `seer_trace_service_path` (`from`, `to`, `maxDepth?`): Bounded BFS cross-service hops.
288
+ 47. `seer_trace_service_dependencies` (`from`, `maxDepth?`, `maxNodes?`, `maxFanout?`): BFS cross-service tree.
289
+ 48. `seer_trace_module_service_dependencies` (`moduleId`, `maxDepth?`, `maxNodes?`): BFS cross-module hops.
290
+
291
+ #### I. Unified Context
292
+ 49. `seer_preflight` (`symbol?`, `file?`, `fromRef?`, `toRef?`, `oldBundle?`, `newBundle?`, `maxSymbols?`, `maxTests?`, `maxHistory?`, `callerDepth?`): Consolidated pre-edit range or symbol context.
293
+ 50. `seer_context` (`symbol`, `file?`, `callerLimit?`, `calleeLimit?`, `testLimit?`, `historyLimit?`, `callerDepth?`, `affectedLimit?`): Consolidated symbol context.
294
+ 51. `seer_risk` (`symbol`, `callerDepth?`): Decomposed deterministic risk analysis.
295
+
296
+ #### J. Agent Optimization Tools
297
+ 52. `seer_skeleton` (`file`, `focusSymbol?`): Render structural file skeleton, signature kept, bodies collapsed deterministic.
298
+ 53. `seer_trace` (`scope`, `args?`): Umbrella dispatcher over all `seer_trace_*` tools (callers, callees, path, file, module, service, service_path, module_service).
299
+ 54. `seer_batch` (`calls`): Run up to 25 read-only tools sequentially in a single MCP request.
300
+
301
+ ---
302
+
303
+ ## 12. Recommended Agent Workflow
304
+
305
+ Maximize efficiency and preserve token budget by starting broad and narrowing focus:
306
+
307
+ ```mermaid
308
+ graph TD
309
+ Step1[1. Health Check<br/>'seer health'] --> Step2[2. Orientation<br/>'seer architecture' or 'seer boundaries']
310
+ Step2 --> Step3[3. Unified Preflight<br/>'seer preflight --from main --to HEAD']
311
+ Step3 --> Step4[4. Targeted Inspection<br/>'seer preflight --symbol MyFunc']
312
+ Step4 --> Step5[5. Deep Behavior & Blame<br/>'seer behavior' or 'seer history']
313
+ Step5 --> Step6[6. API Validation<br/>'seer contract diff']
314
+
315
+ style Step1 fill:#f9f9f9,stroke:#333,stroke-width:1px
316
+ style Step3 fill:#d4edda,stroke:#28a745,stroke-width:2px
317
+ style Step4 fill:#d4edda,stroke:#28a745,stroke-width:2px
318
+ ```
319
+
320
+ 1. **Check Environment Health:** Run `seer health` to ensure database and watcher states are fresh.
321
+ 2. **Orient Structurally:** Check `seer boundaries` or `seer modules` to understand the codebase's high-level logical domains.
322
+ 3. **Inspect Affected Areas:** Run `seer preflight --from main --to HEAD` on your working branch. Translate line diffs to affected symbols and see their blast radius.
323
+ 4. **Drill Down Before Editing:** Call `seer preflight --symbol <Target>` to pull definitions, callers, tests, risk profile, and history for your target symbol in **one compact call**.
324
+ 5. **Examine History & Continuity:** If a symbol was recently refactored, call `seer continuity <symbol>` or check `seer history <symbol>` to view its true lineage.
325
+ 6. **Verify API Contracts:** Before compiling, run `seer contract diff` on dependent bundles to ensure no breaking downstream service links were introduced.
326
+ 7. **Fallback to Grep:** Use standard text grep only for comments, raw strings, configuration values, or unsupported language details. Use Seer for all structural navigation.
@@ -0,0 +1,246 @@
1
+ # Seer — Master Guide & Architectural Spec
2
+
3
+ *A product and architectural specification for turning deterministic local code intelligence into a high-leverage AI-agent workflow and temporal developer onboarding system.*
4
+
5
+ Seer is divided into two distinct product layers:
6
+ 1. **Seer-Core:** The open-source, local-first, deterministic code-intelligence engine for AI agents and local developer tools (zero-AI).
7
+ 2. **Seer-Onboarding:** The richer web and temporal product experience designed to onboard developers and explain complex architectures (AI-enabled).
8
+
9
+ ---
10
+
11
+ ## 1. Product Philosophies
12
+
13
+ ### 1.1 Seer-Core
14
+ AI agents waste massive amounts of LLM context window tokens and multiple tool call round-trips using raw search or grep to navigate codebases. Seer-Core solves this by exposing **deterministic, structural facts** from a local SQLite index over an MCP server.
15
+
16
+ * **Deterministic Only:** Seer-Core does not generate explanations, summaries, or narrative prose. It returns clean, source-labelled facts (definitions, call graphs, routes, churn, etc.) so consuming LLMs can reason without guessing.
17
+ * **Wedge Differentiator (Symbol History):** While generic MCP servers show file-level git churn, Seer-Core's primary differentiator is **symbol-level git history**—returning commit blame chains for the exact function, class, or method.
18
+ * **Workflow Compression:** Rather than forcing an agent to invoke ten different lookup tools, Seer-Core combines metrics, tests, boundaries, and history into unified, high-density pre-edit context packets.
19
+
20
+ ### 1.2 Seer-Onboarding
21
+ While Core is optimized for machines (agents), Seer-Onboarding is optimized for humans (developers). It sits on top of Core and uses LLMs to translate structural graph facts into guided visual walkthroughs, timelines, and interactive learning paths.
22
+
23
+ ---
24
+
25
+ ## 2. Seer-Core Architectural Blueprint
26
+
27
+ ```text
28
+ Workspace Files
29
+ |
30
+ | File discovery (.gitignore + .seerignore)
31
+ v
32
+ Indexer
33
+ |
34
+ | Worker thread pool (web-tree-sitter WASM)
35
+ v
36
+ AST Language Extractors
37
+ |
38
+ | Qualified names, calls, routes, complexity, config, shape hashes
39
+ v
40
+ Idempotent SQLite Store (Schema v10)
41
+ |
42
+ | Post-pass resolution (same-file -> import -> global fallback)
43
+ | Service-link resolver (Track G/H client -> route matching)
44
+ | Louvain modular clustering
45
+ v
46
+ CLI / MCP Server
47
+ |
48
+ | JIT Freshness Check (jitSync file hash checking)
49
+ v
50
+ AI Client / Monaco UI
51
+ ```
52
+
53
+ ### JIT Freshness Model
54
+ Correctness is a product requirement. If an agent edits a file, Seer must reflect those changes immediately.
55
+ 1. **Chokidar Watcher:** Keeps the index warm in the background by debouncing write bursts.
56
+ 2. **JIT Freshness (`jitSync`):** Runs an instant hash check over changed files before any MCP query returns. If a hash mismatch is detected, Seer runs a serial single-file parse to guarantee correct results without blocking concurrent reads.
57
+
58
+ ## 3. Seer-Core Foundational Feature Tracks (Tracks A to H)
59
+
60
+ Seer-Core was developed across a series of structured functional tracks. These tracks form the conceptual and architectural foundation of the deterministic, zero-AI code-intelligence engine:
61
+
62
+ ### 3.1 Track A & B — Core Indexing Framework, Discovery & Symbol Extraction
63
+ * **Layered Ignore-Aware Discovery:** Seer implements a fast directory walker that respects hierarchical `.gitignore` and `.seerignore` rules, classifying files automatically into `project`, `test`, `generated`, or `vendor` roles to exclude low-value files immediately.
64
+ * **WASM Worker Thread Pool:** To bypass V8 execution lockouts when parsing multiple files asynchronously, Seer orchestrates a parallel `WorkerPool` of native Node `worker_threads` containing isolated `web-tree-sitter` WASM instances.
65
+ * **Discovery Modes:** Supports three levels via `--mode full|standard|fast`. Standard is the default; Full includes vendor + generated; Fast layers extra heuristic directory exclusions (`docs/`, `fixtures/`, `testdata/`, `migrations/`).
66
+ * **Tree-Sitter Query-Assisted Walker:** Extractor declares its `candidateNodeTypes` which compiles a `Parser.Query` once and runs it on parse. The walker walks the tree and only executes extractor callbacks (`tryExtractDefinition`, `tryExtractContextName`, etc.) on these captured candidate nodes, speeding up walks. Standard baseline is used as fallback or forced via `SEER_USE_CANDIDATE_QUERY=0`.
67
+ * **Multi-Language AST Extractor:** Performs high-precision syntactic walks of ASTs for TypeScript/JavaScript (including TSX grammar mapping for React components), Python, Go, Java, Rust, C/C++ (including out-of-line method resolution), and C# (constructor/member call tracking).
68
+ * **Syntactic Body Gating:** Prevents type-reference pollution (e.g. C/C++ `struct device *dev`) by dropping body-less nodes, only emitting struct/class/union/enum symbols when the node contains a definition `body`.
69
+ * **Symbol Role Partitioning (Schema v5):** Populates `symbols.symbol_role` (`definition | declaration | type_ref`). Free-function prototypes and class declarations are stored as declarations, excluded from PageRank, and filtered through `includeTests`/`includeDeclarations`/`includeTypeRefs` search constraints.
70
+ * **Three-Pass Scope-Aware Symbol Resolution:** Project-wide references are resolved to target symbol definition IDs via (1) Same-File binding, (2) Imported-File matching (following explicit relative imports), and (3) Global Fallback matching.
71
+ * **Lazy Rankable PageRank (Schema v3):** Restricts the PageRank graph purely to `is_rankable` symbols (functions, methods, classes, constructors) to prevent dilution from isolated declaration rows. PageRank for non-rankables is pinned to 0, and runs are skipped if the graph has not changed.
72
+
73
+ ### 3.2 Track C & D — Web Endpoints, Configuration, Metadata, Complexity & Search
74
+ * **Web Route Extraction:** Parses API routing declarations (Express/Fastify object-style routing URLs, FastAPI/Flask, Spring Boot annotations with prefix inheritance) to map endpoints, methods, and backend handlers.
75
+ * **Config & Env Variable Auditing:** Audits and indexes calls to configuration keys (e.g., `process.env`, `os.getenv`, `System.getenv`), mapping reads to enclosing caller symbols via line containment.
76
+ * **External Dependency Manifest Parsing:** Collects declared external libraries from standard manifests (`package.json`, `Cargo.toml`, `requirements.txt`, `go.mod`), storing them in the `external_dependencies` index.
77
+ * **Abstract-Complexity Analysis:** Tracks structural code complexity metrics—including Cyclomatic Complexity, Cognitive Complexity, Lines of Code (LOC), and Max Nesting Depth—per symbol definition to pinpoint refactoring hotspots.
78
+ * **High-Fan-In Query Optimizations:** Bypasses B-tree temp sorting and database locks on large codebases by separate-routing `findCallers(name, limit)` indexed seeks and `countCallers(name)` true counts.
79
+ * **BM25 Token-Split FTS5 Search:** A high-speed full-text search index backed by custom SQLite FTS5 tokenizers designed to split camelCase (`AuthServiceImpl` -> `auth service impl`) and snake_case keywords for high-precision query matches.
80
+ * **BFS Call Path Tracing:** Exposes BFS solvers (`tracePath`) to trace step-by-step caller chains between any source and destination symbol IDs, and yields reverse reachability graphs.
81
+
82
+ ### 3.3 Track E — Louvain Modules, Reachability Closures & Behavioral Specs
83
+ * **Louvain Modular Clustering:** Constructs a weighted, undirected file graph (weights: import = 2, call = 1, test = 3) and runs Louvain community detection to segment files into highly cohesive **Modules**, allowing agents to orient at subsystem levels.
84
+ * **Transitive BFS Closures:** Computes bounded forward/reverse reachability maps with depth, and resolves transitive file import closures.
85
+ * **Collision Hardening & Exact-ID Evidence Paths:** Copies exact target `to_id` tags on synthesized test edges so same-short-name symbols in different scopes (e.g. `Alpha.run` and `Beta.run`) do not share test coverage, callers, or risk profiles in `seer_behavior`, `seer_risk`, or `seer_context`.
86
+ * **Ranked Behavioral Specs (Behavior 2.0):** Dynamically scores and ranks tests and assertions exercising a target symbol, sorted descending by specificity: (1) Direct call from test to target, (2) Naming conventions (sibling test specs), (3) Call graph step distance, and (4) Assertion counts and commit recency.
87
+ * **Deterministic Edit-Risk Scoring (`seer_risk`):** Synthesizes a composite risk verdict (low, medium, high) and score by evaluating caller fan-in, public route exposure, test coverage gaps, boundary crossings, and structural complexity/churn.
88
+ * **Context Packet (`seer_context`):** Compresses definition, module membership, blast radius, behavioral tests, and edit risk into a high-density JSON payload, ideal for packing into single-call agent prompts.
89
+
90
+ ### 3.4 Track F — SCIP Precision Overlays, SimHash Shapes & Portable Bundles
91
+ * **SCIP JSON Precision Overlays:** Additively integrates language-agnostic SCIP (LSIF) index formats. Merges overlapping tree-sitter nodes under a `scip-merge` role while preserving standalone SCIP facts, allowing idempotent layer updates and removals.
92
+ * **Structural SimHash Shapes:** Generates a 64-bit structural shape hash over AST subtrees folded into category tokens (NAME, OP, NUMBER), ignoring naming and parameter refactorings.
93
+ * **Hamming-Distance Code Clones:** Identifies identical or near-identical code clones across the repository using a SimHash Hamming distance threshold $\le 4$, skipping trivial boilerplate.
94
+ * **Portable `.seerbundle` Archives:** Vacuums and compresses local index files into reproducible, signed binary tarballs containing SHA-256 integrity verifications and fast, zero-write manifest peeks.
95
+
96
+ ### 3.5 Track G & H — Cross-Service Links & Protocol Extensions
97
+ * **HTTP Client Auditing:** Scans source code for network call signatures (e.g., fetch, axios, requests, httpx, HttpClient, RestTemplate) and records outgoing requests in the `service_calls` table.
98
+ * **Infrastructure Host-Evidence Mapping:** Extractor parses Docker Compose configurations and Kubernetes manifests for service host evidence, classifying patterns like `http://payment-service/...` as local service host matches.
99
+ * **Post-Index Service Link Resolver:** Normalizes client URLs and patterns to match them against server route declarations, populating `service_links` to trace API call flows across microservices.
100
+ * **Candidate Telemetry & Truncation:** Caps potential service-link routes at 25 candidates with deterministic ordering, outputting `truncated` and `total_candidates` telemetry attributes.
101
+ * **tRPC Protocol Support:** Parses tRPC routers and query/mutation procedures, scans client operations (e.g., `client.user.getById.query()`), and links them via `trpc_procedure` connections.
102
+ * **GraphQL Protocol Support:** Maps GraphQL schemas and Query/Mutation field resolvers, parses client operations (e.g., `client.query({ query: GET_USER })`), and connects them via `graphql_operation` service links.
103
+ * **gRPC Protocol Support:** Parses `.proto` files to identify services and RPC declarations, extracts Go/Java/C# gRPC client calls, and links them via `grpc_method` matches.
104
+ * **Messaging Protocol Support:** Audits topic/queue producers and consumers across RabbitMQ, Kafka, SQS, SNS, NATS, and Redis Pub/Sub, mapping decoupled data-flow linkages across distinct systems.
105
+ * **Generalized Graph Tracing Tools:** Exposes high-leverage service-link dependency tracing tools: `seer_trace_service_dependencies` (bounded BFS over the service-link graph) and `seer_trace_module_service_dependencies`.
106
+ * **SeerBench Service Benchmarks:** Validated by a deterministic service-link validation benchmark (`npm run test:bench`) enforcing precision and recall $\ge 0.9$ over 8 standard task cases.
107
+
108
+ ---
109
+
110
+ ## 4. Product Specifications of Core Features (Track I - Schema v10)
111
+
112
+ Under **Schema v10**, Seer defines five core features designed to give agents high-density, high-integrity workspace intelligence:
113
+
114
+ ### 4.1 Feature 1 — External Bundle Layers
115
+ In microservice architectures, code intelligence engines are traditionally constrained to a single workspace. Seer solves this by allowing teams to import pre-indexed `.seerbundle` files from external repositories additively:
116
+ * **Phantom Files:** Imported bundles are mapped to read-only "phantom files" (e.g. `'external:<bundle-id>'`) inside the local database.
117
+ * **Cross-Service Call Resolution:** Outbound network calls (`service_calls`) are automatically matched against routes inside these external layers.
118
+ * **Pruning & Additivity:** External layers are isolated, ensuring local codebase prunes never wipe them out. Forced re-imports safely wipe and replace the layer atomically without leaking files.
119
+
120
+ ### 4.2 Feature 2 — Contract Diff
121
+ Ensures API contract safety across development cycles:
122
+ * **Zero-Import Comparisons:** Reads and compares two `.seerbundle` files directly on disk without database write overhead.
123
+ * **Protocol-Aware Diffs:** Identifies breaking changes, route deletions, or signature modifications across HTTP, tRPC, GraphQL, gRPC, and messaging queues (Kafka, SQS, SNS, NATS, RabbitMQ).
124
+ * **Impact Mapping (`--include-callers`):** Cross-references route changes with local and external service links to show precisely which local callers will be broken by a contract modification.
125
+
126
+ ### 4.3 Feature 3 — Preflight Context
127
+ The entry point for any file edit. `seer preflight` replaces high-frequency, narrow tool calls with a single, high-density packet:
128
+ * **Diff-to-Symbol Range Mapping:** Translates raw line-number diffs between git refs (e.g. `main..HEAD`) directly into affected AST symbols using `detectChanges`.
129
+ * **Decomposed Blast Radius:** Combines direct callers, transitive dependents, test spec coverage, recent commit history, and boundary crossing risks into a single, bounded JSON packet.
130
+ * **Bundle Pairing:** Accepts an optional secondary bundle to inject a live API contract diff preview into the preflight check.
131
+
132
+ ### 4.4 Feature 4 — Monorepo Boundaries
133
+ Large monorepos contain logical layer divisions that should not be violated. Seer parses boundaries from standard manifests (`package.json`, `go.mod`, etc.) or fallback paths (`packages/*`):
134
+ * **Boundary Crossing Signals:** If a call edge originates in boundary A but resolves to a symbol in boundary B, Seer flags a `boundaryCrossing` in the edit-risk profile.
135
+ * **Logical Scoping:** Allows agents to scope searches and module mappings to distinct sub-projects, avoiding structural information overload.
136
+
137
+ ### 4.5 Feature 5 — Rename/Move Continuity
138
+ Refactoring regularly rename or moves symbols across files, which breaks standard Git history blame chains. Seer preserves continuous symbol lineage:
139
+ * **Structural SimHash:** Generates a 64-bit structural shape hash over identifier-folded AST subtrees.
140
+ * **Hamming & Scope Heuristics:** Maps moved or renamed functions by matching shape similarity, scope paths, and parameters.
141
+ * **Ambiguity Safeguards:** Bucket searches containing trivial boilerplate (e.g., standard getters) are capped at low confidence and require scope/name similarity to match, preventing false positives.
142
+ * **Unbroken Histories:** Continuity is automatically folded into `seer history` and `seer preflight` results.
143
+
144
+ ### 4.6 Feature 6 — Structural Skeleton Renderer (`seer_skeleton`)
145
+ To help agents comprehend large code files without consuming excessive LLM context tokens or running into rate limits, Seer provides a deterministic source elision engine:
146
+ * **Signature Preservation:** Every function, class, method, and variable signature is preserved in full.
147
+ * **Body Elision:** The implementation bodies of these symbols are collapsed to single-line fold markers containing the exact number of collapsed lines: `{ ... N lines ... }`.
148
+ * **Line-Range Containment:** The nesting hierarchy of these signatures is computed via language-agnostic line-range containment, ensuring perfect structure preservation.
149
+ * **Focus Expansion:** Accepts an optional `focusSymbol` parameter to expand one target symbol body verbatim while leaving all other symbol bodies collapsed, enabling highly targeted reads.
150
+ * **Deterministic Re-Rendering:** Re-rendering is completely deterministic and byte-identical for identical inputs.
151
+
152
+ ### 4.7 Feature 7 — Resilient Search Auto-Suggestions ("Did-you-mean")
153
+ To prevent AI agents from hitting dead ends when they make typographical errors in symbol or file references, Seer integrates a failsafe suggestion engine:
154
+ * **Zero-Result Interception:** When query tools (`definition`, `symbols`, `callers`, `risk`, `context`, `behavior`, `symbol_module`, `continuity`) return zero direct results, Seer intercepts the failure and performs a BM25/FTS5 search.
155
+ * **Suggestive Delivery:** Returns up to 5 close matches under a `didYouMean` array containing key metadata (name, qualified name, kind, file, and line start).
156
+ * **No Auto-Substitution:** Suggestions are strictly advisory. Seer never auto-substitutes queries, preventing misleading information or incorrect context bindings.
157
+
158
+ ### 4.8 Feature 8 — Dynamic Token Budgeting
159
+ To optimize context window usage and prevent prompt overflows during high-volume queries, Seer enforces strict token budgets on list outputs:
160
+ * **Prefix-Trimming (`budgetedText`):** List tools accept a `tokenBudget` parameter and pack items dynamically, prefix-trimming the response to stay within `tokenBudget * 4` characters (assuming ~4 characters per token).
161
+ * **High-Volume Tool Integration:** Available across the 7 high-volume MCP list tools: `seer_symbols`, `seer_definition`, `seer_callers`, `seer_callees`, `seer_service_calls`, `seer_service_links`, and `seer_complexity`.
162
+ * **Truncation Flags & Notes:** Appends `truncated: true`, `omitted: N`, and a descriptive user note indicating how many items were omitted and how to retrieve the rest.
163
+ * **Guaranteed Minimality:** Guarantees that at least one relevant item is returned even if the first item alone exceeds the budget.
164
+ * **Zero-Overhead Baseline:** When no `tokenBudget` is provided, output is completely un-trimmed and byte-identical to previous versions. High-fan-in search paths are never re-sorted by budgeting.
165
+
166
+ ### 4.9 Feature 9 — Lazy Lifecycle Management
167
+ Optimizes cold-start initialization and bundle import times by deferring heavy analytical passes until they are actually needed:
168
+ * **Auto-Build triggers:** The three intensive derived-graph indexes (`ensureModules`, `ensureShapeHashes`, and `ensureSymbolHistory`) automatically run once-per-process on the first dependent query instead of upfront during indexing.
169
+ * **Robust Exception Catching:** If a JIT build fails, exceptions are caught as clean, non-fatal warnings (logged to stderr) without crashing the server or blocking the parent query.
170
+ * **Manual Rebuild Verification:** The corresponding manual build tools (`seer_modules_build`, `seer_symbol_history_build`, and `seer_shape_hash_build`) are rebranded as "(Advanced — usually unnecessary)" in metadata but remain registered for forced overrides.
171
+
172
+ ### 4.10 Feature 10 — Batch Execution and Umbrella Tracing (`seer_batch` & `seer_trace`)
173
+ Minimizes network round-trip delays and agent decision load by introducing unified execution interfaces:
174
+ * **Read-Only Batch Execution (`seer_batch`):** Accepts up to 25 read-only tools in a single MCP request. Runs tools sequentially in-process with failure isolation (one failing query does not abort other queries in the batch).
175
+ * **Umbrella Scope Dispatcher (`seer_trace`):** Provides a single entrypoint that delegates to the specific `seer_trace_*` tool family (`callers`, `callees`, `path`, `file`, `module`, `service`, `service_path`, `module_service`).
176
+ * **Nesting & Recursion Prevention:** Prevents nesting within itself (`seer_batch` cannot call another `seer_batch`), securing the server against recursive stack overflows.
177
+ * **In-Process Mirroring:** Standard registration is wrapped in a `registerTool` decorator that mirrors every handler inside an in-memory handlers map, allowing `seer_batch` and `seer_trace` to dispatch internally without second round-trip MCP payloads.
178
+
179
+ ---
180
+
181
+ ## 5. Derived Conceptual Intelligence
182
+
183
+ On top of basic syntactic extraction, Seer computes three high-value graph-derived signals:
184
+
185
+ ### 5.1 Louvain Module Clustering
186
+ Seer builds a weighted, undirected file graph where import edges have weight 2, call edges weight 1, and test edges weight 3. A Louvain community detection algorithm runs after each graph-mutating index, grouping files into highly cohesive **Modules**.
187
+ * This allows agents to orient at module level (e.g., locating the `Billing` or `Auth` subsystems) before scanning raw directories.
188
+
189
+ ### 5.2 Tests-as-Behavioral-Specs
190
+ Instead of returning a flat list of test files, `seer behavior` ranks tests that exercise a target symbol based on specificity:
191
+ 1. **Direct Call:** Test functions directly invoking the symbol.
192
+ 2. **Naming Convention:** Test files matching the symbol's file name.
193
+ 3. **Graph Distance:** Bounded call-graph steps from tests to the symbol.
194
+ 4. **Assertion Counts & Recency:** Boosts tests that have high assert densities or recent commits.
195
+
196
+ ### 5.3 Decomposed Edit-Risk Profile
197
+ `seer_risk` calculates a deterministic score based on decomposed signals, showing *why* a change is risky:
198
+ * **Fan-in / Transitive dependents:** The symbol has wide downstream usage.
199
+ * **Route exposure:** The symbol sits directly on a public API endpoint.
200
+ * **Test gap:** Direct test coverage is absent or weak.
201
+ * **Boundary crossing:** Modifying this symbol alters interfaces across monorepo packages.
202
+ * **Complexity & Churn:** The symbol is cyclomatically complex and has high historical commit frequency.
203
+
204
+ ---
205
+
206
+ ## 6. Seer-Onboarding Specification
207
+
208
+ Seer-Onboarding consumes the deterministic facts stored in Core and translates them into a human-first learning platform.
209
+
210
+ ### 6.1 Knowledge Hierarchy
211
+ Onboarding visualizes repositories using a structured L0 to L5 hierarchy:
212
+
213
+ ```text
214
+ L5 System Repo-wide architecture map, entry points, and domain glossary.
215
+ L4 Subsystem Aggregated summaries over related logical domains.
216
+ L3 Module Generated conceptual summaries over Louvain modules.
217
+ L2 File Purpose descriptions and key symbol highlights.
218
+ L1 Graph Core symbols, calls, and service links (from Seer-Core).
219
+ L0 Source Raw source files, loaded lazily.
220
+ ```
221
+
222
+ ### 6.2 The Local Onboarding Portal
223
+ A lightweight local web interface that launches in seconds:
224
+ * **Architecture Explorer:** Interactive 2D visualization of Louvain modules, monorepo boundaries, and service-link connections.
225
+ * **Monaco Context Companion:** A sidecar code editor that surfaces ranked tests, blast radius, and symbol blame chains as you hover over code.
226
+ * **Temporal Time-Travel Timeline:** Visualizes how modules and boundaries evolved, mapping commits to logical "epochs" (e.g. "auth-overhaul").
227
+ * **Interactive Katas:** Automatically extracts historically small pull requests to create interactive local coding exercises, allowing developers to practice real codebase changes.
228
+
229
+ ---
230
+
231
+ ## 7. Business & Launch Strategy
232
+
233
+ ### 7.1 Launch Wedge (Symbol-Level History)
234
+ Rather than launching as a generic codebase search engine, Seer-Core will lead with a clear, memorably pitched differentiator:
235
+
236
+ > Seer-Core is the local MCP server that gives AI agents per-function git history, not just per-file churn.
237
+
238
+ This serves as a high-leverage wedge because:
239
+ * It provides immediate, concrete value to developer agents before they touch code.
240
+ * It is completely local, fast, and does not require third-party LLM costs.
241
+ * It acts as the foundation for the temporal time-travel UI in the Onboarding portal.
242
+
243
+ ### 7.2 Monetization & Open-Core Model
244
+ * **OSS Core (Local):** Zero-config tree-sitter parser, SQLite indexer, watcher, JIT freshness, and all MCP navigation tools. Free and open source.
245
+ * **Pro (Single-Developer Portal):** The local Onboarding website, Monaco companion editor, time-travel timeline, and local katas.
246
+ * **Team / Cloud (Commercial):** Hosted collaborative portals, CI-generated `.seerbundle` sharing networks, SSO/SAML, security audit logs, and developer onboarding dashboards.