Complete command-line interface documentation for NeuralMind.
NeuralMind provides a command-line interface for building neural indexes, querying codebases with natural language, and managing knowledge graphs.
neuralmind [OPTIONS] COMMAND [ARGS]
# General help
neuralmind --help
# Command-specific help
neuralmind build --help
neuralmind query --help
| Option | Description |
|---|---|
--help |
Show help message and exit |
--version |
Show version number |
Build or rebuild the neural index from a knowledge graph.
neuralmind build <project_path> [OPTIONS]
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root containing graphify-out/graph.json |
| Option | Default | Description |
|---|---|---|
--force, -f |
False | Force re-embedding of all nodes, even if unchanged |
Displays build statistics including:
# Basic build
neuralmind build /path/to/project
# Force complete rebuild
neuralmind build /path/to/project --force
Before running build, ensure:
graphify update /path/to/projectgraphify-out/graph.json exists in the project directoryQuery the codebase with natural language and get optimized context.
neuralmind query <project_path> "<question>" [OPTIONS]
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root |
question |
Yes | Natural language question about the codebase |
| Option | Default | Description |
|---|---|---|
--json, -j |
False | Output results as JSON |
Returns:
# Basic query
neuralmind query /path/to/project "How does authentication work?"
# JSON output
neuralmind query /path/to/project "What are the main API endpoints?" --json
=== Query: How does authentication work? ===
[Context]
# Project: MyApp
MyApp is a web application with JWT-based authentication...
[Authentication Module]
The auth module handles user login, token generation, and validation...
[Relevant Code]
- auth/jwt_handler.py: JWT token generation and validation
- auth/middleware.py: Authentication middleware for routes
- models/user.py: User model with password hashing
---
Tokens: 847 | Reduction: 59.0x | Layers: L0, L1, L2, L3 | Communities: [5, 12]
Get minimal wake-up context for starting a new conversation.
neuralmind wakeup <project_path> [OPTIONS]
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root |
| Option | Default | Description |
|---|---|---|
--json, -j |
False | Output results as JSON |
Returns L0 (Identity) + L1 (Summary) context, typically ~600 tokens, suitable for:
# Get wake-up context
neuralmind wakeup /path/to/project
# Redirect to file
neuralmind wakeup /path/to/project > context.md
# JSON format
neuralmind wakeup /path/to/project --json
=== Wake-up Context ===
# Project: MyApp
MyApp is a full-stack web application for task management built with React and Node.js.
## Architecture Overview
### Core Components
- **Frontend**: React 18 with TypeScript, Tailwind CSS
- **Backend**: Node.js/Express REST API
- **Database**: PostgreSQL with Prisma ORM
- **Auth**: JWT-based authentication
### Main Modules
1. User Management (users/) - Registration, profiles, settings
2. Task Engine (tasks/) - CRUD operations, scheduling, notifications
3. API Layer (api/) - REST endpoints, middleware, validation
---
Tokens: 412 | Layers: L0, L1
Perform direct semantic search across codebase entities.
neuralmind search <project_path> "<query>" [OPTIONS]
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root |
query |
Yes | Semantic search query |
| Option | Default | Description |
|---|---|---|
--n |
10 | Maximum number of results |
--json, -j |
False | Output results as JSON |
Returns matching code entities with:
# Basic search
neuralmind search /path/to/project "authentication"
# Limit results
neuralmind search /path/to/project "database connection" --n 5
# JSON output
neuralmind search /path/to/project "API endpoint" --json
=== Search: authentication ===
1. authenticate_user (function) - Score: 0.92
File: auth/handlers.py
Validates user credentials and returns JWT token
Community: 5 (Authentication)
2. AuthMiddleware (class) - Score: 0.87
File: auth/middleware.py
Express middleware for JWT validation
Community: 5 (Authentication)
3. hash_password (function) - Score: 0.81
File: utils/crypto.py
Securely hashes passwords using bcrypt
Community: 5 (Authentication)
---
Results: 3 | Query time: 45ms
Run performance benchmark with sample queries.
neuralmind benchmark <project_path> [OPTIONS]
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root |
| Option | Default | Description |
|---|---|---|
--json, -j |
False | Output results as JSON |
Comprehensive benchmark report including:
# Run default benchmark
neuralmind benchmark /path/to/project
# JSON output
neuralmind benchmark /path/to/project --json
=== NeuralMind Benchmark ===
Project: MyApp
Total Nodes: 241
Communities: 93
Estimated Full Codebase: 50,000 tokens
| Query Type | Tokens | Reduction | Latency |
|------------|--------|-----------|----------|
| Wake-up context | 341 | 146.6x | 45ms |
| How does authentication work? | 739 | 67.7x | 187ms |
| What are the main API endpoints? | 748 | 66.8x | 192ms |
| Explain the database models | 812 | 61.6x | 201ms |
|------------|--------|-----------|----------|
| **Average** | **660** | **85.7x** | **156ms** |
---
Benchmark completed in 625ms
Show statistics about the neural index.
neuralmind stats <project_path> [OPTIONS]
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root |
| Option | Default | Description |
|---|---|---|
--json, -j |
False | Output as JSON |
Displays:
# Basic stats
neuralmind stats /path/to/project
# JSON format
neuralmind stats /path/to/project --json
=== NeuralMind Statistics ===
Project: MyApp
Graph Path: /path/to/project/graphify-out/graph.json
DB Path: /path/to/project/graphify-out/neuralmind_db
## Index Summary
- Total Nodes: 241
- Total Edges: 203
- Communities: 93
- Embedding Dimensions: 384
## Node Types
- Functions: 142 (58.9%)
- Classes: 45 (18.7%)
- Files: 38 (15.8%)
- Database Models: 16 (6.6%)
## Storage
- Index Size: 12.4 MB
- Cache Size: 2.1 MB
## Build Info
- Last Build: 2024-01-15 14:30:22
- Build Duration: 8.3s
- Embedding Model: all-MiniLM-L6-v2
Analyze query history to discover cooccurrence patterns and improve future search relevance.
neuralmind learn <project_path>
| Argument | Required | Description |
|---|---|---|
project_path |
Yes | Path to project root |
neuralmind learn .
neuralmind learn /path/to/project
After collecting 5–10 queries, this command:
.neuralmind/memory/query_events.jsonl.neuralmind/learned_patterns.jsonNote: Learning must be enabled (not blocked by NEURALMIND_LEARNING=0).
Print a compact graph-backed view of a file — functions, rationales, and call graph — without loading the full source.
neuralmind skeleton <file_path> [--project-path .] [--json]
| Argument | Required | Description |
|---|---|---|
file_path |
Yes | Path to the source file (absolute or project-relative) |
| Option | Default | Description |
|---|---|---|
--project-path |
. |
Project root directory |
--json, -j |
False | Output as JSON |
# Skeleton for a file in the current project
neuralmind skeleton src/auth/handlers.py
# Skeleton with explicit project root
neuralmind skeleton src/auth/handlers.py --project-path /path/to/project
# JSON output
neuralmind skeleton src/auth/handlers.py --json
Install or uninstall Claude Code PostToolUse compression hooks that automatically compress Read/Bash/Grep output.
neuralmind install-hooks [project_path] [--global] [--uninstall]
| Argument | Required | Description |
|---|---|---|
project_path |
No | Project root (default: current directory). Ignored when --global is set |
| Option | Default | Description |
|---|---|---|
--global |
False | Install hooks in ~/.claude/settings.json (all projects) |
--uninstall |
False | Remove NeuralMind hooks while preserving other tools’ hooks |
# Install hooks for current project
neuralmind install-hooks .
# Install hooks globally
neuralmind install-hooks --global
# Uninstall project hooks
neuralmind install-hooks --uninstall
# Uninstall global hooks
neuralmind install-hooks --uninstall --global
Bypass temporarily:
NEURALMIND_BYPASS=1 claude-code ...
Install (or update) a Git post-commit hook that rebuilds the neural index automatically after every commit. Safe and idempotent — re-running only updates the NeuralMind block without touching other hooks.
neuralmind init-hook [project_path]
| Argument | Required | Description |
|---|---|---|
project_path |
No | Project root (default: current directory) |
# Install hook in current project
neuralmind init-hook .
# Install hook for a specific project
neuralmind init-hook /path/to/project
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | General error |
| 2 | Invalid arguments |
| 3 | graph.json not found |
| 4 | Index not built (run build first) |
| 5 | Database error |
| Variable | Default | Description |
|---|---|---|
NEURALMIND_MEMORY |
1 |
Set to 0 to disable query memory logging |
NEURALMIND_LEARNING |
1 |
Set to 0 to disable continual learning |
NEURALMIND_BYPASS |
unset | Set to 1 to bypass PostToolUse hook compression temporarily |
# 1. Generate knowledge graph
graphify update ~/projects/myapp
# 2. Build neural index
neuralmind build ~/projects/myapp
# 3. View statistics
neuralmind stats ~/projects/myapp
# 4. Get wake-up context for new conversation
neuralmind wakeup ~/projects/myapp > context.md
# 5. Query specific functionality
neuralmind query ~/projects/myapp "How does the payment system work?"
# 6. Search for specific entities
neuralmind search ~/projects/myapp "PaymentController" --n 5
# 7. Run benchmark
neuralmind benchmark ~/projects/myapp
#!/bin/bash
# update_and_query.sh - Update index and run queries
PROJECT="$1"
QUERY="$2"
# Rebuild if graph changed
if [ graphify-out/graph.json -nt graphify-out/neuralmind_db ]; then
echo "Graph updated, rebuilding index..."
neuralmind build "$PROJECT"
fi
# Run query
neuralmind query "$PROJECT" "$QUERY" --json
# Get context and pipe to clipboard (macOS)
neuralmind wakeup ~/projects/myapp | pbcopy
# Get context and pipe to clipboard (Linux)
neuralmind wakeup ~/projects/myapp | xclip -selection clipboard
# Save context to file for AI assistant
neuralmind query ~/projects/myapp "Explain the auth system" > auth_context.md