@kaitranntt/ccs 4.3.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -322,7 +322,7 @@ graph LR
322
322
  ```plaintext
323
323
  ~/.ccs/
324
324
  ├── .claude/ # CCS items (ships with package, v4.1)
325
- │ ├── commands/ccs/ # Delegation commands (/ccs:glm, /ccs:kimi)
325
+ │ ├── commands/ccs/ # Delegation commands (/ccs, /ccs:continue)
326
326
  │ ├── skills/ccs-delegation/ # AI decision framework
327
327
  │ └── agents/ccs-delegator.md # Proactive delegation agent
328
328
  ├── shared/ # Symlinks to ~/.claude/ (for profiles)
@@ -401,7 +401,7 @@ ccs --help # Show all commands and options
401
401
 
402
402
  ### What is Delegation?
403
403
 
404
- CCS Delegation lets you **send tasks to alternative models** (`glm`, `kimi`) **from your main Claude session** using the `-p` flag or slash commands (`/ccs:glm`, `/ccs:kimi`).
404
+ CCS Delegation lets you **send tasks to alternative models** (`glm`, `kimi`) **from your main Claude session** using the `-p` flag or intelligent slash commands (`/ccs`, `/ccs:continue`).
405
405
 
406
406
  **Why use it?**
407
407
  - **Token efficiency**: Simple tasks cost 81% less on GLM vs main Claude session
@@ -426,9 +426,10 @@ ccs glm:continue -p "run the tests and fix any failures"
426
426
  **Via Slash Commands** (inside Claude sessions):
427
427
  ```bash
428
428
  # In your main Claude session:
429
- /ccs:glm "refactor auth.js to use async/await"
430
- /ccs:kimi "find all deprecated API usages across codebase"
431
- /ccs:glm:continue "also update the README examples"
429
+ /ccs "refactor auth.js to use async/await" # Auto-selects best profile
430
+ /ccs --glm "fix typo in documentation" # Forces GLM profile
431
+ /ccs --kimi "analyze entire architecture" # Forces Kimi profile
432
+ /ccs:continue "also update the README examples" # Continues last session
432
433
  ```
433
434
 
434
435
  **Via Natural Language** (Claude auto-delegates):
package/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.1
1
+ 4.3.3
package/bin/ccs.js CHANGED
@@ -172,8 +172,10 @@ function handleHelpCommand() {
172
172
 
173
173
  // Delegation (inside Claude Code CLI)
174
174
  console.log(colored('Delegation (inside Claude Code CLI):', 'cyan'));
175
- console.log(` ${colored('/ccs:glm "task"', 'yellow')} Delegate to GLM-4.6 for simple tasks`);
176
- console.log(` ${colored('/ccs:kimi "task"', 'yellow')} Delegate to Kimi for long context`);
175
+ console.log(` ${colored('/ccs "task"', 'yellow')} Delegate task (auto-selects best profile)`);
176
+ console.log(` ${colored('/ccs --glm "task"', 'yellow')} Force GLM-4.6 for simple tasks`);
177
+ console.log(` ${colored('/ccs --kimi "task"', 'yellow')} Force Kimi for long context`);
178
+ console.log(` ${colored('/ccs:continue "follow-up"', 'yellow')} Continue last delegation session`);
177
179
  console.log(' Save tokens by delegating simple tasks to cost-optimized models');
178
180
  console.log('');
179
181
 
@@ -25,7 +25,7 @@ Enhanced Claude Code delegation system for multi-model task delegation.
25
25
 
26
26
  ### Session Management
27
27
  - Persistence: `~/.ccs/delegation-sessions.json`
28
- - Resume via `/ccs:glm:continue` and `/ccs:kimi:continue`
28
+ - Resume via `/ccs:continue` (auto-detects profile)
29
29
  - Auto-cleanup expired sessions (>30 days)
30
30
  - Cost aggregation across turns
31
31
 
@@ -91,12 +91,13 @@ Automatically applied as CLI flags:
91
91
  The delegation system is invoked via simple slash commands in `.claude/commands/ccs/`:
92
92
 
93
93
  ### Basic Commands
94
- - `/ccs:glm "task"` - Delegate to GLM-4.6
95
- - `/ccs:kimi "task"` - Delegate to Kimi (long-context)
94
+ - `/ccs "task"` - Delegate task (auto-selects best profile)
95
+ - `/ccs --glm "task"` - Force GLM-4.6 delegation
96
+ - `/ccs --kimi "task"` - Force Kimi delegation (long-context)
96
97
 
97
- ### Multi-Turn Commands
98
- - `/ccs:glm:continue "follow-up"` - Resume last GLM session
99
- - `/ccs:kimi:continue "follow-up"` - Resume last Kimi session
98
+ ### Session Continuation
99
+ - `/ccs:continue "follow-up"` - Resume last delegation session (auto-detect profile)
100
+ - `/ccs:continue --glm "follow-up"` - Resume with specific profile switch
100
101
 
101
102
  Each command directly invokes:
102
103
  ```bash
@@ -143,7 +144,8 @@ node tests/unit/delegation/result-formatter.test.js
143
144
  ## Architecture
144
145
 
145
146
  ```
146
- User → SlashCommand (/ccs:glm)
147
+ User → SlashCommand (/ccs)
148
+ → ccs-delegation skill (auto-selects profile)
147
149
  → Directly invokes: claude -p
148
150
  → HeadlessExecutor (monitors execution)
149
151
  → SessionManager (load last session)
@@ -364,12 +364,12 @@ class Doctor {
364
364
  checkDelegation() {
365
365
  const spinner = ora('Checking delegation').start();
366
366
 
367
- // Check if delegation commands exist in ~/.ccs/.claude/commands/ccs/
368
- const ccsClaudeCommandsDir = path.join(this.ccsDir, '.claude', 'commands', 'ccs');
369
- const hasGlmCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'glm.md'));
370
- const hasKimiCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'kimi.md'));
367
+ // Check if delegation commands exist in ~/.ccs/.claude/commands/
368
+ const ccsClaudeCommandsDir = path.join(this.ccsDir, '.claude', 'commands');
369
+ const hasCcsCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'ccs.md'));
370
+ const hasContinueCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'ccs', 'continue.md'));
371
371
 
372
- if (!hasGlmCommand || !hasKimiCommand) {
372
+ if (!hasCcsCommand || !hasContinueCommand) {
373
373
  spinner.warn(` ${'Delegation'.padEnd(26)}${colored('[!]', 'yellow')} Not installed`);
374
374
  this.results.addCheck(
375
375
  'Delegation',
package/lib/ccs CHANGED
@@ -2,7 +2,7 @@
2
2
  set -euo pipefail
3
3
 
4
4
  # Version (updated by scripts/bump-version.sh)
5
- CCS_VERSION="4.3.1"
5
+ CCS_VERSION="4.3.3"
6
6
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
7
  readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
8
8
  readonly PROFILES_JSON="$HOME/.ccs/profiles.json"
@@ -191,8 +191,10 @@ show_help() {
191
191
  echo ""
192
192
 
193
193
  echo -e "${CYAN}Delegation (inside Claude Code CLI):${RESET}"
194
- echo -e " ${YELLOW}/ccs:glm \"task\"${RESET} Delegate to GLM-4.6 for simple tasks"
195
- echo -e " ${YELLOW}/ccs:kimi \"task\"${RESET} Delegate to Kimi for long context"
194
+ echo -e " ${YELLOW}/ccs \"task\"${RESET} Delegate task (auto-selects best profile)"
195
+ echo -e " ${YELLOW}/ccs --glm \"task\"${RESET} Force GLM-4.6 for simple tasks"
196
+ echo -e " ${YELLOW}/ccs --kimi \"task\"${RESET} Force Kimi for long context"
197
+ echo -e " ${YELLOW}/ccs:continue \"follow-up\"${RESET} Continue last delegation session"
196
198
  echo -e " Save tokens by delegating simple tasks to cost-optimized models"
197
199
  echo ""
198
200
 
package/lib/ccs.ps1 CHANGED
@@ -12,7 +12,7 @@ param(
12
12
  $ErrorActionPreference = "Stop"
13
13
 
14
14
  # Version (updated by scripts/bump-version.sh)
15
- $CcsVersion = "4.3.1"
15
+ $CcsVersion = "4.3.3"
16
16
  $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
17
17
  $ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
18
18
  $ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json"
@@ -238,8 +238,10 @@ function Show-Help {
238
238
  Write-Host ""
239
239
 
240
240
  Write-ColorLine "Delegation (inside Claude Code CLI):" "Cyan"
241
- Write-ColorLine " /ccs:glm `"task`" Delegate to GLM-4.6 for simple tasks" "Yellow"
242
- Write-ColorLine " /ccs:kimi `"task`" Delegate to Kimi for long context" "Yellow"
241
+ Write-ColorLine " /ccs `"task`" Delegate task (auto-selects best profile)" "Yellow"
242
+ Write-ColorLine " /ccs --glm `"task`" Force GLM-4.6 for simple tasks" "Yellow"
243
+ Write-ColorLine " /ccs --kimi `"task`" Force Kimi for long context" "Yellow"
244
+ Write-ColorLine " /ccs:continue `"follow-up`" Continue last delegation session" "Yellow"
243
245
  Write-Host " Save tokens by delegating simple tasks to cost-optimized models"
244
246
  Write-Host ""
245
247
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaitranntt/ccs",
3
- "version": "4.3.1",
3
+ "version": "4.3.3",
4
4
  "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
5
5
  "keywords": [
6
6
  "cli",
@@ -1,117 +0,0 @@
1
- ---
2
- name: ccs-delegator
3
- description: Execute delegated tasks in isolated GLM/Kimi sessions via headless mode. Use when parent agent invokes `/ccs:glm` or `/ccs:kimi` slash commands to delegate simple tasks to cost-optimized models. This agent handles the execution orchestration, result collection, and reporting back to the main session. Examples:\n\n<example>\nContext: Main agent receives `/ccs:glm "refactor the parseConfig function"` command.\nparent_agent: "Delegating refactoring task to GLM-4.6 via ccs-delegator"\nassistant: "I'll execute this task in an isolated GLM session using headless mode"\n<commentary>\nThe parent agent has enhanced the prompt and determined the working directory. This agent now executes via `ccs glm -p` using the glm profile, captures output, and reports results.\n</commentary>\n</example>\n\n<example>\nContext: Main agent delegates long-context analysis to Kimi.\nparent_agent: "Delegating codebase analysis to Kimi via ccs-delegator"\nassistant: "I'll execute the analysis in a Kimi session and report findings"\n<commentary>\nThis agent handles execution in the kimi profile, which supports long-context tasks, and formats the comprehensive results for the main session.\n</commentary>\n</example>\n\n<example>\nContext: Delegation execution fails due to unconfigured profile.\nparent_agent: "Attempting delegation to GLM"\nassistant: "Execution failed: GLM profile not configured. Reporting error to main agent."\n<commentary>\nWhen delegation fails, this agent reports the error gracefully without blocking the main session. The main agent can then choose to retry or execute directly.\n</commentary>\n</example>
4
- allowed-tools: Bash, Read, Grep, Glob
5
- default-model: sonnet
6
- ---
7
-
8
- You are a Delegation Executor, a specialized subagent that orchestrates task execution in isolated Claude sessions using alternative models (GLM-4.6, Kimi) via headless mode.
9
-
10
- **CRITICAL RULES:**
11
-
12
- 1. **YOU MUST DELEGATE** - Your ONLY job is to execute `ccs` commands via Bash. You MUST NOT edit or write files yourself.
13
- 2. **ACTIVATE SKILL FIRST** - Always activate the `ccs-delegation` skill before any delegation.
14
- 3. **READ-ONLY ANALYSIS** - You can read files to understand context, but ALL actual work must be done via `ccs` delegation.
15
-
16
- ## Your Mission
17
-
18
- Execute tasks by delegating to alternative models via `ccs` CLI, then report results back to the main session.
19
-
20
- ## Workflow (MANDATORY)
21
-
22
- 1. **Activate Skill** - Load `ccs-delegation` skill for delegation guidelines
23
- 2. **Analyze Task** - Read files if needed to understand context
24
- 3. **Select Profile** - Choose GLM (simple/cost-optimized) or Kimi (long-context)
25
- 4. **Delegate** - Execute via `ccs {profile} -p "enhanced task description"`
26
- 5. **Report Results** - Parse output and report to main session
27
-
28
- ## Delegation Methodology
29
-
30
- When delegating tasks, you will:
31
-
32
- 1. **Task Analysis**
33
- - Read `ccs-delegation` skill for decision framework
34
- - Determine if task is delegation-appropriate
35
- - Estimate time needed: Quick (<2 min) / Medium (<10 min) / Complex (>10 min)
36
- - Identify scope: Single file vs multiple files
37
-
38
- 2. **Profile Selection**
39
- - GLM: Simple, cost-optimized (refactoring, tests, typos)
40
- - Kimi: Long-context (multi-file analysis, architecture docs)
41
-
42
- 3. **Session Strategy**
43
- - **New session** (`ccs {profile} -p "task"`): Use when:
44
- - Starting a new, unrelated task
45
- - Previous session >30 days old
46
- - Different files/scope than last delegation
47
-
48
- - **Continue session** (`ccs {profile}:continue -p "task"`): Use when:
49
- - Completing work from previous delegation
50
- - Fixing issues from last attempt
51
- - Adding to previously created files
52
- - Iterative refinement of same task
53
- - **CRITICAL**: Check delegation output for session ID before continuing
54
-
55
- 4. **Execution**
56
- - **New delegation**: `ccs {profile} -p "enhanced task description"`
57
- - **Continue delegation**: `ccs {profile}:continue -p "enhanced follow-up"`
58
- - **Note**: If task contains a slash command (/cook, /plan, /commit), keep it at the start when enhancing
59
- - Parse output for results
60
- - Report success/failure with file changes
61
-
62
- 5. **Batch Operations**
63
- - For multiple similar tasks, delegate each separately
64
- - Aggregate results
65
- - Report combined outcome
66
-
67
- ## Tools and Techniques
68
-
69
- You will utilize:
70
- - **CCS CLI**: `ccs glm -p`, `ccs kimi -p` for delegation
71
- - **Bash Tool**: Execute CCS commands
72
- - **Read Tool**: Understand project context when needed
73
- - **ccs-delegation Skill**: Core knowledge base for delegation decisions
74
-
75
- ## Integration Components
76
-
77
- CCS delegation uses these internal components:
78
- - **DelegationHandler**: Routes `-p` flag to HeadlessExecutor
79
- - **HeadlessExecutor**: Spawns `claude -p` with enhanced flags (--output-format stream-json, --permission-mode acceptEdits)
80
- - **SessionManager**: Persists sessions to `~/.ccs/delegation-sessions.json`
81
- - **ResultFormatter**: Displays ASCII box output with session ID, cost, turns
82
-
83
- Results include metadata parsed from stream-json output with real-time tool visibility.
84
-
85
- ## Execution Pattern
86
-
87
- **Standard delegation** (new task):
88
- ```bash
89
- ccs glm -p "Refactor auth.js to use async/await"
90
- ```
91
-
92
- **Session continuation** (same task, iterative):
93
- ```bash
94
- # First delegation creates landing page but misses JavaScript
95
- ccs glm -p "Create landing page in HTML/CSS"
96
-
97
- # Output shows: Files Created: index.html, styles.css
98
- # You notice JavaScript file is missing
99
-
100
- # Continue the SAME session to add missing JavaScript
101
- ccs glm:continue -p "Create the missing JavaScript file script.js"
102
- ```
103
-
104
- **Batch delegation** (multiple unrelated tasks):
105
- ```bash
106
- # Each is a separate new session (different files)
107
- ccs glm -p "Add tests for UserService"
108
- ccs glm -p "Add tests for AuthService"
109
- ccs glm -p "Add tests for OrderService"
110
- ```
111
-
112
- ## Remember
113
-
114
- - **NEVER edit/write files yourself** - You lack Edit/Write tools for a reason
115
- - **ALWAYS delegate via `ccs`** - That's your only purpose
116
- - **ALWAYS activate `ccs-delegation` skill first** - It contains critical decision framework
117
- - Parse the delegation output and report results concisely to the main session
@@ -1,22 +0,0 @@
1
- ---
2
- description: Continue last GLM delegation session [AUTO ENHANCE]
3
- argument-hint: [follow-up instruction]
4
- allowed-tools: Read, Grep, Glob, Bash
5
- ---
6
-
7
- Continue last GLM delegation session for iterative refinement.
8
-
9
- **Workflow:**
10
- - Review what was accomplished in previous session
11
- - Analyze the follow-up instruction in `$ARGUMENTS`
12
- - Enhance prompt with context (reference files, incomplete tasks, next steps)
13
- - Execute continuation via `ccs glm:continue -p "$ENHANCED_PROMPT"`
14
-
15
- **Note:** `$ENHANCED_PROMPT` is an enhanced version that references previous work, highlights incomplete tasks, and adds specific validation criteria. If the follow-up contains a slash command (e.g., /commit), keep it at the start of the enhanced prompt.
16
-
17
- **Usage:**
18
- ```
19
- /ccs:glm "fix typo in README"
20
- /ccs:glm:continue "also update the examples section"
21
- /ccs:glm:continue "/commit with descriptive message"
22
- ```
@@ -1,22 +0,0 @@
1
- ---
2
- description: Delegate task to GLM-4.6 (cost-optimized model) [AUTO ENHANCE]
3
- argument-hint: [task description]
4
- allowed-tools: Read, Grep, Glob, Bash
5
- ---
6
-
7
- Delegate simple, deterministic tasks to GLM-4.6 for token optimization.
8
-
9
- **Workflow:**
10
- - Analyze the task description in `$ARGUMENTS`
11
- - Gather context if needed (read files, check structure)
12
- - Enhance prompt with specific details (file paths, context, success criteria)
13
- - Execute delegation via `ccs glm -p "$ENHANCED_PROMPT"`
14
-
15
- **Note:** `$ENHANCED_PROMPT` is an enhanced version that adds specifics like file paths, current implementation context, expected behavior, and success criteria. If the task contains a slash command (e.g., /cook, /plan), keep it at the start of the enhanced prompt.
16
-
17
- **Usage:**
18
- ```
19
- /ccs:glm "refactor auth.js to use async/await"
20
- /ccs:glm "add tests for UserService"
21
- /ccs:glm "/cook create a landing page"
22
- ```
@@ -1,22 +0,0 @@
1
- ---
2
- description: Continue last Kimi delegation session [AUTO ENHANCE]
3
- argument-hint: [follow-up instruction]
4
- allowed-tools: Read, Grep, Glob, Bash
5
- ---
6
-
7
- Continue last Kimi delegation session for multi-turn analysis.
8
-
9
- **Workflow:**
10
- - Review analysis/work from previous session
11
- - Analyze the follow-up instruction in `$ARGUMENTS`
12
- - Enhance prompt with comprehensive context (findings, scope, deliverables, priority)
13
- - Execute continuation via `ccs kimi:continue -p "$ENHANCED_PROMPT"`
14
-
15
- **Note:** `$ENHANCED_PROMPT` is an enhanced version that references previous findings, specifies next scope, and adds actionable deliverables with priorities. If the follow-up contains a slash command (e.g., /plan), keep it at the start of the enhanced prompt.
16
-
17
- **Usage:**
18
- ```
19
- /ccs:kimi "analyze all files in src/"
20
- /ccs:kimi:continue "suggest architectural improvements"
21
- /ccs:kimi:continue "/plan for refactoring with phases"
22
- ```
@@ -1,22 +0,0 @@
1
- ---
2
- description: Delegate task to Kimi (long-context model) [AUTO ENHANCE]
3
- argument-hint: [task description]
4
- allowed-tools: Read, Grep, Glob, Bash
5
- ---
6
-
7
- Delegate long-context, multi-file tasks to Kimi for comprehensive analysis.
8
-
9
- **Workflow:**
10
- - Analyze the task description in `$ARGUMENTS`
11
- - Gather context across multiple files/directories
12
- - Enhance prompt with comprehensive details (structure, relationships, scope)
13
- - Execute delegation via `ccs kimi -p "$ENHANCED_PROMPT"`
14
-
15
- **Note:** `$ENHANCED_PROMPT` is an enhanced version that adds directory structures, cross-file relationships, architecture context, and deliverables. If the task contains a slash command (e.g., /plan, /commit), keep it at the start of the enhanced prompt.
16
-
17
- **Usage:**
18
- ```
19
- /ccs:kimi "analyze all files in src/ and document architecture"
20
- /ccs:kimi "find all deprecated API usages across codebase"
21
- /ccs:kimi "/plan for authentication system"
22
- ```
@@ -1,24 +0,0 @@
1
- # CCS Delegation References
2
-
3
- ## Reading Order
4
-
5
- 1. **Start here**: `../SKILL.md` - Entry point, quick start
6
- 2. `headless-workflow.md` - Technical details (command syntax, features, config)
7
- 3. **As needed**:
8
- - `delegation-guidelines.md` - Decision framework
9
- - `troubleshooting.md` - Error recovery
10
-
11
- ## File Hierarchy
12
-
13
- **PRIMARY (Authoritative Source)**
14
- - `headless-workflow.md` - Technical implementation details
15
-
16
- **SUPPORTING (Reference Primary)**
17
- - `delegation-guidelines.md` - When to delegate
18
- - `troubleshooting.md` - Error patterns
19
-
20
- ## Quick Navigation
21
-
22
- **Need command syntax?** → `headless-workflow.md`
23
- **Need to decide if delegate?** → `delegation-guidelines.md`
24
- **Got an error?** → `troubleshooting.md`
@@ -1,99 +0,0 @@
1
- # Delegation Guidelines
2
-
3
- AI decision framework for when to delegate tasks vs keep in main session.
4
-
5
- ## Task Classification Rules
6
-
7
- **Delegate if ALL criteria match:**
8
- - Task scope: Single concern, < 5 files
9
- - Complexity: Mechanical transformation, established pattern
10
- - Ambiguity: Zero decisions required, clear acceptance criteria
11
- - Context: Existing patterns to follow, no architecture changes
12
-
13
- **Keep in main if ANY criteria match:**
14
- - Requires design decisions or tradeoff analysis
15
- - Security-critical (auth, encryption, permissions)
16
- - Performance-sensitive requiring profiling/measurement
17
- - Breaking changes or API migrations
18
- - User discussion/clarification needed
19
- - Coordinated changes across multiple subsystems
20
-
21
- ## Delegation Pattern Matching
22
-
23
- **High-confidence delegation patterns:**
24
- ```
25
- Task patterns to delegate:
26
- - refactor .* to use (async/await|destructuring|arrow functions)
27
- - add (unit|integration) tests for .*
28
- - fix (typos?|formatting|linting errors?) in .*
29
- - add JSDoc comments to .*
30
- - extract .* into (function|method|util) .*
31
- - rename (variable|function) .* to .*
32
- - add DELETE endpoint for .*
33
- - update README to document .*
34
- ```
35
-
36
- **Anti-patterns (never delegate):**
37
- ```
38
- Task patterns to avoid:
39
- - implement .* (too vague, needs design)
40
- - improve .* (subjective, needs discussion)
41
- - fix bug .* (requires investigation)
42
- - optimize .* (requires profiling)
43
- - migrate .* to .* (breaking change)
44
- - design .* (architecture decision)
45
- - whatever .* you think (requires judgment)
46
- ```
47
-
48
- ## Prompt Quality Criteria
49
-
50
- **Well-formed delegation prompt:**
51
- - Specifies exact file paths: `in src/auth.js, ...`
52
- - Defines success criteria: `covering positive, zero, negative cases`
53
- - Single atomic task: One verb, one target
54
- - Uses imperative mood: "add tests" not "adding tests"
55
-
56
- **Malformed delegation prompt:**
57
- - Multiple tasks: "add tests, update docs, fix linting"
58
- - Vague scope: "improve the code"
59
- - Requires decisions: "use whatever library you want"
60
- - No file context: "fix the bug" (which file?)
61
-
62
- ## Token Efficiency Model
63
-
64
- **Delegation cost model:**
65
- - Main session overhead: ~2000 tokens (context, discussion)
66
- - Delegation overhead: ~500 tokens (focused execution)
67
- - Net savings: ~1500 tokens per delegated task
68
-
69
- **When to batch delegate:**
70
- - User requests N similar tasks (e.g., "add tests for all services")
71
- - Each task follows identical pattern
72
- - Tasks are independent (no coordination needed)
73
-
74
- **Execution pattern:**
75
- ```
76
- for each service in [UserService, AuthService, OrderService]:
77
- ccs glm -p "add unit tests for {service} using Jest"
78
- ```
79
-
80
- ## Monorepo Handling
81
-
82
- **Workspace specification required:**
83
- - Pattern: `in packages/{workspace}, {task}`
84
- - Example: `in packages/api, add validation middleware`
85
- - Without workspace: Task may target wrong package
86
-
87
- ## Scope Limits
88
-
89
- **Absolute limits (reject delegation):**
90
- - Estimated time > 30 minutes
91
- - File count > 5 files
92
- - Requires external research
93
- - Breaking changes to public APIs
94
- - User explicitly requests discussion
95
-
96
- **Examples of over-scoped tasks:**
97
- - "Migrate from SQLite to PostgreSQL" (breaking change)
98
- - "Implement OAuth2 authentication" (too complex)
99
- - "Analyze entire codebase for security issues" (research task)