neuronlayer 0.1.0 → 1.1.0

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.
Files changed (78) hide show
  1. package/README.md +203 -123
  2. package/dist/index.js +635 -710
  3. package/dist/index.js.map +7 -0
  4. package/package.json +67 -63
  5. package/CONTRIBUTING.md +0 -127
  6. package/esbuild.config.js +0 -26
  7. package/src/cli/commands.ts +0 -382
  8. package/src/core/adr-exporter.ts +0 -253
  9. package/src/core/architecture/architecture-enforcement.ts +0 -228
  10. package/src/core/architecture/duplicate-detector.ts +0 -288
  11. package/src/core/architecture/index.ts +0 -6
  12. package/src/core/architecture/pattern-learner.ts +0 -306
  13. package/src/core/architecture/pattern-library.ts +0 -403
  14. package/src/core/architecture/pattern-validator.ts +0 -324
  15. package/src/core/change-intelligence/bug-correlator.ts +0 -444
  16. package/src/core/change-intelligence/change-intelligence.ts +0 -221
  17. package/src/core/change-intelligence/change-tracker.ts +0 -334
  18. package/src/core/change-intelligence/fix-suggester.ts +0 -340
  19. package/src/core/change-intelligence/index.ts +0 -5
  20. package/src/core/code-verifier.ts +0 -843
  21. package/src/core/confidence/confidence-scorer.ts +0 -251
  22. package/src/core/confidence/conflict-checker.ts +0 -289
  23. package/src/core/confidence/index.ts +0 -5
  24. package/src/core/confidence/source-tracker.ts +0 -263
  25. package/src/core/confidence/warning-detector.ts +0 -241
  26. package/src/core/context-rot/compaction.ts +0 -284
  27. package/src/core/context-rot/context-health.ts +0 -243
  28. package/src/core/context-rot/context-rot-prevention.ts +0 -213
  29. package/src/core/context-rot/critical-context.ts +0 -221
  30. package/src/core/context-rot/drift-detector.ts +0 -255
  31. package/src/core/context-rot/index.ts +0 -7
  32. package/src/core/context.ts +0 -263
  33. package/src/core/decision-extractor.ts +0 -339
  34. package/src/core/decisions.ts +0 -69
  35. package/src/core/deja-vu.ts +0 -421
  36. package/src/core/engine.ts +0 -1455
  37. package/src/core/feature-context.ts +0 -726
  38. package/src/core/ghost-mode.ts +0 -412
  39. package/src/core/learning.ts +0 -485
  40. package/src/core/living-docs/activity-tracker.ts +0 -296
  41. package/src/core/living-docs/architecture-generator.ts +0 -428
  42. package/src/core/living-docs/changelog-generator.ts +0 -348
  43. package/src/core/living-docs/component-generator.ts +0 -230
  44. package/src/core/living-docs/doc-engine.ts +0 -110
  45. package/src/core/living-docs/doc-validator.ts +0 -282
  46. package/src/core/living-docs/index.ts +0 -8
  47. package/src/core/project-manager.ts +0 -297
  48. package/src/core/summarizer.ts +0 -267
  49. package/src/core/test-awareness/change-validator.ts +0 -499
  50. package/src/core/test-awareness/index.ts +0 -5
  51. package/src/index.ts +0 -49
  52. package/src/indexing/ast.ts +0 -563
  53. package/src/indexing/embeddings.ts +0 -85
  54. package/src/indexing/indexer.ts +0 -245
  55. package/src/indexing/watcher.ts +0 -78
  56. package/src/server/gateways/aggregator.ts +0 -374
  57. package/src/server/gateways/index.ts +0 -473
  58. package/src/server/gateways/memory-ghost.ts +0 -343
  59. package/src/server/gateways/memory-query.ts +0 -452
  60. package/src/server/gateways/memory-record.ts +0 -346
  61. package/src/server/gateways/memory-review.ts +0 -410
  62. package/src/server/gateways/memory-status.ts +0 -517
  63. package/src/server/gateways/memory-verify.ts +0 -392
  64. package/src/server/gateways/router.ts +0 -434
  65. package/src/server/gateways/types.ts +0 -610
  66. package/src/server/mcp.ts +0 -154
  67. package/src/server/resources.ts +0 -85
  68. package/src/server/tools.ts +0 -2261
  69. package/src/storage/database.ts +0 -262
  70. package/src/storage/tier1.ts +0 -135
  71. package/src/storage/tier2.ts +0 -764
  72. package/src/storage/tier3.ts +0 -123
  73. package/src/types/documentation.ts +0 -619
  74. package/src/types/index.ts +0 -222
  75. package/src/utils/config.ts +0 -193
  76. package/src/utils/files.ts +0 -117
  77. package/src/utils/time.ts +0 -37
  78. package/src/utils/tokens.ts +0 -52
