@gzoo/cortex 0.5.9

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 (377) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/CLAUDE.md +180 -0
  3. package/CONTRIBUTING.md +52 -0
  4. package/LICENSE +21 -0
  5. package/README.md +259 -0
  6. package/dist/cortex-mcp.mjs +3153 -0
  7. package/dist/cortex.mjs +8213 -0
  8. package/icon.png +0 -0
  9. package/logo.png +0 -0
  10. package/package.json +86 -0
  11. package/packages/cli/dist/commands/config.d.ts +4 -0
  12. package/packages/cli/dist/commands/config.d.ts.map +1 -0
  13. package/packages/cli/dist/commands/config.js +419 -0
  14. package/packages/cli/dist/commands/config.js.map +1 -0
  15. package/packages/cli/dist/commands/contradictions.d.ts +3 -0
  16. package/packages/cli/dist/commands/contradictions.d.ts.map +1 -0
  17. package/packages/cli/dist/commands/contradictions.js +74 -0
  18. package/packages/cli/dist/commands/contradictions.js.map +1 -0
  19. package/packages/cli/dist/commands/costs.d.ts +3 -0
  20. package/packages/cli/dist/commands/costs.d.ts.map +1 -0
  21. package/packages/cli/dist/commands/costs.js +168 -0
  22. package/packages/cli/dist/commands/costs.js.map +1 -0
  23. package/packages/cli/dist/commands/db.d.ts +3 -0
  24. package/packages/cli/dist/commands/db.d.ts.map +1 -0
  25. package/packages/cli/dist/commands/db.js +139 -0
  26. package/packages/cli/dist/commands/db.js.map +1 -0
  27. package/packages/cli/dist/commands/find.d.ts +3 -0
  28. package/packages/cli/dist/commands/find.d.ts.map +1 -0
  29. package/packages/cli/dist/commands/find.js +139 -0
  30. package/packages/cli/dist/commands/find.js.map +1 -0
  31. package/packages/cli/dist/commands/ingest.d.ts +3 -0
  32. package/packages/cli/dist/commands/ingest.d.ts.map +1 -0
  33. package/packages/cli/dist/commands/ingest.js +179 -0
  34. package/packages/cli/dist/commands/ingest.js.map +1 -0
  35. package/packages/cli/dist/commands/init.d.ts +3 -0
  36. package/packages/cli/dist/commands/init.d.ts.map +1 -0
  37. package/packages/cli/dist/commands/init.js +285 -0
  38. package/packages/cli/dist/commands/init.js.map +1 -0
  39. package/packages/cli/dist/commands/mcp.d.ts +3 -0
  40. package/packages/cli/dist/commands/mcp.d.ts.map +1 -0
  41. package/packages/cli/dist/commands/mcp.js +65 -0
  42. package/packages/cli/dist/commands/mcp.js.map +1 -0
  43. package/packages/cli/dist/commands/models.d.ts +3 -0
  44. package/packages/cli/dist/commands/models.d.ts.map +1 -0
  45. package/packages/cli/dist/commands/models.js +245 -0
  46. package/packages/cli/dist/commands/models.js.map +1 -0
  47. package/packages/cli/dist/commands/privacy.d.ts +3 -0
  48. package/packages/cli/dist/commands/privacy.d.ts.map +1 -0
  49. package/packages/cli/dist/commands/privacy.js +140 -0
  50. package/packages/cli/dist/commands/privacy.js.map +1 -0
  51. package/packages/cli/dist/commands/projects.d.ts +3 -0
  52. package/packages/cli/dist/commands/projects.d.ts.map +1 -0
  53. package/packages/cli/dist/commands/projects.js +142 -0
  54. package/packages/cli/dist/commands/projects.js.map +1 -0
  55. package/packages/cli/dist/commands/query.d.ts +3 -0
  56. package/packages/cli/dist/commands/query.d.ts.map +1 -0
  57. package/packages/cli/dist/commands/query.js +153 -0
  58. package/packages/cli/dist/commands/query.js.map +1 -0
  59. package/packages/cli/dist/commands/report.d.ts +3 -0
  60. package/packages/cli/dist/commands/report.d.ts.map +1 -0
  61. package/packages/cli/dist/commands/report.js +144 -0
  62. package/packages/cli/dist/commands/report.js.map +1 -0
  63. package/packages/cli/dist/commands/resolve.d.ts +3 -0
  64. package/packages/cli/dist/commands/resolve.d.ts.map +1 -0
  65. package/packages/cli/dist/commands/resolve.js +119 -0
  66. package/packages/cli/dist/commands/resolve.js.map +1 -0
  67. package/packages/cli/dist/commands/serve.d.ts +3 -0
  68. package/packages/cli/dist/commands/serve.d.ts.map +1 -0
  69. package/packages/cli/dist/commands/serve.js +108 -0
  70. package/packages/cli/dist/commands/serve.js.map +1 -0
  71. package/packages/cli/dist/commands/status.d.ts +3 -0
  72. package/packages/cli/dist/commands/status.d.ts.map +1 -0
  73. package/packages/cli/dist/commands/status.js +230 -0
  74. package/packages/cli/dist/commands/status.js.map +1 -0
  75. package/packages/cli/dist/commands/stop.d.ts +5 -0
  76. package/packages/cli/dist/commands/stop.d.ts.map +1 -0
  77. package/packages/cli/dist/commands/stop.js +80 -0
  78. package/packages/cli/dist/commands/stop.js.map +1 -0
  79. package/packages/cli/dist/commands/watch.d.ts +3 -0
  80. package/packages/cli/dist/commands/watch.d.ts.map +1 -0
  81. package/packages/cli/dist/commands/watch.js +235 -0
  82. package/packages/cli/dist/commands/watch.js.map +1 -0
  83. package/packages/cli/dist/index.d.ts +9 -0
  84. package/packages/cli/dist/index.d.ts.map +1 -0
  85. package/packages/cli/dist/index.js +68 -0
  86. package/packages/cli/dist/index.js.map +1 -0
  87. package/packages/cli/package.json +37 -0
  88. package/packages/cli/tsconfig.json +16 -0
  89. package/packages/core/dist/config/loader.d.ts +11 -0
  90. package/packages/core/dist/config/loader.d.ts.map +1 -0
  91. package/packages/core/dist/config/loader.js +133 -0
  92. package/packages/core/dist/config/loader.js.map +1 -0
  93. package/packages/core/dist/config/project-registry.d.ts +71 -0
  94. package/packages/core/dist/config/project-registry.d.ts.map +1 -0
  95. package/packages/core/dist/config/project-registry.js +89 -0
  96. package/packages/core/dist/config/project-registry.js.map +1 -0
  97. package/packages/core/dist/config/schema.d.ts +909 -0
  98. package/packages/core/dist/config/schema.d.ts.map +1 -0
  99. package/packages/core/dist/config/schema.js +125 -0
  100. package/packages/core/dist/config/schema.js.map +1 -0
  101. package/packages/core/dist/errors/cortex-error.d.ts +58 -0
  102. package/packages/core/dist/errors/cortex-error.d.ts.map +1 -0
  103. package/packages/core/dist/errors/cortex-error.js +68 -0
  104. package/packages/core/dist/errors/cortex-error.js.map +1 -0
  105. package/packages/core/dist/events/event-bus.d.ts +10 -0
  106. package/packages/core/dist/events/event-bus.d.ts.map +1 -0
  107. package/packages/core/dist/events/event-bus.js +42 -0
  108. package/packages/core/dist/events/event-bus.js.map +1 -0
  109. package/packages/core/dist/index.d.ts +8 -0
  110. package/packages/core/dist/index.d.ts.map +1 -0
  111. package/packages/core/dist/index.js +22 -0
  112. package/packages/core/dist/index.js.map +1 -0
  113. package/packages/core/dist/logger.d.ts +16 -0
  114. package/packages/core/dist/logger.d.ts.map +1 -0
  115. package/packages/core/dist/logger.js +57 -0
  116. package/packages/core/dist/logger.js.map +1 -0
  117. package/packages/core/dist/types/config.d.ts +107 -0
  118. package/packages/core/dist/types/config.d.ts.map +1 -0
  119. package/packages/core/dist/types/config.js +2 -0
  120. package/packages/core/dist/types/config.js.map +1 -0
  121. package/packages/core/dist/types/entity.d.ts +35 -0
  122. package/packages/core/dist/types/entity.d.ts.map +1 -0
  123. package/packages/core/dist/types/entity.js +2 -0
  124. package/packages/core/dist/types/entity.js.map +1 -0
  125. package/packages/core/dist/types/events.d.ts +76 -0
  126. package/packages/core/dist/types/events.d.ts.map +1 -0
  127. package/packages/core/dist/types/events.js +2 -0
  128. package/packages/core/dist/types/events.js.map +1 -0
  129. package/packages/core/dist/types/file.d.ts +15 -0
  130. package/packages/core/dist/types/file.d.ts.map +1 -0
  131. package/packages/core/dist/types/file.js +2 -0
  132. package/packages/core/dist/types/file.js.map +1 -0
  133. package/packages/core/dist/types/graph.d.ts +93 -0
  134. package/packages/core/dist/types/graph.d.ts.map +1 -0
  135. package/packages/core/dist/types/graph.js +2 -0
  136. package/packages/core/dist/types/graph.js.map +1 -0
  137. package/packages/core/dist/types/index.d.ts +10 -0
  138. package/packages/core/dist/types/index.d.ts.map +1 -0
  139. package/packages/core/dist/types/index.js +2 -0
  140. package/packages/core/dist/types/index.js.map +1 -0
  141. package/packages/core/dist/types/llm.d.ts +95 -0
  142. package/packages/core/dist/types/llm.d.ts.map +1 -0
  143. package/packages/core/dist/types/llm.js +10 -0
  144. package/packages/core/dist/types/llm.js.map +1 -0
  145. package/packages/core/dist/types/project.d.ts +11 -0
  146. package/packages/core/dist/types/project.d.ts.map +1 -0
  147. package/packages/core/dist/types/project.js +2 -0
  148. package/packages/core/dist/types/project.js.map +1 -0
  149. package/packages/core/dist/types/relationship.d.ts +26 -0
  150. package/packages/core/dist/types/relationship.d.ts.map +1 -0
  151. package/packages/core/dist/types/relationship.js +2 -0
  152. package/packages/core/dist/types/relationship.js.map +1 -0
  153. package/packages/core/package.json +22 -0
  154. package/packages/core/tsconfig.json +9 -0
  155. package/packages/graph/dist/index.d.ts +4 -0
  156. package/packages/graph/dist/index.d.ts.map +1 -0
  157. package/packages/graph/dist/index.js +4 -0
  158. package/packages/graph/dist/index.js.map +1 -0
  159. package/packages/graph/dist/migrations/001-initial.d.ts +4 -0
  160. package/packages/graph/dist/migrations/001-initial.d.ts.map +1 -0
  161. package/packages/graph/dist/migrations/001-initial.js +134 -0
  162. package/packages/graph/dist/migrations/001-initial.js.map +1 -0
  163. package/packages/graph/dist/query-engine.d.ts +35 -0
  164. package/packages/graph/dist/query-engine.d.ts.map +1 -0
  165. package/packages/graph/dist/query-engine.js +185 -0
  166. package/packages/graph/dist/query-engine.js.map +1 -0
  167. package/packages/graph/dist/sqlite-store.d.ts +125 -0
  168. package/packages/graph/dist/sqlite-store.d.ts.map +1 -0
  169. package/packages/graph/dist/sqlite-store.js +632 -0
  170. package/packages/graph/dist/sqlite-store.js.map +1 -0
  171. package/packages/graph/dist/vector-store.d.ts +27 -0
  172. package/packages/graph/dist/vector-store.d.ts.map +1 -0
  173. package/packages/graph/dist/vector-store.js +85 -0
  174. package/packages/graph/dist/vector-store.js.map +1 -0
  175. package/packages/graph/package.json +27 -0
  176. package/packages/graph/tsconfig.json +12 -0
  177. package/packages/ingest/dist/chunker.d.ts +21 -0
  178. package/packages/ingest/dist/chunker.d.ts.map +1 -0
  179. package/packages/ingest/dist/chunker.js +118 -0
  180. package/packages/ingest/dist/chunker.js.map +1 -0
  181. package/packages/ingest/dist/index.d.ts +11 -0
  182. package/packages/ingest/dist/index.d.ts.map +1 -0
  183. package/packages/ingest/dist/index.js +14 -0
  184. package/packages/ingest/dist/index.js.map +1 -0
  185. package/packages/ingest/dist/parsers/conversation.d.ts +10 -0
  186. package/packages/ingest/dist/parsers/conversation.d.ts.map +1 -0
  187. package/packages/ingest/dist/parsers/conversation.js +150 -0
  188. package/packages/ingest/dist/parsers/conversation.js.map +1 -0
  189. package/packages/ingest/dist/parsers/index.d.ts +11 -0
  190. package/packages/ingest/dist/parsers/index.d.ts.map +1 -0
  191. package/packages/ingest/dist/parsers/index.js +42 -0
  192. package/packages/ingest/dist/parsers/index.js.map +1 -0
  193. package/packages/ingest/dist/parsers/json-parser.d.ts +6 -0
  194. package/packages/ingest/dist/parsers/json-parser.d.ts.map +1 -0
  195. package/packages/ingest/dist/parsers/json-parser.js +114 -0
  196. package/packages/ingest/dist/parsers/json-parser.js.map +1 -0
  197. package/packages/ingest/dist/parsers/markdown.d.ts +6 -0
  198. package/packages/ingest/dist/parsers/markdown.d.ts.map +1 -0
  199. package/packages/ingest/dist/parsers/markdown.js +116 -0
  200. package/packages/ingest/dist/parsers/markdown.js.map +1 -0
  201. package/packages/ingest/dist/parsers/types.d.ts +18 -0
  202. package/packages/ingest/dist/parsers/types.d.ts.map +1 -0
  203. package/packages/ingest/dist/parsers/types.js +2 -0
  204. package/packages/ingest/dist/parsers/types.js.map +1 -0
  205. package/packages/ingest/dist/parsers/typescript.d.ts +11 -0
  206. package/packages/ingest/dist/parsers/typescript.d.ts.map +1 -0
  207. package/packages/ingest/dist/parsers/typescript.js +197 -0
  208. package/packages/ingest/dist/parsers/typescript.js.map +1 -0
  209. package/packages/ingest/dist/parsers/yaml-parser.d.ts +6 -0
  210. package/packages/ingest/dist/parsers/yaml-parser.d.ts.map +1 -0
  211. package/packages/ingest/dist/parsers/yaml-parser.js +52 -0
  212. package/packages/ingest/dist/parsers/yaml-parser.js.map +1 -0
  213. package/packages/ingest/dist/pipeline.d.ts +30 -0
  214. package/packages/ingest/dist/pipeline.d.ts.map +1 -0
  215. package/packages/ingest/dist/pipeline.js +311 -0
  216. package/packages/ingest/dist/pipeline.js.map +1 -0
  217. package/packages/ingest/dist/post-ingest.d.ts +25 -0
  218. package/packages/ingest/dist/post-ingest.d.ts.map +1 -0
  219. package/packages/ingest/dist/post-ingest.js +171 -0
  220. package/packages/ingest/dist/post-ingest.js.map +1 -0
  221. package/packages/ingest/dist/watcher.d.ts +26 -0
  222. package/packages/ingest/dist/watcher.d.ts.map +1 -0
  223. package/packages/ingest/dist/watcher.js +142 -0
  224. package/packages/ingest/dist/watcher.js.map +1 -0
  225. package/packages/ingest/package.json +30 -0
  226. package/packages/ingest/tsconfig.json +14 -0
  227. package/packages/llm/dist/cache.d.ts +26 -0
  228. package/packages/llm/dist/cache.d.ts.map +1 -0
  229. package/packages/llm/dist/cache.js +60 -0
  230. package/packages/llm/dist/cache.js.map +1 -0
  231. package/packages/llm/dist/index.d.ts +15 -0
  232. package/packages/llm/dist/index.d.ts.map +1 -0
  233. package/packages/llm/dist/index.js +19 -0
  234. package/packages/llm/dist/index.js.map +1 -0
  235. package/packages/llm/dist/output-parser.d.ts +4 -0
  236. package/packages/llm/dist/output-parser.d.ts.map +1 -0
  237. package/packages/llm/dist/output-parser.js +207 -0
  238. package/packages/llm/dist/output-parser.js.map +1 -0
  239. package/packages/llm/dist/prompts/context-ranking.d.ts +33 -0
  240. package/packages/llm/dist/prompts/context-ranking.d.ts.map +1 -0
  241. package/packages/llm/dist/prompts/context-ranking.js +30 -0
  242. package/packages/llm/dist/prompts/context-ranking.js.map +1 -0
  243. package/packages/llm/dist/prompts/contradiction-detection.d.ts +46 -0
  244. package/packages/llm/dist/prompts/contradiction-detection.d.ts.map +1 -0
  245. package/packages/llm/dist/prompts/contradiction-detection.js +45 -0
  246. package/packages/llm/dist/prompts/contradiction-detection.js.map +1 -0
  247. package/packages/llm/dist/prompts/conversational-query.d.ts +29 -0
  248. package/packages/llm/dist/prompts/conversational-query.d.ts.map +1 -0
  249. package/packages/llm/dist/prompts/conversational-query.js +34 -0
  250. package/packages/llm/dist/prompts/conversational-query.js.map +1 -0
  251. package/packages/llm/dist/prompts/entity-extraction.d.ts +67 -0
  252. package/packages/llm/dist/prompts/entity-extraction.d.ts.map +1 -0
  253. package/packages/llm/dist/prompts/entity-extraction.js +76 -0
  254. package/packages/llm/dist/prompts/entity-extraction.js.map +1 -0
  255. package/packages/llm/dist/prompts/follow-up-generation.d.ts +25 -0
  256. package/packages/llm/dist/prompts/follow-up-generation.d.ts.map +1 -0
  257. package/packages/llm/dist/prompts/follow-up-generation.js +25 -0
  258. package/packages/llm/dist/prompts/follow-up-generation.js.map +1 -0
  259. package/packages/llm/dist/prompts/merge-detection.d.ts +41 -0
  260. package/packages/llm/dist/prompts/merge-detection.d.ts.map +1 -0
  261. package/packages/llm/dist/prompts/merge-detection.js +31 -0
  262. package/packages/llm/dist/prompts/merge-detection.js.map +1 -0
  263. package/packages/llm/dist/prompts/relationship-inference.d.ts +60 -0
  264. package/packages/llm/dist/prompts/relationship-inference.d.ts.map +1 -0
  265. package/packages/llm/dist/prompts/relationship-inference.js +66 -0
  266. package/packages/llm/dist/prompts/relationship-inference.js.map +1 -0
  267. package/packages/llm/dist/providers/anthropic.d.ts +39 -0
  268. package/packages/llm/dist/providers/anthropic.d.ts.map +1 -0
  269. package/packages/llm/dist/providers/anthropic.js +157 -0
  270. package/packages/llm/dist/providers/anthropic.js.map +1 -0
  271. package/packages/llm/dist/providers/ollama.d.ts +52 -0
  272. package/packages/llm/dist/providers/ollama.d.ts.map +1 -0
  273. package/packages/llm/dist/providers/ollama.js +297 -0
  274. package/packages/llm/dist/providers/ollama.js.map +1 -0
  275. package/packages/llm/dist/providers/openai-compatible.d.ts +40 -0
  276. package/packages/llm/dist/providers/openai-compatible.d.ts.map +1 -0
  277. package/packages/llm/dist/providers/openai-compatible.js +164 -0
  278. package/packages/llm/dist/providers/openai-compatible.js.map +1 -0
  279. package/packages/llm/dist/router.d.ts +87 -0
  280. package/packages/llm/dist/router.d.ts.map +1 -0
  281. package/packages/llm/dist/router.js +399 -0
  282. package/packages/llm/dist/router.js.map +1 -0
  283. package/packages/llm/dist/token-tracker.d.ts +24 -0
  284. package/packages/llm/dist/token-tracker.d.ts.map +1 -0
  285. package/packages/llm/dist/token-tracker.js +114 -0
  286. package/packages/llm/dist/token-tracker.js.map +1 -0
  287. package/packages/llm/package.json +25 -0
  288. package/packages/llm/tsconfig.json +12 -0
  289. package/packages/mcp/dist/index.d.ts +10 -0
  290. package/packages/mcp/dist/index.d.ts.map +1 -0
  291. package/packages/mcp/dist/index.js +33 -0
  292. package/packages/mcp/dist/index.js.map +1 -0
  293. package/packages/mcp/dist/server.d.ts +5 -0
  294. package/packages/mcp/dist/server.d.ts.map +1 -0
  295. package/packages/mcp/dist/server.js +87 -0
  296. package/packages/mcp/dist/server.js.map +1 -0
  297. package/packages/mcp/dist/store-factory.d.ts +8 -0
  298. package/packages/mcp/dist/store-factory.d.ts.map +1 -0
  299. package/packages/mcp/dist/store-factory.js +24 -0
  300. package/packages/mcp/dist/store-factory.js.map +1 -0
  301. package/packages/mcp/dist/tools/contradictions.d.ts +14 -0
  302. package/packages/mcp/dist/tools/contradictions.d.ts.map +1 -0
  303. package/packages/mcp/dist/tools/contradictions.js +33 -0
  304. package/packages/mcp/dist/tools/contradictions.js.map +1 -0
  305. package/packages/mcp/dist/tools/find.d.ts +37 -0
  306. package/packages/mcp/dist/tools/find.d.ts.map +1 -0
  307. package/packages/mcp/dist/tools/find.js +52 -0
  308. package/packages/mcp/dist/tools/find.js.map +1 -0
  309. package/packages/mcp/dist/tools/projects.d.ts +16 -0
  310. package/packages/mcp/dist/tools/projects.d.ts.map +1 -0
  311. package/packages/mcp/dist/tools/projects.js +17 -0
  312. package/packages/mcp/dist/tools/projects.js.map +1 -0
  313. package/packages/mcp/dist/tools/query.d.ts +20 -0
  314. package/packages/mcp/dist/tools/query.d.ts.map +1 -0
  315. package/packages/mcp/dist/tools/query.js +65 -0
  316. package/packages/mcp/dist/tools/query.js.map +1 -0
  317. package/packages/mcp/dist/tools/status.d.ts +15 -0
  318. package/packages/mcp/dist/tools/status.d.ts.map +1 -0
  319. package/packages/mcp/dist/tools/status.js +17 -0
  320. package/packages/mcp/dist/tools/status.js.map +1 -0
  321. package/packages/mcp/package.json +27 -0
  322. package/packages/mcp/tsconfig.json +14 -0
  323. package/packages/server/dist/index.d.ts +17 -0
  324. package/packages/server/dist/index.d.ts.map +1 -0
  325. package/packages/server/dist/index.js +170 -0
  326. package/packages/server/dist/index.js.map +1 -0
  327. package/packages/server/dist/middleware/auth.d.ts +9 -0
  328. package/packages/server/dist/middleware/auth.d.ts.map +1 -0
  329. package/packages/server/dist/middleware/auth.js +94 -0
  330. package/packages/server/dist/middleware/auth.js.map +1 -0
  331. package/packages/server/dist/routes/contradictions.d.ts +4 -0
  332. package/packages/server/dist/routes/contradictions.d.ts.map +1 -0
  333. package/packages/server/dist/routes/contradictions.js +63 -0
  334. package/packages/server/dist/routes/contradictions.js.map +1 -0
  335. package/packages/server/dist/routes/entities.d.ts +4 -0
  336. package/packages/server/dist/routes/entities.d.ts.map +1 -0
  337. package/packages/server/dist/routes/entities.js +61 -0
  338. package/packages/server/dist/routes/entities.js.map +1 -0
  339. package/packages/server/dist/routes/projects.d.ts +4 -0
  340. package/packages/server/dist/routes/projects.d.ts.map +1 -0
  341. package/packages/server/dist/routes/projects.js +35 -0
  342. package/packages/server/dist/routes/projects.js.map +1 -0
  343. package/packages/server/dist/routes/query.d.ts +4 -0
  344. package/packages/server/dist/routes/query.d.ts.map +1 -0
  345. package/packages/server/dist/routes/query.js +93 -0
  346. package/packages/server/dist/routes/query.js.map +1 -0
  347. package/packages/server/dist/routes/relationships.d.ts +4 -0
  348. package/packages/server/dist/routes/relationships.d.ts.map +1 -0
  349. package/packages/server/dist/routes/relationships.js +52 -0
  350. package/packages/server/dist/routes/relationships.js.map +1 -0
  351. package/packages/server/dist/routes/status.d.ts +4 -0
  352. package/packages/server/dist/routes/status.d.ts.map +1 -0
  353. package/packages/server/dist/routes/status.js +85 -0
  354. package/packages/server/dist/routes/status.js.map +1 -0
  355. package/packages/server/dist/ws/event-relay.d.ts +10 -0
  356. package/packages/server/dist/ws/event-relay.d.ts.map +1 -0
  357. package/packages/server/dist/ws/event-relay.js +83 -0
  358. package/packages/server/dist/ws/event-relay.js.map +1 -0
  359. package/packages/server/package.json +32 -0
  360. package/packages/server/tsconfig.json +15 -0
  361. package/packages/web/dist/assets/index-Bxjfq4I0.css +1 -0
  362. package/packages/web/dist/assets/index-MqwNS5FD.js +248 -0
  363. package/packages/web/dist/assets/index-MqwNS5FD.js.map +1 -0
  364. package/packages/web/dist/cortex-icon.svg +9 -0
  365. package/packages/web/dist/icon.png +0 -0
  366. package/packages/web/dist/index.html +14 -0
  367. package/packages/web/dist/logo.png +0 -0
  368. package/packages/web/index.html +13 -0
  369. package/packages/web/package.json +34 -0
  370. package/packages/web/public/cortex-icon.svg +9 -0
  371. package/packages/web/public/icon.png +0 -0
  372. package/packages/web/public/logo.png +0 -0
  373. package/packages/web/tsconfig.json +22 -0
  374. package/packages/web/vite.config.ts +20 -0
  375. package/tsconfig.base.json +18 -0
  376. package/tsconfig.json +12 -0
  377. package/vitest.config.ts +14 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ # Changelog
