Skip to content

Commit 113bee5

Browse files
author
catlog22
committed
feat: Enhance parallel-dev-cycle with prep-package integration
- Added argument parsing and prep package loading in session initialization. - Implemented validation checks for prep-package.json integrity. - Integrated prep package data into cycle state, including task refinement and auto-iteration settings. - Updated agent execution to utilize source references and focus directives from prep package. - Modified context gathering and test context generation to reference active workflow paths. - Introduced a new interactive prompt for pre-flight checklist and task quality assessment. - Created a detailed schema and integration specification for prep-package.json. - Ensured all relevant phases validate and utilize the prep package effectively.
1 parent afd9729 commit 113bee5

13 files changed

Lines changed: 801 additions & 42 deletions

File tree

.codex/prompts/prep-cycle.md

Lines changed: 418 additions & 0 deletions
Large diffs are not rendered by default.

.codex/skills/analyze-with-file/EXECUTE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ if (!autoYes) {
302302
options: [
303303
{ label: "Start Execution", description: "Execute all tasks serially" },
304304
{ label: "Adjust Tasks", description: "Modify, reorder, or remove tasks" },
305-
{ label: "Cancel", description: "Cancel execution, keep execution-plan.jsonl" }
305+
{ label: "Cancel", description: "Cancel execution, keep tasks.jsonl" }
306306
]
307307
}]
308308
})
309-
// "Adjust Tasks": display task list, user deselects/reorders, regenerate execution-plan.jsonl
309+
// "Adjust Tasks": display task list, user deselects/reorders, regenerate tasks.jsonl
310310
// "Cancel": end workflow, keep artifacts
311311
}
312312
```
@@ -321,7 +321,7 @@ Execute tasks one by one directly using tools (Read, Edit, Write, Grep, Glob, Ba
321321

322322
```
323323
For each taskId in executionOrder:
324-
├─ Load task from execution-plan.jsonl
324+
├─ Load task from tasks.jsonl
325325
├─ Check dependencies satisfied (all deps completed)
326326
├─ Record START event to execution-events.md
327327
├─ Execute task directly:

.codex/skills/analyze-with-file/SKILL.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Step 4: Synthesis & Conclusion
8282
└─ Offer options: quick execute / create issue / generate task / export / done
8383
8484
Step 5: Quick Execute (Optional - user selects)
85-
├─ Convert conclusions.recommendations → execution-plan.jsonl (with convergence)
85+
├─ Convert conclusions.recommendations → tasks.jsonl (unified JSONL with convergence)
8686
├─ Pre-execution analysis (dependencies, file conflicts, execution order)
8787
├─ User confirmation
8888
├─ Direct inline execution (Read/Edit/Write/Grep/Glob/Bash)
@@ -581,13 +581,13 @@ if (!autoYes) {
581581

582582
**Key Principle**: No additional exploration — analysis phase has already collected all necessary context. No CLI delegation — execute directly using tools.
583583

584-
**Flow**: `conclusions.json → execution-plan.jsonl → User Confirmation → Direct Inline Execution → execution.md + execution-events.md`
584+
**Flow**: `conclusions.json → tasks.jsonl → User Confirmation → Direct Inline Execution → execution.md + execution-events.md`
585585

586586
**Full specification**: See `EXECUTE.md` for detailed step-by-step implementation.
587587

588-
##### Step 5.1: Generate execution-plan.jsonl
588+
##### Step 5.1: Generate tasks.jsonl
589589

590-
Convert `conclusions.recommendations` into JSONL execution list. Each line is a self-contained task with convergence criteria:
590+
Convert `conclusions.recommendations` into unified JSONL task format. Each line is a self-contained task with convergence criteria:
591591

592592
```javascript
593593
const conclusions = JSON.parse(Read(`${sessionFolder}/conclusions.json`))
@@ -603,22 +603,28 @@ const tasks = conclusions.recommendations.map((rec, index) => ({
603603
description: rec.rationale,
604604
type: inferTaskType(rec), // fix | refactor | feature | enhancement | testing
605605
priority: rec.priority,
606-
files_to_modify: extractFilesFromEvidence(rec, explorations),
606+
effort: inferEffort(rec), // small | medium | large
607+
files: extractFilesFromEvidence(rec, explorations).map(f => ({
608+
path: f,
609+
action: 'modify'
610+
})),
607611
depends_on: [],
608612
convergence: {
609613
criteria: generateCriteria(rec), // Testable conditions
610614
verification: generateVerification(rec), // Executable command or steps
611615
definition_of_done: generateDoD(rec) // Business language
612616
},
613-
context: {
614-
source_conclusions: conclusions.key_conclusions,
615-
evidence: rec.evidence || []
617+
evidence: rec.evidence || [],
618+
source: {
619+
tool: 'analyze-with-file',
620+
session_id: sessionId,
621+
original_id: `TASK-${String(index + 1).padStart(3, '0')}`
616622
}
617623
}))
618624

619625
// Validate convergence quality (same as req-plan-with-file)
620626
// Write one task per line
621-
Write(`${sessionFolder}/execution-plan.jsonl`, tasks.map(t => JSON.stringify(t)).join('\n'))
627+
Write(`${sessionFolder}/tasks.jsonl`, tasks.map(t => JSON.stringify(t)).join('\n'))
622628
```
623629

624630
##### Step 5.2: Pre-Execution Analysis
@@ -641,7 +647,7 @@ if (!autoYes) {
641647
options: [
642648
{ label: "Start Execution", description: "Execute all tasks serially" },
643649
{ label: "Adjust Tasks", description: "Modify, reorder, or remove tasks" },
644-
{ label: "Cancel", description: "Cancel execution, keep execution-plan.jsonl" }
650+
{ label: "Cancel", description: "Cancel execution, keep tasks.jsonl" }
645651
]
646652
}]
647653
})
@@ -664,7 +670,7 @@ For each task in execution order:
664670

