aictrl.devBlog

Research / Headless agents

Which coding-agent CLI is best for headless workflow automation?

A coding-agent CLI can feel quick in a terminal and still be expensive when a workflow starts it in a fresh container for every job. We measured that cost for six CLIs: start-up, time per turn, memory, image size and tokens.

On overhead per job, pi was the lightest overall. Our own CLI, aictrl, won no metric but came second on four: session time, harness time per turn, memory and image size. Overhead is half the answer: this experiment does not measure whether an agent completes the task, which our next run will.

Goose had the fastest observed median first response, followed by Codex, pi and aictrl. Those four were within 187 ms of each other. pi used the fewest tokens, both in its first request and for a whole short task, spent the least time between model turns, added the least image footprint and finished the scripted session fastest. aictrl came second on session time, per-turn harness time, memory and image footprint. Its system prompt is now as small as pi's. Its tool definitions are not.

Each chart is sorted from lowest to highest, with gold and silver medals for the observed first and second place on that metric. A medal describes this experiment; small gaps do not establish a stable lead.

Disclosure: I build aictrl. This article reports our own measurements, including where our implementation loses. The article and charts were prepared with AI assistance.

What we measured

Fresh 2-CPU containers, a local 50 ms scripted model, six released CLIs with different toolsets.

On 20 October 2026 we tested released installations of aictrl 0.5.4, pi 1.3.0, Codex 0.163.0, OpenCode 2.1.0, Hermes Agent v0.22.2 source and Goose 1.55.0. Hermes' source archive reports vunknown; we identify it by its pinned release commit in the methodology.

Every attempt started a fresh non-root container with an empty home directory, a two-CPU quota and a 2 GiB memory limit. Images were already on the host, and filesystem caches were not cleared. These are fresh-container measurements, excluding image downloads and cloud scheduling.

A local scripted model responded after a fixed 50 ms delay. It removed remote inference variability and dictated the reads. This tests harness overhead and native tool execution; it cannot measure coding quality or natural model-turn efficiency.

For the architectural context behind these measurements, read our agent framework comparison. It examines the framework and harness choices to consider alongside per-job overhead.

We collected 20 measured single-response attempts per harness and five attempts for the 50-read memory task, with two discarded warmups per scenario and interleaved harness order. All six used their own native tool loops. Hermes did not delegate to Codex, and Goose did not delegate through ACP. Every attempt completed, and the runner recorded no failures.

The toolsets were not equal, and that matters most for the token results. pi ran with its four default tools, no subagent tool and no extensions or packages installed. Goose ran with only its built-in Developer extension, so no recipes or sub-recipes were loaded. Hermes ran with only its file and terminal toolsets; its default also enables web, browser, memory and task delegation, among others. aictrl, OpenCode and Codex ran with their default tools, which include a subagent tool in each. The section on tokens adds aictrl restricted to pi's four tools.

Each harness ran non-interactively with its JSON output on. Besides the scripted model's provider settings, the flags were:

  • aictrl: aictrl run --format json
  • pi: pi --mode json
  • Codex: codex exec --json --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check
  • OpenCode: opencode run --standalone --auto --format json
  • Goose: goose run --no-profile --with-builtin developer --output-format stream-json
  • Hermes: hermes chat --oneshot --toolsets file,terminal --ignore-user-config --ignore-rules --format stream-json

The runner has the full adapters, environment and config files.

For token counts we ran a separate capture campaign with the same images and setup. It used five single-response and five 50-read sessions per harness and retained every request body. We counted every harness with one reference tokenizer, OpenAI's o200k_base. These are estimates of what each harness sends, not provider-billed usage.

The measurement extract, token estimates, CSV and methodology accompany the figures. Memory and footprint use MiB; request bodies use actual UTF-8 bytes. Select any chart to open the full-resolution image.

Goose had the fastest observed median first response

The timer started immediately before docker run and stopped at the first matching assistant-response event in the harness's JSON output. Container startup and our setup wrapper count. This is not model time to first token.

First response sorted from lowest to highest median, with gold on Goose and silver on Codex. Solid dots show median; hollow dots show p90.
Figure 1. Source: our six-harness fresh-container measurements, 20 October 2026; 20 attempts each. The connecting lines are not confidence intervals.

