codecortex-ai 0.1.0 → 0.2.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/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# CodeCortex
|
|
2
2
|
|
|
3
|
-
> Persistent
|
|
3
|
+
> Persistent codebase knowledge layer for AI agents. Your AI shouldn't re-learn your codebase every session.
|
|
4
|
+
|
|
5
|
+
[Website](https://codecortex-ai.vercel.app) · [npm](https://www.npmjs.com/package/codecortex-ai) · [GitHub](https://github.com/rushikeshmore/CodeCortex)
|
|
4
6
|
|
|
5
7
|
## The Problem
|
|
6
8
|
|
|
7
|
-
Every AI coding session starts from scratch. When context compacts or a new session begins, the AI
|
|
9
|
+
Every AI coding session starts from scratch. When context compacts or a new session begins, the AI re-scans the entire codebase. Same files, same tokens, same wasted time. It's like hiring a new developer every session who has to re-learn everything before writing a single line.
|
|
8
10
|
|
|
9
11
|
**The data backs this up:**
|
|
10
12
|
- AI agents increase defect risk by 30% on unfamiliar code ([CodeScene + Lund University, 2025](https://codescene.com/hubfs/whitepapers/AI-Coding-Assistants-and-Code-Quality.pdf))
|
|
@@ -13,15 +15,15 @@ Every AI coding session starts from scratch. When context compacts or a new sess
|
|
|
13
15
|
|
|
14
16
|
## The Solution
|
|
15
17
|
|
|
16
|
-
CodeCortex pre-digests codebases into layered
|
|
18
|
+
CodeCortex pre-digests codebases into layered knowledge files and serves them to any AI agent via MCP. Instead of re-understanding your codebase every session, the AI starts with knowledge.
|
|
17
19
|
|
|
18
|
-
**Hybrid extraction:** tree-sitter native N-API for
|
|
20
|
+
**Hybrid extraction:** tree-sitter native N-API for structure (symbols, imports, calls across 28 languages) + host LLM for semantics (what modules do, why they're built that way). Zero extra API keys.
|
|
19
21
|
|
|
20
22
|
## Quick Start
|
|
21
23
|
|
|
22
24
|
```bash
|
|
23
25
|
# Install
|
|
24
|
-
npm install -g codecortex
|
|
26
|
+
npm install -g codecortex-ai
|
|
25
27
|
|
|
26
28
|
# Initialize knowledge for your project
|
|
27
29
|
cd /path/to/your-project
|
|
@@ -50,30 +52,22 @@ Add to your MCP config:
|
|
|
50
52
|
}
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
##
|
|
55
|
+
## What Gets Generated
|
|
56
|
+
|
|
57
|
+
All knowledge lives in `.codecortex/` as flat files in your repo:
|
|
54
58
|
|
|
55
59
|
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
│ report_feedback │
|
|
68
|
-
└──────┬──────────────────────────────────────────────┘
|
|
69
|
-
│ reads/writes
|
|
70
|
-
┌──────▼──────────────────────────────────────────────┐
|
|
71
|
-
│ .codecortex/ (flat files in repo) │
|
|
72
|
-
│ HOT: cortex.yaml │ constitution.md │ overview.md │
|
|
73
|
-
│ graph.json │ symbols.json │ temporal.json │
|
|
74
|
-
│ WARM: modules/*.md │
|
|
75
|
-
│ COLD: decisions/*.md │ sessions/*.md │ patterns.md │
|
|
76
|
-
└──────────────────────────────────────────────────────┘
|
|
60
|
+
.codecortex/
|
|
61
|
+
cortex.yaml # project manifest
|
|
62
|
+
constitution.md # project overview for agents
|
|
63
|
+
overview.md # module map + entry points
|
|
64
|
+
graph.json # dependency graph (imports, calls, modules)
|
|
65
|
+
symbols.json # full symbol index (functions, classes, types...)
|
|
66
|
+
temporal.json # git coupling, hotspots, bug history
|
|
67
|
+
modules/*.md # per-module deep analysis
|
|
68
|
+
decisions/*.md # architectural decision records
|
|
69
|
+
sessions/*.md # session change logs
|
|
70
|
+
patterns.md # coding patterns and conventions
|
|
77
71
|
```
|
|
78
72
|
|
|
79
73
|
## Six Knowledge Layers
|
|
@@ -81,35 +75,35 @@ ANY AI AGENT (Claude Code, Cursor, Codex, Windsurf, Zed)
|
|
|
81
75
|
| Layer | What | File |
|
|
82
76
|
|-------|------|------|
|
|
83
77
|
| 1. Structural | Modules, deps, symbols, entry points | `graph.json` + `symbols.json` |
|
|
84
|
-
| 2. Semantic | What each module
|
|
85
|
-
| 3. Temporal | Git behavioral fingerprint
|
|
86
|
-
| 4. Decisions |
|
|
87
|
-
| 5. Patterns |
|
|
88
|
-
| 6. Sessions | What
|
|
78
|
+
| 2. Semantic | What each module does, data flow, gotchas | `modules/*.md` |
|
|
79
|
+
| 3. Temporal | Git behavioral fingerprint - coupling, hotspots, bug history | `temporal.json` |
|
|
80
|
+
| 4. Decisions | Why things are built this way | `decisions/*.md` |
|
|
81
|
+
| 5. Patterns | How code is written here | `patterns.md` |
|
|
82
|
+
| 6. Sessions | What changed between sessions | `sessions/*.md` |
|
|
89
83
|
|
|
90
|
-
### The Temporal Layer
|
|
84
|
+
### The Temporal Layer
|
|
91
85
|
|
|
92
|
-
The temporal layer tells agents *"if you touch file X, you MUST also touch file Y"* even when there's no import between them. This comes from git co-change analysis, not static code analysis.
|
|
86
|
+
This is the killer differentiator. The temporal layer tells agents *"if you touch file X, you MUST also touch file Y"* even when there's no import between them. This comes from git co-change analysis, not static code analysis.
|
|
93
87
|
|
|
94
88
|
Example from a real codebase:
|
|
95
|
-
- `routes.ts`
|
|
89
|
+
- `routes.ts` and `worker.ts` co-changed in 9/12 commits (75%) with **zero imports between them**
|
|
96
90
|
- Without this knowledge, an AI editing one file would produce a bug 75% of the time
|
|
97
91
|
|
|
98
|
-
## MCP Tools
|
|
92
|
+
## MCP Tools (14)
|
|
99
93
|
|
|
100
94
|
### Read Tools (9)
|
|
101
95
|
|
|
102
|
-
| Tool | Description |
|
|
103
|
-
|
|
104
|
-
| `get_project_overview` | Constitution + overview + graph summary |
|
|
105
|
-
| `get_module_context` | Module doc by name, includes temporal signals |
|
|
106
|
-
| `get_session_briefing` | Changes since last session |
|
|
107
|
-
| `search_knowledge` | Keyword search across all knowledge |
|
|
108
|
-
| `get_decision_history` | Decision records filtered by topic |
|
|
109
|
-
| `get_dependency_graph` | Import/export graph, filterable |
|
|
110
|
-
| `lookup_symbol` | Symbol by name/file/kind |
|
|
111
|
-
| `get_change_coupling` |
|
|
112
|
-
| `get_hotspots` | Files ranked by risk (churn
|
|
96
|
+
| Tool | Description |
|
|
97
|
+
|------|-------------|
|
|
98
|
+
| `get_project_overview` | Constitution + overview + graph summary |
|
|
99
|
+
| `get_module_context` | Module doc by name, includes temporal signals |
|
|
100
|
+
| `get_session_briefing` | Changes since last session |
|
|
101
|
+
| `search_knowledge` | Keyword search across all knowledge |
|
|
102
|
+
| `get_decision_history` | Decision records filtered by topic |
|
|
103
|
+
| `get_dependency_graph` | Import/export graph, filterable |
|
|
104
|
+
| `lookup_symbol` | Symbol by name/file/kind |
|
|
105
|
+
| `get_change_coupling` | What files must I also edit if I touch X? |
|
|
106
|
+
| `get_hotspots` | Files ranked by risk (churn x coupling) |
|
|
113
107
|
|
|
114
108
|
### Write Tools (5)
|
|
115
109
|
|
|
@@ -130,27 +124,25 @@ Example from a real codebase:
|
|
|
130
124
|
| `codecortex update` | Re-extract changed files, update affected modules |
|
|
131
125
|
| `codecortex status` | Show knowledge freshness, stale modules, symbol counts |
|
|
132
126
|
|
|
133
|
-
##
|
|
127
|
+
## Token Efficiency
|
|
134
128
|
|
|
135
129
|
CodeCortex uses a three-tier memory model to minimize token usage:
|
|
136
130
|
|
|
137
131
|
```
|
|
138
|
-
Session start (HOT only): ~4,300 tokens
|
|
139
|
-
Working on a module (+WARM): ~5,000 tokens
|
|
140
|
-
Need coding patterns (+COLD): ~5,900 tokens
|
|
132
|
+
Session start (HOT only): ~4,300 tokens
|
|
133
|
+
Working on a module (+WARM): ~5,000 tokens
|
|
134
|
+
Need coding patterns (+COLD): ~5,900 tokens
|
|
141
135
|
|
|
142
|
-
vs. raw scan of entire codebase: ~37,800 tokens
|
|
136
|
+
vs. raw scan of entire codebase: ~37,800 tokens
|
|
143
137
|
```
|
|
144
138
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
## Supported Languages (27)
|
|
139
|
+
85-90% token reduction. 7-10x efficiency gain.
|
|
148
140
|
|
|
149
|
-
|
|
141
|
+
## Supported Languages (28)
|
|
150
142
|
|
|
151
143
|
| Category | Languages |
|
|
152
144
|
|----------|-----------|
|
|
153
|
-
| Web | TypeScript, TSX, JavaScript |
|
|
145
|
+
| Web | TypeScript, TSX, JavaScript, Liquid |
|
|
154
146
|
| Systems | C, C++, Objective-C, Rust, Zig, Go |
|
|
155
147
|
| JVM | Java, Kotlin, Scala |
|
|
156
148
|
| .NET | C# |
|
|
@@ -162,10 +154,10 @@ Native tree-sitter grammars for:
|
|
|
162
154
|
## Tech Stack
|
|
163
155
|
|
|
164
156
|
- TypeScript ESM, Node.js 20+
|
|
165
|
-
- `tree-sitter` (native N-API) +
|
|
166
|
-
- `@modelcontextprotocol/sdk`
|
|
167
|
-
- `commander`
|
|
168
|
-
- `simple-git`
|
|
157
|
+
- `tree-sitter` (native N-API) + 28 language grammar packages
|
|
158
|
+
- `@modelcontextprotocol/sdk` - MCP server
|
|
159
|
+
- `commander` - CLI
|
|
160
|
+
- `simple-git` - git integration
|
|
169
161
|
- `yaml`, `zod`, `glob`
|
|
170
162
|
|
|
171
163
|
## License
|
|
@@ -947,16 +947,21 @@ export {
|
|
|
947
947
|
writeManifest,
|
|
948
948
|
createManifest,
|
|
949
949
|
updateManifest,
|
|
950
|
+
readGraph,
|
|
950
951
|
writeGraph,
|
|
951
952
|
buildGraph,
|
|
953
|
+
getModuleDependencies,
|
|
952
954
|
enrichCouplingWithImports,
|
|
955
|
+
readModuleDoc,
|
|
956
|
+
writeModuleDoc,
|
|
953
957
|
listModuleDocs,
|
|
954
958
|
listDecisions,
|
|
955
959
|
writeSession,
|
|
956
960
|
listSessions,
|
|
957
961
|
getLatestSession,
|
|
958
962
|
createSession,
|
|
963
|
+
searchKnowledge,
|
|
959
964
|
createServer,
|
|
960
965
|
startServer
|
|
961
966
|
};
|
|
962
|
-
//# sourceMappingURL=chunk-
|
|
967
|
+
//# sourceMappingURL=chunk-DWUIP3WA.js.map
|