Adaptive Neural Knowledge System - Achieve 40-70x token reduction for AI code understanding
Project description
๐ง NeuralMind
Stop Wasting Tokens. Start Understanding Code.
NeuralMind gives AI assistants 40-70x more efficient access to your codebase.
Why NeuralMind? โข Install in 2 Minutes โข Quick Start โข How It Works โข Wiki
๐ฏ Why NeuralMind?
The Problem
When you ask Claude, GPT-4, or Cursor about your codebase:
| Traditional Approach | Tokens Used | Result |
|---|---|---|
| Load entire codebase | 50,000+ | โ Hits context limits, expensive, slow |
| Load a few files manually | 5,000 | โ Misses important context |
| Hope the AI figures it out | 0 | โ Wrong answers, hallucinations |
The Solution
NeuralMind loads only what's relevant to your question:
| NeuralMind Approach | Tokens Used | Result |
|---|---|---|
| Wake-up context | ~400 | โ AI understands project structure |
| Query context | ~800-1,100 | โ AI gets relevant code clusters |
| Total | ~1,500 | โ 40-70x fewer tokens! |
Real Benchmarks
| Project | Codebase Size | NeuralMind Tokens | Reduction |
|---|---|---|---|
| cmmc20 (full-stack app) | 241 code entities | 765 avg | 65.6x |
| mempalace (Python lib) | 1,626 code entities | 1,089 avg | 46.0x |
๐ฆ Installation
Step 1: Install NeuralMind
# From GitHub (available now)
pip install git+https://github.com/dfrostar/neuralmind.git
# From PyPI (coming soon)
pip install neuralmind
Step 2: Install Graphify (creates the knowledge graph)
pip install graphifyy
Step 3: Verify Installation
neuralmind --help
graphify --help
That's it! You're ready to use NeuralMind.
๐ Quick Start
1. Generate Knowledge Graph (one-time per project)
cd /path/to/your/project
graphify update .
This creates graphify-out/graph.json with your codebase structure.
2. Build Neural Index
neuralmind build .
Output:
Building NeuralMind index for: .
Build successful!
Project: my-project
Nodes: 241
Communities: 93
Duration: 16.65s
3. Query Your Codebase
# Get compact context for any question
neuralmind query . "How does authentication work?"
Output:
Query: How does authentication work?
Tokens: 739 (67.7x reduction)
============================================================
## Project: my-project
Knowledge Graph: 241 entities, 93 clusters
## Relevant Code Areas
### Cluster 1 (relevance: 2.45)
Contains: 5 codes
- AuthService (code) โ authService.ts
- hashPassword() (code) โ authService.ts
- verifyToken() (code) โ authService.ts
...
============================================================
4. Use with AI Assistants
Copy the output and paste it into your AI conversation for instant, relevant context!
๐ All Commands
| Command | What It Does | Example |
|---|---|---|
build |
Create neural index from graph.json | neuralmind build . |
query |
Get context for a question | neuralmind query . "How does X work?" |
wakeup |
Get minimal startup context | neuralmind wakeup . |
search |
Semantic search for code | neuralmind search . "authentication" |
benchmark |
Measure token reduction | neuralmind benchmark . |
stats |
Show index statistics | neuralmind stats . |
JSON Output (for automation)
neuralmind query . "How does auth work?" --json
๐ง How It Works
4-Layer Progressive Disclosure
NeuralMind uses a smart layering system to minimize tokens:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ L0: Identity (~100 tokens) โ
โ "Project name, description, graph stats" โ
โ โโโ Always loaded โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ L1: Summary (~300 tokens) โ
โ "Architecture overview, main code clusters" โ
โ โโโ Always loaded โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ L2: On-Demand (~200-400 tokens) โ
โ "Relevant modules based on your query" โ
โ โโโ Loaded per query โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ L3: Search Results (~200-400 tokens) โ
โ "Semantic search matches" โ
โ โโโ Loaded per query โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total: ~800-1,100 tokens vs 50,000+ for full codebase
Data Flow
Your Code โ Graphify โ graph.json โ NeuralMind โ ChromaDB
โ
Smart Context for AI
๐ MCP Integration (Claude Desktop, Cursor)
NeuralMind includes an MCP server for direct integration:
# Install with MCP support
pip install "neuralmind[mcp]"
# Run the server
neuralmind-mcp
Add to your Claude Desktop config (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"neuralmind": {
"command": "neuralmind-mcp"
}
}
}
๐ Python API
from neuralmind import NeuralMind
# Initialize for your project
mind = NeuralMind('/path/to/project')
mind.build()
# Get wake-up context (for starting conversations)
wakeup = mind.wakeup()
print(f"Tokens: {wakeup.budget.total}") # ~400
# Get query context (for specific questions)
result = mind.query("How does authentication work?")
print(f"Tokens: {result.budget.total}") # ~800
print(f"Reduction: {result.reduction_ratio:.1f}x") # ~65x
print(result.context) # The actual context to use
๐ Why This Matters
| Benefit | Impact |
|---|---|
| Cost Savings | 40-70x fewer tokens = 40-70x lower API costs |
| Faster Responses | Less to process = faster AI responses |
| Better Answers | Relevant context = more accurate answers |
| Longer Conversations | More room for back-and-forth |
| Works Everywhere | CLI, Python API, MCP server |
๐ Documentation
- Wiki Home โ Full documentation
- Installation Guide โ Detailed setup
- CLI Reference โ All commands
- API Reference โ Python API
- Architecture โ How it works
- Troubleshooting โ Common issues
๐ค Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
# Clone and install for development
git clone https://github.com/dfrostar/neuralmind.git
cd neuralmind
pip install -e ".[dev]"
# Run tests
pytest
๐ License
MIT License โ see LICENSE for details.
๐ Acknowledgments
- ChromaDB โ Vector storage
- Graphify โ Knowledge graph generation
- code-review-graph โ Inspiration
Made with ๐ง by Agent Zero
Stop wasting tokens. Start understanding code.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neuralmind-0.1.0.tar.gz.
File metadata
- Download URL: neuralmind-0.1.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d746fb5c801f45d6e6ad361ea14e1ff015fce1f699c503d450eb8d746b015f28
|
|
| MD5 |
d9ff1bbdbf5d5705be66811ef4a9ff19
|
|
| BLAKE2b-256 |
4c2902112416da74aed8931ec5b0e3f6a459b342fe9f6dc2ff359dc572841bf2
|
Provenance
The following attestation bundles were made for neuralmind-0.1.0.tar.gz:
Publisher:
release.yml on dfrostar/neuralmind
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
neuralmind-0.1.0.tar.gz -
Subject digest:
d746fb5c801f45d6e6ad361ea14e1ff015fce1f699c503d450eb8d746b015f28 - Sigstore transparency entry: 1321785508
- Sigstore integration time:
-
Permalink:
dfrostar/neuralmind@04a66df511da8f14c7ca32dc9be6376f5980d695 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dfrostar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@04a66df511da8f14c7ca32dc9be6376f5980d695 -
Trigger Event:
push
-
Statement type:
File details
Details for the file neuralmind-0.1.0-py3-none-any.whl.
File metadata
- Download URL: neuralmind-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0ced320be068a5639cce556fc26a8dea80b2d7a043b488b9841255e0d97ee24
|
|
| MD5 |
63598ab4476acd73cbb49ba097a6301e
|
|
| BLAKE2b-256 |
28bbf488a4d856e8d675bfdf707707a26edfbe36333dac30e4d4f5267cd9f6ce
|
Provenance
The following attestation bundles were made for neuralmind-0.1.0-py3-none-any.whl:
Publisher:
release.yml on dfrostar/neuralmind
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
neuralmind-0.1.0-py3-none-any.whl -
Subject digest:
d0ced320be068a5639cce556fc26a8dea80b2d7a043b488b9841255e0d97ee24 - Sigstore transparency entry: 1321785593
- Sigstore integration time:
-
Permalink:
dfrostar/neuralmind@04a66df511da8f14c7ca32dc9be6376f5980d695 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dfrostar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@04a66df511da8f14c7ca32dc9be6376f5980d695 -
Trigger Event:
push
-
Statement type: