diff --git a/.claude/commands/ccs.md b/.claude/commands/ccs.md new file mode 100644 index 00000000..9c3c8139 --- /dev/null +++ b/.claude/commands/ccs.md @@ -0,0 +1,17 @@ +--- +description: Delegate task with intelligent profile selection [AUTO ENHANCE] +argument-hint: [task description] +--- + +Activate `ccs-delegation` skill. The skill contains all execution logic. + +Task: Parse `$ARGUMENTS`, select optimal profile from `~/.ccs/config.json`, enhance prompt, execute delegation via CCS CLI. + +**Examples:** +``` +/ccs "refactor auth.js to use async/await" # Simple task +/ccs "analyze entire architecture" # Long-context task +/ccs "think about caching strategy" # Reasoning task +/ccs --glm "add tests for UserService" # Force specific profile +/ccs "/cook create landing page" # Nested slash command +``` diff --git a/.claude/commands/ccs/continue.md b/.claude/commands/ccs/continue.md new file mode 100644 index 00000000..35498a2d --- /dev/null +++ b/.claude/commands/ccs/continue.md @@ -0,0 +1,15 @@ +--- +description: Continue last CCS delegation session [AUTO ENHANCE] +argument-hint: [follow-up instruction] +--- + +Activate `ccs-delegation` skill. The skill contains all execution logic. + +Task: Detect last-used profile from `~/.ccs/delegation-sessions.json`, parse `$ARGUMENTS`, enhance with previous context, execute continuation via CCS CLI. + +**Examples:** +``` +/ccs:continue "also update the examples section" # Use last profile +/ccs:continue --glm "add unit tests" # Switch profiles +/ccs:continue "/commit with message" # Nested slash command +``` diff --git a/.claude/commands/ccs/glm.md b/.claude/commands/ccs/glm.md deleted file mode 100644 index e2906da0..00000000 --- a/.claude/commands/ccs/glm.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -description: Delegate task to GLM-4.6 (cost-optimized model) [AUTO ENHANCE] -argument-hint: [task description] ---- - -Delegate simple, deterministic tasks to GLM-4.6 for token optimization. - -**Workflow:** -- Analyze the task description in `$ARGUMENTS` -- Gather context if needed (read files, check structure) -- Enhance prompt with specific details (file paths, context, success criteria) -- Execute delegation via `ccs glm -p "$ENHANCED_PROMPT"` - -**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. - -**Usage:** -``` -/ccs:glm "refactor auth.js to use async/await" -/ccs:glm "add tests for UserService" -/ccs:glm "/cook create a landing page" -``` diff --git a/.claude/commands/ccs/glm/continue.md b/.claude/commands/ccs/glm/continue.md deleted file mode 100644 index 666fdd50..00000000 --- a/.claude/commands/ccs/glm/continue.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -description: Continue last GLM delegation session [AUTO ENHANCE] -argument-hint: [follow-up instruction] ---- - -Continue last GLM delegation session for iterative refinement. - -**Workflow:** -- Review what was accomplished in previous session -- Analyze the follow-up instruction in `$ARGUMENTS` -- Enhance prompt with context (reference files, incomplete tasks, next steps) -- Execute continuation via `ccs glm:continue -p "$ENHANCED_PROMPT"` - -**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. - -**Usage:** -``` -/ccs:glm "fix typo in README" -/ccs:glm:continue "also update the examples section" -/ccs:glm:continue "/commit with descriptive message" -``` diff --git a/.claude/commands/ccs/kimi.md b/.claude/commands/ccs/kimi.md deleted file mode 100644 index e1d24bb7..00000000 --- a/.claude/commands/ccs/kimi.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -description: Delegate task to Kimi (long-context model) [AUTO ENHANCE] -argument-hint: [task description] ---- - -Delegate long-context, multi-file tasks to Kimi for comprehensive analysis. - -**Workflow:** -- Analyze the task description in `$ARGUMENTS` -- Gather context across multiple files/directories -- Enhance prompt with comprehensive details (structure, relationships, scope) -- Execute delegation via `ccs kimi -p "$ENHANCED_PROMPT"` - -**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. - -**Usage:** -``` -/ccs:kimi "analyze all files in src/ and document architecture" -/ccs:kimi "find all deprecated API usages across codebase" -/ccs:kimi "/plan for authentication system" -``` diff --git a/.claude/commands/ccs/kimi/continue.md b/.claude/commands/ccs/kimi/continue.md deleted file mode 100644 index 21ed85c1..00000000 --- a/.claude/commands/ccs/kimi/continue.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -description: Continue last Kimi delegation session [AUTO ENHANCE] -argument-hint: [follow-up instruction] ---- - -Continue last Kimi delegation session for multi-turn analysis. - -**Workflow:** -- Review analysis/work from previous session -- Analyze the follow-up instruction in `$ARGUMENTS` -- Enhance prompt with comprehensive context (findings, scope, deliverables, priority) -- Execute continuation via `ccs kimi:continue -p "$ENHANCED_PROMPT"` - -**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. - -**Usage:** -``` -/ccs:kimi "analyze all files in src/" -/ccs:kimi:continue "suggest architectural improvements" -/ccs:kimi:continue "/plan for refactoring with phases" -``` diff --git a/.claude/skills/ccs-delegation/CLAUDE.md.template b/.claude/skills/ccs-delegation/CLAUDE.md.template index 740ad39b..af9c020e 100644 --- a/.claude/skills/ccs-delegation/CLAUDE.md.template +++ b/.claude/skills/ccs-delegation/CLAUDE.md.template @@ -2,6 +2,16 @@ Activate `ccs-delegation` skill for automatic delegation of eligible tasks. +**Commands:** +- `/ccs "task"` - Auto-select best profile (glm/kimi/custom) +- `/ccs:continue "follow-up"` - Continue last session +- `/ccs --glm "task"` - Force specific profile + **Auto-delegates:** typo fixes, test additions, refactoring, JSDoc, docs updates **Override:** Say "don't delegate" to bypass automation -**Commands:** `/ccs:glm "task"` or `/ccs:kimi "task"` for explicit delegation + +**Examples:** +- "use ccs to fix typos in README" → Auto-selects glm +- "use ccs to analyze architecture" → Auto-selects kimi +- "use ccs --glm to add tests" → Forces glm +- "use ccs:continue to commit" → Continues last session diff --git a/.claude/skills/ccs-delegation/SKILL.md b/.claude/skills/ccs-delegation/SKILL.md index 819c2d76..89462939 100644 --- a/.claude/skills/ccs-delegation/SKILL.md +++ b/.claude/skills/ccs-delegation/SKILL.md @@ -1,7 +1,7 @@ --- name: ccs-delegation -description: AUTO-ACTIVATE for delegation-eligible tasks. Triggers on patterns like "fix typos", "add tests", "refactor to use", "add JSDoc", "analyze architecture". Also activates when user says "use ccs glm/kimi". Handles task validation, prompt enhancement, and execution via CCS CLI headless mode. -version: 2.6.0 +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. Trigger: "use ccs [task]" patterns, typo/test/refactor keywords. Excludes: complex architecture, security-critical code, performance optimization, breaking changes. +version: 3.0.0 --- # CCS Delegation @@ -10,50 +10,94 @@ Delegate deterministic tasks to cost-optimized models via CCS CLI. ## Core Concept -Execute tasks via alternative models using `ccs {profile} -p "task"` equivalent to `claude --settings ~/.ccs/{profile}.settings -p "task"` +Execute tasks via alternative models using: +- **Initial delegation**: `ccs {profile} -p "task"` +- **Session continuation**: `ccs {profile}:continue -p "follow-up"` -**Profiles:** GLM (cost-optimized), Kimi (long-context) +**Profile Selection:** +- Auto-select from `~/.ccs/config.json` via task analysis +- Profiles: glm (cost-optimized), kimi (long-context/reasoning), custom profiles +- Override: `--{profile}` flag forces specific profile ## User Invocation Patterns Users trigger delegation naturally: -- "use ccs glm [task]" - Delegate to GLM (cost-optimized) -- "use ccs kimi [task]" - Delegate to Kimi (long-context) -- "use ccs glm:continue [task]" - Continue GLM session -- "use ccs kimi:continue [task]" - Continue Kimi session +- "use ccs [task]" - Auto-select best profile +- "use ccs --glm [task]" - Force GLM profile +- "use ccs --kimi [task]" - Force Kimi profile +- "use ccs:continue [task]" - Continue last session **Examples:** -- "use ccs glm to fix typos in README.md" -- "use ccs kimi to analyze the entire architecture" -- "use ccs glm:continue to add unit tests" +- "use ccs to fix typos in README.md" +- "use ccs to analyze the entire architecture" +- "use ccs --glm to add unit tests" +- "use ccs:continue to commit the changes" ## Agent Response Protocol -When user says "use ccs {profile} [task]": +**For `/ccs [task]`:** -1. **Validate eligibility** against Decision Framework - - Check: Simple, mechanical, <5 files - - Check: No design decisions required - - Check: Clear acceptance criteria exists +1. **Parse override flag** + - Scan task for pattern: `--(\w+)` + - If match: `profile = match[1]`, remove flag from task, skip to step 5 + - If no match: continue to step 2 -2. **Enhance prompt** with context: - - Add file paths if mentioned - - Include working directory - - Specify success criteria - - Add relevant constraints +2. **Discover profiles** + - Read `~/.ccs/config.json` using Read tool + - Extract `Object.keys(config.profiles)` → `availableProfiles[]` + - If file missing → Error: "CCS not configured. Run: ccs doctor" + - If empty → Error: "No profiles in config.json" -3. **Execute via Bash tool**: - ```bash - ccs {profile} -p "enhanced prompt" - ``` +3. **Analyze task requirements** + - Scan task for keywords: + - `/(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 = true` -4. **Report results** to user: - - Cost (USD) - - Duration (seconds) - - Session ID (for continuation) - - Exit code/status +4. **Select profile** + - For each profile in `availableProfiles`: classify by name pattern (see Profile Characteristic Inference table) + - If `needsReasoning`: filter profiles where `reasoning=true` → prefer kimi + - Else if `needsLongContext`: filter profiles where `context=long` → prefer kimi + - Else: filter profiles where `cost=low` → prefer glm + - `selectedProfile = filteredProfiles[0]` + - If `filteredProfiles.length === 0`: fallback to `glm` if exists, else first available + - If no profiles: Error -**If ineligible:** Explain why and handle in main session. +5. **Enhance prompt** + - If task mentions files: gather context using Read tool + - Add: file paths, current implementation, expected behavior, success criteria + - Preserve slash commands at task start (e.g., `/cook`, `/commit`) + +6. **Execute delegation** + - Run: `ccs {selectedProfile} -p "$enhancedPrompt"` via Bash tool + +7. **Report results** + - Log: "Selected {profile} (reason: {reasoning/long-context/cost-optimized})" + - Report: Cost (USD), Duration (sec), Session ID, Exit code + +**For `/ccs:continue [follow-up]`:** + +1. **Detect profile** + - Read `~/.ccs/delegation-sessions.json` using Read tool + - Find most recent session (latest timestamp) + - Extract profile name from session data + - If no sessions → Error: "No previous delegation. Use /ccs first" + +2. **Parse override flag** + - Scan follow-up for pattern: `--(\w+)` + - If match: `profile = match[1]`, remove flag from follow-up, log profile switch + - If no match: use detected profile from step 1 + +3. **Enhance prompt** + - Review previous work (check what was accomplished) + - Add: previous context, incomplete tasks, validation criteria + - Preserve slash commands at start + +4. **Execute continuation** + - Run: `ccs {profile}:continue -p "$enhancedPrompt"` via Bash tool + +5. **Report results** + - Report: Profile, Session #, Incremental cost, Total cost, Duration, Exit code ## Decision Framework @@ -69,18 +113,58 @@ When user says "use ccs {profile} [task]": - Performance optimization - Breaking changes/migrations -## Profile Selection +## Profile Selection Logic -- **GLM**: Simple tasks (<5 files, clear scope, cost-optimized) -- **Kimi**: Long-context (multi-file analysis, architecture docs) +**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**: +- Parse task for `/--(\w+)/`. If match: `profile = match[1]`, remove from task, skip selection ## Example Delegation Tasks **Good candidates:** -- "add unit tests for UserService using Jest" -- "fix typos in README.md" -- "refactor parseConfig to use destructuring" -- "add JSDoc comments to auth.js" +- "/ccs add unit tests for UserService using Jest" + → Auto-selects: glm (simple task) +- "/ccs analyze entire architecture in src/" + → Auto-selects: kimi (long-context) +- "/ccs think about the best database schema design" + → Auto-selects: kimi (reasoning) +- "/ccs --glm refactor parseConfig to use destructuring" + → Forces: glm (override) **Bad candidates (keep in main):** - "implement OAuth" (too complex, needs design) @@ -89,9 +173,15 @@ When user says "use ccs {profile} [task]": ## Execution -Slash commands: `/ccs:glm "task"` or `/ccs:glm:continue "follow-up"` +**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 switch -Agent via Bash: `ccs glm -p "task"` or `ccs glm:continue -p "follow-up"` +**Agent via Bash:** +- Auto: `ccs {auto-selected} -p "task"` +- Continue: `ccs {detected}:continue -p "follow-up"` ## References diff --git a/.claude/skills/ccs-delegation/references/troubleshooting.md b/.claude/skills/ccs-delegation/references/troubleshooting.md index f55719a6..9b77ead4 100644 --- a/.claude/skills/ccs-delegation/references/troubleshooting.md +++ b/.claude/skills/ccs-delegation/references/troubleshooting.md @@ -195,11 +195,6 @@ jq '.glm.turns' ~/.ccs/delegation-sessions.json rm ~/.ccs/delegation-sessions.json # Fresh start (loses all sessions) ``` -**Bypass delegation (use CLI directly):** -```bash -claude -p "task" --settings ~/.ccs/{profile}.settings.json -``` - **Interactive mode (no -p flag):** ```bash ccs {profile} # Opens interactive session diff --git a/CHANGELOG.md b/CHANGELOG.md index 467b47af..1ad83536 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,36 @@ Format: [Keep a Changelog](https://keepachangelog.com/) +## [4.3.3] - 2025-11-21 + +### ⚠️ BREAKING CHANGES + +- **CCS Delegation Commands Consolidated**: Replaced 4 hardcoded commands with 2 intelligent commands + - Old: `/ccs:glm`, `/ccs:kimi`, `/ccs:glm:continue`, `/ccs:kimi:continue` + - New: `/ccs` (auto-selects profile), `/ccs:continue` (auto-detects profile) + - Override with flags: `/ccs --glm "task"`, `/ccs --kimi "task"` + +### Changed +- Updated `--help` text across Node.js, Bash, and PowerShell implementations +- Updated delegation examples in README.md and workflow documentation +- Fixed CCS Doctor health checks to validate new command files +- Updated user configuration templates with new command syntax + +### Added +- Intelligent profile selection based on task analysis (reasoning, long-context, cost-optimized) +- Support for custom profiles without creating new commands +- Enhanced session management with automatic profile detection + +### Migration +| Old Command | New Command | +|-------------|-------------| +| `/ccs:glm "task"` | `/ccs "task"` (or `/ccs --glm "task"`) | +| `/ccs:kimi "task"` | `/ccs "task"` (or `/ccs --kimi "task"`) | +| `/ccs:glm:continue` | `/ccs:continue` | +| `/ccs:kimi:continue` | `/ccs:continue` | + +--- + ## [4.1.5] - 2025-11-17 ### Added diff --git a/README.md b/README.md index 4a58bc6a..0d44dfd8 100644 --- a/README.md +++ b/README.md @@ -322,7 +322,7 @@ graph LR ```plaintext ~/.ccs/ ├── .claude/ # CCS items (ships with package, v4.1) -│ ├── commands/ccs/ # Delegation commands (/ccs:glm, /ccs:kimi) +│ ├── commands/ccs/ # Delegation commands (/ccs, /ccs:continue) │ ├── skills/ccs-delegation/ # AI decision framework │ └── agents/ccs-delegator.md # Proactive delegation agent ├── shared/ # Symlinks to ~/.claude/ (for profiles) @@ -401,7 +401,7 @@ ccs --help # Show all commands and options ### What is Delegation? -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`). +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`). **Why use it?** - **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" **Via Slash Commands** (inside Claude sessions): ```bash # In your main Claude session: -/ccs:glm "refactor auth.js to use async/await" -/ccs:kimi "find all deprecated API usages across codebase" -/ccs:glm:continue "also update the README examples" +/ccs "refactor auth.js to use async/await" # Auto-selects best profile +/ccs --glm "fix typo in documentation" # Forces GLM profile +/ccs --kimi "analyze entire architecture" # Forces Kimi profile +/ccs:continue "also update the README examples" # Continues last session ``` **Via Natural Language** (Claude auto-delegates): diff --git a/VERSION b/VERSION index cc2fbe89..e91d9be2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.3.2 +4.3.3 diff --git a/bin/ccs.js b/bin/ccs.js index 05673384..b9b2be75 100755 --- a/bin/ccs.js +++ b/bin/ccs.js @@ -172,8 +172,10 @@ function handleHelpCommand() { // Delegation (inside Claude Code CLI) console.log(colored('Delegation (inside Claude Code CLI):', 'cyan')); - console.log(` ${colored('/ccs:glm "task"', 'yellow')} Delegate to GLM-4.6 for simple tasks`); - console.log(` ${colored('/ccs:kimi "task"', 'yellow')} Delegate to Kimi for long context`); + console.log(` ${colored('/ccs "task"', 'yellow')} Delegate task (auto-selects best profile)`); + console.log(` ${colored('/ccs --glm "task"', 'yellow')} Force GLM-4.6 for simple tasks`); + console.log(` ${colored('/ccs --kimi "task"', 'yellow')} Force Kimi for long context`); + console.log(` ${colored('/ccs:continue "follow-up"', 'yellow')} Continue last delegation session`); console.log(' Save tokens by delegating simple tasks to cost-optimized models'); console.log(''); diff --git a/bin/delegation/README.md b/bin/delegation/README.md index c3051204..0f32af90 100644 --- a/bin/delegation/README.md +++ b/bin/delegation/README.md @@ -25,7 +25,7 @@ Enhanced Claude Code delegation system for multi-model task delegation. ### Session Management - Persistence: `~/.ccs/delegation-sessions.json` -- Resume via `/ccs:glm:continue` and `/ccs:kimi:continue` +- Resume via `/ccs:continue` (auto-detects profile) - Auto-cleanup expired sessions (>30 days) - Cost aggregation across turns @@ -91,12 +91,13 @@ Automatically applied as CLI flags: The delegation system is invoked via simple slash commands in `.claude/commands/ccs/`: ### Basic Commands -- `/ccs:glm "task"` - Delegate to GLM-4.6 -- `/ccs:kimi "task"` - Delegate to Kimi (long-context) +- `/ccs "task"` - Delegate task (auto-selects best profile) +- `/ccs --glm "task"` - Force GLM-4.6 delegation +- `/ccs --kimi "task"` - Force Kimi delegation (long-context) -### Multi-Turn Commands -- `/ccs:glm:continue "follow-up"` - Resume last GLM session -- `/ccs:kimi:continue "follow-up"` - Resume last Kimi session +### Session Continuation +- `/ccs:continue "follow-up"` - Resume last delegation session (auto-detect profile) +- `/ccs:continue --glm "follow-up"` - Resume with specific profile switch Each command directly invokes: ```bash @@ -143,7 +144,8 @@ node tests/unit/delegation/result-formatter.test.js ## Architecture ``` -User → SlashCommand (/ccs:glm) +User → SlashCommand (/ccs) + → ccs-delegation skill (auto-selects profile) → Directly invokes: claude -p → HeadlessExecutor (monitors execution) → SessionManager (load last session) diff --git a/bin/management/doctor.js b/bin/management/doctor.js index e0f7f846..2e5c662b 100644 --- a/bin/management/doctor.js +++ b/bin/management/doctor.js @@ -364,12 +364,12 @@ class Doctor { checkDelegation() { const spinner = ora('Checking delegation').start(); - // Check if delegation commands exist in ~/.ccs/.claude/commands/ccs/ - const ccsClaudeCommandsDir = path.join(this.ccsDir, '.claude', 'commands', 'ccs'); - const hasGlmCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'glm.md')); - const hasKimiCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'kimi.md')); + // Check if delegation commands exist in ~/.ccs/.claude/commands/ + const ccsClaudeCommandsDir = path.join(this.ccsDir, '.claude', 'commands'); + const hasCcsCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'ccs.md')); + const hasContinueCommand = fs.existsSync(path.join(ccsClaudeCommandsDir, 'ccs', 'continue.md')); - if (!hasGlmCommand || !hasKimiCommand) { + if (!hasCcsCommand || !hasContinueCommand) { spinner.warn(` ${'Delegation'.padEnd(26)}${colored('[!]', 'yellow')} Not installed`); this.results.addCheck( 'Delegation', diff --git a/docs/codebase-summary.md b/docs/codebase-summary.md index fc66bed9..975c43fc 100644 --- a/docs/codebase-summary.md +++ b/docs/codebase-summary.md @@ -173,10 +173,8 @@ ccs work "task" ``` .claude/ ├── commands/ccs/ # Delegation slash commands -│ ├── glm.md # /ccs:glm "task" -│ ├── kimi.md # /ccs:kimi "task" -│ ├── glm/continue.md # /ccs:glm:continue "task" -│ └── kimi/continue.md# /ccs:kimi:continue "task" +│ ├── ccs.md # /ccs "task" (auto-select profile) +│ └── ccs/continue.md # /ccs:continue "follow-up" (auto-detect profile) ├── skills/ccs-delegation/ # Auto-delegation skill │ ├── SKILL.md # Skill definition │ ├── CLAUDE.md.template # User CLAUDE.md snippet @@ -194,7 +192,7 @@ ccs work "task" 1. `npm install -g @kaitranntt/ccs` 2. Postinstall: ClaudeDirInstaller copies `.claude/` → `~/.ccs/.claude/` 3. Postinstall: ClaudeSymlinkManager creates selective symlinks → `~/.claude/` -4. User can now use `/ccs:glm` and `/ccs:kimi` commands +4. User can now use `/ccs` (auto-select) and `/ccs:continue` commands ## File Structure (v4.3.2) diff --git a/docs/headless-workflow.md b/docs/headless-workflow.md index 67c7f769..5ce7893b 100644 --- a/docs/headless-workflow.md +++ b/docs/headless-workflow.md @@ -23,10 +23,10 @@ claude -p "prompt" --settings ~/.ccs/{profile}.settings.json --output-format str ## How It Works **Workflow:** -1. User: `/ccs:glm "task"` in Claude Code session +1. User: `/ccs "task"` in Claude Code session (auto-selects profile) 2. CCS detects `-p` flag and routes to HeadlessExecutor -3. HeadlessExecutor spawns: `claude -p "task" --settings ~/.ccs/glm.settings.json --output-format stream-json --permission-mode acceptEdits` -4. Claude Code runs headless with GLM profile + enhanced flags +3. HeadlessExecutor spawns: `claude -p "task" --settings ~/.ccs/[selected].settings.json --output-format stream-json --permission-mode acceptEdits` +4. Claude Code runs headless with selected profile + enhanced flags 5. Returns stream-JSON with session_id, cost, turns 6. Real-time tool use visibility in TTY 7. ResultFormatter displays formatted results with metadata @@ -116,8 +116,9 @@ ccs glm:continue -p "run tests" Via slash commands: ``` -/ccs:glm "implement feature" -/ccs:glm:continue "add tests" +/ccs "implement feature" # Auto-selects best profile +/ccs --glm "implement feature" # Forces GLM profile +/ccs:continue "add tests" # Continue last session ``` **Session Storage:** `~/.ccs/delegation-sessions.json` diff --git a/installers/install.ps1 b/installers/install.ps1 index e8965c11..17d8a28a 100644 --- a/installers/install.ps1 +++ b/installers/install.ps1 @@ -31,7 +31,7 @@ $InstallMethod = if ($ScriptDir -and ((Test-Path "$ScriptDir\lib\ccs.ps1") -or ( # IMPORTANT: Update this version when releasing new versions! # This hardcoded version is used for standalone installations (irm | iex) # For git installations, VERSION file is read if available -$CcsVersion = "4.3.2" +$CcsVersion = "4.3.3" # Try to read VERSION file for git installations if ($ScriptDir) { diff --git a/installers/install.sh b/installers/install.sh index 77e8e299..e52c02c4 100755 --- a/installers/install.sh +++ b/installers/install.sh @@ -32,7 +32,7 @@ fi # IMPORTANT: Update this version when releasing new versions! # This hardcoded version is used for standalone installations (curl | bash) # For git installations, VERSION file is read if available -CCS_VERSION="4.3.2" +CCS_VERSION="4.3.3" # Try to read VERSION file for git installations if [[ -f "$SCRIPT_DIR/VERSION" ]]; then diff --git a/lib/ccs b/lib/ccs index 0605674f..e470974e 100755 --- a/lib/ccs +++ b/lib/ccs @@ -2,7 +2,7 @@ set -euo pipefail # Version (updated by scripts/bump-version.sh) -CCS_VERSION="4.3.2" +CCS_VERSION="4.3.3" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}" readonly PROFILES_JSON="$HOME/.ccs/profiles.json" @@ -191,8 +191,10 @@ show_help() { echo "" echo -e "${CYAN}Delegation (inside Claude Code CLI):${RESET}" - echo -e " ${YELLOW}/ccs:glm \"task\"${RESET} Delegate to GLM-4.6 for simple tasks" - echo -e " ${YELLOW}/ccs:kimi \"task\"${RESET} Delegate to Kimi for long context" + echo -e " ${YELLOW}/ccs \"task\"${RESET} Delegate task (auto-selects best profile)" + echo -e " ${YELLOW}/ccs --glm \"task\"${RESET} Force GLM-4.6 for simple tasks" + echo -e " ${YELLOW}/ccs --kimi \"task\"${RESET} Force Kimi for long context" + echo -e " ${YELLOW}/ccs:continue \"follow-up\"${RESET} Continue last delegation session" echo -e " Save tokens by delegating simple tasks to cost-optimized models" echo "" diff --git a/lib/ccs.ps1 b/lib/ccs.ps1 index 3a6ba142..e6e42dbb 100644 --- a/lib/ccs.ps1 +++ b/lib/ccs.ps1 @@ -12,7 +12,7 @@ param( $ErrorActionPreference = "Stop" # Version (updated by scripts/bump-version.sh) -$CcsVersion = "4.3.2" +$CcsVersion = "4.3.3" $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path $ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" } $ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json" @@ -238,8 +238,10 @@ function Show-Help { Write-Host "" Write-ColorLine "Delegation (inside Claude Code CLI):" "Cyan" - Write-ColorLine " /ccs:glm `"task`" Delegate to GLM-4.6 for simple tasks" "Yellow" - Write-ColorLine " /ccs:kimi `"task`" Delegate to Kimi for long context" "Yellow" + Write-ColorLine " /ccs `"task`" Delegate task (auto-selects best profile)" "Yellow" + Write-ColorLine " /ccs --glm `"task`" Force GLM-4.6 for simple tasks" "Yellow" + Write-ColorLine " /ccs --kimi `"task`" Force Kimi for long context" "Yellow" + Write-ColorLine " /ccs:continue `"follow-up`" Continue last delegation session" "Yellow" Write-Host " Save tokens by delegating simple tasks to cost-optimized models" Write-Host "" diff --git a/package.json b/package.json index aad12445..b3a2b7b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kaitranntt/ccs", - "version": "4.3.2", + "version": "4.3.3", "description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6", "keywords": [ "cli",