2
+
3
+ All notable changes to GZOO Cortex will be documented in this file.
4
+
5
+ ## [0.1.0] - 2026-03-04
6
+
7
+ ### Added
8
+
9
+ - **Core:** EventBus, config loader with Zod validation, structured error classes
10
+ - **Ingest:** File watcher (Chokidar), parsers for Markdown, TypeScript, JSON, YAML, conversation exports
11
+ - **Graph:** SQLite entity/relationship store, LanceDB vector embeddings, FTS5 query engine
12
+ - **LLM:** Provider abstraction for Anthropic Claude, Google Gemini, OpenAI-compatible APIs, and Ollama
13
+ - **LLM:** Smart hybrid routing — high-volume tasks to local, reasoning to cloud
14
+ - **LLM:** Privacy pipeline — restricted files never sent to cloud, secret scanning + redaction
15
+ - **LLM:** Budget tracking with monthly limits and automatic fallback
16
+ - **CLI:** 17 commands — init, watch, query, find, status, costs, config, privacy, contradictions, resolve, ingest, models, serve, mcp, report, db, projects
17
+ - **MCP:** Model Context Protocol server for Claude Code integration (4 tools)
18
+ - **Web:** React + Vite dashboard with 5 views — Dashboard Home, Knowledge Graph (D3-force), Live Feed (WebSocket), Query Explorer, Contradiction Resolver
19
+ - **Server:** Express REST API + WebSocket relay for real-time events
20
+ - **Detection:** Automatic merge detection and contradiction detection post-ingestion
21
+ - **Confidence:** Local-first confidence escalation — retry on cloud when local confidence < 0.6
package/CLAUDE.md ADDED
@@ -0,0 +1,180 @@
1
+ # CLAUDE.md — GZOO Cortex Project Instructions
2
+
3
+ > **Read this file on every session.** It is the single source of truth for working on GZOO Cortex.
4
+ > Detailed specs live in `/docs/` — reference them before implementing any component.
5
+
6
+ ## What Is GZOO Cortex
7
+
8
+ GZOO Cortex is a **local-first knowledge orchestrator** that watches your project files, extracts entities and relationships using LLMs, stores them in a knowledge graph, and lets you query your own decisions, patterns, and context via natural language CLI and web interface.
9
+
10
+ **Core value prop:** You work across 5+ projects. GZOO Cortex remembers what you decided, why, and where — so you never lose context switching between projects.
11
+
12
+ ## Tech Stack
13
+
14
+ | Layer | Technology | Why |
15
+ |-------|-----------|-----|
16
+ | Runtime | Node.js 20+ with TypeScript (strict mode) | Fast I/O, native file watching |
17
+ | Database | SQLite via better-sqlite3 (WAL mode) | Zero-config, single-file, fast |
18
+ | Vector DB | LanceDB (embedded) | Columnar vectors, no server |
19
+ | LLM (Cloud) | Anthropic Claude Sonnet 4.5 / Haiku 4.5 | Primary cloud provider |
20
+ | LLM (Local) | Ollama + Mistral 7B | Local inference for hybrid/local modes |
21
+ | File Watching | Chokidar | Battle-tested, cross-platform |
22
+ | Parsing | tree-sitter (code), unified/remark (markdown) | AST-level extraction |
23
+ | CLI | Commander.js + Ink (React for terminals) | Rich interactive CLI |
24
+ | Web UI | React + Vite | Localhost dashboard |
25
+ | Monorepo | npm workspaces | Simple, no extra tooling |
26
+
27
+ ## Monorepo Structure
28
+
29
+ ```
30
+ cortex/
31
+ ├── CLAUDE.md ← YOU ARE HERE
32
+ ├── package.json ← root workspace config
33
+ ├── tsconfig.base.json ← shared TypeScript config
34
+ ├── packages/
35
+ │ ├── core/ ← shared types, event bus, config, errors
36
+ │ │ └── src/
37
+ │ │ ├── types/ ← ALL TypeScript interfaces (see docs/types.md)
38
+ │ │ ├── events/ ← EventBus implementation
39
+ │ │ ├── config/ ← Config loader + Zod validation
40
+ │ │ └── errors/ ← CortexError class + error codes
41
+ │ ├── ingest/ ← file watcher, parsers, chunker
42
+ │ │ └── src/
43
+ │ │ ├── watcher.ts ← Chokidar wrapper
44
+ │ │ ├── parsers/ ← markdown, typescript, json, yaml, conversation parsers
45
+ │ │ └── chunker.ts ← content splitting for LLM context
46
+ │ ├── graph/ ← SQLite store, LanceDB vectors, query engine
47
+ │ │ └── src/
48
+ │ │ ├── sqlite-store.ts ← entity/relationship CRUD
49
+ │ │ ├── vector-store.ts ← LanceDB embedding storage
50
+ │ │ └── query-engine.ts ← context assembly for LLM queries
51
+ │ ├── llm/ ← LLM provider abstraction, prompts
52
+ │ │ └── src/
53
+ │ │ ├── providers/ ← anthropic.ts, ollama.ts
54
+ │ │ ├── prompts/ ← versioned prompt templates (see docs/prompts.md)
55
+ │ │ ├── router.ts ← smart routing (cloud, hybrid, local-first, local-only)
56
+ │ │ └── cache.ts ← response caching
57
+ │ ├── cli/ ← all CLI commands
58
+ │ │ └── src/
59
+ │ │ ├── commands/ ← init, watch, query, find, status, costs, config, etc.
60
+ │ │ └── index.ts ← Commander.js entry point
61
+ │ ├── mcp/ ← MCP server (stdio transport)
62
+ │ │ └── src/
63
+ │ │ └── index.ts ← 4 tools: get_status, list_projects, find_entity, query_cortex
64
+ │ ├── server/ ← Express API backend for web dashboard
65
+ │ └── web/ ← React dashboard (Vite)
66
+ ├── docs/ ← SPEC FILES (read before implementing)
67
+ │ ├── types.md ← ALL TypeScript interfaces
68
+ │ ├── prompts.md ← ALL LLM prompts with schemas
69
+ │ ├── api-contracts.md ← REST API, WebSocket, event bus contracts
70
+ │ ├── cli-commands.md ← Every CLI command spec
71
+ │ ├── config.md ← Full config schema + defaults
72
+ │ ├── errors.md ← Error codes, recovery, degradation chain
73
+ │ └── security.md ← Privacy model, threat model, data classification
74
+ └── tests/
75
+ ├── unit/
76
+ └── integration/
77
+ ```
78
+
79
+ ## Architecture Rules
80
+
81
+ 1. **Packages communicate via the EventBus only.** No direct imports between packages except `@cortex/core` types.
82
+ 2. **All LLM calls go through the Router** (`packages/llm/src/router.ts`). No package calls a provider directly.
83
+ 3. **Privacy check runs before every cloud API call.** See `docs/security.md` for the pre-transmission pipeline.
84
+ 4. **Every entity and relationship has a source trail.** `sourceFile`, `sourceRange`, `extractedBy` (prompt+model+version).
85
+ 5. **Errors use CortexError class** with typed codes. See `docs/errors.md` for the full registry.
86
+ 6. **Config validated with Zod schemas.** See `docs/config.md` for every field.
87
+
88
+ ## Core Functionality
89
+
90
+ The system delivers a complete pipeline: **ingest files, extract entities/relationships via LLM, store in knowledge graph, query via CLI or web dashboard.**
91
+
92
+ ### CLI Commands
93
+
94
+ - `cortex init` — Interactive setup (routing mode, API key, directories)
95
+ - `cortex watch` — Start file watcher + ingestion pipeline (with live contradiction alerts)
96
+ - `cortex query "<question>"` — Natural language query with citations
97
+ - `cortex find <name>` — Direct entity lookup with relationship expansion
98
+ - `cortex status` — System dashboard (graph stats, LLM status, costs, local provider info)
99
+ - `cortex costs` — Detailed cost reporting
100
+ - `cortex config` — Read/write/validate configuration
101
+ - `cortex privacy` — Privacy classification management
102
+ - `cortex contradictions` — View detected contradictions
103
+ - `cortex resolve` — Resolve contradictions
104
+ - `cortex projects` — List tracked projects
105
+ - `cortex ingest <file>` — One-shot file ingestion (`--project`, `--dry-run`)
106
+ - `cortex models list/pull/test/info` — Manage Ollama models
107
+ - `cortex serve` — Start web dashboard (default port 3710)
108
+
109
+ ### LLM Routing Modes
110
+
111
+ | Mode | Behavior |
112
+ |------|----------|
113
+ | `cloud-first` | All tasks go to Anthropic API |
114
+ | `hybrid` | Entity extraction via Ollama, reasoning tasks via cloud |
115
+ | `local-first` | Prefer Ollama, escalate to cloud if confidence < 0.6 |
116
+ | `local-only` | All tasks use Ollama, no cloud calls ever |
117
+
118
+ Task routing:
119
+ - Entity extraction → Ollama (hybrid/local modes) or Claude Haiku (cloud)
120
+ - Relationship inference → Claude Sonnet (reasoning-heavy)
121
+ - Contradiction detection → Claude Sonnet (except restricted projects → Ollama)
122
+ - Context ranking → Ollama (local preferred)
123
+ - Conversational queries → Claude Sonnet (streaming)
124
+ - Embeddings → local via LanceDB built-in or Ollama nomic-embed-text
125
+ - Budget exhausted → all tasks auto-route to Ollama
126
+
127
+ ### MCP Server
128
+
129
+ The MCP server (`packages/mcp`) exposes 4 tools via stdio transport for use with Claude Code and other MCP clients:
130
+ - `get_status` — System status
131
+ - `list_projects` — Tracked projects
132
+ - `find_entity` — Entity lookup
133
+ - `query_cortex` — Natural language query
134
+
135
+ ### Web Dashboard
136
+
137
+ `cortex serve` starts an Express API + React SPA at `localhost:3710` with 5 views:
138
+ - Dashboard Home — overview and stats
139
+ - Knowledge Graph — D3-force visualization with smart clustering
140
+ - Live Feed — real-time events via WebSocket
141
+ - Query Explorer — natural language queries in the browser
142
+ - Contradictions — view and manage detected contradictions
143
+
144
+ ## Coding Standards
145
+
146
+ - **TypeScript strict mode.** No `any` types. No `ts-ignore`.
147
+ - **Zod for all external data validation** (config files, LLM responses, API inputs).
148
+ - **No classes for data.** Use interfaces + plain objects. Classes only for services (EventBus, SQLiteStore, etc.).
149
+ - **Async/await everywhere.** No callbacks. No `.then()` chains.
150
+ - **Error handling:** Wrap external calls in try/catch. Throw `CortexError` with typed codes. Never throw raw `Error`.
151
+ - **Logging:** Use the structured logger from `@cortex/core`. Never `console.log` in production code.
152
+ - **Tests:** Unit tests for parsers, prompt output validation, config validation. Integration tests for the full ingest-extract-store pipeline.
153
+ - **No lodash/underscore.** Use native Array methods. Keep dependencies minimal.
154
+ - **File size limit:** No single file over 400 lines. Split into focused modules.
155
+
156
+ ## Key Spec Files (Read Before Coding)
157
+
158
+ | Before building... | Read this spec |
159
+ |---|---|
160
+ | Any TypeScript interface | `docs/types.md` |
161
+ | Any LLM prompt or extraction | `docs/prompts.md` |
162
+ | Any CLI command | `docs/cli-commands.md` |
163
+ | Config loading or validation | `docs/config.md` |
164
+ | Error handling or recovery | `docs/errors.md` |
165
+ | Privacy checks or API calls | `docs/security.md` |
166
+ | REST API or WebSocket | `docs/api-contracts.md` |
167
+
168
+ ## Quick Reference: Entity Types
169
+
170
+ `Decision`, `Requirement`, `Pattern`, `Component`, `Dependency`, `Interface`, `Constraint`, `ActionItem`, `Risk`, `Note`
171
+
172
+ ## Quick Reference: Relationship Types
173
+
174
+ `depends_on`, `implements`, `contradicts`, `evolved_from`, `relates_to`, `uses`, `constrains`, `resolves`, `documents`, `derived_from`
175
+
176
+ ## Quick Reference: Error Code Format
177
+
178
+ `LAYER_CATEGORY_DETAIL` — e.g., `LLM_PROVIDER_UNAVAILABLE`, `INGEST_PARSE_FAILED`, `GRAPH_DB_ERROR`
179
+
180
+ Layers: `INGEST`, `GRAPH`, `LLM`, `INTERFACE`, `CONFIG`, `PRIVACY`
@@ -0,0 +1,52 @@
1
+ # Contributing to GZOO Cortex
2
+
3
+ Thanks for your interest in contributing!
4
+
5
+ ## Getting Started
6
+
7
+ 1. Fork the repo
8
+ 2. Clone your fork
9
+ 3. Install dependencies: `npm install`
10
+ 4. Build: `npm run build`
11
+ 5. Run tests: `npm test`
12
+
13
+ ## Development
14
+
15
+ Cortex is a monorepo with npm workspaces. Packages are in `packages/`.
16
+
17
+ ```bash
18
+ # Build all packages
19
+ npm run build
20
+
21
+ # Run tests
22
+ npm test
23
+
24
+ # Run a specific package's tests
25
+ cd packages/llm && npm test
26
+
27
+ # Link for local development
28
+ cd packages/cli && npm link
29
+ ```
30
+
31
+ ## Pull Requests
32
+
33
+ - One feature or fix per PR
34
+ - Include tests for new functionality
35
+ - Run `npm test` before submitting
36
+ - Keep PRs focused — large refactors should be discussed in an Issue first
37
+
38
+ ## Reporting Bugs
39
+
40
+ Open an Issue with:
41
+ - What you expected to happen
42
+ - What actually happened
43
+ - Steps to reproduce
44
+ - Your environment (OS, Node version, Ollama version if applicable)
45
+
46
+ ## Feature Requests
47
+
48
+ Open a Discussion in the Ideas category. Describe the use case, not just the solution.
49
+
50
+ ## Code of Conduct
51
+
52
+ Be kind. Be constructive. We're all here to build something useful.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GZOO Media LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,259 @@
1
+ # GZOO Cortex
2
+
3
+ <p align="center">
4
+ <img src="social-preview.png" alt="GZOO Cortex — Local-first knowledge graph for developers" width="100%" />
5
+ </p>
6
+
7
+ **Local-first knowledge graph for developers.** Watches your project files,
8
+ extracts entities and relationships using LLMs, and lets you query across
9
+ all your projects in natural language.
10
+
11
+ > “What architecture decisions have I made across projects?”
12
+ >
13
+ > Cortex finds decisions from your READMEs, TypeScript files, config files,
14
+ > and conversation exports — then synthesizes an answer with source citations.
15
+
16
+ ## Why
17
+
18
+ You work on multiple projects. Decisions, patterns, and context are scattered
19
+ across hundreds of files. You forget what you decided three months ago. You
20
+ re-solve problems you already solved in another repo.
21
+
22
+ Cortex watches your project directories, extracts knowledge automatically,
23
+ and gives it back to you when you need it.
24
+
25
+ ## What It Does
26
+
27
+ - **Watches** your project files (md, ts, js, json, yaml) for changes
28
+ - **Extracts** entities: decisions, patterns, components, dependencies, constraints, action items
29
+ - **Infers** relationships between entities across projects
30
+ - **Detects** contradictions when decisions conflict
31
+ - **Queries** in natural language with source citations
32
+ - **Routes** intelligently between cloud and local LLMs
33
+ - **Respects** privacy — restricted projects never leave your machine
34
+ - **Web dashboard** with knowledge graph visualization, live feed, and query explorer
35
+ - **MCP server** for direct integration with Claude Code
36
+
37
+ ## Quick Start
38
+
39
+ ### 1. Install
40
+
41
+ ```bash
42
+ npm install -g gzoo-cortex
43
+ ```
44
+
45
+ Or install from source:
46
+
47
+ ```bash
48
+ git clone https://github.com/gzoonet/cortex.git
49
+ cd cortex
50
+ npm install && npm run build && npm link
51
+ ```
52
+
53
+ ### 2. Setup
54
+
55
+ Run the interactive wizard:
56
+
57
+ ```bash
58
+ cortex init
59
+ ```
60
+
61
+ This walks you through:
62
+ - **LLM provider** — Anthropic, Google Gemini, Groq, OpenRouter, or Ollama (local)
63
+ - **API key** — saved securely to `~/.cortex/.env`
64
+ - **Routing mode** — cloud-first, hybrid, local-first, or local-only
65
+ - **Watch directories** — which directories Cortex should monitor
66
+ - **Budget limit** — monthly LLM spend cap
67
+
68
+ Config is stored at `~/.cortex/cortex.config.json`. API keys go in `~/.cortex/.env`.
69
+
70
+ ### 3. Register Projects
71
+
72
+ ```bash
73
+ cortex projects add my-app ~/projects/app
74
+ cortex projects add api ~/projects/api
75
+ cortex projects list # verify
76
+ ```
77
+
78
+ ### 4. Watch & Query
79
+
80
+ ```bash
81
+ cortex watch # start watching for changes
82
+ cortex query "what caching strategies am I using?"
83
+ cortex query "what decisions have I made about authentication?"
84
+ cortex find "PostgreSQL" --expand 2
85
+ cortex contradictions
86
+ ```
87
+
88
+ ### 5. Web Dashboard
89
+
90
+ ```bash
91
+ cortex serve # open http://localhost:3710
92
+ ```
93
+
94
+ ### Excluding Files & Directories
95
+
96
+ Cortex ignores `node_modules`, `dist`, `.git`, and other common directories by default. To add more:
97
+
98
+ ```bash
99
+ cortex config exclude add docs # exclude a directory
100
+ cortex config exclude add "*.log" # exclude by pattern
101
+ cortex config exclude list # see all excludes
102
+ cortex config exclude remove docs # remove an exclude
103
+ ```
104
+
105
+ ## How It Works
106
+
107
+ Cortex runs a pipeline on every file change:
108
+
109
+ 1. **Parse** — file content is chunked by a language-aware parser (tree-sitter for code, remark for markdown)
110
+ 2. **Extract** — LLM identifies entities (decisions, components, patterns, etc.)
111
+ 3. **Relate** — LLM infers relationships between new and existing entities
112
+ 4. **Detect** — contradictions and duplicates are flagged automatically
113
+ 5. **Store** — entities, relationships, and vectors go into SQLite + LanceDB
114
+ 6. **Query** — natural language queries search the graph and synthesize answers
115
+
116
+ All data stays local in `~/.cortex/`. Only LLM API calls leave your machine
117
+ (and never for restricted projects).
118
+
119
+ ## LLM Providers
120
+
121
+ Cortex is **provider-agnostic**. It supports:
122
+
123
+ - **Anthropic Claude** (Sonnet, Haiku) — via native Anthropic API
124
+ - **Google Gemini** — via OpenAI-compatible API
125
+ - **Any OpenAI-compatible API** — OpenRouter, local proxies, etc.
126
+ - **Ollama** (Mistral, Llama, etc.) — fully local, no cloud required
127
+
128
+ ### Routing Modes
129
+
130
+ | Mode | Cloud Cost | Quality | GPU Required |
131
+ |------|-----------|---------|--------------|
132
+ | `cloud-first` | Varies by provider | Highest | No |
133
+ | `hybrid` | Reduced | High | Yes (Ollama) |
134
+ | `local-first` | Minimal | Good | Yes (Ollama) |
135
+ | `local-only` | $0 | Good | Yes (Ollama) |
136
+
137
+ Hybrid mode routes high-volume tasks (entity extraction, ranking) to Ollama
138
+ and reasoning-heavy tasks (relationship inference, queries) to your cloud provider.
139
+
140
+ ## Requirements
141
+
142
+ - **Node.js** 20+
143
+ - **LLM API key** for cloud modes — Anthropic, Google Gemini, or any OpenAI-compatible provider
144
+ - **Ollama** (for hybrid/local modes) — [install](https://ollama.ai/)
145
+
146
+ ## Configuration
147
+
148
+ All config lives in `~/.cortex/cortex.config.json`. API keys are in `~/.cortex/.env`.
149
+
150
+ ```bash
151
+ cortex config list # see all non-default settings
152
+ cortex config set llm.mode hybrid # switch routing mode
153
+ cortex config set llm.budget.monthlyLimitUsd 10 # set budget
154
+ cortex config exclude add vendor # exclude a directory from watching
155
+ cortex privacy set ~/clients restricted # mark directory as restricted
156
+ ```
157
+
158
+ Full configuration reference: [docs/configuration.md](docs/configuration.md)
159
+
160
+ ## Commands
161
+
162
+ | Command | Description |
163
+ |---------|-------------|
164
+ | `cortex init` | Interactive setup wizard |
165
+ | `cortex projects add <name> [path]` | Register a project directory |
166
+ | `cortex projects list` | List registered projects |
167
+ | `cortex watch [project]` | Start watching for file changes |
168
+ | `cortex query <question>` | Natural language query with citations |
169
+ | `cortex find <term>` | Find entities by name |
170
+ | `cortex ingest <file-or-glob>` | One-shot file ingestion |
171
+ | `cortex status` | Graph stats, costs, provider status |
172
+ | `cortex costs` | Detailed cost breakdown |
173
+ | `cortex contradictions` | List active contradictions |
174
+ | `cortex resolve <id>` | Resolve a contradiction |
175
+ | `cortex models list/pull/test/info` | Manage Ollama models |
176
+ | `cortex serve` | Start web dashboard (localhost:3710) |
177
+ | `cortex mcp` | Start MCP server for Claude Code |
178
+ | `cortex report` | Post-ingestion summary |
179
+ | `cortex privacy set <dir> <level>` | Set directory privacy |
180
+ | `cortex config list/get/set` | Read/write configuration |
181
+ | `cortex config exclude add/remove/list` | Manage file/directory exclusions |
182
+ | `cortex db` | Database operations |
183
+
184
+ Full CLI reference: [docs/cli-reference.md](docs/cli-reference.md)
185
+
186
+ ## Web Dashboard
187
+
188
+ Run `cortex serve` to open a full web dashboard at `http://localhost:3710` with:
189
+
190
+ - **Dashboard Home** — graph stats, recent activity, entity type breakdown
191
+ - **Knowledge Graph** — interactive D3-force graph with clustering, click to explore
192
+ - **Live Feed** — real-time file change and entity extraction events via WebSocket
193
+ - **Query Explorer** — natural language queries with streaming responses
194
+ - **Contradiction Resolver** — review and resolve conflicting decisions
195
+
196
+ ## MCP Server (Claude Code Integration)
197
+
198
+ Cortex includes an MCP server so Claude Code can query your knowledge graph directly:
199
+
200
+ ```bash
201
+ claude mcp add cortex --scope user -- node /path/to/packages/mcp/dist/index.js
202
+ ```
203
+
204
+ This gives Claude Code 4 tools: `get_status`, `list_projects`, `find_entity`, `query_cortex`.
205
+
206
+ ## Architecture
207
+
208
+ Monorepo with eight packages:
209
+
210
+ - **@cortex/core** — types, EventBus, config loader, error classes
211
+ - **@cortex/ingest** — file parsers (tree-sitter + remark), chunker, watcher, pipeline
212
+ - **@cortex/graph** — SQLite store, LanceDB vectors, query engine
213
+ - **@cortex/llm** — Anthropic/Gemini/OpenAI-compatible/Ollama providers, router, prompts, cache
214
+ - **@cortex/cli** — Commander.js CLI with 17 commands
215
+ - **@cortex/mcp** — Model Context Protocol server (stdio transport)
216
+ - **@cortex/server** — Express REST API + WebSocket relay
217
+ - **@cortex/web** — React + Vite + D3 web dashboard
218
+
219
+ Architecture docs: [docs/](docs/)
220
+
221
+ ## Privacy & Security
222
+
223
+ - Files classified as `restricted` are **never** sent to cloud LLMs
224
+ - Sensitive files (.env, .pem, .key) are auto-detected and blocked
225
+ - API key secrets are scanned and redacted before any cloud transmission
226
+ - All data stored locally in `~/.cortex/` — nothing phones home
227
+
228
+ Full security architecture: [docs/security.md](docs/security.md)
229
+
230
+ ## Built With
231
+
232
+ - [SQLite](https://sqlite.org/) via better-sqlite3 — entity and relationship storage
233
+ - [LanceDB](https://lancedb.com/) — vector embeddings for semantic search
234
+ - [Anthropic Claude](https://anthropic.com/) — cloud LLM provider
235
+ - [Google Gemini](https://ai.google.dev/) — cloud LLM provider (via OpenAI-compatible API)
236
+ - [Ollama](https://ollama.ai/) — local LLM inference
237
+ - [tree-sitter](https://tree-sitter.github.io/) — language-aware file parsing
238
+ - [Chokidar](https://github.com/paulmillr/chokidar) — cross-platform file watching
239
+ - [Commander.js](https://github.com/tj/commander.js/) — CLI framework
240
+ - [React](https://react.dev/) + [Vite](https://vite.dev/) — web dashboard
241
+ - [D3](https://d3js.org/) — knowledge graph visualization
242
+
243
+ ## Contributing
244
+
245
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
246
+
247
+ ## License
248
+
249
+ MIT — see [LICENSE](LICENSE)
250
+
251
+ ## About
252
+
253
+ Built by [GZOO](https://gzoo.ai) — an AI-powered business automation platform.
254
+
255
+ Cortex started as an internal tool to maintain context across multiple
256
+ client projects. We open-sourced it because every developer who works on
257
+ more than one thing loses context, and we think this approach — automatic
258
+ file watching + knowledge graph + natural language queries — is the right
259
+ way to solve it.