@danielblomma/cortex-mcp 2.1.4 → 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 +53 -24
- package/bin/cortex.mjs +48 -21
- package/mcp-registry-submission.json +63 -0
- package/package.json +18 -5
- package/scaffold/AGENTS.md +13 -9
- package/scaffold/CLAUDE.md +13 -9
- package/scaffold/docs/architecture.md +1 -1
- package/scaffold/mcp/src/cli/query.ts +455 -0
- package/scaffold/mcp/tests/query-cli.test.mjs +115 -0
- package/scaffold/scripts/bootstrap.sh +3 -2
- package/scaffold/scripts/doctor.sh +9 -8
- package/scaffold/scripts/embed.sh +3 -2
- 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/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
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
## What Cortex is
|
|
17
17
|
|
|
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
|
|
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.
|
|
19
19
|
|
|
20
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.
|
|
21
21
|
|
|
@@ -40,7 +40,7 @@ Cortex is not a replacement for your editor, your version control, or your codin
|
|
|
40
40
|
- **Architectural governance.** Rules and ADRs are surfaced with every answer, so assistants follow the team's established patterns rather than generic best practices.
|
|
41
41
|
- **Multi-language coverage.** A single engine indexes multiple languages through tree-sitter grammars, giving polyglot teams consistent tooling.
|
|
42
42
|
- **Privacy by design.** Your code and its derived index stay on your machine. No upload, no cloud dependency for the core product.
|
|
43
|
-
- **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.
|
|
44
44
|
|
|
45
45
|
## How it works
|
|
46
46
|
|
|
@@ -48,9 +48,9 @@ Cortex operates as a five-stage pipeline between your repository and your AI ass
|
|
|
48
48
|
|
|
49
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`).
|
|
50
50
|
2. **Storage.** Entities and relations are persisted to a local graph database (RyuGraph). An optional vector index provides semantic search across entity content.
|
|
51
|
-
3. **Retrieval.**
|
|
51
|
+
3. **Retrieval.** CLI commands combine semantic search with graph traversal to assemble the smallest context package that answers the task.
|
|
52
52
|
4. **Policy.** Architectural rules and source-of-truth markers filter conflicting or deprecated content before it reaches the assistant.
|
|
53
|
-
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.
|
|
54
54
|
|
|
55
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.
|
|
56
56
|
|
|
@@ -74,13 +74,14 @@ The result is an assistant that behaves as if it already knows your codebase, be
|
|
|
74
74
|
- Architectural rules and ADR enforcement at retrieval time.
|
|
75
75
|
- Incremental index updates driven by git hooks.
|
|
76
76
|
- Live TUI dashboard showing what Cortex adds to your repository.
|
|
77
|
-
-
|
|
77
|
+
- CLI-first retrieval commands for local agents and scripts.
|
|
78
|
+
- Optional MCP integrations with Claude Code, Claude Desktop, and Codex.
|
|
78
79
|
|
|
79
80
|
## Requirements
|
|
80
81
|
|
|
81
|
-
- Node.js
|
|
82
|
+
- Node.js 20+
|
|
82
83
|
- Git repository
|
|
83
|
-
- Optional for
|
|
84
|
+
- Optional for MCP registration: `claude` and/or `codex` CLI in `PATH`
|
|
84
85
|
|
|
85
86
|
## Install
|
|
86
87
|
|
|
@@ -94,7 +95,7 @@ To upgrade an already-scaffolded project to a new Cortex version:
|
|
|
94
95
|
|
|
95
96
|
```bash
|
|
96
97
|
npm i -g @danielblomma/cortex-mcp
|
|
97
|
-
cortex init --force # re-scaffolds .context
|
|
98
|
+
cortex init --force # re-scaffolds .context runtime + .context/scripts
|
|
98
99
|
cortex bootstrap
|
|
99
100
|
cortex update
|
|
100
101
|
```
|
|
@@ -110,9 +111,9 @@ Version-specific notes (see [CHANGELOG.md](CHANGELOG.md) for details):
|
|
|
110
111
|
`CORTEX_EMBED_MAX_CHARS` env var is removed and silently ignored.
|
|
111
112
|
Existing projects keep their old ranking weights in `config.yaml`; the
|
|
112
113
|
recommended block is now `semantic: 0.55, graph: 0.10, trust: 0.20,
|
|
113
|
-
recency: 0.15`.
|
|
114
|
-
|
|
115
|
-
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.
|
|
116
117
|
|
|
117
118
|
## Quick Start
|
|
118
119
|
|
|
@@ -124,10 +125,10 @@ cortex init --bootstrap
|
|
|
124
125
|
|
|
125
126
|
This will:
|
|
126
127
|
|
|
127
|
-
- scaffold `.context/`, `.context/scripts/`, `.context/mcp
|
|
128
|
+
- scaffold `.context/`, `.context/scripts/`, the local context runtime (`.context/mcp` compatibility path), `.githooks/`, and docs files
|
|
128
129
|
- activate git hooks for checkout, pull/merge, commit, and rewrite events
|
|
129
|
-
- build and prepare the local
|
|
130
|
-
-
|
|
130
|
+
- build and prepare the local context runtime
|
|
131
|
+
- leave MCP client registration opt-in via `cortex connect` or `cortex init --connect`
|
|
131
132
|
- start background sync unless disabled
|
|
132
133
|
|
|
133
134
|
Disable watcher setup:
|
|
@@ -142,7 +143,29 @@ Check context status:
|
|
|
142
143
|
cortex status
|
|
143
144
|
```
|
|
144
145
|
|
|
145
|
-
##
|
|
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:
|
|
146
169
|
|
|
147
170
|
Claude:
|
|
148
171
|
|
|
@@ -166,15 +189,16 @@ Install via Claude Code plugin marketplace:
|
|
|
166
189
|
/plugin enable cortex
|
|
167
190
|
```
|
|
168
191
|
|
|
169
|
-
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:
|
|
170
193
|
|
|
171
194
|
```bash
|
|
172
195
|
cortex init --bootstrap
|
|
196
|
+
cortex connect
|
|
173
197
|
```
|
|
174
198
|
|
|
175
199
|
## Manual MCP Configuration
|
|
176
200
|
|
|
177
|
-
If
|
|
201
|
+
If client registration is unavailable, configure MCP manually.
|
|
178
202
|
|
|
179
203
|
Claude Desktop (`~/Library/Application Support/Claude/claude_desktop_config.json`):
|
|
180
204
|
|
|
@@ -259,7 +283,7 @@ For projects on the WSL filesystem (e.g. `~/projects/myapp`), use the WSL path d
|
|
|
259
283
|
- File watching on `/mnt/` paths (Windows filesystem) automatically uses poll mode since `inotify` is unreliable across filesystem boundaries.
|
|
260
284
|
- For best performance, keep projects on the WSL filesystem (`~/...`) rather than `/mnt/c/...`.
|
|
261
285
|
|
|
262
|
-
## MCP
|
|
286
|
+
## MCP Tool Compatibility
|
|
263
287
|
|
|
264
288
|
### `context.search`
|
|
265
289
|
|
|
@@ -352,6 +376,11 @@ cortex connect [path] [--skip-build]
|
|
|
352
376
|
cortex mcp
|
|
353
377
|
cortex bootstrap
|
|
354
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]
|
|
355
384
|
cortex status
|
|
356
385
|
cortex dashboard [--interval <sec>]
|
|
357
386
|
cortex watch [start|stop|status|run|once] [--interval <sec>] [--debounce <sec>] [--mode <auto|event|poll>]
|
|
@@ -372,7 +401,7 @@ This repository includes two GitHub Actions workflows:
|
|
|
372
401
|
- `Release Publish` (`.github/workflows/release-publish.yml`)
|
|
373
402
|
- Triggers on tag push `v*.*.*`
|
|
374
403
|
- Verifies tag/version sync
|
|
375
|
-
- Runs root tests + MCP build/tests
|
|
404
|
+
- Runs root tests + context runtime/MCP build/tests
|
|
376
405
|
- Publishes `@danielblomma/cortex-mcp` to npm via npm trusted publishing (GitHub OIDC)
|
|
377
406
|
|
|
378
407
|
Required npm configuration:
|
|
@@ -404,12 +433,12 @@ to give each its fair share of cores.
|
|
|
404
433
|
|
|
405
434
|
## Troubleshooting
|
|
406
435
|
|
|
407
|
-
- `mcp/dist/server.js` missing:
|
|
436
|
+
- context runtime missing or `mcp/dist/server.js` missing:
|
|
408
437
|
Run `cortex bootstrap` (or re-run `cortex init --bootstrap`).
|
|
409
|
-
- `claude` or `codex` not found during
|
|
410
|
-
|
|
438
|
+
- `claude` or `codex` not found during `cortex connect`:
|
|
439
|
+
MCP registration is skipped for that client; use manual config above if needed.
|
|
411
440
|
- MCP tools return stale context:
|
|
412
|
-
Run `cortex update`, then
|
|
441
|
+
Run `cortex update`, then rerun the CLI query. If you use MCP, reconnect the client or call `context.reload`.
|
|
413
442
|
|
|
414
443
|
## Website and Benchmarks
|
|
415
444
|
|
|
@@ -422,7 +451,7 @@ to give each its fair share of cores.
|
|
|
422
451
|
## Support
|
|
423
452
|
|
|
424
453
|
- Issues: https://github.com/DanielBlomma/cortex/issues
|
|
425
|
-
-
|
|
454
|
+
- MCP registry submission draft: [mcp-registry-submission.json](mcp-registry-submission.json)
|
|
426
455
|
|
|
427
456
|
## License
|
|
428
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) {
|
|
@@ -810,9 +816,9 @@ async function maybeInstallGitHooks(targetDir) {
|
|
|
810
816
|
}
|
|
811
817
|
|
|
812
818
|
function ensureProjectInitialized(targetDir) {
|
|
813
|
-
const
|
|
814
|
-
if (!fs.existsSync(
|
|
815
|
-
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.`);
|
|
816
822
|
}
|
|
817
823
|
}
|
|
818
824
|
|
|
@@ -882,7 +888,7 @@ async function maybeMigrateScaffold(targetDir, command) {
|
|
|
882
888
|
|
|
883
889
|
console.error(
|
|
884
890
|
`[cortex] scaffold in ${targetDir} is out of date ` +
|
|
885
|
-
`(missing .context/scripts/doctor.sh,
|
|
891
|
+
`(missing .context/scripts/doctor.sh, context runtime package.json, doctor subcommand in context.sh, ` +
|
|
886
892
|
`or carries a legacy mcp/ directory at the project root).`
|
|
887
893
|
);
|
|
888
894
|
|
|
@@ -985,7 +991,7 @@ async function run() {
|
|
|
985
991
|
await maybeInstallGitHooks(target);
|
|
986
992
|
|
|
987
993
|
console.log(`[cortex] initialized in ${target}`);
|
|
988
|
-
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/");
|
|
989
995
|
console.log(`[cortex] Claude commands ready: /context-update (${helpers.claude.total} files)`);
|
|
990
996
|
if (helpers.codex.changed) {
|
|
991
997
|
console.log("[cortex] Codex workflow instructions added to AGENTS.md");
|
|
@@ -1002,7 +1008,7 @@ async function run() {
|
|
|
1002
1008
|
if (connect) {
|
|
1003
1009
|
console.log("[cortex] MCP connect: Codex + Claude Code (if CLIs are installed)");
|
|
1004
1010
|
} else {
|
|
1005
|
-
console.log("[cortex] MCP connect skipped (--
|
|
1011
|
+
console.log("[cortex] MCP connect skipped (run 'cortex connect' or init with --connect)");
|
|
1006
1012
|
}
|
|
1007
1013
|
|
|
1008
1014
|
if (watch) {
|
|
@@ -1087,6 +1093,10 @@ async function run() {
|
|
|
1087
1093
|
return runStageCommandShim(rest);
|
|
1088
1094
|
}
|
|
1089
1095
|
|
|
1096
|
+
if (QUERY_COMMANDS.has(command)) {
|
|
1097
|
+
return runQueryCommandShim(command, rest);
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1090
1100
|
const passthrough = new Set([
|
|
1091
1101
|
"bootstrap",
|
|
1092
1102
|
"update",
|
|
@@ -1144,25 +1154,28 @@ function isPidAlive(pid) {
|
|
|
1144
1154
|
}
|
|
1145
1155
|
}
|
|
1146
1156
|
|
|
1147
|
-
function
|
|
1157
|
+
function resolveProjectRuntimeDist() {
|
|
1148
1158
|
// v2.0.5: project layout was moved from <cwd>/mcp/ to <cwd>/.context/mcp/.
|
|
1149
|
-
//
|
|
1150
|
-
//
|
|
1151
|
-
// <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.
|
|
1152
1161
|
const target = process.env.CORTEX_PROJECT_ROOT?.trim() || process.cwd();
|
|
1153
|
-
return path.join(target,
|
|
1162
|
+
return path.join(target, CONTEXT_RUNTIME_REL, "dist");
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
function resolveProjectMcpDist() {
|
|
1166
|
+
return resolveProjectRuntimeDist();
|
|
1154
1167
|
}
|
|
1155
1168
|
|
|
1156
1169
|
function resolveDaemonEntry() {
|
|
1157
|
-
return path.join(
|
|
1170
|
+
return path.join(resolveProjectRuntimeDist(), "daemon", "main.js");
|
|
1158
1171
|
}
|
|
1159
1172
|
|
|
1160
1173
|
function resolveHookEntry(name) {
|
|
1161
|
-
return path.join(
|
|
1174
|
+
return path.join(resolveProjectRuntimeDist(), "hooks", `${name}.js`);
|
|
1162
1175
|
}
|
|
1163
1176
|
|
|
1164
1177
|
function resolveCliEntry(name) {
|
|
1165
|
-
return path.join(
|
|
1178
|
+
return path.join(resolveProjectRuntimeDist(), "cli", `${name}.js`);
|
|
1166
1179
|
}
|
|
1167
1180
|
|
|
1168
1181
|
async function runDaemonCommand(args) {
|
|
@@ -1347,7 +1360,7 @@ function loadGovernModule() {
|
|
|
1347
1360
|
const entry = resolveCliEntry("govern");
|
|
1348
1361
|
if (!fs.existsSync(entry)) {
|
|
1349
1362
|
throw new Error(
|
|
1350
|
-
`Build the project's
|
|
1363
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`
|
|
1351
1364
|
);
|
|
1352
1365
|
}
|
|
1353
1366
|
return import(pathToFileURL(entry).href);
|
|
@@ -1480,7 +1493,7 @@ async function runEnterpriseInstall(args) {
|
|
|
1480
1493
|
|
|
1481
1494
|
const enterpriseEntry = resolveCliEntry("enterprise-setup");
|
|
1482
1495
|
if (!fs.existsSync(enterpriseEntry)) {
|
|
1483
|
-
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.`);
|
|
1484
1497
|
process.exit(1);
|
|
1485
1498
|
}
|
|
1486
1499
|
const enterpriseMod = await import(pathToFileURL(enterpriseEntry).href);
|
|
@@ -1575,6 +1588,7 @@ async function runEnterpriseInstall(args) {
|
|
|
1575
1588
|
}
|
|
1576
1589
|
|
|
1577
1590
|
const RUN_CLIS = new Set(["claude", "codex", "copilot"]);
|
|
1591
|
+
const QUERY_COMMANDS = new Set(["search", "related", "impact", "rules", "explain"]);
|
|
1578
1592
|
|
|
1579
1593
|
async function runRunCommand(args) {
|
|
1580
1594
|
const sub = args[0];
|
|
@@ -1601,7 +1615,7 @@ async function runRunCommand(args) {
|
|
|
1601
1615
|
const entry = resolveCliEntry("run");
|
|
1602
1616
|
if (!fs.existsSync(entry)) {
|
|
1603
1617
|
throw new Error(
|
|
1604
|
-
`Build the project's
|
|
1618
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`
|
|
1605
1619
|
);
|
|
1606
1620
|
}
|
|
1607
1621
|
const mod = await import(pathToFileURL(entry).href);
|
|
@@ -1615,19 +1629,32 @@ async function runStageCommandShim(args) {
|
|
|
1615
1629
|
const entry = resolveCliEntry("stage");
|
|
1616
1630
|
if (!fs.existsSync(entry)) {
|
|
1617
1631
|
throw new Error(
|
|
1618
|
-
`Build the project's
|
|
1632
|
+
`Build the project's context runtime first (missing ${entry}). Run 'cortex bootstrap' in the project root.`,
|
|
1619
1633
|
);
|
|
1620
1634
|
}
|
|
1621
1635
|
const mod = await import(pathToFileURL(entry).href);
|
|
1622
1636
|
await mod.runStageCommand(args);
|
|
1623
1637
|
}
|
|
1624
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
|
+
|
|
1625
1652
|
async function runTelemetryCommand(args) {
|
|
1626
1653
|
const sub = args[0] || "help";
|
|
1627
1654
|
if (sub === "test") {
|
|
1628
1655
|
const entry = resolveCliEntry("telemetry-test");
|
|
1629
1656
|
if (!fs.existsSync(entry)) {
|
|
1630
|
-
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.`);
|
|
1631
1658
|
}
|
|
1632
1659
|
const mod = await import(pathToFileURL(entry).href);
|
|
1633
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,12 +36,23 @@
|
|
|
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",
|
|
45
58
|
"scaffold/mcp/build.mjs",
|
|
@@ -47,11 +60,11 @@
|
|
|
47
60
|
"scaffold/mcp/package-lock.json",
|
|
48
61
|
"scaffold/mcp/tsconfig.json",
|
|
49
62
|
"README.md",
|
|
50
|
-
"
|
|
63
|
+
"mcp-registry-submission.json"
|
|
51
64
|
],
|
|
52
65
|
"scripts": {
|
|
53
66
|
"pretest": "test -d scaffold/scripts/parsers/node_modules || npm --prefix scaffold/scripts/parsers install --no-fund --no-update-notifier --silent",
|
|
54
|
-
"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",
|
|
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",
|
|
55
68
|
"release:sync-version": "node scripts/sync-release-version.mjs",
|
|
56
69
|
"release:check-version-sync": "node scripts/sync-release-version.mjs --check",
|
|
57
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
|