npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

agentic-coding-harness

v0.46.0

Published

Run, watch, and meter coding agents — Claude Code, OpenCode, Kiro, Codex CLI, Gemini CLI, Antigravity CLI, Prime Agent — with normalized events, cost accounting, A/B experiment/variant comparison, external run sources, and replayable run artifacts.

Downloads

10,222

Readme

agentic-coding-harness — cost tracking and observability for Claude Code, Codex CLI, Gemini CLI, Antigravity CLI, OpenCode, Kiro, Prime Agent, and GitHub Copilot CLI

Agents hide the burn. ach runs, watches, and meters Claude Code, Codex CLI, Gemini CLI, Antigravity CLI, OpenCode, Kiro, Prime Agent, and GitHub Copilot CLI from one CLI — agent cost tracking whose numbers verify against each CLI's own records.

Live web dashboard grid showing token usage and cost across concurrent Claude Code and Kiro agent runs, with interactive terminal panes

Highlights

  • One CLI, six agents (plus the Kiro IDE) — claude, opencode, kiro, codex, gemini, prime adapters (plus agy for the Antigravity CLI, copilot for GitHub Copilot CLI, cursor for the Cursor CLI agent, and kiro-ide, which drives the Kiro desktop app over CDP) normalize six different transcript formats into one AgentEvent stream and one canonical token record (input, output, cache read, cache write, reasoning).
  • Cost math you can defend — cache-aware accounting verified against each CLI's own ground truth (Claude session JSONL, Kiro session files, provider-reported costUSD); LiteLLM pricing, and unpriced models are marked unavailable rather than silently assigned a price.
  • Live agent runs dashboard — ach dash redraws 2×/s in the terminal; ach web (port 8399) grids every run with a browser terminal you can type into — PTY per run, vendored xterm.js, zero CDN. Typing and every other privileged route sit behind a per-server token, like Jupyter's ?token= URL.
  • Terminal replay — every run renders to an asciinema-format .cast, so you can scrub what the agent did and when.
  • Run registry — every run persists to <stateDir>/runs/<runId>.json with atomic writes; survives kills, dumps as --json for tools.
  • 10 MCP tools — launch runs and read usage from any MCP client over stdio, or streamable HTTP on port 8398 (ach serve).
  • Artifacts out — ATIF v1.7 trajectories, OpenTelemetry gen_ai spans, Langfuse via OTLP, and single-file HTML comparison reports.
  • Usage you can act on — timezone-aware stats, model/project breakdowns, cache efficiency, rolling billing blocks, quota headroom, context pressure, and persisted threshold alerts.
  • Verified trials — --verify, fresh-session repeats, pass@k and Wilson intervals, and score history from ach regrade.
  • LLM-judge rubrics: --judge rubric.md or ach judge <run-id> grades a run 0.0-1.0 per criterion, blends it with --verify and gates on --threshold (a failed --verify always fails the run, whatever the judge says); the judge is its own metered run (docs/JUDGE.md).
  • More ways to run — custom command templates, agents.d descriptors, an offline null adapter, and standalone macOS/Linux executables.

How it compares

| Compared with | Runs and budgets | Events and cost | Registry and output | |---|---|---|---| | usage CLIs (ccusage etc.) | ach launches, aborts, and budget-caps the runs it meters | normalized token events across 6 agent CLIs | per-run registry keyed by runId + live web grid | | observability platforms (Langfuse etc.) | ach launches and meters the runs itself | local-first flat files — no account, no ingest step | exports to them via OTLP when you want their charts | | tmux + grep | one launcher for all six agents | normalized event schema + cost math | run registry + single-file HTML report |

Is this for you?

  • For you if you run coding agents locally and want per-run tokens, cost, and credits from one place — including opt-in budget enforcement that aborts a runaway run mid-flight.
  • For you if you A/B compare coding agents: same task, six agents, one comparison table, one local registry.
  • Not for you if you need hosted team features (SSO, retention, org-wide dashboards). ach is local-first by design and exports to Langfuse and other OTLP backends when you outgrow it.

Install

Homebrew installs the Node-based CLI; Bun is not required:

brew tap sblattj/agentic-coding-harness https://github.com/sblattj/agentic-coding-harness
brew install sblattj/agentic-coding-harness/ach
ach --version

| Install path | Command or download | Requirements | |---|---|---| | Homebrew | Commands above | Homebrew; Node is installed as a dependency | | npm | npm install -g agentic-coding-harness | Node.js 22+ | | Standalone | GitHub release binaries and SHA256SUMS | macOS or Linux, arm64 or x64; no Node/Bun runtime | | Python wrapper | uv tool install agentic-coding-harness or pipx install agentic-coding-harness | Python 3.9+ and Bun or Node.js 22+ |

npm releases are published by the release workflow after the binaries build. GitHub Release binaries are always available; npm may lag if publishing failed, so compare npm view agentic-coding-harness version with the latest release. See packaging for publishing.

From a source checkout (fresh clone or worktree), ach is not on PATH until you build it:

bun install && bun run build:node && bun link

package.json declares bin.ach = dist/cli/ach.js, and dist/ is a gitignored build output that build:node writes. Without the build there is nothing for bun link to point at. To skip the build, run the source entry directly: bun run src/cli/ach.ts run ....

Standalone binaries embed the web dashboard. The interactive browser terminal and ach run --interactive require bun-pty and are unavailable in standalone builds; CLI runs, stats, terminal dashboard, and the rest of the web dashboard remain available. See packaging for checksum verification and release automation.

Quickstart

You need Node.js 22+ and at least one agent CLI that is installed and signed in: ach runs the agent, it does not install it. The examples use Claude Code:

npm install -g @anthropic-ai/claude-code

Then run claude once and sign in. ach doctor shows which agents ach can find. ach init does the first-run setup for you: it detects the agent CLIs on PATH, asks for a default agent, model, budget cap and max turns (or takes them as flags with --yes), runs the doctor checks for the chosen agent and writes run.agent / run.model / run.budgetUsd / run.maxTurns into the config file (docs/CONFIG.md), so ach run "..." needs no flags afterwards. Run the commands below inside the repository you want the agent to change.

Each ach run gives Claude Code a fresh config dir, which cannot see the session from claude's own sign-in. --claude-default-config uses your normal Claude config and login; alternatively set CLAUDE_CODE_OAUTH_TOKEN (from claude setup-token) or ANTHROPIC_API_KEY.

# without installing ach:
npx -y --package=agentic-coding-harness ach run --agent claude --claude-default-config "add a --dry-run flag to scripts/lint.sh"

# or install it globally:
npm install -g agentic-coding-harness
ach run --agent claude --claude-default-config "add a --dry-run flag to scripts/lint.sh"

Dashboard: ach web keeps running, so start it in its own terminal. It opens http://127.0.0.1:8399/?token=<token> in your browser and prints that URL (--no-open skips the browser). The token is generated on first start and kept in <stateDir>/web/token, so the URL keeps working across restarts; see Auth.

ach web                                        # live dashboard on :8399; leave it running

Then, from any other terminal, run an agent. This one uses the Codex CLI (sign in by running codex once after installing it):

npm install -g @openai/codex
ach run --agent codex "fix the failing test"   # shows up in the dashboard grid; TERM opens a new terminal pane

Demo: one task, six agents, one cost table

