Skip to main content

The context engine for AI coding agents - reduce tokens by 50-70%

Project description

CodeNexus AI

The context engine for AI coding agents

License: MIT Python 3.10+ PyPI

English | 한국어


What is CodeNexus?

CodeNexus is a local-first context engine that helps AI coding agents understand your codebase better. It builds a live dependency graph of your code and serves only the relevant context to AI agents, reducing token usage by 50-70% while improving code quality.

Key Features

  • Local-first: Your code never leaves your machine
  • Token reduction: Save 50-70% on AI API costs
  • Multi-language: Python, JavaScript, TypeScript support
  • MCP compatible: Works with Claude Code, Cursor, and other AI agents
  • Fast indexing: SQLite-based dependency graph

Quick Start

Installation

pip install codenexus-ai

Developing from source (recommended for local edits): install in editable mode so changes in this repo are picked up immediately. A non-editable pip install . copies the code into site-packages and will silently keep running the old copy even after you edit files here.

git clone https://github.com/uptodatelabs/CodeNexus.git
cd CodeNexus
pip install -e .

Basic Usage

# Index your project
codenexus index

# Search for context
codenexus search "authentication middleware"

# Run context pipeline
codenexus pipeline "fix login bug"

# Check index status
codenexus status

How It Works

Your Codebase
     ↓
[CodeNexus Indexer]
     ↓
┌─────────────────────────────────────┐
│  Dependency Graph (SQLite + FTS5)   │
│  - Functions, Classes, Imports      │
│  - Call relationships               │
│  - Type information                 │
└─────────────────────────────────────┘
     ↓
[Context Capsule Generator]
     ↓
┌─────────────────────────────────────┐
│  Optimized Context for AI Agent     │
│  - Pivot files: Full source         │
│  - Supporting: Skeleton only        │
│  - Token budget: Respected          │
└─────────────────────────────────────┘
     ↓
AI Agent (Claude Code, Cursor, etc.)

Claude Code Integration

CodeNexus works with Claude Code to reduce token usage for AI coding agents.

Setup

1. Install CodeNexus

pip install codenexus-ai

2. Edit .claude.json

File location:

  • macOS/Linux: ~/.claude.json
  • Windows: C:\Users\your-username\.claude.json

3. Add configuration

Add the following to your ~/.claude.json:

{
  "mcpServers": {
    "codenexus": {
      "command": "codenexus",
      "args": ["-w", "/path/to/your/project", "serve"]
    }
  }
}

⚠️ Important: /path/to/your/project should be the path to the project where you want to use CodeNexus.

Path Examples

❌ Wrong:

"args": ["-w", "C:\\Users\\username\\.codenexus", "serve"]

→ CodeNexus config directory (incorrect)

✅ Correct:

"args": ["-w", "C:\\Users\\username\\projects\\my-app", "serve"]

→ Project directory where you want to use CodeNexus

OS-specific Path Examples

Windows:

{
  "mcpServers": {
    "codenexus": {
      "command": "codenexus",
      "args": ["-w", "C:\\Users\\username\\projects\\my-app", "serve"]
    }
  }
}

macOS/Linux:

{
  "mcpServers": {
    "codenexus": {
      "command": "codenexus",
      "args": ["-w", "/home/username/projects/my-app", "serve"]
    }
  }
}

Multiple Projects

To use CodeNexus with multiple projects, add configuration for each project:

{
  "projects": {
    "C:\\Users\\username\\projects\\app1": {
      "mcpServers": {
        "codenexus": {
          "command": "codenexus",
          "args": ["-w", "C:\\Users\\username\\projects\\app1", "serve"]
        }
      }
    },
    "C:\\Users\\username\\projects\\app2": {
      "mcpServers": {
        "codenexus": {
          "command": "codenexus",
          "args": ["-w", "C:\\Users\\username\\projects\\app2", "serve"]
        }
      }
    }
  }
}

Verify Setup

  1. Save .claude.json
  2. Restart Claude Code
  3. Run Claude in your project directory
cd C:\Users\username\projects\my-app
claude

Troubleshooting

If MCP server doesn't connect:

  1. Check if CodeNexus is installed:

    pip show codenexus-ai
    
  2. Test code execution:

    codenexus --version
    
  3. Verify the path is correct (watch for quotes)


Supported Languages

Language Status
Python ✅ Full support
JavaScript ✅ Full support
TypeScript ✅ Full support
Go ✅ Full support
Rust ✅ Full support
Java ✅ Full support
C# ✅ Full support

Supported AI Agents

CodeNexus integrates with AI coding agents via MCP (or skills for OpenClaw). The setup wizard auto-detects installed agents and writes the correct config format for each.

Agent Config file MCP key
Claude Code ~/.claude.json mcpServers
Cursor ~/.cursor/mcp.json mcpServers
Windsurf ~/.windsurf/mcp.json mcpServers
GitHub Copilot ~/.copilot/mcp-config.json mcpServers
Zed ~/.zed/settings.json mcpServers
Continue.dev ~/.continue/config.json mcpServers
Augment ~/.augment/settings.json mcpServers
Hermes Agent ~/.hermes/config.yaml mcp_servers
Codex ~/.codex/config.toml mcp_servers
OpenClaw ~/.openclaw/workspace/skills/codenexus/SKILL.md skill