Goose reached the first response in 392 ms at the median, followed by Codex at 471, pi at 522 and aictrl at 579. With 20 samples on a shared host, I would not claim a repeatable ordering among those four. Absolute startup times also moved between our campaigns: the same Goose, Codex, pi and Hermes images measured 140 to 230 ms faster on 20 October than a day earlier. A separate paired run of aictrl and pi measured 503 and 460 ms. Compare startup times within one campaign only. OpenCode 2.1.0 took 926 ms and Hermes 5.5 s, gaps that warrant profiling under the same setup.

These are supported installation profiles with different runtimes, dependencies and startup behavior. pi used Node 22; Hermes core used Python 3.14.8. The other three npm installations used a Node 20 base, while packaged native executables can carry their own runtime. Those differences prevent attributing the result to a programming language.

Memory depends on what reaches the next model request

The long task read fifty distinct files containing the same 48,000-byte, 800-line fixture, then answered Done.. Distinct paths matter: Hermes normally deduplicates unchanged reads. We preserved that behavior while asking each harness to do actual reads of equal-sized files.

Peak container memory over 50 reads, ranked by observed median. pi lowest, aictrl second; Codex listed last and unranked because it cuts each file.
Figure 2. Source: our six-harness measurements, 20 October 2026. Five attempts per harness; completed-run counts and RSS are in the CSV. At five completed runs, nearest-rank p90 is the maximum. Codex is listed last without a medal: it keeps only the first and last ~80 lines of each file, so it holds a different context.

All six completed all five attempts. pi had the lowest median cgroup peak at 154 MiB, followed by aictrl at 207. Codex measured 132 MiB, but it did not hold the same data. Its shell tool cuts long output: of each 800-line file the model saw lines 1–84 and 718–800, with a note that 38,000 characters were removed. That is about a fifth of the file.

The final request was 572,750 bytes for Codex versus 2.46–2.67 million bytes for the others. The validator classified all five Codex runs as shortened context; every other harness delivered and retained complete fixture content in all five attempts. A smaller context is cheaper, but an agent reviewing a long file never sees its middle.

Cgroup memory includes charged cache. Shared host page-cache ownership can change which container bears that cost. Largest-process RSS and sampled summed RSS are also retained in the data; they measure different quantities. A low cgroup reading alone does not mean the process resident set is equally small.

We verify source-line coverage in the next model request and check every result again in the final request. Codex's native output cap yields a much smaller final request. Its memory result therefore cannot establish that it stores an equivalent conversation more efficiently. The stub also reports artificial usage, so normal token-driven context compaction is not exercised.

Turnaround: where the session time goes

Total scripted session time sorted from lowest to highest median, with pi in gold and aictrl in silver.
Figure 3. Source: session measurements, derived from the same campaign; five completed sessions per harness. The timer runs from before container launch to CLI exit, excluding later evidence persistence. Solid: median; hollow: p90.

Each session made 51 main model calls: fifty tool-call responses and a final answer. OpenCode and Hermes each made one additional auxiliary model call. The script imposes the main-call count, so this experiment cannot show how many turns a harness would take on a real task.

It can show what each harness adds to every turn. The stub timestamps each request and response, so we split the session into start-up, time waiting for the model, harness work between turns and shut-down.

Stacked session time per harness: start-up, model wait, harness work between turns and shut-down. pi in gold, aictrl in silver.
Figure 4. Source: session measurements, same campaign. Each component is a median over five sessions. Harness work between turns runs from one model response leaving the stub to the next request arriving: parsing, running the tool and building the next request.

The model wait was about 3 s for everyone: 51 calls at 50 ms plus serialization. The difference is harness work. Between turns pi took a median 9 ms and aictrl 12 ms. OpenCode took 32 ms, Codex 45, Hermes 64 and Goose 72. Codex and Goose run each read as a shell cat, which starts a process. The other four use a native file reader.

