Documentation
¶
Overview ¶
Package agent works out which coding agent, if any, ran this CLI process.
Detection reads environment variables only. Coding agents ("harnesses") set marker variables in the shells they run commands in, and the CLI inherits that shell. Order of precedence:
- AI_AGENT, then AGENT: the generic cross-tool convention (https://github.com/agentsmd/agents.md/issues/136). A named value wins. A bare truthy value ("1", "true") says an agent is present but not which.
- Harness-specific markers (see markers), for harnesses that set neither.
- VOLCANO_AGENT: set by the Volcano skills when the harness sets nothing the CLI recognizes.
- A bare truthy AI_AGENT or AGENT: reported as Unknown.
- Weak (host) markers: variables that show the terminal or workspace the command ran in, or agent settings people export in their own profile. A person typing there sets them too, and any agent started there inherits them, so they are the weakest signal.
The result is advisory telemetry. Any process can set these variables, so nothing may use it to grant or deny anything.
Index ¶
Constants ¶
View Source
const Unknown = "unknown"
Unknown is the name reported when AI_AGENT or AGENT says an agent is present without naming it, and no other rule names it.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Result ¶
type Result struct {
// Name is the canonical agent name, e.g. "claude-code". Empty when no
// agent was detected.
Name string
// Raw is the sanitized value of the variable that named the agent, when
// that variable carried free text (AI_AGENT, AGENT, VOLCANO_AGENT). It can
// carry more than Name, e.g. a version: "claude-code_2-1-299_agent".
Raw string
// Source is the rule that produced Name.
Source Source
// Markers lists the canonical agent name of every marker present, host
// markers included, deduplicated, in table order. It is filled whatever
// rule produced Name. More than one entry means agents are nested (e.g.
// Claude Code started from a Cursor terminal).
Markers []string
}
Result is the outcome of Detect. The zero value means no agent was detected.
Click to show internal directories.
Click to hide internal directories.