Skip to main content

Optulus

Optulus (cf) is an offline-first Python CLI that indexes a repository into a local graph and returns minimal task-specific context with one query.

Install

pip install optulus

For local development in this repo:

pip install -e .

Quick Start (5 minutes)

cf index ./your-project
cd ./your-project
cf context "add rate limiting to auth middleware"
cf stats

The SQLite index and Qdrant files live inside the repository you index: <path>/.cf/ (not in the Optulus install directory). Commands like cf context and cf stats look for .cf/index.db in the current working directory, so run them from that same repo root (or pass . after cd there).

Commands

  • cf index <path>: write <path>/.cf/index.db and <path>/.cf/qdrant/
  • cf index <path> --watch: watch for changes and re-index automatically
  • cf index <path> --langs python,typescript: limit indexed languages
  • cf index <path> --reset: rebuild from scratch
  • cf context "<task>" --top 20 --max-tokens 8000: retrieve ranked context
  • cf context "<task>" --json: output JSON only to stdout
  • cf stats [--since 7d]: show usage and token savings
  • cf serve [--transport stdio|sse|streamable-http] [--host 127.0.0.1] [--port 8765] [--auto-index|--no-auto-index]: MCP server (default stdio; auto-builds .cf/ on start unless disabled; --port only for HTTP transports). More detail: docs/claude-code.md.

Claude Code (MCP)

Optulus exposes MCP tools: get_context, get_file, get_symbol, and optional record_outcome. On startup the server indexes the repo automatically (unless you pass --no-auto-index or set CONTEXTFORGE_AUTO_INDEX=0). You can still run cf index or cf index --watch yourself for manual or continuous re-indexing.

The repo root is resolved from CONTEXTFORGE_REPO_ROOT, or by walking up from cwd for .cf/index.db, or else cwd. Set CONTEXTFORGE_REPO_ROOT if the MCP process starts with the wrong working directory (some global or user-scoped setups).

Add the MCP server in Claude Code

Merge an optulus entry into mcpServers (exact file or UI path depends on your Claude Code version). cwd should be the project root when the client does not already use it.

Using the cf CLI (recommended if cf is on PATH for the MCP child process):

{
  "mcpServers": {
    "optulus": {
      "command": "cf",
      "args": ["serve", "--transport", "stdio"],
      "cwd": "/absolute/path/to/your-project",
      "env": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

Using Python (if cf is not visible to the MCP subprocess but Optulus is installed in that interpreter):

{
  "mcpServers": {
    "optulus": {
      "command": "python3",
      "args": ["-m", "contextforge.mcp", "--transport", "stdio"],
      "cwd": "/absolute/path/to/your-project",
      "env": {
        "PYTHONUNBUFFERED": "1"
      }
    }
  }
}

Optional: Claude Code plugin

A plugin skeleton lives under .claude-plugin/ in this repo (plugin.json, mcp.json, and a skill). Prefer project-scoped installation so cwd matches the repository; see docs/claude-code.md.

Use the tools in a session

  1. Call get_context with a concrete task string. You receive ranked nodes and a JSON context_block sized with max_tokens.
  2. Use get_file or get_symbol to drill into paths or names from those results.
  3. Optionally call record_outcome with the session_id returned by get_context after a turn.

Prefer these tools for code exploration instead of reading large files blindly. The server also sends instructions in the MCP handshake.

Notes

  • Switching projects: Point cwd (or CONTEXTFORGE_REPO_ROOT) at each repo’s root, or add another MCP entry with a different name.
  • SSE / HTTP: For network transports, run cf serve --transport sse --port 8765 (or streamable-http); see docs/claude-code.md.

Design Constraints

  • Python 3.11+
  • Local-only persistence: SQLite and in-process Qdrant
  • No LLM calls in indexer/query engine
  • Rich-based CLI output (stderr for status/progress)

Output Example

cf context prints ranked nodes, token estimate, baseline estimate (12,000 tokens), and computed savings, plus a ready-to-paste JSON context block.

Metadata

Release files for optulus 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for optulus 0.1.0
File Size Uploaded Provenance Actions
optulus-0.1.0.tar.gz 28.7 kB Without provenance Details for optulus-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for optulus 0.1.0
File Interpreter ABI Platform Actions
optulus-0.1.0-py3-none-any.whl Python 3 none any Details for optulus-0.1.0-py3-none-any.whl

Total release size: 60.4 kB

Release files / optulus-0.1.0.tar.gz

Download URL optulus-0.1.0.tar.gz
Size 28.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab153923f85d8bde726872d46132bbab1e8ef2b1d286a1b7ef87806aaa961e71
BLAKE2b-256 checksum
How to use checksums
048f8ed98ffe85f5f51cc8050e2a2cd98dc08d1eeea589b0c4246e148c51b883
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / optulus-0.1.0-py3-none-any.whl

Download URL optulus-0.1.0-py3-none-any.whl
Size 31.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce488fb078b9bd7ebabd126023ed29a43f3d98323525c90157d5a37822fb087b
BLAKE2b-256 checksum
How to use checksums
02b3c953cda1718afb44a6e1a91bafd67671bfbc3a02d388ff2d30eb6eb3ab85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for optulus 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page