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.5.tar.gz (141.6 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.5-py3-none-any.whl (183.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycodesage-0.2.5.tar.gz
  • Upload date:
  • Size: 141.6 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.5.tar.gz
Algorithm Hash digest
SHA256 4eaa9dce63cff73f618d20a1a5ccde6afaa60abf431bd4b9aa8d2c34c2246c39
MD5 2112f554a04409e1fb55e1c639984a95
BLAKE2b-256 69be9d73b1cae2c9885fb5cc1fa45e79dddfa07ba10a0d9cfeab620bd54785c3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycodesage-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 183.2 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 339d30d6865f6ebe715d914e9a0395b8c904384d669aeee0447430da1b1f360e
MD5 a3a8e3f30dd564dce7016cba4012fa0d
BLAKE2b-256 1eea22f4a1cd8bee6f4e18c0e3c128cd34c4415f11dd6cba5ff14258e98393f8

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