# ops/ — an agentic OS for Claude Fable 5

The scaffold from **[Build an autonomous agent with Fable 5](https://fableguide.com/agent/)**.
Plain files and small scripts — no framework. Drop this `ops/` directory at the root of the
repo your agent tends, and work through the layers in order. Each layer ends in a checkpoint
you can run.

The one idea underneath all of it: **the model supplies the intelligence; the OS supplies the
honesty.** Nothing here trusts the model to grade its own work — a script always casts the
final vote.

## What's in here

| File | Layer | What it does |
|------|-------|--------------|
| `models.json` | 00 | The only place a model id appears. Change a model in one line. |
| `probe-cost.sh` | 00 | Checkpoint: watch the effort dial move the price. |
| `CONSTITUTION.md` | 01 | Hard rules the agent reads every run. |
| `check-constitution.sh` | 01 | Enforces the constitution. The final vote — wire it into `pre-commit`. |
| `planner.settings.json` | 02 | Claude Code permissions that give the planner no write tools. |
| `heartbeat.py` | 03 | The daily loop. Fable decides; cheaper models execute. |
| `trust.py` + `trust.jsonl` | 04 | Earned autonomy: 20 runs at 95% unlocks unattended; a slip revokes it. |
| `goals.jsonl` + `verify-goals.sh` | 05 | Re-verify finished work every day. |
| `budget-guard.sh` + `spend.jsonl` | 06 | Hard daily spend cap. |
| `quarantine.py` | 07 | Wrap stranger-written text as data, never instructions. |
| `RUNBOOK.md` | 08 | Every alarm mapped to a response. |

## Prerequisites

```
claude          # Claude Code CLI, with Fable 5 access
pip install anthropic
jq gh git make cron
# a repo with a real test command (edit `make test` references to match yours)
```

Set `ANTHROPIC_API_KEY` in your environment (or a gitignored `.env`) before running
`heartbeat.py`. The interactive layers (planning, reviewing) run inside a Claude subscription;
only the unattended loop bills the API — which is exactly why Layer 06 exists.

## Fastest path to trust

1. **Layer 00–02, attended.** Run the checkpoints. Confirm the planner can't write and the
   constitution blocks a bad commit. Ten minutes.
2. **Layer 03, dry run.** `DRY_RUN=1 python ops/heartbeat.py` — it decides and plans, writes
   nothing. Read every plan.
3. **Layers 04–06.** Let the trust ledger fill on PR-only runs. Turn on the budget guard.
4. **Widen on evidence.** A task type goes unattended only after it earns it. See the 30-day
   rollout in the guide.

Full walkthrough, with the why behind every choice: <https://fableguide.com/agent/>

---
Independent — not affiliated with Anthropic. Verify pricing and API parameters against
<https://platform.claude.com/docs>. MIT-licensed; adapt freely.
