run: steps are your code
Scripts and checks run with your permissions. The guard still checks their changes afterwards.
safety model
caffeine runs agents with nobody watching. Prompts can ask, but only commands can enforce. Here is every layer caffeine enforces around a step, and, just as plainly, what it leaves to you.
// 01 · the guard
After every step that passed, script or agent, whatever the runner, caffeine lists every file added, changed or deleted since the start of the run, and fails the run if one of them matches a protected path. A protected file that is touched and then put back still counts as changed.
# protected by default
**/.env **/.env.* .github/** .gitlab-ci.yml
**/*.pem **/*.key **/*.p12 **/*.pfx **/id_rsa* **/id_ed25519*
.caffeine.conf
guard.forbid in config.yaml.guard_allow: [".github/workflows/main.yml"]..caffeine.conf can never change the guard..gitignore are left out, so build output doesn't trip it.// 02 · tool allowlist
For the claude runner, only the tools in the step's allowed_tools are loaded and approved. Everything else is refused without a prompt.
allowed_tools: [Read, Edit, Grep, Glob, "Bash(cargo build*)", "Bash(cargo test*)"]
Agent, Task) are always disabled.// 03 · sandboxes
sandbox: runs a step's processes (run:, verify:, a cmd agent, the Claude Code CLI) in a container or under bubblewrap, or moves the whole run into a Kubernetes pod. A sandbox sees the workspace, the run's logs, the pipeline's files and skills. Nothing else: no ~/.ssh, no ~/.claude, no config.yaml, no other runs.
| engine | scope | runs on | good for |
|---|---|---|---|
| podman · docker | one container per run and target | macOS, Linux | builds with a known image |
| bwrap | bubblewrap, no image | Linux | light isolation, host toolchain |
| kubernetes | the whole run in one pod | from Linux | shared clusters, host-list networks |
env:..git is read-only, so a step can't plant a hook, an fsmonitor or a filter for caffeine's own git to run.sandbox_required: true refuses any step left on the host.// 04 · network
network: limits what a sandboxed step can reach: none (loopback only), named host lists, or full. A setting caffeine can't enforce is refused when the run starts, never silently widened.
networks: # config.yaml pypi: [pypi.org, files.pythonhosted.org] network: [crates, github] # built-in lists: crates, npm, github
| none | host lists | full | |
|---|---|---|---|
| podman · docker · bwrap | enforced | refused | yes |
| kubernetes | NetworkPolicy | CiliumNetworkPolicy | yes |
| no sandbox | refused | refused | yes |
network.log and summary.json; network_on_deny: fail fails the run.network_allow_full: false refuses full everywhere.// 05 · deterministic checks
verify: is where quality is decided. A model can claim anything; a command can't. Checks that pay off:
caffeine scope <globs>The diff stays inside the expected files.
cargo build && cargo testBuild and tests, the boring and essential part.
caffeine check smokeStart the app, hit the routes that matter, compare with before the change.
caffeine check json · urlsFormat checks on what an agent produced.
When the same correction comes up twice in your reviews, turn it into a check.
// 06 · review and fix
A review: step hands the run's diff to a reviewer that returns a verdict. With fix:, an agent fixes the blocking issues, then a fresh review runs again, for up to five rounds. Model ladders (model: [cheap, mid, smart]) only climb when the check fails, so the expensive model is the exception.
// 07 · trust
| input | trusted? |
|---|---|
| ~/.caffeine | Yes: config, pipelines, prompts and checks are yours. |
| .caffeine.conf, current folder or dir: target | Yes: you chose to run there. |
| .caffeine.conf in a git clone | No, unless the target sets trust_project_conf: true. |
| files, web pages, tool results | No: agents are told to treat them as data. |
A project file can change models, mcp, context and since_days, and narrow network. It can never change targets, the guard, sandboxes, networks or the Claude binary, and a role or MCP server it redefines adds no reachable host.
// 08 · pull requests and inbox
caffeine pr only commits in a fresh clone made by the run, on the run's own branch. Your checkout and default branch are never committed to.caffeine approve or caffeine reject.--auto-merge merges only when every step and check passed. Earn it with caffeine stats first, ideally with a runtime smoke test: a green build is not a working site.max_budget_usd) keeps the bill boring.interrupted.// 09 · honest limits
Every layer has an edge. We'd rather you know where they are.
run: steps are your codeScripts and checks run with your permissions. The guard still checks their changes afterwards.
cmd agentsThey follow their own CLI's permissions, not caffeine's allowlist. Give them a sandbox and a network limit if you don't trust them.
cargo build and npm install execute scripts from the project and its dependencies. Sandbox them, with network: none once dependencies are there.
Containers share the host kernel; bwrap shows the host's /usr and /etc. Host lists need Kubernetes with Cilium; a CNI that ignores policies enforces nothing.
On Kubernetes, the guard and summary are made inside the pod where the steps ran. Treat a pod run's result like its changes, and give caffeine pr a short-lived, repo-scoped token.
Running in the current folder edits your files. Use a git repo, or a git target that works on a throwaway clone.
A second Ctrl-C or kill -9 exits at once. A leftover .agent/ blocks the next run there until you delete it, on purpose.
With claude.ai connectors, list only the tools a step needs and keep irreversible actions out of apply.