Use case · CI/CD

Agents on the night shift.

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

The short answer

A headless coding agent for CI runs the agentic loop without a terminal: scripted prompt in, diff out, exit code gating the pipeline.

Read the full answer

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 night-shift boundary

Nobody is watching at 3 a.m. The policy is.

Nobody is at the prompt in CI. The project profile scopes the work root; require_kernel makes it a kernel rule.

Sandbox · interactive
Profile
Enforce
Kernel
netmachine$TMPDIR~ homeproject + stateagent
policy line in the system prompt
Sandbox: profile=project; reads=project+state root; writes=project+state root;
  network=allow; env=sanitized (secrets filtered); enforce=tool-layer.
What each profile lets a process touch, and the rule that stops it.Anvaya-CLI/crates/anv-sandbox/src · anv-types/src/sandbox.rs

The playbook

Spec in, diff out.

Scope to one jobFresh session per run with a written spec file. No transcript carryover, no cross-job state except the memory graph.
Preview before mutate--plan-only in PR comments for human review; --yolo only on branches where revert is trivial and tests gate.
Pack memory, not historyEach run loads packed project knowledge (known flakes, prior reverts, conventions) at 2–4K tokens, orientation without the 50K bill.
Gate 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.

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

Questions

Asked about headless runs.

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.

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.

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.

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.

Run agents that fit on your laptop.

23.4 MB median own-process memory, measured across 1030 runs (994 verified) and fourteen harnesses. One command installs the harness and the Mind together. Nothing leaves your machine on the Ollama path.

Developer beta. macOS on Apple Silicon and Linux on x86_64 or arm64. Memory figure: --no-mind, macOS/ARM, n=3 per cell. Pre-1.0, pricing not set.