Expand description
Agent Abstraction Module
Provides a pluggable agent system for different AI coding assistants
(Claude, Codex, OpenCode, Goose, Cline, CCS, etc.)
§Module Structure
ccs- CCS (Claude Code Switch) alias resolutionconfig- Agent configuration types and TOML parsingerror- Error classification for fault-tolerant executionfallback- Fallback chain configuration for agent switchingparser- JSON parser type definitionsproviders-OpenCodeprovider types and authenticationregistry- Agent registry for agent lookup and management
§Configuration
Agents can be configured via (in order of increasing priority):
- Built-in defaults (claude, codex, opencode, ccs, aider, goose, cline, continue, amazon-q, gemini)
- Unified config file (
~/.config/ralph-workflow.toml) - Environment variables (
RALPH_DEVELOPER_CMD,RALPH_REVIEWER_CMD) - Programmatic registration via
AgentRegistry::register()
§CCS (Claude Code Switch) Support
CCS aliases can be defined in the unified config and used with ccs/alias syntax:
[ccs_aliases]
work = "ccs work"
personal = "ccs personal"
gemini = "ccs gemini"
[agent_chain]
developer = ["ccs/work", "claude"]§Agent Switching / Fallback
Configure fallback agents for automatic switching when primary agent fails:
[agent_chain]
developer = ["claude", "codex", "goose"]
reviewer = ["codex", "claude"]
max_retries = 3
retry_delay_ms = 1000§Example TOML Configuration
[agents.myagent]
cmd = "my-ai-tool run"
output_flag = "--json-stream"
yolo_flag = "--auto-fix"
verbose_flag = "--verbose"
can_commit = true
json_parser = "claude" # Use Claude's JSON parserRe-exports§
pub use fallback::AgentRole;
Modules§
- fallback
- Fallback chain configuration for agent fault tolerance.
- opencode_
api - OpenCode API catalog module.
- validation
- Startup validation for OpenCode agent references.
Structs§
- Agent
Config - Agent capabilities.
- Agent
Registry - Agent registry with CCS alias and OpenCode dynamic provider/model support.
- Agents
Config File - Root TOML configuration structure.
- Config
Source - Config source for tracking where config was loaded from.
Enums§
- Agent
Error Kind - Error classification for agent failures.
- Config
Init Result - Result of checking/initializing the agents config file.
- Json
Parser Type - JSON parser type for agent output.
- Open
Code Provider Type OpenCodeprovider type extracted from model flag.
Traits§
- Retry
Timer Provider - Provider for sleep operations in retry logic.
Functions§
- auth_
failure_ advice - Get provider-specific authentication failure advice based on model flag.
- contains_
glm_ model - Check if a string contains a GLM-like model name.
- global_
agents_ config_ path - Get the global agents.toml path.
- is_
ccs_ ref - Check if an agent name is a CCS reference.
- is_
glm_ like_ agent - Check if an agent is a CCS/Claude-based agent using a GLM-like model.
- strip_
model_ flag_ prefix - Strip a leading model-flag prefix and return the raw
provider/modelstring. - validate_
model_ flag - Validate a model flag and return provider-specific warnings if any issues detected.