N3MO: The Impact Tracker
Project description
๐ N3MO
A code intelligence engine that transforms repositories into queryable knowledge graphs
Parse once. Query forever. Know exactly what breaks before it does.
๐ Licensed under AGPL-3.0 โ Free for personal/internal use โข Contact for commercial licensing
What is N3MO โข Architecture โข Installation โข Usage โข Benchmarks โข Roadmap
๐ฏ What is N3MO?
N3MO is a symbol-centric code intelligence engine. Instead of scanning raw text, it parses your source code ASTs, maps call graphs, and models dependencies in a queryable relational database.
For engineering leaders and teams, N3MO acts as a structural insurance policy for your codebases.
๐ก Why N3MO?
- ๐ก๏ธ Eliminate Regression Risks: Utility functions are rarely refactored because developers fear unknown side effects. N3MO maps the transitive blast radius of any symbol to arbitrary depth, showing you exactly what will break before you make the edit.
- ๐๏ธ Rapid Developer Onboarding: Instead of senior engineers spending hours explaining codebase flow to new hires, developers can run one command to visualize complex call chains and parent-child dependencies interactively.
- ๐ค AI-Agent Ready Infrastructure: Modern LLM agents (Cursor, Claude Desktop) are limited by context windows and text search. N3MO's native MCP server lets AI agents query the actual code graph, enabling fast, hallucination-free refactoring.
๐ How N3MO Compares
| Capability | Grep / Text Search | IDE "Find References" | N3MO Code Graph |
|---|---|---|---|
| Analysis Basis | Substring Matching | AST-based Direct matching | Relational Knowledge Graph |
| Transitive Traversal | โ None | โ Manual (one level at a time) | โก Instant (to arbitrary depth) |
| Blast Radius Mapping | โ None | โ Text-based search list | ๐จ Interactive visual orbit map |
| CI/CD Integration | โ None | โ Bound to IDE runtime | โ๏ธ Dockerized CLI & DB CTE queries |
| AI Agent Integration | โ Injected file chunks | โ ๏ธ Manual context copy | ๐ค Native MCP Server (Claude/Cursor) |
๐ ๏ธ The Core Problem N3MO Solves
โ Traditional grep/search: "Where does 'login' appear?"
โ
N3MO: "What will break if I change the login function?"
Critical questions N3MO answers instantly:
- ๐ What functions and classes exist in this repository?
- ๐ฏ Where is this symbol being used โ directly and transitively?
- ๐ฅ What is the blast radius of changing this function?
- ๐ธ๏ธ How do these components actually connect?
๐๏ธ Architecture
Knowledge graph model
N3MO builds a symbol-centric knowledge graph stored in PostgreSQL:
graph TB
subgraph repo["Repository Analysis"]
A["๐ Source Code"] -->|Tree-sitter| B["๐ณ AST Parser"]
B --> C["๐ Symbol Extractor"]
end
subgraph kg["Knowledge Graph"]
D[("๐๏ธ PostgreSQL")]
E["๐ฆ Projects"]
F["๐ค Symbols"]
G["๐ Relationships"]
D --- E
D --- F
D --- G
end
subgraph query["Query Engine"]
H["๐ Dependency Graph"]
I["๐ Call Graph"]
J["๐ฅ Impact Analysis"]
end
C --> D
D --> H
D --> I
D --> J
H --> K["๐จ Visualization"]
I --> K
J --> K
style repo fill:#2d3748,stroke:#4a5568,stroke-width:2px,color:#fff
style kg fill:#2d3748,stroke:#4a5568,stroke-width:2px,color:#fff
style query fill:#2d3748,stroke:#4a5568,stroke-width:2px,color:#fff
style A fill:#e2e8f0,stroke:#4a5568,color:#1a202c
style B fill:#cbd5e0,stroke:#4a5568,color:#1a202c
style C fill:#cbd5e0,stroke:#4a5568,color:#1a202c
style D fill:#fc8181,stroke:#c53030,color:#1a202c,stroke-width:3px
style E fill:#a0aec0,stroke:#4a5568,color:#1a202c
style F fill:#a0aec0,stroke:#4a5568,color:#1a202c
style G fill:#a0aec0,stroke:#4a5568,color:#1a202c
style H fill:#90cdf4,stroke:#2c5282,color:#1a202c
style I fill:#90cdf4,stroke:#2c5282,color:#1a202c
style J fill:#90cdf4,stroke:#2c5282,color:#1a202c
style K fill:#9ae6b4,stroke:#2f855a,color:#1a202c
System flow
sequenceDiagram
participant User
participant CLI
participant Docker
participant Parser
participant DB as PostgreSQL
participant Viz as Visualizer
User->>CLI: n3mo index
CLI->>Docker: Start containers
Docker->>Parser: Mount repository
Parser->>Parser: Walk file tree
Parser->>Parser: Parse AST (Tree-sitter)
Parser->>DB: Store symbols & relations
DB-->>Parser: Confirm storage
User->>CLI: n3mo impact "function_name"
CLI->>DB: Query call graph
DB->>DB: Recursive CTE traversal
DB-->>Viz: Return dependency tree
Viz-->>User: Display graph (HTML/JS)
Data model
erDiagram
PROJECT ||--o{ SYMBOL : contains
SYMBOL ||--o{ SYMBOL : "calls/inherits"
SYMBOL {
uuid id PK
string kind "function|class|variable"
string name
string file_path
int line_number
uuid parent_id FK
uuid project_id FK
}
PROJECT {
uuid id PK
string name
string root_path
timestamp indexed_at
}
โจ Core Capabilities
- โ Multi-Language Ingestion โ dynamic Tree-sitter loading with support for all 27 requested languages (including Python, JS, TS, Go, Rust, Java, C/C++, C#, Haskell, Perl, Ruby, PHP, Powershell, Groovy, Matlab, Delphi, Kotlin, Swift, Scala, etc.)
- โ
Parallel AST Ingestion โ multiprocessing scaling utilizing
ProcessPoolExecutorto distribute CPU-bound parsing across cores - โ
Strict & Flawless Exclusions โ case-insensitive directory filters (tests, mocks, specs, fixtures, temp) and camelCase-aware prefix/suffix filename checks to avoid false positives (e.g. allows
contest.py) - โ No-Impact Skips & Pruning โ skips files with 0 symbols, imports, and calls to prevent db bloat and deletes database residues upon updates
- โ
Premium Theme & Visual Styling โ warm beige editorial layout inspired by modern minimalist web design with elegant typography (
Loraserif andIntersans-serif) - โ
Dynamic Canvas Dark Mode โ toggleable dark mode that dynamically updates Vis.js canvas nodes, edges, labels, and orbit lines in real-time, persisting preference in
localStorage - โ AST-based parsing โ Tree-sitter integration for error-tolerant source analysis
- โ Symbol extraction โ functions, classes, methods with full file + line context
- โ Hierarchical modeling โ parent-child relationships (Module โ Class โ Method)
- โ Call graph construction โ who calls whom, captured at ingestion time
- โ Blast radius analysis โ recursive CTE traversal to arbitrary depth
- โ Idempotent ingestion โ re-indexing updates existing data without duplication
- โ Interactive visualizer โ vis.js graph with click-to-inspect nodes, sidebar, and depth slider
- โ Docker-first โ single-command infrastructure setup
- โ Connection pooling โ eliminated per-symbol DB round trips
- โ Batch inserts โ symbols, imports, and calls batched per file
- โ SPLIT_PART query fix โ major call-resolution speedup
- โ
CLI flags โ
--fileand--depthfor targeted impact analysis - โ Incremental re-index โ SHA-256 file hashing, skip unchanged files
- โ Test suite โ pytest with database integration testing
- โ GitHub Actions CI โ lint and test pipeline on every PR
๐ Installation
Prerequisites
Quick start
Install N3MO directly from PyPI:
# Install the package
pip install n3mo
# Start Docker containers & run the database and background engines setup
n3mo setup
Alternatively, for developers running in editable mode:
git clone https://github.com/RajX-dev/N3MO.git
cd N3MO
pip install -e .
n3mo setup
๐ค Model Context Protocol (MCP)
N3MO includes a Model Context Protocol (MCP) server that exposes N3MO's repository analysis and graph traversal tools to LLM agents (like Claude or Cursor).
Automatic Claude Desktop Setup
To automatically configure N3MO in your local Claude Desktop:
# Navigate to the workspace you want Claude to analyze, then run:
n3mo mcp install
This registers N3MO and sets up the paths automatically. Restart Claude Desktop and you're ready!
Cursor Setup
To use N3MO in Cursor:
- Go to Settings -> Models -> MCP.
- Click + Add New MCP Server.
- Set the configuration details:
- Name:
n3mo - Type:
command - Command:
n3mo mcp start(oruvx n3mo mcp startto run directly) - Environment Variables:
TARGET_CODE_DIR=/absolute/path/to/your/active/workspace
- Name:
- Click Save, and Cursor will instantly be able to index and query your workspace blast radius.
๐ป Usage
Index a repository
# Navigate to any Python repository
cd /path/to/your/project
# Run the indexer
n3mo index
What gets indexed:
- โ
Python files (
.py) - โ Virtual environments (
venv/,.venv/) - โ Dependencies (
node_modules/,site-packages/) - โ Build artifacts (
.git/,__pycache__/,dist/)
Blast radius analysis
# Find everything affected by changing a function
n3mo impact "authenticate_user"
# Limit to a specific file or traversal depth
n3mo impact "authenticate_user" --file api/auth.py --depth 2
# Open an interactive visual graph in your browser (with depth slider)
n3mo impact "authenticate_user" --graph
Visualizer Screenshots
Solar Orbit View
Horizontal Tree View
Example terminal output:
โ IMPACT ANALYSIS
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Target: authenticate_user
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Direct Callers (3 symbols)
โธ login_endpoint api/auth.py:12
โธ refresh_token api/token.py:23
โธ validate_session middleware/auth.py:89
โ Ripple Effects (5 symbols)
โฐโโธ POST /login routes.py:67
โฐโโธ admin_login admin/views.py:34
โฐโโธ require_auth decorators.py:12
โฐโโธ dashboard_view views/dashboard.py:8
โฐโโธ settings_view views/settings.py:22
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Total impacted: 8 references โ depth โค 3
Dependency graph visualization
graph LR
A[main.py] --> B[auth.py::login]
A --> C[db.py::connect]
B --> D[utils.py::hash_password]
B --> E[models.py::User]
C --> F[config.py::DB_URI]
style A fill:#ff6b6b,stroke:#c92a2a,stroke-width:2px,color:#fff
style B fill:#4ecdc4,stroke:#0ca89e,stroke-width:2px,color:#000
style C fill:#45b7d1,stroke:#1098ad,stroke-width:2px,color:#000
style D fill:#96ceb4,stroke:#63b598,stroke-width:2px,color:#000
style E fill:#ffd93d,stroke:#f5c200,stroke-width:2px,color:#000
style F fill:#e0e0e0,stroke:#a0a0a0,stroke-width:2px,color:#000
๐ ๏ธ Technology stack
| Component | Technology | Purpose |
|---|---|---|
| Parser | Error-tolerant syntax analysis | |
| Database | Relational graph storage + recursive CTE queries | |
| Runtime | Core logic | |
| Infrastructure | Containerization | |
| Visualization | Interactive impact graph |
๐ Benchmarks
ScanCode Toolkit (v0.3 baseline)
Tested on ScanCode Toolkit โ a real-world open source Python project with ~600k lines of code.
| Metric | v0.3 (baseline) |
|---|---|
| Repository | nexB/scancode-toolkit |
| Lines of code | ~600,000 |
| Index time | ~3 minutes |
| Processing mode | Single-threaded |
| Hardware | Intel i5-13450HX, 24GB RAM, NVMe SSD |
Django โ full optimization history (v0.3 โ v0.4)
| Version | Index time | Speedup |
|---|---|---|
| v0.3 baseline | 23 minutes | 1x |
| After SPLIT_PART fix | 11 minutes | 2x |
| After batch inserts (symbols/imports/calls) | 5 minutes | 4.6x |
Files: 3,021
Symbols: ~43,000
Calls: ~181,000
โ Real measured results on Django, single-threaded, same hardware as above.
Total improvement: 4.6x faster than v0.3. Multiprocessing (v0.5) will produce a further before/after comparison once implemented. No projections until the code exists.
Running the Indexing Performance Benchmark
N3MO includes an automated performance benchmarking script to evaluate index timing improvements (comparing full indexing times against incremental re-indexing times):
python benchmarks/benchmark_indexing.py
๐บ๏ธ Roadmap
Development timeline
| Phase | Component | Status |
|---|---|---|
| Phase 1 โ Foundations | ||
| Docker setup | โ Complete | |
| Database schema | โ Complete | |
| Tree-sitter integration | โ Complete | |
| Symbol + call extraction | โ Complete | |
| Blast radius (recursive CTE) | โ Complete | |
| Interactive visualizer | โ Complete | |
| Phase 2 โ Performance | ||
| Connection pooling | โ Complete | |
| Batch DB operations (symbols/imports/calls) | โ Complete | |
| SPLIT_PART query fix | โ Complete | |
--file / --depth CLI flags |
โ Complete | |
| Interactive depth slider | โ Complete | |
| Phase 3 โ Correctness & Scaling | ||
| Incremental re-index (file hashing) | โ Complete | |
| Multiprocessing (AST parsing) | โ Complete | |
| Scope-aware call resolution | โณ Planned | |
| CTE cycle guard | โณ Planned | |
| Full type annotations + mypy | โณ Planned | |
| pytest suite + CI | โ Complete | |
| Multi-language support | โ Complete | |
| Phase 4 โ Distribution | ||
| MCP server (Cursor / Claude Code) | โ Complete | |
| FastAPI REST layer | โณ Planned | |
| Real-time git-hook indexing | โณ Planned | |
| pgvector semantic search | โณ Planned |
Legend: โ Complete ย |ย ๐ต In Progress ย |ย โณ Planned
Phase 1: Foundations โ Complete
- Docker environment (PostgreSQL)
- Database schema โ Projects, Symbols, Calls, Imports tables
- Tree-sitter parser integration
- Symbol extractor with full AST traversal
- Idempotent upsert logic
- Blast radius via recursive CTE
- Interactive vis.js visualizer
Phase 2: Performance โ Complete
-
psycopg2.pool.ThreadedConnectionPoolโ replace per-call connections -
execute_values()batch inserts for symbols, imports, and calls โ 1 transaction per file - SPLIT_PART query optimization for call resolution
-
--fileand--depthCLI flags for targeted impact analysis - Interactive depth slider in visualizer
Results: Django (3,021 files, ~43k symbols, ~181k calls) โ 23min โ 5min (4.6x faster)
Phase 3: Correctness + Scaling ๐ต In Progress
- SHA-256 file hashing for incremental re-index
-
ProcessPoolExecutorfor parallel AST parsing - Scope-aware call resolution using imports table
- CTE cycle guard (visited node tracking)
- Full type annotations,
mypy --strictclean - pytest unit + integration test suite
- GitHub Actions CI pipeline
- Multi-language support
Phase 4: Distribution ๐ต In Progress
- MCP server โ N3MO as a tool for Cursor, Claude Code, Windsurf
- FastAPI REST layer โ
GET /impact/{symbol},POST /index - Real-time incremental indexing via git hooks
-
pgvectorsemantic search โ "find functions that do X"
๐ Design principles
1. Structure before semantics Map the code skeleton (AST) before adding AI analysis. A correct graph is worth more than a smart but wrong one.
2. Database as source of truth All state lives in PostgreSQL, eliminating in-memory complexity and enabling graph queries that application-level traversal cannot match.
3. Correctness over speed The parser must handle syntax errors gracefully without corrupting the graph. A fast indexer that silently drops symbols is worse than a slow one that gets everything right.
4. Idempotent operations Re-running ingestion produces identical results, enabling safe incremental updates and CI/CD integration.
๐ค Contributing
Contributions are welcome. Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development setup
# Install with dev dependencies
pip install -e ".[dev]"
# Lint
ruff check n3mo/
# Type check
mypy n3mo/
# Tests
pytest tests/
๐ License
Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
- โ Free for personal projects and internal tools
- โ Open source โ view, modify, and distribute freely
- โ ๏ธ Copyleft โ derivative works must also be AGPL-3.0
- โ ๏ธ Network use โ modified versions run as a web service must share changes
For commercial deployments or proprietary modifications, contact for licensing options.
See LICENSE for full legal details.
๐จโ๐ป Author
Raj Shekhar โ Delhi Technological University
๐ Acknowledgments
- Tree-sitter โ for robust, incremental, error-tolerant parsing
- PostgreSQL โ for making recursive graph queries possible without a graph database
- Docker โ for reproducible, single-command environments
- vis.js โ for the interactive graph visualization
โญ Star this repo if you find it useful!
Building tools for understanding code at scale.
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 n3mo-1.0.6.tar.gz.
File metadata
- Download URL: n3mo-1.0.6.tar.gz
- Upload date:
- Size: 64.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab66e6475d924711d0f542e32d4660ed8089a4d7737235c525e4dce8c5afee69
|
|
| MD5 |
1ada223a1ccf8a63310475cfde679440
|
|
| BLAKE2b-256 |
53fe51b0a8ac3e9f0739cb590299b23fc269db5bda871327d1a7f3c291e35b37
|
File details
Details for the file n3mo-1.0.6-py3-none-any.whl.
File metadata
- Download URL: n3mo-1.0.6-py3-none-any.whl
- Upload date:
- Size: 56.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
662c932f69d6d321c14e9e21872ea3d0cd4bf2f8b9c801e0da91b29c4e0ecc08
|
|
| MD5 |
b208ae95a057130ce663ade63d6ef38f
|
|
| BLAKE2b-256 |
533f859ae415958f90b7fae063368440cda33b3707632ccb79629d47c953a1d8
|