Skip to content

Commit ef7382e

Browse files
author
catlog22
committed
refactor: rewrite workflow-lite-plan-execute to serial CLI exploration with unified JSONL output
- Remove agent delegation (spawn_agent/wait/send_input/close_agent), all phases serial inline - Replace parallel agent exploration with serial ccw cli calls (gemini/claude) - Add search verification after each CLI exploration (ACE/Grep/Glob) - Change output from plan.json/executionContext to tasks.jsonl (unified JSONL) - Output format now compatible with collaborative-plan-with-file - Replace custom execution engine with unified-execute-with-file delegation - Copy full execution spec inline (no external references) - Use $ prefix for codex skill invocations
1 parent 752d98b commit ef7382e

3 files changed

Lines changed: 859 additions & 781 deletions

File tree

.codex/skills/workflow-lite-plan-execute/SKILL.md

Lines changed: 68 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
22
name: workflow-lite-plan-execute
3-
description: Lightweight planning + execution workflow. Exploration -> Clarification -> Planning -> Confirmation -> Execution (via lite-execute).
4-
allowed-tools: spawn_agent, wait, send_input, close_agent, AskUserQuestion, Read, Write, Edit, Bash, Glob, Grep, mcp__ace-tool__search_context
3+
description: Lightweight planning + execution workflow. Serial CLI exploration → Search verification → Clarification Planning → Unified JSONL output → Execution via unified-execute.
4+
allowed-tools: AskUserQuestion, Read, Write, Edit, Bash, Glob, Grep, mcp__ace-tool__search_context
55
---
66

77
# Planning Workflow
88

9-
Lite Plan produces an implementation plan and an `executionContext`, then hands off to Lite Execute for task execution.
9+
Lite Plan produces a unified JSONL (`tasks.jsonl`) implementation plan via serial CLI exploration and direct planning, then hands off to unified-execute-with-file for task execution.
1010

1111
## Key Design Principles
1212

13-
1. **Shared Execution**: Lite Plan produces `executionContext` consumed by Phase 2 (Lite Execute)
14-
2. **Progressive Phase Loading**: Only load phase docs when about to execute
15-
3. **Auto-Continue**: After the plan is confirmed ("Allow"), automatically load execution phase
16-
4. **Default Auto Mode**: When `--yes`, skip confirmations and auto-approve the plan
13+
1. **Serial Execution**: All phases execute serially inline, no agent delegation
14+
2. **CLI Exploration**: Multi-angle codebase exploration via `ccw cli` calls (default gemini, fallback claude)
15+
3. **Search Verification**: Verify CLI findings with ACE search / Grep / Glob before incorporating
16+
4. **Unified JSONL Output**: Produces `tasks.jsonl` compatible with `collaborative-plan-with-file` and `unified-execute-with-file`
17+
5. **Progressive Phase Loading**: Only load phase docs when about to execute
1718

1819
## Auto Mode
1920