Summed over a session, the gaps came to a median 0.5 s for pi, 0.6 s for aictrl and 3.8 s for Goose, whose slower turns also vary more. With a real model taking seconds per turn they are a small share of the total. The turn count, which a real model decides, is the larger lever. Hermes also spent 5.3 s before its first request and 1 s shutting down.

OpenCode's npm installation was the largest

Uncompressed image increment sorted from smallest to largest. pi takes gold and aictrl silver; OpenCode is largest.
Figure 5. Source: our installation measurements. Values are uncompressed image increments above each corresponding runtime base. They are not registry downloads, executable sizes or build times; bases differ.

npm installed four Linux x64 binaries for OpenCode 2.1.0: glibc and musl builds, each in a regular and a baseline variant. Each takes about 204 MiB, and the launcher uses one. Its platform packages declare the operating system and CPU but not the C library, so npm cannot skip the variants this host does not need.

aictrl's platform packages declare their C library, so npm installs only the one binary the host needs. It adds 113 MiB, about 6 MiB more than pi. The build metadata records the installed packages.

We did not measure image pulls, so the experiment identifies duplication without quantifying its deployment-time penalty.

Tokens: fixed cost per call, then what the read tool returns

Every call resends the system prompt and the tool definitions, so their size is a fixed cost on each turn. We split the first request into those two parts and the rest: the task message, any context the harness injects, and JSON framing.

First request tokens per harness, split into system prompt, tool definitions and the rest. pi has the smallest total.
Figure 6. Source: token estimates from the capture campaign, o200k_base for every harness. Tool definitions are counted as canonical JSON. Provider-reported counts add model-specific framing and will differ.
Harness System prompt Tool definitions (tools) First request total
pi 2601 1609 (4) 11,276
Goose 1563 2897 (6) 21,577
Hermes 1,053 2,279 (8) 3,391
aictrl 608 2,772 (9) 3,442
OpenCode 1,857 2,799 (12) 4,903
Codex 4,047 3,614 (9) 8,178
aictrl, pi's four tools 608 1,421 (4) 2,091

aictrl's system prompt is 608 tokens, level with pi's 601 and Goose's 563. The remaining gap to pi is the tool definitions: nine tools at 2,772 tokens against pi's four at 609. Our read tool alone is described in 394 tokens, pi's in 159.

Most of that gap is a design choice about which tools to declare. pi declares four by default and leaves out subagents on purpose. Its README says it "skips features like sub-agents and plan mode", and offers subagents as an optional extension that runs each one as a separate process. Search goes through bash. aictrl also declares glob, grep, webfetch, a skill loader, and a task tool that starts subagents. Those five add about 1,350 tokens to every call. OpenCode's twelve tools include a subagent tool too.

For workflow automation, that is often more than a step needs. The workflow already divides the work, and each step is a scoped run of the CLI. A step that does not delegate, or must not, loses nothing with a minimal toolset and saves those tokens on every call. A broad, open-ended task can still gain from subagents that explore in a separate context.

To compare like with like, we also captured aictrl with only pi's four tools, denying the other five through its permission config. Its first request fell from 3,442 to 2,091 tokens: 608 for the system prompt and 1,421 for the tools. That is 815 tokens above pi, 812 of them in longer descriptions of the same four tools. The run also showed that our system prompt and tool descriptions still mention Task, Glob and Grep when those tools are removed, which we are fixing.

To run aictrl with the same four tools, add these denials to the permission settings in aictrl.json or in the AICTRL_CONFIG_CONTENT environment variable. A denied tool is left out of the request:

{
  "permission": {
    "glob": "deny", "grep": "deny", "task": "deny",
    "webfetch": "deny", "skill": "deny"
  }
}

Most workflow steps are short, and there the fixed cost per call dominates. In a second scenario each CLI read three 340-byte files and answered, four model calls in all. Every call resends the system prompt, the tool definitions and the history so far.

Total tokens for a short task with three small reads and four model calls. pi lowest at 6.1k, Goose 7.3k, aictrl with pi's four tools 9.8k, aictrl 15.2k, Hermes 15.6k, OpenCode 21.5k, Codex 34.1k.
Figure 7. Source: short-task token estimates, input and output of every call, o200k_base for every harness. Three captures each; only Codex varied, by up to 51 tokens of injected environment context. No prompt-cache discount is applied.

