GitHub
Skip to content

Readers

How readerly decides who reads the output, from the AI_AGENT variable to the TTY, and what each reader gets.

detect() runs once, reads only the environment and the streams, and returns the reader with the signal that decided it. --verbose prints that signal on stderr.

yesnoyesnoyesnoyesnoyesnoAI_AGENT names anagent?AgentA harness's strong marker?AgentCI?CIstdout a TTY?TerminalA weak marker, or AGENT?AgentPipe

AI_AGENT set to 0, false, no, off or empty rules an agent out, whatever markers are set: CI, then the TTY, decides. A tool can skip all of this with detection: { agent: true } or false.

A person, with stdout on a TTY. The text format, in color, with prompts and a progress line, and long lists cut at 50 rows. The reason is stdout.isTTY.

Any of 15 CI providers, such as GitHub Actions, GitLab or Vercel, or a bare CI=true. The text format, never a prompt, and every row. On GitHub Actions, the errors and warnings that have a file also go to stderr as annotations, at most 10 of each. The reason names the provider, such as CI:github-actions.

A coding agent's strong marker wins over CI, so an agent running in CI still gets the agent report.

A coding agent, found by AI_AGENT or by a variable its harness sets. The agent format: a verdict first, then the diagnostics, kept under 8000 characters, with a hidden: line naming what was left out and how to see it. No color, prompts or progress. The reason is AI_AGENT, marker:<name> or weak:<name>.

Another program, with stdout not on a TTY and no other signal. The text format without color or prompts, and every row. The reason is stdout not a TTY. A program that parses the output should ask for --format json or --format jsonl.

A harness names itself with AI_AGENT, and readerly matches the longest known prefix: AI_AGENT=claude-code_2-1_agent is Claude Code 2.1. Without it, a strong marker is set only while the agent runs the command. A weak marker can sit in a person's shell too, so it counts only off a TTY and outside CI. A harness that sets AGENT=<name> is caught the same way.

Claude Code

AI_AGENT=claude-code · strong CLAUDECODE

Codex

AI_AGENT=codex · strong CODEX_THREAD_ID, CODEX_SANDBOX, CODEX_CI

Cursor

AI_AGENT=cursor · strong CURSOR_AGENT, CURSOR_EXTENSION_HOST_ROLE=agent-exec · weak CURSOR_TRACE_ID

OpenCode

AI_AGENT=opencode · strong OPENCODE

T3 Code

AI_AGENT=t3-code · weak T3CODE_THREAD_ID

Gemini CLI

AI_AGENT=gemini · strong GEMINI_CLI · from docs

Cline

AI_AGENT=cline · strong CLINE_ACTIVE · from docs

Augment

AI_AGENT=augment · strong AUGMENT_AGENT · from docs

Amp

AI_AGENT=amp · strong AMP_CURRENT_THREAD_ID · from docs

GitHub Copilot

AI_AGENT=github_copilot · from docs

Grok

AI_AGENT=grok · weak GROK_SESSION_ID, GROK_AGENT_ID · from docs

Kiro

AI_AGENT=kiro · weak TERM_PROGRAM=kiro · from docs

Goose

AI_AGENT=goose · weak GOOSE_TERMINAL · from docs

Replit

AI_AGENT=replit · weak REPL_ID · from docs

Windsurf

AI_AGENT=windsurf · weak WINDSURF_CASCADE_TERMINAL · from docs

Pi

AI_AGENT=pi · from docs

"From docs" means the markers come from the harness's source or docs, not from a run of it. Missing an agent? AI_AGENT=<name> works for any harness, and its name shows in --verbose.