665671
- Update `execution.md` with final summary (statistics, task results table)
666672
- Finalize `execution-events.md` with session footer
667-
- Update `execution-plan.jsonl` with execution results per task
673+
- Update `tasks.jsonl` with `_execution` state per task
668674

669675
```javascript
670676
if (!autoYes) {
@@ -685,7 +691,7 @@ if (!autoYes) {
685691
```
686692

687693
**Success Criteria**:
688-
- `execution-plan.jsonl` generated with convergence criteria per task
694+
- `tasks.jsonl` generated with convergence criteria and source provenance per task
689695
- `execution.md` contains plan overview, task table, pre-execution analysis, final summary
690696
- `execution-events.md` contains chronological event stream with convergence verification
691697
- All tasks executed (or explicitly skipped) via direct inline execution
@@ -704,7 +710,7 @@ if (!autoYes) {
704710
├── explorations.json # Phase 2: Single perspective aggregated findings
705711
├── perspectives.json # Phase 2: Multi-perspective findings with synthesis
706712
├── conclusions.json # Phase 4: Final synthesis with recommendations
707-
├── execution-plan.jsonl # Phase 5: JSONL execution list with convergence (if quick execute)
713+
├── tasks.jsonl # Phase 5: Unified JSONL with convergence + source (if quick execute)
708714
├── execution.md # Phase 5: Execution overview + task table + summary (if quick execute)
709715
└── execution-events.md # Phase 5: Chronological event log (if quick execute)
710716
```
@@ -717,7 +723,7 @@ if (!autoYes) {
717723
| `explorations.json` | 2 | Single perspective aggregated findings |
718724
| `perspectives.json` | 2 | Multi-perspective findings with cross-perspective synthesis |
719725
| `conclusions.json` | 4 | Final synthesis: conclusions, recommendations, open questions |
720-
| `execution-plan.jsonl` | 5 | JSONL execution list from recommendations, each line with convergence criteria |
726+
| `tasks.jsonl` | 5 | Unified JSONL from recommendations, each line with convergence criteria and source provenance |
721727
| `execution.md` | 5 | Execution overview: plan source, task table, pre-execution analysis, final summary |
722728
| `execution-events.md` | 5 | Chronological event stream with task details and convergence verification |
723729

@@ -861,7 +867,7 @@ Remaining questions or areas for investigation
861867
| Session folder conflict | Append timestamp suffix | Create unique folder and continue |
862868
| Quick execute: task fails | Record failure in execution-events.md | User can retry, skip, or abort |
863869
| Quick execute: verification fails | Mark criterion as unverified, continue | Note in events, manual check |
864-
| Quick execute: no recommendations | Cannot generate execution-plan.jsonl | Suggest using lite-plan instead |
870+
| Quick execute: no recommendations | Cannot generate tasks.jsonl | Suggest using lite-plan instead |
865871

866872
## Best Practices
867873

.codex/skills/parallel-dev-cycle/SKILL.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ Each agent **maintains one main document** (e.g., requirements.md, plan.json, im
7474

7575
When `--auto`: Run all phases sequentially without user confirmation between iterations. Use recommended defaults for all decisions. Automatically continue iteration loop until tests pass or max iterations reached.
7676

77+
## Prep Package Integration
78+
79+
When `prep-package.json` exists at `{projectRoot}/.workflow/.cycle/prep-package.json`, Phase 1 consumes it to:
80+
- Use refined task description instead of raw TASK
81+
- Apply auto-iteration config (convergence criteria, phase gates)
82+
- Inject per-iteration agent focus directives (0→1 vs 1→100)
83+
84+
Prep packages are generated by the interactive prompt `/prompts:prep-cycle`. See [phases/00-prep-checklist.md](phases/00-prep-checklist.md) for schema.
85+
7786
## Execution Flow
7887

7988
```
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
# Prep Package Schema & Integration Spec
2+
3+
Schema definition for `prep-package.json` and integration points with the parallel-dev-cycle skill.
4+
5+
## File Location
6+
7+
```
8+
{projectRoot}/.workflow/.cycle/prep-package.json
9+
```
10+
11+
Generated by: `/prompts:prep-cycle` (interactive prompt)
12+
Consumed by: Phase 1 (Session Initialization)
13+
14+
## JSON Schema
15+
16+
```json
17+
{
18+
"version": "1.0.0",
19+
"generated_at": "ISO8601",
20+
"prep_status": "ready | needs_refinement | blocked",
21+
22+
"environment": {
23+
"project_root": "/path/to/project",
24+
"prerequisites": {
25+
"required_passed": true,
26+
"recommended_passed": true,
27+
"warnings": ["string"]
28+
},
29+
"tech_stack": "string (e.g. Express.js + TypeORM + PostgreSQL)",
30+
"test_framework": "string (e.g. jest, vitest, pytest)",
31+
"has_project_tech": true,
32+
"has_project_guidelines": true
33+
},
34+
35+
"task": {
36+
"original": "raw user input",
37+
"refined": "enhanced task description with all 5 dimensions",
38+
"quality_score": 8,
39+
"dimensions": {
40+
"objective": { "score": 2, "value": "..." },
41+
"success_criteria": { "score": 2, "value": "..." },
42+
"scope": { "score": 2, "value": "..." },
43+
"constraints": { "score": 1, "value": "..." },
44+
"context": { "score": 1, "value": "..." }
45+
},
46+
"source_refs": [
47+
{
48+
"path": "docs/prd.md",
49+
"type": "local_file | url | auto_detected",
50+
"status": "verified | linked | not_found",
51+
"preview": "first ~20 lines (local_file only)"
52+
}
53+
]
54+
},
55+
56+
"auto_iteration": {
57+
"enabled": true,
58+
"no_confirmation": true,
59+
"max_iterations": 5,
60+
"timeout_per_iteration_ms": 1800000,
61+
"convergence": {
62+
"test_pass_rate": 90,
63+
"coverage": 80,
64+
"max_critical_bugs": 0,
65+
"max_open_issues": 3
66+
},
67+
"phase_gates": {
68+
"zero_to_one": {
69+
"iterations": [1, 2],
70+
"exit_criteria": {
71+
"code_compiles": true,
72+
"core_test_passes": true,
73+
"min_requirements_implemented": 1
74+
}
75+
},
76+
"one_to_hundred": {
77+
"iterations": [3, 4, 5],
78+
"exit_criteria": {
79+
"test_pass_rate": 90,
80+
"coverage": 80,
81+
"critical_bugs": 0
82+
}
83+
}
84+
},
85+
"agent_focus": {
86+
"zero_to_one": {
87+
"ra": "core_requirements_only",
88+
"ep": "minimal_viable_architecture",
89+
"cd": "happy_path_first",
90+
"vas": "smoke_tests_only"
91+
},
92+
"one_to_hundred": {
93+
"ra": "full_requirements_with_nfr",
94+
"ep": "refined_architecture_with_risks",
95+
"cd": "complete_implementation_with_error_handling",
96+
"vas": "full_test_suite_with_coverage"
97+
}
98+
}
99+
}
100+
}
101+
```
102+
103+
## Phase 1 Integration (Consume & Check)
104+
105+
Phase 1 对 prep-package.json 执行 **6 项验证**,全部通过才加载,任一失败回退默认行为:
106+
107+
| # | 检查项 | 条件 | 失败处理 |
108+
|---|--------|------|----------|
109+
| 1 | prep_status | `=== "ready"` | 跳过 prep |
110+
| 2 | project_root | 与当前 projectRoot 一致 | 跳过 prep(防错误项目) |
111+
| 3 | quality_score | `>= 6` | 跳过 prep(任务质量不达标) |
112+
| 4 | 时效性 | generated_at 在 24h 以内 | 跳过 prep(可能过期) |
113+
| 5 | 必需字段 | task.refined, convergence, phase_gates, agent_focus 全部存在 | 跳过 prep |
114+
| 6 | 收敛值合法 | test_pass_rate/coverage 为 0-100 的数字 | 跳过 prep |
115+
116+
```javascript
117+
// In 01-session-init.md, Step 1.1:
118+
const prepPath = `${projectRoot}/.workflow/.cycle/prep-package.json`
119+
if (fs.existsSync(prepPath)) {
120+
const raw = JSON.parse(Read(prepPath))
121+
const checks = validatePrepPackage(raw, projectRoot)
122+
123+
if (checks.valid) {
124+
prepPackage = raw
125+
task = prepPackage.task.refined
126+
// Inject into state:
127+
state.convergence = prepPackage.auto_iteration.convergence
128+
state.phase_gates = prepPackage.auto_iteration.phase_gates
129+
state.agent_focus = prepPackage.auto_iteration.agent_focus
130+
state.max_iterations = prepPackage.auto_iteration.max_iterations
131+
} else {
132+
console.warn('Prep package validation failed, using defaults')
133+
// prepPackage remains null → no convergence/phase_gates/agent_focus
134+
}
135+
}
136+
```
137+
138+
## Phase 2 Integration (Agent Focus Directives)
139+
140+
```javascript
141+
// Before spawning each agent, append focus directive:
142+
function getAgentFocusDirective(agentName, state) {
143+
if (!state.phase_gates) return ""
144+
const iteration = state.current_iteration
145+
const isZeroToOne = state.phase_gates.zero_to_one.iterations.includes(iteration)
146+
const focus = isZeroToOne
147+
? state.agent_focus.zero_to_one[agentName]
148+
: state.agent_focus.one_to_hundred[agentName]
149+
150+
const directives = {
151+
core_requirements_only: "Focus ONLY on core functional requirements. Skip NFRs and edge cases.",
152+
minimal_viable_architecture: "Design the simplest working architecture. Skip optimization.",
153+
happy_path_first: "Implement ONLY the happy path. Skip error handling and edge cases.",
154+
smoke_tests_only: "Run smoke tests only. Skip coverage analysis and exhaustive validation.",
155+
full_requirements_with_nfr: "Complete requirements including NFRs, edge cases, security.",
156+
refined_architecture_with_risks: "Refine architecture with risk mitigation and scalability.",
157+
complete_implementation_with_error_handling: "Complete all tasks with error handling and validation.",
158+
full_test_suite_with_coverage: "Full test suite with coverage report and quality audit."
159+
}
160+
return `\n## FOCUS DIRECTIVE (${isZeroToOne ? '0→1' : '1→100'})\n${directives[focus] || ''}\n`
161+
}
162+
```
163+
164+
## Phase 3 Integration (Convergence Evaluation)
165+
166+
```javascript
167+
// In 03-result-aggregation.md, Step 3.4:
168+
function evaluateConvergence(parsedResults, state) {
169+
if (!state.phase_gates) {
170+
// No prep package: use default issue detection
171+
return { converged: !parsedResults.vas.issues?.length, phase: "default" }
172+
}
173+
const iteration = state.current_iteration
174+
const isZeroToOne = state.phase_gates.zero_to_one.iterations.includes(iteration)
175+
176+
if (isZeroToOne) {
177+
return {
178+
converged: parsedResults.cd.status !== 'failed'
179+
&& (parsedResults.vas.test_pass_rate > 0 || parsedResults.cd.tests_passing),
180+
phase: "0→1"
181+
}
182+
}
183+
const conv = state.convergence
184+
return {
185+
converged: (parsedResults.vas.test_pass_rate || 0) >= conv.test_pass_rate
186+
&& (parsedResults.vas.coverage || 0) >= conv.coverage
187+
&& (parsedResults.vas.critical_issues || 0) <= conv.max_critical_bugs,
188+
phase: "1→100"
189+
}
190+
}
191+
```

0 commit comments

Comments
 (0)