> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ccs.kaitran.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# Task Delegation

> Delegate tasks to appropriate models

# Task Delegation

CCS includes intelligent task delegation via the `/ccs` meta-command, allowing you to route tasks to the most appropriate model.

## Basic Delegation

```bash theme={null}
# Delegate planning to GLM (saves Sonnet tokens)
/ccs glm /plan "add user authentication"

# Delegate coding to GLM
/ccs glm /code "implement auth endpoints"

# Quick questions with Haiku
/ccs haiku /ask "explain this error"
```

## Continue Previous Session

Resume the last delegation session to continue a task:

```bash theme={null}
# Continue last delegation with follow-up
/ccs:continue "add error handling to that feature"

# Works with any previous delegation context
/ccs:continue "also add unit tests"
```

This preserves the context from your previous delegation, enabling multi-step workflows without repeating information.

## Benefits

* Save tokens by delegating simple tasks to cheaper models
* Use right model for each task automatically
* Reusable commands across all projects (user-scope)
* Seamless integration with existing workflows
* Session continuity with `/ccs:continue`

## Headless Delegation

Execute prompts without interactive session using `-p` or `--prompt`:

```bash theme={null}
# Direct prompt execution
ccs -p "your prompt"
ccs --prompt "your prompt"

# With specific profile
ccs glm -p "implement feature"
ccs codex --prompt "analyze this code"
```

Use cases:

* CI/CD pipelines
* Automated scripts
* Batch processing
* Remote/headless servers

## Workflow Example

**Scenario**: Building a new payment integration feature

```bash theme={null}
# Step 1: Architecture & Planning (needs Claude's intelligence)
ccs
/plan "Design payment integration with Stripe"
# → Claude Sonnet 4.5 thinks deeply about edge cases

# Step 2: Implementation (straightforward, use GLM)
ccs glm
/code "implement the payment webhook handler"
# → GLM 4.6 writes code efficiently, saves usage

# Step 3: Code Review (needs deep analysis)
ccs
/review "check payment handler for security"
# → Claude Sonnet catches subtle vulnerabilities

# Step 4: Bug Fixes (simple)
ccs glm
/fix "update error message formatting"
# → GLM handles routine fixes

# Step 5: Continue with follow-up
/ccs:continue "also add logging to the webhook"
# → Continues from previous context
```

**Result**: Best model for each task, lower costs, better quality.

## Task-Model Mapping

| Task Type                 | Recommended Model     | Why                               |
| ------------------------- | --------------------- | --------------------------------- |
| Architecture              | Claude Sonnet         | Deep reasoning, edge cases        |
| Planning                  | Claude Sonnet         | System design                     |
| Code Review               | Claude Sonnet         | Security, subtle bugs             |
| Implementation            | GLM 5                 | Efficient, cost-effective         |
| Simple Fixes              | GLM 5                 | Routine changes                   |
| Long Docs                 | Kimi                  | 1M context window                 |
| Quick Iterations          | GPT-5 Codex Mini      | Fast responses, low overhead      |
| Reasoning-First API Tasks | `/ccs --km`           | Kimi API reasoning                |
| Thinking Tasks            | Claude Sonnet / Codex | Strong reasoning and review depth |

## Rate Limit Management

```bash theme={null}
# Working on complex refactoring with Claude
ccs
/plan "refactor authentication system"

# Claude hits rate limit mid-task
# → Error: Rate limit exceeded

# Switch to GLM instantly
ccs glm
# Continue working without interruption

# Rate limit resets? Switch back
ccs
```

## Profile Selection

Force specific profiles for delegation:

```bash theme={null}
# Force GLM for simple tasks
/ccs --glm "task description"

# Force Kimi for long context
/ccs --kimi "analyze this large codebase"

# Force Codex for quick iterations
/ccs --codex "quick prototype"

# Force Kimi for Coding API reasoning
/ccs --km "reason through this failing test"
```
