Compare commits

..

7 Commits

Author SHA1 Message Date
catlog22
fe0d30256c feat(lite-plan): enhance execution context continuity for multi-call scenarios
Improvements:
1. Add plan summary in confirmation question for quick review
2. Add previousExecutionResults tracking for multi-execution flows
3. Include execution result collection mechanism after each call
4. Update both Agent and Codex execution prompts with context continuity

Benefits:
- Subsequent executions can see what previous calls completed
- Avoid duplicate work across multiple execution calls
- Better dependency management and task flow
- Clear context propagation: executionId, status, tasks, outputs, notes
2025-11-16 23:10:18 +08:00
catlog22
1c416b538d refactor(lite-plan): separate plan display from user confirmation in Phase 4
Change Phase 4 confirmation flow from single-step to two-step process:
- Step 4.1: Display complete plan as readable text output
- Step 4.2: Collect three-dimensional input via AskUserQuestion

Benefits:
- Clearer plan presentation (not embedded in question)
- Simpler question interface focused on user decisions
- Better user experience with logical separation
2025-11-16 22:56:48 +08:00
catlog22
81362c14de refactor(lite-plan): enhance execution call tracking and user interaction clarity 2025-11-16 21:52:09 +08:00
catlog22
fa6257ecae refactor(lite-plan): streamline planning execution guidelines and enhance user confirmation process 2025-11-16 21:35:47 +08:00
catlog22
ccb4490ed4 refactor(cli-tools): remove redundant model parameters for improved command clarity 2025-11-16 21:11:16 +08:00
catlog22
58206f1996 refactor(lite-plan): update execution method options for clarity and complexity-based selection 2025-11-16 21:03:16 +08:00
catlog22
564bcb72ea refactor(lite-plan): simplify command format for Codex and Qwen by removing redundant parameters 2025-11-16 20:58:25 +08:00
9 changed files with 281 additions and 395 deletions

View File

@@ -162,15 +162,15 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
**Gemini/Qwen (Write)**:
```bash
cd {dir} && gemini -p "..." -m gemini-2.5-flash --approval-mode yolo
cd {dir} && gemini -p "..." --approval-mode yolo
```
**Codex (Auto)**:
```bash
codex -C {dir} --full-auto exec "..." -m gpt-5 --skip-git-repo-check -s danger-full-access
codex -C {dir} --full-auto exec "..." --skip-git-repo-check -s danger-full-access
# Resume: Add 'resume --last' after prompt
codex --full-auto exec "..." resume --last -m gpt-5 --skip-git-repo-check -s danger-full-access
codex --full-auto exec "..." resume --last --skip-git-repo-check -s danger-full-access
```
**Cross-Directory** (Gemini/Qwen):

View File