pi used 6,074 tokens for the whole task and Goose 7,281. aictrl used 15,209, two and a half times pi. With pi's four tools it used 9,805, which puts the cost of its five extra tools at about 5,400 tokens per short task. Codex used the most, 34,078: its first request alone is 8,178 tokens, half of it system prompt, and every call repeats it.

Long tasks are different: what the read tool returns outweighs the prompt. An 800-line read of our test file costs 11,299 tokens in aictrl, 11,276 in OpenCode and 12,111 in Hermes, which number every line they return, against 9,661 in pi and Goose, which return the raw text. Over the 50-read session, where every call resends every earlier file, that gap compounds: aictrl sent 14.6 million input tokens in total, pi 12.4.

Codex is not comparable on long reads. It cut each 48 KB file to about 10 KB, so its 50-read session sent 3.2 million input tokens, a quarter of the others.

With prompt caching, a provider bills most of the resent history at a discount. The tokens still fill the context window and add prefill time. A real-model run will report billed usage, including cache hits.

We also care about how many model turns a task takes. aictrl's tool instructions ask the model to batch independent tool calls. Reading three independent files in one turn can avoid extra model round trips.

That is a design choice to evaluate. It does not show that pi cannot batch or that aictrl needs fewer turns. The captured requests show that Goose and Hermes carry similar guidance, to read efficiently or batch independent calls. Here the scripted model determines the sequence regardless of instructions.

Our separate tool-text experiments are not a direct aictrl-versus-pi turn comparison. Both initial comparison arms retained batching guidance, so they cannot isolate the effect of removing it. Before making that claim we need the same real model and tasks, verified outcomes, model turns, calls per turn, provider-reported tokens and elapsed time. Every token of prompt and tool description should earn its place through measured behavior.

Event stream: what a pipeline can read

A workflow does not watch a terminal. It reads what the harness writes to stdout, so the shape of that stream decides what you can log, bill and debug. All six harnesses can write newline-delimited JSON, and we ran each with it on. What the streams carry differs:

We scored each stream against the scripted model's own record of the short task: 25 facts per run, modelled on the OpenTelemetry GenAI attributes, each counted only when the stream states it and the value matches. aictrl and pi covered all 25, OpenCode 80%, Hermes 72%, Goose 68% and Codex 40%. We designed aictrl's stream, so read that with the disclosure in mind; the scorer is published.

Some teams want spans in their tracing system instead. Codex and Goose export OpenTelemetry spans with token usage, and Codex puts most of its detail there rather than in its JSON stream. OpenCode exports spans for its internal operations. aictrl, pi and Hermes, as installed, export nothing; for aictrl that is a gap today.

What we will change

For aictrl, the npm footprint, the system prompt and per-turn harness time are now close to the smallest we measured. Two token costs remain: tool definitions more than four times the size of pi's, which make a short task cost two and a half times as much, and line-numbered read output, which we keep for precise citations and edits but will measure. We plan to make the subagent, web and skill tools opt-in for steps that do not need them, and to shorten the remaining descriptions. Startup time and memory retained across steps also remain to investigate. The next comparison uses a real model, to measure task success, turns per task and provider-reported tokens together.

For container automation, this experiment gives us fresh-process overhead, an installation footprint and memory under a specific output-retention policy. Those are useful inputs to a choice, alongside real-task quality and the tools a workflow needs. The medals describe separate metrics. pi placed first or second on seven of the eight; aictrl was second on four: session time, per-turn time, memory and image size.

To evaluate coding-task quality alongside overhead, see what the SWE-EVO benchmark measures and the proposed prompt comparison on your own tasks. These are separate evaluations; our scripted experiment does not establish a SWE-EVO score for any CLI.

Summary

Lower is better for each measured value. 1 and 2 mark the lowest and second-lowest observed result in each row. aictrl, our own CLI, comes first; the other columns are ordered by medals. pi, Goose and Hermes ran with reduced toolsets and no subagent tool, which favours them on the token rows; aictrl's results use its default nine tools.

