Skip to content

Commit 545679e

Browse files
author
catlog22
committed
Refactor execution modes and CLI integration across agents
- Updated code-developer, tdd-developer, and test-fix-agent to streamline execution modes based on task.meta.execution_config.method. - Removed legacy command handling and introduced CLI handoff for 'cli' execution method. - Enhanced buildCliHandoffPrompt to include task JSON path and improved context handling. - Updated task-generate-agent and task-generate-tdd to reflect new execution method mappings and removed command field from implementation_approach. - Improved CLI settings validation in CliSettingsModal with format and length checks. - Added localization for new CLI settings messages in English and Chinese. - Enhanced GPU selector to use localized strings for GPU types. - Introduced TypeScript LSP setup documentation for better user guidance.
1 parent 2305e7b commit 545679e

18 files changed

Lines changed: 192 additions & 405 deletions

File tree

.claude/.workflow-enhancements/test-enrichment-integration.md

Lines changed: 0 additions & 216 deletions
This file was deleted.

.claude/agents/action-planning-agent.md

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ function computeCliStrategy(task, allTasks) {
288288
"execution_group": "parallel-abc123|null",
289289
"module": "frontend|backend|shared|null",
290290
"execution_config": {
291-
"method": "agent|hybrid|cli",
292-
"cli_tool": "codex|gemini|qwen|auto",
291+
"method": "agent|cli",
292+
"cli_tool": "codex|gemini|qwen|auto|null",
293293
"enable_resume": true,
294294
"previous_cli_id": "string|null"
295295
}
@@ -303,7 +303,7 @@ function computeCliStrategy(task, allTasks) {
303303
- `execution_group`: Parallelization group ID (tasks with same ID can run concurrently) or `null` for sequential tasks
304304
- `module`: Module identifier for multi-module projects (e.g., `frontend`, `backend`, `shared`) or `null` for single-module
305305
- `execution_config`: CLI execution settings (MUST align with userConfig from task-generate-agent)
306-
- `method`: Execution method - `agent` (direct), `hybrid` (agent + CLI), `cli` (CLI only)
306+
- `method`: Execution method - `agent` (direct) or `cli` (CLI only). Only two values in final task JSON.
307307
- `cli_tool`: Preferred CLI tool - `codex`, `gemini`, `qwen`, `auto`, or `null` (for agent-only)
308308
- `enable_resume`: Whether to use `--resume` for CLI continuity (default: true)
309309
- `previous_cli_id`: Previous task's CLI execution ID for resume (populated at runtime)
@@ -318,14 +318,16 @@ userConfig.executionMethod → meta.execution_config
318318

319319
"cli"
320320
meta.execution_config = { method: "cli", cli_tool: userConfig.preferredCliTool, enable_resume: true }
321-
Execution: Agent executes pre_analysis, then hands off context + implementation_approach to CLI
321+
Execution: Agent executes pre_analysis, then hands off full context to CLI via buildCliHandoffPrompt()
322322

323323
"hybrid"
324-
meta.execution_config = { method: "hybrid", cli_tool: userConfig.preferredCliTool, enable_resume: true }
325-
Execution: Agent decides which tasks to handoff to CLI based on complexity
324+
Per-task decision: set method to "agent" OR "cli" per task based on complexity
325+
- Simple tasks (≤3 files, straightforward logic) → { method: "agent", cli_tool: null, enable_resume: false }
326+
- Complex tasks (>3 files, complex logic, refactoring) → { method: "cli", cli_tool: userConfig.preferredCliTool, enable_resume: true }
327+
Final task JSON always has method = "agent" or "cli", never "hybrid"
326328
```
327329
328-
**Note**: implementation_approach steps NO LONGER contain `command` fields. CLI execution is controlled by task-level `meta.execution_config` only.
330+
**IMPORTANT**: implementation_approach steps do NOT contain `command` fields. Execution routing is controlled by task-level `meta.execution_config.method` only.
329331
330332
**Test Task Extensions** (for type="test-gen" or type="test-fix"):
331333
@@ -344,7 +346,7 @@ userConfig.executionMethod → meta.execution_config
344346
- `test_framework`: Existing test framework from project (required for test tasks)
345347
- `coverage_target`: Target code coverage percentage (optional)
346348
347-
**Note**: CLI tool usage for test-fix tasks is now controlled via `flow_control.implementation_approach` steps with `command` fields, not via `meta.use_codex`.
349+
**Note**: CLI tool usage for test-fix tasks is now controlled via task-level `meta.execution_config.method`, not via `meta.use_codex`.
348350
349351
#### Context Object
350352
@@ -555,59 +557,45 @@ The examples above demonstrate **patterns**, not fixed requirements. Agent MUST:
555557

556558
##### Implementation Approach
557559

558-
**Execution Modes**:
560+
**Execution Control**:
559561

560-
The `implementation_approach` supports **two execution modes** based on the presence of the `command` field:
562+
The `implementation_approach` defines sequential implementation steps. Execution routing is controlled by **task-level `meta.execution_config.method`**, NOT by step-level `command` fields.
561563

562-
1. **Default Mode (Agent Execution)** - `command` field **omitted**:
564+
**Two Execution Modes**:
565+
566+
1. **Agent Mode** (`meta.execution_config.method = "agent"`):
563567
- Agent interprets `modification_points` and `logic_flow` autonomously
564568
- Direct agent execution with full context awareness
565569
- No external tool overhead
566570
- **Use for**: Standard implementation tasks where agent capability is sufficient
567-
- **Required fields**: `step`, `title`, `description`, `modification_points`, `logic_flow`, `depends_on`, `output`
568-
569-
2. **CLI Mode (Command Execution)** - `command` field **included**:
570-
- Specified command executes the step directly
571-
- Leverages specialized CLI tools (codex/gemini/qwen) for complex reasoning
572-
- **Use for**: Large-scale features, complex refactoring, or when user explicitly requests CLI tool usage
573-
- **Required fields**: Same as default mode **PLUS** `command`, `resume_from` (optional)
574-
- **Command patterns** (with resume support):
575-
- `ccw cli -p '[prompt]' --tool codex --mode write --cd [path]`
576-
- `ccw cli -p '[prompt]' --resume ${previousCliId} --tool codex --mode write` (resume from previous)
577-
- `ccw cli -p '[prompt]' --tool gemini --mode write --cd [path]` (write mode)
578-
- **Resume mechanism**: When step depends on previous CLI execution, include `--resume` with previous execution ID
579-
580-
**Semantic CLI Tool Selection**:
581-
582-
Agent determines CLI tool usage per-step based on user semantics and task nature.
583571

584-
**Source**: Scan `metadata.task_description` from context-package.json for CLI tool preferences.
572+
2. **CLI Mode** (`meta.execution_config.method = "cli"`):
573+
- Agent executes `pre_analysis`, then hands off full context to CLI via `buildCliHandoffPrompt()`
574+
- CLI tool specified in `meta.execution_config.cli_tool` (codex/gemini/qwen)
575+
- Leverages specialized CLI tools for complex reasoning
576+
- **Use for**: Large-scale features, complex refactoring, or when userConfig.executionMethod = "cli"
585577

586-
**User Semantic Triggers** (patterns to detect in task_description):
587-
- "use Codex/codex" → Add `command` field with Codex CLI
588-
- "use Gemini/gemini" → Add `command` field with Gemini CLI
589-
- "use Qwen/qwen" → Add `command` field with Qwen CLI
590-
- "CLI execution" / "automated" → Infer appropriate CLI tool
591-
592-
**Task-Based Selection** (when no explicit user preference):
593-
- **Implementation/coding**: Codex preferred for autonomous development
594-
- **Analysis/exploration**: Gemini preferred for large context analysis
595-
- **Documentation**: Gemini/Qwen with write mode (`--mode write`)
596-
- **Testing**: Depends on complexity - simple=agent, complex=Codex
578+
**Step Schema** (same for both modes):
579+
```json
580+
{
581+
"step": 1,
582+
"title": "Step title",
583+
"description": "What to implement (may use [variable] placeholders from pre_analysis)",
584+
"modification_points": ["Quantified changes: [list with counts]"],
585+
"logic_flow": ["Implementation sequence"],
586+
"depends_on": [0],
587+
"output": "variable_name"
588+
}
589+
```
597590
598-
**Default Behavior**: Agent always executes the workflow. CLI commands are embedded in `implementation_approach` steps:
599-
- Agent orchestrates task execution
600-
- When step has `command` field, agent executes it via CCW CLI
601-
- When step has no `command` field, agent implements directly
602-
- This maintains agent control while leveraging CLI tool power
591+
**Required fields**: `step`, `title`, `description`, `modification_points`, `logic_flow`, `depends_on`, `output`
603592
604-
**Key Principle**: The `command` field is **optional**. Agent decides based on user semantics and task complexity.
593+
**IMPORTANT**: Do NOT add `command` field to implementation_approach steps. Execution routing is determined by task-level `meta.execution_config.method` only.
605594
606-
**Examples**:
595+
**Example**:
607596
608597
```json
609598
[
610-
// === DEFAULT MODE: Agent Execution (no command field) ===
611599
{
612600
"step": 1,
613601
"title": "Load and analyze role analyses",
@@ -644,8 +632,7 @@ Agent determines CLI tool usage per-step based on user semantics and task nature
644632
],
645633
"depends_on": [1],
646634
"output": "implementation"
647-
},
648-
635+
}
649636
]
650637
```
651638

0 commit comments

Comments
 (0)