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

  • Current OSS license — Apache License 2.0 (LICENSE). Free for any use, including commercial. Modify, fork, redistribute — all permitted under Apache-2.0 terms.
  • Third-party deps — see THIRD_PARTY_LICENSES.md.

The author may introduce a paid offering or relicense future major versions; no commitment either way. Releases already published under Apache-2.0 (including all 2.x versions) keep their Apache-2.0 grant — that grant is irrevocable. Background and FAQ in LICENSING.md. No warranty or support obligation; see LICENSE Sections 7–8.


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.2.tar.gz (775.8 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.2-py3-none-any.whl (817.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: code_context_control-2.28.2.tar.gz
  • Upload date:
  • Size: 775.8 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.2.tar.gz
Algorithm Hash digest
SHA256 42214e1aad504edb3cced029d18751e2eb54e81a0186a99397ed5ba05614854a
MD5 672ca5f197d239b4002107dcc1022326
BLAKE2b-256 3bb41a91ffec217e37f53cdae5cd0d570aa28de77bbaba2fb798397910356507

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_context_control-2.28.2.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.2-py3-none-any.whl.

File metadata

File hashes

Hashes for code_context_control-2.28.2-py3-none-any.whl
Algorithm Hash digest
SHA256 00ce67fad2b71c4df3654264fdb1962043231a50ddf9269298746a26661f7dc6
MD5 f4845cd9587d4c6f1634925c872433fd
BLAKE2b-256 99e9a5eec1cafaacf9dd8b5f4f16effc32cb861c799e8a04ad6f21b2df8fdc11

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_context_control-2.28.2-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