@@ -136,7 +136,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/{template}) |
- Consider previous iteration failures
- Validate fix doesn't introduce new vulnerabilities
- analysis=READ-ONLY
" -m {model} {timeout_flag}
" {timeout_flag}
```
**Layer-Specific Guidance Injection**:

View File

@@ -21,10 +21,10 @@ Intelligent lightweight planning and execution command with dynamic workflow ada
- **Adaptive Planning**:
- Simple tasks: Direct planning by current Claude
- Complex tasks: Delegates to cli-planning-agent for detailed breakdown
- **Three-Dimensional Confirmation**: Multi-select interaction for task approval + execution method selection + code review tool selection
- **Direct Execution**: Immediate dispatch to selected execution method (agent or CLI)
- **Live Progress Tracking**: Real-time TodoWrite updates during execution
- **Optional Code Review**: Post-execution quality analysis with claude/gemini/qwen/codex (user selectable)
- **Two-Step Confirmation**: First display complete plan as text, then collect three-dimensional input (task approval + execution method + code review tool)
- **Direct Execution**: Immediate dispatch to selected execution method (agent/codex/auto)
- **Live Progress Tracking**: Real-time TodoWrite updates at execution call level ([Agent-1], [Codex-1], etc.) during execution
- **Optional Code Review**: Post-execution quality analysis with gemini/agent or custom tools via "Other" option (e.g., qwen, codex)
## Usage
@@ -34,7 +34,6 @@ Intelligent lightweight planning and execution command with dynamic workflow ada
/workflow:lite-plan [FLAGS] <TASK_DESCRIPTION>
# Flags
--tool <tool-name> Preset CLI tool (claude|gemini|qwen|codex); if not provided, user selects during confirmation
-e, --explore Force code exploration phase (overrides auto-detection logic)
# Arguments
@@ -73,20 +72,20 @@ User Input ("/workflow:lite-plan \"task\"")
|
v
[Phase 4] Task Confirmation & Execution Selection (User interaction)
-> Display task breakdown and approach
-> AskUserQuestion: Three dimensions (all multi-select)
1. Confirm task: Allow/Modify/Cancel (can supplement via Other)
2. Execution method: Agent/Provide Plan/CLI (input CLI tool in Other)
3. Code review: No/Claude/Gemini/Qwen/Codex
-> Step 4.1: Output complete plan as text to user
-> Step 4.2: AskUserQuestion with three dimensions
1. Confirm task: Allow/Modify/Cancel (multi-select, can supplement via Other)
2. Execution method: Agent/Codex/Auto (single-select, auto: simple→agent, complex→codex)
3. Code review: Skip/Gemini/Agent/Other (single-select, can specify custom tool via Other)
-> Process selections and proceed to Phase 5
-> If cancel: Exit
|
v
[Phase 5] Execution & Progress Tracking
-> Create TodoWrite task list from breakdown
-> Create TodoWrite execution call list (grouped tasks)
-> Launch selected execution (agent or CLI)
-> Track progress with TodoWrite updates
-> Real-time status displayed to user
-> Track execution call progress with TodoWrite updates
-> Real-time call status displayed to user (e.g., "[Agent-1] (Task A + Task B)")
-> If code review enabled: Run selected CLI analysis
|
v
@@ -95,9 +94,10 @@ Execution Complete
### Task Management Pattern
- TodoWrite creates task list before execution starts (Phase 5)
- Tasks marked as in_progress/completed during execution
- Real-time progress updates visible to user
- TodoWrite creates execution call list before execution starts (Phase 5)
- Execution calls ([Agent-1], [Codex-1], etc.) marked as in_progress/completed during execution
- Each execution call handles multiple related tasks
- Real-time progress updates visible at call level (not individual task level)
- No intermediate file artifacts generated
## Detailed Phase Execution
@@ -266,36 +266,25 @@ else complexity = "High"
**Planning Execution**:
**Option A: Direct Planning (Low Complexity)**
```javascript
// Current Claude generates plan directly
planObject = {
summary: "Brief overview of what needs to be done",
approach: "Step-by-step implementation strategy",
tasks: [
"Task 1: Specific action with file references",
"Task 2: Specific action with file references",
// ... 3-5 tasks
],
complexity: "Low",
estimated_time: "15-30 minutes"
}
```
Current Claude generates plan directly following these guidelines:
- **Summary**: 2-3 sentence overview of the implementation
- **Approach**: High-level implementation strategy
- **Task Breakdown**: 3-5 specific, actionable tasks with file paths
- **Estimated Time**: Total implementation time estimate
- **Recommended Execution**: "Agent" (for Low complexity tasks)
**Option B: Agent-Based Planning (Medium/High Complexity)**
Delegate to cli-planning-agent with detailed requirements:
```javascript
// Delegate to cli-planning-agent
Task(
subagent_type="cli-planning-agent",
description="Generate detailed implementation plan",
prompt=`
Task: ${task_description}
Exploration Context:
${JSON.stringify(explorationContext, null, 2)}
User Clarifications:
${JSON.stringify(clarificationContext, null, 2) || "None provided"}
Exploration Context: ${JSON.stringify(explorationContext, null, 2)}
User Clarifications: ${JSON.stringify(clarificationContext, null, 2) || "None provided"}
Complexity Level: ${complexity}
Generate a detailed implementation plan with the following components:
@@ -303,79 +292,31 @@ Task(
1. Summary: 2-3 sentence overview of the implementation
2. Approach: High-level implementation strategy
3. Task Breakdown: 5-10 specific, actionable tasks
- Each task should specify:
* What to do
* Which files to modify/create
* Dependencies on other tasks (if any)
- Each task should specify: What to do, Which files to modify/create, Dependencies on other tasks (if any)
4. Task Dependencies & Parallelization:
- Identify independent tasks that can run in parallel (no shared file conflicts or logical dependencies)
- Group tasks by execution order: parallel groups can execute simultaneously, sequential groups must wait for previous completion
- Format: "Group 1 (parallel): Task 1, Task 2 | Group 2 (parallel): Task 3, Task 4 | Task 5 (depends on all)"
5. Risks: Potential issues and mitigation strategies (for Medium/High complexity)
6. Estimated Time: Total implementation time estimate
7. Recommended Execution: "Direct" (agent) or "CLI" (autonomous tool)
Output Format: Return a structured object with these fields:
{
summary: string,
approach: string,
tasks: string[],
dependencies: string[] (optional),
risks: string[] (optional),
estimated_time: string,
recommended_execution: "Direct" | "CLI"
}
7. Recommended Execution: "Agent" or "Codex" based on task complexity
Ensure tasks are specific, with file paths and clear acceptance criteria.
`
)
// Agent returns detailed plan
planObject = agent_output.parse()
```
**Expected Return Structure**:
**Expected Return Structure (Both Options)**:
```javascript
planObject = {
summary: "Implement JWT-based authentication system with middleware integration",
approach: "Create auth service layer, implement JWT utilities, add middleware, update routes",
tasks: [
"Create authentication service in src/auth/service.ts with login/logout/verify methods",
"Implement JWT token utilities in src/auth/jwt.ts (generate, verify, refresh)",
"Add authentication middleware to src/middleware/auth.ts",
"Update API routes in src/routes/*.ts to use auth middleware",
"Add integration tests for auth flow in tests/auth.test.ts"
],
dependencies: [
"Group 1 (parallel): Task 1, Task 2 - Independent service and utilities, no file conflicts",
"Group 2 (sequential): Task 3 - Depends on Task 2 completion (middleware needs JWT utilities)",
"Group 3 (sequential): Task 4 - Depends on Task 3 completion (routes need middleware)",
"Group 4 (sequential): Task 5 - Depends on all previous tasks (tests need complete implementation)"
],
risks: [
"Token refresh timing may conflict with existing session logic - test thoroughly",
"Breaking change if existing auth is in use - plan migration strategy"
],
estimated_time: "30-45 minutes",
recommended_execution: "CLI" // Based on clear requirements and straightforward implementation
}
```
**Output Structure**:
```javascript
planObject = {
summary: "2-3 sentence overview",
approach: "Implementation strategy",
tasks: [
"Task 1: ...",
"Task 2: ...",
// ... 3-10 tasks based on complexity
],
complexity: "Low|Medium|High",
dependencies: ["task1 -> task2", ...], // if Medium/High
risks: ["risk1", "risk2", ...], // if High
estimated_time: "X minutes",
recommended_execution: "Direct|CLI"
summary: string, // 2-3 sentence overview
approach: string, // High-level implementation strategy
tasks: string[], // 3-5 tasks (Low) or 5-10 tasks (Medium/High) with file paths
dependencies: string[], // Task execution order: parallel groups and sequential dependencies (Medium/High only)
risks: string[], // Potential issues and mitigation strategies (Medium/High only)
estimated_time: string, // Total implementation time estimate
recommended_execution: string, // "Agent" (Low) or "Codex" (Medium/High)
complexity: string // "Low" | "Medium" | "High"
}
```
@@ -391,75 +332,94 @@ planObject = {
### Phase 4: Task Confirmation & Execution Selection
**User Interaction Flow**: Three-dimensional multi-select confirmation
**User Interaction Flow**: Two-step confirmation process
**Step 4.1: Display Plan Summary**
First, output the complete plan to the user as regular text:
```
## Implementation Plan
**Summary**: ${planObject.summary}
**Approach**: ${planObject.approach}
**Task Breakdown**:
${planObject.tasks.map((t, i) => `${i+1}. ${t}`).join('\n')}
${planObject.dependencies ? `\n**Dependencies**:\n${planObject.dependencies.join('\n')}` : ''}
${planObject.risks ? `\n**Risks**:\n${planObject.risks.join('\n')}` : ''}
**Complexity**: ${planObject.complexity}
**Estimated Time**: ${planObject.estimated_time}
**Recommended Execution**: ${planObject.recommended_execution}
```
**Step 4.2: Collect User Confirmation**
After displaying the plan, collect three inputs via AskUserQuestion:
**Operations**:
- Display plan summary with full task breakdown
- Collect three multi-select inputs:
1. Task confirmation (Allow/Modify/Cancel + optional supplements)
2. Execution method (Agent/Provide Plan/CLI + CLI tool specification)
3. Code review tool (No/Claude/Gemini/Qwen/Codex)
- Support plan supplements and modifications via "Other" input
- Collect three inputs:
1. Task confirmation (multi-select: Allow/Modify/Cancel + optional supplements via "Other")
2. Execution method (single-select: Agent/Codex/Auto)
- Agent: Execute with @code-developer
- Codex: Execute with codex CLI tool
- Auto: Simple tasks (Low complexity) → Agent, Complex tasks (Medium/High) → Codex
3. Code review tool (single-select: Skip/Gemini/Agent + custom tools via "Other")
- Gemini Review: Use gemini CLI for code analysis
- Agent Review: Use @code-reviewer agent
- Other: Specify custom tool (e.g., "qwen", "codex") via text input
- Support plan supplements and custom tool specification via "Other" input
**Question 1: Task Confirmation (Multi-select)**
**Three Questions in Single AskUserQuestion Call**:
- Question 1: Task confirmation (multi-select: Allow/Modify/Cancel)
- Question 2: Execution method selection (single-select: Agent/Codex/Auto)
- Question 3: Code review tool selection (single-select: Skip/Gemini/Agent, custom via "Other")
Display plan to user and ask for confirmation:
- Show: summary, approach, task breakdown, dependencies, risks, complexity, estimated time
- Options: "Allow" / "Modify" / "Cancel" (multi-select enabled)
- User can input plan supplements via "Other" option
- If Cancel selected: Exit workflow
- Otherwise: Proceed to Question 2
**Question 2: Execution Method Selection (Multi-select)**
Ask user to select execution method:
- Options: "Agent Execution" / "Provide Plan" / "CLI Execution" (multi-select enabled)
- User inputs CLI tool choice (gemini/qwen/codex) via "Other" option if "CLI Execution" selected
- Store selection for Phase 5 execution
**Simplified AskUserQuestion Reference**:
**AskUserQuestion Call**:
```javascript
// Question 1: Task Confirmation (Multi-select)
AskUserQuestion({
questions: [{
question: `[Display plan with all details]\n\nConfirm this plan?`,
header: "Confirm Plan",
multiSelect: true,
options: [
{ label: "Allow", description: "Proceed with plan" },
{ label: "Modify", description: "Adjust plan" },
{ label: "Cancel", description: "Abort" }
]
}]
})
questions: [
{
question: `**Plan Summary**: ${planObject.summary}
// Question 2: Execution Method (Multi-select)
AskUserQuestion({
questions: [{
question: `Select execution method (input CLI tool in Other if choosing CLI):`,
header: "Execution Method",
multiSelect: true,
options: [
{ label: "Agent Execution", description: "Execute with @code-developer" },
{ label: "Provide Plan", description: "Return plan only" },
{ label: "CLI Execution", description: "Execute with CLI tool (specify in Other)" }
]
}]
})
**Tasks**: ${planObject.tasks.length} tasks | **Complexity**: ${planObject.complexity} | **Estimated Time**: ${planObject.estimated_time}
// Question 3: Code Review Tool Selection
AskUserQuestion({
questions: [{
question: `Enable code review after execution?`,
header: "Code Review",
options: [
{ label: "No", description: "Skip code review" },
{ label: "Claude (default)", description: "Current Claude agent review" },
{ label: "Gemini", description: "gemini-2.5-pro analysis" },
{ label: "Qwen", description: "coder-model analysis" },
{ label: "Codex", description: "gpt-5 analysis" }
]
}]
Confirm this plan? (Multi-select enabled - you can select multiple options and add supplements via "Other")`,
header: "Confirm Plan",
multiSelect: true,
options: [
{ label: "Allow", description: "Proceed with plan as-is" },
{ label: "Modify", description: "Adjust plan before execution" },
{ label: "Cancel", description: "Abort workflow" }
]
},
{
question: `Select execution method:`,
header: "Execution",
multiSelect: false,
options: [
{ label: "Agent", description: "Execute with @code-developer agent" },
{ label: "Codex", description: "Execute with codex CLI tool" },
{ label: "Auto", description: `Auto-select: ${planObject.complexity === 'Low' ? 'Agent (Low complexity)' : 'Codex (Medium/High complexity)'}` }
]
},
{
question: `Enable code review after execution?
(You can specify other tools like "qwen" or "codex" via "Other" option)`,
header: "Code Review",
multiSelect: false,
options: [
{ label: "Gemini Review", description: "Review with Gemini CLI tool (gemini-2.5-pro)" },
{ label: "Agent Review", description: "Review with @code-reviewer agent" },
{ label: "Skip", description: "No review needed" }
]
}
]
})
```
@@ -470,17 +430,18 @@ Task Confirmation (Multi-select):
├─ Modify (+ optional supplements in Other) → Re-run Phase 3 with modifications
└─ Cancel → Exit (no execution)
Execution Method Selection (Multi-select):
├─ Agent Execution → Launch @code-developer
├─ Provide Plan → Return plan JSON, skip execution
└─ CLI Execution (+ tool name in Other: gemini/qwen/codex) → Build and execute CLI command
Execution Method Selection (Single-select):
├─ Agent → Launch @code-developer agent
├─ Codex → Execute with codex CLI tool
└─ Auto → Automatic selection:
├─ If complexity = Low → Launch @code-developer agent
└─ If complexity = Medium/High → Execute with codex CLI tool
Code Review Selection (after execution):
├─ No → Skip review, workflow complete
├─ Claude (default) → Current Claude agent review
├─ Gemini → Run gemini code analysis
Qwen → Run qwen code analysis
└─ Codex → Run codex code analysis
├─ Skip → Skip review, workflow complete
├─ Gemini Review → Run gemini code analysis (gemini-2.5-pro)
├─ Agent Review → Current Claude agent review
Other → Specify custom tool (e.g., "qwen", "codex") via text input
```
**Progress Tracking**:
@@ -494,44 +455,57 @@ Code Review Selection (after execution):
### Phase 5: Execution & Progress Tracking
**Operations**:
- Create TodoWrite task list from plan breakdown
- Create TodoWrite execution call list (grouped tasks by dependencies)
- Launch selected execution method (agent or CLI)
- Track execution progress with real-time TodoWrite updates
- Display status to user
- Track execution call progress with real-time TodoWrite updates (not individual tasks)
- Display execution status to user
**Step 5.1: Create TodoWrite Task List**
**Step 5.1: Create TodoWrite Execution List**
**Before execution starts**, create task list:
**Before execution starts**, create execution call list (not individual tasks):
```javascript
// Group tasks based on dependencies and execution strategy
// Each execution call handles multiple related tasks
executionCalls = groupTasksByExecution(planObject.tasks, planObject.dependencies)
TodoWrite({
todos: planObject.tasks.map((task, index) => ({
content: task,
todos: executionCalls.map((call, index) => ({
content: `[${call.method}-${index+1}] (${call.taskSummary})`,
status: "pending",
activeForm: task.replace(/^(.*?):/, "$1ing:") // "Implement X" -> "Implementing X"
activeForm: `Executing [${call.method}-${index+1}] (${call.taskSummary})`
}))
})
```
**Example Task List**:
**Example Execution List**:
```
[ ] Implement authentication service in src/auth/service.ts
[ ] Create JWT token utilities in src/auth/jwt.ts
[ ] Add authentication middleware to src/middleware/auth.ts
[ ] Update API routes to use authentication
[ ] Add integration tests for auth flow
[ ] [Agent-1] (Implement auth service + Create JWT utilities)
[ ] [Agent-2] (Add middleware + Update routes)
[ ] [Codex-1] (Add integration tests for auth flow)
```
**Task Grouping Logic**:
- Parallel tasks → Single execution call
- Sequential tasks → Separate execution calls
- Complex tasks → May split into multiple calls based on file scope
**Step 5.2: Launch Execution**
**IMPORTANT**: CLI execution MUST run in foreground (no background execution)
Based on user selection in Phase 4, execute appropriate method:
- **Agent**: Launch @code-developer agent
- **Codex**: Execute with codex CLI tool
- **Auto**: Automatic selection based on complexity
- Low complexity → Agent execution
- Medium/High complexity → Codex execution
#### Option A: Direct Execution with Agent
**Operations**:
- Launch @code-developer agent with full plan context
- Agent receives exploration findings, clarifications, and task breakdown
- **For subsequent executions**: Include previous execution results to maintain context continuity
- Agent call format:
```javascript
Task(
@@ -547,6 +521,14 @@ Based on user selection in Phase 4, execute appropriate method:
${planObject.dependencies ? `\nTask Dependencies:\n${planObject.dependencies.join('\n')}` : ''}
${previousExecutionResults ? `\n## Previous Execution Results\n${previousExecutionResults.map(result => `
[${result.executionId}] ${result.status}
Tasks handled: ${result.tasksSummary}
Completion status: ${result.completionSummary}
Key outputs: ${result.keyOutputs || 'See git diff for details'}
${result.notes ? `Notes: ${result.notes}` : ''}
`).join('\n---\n')}` : ''}
Implementation Approach:
${planObject.approach}
@@ -558,92 +540,50 @@ Based on user selection in Phase 4, execute appropriate method:
${planObject.risks ? `\nRisks to Consider:\n${planObject.risks.join('\n')}` : ''}
IMPORTANT Instructions:
- **Context Continuity**: Review previous execution results above to understand what's already completed
- **Build on Previous Work**: Ensure your work integrates with previously completed tasks
- **Avoid Duplication**: Don't redo tasks that are already completed in previous executions
- **Parallel Execution**: Identify independent tasks from dependencies field and execute them in parallel using multiple tool calls in a single message
- **Dependency Respect**: Sequential tasks must wait for dependent tasks to complete before starting
- **TodoWrite Updates**: Mark tasks as in_progress when starting, completed when finished
- **Intelligent Grouping**: Analyze task dependencies to determine parallel groups - tasks with no file conflicts or logical dependencies can run simultaneously
- Test functionality as you go
- Handle risks proactively
Note: This agent call handles multiple tasks. TodoWrite tracking is managed at call level by orchestrator.
`
)
```
**Agent Responsibilities**:
- Mark tasks as in_progress when starting
- Mark tasks as completed when finished
- Update TodoWrite in real-time for user visibility
- Each agent call handles multiple tasks (grouped by dependencies)
- Agent updates TodoWrite at **call level** (not individual task level)
- Mark execution call as in_progress when starting, completed when all assigned tasks finished
#### Option B: CLI Execution (Gemini/Codex/Qwen)
**Execution Result Collection** (for multi-execution scenarios):
- After each execution completes, collect result summary:
```javascript
executionResult = {
executionId: "[Agent-1]" or "[Codex-1]",
status: "completed" or "partial" or "failed",
tasksSummary: "Brief description of tasks handled",
completionSummary: "What was completed",
keyOutputs: "Files created/modified, key changes",
notes: "Any important context for next execution"
}
previousExecutionResults.push(executionResult)
```
- Pass `previousExecutionResults` to subsequent executions for context continuity
#### Option B: CLI Execution (Codex)
**Operations**:
- Build CLI command with comprehensive context
- Execute CLI tool with write permissions
- Build codex CLI command with comprehensive context
- **For subsequent executions**: Include previous execution results summary
- Execute codex tool with write permissions
- Monitor CLI output and update TodoWrite based on progress indicators
- Parse CLI completion signals to mark tasks as done
**Command Format (Gemini)** - Full context with exploration and clarifications:
```bash
gemini -p "
PURPOSE: Implement planned tasks with full context from exploration and planning
TASK:
${planObject.tasks.map((t, i) => `• ${t}`).join('\n')}
MODE: write
CONTEXT: @**/* | Memory: Implementation plan from lite-plan workflow
## Exploration Findings
${explorationContext ? `
Project Structure:
${explorationContext.project_structure || 'Not available'}
Relevant Files:
${explorationContext.relevant_files?.join('\n') || 'Not specified'}
Current Implementation Patterns:
${explorationContext.patterns || 'Not analyzed'}
Dependencies and Integration Points:
${explorationContext.dependencies || 'Not specified'}
Architecture Constraints:
${explorationContext.constraints || 'None identified'}
` : 'No exploration performed (task did not require codebase context)'}
## User Clarifications
${clarificationContext ? `
The following clarifications were provided by the user after exploration:
${Object.entries(clarificationContext).map(([q, a]) => `Q: ${q}\nA: ${a}`).join('\n\n')}
` : 'No clarifications needed'}
## Implementation Plan Context
Task Summary: ${planObject.summary}
Implementation Approach:
${planObject.approach}
${planObject.dependencies ? `
Task Dependencies (execute in order):
${planObject.dependencies.join('\n')}
` : ''}
${planObject.risks ? `
Identified Risks:
${planObject.risks.join('\n')}
` : ''}
Complexity Level: ${planObject.complexity}
Estimated Time: ${planObject.estimated_time}
EXPECTED: All tasks implemented following the plan approach, with proper error handling and testing
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt) | Follow implementation approach exactly | Handle identified risks proactively | write=CREATE/MODIFY/DELETE
" -m gemini-2.5-pro --approval-mode yolo
```
**Command Format (Codex)** - Session-based with resume support:
**First Execution (Establish Session)**:
**Command Format (Codex)** - Single execution with full context:
```bash
codex --full-auto exec "
TASK: ${planObject.summary}
@@ -653,6 +593,17 @@ ${planObject.tasks.map((t, i) => `${i+1}. ${t}`).join('\n')}
${planObject.dependencies ? `\n## Task Dependencies\n${planObject.dependencies.join('\n')}` : ''}
${previousExecutionResults ? `\n## Previous Execution Results\n${previousExecutionResults.map(result => `
[${result.executionId}] ${result.status}
Tasks: ${result.tasksSummary}
Status: ${result.completionSummary}
Outputs: ${result.keyOutputs || 'See git diff'}
${result.notes ? `Notes: ${result.notes}` : ''}
`).join('\n---\n')}
IMPORTANT: Review previous results above. Build on completed work. Avoid duplication.
` : ''}
## Implementation Approach
${planObject.approach}
@@ -670,168 +621,96 @@ ${clarificationContext ? `\n## User Clarifications\n${Object.entries(clarificati
${planObject.risks ? `\n## Risks to Handle\n${planObject.risks.join('\n')}` : ''}
## Execution Instructions
- Complete all tasks following the breakdown sequence
- Review previous execution results for context continuity
- Build on previous work, don't duplicate completed tasks
- Complete all assigned tasks in single execution
- Test functionality as you implement
- Handle identified risks proactively
- Create session for potential resume if needed
Complexity: ${planObject.complexity}
" -m gpt-5 --skip-git-repo-check -s danger-full-access
" --skip-git-repo-check -s danger-full-access
```
**Subsequent Executions (Resume if needed)**:
```bash
# If first execution fails or is interrupted, can resume:
codex --full-auto exec "
Continue implementation from previous session.
**Note**: Avoid `resume --last` unless task is exceptionally complex or hits timeout. Optimize task breakdown for full completion in single execution.
Remaining tasks:
${remaining_tasks.map((t, i) => `${i+1}. ${t}`).join('\n')}
Maintain context from previous execution.
" resume --last -m gpt-5 --skip-git-repo-check -s danger-full-access
```
**Codex Session Strategy**:
- First execution establishes full context and creates session
- If execution is interrupted or fails, use `resume --last` to continue
- Resume inherits all context from original execution
- Useful for complex tasks that may hit timeouts or require iteration
**Command Format (Qwen)** - Full context similar to Gemini:
```bash
qwen -p "
PURPOSE: Implement planned tasks with comprehensive context
TASK:
${planObject.tasks.map((t, i) => `• ${t}`).join('\n')}
MODE: write
CONTEXT: @**/* | Memory: Full implementation context from lite-plan
## Code Exploration Results
${explorationContext ? `
Analyzed Project Structure:
${explorationContext.project_structure || 'Standard structure'}
Key Files to Modify:
${explorationContext.relevant_files?.join('\n') || 'To be determined during implementation'}
Existing Code Patterns:
${explorationContext.patterns || 'Follow codebase conventions'}
Dependencies:
${explorationContext.dependencies || 'None specified'}
Constraints:
${explorationContext.constraints || 'None identified'}
` : 'No exploration performed - analyze codebase patterns as you implement'}
## Clarifications from User
${clarificationContext ? `
${Object.entries(clarificationContext).map(([question, answer]) => `
Question: ${question}
Answer: ${answer}
`).join('\n')}
` : 'No additional clarifications provided'}
## Implementation Strategy
Summary: ${planObject.summary}
Approach:
${planObject.approach}
${planObject.dependencies ? `
Task Order (follow sequence):
${planObject.dependencies.join('\n')}
` : ''}
${planObject.risks ? `
Risk Mitigation:
${planObject.risks.join('\n')}
` : ''}
Task Complexity: ${planObject.complexity}
Time Estimate: ${planObject.estimated_time}
EXPECTED: Complete implementation with tests and proper error handling
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt) | Follow approach strictly | Test thoroughly | write=CREATE/MODIFY/DELETE
" -m coder-model --approval-mode yolo
```
**Execution Result Collection** (for multi-execution scenarios):
- After CLI execution completes, analyze output and collect result summary
- Extract key information: modified files, completion status, important notes
- Store in `previousExecutionResults` array for subsequent executions
- Result structure same as Agent execution (see Option A above)
**Execution with Progress Tracking**:
```javascript
// Launch CLI in foreground (NOT background - avoid )
// Launch CLI in foreground (NOT background)
bash_result = Bash(
command=cli_command,
timeout=600000 // 10 minutes
)
// Monitor output and update TodoWrite
// Parse CLI output for task completion indicators
// Update TodoWrite when tasks complete
// Example: When CLI outputs "✓ Task 1 complete" -> Mark task 1 as completed
// Update TodoWrite when CLI execution call completes
// Mark execution call (e.g., "[Codex-1]") as completed when CLI finishes
// One CLI call may handle multiple tasks - track at call level, not task level
```
**CLI Progress Monitoring**:
- Parse CLI output for completion keywords ("done", "complete", "✓", etc.)
- Update corresponding TodoWrite tasks based on progress
- Provide real-time visibility to user
- Monitor CLI execution at **call level** (not individual task level)
- Update TodoWrite when CLI execution call completes (all assigned tasks done)
- Provide real-time visibility of execution call progress to user
**Step 5.3: Track Execution Progress**
Track **agent/CLI call level** (not individual tasks):
**Real-time TodoWrite Updates**:
```javascript
// As execution progresses, update task status:
// Task started
// When execution call starts
TodoWrite({
todos: [
{ content: "Implement auth service", status: "in_progress", activeForm: "Implementing auth service" },
{ content: "Create JWT utilities", status: "pending", activeForm: "Creating JWT utilities" },
// ...
{ content: "[Agent-1] (Implement auth service + Create JWT utilities)", status: "in_progress", activeForm: "Executing [Agent-1] (Implement auth service + Create JWT utilities)" },
{ content: "[Agent-2] (Add middleware + Update routes)", status: "pending", activeForm: "Executing [Agent-2] (Add middleware + Update routes)" },
{ content: "[Codex-1] (Add integration tests)", status: "pending", activeForm: "Executing [Codex-1] (Add integration tests)" }
]
})
// Task completed
// When execution call completes
TodoWrite({
todos: [
{ content: "Implement auth service", status: "completed", activeForm: "Implementing auth service" },
{ content: "Create JWT utilities", status: "in_progress", activeForm: "Creating JWT utilities" },
// ...
{ content: "[Agent-1] (Implement auth service + Create JWT utilities)", status: "completed", activeForm: "Executing [Agent-1] (Implement auth service + Create JWT utilities)" },
{ content: "[Agent-2] (Add middleware + Update routes)", status: "in_progress", activeForm: "Executing [Agent-2] (Add middleware + Update routes)" },
{ content: "[Codex-1] (Add integration tests)", status: "pending", activeForm: "Executing [Codex-1] (Add integration tests)" }
]
})
```
**User Visibility**:
- User sees real-time task progress
- Current task highlighted as "in_progress"
- Completed tasks marked with checkmark
- Pending tasks remain unchecked
- User sees **execution call progress** (not individual task progress)
- Current execution highlighted as "in_progress" (e.g., "[Agent-1] (Task A + Task B)")
- Completed executions marked with checkmark
- Pending executions remain unchecked
- Each execution shows **task summary** for context
**Progress Tracking**:
- Mark Phase 5 as in_progress throughout execution
- Mark Phase 5 as completed when all tasks done
- Final status summary displayed to user
- Track agent/CLI call completion (not task completion)
- One execution call may handle multiple tasks simultaneously
- Mark Phase 5 as completed when all execution calls done
**Step 5.4: Code Review (Optional)**
**Skip Condition**: Only run if user selected review tool in Phase 4 (not "No")
**Skip Condition**: Only run if user selected review tool in Phase 4 (not "Skip")
**Operations**:
- If Claude: Current agent performs direct code review analysis
- If CLI tool (gemini/qwen/codex): Execute CLI with code review analysis prompt
- If "Agent Review": Current agent performs direct code review analysis
- If "Gemini Review": Execute gemini CLI with code review analysis prompt
- If "Other" (custom tool specified): Execute specified CLI tool (e.g., qwen, codex)
- Review all modified files from execution
- Generate quality assessment and improvement recommendations
**Command Format**:
```bash
# Claude (default): Direct agent review (no CLI command needed)
# Agent Review: Direct agent review (no CLI command needed)
# Uses analysis prompt and TodoWrite tools directly
# CLI Tools (gemini/qwen/codex): Execute analysis command
# Gemini Review / Custom Tool (qwen, codex, etc.): Execute analysis command
{selected_tool} -p "
PURPOSE: Code review for implemented changes
TASK: • Analyze code quality • Identify potential issues • Suggest improvements
@@ -839,7 +718,7 @@ MODE: analysis
CONTEXT: @**/* | Memory: Review changes from lite-plan execution
EXPECTED: Quality assessment with actionable recommendations
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-quality.txt) | Focus on recent changes | analysis=READ-ONLY
" -m {model}
"
```
**Expected Duration**: Varies by task complexity and execution method
@@ -877,19 +756,27 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-q
- High complexity (6+ files): CLI planning agent with risk analysis (thorough, 50-60s)
- Balances speed and thoroughness appropriately
4. **Two-Dimensional Confirmation**: Separate task approval from execution method
- First dimension: Confirm/Modify/Cancel plan
- Second dimension: Direct execution vs CLI execution
4. **Two-Step Confirmation Process**: Clear plan presentation followed by comprehensive control
- **Step 1**: Display complete plan as readable text output (not embedded in question)
- Shows summary, approach, tasks, dependencies, risks, complexity, time estimate
- Clear separation between plan content and user interaction
- **Step 2**: Collect three-dimensional input via AskUserQuestion
- First dimension: Confirm/Modify/Cancel plan (multi-select with supplement via "Other")
- Second dimension: Execution method selection (Agent/Codex/Auto)
- Third dimension: Code review tool selection (Skip/Gemini/Agent, custom via "Other")
- Allows plan refinement without re-selecting execution method
- Supports iterative planning with user feedback
- Auto mode intelligently selects execution method based on complexity
- Custom code review tools (qwen, codex, etc.) can be specified via "Other" option
### Task Management
1. **Live Progress Tracking**: TodoWrite provides real-time execution visibility
- Tasks created before execution starts
- Updated in real-time as work progresses
- User sees current task being worked on
- Clear completion status throughout execution
1. **Live Progress Tracking**: TodoWrite provides real-time execution call visibility
- Execution calls ([Agent-1], [Codex-1], etc.) created before execution starts
- Updated in real-time as execution calls progress
- User sees current execution call being worked on (e.g., "[Agent-1] (Task A + Task B)")
- Each execution call shows task summary for context
- Clear completion status at call level (not individual task level)
2. **Phase-Based Organization**: 5 distinct phases with clear transitions
- Phase 1: Task Analysis & Exploration (automatic)
@@ -942,8 +829,8 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-q
| Phase 3 Planning Timeout | Planning takes > 90 seconds | Generate simplified direct plan, mark as "Quick Plan", continue to Phase 4 with reduced detail |
| Phase 4 Confirmation Timeout | User no response > 5 minutes | Save plan context to temporary var, display resume instructions, exit gracefully |
| Phase 4 Modification Loop | User requests modify > 3 times | Suggest breaking task into smaller pieces or using /workflow:plan for comprehensive planning |
| Phase 5 CLI Tool Unavailable | Selected CLI tool not installed | Show installation instructions, offer to re-select (Direct execution or different CLI) |
| Phase 5 Execution Failure | Agent/CLI crashes or errors | Display error details, save partial progress from TodoWrite, suggest manual recovery or retry |
| Phase 5 Codex Unavailable | Codex tool not installed | Show installation instructions, offer to re-select (Agent execution or Auto mode) |
| Phase 5 Execution Failure | Agent/Codex crashes or errors | Display error details, save partial progress from TodoWrite, suggest manual recovery or retry |
## Input/Output
@@ -956,7 +843,6 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-q
- "Refactor logging module for better performance"
- "Add unit tests for authentication service"
- Flags (optional):
- `--tool <name>`: Preset execution tool (claude|gemini|codex|qwen)
- `-e` or `--explore`: Force code exploration phase (overrides auto-detection)
### Output Format
@@ -972,7 +858,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/02-review-code-q
// ... 3-7 tasks total
],
complexity: "Low|Medium|High",
recommended_tool: "Claude|Gemini|Codex|Qwen",
recommended_execution: "Agent|Codex", // Based on complexity
estimated_time: "X minutes"
}
```

