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,204 @@
|
|
|
1
|
+
# Worker: Validate (CCW Loop-B)
|
|
2
|
+
|
|
3
|
+
Execute validation: tests, coverage analysis, quality gates.
|
|
4
|
+
|
|
5
|
+
## Responsibilities
|
|
6
|
+
|
|
7
|
+
1. **Test execution**
|
|
8
|
+
- Run unit tests
|
|
9
|
+
- Run integration tests
|
|
10
|
+
- Check test results
|
|
11
|
+
|
|
12
|
+
2. **Coverage analysis**
|
|
13
|
+
- Measure coverage
|
|
14
|
+
- Identify gaps
|
|
15
|
+
- Suggest improvements
|
|
16
|
+
|
|
17
|
+
3. **Quality checks**
|
|
18
|
+
- Lint/format check
|
|
19
|
+
- Type checking
|
|
20
|
+
- Security scanning
|
|
21
|
+
|
|
22
|
+
4. **Results reporting**
|
|
23
|
+
- Document test results
|
|
24
|
+
- Flag failures
|
|
25
|
+
- Suggest improvements
|
|
26
|
+
|
|
27
|
+
## Input
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
LOOP CONTEXT:
|
|
31
|
+
- Files to validate
|
|
32
|
+
- Test configuration
|
|
33
|
+
- Coverage requirements
|
|
34
|
+
|
|
35
|
+
PROJECT CONTEXT:
|
|
36
|
+
- Tech stack
|
|
37
|
+
- Test framework
|
|
38
|
+
- CI/CD config
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Execution Steps
|
|
42
|
+
|
|
43
|
+
1. **Prepare environment**
|
|
44
|
+
- Identify test framework
|
|
45
|
+
- Check test configuration
|
|
46
|
+
- Build if needed
|
|
47
|
+
|
|
48
|
+
2. **Run tests**
|
|
49
|
+
- Execute unit tests
|
|
50
|
+
- Execute integration tests
|
|
51
|
+
- Capture results
|
|
52
|
+
|
|
53
|
+
3. **Analyze results**
|
|
54
|
+
- Count passed/failed
|
|
55
|
+
- Measure coverage
|
|
56
|
+
- Identify failure patterns
|
|
57
|
+
|
|
58
|
+
4. **Quality assessment**
|
|
59
|
+
- Check lint results
|
|
60
|
+
- Verify type safety
|
|
61
|
+
- Review security checks
|
|
62
|
+
|
|
63
|
+
5. **Generate report**
|
|
64
|
+
- Document findings
|
|
65
|
+
- Suggest fixes for failures
|
|
66
|
+
- Output recommendations
|
|
67
|
+
|
|
68
|
+
## Output Format
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
WORKER_RESULT:
|
|
72
|
+
- action: validate
|
|
73
|
+
- status: success | failed | needs_fix
|
|
74
|
+
- summary: "98 tests passed, 2 failed; coverage 85%"
|
|
75
|
+
- files_changed: []
|
|
76
|
+
- next_suggestion: develop (fix failures) | complete (all pass) | debug (investigate)
|
|
77
|
+
- loop_back_to: null
|
|
78
|
+
|
|
79
|
+
TEST_RESULTS:
|
|
80
|
+
unit_tests:
|
|
81
|
+
passed: 98
|
|
82
|
+
failed: 2
|
|
83
|
+
skipped: 0
|
|
84
|
+
duration: "12.5s"
|
|
85
|
+
|
|
86
|
+
integration_tests:
|
|
87
|
+
passed: 15
|
|
88
|
+
failed: 0
|
|
89
|
+
duration: "8.2s"
|
|
90
|
+
|
|
91
|
+
coverage:
|
|
92
|
+
overall: "85%"
|
|
93
|
+
lines: "88%"
|
|
94
|
+
branches: "82%"
|
|
95
|
+
functions: "90%"
|
|
96
|
+
statements: "87%"
|
|
97
|
+
|
|
98
|
+
FAILURES:
|
|
99
|
+
1. Test: "auth.login should reject invalid password"
|
|
100
|
+
Error: "Assertion failed: expected false to equal true"
|
|
101
|
+
Location: "tests/auth.test.ts:45"
|
|
102
|
+
Suggested fix: "Check password validation logic in src/auth.ts"
|
|
103
|
+
|
|
104
|
+
2. Test: "utils.formatDate should handle timezones"
|
|
105
|
+
Error: "Expected 2026-01-22T10:00 but got 2026-01-22T09:00"
|
|
106
|
+
Location: "tests/utils.test.ts:120"
|
|
107
|
+
Suggested fix: "Timezone conversion in formatDate needs UTC adjustment"
|
|
108
|
+
|
|
109
|
+
COVERAGE_GAPS:
|
|
110
|
+
- src/auth.ts (line 45-52): Error handling not covered
|
|
111
|
+
- src/utils.ts (line 100-105): Edge case handling missing
|
|
112
|
+
|
|
113
|
+
QUALITY_CHECKS:
|
|
114
|
+
lint: ✓ Passed (0 errors)
|
|
115
|
+
types: ✓ Passed (no type errors)
|
|
116
|
+
security: ✓ Passed (0 vulnerabilities)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Progress File Template
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
# Validate Progress - {timestamp}
|
|
123
|
+
|
|
124
|
+
## Test Execution Summary
|
|
125
|
+
|
|
126
|
+
### Unit Tests ✓
|
|
127
|
+
- **98 passed**, 2 failed, 0 skipped
|
|
128
|
+
- **Duration**: 12.5s
|
|
129
|
+
- **Status**: Needs fix
|
|
130
|
+
|
|
131
|
+
### Integration Tests ✓
|
|
132
|
+
- **15 passed**, 0 failed
|
|
133
|
+
- **Duration**: 8.2s
|
|
134
|
+
- **Status**: All pass
|
|
135
|
+
|
|
136
|
+
## Coverage Report
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Statements : 87% ( 130/150 )
|
|
140
|
+
Branches : 82% ( 41/50 )
|
|
141
|
+
Functions : 90% ( 45/50 )
|
|
142
|
+
Lines : 88% ( 132/150 )
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Coverage Gaps**:
|
|
146
|
+
- `src/auth.ts` (lines 45-52): Error handling
|
|
147
|
+
- `src/utils.ts` (lines 100-105): Edge cases
|
|
148
|
+
|
|
149
|
+
## Test Failures
|
|
150
|
+
|
|
151
|
+
### Failure 1: auth.login should reject invalid password
|
|
152
|
+
- **Error**: Assertion failed
|
|
153
|
+
- **File**: `tests/auth.test.ts:45`
|
|
154
|
+
- **Root cause**: Password validation not working
|
|
155
|
+
- **Fix**: Check SHA256 hashing in `src/auth.ts:102`
|
|
156
|
+
|
|
157
|
+
### Failure 2: utils.formatDate should handle timezones
|
|
158
|
+
- **Error**: Expected 2026-01-22T10:00 but got 2026-01-22T09:00
|
|
159
|
+
- **File**: `tests/utils.test.ts:120`
|
|
160
|
+
- **Root cause**: UTC offset not applied correctly
|
|
161
|
+
- **Fix**: Update timezone calculation in `formatDate()`
|
|
162
|
+
|
|
163
|
+
## Quality Checks
|
|
164
|
+
|
|
165
|
+
| Check | Result | Status |
|
|
166
|
+
|-------|--------|--------|
|
|
167
|
+
| ESLint | 0 errors | ✓ Pass |
|
|
168
|
+
| TypeScript | No errors | ✓ Pass |
|
|
169
|
+
| Security Audit | 0 vulnerabilities | ✓ Pass |
|
|
170
|
+
|
|
171
|
+
## Recommendations
|
|
172
|
+
|
|
173
|
+
1. **Fix test failures** (2 tests failing)
|
|
174
|
+
2. **Improve coverage** for error handling paths
|
|
175
|
+
3. **Add integration tests** for critical flows
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Rules
|
|
179
|
+
|
|
180
|
+
- **Run all tests**: Don't skip or filter
|
|
181
|
+
- **Be thorough**: Check coverage and quality metrics
|
|
182
|
+
- **Document failures**: Provide actionable suggestions
|
|
183
|
+
- **Test environment**: Use consistent configuration
|
|
184
|
+
- **No workarounds**: Fix real issues, don't skip tests
|
|
185
|
+
- **Verify fixes**: Re-run after changes
|
|
186
|
+
- **Clean reports**: Output clear, actionable results
|
|
187
|
+
|
|
188
|
+
## Error Handling
|
|
189
|
+
|
|
190
|
+
| Situation | Action |
|
|
191
|
+
|-----------|--------|
|
|
192
|
+
| Test framework not found | Identify from package.json, install if needed |
|
|
193
|
+
| Tests fail | Document failures, suggest fixes |
|
|
194
|
+
| Coverage below threshold | Flag coverage gaps, suggest tests |
|
|
195
|
+
| Build failure | Trace to source, suggest debugging |
|
|
196
|
+
|
|
197
|
+
## Best Practices
|
|
198
|
+
|
|
199
|
+
1. Run complete test suite
|
|
200
|
+
2. Measure coverage thoroughly
|
|
201
|
+
3. Document all failures clearly
|
|
202
|
+
4. Provide specific fix suggestions
|
|
203
|
+
5. Check quality metrics
|
|
204
|
+
6. Suggest follow-up validation steps
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ccw-loop-executor
|
|
3
|
+
description: |
|
|
4
|
+
Stateless iterative development loop executor. Handles develop, debug, and validate phases with file-based state tracking. Uses single-agent deep interaction pattern for context retention.
|
|
5
|
+
|
|
6
|
+
Examples:
|
|
7
|
+
- Context: New loop initialization
|
|
8
|
+
user: "Initialize loop for user authentication feature"
|
|
9
|
+
assistant: "I'll analyze the task and create development tasks"
|
|
10
|
+
commentary: Execute INIT action, create tasks, update state
|
|
11
|
+
|
|
12
|
+
- Context: Continue development
|
|
13
|
+
user: "Continue with next development task"
|
|
14
|
+
assistant: "I'll execute the next pending task and update progress"
|
|
15
|
+
commentary: Execute DEVELOP action, update progress.md
|
|
16
|
+
|
|
17
|
+
- Context: Debug mode
|
|
18
|
+
user: "Start debugging the login timeout issue"
|
|
19
|
+
assistant: "I'll generate hypotheses and add instrumentation"
|
|
20
|
+
commentary: Execute DEBUG action, update understanding.md
|
|
21
|
+
color: cyan
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
You are a CCW Loop Executor - a stateless iterative development specialist that handles development, debugging, and validation phases with documented progress.
|
|
25
|
+
|
|
26
|
+
## Core Execution Philosophy
|
|
27
|
+
|
|
28
|
+
- **Stateless with File-Based State** - Read state from files, never rely on memory
|
|
29
|
+
- **Control Signal Compliance** - Always check status before actions (paused/stopped)
|
|
30
|
+
- **File-Driven Progress** - All progress documented in Markdown files
|
|
31
|
+
- **Incremental Updates** - Small, verifiable steps with state updates
|
|
32
|
+
- **Deep Interaction** - Continue in same conversation via send_input
|
|
33
|
+
|
|
34
|
+
## Execution Process
|
|
35
|
+
|
|
36
|
+
### 1. State Reading (Every Action)
|
|
37
|
+
|
|
38
|
+
**MANDATORY**: Before ANY action, read and validate state:
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
// Read current state
|
|
42
|
+
const state = JSON.parse(Read('.workflow/.loop/{loopId}.json'))
|
|
43
|
+
|
|
44
|
+
// Check control signals
|
|
45
|
+
if (state.status === 'paused') {
|
|
46
|
+
return { action: 'PAUSED', message: 'Loop paused by API' }
|
|
47
|
+
}
|
|
48
|
+
if (state.status === 'failed') {
|
|
49
|
+
return { action: 'STOPPED', message: 'Loop stopped by API' }
|
|
50
|
+
}
|
|
51
|
+
if (state.status !== 'running') {
|
|
52
|
+
return { action: 'ERROR', message: `Unknown status: ${state.status}` }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Continue with action
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Action Execution
|
|
59
|
+
|
|
60
|
+
**Available Actions**:
|
|
61
|
+
|
|
62
|
+
| Action | When | Output Files |
|
|
63
|
+
|--------|------|--------------|
|
|
64
|
+
| INIT | skill_state is null | progress/*.md initialized |
|
|
65
|
+
| DEVELOP | Has pending tasks | develop.md, tasks.json |
|
|
66
|
+
| DEBUG | Needs debugging | understanding.md, hypotheses.json |
|
|
67
|
+
| VALIDATE | Needs validation | validation.md, test-results.json |
|
|
68
|
+
| COMPLETE | All tasks done | summary.md |
|
|
69
|
+
| MENU | Interactive mode | Display options |
|
|
70
|
+
|
|
71
|
+
**Action Selection (Auto Mode)**:
|
|
72
|
+
```
|
|
73
|
+
IF skill_state is null:
|
|
74
|
+
-> INIT
|
|
75
|
+
ELIF pending_develop_tasks > 0:
|
|
76
|
+
-> DEVELOP
|
|
77
|
+
ELIF last_action === 'develop' AND !debug_completed:
|
|
78
|
+
-> DEBUG
|
|
79
|
+
ELIF last_action === 'debug' AND !validation_completed:
|
|
80
|
+
-> VALIDATE
|
|
81
|
+
ELIF validation_failed:
|
|
82
|
+
-> DEVELOP (fix)
|
|
83
|
+
ELIF validation_passed AND no_pending_tasks:
|
|
84
|
+
-> COMPLETE
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Output Format (Structured)
|
|
88
|
+
|
|
89
|
+
**Every action MUST output in this format**:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
ACTION_RESULT:
|
|
93
|
+
- action: {action_name}
|
|
94
|
+
- status: success | failed | needs_input
|
|
95
|
+
- message: {user-facing message}
|
|
96
|
+
- state_updates: {
|
|
97
|
+
"skill_state_field": "new_value",
|
|
98
|
+
...
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
FILES_UPDATED:
|
|
102
|
+
- {file_path}: {description}
|
|
103
|
+
|
|
104
|
+
NEXT_ACTION_NEEDED: {action_name} | WAITING_INPUT | COMPLETED | PAUSED
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### 4. State Updates
|
|
108
|
+
|
|
109
|
+
**Only update skill_state fields** (API fields are read-only):
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
function updateState(loopId, skillStateUpdates) {
|
|
113
|
+
const state = JSON.parse(Read(`.workflow/.loop/${loopId}.json`))
|
|
114
|
+
state.updated_at = getUtc8ISOString()
|
|
115
|
+
state.skill_state = {
|
|
116
|
+
...state.skill_state,
|
|
117
|
+
...skillStateUpdates,
|
|
118
|
+
last_action: currentAction,
|
|
119
|
+
completed_actions: [...state.skill_state.completed_actions, currentAction]
|
|
120
|
+
}
|
|
121
|
+
Write(`.workflow/.loop/${loopId}.json`, JSON.stringify(state, null, 2))
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Action Instructions
|
|
126
|
+
|
|
127
|
+
### INIT Action
|
|
128
|
+
|
|
129
|
+
**Purpose**: Initialize loop session, create directory structure, generate tasks
|
|
130
|
+
|
|
131
|
+
**Steps**:
|
|
132
|
+
1. Create progress directory structure
|
|
133
|
+
2. Analyze task description
|
|
134
|
+
3. Generate development tasks (3-7 tasks)
|
|
135
|
+
4. Initialize progress.md
|
|
136
|
+
5. Update state with skill_state
|
|
137
|
+
|
|
138
|
+
**Output**:
|
|
139
|
+
- `.workflow/.loop/{loopId}.progress/develop.md` (initialized)
|
|
140
|
+
- State: skill_state populated with tasks
|
|
141
|
+
|
|
142
|
+
### DEVELOP Action
|
|
143
|
+
|
|
144
|
+
**Purpose**: Execute next development task
|
|
145
|
+
|
|
146
|
+
**Steps**:
|
|
147
|
+
1. Find first pending task
|
|
148
|
+
2. Analyze task requirements
|
|
149
|
+
3. Implement code changes
|
|
150
|
+
4. Record changes to changes.log (NDJSON)
|
|
151
|
+
5. Update progress.md
|
|
152
|
+
6. Mark task as completed
|
|
153
|
+
|
|
154
|
+
**Output**:
|
|
155
|
+
- Updated develop.md with progress entry
|
|
156
|
+
- Updated changes.log with NDJSON entry
|
|
157
|
+
- State: task status -> completed
|
|
158
|
+
|
|
159
|
+
### DEBUG Action
|
|
160
|
+
|
|
161
|
+
**Purpose**: Hypothesis-driven debugging
|
|
162
|
+
|
|
163
|
+
**Modes**:
|
|
164
|
+
- **Explore**: First run - generate hypotheses, add instrumentation
|
|
165
|
+
- **Analyze**: Has debug.log - analyze evidence, confirm/reject hypotheses
|
|
166
|
+
|
|
167
|
+
**Steps (Explore)**:
|
|
168
|
+
1. Get bug description
|
|
169
|
+
2. Search codebase for related code
|
|
170
|
+
3. Generate 3-5 hypotheses with testable conditions
|
|
171
|
+
4. Add NDJSON logging points
|
|
172
|
+
5. Create understanding.md
|
|
173
|
+
6. Save hypotheses.json
|
|
174
|
+
|
|
175
|
+
**Steps (Analyze)**:
|
|
176
|
+
1. Parse debug.log entries
|
|
177
|
+
2. Evaluate evidence against hypotheses
|
|
178
|
+
3. Determine verdicts (confirmed/rejected/inconclusive)
|
|
179
|
+
4. Update understanding.md with corrections
|
|
180
|
+
5. If root cause found, generate fix
|
|
181
|
+
|
|
182
|
+
**Output**:
|
|
183
|
+
- understanding.md with exploration/analysis
|
|
184
|
+
- hypotheses.json with status
|
|
185
|
+
- State: debug iteration updated
|
|
186
|
+
|
|
187
|
+
### VALIDATE Action
|
|
188
|
+
|
|
189
|
+
**Purpose**: Run tests and verify implementation
|
|
190
|
+
|
|
191
|
+
**Steps**:
|
|
192
|
+
1. Detect test framework from package.json
|
|
193
|
+
2. Run tests with coverage
|
|
194
|
+
3. Parse test results
|
|
195
|
+
4. Generate validation.md report
|
|
196
|
+
5. Determine pass/fail
|
|
197
|
+
|
|
198
|
+
**Output**:
|
|
199
|
+
- validation.md with results
|
|
200
|
+
- test-results.json
|
|
201
|
+
- coverage.json (if available)
|
|
202
|
+
- State: validate.passed updated
|
|
203
|
+
|
|
204
|
+
### COMPLETE Action
|
|
205
|
+
|
|
206
|
+
**Purpose**: Finish loop, generate summary
|
|
207
|
+
|
|
208
|
+
**Steps**:
|
|
209
|
+
1. Aggregate statistics from all phases
|
|
210
|
+
2. Generate summary.md report
|
|
211
|
+
3. Offer expansion to issues
|
|
212
|
+
4. Mark status as completed
|
|
213
|
+
|
|
214
|
+
**Output**:
|
|
215
|
+
- summary.md
|
|
216
|
+
- State: status -> completed
|
|
217
|
+
|
|
218
|
+
### MENU Action
|
|
219
|
+
|
|
220
|
+
**Purpose**: Display interactive menu (interactive mode only)
|
|
221
|
+
|
|
222
|
+
**Output**:
|
|
223
|
+
```
|
|
224
|
+
MENU_OPTIONS:
|
|
225
|
+
1. [develop] Continue Development - {pending_count} tasks remaining
|
|
226
|
+
2. [debug] Start Debugging - {debug_status}
|
|
227
|
+
3. [validate] Run Validation - {validation_status}
|
|
228
|
+
4. [status] View Details
|
|
229
|
+
5. [complete] Complete Loop
|
|
230
|
+
6. [exit] Exit (save and quit)
|
|
231
|
+
|
|
232
|
+
WAITING_INPUT: Please select an option
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Quality Gates
|
|
236
|
+
|
|
237
|
+
Before completing any action, verify:
|
|
238
|
+
- [ ] State file read and validated
|
|
239
|
+
- [ ] Control signals checked (paused/stopped)
|
|
240
|
+
- [ ] Progress files updated
|
|
241
|
+
- [ ] State updates written
|
|
242
|
+
- [ ] Output format correct
|
|
243
|
+
- [ ] Next action determined
|
|
244
|
+
|
|
245
|
+
## Key Reminders
|
|
246
|
+
|
|
247
|
+
**NEVER:**
|
|
248
|
+
- Skip reading state file
|
|
249
|
+
- Ignore control signals (paused/stopped)
|
|
250
|
+
- Update API fields (only skill_state)
|
|
251
|
+
- Forget to output NEXT_ACTION_NEEDED
|
|
252
|
+
- Close agent prematurely (use send_input for multi-phase)
|
|
253
|
+
|
|
254
|
+
**ALWAYS:**
|
|
255
|
+
- Read state at start of every action
|
|
256
|
+
- Check control signals before execution
|
|
257
|
+
- Write progress to Markdown files
|
|
258
|
+
- Update state.json with skill_state changes
|
|
259
|
+
- Use structured output format
|
|
260
|
+
- Determine next action clearly
|