Skip to main content

Adaptive Neural Knowledge System - Achieve 40-70x token reduction for AI code understanding

Project description

๐Ÿง  NeuralMind

Stop Wasting Tokens. Start Understanding Code.

CI Python 3.10+ License: MIT

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


๐Ÿค 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


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

neuralmind-0.1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuralmind-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

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

Hashes for neuralmind-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d746fb5c801f45d6e6ad361ea14e1ff015fce1f699c503d450eb8d746b015f28
MD5 d9ff1bbdbf5d5705be66811ef4a9ff19
BLAKE2b-256 4c2902112416da74aed8931ec5b0e3f6a459b342fe9f6dc2ff359dc572841bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for neuralmind-0.1.0.tar.gz:

Publisher: release.yml on dfrostar/neuralmind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for neuralmind-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ced320be068a5639cce556fc26a8dea80b2d7a043b488b9841255e0d97ee24
MD5 63598ab4476acd73cbb49ba097a6301e
BLAKE2b-256 28bbf488a4d856e8d675bfdf707707a26edfbe36333dac30e4d4f5267cd9f6ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for neuralmind-0.1.0-py3-none-any.whl:

Publisher: release.yml on dfrostar/neuralmind

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page