@cleocode/cleo 2026.3.2 → 2026.3.6
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/README.md +1 -3
- package/dist/cli/index.js +7381 -3507
- package/dist/cli/index.js.map +4 -4
- package/dist/mcp/index.js +5792 -2097
- package/dist/mcp/index.js.map +4 -4
- package/package.json +4 -4
- package/packages/ct-skills/index.js +1 -1
- package/packages/ct-skills/package.json +0 -2
- package/packages/ct-skills/profiles/core.json +1 -1
- package/packages/ct-skills/profiles/full.json +4 -5
- package/packages/ct-skills/profiles/minimal.json +3 -3
- package/packages/ct-skills/profiles/recommended.json +2 -2
- package/packages/ct-skills/provider-skills-map.json +97 -0
- package/packages/ct-skills/skills/_shared/skill-chaining-patterns.md +23 -26
- package/packages/ct-skills/skills/_shared/testing-framework-config.md +9 -9
- package/packages/ct-skills/skills/ct-cleo/SKILL.md +21 -1
- package/packages/ct-skills/skills/ct-dev-workflow/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-documentor/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-epic-architect/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-grade/SKILL.md +214 -0
- package/packages/ct-skills/skills/ct-orchestrator/SKILL.md +119 -43
- package/packages/ct-skills/skills/ct-orchestrator/orchestrator-prompt.txt +17 -0
- package/packages/ct-skills/skills/ct-orchestrator/references/orchestrator-patterns.md +1 -1
- package/packages/ct-skills/skills/ct-research-agent/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-spec-writer/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-task-executor/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-validator/SKILL.md +1 -1
- package/packages/ct-skills/skills/manifest.json +217 -947
- package/packages/ct-skills/skills.json +244 -3
- package/templates/CLEO-INJECTION.md +37 -0
- package/templates/README.md +4 -4
- package/templates/cleo-gitignore +3 -11
- package/templates/git-hooks/pre-commit +1 -1
- package/packages/ct-skills/protocols/agent-protocol.md +0 -260
- package/packages/ct-skills/protocols/artifact-publish.md +0 -587
- package/packages/ct-skills/protocols/consensus.md +0 -309
- package/packages/ct-skills/protocols/contribution.md +0 -375
- package/packages/ct-skills/protocols/decomposition.md +0 -352
- package/packages/ct-skills/protocols/implementation.md +0 -344
- package/packages/ct-skills/protocols/provenance.md +0 -600
- package/packages/ct-skills/protocols/release.md +0 -635
- package/packages/ct-skills/protocols/research.md +0 -248
- package/packages/ct-skills/protocols/specification.md +0 -287
- package/packages/ct-skills/protocols/testing.md +0 -346
- package/packages/ct-skills/protocols/validation.md +0 -229
- package/packages/ct-skills/skills/ct-gitbook/SKILL.md +0 -516
- package/packages/ct-skills/skills/ct-gitbook/assets/SUMMARY.md +0 -28
- package/packages/ct-skills/skills/ct-gitbook/assets/gitbook.yaml +0 -14
- package/packages/ct-skills/skills/ct-gitbook/references/api-sdk.md +0 -318
- package/packages/ct-skills/skills/ct-gitbook/references/auth-sso.md +0 -208
- package/packages/ct-skills/skills/ct-gitbook/references/change-requests.md +0 -169
- package/packages/ct-skills/skills/ct-gitbook/references/content-blocks.md +0 -230
- package/packages/ct-skills/skills/ct-gitbook/references/docs-sites.md +0 -202
- package/packages/ct-skills/skills/ct-gitbook/references/git-sync.md +0 -175
- package/packages/ct-skills/skills/ct-gitbook/references/llm-ready.md +0 -178
- package/packages/ct-skills/skills/ct-gitbook/references/migration.md +0 -263
- package/packages/ct-skills/skills/ct-library-implementer-bash/SKILL.md +0 -316
- package/packages/ct-skills/skills/ct-skill-lookup/SKILL.md +0 -179
- package/packages/ct-skills/skills/ct-test-writer-bats/SKILL.md +0 -347
- package/packages/ct-skills/skills/railway-platform/SKILL.md +0 -506
- package/packages/ct-skills/skills/railway-platform/_shared/scripts/railway-api.sh +0 -180
- package/packages/ct-skills/skills/railway-platform/_shared/scripts/railway-common.sh +0 -262
- package/packages/ct-skills/skills/railway-platform/references/01-getting-started.md +0 -149
- package/packages/ct-skills/skills/railway-platform/references/02-projects.md +0 -116
- package/packages/ct-skills/skills/railway-platform/references/03-services.md +0 -147
- package/packages/ct-skills/skills/railway-platform/references/04-deployments.md +0 -210
- package/packages/ct-skills/skills/railway-platform/references/05-databases.md +0 -142
- package/packages/ct-skills/skills/railway-platform/references/06-environments.md +0 -261
- package/packages/ct-skills/skills/railway-platform/references/07-domains.md +0 -139
- package/packages/ct-skills/skills/railway-platform/references/08-volumes.md +0 -533
- package/packages/ct-skills/skills/railway-platform/references/09-networking.md +0 -592
- package/packages/ct-skills/skills/railway-platform/references/10-cron.md +0 -488
- package/packages/ct-skills/skills/railway-platform/references/11-functions.md +0 -170
- package/packages/ct-skills/skills/railway-platform/references/12-monorepo.md +0 -294
- package/packages/ct-skills/skills/railway-platform/references/13-troubleshooting.md +0 -335
- package/packages/ct-skills/skills/railway-platform/references/14-railway-metal.md +0 -197
|
@@ -1,352 +0,0 @@
|
|
|
1
|
-
# Decomposition Protocol
|
|
2
|
-
|
|
3
|
-
**Provenance**: @task T3155, @epic T3147
|
|
4
|
-
**Version**: 1.0.1
|
|
5
|
-
**Type**: Conditional Protocol
|
|
6
|
-
**Max Active**: 3 protocols (including base)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Trigger Conditions
|
|
11
|
-
|
|
12
|
-
This protocol activates when the task involves:
|
|
13
|
-
|
|
14
|
-
| Trigger | Keywords | Context |
|
|
15
|
-
|---------|----------|---------|
|
|
16
|
-
| Epic Planning | "epic", "project", "initiative" | Large scope work |
|
|
17
|
-
| Breakdown | "decompose", "break down", "split" | Task subdivision |
|
|
18
|
-
| Planning | "plan", "roadmap", "phases" | Work organization |
|
|
19
|
-
| Analysis | "scope", "estimate complexity" | Size assessment |
|
|
20
|
-
|
|
21
|
-
**Explicit Override**: `--protocol decomposition` flag on task creation.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Requirements (RFC 2119)
|
|
26
|
-
|
|
27
|
-
### MUST
|
|
28
|
-
|
|
29
|
-
| Requirement | Description |
|
|
30
|
-
|-------------|-------------|
|
|
31
|
-
| DCMP-001 | MUST follow MECE principle (Mutually Exclusive, Collectively Exhaustive) |
|
|
32
|
-
| DCMP-002 | MUST map dependencies between tasks |
|
|
33
|
-
| DCMP-003 | MUST respect maximum depth (3 levels: epic > task > subtask) |
|
|
34
|
-
| DCMP-004 | MUST verify atomicity for leaf tasks |
|
|
35
|
-
| DCMP-005 | MUST NOT include time estimates (use size: small/medium/large) |
|
|
36
|
-
| DCMP-006 | MUST include acceptance criteria for each task |
|
|
37
|
-
| DCMP-007 | MUST set `agent_type: "analysis"` in manifest |
|
|
38
|
-
|
|
39
|
-
### SHOULD
|
|
40
|
-
|
|
41
|
-
| Requirement | Description |
|
|
42
|
-
|-------------|-------------|
|
|
43
|
-
| DCMP-010 | SHOULD identify parallel execution opportunities |
|
|
44
|
-
| DCMP-011 | SHOULD flag unclear requirements for HITL |
|
|
45
|
-
| DCMP-012 | SHOULD consider existing task overlap |
|
|
46
|
-
| DCMP-013 | SHOULD assign phase to each task |
|
|
47
|
-
|
|
48
|
-
### MAY
|
|
49
|
-
|
|
50
|
-
| Requirement | Description |
|
|
51
|
-
|-------------|-------------|
|
|
52
|
-
| DCMP-020 | MAY propose multiple decomposition options |
|
|
53
|
-
| DCMP-021 | MAY identify risks and mitigations |
|
|
54
|
-
| DCMP-022 | MAY suggest task consolidation |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Output Format
|
|
59
|
-
|
|
60
|
-
### Hierarchy Structure
|
|
61
|
-
|
|
62
|
-
```
|
|
63
|
-
EPIC (T001) - Large initiative
|
|
64
|
-
├── TASK (T002) - Coherent unit of work
|
|
65
|
-
│ ├── SUBTASK (T003) - Atomic task (MUST be atomic)
|
|
66
|
-
│ └── SUBTASK (T004) - Atomic task
|
|
67
|
-
├── TASK (T005) - Another unit
|
|
68
|
-
│ └── SUBTASK (T006)
|
|
69
|
-
└── TASK (T007) - Independent task
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Size Definitions
|
|
73
|
-
|
|
74
|
-
| Size | Scope | Atomicity |
|
|
75
|
-
|------|-------|-----------|
|
|
76
|
-
| `small` | 1-2 files, single concern | MUST be atomic |
|
|
77
|
-
| `medium` | 3-7 files, related concerns | SHOULD be atomic |
|
|
78
|
-
| `large` | 8+ files, multiple concerns | MUST decompose further |
|
|
79
|
-
|
|
80
|
-
### Atomicity Criteria (6-Point Test)
|
|
81
|
-
|
|
82
|
-
| # | Criterion | Pass Condition |
|
|
83
|
-
|---|-----------|----------------|
|
|
84
|
-
| 1 | Single File Scope | Affects ≤3 tightly-coupled files |
|
|
85
|
-
| 2 | Single Cognitive Concern | One "thing" to understand |
|
|
86
|
-
| 3 | Clear Acceptance Criteria | Testable completion condition |
|
|
87
|
-
| 4 | No Context Switching | Can complete in one session |
|
|
88
|
-
| 5 | No Hidden Sub-Decisions | All choices made at decomposition |
|
|
89
|
-
| 6 | Programmatic Validation | Result verifiable by code/test |
|
|
90
|
-
|
|
91
|
-
### Dependency Graph
|
|
92
|
-
|
|
93
|
-
```json
|
|
94
|
-
{
|
|
95
|
-
"tasks": [
|
|
96
|
-
{"id": "T001", "type": "epic", "children": ["T002", "T005", "T007"]},
|
|
97
|
-
{"id": "T002", "type": "task", "parent": "T001", "children": ["T003", "T004"], "depends": []},
|
|
98
|
-
{"id": "T003", "type": "subtask", "parent": "T002", "depends": []},
|
|
99
|
-
{"id": "T004", "type": "subtask", "parent": "T002", "depends": ["T003"]},
|
|
100
|
-
{"id": "T005", "type": "task", "parent": "T001", "depends": ["T002"]},
|
|
101
|
-
{"id": "T007", "type": "task", "parent": "T001", "depends": []}
|
|
102
|
-
],
|
|
103
|
-
"waves": [
|
|
104
|
-
{"wave": 0, "tasks": ["T003", "T007"]},
|
|
105
|
-
{"wave": 1, "tasks": ["T004"]},
|
|
106
|
-
{"wave": 2, "tasks": ["T002"]},
|
|
107
|
-
{"wave": 3, "tasks": ["T005"]}
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### Wave Computation
|
|
113
|
-
|
|
114
|
-
Tasks are grouped into waves for parallel execution:
|
|
115
|
-
|
|
116
|
-
| Wave | Condition | Execution |
|
|
117
|
-
|------|-----------|-----------|
|
|
118
|
-
| 0 | No dependencies | Parallel |
|
|
119
|
-
| 1 | Depends only on wave 0 | Parallel after wave 0 |
|
|
120
|
-
| N | Depends on wave N-1 or earlier | Sequential ordering |
|
|
121
|
-
|
|
122
|
-
### File Output
|
|
123
|
-
|
|
124
|
-
```markdown
|
|
125
|
-
# Decomposition: {Epic Title}
|
|
126
|
-
|
|
127
|
-
**Task**: T####
|
|
128
|
-
**Date**: YYYY-MM-DD
|
|
129
|
-
**Status**: complete|partial|blocked
|
|
130
|
-
**Agent Type**: analysis
|
|
131
|
-
|
|
132
|
-
---
|
|
133
|
-
|
|
134
|
-
## Epic Summary
|
|
135
|
-
|
|
136
|
-
{2-3 sentence summary of the epic scope}
|
|
137
|
-
|
|
138
|
-
## Task Hierarchy
|
|
139
|
-
|
|
140
|
-
### T001 - {Epic Title} (epic, large)
|
|
141
|
-
|
|
142
|
-
**Description**: {Epic description}
|
|
143
|
-
**Phase**: {phase}
|
|
144
|
-
|
|
145
|
-
#### T002 - {Task Title} (task, medium)
|
|
146
|
-
|
|
147
|
-
**Description**: {Task description}
|
|
148
|
-
**Depends**: none
|
|
149
|
-
**Phase**: {phase}
|
|
150
|
-
**Acceptance Criteria**:
|
|
151
|
-
- {Criterion 1}
|
|
152
|
-
- {Criterion 2}
|
|
153
|
-
|
|
154
|
-
##### T003 - {Subtask Title} (subtask, small)
|
|
155
|
-
|
|
156
|
-
**Description**: {Subtask description}
|
|
157
|
-
**Depends**: none
|
|
158
|
-
**Atomicity**: 6/6 (PASS)
|
|
159
|
-
**Acceptance Criteria**:
|
|
160
|
-
- {Testable criterion}
|
|
161
|
-
|
|
162
|
-
## Dependency Graph
|
|
163
|
-
|
|
164
|
-
```mermaid
|
|
165
|
-
graph TD
|
|
166
|
-
T001[Epic] --> T002[Task A]
|
|
167
|
-
T001 --> T005[Task B]
|
|
168
|
-
T002 --> T003[Subtask 1]
|
|
169
|
-
T002 --> T004[Subtask 2]
|
|
170
|
-
T003 --> T004
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Wave Analysis
|
|
174
|
-
|
|
175
|
-
| Wave | Tasks | Parallel Opportunities |
|
|
176
|
-
|------|-------|----------------------|
|
|
177
|
-
| 0 | T003, T007 | 2 tasks parallel |
|
|
178
|
-
| 1 | T004 | Sequential |
|
|
179
|
-
| 2 | T002, T005 | 2 tasks parallel |
|
|
180
|
-
|
|
181
|
-
## Risks
|
|
182
|
-
|
|
183
|
-
| Risk | Impact | Mitigation |
|
|
184
|
-
|------|--------|------------|
|
|
185
|
-
| {Risk} | {Impact} | {Mitigation} |
|
|
186
|
-
|
|
187
|
-
## Open Questions
|
|
188
|
-
|
|
189
|
-
- {Questions requiring HITL resolution}
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
### Manifest Entry
|
|
193
|
-
|
|
194
|
-
@skills/_shared/manifest-operations.md
|
|
195
|
-
|
|
196
|
-
Use `cleo research add` to create the manifest entry:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
|
-
cleo research add \
|
|
200
|
-
--title "Decomposition: Epic Title" \
|
|
201
|
-
--file "YYYY-MM-DD_decomposition.md" \
|
|
202
|
-
--topics "decomposition,planning,epic" \
|
|
203
|
-
--findings "12 tasks identified,3 wave parallel plan,2 HITL questions" \
|
|
204
|
-
--status complete \
|
|
205
|
-
--task T#### \
|
|
206
|
-
--actionable \
|
|
207
|
-
--needs-followup T#### \
|
|
208
|
-
--agent-type analysis
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
---
|
|
212
|
-
|
|
213
|
-
## Integration Points
|
|
214
|
-
|
|
215
|
-
### Base Protocol
|
|
216
|
-
|
|
217
|
-
- Inherits task lifecycle (start, execute, complete)
|
|
218
|
-
- Inherits manifest append requirement
|
|
219
|
-
- Inherits error handling patterns
|
|
220
|
-
|
|
221
|
-
### Protocol Interactions
|
|
222
|
-
|
|
223
|
-
| Combined With | Behavior |
|
|
224
|
-
|---------------|----------|
|
|
225
|
-
| research | Research informs scope understanding |
|
|
226
|
-
| specification | Spec defines task boundaries |
|
|
227
|
-
| implementation | Decomposition feeds implementation order |
|
|
228
|
-
|
|
229
|
-
### CLEO Integration
|
|
230
|
-
|
|
231
|
-
```bash
|
|
232
|
-
# Create epic and tasks from decomposition
|
|
233
|
-
cleo add "Epic Title" --type epic --size large
|
|
234
|
-
|
|
235
|
-
# Add tasks with hierarchy
|
|
236
|
-
cleo add "Task A" --parent T001 --type task --size medium --phase core
|
|
237
|
-
|
|
238
|
-
# Add subtasks
|
|
239
|
-
cleo add "Subtask 1" --parent T002 --type subtask --size small --phase core
|
|
240
|
-
|
|
241
|
-
# Set dependencies
|
|
242
|
-
cleo update T004 --depends T003
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
---
|
|
246
|
-
|
|
247
|
-
## Example
|
|
248
|
-
|
|
249
|
-
**Task**: Decompose CLEO Universal Subagent Architecture
|
|
250
|
-
|
|
251
|
-
**Manifest Entry Command**:
|
|
252
|
-
```bash
|
|
253
|
-
cleo research add \
|
|
254
|
-
--title "Decomposition: Universal Subagent Architecture" \
|
|
255
|
-
--file "2026-01-26_subagent-decomposition.md" \
|
|
256
|
-
--topics "subagent,architecture,decomposition" \
|
|
257
|
-
--findings "14 tasks identified,4 parallel waves,Base protocol + 7 conditional protocols" \
|
|
258
|
-
--status complete \
|
|
259
|
-
--task T2392 \
|
|
260
|
-
--actionable \
|
|
261
|
-
--needs-followup T2393,T2394 \
|
|
262
|
-
--agent-type analysis
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
## Atomicity Validation
|
|
268
|
-
|
|
269
|
-
### Atomicity Checklist
|
|
270
|
-
|
|
271
|
-
For each leaf task, verify:
|
|
272
|
-
|
|
273
|
-
- [ ] **Single Responsibility**: One clear objective
|
|
274
|
-
- [ ] **Completable in 1 session**: No multi-day work
|
|
275
|
-
- [ ] **Testable**: Has clear acceptance criteria
|
|
276
|
-
- [ ] **Mergeable**: Can be PR'd independently
|
|
277
|
-
- [ ] **Reversible**: Can be rolled back if needed
|
|
278
|
-
- [ ] **Dependencies Clear**: Blocking tasks explicit
|
|
279
|
-
|
|
280
|
-
### Validation Command
|
|
281
|
-
|
|
282
|
-
**Command** (planned): `cleo atomicity check --epic EPIC_ID`
|
|
283
|
-
|
|
284
|
-
**Current State**: Available via `validate_decomposition_protocol()` in `lib/protocol-validation.sh`
|
|
285
|
-
|
|
286
|
-
```bash
|
|
287
|
-
# Programmatic validation
|
|
288
|
-
source lib/protocol-validation.sh
|
|
289
|
-
child_tasks=$(cleo list --parent T2000 --format json | jq -c '.tasks')
|
|
290
|
-
result=$(validate_decomposition_protocol "T2000" "T2000" "$child_tasks" "false")
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
**Checks**:
|
|
294
|
-
- DCMP-002: No circular dependencies (via hierarchy validation)
|
|
295
|
-
- DCMP-003: Max depth 3 (epic→task→subtask)
|
|
296
|
-
- DCMP-004: Atomicity test (6 criteria above)
|
|
297
|
-
- DCMP-006: Max 7 siblings per parent
|
|
298
|
-
|
|
299
|
-
### Scoring System
|
|
300
|
-
|
|
301
|
-
Each leaf task scored on 6 criteria (pass/fail per criterion):
|
|
302
|
-
|
|
303
|
-
| Score | Interpretation | Action |
|
|
304
|
-
|-------|---------------|--------|
|
|
305
|
-
| 6/6 | Atomic | Proceed |
|
|
306
|
-
| 4-5/6 | Mostly atomic | Review failing criteria |
|
|
307
|
-
| 2-3/6 | Needs refinement | Split or clarify |
|
|
308
|
-
| 0-1/6 | Not atomic | Reject, re-decompose |
|
|
309
|
-
|
|
310
|
-
**Aggregate Epic Score**: Average of leaf task scores
|
|
311
|
-
|
|
312
|
-
### Orchestrator Integration
|
|
313
|
-
|
|
314
|
-
**Pre-Decomposition**:
|
|
315
|
-
- Epic architect validates parent epic exists
|
|
316
|
-
- Checks current depth < 3
|
|
317
|
-
- Verifies sibling count < 7
|
|
318
|
-
|
|
319
|
-
**Post-Decomposition**:
|
|
320
|
-
- Validates all new tasks meet atomicity criteria
|
|
321
|
-
- Blocks spawn of non-atomic tasks
|
|
322
|
-
- Returns refinement suggestions
|
|
323
|
-
|
|
324
|
-
### Exit Codes
|
|
325
|
-
|
|
326
|
-
- `EXIT_PROTOCOL_DECOMPOSITION` (63) - Decomposition protocol violation
|
|
327
|
-
- Common violations: Max siblings exceeded, depth limit exceeded, non-atomic tasks
|
|
328
|
-
|
|
329
|
-
### Auto-Refinement (Future)
|
|
330
|
-
|
|
331
|
-
**Planned**: If atomicity score <4/6:
|
|
332
|
-
1. Analyze failing criteria
|
|
333
|
-
2. Suggest task splits
|
|
334
|
-
3. Generate refined decomposition
|
|
335
|
-
4. Re-validate until score ≥4/6
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
|
-
## Anti-Patterns
|
|
340
|
-
|
|
341
|
-
| Pattern | Why Avoid |
|
|
342
|
-
|---------|-----------|
|
|
343
|
-
| Time estimates | Cannot predict duration accurately |
|
|
344
|
-
| Non-atomic leaf tasks | Create hidden work |
|
|
345
|
-
| Missing dependencies | Incorrect execution order |
|
|
346
|
-
| Violating depth limit | Complexity explosion |
|
|
347
|
-
| Overlapping scopes (not MECE) | Duplicate work |
|
|
348
|
-
| Skipping atomicity check | Quality regression |
|
|
349
|
-
|
|
350
|
-
---
|
|
351
|
-
|
|
352
|
-
*Protocol Version 1.0.0 - Decomposition Protocol*
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
# Implementation Protocol
|
|
2
|
-
|
|
3
|
-
**Provenance**: @task T3155, @epic T3147
|
|
4
|
-
**Version**: 1.0.1
|
|
5
|
-
**Type**: Conditional Protocol
|
|
6
|
-
**Max Active**: 3 protocols (including base)
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Trigger Conditions
|
|
11
|
-
|
|
12
|
-
This protocol activates when the task involves:
|
|
13
|
-
|
|
14
|
-
| Trigger | Keywords | Context |
|
|
15
|
-
|---------|----------|---------|
|
|
16
|
-
| Building | "implement", "build", "create", "develop" | New functionality |
|
|
17
|
-
| Coding | "code", "write", "program" | Software creation |
|
|
18
|
-
| Fixing | "fix", "bug", "patch", "repair" | Issue resolution |
|
|
19
|
-
| Enhancement | "improve", "enhance", "optimize" | Existing code |
|
|
20
|
-
|
|
21
|
-
**Explicit Override**: `--protocol implementation` flag on task creation.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## Requirements (RFC 2119)
|
|
26
|
-
|
|
27
|
-
### MUST
|
|
28
|
-
|
|
29
|
-
| Requirement | Description |
|
|
30
|
-
|-------------|-------------|
|
|
31
|
-
| IMPL-001 | MUST include tests for new functionality |
|
|
32
|
-
| IMPL-002 | MUST follow project code style conventions |
|
|
33
|
-
| IMPL-003 | MUST include JSDoc/docstring provenance tags |
|
|
34
|
-
| IMPL-004 | MUST verify changes pass existing tests |
|
|
35
|
-
| IMPL-005 | MUST document breaking changes |
|
|
36
|
-
| IMPL-006 | MUST write implementation summary to manifest |
|
|
37
|
-
| IMPL-007 | MUST set `agent_type: "implementation"` in manifest |
|
|
38
|
-
|
|
39
|
-
### SHOULD
|
|
40
|
-
|
|
41
|
-
| Requirement | Description |
|
|
42
|
-
|-------------|-------------|
|
|
43
|
-
| IMPL-010 | SHOULD add inline comments for complex logic |
|
|
44
|
-
| IMPL-011 | SHOULD refactor duplicated code |
|
|
45
|
-
| IMPL-012 | SHOULD update related documentation |
|
|
46
|
-
| IMPL-013 | SHOULD consider error handling edge cases |
|
|
47
|
-
|
|
48
|
-
### MAY
|
|
49
|
-
|
|
50
|
-
| Requirement | Description |
|
|
51
|
-
|-------------|-------------|
|
|
52
|
-
| IMPL-020 | MAY propose architectural improvements |
|
|
53
|
-
| IMPL-021 | MAY add performance benchmarks |
|
|
54
|
-
| IMPL-022 | MAY suggest follow-up enhancements |
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Output Format
|
|
59
|
-
|
|
60
|
-
### Provenance Tags
|
|
61
|
-
|
|
62
|
-
**JavaScript/TypeScript**:
|
|
63
|
-
```javascript
|
|
64
|
-
/**
|
|
65
|
-
* @task T####
|
|
66
|
-
* @session session_YYYYMMDD_HHMMSS_######
|
|
67
|
-
* @agent opus-1
|
|
68
|
-
* @date YYYY-MM-DD
|
|
69
|
-
* @description Brief description of the function
|
|
70
|
-
*/
|
|
71
|
-
function implementedFunction() {
|
|
72
|
-
// Implementation
|
|
73
|
-
}
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**Bash**:
|
|
77
|
-
```bash
|
|
78
|
-
# =============================================================================
|
|
79
|
-
# Function: function_name
|
|
80
|
-
# Task: T####
|
|
81
|
-
# Session: session_YYYYMMDD_HHMMSS_######
|
|
82
|
-
# Agent: opus-1
|
|
83
|
-
# Date: YYYY-MM-DD
|
|
84
|
-
# Description: Brief description
|
|
85
|
-
# =============================================================================
|
|
86
|
-
function_name() {
|
|
87
|
-
# Implementation
|
|
88
|
-
}
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**Python**:
|
|
92
|
-
```python
|
|
93
|
-
def implemented_function():
|
|
94
|
-
"""
|
|
95
|
-
Brief description.
|
|
96
|
-
|
|
97
|
-
Task: T####
|
|
98
|
-
Session: session_YYYYMMDD_HHMMSS_######
|
|
99
|
-
Agent: opus-1
|
|
100
|
-
Date: YYYY-MM-DD
|
|
101
|
-
"""
|
|
102
|
-
# Implementation
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Test Requirements
|
|
106
|
-
|
|
107
|
-
| Test Type | When Required | Coverage |
|
|
108
|
-
|-----------|---------------|----------|
|
|
109
|
-
| Unit | New functions | MUST cover happy path |
|
|
110
|
-
| Integration | New workflows | SHOULD cover end-to-end |
|
|
111
|
-
| Edge Case | Complex logic | SHOULD cover boundaries |
|
|
112
|
-
| Regression | Bug fixes | MUST reproduce issue |
|
|
113
|
-
|
|
114
|
-
### Code Style Checklist
|
|
115
|
-
|
|
116
|
-
| Language | Style Guide | Enforcement |
|
|
117
|
-
|----------|-------------|-------------|
|
|
118
|
-
| Bash | CLEO style (4 spaces, snake_case) | `shellcheck` |
|
|
119
|
-
| JavaScript | ESLint config | `eslint` |
|
|
120
|
-
| TypeScript | TSConfig strict | `tsc --noEmit` |
|
|
121
|
-
| Python | PEP 8 | `flake8`, `black` |
|
|
122
|
-
|
|
123
|
-
### File Output
|
|
124
|
-
|
|
125
|
-
```markdown
|
|
126
|
-
# Implementation: {Feature/Fix Title}
|
|
127
|
-
|
|
128
|
-
**Task**: T####
|
|
129
|
-
**Date**: YYYY-MM-DD
|
|
130
|
-
**Status**: complete|partial|blocked
|
|
131
|
-
**Agent Type**: implementation
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## Summary
|
|
136
|
-
|
|
137
|
-
{2-3 sentence summary of implementation}
|
|
138
|
-
|
|
139
|
-
## Changes
|
|
140
|
-
|
|
141
|
-
### Files Modified
|
|
142
|
-
|
|
143
|
-
| File | Action | Description |
|
|
144
|
-
|------|--------|-------------|
|
|
145
|
-
| `path/to/file.sh` | Modified | Added validation function |
|
|
146
|
-
| `path/to/new.sh` | Created | New utility module |
|
|
147
|
-
|
|
148
|
-
### Functions Added
|
|
149
|
-
|
|
150
|
-
| Function | File | Purpose |
|
|
151
|
-
|----------|------|---------|
|
|
152
|
-
| `validate_input()` | file.sh | Input validation |
|
|
153
|
-
|
|
154
|
-
### Functions Modified
|
|
155
|
-
|
|
156
|
-
| Function | File | Change |
|
|
157
|
-
|----------|------|--------|
|
|
158
|
-
| `process_data()` | file.sh | Added error handling |
|
|
159
|
-
|
|
160
|
-
## Tests
|
|
161
|
-
|
|
162
|
-
### New Tests
|
|
163
|
-
|
|
164
|
-
| Test | File | Coverage |
|
|
165
|
-
|------|------|----------|
|
|
166
|
-
| `test_validate_input` | tests/unit/file.bats | Input validation |
|
|
167
|
-
|
|
168
|
-
### Test Results
|
|
169
|
-
|
|
170
|
-
```
|
|
171
|
-
Running tests/unit/file.bats
|
|
172
|
-
✓ validate_input accepts valid input
|
|
173
|
-
✓ validate_input rejects empty input
|
|
174
|
-
✓ validate_input handles special characters
|
|
175
|
-
|
|
176
|
-
3 tests, 0 failures
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
## Validation
|
|
180
|
-
|
|
181
|
-
| Check | Status | Notes |
|
|
182
|
-
|-------|--------|-------|
|
|
183
|
-
| Tests pass | PASS | All 42 tests pass |
|
|
184
|
-
| Lint clean | PASS | No shellcheck warnings |
|
|
185
|
-
| No regressions | PASS | Existing tests unchanged |
|
|
186
|
-
|
|
187
|
-
## Breaking Changes
|
|
188
|
-
|
|
189
|
-
{If any, document migration path}
|
|
190
|
-
|
|
191
|
-
## Follow-up
|
|
192
|
-
|
|
193
|
-
- {Suggested improvements}
|
|
194
|
-
- {Technical debt items}
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
### Manifest Entry
|
|
198
|
-
|
|
199
|
-
@skills/_shared/manifest-operations.md
|
|
200
|
-
|
|
201
|
-
Use `cleo research add` to create the manifest entry:
|
|
202
|
-
|
|
203
|
-
```bash
|
|
204
|
-
cleo research add \
|
|
205
|
-
--title "Implementation: Feature Name" \
|
|
206
|
-
--file "YYYY-MM-DD_implementation.md" \
|
|
207
|
-
--topics "implementation,feature" \
|
|
208
|
-
--findings "3 functions added,Tests passing,No breaking changes" \
|
|
209
|
-
--status complete \
|
|
210
|
-
--task T#### \
|
|
211
|
-
--not-actionable \
|
|
212
|
-
--agent-type implementation
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
## Integration Points
|
|
218
|
-
|
|
219
|
-
### Base Protocol
|
|
220
|
-
|
|
221
|
-
- Inherits task lifecycle (start, execute, complete)
|
|
222
|
-
- Inherits manifest append requirement
|
|
223
|
-
- Inherits error handling patterns
|
|
224
|
-
|
|
225
|
-
### Protocol Interactions
|
|
226
|
-
|
|
227
|
-
| Combined With | Behavior |
|
|
228
|
-
|---------------|----------|
|
|
229
|
-
| specification | Spec defines implementation requirements |
|
|
230
|
-
| contribution | Implementation triggers contribution record |
|
|
231
|
-
| release | Implementation changes tracked for release |
|
|
232
|
-
|
|
233
|
-
### Workflow Sequence
|
|
234
|
-
|
|
235
|
-
```
|
|
236
|
-
1. Read task requirements (cleo show T####)
|
|
237
|
-
2. Start task (cleo start T####)
|
|
238
|
-
3. Implement changes with provenance tags
|
|
239
|
-
4. Write/update tests
|
|
240
|
-
5. Run validation (tests, lint)
|
|
241
|
-
6. Document changes in output file
|
|
242
|
-
7. Append manifest entry
|
|
243
|
-
8. Complete task (cleo complete T####)
|
|
244
|
-
9. Return completion message
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## Example
|
|
250
|
-
|
|
251
|
-
**Task**: Implement session binding for multi-agent support
|
|
252
|
-
|
|
253
|
-
**Manifest Entry Command**:
|
|
254
|
-
```bash
|
|
255
|
-
cleo research add \
|
|
256
|
-
--title "Implementation: Session Binding" \
|
|
257
|
-
--file "2026-01-26_session-binding-impl.md" \
|
|
258
|
-
--topics "session,binding,multi-agent" \
|
|
259
|
-
--findings "TTY binding implemented,Env var fallback added,4 new tests passing" \
|
|
260
|
-
--status complete \
|
|
261
|
-
--task T2400 \
|
|
262
|
-
--epic T2392 \
|
|
263
|
-
--not-actionable \
|
|
264
|
-
--agent-type implementation
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
**Return Message**:
|
|
268
|
-
```
|
|
269
|
-
Implementation complete. See MANIFEST.jsonl for summary.
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
---
|
|
273
|
-
|
|
274
|
-
## Provenance Validation
|
|
275
|
-
|
|
276
|
-
### Pre-Commit Hook
|
|
277
|
-
|
|
278
|
-
**Location**: `.git/hooks/commit-msg` (installed via `git config core.hooksPath .cleo/hooks`)
|
|
279
|
-
|
|
280
|
-
**Logic**:
|
|
281
|
-
1. Extract @task tags from commit diff
|
|
282
|
-
2. Count new functions/classes
|
|
283
|
-
3. Calculate provenance coverage
|
|
284
|
-
4. Apply thresholds:
|
|
285
|
-
- **New code**: 100% coverage required
|
|
286
|
-
- **Existing code**: 80% coverage required
|
|
287
|
-
- **Legacy code**: 50% coverage required
|
|
288
|
-
5. Block commit if thresholds not met
|
|
289
|
-
|
|
290
|
-
**Exit Code**: `EXIT_PROTOCOL_IMPLEMENTATION` (64) on violation
|
|
291
|
-
|
|
292
|
-
### Runtime Validation
|
|
293
|
-
|
|
294
|
-
**Command** (planned): `cleo provenance validate [--task TASK_ID]`
|
|
295
|
-
|
|
296
|
-
**Current State**: Validation available via protocol library
|
|
297
|
-
|
|
298
|
-
```bash
|
|
299
|
-
# Programmatic validation
|
|
300
|
-
source lib/protocol-validation.sh
|
|
301
|
-
result=$(validate_implementation_protocol "T1234" "$manifest_entry" "false")
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
**Checks**:
|
|
305
|
-
- IMPL-003: `@task T####` tags in new functions
|
|
306
|
-
- Git diff analysis for provenance coverage
|
|
307
|
-
- Agent type = "implementation" (IMPL-007)
|
|
308
|
-
|
|
309
|
-
### Thresholds
|
|
310
|
-
|
|
311
|
-
| Code Category | Provenance Requirement | Rationale |
|
|
312
|
-
|---------------|------------------------|-----------|
|
|
313
|
-
| **New code** | 100% | Fresh code must be attributable |
|
|
314
|
-
| **Existing code** | 80% | Modifications should track origin |
|
|
315
|
-
| **Legacy code** | 50% | Gradual attribution improvement |
|
|
316
|
-
|
|
317
|
-
**Detection**:
|
|
318
|
-
- New code: Lines with `^+` in git diff, no prior history
|
|
319
|
-
- Existing code: Modified files with prior commits
|
|
320
|
-
- Legacy code: Files >6 months old or >100 commits
|
|
321
|
-
|
|
322
|
-
### Enforcement Points
|
|
323
|
-
|
|
324
|
-
1. **Pre-commit**: Blocks commits lacking provenance
|
|
325
|
-
2. **Pre-push**: Warns on aggregate provenance score <70%
|
|
326
|
-
3. **Runtime**: `cleo complete` validates IMPL-003 for implementation tasks
|
|
327
|
-
4. **Orchestrator**: Validates before spawning implementation agents
|
|
328
|
-
|
|
329
|
-
---
|
|
330
|
-
|
|
331
|
-
## Anti-Patterns
|
|
332
|
-
|
|
333
|
-
| Pattern | Why Avoid |
|
|
334
|
-
|---------|-----------|
|
|
335
|
-
| Code without tests | Regression risk |
|
|
336
|
-
| Missing provenance | Lost attribution |
|
|
337
|
-
| Skipping validation | Quality regression |
|
|
338
|
-
| Undocumented breaking changes | Surprise failures |
|
|
339
|
-
| No error handling | Silent failures |
|
|
340
|
-
| Hardcoded values | Maintenance burden |
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
*Protocol Version 1.0.0 - Implementation Protocol*
|