Expand description
CCS (Claude Code Switch) Alias Resolution
This module provides support for resolving CCS aliases to agent configurations.
CCS is a universal AI profile manager that supports multiple Claude accounts,
Gemini, Copilot, OpenRouter, and other providers.
§Direct Claude Execution for CCS GLM Only
IMPORTANT: This module bypasses the ccs wrapper command only for ccs/glm.
§Why?
The ccs wrapper command does not pass through all Claude CLI flags properly
(especially streaming-related flags like --include-partial-messages). For GLM,
Ralph also needs to inject Anthropic-compatible env vars from CCS settings.
For other CCS profiles/providers (e.g. Gemini, Codex), CCS must initialize
provider-specific state itself, so Ralph runs ccs ... directly and does not
inject GLM/Anthropic env vars.
§How?
For ccs/glm, instead of running ccs glm --print --output-format=stream-json ..., we run:
ANTHROPIC_BASE_URL="..." \
ANTHROPIC_AUTH_TOKEN="..." \
ANTHROPIC_MODEL="..." \
claude --print --output-format=stream-json ...The environment variables are loaded from CCS’ settings files using the same
resolution rules CCS uses (via ~/.ccs/config.json / ~/.ccs/config.yaml and
common settings filenames like ~/.ccs/{profile}.settings.json). This avoids
running the ccs wrapper while still using CCS-managed credentials.
§Fallback
If the claude binary is not found in PATH (or env vars can’t be loaded), the
original ccs command is used.
§Usage
Agents can be specified using ccs/alias syntax:
ccs/work- Uses the “work” profile from CCS configccs/personal- Uses the “personal” profileccs/gemini- Uses CCS with Gemini providerccs- Uses the default CCS profile
§Configuration
CCS aliases are defined in ~/.config/ralph-workflow.toml:
[ccs]
# Defaults applied to all CCS aliases unless overridden per-alias.
# If your CCS version doesn't support these Claude CLI flags, set them to "".
output_flag = "--output-format=stream-json"
verbose_flag = "--verbose"
# YOLO (autonomous) mode: enabled by default (skip permission/confirmation prompts).
# Set to "" to disable and require confirmations.
yolo_flag = "--dangerously-skip-permissions"
json_parser = "claude"
[ccs_aliases]
work = "ccs work" # shorthand
personal = { cmd = "ccs personal" } # explicit table form
gemini = { cmd = "ccs gemini", output_flag = "", verbose_flag = "", json_parser = "generic" }Structs§
- CcsAlias
Resolver - CCS alias resolver that can be used by the agent registry.
- CcsCommand
Result - Result type for CCS command resolution with diagnostics.
- CcsEnv
VarDebug Summary
Constants§
- CCS_
PREFIX - CCS alias prefix for agent names.
Functions§
- build_
ccs_ agent_ config - ccs_
env_ var_ debug_ summary - is_
ccs_ ref - Check if an agent name is a CCS reference.
- parse_
ccs_ ref - Parse a CCS agent reference and extract the alias name.
- resolve_
ccs_ agent - Resolve a CCS alias to an
AgentConfig. - resolve_
ccs_ command