Skip to main content

Local code-intelligence layer for AI coding tools (Claude Code, Codex, Gemini, Copilot). Retrieve less, read less, edit safer.

Project description

Code Context Control (C3)

The local code-intelligence layer for AI coding tools.
Stop burning tokens on whole-file reads, blind greps, and unbounded log dumps.
Works with Claude Code, Codex, Gemini CLI, and VS Code Copilot.

License: Apache-2.0 Python 3.10+ Platforms Status: Beta

C3 web dashboard


Why C3?

LLM-driven coding tools have one expensive failure mode: they read too much. They cat whole files, regex the entire repo, dump 10k-line logs into context, and burn through budget before they touch a single line of code.

C3 is a thin, local layer that sits between your IDE and your repo and forces the model to read like a senior engineer:

Without C3 With C3
Read whole 2k-line file c3_compress → 70% smaller map, then c3_read(symbols=…) for the exact function
Grep the whole repo blindly c3_search returns ranked candidates with TF-IDF + symbol awareness
Dump full pytest output into the prompt c3_filter distills 500 lines → 30 actionable ones
Edit, hope it compiled c3_edit writes via a ledger + c3_validate runs pyright/tsc automatically
Bash test runs that hang on Windows c3_shell returns structured {exit_code, stdout, stderr, duration} with auto-filter
Lose context on /clear c3_session(snapshot) + c3_memory persist decisions across sessions

Everything runs locally. No source code or prompts ever leave your machine unless you explicitly opt into a third-party model API.


Install

Requires Python 3.10+.

# Clone and install
git clone https://github.com/drknowhow/code-context-control.git
cd code-context-control
pip install .

# Initialize a project (interactive)
c3 init /path/to/your/project

This walks you through:

  1. IDE selection (Claude Code / Codex / Gemini / VS Code).
  2. Optional local git init.
  3. MCP server registration.
  4. (Claude Code only) Permission tier selection.

Headless / scripted install:

c3 init /path/to/project --force --ide claude --mcp-mode direct --permissions standard

What you get

Surgical reads

c3_compress(file_path="services/router.py", mode="map")    # structural outline (~30% tokens)
c3_read(file_path="services/router.py", symbols=["ModelRouter._classify_features"])

Ranked search

c3_search(query="prompt cache hit rate", action="code", top_k=5)

Safer edits + automatic validation

c3_edit(file_path=..., old_string=..., new_string=..., summary="fix off-by-one")
c3_validate(file_path=...)        # pyright/tsc if installed; syntax check otherwise

Distilled output

c3_filter(text=pytest_output)     # 500 lines → 30 actionable
c3_shell(cmd="pytest -x")          # structured, auto-filtered

Persistent memory

c3_memory(action="recall", query="why did we switch to direct MCP mode")
c3_session(action="snapshot")     # before /clear

A web dashboard for everything you've done

C3 Project Hub

c3-hub                            # http://127.0.0.1:3330

The Hub gives you per-project edit ledgers, session history, memory graphs, benchmark dashboards, and IDE/MCP profile management.

C3 Notifications C3 IDE config


Tiered local AI (optional)

C3 ships with optional Ollama integration for offload work the primary model shouldn't waste context on:

Tier Model class Used for
Nano qwen2:0.5b Sub-100 ms intent routing
Micro deepseek-r1:1.5b Last-turn Q&A, summarization
Base llama3.2:3b+ Code analysis, technical reasoning
c3_delegate(task="summarize this 4k-line stacktrace", backend="ollama")

Ollama is optional. C3 works fine without it.


Permissions (Claude Code only)

C3 can manage Claude Code permission tiers via .claude/settings.local.json:

Tier What it allows
read-only Exploration — no file writes, no git writes, no installs
standard Normal dev workflow — edit, build, test, local git (recommended)
permissive Full trust — everything except destructive ops

All tiers always allow C3 MCP tools and include a deny list that blocks rm -rf, sudo, git push --force, etc.

c3 permissions show
c3 permissions standard

Benchmarks

c3 benchmark /path/to/project

Runs C3 against open task suites (Aider Polyglot, SWE-bench Lite) with local-Ollama delegate measurement included.


Security & Privacy

C3 runs locally. The Hub binds to 127.0.0.1 by default. Do not expose the Hub to a public network without putting auth/TLS in front of it.

No telemetry by default. Opt-in Sentry crash reporting is available via the [telemetry] extra and requires both SENTRY_DSN (your project) and C3_TELEMETRY_OPT_IN=1 to activate. Even when enabled, request bodies, local variables, and prompts are stripped before sending.

See SECURITY.md for vulnerability reports, the full hardening guide, and the telemetry scrubbing details.


License

  • Core / OSS — Apache License 2.0 (see LICENSE).
  • Pro tier (planned: license-key activation, hosted team Hub, advanced memory) — separate commercial EULA (see EULA-PRO.md).
  • Third-party deps — listed in THIRD_PARTY_LICENSES.md.

Links

  • Changelog: CHANGELOG.md
  • Security policy: SECURITY.md
  • Issues / questions: open a GitHub issue or email dtselenc@gmail.com

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

code_context_control-2.28.0.tar.gz (775.7 kB view details)

Uploaded Source

Built Distribution

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

code_context_control-2.28.0-py3-none-any.whl (817.3 kB view details)

Uploaded Python 3

File details

Details for the file code_context_control-2.28.0.tar.gz.

File metadata

  • Download URL: code_context_control-2.28.0.tar.gz
  • Upload date:
  • Size: 775.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for code_context_control-2.28.0.tar.gz
Algorithm Hash digest
SHA256 4a72a7474de594539838038b423b7e9c9ff8c25a04a2972e28a294b80647da87
MD5 8eba5ee6f3552d251967d0a86cf7fff0
BLAKE2b-256 6811d5a41c152c97218af39bc705f5ba13c4238f3ae40bd14140fef8a9feb2be

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_context_control-2.28.0.tar.gz:

Publisher: release.yml on drknowhow/code-context-control

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file code_context_control-2.28.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_context_control-2.28.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1a7a54f67f7a76822499b6abf297498773b7f605836ab4569202e92a8ca0fe6a
MD5 8b3433b5082e6d52725ad6749bd3f4d4
BLAKE2b-256 a6a67963e50033d5bb27bad209f4edb5937ab8c13565ff7d6305b4e28aa26eba

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_context_control-2.28.0-py3-none-any.whl:

Publisher: release.yml on drknowhow/code-context-control

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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