mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
- Implemented `prep-loop.md` for ccw-loop, detailing source discovery, validation, task transformation, and auto-loop configuration. - Created `prep-plan.md` for workflow planning, covering environment checks, task quality assessment, execution preferences, and final confirmation. - Defined schemas and integration points for `prep-package.json` in both ccw-loop and workflow-plan skills, ensuring proper validation and task handling. - Added error handling mechanisms for various scenarios during the preparation phases.
3.5 KiB
3.5 KiB
Phase 0: Prep Package Schema & Integration
Schema reference for prep-package.json consumed by ccw-loop Phase 1. Generated by interactive prompt /prompts:prep-loop.
prep-package.json Schema
{
"version": "1.0.0",
"generated_at": "ISO8601 (UTC+8)",
"prep_status": "ready | cancelled | needs_refinement",
"target_skill": "ccw-loop",
"environment": {
"project_root": "absolute path",
"tech_stack": "string",
"test_framework": "string"
},
"source": {
"tool": "collaborative-plan-with-file | analyze-with-file | brainstorm-to-cycle | manual",
"session_id": "string",
"jsonl_path": "absolute path to original JSONL",
"task_count": "number",
"tasks_with_convergence": "number"
},
"tasks": {
"total": "number",
"by_priority": { "high": 0, "medium": 0, "low": 0 },
"by_type": { "feature": 0, "fix": 0, "refactor": 0, "enhancement": 0, "testing": 0 }
},
"auto_loop": {
"enabled": true,
"no_confirmation": true,
"max_iterations": 10,
"timeout_per_action_ms": 600000
}
}
prep-tasks.jsonl Schema
One task per line, each in ccw-loop develop.tasks[] format with extended fields:
{
"id": "task-001",
"description": "Title: detailed description",
"tool": "gemini",
"mode": "write",
"status": "pending",
"priority": 1,
"files_changed": ["path/to/file.ts"],
"created_at": "ISO8601",
"completed_at": null,
"_source": { "tool": "collaborative-plan-with-file", "session_id": "...", "original_id": "TASK-001" },
"_convergence": { "criteria": ["..."], "verification": "...", "definition_of_done": "..." },
"_type": "feature",
"_effort": "medium",
"_depends_on": []
}
Validation Rules
| # | Check | Condition | On Failure |
|---|---|---|---|
| 1 | prep_status | === "ready" |
Skip prep, use default INIT |
| 2 | target_skill | === "ccw-loop" |
Skip prep, use default INIT |
| 3 | project_root | Matches current projectRoot |
Skip prep, warn mismatch |
| 4 | freshness | generated_at within 24h |
Skip prep, warn stale |
| 5 | tasks file | prep-tasks.jsonl exists and readable |
Skip prep, use default INIT |
| 6 | tasks content | At least 1 valid task line in JSONL | Skip prep, use default INIT |
Integration Points
Phase 1: Session Initialization
// Load prep-package.json (generated by /prompts:prep-loop)
let prepPackage = null
const prepPath = `${projectRoot}/.workflow/.loop/prep-package.json`
if (fs.existsSync(prepPath)) {
const raw = JSON.parse(Read(prepPath))
const checks = validateLoopPrepPackage(raw, projectRoot)
if (checks.valid) {
prepPackage = raw
// Load pre-built tasks from prep-tasks.jsonl
const tasksPath = `${projectRoot}/.workflow/.loop/prep-tasks.jsonl`
const prepTasks = loadPrepTasks(tasksPath)
// → Inject into state.skill_state.develop.tasks
// → Set max_iterations from auto_loop config
} else {
console.warn(`⚠ Prep package failed validation, using default INIT`)
prepPackage = null
}
}
INIT Action (action-init.md)
When prep tasks are loaded:
- Skip Step 3 (Analyze Task and Generate Tasks) — tasks already provided
- Use prep tasks directly in Step 5 (Update State)
- Preserve
_convergencefields for VALIDATE action reference
VALIDATE Action
When _convergence exists on a task:
- Use
convergence.verificationas validation command/steps - Use
convergence.criteriaas pass/fail conditions - Fall back to default test validation if
_convergenceis null