Real token and cost accounting across every installed agent — output shapes are the real ones (formatSummary in src/cli/lib.ts, the table in src/cli/dash.ts); values from actual runs:

ach stats terminal output showing per-agent and per-day token usage, cache reads, and cost in USD across Claude Code, Codex CLI, Gemini CLI, OpenCode, and Kiro

$ ach run --agent claude --max-turns 40 "add a --dry-run flag to scripts/lint.sh"
[14:03:11] step
[14:03:13] tool    Read
[14:03:19] tool    Edit
[14:03:24] step
sessionId  7c1f0a2e-4b9d-4e1a-9c33-8f2a1d5b6e70
tokens     input=4,812 output=933 cacheRead=38,204 cacheWrite=1,120 reasoning=640
cost       $0.0612
duration   31.4s
exit       success

$ ach dash
STATUS AGENT    RUNID    SESSION  ELAPSED       IN      OUT     CACHE     COST  CREDITS LAST EVENT
+      claude   7c1f0a2e 7c1f0a2e     31s     4.8k     933    39.3k  $0.0612          step
●      kiro     91b3ce11 91b3ce11     12s       0       0        0  $0.0000   0.05cr tool    Bash

2 runs  in 4.8k  out 933  cost $0.0612  credits 0.05cr  ? help  q quit

$ ach report trials/20260911-141210          # single-file HTML comparison
$ ach emit --format langfuse --input …       # post spans to Langfuse / OTel / ATIF

The problem: coding agents hide token usage and cost

  • Agents hide burn. Kiro exposes metering credits, not tokens; Claude mixes models inside one session, so any single blended price is wrong — real Claude Code cost needs per-(model, cache-tier) math. Each adapter taps usage at its source and prices it that way. Kiro credits stay on their own summary line — never merged into USD.
  • Every CLI speaks a different format. JSONL transcripts, NDJSON stdout, ACP, SQLite — six adapters normalize all of it into one event model and one CanonicalTokenRecord (with cache-read/write/reasoning split), so dash, stats, emitters, and the MCP server are written once.
  • Nothing correlated runs across agents — until now. Runs land in a registry keyed by runId; examples/trial-all.sh side-by-sides, HTML comparison reports, and cross-agent stats are first-class, not shell archaeology.
  • Numbers you can defend. Token/cost columns are checked against ground truth: cache columns exact vs each CLI's own session JSONL; Kiro MITM credits bit-for-bit vs Kiro's session files.