View File

@@ -78,7 +78,7 @@ cd src/auth && qwen -p "
追踪用户登录的完整执行流程,
从 API 入口到数据库查询,
列出所有调用的函数和依赖关系
" -m coder-model
"
```
**工具输出**Qwen 理解需求,自动追踪执行路径
@@ -278,7 +278,7 @@ codex -C src/auth --full-auto exec "
**方式 1CLI 工具语义调用**(推荐,灵活)
- **用户输入**`使用 gemini 分析这个项目的架构设计,识别主要模块、依赖关系和架构模式`
- **Claude Code 生成并执行**`cd project-root && gemini -p "..." -m gemini-3-pro-preview-11-2025`
- **Claude Code 生成并执行**`cd project-root && gemini -p "..."`
**方式 2Slash 命令**
- **用户输入**`/cli:analyze --tool gemini "分析项目架构"`
@@ -291,7 +291,7 @@ codex -C src/auth --full-auto exec "
**方式 1CLI 工具语义调用**
- **用户输入**`让 codex 实现用户认证功能:注册(邮箱+密码+验证、登录JWT token、刷新令牌技术栈 Node.js + Express`
- **Claude Code 生成并执行**`codex -C src/auth --full-auto exec "..." -m gpt-5 --skip-git-repo-check -s danger-full-access`
- **Claude Code 生成并执行**`codex -C src/auth --full-auto exec "..." --skip-git-repo-check -s danger-full-access`
**方式 2Slash 命令**(工作流化)
- **用户输入**`/workflow:plan --agent "实现用户认证功能"``/workflow:execute`
@@ -304,9 +304,9 @@ codex -C src/auth --full-auto exec "
**方式 1CLI 工具语义调用**
- **用户输入**`使用 gemini 诊断登录超时问题,分析处理流程、性能瓶颈、数据库查询效率`
- **Claude Code 生成并执行**`cd src/auth && gemini -p "..." -m gemini-3-pro-preview-11-2025`
- **Claude Code 生成并执行**`cd src/auth && gemini -p "..."`
- **用户输入**`让 codex 根据上述分析修复登录超时,优化查询、添加缓存`
- **Claude Code 生成并执行**`codex -C src/auth --full-auto exec "..." -m gpt-5 --skip-git-repo-check -s danger-full-access`
- **Claude Code 生成并执行**`codex -C src/auth --full-auto exec "..." --skip-git-repo-check -s danger-full-access`
**方式 2Slash 命令**
- **用户输入**`/cli:mode:bug-diagnosis --tool gemini "诊断登录超时"``/cli:execute --tool codex "修复登录超时"`
@@ -319,7 +319,7 @@ codex -C src/auth --full-auto exec "
**方式 1CLI 工具语义调用**
- **用户输入**`使用 gemini 为 API 模块生成技术文档,包含端点说明、数据模型、使用示例`
- **Claude Code 生成并执行**`cd src/api && gemini -p "..." -m gemini-3-pro-preview-11-2025 --approval-mode yolo`
- **Claude Code 生成并执行**`cd src/api && gemini -p "..." --approval-mode yolo`
**方式 2Slash 命令**
- **用户输入**`/memory:docs src/api --tool gemini --mode full`

View File

@@ -762,7 +762,7 @@ async function executeCLIAnalysis(prompt) {
// Execute gemini with analysis prompt using --include-directories
// This allows gemini to access reference docs while maintaining correct file context
const command = `gemini -p "${escapePrompt(prompt)}" -m gemini-3-pro-preview-11-2025 --include-directories ${referencePath}`;
const command = `gemini -p "${escapePrompt(prompt)}" --include-directories ${referencePath}`;
try {
const result = await execBash(command, { timeout: 120000 }); // 2 min timeout
@@ -770,7 +770,7 @@ async function executeCLIAnalysis(prompt) {
} catch (error) {
// Fallback to qwen if gemini fails
console.warn('Gemini failed, falling back to qwen');
const fallbackCmd = `qwen -p "${escapePrompt(prompt)}" -m coder-model --include-directories ${referencePath}`;
const fallbackCmd = `qwen -p "${escapePrompt(prompt)}" --include-directories ${referencePath}`;
const result = await execBash(fallbackCmd, { timeout: 120000 });
return parseAnalysisResult(result.stdout);
}

View File

@@ -162,15 +162,15 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/analysis/pattern.txt)
**Gemini/Qwen (Write)**:
```bash
cd {dir} && gemini -p "..." -m gemini-2.5-flash --approval-mode yolo
cd {dir} && gemini -p "..." --approval-mode yolo
```
**Codex (Auto)**:
```bash
codex -C {dir} --full-auto exec "..." -m gpt-5 --skip-git-repo-check -s danger-full-access
codex -C {dir} --full-auto exec "..." --skip-git-repo-check -s danger-full-access
# Resume: Add 'resume --last' after prompt
codex --full-auto exec "..." resume --last -m gpt-5 --skip-git-repo-check -s danger-full-access
codex --full-auto exec "..." resume --last --skip-git-repo-check -s danger-full-access
```
**Cross-Directory** (Gemini/Qwen):

View File

@@ -136,7 +136,7 @@ RULES: $(cat ~/.claude/workflows/cli-templates/prompts/{template}) |
- Consider previous iteration failures
- Validate fix doesn't introduce new vulnerabilities
- analysis=READ-ONLY
" -m {model} {timeout_flag}
" {timeout_flag}
```
**Layer-Specific Guidance Injection**:

View File

@@ -766,7 +766,7 @@ Time Estimate: ${planObject.estimated_time}
EXPECTED: Complete implementation with tests and proper error handling
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/development/02-implement-feature.txt) | Follow approach strictly | Test thoroughly | write=CREATE/MODIFY/DELETE
" -m coder-model --approval-mode yolo
" --approval-mode yolo
```
**Execution with Progress Tracking**:

View File

@@ -333,7 +333,7 @@ codex --full-auto exec "Add JWT refresh token validation" resume --last --skip-g
2. Explicitly reference external files in CONTEXT field with @ patterns
3. ⚠️ BOTH steps are MANDATORY
Example: `cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" -m gemini-2.5-pro --include-directories ../shared`
Example: `cd src/auth && gemini -p "CONTEXT: @**/* @../shared/**/*" --include-directories ../shared`
**Rule**: If CONTEXT contains `@../dir/**/*`, command MUST include `--include-directories ../dir`