neuralmind 0.1.0__tar.gz
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.
- neuralmind-0.1.0/.gitignore +47 -0
- neuralmind-0.1.0/LICENSE +21 -0
- neuralmind-0.1.0/PKG-INFO +356 -0
- neuralmind-0.1.0/README.md +305 -0
- neuralmind-0.1.0/pyproject.toml +185 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
build/
|
|
8
|
+
develop-eggs/
|
|
9
|
+
dist/
|
|
10
|
+
downloads/
|
|
11
|
+
eggs/
|
|
12
|
+
.eggs/
|
|
13
|
+
lib/
|
|
14
|
+
lib64/
|
|
15
|
+
parts/
|
|
16
|
+
sdist/
|
|
17
|
+
var/
|
|
18
|
+
wheels/
|
|
19
|
+
*.egg-info/
|
|
20
|
+
.installed.cfg
|
|
21
|
+
*.egg
|
|
22
|
+
|
|
23
|
+
# Virtual environments
|
|
24
|
+
venv/
|
|
25
|
+
ENV/
|
|
26
|
+
env/
|
|
27
|
+
.venv/
|
|
28
|
+
|
|
29
|
+
# ChromaDB databases
|
|
30
|
+
**/neuralmind_db/
|
|
31
|
+
*.sqlite3
|
|
32
|
+
|
|
33
|
+
# IDE
|
|
34
|
+
.idea/
|
|
35
|
+
.vscode/
|
|
36
|
+
*.swp
|
|
37
|
+
*.swo
|
|
38
|
+
*~
|
|
39
|
+
|
|
40
|
+
# Testing
|
|
41
|
+
.pytest_cache/
|
|
42
|
+
.coverage
|
|
43
|
+
htmlcov/
|
|
44
|
+
|
|
45
|
+
# OS
|
|
46
|
+
.DS_Store
|
|
47
|
+
Thumbs.db
|
neuralmind-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 NeuralMind Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: neuralmind
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Adaptive Neural Knowledge System - Achieve 40-70x token reduction for AI code understanding
|
|
5
|
+
Project-URL: Homepage, https://github.com/dfrostar/neuralmind
|
|
6
|
+
Project-URL: Documentation, https://github.com/dfrostar/neuralmind/wiki
|
|
7
|
+
Project-URL: Repository, https://github.com/dfrostar/neuralmind.git
|
|
8
|
+
Project-URL: Issues, https://github.com/dfrostar/neuralmind/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/dfrostar/neuralmind/releases
|
|
10
|
+
Author: dfrostar
|
|
11
|
+
Maintainer: dfrostar
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: ai,ai-coding-assistant,chromadb,code-understanding,context-window,embeddings,knowledge-graph,llm,mcp,semantic-search,token-reduction
|
|
15
|
+
Classifier: Development Status :: 4 - Beta
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Requires-Dist: chromadb>=0.4.0
|
|
28
|
+
Requires-Dist: pyyaml>=6.0
|
|
29
|
+
Provides-Extra: all
|
|
30
|
+
Requires-Dist: black>=23.0; extra == 'all'
|
|
31
|
+
Requires-Dist: mcp>=0.1.0; extra == 'all'
|
|
32
|
+
Requires-Dist: mypy>=1.0; extra == 'all'
|
|
33
|
+
Requires-Dist: pre-commit>=3.0; extra == 'all'
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'all'
|
|
35
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'all'
|
|
36
|
+
Requires-Dist: pytest-mock>=3.10; extra == 'all'
|
|
37
|
+
Requires-Dist: pytest>=7.0; extra == 'all'
|
|
38
|
+
Requires-Dist: ruff>=0.1.0; extra == 'all'
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: black>=23.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest-mock>=3.10; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
48
|
+
Provides-Extra: mcp
|
|
49
|
+
Requires-Dist: mcp>=0.1.0; extra == 'mcp'
|
|
50
|
+
Description-Content-Type: text/markdown
|
|
51
|
+
|
|
52
|
+
<div align="center">
|
|
53
|
+
|
|
54
|
+
# 🧠 NeuralMind
|
|
55
|
+
|
|
56
|
+
### **Stop Wasting Tokens. Start Understanding Code.**
|
|
57
|
+
|
|
58
|
+
[](https://github.com/dfrostar/neuralmind/actions/workflows/ci.yml)
|
|
59
|
+
[](https://www.python.org/downloads/)
|
|
60
|
+
[](https://opensource.org/licenses/MIT)
|
|
61
|
+
|
|
62
|
+
**NeuralMind gives AI assistants 40-70x more efficient access to your codebase.**
|
|
63
|
+
|
|
64
|
+
[Why NeuralMind?](#-why-neuralmind) •
|
|
65
|
+
[Install in 2 Minutes](#-installation) •
|
|
66
|
+
[Quick Start](#-quick-start) •
|
|
67
|
+
[How It Works](#-how-it-works) •
|
|
68
|
+
[Wiki](https://github.com/dfrostar/neuralmind/wiki)
|
|
69
|
+
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## 🎯 Why NeuralMind?
|
|
75
|
+
|
|
76
|
+
### The Problem
|
|
77
|
+
|
|
78
|
+
When you ask Claude, GPT-4, or Cursor about your codebase:
|
|
79
|
+
|
|
80
|
+
| Traditional Approach | Tokens Used | Result |
|
|
81
|
+
|---------------------|-------------|--------|
|
|
82
|
+
| Load entire codebase | **50,000+** | ❌ Hits context limits, expensive, slow |
|
|
83
|
+
| Load a few files manually | **5,000** | ❌ Misses important context |
|
|
84
|
+
| Hope the AI figures it out | **0** | ❌ Wrong answers, hallucinations |
|
|
85
|
+
|
|
86
|
+
### The Solution
|
|
87
|
+
|
|
88
|
+
**NeuralMind loads only what's relevant to your question:**
|
|
89
|
+
|
|
90
|
+
| NeuralMind Approach | Tokens Used | Result |
|
|
91
|
+
|--------------------|-------------|--------|
|
|
92
|
+
| Wake-up context | **~400** | ✅ AI understands project structure |
|
|
93
|
+
| Query context | **~800-1,100** | ✅ AI gets relevant code clusters |
|
|
94
|
+
| **Total** | **~1,500** | ✅ **40-70x fewer tokens!** |
|
|
95
|
+
|
|
96
|
+
### Real Benchmarks
|
|
97
|
+
|
|
98
|
+
| Project | Codebase Size | NeuralMind Tokens | Reduction |
|
|
99
|
+
|---------|---------------|-------------------|----------|
|
|
100
|
+
| cmmc20 (full-stack app) | 241 code entities | 765 avg | **65.6x** |
|
|
101
|
+
| mempalace (Python lib) | 1,626 code entities | 1,089 avg | **46.0x** |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 📦 Installation
|
|
106
|
+
|
|
107
|
+
### Step 1: Install NeuralMind
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# From GitHub (available now)
|
|
111
|
+
pip install git+https://github.com/dfrostar/neuralmind.git
|
|
112
|
+
|
|
113
|
+
# From PyPI (coming soon)
|
|
114
|
+
pip install neuralmind
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Step 2: Install Graphify (creates the knowledge graph)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pip install graphifyy
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Step 3: Verify Installation
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
neuralmind --help
|
|
127
|
+
graphify --help
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**That's it!** You're ready to use NeuralMind.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🚀 Quick Start
|
|
135
|
+
|
|
136
|
+
### 1. Generate Knowledge Graph (one-time per project)
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
cd /path/to/your/project
|
|
140
|
+
graphify update .
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This creates `graphify-out/graph.json` with your codebase structure.
|
|
144
|
+
|
|
145
|
+
### 2. Build Neural Index
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
neuralmind build .
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Output:**
|
|
152
|
+
```
|
|
153
|
+
Building NeuralMind index for: .
|
|
154
|
+
Build successful!
|
|
155
|
+
Project: my-project
|
|
156
|
+
Nodes: 241
|
|
157
|
+
Communities: 93
|
|
158
|
+
Duration: 16.65s
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 3. Query Your Codebase
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Get compact context for any question
|
|
165
|
+
neuralmind query . "How does authentication work?"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Output:**
|
|
169
|
+
```
|
|
170
|
+
Query: How does authentication work?
|
|
171
|
+
Tokens: 739 (67.7x reduction)
|
|
172
|
+
============================================================
|
|
173
|
+
## Project: my-project
|
|
174
|
+
Knowledge Graph: 241 entities, 93 clusters
|
|
175
|
+
|
|
176
|
+
## Relevant Code Areas
|
|
177
|
+
### Cluster 1 (relevance: 2.45)
|
|
178
|
+
Contains: 5 codes
|
|
179
|
+
- AuthService (code) — authService.ts
|
|
180
|
+
- hashPassword() (code) — authService.ts
|
|
181
|
+
- verifyToken() (code) — authService.ts
|
|
182
|
+
...
|
|
183
|
+
============================================================
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### 4. Use with AI Assistants
|
|
187
|
+
|
|
188
|
+
Copy the output and paste it into your AI conversation for instant, relevant context!
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## 📖 All Commands
|
|
193
|
+
|
|
194
|
+
| Command | What It Does | Example |
|
|
195
|
+
|---------|--------------|--------|
|
|
196
|
+
| `build` | Create neural index from graph.json | `neuralmind build .` |
|
|
197
|
+
| `query` | Get context for a question | `neuralmind query . "How does X work?"` |
|
|
198
|
+
| `wakeup` | Get minimal startup context | `neuralmind wakeup .` |
|
|
199
|
+
| `search` | Semantic search for code | `neuralmind search . "authentication"` |
|
|
200
|
+
| `benchmark` | Measure token reduction | `neuralmind benchmark .` |
|
|
201
|
+
| `stats` | Show index statistics | `neuralmind stats .` |
|
|
202
|
+
|
|
203
|
+
### JSON Output (for automation)
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
neuralmind query . "How does auth work?" --json
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 🔧 How It Works
|
|
212
|
+
|
|
213
|
+
### 4-Layer Progressive Disclosure
|
|
214
|
+
|
|
215
|
+
NeuralMind uses a smart layering system to minimize tokens:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
┌─────────────────────────────────────────────────────┐
|
|
219
|
+
│ L0: Identity (~100 tokens) │
|
|
220
|
+
│ "Project name, description, graph stats" │
|
|
221
|
+
│ └── Always loaded │
|
|
222
|
+
├─────────────────────────────────────────────────────┤
|
|
223
|
+
│ L1: Summary (~300 tokens) │
|
|
224
|
+
│ "Architecture overview, main code clusters" │
|
|
225
|
+
│ └── Always loaded │
|
|
226
|
+
├─────────────────────────────────────────────────────┤
|
|
227
|
+
│ L2: On-Demand (~200-400 tokens) │
|
|
228
|
+
│ "Relevant modules based on your query" │
|
|
229
|
+
│ └── Loaded per query │
|
|
230
|
+
├─────────────────────────────────────────────────────┤
|
|
231
|
+
│ L3: Search Results (~200-400 tokens) │
|
|
232
|
+
│ "Semantic search matches" │
|
|
233
|
+
│ └── Loaded per query │
|
|
234
|
+
└─────────────────────────────────────────────────────┘
|
|
235
|
+
|
|
236
|
+
Total: ~800-1,100 tokens vs 50,000+ for full codebase
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Data Flow
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Your Code → Graphify → graph.json → NeuralMind → ChromaDB
|
|
243
|
+
↓
|
|
244
|
+
Smart Context for AI
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## 🔌 MCP Integration (Claude Desktop, Cursor)
|
|
250
|
+
|
|
251
|
+
NeuralMind includes an MCP server for direct integration:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
# Install with MCP support
|
|
255
|
+
pip install "neuralmind[mcp]"
|
|
256
|
+
|
|
257
|
+
# Run the server
|
|
258
|
+
neuralmind-mcp
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Add to your Claude Desktop config (`~/.config/claude/claude_desktop_config.json`):
|
|
262
|
+
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"mcpServers": {
|
|
266
|
+
"neuralmind": {
|
|
267
|
+
"command": "neuralmind-mcp"
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## 🐍 Python API
|
|
276
|
+
|
|
277
|
+
```python
|
|
278
|
+
from neuralmind import NeuralMind
|
|
279
|
+
|
|
280
|
+
# Initialize for your project
|
|
281
|
+
mind = NeuralMind('/path/to/project')
|
|
282
|
+
mind.build()
|
|
283
|
+
|
|
284
|
+
# Get wake-up context (for starting conversations)
|
|
285
|
+
wakeup = mind.wakeup()
|
|
286
|
+
print(f"Tokens: {wakeup.budget.total}") # ~400
|
|
287
|
+
|
|
288
|
+
# Get query context (for specific questions)
|
|
289
|
+
result = mind.query("How does authentication work?")
|
|
290
|
+
print(f"Tokens: {result.budget.total}") # ~800
|
|
291
|
+
print(f"Reduction: {result.reduction_ratio:.1f}x") # ~65x
|
|
292
|
+
print(result.context) # The actual context to use
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## 📊 Why This Matters
|
|
298
|
+
|
|
299
|
+
| Benefit | Impact |
|
|
300
|
+
|---------|--------|
|
|
301
|
+
| **Cost Savings** | 40-70x fewer tokens = 40-70x lower API costs |
|
|
302
|
+
| **Faster Responses** | Less to process = faster AI responses |
|
|
303
|
+
| **Better Answers** | Relevant context = more accurate answers |
|
|
304
|
+
| **Longer Conversations** | More room for back-and-forth |
|
|
305
|
+
| **Works Everywhere** | CLI, Python API, MCP server |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## 📚 Documentation
|
|
310
|
+
|
|
311
|
+
- **[Wiki Home](https://github.com/dfrostar/neuralmind/wiki)** — Full documentation
|
|
312
|
+
- **[Installation Guide](https://github.com/dfrostar/neuralmind/wiki/Installation)** — Detailed setup
|
|
313
|
+
- **[CLI Reference](https://github.com/dfrostar/neuralmind/wiki/CLI-Reference)** — All commands
|
|
314
|
+
- **[API Reference](https://github.com/dfrostar/neuralmind/wiki/API-Reference)** — Python API
|
|
315
|
+
- **[Architecture](https://github.com/dfrostar/neuralmind/wiki/Architecture)** — How it works
|
|
316
|
+
- **[Troubleshooting](https://github.com/dfrostar/neuralmind/wiki/Troubleshooting)** — Common issues
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## 🤝 Contributing
|
|
321
|
+
|
|
322
|
+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
# Clone and install for development
|
|
326
|
+
git clone https://github.com/dfrostar/neuralmind.git
|
|
327
|
+
cd neuralmind
|
|
328
|
+
pip install -e ".[dev]"
|
|
329
|
+
|
|
330
|
+
# Run tests
|
|
331
|
+
pytest
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## 📄 License
|
|
337
|
+
|
|
338
|
+
MIT License — see [LICENSE](LICENSE) for details.
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## 🙏 Acknowledgments
|
|
343
|
+
|
|
344
|
+
- **[ChromaDB](https://www.trychroma.com/)** — Vector storage
|
|
345
|
+
- **[Graphify](https://github.com/safishamsi/graphify)** — Knowledge graph generation
|
|
346
|
+
- **[code-review-graph](https://github.com/tirth8205/code-review-graph)** — Inspiration
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
<div align="center">
|
|
351
|
+
|
|
352
|
+
**Made with 🧠 by [Agent Zero](https://github.com/frdel/agent-zero)**
|
|
353
|
+
|
|
354
|
+
*Stop wasting tokens. Start understanding code.*
|
|
355
|
+
|
|
356
|
+
</div>
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# 🧠 NeuralMind
|
|
4
|
+
|
|
5
|
+
### **Stop Wasting Tokens. Start Understanding Code.**
|
|
6
|
+
|
|
7
|
+
[](https://github.com/dfrostar/neuralmind/actions/workflows/ci.yml)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
[](https://opensource.org/licenses/MIT)
|
|
10
|
+
|
|
11
|
+
**NeuralMind gives AI assistants 40-70x more efficient access to your codebase.**
|
|
12
|
+
|
|
13
|
+
[Why NeuralMind?](#-why-neuralmind) •
|
|
14
|
+
[Install in 2 Minutes](#-installation) •
|
|
15
|
+
[Quick Start](#-quick-start) •
|
|
16
|
+
[How It Works](#-how-it-works) •
|
|
17
|
+
[Wiki](https://github.com/dfrostar/neuralmind/wiki)
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 🎯 Why NeuralMind?
|
|
24
|
+
|
|
25
|
+
### The Problem
|
|
26
|
+
|
|
27
|
+
When you ask Claude, GPT-4, or Cursor about your codebase:
|
|
28
|
+
|
|
29
|
+
| Traditional Approach | Tokens Used | Result |
|
|
30
|
+
|---------------------|-------------|--------|
|
|
31
|
+
| Load entire codebase | **50,000+** | ❌ Hits context limits, expensive, slow |
|
|
32
|
+
| Load a few files manually | **5,000** | ❌ Misses important context |
|
|
33
|
+
| Hope the AI figures it out | **0** | ❌ Wrong answers, hallucinations |
|
|
34
|
+
|
|
35
|
+
### The Solution
|
|
36
|
+
|
|
37
|
+
**NeuralMind loads only what's relevant to your question:**
|
|
38
|
+
|
|
39
|
+
| NeuralMind Approach | Tokens Used | Result |
|
|
40
|
+
|--------------------|-------------|--------|
|
|
41
|
+
| Wake-up context | **~400** | ✅ AI understands project structure |
|
|
42
|
+
| Query context | **~800-1,100** | ✅ AI gets relevant code clusters |
|
|
43
|
+
| **Total** | **~1,500** | ✅ **40-70x fewer tokens!** |
|
|
44
|
+
|
|
45
|
+
### Real Benchmarks
|
|
46
|
+
|
|
47
|
+
| Project | Codebase Size | NeuralMind Tokens | Reduction |
|
|
48
|
+
|---------|---------------|-------------------|----------|
|
|
49
|
+
| cmmc20 (full-stack app) | 241 code entities | 765 avg | **65.6x** |
|
|
50
|
+
| mempalace (Python lib) | 1,626 code entities | 1,089 avg | **46.0x** |
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 📦 Installation
|
|
55
|
+
|
|
56
|
+
### Step 1: Install NeuralMind
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# From GitHub (available now)
|
|
60
|
+
pip install git+https://github.com/dfrostar/neuralmind.git
|
|
61
|
+
|
|
62
|
+
# From PyPI (coming soon)
|
|
63
|
+
pip install neuralmind
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Step 2: Install Graphify (creates the knowledge graph)
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pip install graphifyy
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Step 3: Verify Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
neuralmind --help
|
|
76
|
+
graphify --help
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**That's it!** You're ready to use NeuralMind.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 🚀 Quick Start
|
|
84
|
+
|
|
85
|
+
### 1. Generate Knowledge Graph (one-time per project)
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cd /path/to/your/project
|
|
89
|
+
graphify update .
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
This creates `graphify-out/graph.json` with your codebase structure.
|
|
93
|
+
|
|
94
|
+
### 2. Build Neural Index
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
neuralmind build .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Output:**
|
|
101
|
+
```
|
|
102
|
+
Building NeuralMind index for: .
|
|
103
|
+
Build successful!
|
|
104
|
+
Project: my-project
|
|
105
|
+
Nodes: 241
|
|
106
|
+
Communities: 93
|
|
107
|
+
Duration: 16.65s
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Query Your Codebase
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Get compact context for any question
|
|
114
|
+
neuralmind query . "How does authentication work?"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Output:**
|
|
118
|
+
```
|
|
119
|
+
Query: How does authentication work?
|
|
120
|
+
Tokens: 739 (67.7x reduction)
|
|
121
|
+
============================================================
|
|
122
|
+
## Project: my-project
|
|
123
|
+
Knowledge Graph: 241 entities, 93 clusters
|
|
124
|
+
|
|
125
|
+
## Relevant Code Areas
|
|
126
|
+
### Cluster 1 (relevance: 2.45)
|
|
127
|
+
Contains: 5 codes
|
|
128
|
+
- AuthService (code) — authService.ts
|
|
129
|
+
- hashPassword() (code) — authService.ts
|
|
130
|
+
- verifyToken() (code) — authService.ts
|
|
131
|
+
...
|
|
132
|
+
============================================================
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 4. Use with AI Assistants
|
|
136
|
+
|
|
137
|
+
Copy the output and paste it into your AI conversation for instant, relevant context!
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 📖 All Commands
|
|
142
|
+
|
|
143
|
+
| Command | What It Does | Example |
|
|
144
|
+
|---------|--------------|--------|
|
|
145
|
+
| `build` | Create neural index from graph.json | `neuralmind build .` |
|
|
146
|
+
| `query` | Get context for a question | `neuralmind query . "How does X work?"` |
|
|
147
|
+
| `wakeup` | Get minimal startup context | `neuralmind wakeup .` |
|
|
148
|
+
| `search` | Semantic search for code | `neuralmind search . "authentication"` |
|
|
149
|
+
| `benchmark` | Measure token reduction | `neuralmind benchmark .` |
|
|
150
|
+
| `stats` | Show index statistics | `neuralmind stats .` |
|
|
151
|
+
|
|
152
|
+
### JSON Output (for automation)
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
neuralmind query . "How does auth work?" --json
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## 🔧 How It Works
|
|
161
|
+
|
|
162
|
+
### 4-Layer Progressive Disclosure
|
|
163
|
+
|
|
164
|
+
NeuralMind uses a smart layering system to minimize tokens:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
┌─────────────────────────────────────────────────────┐
|
|
168
|
+
│ L0: Identity (~100 tokens) │
|
|
169
|
+
│ "Project name, description, graph stats" │
|
|
170
|
+
│ └── Always loaded │
|
|
171
|
+
├─────────────────────────────────────────────────────┤
|
|
172
|
+
│ L1: Summary (~300 tokens) │
|
|
173
|
+
│ "Architecture overview, main code clusters" │
|
|
174
|
+
│ └── Always loaded │
|
|
175
|
+
├─────────────────────────────────────────────────────┤
|
|
176
|
+
│ L2: On-Demand (~200-400 tokens) │
|
|
177
|
+
│ "Relevant modules based on your query" │
|
|
178
|
+
│ └── Loaded per query │
|
|
179
|
+
├─────────────────────────────────────────────────────┤
|
|
180
|
+
│ L3: Search Results (~200-400 tokens) │
|
|
181
|
+
│ "Semantic search matches" │
|
|
182
|
+
│ └── Loaded per query │
|
|
183
|
+
└─────────────────────────────────────────────────────┘
|
|
184
|
+
|
|
185
|
+
Total: ~800-1,100 tokens vs 50,000+ for full codebase
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Data Flow
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
Your Code → Graphify → graph.json → NeuralMind → ChromaDB
|
|
192
|
+
↓
|
|
193
|
+
Smart Context for AI
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## 🔌 MCP Integration (Claude Desktop, Cursor)
|
|
199
|
+
|
|
200
|
+
NeuralMind includes an MCP server for direct integration:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Install with MCP support
|
|
204
|
+
pip install "neuralmind[mcp]"
|
|
205
|
+
|
|
206
|
+
# Run the server
|
|
207
|
+
neuralmind-mcp
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Add to your Claude Desktop config (`~/.config/claude/claude_desktop_config.json`):
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"mcpServers": {
|
|
215
|
+
"neuralmind": {
|
|
216
|
+
"command": "neuralmind-mcp"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## 🐍 Python API
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from neuralmind import NeuralMind
|
|
228
|
+
|
|
229
|
+
# Initialize for your project
|
|
230
|
+
mind = NeuralMind('/path/to/project')
|
|
231
|
+
mind.build()
|
|
232
|
+
|
|
233
|
+
# Get wake-up context (for starting conversations)
|
|
234
|
+
wakeup = mind.wakeup()
|
|
235
|
+
print(f"Tokens: {wakeup.budget.total}") # ~400
|
|
236
|
+
|
|
237
|
+
# Get query context (for specific questions)
|
|
238
|
+
result = mind.query("How does authentication work?")
|
|
239
|
+
print(f"Tokens: {result.budget.total}") # ~800
|
|
240
|
+
print(f"Reduction: {result.reduction_ratio:.1f}x") # ~65x
|
|
241
|
+
print(result.context) # The actual context to use
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 📊 Why This Matters
|
|
247
|
+
|
|
248
|
+
| Benefit | Impact |
|
|
249
|
+
|---------|--------|
|
|
250
|
+
| **Cost Savings** | 40-70x fewer tokens = 40-70x lower API costs |
|
|
251
|
+
| **Faster Responses** | Less to process = faster AI responses |
|
|
252
|
+
| **Better Answers** | Relevant context = more accurate answers |
|
|
253
|
+
| **Longer Conversations** | More room for back-and-forth |
|
|
254
|
+
| **Works Everywhere** | CLI, Python API, MCP server |
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## 📚 Documentation
|
|
259
|
+
|
|
260
|
+
- **[Wiki Home](https://github.com/dfrostar/neuralmind/wiki)** — Full documentation
|
|
261
|
+
- **[Installation Guide](https://github.com/dfrostar/neuralmind/wiki/Installation)** — Detailed setup
|
|
262
|
+
- **[CLI Reference](https://github.com/dfrostar/neuralmind/wiki/CLI-Reference)** — All commands
|
|
263
|
+
- **[API Reference](https://github.com/dfrostar/neuralmind/wiki/API-Reference)** — Python API
|
|
264
|
+
- **[Architecture](https://github.com/dfrostar/neuralmind/wiki/Architecture)** — How it works
|
|
265
|
+
- **[Troubleshooting](https://github.com/dfrostar/neuralmind/wiki/Troubleshooting)** — Common issues
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## 🤝 Contributing
|
|
270
|
+
|
|
271
|
+
Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Clone and install for development
|
|
275
|
+
git clone https://github.com/dfrostar/neuralmind.git
|
|
276
|
+
cd neuralmind
|
|
277
|
+
pip install -e ".[dev]"
|
|
278
|
+
|
|
279
|
+
# Run tests
|
|
280
|
+
pytest
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 📄 License
|
|
286
|
+
|
|
287
|
+
MIT License — see [LICENSE](LICENSE) for details.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 🙏 Acknowledgments
|
|
292
|
+
|
|
293
|
+
- **[ChromaDB](https://www.trychroma.com/)** — Vector storage
|
|
294
|
+
- **[Graphify](https://github.com/safishamsi/graphify)** — Knowledge graph generation
|
|
295
|
+
- **[code-review-graph](https://github.com/tirth8205/code-review-graph)** — Inspiration
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
<div align="center">
|
|
300
|
+
|
|
301
|
+
**Made with 🧠 by [Agent Zero](https://github.com/frdel/agent-zero)**
|
|
302
|
+
|
|
303
|
+
*Stop wasting tokens. Start understanding code.*
|
|
304
|
+
|
|
305
|
+
</div>
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "neuralmind"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Adaptive Neural Knowledge System - Achieve 40-70x token reduction for AI code understanding"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "dfrostar" }
|
|
13
|
+
]
|
|
14
|
+
maintainers = [
|
|
15
|
+
{ name = "dfrostar" }
|
|
16
|
+
]
|
|
17
|
+
keywords = [
|
|
18
|
+
"ai",
|
|
19
|
+
"llm",
|
|
20
|
+
"code-understanding",
|
|
21
|
+
"knowledge-graph",
|
|
22
|
+
"token-reduction",
|
|
23
|
+
"semantic-search",
|
|
24
|
+
"mcp",
|
|
25
|
+
"chromadb",
|
|
26
|
+
"embeddings",
|
|
27
|
+
"context-window",
|
|
28
|
+
"ai-coding-assistant"
|
|
29
|
+
]
|
|
30
|
+
classifiers = [
|
|
31
|
+
"Development Status :: 4 - Beta",
|
|
32
|
+
"Intended Audience :: Developers",
|
|
33
|
+
"License :: OSI Approved :: MIT License",
|
|
34
|
+
"Operating System :: OS Independent",
|
|
35
|
+
"Programming Language :: Python :: 3",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
41
|
+
"Typing :: Typed"
|
|
42
|
+
]
|
|
43
|
+
requires-python = ">=3.10"
|
|
44
|
+
dependencies = [
|
|
45
|
+
"chromadb>=0.4.0",
|
|
46
|
+
"pyyaml>=6.0"
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[project.optional-dependencies]
|
|
50
|
+
mcp = [
|
|
51
|
+
"mcp>=0.1.0"
|
|
52
|
+
]
|
|
53
|
+
dev = [
|
|
54
|
+
"pytest>=7.0",
|
|
55
|
+
"pytest-asyncio>=0.21.0",
|
|
56
|
+
"pytest-cov>=4.0",
|
|
57
|
+
"pytest-mock>=3.10",
|
|
58
|
+
"black>=23.0",
|
|
59
|
+
"ruff>=0.1.0",
|
|
60
|
+
"mypy>=1.0",
|
|
61
|
+
"pre-commit>=3.0"
|
|
62
|
+
]
|
|
63
|
+
all = [
|
|
64
|
+
"neuralmind[mcp,dev]"
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
[project.scripts]
|
|
68
|
+
neuralmind = "neuralmind.cli:main"
|
|
69
|
+
neuralmind-mcp = "neuralmind.mcp_server:main"
|
|
70
|
+
|
|
71
|
+
[project.urls]
|
|
72
|
+
Homepage = "https://github.com/dfrostar/neuralmind"
|
|
73
|
+
Documentation = "https://github.com/dfrostar/neuralmind/wiki"
|
|
74
|
+
Repository = "https://github.com/dfrostar/neuralmind.git"
|
|
75
|
+
Issues = "https://github.com/dfrostar/neuralmind/issues"
|
|
76
|
+
Changelog = "https://github.com/dfrostar/neuralmind/releases"
|
|
77
|
+
|
|
78
|
+
[tool.hatch.build.targets.wheel]
|
|
79
|
+
packages = ["neuralmind"]
|
|
80
|
+
|
|
81
|
+
[tool.hatch.build.targets.sdist]
|
|
82
|
+
include = [
|
|
83
|
+
"neuralmind/**/*.py",
|
|
84
|
+
"README.md",
|
|
85
|
+
"LICENSE",
|
|
86
|
+
"CHANGELOG.md"
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
# PyPI Trusted Publishing Configuration
|
|
90
|
+
# To enable trusted publishing on PyPI:
|
|
91
|
+
# 1. Go to https://pypi.org/manage/project/neuralmind/settings/publishing/
|
|
92
|
+
# 2. Add a new trusted publisher with:
|
|
93
|
+
# - Owner: dfrostar
|
|
94
|
+
# - Repository: neuralmind
|
|
95
|
+
# - Workflow: release.yml
|
|
96
|
+
# - Environment: pypi
|
|
97
|
+
|
|
98
|
+
[tool.black]
|
|
99
|
+
line-length = 100
|
|
100
|
+
target-version = ["py310", "py311", "py312"]
|
|
101
|
+
include = '\.pyi?$'
|
|
102
|
+
exclude = '''
|
|
103
|
+
/(
|
|
104
|
+
\.git
|
|
105
|
+
| \.hg
|
|
106
|
+
| \.mypy_cache
|
|
107
|
+
| \.tox
|
|
108
|
+
| \.venv
|
|
109
|
+
| _build
|
|
110
|
+
| buck-out
|
|
111
|
+
| build
|
|
112
|
+
| dist
|
|
113
|
+
)/
|
|
114
|
+
'''
|
|
115
|
+
|
|
116
|
+
[tool.ruff]
|
|
117
|
+
line-length = 100
|
|
118
|
+
target-version = "py310"
|
|
119
|
+
|
|
120
|
+
[tool.ruff.lint]
|
|
121
|
+
select = [
|
|
122
|
+
"E", # pycodestyle errors
|
|
123
|
+
"F", # pyflakes
|
|
124
|
+
"W", # pycodestyle warnings
|
|
125
|
+
"I", # isort
|
|
126
|
+
"N", # pep8-naming
|
|
127
|
+
"UP", # pyupgrade
|
|
128
|
+
"B", # flake8-bugbear
|
|
129
|
+
"C4", # flake8-comprehensions
|
|
130
|
+
"T10", # flake8-debugger
|
|
131
|
+
"ISC", # flake8-implicit-str-concat
|
|
132
|
+
"PIE", # flake8-pie
|
|
133
|
+
"RET", # flake8-return
|
|
134
|
+
]
|
|
135
|
+
ignore = [
|
|
136
|
+
"E501", # line too long (handled by black)
|
|
137
|
+
"B008", # function call in argument defaults
|
|
138
|
+
"C901", # too complex
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
[tool.ruff.lint.per-file-ignores]
|
|
142
|
+
"tests/**/*.py" = ["S101", "F841", "PT011", "PT012"] # allow assert and test patterns
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
[tool.mypy]
|
|
146
|
+
python_version = "3.10"
|
|
147
|
+
warn_return_any = true
|
|
148
|
+
warn_unused_configs = true
|
|
149
|
+
disallow_untyped_defs = true
|
|
150
|
+
disallow_incomplete_defs = true
|
|
151
|
+
check_untyped_defs = true
|
|
152
|
+
strict_optional = true
|
|
153
|
+
warn_redundant_casts = true
|
|
154
|
+
warn_unused_ignores = true
|
|
155
|
+
show_error_codes = true
|
|
156
|
+
|
|
157
|
+
[[tool.mypy.overrides]]
|
|
158
|
+
module = ["chromadb.*", "mcp.*"]
|
|
159
|
+
ignore_missing_imports = true
|
|
160
|
+
|
|
161
|
+
[tool.pytest.ini_options]
|
|
162
|
+
minversion = "7.0"
|
|
163
|
+
addopts = "-ra -q --strict-markers"
|
|
164
|
+
testpaths = ["tests"]
|
|
165
|
+
python_files = ["test_*.py"]
|
|
166
|
+
python_functions = ["test_*"]
|
|
167
|
+
python_classes = ["Test*"]
|
|
168
|
+
markers = [
|
|
169
|
+
"slow: marks tests as slow",
|
|
170
|
+
"integration: marks tests as integration tests",
|
|
171
|
+
]
|
|
172
|
+
|
|
173
|
+
[tool.coverage.run]
|
|
174
|
+
branch = true
|
|
175
|
+
source = ["neuralmind"]
|
|
176
|
+
omit = ["*/tests/*", "*/__pycache__/*"]
|
|
177
|
+
|
|
178
|
+
[tool.coverage.report]
|
|
179
|
+
exclude_lines = [
|
|
180
|
+
"pragma: no cover",
|
|
181
|
+
"def __repr__",
|
|
182
|
+
"raise NotImplementedError",
|
|
183
|
+
"if __name__ == .__main__.:",
|
|
184
|
+
"if TYPE_CHECKING:",
|
|
185
|
+
]
|