Other AI Agent Integration

CodeNexus works with various AI coding agents. Here's how to integrate with other popular tools.

OpenClaw Integration

OpenClaw is a personal AI assistant that connects to WhatsApp, Telegram, Slack, Discord, and more.

Setup

OpenClaw doesn't support MCP directly. Use CodeNexus CLI commands through OpenClaw's skill system.

1. Install CodeNexus:

pip install codenexus-ai

2. Create OpenClaw skill:

Create ~/.openclaw/workspace/skills/codenexus/SKILL.md:

---
name: codenexus
description: Search and analyze code using CodeNexus
allowed_tools:
  - bash
---

# CodeNexus Skill

Use CodeNexus to search and analyze code in the workspace.

## Commands

- `codenexus index` - Index the workspace
- `codenexus search "query"` - Search for code
- `codenexus pipeline "task"` - Get context for a task

3. Usage in OpenClaw:

/codenexus search "authentication middleware"
/codenexus pipeline "fix login bug"

Hermes Agent Integration

Hermes Agent is a self-improving AI agent by Nous Research.

Setup

Hermes supports MCP servers. Configure CodeNexus as an MCP server.

1. Install CodeNexus:

pip install codenexus-ai

2. Add MCP server to Hermes:

hermes mcp add codenexus -- codenexus -w /path/to/your/project serve

Or add to ~/.hermes/config.yaml:

mcp_servers:
  codenexus:
    command: codenexus
    args:
      - serve
      - -w
      - /path/to/your/project

3. Usage in Hermes:

/hermes search "authentication middleware"
/hermes pipeline "fix login bug"

Other Agents

Any agent that supports CLI commands can use CodeNexus:

# Direct CLI usage
codenexus index
codenexus search "query"
codenexus pipeline "task"
codenexus status

# JSON output for programmatic use
codenexus search "query" --json

Token Savings Example

Before CodeNexus:

8,247 tokens per query

After CodeNexus:

2,140 tokens per query (74% reduction)

Setup Wizard

CodeNexus includes a setup wizard to easily configure AI coding agents.

Detect Installed Agents

codenexus wizard detect

List Supported Agents

codenexus wizard list

Setup a Specific Agent

# Claude Code
codenexus wizard setup claude_code

# OpenClaw
codenexus wizard setup openclaw

# Hermes Agent
codenexus wizard setup hermes

# Cursor
codenexus wizard setup cursor

# GitHub Copilot
codenexus wizard setup copilot

# Codex
codenexus wizard setup codex

# And more...

Note: Setup will automatically index your project after configuration.

Clear Index Data

codenexus wizard clear

This will show all index directories and let you select which ones to clear.

For non-interactive use (e.g. scripts/CI), clear everything without prompts:

codenexus wizard clear --all --yes
  • --all selects every discovered index
  • --yes skips the confirmation prompt

You can also clear specific indexes by typing their IDs (e.g. idx-1,idx-3) or type the project directory name to confirm each deletion individually.

Interactive Setup

codenexus wizard interactive

Roadmap

  • Tree-sitter integration for better parsing
  • Graph centrality (PageRank) for better ranking
  • Local LLM support for additional savings
  • Multi-repo workspace support
  • VS Code extension

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • Inspired by vexp - The original context engine
  • Built with Python, SQLite, and MCP
  • Thanks to all contributors

Support

If you find CodeNexus useful, consider supporting the project:

Ko-fi GitHub Sponsors


Connect your code. Empower your AI.

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

codenexus_ai-1.1.25.tar.gz (45.9 kB view details)

Uploaded Source

Built Distribution

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

codenexus_ai-1.1.25-py3-none-any.whl (47.3 kB view details)

Uploaded Python 3

File details

Details for the file codenexus_ai-1.1.25.tar.gz.

File metadata

  • Download URL: codenexus_ai-1.1.25.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for codenexus_ai-1.1.25.tar.gz
Algorithm Hash digest
SHA256 a885a65791593658b2d1ae33eb03dd8feefd99f7a17ca46997e2eba3846a8a9e
MD5 7cd11752f33fe33f78403b611867408c
BLAKE2b-256 0d1d2c9718901034509e1620ae5e1c7f59b88f208532bbd607851d87f16af331

See more details on using hashes here.

File details

Details for the file codenexus_ai-1.1.25-py3-none-any.whl.

File metadata

  • Download URL: codenexus_ai-1.1.25-py3-none-any.whl
  • Upload date:
  • Size: 47.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for codenexus_ai-1.1.25-py3-none-any.whl
Algorithm Hash digest
SHA256 1fce552dc3eea907a16f68f8e43aeab073276371fa9c695b67eb5dab86a36d16
MD5 17de6ef57f5d751c58ba361ae8e7f889
BLAKE2b-256 971d0f5657913d17e5a71761994788ee0ad2ff6419f934a1713df0ab40cfcd97

See more details on using hashes here.

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