neuronlayer 0.1.8 → 0.1.9

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,8 +1,8 @@
1
1
  # NeuronLayer
2
2
 
3
- **Code intelligence layer disguised as memory.**
3
+ **Persistent codebase understanding for AI assistants.**
4
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.
5
+ NeuronLayer is an MCP server that indexes your codebase and gives AI assistants like Claude the ability to understand your project's structure, dependencies, and history across sessions.
6
6
 
7
7
  [![npm version](https://img.shields.io/npm/v/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
8
8
  [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
@@ -11,286 +11,152 @@ NeuronLayer isn't another memory tool. It's a code-intelligence layer that gives
11
11
 
12
12
  ---
13
13
 
14
- ## What Makes NeuronLayer Different
14
+ ## What NeuronLayer Does
15
15
 
16
- Most "memory tools" for AI are just note-taking with embeddings. NeuronLayer does something fundamentally different:
16
+ - **Indexes your code** - Extracts functions, classes, imports, and exports using regex parsing
17
+ - **Builds a dependency graph** - Tracks what files import what, transitively
18
+ - **Analyzes impact** - Shows which files are affected when you change something
19
+ - **Detects circular dependencies** - Finds import cycles in your codebase
20
+ - **Indexes tests** - Identifies test files and what source files they cover
21
+ - **Records decisions** - Stores architectural decisions that persist across sessions
22
+ - **Semantic search** - Find code by meaning using local embeddings
17
23
 
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
-
31
- ## The Problem
32
-
33
- AI coding assistants are powerful but blind:
34
-
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
39
-
40
- ## The Solution
41
-
42
- NeuronLayer gives AI assistants **persistent code intelligence**:
43
-
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
49
-
50
- ---
51
-
52
- ## Compatibility
53
-
54
- | Tool | Supported | Auto-Configure |
55
- |------|-----------|----------------|
56
- | Claude Desktop | Yes | `neuronlayer init` |
57
- | Claude Code (CLI) | Yes | `neuronlayer init` |
58
- | Cursor | Yes | Via MCP support |
59
- | OpenCode | Yes | `neuronlayer init` |
60
- | VS Code + Continue | Yes | Manual config |
61
- | Any MCP Client | Yes | Manual config |
24
+ All processing happens locally on your machine. No cloud services, no telemetry.
62
25
 
63
26
  ---
64
27
 
65
28
  ## Quick Start
66
29
 
67
- ### Installation
68
-
69
30
  ```bash
31
+ # Install
70
32
  npm install -g neuronlayer
71
- ```
72
33
 
73
- ### One-Command Setup
74
-
75
- ```bash
34
+ # Initialize in your project
76
35
  cd your-project
77
36
  neuronlayer init
78
37
  ```
79
38
 
80
- That's it! This automatically:
81
- 1. Registers your project
82
- 2. Configures Claude Desktop, Claude Code, and OpenCode
83
- 3. Indexes your codebase (symbol extraction, dependency graph, tests)
84
-
85
- Just restart your AI tool and NeuronLayer is active.
39
+ This registers your project and configures Claude Desktop, Claude Code, and OpenCode automatically. Restart your AI tool and you're ready.
86
40
 
87
41
  ---
88
42
 
89
- ## Code Intelligence Features
43
+ ## Supported AI Tools
90
44
 
91
- ### Dependency Graph
45
+ | Tool | Setup |
46
+ |------|-------|
47
+ | Claude Desktop | `neuronlayer init` (auto) |
48
+ | Claude Code (CLI) | `neuronlayer init` (auto) |
49
+ | Cursor | `neuronlayer init` (auto) |
50
+ | OpenCode | `neuronlayer init` (auto) |
51
+ | Any MCP Client | Manual config |
52
+ | **Any tool (HTTP)** | `neuronlayer serve` |
92
53
 
93
- NeuronLayer builds a complete dependency graph of your codebase:
54
+ All tools share the same data - switch between them freely.
94
55
 
95
- ```
96
- src/auth/login.ts
97
- ├── imports: ./utils, ../api/client, ./types
98
- └── imported by: src/pages/auth.tsx, src/hooks/useAuth.ts
99
- ```
56
+ ---
100
57
 
101
- ### Impact Analysis
58
+ ## What You Can Ask
102
59
 
103
- Before making changes, the AI can ask "what's the blast radius?"
60
+ Once NeuronLayer is running, your AI assistant can:
104
61
 
62
+ **Understand dependencies:**
105
63
  ```
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
64
+ "What files depend on src/auth/login.ts?"
65
+ "Show me the import chain for this module"
113
66
  ```
114
67
 
115
- ### Circular Dependency Detection
116
-
117
- Automatically finds import cycles that cause subtle bugs:
118
-
68
+ **Analyze impact:**
119
69
  ```
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
70
+ "If I change this file, what else might break?"
71
+ "What tests cover this function?"
125
72
  ```
126
73
 
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:
74
+ **Find code:**
75
+ ```
76
+ "Find all authentication-related code"
77
+ "Where is the user validation logic?"
78
+ ```
138
79
 
80
+ **Check for issues:**
139
81
  ```
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
82
+ "Are there any circular dependencies?"
83
+ "What decisions have we made about authentication?"
144
84
  ```
145
85
 
146
86
  ---
147
87
 
148
- ## MCP Tools
88
+ ## How It Works
149
89
 
150
- ### Gateway Tools (Smart Routing)
90
+ NeuronLayer watches your project and maintains:
151
91
 
152
- | Tool | Purpose |
153
- |------|---------|
154
- | `memory_query` | Search codebase, find code, look up symbols, get file context |
155
- | `memory_record` | Save decisions, learn patterns, record feedback, track features |
156
- | `memory_review` | Pre-code review: check patterns, conflicts, tests, get suggestions |
157
- | `memory_status` | Project overview, architecture, recent changes, health check |
158
- | `memory_ghost` | Proactive intelligence: conflicts, "you solved this before", session resume |
159
- | `memory_verify` | Pre-commit check: validate imports, security, dependencies |
92
+ 1. **Symbol index** - Functions, classes, imports, exports
93
+ 2. **Dependency graph** - File-to-file import relationships
94
+ 3. **Decision log** - Architectural decisions you've recorded
95
+ 4. **Embeddings** - For semantic search (using MiniLM-L6 locally)
160
96
 
161
- ### Code Intelligence Tools
162
-
163
- | Tool | Purpose |
164
- |------|---------|
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 |
175
- | `switch_project` | Switch between registered projects |
176
- | `trigger_compaction` | Reduce memory when context is full |
177
- | `export_decisions_to_adr` | Export decisions as ADR markdown files |
97
+ When your AI assistant asks a question, NeuronLayer provides the relevant context.
178
98
 
179
99
  ---
180
100
 
181
101
  ## Language Support
182
102
 
183
- All languages use regex-based parsing for reliable cross-platform support.
103
+ | Language | What's Extracted |
104
+ |----------|------------------|
105
+ | TypeScript/JavaScript | Functions, classes, imports, exports |
106
+ | Python | Functions, classes, imports |
107
+ | Go | Functions, structs, imports |
108
+ | Rust | Functions, structs, imports |
109
+ | Java | Classes, methods, imports |
184
110
 
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 |
111
+ Parsing uses regex patterns, which works reliably across platforms but may miss edge cases in complex syntax.
192
112
 
193
113
  ---
194
114
 
195
- ## Features
196
-
197
- | Feature | Status | Description |
198
- |---------|--------|-------------|
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) |
204
- | **Decision Recording** | Working | Log architectural decisions with context |
205
- | **Pattern Library** | Working | Learn and validate coding patterns |
206
- | **Symbol Extraction** | Working | Extract functions, classes, imports via regex |
207
- | **Context Compaction** | Working | Smart summarization when context fills |
208
- | **Git Integration** | Working | Track changes, correlate with decisions |
209
- | **Multi-Project** | Working | Switch between projects seamlessly |
210
- | **Impact Warnings** | Working | Real-time notifications on file changes |
211
-
212
- ---
213
-
214
- ## Architecture
215
-
216
- ```
217
- +-------------------------------------------------------------+
218
- | NEURONLAYER |
219
- +-------------------------------------------------------------+
220
- | |
221
- | +--------------+ +--------------+ +--------------+ |
222
- | | AI Tool |--->| MCP Server |--->| Code | |
223
- | | Claude/etc | | (stdio) | | Intelligence | |
224
- | +--------------+ +--------------+ +--------------+ |
225
- | | |
226
- | +--------------------+--+----+ |
227
- | | v | |
228
- | +--------------+ +-----+----+ +------------------+| |
229
- | | Your Code |--->| Indexer |--->| SQLite + Vec DB || |
230
- | | (watched) | | AST/Deps | | + Dep Graph || |
231
- | +--------------+ +----------+ +------------------+| |
232
- | | |
233
- +-------------------------------------------------------------+
234
- ```
235
-
236
- ### Core Modules
115
+ ## CLI Commands
237
116
 
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)
117
+ ```bash
118
+ neuronlayer init # Set up project + configure AI tools
119
+ neuronlayer serve # Start HTTP API server
120
+ neuronlayer projects list # List registered projects
121
+ neuronlayer projects add . # Add current directory
122
+ neuronlayer projects switch # Switch active project
123
+ neuronlayer export # Export decisions to ADR files
124
+ neuronlayer help # Show help
258
125
  ```
259
126
 
260
127
  ---
261
128
 
262
- ## CLI Commands
263
-
264
- ```bash
265
- # Quick setup (auto-configures AI tools)
266
- neuronlayer init
129
+ ## HTTP API
267
130
 
268
- # Initialize specific project
269
- neuronlayer init /path/to/project
131
+ For tools that don't support MCP, NeuronLayer provides a REST API:
270
132
 
271
- # List all registered projects
272
- neuronlayer projects list
273
-
274
- # Add a new project
275
- neuronlayer projects add /path/to/my-project
133
+ ```bash
134
+ neuronlayer serve --project /path/to/project --port 3333
135
+ ```
276
136
 
277
- # Switch active project
278
- neuronlayer projects switch <id>
137
+ **Endpoints:**
279
138
 
280
- # Export decisions to ADR files
281
- neuronlayer export --format madr
139
+ | Method | Endpoint | Description |
140
+ |--------|----------|-------------|
141
+ | GET | `/status` | Project stats |
142
+ | GET | `/search?q=...` | Semantic code search |
143
+ | GET | `/dependencies?file=...` | File dependencies |
144
+ | GET | `/impact?file=...` | Impact analysis |
145
+ | GET | `/circular` | Find circular deps |
146
+ | GET | `/decisions` | List decisions |
147
+ | POST | `/decisions` | Record a decision |
148
+ | GET | `/symbols?file=...` | Get file symbols |
282
149
 
283
- # Show help
284
- neuronlayer help
150
+ **Example:**
151
+ ```bash
152
+ curl "http://localhost:3333/impact?file=src/auth/login.ts"
285
153
  ```
286
154
 
287
155
  ---
288
156
 
289
157
  ## Manual Configuration
290
158
 
291
- ### Claude Desktop
292
-
293
- Add to `claude_desktop_config.json`:
159
+ If `neuronlayer init` doesn't work for your setup, add to your Claude Desktop config:
294
160
 
295
161
  ```json
296
162
  {
@@ -312,86 +178,45 @@ Config locations:
312
178
 
313
179
  ## Data Storage
314
180
 
315
- Each project has isolated data:
181
+ Project data is stored locally:
316
182
 
317
183
  ```
318
184
  ~/.memorylayer/
319
185
  ├── projects/
320
- ├── project-a-abc123/
321
- ├── neuronlayer.db # SQLite + dependency graph
322
- └── embeddings/ # Vector index
323
- └── project-b-def456/
324
- │ └── ...
325
- └── registry.json # Project registry
186
+ └── your-project-abc123/
187
+ ├── neuronlayer.db # SQLite database
188
+ └── embeddings/ # Vector index
189
+ └── registry.json # Project list
326
190
  ```
327
191
 
328
192
  ---
329
193
 
330
- ## NeuronLayer vs Other Tools
331
-
332
- ### vs grep/ripgrep
333
-
334
- NeuronLayer **doesn't compete with grep** - Claude already has grep. They serve different purposes:
335
-
336
- | grep does | NeuronLayer does |
337
- |-----------|------------------|
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?) |
342
-
343
- ### vs Simple Memory Tools
344
-
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** |
351
-
352
- ---
353
-
354
194
  ## Privacy
355
195
 
356
- NeuronLayer is **100% local**:
357
-
358
- - All data stored on your machine
196
+ - All data stays on your machine
359
197
  - No cloud services
360
198
  - No telemetry
361
- - No LLM calls (pure code analysis)
362
- - Works completely offline
199
+ - Works offline
363
200
 
364
201
  ---
365
202
 
366
203
  ## Development
367
204
 
368
205
  ```bash
369
- # Clone
370
206
  git clone https://github.com/abhisavakar/neuronlayer.git
371
207
  cd neuronlayer
372
-
373
- # Install
374
208
  npm install
375
-
376
- # Build
377
209
  npm run build
378
-
379
- # Type check
380
- npm run typecheck
381
210
  ```
382
211
 
383
212
  ---
384
213
 
385
214
  ## License
386
215
 
387
- MIT License - see [LICENSE](LICENSE)
216
+ MIT - see [LICENSE](LICENSE)
388
217
 
389
218
  ---
390
219
 
391
- ## Author
392
-
393
- **Abhishek Arun Savakar** - [savakar.com](https://savakar.com)
394
-
395
- ---
220
+ **Author:** Abhishek Arun Savakar - [savakar.com](https://savakar.com)
396
221
 
397
222
  Built with [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic.