// Auto-activate CCS CLI delegation for deterministic tasks. Parses user input, auto-selects optimal profile (glm/kimi/custom) from ~/.ccs/config.json, enhances prompts with context, executes via `ccs {profile} -p "task"` or `ccs {profile}:continue`, and reports results. Triggers on "use ccs [task]" patterns, typo/test/refactor keywords. Excludes complex architecture, security-critical code, performance optimization, breaking changes.
| name | ccs-delegation |
| description | Auto-activate CCS CLI delegation for deterministic tasks. Parses user input, auto-selects optimal profile (glm/kimi/custom) from ~/.ccs/config.json, enhances prompts with context, executes via `ccs {profile} -p "task"` or `ccs {profile}:continue`, and reports results. Triggers on "use ccs [task]" patterns, typo/test/refactor keywords. Excludes complex architecture, security-critical code, performance optimization, breaking changes. |
| version | 3.0.0 |
Delegate deterministic tasks to cost-optimized models via CCS CLI.
Execute tasks via alternative models using:
ccs {profile} -p "task"ccs {profile}:continue -p "follow-up"Profile Selection:
~/.ccs/config.json via task analysis--{profile} flag forces specific profileUsers trigger delegation naturally:
Examples:
For /ccs [task]:
Parse override flag
--(\w+)profile = match[1], remove flag from task, skip to step 5Discover profiles
~/.ccs/config.json using Read toolObject.keys(config.profiles) → availableProfiles[]Analyze task requirements
/(think|analyze|reason|debug|investigate|evaluate)/i → needsReasoning = true/(architecture|entire|all files|codebase|analyze all)/i → needsLongContext = true/(typo|test|refactor|update|fix)/i → preferCostOptimized = trueSelect profile
availableProfiles: classify by name pattern (see Profile Characteristic Inference table)needsReasoning: filter profiles where reasoning=true → prefer kimineedsLongContext: filter profiles where context=long → prefer kimicost=low → prefer glmselectedProfile = filteredProfiles[0]filteredProfiles.length === 0: fallback to glm if exists, else first availableEnhance prompt
/cook, /commit)Execute delegation
ccs {selectedProfile} -p "$enhancedPrompt" via Bash toolReport results
For /ccs:continue [follow-up]:
Detect profile
~/.ccs/delegation-sessions.json using Read toolParse override flag
--(\w+)profile = match[1], remove flag from follow-up, log profile switchEnhance prompt
Execute continuation
ccs {profile}:continue -p "$enhancedPrompt" via Bash toolReport results
Delegate when:
Keep in main when:
Task Analysis Keywords (scan task string with regex):
| Pattern | Variable | Example |
|---|---|---|
/(think|analyze|reason|debug|investigate|evaluate)/i | needsReasoning = true | "think about caching" |
/(architecture|entire|all files|codebase|analyze all)/i | needsLongContext = true | "analyze all files" |
/(typo|test|refactor|update|fix)/i | preferCostOptimized = true | "fix typo in README" |
Profile Characteristic Inference (classify by name pattern):
| Profile Pattern | Cost | Context | Reasoning |
|---|---|---|---|
/^glm/i | low | standard | false |
/^kimi/i | medium | long | true |
/^claude/i | high | standard | false |
| others | low | standard | false |
Selection Algorithm (apply filters sequentially):
profiles = Object.keys(config.profiles)
classified = profiles.map(p => ({name: p, ...inferCharacteristics(p)}))
if (needsReasoning):
filtered = classified.filter(p => p.reasoning === true).sort(['kimi'])
else if (needsLongContext):
filtered = classified.filter(p => p.context === 'long').sort(['kimi'])
else:
filtered = classified.filter(p => p.cost === 'low').sort(['glm', ...])
selected = filtered[0] || profiles.find(p => p === 'glm') || profiles[0]
if (!selected): throw Error("No profiles configured")
log("Selected {selected} (reason: {reasoning|long-context|cost-optimized})")
Override Logic:
/--(\w+)/. If match: profile = match[1], remove from task, skip selectionGood candidates:
Bad candidates (keep in main):
Commands:
/ccs "task" - Intelligent delegation (auto-select profile)/ccs --{profile} "task" - Force specific profile/ccs:continue "follow-up" - Continue last session (auto-detect profile)/ccs:continue --{profile} "follow-up" - Continue with profile switchAgent via Bash:
ccs {auto-selected} -p "task"ccs {detected}:continue -p "follow-up"Template: CLAUDE.md.template - Copy to user's CLAUDE.md for auto-delegation config
Troubleshooting: references/troubleshooting.md