@cleocode/cleo 2026.2.8 → 2026.3.0

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.
Files changed (62) hide show
  1. package/README.md +14 -13
  2. package/dist/cli/index.js +22676 -26012
  3. package/dist/cli/index.js.map +4 -4
  4. package/dist/mcp/index.js +1651 -802
  5. package/dist/mcp/index.js.map +4 -4
  6. package/drizzle/20260301053344_careless_changeling/migration.sql +27 -0
  7. package/drizzle/20260301053344_careless_changeling/snapshot.json +2598 -0
  8. package/package.json +3 -4
  9. package/packages/ct-skills/skills/ct-cleo/SKILL.md +49 -22
  10. package/templates/CLEO-INJECTION.md +32 -138
  11. package/templates/cleo-gitignore +66 -49
  12. package/templates/git-hooks/pre-commit +24 -6
  13. package/schemas/archive/agent-configs.schema.json +0 -120
  14. package/schemas/archive/agent-registry.schema.json +0 -132
  15. package/schemas/archive/archive.schema.json +0 -450
  16. package/schemas/archive/claudedocs-frontmatter.schema.json +0 -162
  17. package/schemas/archive/commands-index.schema.json +0 -158
  18. package/schemas/archive/contribution.schema.json +0 -722
  19. package/schemas/archive/critical-path.schema.json +0 -246
  20. package/schemas/archive/deps-cache.schema.json +0 -97
  21. package/schemas/archive/doctor-output.schema.json +0 -283
  22. package/schemas/archive/error.schema.json +0 -161
  23. package/schemas/archive/export-package.schema.json +0 -375
  24. package/schemas/archive/global-config.schema.json +0 -219
  25. package/schemas/archive/log.schema.json +0 -250
  26. package/schemas/archive/metrics.schema.json +0 -328
  27. package/schemas/archive/migrations.schema.json +0 -150
  28. package/schemas/archive/nexus-registry.schema.json +0 -90
  29. package/schemas/archive/output.schema.json +0 -164
  30. package/schemas/archive/rcsd-consensus-report.schema.json +0 -491
  31. package/schemas/archive/rcsd-hitl-resolution.schema.json +0 -216
  32. package/schemas/archive/rcsd-index.schema.json +0 -384
  33. package/schemas/archive/rcsd-manifest.schema.json +0 -264
  34. package/schemas/archive/rcsd-research-output.schema.json +0 -564
  35. package/schemas/archive/rcsd-spec-frontmatter.schema.json +0 -225
  36. package/schemas/archive/releases.schema.json +0 -267
  37. package/schemas/archive/skills-manifest.schema.json +0 -91
  38. package/schemas/archive/skillsmp.schema.json +0 -208
  39. package/schemas/archive/spec-index.schema.json +0 -196
  40. package/schemas/archive/todo.schema.json +0 -995
  41. package/schemas/claudedocs-frontmatter.schema.json +0 -162
  42. package/schemas/commands-index.schema.json +0 -158
  43. package/schemas/rcsd-consensus-report.schema.json +0 -494
  44. package/schemas/rcsd-hitl-resolution.schema.json +0 -219
  45. package/schemas/rcsd-index.schema.json +0 -387
  46. package/schemas/rcsd-manifest.schema.json +0 -267
  47. package/schemas/rcsd-research-output.schema.json +0 -567
  48. package/schemas/rcsd-spec-frontmatter.schema.json +0 -225
  49. package/schemas/todo.schema.json +0 -994
  50. package/skills/_shared/cleo-style-guide.md +0 -84
  51. package/skills/_shared/manifest-operations.md +0 -810
  52. package/skills/_shared/placeholders.json +0 -433
  53. package/skills/_shared/skill-chaining-patterns.md +0 -240
  54. package/skills/_shared/subagent-protocol-base.md +0 -221
  55. package/skills/_shared/task-system-integration.md +0 -232
  56. package/skills/_shared/testing-framework-config.md +0 -110
  57. package/skills/agentskills-integrate.md +0 -104
  58. package/skills/agentskills-specs.md +0 -255
  59. package/skills/agentskills-what-are-skills.md +0 -75
  60. package/skills/manifest.json +0 -510
  61. package/templates/AGENT-INJECTION.md +0 -166
  62. /package/schemas/{research-manifest.schema.json → archive/research-manifest.schema.json} +0 -0
