Skip to main content

detect_agent

Function detect_agent 

Source
pub fn detect_agent(command: &[String]) -> AgentKind
Expand description

Detect the agent kind from the command argv (FR-1.2).

Rules:

  • If command is empty, this is a caller bug → Generic.
  • If the basename of command[0] is claude (with optional .exe on Windows), → ClaudeCode.
  • If the basename is codexCodexCli.
  • If the basename is geminiGeminiCli.
  • Otherwise → Generic.

A forced --adapter flag bypasses this; the CLI wires that by passing the adapter’s AgentKind directly, so detection only runs for the auto path.