cortex-mcp 1.0.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 +54 -0
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/cli/setup.d.ts +12 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +293 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/config/config.d.ts +13 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +33 -0
- package/dist/config/config.js.map +1 -0
- package/dist/core/event-bus.d.ts +19 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +51 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/db/database.d.ts +19 -0
- package/dist/db/database.d.ts.map +1 -0
- package/dist/db/database.js +254 -0
- package/dist/db/database.js.map +1 -0
- package/dist/db/event-log.d.ts +28 -0
- package/dist/db/event-log.d.ts.map +1 -0
- package/dist/db/event-log.js +87 -0
- package/dist/db/event-log.js.map +1 -0
- package/dist/db/memory-store.d.ts +65 -0
- package/dist/db/memory-store.d.ts.map +1 -0
- package/dist/db/memory-store.js +370 -0
- package/dist/db/memory-store.js.map +1 -0
- package/dist/embedding-worker.d.ts +3 -0
- package/dist/embedding-worker.d.ts.map +1 -0
- package/dist/embedding-worker.js +94 -0
- package/dist/embedding-worker.js.map +1 -0
- package/dist/hooks/cortex-run.d.ts +15 -0
- package/dist/hooks/cortex-run.d.ts.map +1 -0
- package/dist/hooks/cortex-run.js +148 -0
- package/dist/hooks/cortex-run.js.map +1 -0
- package/dist/hooks/git-capture.d.ts +21 -0
- package/dist/hooks/git-capture.d.ts.map +1 -0
- package/dist/hooks/git-capture.js +178 -0
- package/dist/hooks/git-capture.js.map +1 -0
- package/dist/hooks/git-hooks.d.ts +12 -0
- package/dist/hooks/git-hooks.d.ts.map +1 -0
- package/dist/hooks/git-hooks.js +130 -0
- package/dist/hooks/git-hooks.js.map +1 -0
- package/dist/mcp-stdio.d.ts +10 -0
- package/dist/mcp-stdio.d.ts.map +1 -0
- package/dist/mcp-stdio.js +247 -0
- package/dist/mcp-stdio.js.map +1 -0
- package/dist/memory/anticipation-engine.d.ts +19 -0
- package/dist/memory/anticipation-engine.d.ts.map +1 -0
- package/dist/memory/anticipation-engine.js +76 -0
- package/dist/memory/anticipation-engine.js.map +1 -0
- package/dist/memory/attention-ranker.d.ts +19 -0
- package/dist/memory/attention-ranker.d.ts.map +1 -0
- package/dist/memory/attention-ranker.js +97 -0
- package/dist/memory/attention-ranker.js.map +1 -0
- package/dist/memory/auto-learner.d.ts +20 -0
- package/dist/memory/auto-learner.d.ts.map +1 -0
- package/dist/memory/auto-learner.js +179 -0
- package/dist/memory/auto-learner.js.map +1 -0
- package/dist/memory/confidence-decay.d.ts +22 -0
- package/dist/memory/confidence-decay.d.ts.map +1 -0
- package/dist/memory/confidence-decay.js +54 -0
- package/dist/memory/confidence-decay.js.map +1 -0
- package/dist/memory/embedding-manager.d.ts +5 -0
- package/dist/memory/embedding-manager.d.ts.map +1 -0
- package/dist/memory/embedding-manager.js +118 -0
- package/dist/memory/embedding-manager.js.map +1 -0
- package/dist/memory/export-import.d.ts +49 -0
- package/dist/memory/export-import.d.ts.map +1 -0
- package/dist/memory/export-import.js +131 -0
- package/dist/memory/export-import.js.map +1 -0
- package/dist/memory/git-memory.d.ts +15 -0
- package/dist/memory/git-memory.d.ts.map +1 -0
- package/dist/memory/git-memory.js +178 -0
- package/dist/memory/git-memory.js.map +1 -0
- package/dist/memory/learning-rate.d.ts +24 -0
- package/dist/memory/learning-rate.d.ts.map +1 -0
- package/dist/memory/learning-rate.js +95 -0
- package/dist/memory/learning-rate.js.map +1 -0
- package/dist/memory/llm-enhancer.d.ts +54 -0
- package/dist/memory/llm-enhancer.d.ts.map +1 -0
- package/dist/memory/llm-enhancer.js +270 -0
- package/dist/memory/llm-enhancer.js.map +1 -0
- package/dist/memory/memory-cache.d.ts +5 -0
- package/dist/memory/memory-cache.d.ts.map +1 -0
- package/dist/memory/memory-cache.js +37 -0
- package/dist/memory/memory-cache.js.map +1 -0
- package/dist/memory/memory-consolidator.d.ts +14 -0
- package/dist/memory/memory-consolidator.d.ts.map +1 -0
- package/dist/memory/memory-consolidator.js +156 -0
- package/dist/memory/memory-consolidator.js.map +1 -0
- package/dist/memory/memory-decay.d.ts +10 -0
- package/dist/memory/memory-decay.d.ts.map +1 -0
- package/dist/memory/memory-decay.js +79 -0
- package/dist/memory/memory-decay.js.map +1 -0
- package/dist/memory/memory-quality.d.ts +37 -0
- package/dist/memory/memory-quality.d.ts.map +1 -0
- package/dist/memory/memory-quality.js +203 -0
- package/dist/memory/memory-quality.js.map +1 -0
- package/dist/memory/memory-ranker.d.ts +14 -0
- package/dist/memory/memory-ranker.d.ts.map +1 -0
- package/dist/memory/memory-ranker.js +68 -0
- package/dist/memory/memory-ranker.js.map +1 -0
- package/dist/memory/meta-memory.d.ts +11 -0
- package/dist/memory/meta-memory.d.ts.map +1 -0
- package/dist/memory/meta-memory.js +141 -0
- package/dist/memory/meta-memory.js.map +1 -0
- package/dist/memory/session-tracker.d.ts +39 -0
- package/dist/memory/session-tracker.d.ts.map +1 -0
- package/dist/memory/session-tracker.js +127 -0
- package/dist/memory/session-tracker.js.map +1 -0
- package/dist/memory/temporal-engine.d.ts +25 -0
- package/dist/memory/temporal-engine.d.ts.map +1 -0
- package/dist/memory/temporal-engine.js +106 -0
- package/dist/memory/temporal-engine.js.map +1 -0
- package/dist/retrieval/hybrid-retriever.d.ts +23 -0
- package/dist/retrieval/hybrid-retriever.d.ts.map +1 -0
- package/dist/retrieval/hybrid-retriever.js +120 -0
- package/dist/retrieval/hybrid-retriever.js.map +1 -0
- package/dist/scanners/architecture-graph.d.ts +30 -0
- package/dist/scanners/architecture-graph.d.ts.map +1 -0
- package/dist/scanners/architecture-graph.js +315 -0
- package/dist/scanners/architecture-graph.js.map +1 -0
- package/dist/scanners/code-verifier.d.ts +70 -0
- package/dist/scanners/code-verifier.d.ts.map +1 -0
- package/dist/scanners/code-verifier.js +374 -0
- package/dist/scanners/code-verifier.js.map +1 -0
- package/dist/scanners/context-builder.d.ts +19 -0
- package/dist/scanners/context-builder.d.ts.map +1 -0
- package/dist/scanners/context-builder.js +102 -0
- package/dist/scanners/context-builder.js.map +1 -0
- package/dist/scanners/export-map.d.ts +22 -0
- package/dist/scanners/export-map.d.ts.map +1 -0
- package/dist/scanners/export-map.js +249 -0
- package/dist/scanners/export-map.js.map +1 -0
- package/dist/scanners/file-verifier.d.ts +22 -0
- package/dist/scanners/file-verifier.d.ts.map +1 -0
- package/dist/scanners/file-verifier.js +140 -0
- package/dist/scanners/file-verifier.js.map +1 -0
- package/dist/scanners/project-scanner.d.ts +31 -0
- package/dist/scanners/project-scanner.d.ts.map +1 -0
- package/dist/scanners/project-scanner.js +398 -0
- package/dist/scanners/project-scanner.js.map +1 -0
- package/dist/security/encryption.d.ts +15 -0
- package/dist/security/encryption.d.ts.map +1 -0
- package/dist/security/encryption.js +116 -0
- package/dist/security/encryption.js.map +1 -0
- package/dist/security/feature-gate.d.ts +30 -0
- package/dist/security/feature-gate.d.ts.map +1 -0
- package/dist/security/feature-gate.js +91 -0
- package/dist/security/feature-gate.js.map +1 -0
- package/dist/security/license.d.ts +24 -0
- package/dist/security/license.d.ts.map +1 -0
- package/dist/security/license.js +168 -0
- package/dist/security/license.js.map +1 -0
- package/dist/security/rate-limiter.d.ts +20 -0
- package/dist/security/rate-limiter.d.ts.map +1 -0
- package/dist/security/rate-limiter.js +60 -0
- package/dist/security/rate-limiter.js.map +1 -0
- package/dist/server/dashboard.d.ts +3 -0
- package/dist/server/dashboard.d.ts.map +1 -0
- package/dist/server/dashboard.js +258 -0
- package/dist/server/dashboard.js.map +1 -0
- package/dist/server/mcp-handler.d.ts +12 -0
- package/dist/server/mcp-handler.d.ts.map +1 -0
- package/dist/server/mcp-handler.js +1392 -0
- package/dist/server/mcp-handler.js.map +1 -0
- package/dist/strategies/embedders/local-minilm.d.ts +35 -0
- package/dist/strategies/embedders/local-minilm.d.ts.map +1 -0
- package/dist/strategies/embedders/local-minilm.js +176 -0
- package/dist/strategies/embedders/local-minilm.js.map +1 -0
- package/dist/types.d.ts +207 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +83 -0
- package/dist/types.js.map +1 -0
- package/package.json +87 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to Cortex MCP Server are documented here.
|
|
4
|
+
|
|
5
|
+
## [1.0.1] -- 2026-02-19
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **FTS5 indexing** -- Triggers were silently failing to index memories for search
|
|
9
|
+
- **Emoji removal** -- All emojis removed from source code for professional terminal output
|
|
10
|
+
- **SECURITY.md port** -- Documented port corrected from 3100 to 3456
|
|
11
|
+
- **CONTRIBUTING.md** -- Fixed `npm run dev` to `npm run watch`
|
|
12
|
+
- **Config leak** -- Added `bin/` and `.ai/` to `.gitignore` and `.npmignore`
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **Soak testing** -- 500-operation stability test (1800+ ops/sec, 0 failures)
|
|
16
|
+
- **Binary builds** -- `scripts/build-binaries.js` for standalone executables
|
|
17
|
+
- **CI/CD pipeline** -- `.github/workflows/release.yml` for automated releases
|
|
18
|
+
- **Value verification** -- `scripts/value-test.js` proves cross-session memory recall
|
|
19
|
+
- **Performance stats** -- Added to README (<1ms latency, 1800+ ops/sec)
|
|
20
|
+
- **Direct download** -- README Option 3 for binary downloads
|
|
21
|
+
|
|
22
|
+
## [1.0.0] -- 2026-02-18
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **`force_recall` tool** — Mandatory context injection at conversation start
|
|
26
|
+
- **`quick_store` tool** — One-sentence memory storage with auto-classification
|
|
27
|
+
- **`store_memory` / `recall_memory`** — Full memory CRUD with type, tags, reason
|
|
28
|
+
- **`update_memory` / `delete_memory` / `list_memories`** — Memory management
|
|
29
|
+
- **`auto_learn` tool** — Extracts decisions and patterns from AI responses
|
|
30
|
+
- **`verify_code` tool** — Detects hallucinated imports, exports, env variables
|
|
31
|
+
- **`verify_files` tool** — Catches hallucinated file paths
|
|
32
|
+
- **`scan_project` tool** — Scans project structure, stack, and git history
|
|
33
|
+
- **`get_context` tool** — Compressed context for current file
|
|
34
|
+
- **`get_stats` / `health_check`** — Database and server diagnostics
|
|
35
|
+
- **`export_memories` / `import_memories`** — JSON bundle export/import with dedup
|
|
36
|
+
- **Git auto-capture** — `post-commit` hook classifies every commit as a memory
|
|
37
|
+
- **Branch/merge capture** — `post-checkout` and `post-merge` hooks track workflow
|
|
38
|
+
- **Build error capture** — `cortex-run` wrapper captures test/build failures
|
|
39
|
+
- **Optional LLM enhancement** — OpenAI/Anthropic/compatible APIs for smarter classification
|
|
40
|
+
- **Web dashboard** — localhost:3456 with memory viewer, search, export
|
|
41
|
+
- **`cortex-setup` CLI** — Auto-configures Antigravity, Claude, Cursor, Copilot, Windsurf, Zed
|
|
42
|
+
- **CLI routing** — `npx @cortex-mcp/server setup` and `--version` subcommands
|
|
43
|
+
- **Quality gates** — Junk rejection, contradiction detection, deduplication
|
|
44
|
+
- **Rate limiting** — 30 stores, 100 auto-learns, 500 calls per session
|
|
45
|
+
- **Memory decay** — Stale/low-quality memories cleaned automatically
|
|
46
|
+
- **Crash protection** — `uncaughtException` and `unhandledRejection` handlers
|
|
47
|
+
- **Degraded mode** — Server reports errors instead of crashing if DB init fails
|
|
48
|
+
|
|
49
|
+
### Technical
|
|
50
|
+
- SQLite-backed persistence with FTS5 full-text search
|
|
51
|
+
- MiniLM-L6-v2 semantic embeddings via `@xenova/transformers` (background worker)
|
|
52
|
+
- Hybrid retrieval: semantic similarity + keyword FTS + recency scoring
|
|
53
|
+
- Direct SQLite hooks for sub-500ms git hook execution
|
|
54
|
+
- Optional LLM with graceful fallback to keyword classification
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Perla Jaswanth Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Cortex MCP — Persistent AI Memory
|
|
2
|
+
|
|
3
|
+
> Give your AI coding assistant a brain that remembers across sessions.
|
|
4
|
+
|
|
5
|
+
Cortex is an MCP (Model Context Protocol) server that provides persistent, intelligent memory to any AI coding assistant — Cursor, Claude Code, Windsurf, Cline, or any MCP-compatible tool.
|
|
6
|
+
|
|
7
|
+
## The Problem
|
|
8
|
+
|
|
9
|
+
Every time you start a new conversation, your AI assistant forgets everything:
|
|
10
|
+
- Coding conventions you already explained
|
|
11
|
+
- Bugs you already fixed
|
|
12
|
+
- Decisions you already made
|
|
13
|
+
- What files you were working on
|
|
14
|
+
|
|
15
|
+
**Cortex solves this.** It stores, ranks, and proactively recalls context so your AI never starts from zero.
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
### Option 1: npm install (recommended)
|
|
20
|
+
```bash
|
|
21
|
+
npm install -g cortex-mcp
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then add to your MCP config:
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"cortex": {
|
|
29
|
+
"command": "cortex-mcp",
|
|
30
|
+
"transportType": "stdio"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Option 2: Clone from source
|
|
37
|
+
```bash
|
|
38
|
+
git clone <your-repo-url>
|
|
39
|
+
cd cognitive-memory
|
|
40
|
+
npm install
|
|
41
|
+
npm run build
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then add to your MCP config:
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"cortex": {
|
|
49
|
+
"command": "node",
|
|
50
|
+
"args": ["<path-to>/cognitive-memory/dist/mcp-stdio.js"],
|
|
51
|
+
"transportType": "stdio"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Restart your IDE and Cortex is active.
|
|
58
|
+
|
|
59
|
+
### Option 3: Direct Download (Binaries)
|
|
60
|
+
No Node.js required. Just download and run.
|
|
61
|
+
- [Windows](https://github.com/cortex-mcp/server/releases/latest/download/cortex-win.exe)
|
|
62
|
+
- [macOS](https://github.com/cortex-mcp/server/releases/latest/download/cortex-macos)
|
|
63
|
+
- [Linux](https://github.com/cortex-mcp/server/releases/latest/download/cortex-linux)
|
|
64
|
+
|
|
65
|
+
Then configure your MCP client to run the executable directly.
|
|
66
|
+
|
|
67
|
+
## Features
|
|
68
|
+
|
|
69
|
+
### 16 MCP Tools
|
|
70
|
+
| Tool | Purpose |
|
|
71
|
+
|---|---|
|
|
72
|
+
| `force_recall` | Full brain dump at conversation start (14-layer pipeline) |
|
|
73
|
+
| `recall_memory` | Search memories by topic (FTS + vector + graph) |
|
|
74
|
+
| `store_memory` | Store a decision, correction, convention, or bug fix |
|
|
75
|
+
| `quick_store` | One-liner memory storage with auto-classification |
|
|
76
|
+
| `auto_learn` | Extract memories from AI responses automatically |
|
|
77
|
+
| `scan_project` | Scan project structure, stack, git, exports, architecture |
|
|
78
|
+
| `verify_code` | Check if imports/exports/env vars actually exist |
|
|
79
|
+
| `verify_files` | Check if file paths are real or hallucinated |
|
|
80
|
+
| `get_context` | Get compressed context for current file |
|
|
81
|
+
| `get_stats` | Memory database statistics |
|
|
82
|
+
| `list_memories` | List all active memories |
|
|
83
|
+
| `update_memory` | Update an existing memory |
|
|
84
|
+
| `delete_memory` | Delete a memory |
|
|
85
|
+
| `export_memories` | Export all memories to JSON |
|
|
86
|
+
| `import_memories` | Import memories from JSON |
|
|
87
|
+
| `health_check` | Server health check |
|
|
88
|
+
|
|
89
|
+
### 14-Layer Brain Pipeline
|
|
90
|
+
|
|
91
|
+
Every conversation starts with `force_recall`, which runs 14 layers:
|
|
92
|
+
|
|
93
|
+
| Layer | Feature |
|
|
94
|
+
|:---:|---|
|
|
95
|
+
| 0 | Session management — track what you're working on |
|
|
96
|
+
| 1 | Maintenance — decay old memories, boost corrections, consolidate duplicates |
|
|
97
|
+
| 2 | Attention focus — detect debugging vs coding vs reviewing |
|
|
98
|
+
| 3 | Session continuity — resume from where you left off |
|
|
99
|
+
| 4 | Hot corrections — surface frequently-corrected topics |
|
|
100
|
+
| 5 | Core context — all corrections, decisions, conventions, bug fixes |
|
|
101
|
+
| 6 | Anticipation — proactive recall based on current file |
|
|
102
|
+
| 7 | Temporal — what changed today, yesterday, this week |
|
|
103
|
+
| 8 | Workspace git — branch, recent commits, diffs |
|
|
104
|
+
| 8.5 | Git memory — auto-capture commits + detect file changes |
|
|
105
|
+
| 9 | Topic search — FTS + confidence decay + causal chain traversal |
|
|
106
|
+
| 10 | Knowledge gaps — flag files with zero memories |
|
|
107
|
+
| 11 | Export map — show all available functions/classes (anti-hallucination) |
|
|
108
|
+
| 12 | Architecture graph — show layers, circular deps, API endpoints |
|
|
109
|
+
|
|
110
|
+
### Cognitive Features
|
|
111
|
+
- **Confidence decay** — old unused memories fade, frequently accessed ones strengthen
|
|
112
|
+
- **Attention ranking** — debugging context boosts bug-fix memories, coding boosts conventions
|
|
113
|
+
- **Contradiction detection** — new memories automatically supersede conflicting old ones
|
|
114
|
+
- **Memory consolidation** — similar memories merge into higher-level insights
|
|
115
|
+
- **Cross-session threading** — related sessions link by topic overlap
|
|
116
|
+
- **Learning rate** — topics corrected 3+ times get CRITICAL priority
|
|
117
|
+
|
|
118
|
+
### Performance & Reliability
|
|
119
|
+
- **Latency**: <1ms average recall time (local SQLite + WAL).
|
|
120
|
+
- **Throughput**: 1800+ ops/sec (verified via Soak Test).
|
|
121
|
+
- **Stability**: Zero memory leaks over sustained operation.
|
|
122
|
+
- **Protocol**: Full JSON-RPC 2.0 compliance (passed E2E suite).
|
|
123
|
+
|
|
124
|
+
### Anti-Hallucination
|
|
125
|
+
- Deep export map scans every source file for all exported functions, classes, types
|
|
126
|
+
- When AI references a function that doesn't exist, `verify_code` suggests the closest real match
|
|
127
|
+
- Architecture graph shows actual project layers and dependencies
|
|
128
|
+
|
|
129
|
+
## Optional: LLM Enhancement
|
|
130
|
+
|
|
131
|
+
Cortex works fully without any API key. Optionally, add an LLM key for smarter memory extraction:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Option 1: OpenAI
|
|
135
|
+
set OPENAI_API_KEY=sk-your-key
|
|
136
|
+
|
|
137
|
+
# Option 2: Anthropic
|
|
138
|
+
set ANTHROPIC_API_KEY=sk-ant-your-key
|
|
139
|
+
|
|
140
|
+
# Option 3: Local (Ollama, free)
|
|
141
|
+
set CORTEX_LLM_KEY=ollama
|
|
142
|
+
set CORTEX_LLM_BASE_URL=http://localhost:11434
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Memory Types
|
|
146
|
+
|
|
147
|
+
| Type | Use For |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `CORRECTION` | "Don't use var, use const" |
|
|
150
|
+
| `DECISION` | "We chose PostgreSQL over MongoDB" |
|
|
151
|
+
| `CONVENTION` | "All API routes start with /api/v1" |
|
|
152
|
+
| `BUG_FIX` | "Fixed race condition in auth middleware" |
|
|
153
|
+
| `INSIGHT` | "The codebase uses a layered architecture" |
|
|
154
|
+
| `FAILED_SUGGESTION` | "Tried Redis caching, too complex for this project" |
|
|
155
|
+
| `PROVEN_PATTERN` | "useDebounce hook works well for search inputs" |
|
|
156
|
+
|
|
157
|
+
## Architecture
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
src/
|
|
161
|
+
├── server/ # MCP handler (14-layer pipeline) + dashboard
|
|
162
|
+
├── memory/ # 17 cognitive modules (decay, attention, anticipation, etc.)
|
|
163
|
+
├── scanners/ # Project scanner, code verifier, export map, architecture graph
|
|
164
|
+
├── db/ # SQLite storage, event log
|
|
165
|
+
├── security/ # Rate limiter, encryption
|
|
166
|
+
├── hooks/ # Git capture
|
|
167
|
+
├── config/ # Configuration
|
|
168
|
+
└── cli/ # Setup wizard
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Pricing & Features
|
|
172
|
+
|
|
173
|
+
Cortex is open core. The basic version is free forever. To unlock deep cognitive features, upgrade to PRO.
|
|
174
|
+
|
|
175
|
+
| Feature | FREE (npm install) | PRO ($9/mo) |
|
|
176
|
+
|---|:---:|:---:|
|
|
177
|
+
| **Memory Capacity** | 20 memories | ∞ Unlimited |
|
|
178
|
+
| **Brain Layers** | 3 (Basic) | 14 (Full) |
|
|
179
|
+
| **Project Scan** | Yes | Yes |
|
|
180
|
+
| **Verify Code** | Yes | Yes |
|
|
181
|
+
| **Auto-Learn** | No | Yes |
|
|
182
|
+
| **Export Map (Anti-Hallucination)** | No | Yes |
|
|
183
|
+
| **Architecture Graph** | No | Yes |
|
|
184
|
+
| **Git Memory** | No | Yes |
|
|
185
|
+
| **Confidence Decay** | No | Yes |
|
|
186
|
+
| **Contradiction Detection** | No | Yes |
|
|
187
|
+
|
|
188
|
+
### Activate PRO
|
|
189
|
+
1. Get a license key from [cortex-mcp.org](https://cortex-mcp.org)
|
|
190
|
+
2. Set it in your environment:
|
|
191
|
+
```bash
|
|
192
|
+
# Option A: Environment variable
|
|
193
|
+
export CORTEX_LICENSE_KEY=CORTEX-XXXX-XXXX-XXXX-XXXX
|
|
194
|
+
|
|
195
|
+
# Option B: License file
|
|
196
|
+
echo CORTEX-XXXX-XXXX-XXXX-XXXX > ~/.cortex/license
|
|
197
|
+
```
|
|
198
|
+
3. Restart your IDE / MCP server.
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
MIT
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* cortex setup — Auto-configures Cortex MCP server for any AI client.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* cortex-setup # auto-detect all clients
|
|
7
|
+
* cortex-setup --client antigravity
|
|
8
|
+
* cortex-setup --client claude
|
|
9
|
+
* cortex-setup --client cursor
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* cortex setup — Auto-configures Cortex MCP server for any AI client.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* cortex-setup # auto-detect all clients
|
|
8
|
+
* cortex-setup --client antigravity
|
|
9
|
+
* cortex-setup --client claude
|
|
10
|
+
* cortex-setup --client cursor
|
|
11
|
+
*/
|
|
12
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(o, k2, desc);
|
|
19
|
+
}) : (function(o, m, k, k2) {
|
|
20
|
+
if (k2 === undefined) k2 = k;
|
|
21
|
+
o[k2] = m[k];
|
|
22
|
+
}));
|
|
23
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
+
}) : function(o, v) {
|
|
26
|
+
o["default"] = v;
|
|
27
|
+
});
|
|
28
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
+
var ownKeys = function(o) {
|
|
30
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
+
var ar = [];
|
|
32
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
+
return ar;
|
|
34
|
+
};
|
|
35
|
+
return ownKeys(o);
|
|
36
|
+
};
|
|
37
|
+
return function (mod) {
|
|
38
|
+
if (mod && mod.__esModule) return mod;
|
|
39
|
+
var result = {};
|
|
40
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
+
__setModuleDefault(result, mod);
|
|
42
|
+
return result;
|
|
43
|
+
};
|
|
44
|
+
})();
|
|
45
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
+
const fs = __importStar(require("fs"));
|
|
47
|
+
const path = __importStar(require("path"));
|
|
48
|
+
const os = __importStar(require("os"));
|
|
49
|
+
const HOME = os.homedir();
|
|
50
|
+
const CLIENTS = {
|
|
51
|
+
antigravity: {
|
|
52
|
+
name: 'Antigravity (Gemini)',
|
|
53
|
+
configPath: path.join(HOME, '.gemini', 'antigravity', 'mcp_config.json'),
|
|
54
|
+
configKey: 'mcpServers',
|
|
55
|
+
},
|
|
56
|
+
claude: {
|
|
57
|
+
name: 'Claude Desktop',
|
|
58
|
+
configPath: process.platform === 'win32'
|
|
59
|
+
? path.join(HOME, 'AppData', 'Roaming', 'Claude', 'claude_desktop_config.json')
|
|
60
|
+
: path.join(HOME, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'),
|
|
61
|
+
configKey: 'mcpServers',
|
|
62
|
+
},
|
|
63
|
+
cursor: {
|
|
64
|
+
name: 'Cursor',
|
|
65
|
+
configPath: path.join(HOME, '.cursor', 'mcp.json'),
|
|
66
|
+
configKey: 'mcpServers',
|
|
67
|
+
},
|
|
68
|
+
copilot: {
|
|
69
|
+
name: 'GitHub Copilot (VS Code)',
|
|
70
|
+
configPath: path.join(HOME, '.vscode', 'settings.json'),
|
|
71
|
+
configKey: 'github.copilot.chat.mcpServers',
|
|
72
|
+
},
|
|
73
|
+
windsurf: {
|
|
74
|
+
name: 'Windsurf',
|
|
75
|
+
configPath: path.join(HOME, '.codeium', 'windsurf', 'mcp_config.json'),
|
|
76
|
+
configKey: 'mcpServers',
|
|
77
|
+
},
|
|
78
|
+
zed: {
|
|
79
|
+
name: 'Zed',
|
|
80
|
+
configPath: process.platform === 'win32'
|
|
81
|
+
? path.join(HOME, 'AppData', 'Roaming', 'Zed', 'settings.json')
|
|
82
|
+
: path.join(HOME, '.config', 'zed', 'settings.json'),
|
|
83
|
+
configKey: 'mcpServers',
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
// ─── Server Entry ─────────────────────────────────────────────────────────────
|
|
87
|
+
const SERVER_ENTRY = {
|
|
88
|
+
command: 'npx',
|
|
89
|
+
args: ['-y', '@cortex-mcp/server'],
|
|
90
|
+
};
|
|
91
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
92
|
+
function readJSON(filePath) {
|
|
93
|
+
try {
|
|
94
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
95
|
+
return JSON.parse(raw);
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return {};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function writeJSON(filePath, data) {
|
|
102
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
103
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
|
104
|
+
}
|
|
105
|
+
function setNestedKey(obj, keyPath, value) {
|
|
106
|
+
const keys = keyPath.split('.');
|
|
107
|
+
let current = obj;
|
|
108
|
+
for (let i = 0; i < keys.length - 1; i++) {
|
|
109
|
+
if (!current[keys[i]])
|
|
110
|
+
current[keys[i]] = {};
|
|
111
|
+
current = current[keys[i]];
|
|
112
|
+
}
|
|
113
|
+
const lastKey = keys[keys.length - 1];
|
|
114
|
+
if (!current[lastKey])
|
|
115
|
+
current[lastKey] = {};
|
|
116
|
+
current[lastKey]['cortex'] = value;
|
|
117
|
+
return obj;
|
|
118
|
+
}
|
|
119
|
+
function configureClient(clientKey) {
|
|
120
|
+
const client = CLIENTS[clientKey];
|
|
121
|
+
if (!client) {
|
|
122
|
+
console.error(`Unknown client: ${clientKey}`);
|
|
123
|
+
console.error(`Available: ${Object.keys(CLIENTS).join(', ')}`);
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
const config = readJSON(client.configPath);
|
|
127
|
+
const updated = setNestedKey(config, client.configKey, SERVER_ENTRY);
|
|
128
|
+
writeJSON(client.configPath, updated);
|
|
129
|
+
console.log(`[OK] ${client.name} configured!`);
|
|
130
|
+
console.log(` Config: ${client.configPath}`);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
function autoDetect() {
|
|
134
|
+
const detected = [];
|
|
135
|
+
for (const [key, client] of Object.entries(CLIENTS)) {
|
|
136
|
+
if (fs.existsSync(path.dirname(client.configPath))) {
|
|
137
|
+
detected.push(key);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return detected;
|
|
141
|
+
}
|
|
142
|
+
// ─── Git Hook Installation ────────────────────────────────────────────────────
|
|
143
|
+
const HOOKS = {
|
|
144
|
+
'post-commit': '#!/bin/sh\n# Cortex — Auto-capture commits\ncortex-capture 2>/dev/null || true\n',
|
|
145
|
+
'post-checkout': '#!/bin/sh\n# Cortex — Track branch switches\ncortex-hooks checkout "$@" 2>/dev/null || true\n',
|
|
146
|
+
'post-merge': '#!/bin/sh\n# Cortex — Track merges\ncortex-hooks merge "$@" 2>/dev/null || true\n',
|
|
147
|
+
};
|
|
148
|
+
function installGitHooks(workspaceRoot) {
|
|
149
|
+
const gitDir = path.join(workspaceRoot, '.git');
|
|
150
|
+
if (!fs.existsSync(gitDir))
|
|
151
|
+
return 0;
|
|
152
|
+
const hookDir = path.join(gitDir, 'hooks');
|
|
153
|
+
fs.mkdirSync(hookDir, { recursive: true });
|
|
154
|
+
let installed = 0;
|
|
155
|
+
for (const [hookName, hookContent] of Object.entries(HOOKS)) {
|
|
156
|
+
const hookPath = path.join(hookDir, hookName);
|
|
157
|
+
const marker = hookName === 'post-commit' ? 'cortex-capture' : 'cortex-hooks';
|
|
158
|
+
if (fs.existsSync(hookPath)) {
|
|
159
|
+
const existing = fs.readFileSync(hookPath, 'utf-8');
|
|
160
|
+
if (existing.includes(marker))
|
|
161
|
+
continue; // Already installed
|
|
162
|
+
// Append to existing hook
|
|
163
|
+
const appendLine = hookContent.split('\n').filter(l => l.includes('cortex')).join('\n');
|
|
164
|
+
fs.appendFileSync(hookPath, `\n# Cortex MCP\n${appendLine}\n`);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
fs.writeFileSync(hookPath, hookContent, { mode: 0o755 });
|
|
168
|
+
}
|
|
169
|
+
installed++;
|
|
170
|
+
}
|
|
171
|
+
return installed;
|
|
172
|
+
}
|
|
173
|
+
// ─── Prompt Rules Installation ────────────────────────────────────────────────
|
|
174
|
+
// Each AI client has its own rules file. These tell the AI to auto-call
|
|
175
|
+
// force_recall at conversation start and auto_learn after every response.
|
|
176
|
+
const CORTEX_RULES = `# Cortex Memory Rules — MANDATORY
|
|
177
|
+
|
|
178
|
+
## At Conversation Start (ALWAYS)
|
|
179
|
+
1. ALWAYS call \`mcp_cortex_force_recall\` with the topic of the user's question
|
|
180
|
+
- This returns ALL corrections, decisions, conventions, and bug fixes
|
|
181
|
+
- Plus topic-specific search results
|
|
182
|
+
- DO NOT skip this step. It is mandatory.
|
|
183
|
+
|
|
184
|
+
## After EVERY Response (ALWAYS)
|
|
185
|
+
2. ALWAYS call \`mcp_cortex_auto_learn\` with the text of your response
|
|
186
|
+
- Cortex will automatically extract and store any decisions, corrections, conventions, or bug fixes
|
|
187
|
+
- This is how Cortex learns passively — zero manual effort required
|
|
188
|
+
- DO NOT skip this step. It is mandatory.
|
|
189
|
+
|
|
190
|
+
## When Decisions Are Made
|
|
191
|
+
ALSO call \`mcp_cortex_store_memory\` for high-importance items:
|
|
192
|
+
- A critical architectural decision (type: DECISION)
|
|
193
|
+
- A mistake that must never be repeated (type: CORRECTION)
|
|
194
|
+
- A project-wide coding convention (type: CONVENTION)
|
|
195
|
+
- A tricky bug that was hard to find (type: BUG_FIX)
|
|
196
|
+
|
|
197
|
+
## Before Suggesting Code
|
|
198
|
+
Call \`mcp_cortex_verify_code\` to check:
|
|
199
|
+
- Are import packages real (exist in package.json)?
|
|
200
|
+
- Are imported functions actually exported?
|
|
201
|
+
- Are env variables defined in .env?
|
|
202
|
+
|
|
203
|
+
## Before Referencing Files
|
|
204
|
+
Call \`mcp_cortex_verify_files\` to check if file paths are real.
|
|
205
|
+
`;
|
|
206
|
+
// Map of client → rules file path (relative to project root)
|
|
207
|
+
const RULES_FILES = {
|
|
208
|
+
antigravity: path.join('.gemini', 'GEMINI.md'),
|
|
209
|
+
cursor: '.cursorrules',
|
|
210
|
+
copilot: path.join('.github', 'copilot-instructions.md'),
|
|
211
|
+
windsurf: '.windsurfrules',
|
|
212
|
+
};
|
|
213
|
+
function installPromptRules(workspaceRoot, detectedClients) {
|
|
214
|
+
let installed = 0;
|
|
215
|
+
for (const client of detectedClients) {
|
|
216
|
+
const rulesFile = RULES_FILES[client];
|
|
217
|
+
if (!rulesFile)
|
|
218
|
+
continue; // No rules file for this client (e.g. zed, claude)
|
|
219
|
+
const fullPath = path.join(workspaceRoot, rulesFile);
|
|
220
|
+
// Don't overwrite — check if Cortex rules already present
|
|
221
|
+
if (fs.existsSync(fullPath)) {
|
|
222
|
+
const existing = fs.readFileSync(fullPath, 'utf-8');
|
|
223
|
+
if (existing.includes('mcp_cortex_force_recall'))
|
|
224
|
+
continue; // Already installed
|
|
225
|
+
// Append to existing rules
|
|
226
|
+
fs.appendFileSync(fullPath, '\n\n' + CORTEX_RULES);
|
|
227
|
+
console.log(`[OK] Cortex rules appended to ${rulesFile}`);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
fs.mkdirSync(path.dirname(fullPath), { recursive: true });
|
|
231
|
+
fs.writeFileSync(fullPath, CORTEX_RULES, 'utf-8');
|
|
232
|
+
console.log(`[OK] Created ${rulesFile} with Cortex memory rules`);
|
|
233
|
+
}
|
|
234
|
+
installed++;
|
|
235
|
+
}
|
|
236
|
+
return installed;
|
|
237
|
+
}
|
|
238
|
+
// ─── Main ─────────────────────────────────────────────────────────────────────
|
|
239
|
+
function main() {
|
|
240
|
+
const args = process.argv.slice(2);
|
|
241
|
+
const clientFlag = args.indexOf('--client');
|
|
242
|
+
const clientArg = clientFlag !== -1 ? args[clientFlag + 1] : null;
|
|
243
|
+
console.log('\nCortex MCP Setup\n');
|
|
244
|
+
let detectedClients = [];
|
|
245
|
+
if (clientArg) {
|
|
246
|
+
configureClient(clientArg);
|
|
247
|
+
detectedClients = [clientArg];
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
// Auto-detect installed clients
|
|
251
|
+
detectedClients = autoDetect();
|
|
252
|
+
if (detectedClients.length === 0) {
|
|
253
|
+
console.log('No supported AI clients detected.');
|
|
254
|
+
console.log('Supported clients:', Object.keys(CLIENTS).join(', '));
|
|
255
|
+
console.log('\nManual setup:');
|
|
256
|
+
console.log(JSON.stringify({ mcpServers: { cortex: SERVER_ENTRY } }, null, 2));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
console.log(`Detected clients: ${detectedClients.map(k => CLIENTS[k].name).join(', ')}\n`);
|
|
260
|
+
for (const key of detectedClients) {
|
|
261
|
+
configureClient(key);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const cwd = process.cwd();
|
|
266
|
+
// Install prompt rules (tells the AI to use Cortex automatically)
|
|
267
|
+
if (detectedClients.length > 0) {
|
|
268
|
+
console.log('');
|
|
269
|
+
const rulesCount = installPromptRules(cwd, detectedClients);
|
|
270
|
+
if (rulesCount > 0) {
|
|
271
|
+
console.log(` AI will now auto-recall context and auto-learn from every conversation!`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Install git hooks in current directory (if it's a git repo)
|
|
275
|
+
console.log('');
|
|
276
|
+
if (fs.existsSync(path.join(cwd, '.git'))) {
|
|
277
|
+
const count = installGitHooks(cwd);
|
|
278
|
+
if (count > 0) {
|
|
279
|
+
console.log(`[OK] ${count} git hook(s) installed (commits, branches, merges)`);
|
|
280
|
+
console.log(' Every code change will now be auto-captured as a memory!');
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
console.log('[OK] Git hooks already installed');
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
console.log('[INFO] No git repo detected in current directory.');
|
|
288
|
+
console.log(' Run "cortex-setup" inside a git repo to enable auto-capture.');
|
|
289
|
+
}
|
|
290
|
+
console.log('\nDone! Restart your AI client to activate Cortex.\n');
|
|
291
|
+
}
|
|
292
|
+
main();
|
|
293
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":";;AACA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAC7B,uCAAyB;AAEzB,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;AAU1B,MAAM,OAAO,GAAiC;IAC1C,WAAW,EAAE;QACT,IAAI,EAAE,sBAAsB;QAC5B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,iBAAiB,CAAC;QACxE,SAAS,EAAE,YAAY;KAC1B;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,gBAAgB;QACtB,UAAU,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO;YACpC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,4BAA4B,CAAC;YAC/E,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,CAAC;QAC/F,SAAS,EAAE,YAAY;KAC1B;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC;QAClD,SAAS,EAAE,YAAY;KAC1B;IACD,OAAO,EAAE;QACL,IAAI,EAAE,0BAA0B;QAChC,UAAU,EAAE,I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_AGE_DAYS: number;
|
|
5
|
+
MEMORY_CAP: number;
|
|
6
|
+
CACHE_TTL: number;
|
|
7
|
+
CACHE_MAX: number;
|
|
8
|
+
EMBEDDING_TIMEOUT: number;
|
|
9
|
+
MAX_CONTEXT_CHARS: number;
|
|
10
|
+
MAX_RECALL_RESULTS: number;
|
|
11
|
+
DASHBOARD_PORT: number;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM;gBASV,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;;;;;;;CAoB9B,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CONFIG = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Cortex Configuration — Minimal, focused config for MCP mode.
|
|
6
|
+
*/
|
|
7
|
+
const types_1 = require("../types");
|
|
8
|
+
exports.CONFIG = {
|
|
9
|
+
// Memory ranking boosts by type
|
|
10
|
+
TYPE_BOOST: {
|
|
11
|
+
[types_1.MemoryType.CORRECTION]: 1.5,
|
|
12
|
+
[types_1.MemoryType.DECISION]: 1.3,
|
|
13
|
+
[types_1.MemoryType.CONVENTION]: 1.2,
|
|
14
|
+
[types_1.MemoryType.BUG_FIX]: 1.1,
|
|
15
|
+
[types_1.MemoryType.INSIGHT]: 1.0,
|
|
16
|
+
[types_1.MemoryType.DEPENDENCY]: 0.8,
|
|
17
|
+
},
|
|
18
|
+
// Memory decay
|
|
19
|
+
INSIGHT_MAX_AGE_DAYS: 30,
|
|
20
|
+
UNUSED_MAX_AGE_DAYS: 60,
|
|
21
|
+
MEMORY_CAP: 500,
|
|
22
|
+
// Cache
|
|
23
|
+
CACHE_TTL: 60_000, // 1 minute
|
|
24
|
+
CACHE_MAX: 50,
|
|
25
|
+
// Embeddings
|
|
26
|
+
EMBEDDING_TIMEOUT: 30_000, // 30 seconds
|
|
27
|
+
// Context
|
|
28
|
+
MAX_CONTEXT_CHARS: 3000,
|
|
29
|
+
MAX_RECALL_RESULTS: 10,
|
|
30
|
+
// Server
|
|
31
|
+
DASHBOARD_PORT: 3456,
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,oCAAsC;AAEzB,QAAA,MAAM,GAAG;IAClB,gCAAgC;IAChC,UAAU,EAAE;QACR,CAAC,kBAAU,CAAC,UAAU,CAAC,EAAE,GAAG;QAC5B,CAAC,kBAAU,CAAC,QAAQ,CAAC,EAAE,GAAG;QAC1B,CAAC,kBAAU,CAAC,UAAU,CAAC,EAAE,GAAG;QAC5B,CAAC,kBAAU,CAAC,OAAO,CAAC,EAAE,GAAG;QACzB,CAAC,kBAAU,CAAC,OAAO,CAAC,EAAE,GAAG;QACzB,CAAC,kBAAU,CAAC,UAAU,CAAC,EAAE,GAAG;KACL;IAE3B,eAAe;IACf,oBAAoB,EAAE,EAAE;IACxB,mBAAmB,EAAE,EAAE;IACvB,UAAU,EAAE,GAAG;IAEf,QAAQ;IACR,SAAS,EAAE,MAAM,EAAM,WAAW;IAClC,SAAS,EAAE,EAAE;IAEb,aAAa;IACb,iBAAiB,EAAE,MAAM,EAAE,aAAa;IAExC,UAAU;IACV,iBAAiB,EAAE,IAAI;IACvB,kBAAkB,EAAE,EAAE;IAEtB,SAAS;IACT,cAAc,EAAE,IAAI;CACvB,CAAC"}
|