claude-code-workflow 6.3.37 → 6.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/workflow/lite-execute.md +2 -0
- package/.codex/agents/action-planning-agent.md +885 -0
- package/.codex/agents/ccw-loop-b-complete.md +227 -0
- package/.codex/agents/ccw-loop-b-debug.md +172 -0
- package/.codex/agents/ccw-loop-b-develop.md +147 -0
- package/.codex/agents/ccw-loop-b-init.md +82 -0
- package/.codex/agents/ccw-loop-b-validate.md +204 -0
- package/.codex/agents/ccw-loop-executor.md +260 -0
- package/.codex/agents/cli-discuss-agent.md +391 -0
- package/.codex/agents/cli-execution-agent.md +333 -0
- package/.codex/agents/cli-explore-agent.md +186 -0
- package/.codex/agents/cli-lite-planning-agent.md +736 -0
- package/.codex/agents/cli-planning-agent.md +562 -0
- package/.codex/agents/code-developer.md +408 -0
- package/.codex/agents/conceptual-planning-agent.md +321 -0
- package/.codex/agents/context-search-agent.md +585 -0
- package/.codex/agents/debug-explore-agent.md +436 -0
- package/.codex/agents/doc-generator.md +334 -0
- package/.codex/agents/issue-plan-agent.md +417 -0
- package/.codex/agents/issue-queue-agent.md +311 -0
- package/.codex/agents/memory-bridge.md +96 -0
- package/.codex/agents/test-context-search-agent.md +402 -0
- package/.codex/agents/test-fix-agent.md +359 -0
- package/.codex/agents/ui-design-agent.md +595 -0
- package/.codex/agents/universal-executor.md +135 -0
- package/.codex/prompts/clean.md +409 -0
- package/.codex/prompts/issue-discover-by-prompt.md +364 -0
- package/.codex/prompts/issue-discover.md +261 -0
- package/.codex/prompts/issue-execute.md +10 -0
- package/.codex/prompts/issue-new.md +285 -0
- package/.codex/prompts/issue-plan.md +161 -63
- package/.codex/prompts/issue-queue.md +298 -288
- package/.codex/prompts/lite-execute.md +627 -133
- package/.codex/prompts/lite-fix.md +670 -0
- package/.codex/prompts/lite-plan-a.md +337 -0
- package/.codex/prompts/lite-plan-b.md +485 -0
- package/.codex/prompts/{lite-plan.md → lite-plan-c.md} +601 -469
- package/.codex/skills/ccw-loop/README.md +171 -0
- package/.codex/skills/ccw-loop/SKILL.md +349 -0
- package/.codex/skills/ccw-loop/phases/actions/action-complete.md +269 -0
- package/.codex/skills/ccw-loop/phases/actions/action-debug.md +286 -0
- package/.codex/skills/ccw-loop/phases/actions/action-develop.md +183 -0
- package/.codex/skills/ccw-loop/phases/actions/action-init.md +164 -0
- package/.codex/skills/ccw-loop/phases/actions/action-menu.md +205 -0
- package/.codex/skills/ccw-loop/phases/actions/action-validate.md +250 -0
- package/.codex/skills/ccw-loop/phases/orchestrator.md +416 -0
- package/.codex/skills/ccw-loop/phases/state-schema.md +388 -0
- package/.codex/skills/ccw-loop/specs/action-catalog.md +182 -0
- package/.codex/skills/ccw-loop-b/README.md +301 -0
- package/.codex/skills/ccw-loop-b/SKILL.md +322 -0
- package/.codex/skills/ccw-loop-b/phases/orchestrator.md +257 -0
- package/.codex/skills/ccw-loop-b/phases/state-schema.md +181 -0
- package/.codex/skills/ccw-loop-b/specs/action-catalog.md +383 -0
- package/.codex/skills/parallel-dev-cycle/README.md +382 -0
- package/.codex/skills/parallel-dev-cycle/SKILL.md +512 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +242 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/exploration-planner.md +285 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +285 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/validation-archivist.md +381 -0
- package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +696 -0
- package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +436 -0
- package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +423 -0
- package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +391 -0
- package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +330 -0
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +4 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +39 -8
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +3 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +107 -0
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/commands/upgrade.js +1 -1
- package/ccw/dist/commands/upgrade.js.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.js +3 -2
- package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.js +2 -5
- package/ccw/dist/core/memory-embedder-bridge.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +7 -6
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js +2 -2
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
- package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/graph-routes.js +17 -2
- package/ccw/dist/core/routes/graph-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/issue-routes.js +280 -33
- package/ccw/dist/core/routes/issue-routes.js.map +1 -1
- package/ccw/dist/core/routes/loop-v2-routes.d.ts +9 -0
- package/ccw/dist/core/routes/loop-v2-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/loop-v2-routes.js +56 -4
- package/ccw/dist/core/routes/loop-v2-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +3 -2
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +5 -3
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +4 -3
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/cli-config-manager.d.ts +1 -0
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
- package/ccw/dist/tools/cli-config-manager.js +2 -1
- package/ccw/dist/tools/cli-config-manager.js.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.js +2 -5
- package/ccw/dist/tools/codex-lens-lsp.js.map +1 -1
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +22 -32
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/dist/tools/litellm-client.d.ts +6 -0
- package/ccw/dist/tools/litellm-client.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-client.js +15 -2
- package/ccw/dist/tools/litellm-client.js.map +1 -1
- package/ccw/dist/tools/loop-task-manager.d.ts +13 -2
- package/ccw/dist/tools/loop-task-manager.d.ts.map +1 -1
- package/ccw/dist/tools/loop-task-manager.js.map +1 -1
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
- package/ccw/dist/tools/native-session-discovery.js +35 -7
- package/ccw/dist/tools/native-session-discovery.js.map +1 -1
- package/ccw/dist/utils/codexlens-path.d.ts +36 -0
- package/ccw/dist/utils/codexlens-path.d.ts.map +1 -0
- package/ccw/dist/utils/codexlens-path.js +56 -0
- package/ccw/dist/utils/codexlens-path.js.map +1 -0
- package/ccw/dist/utils/uv-manager.d.ts.map +1 -1
- package/ccw/dist/utils/uv-manager.js +3 -2
- package/ccw/dist/utils/uv-manager.js.map +1 -1
- package/ccw/src/cli.ts +4 -0
- package/ccw/src/commands/install.ts +51 -8
- package/ccw/src/commands/issue.ts +119 -0
- package/ccw/src/commands/upgrade.ts +1 -1
- package/ccw/src/config/litellm-api-config-manager.ts +3 -2
- package/ccw/src/core/memory-embedder-bridge.ts +2 -6
- package/ccw/src/core/routes/cli-routes.ts +1 -1
- package/ccw/src/core/routes/codexlens/config-handlers.ts +7 -6
- package/ccw/src/core/routes/codexlens/semantic-handlers.ts +2 -2
- package/ccw/src/core/routes/graph-routes.ts +18 -2
- package/ccw/src/core/routes/issue-routes.ts +308 -33
- package/ccw/src/core/routes/loop-v2-routes.ts +64 -6
- package/ccw/src/core/routes/system-routes.ts +3 -2
- package/ccw/src/core/server.ts +6 -3
- package/ccw/src/templates/dashboard-css/02-session.css +2 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +103 -1
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +32 -0
- package/ccw/src/templates/dashboard-js/components/cli-history.js +48 -48
- package/ccw/src/templates/dashboard-js/components/navigation.js +6 -0
- package/ccw/src/templates/dashboard-js/components/notifications.js +6 -0
- package/ccw/src/templates/dashboard-js/components/version-check.js +38 -0
- package/ccw/src/templates/dashboard-js/i18n.js +126 -0
- package/ccw/src/templates/dashboard-js/state.js +2 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +1 -1
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +183 -1
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +55 -11
- package/ccw/src/templates/dashboard-js/views/loop-monitor.js +112 -11
- package/ccw/src/templates/dashboard.html +48 -2
- package/ccw/src/tools/claude-cli-tools.ts +4 -3
- package/ccw/src/tools/cli-config-manager.ts +3 -1
- package/ccw/src/tools/codex-lens-lsp.ts +2 -5
- package/ccw/src/tools/codex-lens.ts +27 -38
- package/ccw/src/tools/litellm-client.ts +16 -2
- package/ccw/src/tools/loop-task-manager.ts +13 -2
- package/ccw/src/tools/native-session-discovery.ts +38 -7
- package/ccw/src/utils/codexlens-path.ts +60 -0
- package/ccw/src/utils/uv-manager.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
# State Schema (Codex Version)
|
|
2
|
+
|
|
3
|
+
CCW Loop state structure definition for Codex subagent pattern.
|
|
4
|
+
|
|
5
|
+
## State File
|
|
6
|
+
|
|
7
|
+
**Location**: `.workflow/.loop/{loopId}.json` (unified location, API + Skill shared)
|
|
8
|
+
|
|
9
|
+
## Structure Definition
|
|
10
|
+
|
|
11
|
+
### Unified Loop State Interface
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
/**
|
|
15
|
+
* Unified Loop State - API and Skill shared state structure
|
|
16
|
+
* API (loop-v2-routes.ts) owns state control
|
|
17
|
+
* Skill (ccw-loop) reads and updates this state via subagent
|
|
18
|
+
*/
|
|
19
|
+
interface LoopState {
|
|
20
|
+
// =====================================================
|
|
21
|
+
// API FIELDS (from loop-v2-routes.ts)
|
|
22
|
+
// These fields are managed by API, Skill read-only
|
|
23
|
+
// =====================================================
|
|
24
|
+
|
|
25
|
+
loop_id: string // Loop ID, e.g., "loop-v2-20260122-abc123"
|
|
26
|
+
title: string // Loop title
|
|
27
|
+
description: string // Loop description
|
|
28
|
+
max_iterations: number // Maximum iteration count
|
|
29
|
+
status: 'created' | 'running' | 'paused' | 'completed' | 'failed' | 'user_exit'
|
|
30
|
+
current_iteration: number // Current iteration count
|
|
31
|
+
created_at: string // Creation time (ISO8601)
|
|
32
|
+
updated_at: string // Last update time (ISO8601)
|
|
33
|
+
completed_at?: string // Completion time (ISO8601)
|
|
34
|
+
failure_reason?: string // Failure reason
|
|
35
|
+
|
|
36
|
+
// =====================================================
|
|
37
|
+
// SKILL EXTENSION FIELDS
|
|
38
|
+
// These fields are managed by Skill executor agent
|
|
39
|
+
// =====================================================
|
|
40
|
+
|
|
41
|
+
skill_state?: {
|
|
42
|
+
// Current execution action
|
|
43
|
+
current_action: 'init' | 'develop' | 'debug' | 'validate' | 'complete' | null
|
|
44
|
+
last_action: string | null
|
|
45
|
+
completed_actions: string[]
|
|
46
|
+
mode: 'interactive' | 'auto'
|
|
47
|
+
|
|
48
|
+
// === Development Phase ===
|
|
49
|
+
develop: {
|
|
50
|
+
total: number
|
|
51
|
+
completed: number
|
|
52
|
+
current_task?: string
|
|
53
|
+
tasks: DevelopTask[]
|
|
54
|
+
last_progress_at: string | null
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// === Debug Phase ===
|
|
58
|
+
debug: {
|
|
59
|
+
active_bug?: string
|
|
60
|
+
hypotheses_count: number
|
|
61
|
+
hypotheses: Hypothesis[]
|
|
62
|
+
confirmed_hypothesis: string | null
|
|
63
|
+
iteration: number
|
|
64
|
+
last_analysis_at: string | null
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// === Validation Phase ===
|
|
68
|
+
validate: {
|
|
69
|
+
pass_rate: number // Test pass rate (0-100)
|
|
70
|
+
coverage: number // Coverage (0-100)
|
|
71
|
+
test_results: TestResult[]
|
|
72
|
+
passed: boolean
|
|
73
|
+
failed_tests: string[]
|
|
74
|
+
last_run_at: string | null
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// === Error Tracking ===
|
|
78
|
+
errors: Array<{
|
|
79
|
+
action: string
|
|
80
|
+
message: string
|
|
81
|
+
timestamp: string
|
|
82
|
+
}>
|
|
83
|
+
|
|
84
|
+
// === Summary (after completion) ===
|
|
85
|
+
summary?: {
|
|
86
|
+
duration: number
|
|
87
|
+
iterations: number
|
|
88
|
+
develop: object
|
|
89
|
+
debug: object
|
|
90
|
+
validate: object
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface DevelopTask {
|
|
96
|
+
id: string
|
|
97
|
+
description: string
|
|
98
|
+
tool: 'gemini' | 'qwen' | 'codex' | 'bash'
|
|
99
|
+
mode: 'analysis' | 'write'
|
|
100
|
+
status: 'pending' | 'in_progress' | 'completed' | 'failed'
|
|
101
|
+
files_changed: string[]
|
|
102
|
+
created_at: string
|
|
103
|
+
completed_at: string | null
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
interface Hypothesis {
|
|
107
|
+
id: string // H1, H2, ...
|
|
108
|
+
description: string
|
|
109
|
+
testable_condition: string
|
|
110
|
+
logging_point: string
|
|
111
|
+
evidence_criteria: {
|
|
112
|
+
confirm: string
|
|
113
|
+
reject: string
|
|
114
|
+
}
|
|
115
|
+
likelihood: number // 1 = most likely
|
|
116
|
+
status: 'pending' | 'confirmed' | 'rejected' | 'inconclusive'
|
|
117
|
+
evidence: Record<string, any> | null
|
|
118
|
+
verdict_reason: string | null
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface TestResult {
|
|
122
|
+
test_name: string
|
|
123
|
+
suite: string
|
|
124
|
+
status: 'passed' | 'failed' | 'skipped'
|
|
125
|
+
duration_ms: number
|
|
126
|
+
error_message: string | null
|
|
127
|
+
stack_trace: string | null
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Initial State
|
|
132
|
+
|
|
133
|
+
### Created by API (Dashboard Trigger)
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"loop_id": "loop-v2-20260122-abc123",
|
|
138
|
+
"title": "Implement user authentication",
|
|
139
|
+
"description": "Add login/logout functionality",
|
|
140
|
+
"max_iterations": 10,
|
|
141
|
+
"status": "created",
|
|
142
|
+
"current_iteration": 0,
|
|
143
|
+
"created_at": "2026-01-22T10:00:00+08:00",
|
|
144
|
+
"updated_at": "2026-01-22T10:00:00+08:00"
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### After Skill Initialization (INIT action)
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{
|
|
152
|
+
"loop_id": "loop-v2-20260122-abc123",
|
|
153
|
+
"title": "Implement user authentication",
|
|
154
|
+
"description": "Add login/logout functionality",
|
|
155
|
+
"max_iterations": 10,
|
|
156
|
+
"status": "running",
|
|
157
|
+
"current_iteration": 0,
|
|
158
|
+
"created_at": "2026-01-22T10:00:00+08:00",
|
|
159
|
+
"updated_at": "2026-01-22T10:00:05+08:00",
|
|
160
|
+
|
|
161
|
+
"skill_state": {
|
|
162
|
+
"current_action": "init",
|
|
163
|
+
"last_action": null,
|
|
164
|
+
"completed_actions": [],
|
|
165
|
+
"mode": "auto",
|
|
166
|
+
|
|
167
|
+
"develop": {
|
|
168
|
+
"total": 3,
|
|
169
|
+
"completed": 0,
|
|
170
|
+
"current_task": null,
|
|
171
|
+
"tasks": [
|
|
172
|
+
{ "id": "task-001", "description": "Create auth component", "status": "pending" }
|
|
173
|
+
],
|
|
174
|
+
"last_progress_at": null
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
"debug": {
|
|
178
|
+
"active_bug": null,
|
|
179
|
+
"hypotheses_count": 0,
|
|
180
|
+
"hypotheses": [],
|
|
181
|
+
"confirmed_hypothesis": null,
|
|
182
|
+
"iteration": 0,
|
|
183
|
+
"last_analysis_at": null
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
"validate": {
|
|
187
|
+
"pass_rate": 0,
|
|
188
|
+
"coverage": 0,
|
|
189
|
+
"test_results": [],
|
|
190
|
+
"passed": false,
|
|
191
|
+
"failed_tests": [],
|
|
192
|
+
"last_run_at": null
|
|
193
|
+
},
|
|
194
|
+
|
|
195
|
+
"errors": []
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Control Signal Checking (Codex Pattern)
|
|
201
|
+
|
|
202
|
+
Agent checks control signals at start of every action:
|
|
203
|
+
|
|
204
|
+
```javascript
|
|
205
|
+
/**
|
|
206
|
+
* Check API control signals
|
|
207
|
+
* MUST be called at start of every action
|
|
208
|
+
* @returns { continue: boolean, action: 'pause_exit' | 'stop_exit' | 'continue' }
|
|
209
|
+
*/
|
|
210
|
+
function checkControlSignals(loopId) {
|
|
211
|
+
const state = JSON.parse(Read(`.workflow/.loop/${loopId}.json`))
|
|
212
|
+
|
|
213
|
+
switch (state.status) {
|
|
214
|
+
case 'paused':
|
|
215
|
+
// API paused the loop, Skill should exit and wait for resume
|
|
216
|
+
return { continue: false, action: 'pause_exit' }
|
|
217
|
+
|
|
218
|
+
case 'failed':
|
|
219
|
+
// API stopped the loop (user manual stop)
|
|
220
|
+
return { continue: false, action: 'stop_exit' }
|
|
221
|
+
|
|
222
|
+
case 'running':
|
|
223
|
+
// Normal continue
|
|
224
|
+
return { continue: true, action: 'continue' }
|
|
225
|
+
|
|
226
|
+
default:
|
|
227
|
+
// Abnormal status
|
|
228
|
+
return { continue: false, action: 'stop_exit' }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## State Transitions
|
|
234
|
+
|
|
235
|
+
### 1. Initialization (INIT action)
|
|
236
|
+
|
|
237
|
+
```javascript
|
|
238
|
+
{
|
|
239
|
+
status: 'created' -> 'running', // Or keep 'running' if API already set
|
|
240
|
+
updated_at: timestamp,
|
|
241
|
+
|
|
242
|
+
skill_state: {
|
|
243
|
+
current_action: 'init',
|
|
244
|
+
mode: 'auto',
|
|
245
|
+
develop: {
|
|
246
|
+
tasks: [...parsed_tasks],
|
|
247
|
+
total: N,
|
|
248
|
+
completed: 0
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 2. Development (DEVELOP action)
|
|
255
|
+
|
|
256
|
+
```javascript
|
|
257
|
+
{
|
|
258
|
+
updated_at: timestamp,
|
|
259
|
+
current_iteration: state.current_iteration + 1,
|
|
260
|
+
|
|
261
|
+
skill_state: {
|
|
262
|
+
current_action: 'develop',
|
|
263
|
+
last_action: 'DEVELOP',
|
|
264
|
+
completed_actions: [..., 'DEVELOP'],
|
|
265
|
+
develop: {
|
|
266
|
+
current_task: 'task-xxx',
|
|
267
|
+
completed: N+1,
|
|
268
|
+
last_progress_at: timestamp
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### 3. Debugging (DEBUG action)
|
|
275
|
+
|
|
276
|
+
```javascript
|
|
277
|
+
{
|
|
278
|
+
updated_at: timestamp,
|
|
279
|
+
current_iteration: state.current_iteration + 1,
|
|
280
|
+
|
|
281
|
+
skill_state: {
|
|
282
|
+
current_action: 'debug',
|
|
283
|
+
last_action: 'DEBUG',
|
|
284
|
+
debug: {
|
|
285
|
+
active_bug: '...',
|
|
286
|
+
hypotheses_count: N,
|
|
287
|
+
hypotheses: [...new_hypotheses],
|
|
288
|
+
iteration: N+1,
|
|
289
|
+
last_analysis_at: timestamp
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### 4. Validation (VALIDATE action)
|
|
296
|
+
|
|
297
|
+
```javascript
|
|
298
|
+
{
|
|
299
|
+
updated_at: timestamp,
|
|
300
|
+
current_iteration: state.current_iteration + 1,
|
|
301
|
+
|
|
302
|
+
skill_state: {
|
|
303
|
+
current_action: 'validate',
|
|
304
|
+
last_action: 'VALIDATE',
|
|
305
|
+
validate: {
|
|
306
|
+
test_results: [...results],
|
|
307
|
+
pass_rate: 95.5,
|
|
308
|
+
coverage: 85.0,
|
|
309
|
+
passed: true | false,
|
|
310
|
+
failed_tests: ['test1', 'test2'],
|
|
311
|
+
last_run_at: timestamp
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### 5. Completion (COMPLETE action)
|
|
318
|
+
|
|
319
|
+
```javascript
|
|
320
|
+
{
|
|
321
|
+
status: 'running' -> 'completed',
|
|
322
|
+
completed_at: timestamp,
|
|
323
|
+
updated_at: timestamp,
|
|
324
|
+
|
|
325
|
+
skill_state: {
|
|
326
|
+
current_action: 'complete',
|
|
327
|
+
last_action: 'COMPLETE',
|
|
328
|
+
summary: { ... }
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
## File Sync
|
|
334
|
+
|
|
335
|
+
### Unified Location
|
|
336
|
+
|
|
337
|
+
State-to-file mapping:
|
|
338
|
+
|
|
339
|
+
| State Field | Sync File | Sync Timing |
|
|
340
|
+
|-------------|-----------|-------------|
|
|
341
|
+
| Entire LoopState | `.workflow/.loop/{loopId}.json` | Every state change (master) |
|
|
342
|
+
| `skill_state.develop` | `.workflow/.loop/{loopId}.progress/develop.md` | After each dev operation |
|
|
343
|
+
| `skill_state.debug` | `.workflow/.loop/{loopId}.progress/debug.md` | After each debug operation |
|
|
344
|
+
| `skill_state.validate` | `.workflow/.loop/{loopId}.progress/validate.md` | After each validation |
|
|
345
|
+
| Code changes log | `.workflow/.loop/{loopId}.progress/changes.log` | Each file modification (NDJSON) |
|
|
346
|
+
| Debug log | `.workflow/.loop/{loopId}.progress/debug.log` | Each debug log (NDJSON) |
|
|
347
|
+
|
|
348
|
+
### File Structure
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
.workflow/.loop/
|
|
352
|
+
+-- loop-v2-20260122-abc123.json # Master state file (API + Skill)
|
|
353
|
+
+-- loop-v2-20260122-abc123.tasks.jsonl # Task list (API managed)
|
|
354
|
+
+-- loop-v2-20260122-abc123.progress/ # Skill progress files
|
|
355
|
+
+-- develop.md # Development progress
|
|
356
|
+
+-- debug.md # Debug understanding
|
|
357
|
+
+-- validate.md # Validation report
|
|
358
|
+
+-- changes.log # Code changes (NDJSON)
|
|
359
|
+
+-- debug.log # Debug log (NDJSON)
|
|
360
|
+
+-- summary.md # Completion summary
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## State Recovery
|
|
364
|
+
|
|
365
|
+
If master state file corrupted, rebuild skill_state from progress files:
|
|
366
|
+
|
|
367
|
+
```javascript
|
|
368
|
+
function rebuildSkillStateFromProgress(loopId) {
|
|
369
|
+
const progressDir = `.workflow/.loop/${loopId}.progress`
|
|
370
|
+
|
|
371
|
+
// Parse progress files to rebuild state
|
|
372
|
+
const skill_state = {
|
|
373
|
+
develop: parseProgressFile(`${progressDir}/develop.md`),
|
|
374
|
+
debug: parseProgressFile(`${progressDir}/debug.md`),
|
|
375
|
+
validate: parseProgressFile(`${progressDir}/validate.md`)
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return skill_state
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Codex Pattern Notes
|
|
383
|
+
|
|
384
|
+
1. **Agent reads state**: Agent reads `.workflow/.loop/{loopId}.json` at action start
|
|
385
|
+
2. **Agent writes state**: Agent updates state after action completion
|
|
386
|
+
3. **Orchestrator tracks iterations**: Main loop tracks `current_iteration`
|
|
387
|
+
4. **Single agent context**: All state updates in same agent conversation via send_input
|
|
388
|
+
5. **No context serialization loss**: State transitions happen in-memory within agent
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Action Catalog (Codex Version)
|
|
2
|
+
|
|
3
|
+
CCW Loop available actions and their specifications.
|
|
4
|
+
|
|
5
|
+
## Available Actions
|
|
6
|
+
|
|
7
|
+
| Action | Purpose | Preconditions | Effects | Output |
|
|
8
|
+
|--------|---------|---------------|---------|--------|
|
|
9
|
+
| INIT | Initialize session | status=running, skill_state=null | skill_state initialized | progress/*.md created |
|
|
10
|
+
| MENU | Display action menu | skill_state!=null, mode=interactive | Wait for user input | WAITING_INPUT |
|
|
11
|
+
| DEVELOP | Execute dev task | pending tasks > 0 | Update progress.md | develop.md updated |
|
|
12
|
+
| DEBUG | Hypothesis debug | needs debugging | Update understanding.md | debug.md updated |
|
|
13
|
+
| VALIDATE | Run tests | needs validation | Update validation.md | validate.md updated |
|
|
14
|
+
| COMPLETE | Finish loop | all done | status=completed | summary.md created |
|
|
15
|
+
|
|
16
|
+
## Action Flow (Codex Pattern)
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
spawn_agent (ccw-loop-executor)
|
|
20
|
+
|
|
|
21
|
+
v
|
|
22
|
+
+-------+
|
|
23
|
+
| INIT | (if skill_state is null)
|
|
24
|
+
+-------+
|
|
25
|
+
|
|
|
26
|
+
v
|
|
27
|
+
+-------+ send_input
|
|
28
|
+
| MENU | <------------- (user selection in interactive mode)
|
|
29
|
+
+-------+
|
|
30
|
+
|
|
|
31
|
+
+---+---+---+---+
|
|
32
|
+
| | | | |
|
|
33
|
+
v v v v v
|
|
34
|
+
DEV DBG VAL CMP EXIT
|
|
35
|
+
|
|
|
36
|
+
v
|
|
37
|
+
wait() -> get result
|
|
38
|
+
|
|
|
39
|
+
v
|
|
40
|
+
[Loop continues via send_input]
|
|
41
|
+
|
|
|
42
|
+
v
|
|
43
|
+
close_agent()
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Action Execution Pattern
|
|
47
|
+
|
|
48
|
+
### Single Agent Deep Interaction
|
|
49
|
+
|
|
50
|
+
All actions executed within same agent via `send_input`:
|
|
51
|
+
|
|
52
|
+
```javascript
|
|
53
|
+
// Initial spawn
|
|
54
|
+
const agent = spawn_agent({ message: role + initial_task })
|
|
55
|
+
|
|
56
|
+
// Execute INIT
|
|
57
|
+
const initResult = wait({ ids: [agent] })
|
|
58
|
+
|
|
59
|
+
// Continue with DEVELOP via send_input
|
|
60
|
+
send_input({ id: agent, message: 'Execute DEVELOP' })
|
|
61
|
+
const devResult = wait({ ids: [agent] })
|
|
62
|
+
|
|
63
|
+
// Continue with VALIDATE via send_input
|
|
64
|
+
send_input({ id: agent, message: 'Execute VALIDATE' })
|
|
65
|
+
const valResult = wait({ ids: [agent] })
|
|
66
|
+
|
|
67
|
+
// Only close when done
|
|
68
|
+
close_agent({ id: agent })
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Action Output Format (Standardized)
|
|
72
|
+
|
|
73
|
+
Every action MUST output:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
ACTION_RESULT:
|
|
77
|
+
- action: {ACTION_NAME}
|
|
78
|
+
- status: success | failed | needs_input
|
|
79
|
+
- message: {user-facing message}
|
|
80
|
+
- state_updates: { ... }
|
|
81
|
+
|
|
82
|
+
FILES_UPDATED:
|
|
83
|
+
- {file_path}: {description}
|
|
84
|
+
|
|
85
|
+
NEXT_ACTION_NEEDED: {NEXT_ACTION} | WAITING_INPUT | COMPLETED | PAUSED
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Action Selection Logic
|
|
89
|
+
|
|
90
|
+
### Auto Mode
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
function selectNextAction(state) {
|
|
94
|
+
const skillState = state.skill_state
|
|
95
|
+
|
|
96
|
+
// 1. Terminal conditions
|
|
97
|
+
if (state.status === 'completed') return null
|
|
98
|
+
if (state.status === 'failed') return null
|
|
99
|
+
if (state.current_iteration >= state.max_iterations) return 'COMPLETE'
|
|
100
|
+
|
|
101
|
+
// 2. Initialization check
|
|
102
|
+
if (!skillState) return 'INIT'
|
|
103
|
+
|
|
104
|
+
// 3. Auto selection based on state
|
|
105
|
+
const hasPendingDevelop = skillState.develop.tasks.some(t => t.status === 'pending')
|
|
106
|
+
|
|
107
|
+
if (hasPendingDevelop) {
|
|
108
|
+
return 'DEVELOP'
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (skillState.last_action === 'DEVELOP') {
|
|
112
|
+
const needsDebug = skillState.develop.completed < skillState.develop.total
|
|
113
|
+
if (needsDebug) return 'DEBUG'
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (skillState.last_action === 'DEBUG' || skillState.debug.confirmed_hypothesis) {
|
|
117
|
+
return 'VALIDATE'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (skillState.last_action === 'VALIDATE') {
|
|
121
|
+
if (!skillState.validate.passed) return 'DEVELOP'
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (skillState.validate.passed && !hasPendingDevelop) {
|
|
125
|
+
return 'COMPLETE'
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return 'DEVELOP'
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Interactive Mode
|
|
133
|
+
|
|
134
|
+
Returns `MENU` action, which displays options and waits for user input.
|
|
135
|
+
|
|
136
|
+
## Action Dependencies
|
|
137
|
+
|
|
138
|
+
| Action | Depends On | Leads To |
|
|
139
|
+
|--------|------------|----------|
|
|
140
|
+
| INIT | - | MENU or DEVELOP |
|
|
141
|
+
| MENU | INIT | User selection |
|
|
142
|
+
| DEVELOP | INIT | DEVELOP, DEBUG, VALIDATE |
|
|
143
|
+
| DEBUG | INIT | DEVELOP, VALIDATE |
|
|
144
|
+
| VALIDATE | DEVELOP or DEBUG | COMPLETE, DEBUG, DEVELOP |
|
|
145
|
+
| COMPLETE | - | Terminal |
|
|
146
|
+
|
|
147
|
+
## Action Sequences
|
|
148
|
+
|
|
149
|
+
### Happy Path (Auto Mode)
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
INIT -> DEVELOP -> DEVELOP -> DEVELOP -> VALIDATE (pass) -> COMPLETE
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Debug Iteration Path
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
INIT -> DEVELOP -> VALIDATE (fail) -> DEBUG -> DEBUG -> VALIDATE (pass) -> COMPLETE
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Interactive Path
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
INIT -> MENU -> (user: develop) -> DEVELOP -> MENU -> (user: validate) -> VALIDATE -> MENU -> (user: complete) -> COMPLETE
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Error Recovery
|
|
168
|
+
|
|
169
|
+
| Error | Recovery |
|
|
170
|
+
|-------|----------|
|
|
171
|
+
| Action timeout | send_input requesting convergence |
|
|
172
|
+
| Action failed | Log error, continue or retry |
|
|
173
|
+
| Agent closed unexpectedly | Re-spawn with previous output |
|
|
174
|
+
| State corrupted | Rebuild from progress files |
|
|
175
|
+
|
|
176
|
+
## Codex Best Practices
|
|
177
|
+
|
|
178
|
+
1. **Single agent for all actions**: No need to spawn new agent for each action
|
|
179
|
+
2. **Deep interaction via send_input**: Continue conversation in same context
|
|
180
|
+
3. **Delayed close_agent**: Only close after all actions complete
|
|
181
|
+
4. **Structured output**: Always use ACTION_RESULT format for parsing
|
|
182
|
+
5. **Control signal checking**: Check state.status before every action
|