What it does: token metering, verified cost tracking, and run artifacts for six agents

  • Nine CLI adapters — claude, opencode, kiro, codex, gemini, prime (headless / ACP lanes) — plus agy (Antigravity CLI, below), copilot (GitHub Copilot CLI, below), cursor (Cursor CLI agent, below) and kiro-ide, which drives the Kiro IDE desktop app over CDP (see "Kiro IDE (desktop app)").
  • Prime Agent — ach run --agent prime drives prime-agent -p --mode json; --model passes through verbatim (<provider>/<model>). Usage is counted per assistant message plus the subagent (rlm.spawn) sessions read from ~/.prime/agent/session-artifacts/; a provider-reported cost of 0 is shown as n/a, not $0. ach doctor --agent prime checks the binary and auth (PRIME_API_KEY, ~/.prime/agent/auth.json, or a provider key in ~/.prime/agent/models.json). No vendor quota source.
  • Antigravity CLI (agy): ach run --agent agy drives agy -p <prompt> --output-format stream-json --dangerously-skip-permissions (the skip flag is replaced by the policy's own flag when --permission-mode is set; --resume <id> becomes agy --conversation <id>). Auth prerequisite: run agy once and sign in (the login lives in the OS keychain, so ach doctor reports it unproven), or set GEMINI_API_KEY. Tokens come from the stream, one usage record per model call (input is uncached, cache reads are separate, output includes thinking); a --print-timeout expiry or a bad --model is recorded as an error with no usage. Cost uses the usual pricing table: the gemini-4-* models agy defaults to have no list rates yet, so their cost is n/a with a warning, never estimated. ach stats / ach watch / ach archive also read agy's own conversation logs (~/.gemini/antigravity-cli/brain/<id>/.system_generated/logs/transcript.jsonl); a run's own conversation is counted once. No vendor quota source. The gemini adapter stays: per Google's notice at the top of the Gemini CLI README (reported there, checked 2026-11-20), free and Google AI Pro / Ultra access moved from Gemini CLI to Antigravity CLI on June 18, 2026, while Gemini Code Assist Standard / Enterprise keeps Gemini CLI.
  • GitHub Copilot CLI — ach run --agent copilot drives copilot --prompt=<text> --output-format json --allow-all-tools (binary override: COPILOT_CLI_BIN). Auth prerequisite: a GitHub login that has Copilot access, by copilot login, a COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN env var, or gh auth login; without one the run fails fast with a specific copilot: not authenticated (or access denied by policy) error and is recorded unavailable. Copilot bills in AI credits (AIU), not tokens: the cost is the CLI's own totalNanoAiu telemetry at 1 AIU = $0.01, shown in the normal cost column and as credits. If that telemetry is missing the cost is n/a with a warning and tokens still show: ach never estimates a Copilot cost from token math. --resume SID bills only the resumed run's share of the cumulative session. See docs/transcript-adapters.md for where the telemetry lives and what is verified. No vendor quota source.
  • Cursor CLI agent — ach run --agent cursor drives cursor-agent --print --output-format stream-json --trust --force -- <prompt> (binary override: CURSOR_AGENT_BIN; --resume <chatId> continues a chat). Auth prerequisite: cursor-agent login or CURSOR_API_KEY. Before launching, ach runs cursor-agent status; an unauthenticated CLI fails fast with a specific cursor: not authenticated error and the run is recorded unavailable (the CLI itself reports "Authentication required" on a run and "Not logged in" on status, both with no token spent). Cost follows the usual honesty rule: the CLI's own stated cost when its result carries one (reported), else computed from the tokens its result reports (computed, with a warning), else n/a with a warning: ach never estimates a Cursor cost from text length. cursor is also the name of the read-only Cursor IDE monitor, which ach stats --agent cursor keeps reading (separate store, no double count). Supports cursor-agent 2026.10.x: its result reports tokens (net input, cache read, cache write, output) but no cost, so a Cursor run's cost is computed from --model. The default model, Auto, does not say which model served the run, so its tokens are recorded and its cost is unavailable (one warning). Recent Cursor IDE builds keep no per-message token counts on disk, so ach stats --agent cursor reports them unavailable (one warning) rather than estimating; use ach run --agent cursor or the Cursor dashboard export for exact usage. To keep a dashboard export, run ach import --agent cursor --usage-export <file> (CSV or JSON from the Cursor dashboard): the file is validated and a copy stored under <stateDir>/cursor-dashboard/; re-importing the same file is unchanged, and no run records are written. ach stats counts the stored exports (billed cost, also with --state-only): a dashboard row replaces the ach run cursor record of the same session (JSON) or with identical tokens within 10 minutes (CSV), and replaces Cursor IDE rows inside the export's time span. Stream shapes were read from the 2026.10.01 CLI bundle and verified on a live logged-in run; see docs/transcript-adapters.md. No vendor quota source.
  • Unified events, cache-aware tokens — one AgentEvent stream, one canonical token record; per-agent double-counting traps handled (docs/TOKEN-COUNTING.md).
  • LiteLLM multi-model pricing — bundled LiteLLM extract, external cost-map override; unpriced models carry an explicit unavailable price, never a silent estimate. Pricing is fully offline: the snapshot is date-stamped (ach stats --json pricing block, stale notice after 180 days, AGENTIC_CODING_HARNESS_PRICING_STALE_DAYS) and --offline on stats/watch/dash/web makes any outbound network call fail loudly (docs/TOKEN-COUNTING.md).
  • Kiro MITM credit tap — auto-starts on ach run --agent kiro when mitmdump is on the PATH; captures metering credits (extra.credits) and the native kiroSession id for grep correlation; degrades to a warning when absent.
  • Kiro ACP transport + preflight — --kiro-transport acp drives kiro-cli acp over JSON-RPC and records the proven mode/model (result.kiro.modelAck); the default headless lane forwards the same --model/--kiro-* config and records what it passed, with no implicit --trust-all-tools; ach preflight --agent kiro and harness_kiro_preflight verify binary, auth, agent, model and MCP state without sending a prompt. Token counts are reported n/a when no source carries them (kiro-cli 2.21.x) — never fabricated zeros; credits and derived context tokens are shown instead. See docs/KIRO.md.
  • agy preflight — ach preflight --agent agy [--model M] [--home DIR] and harness_agy_preflight check the agy binary, the Google sign-in under the run HOME (agy models, no prompt), on macOS that HOME's login keychain link, and the model, before a run starts; ach bakeoff runs it once before any agy cell. See docs/MCP.md.
  • Run registry + ach dash — live TUI over <stateDir>/runs (redraws 2×/s, ANSI status glyphs, totals footer); --json dumps RunRecords for tools, --all widens past the last hour.
  • Run queue — ach queue run plan.txt --max-concurrent 4 launches plan-file slices as detached ach run processes, capped by the live runs on the whole machine, with pre/post hooks, per-slice logs and a state file; see docs/QUEUE.md.
  • MCP server — ach mcp (stdio JSON-RPC; ach serve for streamable HTTP), 11 tools (harness_run{,_async,_status,_events,_cancel}, harness_kiro_preflight, harness_agy_preflight, report/emit/stats/agents) so any MCP client launches runs and reads usage; see docs/MCP.md.
  • Emitters — ATIF v1.7 trajectories (self-validating), OpenTelemetry gen_ai spans, Langfuse via OTLP. Custom static or env-sourced attributes (--attr, --attr-env, or the config file's emit section) ride on every exported span; --enricher adds a JS module for dynamic per-span attributes.
  • HTTP event tap: ach run --event-webhook <url> POSTs start, exit, budget and periodic usage events as versioned JSON ({schemaVersion, runId, type, timestamp, payload}), optionally HMAC-signed, queued off the event stream with a bounded retry budget so a dead receiver never fails or stalls the run; ach watch --event-webhook posts its live deltas. See docs/EVENT-WEBHOOK.md.
  • Alert rules: the config file's alerts key holds error_rate (N of the last M runs failed, or K in a row) and idle (a live run has gone quiet for X seconds) rules that ach watch evaluates every poll and sends to a webhook (type: "alert" envelope) or a desktop notification, with per-episode debounce and a per-rule cooldown; ach alerts --dry-run shows which rules would have fired on your run history. See docs/ALERTS.md.
  • W3C trace context: a run joins an incoming TRACEPARENT (or starts a trace), stamps trace on its record, hands its agent child and --verify checker a TRACEPARENT naming the run's span, and the OTel/Langfuse exports reuse those ids; the run summary and ach web show the copyable traceparent. See docs/TRACE-CONTEXT.md.
  • Single-file HTML reports — charts + timelines comparing every agent in a trial dir.
  • watch / stats — live per-session token deltas across claude/codex/gemini/agy/prime transcript dirs plus the opencode SQLite store; stats aggregates totals/byAgent/byDay over machine transcripts and harness state (--state-only to skip transcript scans).

A/B compare coding agents side by side — tokens, cost, credits, duration

Run the same task on every installed agent and get a single comparison: tokens in/out/cache, cost, wall-clock duration, and status per agent. No manual log diffing. For lightweight experiment tracking, the web dashboard's /compare view rolls runs up by experiment×variant or workflow×agent straight from the local registry.

For a full sweep, declare the grid once and let ach trial --matrix run it:

ach trial --matrix examples/trial-matrix.json --dry-run   # list the 9 cells, launch nothing
ach trial --matrix examples/trial-matrix.json             # run them; Ctrl-C and re-run to resume

Each cell (agent:task:model:trialN) becomes one run labelled with the plan's experiment and a variant, so /compare groups the results with no extra setup. The runner appends one row to examples/trial-matrix.ledger.jsonl only after that cell's run has finalized. A re-run skips cells that already have a verdict (passed or verify-failed) and runs the rest. Infrastructure error cells are reported and re-run only with --retry-failed; a verify failure is never retried. A cell that died on a provider usage or rate limit (429, overloaded, hit your session limit) is skipped-provider-limit: no verdict, not a failure, and run again next time, like an unavailable CLI. The plan schema, task directories (task.md, setup.sh, verify.sh), and ledger format are in docs/TRIALS.md. To compare SDLC methods x builders on one frozen contract (fresh clone per cell, every cell confined to its own dir, hidden acceptance, blind review), see docs/BAKEOFF.md.

To compare agents without writing tasks, run the bundled suite: 12 self-verifying shell, JavaScript and Python tasks, with every installed agent by default.

ach trial --suite core --dry-run                      # agents x tasks, launch nothing
ach trial --suite core --agent claude --task py-slugify --repeat 3

Agents whose CLI is not installed are skipped with a printed reason. The suite writes an HTML report next to its ledger in the state dir. See docs/TRIALS.md.

To add your own task, scaffold it instead of copying a bundled one:

ach trial new my-task --with-tests     # tasks/my-task/{task.md,task.json,verify.sh,tests/}
ach trial --suite local --tasks-dir tasks --task my-task --agent claude

The new verify.sh fails until you write the check, and trial new runs it once to show that. See docs/TRIALS.md.

To share the result, build a league table from the run registry: one row per experiment × variant (runs, success rate, mean and median cost, tokens, wall time, and the run ids with their seal verdict), the same rollup as /api/compare. It lands in the single-file HTML report and in a versioned leaderboard.json next to it, and regenerates byte-identically from unchanged runs:

ach report --registry --out site/index.html   # also writes site/leaderboard.json
ach report --registry --limit 50 --privacy anon --out site/index.html   # newest 50, ids hashed

Walkthrough and the JSON schema: docs/LEADERBOARD.md.

For a benchmark that means the same thing next month, package the tasks as a versioned pack: an ach-pack.json with a semver version, pinned by ach pack lock.

ach pack lock ./mypack && ach pack add ./mypack
ach trial --pack [email protected] --agent claude --agent codex

A locked pack whose task content changed refuses to start and names the task (--allow-drift runs it anyway, loudly). Every run record and the HTML report cite [email protected] plus its content hash. See docs/TASK-PACKS.md.

Cross-agent comparison table showing token usage, cost, duration, and status for Claude Code, Codex CLI, Gemini CLI, OpenCode, and Kiro run on the same task

Live dashboards: terminal (ach dash) and web (ach web)

One registry, two live agent runs dashboards.

Web: a tmux-like grid of every run, plus an observability view per run. On a run started with ach run --interactive the tile's TUI button attaches to that run's own PTY (same session, metered on the run; see Interactive runs) and expands the tile to a full xterm.js browser terminal you can type into. On any other run the button reads TERM and spawns a NEW, separate agent session in a PTY, labelled as such: what you type there is not part of the run and is not metered on it.

Bounded run list. ach web reads the run registry plus this machine's agent transcripts (Claude Code, Codex, Gemini and the rest, as ach stats does), which can be tens of thousands of sessions. So every list view (/api/runs, the /ws?runs=1 snapshot and each push) carries one page: the newest --page-size runs (default 200) started within --recent (default 7d; a <N>m|h|d|w duration or all). Running runs are always included. Under the grid and the main run list, load older fetches the next page, newest first, until every run is shown, and a tile opens its event feed only when it scrolls into view (and drops it again off-screen once the run is done). Set the defaults in the config file as web.recent / web.pageSize. --state-only skips the transcript scan and shows only registry runs (ach run); /api/stats and /api/compare still roll up every run.

Transcripts are indexed per file (path, mtime, size). On start the server parses the files touched within --recent first, then backfills older ones in the background; until it finishes, the list shows "indexing older sessions (N of M files)", /api/runs carries scan: {complete, filesParsed, filesTotal} and /api/stats / /health carry it as transcriptScan (stats totals cover only the files indexed so far). Each 30s refresh re-reads only files that changed. The index is saved to <stateDir>/cache/transcript-index.json (rebuilt when the bundled price table changes; safe to delete), so a restart re-reads only what changed since.

Web dashboard terminal grid showing live agent run tiles with token and cost readouts and interactive terminal panes

Observability trio — traces, metrics, and logs for a single run, with a live terminal drawer: the span waterfall, cumulative token/cost charts, and the leveled event log. The metrics pane also shows latency — time to first token, output tokens/s, time per output token, and a per-tool duration table (calls, avg, p95, total); a metric the event log cannot support reads n/a. Time to first token is measured for claude, gemini, codex (first request of each turn), agy (every model call that streams text, timed from the request) and headless kiro (first request); output tokens/s and time per output token for claude only; opencode's stream carries no request timing. See ARCHITECTURE.md ("Latency metrics") for definitions, precision and which agents emit what.

Observability view showing the traces waterfall, token and cost metric cards with charts, and the event log stream for a single coding agent run

Terminal — ach dash is a live TUI over the run registry (redraws 2×/s, ANSI status glyphs, totals footer); --json dumps RunRecords for tools. Press ? for key help (keys, status glyph legend, flags). The first launch shows it once (seen-flag <stateDir>/dash-help-seen); --help-keys forces it, --no-help suppresses the auto-show for scripts. NO_COLOR or a non-TTY gives plain text. --set-terminal-title[=FORMAT] keeps the run state in the terminal tab title, refreshed with the table (default {active} running · {done}/{total}; tokens {active}, {done}, {total}, {pct}, {spend} = today's USD; an unknown token stays as written). Quitting leaves a final summary title. Off by default, and never written to a non-TTY or --json output.

Per-model cost chips — a run that used two or more models (for example Claude mixing an opus main loop with haiku sub-agent calls) records totals.byModel (cost and tokens per model, highest cost first). The web run header shows one chip per model (claude-opus-5 $0.40 · 18.2k) and ach dash prints a models <runid> opus $0.4000 + haiku $0.0200 line under the table. An unpriced model shows n/a plus the usual unknown-model warning, never an invented cost; single-model runs, and runs recorded before this field existed, keep the plain aggregate.

Spend by git branch

ach run records the git branch (and short commit) of the run's working directory on its run record at start. ach stats --by branch (composable with --by model,project) prints a per-branch table and adds byBranch to --json. Runs with no recorded branch (older records, non-git directories, transcript-only rows) show as (no branch); a detached HEAD shows as (detached <sha>). Attribution is by start branch: a mid-run git checkout is not re-attributed.

The same labels drive two more views. /api/compare?by=branch (alias by=git.branch, composable with the other keys, e.g. by=branch,agent) groups the web rollup by branch. ach report adds a "spend by git branch" table (branch, runs, cost, tokens) whenever a trial's run records carry a branch; runs without one fall in (no branch).

Spend by pull request

ach run --pr 482 stamps the PR on the run record as pr: 482 with prSource: "flag" (the registry is flat, so these are top-level fields next to branch/commit; issue #48 calls them git.pr / git.prSource). Without the flag the PR comes from, in order:

  1. AGENTIC_CODING_HARNESS_PR (prSource: "env"), so wrapper scripts set it once per shell. The explicit flag always wins over the env var.
  2. The branch captured at run start (prSource: "branch"). A /-separated segment matches pr-<n>, pull-<n>, issue-<n> or issues-<n> (optionally followed by -slug), or <n>-slug where the slug starts with a letter: 482-fix-auth, pr-482, feat/482-x all map to 482. main, develop, bare numbers, dates (2026-11-07), versions (release-1.2, v2-beta) and branches with no number stay unlinked. The rule reads the name only, so a branch like 2fa-rollout can link to a wrong number; there is no opt-out flag, so pass --pr <n> to override it. With --isolate the branch and the gh lookup use your original checkout, not the ach/<runId> worktree.
  3. gh pr view <branch> --json number, ONLY when you pass --pr auto (or set AGENTIC_CODING_HARNESS_PR=auto) and the branch name matched nothing (prSource: "gh"). Never by default, never during stats. The lookup is cached per repo and branch for the life of the process (misses and timeouts too), so --repeat and --parallel wait for gh at most once.

ach stats --by pr (composable with --by model,project,branch) prints a per-PR table (#482 records=... cost=...) and adds byPr to --json; runs with no recorded PR land in none. Grouping reads only what was recorded at run time: no network, no gh. /api/compare?by=pr groups the web rollup the same way (PR number or none).

New in 0.11.0

ach doctor --agent claude --json                 # configuration checks, no prompt
ach run --agent null --verify 'true' --repeat 3 "offline smoke"
ach stats --last 7d --tz America/Los_Angeles --by week,model,project
ach stats --cost-mode calculate --blocks         # computed cost and Claude 5-hour blocks
ach stats --spark cost                           # 14-day trend bar on the totals line
ach stats --days 7 --compare prev                # this week vs the 7 days before it
ach stats --since 2026-09-01 --until 2026-09-08 --compare prev:7d   # Sep 1-7 vs Aug 25-31
ach quota --json                                # vendor-reported headroom, n/a when absent
ach quota wait --max-used 90 -- ./batch.sh       # start a job once the quota window has room
ach status --compact
ach statusline                                  # statusline-compatible usage summary
ach archive                                     # preserve transcripts and run records
ach regrade <run-id> --verify 'npm test'          # append a score without another agent run

--cost-mode auto|calculate|display selects reported or computed cost, with provenance labels on displayed values. Time filters, project/model dimensions, --spark cost|tokens (14-day block-bar trend on the totals line; --no-spark or a non-UTF terminal prints plain min=.. max=.. text), cache-hit ratios, and --exit-codes ladder compose with the existing stats commands. A cache panel (cache reads vs creation vs plain input) carries a prompt-cache TTL that is always tier-labeled est, reported or measured (n/a when nothing is known): cache in ach stats --json, a cache line in text stats, and cache ttl in the ach web run view. See docs/CACHE-TTL.md. Custom agents can use --agent custom --template 'mycli {prompt}' or a JSON file in .ach/agents.d/; runs without a usage source remain explicitly unmetered.

Budget behavior changed: spend thresholds warn by default. Use --budget-usd 5 --on-budget abort to enforce a hard spending cap. Wall-clock, idle, and turn limits continue to enforce their own limits. Context pressure and budget crossings share persisted alert state. Plan presets are labeled community estimates; quota output uses provider-reported values when available.

CLI

ach run [--profile NAME]   # a named set of these flags from the config file, see docs/CONFIG.md#agent-profiles
ach run --agent <claude|opencode|kiro|codex|gemini|agy|prime|kiro-ide|copilot|cursor|null|custom|descriptor> [--model M] [--resume SID]
            [--budget-usd N] [--on-budget warn|abort] [--max-turns N] [--wall-ms N] [--idle-ms N]
            [--verify CMD] [--repeat N] [--parallel K] [--exit-codes binary|ladder] [--json] "prompt"
            [--judge rubric.md [--judge-agent A] [--judge-model M] [--judge-retries 2] [--judge-max-tokens N]
             [--judge-wall-ms N] [--threshold T] [--weight W]]   # LLM-judge rubric score (docs/JUDGE.md)
            [--effort low|medium|high|xhigh|max]   # one level, mapped per agent (docs/EFFORT.md)
            [--capture-mode full|metadata|off]     # how much prompt/tool text ach records (docs/CAPTURE.md)
            [--event-webhook URL] [--webhook-events start,exit,budget,usage] [--webhook-usage-ms N]
                                                   # POST run events, fail open (docs/EVENT-WEBHOOK.md)
            [--extra-args 'a b']... [--extra-arg TOKEN]...   # see "Passing extra CLI args"
            [--permission-mode MODE] [--allowed-tools LIST]... [--disallowed-tools LIST]...
            [--mcp-config PATH|JSON] [--evidence-dir DIR]   # see "Permission and sandbox flags"
            kiro only: [--kiro-transport headless|acp] [--kiro-agent A] [--kiro-engine v1|v2|v3]
                       [--kiro-effort E] [--kiro-tools all|none|a,b] [--kiro-require-mcp-startup]
                       [--kiro-startup-ms N] [--kiro-require-model-ack] [--kiro-mcp-server '<json>']...
            kiro-ide only: [--kiro-ide-cdp host:port] [--kiro-ide-port N] [--kiro-ide-bin PATH]
                           [--kiro-ide-user-data-dir DIR] [--kiro-ide-no-new-session]
            claude only: [--claude-default-config]   # default CLAUDE_CONFIG_DIR (keychain OAuth)
                         [--claude-no-background-tasks]  # claude -p waits for spawned sub-agents
ach trial --matrix plan.json [--dry-run] [--retry-failed] [--ledger PATH] [--json] [--effort E] [--capture-mode C]
            # resumable agents x tasks x models x trials grid; re-run the same command
            # after an interruption and finalized cells are skipped (docs/TRIALS.md)
ach trial --suite core [--agent A]... [--task T]... [--model M]... [--repeat N] [--effort E] [--capture-mode C] [--tasks-dir DIR] [--ledger PATH]
            [--permission-mode M] [--allowed-tools L] [--disallowed-tools L] [--mcp-config PATH|JSON]
            # bundled task suite; missing agent CLIs skipped; HTML report next to the ledger
ach trial new <name> [--with-tests] [--tasks-dir DIR=tasks] [--suite NAME=local] [--json]
            # scaffold tasks/<name>/ (task.md, task.json, failing verify.sh); refuses to overwrite
ach trial --pack <path|name@version> [--packs-dir DIR] [--allow-drift] [--agent A]... [--model M]... [--repeat N]
            # a versioned task pack: exactly its listed tasks; a locked pack whose content
            # changed refuses to start; every run records pack name, version, hash (docs/TASK-PACKS.md)
ach pack lock <path|name@version> | add <path> | list | show <path|name@version> [--packs-dir DIR] [--json]
            # pin task content hashes (ach-pack.lock.json); publish name/version to the local registry
ach preflight --agent kiro [--model M] [--kiro-agent A] [--json]   # verify config, no prompt
ach preflight --agent kiro-ide [--kiro-ide-cdp host:port] [--json]  # read-only CDP rows, same as doctor
ach watch [--transcript-dir <root>]... [--rewrite FROM=TO]...   # live per-session token deltas
            [--event-webhook URL]   # also POST each delta as a `usage` event (docs/EVENT-WEBHOOK.md)
            # also evaluates the config file's alert rules every poll (docs/ALERTS.md)
ach alerts [--dry-run | --once] [--json] [--offline]
            # validate alert rules; --dry-run replays them over history, sends nothing;
            # --once evaluates now and sends new hits (cron)
ach stats [--agent A] [--days N | --since DATE [--until DATE] | --last D] [--json] [--state-only]
            [--transcript-dir <root>]... [--state-dir <stateDir>]... [--rewrite FROM=TO]...
            [--origin all|native|imported|transcript]
            # repeat --dir/--transcript-dir or --state-dir to merge several dirs (a run or
            # session in two dirs counts once); --rewrite /mnt/c=C: maps WSL paths for
            # display (docs/MULTI-DIR.md: WSL and multi-machine recipes)
            # window is [--since, --until): since inclusive, until EXCLUSIVE (a record
            # stamped exactly at --until is not counted); --until alone = everything before it
            # --compare prev | prev:<dur>: add a compare block (tokens, cost, runs: current,
            # previous, delta, signed %) and, with --json, a top-level `compare` object.
            # prev = the window of the same length right before the selected one; prev:7d =
            # the selected window shifted 7 days earlier (calendar-exact in --tz, so Sep 1-7
            # compares to Aug 25-31). Needs a bounded window (--days/--since/--last).
            # A zero previous base prints n/a (JSON null), never -100%. Days whose run
            # transcripts were pruned (`ach gc`) are listed as `unexplained`, not in totals.
ach audit [--agent A] [--days N] [--json] [--tolerance-pct P] [--fix] [--state-dir <stateDir>]
            # re-derive RunRecord totals from raw transcripts; exit 1 on drift
ach import --agent claude [--days N=30] [--transcript-dir <root>] [--state-dir <stateDir>]
            [--dry-run] [--json]
            # record existing Claude Code sessions as imported RunRecords
ach verify-run <runId|runDir> [--json] [--records] [--state-dir <stateDir>]
            # prove the run's hash-chained event log + sealed totals are untouched
            # exit 0 intact, 2 tampered, 3 unsealed (legacy), 4 open (never sealed)
ach context <runId> [--json] [--state-dir <stateDir>]
            # what filled the run's context window, from its stored events (offline): % prompt/user,
            # assistant text, reasoning, tool calls, tool results (top 5 tools), unattributed remainder;
            # n/a where the adapter records no data; --json = component map (docs/CONTEXT.md)
ach replay vet <pr-number|pr-url> [--repo owner/name] [--clone PATH] [--fallback-clone PATH]... [--json]
            # read-only vetting of a merged PR as a replay case: merged/approved/trunk/tests/ticket,
            # merge + base commits in the clone, squash vs merge; exit 0 pass/warn, 40 fail (docs/REPLAY.md)
ach smoke <message-file> [--account EMAIL] [--stub jira=JIRA_BASE_URL]... [--allow-path DIR]...
            [--cdp URL|--no-browser] [--no-fix|--fix-agent A|--fix-tool REPO] [--out DIR] [--copy] [--json]
            # run a how-to message's steps literally as a brand-new user (fresh HOME, own keychain),
            # fix the message in place, print the friction table; exit 0 clean, 1 friction, 2 usage (docs/SMOKE.md)
ach emit --input events.json --format atif|otel|langfuse|sft [--out path]
            [--agent A] [--model M] [--session-id SID]
            [--attr team=platform]... [--attr-env ci.build_id=BUILD_NUMBER]... [--enricher ./enrich.mjs]
            (custom attributes on every OTel/Langfuse span + OTLP resource, ATIF extra.attributes;
             set them once in the config file's emit section; docs/CONFIG.md#export-enrichers)
            (sft: OpenAI chat JSONL for fine-tuning; --input may be a trials dir;
             [--min-score N] [--exit success] [--agent A] [--full-conversation]; docs/SFT-EXPORT.md)
            (langfuse auth: --langfuse-url/--langfuse-public-key/--langfuse-secret-key or env)
            (otel/langfuse: a RunResult input's `trace` ids are adopted, docs/TRACE-CONTEXT.md)
            [--mask none|preview|all] [--mask-style replace|partial] [--mask-entropy] [--mask-pattern RE]...
            (secret masking before export; default all for otel and langfuse, none for atif and sft; docs/MASKING.md)
            [--privacy off|redact|anon]
            (privacy mode for shared output: redact shortens paths, anon also drops prompt text
             and hashes run/session ids; default off; docs/MASKING.md#privacy-modes)
ach report <trials-dir> [--out path] [--json] [--mask none|preview|all] [--privacy off|redact|anon]
ach report --registry [--limit N] [--out path] [--json] [--mask ..] [--privacy ..]
            # single-file HTML comparison plus an experiment x variant league table, and
            # leaderboard.json next to the HTML; --registry reads <stateDir>/runs/ instead of
            # trial dirs; --json prints the report model (with a privacy field) (docs/LEADERBOARD.md)
ach judge <run-id> --rubric rubric.md [--agent A] [--model M] [--judge-retries N] [--max-tokens N] [--wall-ms N]
            [--threshold T] [--weight W] [--mask none|preview|all] [--json]
            # LLM-judge a recorded run against a markdown rubric: partial credit per criterion,
            # RunRecord.judge + outcome; the judge is its own metered run (docs/JUDGE.md)
ach scrub <file|dir>... --mask preview|all [--out-dir DIR] [--json]
            # share-time scrub of exported artifacts: preview lists every key, email and home path
            # and touches nothing; all writes <name>.masked.<ext> copies, originals unchanged (docs/MASKING.md)
ach export --out DIR [--no-transcripts] [--include-machine-dirs] [--json] [--mask none|preview|all]
            # full data dump: runs/ (RunRecords, byte-identical), events/ (<stateDir>/raw), transcripts/
            # (archive warehouse), stats.json (= ach stats --json), stats.csv, manifest.json (sha256 per file,
            # record counts, ach version); re-runs skip identical files (docs/EXPORT.md)
ach dash [--json [--queues]] [--all] [--state-dir <stateDir>]   # live run dashboard (+ queues section) [--help-keys|--no-help] [--spark [--no-spark]] [--set-terminal-title[=FMT]]; ? help, q quits
ach queue run <plan> [--max-concurrent N] [--max-hours H] [--dry-run]   # plan-file run queue, <= N live
            # `ach run` machine-wide, detached runs, pre/post hooks (docs/QUEUE.md); ach queue status [<id>]
ach config --show [<section>] [--json]   # every resolved setting + its source (flag/env/file/default)
ach config --set run.budgetUsd 5 [--dry-run]   # write ./.ach/config.json; ach --config <path> <cmd> to pick a file (docs/CONFIG.md)
ach config --set profiles.fast.model sonnet     # a named set of run flags (docs/CONFIG.md#agent-profiles)
ach run --profile fast "prompt"                 # expand it; explicit flags still win
ach profiles list [--json]                      # every profile and the flags it expands to
ach init [--agent A] [--model M] [--budget-usd N] [--max-turns N] [--yes] [--dry-run] [--show] [--project]
            # first-run wizard: detect agent CLIs, doctor-check the chosen one, write the user config (--project: ./.ach/config.json)
ach mcp [--gateway --root R] [--max-jobs N] [--max-output-bytes N] [--allow-extra-args A]
            (MCP over stdio: newline-delimited JSON-RPC on stdin/stdout, Content-Length
             framing tolerated; same 10 tools and gateway flags as `ach serve`)
ach serve [--http] [--port N=8398] [--host 127.0.0.1] [--token T]
            (MCP over streamable HTTP on POST /mcp; GET /health probe;
             token via --token or env AGENTIC_CODING_HARNESS_HTTP_TOKEN)
ach web [trials-dir] [--port N=8399] [--host H] [--token T] [--state-dir <stateDir>] [--no-open]
          [--source URL] [--source-token T] [--source-mode poll|sse|ws]
          [--source-poll-ms N=3000] [--source-merge state|only]

--dir is kept as an alias with a per-command meaning: for watch and stats it is --transcript-dir (a home-shaped root holding .claude/projects etc.); for archive, audit, import, dash and web it is --state-dir. Passing both spellings with different values is a usage error.

ach import --agent claude gives a new install its history on day one. It reads the existing Claude Code transcripts (~/.claude/projects, or <root>/.claude/projects with --transcript-dir <root>) and writes one RunRecord per session into the same registry native runs use (<stateDir>/runs/), marked source: "imported" and carrying the native sessionId, the session's token totals, a computed cost, its cwd, and the transcript paths in metadata. ach dash, ach web, and the compare view then list those sessions next to native runs. The import is idempotent: the run id is derived from the session id, so a second import rewrites nothing and reports each session unchanged (a session that grew since is updated). A session a native ach run already recorded is skipped and reported, never duplicated. Sessions whose last activity is older than --days (default 30) are reported as skipped-outside-window. A corrupt transcript file is an error line; the import continues and still exits 0. --dry-run reports without writing; --json emits {summary, sessions, errors, ...}. Only claude is importable so far.

Import never changes an ach stats total. Stats already counts machine transcripts directly, and it sums tokens only from those transcripts and from harness state under <stateDir>/raw/, never from RunRecord totals, so an imported session is counted once, from its transcript, before and after import. What import adds is provenance: once the registry holds imported sessions, ach stats prints an origin: line per origin (--json: origins), and --origin counts only one of them. native means ach runs, imported means sessions ach import recorded, and transcript means machine transcripts that are not in the registry. The default is all. The flag is --origin rather than --source because ach web --source names an external run feed. Imported sessions carry no task verdict, so they are excluded from the stats run-outcome rollup and from ach status run counts. To keep history after Claude Code prunes old transcripts, snapshot them with ach archive and read them back with ach stats --with-warehouse.

ach audit is the self-check on the numbers themselves. For every RunRecord under <stateDir>/runs/ it replays the run's raw transcript (<stateDir>/raw/<agent>-<session>.jsonl), re-parses each usage event's raw payload (not the adapter's pre-normalized record; per-model breakdowns preferred), re-prices it with the current pricing tables, and prints field: recorded vs recomputed (Δ) for inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, and costUsd. It exits 0 when every delta is within --tolerance-pct (default 0: exact tokens, 1e-9 USD rounding slack) and 1 otherwise, so it works as a CI gate on the parsing and pricing pipeline. Runs with no totals or no transcript are reported unverifiable, and a model the pricer does not know is reported as an unpriceable cost; neither counts as drift. --fix rewrites the drifted totals (and the usage.usd.value mirror) and appends one corrections: [{at, field, from, to, by}] entry per field to the RunRecord, so a patch is never silent. --json emits {rows, summary, total}; each row carries recorded, recomputed, and delta objects keyed by the same field names as ach stats --json. Each row also carries chain, the run's ach verify-run verdict (below), taken before any --fix.

Knowing about new releases: ach update --check

ach update --check [--json] reads the GitHub release feed once and prints up to date or new version X available: <url>. It never downloads, installs, replaces or modifies anything. An opt-in once-per-24h stderr line is available with AGENTIC_CODING_HARNESS_UPDATE_CHECK=1 (default off: no command makes a network call). Feed URL, fields read and cache file: docs/UPDATE-CHECK.md.

Reclaiming disk: ach gc

ach gc deletes old artifacts from the state dir (AGENTIC_CODING_HARNESS_STATE_DIR, default ~/.agentic-coding-harness), with a separate TTL per class: raw transcripts (<stateDir>/raw/**/*.jsonl, default 30 days) and run records (<stateDir>/runs/*.json, kept forever by default). --dry-run lists every file it would delete with its size and the total bytes, and touches nothing. --before 30d (or a date) sets one cutoff for both classes; --keep-summaries keeps every run record (tokens, cost, exit status) and prunes transcripts only. --transcripts-ttl / --runs-ttl (or AGENTIC_CODING_HARNESS_GC_TRANSCRIPTS_TTL / AGENTIC_CODING_HARNESS_GC_RUNS_TTL; never disables a class) override --before per class.

ach gc --dry-run --before 30d --keep-summaries   # preview: path, class, bytes, total
ach gc --before 30d --keep-summaries             # prune transcripts, keep run summaries

It never deletes anything outside raw/ and runs/ (the warehouse, queues, quota and offsets files are untouched), never follows or deletes a symlink (it is reported as refused), never touches a run whose record says running while its pid is alive, and skips files written in the last minute. A transcript tied to a run ages from the run's end; other raw files age by mtime. Each real pass appends a line to <stateDir>/gc-log.jsonl. A pruned transcript drops out of ach stats history and leaves its run unverifiable in ach audit, unless ach archive snapshotted it first (ach stats --with-warehouse and ach audit then read the archived copy).

Reasoning effort: --effort

--effort low|medium|high|xhigh|max sets one portable effort level on any agent. The harness maps it to the agent's own mechanism through one table: --effort for claude, agy and kiro (--kiro-effort still works and gives the same argv), -c model_reasoning_effort= for codex, --reasoning-effort for copilot, --variant for opencode, and a <model>[effort=<level>] model slug for cursor. Agents with no mechanism (gemini, prime, kiro-ide, null, custom) still run, with a warning naming the agent. Every --effort run records effort: {requested, applied, mechanism} on its RunRecord and fills usage.model.requestedEffort. ach trial --effort, a plan's effort key and the MCP effort param go through the same table. Full table and the help lines it relies on: docs/EFFORT.md.

Content capture: --capture-mode

--capture-mode full|metadata|off (or ACH_CAPTURE_MODE, or contentCapture in the config file, with per-agent overrides) sets how much of a run's text ach writes. full is the default and changes nothing. metadata keeps every event's type, ids, timings, model and tool names, token counts and costs, and replaces every other string with [STRIPPED]. off keeps only the lifecycle and the token lines. The tier is applied when ach records, so the prompt and tool output never reach the state dir; ach stats, ach audit and ach verify-run work the same in every tier, and each RunRecord says which tier it ran under. Sinks and precedence: docs/CAPTURE.md.

ach run --agent codex --capture-mode metadata "refactor the parser"
ach config --set contentCapture.agents.codex off

Passing extra CLI args to the agent: --extra-args / --extra-arg

Both flags work on ach run and ach preflight, for every launchable agent, and are repeatable. Tokens reach the agent in command-line order, even when the flags are mixed.

  • --extra-args '<a b>' splits each value on spaces (--extra-args "-c x=1" passes -c, x=1).
  • --extra-arg <token> passes exactly ONE verbatim argv token and never splits it, so a value containing spaces survives. A dash-leading value is fine in the space form.
# route codex to a custom provider and pass a config value with spaces as one token
ach run --agent codex \
  --extra-arg -c --extra-arg 'model_provider=ferry' \
  --extra-arg -c --extra-arg 'developer_instructions="FERRY ROUTING: use tier names heavy, medium, light"' \
  "prompt"

The MCP tools take extraArgs as an array, which is already verbatim.

Permission and sandbox flags: --permission-mode / --allowed-tools / --disallowed-tools / --mcp-config

These four flags build the typed SandboxPolicy (see src/core/types.ts) that each adapter translates into its own CLI flags, so a headless child that needs Bash, file writes or MCP tools does not stall on an approval prompt, and you do not hand-assemble --extra-args.

  • --permission-mode <mode>: ask and dontAsk are portable; any other value passes through as the agent's native mode (claude bypassPermissions / acceptEdits, codex on-failure, gemini yolo, agy accept-edits / auto / plan via --mode).
  • --allowed-tools <list> / --disallowed-tools <list>: repeatable AND comma-separated; occurrences concatenate. Commas inside parentheses are kept, so 'Bash(git log:*)' is one tool. Tool names are agent-native (copilot: bash, view, create, edit, grep, glob, ...; claude: Bash, Read, ...), not translated; copilot silently ignores a name it does not know, so ach prints a [warn] for a copilot tool name that is not a built-in (with a "did you mean" hint) while still passing it through. A deny list blocks only the tools it names: on copilot, excluding view and bash still leaves read_bash, grep and glob, which can read files, so prefer an --allowed-tools list to confine a run.
  • --mcp-config <path|json>: given once. A value starting with { is parsed as inline JSON, anything else is a file path passed verbatim.

| Agent | --permission-mode | --allowed-tools | --disallowed-tools | --mcp-config | |---|---|---|---|---| | claude | yes | yes | yes | yes | | gemini | yes | yes | yes | yes | | codex | yes | no | no | no | | agy | dontAsk (--dangerously-skip-permissions), ask (agy's default review), accept-edits/auto/plan (--mode) | no (no allow-list flag) | no | no (servers live in ~/.gemini/config/mcp_config.json) | | kiro | no | yes (becomes --kiro-tools; --kiro-tools wins) | no | no (use --kiro-mcp-server) | | prime | no | yes | no | no | | copilot | dontAsk/ask (all tools pre-approved), plan, interactive, autopilot | yes (--available-tools) | yes (--excluded-tools) | yes (--additional-mcp-config) | | cursor | dontAsk (--force), plan, ask (--mode) | no (permissions live in ~/.cursor/cli-config.json) | no | no (use .cursor/mcp.json) | | opencode, kiro-ide, null, custom, agents.d | no | no | no | no |

ach run --agent claude --interactive passes the same four flags to the Claude TUI.

A flag the chosen agent cannot honor prints [warn] --<flag> is not supported by agent '<agent>' and was dropped and the run continues (--extra-arg stays the escape hatch). The resolved policy is printed to stderr as a [sandbox] permissionMode=... allowedTools=... header line, and --json output gains a sandbox object; inline MCP JSON is shown as <inline JSON, N bytes> because it can carry credentials.

ach run --agent claude --permission-mode bypassPermissions \
  --allowed-tools 'Bash,Read,Edit' --mcp-config ./mcp.json "prompt"

The same policy is available on the other surfaces. ach trial --suite takes the four flags directly (they become the generated plan's sandbox); ach trial --matrix plans take an optional sandbox object at plan level, per agent entry and per task (see docs/TRIALS.md); the MCP harness_run and harness_run_async tools take a sandbox input object (see docs/MCP.md). Both use the support table above and report a dropped field as a warning.

Interactive runs: ach run --interactive

A headless run (claude -p) cannot be watched or steered mid-flight. --interactive (alias --tui) runs the agent's own TUI instead, in a PTY that the ach run process owns, so you can watch it and type into it from the web dashboard or another terminal while it is still a metered run with caps. Claude only for now; other agents print a clear "not yet supported".

ach run --agent claude --model claude-sonnet-5-5 --interactive --budget-usd 0.50 \
  --permission-mode acceptEdits "refactor the parser" \
  --then "now add tests for it" --then "run the tests and fix what fails"
  • Same launch as headless: the TUI starts with the run's model, permission mode, tool policy (--allowed-tools / --disallowed-tools / --mcp-config), extra args, the first prompt and a fixed --session-id. It uses your default Claude config (login and settings), not a per-run CLAUDE_CONFIG_DIR.
  • Metering: tokens and cost come from the session transcript (~/.claude/projects/<dir>/<sessionId>.jsonl plus its sub-agent files), the same records ach watch reads, keyed to the RunRecord by session id. Typing into the run from anywhere is metered on it.
  • Caps: --budget-usd (with --on-budget abort), --max-turns (model turns), --wall-ms and --idle-ms apply. An abort sends SIGINT to the TUI, then SIGTERM, then SIGKILL, and the run ends with the same exit status as a headless one (budget_exceeded, timeout, ...). The usd cap is checked as each turn's usage lands in the transcript, so an interactive run stops after the turn that crosses it (headless claude -p reports cost only at the end, so there the cap can only warn). --idle-ms counts agent activity, so it also ends a session left waiting at its prompt with nobody typing.
  • Watch and type: ach web, then TUI on the run's tile (or LIVE in the trio drawer), with scrollback replay; closing the pane detaches. ach attach <runId|prefix> mirrors the same screen in a terminal, tmux-style: Ctrl-] d detaches and leaves the run going. When ach run --interactive itself runs in a terminal it shows the TUI there too. Every viewer can type (no single-writer lock yet), and the last viewer to resize sets the PTY size.
  • Steps: --then "<prompt>" (repeatable) types the next prompt once Claude finishes a turn (its turn_duration transcript marker), so a multi-step workflow runs in one watched session. --pause-between waits before each step for Ctrl-] n in a terminal or the NEXT STEP button on the web tile.
  • Trust prompt: in a folder Claude has not seen (always the case with --hermetic and --isolate), Claude asks whether to trust it. Answer in the TUI, or pass --trust-workspace to have ach pick yes.
  • Artifacts: the raw TUI is recorded as <stateDir>/casts/<runId>.cast (served by /api/runs/<id>/cast), --verify runs after the TUI exits, and the RunRecord, events and --json output have the usual shape.
  • Install: the PTY comes from bun-pty, so interactive runs need the npm/bun install run under Bun. The Node build and standalone binaries print "interactive runs need the npm/bun install". Not combinable with --repeat, --parallel or --resume yet.
  • Where the PTY is published: a per-user Unix socket (/tmp/ach-live-<uid>/, or AGENTIC_CODING_HARNESS_LIVE_SOCKET_DIR) named in <stateDir>/live/<runId>.json while the run is live. /api/live and /api/live/<runId> list them; they, typing into the run (/ws/pty/run:<runId>) and POST /api/live/<runId>/continue all need the ach web token.

The browser terminal is xterm.js. ghostty-web (libghostty in WASM with an xterm.js-compatible API) could give closer parity with a native Ghostty tab later; it has not been evaluated, and xterm.js stays the default.

Metrics-only evidence: --evidence-dir

ach run --evidence-dir <dir> writes <dir>/metrics.json (metrics-<i>.json per child with --repeat) after the run: agent, model, exit status, wall seconds, turns, cost with provenance, token totals, credits, the sandbox policy, ach version and timestamps. It holds no prompt, response, tool input or file content, so a trial can commit it while keeping the raw stream private. See docs/TRIALS.md, "Evidence hygiene".

Ancestor instruction files and --hermetic

Coding agents load "project memory" from the run's working directory and from its ancestor directories. A workspace under $HOME therefore inherits files like ~/CLAUDE.md even when claude runs with --setting-sources project,local --strict-mcp-config, because a parent-directory CLAUDE.md counts as project memory. That leaks your own instructions into runs that are meant to be hermetic and skews benchmark comparisons (#106).

Before ach run launches the agent, it walks from the cwd's parent up and lists the instruction files that agent would load there. The cwd's own files are the workspace's own project memory and are not listed.

| Agent | Files | How far up | |---|---|---| | claude | CLAUDE.md, CLAUDE.local.md | every ancestor, up to / | | codex | AGENTS.override.md, AGENTS.md | up to the git root (the nearest dir with .git); none without one | | gemini | GEMINI.md | up to the git root; none without one | | agy | AGENTS.md, GEMINI.md | up to the git root; none without one | | prime | AGENTS.md, CLAUDE.md | every ancestor, up to / (it does not stop at the git root) | | copilot | AGENTS.md, CLAUDE.md | up to the git root; none without one | | opencode, kiro, cursor, null, custom | none checked | |

When the list is non-empty, ach run prints a [warn] block naming every file on stderr. The run summary gains an ancestors line, and the RunRecord and the --json RunResult carry ancestorInstructions: string[]. Records without ancestor files are unchanged. MCP harness_run adds the same list to the result's warnings, and ach trial warns per cell.

--hermetic removes the leak instead of reporting it:

ach run --agent claude --hermetic --verify 'npm test' "fix the failing test"
  1. The workspace is copied into mkdtemp(<tmp>/ach-hermetic-XXXX)/<workspace-name>. <tmp> is os.tmpdir(), or $AGENTIC_CODING_HARNESS_HERMETIC_ROOT when set. On macOS that is /var/folders/..., outside $HOME.
  2. The detector runs on the copy. If the copy still has ancestor instruction files, for example because TMPDIR points under $HOME, the run fails with a non-zero exit before the agent launches. It never runs silently non-hermetic.
  3. The agent runs in the copy. Afterwards the changed tree is synced back into the original workspace, so --verify and your checkout see the agent's edits. Deletions propagate, but only for paths that existed when the copy was made, so a file you create in the original during the run is left alone.
  4. The temp di