Use Case · CI/CD

Agents on the Night Shift.

Scripted runs, gated merges, memory-aware retries. CI that learns from every red build.

Direct answer

A headless coding agent for CI runs the agentic loop without a terminal: scripted prompt in, diff out, exit code gating the pipeline. Anvaya's headless mode (anv --no-tui --yolo, exits 0/1/2-denied, pipeable I/O) fits standard runners — one job, one spec, tests as merge gates — with two differentiators: read-only plan mode previews mutations before they land, and memory-aware runs pack the repo's bug threads and past outcomes into each job, so nightly retries stop rediscovering known traps. Approval policy follows revert cost (auto-approve where git revert is one command, gate everywhere else), per-job token metering keeps spend predictable, and timestamped backups precede every mutation. Interactive judgment for architecture; headless throughput for everything specified.

The Playbook

Spec In, Diff Out.

01Scope to one jobFresh session per run with a written spec file. No transcript carryover, no cross-job state except the memory graph.
02Preview before mutate--plan-only in PR comments for human review; --yolo only on branches where revert is trivial and tests gate.
03Pack memory, not historyEach run loads packed project knowledge (known flakes, prior reverts, conventions) at 2–4K tokens — orientation without the 50K bill.
04Gate on signalsExit 2 on denial, failing tests block merge, per-job token caps with outlier alerts. Red builds become ledger entries the next run learns from.

Fit

Automate This, Not That.

01AutomateDependency bumps + fallout fixes, format/lint/test loops, codemod migrations with gates, flake triage, batch spec-to-patch.
02Keep interactiveArchitecture calls, production hotfixes with unknown blast radius, anything where a wrong merge costs more than a planning session.

Questions

Asked About Headless Runs.

Q

How do headless agent runs stay safe?

Three controls: narrow scopes (one job, one spec), approval policy matched to revert cost (--yolo only where git revert is one command), and tests as merge gates. Read-only --plan-only previews changes before any mutation lands. Denials exit 2 so pipelines gate cleanly.

Q

What makes a run memory-aware?

Past sessions' bug threads and fix outcomes pack into the run's context: the agent starts from what the repo already learned (flaky tests, known traps, prior reverts) instead of rediscovering them at CI-minute prices.

Q

What jobs fit headless agents?

Repetitive, well-specified work: dependency-bump + fix fallout, lint-format-test loops, migration codemods with test gates, nightly flake triage, spec-to-patch batch jobs. Fuzzy architectural calls stay interactive.

Q

How do costs stay predictable?

Fresh session per job with a written spec (no transcript carryover), packed memory (2–4K vs ~50K raw), quiet command flags, and local models for triage with frontier escalation only on failure. Meter per-job tokens and alert on outliers.

Stop Starting From Zero.

One binary. 11+9 Rust crates. 545 tests. Hand-written HNSW index. Three transport modes. Four providers, Ollama, Anthropic, OpenAI, Siemens. Zero API keys required to start. Mind remembers everything after the first session.