Skip to main content

Module ccs

Module ccs 

Source
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 config
  • ccs/personal - Uses the “personal” profile
  • ccs/gemini - Uses CCS with Gemini provider
  • ccs - 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§

CcsAliasResolver
CCS alias resolver that can be used by the agent registry.
CcsCommandResult
Result type for CCS command resolution with diagnostics.
CcsEnvVarDebugSummary

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