@danielblomma/cortex-mcp 2.2.5 → 2.4.1
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/CHANGELOG.md +201 -0
- package/README.md +73 -3
- package/bin/cortex.mjs +339 -242
- package/bin/daemon-control.mjs +162 -0
- package/package.json +7 -3
- package/scaffold/mcp/dist/.cortex-build-hash +1 -0
- package/scaffold/mcp/dist/cli/enterprise-setup.js +134 -0
- package/scaffold/mcp/dist/cli/govern.js +937 -0
- package/scaffold/mcp/dist/cli/query.js +409 -0
- package/scaffold/mcp/dist/cli/run.js +295 -0
- package/scaffold/mcp/dist/cli/stage.js +308 -0
- package/scaffold/mcp/dist/cli/telemetry-test.js +141 -0
- package/scaffold/mcp/dist/cli/ungoverned-detector.js +133 -0
- package/scaffold/mcp/dist/contextEntities.js +282 -0
- package/scaffold/mcp/dist/core/audit/query.js +72 -0
- package/scaffold/mcp/dist/core/audit/writer.js +28 -0
- package/scaffold/mcp/dist/core/config.js +235 -0
- package/scaffold/mcp/dist/core/enterprise-host-identity.js +193 -0
- package/scaffold/mcp/dist/core/enterprise-identity.js +18 -0
- package/scaffold/mcp/dist/core/enterprise-rotation.js +158 -0
- package/scaffold/mcp/dist/core/govern-paths.js +21 -0
- package/scaffold/mcp/dist/core/index.js +14 -0
- package/scaffold/mcp/dist/core/license.js +278 -0
- package/scaffold/mcp/dist/core/policy/enforce.js +66 -0
- package/scaffold/mcp/dist/core/policy/injection.js +172 -0
- package/scaffold/mcp/dist/core/policy/store.js +179 -0
- package/scaffold/mcp/dist/core/rbac/check.js +30 -0
- package/scaffold/mcp/dist/core/secure-endpoint.js +25 -0
- package/scaffold/mcp/dist/core/telemetry/collector.js +285 -0
- package/scaffold/mcp/dist/core/telemetry/state-dir.js +31 -0
- package/scaffold/mcp/dist/core/validators/builtins.js +632 -0
- package/scaffold/mcp/dist/core/validators/config.js +44 -0
- package/scaffold/mcp/dist/core/validators/engine.js +120 -0
- package/scaffold/mcp/dist/core/validators/evaluators/code_comments.js +236 -0
- package/scaffold/mcp/dist/core/validators/evaluators/regex.js +116 -0
- package/scaffold/mcp/dist/core/workflow/artifact-io.js +103 -0
- package/scaffold/mcp/dist/core/workflow/capabilities.js +88 -0
- package/scaffold/mcp/dist/core/workflow/default-workflows.js +102 -0
- package/scaffold/mcp/dist/core/workflow/enforcement.js +164 -0
- package/scaffold/mcp/dist/core/workflow/envelope.js +132 -0
- package/scaffold/mcp/dist/core/workflow/index.js +11 -0
- package/scaffold/mcp/dist/core/workflow/mcp-tools.js +175 -0
- package/scaffold/mcp/dist/core/workflow/resolution.js +69 -0
- package/scaffold/mcp/dist/core/workflow/run-lifecycle.js +123 -0
- package/scaffold/mcp/dist/core/workflow/schemas.js +141 -0
- package/scaffold/mcp/dist/core/workflow/synced-capability-registry.js +60 -0
- package/scaffold/mcp/dist/core/workflow/synced-registry.js +60 -0
- package/scaffold/mcp/dist/daemon/capability-sync-checker.js +242 -0
- package/scaffold/mcp/dist/daemon/client.js +130 -0
- package/scaffold/mcp/dist/daemon/egress-proxy.js +288 -0
- package/scaffold/mcp/dist/daemon/global-host-events.js +222 -0
- package/scaffold/mcp/dist/daemon/heartbeat-pusher.js +116 -0
- package/scaffold/mcp/dist/daemon/heartbeat-tracker.js +165 -0
- package/scaffold/mcp/dist/daemon/host-events-pusher.js +249 -0
- package/scaffold/mcp/dist/daemon/main.js +449 -0
- package/scaffold/mcp/dist/daemon/paths.js +36 -0
- package/scaffold/mcp/dist/daemon/project-service-registry.js +78 -0
- package/scaffold/mcp/dist/daemon/protocol.js +8 -0
- package/scaffold/mcp/dist/daemon/server.js +180 -0
- package/scaffold/mcp/dist/daemon/skill-sync-checker.js +557 -0
- package/scaffold/mcp/dist/daemon/sync-checker.js +165 -0
- package/scaffold/mcp/dist/daemon/ungoverned-scanner.js +136 -0
- package/scaffold/mcp/dist/daemon/workflow-sync-checker.js +249 -0
- package/scaffold/mcp/dist/defaults.js +6 -0
- package/scaffold/mcp/dist/embed.js +627 -0
- package/scaffold/mcp/dist/embedScheduler.js +479 -0
- package/scaffold/mcp/dist/embeddings.js +167 -0
- package/scaffold/mcp/dist/enterprise/audit/push.js +66 -0
- package/scaffold/mcp/dist/enterprise/index.js +327 -0
- package/scaffold/mcp/dist/enterprise/model/deploy.js +27 -0
- package/scaffold/mcp/dist/enterprise/policy/sync.js +129 -0
- package/scaffold/mcp/dist/enterprise/privacy/boundary.js +184 -0
- package/scaffold/mcp/dist/enterprise/reviews/changed-files.js +33 -0
- package/scaffold/mcp/dist/enterprise/reviews/pattern-context.js +202 -0
- package/scaffold/mcp/dist/enterprise/reviews/policy-selection.js +46 -0
- package/scaffold/mcp/dist/enterprise/reviews/push.js +102 -0
- package/scaffold/mcp/dist/enterprise/reviews/trust-state.js +186 -0
- package/scaffold/mcp/dist/enterprise/telemetry/sync.js +57 -0
- package/scaffold/mcp/dist/enterprise/tools/enterprise.js +826 -0
- package/scaffold/mcp/dist/enterprise/tools/harness.js +40 -0
- package/scaffold/mcp/dist/enterprise/tools/walk.js +73 -0
- package/scaffold/mcp/dist/enterprise/violations/push.js +77 -0
- package/scaffold/mcp/dist/enterprise/workflow/push.js +44 -0
- package/scaffold/mcp/dist/enterprise/workflow/state.js +329 -0
- package/scaffold/mcp/dist/frontmatter.js +33 -0
- package/scaffold/mcp/dist/graph.js +769 -0
- package/scaffold/mcp/dist/graphCsv.js +55 -0
- package/scaffold/mcp/dist/graphMetrics.js +8 -0
- package/scaffold/mcp/dist/hooks/permission-request.js +89 -0
- package/scaffold/mcp/dist/hooks/post-tool-use.js +105 -0
- package/scaffold/mcp/dist/hooks/pre-compact.js +29 -0
- package/scaffold/mcp/dist/hooks/pre-tool-use.js +78 -0
- package/scaffold/mcp/dist/hooks/session-end.js +43 -0
- package/scaffold/mcp/dist/hooks/session-start.js +41 -0
- package/scaffold/mcp/dist/hooks/shared.js +194 -0
- package/scaffold/mcp/dist/hooks/stop.js +28 -0
- package/scaffold/mcp/dist/hooks/user-prompt-submit.js +33 -0
- package/scaffold/mcp/dist/impactPresentation.js +137 -0
- package/scaffold/mcp/dist/impactRanking.js +191 -0
- package/scaffold/mcp/dist/impactResponse.js +30 -0
- package/scaffold/mcp/dist/impactResults.js +105 -0
- package/scaffold/mcp/dist/impactSeed.js +20 -0
- package/scaffold/mcp/dist/impactTraversal.js +64 -0
- package/scaffold/mcp/dist/jsonl.js +77 -0
- package/scaffold/mcp/dist/loadGraph.js +759 -0
- package/scaffold/mcp/dist/lruCache.js +38 -0
- package/scaffold/mcp/dist/paths.js +97 -0
- package/scaffold/mcp/dist/patternEvidence.js +272 -0
- package/scaffold/mcp/dist/plugin.js +81 -0
- package/scaffold/mcp/dist/presets.js +78 -0
- package/scaffold/mcp/dist/relatedResponse.js +18 -0
- package/scaffold/mcp/dist/relatedTraversal.js +78 -0
- package/scaffold/mcp/dist/rules.js +23 -0
- package/scaffold/mcp/dist/search.js +212 -0
- package/scaffold/mcp/dist/searchCore.js +457 -0
- package/scaffold/mcp/dist/searchResults.js +230 -0
- package/scaffold/mcp/dist/server.js +317 -0
- package/scaffold/mcp/dist/types.js +1 -0
- package/scaffold/mcp/package-lock.json +336 -212
- package/scaffold/mcp/package.json +15 -6
- package/scaffold/mcp/src/cli/enterprise-setup.ts +82 -8
- package/scaffold/mcp/src/cli/govern.ts +137 -52
- package/scaffold/mcp/src/cli/query.ts +36 -2
- package/scaffold/mcp/src/cli/run.ts +53 -19
- package/scaffold/mcp/src/cli/stage.ts +8 -3
- package/scaffold/mcp/src/core/config.ts +9 -2
- package/scaffold/mcp/src/core/enterprise-host-identity.ts +259 -0
- package/scaffold/mcp/src/core/enterprise-identity.ts +20 -0
- package/scaffold/mcp/src/core/enterprise-rotation.ts +185 -0
- package/scaffold/mcp/src/core/govern-paths.ts +30 -0
- package/scaffold/mcp/src/core/license.ts +186 -17
- package/scaffold/mcp/src/core/secure-endpoint.ts +23 -0
- package/scaffold/mcp/src/core/workflow/enforcement.ts +8 -1
- package/scaffold/mcp/src/core/workflow/mcp-tools.ts +3 -0
- package/scaffold/mcp/src/core/workflow/resolution.ts +9 -1
- package/scaffold/mcp/src/core/workflow/synced-capability-registry.ts +15 -0
- package/scaffold/mcp/src/core/workflow/synced-registry.ts +15 -0
- package/scaffold/mcp/src/daemon/capability-sync-checker.ts +38 -2
- package/scaffold/mcp/src/daemon/egress-proxy.ts +14 -8
- package/scaffold/mcp/src/daemon/global-host-events.ts +288 -0
- package/scaffold/mcp/src/daemon/heartbeat-pusher.ts +4 -0
- package/scaffold/mcp/src/daemon/heartbeat-tracker.ts +2 -0
- package/scaffold/mcp/src/daemon/host-events-pusher.ts +5 -0
- package/scaffold/mcp/src/daemon/main.ts +99 -25
- package/scaffold/mcp/src/daemon/project-service-registry.ts +107 -0
- package/scaffold/mcp/src/daemon/skill-sync-checker.ts +368 -31
- package/scaffold/mcp/src/daemon/sync-checker.ts +4 -0
- package/scaffold/mcp/src/daemon/ungoverned-scanner.ts +57 -25
- package/scaffold/mcp/src/daemon/workflow-sync-checker.ts +41 -2
- package/scaffold/mcp/src/embed.ts +211 -10
- package/scaffold/mcp/src/enterprise/audit/push.ts +8 -0
- package/scaffold/mcp/src/enterprise/index.ts +1 -1
- package/scaffold/mcp/src/enterprise/policy/sync.ts +12 -0
- package/scaffold/mcp/src/enterprise/reviews/changed-files.ts +34 -0
- package/scaffold/mcp/src/enterprise/reviews/pattern-context.ts +231 -0
- package/scaffold/mcp/src/enterprise/reviews/push.ts +9 -0
- package/scaffold/mcp/src/enterprise/reviews/trust-state.ts +3 -1
- package/scaffold/mcp/src/enterprise/telemetry/sync.ts +9 -0
- package/scaffold/mcp/src/enterprise/tools/enterprise.ts +49 -36
- package/scaffold/mcp/src/enterprise/violations/push.ts +9 -0
- package/scaffold/mcp/src/enterprise/workflow/push.ts +7 -0
- package/scaffold/mcp/src/paths.ts +3 -5
- package/scaffold/mcp/src/patternEvidence.ts +347 -0
- package/scaffold/mcp/src/plugin.ts +20 -0
- package/scaffold/mcp/src/search.ts +35 -9
- package/scaffold/mcp/src/searchCore.ts +254 -12
- package/scaffold/mcp/src/searchResults.ts +96 -9
- package/scaffold/mcp/src/types.ts +7 -0
- package/scaffold/mcp/tests/changed-files.test.mjs +41 -0
- package/scaffold/mcp/tests/copilot-shim.test.mjs +19 -1
- package/scaffold/mcp/tests/egress-proxy.test.mjs +37 -0
- package/scaffold/mcp/tests/embed-entities.test.mjs +109 -1
- package/scaffold/mcp/tests/enterprise-identity-sync.test.mjs +401 -0
- package/scaffold/mcp/tests/enterprise-pattern-context.test.mjs +322 -0
- package/scaffold/mcp/tests/enterprise-setup.test.mjs +189 -0
- package/scaffold/mcp/tests/global-host-events.test.mjs +81 -0
- package/scaffold/mcp/tests/govern-install.test.mjs +95 -2
- package/scaffold/mcp/tests/govern-repair.test.mjs +20 -3
- package/scaffold/mcp/tests/heartbeat-tracker.test.mjs +26 -0
- package/scaffold/mcp/tests/license.test.mjs +367 -0
- package/scaffold/mcp/tests/paths.test.mjs +11 -3
- package/scaffold/mcp/tests/pattern-evidence.test.mjs +321 -0
- package/scaffold/mcp/tests/project-service-registry.test.mjs +172 -0
- package/scaffold/mcp/tests/query-cli.test.mjs +73 -1
- package/scaffold/mcp/tests/review-trust-contract.test.mjs +18 -0
- package/scaffold/mcp/tests/search-graph-score.test.mjs +167 -0
- package/scaffold/mcp/tests/secure-enterprise-endpoint.test.mjs +46 -0
- package/scaffold/mcp/tests/skill-sync-checker.test.mjs +446 -2
- package/scaffold/mcp/tests/ungoverned-scanner.test.mjs +104 -22
- package/scaffold/mcp/tests/workflow-cli.test.mjs +14 -1
- package/scaffold/mcp/tests/workflow-synced-capabilities.test.mjs +37 -0
- package/scaffold/mcp/tests/workflow-synced-registry.test.mjs +40 -1
- package/scaffold/scripts/dashboard.mjs +29 -18
- package/scaffold/scripts/doctor.sh +26 -8
- package/scaffold/scripts/ingest.mjs +37 -4
- package/scaffold/scripts/status.sh +13 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.4.1 — 2026-07-28
|
|
4
|
+
|
|
5
|
+
### Security
|
|
6
|
+
|
|
7
|
+
- Validated remote enterprise skill names, blocked symlink targets, and
|
|
8
|
+
added Cortex ownership markers so personal skill directories cannot be
|
|
9
|
+
overwritten or recursively deleted. Deletion targets are derived from
|
|
10
|
+
managed CLI roots instead of trusting cached absolute paths.
|
|
11
|
+
- Bound license-cache reuse to the normalized endpoint and a one-way API-key
|
|
12
|
+
fingerprint. Malformed, future-dated, and expired cache assertions fail
|
|
13
|
+
closed; HTTP 401/403 responses reject authorization without grace.
|
|
14
|
+
- Changed enterprise onboarding to read API keys from stdin and atomically
|
|
15
|
+
create `.context/enterprise.yml` with mode `0600`. Remote endpoints require
|
|
16
|
+
HTTPS, with a loopback-only HTTP exception for local development.
|
|
17
|
+
- Bound user-global organization artifacts and host process detection to one
|
|
18
|
+
opaque Enterprise credential identity per OS user. A conflicting endpoint
|
|
19
|
+
is rejected, same-endpoint API-key rotation safely purges old marker-owned
|
|
20
|
+
skills and caches, and only one host-wide process scanner runs.
|
|
21
|
+
- Moved unattributed process findings into a credential-bound, mode-`0600`
|
|
22
|
+
user-global queue instead of the first project's audit directory.
|
|
23
|
+
- Enterprise admin commands now execute only package-owned trusted code.
|
|
24
|
+
Repository runtime modules and project-local state writes never execute with
|
|
25
|
+
root authority; persisted govern paths are not deletion authority.
|
|
26
|
+
- Suppressed shared-proxy project audit events when a connection has no
|
|
27
|
+
trustworthy project attribution.
|
|
28
|
+
- Added verified socket-based daemon stop/restart. Bootstrap now restarts an
|
|
29
|
+
already-running daemon so the upgraded security code replaces the old
|
|
30
|
+
in-memory runtime, and init repairs preserved Enterprise configs to `0600`.
|
|
31
|
+
- Updated the frontend and packaged MCP dependency trees to patched PostCSS,
|
|
32
|
+
SDK, Hono, archive, URI, YAML, protobuf, ONNX ZIP, and Sharp versions. All
|
|
33
|
+
committed npm lockfiles now have a zero-vulnerability audit target.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Replace `sudo cortex enterprise <api-key>` with:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
printf '%s\n' "$CORTEX_API_KEY" |
|
|
41
|
+
sudo cortex enterprise install --api-key-stdin
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- After updating the npm package, run `cortex init --force` and
|
|
45
|
+
`cortex bootstrap`. The latter safely restarts a verified running daemon;
|
|
46
|
+
an npm update alone does not activate this fix in an existing process.
|
|
47
|
+
- Existing Enterprise users must then rerun the stdin install to create the
|
|
48
|
+
durable host-identity marker. Confirm
|
|
49
|
+
`cortex enterprise status --json` reports
|
|
50
|
+
`enterprise.host_identity_bound: true`; Cortex never auto-enrolls from a
|
|
51
|
+
repository config.
|
|
52
|
+
- The minimum supported runtime is Node.js 20.9 (the first Node 20 LTS
|
|
53
|
+
release), required by the patched native embedding dependency chain.
|
|
54
|
+
- Before re-enrollment, review legacy `~/.cortex/skills.local.json` records
|
|
55
|
+
without `credential_id`, back up each exact matching Claude/Codex skill
|
|
56
|
+
directory outside the discovery roots, and back up the state file. Ambiguous
|
|
57
|
+
legacy directories are deliberately not adopted or deleted automatically.
|
|
58
|
+
|
|
59
|
+
### Rollout and emergency containment
|
|
60
|
+
|
|
61
|
+
- Do not downgrade to 2.4.0: that reopens the remote skill traversal boundary.
|
|
62
|
+
Use a forward fix.
|
|
63
|
+
- Before rollout, back up `.context/enterprise.yml` with ownership and mode
|
|
64
|
+
preserved. After restore, verify the correct owner and run
|
|
65
|
+
`chmod 600 .context/enterprise.yml`.
|
|
66
|
+
- If suspicious remote organization content is observed, run
|
|
67
|
+
`cortex daemon stop` and stop Enterprise AI sessions until a forward fix is
|
|
68
|
+
installed. Enforced hooks intentionally fail closed while the daemon is
|
|
69
|
+
unavailable.
|
|
70
|
+
- After rollout, verify `cortex daemon status` reports a verified PID,
|
|
71
|
+
`cortex enterprise status` is healthy, the config mode is `0600`, and a
|
|
72
|
+
canary organization sync cannot overwrite an unmanaged personal skill.
|
|
73
|
+
|
|
74
|
+
## 2.4.0 — 2026-07-13
|
|
75
|
+
|
|
76
|
+
### Added
|
|
77
|
+
|
|
78
|
+
- Added a native agent behavior layer: dual plugin manifests (Claude Code +
|
|
79
|
+
Codex), five Cortex skills with trigger descriptions, a cached
|
|
80
|
+
SessionStart bootstrap that survives clear/compaction, and a Claude Code
|
|
81
|
+
marketplace entry.
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- Upgraded the `cortex init` AGENTS.md section from an update reminder to a
|
|
86
|
+
compact using-cortex bootstrap.
|
|
87
|
+
|
|
88
|
+
## 2.3.0 — 2026-07-13
|
|
89
|
+
|
|
90
|
+
### Added
|
|
91
|
+
|
|
92
|
+
- Added `cortex pattern-evidence <file-path|entity-id>` for cited, structured
|
|
93
|
+
review evidence ordered by same file, module, feature area, and repository
|
|
94
|
+
fallback.
|
|
95
|
+
- Integrated bounded, non-blocking pattern context into enterprise
|
|
96
|
+
`context.review` without changing policy pass/fail or workflow trust.
|
|
97
|
+
|
|
98
|
+
### Changed
|
|
99
|
+
|
|
100
|
+
- Made equal-score search ordering deterministic with stable entity/path
|
|
101
|
+
tie-breaks.
|
|
102
|
+
- Added strict numeric validation for CLI query limits.
|
|
103
|
+
- Fixed the enterprise runtime package-version lookup so compiled enterprise
|
|
104
|
+
tools load from the packaged MCP runtime.
|
|
105
|
+
- Made `context.review` scope=changed list staged and untracked files in
|
|
106
|
+
repositories without commits instead of falling back to a full project
|
|
107
|
+
walk that ignores `.gitignore`.
|
|
108
|
+
- Made pattern review context load the Cortex index once per review instead
|
|
109
|
+
of once per target, and cached the ranking reference-time scan per loaded
|
|
110
|
+
index.
|
|
111
|
+
- Unified review path canonicalization and text comparison on the shared
|
|
112
|
+
pattern-evidence and search helpers.
|
|
113
|
+
|
|
114
|
+
## 2.2.5 — 2026-06-21
|
|
115
|
+
|
|
116
|
+
### Changed
|
|
117
|
+
|
|
118
|
+
- Made the default embedding token-budget `auto` mode memory-aware: Cortex
|
|
119
|
+
still starts from the embedding model's maximum context, but degrades to a
|
|
120
|
+
safe cap when local memory headroom is unlikely to fit the full context.
|
|
121
|
+
|
|
122
|
+
## 2.2.4 — 2026-06-20
|
|
123
|
+
|
|
124
|
+
### Changed
|
|
125
|
+
|
|
126
|
+
- Added an explicit embedding token-budget profile and benchmark support for
|
|
127
|
+
`CORTEX_EMBED_MAX_TOKENS`.
|
|
128
|
+
- Kept the default `auto` token budget quality-preserving: Cortex uses the
|
|
129
|
+
embedding model's own maximum context unless a numeric cap is explicitly set.
|
|
130
|
+
- Reduced embedding memory overhead by avoiding full normalized-text copies for
|
|
131
|
+
cached entities before deciding what needs re-embedding.
|
|
132
|
+
|
|
133
|
+
## 2.1.0 — 2026-06-11
|
|
134
|
+
|
|
135
|
+
New features and behavior changes, no API breaks.
|
|
136
|
+
|
|
137
|
+
### Changed
|
|
138
|
+
|
|
139
|
+
- **Default embedding model is now `jinaai/jina-embeddings-v2-base-code`**
|
|
140
|
+
(was `Xenova/all-MiniLM-L6-v2`). The old model truncated input at 512
|
|
141
|
+
tokens, which clipped the majority of file-level embeddings in typical
|
|
142
|
+
repositories and made code-oriented queries miss implementation files.
|
|
143
|
+
The jina code model has an 8192-token window. Override with
|
|
144
|
+
`CORTEX_EMBED_MODEL` as before.
|
|
145
|
+
- **Embedding input text is no longer character-capped.** The previous
|
|
146
|
+
7000-char entity cap and 2000-char chunk-body preview (and the
|
|
147
|
+
`CORTEX_EMBED_MAX_CHARS` env var) were calibrated for small models. The
|
|
148
|
+
tokenizer's own 8192-token truncation is now the only limit.
|
|
149
|
+
`CORTEX_EMBED_MAX_CHARS` is removed and silently ignored if set.
|
|
150
|
+
- **`graph_score` now uses a midrank percentile of relation degree within
|
|
151
|
+
the entity's own type** instead of `min(1, degree/4)`, which saturated at
|
|
152
|
+
degree >= 4 and made the graph ranking weight a constant for nearly every
|
|
153
|
+
entity. Percentiles are type-neutral (every type averages ~0.5), so
|
|
154
|
+
hub-heavy types such as rules cannot drown out leaf code.
|
|
155
|
+
- **Default ranking weights changed** to `semantic: 0.55, graph: 0.10,
|
|
156
|
+
trust: 0.20, recency: 0.15` (was `0.40 / 0.25 / 0.20 / 0.15`). Graph
|
|
157
|
+
degree mostly measures how many rules constrain an entity, so it gets low
|
|
158
|
+
weight; this reweighting and the percentile graph_score were benchmarked
|
|
159
|
+
as a pair. **Existing projects keep their per-project `config.yaml` —
|
|
160
|
+
ranking weights are NOT updated automatically.** To adopt the new
|
|
161
|
+
defaults, edit `.context/config.yaml`:
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
ranking:
|
|
165
|
+
semantic: 0.55
|
|
166
|
+
graph: 0.10
|
|
167
|
+
trust: 0.20
|
|
168
|
+
recency: 0.15
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Added
|
|
172
|
+
|
|
173
|
+
- **Markdown chunking.** `.md`/`.mdx` files are now chunked into H1–H3
|
|
174
|
+
heading-bounded sections (headings inside fenced code blocks are ignored,
|
|
175
|
+
preamble before the first heading is captured, empty sections are
|
|
176
|
+
skipped). Long sections are window-split with overlap, so prose gets
|
|
177
|
+
overlap while code stays symbol-chunked without it. Queries that target a
|
|
178
|
+
specific document section now return that section chunk directly.
|
|
179
|
+
- `rules.yaml` is now preserved on re-scaffold (`cortex init --force`),
|
|
180
|
+
alongside `config.yaml`, so project-specific rules survive upgrades.
|
|
181
|
+
|
|
182
|
+
### Upgrading an existing project
|
|
183
|
+
|
|
184
|
+
1. `npm i -g @danielblomma/cortex-mcp@2.1.0`
|
|
185
|
+
2. In the project: `cortex init --force` (re-scaffolds `.context/mcp` and
|
|
186
|
+
`.context/scripts`; your `config.yaml`, `rules.yaml`, notes and
|
|
187
|
+
decisions are preserved), then `cortex bootstrap`.
|
|
188
|
+
3. `cortex update` — the stored embedding-model id no longer matches, so
|
|
189
|
+
this triggers a **full re-embed automatically**. Cost: roughly 2 minutes
|
|
190
|
+
per 1000 entities plus a one-time download of the jina ONNX model. The
|
|
191
|
+
embeddings file grows (768-dim vectors vs 384).
|
|
192
|
+
4. Restart the MCP server (e.g. restart your editor/agent session) — the
|
|
193
|
+
compiled search code only loads on process start.
|
|
194
|
+
|
|
195
|
+
Known quirk: the MCP server lazy-loads the embeddings file, so the first
|
|
196
|
+
search immediately after a re-embed can be served from a stale cache —
|
|
197
|
+
re-run the query.
|
|
198
|
+
|
|
199
|
+
## 2.0.19 and earlier
|
|
200
|
+
|
|
201
|
+
See git history (`git log --oneline`) and GitHub releases.
|
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ The result is an assistant that behaves as if it already knows your codebase, be
|
|
|
79
79
|
|
|
80
80
|
## Requirements
|
|
81
81
|
|
|
82
|
-
- Node.js 20+
|
|
82
|
+
- Node.js 20.9+ (Node 20 LTS or newer)
|
|
83
83
|
- Git repository
|
|
84
84
|
- Optional for MCP registration: `claude` and/or `codex` CLI in `PATH`
|
|
85
85
|
|
|
@@ -96,15 +96,31 @@ To upgrade an already-scaffolded project to a new Cortex version:
|
|
|
96
96
|
```bash
|
|
97
97
|
npm i -g @danielblomma/cortex-mcp
|
|
98
98
|
cortex init --force # re-scaffolds .context runtime + .context/scripts
|
|
99
|
-
cortex bootstrap
|
|
99
|
+
cortex bootstrap # rebuilds and safely restarts a verified running daemon
|
|
100
100
|
cortex update
|
|
101
101
|
```
|
|
102
102
|
|
|
103
103
|
`cortex init --force` preserves per-project files: `.context/config.yaml`,
|
|
104
|
-
`.context/rules.yaml`, and your notes/decisions.
|
|
104
|
+
`.context/rules.yaml`, `.context/enterprise.yml`, and your notes/decisions.
|
|
105
|
+
It repairs existing Enterprise config permissions to `0600` without rewriting
|
|
106
|
+
the file. An npm update alone does not replace code already loaded by the
|
|
107
|
+
per-user daemon; `cortex bootstrap` performs the verified restart.
|
|
105
108
|
|
|
106
109
|
Version-specific notes (see [CHANGELOG.md](CHANGELOG.md) for details):
|
|
107
110
|
|
|
111
|
+
- **2.4.1**: enterprise onboarding no longer accepts API keys as positional
|
|
112
|
+
arguments. Pipe the key to
|
|
113
|
+
`sudo cortex enterprise install --api-key-stdin`. Enterprise endpoints must
|
|
114
|
+
use HTTPS (loopback HTTP remains available for local development). Existing
|
|
115
|
+
Enterprise users must rerun that stdin install after `cortex bootstrap`;
|
|
116
|
+
enrollment is deliberately not inferred from repository config. Verify
|
|
117
|
+
`cortex enterprise status --json` reports
|
|
118
|
+
`enterprise.host_identity_bound: true`. One Enterprise endpoint is supported
|
|
119
|
+
per OS user because organization skills and host process detection are
|
|
120
|
+
user-global; an explicit install may rotate its API key. Before upgrading
|
|
121
|
+
legacy organization skills without Cortex ownership markers, back up and
|
|
122
|
+
move the exact reviewed directories listed by
|
|
123
|
+
`~/.cortex/skills.local.json` out of the Claude/Codex discovery roots.
|
|
108
124
|
- **2.1.0**: the default embedding model changed, so the first
|
|
109
125
|
`cortex update` after upgrading triggers a full re-embed automatically
|
|
110
126
|
(~2 min per 1000 entities plus a one-time model download). The
|
|
@@ -143,6 +159,26 @@ Check context status:
|
|
|
143
159
|
cortex status
|
|
144
160
|
```
|
|
145
161
|
|
|
162
|
+
## Agent plugin (Claude Code + Codex)
|
|
163
|
+
|
|
164
|
+
The `plugins/cortex` directory is a dual-manifest agent plugin: five behavior
|
|
165
|
+
skills (`using-cortex`, `repo-research`, `change-impact`, `pattern-review`,
|
|
166
|
+
`context-review`), a SessionStart bootstrap that re-injects Cortex
|
|
167
|
+
instructions after new sessions, `/clear`, and compaction (Claude Code), and
|
|
168
|
+
an MCP config that follows the active workspace.
|
|
169
|
+
|
|
170
|
+
Claude Code:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
/plugin marketplace add DanielBlomma/cortex
|
|
174
|
+
/plugin install cortex@cortex
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Codex discovers the same skills through `.codex-plugin/plugin.json`; repos
|
|
178
|
+
initialized with `cortex init` also get an AGENTS.md bootstrap section as a
|
|
179
|
+
fallback when the plugin is not installed. The CLI remains the engine — the
|
|
180
|
+
plugin only adds the behavior layer, and `cortex connect` stays opt-in.
|
|
181
|
+
|
|
146
182
|
## Query From The CLI
|
|
147
183
|
|
|
148
184
|
Use the CLI as the default local agent interface:
|
|
@@ -153,6 +189,7 @@ cortex related file:src/auth.ts --json
|
|
|
153
189
|
cortex impact "payment service" --json
|
|
154
190
|
cortex rules --json
|
|
155
191
|
cortex explain "where retries are configured" --json
|
|
192
|
+
cortex pattern-evidence src/auth.ts --query "error handling" --json
|
|
156
193
|
```
|
|
157
194
|
|
|
158
195
|
These commands read the same local graph, embeddings, and rules used by the MCP server, but they do not require an MCP client registration.
|
|
@@ -381,12 +418,39 @@ cortex related <entity-id> [--json]
|
|
|
381
418
|
cortex impact <query|entity-id> [--json]
|
|
382
419
|
cortex rules [--json]
|
|
383
420
|
cortex explain <query|entity-id> [--json]
|
|
421
|
+
cortex pattern-evidence <file-path|entity-id> [--query <text>] [--top-k <n>] [--json]
|
|
384
422
|
cortex status
|
|
385
423
|
cortex dashboard [--interval <sec>]
|
|
386
424
|
cortex watch [start|stop|status|run|once] [--interval <sec>] [--debounce <sec>] [--mode <auto|event|poll>]
|
|
387
425
|
cortex help
|
|
388
426
|
```
|
|
389
427
|
|
|
428
|
+
## Enterprise Pattern Review
|
|
429
|
+
|
|
430
|
+
Enterprise `context.review` includes bounded repo-local pattern context by
|
|
431
|
+
default. This evidence is advisory and does not change policy validator totals,
|
|
432
|
+
workflow approval, or review trust.
|
|
433
|
+
|
|
434
|
+
Optional MCP inputs:
|
|
435
|
+
|
|
436
|
+
- `include_pattern_evidence` — enable or disable pattern context (default `true`).
|
|
437
|
+
- `pattern_query` — shared pattern query; otherwise Cortex derives one per file.
|
|
438
|
+
- `pattern_top_k` — evidence items per locality tier, from 1 to 5 (default `2`).
|
|
439
|
+
- `pattern_limit` — analyzed review targets, from 1 to 25 (default `10`).
|
|
440
|
+
|
|
441
|
+
The response adds `pattern_review` with deterministic targets, the canonical
|
|
442
|
+
review question, cited evidence tiers, explicit repository fallback, unindexed
|
|
443
|
+
status, and omitted-file counts. Pattern evidence never constitutes automatic
|
|
444
|
+
code approval. Enterprise pattern review is lexical-only and never downloads an
|
|
445
|
+
embedding model or calls an external service.
|
|
446
|
+
|
|
447
|
+
Every target uses the same response fields. `status` is one of
|
|
448
|
+
`local_evidence`, `repo_fallback`, `no_evidence`, `not_indexed`, or `error`;
|
|
449
|
+
`local_pattern_found` and `fallback_used` are always explicit booleans, and
|
|
450
|
+
`evidence_order` plus all four `tiers` are always present. Unavailable evidence
|
|
451
|
+
uses empty tiers and sanitized messages rather than local paths or runtime
|
|
452
|
+
errors.
|
|
453
|
+
|
|
390
454
|
## Automated Release
|
|
391
455
|
|
|
392
456
|
This repository includes two GitHub Actions workflows:
|
|
@@ -428,6 +492,12 @@ set it to `model` or `full` to force the full-model baseline even on tight
|
|
|
428
492
|
machines. When several cortex instances share one machine, set
|
|
429
493
|
`CORTEX_EMBED_THREADS` to give each its fair share of cores.
|
|
430
494
|
|
|
495
|
+
For experiments on very large repositories, `CORTEX_EMBED_TEXT_PROFILE=compact-files`
|
|
496
|
+
compacts only large file-level embedding records while keeping chunk-level
|
|
497
|
+
embedding text full. The default remains `full`; use the compact profile only
|
|
498
|
+
with a before/after semantic quality check because file-level compaction can
|
|
499
|
+
change retrieval behavior.
|
|
500
|
+
|
|
431
501
|
## Limitations
|
|
432
502
|
|
|
433
503
|
- Requires repo initialization (`cortex init --bootstrap`).
|