@cleocode/core 2026.4.5 → 2026.4.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/dist/discovery.d.ts +69 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1643 -2349
- package/dist/index.js.map +4 -4
- package/dist/init.d.ts +51 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/internal.d.ts +9 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/lifecycle/default-chain.d.ts +8 -2
- package/dist/lifecycle/default-chain.d.ts.map +1 -1
- package/dist/lifecycle/index.d.ts +1 -0
- package/dist/lifecycle/index.d.ts.map +1 -1
- package/dist/lifecycle/stage-guidance.d.ts +140 -0
- package/dist/lifecycle/stage-guidance.d.ts.map +1 -0
- package/dist/orchestration/protocol-validators.d.ts +122 -3
- package/dist/orchestration/protocol-validators.d.ts.map +1 -1
- package/dist/paths.d.ts +91 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/scaffold.d.ts +31 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/skills/dispatch.d.ts +1 -1
- package/dist/skills/skill-paths.d.ts +9 -6
- package/dist/skills/skill-paths.d.ts.map +1 -1
- package/dist/validation/protocols/_shared.d.ts +40 -0
- package/dist/validation/protocols/_shared.d.ts.map +1 -0
- package/dist/validation/protocols/architecture-decision.d.ts +23 -0
- package/dist/validation/protocols/architecture-decision.d.ts.map +1 -0
- package/dist/validation/protocols/artifact-publish.d.ts +22 -0
- package/dist/validation/protocols/artifact-publish.d.ts.map +1 -0
- package/dist/validation/protocols/consensus.d.ts +11 -17
- package/dist/validation/protocols/consensus.d.ts.map +1 -1
- package/dist/validation/protocols/contribution.d.ts +12 -17
- package/dist/validation/protocols/contribution.d.ts.map +1 -1
- package/dist/validation/protocols/decomposition.d.ts +18 -21
- package/dist/validation/protocols/decomposition.d.ts.map +1 -1
- package/dist/validation/protocols/implementation.d.ts +9 -17
- package/dist/validation/protocols/implementation.d.ts.map +1 -1
- package/dist/validation/protocols/provenance.d.ts +23 -0
- package/dist/validation/protocols/provenance.d.ts.map +1 -0
- package/dist/validation/protocols/release.d.ts +25 -0
- package/dist/validation/protocols/release.d.ts.map +1 -0
- package/dist/validation/protocols/research.d.ts +9 -17
- package/dist/validation/protocols/research.d.ts.map +1 -1
- package/dist/validation/protocols/specification.d.ts +7 -17
- package/dist/validation/protocols/specification.d.ts.map +1 -1
- package/dist/validation/protocols/testing.d.ts +22 -0
- package/dist/validation/protocols/testing.d.ts.map +1 -0
- package/dist/validation/protocols/validation.d.ts +22 -0
- package/dist/validation/protocols/validation.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/__tests__/injection-mvi-tiers.test.js +54 -90
- package/src/__tests__/injection-mvi-tiers.test.js.map +1 -1
- package/src/discovery.ts +235 -0
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js +3 -1
- package/src/hooks/handlers/__tests__/hook-automation-e2e.test.js.map +1 -1
- package/src/index.ts +16 -0
- package/src/init.ts +196 -0
- package/src/internal.ts +31 -1
- package/src/lifecycle/default-chain.ts +11 -2
- package/src/lifecycle/index.ts +10 -0
- package/src/lifecycle/stage-guidance.ts +282 -0
- package/src/metrics/__tests__/provider-detection.test.js +19 -7
- package/src/metrics/__tests__/provider-detection.test.js.map +1 -1
- package/src/orchestration/__tests__/protocol-validators.test.js +228 -8
- package/src/orchestration/__tests__/protocol-validators.test.js.map +1 -1
- package/src/orchestration/__tests__/protocol-validators.test.ts +259 -7
- package/src/orchestration/protocol-validators.ts +419 -4
- package/src/paths.ts +110 -0
- package/src/scaffold.ts +240 -4
- package/src/skills/dispatch.ts +6 -6
- package/src/skills/skill-paths.ts +27 -23
- package/src/validation/protocols/_shared.ts +88 -0
- package/src/validation/protocols/architecture-decision.ts +52 -0
- package/src/validation/protocols/artifact-publish.ts +49 -0
- package/src/validation/protocols/consensus.ts +44 -74
- package/src/validation/protocols/contribution.ts +28 -65
- package/src/validation/protocols/decomposition.ts +37 -64
- package/src/validation/protocols/implementation.ts +25 -65
- package/src/validation/protocols/protocols-markdown/architecture-decision.md +303 -0
- package/src/validation/protocols/protocols-markdown/artifact-publish.md +600 -0
- package/src/validation/protocols/protocols-markdown/consensus.md +322 -0
- package/src/validation/protocols/protocols-markdown/contribution.md +388 -0
- package/src/validation/protocols/protocols-markdown/decomposition.md +421 -0
- package/src/validation/protocols/protocols-markdown/implementation.md +357 -0
- package/src/validation/protocols/protocols-markdown/provenance.md +613 -0
- package/src/validation/protocols/protocols-markdown/release.md +783 -0
- package/src/validation/protocols/protocols-markdown/research.md +261 -0
- package/src/validation/protocols/protocols-markdown/specification.md +300 -0
- package/src/validation/protocols/protocols-markdown/testing.md +287 -0
- package/src/validation/protocols/protocols-markdown/validation.md +242 -0
- package/src/validation/protocols/provenance.ts +50 -0
- package/src/validation/protocols/release.ts +44 -0
- package/src/validation/protocols/research.ts +25 -87
- package/src/validation/protocols/specification.ts +27 -89
- package/src/validation/protocols/testing.ts +46 -0
- package/src/validation/protocols/validation.ts +46 -0
- package/dist/validation/protocols/release-protocol.d.ts +0 -27
- package/dist/validation/protocols/release-protocol.d.ts.map +0 -1
- package/dist/validation/protocols/testing-protocol.d.ts +0 -27
- package/dist/validation/protocols/testing-protocol.d.ts.map +0 -1
- package/dist/validation/protocols/validation-protocol.d.ts +0 -27
- package/dist/validation/protocols/validation-protocol.d.ts.map +0 -1
- package/schemas/agent-configs.schema.json +0 -120
- package/schemas/agent-registry.schema.json +0 -132
- package/schemas/archive.schema.json +0 -450
- package/schemas/brain-decision.schema.json +0 -69
- package/schemas/brain-learning.schema.json +0 -57
- package/schemas/brain-pattern.schema.json +0 -72
- package/schemas/critical-path.schema.json +0 -246
- package/schemas/deps-cache.schema.json +0 -97
- package/schemas/doctor-output.schema.json +0 -283
- package/schemas/error.schema.json +0 -161
- package/schemas/global-config.schema.json +0 -219
- package/schemas/grade.schema.json +0 -49
- package/schemas/log.schema.json +0 -250
- package/schemas/metrics.schema.json +0 -328
- package/schemas/migrations.schema.json +0 -150
- package/schemas/nexus-registry.schema.json +0 -90
- package/schemas/operation-constitution.schema.json +0 -438
- package/schemas/output.schema.json +0 -164
- package/schemas/projects-registry.schema.json +0 -107
- package/schemas/protocol-frontmatter.schema.json +0 -72
- package/schemas/rcasd-consensus-report.schema.json +0 -10
- package/schemas/rcasd-evidence.schema.json +0 -42
- package/schemas/rcasd-gate-result.schema.json +0 -46
- package/schemas/rcasd-hitl-resolution.schema.json +0 -10
- package/schemas/rcasd-index.schema.json +0 -10
- package/schemas/rcasd-manifest.schema.json +0 -10
- package/schemas/rcasd-research-output.schema.json +0 -10
- package/schemas/rcasd-spec-frontmatter.schema.json +0 -10
- package/schemas/rcasd-stage-transition.schema.json +0 -38
- package/schemas/releases.schema.json +0 -267
- package/schemas/skills-manifest.schema.json +0 -91
- package/schemas/spec-index.schema.json +0 -196
- package/schemas/system-flow-atlas.schema.json +0 -125
- package/src/conduit/__tests__/dual-api-e2e.test.d.ts.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.js +0 -178
- package/src/conduit/__tests__/dual-api-e2e.test.js.map +0 -1
- package/src/conduit/__tests__/dual-api-e2e.test.ts +0 -212
- package/src/validation/protocols/release-protocol.ts +0 -80
- package/src/validation/protocols/testing-protocol.ts +0 -93
- package/src/validation/protocols/validation-protocol.ts +0 -93
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: DCMP
|
|
3
|
+
title: Decomposition Protocol
|
|
4
|
+
version: 2.0.0
|
|
5
|
+
status: active
|
|
6
|
+
type: conditional
|
|
7
|
+
audience: [llm-agent, orchestrator]
|
|
8
|
+
tags: [decomposition, hierarchy, atomicity, planning]
|
|
9
|
+
skillRef: ct-epic-architect
|
|
10
|
+
mcpOperations:
|
|
11
|
+
- tasks.add
|
|
12
|
+
- tasks.update
|
|
13
|
+
- session.start
|
|
14
|
+
lastUpdated: 2026-02-24
|
|
15
|
+
provenanceTask: T3155
|
|
16
|
+
enforcement: strict
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# Decomposition Protocol
|
|
20
|
+
|
|
21
|
+
**Provenance**: @task T3155, @epic T3147
|
|
22
|
+
**Version**: 2.0.0
|
|
23
|
+
**Type**: Conditional Protocol
|
|
24
|
+
**Max Active**: 3 protocols (including base)
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Trigger Conditions
|
|
29
|
+
|
|
30
|
+
This protocol activates when the task involves:
|
|
31
|
+
|
|
32
|
+
| Trigger | Keywords | Context |
|
|
33
|
+
|---------|----------|---------|
|
|
34
|
+
| Epic Planning | "epic", "project", "initiative" | Large scope work |
|
|
35
|
+
| Breakdown | "decompose", "break down", "split" | Task subdivision |
|
|
36
|
+
| Planning | "plan", "roadmap", "phases" | Work organization |
|
|
37
|
+
| Analysis | "scope", "estimate complexity" | Size assessment |
|
|
38
|
+
|
|
39
|
+
**Explicit Override**: `--protocol decomposition` flag on task creation.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Hard Invariants vs. Configurable Limits
|
|
44
|
+
|
|
45
|
+
### Hard Invariants (always enforced regardless of profile)
|
|
46
|
+
- **Parent must exist**: The parent task ID must be present in the task store
|
|
47
|
+
- **No circular references**: Moving a task under its own descendant is always rejected
|
|
48
|
+
- **Dependency DAG integrity**: The blockedBy/blocks relationship must remain acyclic
|
|
49
|
+
|
|
50
|
+
### Configurable Limits (profile-driven, overridable per project)
|
|
51
|
+
- **maxSiblings** (default: 0 = unlimited for `llm-agent-first` profile; 7 for `human-cognitive`)
|
|
52
|
+
— Set `hierarchy.maxSiblings` in `.cleo/config.json` to enforce a limit
|
|
53
|
+
- **maxActiveSiblings** (default: 32): Operational concurrency guard — caps the number of `pending|active|blocked` siblings under one parent
|
|
54
|
+
- **maxDepth** (default: 3): Maximum nesting depth (epic → task → subtask)
|
|
55
|
+
|
|
56
|
+
### Enforcement Profiles
|
|
57
|
+
|
|
58
|
+
| Profile | maxSiblings | maxActiveSiblings | maxDepth |
|
|
59
|
+
|---------|-------------|-------------------|----------|
|
|
60
|
+
| `llm-agent-first` (default) | 0 (unlimited) | 32 | 3 |
|
|
61
|
+
| `human-cognitive` | 7 | 3 | 3 |
|
|
62
|
+
|
|
63
|
+
Configure via `.cleo/config.json`:
|
|
64
|
+
```json
|
|
65
|
+
{ "hierarchy": { "enforcementProfile": "human-cognitive" } }
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Requirements (RFC 2119)
|
|
71
|
+
|
|
72
|
+
### MUST
|
|
73
|
+
|
|
74
|
+
| Requirement | Description |
|
|
75
|
+
|-------------|-------------|
|
|
76
|
+
| DCMP-001 | MUST follow MECE principle (Mutually Exclusive, Collectively Exhaustive) |
|
|
77
|
+
| DCMP-002 | MUST map dependencies between tasks |
|
|
78
|
+
| DCMP-003 | MUST respect the configured hierarchy.maxDepth policy (default: 3) |
|
|
79
|
+
| DCMP-004 | MUST verify atomicity for leaf tasks |
|
|
80
|
+
| DCMP-005 | MUST NOT include time estimates (use size: small/medium/large) |
|
|
81
|
+
| DCMP-006 | MUST include acceptance criteria for each task |
|
|
82
|
+
| DCMP-007 | Siblings MUST respect the configured hierarchy.maxSiblings policy (0 = unlimited) |
|
|
83
|
+
| DCMP-008 | Depth MUST respect the configured hierarchy.maxDepth policy (default: 3) |
|
|
84
|
+
| DCMP-009 | MUST set `agent_type: "analysis"` in manifest |
|
|
85
|
+
|
|
86
|
+
### SHOULD
|
|
87
|
+
|
|
88
|
+
| Requirement | Description |
|
|
89
|
+
|-------------|-------------|
|
|
90
|
+
| DCMP-010 | SHOULD identify parallel execution opportunities |
|
|
91
|
+
| DCMP-011 | SHOULD flag unclear requirements for HITL |
|
|
92
|
+
| DCMP-012 | SHOULD consider existing task overlap |
|
|
93
|
+
| DCMP-013 | SHOULD assign phase to each task |
|
|
94
|
+
|
|
95
|
+
### MAY
|
|
96
|
+
|
|
97
|
+
| Requirement | Description |
|
|
98
|
+
|-------------|-------------|
|
|
99
|
+
| DCMP-020 | MAY propose multiple decomposition options |
|
|
100
|
+
| DCMP-021 | MAY identify risks and mitigations |
|
|
101
|
+
| DCMP-022 | MAY suggest task consolidation |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Output Format
|
|
106
|
+
|
|
107
|
+
### Hierarchy Structure
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
EPIC (T001) - Large initiative
|
|
111
|
+
├── TASK (T002) - Coherent unit of work
|
|
112
|
+
│ ├── SUBTASK (T003) - Atomic task (MUST be atomic)
|
|
113
|
+
│ └── SUBTASK (T004) - Atomic task
|
|
114
|
+
├── TASK (T005) - Another unit
|
|
115
|
+
│ └── SUBTASK (T006)
|
|
116
|
+
└── TASK (T007) - Independent task
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Size Definitions
|
|
120
|
+
|
|
121
|
+
| Size | Scope | Atomicity |
|
|
122
|
+
|------|-------|-----------|
|
|
123
|
+
| `small` | 1-2 files, single concern | MUST be atomic |
|
|
124
|
+
| `medium` | 3-7 files, related concerns | SHOULD be atomic |
|
|
125
|
+
| `large` | 8+ files, multiple concerns | MUST decompose further |
|
|
126
|
+
|
|
127
|
+
### Atomicity Criteria (6-Point Test)
|
|
128
|
+
|
|
129
|
+
| # | Criterion | Pass Condition |
|
|
130
|
+
|---|-----------|----------------|
|
|
131
|
+
| 1 | Single File Scope | Affects ≤3 tightly-coupled files |
|
|
132
|
+
| 2 | Single Cognitive Concern | One bounded concern per task |
|
|
133
|
+
| 3 | Clear Acceptance Criteria | Testable completion condition |
|
|
134
|
+
| 4 | No Context Switching | Completable within a single agent session |
|
|
135
|
+
| 5 | No Hidden Sub-Decisions | All choices made at decomposition |
|
|
136
|
+
| 6 | Programmatic Validation | Result verifiable by code/test |
|
|
137
|
+
|
|
138
|
+
### Dependency Graph
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"tasks": [
|
|
143
|
+
{"id": "T001", "type": "epic", "children": ["T002", "T005", "T007"]},
|
|
144
|
+
{"id": "T002", "type": "task", "parent": "T001", "children": ["T003", "T004"], "depends": []},
|
|
145
|
+
{"id": "T003", "type": "subtask", "parent": "T002", "depends": []},
|
|
146
|
+
{"id": "T004", "type": "subtask", "parent": "T002", "depends": ["T003"]},
|
|
147
|
+
{"id": "T005", "type": "task", "parent": "T001", "depends": ["T002"]},
|
|
148
|
+
{"id": "T007", "type": "task", "parent": "T001", "depends": []}
|
|
149
|
+
],
|
|
150
|
+
"waves": [
|
|
151
|
+
{"wave": 0, "tasks": ["T003", "T007"]},
|
|
152
|
+
{"wave": 1, "tasks": ["T004"]},
|
|
153
|
+
{"wave": 2, "tasks": ["T002"]},
|
|
154
|
+
{"wave": 3, "tasks": ["T005"]}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Wave Computation
|
|
160
|
+
|
|
161
|
+
Tasks are grouped into waves for parallel execution:
|
|
162
|
+
|
|
163
|
+
| Wave | Condition | Execution |
|
|
164
|
+
|------|-----------|-----------|
|
|
165
|
+
| 0 | No dependencies | Parallel |
|
|
166
|
+
| 1 | Depends only on wave 0 | Parallel after wave 0 |
|
|
167
|
+
| N | Depends on wave N-1 or earlier | Sequential ordering |
|
|
168
|
+
|
|
169
|
+
### File Output
|
|
170
|
+
|
|
171
|
+
```markdown
|
|
172
|
+
# Decomposition: {Epic Title}
|
|
173
|
+
|
|
174
|
+
**Task**: T####
|
|
175
|
+
**Date**: YYYY-MM-DD
|
|
176
|
+
**Status**: complete|partial|blocked
|
|
177
|
+
**Agent Type**: analysis
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Epic Summary
|
|
182
|
+
|
|
183
|
+
{2-3 sentence summary of the epic scope}
|
|
184
|
+
|
|
185
|
+
## Task Hierarchy
|
|
186
|
+
|
|
187
|
+
### T001 - {Epic Title} (epic, large)
|
|
188
|
+
|
|
189
|
+
**Description**: {Epic description}
|
|
190
|
+
**Phase**: {phase}
|
|
191
|
+
|
|
192
|
+
#### T002 - {Task Title} (task, medium)
|
|
193
|
+
|
|
194
|
+
**Description**: {Task description}
|
|
195
|
+
**Depends**: none
|
|
196
|
+
**Phase**: {phase}
|
|
197
|
+
**Acceptance Criteria**:
|
|
198
|
+
- {Criterion 1}
|
|
199
|
+
- {Criterion 2}
|
|
200
|
+
|
|
201
|
+
##### T003 - {Subtask Title} (subtask, small)
|
|
202
|
+
|
|
203
|
+
**Description**: {Subtask description}
|
|
204
|
+
**Depends**: none
|
|
205
|
+
**Atomicity**: 6/6 (PASS)
|
|
206
|
+
**Acceptance Criteria**:
|
|
207
|
+
- {Testable criterion}
|
|
208
|
+
|
|
209
|
+
## Dependency Graph
|
|
210
|
+
|
|
211
|
+
```mermaid
|
|
212
|
+
graph TD
|
|
213
|
+
T001[Epic] --> T002[Task A]
|
|
214
|
+
T001 --> T005[Task B]
|
|
215
|
+
T002 --> T003[Subtask 1]
|
|
216
|
+
T002 --> T004[Subtask 2]
|
|
217
|
+
T003 --> T004
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Wave Analysis
|
|
221
|
+
|
|
222
|
+
| Wave | Tasks | Parallel Opportunities |
|
|
223
|
+
|------|-------|----------------------|
|
|
224
|
+
| 0 | T003, T007 | 2 tasks parallel |
|
|
225
|
+
| 1 | T004 | Sequential |
|
|
226
|
+
| 2 | T002, T005 | 2 tasks parallel |
|
|
227
|
+
|
|
228
|
+
## Risks
|
|
229
|
+
|
|
230
|
+
| Risk | Impact | Mitigation |
|
|
231
|
+
|------|--------|------------|
|
|
232
|
+
| {Risk} | {Impact} | {Mitigation} |
|
|
233
|
+
|
|
234
|
+
## Open Questions
|
|
235
|
+
|
|
236
|
+
- {Questions requiring HITL resolution}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Manifest Entry
|
|
240
|
+
|
|
241
|
+
@skills/_shared/manifest-operations.md
|
|
242
|
+
|
|
243
|
+
Use `cleo research add` to create the manifest entry:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
cleo research add \
|
|
247
|
+
--title "Decomposition: Epic Title" \
|
|
248
|
+
--file "YYYY-MM-DD_decomposition.md" \
|
|
249
|
+
--topics "decomposition,planning,epic" \
|
|
250
|
+
--findings "12 tasks identified,3 wave parallel plan,2 HITL questions" \
|
|
251
|
+
--status complete \
|
|
252
|
+
--task T#### \
|
|
253
|
+
--actionable \
|
|
254
|
+
--needs-followup T#### \
|
|
255
|
+
--agent-type analysis
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Integration Points
|
|
261
|
+
|
|
262
|
+
### Base Protocol
|
|
263
|
+
|
|
264
|
+
- Inherits task lifecycle (start, execute, complete)
|
|
265
|
+
- Inherits manifest append requirement
|
|
266
|
+
- Inherits error handling patterns
|
|
267
|
+
|
|
268
|
+
### Protocol Interactions
|
|
269
|
+
|
|
270
|
+
| Combined With | Behavior |
|
|
271
|
+
|---------------|----------|
|
|
272
|
+
| research | Research informs scope understanding |
|
|
273
|
+
| specification | Spec defines task boundaries |
|
|
274
|
+
| implementation | Decomposition feeds implementation order |
|
|
275
|
+
|
|
276
|
+
### CLEO Integration
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Create epic and tasks from decomposition
|
|
280
|
+
cleo add "Epic Title" --type epic --size large
|
|
281
|
+
|
|
282
|
+
# Add tasks with hierarchy
|
|
283
|
+
cleo add "Task A" --parent T001 --type task --size medium --phase core
|
|
284
|
+
|
|
285
|
+
# Add subtasks
|
|
286
|
+
cleo add "Subtask 1" --parent T002 --type subtask --size small --phase core
|
|
287
|
+
|
|
288
|
+
# Set dependencies
|
|
289
|
+
cleo update T004 --depends T003
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## Example
|
|
295
|
+
|
|
296
|
+
**Task**: Decompose CLEO Universal Subagent Architecture
|
|
297
|
+
|
|
298
|
+
**Manifest Entry Command**:
|
|
299
|
+
```bash
|
|
300
|
+
cleo research add \
|
|
301
|
+
--title "Decomposition: Universal Subagent Architecture" \
|
|
302
|
+
--file "2026-01-26_subagent-decomposition.md" \
|
|
303
|
+
--topics "subagent,architecture,decomposition" \
|
|
304
|
+
--findings "14 tasks identified,4 parallel waves,Base protocol + 7 conditional protocols" \
|
|
305
|
+
--status complete \
|
|
306
|
+
--task T2392 \
|
|
307
|
+
--actionable \
|
|
308
|
+
--needs-followup T2393,T2394 \
|
|
309
|
+
--agent-type analysis
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## Atomicity Validation Module
|
|
315
|
+
|
|
316
|
+
The 6-point atomicity test is implemented as a shared TypeScript module at
|
|
317
|
+
`src/core/tasks/atomicity.ts`. The `checkAtomicity(task, threshold?)` function
|
|
318
|
+
scores tasks against these criteria:
|
|
319
|
+
|
|
320
|
+
1. **single-file-scope** — Task targets a single file or bounded concern
|
|
321
|
+
2. **single-cognitive-concern** — Title uses at most one action verb
|
|
322
|
+
3. **clear-acceptance-criteria** — Description specifies verifiable completion
|
|
323
|
+
4. **no-context-switching** — Task spans at most 2 technical domains
|
|
324
|
+
5. **no-hidden-decisions** — No deferred choices (TBD, figure out, unclear)
|
|
325
|
+
6. **programmatic-validation-possible** — Output can be tested programmatically
|
|
326
|
+
|
|
327
|
+
Default passing threshold: 4/6. The `ATOMICITY_CRITERIA` constant is exported
|
|
328
|
+
for use in protocol validators and orchestrator pre-spawn gating.
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Atomicity Validation
|
|
333
|
+
|
|
334
|
+
### Atomicity Checklist
|
|
335
|
+
|
|
336
|
+
For each leaf task, verify:
|
|
337
|
+
|
|
338
|
+
- [ ] **Single Responsibility**: One clear objective
|
|
339
|
+
- [ ] **Completable in 1 agent session**: Scoped to a single execution context
|
|
340
|
+
- [ ] **Testable**: Has clear acceptance criteria
|
|
341
|
+
- [ ] **Mergeable**: Can be PR'd independently
|
|
342
|
+
- [ ] **Reversible**: Can be rolled back if needed
|
|
343
|
+
- [ ] **Dependencies Clear**: Blocking tasks explicit
|
|
344
|
+
|
|
345
|
+
### Validation Command
|
|
346
|
+
|
|
347
|
+
**Command** (planned): `cleo atomicity check --epic EPIC_ID`
|
|
348
|
+
|
|
349
|
+
**Current State**: Available via `validate_decomposition_protocol()` in `lib/protocol-validation.sh`
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Programmatic validation
|
|
353
|
+
source lib/protocol-validation.sh
|
|
354
|
+
child_tasks=$(cleo list --parent T2000 --format json | jq -c '.tasks')
|
|
355
|
+
result=$(validate_decomposition_protocol "T2000" "T2000" "$child_tasks" "false")
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Checks**:
|
|
359
|
+
- DCMP-002: No circular dependencies (via hierarchy validation)
|
|
360
|
+
- DCMP-003: Exceeds configured maxDepth (default: 3, epic→task→subtask)
|
|
361
|
+
- DCMP-004: Atomicity test (6 criteria above)
|
|
362
|
+
- DCMP-007: Exceeds configured maxSiblings (default: unlimited for llm-agent-first profile)
|
|
363
|
+
|
|
364
|
+
### Scoring System
|
|
365
|
+
|
|
366
|
+
Each leaf task scored on 6 criteria (pass/fail per criterion):
|
|
367
|
+
|
|
368
|
+
| Score | Interpretation | Action |
|
|
369
|
+
|-------|---------------|--------|
|
|
370
|
+
| 6/6 | Atomic | Proceed |
|
|
371
|
+
| 4-5/6 | Mostly atomic | Review failing criteria |
|
|
372
|
+
| 2-3/6 | Needs refinement | Split or clarify |
|
|
373
|
+
| 0-1/6 | Not atomic | Reject, re-decompose |
|
|
374
|
+
|
|
375
|
+
**Aggregate Epic Score**: Average of leaf task scores
|
|
376
|
+
|
|
377
|
+
### Orchestrator Integration
|
|
378
|
+
|
|
379
|
+
Hierarchy enforcement is implemented in `src/core/tasks/hierarchy-policy.ts`.
|
|
380
|
+
The `resolveHierarchyPolicy(config)` function returns the active `HierarchyPolicy`
|
|
381
|
+
for the project, incorporating the configured enforcement profile and any explicit overrides.
|
|
382
|
+
|
|
383
|
+
**Pre-Decomposition**:
|
|
384
|
+
- Epic architect validates parent epic exists
|
|
385
|
+
- Checks current depth against the configured hierarchy.maxDepth policy (default: 3)
|
|
386
|
+
- Verifies sibling count against the configured hierarchy.maxSiblings policy (default: unlimited for llm-agent-first profile)
|
|
387
|
+
|
|
388
|
+
**Post-Decomposition**:
|
|
389
|
+
- Validates all new tasks meet atomicity criteria
|
|
390
|
+
- Blocks spawn of non-atomic tasks
|
|
391
|
+
- Returns refinement suggestions
|
|
392
|
+
|
|
393
|
+
### Exit Codes
|
|
394
|
+
|
|
395
|
+
- `EXIT_PROTOCOL_DECOMPOSITION` (63) - Decomposition protocol violation
|
|
396
|
+
- Common violations: Configured maxSiblings exceeded, configured maxDepth exceeded, non-atomic tasks
|
|
397
|
+
|
|
398
|
+
### Auto-Refinement (Future)
|
|
399
|
+
|
|
400
|
+
**Planned**: If atomicity score <4/6:
|
|
401
|
+
1. Analyze failing criteria
|
|
402
|
+
2. Suggest task splits
|
|
403
|
+
3. Generate refined decomposition
|
|
404
|
+
4. Re-validate until score ≥4/6
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## Anti-Patterns
|
|
409
|
+
|
|
410
|
+
| Pattern | Why Avoid |
|
|
411
|
+
|---------|-----------|
|
|
412
|
+
| Time estimates | Cannot predict duration accurately |
|
|
413
|
+
| Non-atomic leaf tasks | Create hidden work |
|
|
414
|
+
| Missing dependencies | Incorrect execution order |
|
|
415
|
+
| Exceeding configured maxDepth | Complexity explosion |
|
|
416
|
+
| Overlapping scopes (not MECE) | Duplicate work |
|
|
417
|
+
| Skipping atomicity check | Quality regression |
|
|
418
|
+
|
|
419
|
+
---
|
|
420
|
+
|
|
421
|
+
*Protocol Version 2.0.0 - Decomposition Protocol*
|