neuronlayer 0.1.7 → 0.1.8
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 +171 -111
- package/dist/index.js +724 -134
- package/package.json +2 -2
- package/src/cli/commands.ts +12 -6
- package/src/core/engine.ts +53 -3
- package/src/core/ghost-mode.ts +53 -0
- package/src/core/project-manager.ts +5 -1
- package/src/indexing/ast.ts +356 -51
- package/src/indexing/indexer.ts +25 -0
- package/src/server/mcp.ts +1 -1
- package/src/server/tools.ts +129 -0
- package/src/storage/tier2.ts +212 -4
- package/real-benchmark.mjs +0 -322
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# NeuronLayer
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Code intelligence layer disguised as memory.**
|
|
4
|
+
|
|
5
|
+
NeuronLayer isn't another memory tool. It's a code-intelligence layer that gives AI assistants deep understanding of your codebase - understanding that persists across sessions.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/neuronlayer)
|
|
6
8
|
[](LICENSE)
|
|
@@ -9,23 +11,41 @@
|
|
|
9
11
|
|
|
10
12
|
---
|
|
11
13
|
|
|
14
|
+
## What Makes NeuronLayer Different
|
|
15
|
+
|
|
16
|
+
Most "memory tools" for AI are just note-taking with embeddings. NeuronLayer does something fundamentally different:
|
|
17
|
+
|
|
18
|
+
| Memory Tools | NeuronLayer |
|
|
19
|
+
|--------------|-------------|
|
|
20
|
+
| Store text, retrieve by similarity | **Parse code structure** (regex-based extraction) |
|
|
21
|
+
| Keyword/embedding search | **Understand dependencies** (what imports what) |
|
|
22
|
+
| Tag-based organization | **Transitive impact analysis** (change X → affects Y, Z) |
|
|
23
|
+
| Session notes | **Circular dependency detection** |
|
|
24
|
+
| | **Test indexing** (identifies test files and what they test) |
|
|
25
|
+
| | **Conflict detection** with recorded decisions |
|
|
26
|
+
|
|
27
|
+
**The AI thinks it's using memory tools. It's actually getting code intelligence.**
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
12
31
|
## The Problem
|
|
13
32
|
|
|
14
|
-
AI coding assistants are powerful but
|
|
33
|
+
AI coding assistants are powerful but blind:
|
|
15
34
|
|
|
16
|
-
-
|
|
17
|
-
- No
|
|
18
|
-
-
|
|
19
|
-
-
|
|
35
|
+
- **No structural understanding** - AI doesn't know your dependency graph
|
|
36
|
+
- **No impact awareness** - "changing this file breaks 12 others"
|
|
37
|
+
- **No test knowledge** - AI suggestions break tests it doesn't know exist
|
|
38
|
+
- **No persistent decisions** - architectural choices forgotten each session
|
|
20
39
|
|
|
21
40
|
## The Solution
|
|
22
41
|
|
|
23
|
-
NeuronLayer gives AI assistants persistent
|
|
42
|
+
NeuronLayer gives AI assistants **persistent code intelligence**:
|
|
24
43
|
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
44
|
+
- **Dependency graph** - knows what imports what, transitively
|
|
45
|
+
- **Impact analysis** - "changing auth.ts affects 8 files and 4 tests"
|
|
46
|
+
- **Test awareness** - indexes tests, predicts failures, suggests updates
|
|
47
|
+
- **Decision memory** - architectural decisions survive across sessions
|
|
48
|
+
- **Circular dependency detection** - finds import cycles automatically
|
|
29
49
|
|
|
30
50
|
---
|
|
31
51
|
|
|
@@ -35,9 +55,9 @@ NeuronLayer gives AI assistants persistent, intelligent memory:
|
|
|
35
55
|
|------|-----------|----------------|
|
|
36
56
|
| Claude Desktop | Yes | `neuronlayer init` |
|
|
37
57
|
| Claude Code (CLI) | Yes | `neuronlayer init` |
|
|
58
|
+
| Cursor | Yes | Via MCP support |
|
|
38
59
|
| OpenCode | Yes | `neuronlayer init` |
|
|
39
60
|
| VS Code + Continue | Yes | Manual config |
|
|
40
|
-
| Cursor | Not yet | No MCP support |
|
|
41
61
|
| Any MCP Client | Yes | Manual config |
|
|
42
62
|
|
|
43
63
|
---
|
|
@@ -59,21 +79,75 @@ neuronlayer init
|
|
|
59
79
|
|
|
60
80
|
That's it! This automatically:
|
|
61
81
|
1. Registers your project
|
|
62
|
-
2. Configures Claude Desktop
|
|
63
|
-
3.
|
|
64
|
-
4. Configures Claude Code
|
|
82
|
+
2. Configures Claude Desktop, Claude Code, and OpenCode
|
|
83
|
+
3. Indexes your codebase (symbol extraction, dependency graph, tests)
|
|
65
84
|
|
|
66
85
|
Just restart your AI tool and NeuronLayer is active.
|
|
67
86
|
|
|
68
87
|
---
|
|
69
88
|
|
|
70
|
-
##
|
|
89
|
+
## Code Intelligence Features
|
|
71
90
|
|
|
72
|
-
|
|
91
|
+
### Dependency Graph
|
|
73
92
|
|
|
74
|
-
|
|
93
|
+
NeuronLayer builds a complete dependency graph of your codebase:
|
|
75
94
|
|
|
76
|
-
|
|
95
|
+
```
|
|
96
|
+
src/auth/login.ts
|
|
97
|
+
├── imports: ./utils, ../api/client, ./types
|
|
98
|
+
└── imported by: src/pages/auth.tsx, src/hooks/useAuth.ts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Impact Analysis
|
|
102
|
+
|
|
103
|
+
Before making changes, the AI can ask "what's the blast radius?"
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
get_impact_analysis({ file: "src/auth/login.ts" })
|
|
107
|
+
|
|
108
|
+
→ Risk Level: MEDIUM
|
|
109
|
+
→ Direct dependents: 3 files
|
|
110
|
+
→ Indirect dependents: 5 files (2 hops)
|
|
111
|
+
→ Affected tests: 4 tests
|
|
112
|
+
→ Circular dependencies: none
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Circular Dependency Detection
|
|
116
|
+
|
|
117
|
+
Automatically finds import cycles that cause subtle bugs:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
find_circular_deps()
|
|
121
|
+
|
|
122
|
+
→ Found 2 circular dependency chains:
|
|
123
|
+
1. src/a.ts → src/b.ts → src/c.ts → src/a.ts
|
|
124
|
+
2. src/utils/index.ts → src/utils/helpers.ts → src/utils/index.ts
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Test Awareness
|
|
128
|
+
|
|
129
|
+
NeuronLayer indexes your test files:
|
|
130
|
+
- Detects test framework (Jest, Vitest, Mocha, pytest, etc.)
|
|
131
|
+
- Identifies test files by naming conventions and patterns
|
|
132
|
+
- Maps tests to source files they import
|
|
133
|
+
- Shows which tests may be affected when files change
|
|
134
|
+
|
|
135
|
+
### Real-Time Impact Warnings
|
|
136
|
+
|
|
137
|
+
When you save a file, NeuronLayer tells you what's affected:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
[Impact] src/auth/login.ts changed → 3 file(s) may be affected
|
|
141
|
+
→ src/pages/auth.tsx
|
|
142
|
+
→ src/hooks/useAuth.ts
|
|
143
|
+
→ src/components/LoginForm.tsx
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## MCP Tools
|
|
149
|
+
|
|
150
|
+
### Gateway Tools (Smart Routing)
|
|
77
151
|
|
|
78
152
|
| Tool | Purpose |
|
|
79
153
|
|------|---------|
|
|
@@ -84,80 +158,60 @@ These are the main tools. Each routes to multiple internal capabilities based on
|
|
|
84
158
|
| `memory_ghost` | Proactive intelligence: conflicts, "you solved this before", session resume |
|
|
85
159
|
| `memory_verify` | Pre-commit check: validate imports, security, dependencies |
|
|
86
160
|
|
|
87
|
-
###
|
|
161
|
+
### Code Intelligence Tools
|
|
88
162
|
|
|
89
163
|
| Tool | Purpose |
|
|
90
164
|
|------|---------|
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
165
|
+
| `get_impact_analysis` | **Analyze blast radius** - all affected files, tests, risk level |
|
|
166
|
+
| `find_circular_deps` | **Detect import cycles** - find circular dependencies |
|
|
167
|
+
| `get_dependencies` | Get imports and importers for a file |
|
|
168
|
+
| `get_file_summary` | Compressed file overview (10x smaller than full content) |
|
|
169
|
+
|
|
170
|
+
### Utility Tools
|
|
171
|
+
|
|
172
|
+
| Tool | Purpose |
|
|
173
|
+
|------|---------|
|
|
174
|
+
| `memory_refresh` | Trigger manual refresh after external changes |
|
|
93
175
|
| `switch_project` | Switch between registered projects |
|
|
94
|
-
| `switch_feature_context` | Resume work on a previous feature |
|
|
95
176
|
| `trigger_compaction` | Reduce memory when context is full |
|
|
96
|
-
| `update_decision_status` | Mark decisions as deprecated/superseded |
|
|
97
177
|
| `export_decisions_to_adr` | Export decisions as ADR markdown files |
|
|
98
|
-
| `discover_projects` | Find git repos on the system |
|
|
99
178
|
|
|
100
179
|
---
|
|
101
180
|
|
|
102
|
-
##
|
|
181
|
+
## Language Support
|
|
103
182
|
|
|
104
|
-
|
|
183
|
+
All languages use regex-based parsing for reliable cross-platform support.
|
|
184
|
+
|
|
185
|
+
| Language | Symbol Extraction | Dependency Tracking |
|
|
186
|
+
|----------|-------------------|---------------------|
|
|
187
|
+
| TypeScript/JavaScript | Functions, classes, imports, exports | Yes |
|
|
188
|
+
| Python | Functions, classes, imports | Yes |
|
|
189
|
+
| Go | Functions, structs, imports | Yes |
|
|
190
|
+
| Rust | Functions, structs, imports | Yes |
|
|
191
|
+
| Java | Classes, methods, imports | Yes |
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## Features
|
|
105
196
|
|
|
106
197
|
| Feature | Status | Description |
|
|
107
198
|
|---------|--------|-------------|
|
|
108
|
-
| **
|
|
199
|
+
| **Dependency Graph** | Working | Tracks imports via regex, builds transitive dependency graph |
|
|
200
|
+
| **Impact Analysis** | Working | Shows blast radius using BFS graph traversal |
|
|
201
|
+
| **Circular Detection** | Working | Finds import cycles using DFS |
|
|
202
|
+
| **Test Indexing** | Working | Indexes test files, identifies what functions they test |
|
|
203
|
+
| **Semantic Search** | Working | Find code by meaning using local embeddings (MiniLM-L6) |
|
|
109
204
|
| **Decision Recording** | Working | Log architectural decisions with context |
|
|
110
205
|
| **Pattern Library** | Working | Learn and validate coding patterns |
|
|
111
|
-
| **
|
|
206
|
+
| **Symbol Extraction** | Working | Extract functions, classes, imports via regex |
|
|
112
207
|
| **Context Compaction** | Working | Smart summarization when context fills |
|
|
113
|
-
| **Test Indexing** | Working | Index tests, predict failures |
|
|
114
208
|
| **Git Integration** | Working | Track changes, correlate with decisions |
|
|
115
|
-
| **Multi-Project** | Working | Switch between projects |
|
|
116
|
-
| **
|
|
117
|
-
|
|
118
|
-
### Intelligent Refresh System (v0.1.4)
|
|
119
|
-
|
|
120
|
-
NeuronLayer now includes a tiered refresh architecture that eliminates wasteful polling:
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
TIER 1: REAL-TIME
|
|
124
|
-
├── File changes → Chokidar watcher → immediate invalidation
|
|
125
|
-
├── User queries → immediate tracking
|
|
126
|
-
└── File access → immediate hot cache update
|
|
127
|
-
|
|
128
|
-
TIER 2: ON-DEMAND WITH CHEAP PRE-CHECK
|
|
129
|
-
├── Git sync → check HEAD first (5ms), only sync if changed
|
|
130
|
-
├── Summaries → check lastModified before regenerating
|
|
131
|
-
└── Bug diagnosis → sync git first if HEAD changed
|
|
132
|
-
|
|
133
|
-
TIER 3: IDLE-TIME MAINTENANCE
|
|
134
|
-
├── When user idle > 30s AND git changed → sync git
|
|
135
|
-
├── When idle > 5min since last update → update importance scores
|
|
136
|
-
└── One task at a time, non-blocking
|
|
137
|
-
|
|
138
|
-
TIER 4: SESSION-BASED
|
|
139
|
-
├── Engine init → full git sync
|
|
140
|
-
└── Shutdown → persist state
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
**Key optimization**: Instead of running expensive `git log` operations (~100ms+), we cache the HEAD commit and only sync when it changes (~5ms check).
|
|
144
|
-
|
|
145
|
-
### Modules
|
|
146
|
-
|
|
147
|
-
```
|
|
148
|
-
src/core/
|
|
149
|
-
├── refresh/ # NEW: Intelligent refresh system
|
|
150
|
-
├── living-docs/ # Architecture & changelog generation
|
|
151
|
-
├── context-rot/ # Context health & compaction
|
|
152
|
-
├── confidence/ # Source tracking & conflict detection
|
|
153
|
-
├── change-intelligence/ # Git tracking & fix suggestions
|
|
154
|
-
├── architecture/ # Pattern library & validation
|
|
155
|
-
└── test-awareness/ # Test indexing & failure prediction
|
|
156
|
-
```
|
|
209
|
+
| **Multi-Project** | Working | Switch between projects seamlessly |
|
|
210
|
+
| **Impact Warnings** | Working | Real-time notifications on file changes |
|
|
157
211
|
|
|
158
212
|
---
|
|
159
213
|
|
|
160
|
-
##
|
|
214
|
+
## Architecture
|
|
161
215
|
|
|
162
216
|
```
|
|
163
217
|
+-------------------------------------------------------------+
|
|
@@ -165,25 +219,43 @@ src/core/
|
|
|
165
219
|
+-------------------------------------------------------------+
|
|
166
220
|
| |
|
|
167
221
|
| +--------------+ +--------------+ +--------------+ |
|
|
168
|
-
| | AI Tool |--->| MCP Server |--->|
|
|
169
|
-
| | Claude/
|
|
222
|
+
| | AI Tool |--->| MCP Server |--->| Code | |
|
|
223
|
+
| | Claude/etc | | (stdio) | | Intelligence | |
|
|
170
224
|
| +--------------+ +--------------+ +--------------+ |
|
|
171
225
|
| | |
|
|
172
226
|
| +--------------------+--+----+ |
|
|
173
227
|
| | v | |
|
|
174
228
|
| +--------------+ +-----+----+ +------------------+| |
|
|
175
229
|
| | Your Code |--->| Indexer |--->| SQLite + Vec DB || |
|
|
176
|
-
| | (watched) | |
|
|
230
|
+
| | (watched) | | AST/Deps | | + Dep Graph || |
|
|
177
231
|
| +--------------+ +----------+ +------------------+| |
|
|
178
232
|
| | |
|
|
179
233
|
+-------------------------------------------------------------+
|
|
180
234
|
```
|
|
181
235
|
|
|
182
|
-
###
|
|
236
|
+
### Core Modules
|
|
183
237
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
238
|
+
```
|
|
239
|
+
src/core/
|
|
240
|
+
├── engine.ts # Main engine, coordinates everything
|
|
241
|
+
├── ghost-mode.ts # Proactive conflict detection
|
|
242
|
+
├── test-awareness/ # Test indexing & failure prediction
|
|
243
|
+
├── change-intelligence/ # Git tracking & impact analysis
|
|
244
|
+
├── architecture/ # Pattern library & validation
|
|
245
|
+
├── context-rot/ # Context health & compaction
|
|
246
|
+
├── living-docs/ # Architecture & changelog generation
|
|
247
|
+
└── refresh/ # Intelligent refresh system
|
|
248
|
+
|
|
249
|
+
src/storage/
|
|
250
|
+
├── tier1.ts # Hot cache (instant)
|
|
251
|
+
├── tier2.ts # SQLite + dependency graph (fast)
|
|
252
|
+
└── tier3.ts # Vector embeddings (semantic)
|
|
253
|
+
|
|
254
|
+
src/indexing/
|
|
255
|
+
├── ast.ts # Regex-based parsing (TS/JS/Python/Go/Rust/Java)
|
|
256
|
+
├── indexer.ts # File indexing + dependency building
|
|
257
|
+
└── embeddings.ts # Local embedding generation (MiniLM-L6)
|
|
258
|
+
```
|
|
187
259
|
|
|
188
260
|
---
|
|
189
261
|
|
|
@@ -236,21 +308,6 @@ Config locations:
|
|
|
236
308
|
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
237
309
|
- **Linux**: `~/.config/claude/claude_desktop_config.json`
|
|
238
310
|
|
|
239
|
-
### OpenCode
|
|
240
|
-
|
|
241
|
-
Add to `~/.opencode/config.json`:
|
|
242
|
-
|
|
243
|
-
```json
|
|
244
|
-
{
|
|
245
|
-
"mcpServers": {
|
|
246
|
-
"neuronlayer": {
|
|
247
|
-
"command": "npx",
|
|
248
|
-
"args": ["-y", "neuronlayer", "--project", "/path/to/your/project"]
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
```
|
|
253
|
-
|
|
254
311
|
---
|
|
255
312
|
|
|
256
313
|
## Data Storage
|
|
@@ -261,34 +318,36 @@ Each project has isolated data:
|
|
|
261
318
|
~/.memorylayer/
|
|
262
319
|
├── projects/
|
|
263
320
|
│ ├── project-a-abc123/
|
|
264
|
-
│ │ ├──
|
|
265
|
-
│ │ └── embeddings/
|
|
321
|
+
│ │ ├── neuronlayer.db # SQLite + dependency graph
|
|
322
|
+
│ │ └── embeddings/ # Vector index
|
|
266
323
|
│ └── project-b-def456/
|
|
267
324
|
│ └── ...
|
|
268
|
-
└── registry.json
|
|
325
|
+
└── registry.json # Project registry
|
|
269
326
|
```
|
|
270
327
|
|
|
271
328
|
---
|
|
272
329
|
|
|
273
|
-
## NeuronLayer vs
|
|
330
|
+
## NeuronLayer vs Other Tools
|
|
331
|
+
|
|
332
|
+
### vs grep/ripgrep
|
|
274
333
|
|
|
275
334
|
NeuronLayer **doesn't compete with grep** - Claude already has grep. They serve different purposes:
|
|
276
335
|
|
|
277
336
|
| grep does | NeuronLayer does |
|
|
278
337
|
|-----------|------------------|
|
|
279
|
-
| Text matching | **Semantic search** ("how does auth work
|
|
280
|
-
| Regex patterns | **
|
|
281
|
-
| Fast file search | **
|
|
282
|
-
| | **
|
|
283
|
-
| | **Context preservation** (survives conversation resets) |
|
|
338
|
+
| Text matching | **Semantic search** ("how does auth work?") |
|
|
339
|
+
| Regex patterns | **Dependency analysis** (what depends on this?) |
|
|
340
|
+
| Fast file search | **Impact prediction** (what breaks if I change this?) |
|
|
341
|
+
| | **Test awareness** (which tests cover this function?) |
|
|
284
342
|
|
|
285
|
-
|
|
286
|
-
- First-time indexing: ~28 seconds (one-time for new codebases)
|
|
287
|
-
- Subsequent sessions: Only changed files re-indexed (content hash check)
|
|
288
|
-
- Index persists in SQLite between sessions
|
|
343
|
+
### vs Simple Memory Tools
|
|
289
344
|
|
|
290
|
-
|
|
291
|
-
|
|
345
|
+
| Memory tools do | NeuronLayer does |
|
|
346
|
+
|-----------------|------------------|
|
|
347
|
+
| Store notes | **Parse code structure** |
|
|
348
|
+
| Keyword search | **Graph traversal** |
|
|
349
|
+
| Tag organization | **Circular dependency detection** |
|
|
350
|
+
| | **Test failure prediction** |
|
|
292
351
|
|
|
293
352
|
---
|
|
294
353
|
|
|
@@ -299,7 +358,8 @@ NeuronLayer is **100% local**:
|
|
|
299
358
|
- All data stored on your machine
|
|
300
359
|
- No cloud services
|
|
301
360
|
- No telemetry
|
|
302
|
-
-
|
|
361
|
+
- No LLM calls (pure code analysis)
|
|
362
|
+
- Works completely offline
|
|
303
363
|
|
|
304
364
|
---
|
|
305
365
|
|