@@ -42,14 +43,14 @@ $workflow-lite-plan-execute -e "Refactor payment module"
4243
$workflow-lite-plan-execute "docs/todo.md"
4344
```
4445

45-
> **Implementation sketch**: 编排器内部使用 `Skill(skill="workflow-lite-plan-execute", args="...")` 接口调用,此为伪代码示意,非命令行语法。
46+
> **Implementation sketch**: 编排器内部使用 `$workflow-lite-plan-execute "..."` 接口调用,此为伪代码示意,非命令行语法。
4647
4748
## Phase Reference Documents (Read On Demand)
4849

4950
| Phase | Document | Purpose |
5051
|-------|----------|---------|
51-
| 1 | `phases/01-lite-plan.md` | Lightweight planning with exploration, clarification, plan generation, and confirmation |
52-
| 2 | `phases/02-lite-execute.md` | Shared execution engine: task grouping, batch execution, optional code review |
52+
| 1 | `phases/01-lite-plan.md` | Serial CLI exploration, clarification, plan generation → tasks.jsonl |
53+
| 2 | `phases/02-lite-execute.md` | Handoff to unified-execute-with-file for task execution |
5354

5455
## Orchestrator Logic
5556

@@ -71,76 +72,107 @@ function extractTaskDescription(args) {
7172

7273
const taskDescription = extractTaskDescription($ARGUMENTS)
7374

74-
// Phase 1: Lite Plan
75+
// Phase 1: Lite Plan → tasks.jsonl
7576
Read('phases/01-lite-plan.md')
7677
// Execute planning phase...
7778

7879
// Gate: only continue when confirmed (or --yes)
79-
if (executionContext?.userSelection?.confirmation !== 'Allow' && !autoYes) {
80+
if (planResult?.userSelection?.confirmation !== 'Allow' && !autoYes) {
8081
// Stop: user cancelled or requested modifications
8182
return
8283
}
8384

84-
// Phase 2: Lite Execute
85+
// Phase 2: Handoff to unified-execute-with-file
8586
Read('phases/02-lite-execute.md')
86-
// Execute execution phase with executionContext from Phase 1
87+
// Invoke unified-execute-with-file with tasks.jsonl path
8788
```
8889
89-
## executionContext Contract (High Level)
90+
## Output Contract
9091
91-
`executionContext` is the only contract between Phase 1 and Phase 2.
92+
Phase 1 produces `tasks.jsonl` (unified JSONL format) — compatible with `collaborative-plan-with-file` and consumable by `unified-execute-with-file`.
93+
94+
**Output Directory**: `{projectRoot}/.workflow/.lite-plan/{session-id}/`
95+
96+
```
97+
{projectRoot}/.workflow/.lite-plan/{session-id}/
98+
├── exploration-{angle1}.md # Per-angle CLI exploration results
99+
├── exploration-{angle2}.md # (1-4 files based on complexity)
100+
├── explorations-manifest.json # Exploration index
101+
├── exploration-notes.md # Synthesized exploration notes
102+
├── requirement-analysis.json # Complexity assessment
103+
├── tasks.jsonl # ⭐ Unified JSONL (collaborative-plan-with-file compatible)
104+
└── plan.md # Human-readable summary
105+
```
106+
107+
**Unified JSONL Task Format** (one task per line):
92108
93-
Required (minimum) fields:
94109
```javascript
95110
{
96-
projectRoot: string, // 项目根目录绝对路径 (git rev-parse --show-toplevel || pwd)
97-
planObject: { summary, approach, tasks, complexity, estimated_time, recommended_execution },
98-
originalUserInput: string,
99-
executionMethod: "Agent" | "Codex" | "Auto",
100-
codeReviewTool: "Skip" | "Gemini Review" | "Codex Review" | "Agent Review" | string,
101-
userSelection: { confirmation: "Allow" | "Modify" | "Cancel" }
111+
id: "TASK-001",
112+
title: string,
113+
description: string,
114+
type: "feature|fix|refactor|enhancement|testing|infrastructure",
115+
priority: "high|medium|low",
116+
effort: "small|medium|large",
117+
scope: string,
118+
depends_on: ["TASK-xxx"],
119+
convergence: {
120+
criteria: string[], // Testable conditions
121+
verification: string, // Executable command or manual steps
122+
definition_of_done: string // Business language
123+
},
124+
files: [{
125+
path: string,
126+
action: "modify|create|delete",
127+
changes: string[],
128+
conflict_risk: "low|medium|high"
129+
}],
130+
source: {
131+
tool: "workflow-lite-plan-execute",
132+
session_id: string,
133+
original_id: string
134+
}
102135
}
103136
```
104137
105-
Recommended fields:
106-
- `explorationsContext`, `clarificationContext`, `executorAssignments`, and `session` (artifacts folder + paths)
107-
108138
## TodoWrite Pattern
109139
110140
Initialization:
111141
```json
112142
[
113143
{"content": "Lite Plan - Planning", "status": "in_progress", "activeForm": "Planning"},
114-
{"content": "Execution (Phase 2)", "status": "pending", "activeForm": "Executing tasks"}
144+
{"content": "Execution (unified-execute)", "status": "pending", "activeForm": "Executing tasks"}
115145
]
116146
```
117147
118148
After planning completes:
119149
```json
120150
[
121151
{"content": "Lite Plan - Planning", "status": "completed", "activeForm": "Planning"},
122-
{"content": "Execution (Phase 2)", "status": "in_progress", "activeForm": "Executing tasks"}
152+
{"content": "Execution (unified-execute)", "status": "in_progress", "activeForm": "Executing tasks"}
123153
]
124154
```
125155
126156
## Core Rules
127157
128-
1. **Planning phase NEVER modifies project code** - it may write planning artifacts, but all implementation is delegated to Phase 2
129-
2. **Phase 2 runs only after confirmation** - execute only when confirmation is "Allow" (or `--yes` auto mode)
130-
3. **executionContext is the contract** between planning and execution phases
131-
4. **Progressive loading**: Read phase doc only when about to execute
132-
5. **File-path detection**: Treat input as a file path only if the path exists; do not infer from file extensions
133-
6. **Explicit lifecycle**: Always `close_agent` after `wait` completes
158+
1. **Planning phase NEVER modifies project code** it may write planning artifacts, but all implementation is delegated to unified-execute
159+
2. **All phases serial, no agent delegation** — everything runs inline, no spawn_agent
160+
3. **CLI exploration with search verification** — CLI calls produce findings, ACE/Grep/Glob verify them
161+
4. **tasks.jsonl is the output contract** — unified JSONL format passed to unified-execute-with-file
162+
5. **Progressive loading**: Read phase doc only when about to execute
163+
6. **File-path detection**: Treat input as a file path only if the path exists; do not infer from file extensions
134164
135165
## Error Handling
136166
137167
| Error | Resolution |
138168
|-------|------------|
169+
| CLI exploration failure | Skip angle, continue with remaining; fallback gemini → claude |
139170
| Planning phase failure | Display error, offer retry |
140-
| executionContext missing | Error: planning phase did not produce context |
171+
| tasks.jsonl missing | Error: planning phase did not produce output |
141172
| Phase file not found | Error with file path for debugging |
142173
143174
## Related Skills
144175
176+
- Collaborative planning: `../collaborative-plan-with-file/SKILL.md`
177+
- Unified execution: `../unified-execute-with-file/SKILL.md`
145178
- Full planning workflow: `../workflow-plan-execute/SKILL.md`
146-
- Brainstorming: `../workflow-brainstorm-auto-parallel/SKILL.md`

0 commit comments

Comments
 (0)