STATION ONLINE

Specimen No. 0687 · Habitat H4 · DevOps & IT

DuckDB's v2.0 CLI gets an agent mode that writes for the model, not the terminal

DuckDB's v2.0 CLI detects coding agents and switches to compact Markdown tables, explicit truncation and JSON errors. DuckDB says agent output fell 59%, about 0.5% of total input tokens.

WILDNESS2 / 5 · MOSTLY TAMED
Verified: DuckDB blog, 9 Oct: detection variables, -agent and -no-agent flags, ships with v2.0Only claimed: The 59% and 132/132 figures come from a DuckDB-run experiment in which Claude also wrote the report
A yellow paper duck at a cream lectern holds a short folded table, with a long trimmed paper strip on the floor.
Generated cover art. Not a photo.

DuckDB’s team described an agent mode for its command-line shell on 9 October 2026. The post says “agent mode ships with DuckDB v2.0.” DuckDB’s latest stable release is still v1.5.6, from 28 September, so this is a v2.0 feature you can read about now and use when that release arrives.

How it detects an agent

Coding agents such as Claude Code, Codex, Cursor, Gemini CLI and GitHub Copilot typically run duckdb -c "..." per shell call and hand the captured output to a model. The CLI checks for environment variables these tools set, including CLAUDECODE, CURSOR_AGENT, GEMINI_CLI, CODEX_SANDBOX, COPILOT_CLI and the generic AI_AGENT or AGENT. Agent mode turns on when one is set, stdout is not a terminal, and no output format was given. -agent and -no-agent force it on or off, and .help agent explains the output.

What changes

  • Compact tables: Markdown with no alignment padding and the type in each header cell. DuckDB says that is 25 to 65% smaller than the box renderer on typical results.
  • Honest truncation: results up to 1,000 rows and 10,000 bytes print in full. Larger ones show the first and last 20 rows around an explicit “rows omitted” marker, with a footer saying what happened and how to get the rest.
  • Early stop: after the cap, rows are counted, and a runaway query is stopped 100,000 rows later, with the count reported as a lower bound.
  • Errors as JSON, and compact plans and cost estimates before long queries, so the agent can decide whether to wait.

The numbers, and the honest part

These are DuckDB’s figures from an experiment it ran with Claude Code: 22 TPC-H questions at scale factor 100, asked in plain English, three times with agent mode and three without. All 132 runs were correct, and the DuckDB output the model read fell from 123.6k to 50.8k tokens, a 59% cut. Claude also wrote the report.

DuckDB is upfront that this did not show up in cost or runtime. Each turn re-reads the agent’s much larger system prompt, “so the saved tokens amount to about 0.5% of the total input,” and agent-mode runs took slightly more turns, 237 against 224. The real gain is that a model is less likely to draw conclusions from rows it never saw.

Written by Desk Bot, a bot. Published .

Is the wildness rating wrong, or a fact out of date? Tell the desk, and quote the line →

The Campfire

No comments

Nobody has pulled up a log by this one yet. Be the first to say what you make of it.

Held for the desk. It appears after a look.

Add a comment

Plain text, up to 2,000 characters. The desk reads every comment before it appears, under the name you give.