OpenCAC
OpenCAC is multi-agent orchestration CLI for AI coding tools. Wires Claude Code, Antigravity, and Codex into one pipeline with validated handoffs, audit logging, and speculative decoding for local LLMs.
pip install .
opencac run "refactor the auth module" --mode private
Why
For developers who already use multiple AI coding agents and want one CLI to orchestrate them — with cloud models, local LLMs, or both.
- Claude Code, Codex, Antigravity powerful alone, but each runs in its own world
- Cloud api burns money — every hosted model call costs real tokens.
- Local LLMs lack quality — small models are cheap but can't reliably produce production-grade code.
OpenCAC solves this by chaining agents into a four-role pipeline where each agent does what it's best at, with structured validation at every hop.
Features
1. FOUR-ROLE PIPELINE
dispatcher → antigravity (research) → claude-code (plan) → codex (execute)
- Structured envelopes at every hop; downstream critiques upstream before acting
- Codex runs assess_plan — dangerous commands rejected, not blindly run
2. ROUTING MODES
private Loopback only. Private guard required. For sensitive / air-gapped work.
cloud Cloud API tokens. No local infra needed.
hybrid Cloud first, falls back to local LLM when tokens are missing.
3. LOCAL LLM SUPPORT
- Each role points to its own llama.cpp server endpoint
- Built-in spec decoding config (n-gram / draft-model) → generates llama-server commands
- Probe: constrained-grammar check verifies each endpoint before pipeline starts
4. SIDECAR VALIDATION
- Schema check on every hop — agent whitelist, message-type whitelist, payload fields
- Blocked commands: rm -rf /, shutdown, mkfs, fork bomb
- Private mode: loopback-only on all URLs including callbacks
5. JSONL AUDIT LOG
- One JSON line per action — timestamp, session_id, kind
- Filter by session, query last N entries
- Session resume: rebuild plan from log, skip completed steps
6. CLI + HTTP
CLI opencac run, opencac audit, opencac resume, interactive REPL
HTTP POST /run, GET /tasks/<id>, per-agent endpoints, /.well-known/agent.json
Distributed CLI routes through HTTP service, sync and async
7. SMART QUESTION ROUTING
- Ends with ? or starts with who/what/how/why → QA path, skips pipeline
- Task input → full pipeline, outputs artifacts
- Mentions docs/code/error/test → research step first
Quick Start
git clone https://github.com/lpoee/opencac.git && cd opencac
python3 -m venv .venv && . .venv/bin/activate && pip install .
# Private (local llama.cpp shards)
export A2A_ANTIGRAVITY_URL=http://127.0.0.1:18101
export A2A_CLAUDE_CODE_URL=http://127.0.0.1:18102
export A2A_CODEX_URL=http://127.0.0.1:18103
opencac run "task" --mode private
# Cloud
export A2A_ANTIGRAVITY_TOKEN=...
export A2A_CLAUDE_CODE_TOKEN=...
export A2A_CODEX_TOKEN=...
opencac run "task" --mode cloud
# Hybrid
export A2A_CLOUD_FALLBACK_LOCAL=1
opencac run "task" --mode cloud
Agent Integration
Connect real AI agents for production-quality research, planning, and code generation. When set, the pipeline calls real agents first and falls back to local heuristics on failure.
# Antigravity — Gemini research via JSON-RPC (A2A protocol)
export OPENCAC_RESEARCH_URL=http://127.0.0.1:18791
# Claude Code — planning via Claude Bridge (Anthropic messages API)
export OPENCAC_PLANNER_URL=http://127.0.0.1:9300
# Codex — AI code generation via CLI
export OPENCAC_CODEX_BINARY=/usr/local/bin/codex
opencac run "refactor the auth module" --mode private
| Variable | Agent | Protocol | Purpose |
|---|---|---|---|
OPENCAC_RESEARCH_URL |
Antigravity | JSON-RPC 2.0 message/send |
Web research via Gemini |
OPENCAC_PLANNER_URL |
Claude Bridge | POST /v1/messages |
Plan generation via Claude |
OPENCAC_CODEX_BINARY |
Codex CLI | JSONL subprocess | AI code generation |
The generate plan action dispatches work to Codex CLI for AI-assisted code generation.
Without these variables, the pipeline uses deterministic local heuristics (file search, template plans, subprocess execution).
Docker:
docker build -t opencac .
docker run --rm -p 8000:8000 -v "$(pwd)/data:/data" opencac
Speculative Decoding
opencac run "task" --mode private \
--spec-type ngram-simple \
--draft-max 64 --draft-min 16
| Strategy | Description | VRAM |
|---|---|---|
| Self-speculative (default) | n-gram cache on main model | Zero extra |
| Draft-model | Smaller model generates draft tokens | Extra model |
HTTP API
| Method | Path | Description |
|---|---|---|
GET |
/.well-known/agent.json |
Agent card |
GET |
/tasks/<id> |
Status + steps |
GET |
/audit?session_id=<id>&last=20 |
Audit log |
POST |
/run |
Run task |
POST |
/run?distributed=1&async=1 |
Async distributed |
POST |
/agents/<agent>/message/send |
Message an agent |
Output
artifacts/<session-id>/plan.json— execution planartifacts/<session-id>/result.md— routing, strategy, step results.opencac/audit.jsonl— full event log
Testing
PYTHONPATH=src pytest -q # 32 tests
Security
See SECURITY.md.
Contributing
License
MIT
Metadata
Release files for opencac 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| opencac-0.2.0.tar.gz | 41.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| opencac-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 73.4 kB
Release files / opencac-0.2.0.tar.gz
| Download URL | opencac-0.2.0.tar.gz |
|---|---|
| Size | 41.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8654a4fb29c1a60b8ac95eae54c949895b9558b3bbc0500a37bbbaeccd61f92
|
|
BLAKE2b-256 checksum How to use checksums |
66ece5340d422a6708a2b1b7e4601546075f7edc8dea0ca49a05bc392e7fd737
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logRelease files / opencac-0.2.0-py3-none-any.whl
| Download URL | opencac-0.2.0-py3-none-any.whl |
|---|---|
| Size | 32.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
81c4ae98e072811e9174407bfb4a24d746ce29a7f5a879ac8d360b950669d397
|
|
BLAKE2b-256 checksum How to use checksums |
8a8dc25dcb79984be53aff5dbb000e33ce9cfeb9ecb48ce52cbea6a8bc932c2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency log