When the reader is a coding agent, readerly prints the agent format. This page covers what that output holds and how readerly knows which agent is running.
What an agent gets
Section titled "What an agent gets"The acme check example from test/golden, as a coding agent gets it:
acme check: failed. 2 errors, 1 warning in 212 files (0.8s).
error ACME001 src/app.ts:14:3 Route handler reads process.env at module scope. fix: Read it inside the handler
error ACME004 src/db.ts:3:1 Top-level await in a server entry. fix: Move the call into the plugin setup
warn ACME010 vite.config.ts:8:5 Alias shadows a workspace package
next: acme check --fix (applies 2 safe fixes)
next: acme explain <code> (explains one code)- No color and no glyphs. No escape codes, no
โ, no tree. Each diagnostic is one line, with itsfixon the same line.whyanddocsappear only with--full. - The verdict on line 1. Hosts cut the middle of long output, so the first line says whether the run failed and what it counted.
- No prompts. An agent can't answer one. When a prompt has a default, readerly uses it and adds a
next:line with the flag that changes it, hereacme check --fix. When it has none,out.confirmthrows anaction_requiredfailure that names the flag, andout.fail()prints it with exit code 2. See Prompts and input. - A budget of 8,000 characters. That is under Claude Code's 30,000-character Bash output limit and Codex's 10,000-token cap. readerly keeps or drops whole lines:
next:lines first, then errors, warnings, infos and logs. The last line names what it dropped and how to get it back:
hidden: 23 warn. rerun: acme check --full, or acme check --format json--max-chars <n> sets another budget and --full removes it. Budget has the details.
Failures go to stdout in this format too, so an agent sees the error, the fix and the command to rerun in one read.
Known harnesses
Section titled "Known harnesses"The harness registry in src/registry.ts lists each agent readerly knows. A bare marker name counts when the variable is set and not 0, false, no, off or empty; NAME=value must match exactly.
id | Strong markers | Weak markers | sessionId from | Also reads |
|---|---|---|---|---|
claude-code | CLAUDECODE | CLAUDE_CODE_SESSION_ID | CLAUDE_EFFORT as effort | |
codex | CODEX_THREAD_ID, CODEX_SANDBOX, CODEX_CI | CODEX_THREAD_ID | CODEX_VERSION as version | |
gemini* | GEMINI_CLI | |||
cline* | CLINE_ACTIVE | |||
opencode | OPENCODE | OPENCODE_SESSION_ID | ||
cursor | CURSOR_AGENT, CURSOR_EXTENSION_HOST_ROLE=agent-exec | CURSOR_TRACE_ID | CURSOR_CONVERSATION_ID | |
augment* | AUGMENT_AGENT | |||
amp* | AMP_CURRENT_THREAD_ID | AMP_CURRENT_THREAD_ID | ||
copilot* | ||||
grok* | GROK_SESSION_ID, GROK_AGENT_ID | GROK_SESSION_ID | ||
kiro* | TERM_PROGRAM=kiro | |||
goose* | GOOSE_TERMINAL | |||
replit* | REPL_ID | |||
windsurf* | WINDSURF_CASCADE_TERMINAL | |||
pi* | ||||
t3-code | T3CODE_THREAD_ID | T3CODE_THREAD_ID |
* Markers taken from the harness's source or docs, not from a live run.
copilot and pi have no marker. readerly finds them only through AI_AGENT, such as AI_AGENT=github_copilot_vscode_agent. A bare AGENT variable is one more weak marker for any harness: AGENT=goose reports goose, and AGENT=1 reports unknown.
When T3CODE_THREAD_ID is set and the agent is not T3 Code itself, AgentInfo.wrapper is { id: "t3-code", threadId }: a Claude Code run inside T3 Code reports both.
Declared, strong and weak
Section titled "Declared, strong and weak"AgentInfo.strength says how readerly found the agent.
strength | Source | Trusted |
|---|---|---|
declared | AI_AGENT | Always. It is checked before any marker. |
strong | A variable the harness sets only while a model runs the command | Always, also in a TTY and in CI |
weak | A variable that can also sit in a person's shell | Only when stdout is not a TTY and the run is not in CI |
The full order is in Readers.
Declaring an agent
Section titled "Declaring an agent"A harness, or a wrapper script around one, declares itself by setting AI_AGENT. readerly reads the value like this:
- A value that doesn't match
^[A-Za-z0-9_.-]{1,64}$gives the idunknown. - readerly lowercases it and splits it on
_. A last segment ofagentorharnessbecomesmode. - A version segment of digits joined by
-or.becomesversion, with-turned into.. - The id is the longest registry prefix followed by
_,-or the end of the value. Otherwise it is the rest of the value;1,true,yesandongiveunknown.
AI_AGENT | id | version | mode |
|---|---|---|---|
claude-code_2-1-332_agent | claude-code | 2.1.332 | agent |
codex | codex | ||
opencode_1.4.2 | opencode | 1.4.2 | |
github_copilot_vscode_agent | copilot | agent | |
new-tool_3-0_agent | new-tool | 3.0 | agent |
1 | unknown |
AgentInfo.raw keeps the value as given. AI_AGENT=0 declares that no agent runs; see Readers.
Agents in CI
Section titled "Agents in CI"A coding agent can run inside a CI job, such as Claude Code in GitHub Actions. A declared or strong agent wins over CI: the reader is agent, and Detection.ci still names the provider. A weak marker never wins in CI, so CURSOR_TRACE_ID in a GitHub Actions job leaves the reader ci.
An agent in CI gets the agent format and no GitHub annotations. Annotations go only with the text format, for the ci reader on GitHub Actions. See GitHub Actions.