heretic-cli
Command-line interface for managing containerized AI coding agents with layered configuration, secure secrets, build sidecars, and multi-provider support
heretic-cli runs AI coding agents (Claude Code, GitHub Copilot CLI, OpenCode, Gemini CLI) inside Docker containers on your own machine or server. It manages the agent profiles, the images they run in, the secrets they need, the MCP servers they talk to, and the sibling containers that carry build toolchains.
It is a single native executable built with Bun and TypeScript — no runtime dependency tree, no daemon of its own.
CLI-First Approach
All agent configuration is done through CLI commands. The CLI creates and manages:
- Secret scripts — small executables that print API tokens on demand, so no token is ever written into YAML
- Claude settings — Claude Code permissions and model configuration per agent
- Agent profiles — the full container definition (image, volumes, env, MCP, runner)
Never edit generated config by hand
Use heretic-cli init, heretic-cli agents edit and heretic-cli local-init for all changes. Hand-edited files are not validated until you run heretic-cli agents validate or heretic-cli local-validate.
Key Features
- Multi-provider support — Anthropic (API key or OAuth subscription), third-party Anthropic-compatible APIs (ZAI, Kimi, or any custom base URL), and GitHub Copilot
- Layered configuration — global profile → per-project override → CLI flags, with
${VAR}interpolation - Secure secrets — token values come from scripts, environment references, or literals, resolved at run time
- MCP integration — inline servers, external JSON files, and auto-detection of the three common MCP JSON shapes
- Sessions — several isolated instances of the same agent in the same project
- Build sidecars — keep
npm,pip,mvn,go,cargoout of the agent image and run them in sibling containers over HTTP, or on a remote host over SSH - Image builder — generate and build agent images and builder images from templates, single- or multi-arch
- Cross-platform — Linux, macOS and Windows
Commands at a Glance
| Command | What it does |
|---|---|
init | Interactive global setup: GitHub tokens and agent profiles |
agents | Profile CRUD: list, add, edit, show, validate, delete, mcp |
local-init | Create a per-project override for a profile (or a compose.yaml template) |
local-validate | Resolve and validate the project's local configs |
run | Start an agent container (also reachable as heretic-cli <profile>) |
ps / stop / attach | Inspect, stop and re-attach to running agents |
image | Build agent images, builder (sidecar) images, or print generated templates |
doctor | Environment health checks |
update | Self-update from the latest GitHub release |
Quick Overview
# 1. Global setup: tokens + first agent profile
heretic-cli init
# 2. Per-project overrides (optional but recommended)
cd ~/code/my-project
heretic-cli local-init claude
# 3. Run the agent in this directory
heretic-cli run claude # or: heretic-cli claude
Next Steps
- Installation — install heretic-cli
- Setup & Upgrade — end-to-end first-time setup
- Quick Start — three working agent recipes
- Commands — full command reference
- Configuration — profiles, overrides, secrets, MCP, sidecars