@danielblomma/cortex-mcp 2.1.1 → 2.2.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.
- package/README.md +72 -24
- package/bin/cortex.mjs +50 -21
- package/mcp-registry-submission.json +63 -0
- package/package.json +19 -5
- package/scaffold/AGENTS.md +13 -9
- package/scaffold/CLAUDE.md +13 -9
- package/scaffold/docs/architecture.md +1 -1
- package/scaffold/mcp/build.mjs +92 -0
- package/scaffold/mcp/package.json +4 -4
- package/scaffold/mcp/src/cli/query.ts +455 -0
- package/scaffold/mcp/src/embed.ts +181 -77
- package/scaffold/mcp/src/embedScheduler.ts +509 -0
- package/scaffold/mcp/src/embeddings.ts +31 -30
- package/scaffold/mcp/src/graphCsv.ts +65 -0
- package/scaffold/mcp/src/jsonl.ts +69 -14
- package/scaffold/mcp/src/loadGraph.ts +276 -40
- package/scaffold/mcp/src/lruCache.ts +41 -0
- package/scaffold/mcp/src/searchCore.ts +1 -1
- package/scaffold/mcp/src/searchResults.ts +3 -3
- package/scaffold/mcp/src/types.ts +6 -1
- package/scaffold/mcp/tests/embed-scheduler.test.mjs +474 -0
- package/scaffold/mcp/tests/embedding-jsonl.test.mjs +39 -0
- package/scaffold/mcp/tests/graph-bulk-load.test.mjs +258 -0
- package/scaffold/mcp/tests/graph-csv.test.mjs +118 -0
- package/scaffold/mcp/tests/lru-cache.test.mjs +37 -0
- package/scaffold/mcp/tests/query-cli.test.mjs +115 -0
- package/scaffold/mcp/tests/vector-index.test.mjs +109 -0
- package/scaffold/mcp/tsconfig.json +3 -1
- package/scaffold/scripts/bootstrap.sh +37 -4
- package/scaffold/scripts/dashboard.mjs +1 -1
- package/scaffold/scripts/doctor.sh +9 -8
- package/scaffold/scripts/embed.sh +3 -2
- package/scaffold/scripts/ingest-parsers.mjs +387 -0
- package/scaffold/scripts/ingest-worker.mjs +52 -0
- package/scaffold/scripts/ingest.mjs +550 -378
- package/scaffold/scripts/load-ryu.sh +3 -2
- package/scaffold/scripts/memory-compile.mjs +5 -2
- package/scaffold/scripts/memory-lint.mjs +5 -2
- package/scaffold/scripts/parsers/csharp.mjs +2 -1
- package/scaffold/scripts/parsers/javascript/ast.mjs +160 -8
- package/scaffold/scripts/parsers/javascript/chunks.mjs +129 -22
- package/scaffold/scripts/parsers/javascript/imports.mjs +38 -4
- package/scaffold/scripts/parsers/vbnet.mjs +2 -1
- package/scaffold/scripts/status.sh +50 -14
- package/scaffold/scripts/parsers/node_modules/.package-lock.json +0 -56
- package/scaffold/scripts/parsers/node_modules/acorn/CHANGELOG.md +0 -972
- package/scaffold/scripts/parsers/node_modules/acorn/LICENSE +0 -21
- package/scaffold/scripts/parsers/node_modules/acorn/README.md +0 -301
- package/scaffold/scripts/parsers/node_modules/acorn/bin/acorn +0 -4
- package/scaffold/scripts/parsers/node_modules/acorn/dist/acorn.d.mts +0 -883
- package/scaffold/scripts/parsers/node_modules/acorn/dist/acorn.d.ts +0 -883
- package/scaffold/scripts/parsers/node_modules/acorn/dist/acorn.js +0 -6295
- package/scaffold/scripts/parsers/node_modules/acorn/dist/acorn.mjs +0 -6266
- package/scaffold/scripts/parsers/node_modules/acorn/dist/bin.js +0 -90
- package/scaffold/scripts/parsers/node_modules/acorn/package.json +0 -50
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/CHANGELOG.md +0 -421
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/LICENSE +0 -21
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/README.md +0 -81
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/error.d.ts +0 -103
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/error.js +0 -78
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/error.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/decorators.d.ts +0 -167
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/decorators.js +0 -75
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/decorators.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/import-assertions.d.ts +0 -177
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/import-assertions.js +0 -56
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/import-assertions.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/jsx/index.d.ts +0 -198
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/jsx/index.js +0 -327
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/jsx/index.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/jsx/xhtml.d.ts +0 -256
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/jsx/xhtml.js +0 -256
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/extentions/jsx/xhtml.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/index.d.ts +0 -472
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/index.js +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/index.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/index.mjs +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/middleware.d.ts +0 -159
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/middleware.js +0 -2
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/middleware.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/parseutil.d.ts +0 -10
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/parseutil.js +0 -38
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/parseutil.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/scopeflags.d.ts +0 -12
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/scopeflags.js +0 -29
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/scopeflags.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/tokenType.d.ts +0 -2
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/tokenType.js +0 -118
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/tokenType.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/types.d.ts +0 -60
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/types.js +0 -2
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/types.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/whitespace.d.ts +0 -2
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/whitespace.js +0 -19
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/lib/whitespace.js.map +0 -1
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/package.json +0 -53
- package/scaffold/scripts/parsers/node_modules/acorn-typescript/tsconfig.json +0 -19
- package/scaffold/scripts/parsers/node_modules/acorn-walk/CHANGELOG.md +0 -209
- package/scaffold/scripts/parsers/node_modules/acorn-walk/LICENSE +0 -21
- package/scaffold/scripts/parsers/node_modules/acorn-walk/README.md +0 -124
- package/scaffold/scripts/parsers/node_modules/acorn-walk/dist/walk.d.mts +0 -152
- package/scaffold/scripts/parsers/node_modules/acorn-walk/dist/walk.d.ts +0 -152
- package/scaffold/scripts/parsers/node_modules/acorn-walk/dist/walk.js +0 -485
- package/scaffold/scripts/parsers/node_modules/acorn-walk/dist/walk.mjs +0 -467
- package/scaffold/scripts/parsers/node_modules/acorn-walk/package.json +0 -50
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/LICENSE +0 -24
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/README.md +0 -23
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-bash.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-c.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-c_sharp.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-cpp.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-css.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-dart.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-elisp.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-elixir.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-elm.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-embedded_template.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-go.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-html.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-java.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-javascript.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-json.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-kotlin.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-lua.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-objc.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-ocaml.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-php.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-ql.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-rescript.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-ruby.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-rust.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-scala.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-solidity.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-swift.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-systemrdl.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-tlaplus.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-toml.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-tsx.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-typescript.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-vue.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-yaml.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/out/tree-sitter-zig.wasm +0 -0
- package/scaffold/scripts/parsers/node_modules/tree-sitter-wasms/package.json +0 -64
- package/scaffold/scripts/parsers/node_modules/web-tree-sitter/LICENSE +0 -21
- package/scaffold/scripts/parsers/node_modules/web-tree-sitter/README.md +0 -198
- package/scaffold/scripts/parsers/node_modules/web-tree-sitter/package.json +0 -37
- package/scaffold/scripts/parsers/node_modules/web-tree-sitter/tree-sitter-web.d.ts +0 -242
- package/scaffold/scripts/parsers/node_modules/web-tree-sitter/tree-sitter.js +0 -1
- package/scaffold/scripts/parsers/node_modules/web-tree-sitter/tree-sitter.wasm +0 -0
package/README.md
CHANGED
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
[](https://www.npmjs.com/package/@danielblomma/cortex-mcp)
|
|
10
10
|
[](https://www.npmjs.com/package/@danielblomma/cortex-mcp)
|
|
11
11
|
[](./LICENSE)
|
|
12
|
+
[](https://danielblomma.github.io/cortex/)
|
|
12
13
|
|
|
13
14
|
---
|
|
14
15
|
|
|
15
16
|
## What Cortex is
|
|
16
17
|
|
|
17
|
-
Cortex is a local, repository-scoped context engine for coding assistants. It parses your source code with tree-sitter, indexes it into a structured knowledge graph of entities (files, symbols, rules, ADRs) and their relationships (calls, defines, constrains, implements, supersedes), and
|
|
18
|
+
Cortex is a local, repository-scoped context engine for coding assistants. It parses your source code with tree-sitter, indexes it into a structured knowledge graph of entities (files, symbols, rules, ADRs) and their relationships (calls, defines, constrains, implements, supersedes), and exposes that context through CLI commands. MCP remains available as a compatibility and integration bridge for clients that support it.
|
|
18
19
|
|
|
19
20
|
Where a general-purpose AI assistant sees your codebase as a pile of text files, Cortex gives it a precise map: what exists, how it is connected, which rules govern it, and which parts are source-of-truth versus deprecated.
|
|
20
21
|
|
|
@@ -39,7 +40,7 @@ Cortex is not a replacement for your editor, your version control, or your codin
|
|
|
39
40
|
- **Architectural governance.** Rules and ADRs are surfaced with every answer, so assistants follow the team's established patterns rather than generic best practices.
|
|
40
41
|
- **Multi-language coverage.** A single engine indexes multiple languages through tree-sitter grammars, giving polyglot teams consistent tooling.
|
|
41
42
|
- **Privacy by design.** Your code and its derived index stay on your machine. No upload, no cloud dependency for the core product.
|
|
42
|
-
- **Low friction.** One command (`cortex init --bootstrap`) scaffolds everything
|
|
43
|
+
- **Low friction.** One command (`cortex init --bootstrap`) scaffolds everything needed for local indexing, git hooks, CLI retrieval, and optional MCP compatibility.
|
|
43
44
|
|
|
44
45
|
## How it works
|
|
45
46
|
|
|
@@ -47,9 +48,9 @@ Cortex operates as a five-stage pipeline between your repository and your AI ass
|
|
|
47
48
|
|
|
48
49
|
1. **Ingestion.** Source files are parsed with tree-sitter, producing structured entities (files, functions, classes, rules, ADRs) and relations (`CALLS`, `DEFINES`, `CONSTRAINS`, `IMPLEMENTS`, `IMPORTS`, `SUPERSEDES`).
|
|
49
50
|
2. **Storage.** Entities and relations are persisted to a local graph database (RyuGraph). An optional vector index provides semantic search across entity content.
|
|
50
|
-
3. **Retrieval.**
|
|
51
|
+
3. **Retrieval.** CLI commands combine semantic search with graph traversal to assemble the smallest context package that answers the task.
|
|
51
52
|
4. **Policy.** Architectural rules and source-of-truth markers filter conflicting or deprecated content before it reaches the assistant.
|
|
52
|
-
5. **Assembly.** Results are delivered
|
|
53
|
+
5. **Assembly.** Results are delivered as compact, ranked context packages over `cortex ... --json`, with MCP exposing equivalent tool responses when enabled.
|
|
53
54
|
|
|
54
55
|
Git hooks keep the index fresh on every checkout, pull, commit, and rewrite. A live TUI dashboard (`cortex dashboard`) shows what Cortex adds to the repository in real time.
|
|
55
56
|
|
|
@@ -73,13 +74,14 @@ The result is an assistant that behaves as if it already knows your codebase, be
|
|
|
73
74
|
- Architectural rules and ADR enforcement at retrieval time.
|
|
74
75
|
- Incremental index updates driven by git hooks.
|
|
75
76
|
- Live TUI dashboard showing what Cortex adds to your repository.
|
|
76
|
-
-
|
|
77
|
+
- CLI-first retrieval commands for local agents and scripts.
|
|
78
|
+
- Optional MCP integrations with Claude Code, Claude Desktop, and Codex.
|
|
77
79
|
|
|
78
80
|
## Requirements
|
|
79
81
|
|
|
80
|
-
- Node.js
|
|
82
|
+
- Node.js 20+
|
|
81
83
|
- Git repository
|
|
82
|
-
- Optional for
|
|
84
|
+
- Optional for MCP registration: `claude` and/or `codex` CLI in `PATH`
|
|
83
85
|
|
|
84
86
|
## Install
|
|
85
87
|
|
|
@@ -93,7 +95,7 @@ To upgrade an already-scaffolded project to a new Cortex version:
|
|
|
93
95
|
|
|
94
96
|
```bash
|
|
95
97
|
npm i -g @danielblomma/cortex-mcp
|
|
96
|
-
cortex init --force # re-scaffolds .context
|
|
98
|
+
cortex init --force # re-scaffolds .context runtime + .context/scripts
|
|
97
99
|
cortex bootstrap
|
|
98
100
|
cortex update
|
|
99
101
|
```
|
|
@@ -109,9 +111,9 @@ Version-specific notes (see [CHANGELOG.md](CHANGELOG.md) for details):
|
|
|
109
111
|
`CORTEX_EMBED_MAX_CHARS` env var is removed and silently ignored.
|
|
110
112
|
Existing projects keep their old ranking weights in `config.yaml`; the
|
|
111
113
|
recommended block is now `semantic: 0.55, graph: 0.10, trust: 0.20,
|
|
112
|
-
recency: 0.15`.
|
|
113
|
-
|
|
114
|
-
cache — re-run the query.
|
|
114
|
+
recency: 0.15`. If you use MCP, restart the MCP server after
|
|
115
|
+
re-embedding. The first search after a re-embed can hit a stale
|
|
116
|
+
embeddings cache — re-run the query.
|
|
115
117
|
|
|
116
118
|
## Quick Start
|
|
117
119
|
|
|
@@ -123,10 +125,10 @@ cortex init --bootstrap
|
|
|
123
125
|
|
|
124
126
|
This will:
|
|
125
127
|
|
|
126
|
-
- scaffold `.context/`, `.context/scripts/`, `.context/mcp
|
|
128
|
+
- scaffold `.context/`, `.context/scripts/`, the local context runtime (`.context/mcp` compatibility path), `.githooks/`, and docs files
|
|
127
129
|
- activate git hooks for checkout, pull/merge, commit, and rewrite events
|
|
128
|
-
- build and prepare the local
|
|
129
|
-
-
|
|
130
|
+
- build and prepare the local context runtime
|
|
131
|
+
- leave MCP client registration opt-in via `cortex connect` or `cortex init --connect`
|
|
130
132
|
- start background sync unless disabled
|
|
131
133
|
|
|
132
134
|
Disable watcher setup:
|
|
@@ -141,7 +143,29 @@ Check context status:
|
|
|
141
143
|
cortex status
|
|
142
144
|
```
|
|
143
145
|
|
|
144
|
-
##
|
|
146
|
+
## Query From The CLI
|
|
147
|
+
|
|
148
|
+
Use the CLI as the default local agent interface:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
cortex search "authentication flow" --json
|
|
152
|
+
cortex related file:src/auth.ts --json
|
|
153
|
+
cortex impact "payment service" --json
|
|
154
|
+
cortex rules --json
|
|
155
|
+
cortex explain "where retries are configured" --json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
These commands read the same local graph, embeddings, and rules used by the MCP server, but they do not require an MCP client registration.
|
|
159
|
+
|
|
160
|
+
## Optional MCP Connection
|
|
161
|
+
|
|
162
|
+
MCP remains supported for clients that need it. Register MCP clients explicitly:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
cortex connect
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Then verify the client registration:
|
|
145
169
|
|
|
146
170
|
Claude:
|
|
147
171
|
|
|
@@ -165,15 +189,16 @@ Install via Claude Code plugin marketplace:
|
|
|
165
189
|
/plugin enable cortex
|
|
166
190
|
```
|
|
167
191
|
|
|
168
|
-
Then initialize Cortex in your target repository:
|
|
192
|
+
Then initialize Cortex in your target repository. If you want the plugin to call the local MCP server, also run `cortex connect` from that repository:
|
|
169
193
|
|
|
170
194
|
```bash
|
|
171
195
|
cortex init --bootstrap
|
|
196
|
+
cortex connect
|
|
172
197
|
```
|
|
173
198
|
|
|
174
199
|
## Manual MCP Configuration
|
|
175
200
|
|
|
176
|
-
If
|
|
201
|
+
If client registration is unavailable, configure MCP manually.
|
|
177
202
|
|
|
178
203
|
Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
179
204
|
|
|
@@ -258,7 +283,7 @@ For projects on the WSL filesystem (e.g. `~/projects/myapp`), use the WSL path d
|
|
|
258
283
|
- File watching on `/mnt/` paths (Windows filesystem) automatically uses poll mode since `inotify` is unreliable across filesystem boundaries.
|
|
259
284
|
- For best performance, keep projects on the WSL filesystem (`~/...`) rather than `/mnt/c/...`.
|
|
260
285
|
|
|
261
|
-
## MCP
|
|
286
|
+
## MCP Tool Compatibility
|
|
262
287
|
|
|
263
288
|
### `context.search`
|
|
264
289
|
|
|
@@ -351,6 +376,11 @@ cortex connect [path] [--skip-build]
|
|
|
351
376
|
cortex mcp
|
|
352
377
|
cortex bootstrap
|
|
353
378
|
cortex update
|
|
379
|
+
cortex search <query> [--json]
|
|
380
|
+
cortex related <entity-id> [--json]
|
|
381
|
+
cortex impact <query|entity-id> [--json]
|
|
382
|
+
cortex rules [--json]
|
|
383
|
+
cortex explain <query|entity-id> [--json]
|
|
354
384
|
cortex status
|
|
355
385
|
cortex dashboard [--interval <sec>]
|
|
356
386
|
cortex watch [start|stop|status|run|once] [--interval <sec>] [--debounce <sec>] [--mode <auto|event|poll>]
|
|
@@ -371,7 +401,7 @@ This repository includes two GitHub Actions workflows:
|
|
|
371
401
|
- `Release Publish` (`.github/workflows/release-publish.yml`)
|
|
372
402
|
- Triggers on tag push `v*.*.*`
|
|
373
403
|
- Verifies tag/version sync
|
|
374
|
-
- Runs root tests + MCP build/tests
|
|
404
|
+
- Runs root tests + context runtime/MCP build/tests
|
|
375
405
|
- Publishes `@danielblomma/cortex-mcp` to npm via npm trusted publishing (GitHub OIDC)
|
|
376
406
|
|
|
377
407
|
Required npm configuration:
|
|
@@ -380,6 +410,16 @@ Required npm configuration:
|
|
|
380
410
|
- Use GitHub Actions publisher `DanielBlomma/cortex`
|
|
381
411
|
- Workflow filename must match `release-publish.yml`
|
|
382
412
|
|
|
413
|
+
## Embedding performance
|
|
414
|
+
|
|
415
|
+
Embedding generation tunes itself to the machine: the number of parallel
|
|
416
|
+
workers, memory limits for long files, and skip-work caching are all derived
|
|
417
|
+
from the available CPU cores and RAM at run time (container memory limits
|
|
418
|
+
included). No configuration is needed — on a laptop or a CI runner, cortex
|
|
419
|
+
picks safe, fast settings by itself. The one exception worth knowing:
|
|
420
|
+
when several cortex instances share one machine, set `CORTEX_EMBED_THREADS`
|
|
421
|
+
to give each its fair share of cores.
|
|
422
|
+
|
|
383
423
|
## Limitations
|
|
384
424
|
|
|
385
425
|
- Requires repo initialization (`cortex init --bootstrap`).
|
|
@@ -393,17 +433,25 @@ Required npm configuration:
|
|
|
393
433
|
|
|
394
434
|
## Troubleshooting
|
|
395
435
|
|
|
396
|
-
- `mcp/dist/server.js` missing:
|
|
436
|
+
- context runtime missing or `mcp/dist/server.js` missing:
|
|
397
437
|
Run `cortex bootstrap` (or re-run `cortex init --bootstrap`).
|
|
398
|
-
- `claude` or `codex` not found during
|
|
399
|
-
|
|
438
|
+
- `claude` or `codex` not found during `cortex connect`:
|
|
439
|
+
MCP registration is skipped for that client; use manual config above if needed.
|
|
400
440
|
- MCP tools return stale context:
|
|
401
|
-
Run `cortex update`, then
|
|
441
|
+
Run `cortex update`, then rerun the CLI query. If you use MCP, reconnect the client or call `context.reload`.
|
|
442
|
+
|
|
443
|
+
## Website and Benchmarks
|
|
444
|
+
|
|
445
|
+
- `frontend/` hosts the cortex website (GitHub Pages, deployed on push to `main`):
|
|
446
|
+
product overview plus bootstrap evaluation metrics.
|
|
447
|
+
- `benchmark/bootstrapbench/` runs `cortex bootstrap` against 69 pinned
|
|
448
|
+
real-world repositories in isolated containers and extracts chunk, embedding
|
|
449
|
+
and graph statistics. See [benchmark/bootstrapbench/README.md](benchmark/bootstrapbench/README.md).
|
|
402
450
|
|
|
403
451
|
## Support
|
|
404
452
|
|
|
405
453
|
- Issues: https://github.com/DanielBlomma/cortex/issues
|
|
406
|
-
-
|
|
454
|
+
- MCP registry submission draft: [mcp-registry-submission.json](mcp-registry-submission.json)
|
|
407
455
|
|
|
408
456
|
## License
|
|
409
457
|
|
package/bin/cortex.mjs
CHANGED
|
@@ -27,6 +27,7 @@ const PACKAGE_JSON_PATH = path.join(PACKAGE_ROOT, "package.json");
|
|
|
27
27
|
// only the three editable config files". Generated artifacts (db,
|
|
28
28
|
// embeddings, cache, hooks, mcp/, govern.local.json) never land in git.
|
|
29
29
|
const MCP_PROJECT_REL = path.join(".context", "mcp");
|
|
30
|
+
const CONTEXT_RUNTIME_REL = MCP_PROJECT_REL;
|
|
30
31
|
const CONTEXT_SCRIPTS_REL = path.join(".context", "scripts");
|
|
31
32
|
|
|
32
33
|
// `.context/*` (not `.context/`) so the !-negations below actually re-include
|
|
@@ -67,7 +68,7 @@ function printHelp() {
|
|
|
67
68
|
|
|
68
69
|
console.log(helpSection("CONTEXT"));
|
|
69
70
|
console.log(helpRow("init [path]", "Scaffold a project with --force/--bootstrap/--connect/--watch"));
|
|
70
|
-
console.log(helpRow("connect [path]", "
|
|
71
|
+
console.log(helpRow("connect [path]", "Register MCP clients (Codex + Claude Code)"));
|
|
71
72
|
console.log(helpRow("bootstrap", "Install deps, ingest, embed, load graph"));
|
|
72
73
|
console.log(helpRow("update", "Refresh context for changed files"));
|
|
73
74
|
console.log(helpRow("status", "Project context status"));
|
|
@@ -75,6 +76,11 @@ function printHelp() {
|
|
|
75
76
|
console.log(helpRow("ingest [--changed] [--verbose]", "Re-index source files"));
|
|
76
77
|
console.log(helpRow("embed [--changed]", "Recompute embeddings"));
|
|
77
78
|
console.log(helpRow("graph-load [--no-reset]", "Reload the dependency graph"));
|
|
79
|
+
console.log(helpRow("search <query> [--json]", "Search local graph+RAG context"));
|
|
80
|
+
console.log(helpRow("related <entity-id> [--json]", "Show related context entities"));
|
|
81
|
+
console.log(helpRow("impact <query|entity-id> [--json]", "Trace likely impact paths"));
|
|
82
|
+
console.log(helpRow("rules [--json]", "List active context rules"));
|
|
83
|
+
console.log(helpRow("explain <query|entity-id> [--json]", "Show search score evidence"));
|
|
78
84
|
console.log(helpRow("dashboard [--interval <sec>]", "Live local dashboard"));
|
|
79
85
|
console.log(helpRow("memory-compile [--dry-run] [--verbose]", "Compile memory artifacts"));
|
|
80
86
|
console.log(helpRow("memory-lint [--verbose] [--json]", "Lint compiled memory"));
|
|
@@ -119,7 +125,7 @@ function parseInitArgs(args) {
|
|
|
119
125
|
let target = process.cwd();
|
|
120
126
|
let force = false;
|
|
121
127
|
let bootstrap = false;
|
|
122
|
-
let connect =
|
|
128
|
+
let connect = false;
|
|
123
129
|
let watch = true;
|
|
124
130
|
|
|
125
131
|
for (const arg of args) {
|
|
@@ -229,6 +235,8 @@ const INIT_SOURCE_EXTENSIONS = new Set([
|
|
|
229
235
|
".csv",
|
|
230
236
|
".ts",
|
|
231
237
|
".tsx",
|
|
238
|
+
".mts",
|
|
239
|
+
".cts",
|
|
232
240
|
".js",
|
|
233
241
|
".jsx",
|
|
234
242
|
".mjs",
|
|
@@ -808,9 +816,9 @@ async function maybeInstallGitHooks(targetDir) {
|
|
|
808
816
|
}
|
|
809
817
|
|
|
810
818
|
function ensureProjectInitialized(targetDir) {
|
|
811
|
-
const
|
|
812
|
-
if (!fs.existsSync(
|
|
813
|
-
throw new Error(`Missing ${
|
|
819
|
+
const runtimePackageJson = path.join(targetDir, CONTEXT_RUNTIME_REL, "package.json");
|
|
820
|
+
if (!fs.existsSync(runtimePackageJson)) {
|
|
821
|
+
throw new Error(`Missing ${runtimePackageJson}. Run 'cortex init --bootstrap' first.`);
|
|
814
822
|
}
|
|
815
823
|
}
|
|
816
824
|
|
|
@@ -880,7 +888,7 @@ async function maybeMigrateScaffold(targetDir, command) {
|
|
|
880
888
|
|
|
881
889
|
console.error(
|
|
882
890
|
`[cortex] scaffold in ${targetDir} is out of date ` +
|
|
883
|
-
`(missing .context/scripts/doctor.sh,
|
|
891
|
+
`(missing .context/scripts/doctor.sh, context runtime package.json, doctor subcommand in context.sh, ` +
|
|
884
892
|
`or carries a legacy mcp/ directory at the project root).`
|
|
885
893
|
);
|
|
886
894
|
|
|
@@ -983,7 +991,7 @@ async function run() {
|
|
|
983
991
|
await maybeInstallGitHooks(target);
|
|
984
992
|
|
|
985
993
|
console.log(`[cortex] initialized in ${target}`);
|
|
986
|
-
console.log("[cortex] scaffold copied: .context/, .context/scripts/, .context/mcp
|
|
994
|
+
console.log("[cortex] scaffold copied: .context/, .context/scripts/, context runtime (.context/mcp compatibility path), .githooks/, docs/");
|
|
987
995
|
console.log(`[cortex] Claude commands ready: /context-update (${helpers.claude.total} files)`);
|
|
988
996
|
if (helpers.codex.changed) {
|
|
989
997
|
console.log("[cortex] Codex workflow instructions added to AGENTS.md");
|
|
@@ -1000,7 +1008,7 @@ async function run() {
|
|
|
1000
1008
|
if (connect) {
|
|
1001
1009
|
console.log("[cortex] MCP connect: Codex + Claude Code (if CLIs are installed)");
|
|
1002
1010
|
} else {
|
|
1003
|
-
console.log("[cortex] MCP connect skipped (--
|
|
1011
|
+
console.log("[cortex] MCP connect skipped (run 'cortex connect' or init with --connect)");
|
|
1004
1012
|
}
|
|
1005
1013
|
|
|
1006
1014
|
if (watch) {
|
|
@@ -1085,6 +1093,10 @@ async function run() {
|
|
|
1085
1093
|
return runStageCommandShim(rest);
|
|
1086
1094
|
}
|
|
1087
1095
|
|
|
1096
|
+
if (QUERY_COMMANDS.has(command)) {
|
|
1097
|
+
return runQueryCommandShim(command, rest);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1088
1100
|
const passthrough = new Set([
|
|
1089
1101
|
"bootstrap",
|
|
1090
1102
|
"update",
|
|
@@ -1142,25 +1154,28 @@ function isPidAlive(pid) {
|
|
|
1142
1154
|
}
|
|
1143
1155
|
}
|
|
1144
1156
|
|
|
1145
|
-
function
|
|
1157
|
+
function resolveProjectRuntimeDist() {
|
|
1146
1158
|
// v2.0.5: project layout was moved from <cwd>/mcp/ to <cwd>/.context/mcp/.
|
|
1147
|
-
//
|
|
1148
|
-
//
|
|
1149
|
-
// <cwd>/.context/mcp/dist/ after bootstrap.
|
|
1159
|
+
// The runtime still lives there for compatibility, but CLI commands now
|
|
1160
|
+
// treat it as the local context runtime rather than an MCP-only surface.
|
|
1150
1161
|
const target = process.env.CORTEX_PROJECT_ROOT?.trim() || process.cwd();
|
|
1151
|
-
return path.join(target,
|
|
1162
|
+
return path.join(target, CONTEXT_RUNTIME_REL, "dist");
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
function resolveProjectMcpDist() {
|
|
1166
|
+
return resolveProjectRuntimeDist();
|
|
1152
1167
|
}
|
|
1153
1168
|
|
|
1154
1169
|
function resolveDaemonEntry() {
|
|
1155
|
-
return path.join(
|
|
1170
|
+
return path.join(resolveProjectRuntimeDist(), "daemon", "main.js");
|
|
1156
1171
|
}
|
|
1157
1172
|
|
|
1158
1173
|
function resolveHookEntry(name) {
|
|
1159
|
-
return path.join(
|
|
1174
|
+
return path.join(resolveProjectRuntimeDist(), "hooks", `${name}.js`);
|
|
1160
1175
|
}
|
|
1161
1176
|
|
|
1162
1177
|
function resolveCliEntry(name) {
|
|
1163
|
-
return path.join(
|
|
1178
|
+
return path.join(resolveProjectRuntimeDist(), "cli", `${name}.js`);
|
|
1164
1179
|
}
|
|
1165
1180
|
|
|
1166
1181
|
async function runDaemonCommand(args) {
|
|
@@ -1345,7 +1360,7 @@ function loadGovernModule() {
|
|
|
1345
1360
|
const entry = resolveCliEntry("govern");
|
|
1346
1361
|
if (!fs.existsSync(entry)) {
|
|
1347
1362
|
throw new Error(
|
|
1348
|
-
`Build the project's
|
|
1363
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`
|
|
1349
1364
|
);
|
|
1350
1365
|
}
|
|
1351
1366
|
return import(pathToFileURL(entry).href);
|
|
@@ -1478,7 +1493,7 @@ async function runEnterpriseInstall(args) {
|
|
|
1478
1493
|
|
|
1479
1494
|
const enterpriseEntry = resolveCliEntry("enterprise-setup");
|
|
1480
1495
|
if (!fs.existsSync(enterpriseEntry)) {
|
|
1481
|
-
printBullet("fail", `Build the project's
|
|
1496
|
+
printBullet("fail", `Build the project's context runtime first (missing ${enterpriseEntry}). Run 'cortex bootstrap' in the project root.`);
|
|
1482
1497
|
process.exit(1);
|
|
1483
1498
|
}
|
|
1484
1499
|
const enterpriseMod = await import(pathToFileURL(enterpriseEntry).href);
|
|
@@ -1573,6 +1588,7 @@ async function runEnterpriseInstall(args) {
|
|
|
1573
1588
|
}
|
|
1574
1589
|
|
|
1575
1590
|
const RUN_CLIS = new Set(["claude", "codex", "copilot"]);
|
|
1591
|
+
const QUERY_COMMANDS = new Set(["search", "related", "impact", "rules", "explain"]);
|
|
1576
1592
|
|
|
1577
1593
|
async function runRunCommand(args) {
|
|
1578
1594
|
const sub = args[0];
|
|
@@ -1599,7 +1615,7 @@ async function runRunCommand(args) {
|
|
|
1599
1615
|
const entry = resolveCliEntry("run");
|
|
1600
1616
|
if (!fs.existsSync(entry)) {
|
|
1601
1617
|
throw new Error(
|
|
1602
|
-
`Build the project's
|
|
1618
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`
|
|
1603
1619
|
);
|
|
1604
1620
|
}
|
|
1605
1621
|
const mod = await import(pathToFileURL(entry).href);
|
|
@@ -1613,19 +1629,32 @@ async function runStageCommandShim(args) {
|
|
|
1613
1629
|
const entry = resolveCliEntry("stage");
|
|
1614
1630
|
if (!fs.existsSync(entry)) {
|
|
1615
1631
|
throw new Error(
|
|
1616
|
-
`Build the project's
|
|
1632
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`,
|
|
1617
1633
|
);
|
|
1618
1634
|
}
|
|
1619
1635
|
const mod = await import(pathToFileURL(entry).href);
|
|
1620
1636
|
await mod.runStageCommand(args);
|
|
1621
1637
|
}
|
|
1622
1638
|
|
|
1639
|
+
async function runQueryCommandShim(command, args) {
|
|
1640
|
+
const target = process.env.CORTEX_PROJECT_ROOT?.trim() || process.cwd();
|
|
1641
|
+
process.env.CORTEX_PROJECT_ROOT = path.resolve(target);
|
|
1642
|
+
const entry = resolveCliEntry("query");
|
|
1643
|
+
if (!fs.existsSync(entry)) {
|
|
1644
|
+
throw new Error(
|
|
1645
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`
|
|
1646
|
+
);
|
|
1647
|
+
}
|
|
1648
|
+
const mod = await import(pathToFileURL(entry).href);
|
|
1649
|
+
await mod.runQueryCommand([command, ...args]);
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1623
1652
|
async function runTelemetryCommand(args) {
|
|
1624
1653
|
const sub = args[0] || "help";
|
|
1625
1654
|
if (sub === "test") {
|
|
1626
1655
|
const entry = resolveCliEntry("telemetry-test");
|
|
1627
1656
|
if (!fs.existsSync(entry)) {
|
|
1628
|
-
throw new Error(`Build the project's
|
|
1657
|
+
throw new Error(`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`);
|
|
1629
1658
|
}
|
|
1630
1659
|
const mod = await import(pathToFileURL(entry).href);
|
|
1631
1660
|
const code = await mod.runTelemetryTest();
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cortex",
|
|
3
|
+
"vendor": "danielblomma",
|
|
4
|
+
"sourceUrl": "https://github.com/DanielBlomma/cortex",
|
|
5
|
+
"description": "Local, repo-scoped context platform for coding assistants. Semantic search, graph relationships, and architectural rule context for your codebase.",
|
|
6
|
+
"npmPackage": "@danielblomma/cortex-mcp",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"homepage": "https://github.com/DanielBlomma/cortex",
|
|
9
|
+
"categories": [
|
|
10
|
+
"development-tools",
|
|
11
|
+
"code-analysis",
|
|
12
|
+
"search"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"context",
|
|
17
|
+
"code-search",
|
|
18
|
+
"semantic-search",
|
|
19
|
+
"refactoring"
|
|
20
|
+
],
|
|
21
|
+
"installation": {
|
|
22
|
+
"npm": "npm i -g @danielblomma/cortex-mcp && cortex init --bootstrap"
|
|
23
|
+
},
|
|
24
|
+
"tools": [
|
|
25
|
+
{
|
|
26
|
+
"name": "context.search",
|
|
27
|
+
"description": "Semantic search across codebase entities (files, rules, ADRs)"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "context.get_related",
|
|
31
|
+
"description": "Get related entities via graph relationships"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"name": "context.get_rules",
|
|
35
|
+
"description": "Get active architectural rules and decisions"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "context.reload",
|
|
39
|
+
"description": "Reload context graph after code changes"
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"config": {
|
|
43
|
+
"command": "cortex",
|
|
44
|
+
"args": ["mcp"],
|
|
45
|
+
"env": {
|
|
46
|
+
"CORTEX_PROJECT_ROOT": "<project-path>"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"features": [
|
|
50
|
+
"Semantic codebase search with graph-aware ranking",
|
|
51
|
+
"Graph relationships between files, rules, and ADRs",
|
|
52
|
+
"Experimental call graph APIs for function-level tracing and impact analysis (JS/TS semantic chunking builds)",
|
|
53
|
+
"Architectural rules and ADR enforcement",
|
|
54
|
+
"Local & private (no cloud, your code stays on your machine)",
|
|
55
|
+
"Incremental background sync",
|
|
56
|
+
"Multi-language support (JS/TS today, Python/Go planned)"
|
|
57
|
+
],
|
|
58
|
+
"requirements": {
|
|
59
|
+
"node": ">=18",
|
|
60
|
+
"git": "required for change tracking",
|
|
61
|
+
"disk": "~50MB per project"
|
|
62
|
+
}
|
|
63
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@danielblomma/cortex-mcp",
|
|
3
3
|
"mcpName": "io.github.DanielBlomma/cortex",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0",
|
|
5
5
|
"description": "Local, repo-scoped context platform for coding assistants. Semantic search, graph relationships, and architectural rule context.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Daniel Blomma",
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"keywords": [
|
|
18
18
|
"mcp",
|
|
19
19
|
"model-context-protocol",
|
|
20
|
+
"cli",
|
|
20
21
|
"context",
|
|
22
|
+
"knowledge-graph",
|
|
21
23
|
"code-search",
|
|
22
24
|
"semantic-search",
|
|
23
25
|
"refactoring",
|
|
@@ -34,23 +36,35 @@
|
|
|
34
36
|
"files": [
|
|
35
37
|
"bin",
|
|
36
38
|
"types.js",
|
|
37
|
-
"scaffold/.context",
|
|
39
|
+
"scaffold/.context/config.yaml",
|
|
40
|
+
"scaffold/.context/rules.yaml",
|
|
41
|
+
"scaffold/.context/ontology.cypher",
|
|
38
42
|
"scaffold/.githooks",
|
|
39
43
|
"scaffold/AGENTS.md",
|
|
40
44
|
"scaffold/CLAUDE.md",
|
|
41
45
|
"scaffold/docs",
|
|
42
|
-
"scaffold/scripts",
|
|
46
|
+
"scaffold/scripts/*.mjs",
|
|
47
|
+
"scaffold/scripts/*.sh",
|
|
48
|
+
"scaffold/scripts/lib",
|
|
49
|
+
"scaffold/scripts/parsers/*.mjs",
|
|
50
|
+
"scaffold/scripts/parsers/package.json",
|
|
51
|
+
"scaffold/scripts/parsers/package-lock.json",
|
|
52
|
+
"scaffold/scripts/parsers/javascript",
|
|
53
|
+
"scaffold/scripts/parsers/tree-sitter",
|
|
54
|
+
"scaffold/scripts/parsers/dotnet/*/*.csproj",
|
|
55
|
+
"scaffold/scripts/parsers/dotnet/*/Program.cs",
|
|
43
56
|
"scaffold/mcp/src",
|
|
44
57
|
"scaffold/mcp/tests",
|
|
58
|
+
"scaffold/mcp/build.mjs",
|
|
45
59
|
"scaffold/mcp/package.json",
|
|
46
60
|
"scaffold/mcp/package-lock.json",
|
|
47
61
|
"scaffold/mcp/tsconfig.json",
|
|
48
62
|
"README.md",
|
|
49
|
-
"
|
|
63
|
+
"mcp-registry-submission.json"
|
|
50
64
|
],
|
|
51
65
|
"scripts": {
|
|
52
66
|
"pretest": "test -d scaffold/scripts/parsers/node_modules || npm --prefix scaffold/scripts/parsers install --no-fund --no-update-notifier --silent",
|
|
53
|
-
"test": "node tests/context-regressions.test.mjs && node --test tests/ingest-units.test.mjs tests/javascript-parser.test.mjs tests/markdown-parser.test.mjs tests/sql-parser.test.mjs tests/config-parser.test.mjs tests/resources-parser.test.mjs tests/vbnet-parser.test.mjs tests/cpp-parser.test.mjs tests/dashboard.test.mjs tests/init-config.test.mjs tests/init-agents.test.mjs tests/multi-level.test.mjs tests/no-legacy-paths.test.mjs tests/tree-sitter-error-reporting.test.mjs tests/tree-sitter-body-cap.test.mjs tests/tree-sitter-exported.test.mjs tests/tree-sitter-robustness.test.mjs",
|
|
67
|
+
"test": "node tests/context-regressions.test.mjs && node --test tests/ingest-units.test.mjs tests/ingest-parallel.test.mjs tests/ingest-worker-crash.test.mjs tests/javascript-parser.test.mjs tests/markdown-parser.test.mjs tests/sql-parser.test.mjs tests/config-parser.test.mjs tests/resources-parser.test.mjs tests/vbnet-parser.test.mjs tests/cpp-parser.test.mjs tests/dashboard.test.mjs tests/init-config.test.mjs tests/init-agents.test.mjs tests/multi-level.test.mjs tests/no-legacy-paths.test.mjs tests/tree-sitter-error-reporting.test.mjs tests/tree-sitter-body-cap.test.mjs tests/tree-sitter-exported.test.mjs tests/tree-sitter-robustness.test.mjs tests/bootstrapbench-stats.test.mjs tests/bootstrapbench-aggregate.test.mjs tests/bootstrapbench-cleanup.test.mjs tests/query-cli-shim.test.mjs",
|
|
54
68
|
"release:sync-version": "node scripts/sync-release-version.mjs",
|
|
55
69
|
"release:check-version-sync": "node scripts/sync-release-version.mjs --check",
|
|
56
70
|
"prepublishOnly": "echo 'Ready to publish to npm'"
|
package/scaffold/AGENTS.md
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
This project uses Cortex for AI-powered code context.
|
|
4
4
|
|
|
5
|
-
## Required: Always use Cortex
|
|
5
|
+
## Required: Always use Cortex context
|
|
6
6
|
|
|
7
|
-
When answering questions about this codebase, you MUST use Cortex
|
|
7
|
+
When answering questions about this codebase, you MUST use Cortex context instead of relying on memory or assumptions.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **context.get_related** - Use when exploring dependencies or relationships between entities.
|
|
11
|
-
- **context.get_rules** - Check architectural rules before suggesting changes.
|
|
12
|
-
- **context.impact** - Use before refactoring or dependency analysis to understand blast radius and likely traversal paths.
|
|
13
|
-
- **context.reload** - Use after making significant changes to refresh the index.
|
|
9
|
+
Preferred CLI commands:
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
- `cortex search "<query>" --json` - Search before answering any code question. Never guess at implementations.
|
|
12
|
+
- `cortex related <entity-id> --json` - Use when exploring dependencies or relationships between entities.
|
|
13
|
+
- `cortex rules --json` - Check architectural rules before suggesting changes.
|
|
14
|
+
- `cortex impact "<query-or-entity-id>" --json` - Use before refactoring or dependency analysis to understand blast radius and likely traversal paths.
|
|
15
|
+
- `cortex update` - Refresh the index after making significant changes.
|
|
16
|
+
|
|
17
|
+
If MCP tools are explicitly available in your client, the equivalent tools are `context.search`, `context.get_related`, `context.get_rules`, `context.impact`, and `context.reload`.
|
|
18
|
+
|
|
19
|
+
Do NOT answer code questions from memory when Cortex CLI or MCP tools are available. Always search first.
|
|
16
20
|
|
|
17
21
|
## Enterprise tools (if available)
|
|
18
22
|
|
|
@@ -28,7 +32,7 @@ Do NOT answer code questions from memory when these tools are available. Always
|
|
|
28
32
|
|
|
29
33
|
## Diagnostics
|
|
30
34
|
|
|
31
|
-
Run `cortex doctor` to verify your setup is healthy.
|
|
35
|
+
Run `cortex doctor` to verify your setup is healthy. MCP client registration is optional; run `cortex connect` only when your local assistant needs MCP.
|
|
32
36
|
|
|
33
37
|
<!-- cortex:auto:start -->
|
|
34
38
|
## Cortex Auto Workflow
|
package/scaffold/CLAUDE.md
CHANGED
|
@@ -2,17 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
This project uses Cortex for AI-powered code context.
|
|
4
4
|
|
|
5
|
-
## Required: Always use Cortex
|
|
5
|
+
## Required: Always use Cortex context
|
|
6
6
|
|
|
7
|
-
When answering questions about this codebase, you MUST use Cortex
|
|
7
|
+
When answering questions about this codebase, you MUST use Cortex context instead of relying on memory or assumptions.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- **context.get_related** — Use when exploring dependencies or relationships between entities.
|
|
11
|
-
- **context.get_rules** — Check architectural rules before suggesting changes.
|
|
12
|
-
- **context.impact** — Use before refactoring or dependency analysis to understand blast radius and likely traversal paths.
|
|
13
|
-
- **context.reload** — Use after making significant changes to refresh the index.
|
|
9
|
+
Preferred CLI commands:
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
- `cortex search "<query>" --json` — Search before answering any code question. Never guess at implementations.
|
|
12
|
+
- `cortex related <entity-id> --json` — Use when exploring dependencies or relationships between entities.
|
|
13
|
+
- `cortex rules --json` — Check architectural rules before suggesting changes.
|
|
14
|
+
- `cortex impact "<query-or-entity-id>" --json` — Use before refactoring or dependency analysis to understand blast radius and likely traversal paths.
|
|
15
|
+
- `cortex update` — Refresh the index after making significant changes.
|
|
16
|
+
|
|
17
|
+
If MCP tools are explicitly available in Claude, the equivalent tools are `context.search`, `context.get_related`, `context.get_rules`, `context.impact`, and `context.reload`.
|
|
18
|
+
|
|
19
|
+
Do NOT answer code questions from memory when Cortex CLI or MCP tools are available. Always search first.
|
|
16
20
|
|
|
17
21
|
## Enterprise tools (if available)
|
|
18
22
|
|
|
@@ -28,4 +32,4 @@ Do NOT answer code questions from memory when these tools are available. Always
|
|
|
28
32
|
|
|
29
33
|
## Diagnostics
|
|
30
34
|
|
|
31
|
-
Run `cortex doctor` to verify your setup is healthy.
|
|
35
|
+
Run `cortex doctor` to verify your setup is healthy. MCP client registration is optional; run `cortex connect` only when Claude should use Cortex as an MCP server.
|
|
@@ -8,7 +8,7 @@ Provide high-signal, repo-local context to coding agents without bloating instru
|
|
|
8
8
|
2. Storage: graph (RyuGraph) + optional vector index
|
|
9
9
|
3. Retrieval: semantic + graph
|
|
10
10
|
4. Policy: rules filter conflicts/deprecated/source-of-truth
|
|
11
|
-
5. Assembly: runtime context package for MCP tool responses
|
|
11
|
+
5. Assembly: runtime context package for CLI JSON and optional MCP tool responses
|
|
12
12
|
|
|
13
13
|
## Runtime Context Order
|
|
14
14
|
1. Task
|