Skip to main content

Local-first CLI code intelligence tool with LangChain-powered RAG

Project description

CodeSage

Local-first code intelligence CLI with MCP support for Claude Desktop, Cursor, and Windsurf.

Index your codebase and search it using natural language. Everything runs locally with Ollama. Supports Python, JavaScript, TypeScript, Go, and Rust.

Install

Recommended: pipx

We strongly recommend installing CodeSage with pipx to run it in an isolated environment.

  1. Install pipx (if not already installed):

    # macOS
    brew install pipx
    pipx ensurepath
    
    # Linux/Windows
    python3 -m pip install --user pipx
    python3 -m pipx ensurepath
    
  2. Install CodeSage:

    # Install Python 3.10+ (Recommended)
    brew install python@3.11
    
    # Install CodeSage using the specific python version
    pipx install --python python3.11 pycodesage
    

    Note: You can use any installed Python version >= 3.10 (e.g., python3.10, python3.12).

    Note: To add optional features later (e.g., multi-language support), use pipx inject:

    pipx inject pycodesage pycodesage[multi-language]
    

Alternative: pip

You can also install via standard pip, though this may conflict with other packages:

pip install pycodesage

Or from source:

git clone https://github.com/keshavashiya/codesage.git
cd codesage
pip install -e .

Requirements

Ollama must be running with these models:

ollama pull qwen2.5-coder:7b
ollama pull mxbai-embed-large
ollama serve

Usage

# Initialize and index your project
cd your-project
codesage init
codesage index

# Search your code
codesage suggest "validate email"

# Check everything is working
codesage health

MCP Setup

{
  "mcpServers": {
    "codesage": {
      "command": "codesage",
      "args": ["mcp", "serve", "--global"]
    }
  }
}
Other MCP clients (Cursor, Windsurf)

Cursor: Settings → Features → MCP Servers, add same config.

Windsurf: Settings → MCP → Add Server. Command: codesage, Args: mcp serve --global

Commands

codesage init           # Initialize project
codesage index          # Index codebase
codesage suggest QUERY  # Search code
codesage stats          # Show stats
codesage health         # System check
codesage review         # AI code review
codesage chat           # Interactive mode
More commands
# MCP
codesage mcp serve          # Start server
codesage mcp serve --global # All projects
codesage mcp test           # Test tools

# Security
codesage security scan      # Scan vulnerabilities
codesage hooks install      # Pre-commit hook

# Storage
codesage storage info       # Backend details
codesage storage stats      # Metrics

# Profile
codesage profile show       # Developer profile
codesage profile patterns   # Learned patterns

Configuration

Stored in .codesage/config.yaml:

project_name: my-project
languages:
  - python
  - typescript

llm:
  provider: ollama
  model: qwen2.5-coder:7b
  embedding_model: mxbai-embed-large

exclude_dirs:
  - venv
  - node_modules
  - .git

Development

pip install -e ".[dev]"
pytest tests/ -v

License

MIT

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

pycodesage-0.2.2.tar.gz (141.0 kB view details)

Uploaded Source

Built Distribution

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

pycodesage-0.2.2-py3-none-any.whl (182.4 kB view details)

Uploaded Python 3

File details

Details for the file pycodesage-0.2.2.tar.gz.

File metadata

  • Download URL: pycodesage-0.2.2.tar.gz
  • Upload date:
  • Size: 141.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for pycodesage-0.2.2.tar.gz
Algorithm Hash digest
SHA256 928021e91d7da9cd7498ccadbb435363199710159dee8db01eff6a6302e430b4
MD5 29e6aae4331d77296709de4ace709654
BLAKE2b-256 8e6214fa40f3d094764d6a252b1ea487d85628912f5924be9ccbb3e42d4574bd

See more details on using hashes here.

File details

Details for the file pycodesage-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: pycodesage-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 182.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for pycodesage-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 32b9102144dcd5e76bfd79d9a7ee3d67c45a27e783d5b4456b3816b105a197d3
MD5 0e5c72bf8f58e1f36563fb0748873ff3
BLAKE2b-256 8cda624b3d43ae3d92f3dc160364eb8fc0c9dee4911ae1b362219e5430a4d3e8

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