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.4.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.4-py3-none-any.whl (183.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pycodesage-0.2.4.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.4.tar.gz
Algorithm Hash digest
SHA256 df1eb750e180910f4c30142e6124ad689ca433c771a55d4f93dd521968f079f2
MD5 385e97fd0aa6b0c8895dcf78e91adeed
BLAKE2b-256 6c10d1e3c7e5141c8ee1c8e5a110395200daf8a5d1da61e0ff998237bfd202f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pycodesage-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 183.1 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 06087f822fdea7fca762480c1d1860bcefe8f346ac1275ec385b9ced5de8e63d
MD5 04cd8717b6e46cf74b55ebdb947a3283
BLAKE2b-256 1a2195fc86b9859e07d93c03975f233f83865c518174aea2aba62a1804758794

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