@@ -1,433 +0,0 @@
1
- {
2
- "$schema": "https://cleo-dev.com/schemas/v1/placeholders.schema.json",
3
- "_meta": {
4
- "version": "1.0.0",
5
- "description": "Canonical registry of all template placeholders used in orchestrator protocol and skill templates",
6
- "lastUpdated": "2026-01-26",
7
- "tokenFormat": "{{TOKEN_NAME}}"
8
- },
9
- "required": [
10
- {
11
- "token": "TASK_ID",
12
- "type": "string",
13
- "pattern": "^T[0-9]+$",
14
- "example": "T1234",
15
- "description": "CLEO task ID"
16
- },
17
- {
18
- "token": "DATE",
19
- "type": "string",
20
- "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$",
21
- "example": "2026-01-19",
22
- "description": "ISO date (YYYY-MM-DD)",
23
- "default": "$(date +%Y-%m-%d)"
24
- },
25
- {
26
- "token": "TOPIC_SLUG",
27
- "type": "string",
28
- "pattern": "^[a-zA-Z0-9_-]+$",
29
- "example": "auth-token-rotation",
30
- "description": "Slugified topic name (lowercase, hyphenated, URL-safe)"
31
- }
32
- ],
33
- "context": [
34
- {
35
- "token": "EPIC_ID",
36
- "type": "string",
37
- "pattern": "^T[0-9]+$",
38
- "example": "T1000",
39
- "description": "Parent epic ID",
40
- "default": ""
41
- },
42
- {
43
- "token": "SESSION_ID",
44
- "type": "string",
45
- "pattern": "^session_[0-9]{8}_[0-9]{6}_[a-f0-9]+$",
46
- "example": "session_20260119_143500_abc123",
47
- "description": "Current CLEO session ID",
48
- "default": ""
49
- },
50
- {
51
- "token": "RESEARCH_ID",
52
- "type": "string",
53
- "example": "auth-token-2026-01-19",
54
- "description": "Research entry ID for manifest",
55
- "default": ""
56
- },
57
- {
58
- "token": "TITLE",
59
- "type": "string",
60
- "example": "Authentication Token Rotation",
61
- "description": "Human-readable title",
62
- "default": ""
63
- },
64
- {
65
- "token": "OUTPUT_DIR",
66
- "type": "path",
67
- "example": ".cleo/agent-outputs",
68
- "description": "Output directory path for agent artifacts",
69
- "default": ".cleo/agent-outputs"
70
- },
71
- {
72
- "token": "MANIFEST_PATH",
73
- "type": "path",
74
- "example": ".cleo/agent-outputs/MANIFEST.jsonl",
75
- "description": "Path to MANIFEST.jsonl file",
76
- "default": ".cleo/agent-outputs/MANIFEST.jsonl"
77
- }
78
- ],
79
- "taskCommands": {
80
- "_comment": "CLEO task system command tokens - enables portability",
81
- "tokens": [
82
- {
83
- "token": "TASK_SHOW_CMD",
84
- "default": "cleo show",
85
- "description": "Command to show task details"
86
- },
87
- {
88
- "token": "TASK_START_CMD",
89
- "default": "cleo start",
90
- "description": "Command to start a task"
91
- },
92
- {
93
- "token": "TASK_FOCUS_SHOW_CMD",
94
- "default": "cleo focus show",
95
- "description": "Command to show current focus"
96
- },
97
- {
98
- "token": "TASK_COMPLETE_CMD",
99
- "default": "cleo complete",
100
- "description": "Command to complete task"
101
- },
102
- {
103
- "token": "TASK_LINK_CMD",
104
- "default": "cleo research link",
105
- "description": "Command to link research to task"
106
- },
107
- {
108
- "token": "TASK_LIST_CMD",
109
- "default": "cleo list",
110
- "description": "Command to list tasks"
111
- },
112
- {
113
- "token": "TASK_FIND_CMD",
114
- "default": "cleo find",
115
- "description": "Command to find tasks"
116
- },
117
- {
118
- "token": "TASK_ADD_CMD",
119
- "default": "cleo add",
120
- "description": "Command to add task"
121
- },
122
- {
123
- "token": "SESSION_LIST_CMD",
124
- "default": "cleo session list",
125
- "description": "Command to list sessions"
126
- },
127
- {
128
- "token": "SESSION_START_CMD",
129
- "default": "cleo session start",
130
- "description": "Command to start session"
131
- },
132
- {
133
- "token": "SESSION_END_CMD",
134
- "default": "cleo session end",
135
- "description": "Command to end session"
136
- },
137
- {
138
- "token": "DASH_CMD",
139
- "default": "cleo dash",
140
- "description": "Command to show dashboard"
141
- },
142
- {
143
- "token": "RESEARCH_LIST_CMD",
144
- "default": "cleo research list",
145
- "description": "Command to list research entries"
146
- },
147
- {
148
- "token": "RESEARCH_SHOW_CMD",
149
- "default": "cleo research show",
150
- "description": "Command to show research entry details"
151
- },
152
- {
153
- "token": "RESEARCH_PENDING_CMD",
154
- "default": "cleo research pending",
155
- "description": "Command to show pending research followups"
156
- },
157
- {
158
- "token": "RESEARCH_INJECT_CMD",
159
- "default": "cleo research inject",
160
- "description": "Command to inject subagent protocol block (supports --clipboard flag)"
161
- },
162
- {
163
- "token": "SESSION_GC_CMD",
164
- "default": "cleo session gc",
165
- "description": "Command for session garbage collection (supports --include-active flag)"
166
- },
167
- {
168
- "token": "TASK_EXISTS_CMD",
169
- "default": "cleo exists",
170
- "description": "Command to check if task ID exists (exit code 0/1)"
171
- },
172
- {
173
- "token": "TASK_PHASE_CMD",
174
- "default": "cleo phase show",
175
- "description": "Command to show current project phase"
176
- },
177
- {
178
- "token": "TASK_TREE_CMD",
179
- "default": "cleo list --tree",
180
- "description": "Command to show task hierarchy tree (use --parent for subtree)"
181
- }
182
- ]
183
- },
184
- "manifest": {
185
- "_comment": "Tokens used when constructing MANIFEST.jsonl entries",
186
- "tokens": [
187
- {
188
- "token": "MANIFEST_ID",
189
- "type": "string",
190
- "example": "topic-2026-01-19",
191
- "description": "Unique manifest entry ID"
192
- },
193
- {
194
- "token": "MANIFEST_FILE",
195
- "type": "string",
196
- "example": "2026-01-19_topic-slug.md",
197
- "description": "Output filename"
198
- },
199
- {
200
- "token": "MANIFEST_TITLE",
201
- "type": "string",
202
- "example": "Research on Topic",
203
- "description": "Entry title"
204
- },
205
- {
206
- "token": "MANIFEST_STATUS",
207
- "type": "enum",
208
- "enum": ["complete", "partial", "blocked"],
209
- "default": "complete",
210
- "description": "Entry status"
211
- },
212
- {
213
- "token": "MANIFEST_TOPICS",
214
- "type": "array",
215
- "example": ["auth", "security"],
216
- "description": "Topic tags"
217
- },
218
- {
219
- "token": "MANIFEST_FINDINGS",
220
- "type": "array",
221
- "example": ["Finding 1", "Finding 2"],
222
- "description": "Key findings (3-7 items)"
223
- },
224
- {
225
- "token": "LINKED_TASKS",
226
- "type": "array",
227
- "example": ["T1234", "T1235"],
228
- "description": "Related CLEO task IDs"
229
- },
230
- {
231
- "token": "NEEDS_FOLLOWUP",
232
- "type": "array",
233
- "default": [],
234
- "description": "Tasks requiring follow-up"
235
- }
236
- ]
237
- },
238
- "taskContext": {
239
- "_comment": "Task-specific tokens populated by orchestrator from CLEO task data",
240
- "tokens": [
241
- {
242
- "token": "TASK_TITLE",
243
- "type": "string",
244
- "example": "Implement login endpoint",
245
- "description": "Task title from CLEO (task.title)",
246
- "source": "task.title"
247
- },
248
- {
249
- "token": "TASK_NAME",
250
- "type": "string",
251
- "example": "Implement login endpoint",
252
- "description": "Alias for TASK_TITLE (for backward compatibility)",
253
- "source": "task.title"
254
- },
255
- {
256
- "token": "TASK_DESCRIPTION",
257
- "type": "string",
258
- "example": "Create POST /api/login endpoint with JWT authentication...",
259
- "description": "Task description from CLEO (task.description)",
260
- "source": "task.description"
261
- },
262
- {
263
- "token": "TASK_INSTRUCTIONS",
264
- "type": "string",
265
- "example": "Create POST /api/login endpoint with JWT authentication...",
266
- "description": "Task instructions (defaults to task.description, can be custom)",
267
- "source": "task.description"
268
- },
269
- {
270
- "token": "TOPICS_JSON",
271
- "type": "array",
272
- "example": "[\"auth\", \"api\", \"security\"]",
273
- "description": "Task labels as JSON array",
274
- "source": "task.labels"
275
- },
276
- {
277
- "token": "DEPENDS_LIST",
278
- "type": "string",
279
- "example": "T1001, T1002",
280
- "description": "Comma-separated dependency IDs",
281
- "source": "task.depends",
282
- "default": ""
283
- },
284
- {
285
- "token": "ACCEPTANCE_CRITERIA",
286
- "type": "string",
287
- "example": "Tests pass, API responds with valid JWT",
288
- "description": "Acceptance criteria (extracted from description or default)",
289
- "default": "Task completed successfully per description"
290
- },
291
- {
292
- "token": "DELIVERABLES_LIST",
293
- "type": "string",
294
- "example": "1. API endpoint\\n2. Unit tests\\n3. Documentation",
295
- "description": "List of deliverables (extracted from description or default)",
296
- "default": "Implementation per task description"
297
- },
298
- {
299
- "token": "MANIFEST_SUMMARIES",
300
- "type": "string",
301
- "example": "Previous research found: auth tokens should rotate every 24h",
302
- "description": "Context from previous subagent manifest entries",
303
- "default": ""
304
- },
305
- {
306
- "token": "NEXT_TASK_IDS",
307
- "type": "string",
308
- "example": "T1003, T1004",
309
- "description": "Follow-up task IDs to add to needs_followup",
310
- "default": ""
311
- }
312
- ]
313
- },
314
- "skillSpecific": {
315
- "epicArchitect": [
316
- {
317
- "token": "FEATURE_SLUG",
318
- "type": "string",
319
- "example": "user-authentication",
320
- "description": "Slugified feature name"
321
- },
322
- {
323
- "token": "FEATURE_NAME",
324
- "type": "string",
325
- "example": "User Authentication",
326
- "description": "Human-readable feature name"
327
- },
328
- {
329
- "token": "FEATURE_DESCRIPTION",
330
- "type": "string",
331
- "example": "Implement JWT-based authentication...",
332
- "description": "Full description from epic"
333
- }
334
- ],
335
- "validator": [
336
- {
337
- "token": "TEST_SCOPE",
338
- "type": "enum",
339
- "enum": ["unit", "integration", "e2e"],
340
- "description": "Test scope to execute"
341
- },
342
- {
343
- "token": "TARGET_PATH",
344
- "type": "path",
345
- "example": "src/auth/",
346
- "description": "Path to validate"
347
- }
348
- ],
349
- "taskExecutor": [
350
- {
351
- "token": "TASK_TITLE",
352
- "type": "string",
353
- "example": "Implement login endpoint",
354
- "description": "Task title (from taskContext.TASK_TITLE)",
355
- "inherits": "taskContext.TASK_TITLE"
356
- },
357
- {
358
- "token": "TASK_NAME",
359
- "type": "string",
360
- "example": "Implement login endpoint",
361
- "description": "Alias for TASK_TITLE (from taskContext.TASK_NAME)",
362
- "inherits": "taskContext.TASK_NAME"
363
- },
364
- {
365
- "token": "TASK_DESCRIPTION",
366
- "type": "string",
367
- "example": "Create POST /api/login with JWT auth...",
368
- "description": "Task description (from taskContext.TASK_DESCRIPTION)",
369
- "inherits": "taskContext.TASK_DESCRIPTION"
370
- },
371
- {
372
- "token": "TASK_INSTRUCTIONS",
373
- "type": "string",
374
- "example": "1. Create endpoint\\n2. Add JWT validation\\n3. Return token",
375
- "description": "Execution instructions (from taskContext.TASK_INSTRUCTIONS)",
376
- "inherits": "taskContext.TASK_INSTRUCTIONS"
377
- },
378
- {
379
- "token": "DELIVERABLES_LIST",
380
- "type": "string",
381
- "example": "1. API endpoint\\n2. Unit tests\\n3. Documentation",
382
- "description": "Expected outputs (from taskContext.DELIVERABLES_LIST)",
383
- "inherits": "taskContext.DELIVERABLES_LIST"
384
- },
385
- {
386
- "token": "ACCEPTANCE_CRITERIA",
387
- "type": "string",
388
- "example": "Tests pass, API responds with valid JWT",
389
- "description": "Completion criteria (from taskContext.ACCEPTANCE_CRITERIA)",
390
- "inherits": "taskContext.ACCEPTANCE_CRITERIA"
391
- },
392
- {
393
- "token": "DEPENDS_LIST",
394
- "type": "string",
395
- "example": "T1001, T1002",
396
- "description": "Completed dependencies (from taskContext.DEPENDS_LIST)",
397
- "inherits": "taskContext.DEPENDS_LIST"
398
- },
399
- {
400
- "token": "TOPICS_JSON",
401
- "type": "array",
402
- "example": "[\"auth\", \"api\"]",
403
- "description": "Task labels as JSON (from taskContext.TOPICS_JSON)",
404
- "inherits": "taskContext.TOPICS_JSON"
405
- },
406
- {
407
- "token": "MANIFEST_SUMMARIES",
408
- "type": "string",
409
- "example": "Previous: auth tokens rotate every 24h",
410
- "description": "Context from previous agents (from taskContext.MANIFEST_SUMMARIES)",
411
- "inherits": "taskContext.MANIFEST_SUMMARIES"
412
- },
413
- {
414
- "token": "NEXT_TASK_IDS",
415
- "type": "string",
416
- "example": "T1003, T1004",
417
- "description": "Follow-up task IDs (from taskContext.NEXT_TASK_IDS)",
418
- "inherits": "taskContext.NEXT_TASK_IDS"
419
- }
420
- ]
421
- },
422
- "conventions": {
423
- "naming": "ALL_CAPS with underscores for multi-word names",
424
- "format": "Enclosed in double curly braces: {{TOKEN_NAME}}",
425
- "validation": {
426
- "string": "Non-empty UTF-8 text",
427
- "date": "ISO 8601 (YYYY-MM-DD)",
428
- "path": "Unix path with valid characters",
429
- "enum": "Exact match required",
430
- "array": "Valid JSON array"
431
- }
432
- }
433
- }
@@ -1,240 +0,0 @@
1
- # Skill Chaining Patterns
2
-
3
- This reference defines patterns for multi-level skill invocation and context propagation across agent boundaries.
4
-
5
- ---
6
-
7
- ## Pattern Overview
8
-
9
- | Pattern | Description | Use Case |
10
- |---------|-------------|----------|
11
- | Single-level | Orchestrator spawns one skill | Simple task delegation |
12
- | Skill chaining | Skill invokes other skills | Workflow orchestration |
13
- | Multi-level | Subagent becomes orchestrator | Complex nested workflows |
14
-
15
- ---
16
-
17
- ## Pattern 1: Single-Level Spawning
18
-
19
- The orchestrator delegates work to a subagent via Task tool with skill injection.
20
-
21
- ### Flow
22
-
23
- ```
24
- ┌─────────────────┐
25
- │ ORCHESTRATOR │
26
- │ (ct-orchestrator)
27
- └────────┬────────┘
28
- │ Task tool + skill template
29
-
30
- ┌─────────────────┐
31
- │ SUBAGENT │
32
- │ (ct-research-agent)
33
- └─────────────────┘
34
- ```
35
-
36
- ### Implementation
37
-
38
- ```bash
39
- # Orchestrator prepares context
40
- source lib/token-inject.sh
41
- export TI_TASK_ID="T1234"
42
- export TI_DATE="$(date +%Y-%m-%d)"
43
- export TI_TOPIC_SLUG="auth-research"
44
- ti_set_defaults
45
-
46
- # Load skill template with tokens
47
- template=$(ti_load_template "skills/ct-research-agent/SKILL.md")
48
-
49
- # Spawn via Task tool (includes subagent protocol block)
50
- ```
51
-
52
- ### Context Propagation
53
-
54
- - **Input**: Task ID, skill template, previous manifest key_findings
55
- - **Output**: Manifest entry with key_findings for next agent
56
- - **Response**: "Research complete. See MANIFEST.jsonl for summary."
57
-
58
- ---
59
-
60
- ## Pattern 2: Skill Chaining
61
-
62
- A skill invokes other skills to complete workflow phases. The loaded skill maintains context while delegating specialized work.
63
-
64
- ### Example: ct-documentor
65
-
66
- ```
67
- ┌─────────────────────┐
68
- │ ct-documentor │ ← Loaded by user request
69
- │ (Documentation │
70
- │ Specialist) │
71
- └─────────┬───────────┘
72
-
73
- ┌─────┴─────┬────────────┐
74
- ▼ ▼ ▼
75
- ┌───────┐ ┌────────┐ ┌─────────┐
76
- │lookup │ │ write │ │ review │
77
- │(Phase │ │(Phase │ │(Phase │
78
- │ 1) │ │ 3) │ │ 4) │
79
- └───────┘ └────────┘ └─────────┘
80
- ```
81
-
82
- ### Skill Invocation Methods
83
-
84
- ```markdown
85
- # Via Skill tool (programmatic)
86
- Skill(skill="ct-docs-lookup")
87
- Skill(skill="ct-docs-write")
88
- Skill(skill="ct-docs-review")
89
-
90
- # Via slash command (user-facing)
91
- /ct-docs-lookup
92
- /ct-docs-write
93
- /ct-docs-review
94
- ```
95
-
96
- ### When to Use Skill Chaining
97
-
98
- | Scenario | Pattern |
99
- |----------|---------|
100
- | Workflow has distinct phases | Chain skills for each phase |
101
- | Skills share common context | Parent skill maintains state |
102
- | Quality gates between phases | Invoke review skill before completion |
103
- | Specialized expertise needed | Delegate to domain-specific skill |
104
-
105
- ### Context Management
106
-
107
- **Within skill chain (same agent)**:
108
- - Skills share the agent's context window
109
- - State persists between skill invocations
110
- - No manifest needed for internal handoffs
111
-
112
- **Across agent boundaries**:
113
- - Use manifest for key_findings only
114
- - Write detailed output to files
115
- - Return minimal response to preserve parent context
116
-
117
- ---
118
-
119
- ## Pattern 3: Multi-Level Orchestration
120
-
121
- A subagent can itself become an orchestrator, spawning further subagents for complex nested workflows.
122
-
123
- ### Flow
124
-
125
- ```
126
- ┌─────────────────────┐
127
- │ ORCHESTRATOR │ Level 0: Main workflow
128
- │ (ct-orchestrator) │
129
- └─────────┬───────────┘
130
- │ Task tool
131
-
132
- ┌─────────────────────┐
133
- │ SUB-ORCHESTRATOR │ Level 1: Epic decomposition
134
- │ (ct-epic-architect) │
135
- └─────────┬───────────┘
136
- │ Task tool
137
-
138
- ┌─────────────────────┐
139
- │ WORKER AGENT │ Level 2: Task execution
140
- │ (ct-task-executor) │
141
- └─────────────────────┘
142
- ```
143
-
144
- ### Guidelines for Multi-Level
145
-
146
- 1. **Depth limit**: SHOULD NOT exceed 3 levels (diminishing returns)
147
- 2. **Context budget**: Each level MUST stay under 10K tokens
148
- 3. **Manifest propagation**: Each level writes to shared manifest
149
- 4. **Response contract**: Each level returns only summary message
150
-
151
- ### When Multi-Level is Appropriate
152
-
153
- | Use Case | Levels | Structure |
154
- |----------|--------|-----------|
155
- | Simple research | 1 | Orchestrator → Researcher |
156
- | Epic planning | 2 | Orchestrator → Architect → Executor |
157
- | Complex pipeline | 3 | Orchestrator → Coordinator → Workers |
158
-
159
- ---
160
-
161
- ## Context Boundary Rules
162
-
163
- ### Rule 1: Manifest for Handoffs (MUST)
164
-
165
- ```json
166
- // Subagent appends ONE line to MANIFEST.jsonl
167
- {"id":"topic-2026-01-20","key_findings":["Finding 1","Finding 2"],"needs_followup":["T1235"]}
168
- ```
169
-
170
- Parent reads only key_findings, not full research files.
171
-
172
- ### Rule 2: Minimal Response (MUST)
173
-
174
- ```
175
- Subagent MUST return ONLY: "Research complete. See MANIFEST.jsonl for summary."
176
- Subagent MUST NOT return research content in response.
177
- ```
178
-
179
- ### Rule 3: File-Based Details (MUST)
180
-
181
- Detailed findings go to output files, not manifest or response:
182
- - Full analysis → `{{OUTPUT_DIR}}/YYYY-MM-DD_topic.md`
183
- - Summary only → `MANIFEST.jsonl` key_findings array
184
-
185
- ### Rule 4: Token Injection (SHOULD)
186
-
187
- Use `lib/token-inject.sh` for dynamic token replacement:
188
-
189
- ```bash
190
- # Required tokens for all subagents
191
- TI_TASK_ID # Current task identifier
192
- TI_DATE # Execution date (YYYY-MM-DD)
193
- TI_TOPIC_SLUG # URL-safe topic name
194
- ```
195
-
196
- ---
197
-
198
- ## Anti-Patterns
199
-
200
- | Pattern | Problem | Solution |
201
- |---------|---------|----------|
202
- | Reading full files at parent | Context explosion | Use manifest key_findings |
203
- | Returning research content | Context bloat | Return summary message only |
204
- | Parallel subagent spawning | Race conditions | Sequential spawning only |
205
- | Deep nesting (4+ levels) | Coordination overhead | Flatten to 3 levels max |
206
- | Skipping manifest entry | Lost handoff | Always append manifest |
207
-
208
- ---
209
-
210
- ## Implementation Checklist
211
-
212
- Before spawning subagent:
213
- - [ ] Identify appropriate skill for task type
214
- - [ ] Prepare token context (TI_TASK_ID, TI_DATE, TI_TOPIC_SLUG)
215
- - [ ] Load skill template with `ti_load_template()`
216
- - [ ] Include subagent protocol block in prompt
217
-
218
- Before chaining to another skill:
219
- - [ ] Determine if skill shares context (same agent) or needs delegation
220
- - [ ] For same-agent: Use `Skill(skill="name")` or `/skill-name`
221
- - [ ] For new agent: Use Task tool with full protocol injection
222
-
223
- Before completion:
224
- - [ ] Verify manifest entry appended
225
- - [ ] Confirm output file written
226
- - [ ] Return ONLY the summary message
227
-
228
- ---
229
-
230
- ## Reference Skills
231
-
232
- | Skill | Demonstrates |
233
- |-------|--------------|
234
- | `ct-orchestrator` | Single-level spawning via Task tool |
235
- | `ct-documentor` | Skill chaining (lookup → write → review) |
236
- | `ct-epic-architect` | Potential multi-level orchestration |
237
-
238
- See also:
239
- - @skills/_shared/subagent-protocol-base.md
240
- - @skills/_shared/task-system-integration.md