# Loop Harness MVI

Loop engineering is useful only after it becomes a harness:

1. **One bounded cycle**: claim one task, run one worker, stop.
2. **Durable state**: task status lives in JSON/DB, not agent context.
3. **Event log**: every cycle appends JSONL evidence.
4. **Budget gate**: token estimate blocks before work starts.
5. **Verifier gate**: tests/review decide whether the next cycle may run.
6. **Human gate**: pause on deploy, unknown failures, or budget spikes.

This repo's smallest working primitive is `pipeline/harness_loop.py`.
It intentionally does not run agents itself; callers plug in Claude Code, Pi,
Codex, OpenClaw, or local scripts after a task is claimed.

```bash
python -m pipeline.harness_loop \
  --tasks .runs/demo/tasks.json \
  --events .runs/demo/events.jsonl \
  --run-id demo \
  --max-tokens 20000 \
  --estimate-tokens 3000
```

Skipped for now: dashboards, Postgres, queues, schedulers, and multi-provider
routing. Add those only after the JSONL spine proves the loop is worth running.
