The QoderCLIAgent implements the Agent interface for QoderCLI, a high-performance coding assistant. It handles the lifecycle of the Qoder binary, including installation via official scripts, credential verification for the Qoder platform, and session recovery from local JSONL trace files.
The QoderCLIAgent is a specialized CLIAgent that interacts with the qodercli binary internal/agent/qodercli.go19-21 It is designed to run within a Runtime environment (Host, Docker, or OpenSandbox) and provides automated path discovery for its binary, which is typically located in $HOME/.local/bin internal/agent/qodercli.go25-28
When initialized via NewQoderCLIAgent, the agent sets several defaults:
qodercli internal/agent/qodercli.go32-34command -v qodercli internal/agent/qodercli.go35-37qodercli -p "%s" 2>&1 internal/agent/qodercli.go38-40.qoder/skills internal/agent/qodercli.go41-43The following diagram illustrates how a natural language prompt is processed by the QoderCLIAgent and converted back into a structured SessionResult.
Diagram: QoderCLI Execution Pipeline
Sources: internal/agent/qodercli.go72-105 internal/agent/qodercli.go125-138 internal/agent/qodercli.go140-158 internal/agent/qodercli.go172-225
The agent automates installation using the official Qoder installer script. If InstallCmd is not explicitly provided in the configuration, it defaults to the command returned by defaultQoderCLIInstallCmd(): curl -fsSL https://qoder.com/install | bash internal/agent/qodercli.go235-238 internal/agent/qodercli_test.go111-122 During installation, the agent probes the environment to ensure $HOME/.local/bin is present in the PATH via qoderExecPathProbeCmd internal/agent/qodercli.go28 internal/agent/qodercli.go230
QoderCLI uses QODER_PERSONAL_ACCESS_TOKEN internal/credential/credential.go23 for authentication. The agent checks for this token in two places:
EnvVars map provided during agent configuration internal/agent/qodercli.go55-58If the token is missing, the agent logs a warning but proceeds, as QoderCLI may rely on an existing local login state internal/agent/qodercli.go65-66
Sources: internal/agent/qodercli.go50-67 internal/agent/qodercli.go229-247 internal/agent/qodercli_test.go37-49 internal/credential/credential.go23-24
QoderCLI stores session data in JSONL format under a project-specific directory. The agent identifies the correct directory by generating a workspaceKey via workspaceKeyForRuntime, which is the absolute path of the workspace with slashes replaced by hyphens internal/agent/session_lookup.go111-117
The function findQoderSessionFile performs the following steps inside the runtime using findAgentSessionJSONL internal/agent/qodercli.go218-224:
$home/.qoder/projects/$SKILL_UP_QODER_WSKEY internal/agent/qodercli.go221*-session.json using findExtra internal/agent/qodercli.go222.jsonl file based on stat timestamps in the shell script internal/agent/session_lookup.go132-149QoderCLI session files are processed within a cleanup context that detaches from the main run context to prevent premature cancellation internal/agent/session_lookup.go24-26 The withDownloadedSession helper manages the "download → register → parse" pipeline internal/agent/session_lookup.go37-66 The buildSessionResult method calls parseSessionFile to extract:
Diagram: Session Discovery and Data Recovery
Sources: internal/agent/qodercli.go218-224 internal/agent/session_lookup.go89-118 internal/agent/session_lookup.go132-149 internal/agent/session_lookup.go24-26
QoderCLI often extracts native binaries to a fixed directory in /tmp.
qodercli processes running concurrently in the same runtime may encounter race conditions during extraction or permission errors.QoderCLI supports a specific set of model aliases: lite, efficient, auto, performance, and ultimate internal/agent/qodercli.go23 If a user configures a model name outside this list (e.g., a Claude or GPT model name), the effectiveModelName function logs a warning and allows QoderCLI to fall back to its local default settings internal/agent/qodercli.go125-138
The QoderCLI agent requires a Bash-compatible environment to execute commands correctly, checked via requireBashTargetShell at the start of Run internal/agent/qodercli.go73-75
Sources: internal/agent/qodercli.go23 internal/agent/qodercli.go73-75 internal/agent/qodercli.go125-138 internal/agent/qodercli_test.go187-205
Refresh this wiki