# Readers

`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.

```mermaid
flowchart TD
  A{"AI_AGENT names an agent?"} -- yes --> A1[Agent]
  A -- no --> S{"A harness's strong marker?"}
  S -- yes --> A2[Agent]
  S -- no --> C{"CI?"}
  C -- yes --> CI[CI]
  C -- no --> T{"stdout a TTY?"}
  T -- yes --> Term[Terminal]
  T -- no --> W{"A weak marker, or AGENT?"}
  W -- yes --> A3[Agent]
  W -- no --> Pipe[Pipe]
```

`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`.

## Terminal

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`.

## CI

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.

## Agent

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>`.

## Pipe

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`.

## Agents

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.

::card-group
:::card{title="Claude Code" icon="i-simple-icons-claude"}
`AI_AGENT=claude-code` · strong `CLAUDECODE`
:::

:::card{title="Codex" icon="i-simple-icons-openai"}
`AI_AGENT=codex` · strong `CODEX_THREAD_ID`, `CODEX_SANDBOX`, `CODEX_CI`
:::

:::card{title="Cursor" icon="i-simple-icons-cursor"}
`AI_AGENT=cursor` · strong `CURSOR_AGENT`, `CURSOR_EXTENSION_HOST_ROLE=agent-exec` · weak `CURSOR_TRACE_ID`
:::

:::card{title="OpenCode" icon="i-simple-icons-opencode"}
`AI_AGENT=opencode` · strong `OPENCODE`
:::

:::card{title="T3 Code" icon="i-lucide-bot"}
`AI_AGENT=t3-code` · weak `T3CODE_THREAD_ID`
:::

:::card{title="Gemini CLI" icon="i-simple-icons-googlegemini"}
`AI_AGENT=gemini` · strong `GEMINI_CLI` · from docs
:::

:::card{title="Cline" icon="i-simple-icons-cline"}
`AI_AGENT=cline` · strong `CLINE_ACTIVE` · from docs
:::

:::card{title="Augment" icon="i-lucide-bot"}
`AI_AGENT=augment` · strong `AUGMENT_AGENT` · from docs
:::

:::card{title="Amp" icon="i-simple-icons-amp"}
`AI_AGENT=amp` · strong `AMP_CURRENT_THREAD_ID` · from docs
:::

:::card{title="GitHub Copilot" icon="i-simple-icons-githubcopilot"}
`AI_AGENT=github_copilot` · from docs
:::

:::card{title="Grok" icon="i-lucide-bot"}
`AI_AGENT=grok` · weak `GROK_SESSION_ID`, `GROK_AGENT_ID` · from docs
:::

:::card{title="Kiro" icon="i-lucide-bot"}
`AI_AGENT=kiro` · weak `TERM_PROGRAM=kiro` · from docs
:::

:::card{title="Goose" icon="i-lucide-bot"}
`AI_AGENT=goose` · weak `GOOSE_TERMINAL` · from docs
:::

:::card{title="Replit" icon="i-simple-icons-replit"}
`AI_AGENT=replit` · weak `REPL_ID` · from docs
:::

:::card{title="Windsurf" icon="i-simple-icons-windsurf"}
`AI_AGENT=windsurf` · weak `WINDSURF_CASCADE_TERMINAL` · from docs
:::

:::card{title="Pi" icon="i-lucide-bot"}
`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`.

<!-- vitehub-docs:section-links -->
All pages: [llms.txt](https://readerly.loadsheet.dev/llms.txt)