Metric aictrl pi Goose Codex OpenCode Hermes
First response, median (ms) 579 522 1392 2471 926 5,521
Session time, median (s) 24.27 13.98 7.22 5.57 6.03 12.76
Harness time per turn, median (ms) 212 19 72 45 32 64
Peak cgroup memory, median (MiB) 2207 1154 247 132* 424 344
Image increment (MiB) 2113 1108 292 410 818 388
System prompt (tokens) 608 2601 1563 4,047 1,857 1,053
First request (tokens) 3,442 11,276 21,577 8,178 4,903 3,391
Short task, all calls (tokens) 15,209 16,074 27,281 34,078 21,489 15,562
One 800-line read (tokens) 11,299 9,661 9,661 2,159* 11,276 12,111
Model calls/session (scripted) 51 51 51 51 52 52
Capabilities, as tested
Subagent tool Yes No No Yes Yes No
Line-numbered reads Yes No No No Yes Yes
Whole file kept on long reads Yes Yes Yes No Yes Yes
Search tools (glob, grep) Yes No No No Yes Yes
Web tool Yes No No Yes Yes No
Event stream, as tested
Event coverage (25 facts) 100% 100% 68% 40% 80% 72%
JSON events on stdout Yes Yes Yes Yes Yes Yes
Tokens for each model call Yes Yes No No Yes No
Timestamp on every event Yes No No No Yes Yes
Tool start and end times Yes Yes No No Yes Yes
Permission decisions Yes No No No No No
OpenTelemetry export No No Yes Yes Yes No

* Codex keeps only the first and last ~80 lines of a long read, so its memory and read size are not comparable and take no medal.† Available, but off in the configuration we tested.‡ Goose also writes a text banner to stdout before its JSON events.§ Internal spans only, without token or model attributes.

How this table was measured

Sources. Saved measurements and computed CSV. Startup: 20/20 attempts per harness; memory: 5/5 completed for all six. Versions and runtime profiles are listed above. Session duration, per-turn time and model-call counts: session measurements. Tokens: token estimates, short task and per read, o200k_base reference counts from a separate capture campaign, not provider-billed usage.

Medals. They describe observed results; the first four startup medians are close, and the experiment does not establish a stable overall winner. No medals are awarded for the imposed call count, for read size, which trades tokens for line numbers, or for event coverage. Cgroup memory includes charged cache.

Capabilities. The tools each harness declared to the model in our runs; pi and Goose search and read through their shell tool. pi ships a subagent extension in its package, and the default toolsets of Goose and Hermes add subagents (and, for Hermes, web tools).

Event stream. The newline-delimited JSON each harness wrote with its JSON output flag, which all six had on. Goose, Codex and Hermes report tokens once, as session totals at the end; pi timestamps its messages but not its turn and tool events. Goose's text banner means a parser has to skip non-JSON lines.

OpenTelemetry. Tested by pointing each CLI at a local OTLP receiver with the standard OTEL_EXPORTER_OTLP_* settings, plus Codex's [otel] config section and the experimental.openTelemetry switch in aictrl and OpenCode. Goose and Codex sent spans with token counts in the GenAI attributes; OpenCode's spans cover its internal operations; Hermes needs its optional otlp extra, which our install did not include. aictrl has the switch but no exporter yet, so nothing was sent.

Event coverage. Each JSON stream is scored against the scripted model's own record of the short task: 25 facts per run, modelled on the OpenTelemetry GenAI attributes (session and model; tokens and a timestamp for each of the four model calls; for each of the three tool calls its name and file, call ID, full result and timing; run end, token totals and the final answer). A fact counts only when the stream states it and the value matches; all three runs scored the same. We designed aictrl's stream, so the row carries no medal; the checklist and scorer are published with the scores. Codex puts more of its detail into its OpenTelemetry export than into its JSON stream.

Sources and reproduction

All figures show our own measurements. The linked source instruction explains batching guidance; it does not supply a benchmark result.

The principles and capabilities of our CLI are described on the aictrl headless agent harness page. To run it in a terminal or a GitHub Actions job, follow the CLI quickstart.

Code review or bug fix. The workflow is yours.

Use our skills or bring your own. 20 free executions, no card.