neuronlayer 0.1.7 → 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,6 +1,8 @@
1
1
  # NeuronLayer
2
2
 
3
- **Persistent memory layer for AI coding assistants. Your codebase documents itself.**
3
+ **Persistent codebase understanding for AI assistants.**
4
+
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.
4
6
 
5
7
  [![npm version](https://img.shields.io/npm/v/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
6
8
  [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
@@ -9,216 +11,152 @@
9
11
 
10
12
  ---
11
13
 
12
- ## The Problem
13
-
14
- AI coding assistants are powerful but forgetful:
15
-
16
- - Context collapse - AI forgets mid-session
17
- - No persistent memory - every session starts fresh
18
- - Code duplication - AI doesn't know what already exists
19
- - Test breakage - AI suggestions break existing tests
14
+ ## What NeuronLayer Does
20
15
 
21
- ## The Solution
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
22
23
 
23
- NeuronLayer gives AI assistants persistent, intelligent memory:
24
-
25
- - **Decisions persist** - Architectural decisions survive across sessions
26
- - **Patterns learned** - AI knows your coding conventions
27
- - **Context preserved** - Smart compaction prevents forgetting
28
- - **Tests respected** - AI knows what tests exist
29
-
30
- ---
31
-
32
- ## Compatibility
33
-
34
- | Tool | Supported | Auto-Configure |
35
- |------|-----------|----------------|
36
- | Claude Desktop | Yes | `neuronlayer init` |
37
- | Claude Code (CLI) | Yes | `neuronlayer init` |
38
- | OpenCode | Yes | `neuronlayer init` |
39
- | VS Code + Continue | Yes | Manual config |
40
- | Cursor | Not yet | No MCP support |
41
- | Any MCP Client | Yes | Manual config |
24
+ All processing happens locally on your machine. No cloud services, no telemetry.
42
25
 
43
26
  ---
44
27
 
45
28
  ## Quick Start
46
29
 
47
- ### Installation
48
-
49
30
  ```bash
31
+ # Install
50
32
  npm install -g neuronlayer
51
- ```
52
33
 
53
- ### One-Command Setup
54
-
55
- ```bash
34
+ # Initialize in your project
56
35
  cd your-project
57
36
  neuronlayer init
58
37
  ```
59
38
 
60
- That's it! This automatically:
61
- 1. Registers your project
62
- 2. Configures Claude Desktop
63
- 3. Configures OpenCode
64
- 4. Configures Claude Code
65
-
66
- 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.
67
40
 
68
41
  ---
69
42
 
70
- ## MCP Tools
71
-
72
- NeuronLayer exposes **14 MCP tools** organized into 6 gateway tools and 8 standalone tools.
73
-
74
- ### Gateway Tools (Smart Routing)
75
-
76
- These are the main tools. Each routes to multiple internal capabilities based on input:
43
+ ## Supported AI Tools
77
44
 
78
- | Tool | Purpose |
79
- |------|---------|
80
- | `memory_query` | Search codebase, find code, look up symbols, get file context |
81
- | `memory_record` | Save decisions, learn patterns, record feedback, track features |
82
- | `memory_review` | Pre-code review: check patterns, conflicts, tests, get suggestions |
83
- | `memory_status` | Project overview, architecture, recent changes, health check |
84
- | `memory_ghost` | Proactive intelligence: conflicts, "you solved this before", session resume |
85
- | `memory_verify` | Pre-commit check: validate imports, security, dependencies |
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` |
86
53
 
87
- ### Standalone Tools
88
-
89
- | Tool | Purpose |
90
- |------|---------|
91
- | `memory_refresh` | **NEW** Trigger manual refresh after external changes (git pull) |
92
- | `get_refresh_status` | **NEW** Check idle tasks, activity status, git state |
93
- | `switch_project` | Switch between registered projects |
94
- | `switch_feature_context` | Resume work on a previous feature |
95
- | `trigger_compaction` | Reduce memory when context is full |
96
- | `update_decision_status` | Mark decisions as deprecated/superseded |
97
- | `export_decisions_to_adr` | Export decisions as ADR markdown files |
98
- | `discover_projects` | Find git repos on the system |
54
+ All tools share the same data - switch between them freely.
99
55
 
100
56
  ---
101
57
 
102
- ## Features
103
-
104
- ### What's Implemented
105
-
106
- | Feature | Status | Description |
107
- |---------|--------|-------------|
108
- | **Semantic Search** | Working | Find code by meaning using embeddings |
109
- | **Decision Recording** | Working | Log architectural decisions with context |
110
- | **Pattern Library** | Working | Learn and validate coding patterns |
111
- | **File Indexing** | Working | AST-based symbol extraction |
112
- | **Context Compaction** | Working | Smart summarization when context fills |
113
- | **Test Indexing** | Working | Index tests, predict failures |
114
- | **Git Integration** | Working | Track changes, correlate with decisions |
115
- | **Multi-Project** | Working | Switch between projects |
116
- | **Intelligent Refresh** | **NEW** | Smart sync with cheap pre-checks |
58
+ ## What You Can Ask
117
59
 
118
- ### Intelligent Refresh System (v0.1.4)
119
-
120
- NeuronLayer now includes a tiered refresh architecture that eliminates wasteful polling:
60
+ Once NeuronLayer is running, your AI assistant can:
121
61
 
62
+ **Understand dependencies:**
122
63
  ```
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
64
+ "What files depend on src/auth/login.ts?"
65
+ "Show me the import chain for this module"
141
66
  ```
142
67
 
143
- **Key optimization**: Instead of running expensive `git log` operations (~100ms+), we cache the HEAD commit and only sync when it changes (~5ms check).
68
+ **Analyze impact:**
69
+ ```
70
+ "If I change this file, what else might break?"
71
+ "What tests cover this function?"
72
+ ```
144
73
 
145
- ### Modules
74
+ **Find code:**
75
+ ```
76
+ "Find all authentication-related code"
77
+ "Where is the user validation logic?"
78
+ ```
146
79
 
80
+ **Check for issues:**
147
81
  ```
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
82
+ "Are there any circular dependencies?"
83
+ "What decisions have we made about authentication?"
156
84
  ```
157
85
 
158
86
  ---
159
87
 
160
88
  ## How It Works
161
89
 
162
- ```
163
- +-------------------------------------------------------------+
164
- | NEURONLAYER |
165
- +-------------------------------------------------------------+
166
- | |
167
- | +--------------+ +--------------+ +--------------+ |
168
- | | AI Tool |--->| MCP Server |--->| Memory | |
169
- | | Claude/Open | | (stdio) | | Engine | |
170
- | +--------------+ +--------------+ +--------------+ |
171
- | | |
172
- | +--------------------+--+----+ |
173
- | | v | |
174
- | +--------------+ +-----+----+ +------------------+| |
175
- | | Your Code |--->| Indexer |--->| SQLite + Vec DB || |
176
- | | (watched) | | (AST/Git)| | (embeddings) || |
177
- | +--------------+ +----------+ +------------------+| |
178
- | | |
179
- +-------------------------------------------------------------+
180
- ```
90
+ NeuronLayer watches your project and maintains:
91
+
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)
96
+
97
+ When your AI assistant asks a question, NeuronLayer provides the relevant context.
98
+
99
+ ---
100
+
101
+ ## Language Support
181
102
 
182
- ### Memory Tiers
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 |
183
110
 
184
- 1. **Tier 1** - Hot cache for active files (instant)
185
- 2. **Tier 2** - SQLite for decisions, patterns, history (fast)
186
- 3. **Tier 3** - Vector embeddings for semantic search (smart)
111
+ Parsing uses regex patterns, which works reliably across platforms but may miss edge cases in complex syntax.
187
112
 
188
113
  ---
189
114
 
190
115
  ## CLI Commands
191
116
 
192
117
  ```bash
193
- # Quick setup (auto-configures AI tools)
194
- neuronlayer init
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
125
+ ```
195
126
 
196
- # Initialize specific project
197
- neuronlayer init /path/to/project
127
+ ---
198
128
 
199
- # List all registered projects
200
- neuronlayer projects list
129
+ ## HTTP API
201
130
 
202
- # Add a new project
203
- neuronlayer projects add /path/to/my-project
131
+ For tools that don't support MCP, NeuronLayer provides a REST API:
204
132
 
205
- # Switch active project
206
- neuronlayer projects switch <id>
133
+ ```bash
134
+ neuronlayer serve --project /path/to/project --port 3333
135
+ ```
207
136
 
208
- # Export decisions to ADR files
209
- neuronlayer export --format madr
137
+ **Endpoints:**
210
138
 
211
- # Show help
212
- neuronlayer help
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 |
149
+
150
+ **Example:**
151
+ ```bash
152
+ curl "http://localhost:3333/impact?file=src/auth/login.ts"
213
153
  ```
214
154
 
215
155
  ---
216
156
 
217
157
  ## Manual Configuration
218
158
 
219
- ### Claude Desktop
220
-
221
- Add to `claude_desktop_config.json`:
159
+ If `neuronlayer init` doesn't work for your setup, add to your Claude Desktop config:
222
160
 
223
161
  ```json
224
162
  {
@@ -236,67 +174,26 @@ Config locations:
236
174
  - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
237
175
  - **Linux**: `~/.config/claude/claude_desktop_config.json`
238
176
 
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
177
  ---
255
178
 
256
179
  ## Data Storage
257
180
 
258
- Each project has isolated data:
181
+ Project data is stored locally:
259
182
 
260
183
  ```
261
184
  ~/.memorylayer/
262
185
  ├── projects/
263
- ├── project-a-abc123/
264
- ├── memorylayer.db # SQLite database
265
- └── embeddings/ # Vector index
266
- └── project-b-def456/
267
- │ └── ...
268
- └── registry.json # Project registry
186
+ └── your-project-abc123/
187
+ ├── neuronlayer.db # SQLite database
188
+ └── embeddings/ # Vector index
189
+ └── registry.json # Project list
269
190
  ```
270
191
 
271
192
  ---
272
193
 
273
- ## NeuronLayer vs grep
274
-
275
- NeuronLayer **doesn't compete with grep** - Claude already has grep. They serve different purposes:
276
-
277
- | grep does | NeuronLayer does |
278
- |-----------|------------------|
279
- | Text matching | **Semantic search** ("how does auth work here?") |
280
- | Regex patterns | **Persistent memory** (decisions survive across sessions) |
281
- | Fast file search | **Architectural awareness** (knows module relationships) |
282
- | | **Pattern learning** (learns your coding conventions) |
283
- | | **Context preservation** (survives conversation resets) |
284
-
285
- **Real-world indexing** (Express.js - 141 files, 21k LOC):
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
289
-
290
- **Use grep for:** "find all files containing `router`"
291
- **Use NeuronLayer for:** "how does the routing system work?" or "what decisions were made about authentication?"
292
-
293
- ---
294
-
295
194
  ## Privacy
296
195
 
297
- NeuronLayer is **100% local**:
298
-
299
- - All data stored on your machine
196
+ - All data stays on your machine
300
197
  - No cloud services
301
198
  - No telemetry
302
199
  - Works offline
@@ -306,32 +203,20 @@ NeuronLayer is **100% local**:
306
203
  ## Development
307
204
 
308
205
  ```bash
309
- # Clone
310
206
  git clone https://github.com/abhisavakar/neuronlayer.git
311
207
  cd neuronlayer
312
-
313
- # Install
314
208
  npm install
315
-
316
- # Build
317
209
  npm run build
318
-
319
- # Type check
320
- npm run typecheck
321
210
  ```
322
211
 
323
212
  ---
324
213
 
325
214
  ## License
326
215
 
327
- MIT License - see [LICENSE](LICENSE)
216
+ MIT - see [LICENSE](LICENSE)
328
217
 
329
218
  ---
330
219
 
331
- ## Author
332
-
333
- **Abhishek Arun Savakar** - [savakar.com](https://savakar.com)
334
-
335
- ---
220
+ **Author:** Abhishek Arun Savakar - [savakar.com](https://savakar.com)
336
221
 
337
222
  Built with [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic.