Documentation
¶
Overview ¶
Package agent detects AI coding agents hosting the process.
Index ¶
Examples ¶
Constants ¶
const ( // EnvAgent is the proposed cross-tool convention // (https://github.com/agentsmd/agents.md/issues/136), set either to the // agent's name (e.g. `goose`, `amp`) or a truthy token like `1`. EnvAgent = "AGENT" // EnvAIAgent is the more specific variant used by Vercel's detection // tooling; consulted with the same semantics as [EnvAgent]. EnvAIAgent = "AI_AGENT" )
Environment variables consulted by Is and Detect.
const ( Amp = "amp" Claude = "claude" Cline = "cline" Codex = "codex" Cursor = "cursor" Gemini = "gemini" Goose = "goose" OpenCode = "opencode" Replit = "replit" )
Recognized AI coding agent names, as returned by Detect.
Variables ¶
This section is empty.
Functions ¶
func Detect ¶
func Detect() string
Detect returns the name of the AI coding agent hosting the process, or empty if there is none or it cannot be identified. A named `AGENT` / `AI_AGENT` value is returned verbatim (lowercased), so agents unknown to this package still identify themselves; a bare truthy token like `AGENT=1` signals presence without identity, so Detect falls through to the marker variables and may return empty even though Is reports true.
func Is ¶
func Is() bool
Is reports whether the process appears to be running under an AI coding agent. Detection is best-effort, based on environment variables set by the hosting agent: the cross-tool `AGENT` / `AI_AGENT` convention first, then agent-specific markers (`CLAUDECODE`, `CODEX_SANDBOX`, `CURSOR_AGENT`, ...). A falsy `AGENT` / `AI_AGENT` value (`0`, `false`, `no`, `off`) is an explicit opt-out and reports false even when a marker variable is present, mirroring the `CI=false` escape hatch.
Types ¶
This section is empty.