package/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # MemoryLayer
1
+ # NeuronLayer
2
2
 
3
- **Persistent memory layer for AI coding assistants. Your codebase documents itself.**
3
+ **Turn any AI coding assistant into an intelligent one.**
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/neuronlayer.svg)](https://www.npmjs.com/package/neuronlayer)
5
6
  [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
6
7
  [![Node.js](https://img.shields.io/badge/Node.js-18+-339933.svg)](https://nodejs.org/)
7
8
  [![MCP](https://img.shields.io/badge/MCP-Compatible-blue.svg)](https://modelcontextprotocol.io/)
@@ -23,7 +24,7 @@ AI coding assistants are powerful but forgetful:
23
24
 
24
25
  ## The Solution
25
26
 
26
- MemoryLayer gives AI assistants persistent, intelligent memory:
27
+ NeuronLayer gives AI assistants persistent, intelligent memory:
27
28
 
28
29
  - **Never forget context** - Decisions, patterns, and history persist across sessions
29
30
  - **Self-documenting codebase** - Architecture docs generate automatically
@@ -33,27 +34,17 @@ MemoryLayer gives AI assistants persistent, intelligent memory:
33
34
 
34
35
  ---
35
36
 
36
- ## Features
37
-
38
- ### Core Features (Free)
39
-
40
- | Feature | Description |
41
- |---------|-------------|
42
- | **Semantic Search** | Find code by meaning, not just keywords |
43
- | **Decision Recording** | Log architectural decisions with context |
44
- | **Pattern Library** | Learn and enforce coding patterns |
45
- | **File Indexing** | AST-based symbol extraction |
37
+ ## Compatibility
46
38
 
47
- ### Advanced Features
48
-
49
- | Feature | Description |
50
- |---------|-------------|
51
- | **Living Documentation** | Auto-generated architecture docs |
52
- | **Context Rot Prevention** | Smart compaction keeps AI focused |
53
- | **Confidence Scoring** | Know when AI is guessing vs confident |
54
- | **Change Intelligence** | "What changed?" and "Why did it break?" |
55
- | **Architecture Enforcement** | Suggest existing functions, prevent duplication |
56
- | **Test-Aware Suggestions** | Predict test failures before they happen |
39
+ | Tool | Supported | Auto-Configure |
40
+ |------|-----------|----------------|
41
+ | **memcode (Built-in agent)** | Yes | *N/A (Native)* |
42
+ | Claude Desktop | Yes | `neuronlayer init` |
43
+ | Claude Code (CLI) | Yes | `neuronlayer init` |
44
+ | OpenCode | Yes | `neuronlayer init` |
45
+ | VS Code + Continue | Yes | Manual config |
46
+ | Cursor | Not yet | No MCP support |
47
+ | Any MCP Client | Yes | Manual config |
57
48
 
58
49
  ---
59
50
 
@@ -62,50 +53,127 @@ MemoryLayer gives AI assistants persistent, intelligent memory:
62
53
  ### Installation
63
54
 
64
55
  ```bash
65
- npm install -g memory-layer
56
+ npm install -g neuronlayer
57
+ ```
58
+
59
+ ### One-Command Setup
60
+
61
+ ```bash
62
+ cd your-project
63
+ neuronlayer init
64
+ ```
65
+
66
+ That's it! This automatically:
67
+ 1. Registers your project
68
+ 2. Configures Claude Desktop
69
+ 3. Configures OpenCode
70
+ 4. Configures Claude Code
71
+
72
+ Just restart your AI tool and NeuronLayer is active.
73
+
74
+ ### Output
75
+
66
76
  ```
77
+ NeuronLayer initialized!
67
78
 
68
- ### Usage with Claude Desktop
79
+ Project: my-project
80
+ Path: /home/user/my-project
81
+ Data: ~/.neuronlayer/projects/my-project-abc123
69
82
 
70
- Add to your Claude Desktop config (`claude_desktop_config.json`):
83
+ Configured MCP Clients:
84
+ ✓ Claude Desktop: ~/.config/claude/claude_desktop_config.json
85
+ ✓ OpenCode: ~/.opencode/config.json
86
+ ✓ Claude Code: ~/.claude.json
87
+
88
+ Restart your AI tools to activate.
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Manual Configuration
94
+
95
+ If you prefer manual setup or use a different MCP client:
96
+
97
+ ### Claude Desktop
98
+
99
+ Add to `claude_desktop_config.json`:
71
100
 
72
101
  ```json
73
102
  {
74
103
  "mcpServers": {
75
- "memorylayer": {
104
+ "neuronlayer": {
76
105
  "command": "npx",
77
- "args": ["-y", "memory-layer", "--project", "/path/to/your/project"]
106
+ "args": ["-y", "neuronlayer", "--project", "/path/to/your/project"]
78
107
  }
79
108
  }
80
109
  }
81
110
  ```
82
111
 
83
- ### Usage with Any MCP Client
112
+ Config locations:
113
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
114
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
115
+ - **Linux**: `~/.config/claude/claude_desktop_config.json`
84
116
 
85
- ```bash
86
- # Start the MCP server
87
- memorylayer --project /path/to/your/project
117
+ ### OpenCode
118
+
119
+ Add to `~/.opencode/config.json`:
120
+
121
+ ```json
122
+ {
123
+ "mcpServers": {
124
+ "neuronlayer": {
125
+ "command": "npx",
126
+ "args": ["-y", "neuronlayer", "--project", "/path/to/your/project"]
127
+ }
128
+ }
129
+ }
88
130
  ```
89
131
 
90
132
  ---
91
133
 
134
+ ## Features
135
+
136
+ ### Core Features
137
+
138
+ | Feature | Description |
139
+ |---------|-------------|
140
+ | **Semantic Search** | Find code by meaning, not just keywords |
141
+ | **Decision Recording** | Log architectural decisions with context |
142
+ | **Pattern Library** | Learn and enforce coding patterns |
143
+ | **File Indexing** | Symbol extraction for TS/JS/Python |
144
+
145
+ ### Advanced Features
146
+
147
+ | Feature | Description |
148
+ |---------|-------------|
149
+ | **Living Documentation** | Auto-generated architecture docs |
150
+ | **Context Rot Prevention** | Smart compaction keeps AI focused |
151
+ | **Confidence Scoring** | Know when AI is guessing vs confident |
152
+ | **Change Intelligence** | "What changed?" and "Why did it break?" |
153
+ | **Architecture Enforcement** | Suggest existing functions, prevent duplication |
154
+ | **Test-Aware Suggestions** | Predict test failures before they happen |
155
+ | **Super Intelligent Brain (Ghost Mode)** | Proactively checks for conflicts, déjà vu, and session context |
156
+ | **Pre-commit Quality Gate** | Validates AI-generated code against hallucination and patterns BEFORE commit |
157
+
158
+ ---
159
+
92
160
  ## How It Works
93
161
 
94
162
  ```
95
163
  +-------------------------------------------------------------+
96
- | MEMORYLAYER |
164
+ | NEURONLAYER |
97
165
  +-------------------------------------------------------------+
98
166
  | |
99
167
  | +--------------+ +--------------+ +--------------+ |
100
168
  | | AI Tool |--->| MCP Server |--->| Memory | |
101
- | | (Claude etc) | | (stdio) | | Engine | |
169
+ | | Claude/Open | | (stdio) | | Engine | |
102
170
  | +--------------+ +--------------+ +--------------+ |
103
171
  | | |
104
172
  | +--------------------+--+----+ |
105
173
  | | v | |
106
174
  | +--------------+ +-----+----+ +------------------+| |
107
175
  | | Your Code |--->| Indexer |--->| SQLite + Vec DB || |
108
- | | (watched) | | (AST/Git)| | (embeddings) || |
176
+ | | (watched) | | (Regex) | | (embeddings) || |
109
177
  | +--------------+ +----------+ +------------------+| |
110
178
  | | |
111
179
  +-------------------------------------------------------------+
@@ -119,88 +187,116 @@ memorylayer --project /path/to/your/project
119
187
 
120
188
  ---
121
189
 
122
- ## MCP Tools
190
+ ## MCP Tools (The Gateway Architecture)
123
191
 
124
- MemoryLayer exposes 25+ MCP tools:
192
+ NeuronLayer elegantly compresses 51+ granular internal functions into **12 optimized Gateway Tools**, dramatically saving prompt tokens and improving LLM routing reliability (proven 759x faster than standard grep).
125
193
 
126
- ### Query & Search
127
- - `memory_query` - Semantic search across codebase
128
- - `memory_status` - Project overview and health
194
+ ### 6 Core Gateways
195
+ - `memory_query` - Semantic search, symbol lookup, and focused context retrieval.
196
+ - `memory_record` - Save architectural decisions, patterns, and feedback.
197
+ - `memory_review` - Pre-flight check before code changes vs patterns & decisions.
198
+ - `memory_status` - Project overview, architecture diagrams, and health checks.
199
+ - `memory_ghost` - The "Super Intelligent Brain": flags conflicts, déjà vu, and session resurrection.
200
+ - `memory_verify` - Pre-commit quality gate for AI-generated code (hallucinations, imports, security, tests).
129
201
 
130
- ### Recording
131
- - `memory_record` - Save decisions, patterns, feedback
132
- - `memory_review` - Pre-flight check before code changes
133
- - `memory_verify` - Validate AI-generated code
202
+ ### 6 Standalone Commands
203
+ - `switch_project` - Hot-swap active project context.
204
+ - `switch_feature_context` - Resume tracking an ongoing feature.
205
+ - `trigger_compaction` - Smart compression of context tree.
206
+ - `update_decision_status` - Mark architectural choices as deprecated/superseded.
207
+ - `export_decisions_to_adr` - Generate markdown Architecture Decision Records (ADRs).
208
+ - `discover_projects` - Find eligible Git repositories on disk.
134
209
 
135
- ### Ghost Mode (AI-Proactive)
136
- - `memory_ghost` - Conflicts, deja vu, session resurrection
210
+ ---
137
211
 
138
- ### Living Documentation
139
- - `get_architecture` - Project structure overview
140
- - `get_changelog` - Recent changes with context
141
- - `what_happened` - "What did we do yesterday?"
212
+ ## 🤖 memcode - The First-Party AI Coding Assistant
142
213
 
143
- ### Architecture Enforcement
144
- - `validate_pattern` - Check code against patterns
145
- - `suggest_existing` - Find reusable functions
146
- - `learn_pattern` - Teach new patterns
214
+ NeuronLayer powers its own fully-featured terminal coding agent: **memcode**.
215
+ It natively understands NeuronLayer's context graph and avoids context rot.
147
216
 
148
- ### Test Awareness
149
- - `get_related_tests` - Tests for a file/function
150
- - `check_tests` - Predict test failures
151
- - `suggest_test_update` - Test update suggestions
217
+ ### Quick Start
218
+ ```bash
219
+ # Set your preferred API key
220
+ export ANTHROPIC_API_KEY=your-key
152
221
 
153
- ---
222
+ # Run memcode inside your project
223
+ npx neuronlayer memcode
224
+ ```
225
+
226
+ ### memcode Features
227
+ - **Multi-LLM Support**: Claude (Anthropic), all GPT/o1 (OpenAI), 200+ models via OpenRouter, and Local LLMs (Ollama).
228
+ - **Persistent Memory**: Decisions and patterns automatically persist across your chat sessions.
229
+ - **Full Shell & Git access**: Runs commands, tests, and edits files directly in your sandbox.
230
+ - **Session Lifecycles**: Save and resume conversations exactly where you left them.
154
231
 
155
- ## Configuration
232
+ ### Interactive Commands
233
+ Inside a `memcode` session, use:
234
+ - `/model [name]` - Hot-swap LLMs.
235
+ - `/feature [name]` - Track a specific feature area.
236
+ - `/cost` - Track precise token usage and cost.
237
+ - `/save` & `/continue` - Session management.
156
238
 
157
- MemoryLayer stores data in:
158
- - **Windows**: `%APPDATA%\.memorylayer\<project-hash>\`
159
- - **macOS/Linux**: `~/.memorylayer/<project-hash>/`
239
+ ---
160
240
 
161
- ### CLI Commands
241
+ ## CLI Commands
162
242
 
163
243
  ```bash
164
- # List all indexed projects
165
- memorylayer projects
244
+ # Quick setup (auto-configures Claude Desktop, OpenCode)
245
+ neuronlayer init
166
246
 
167
- # Export decisions as ADRs
168
- memorylayer export --format adr --output ./docs/decisions
247
+ # Run the native AI Coding Assistant
248
+ neuronlayer memcode
249
+
250
+ # List all registered projects
251
+ neuronlayer projects list
252
+
253
+ # Add a new project
254
+ neuronlayer projects add /path/to/my-project
255
+
256
+ # Switch active project
257
+ neuronlayer projects switch <id>
258
+
259
+ # Export decisions to ADR files
260
+ neuronlayer export --format madr
261
+
262
+ # Discover projects in common locations
263
+ neuronlayer projects discover
169
264
 
170
265
  # Show help
171
- memorylayer help
266
+ neuronlayer help
172
267
  ```
173
268
 
174
269
  ---
175
270
 
176
- ## Architecture
271
+ ## Data Storage
272
+
273
+ NeuronLayer stores project data separately for each project:
177
274
 
178
275
  ```
179
- src/
180
- ├── core/ # Business logic
181
- │ ├── engine.ts # Main orchestrator
182
- │ ├── living-docs/ # Auto-documentation
183
- ├── context-rot/ # Context health management
184
- ├── confidence/ # Trust scoring
185
- ├── change-intelligence/ # What changed & why
186
- ├── architecture/ # Pattern enforcement
187
- └── test-awareness/ # Test-respecting suggestions
188
- ├── server/
189
- │ ├── mcp.ts # MCP protocol handler
190
- │ ├── tools.ts # Tool definitions
191
- │ └── gateways/ # Unified tool APIs
192
- ├── storage/
193
- │ ├── tier1.ts # Hot cache
194
- │ ├── tier2.ts # SQLite storage
195
- │ └── tier3.ts # Vector embeddings
196
- ├── indexing/
197
- │ ├── indexer.ts # File indexing
198
- │ ├── ast.ts # AST parsing
199
- │ ├── embeddings.ts # Embedding generation
200
- │ └── watcher.ts # File watching
201
- └── types/ # TypeScript definitions
276
+ ~/.neuronlayer/
277
+ ├── projects/
278
+ │ ├── project-a-abc123/
279
+ ├── neuronlayer.db # SQLite database
280
+ │ └── embeddings/ # Vector index
281
+ └── project-b-def456/
282
+ ├── neuronlayer.db
283
+ └── embeddings/
284
+ └── registry.json # Project registry
202
285
  ```
203
286
 
287
+ Each project is isolated - no data mixing between projects.
288
+
289
+ ---
290
+
291
+ ## Privacy
292
+
293
+ NeuronLayer is **100% local by default**:
294
+
295
+ - All data stored on your machine
296
+ - No cloud services required
297
+ - No telemetry or tracking
298
+ - Works completely offline
299
+
204
300
  ---
205
301
 
206
302
  ## Development
@@ -214,8 +310,8 @@ src/
214
310
 
215
311
  ```bash
216
312
  # Clone the repository
217
- git clone https://github.com/anthropics/memorylayer.git
218
- cd memorylayer
313
+ git clone https://github.com/abhisavakar/neuronlayer.git
314
+ cd neuronlayer
219
315
 
220
316
  # Install dependencies
221
317
  npm install
@@ -230,29 +326,6 @@ npm test
230
326
  npm run typecheck
231
327
  ```
232
328
 
233
- ### Scripts
234
-
235
- | Script | Description |
236
- |--------|-------------|
237
- | `npm run build` | Build the project |
238
- | `npm run dev` | Development mode with watch |
239
- | `npm run test` | Run tests |
240
- | `npm run typecheck` | Type check without building |
241
- | `npm run benchmark` | Run performance benchmarks |
242
-
243
- ---
244
-
245
- ## Privacy
246
-
247
- MemoryLayer is **100% local by default**:
248
-
249
- - All data stored on your machine
250
- - No cloud services required
251
- - No telemetry or tracking
252
- - Works offline
253
-
254
- Optional cloud features (coming soon) will use your own infrastructure.
255
-
256
329
  ---
257
330
 
258
331
  ## Contributing
@@ -261,11 +334,11 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
261
334
 
262
335
  ### Areas We Need Help
263
336
 
264
- - Additional language support (Python, Go, Rust AST)
337
+ - Additional language support (Go, Rust, Java)
265
338
  - IDE extensions (VS Code, JetBrains)
339
+ - Cursor integration (when they add MCP support)
266
340
  - Documentation improvements
267
341
  - Performance optimizations
268
- - Bug fixes and test coverage
269
342
 
270
343
  ---
271
344
 
@@ -278,9 +351,11 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
278
351
  - [x] Change Intelligence
279
352
  - [x] Architecture Enforcement
280
353
  - [x] Test-Aware Suggestions
354
+ - [x] Auto-setup for Claude Desktop
355
+ - [x] Auto-setup for OpenCode
281
356
  - [ ] VS Code extension
357
+ - [ ] Cursor support (pending MCP)
282
358
  - [ ] Team features (shared memory)
283
- - [ ] Enterprise deployment (AWS Bedrock)
284
359
 
285
360
  ---
286
361
 
@@ -290,16 +365,21 @@ MIT License - see [LICENSE](LICENSE) for details.
290
365
 
291
366
  ---
292
367
 
368
+ ## Author
369
+
370
+ **Abhishek Arun Savakar** - [savakar.com](https://savakar.com)
371
+
372
+ ---
373
+
293
374
  ## Acknowledgments
294
375
 
295
376
  Built with:
296
377
  - [Model Context Protocol](https://modelcontextprotocol.io/) by Anthropic
297
378
  - [better-sqlite3](https://github.com/WiseLibs/better-sqlite3)
298
- - [tree-sitter](https://tree-sitter.github.io/tree-sitter/) for AST parsing
299
379
  - [Xenova/transformers](https://github.com/xenova/transformers.js) for embeddings
300
380
 
301
381
  ---
302
382
 
303
383
  **Made with determination over a weekend.**
304
384
 
305
- *Your codebase documents itself. AI that never forgets.*
385
+ *Code intelligence that transforms AI assistants into intelligent coding partners.*