@cleocode/agents 2026.3.37 → 2026.3.40

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CLEO Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,338 @@
1
+ # @cleocode/agents
2
+
3
+ CLEO agent protocols and templates.
4
+
5
+ ## Overview
6
+
7
+ This package contains agent protocols, templates, and base configurations for CLEO subagents. These agents follow standardized protocols to ensure consistency and compliance when working within the CLEO ecosystem.
8
+
9
+ ## What are CLEO Agents?
10
+
11
+ CLEO Agents are specialized AI workers that:
12
+ - Follow standardized protocols (LOOM methodology)
13
+ - Work within the CLEO task management system
14
+ - Produce outputs in defined formats
15
+ - Maintain compliance with CLEO constraints
16
+ - Communicate through structured channels
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ npm install @cleocode/agents
22
+ ```
23
+
24
+ ```bash
25
+ pnpm add @cleocode/agents
26
+ ```
27
+
28
+ ```bash
29
+ yarn add @cleocode/agents
30
+ ```
31
+
32
+ ## Available Agents
33
+
34
+ ### cleo-subagent
35
+
36
+ The base protocol for all CLEO subagents. Every subagent in the CLEO ecosystem extends this foundation.
37
+
38
+ **File**: `cleo-subagent/AGENT.md`
39
+
40
+ #### Key Features
41
+
42
+ - **Protocol Compliance**: Follows RFC 2119 constraint definitions
43
+ - **LOOM Lifecycle**: Implements Logical Order of Operations Methodology
44
+ - **Structured Output**: Writes to files, returns only summaries
45
+ - **Manifest Integration**: Automatically appends to MANIFEST.jsonl
46
+
47
+ #### Immutable Constraints (RFC 2119)
48
+
49
+ | ID | Rule | Enforcement |
50
+ |----|------|-------------|
51
+ | BASE-001 | **MUST** append ONE line to MANIFEST.jsonl | Required |
52
+ | BASE-002 | **MUST NOT** return content in response | Required |
53
+ | BASE-003 | **MUST** complete task via `cleo complete` | Required |
54
+ | BASE-004 | **MUST** write output file before manifest | Required |
55
+ | BASE-005 | **MUST** set focus before starting work | Required |
56
+ | BASE-006 | **MUST NOT** fabricate information | Required |
57
+ | BASE-007 | **SHOULD** link research to task | Recommended |
58
+
59
+ #### LOOM Lifecycle Protocol
60
+
61
+ The **LOOM** (Logical Order of Operations Methodology) is the systematic framework for processing project threads through the RCASD-IVTR+C pipeline.
62
+
63
+ **Phase 1: Spawn (Initialization)**
64
+
65
+ ```bash
66
+ # 1. Read task context
67
+ cleo show {{TASK_ID}}
68
+
69
+ # 2. Start task (marks task active)
70
+ cleo start {{TASK_ID}}
71
+ ```
72
+
73
+ **Phase 2: Execute (Skill-Specific)**
74
+
75
+ Follow the injected skill protocol for the current LOOM stage:
76
+ - **Research**: Gather information, cite sources
77
+ - **Consensus**: Validate claims, vote
78
+ - **Specification**: Write RFC 2119 spec
79
+ - **Decomposition**: Break down into tasks
80
+ - **Implementation**: Write code
81
+ - **Validation**: Verify compliance
82
+ - **Testing**: Write BATS tests
83
+ - **Contribution**: Track attribution
84
+ - **Release**: Version and changelog
85
+
86
+ **Phase 3: Output (Mandatory)**
87
+
88
+ ```bash
89
+ # 1. Write output file
90
+ # Location: {{OUTPUT_DIR}}/{{TASK_ID}}-<slug>.md
91
+
92
+ # 2. Append manifest entry (single line JSON)
93
+ echo '{"id":"{{TASK_ID}}-slug",...}' >> {{MANIFEST_PATH}}
94
+
95
+ # 3. Complete task
96
+ cleo complete {{TASK_ID}}
97
+ ```
98
+
99
+ **Phase 4: Return (Summary Only)**
100
+
101
+ Return ONLY one of these messages:
102
+ - `"[Type] complete. See MANIFEST.jsonl for summary."`
103
+ - `"[Type] partial. See MANIFEST.jsonl for details."`
104
+ - `"[Type] blocked. See MANIFEST.jsonl for blocker details."`
105
+
106
+ **NEVER** return content in the response. All content goes to output files.
107
+
108
+ #### Token Reference
109
+
110
+ **Required Tokens:**
111
+ | Token | Description | Example |
112
+ |-------|-------------|---------|
113
+ | `{{TASK_ID}}` | Current task identifier | `T1234` |
114
+ | `{{DATE}}` | Current date (ISO) | `2026-01-29` |
115
+ | `{{TOPIC_SLUG}}` | URL-safe topic name | `auth-research` |
116
+
117
+ **Optional Tokens:**
118
+ | Token | Default | Description |
119
+ |-------|---------|-------------|
120
+ | `{{EPIC_ID}}` | `""` | Parent epic ID |
121
+ | `{{OUTPUT_DIR}}` | `claudedocs/agent-outputs` | Output directory |
122
+ | `{{MANIFEST_PATH}}` | `{{OUTPUT_DIR}}/MANIFEST.jsonl` | Manifest location |
123
+
124
+ #### Error Handling
125
+
126
+ **Status Classification:**
127
+
128
+ | Status | Condition | Action |
129
+ |--------|-----------|--------|
130
+ | `complete` | All objectives achieved | Write full output |
131
+ | `partial` | Some objectives achieved | Write partial, populate `needs_followup` |
132
+ | `blocked` | Cannot proceed | Document blocker, do NOT complete task |
133
+
134
+ **Retryable Errors:**
135
+
136
+ Exit codes 7, 20, 21, 22, 60-63 support retry with exponential backoff.
137
+
138
+ #### Anti-Patterns
139
+
140
+ | Pattern | Problem | Solution |
141
+ |---------|---------|----------|
142
+ | Returning content | Bloats orchestrator context | Write to file, return summary |
143
+ | Pretty-printed JSON | Multiple lines in manifest | Single-line JSON only |
144
+ | Skipping start | Protocol violation | Always `cleo start` first |
145
+ | Loading skills via `@` | Cannot resolve | Skills injected by orchestrator |
146
+
147
+ ## Agent Structure
148
+
149
+ Agents in this package follow a standardized structure:
150
+
151
+ ```
152
+ agents/
153
+ ├── <agent-name>/
154
+ │ ├── AGENT.md # Main agent definition
155
+ │ ├── protocols/ # Protocol-specific docs
156
+ │ ├── templates/ # Output templates
157
+ │ └── examples/ # Example outputs
158
+ ```
159
+
160
+ ## Using Agents
161
+
162
+ ### From Skills
163
+
164
+ Skills can spawn agents using the orchestration API:
165
+
166
+ ```typescript
167
+ import { orchestration } from '@cleocode/core';
168
+
169
+ await orchestration.spawn({
170
+ agent: 'cleo-subagent',
171
+ taskId: 'T1234',
172
+ context: {
173
+ skill: 'ct-research-agent',
174
+ topic: 'authentication patterns'
175
+ }
176
+ });
177
+ ```
178
+
179
+ ### From CLI
180
+
181
+ Spawn agents directly from the command line:
182
+
183
+ ```bash
184
+ # Spawn a research agent
185
+ cleo orchestrate spawn --agent cleo-subagent --task T1234 --skill ct-research-agent
186
+
187
+ # Spawn with context
188
+ cleo orchestrate spawn --agent cleo-subagent --task T1234 --context '{"topic":"API design"}'
189
+ ```
190
+
191
+ ### From MCP
192
+
193
+ Use the MCP server to spawn agents:
194
+
195
+ ```json
196
+ {
197
+ "domain": "orchestrate",
198
+ "operation": "spawn",
199
+ "params": {
200
+ "agent": "cleo-subagent",
201
+ "taskId": "T1234",
202
+ "context": {
203
+ "skill": "ct-implementation"
204
+ }
205
+ }
206
+ }
207
+ ```
208
+
209
+ ## Creating Custom Agents
210
+
211
+ To create a custom agent that extends the base protocol:
212
+
213
+ 1. **Create agent directory**:
214
+ ```bash
215
+ mkdir -p agents/my-custom-agent
216
+ ```
217
+
218
+ 2. **Create AGENT.md**:
219
+ ```markdown
220
+ ---
221
+ name: my-custom-agent
222
+ description: |
223
+ Custom agent for specialized tasks. Extends cleo-subagent base protocol.
224
+ model: sonnet
225
+ allowed_tools:
226
+ - Read
227
+ - Write
228
+ - Bash
229
+ ---
230
+
231
+ # My Custom Agent
232
+
233
+ Extends [cleo-subagent](./cleo-subagent/AGENT.md).
234
+
235
+ ## Additional Constraints
236
+
237
+ | ID | Rule | Enforcement |
238
+ |----|------|-------------|
239
+ | CUST-001 | **MUST** validate output format | Required |
240
+
241
+ ## Specialization
242
+
243
+ This agent specializes in [your domain].
244
+
245
+ ## Usage
246
+
247
+ ```bash
248
+ cleo orchestrate spawn --agent my-custom-agent --task T1234
249
+ ```
250
+ ```
251
+
252
+ 3. **Register the agent**:
253
+ ```typescript
254
+ import { agents } from '@cleocode/core';
255
+
256
+ agents.register({
257
+ name: 'my-custom-agent',
258
+ path: './agents/my-custom-agent',
259
+ baseProtocol: 'cleo-subagent'
260
+ });
261
+ ```
262
+
263
+ ## Agent Protocols
264
+
265
+ ### Base Protocol
266
+
267
+ All agents extend the `cleo-subagent` base protocol which provides:
268
+
269
+ - **Constraint System**: RFC 2119 (MUST, SHOULD, MAY) rules
270
+ - **Lifecycle Management**: LOOM phases (Spawn, Execute, Output, Return)
271
+ - **Output Standards**: File-based outputs with manifest tracking
272
+ - **Error Handling**: Standardized status classification
273
+ - **Token System**: Template variables for dynamic content
274
+
275
+ ### Protocol Inheritance
276
+
277
+ ```
278
+ cleo-subagent (base)
279
+
280
+ ├── research-subagent
281
+ │ └── Extends with research-specific constraints
282
+
283
+ ├── implementation-subagent
284
+ │ └── Extends with coding-specific constraints
285
+
286
+ └── validation-subagent
287
+ └── Extends with compliance-specific constraints
288
+ ```
289
+
290
+ ### Protocol Compliance
291
+
292
+ Agents are validated for protocol compliance:
293
+
294
+ ```typescript
295
+ import { compliance } from '@cleocode/core';
296
+
297
+ // Validate agent definition
298
+ const result = await compliance.validateAgent({
299
+ agentPath: './agents/my-agent',
300
+ baseProtocol: 'cleo-subagent'
301
+ });
302
+
303
+ if (result.valid) {
304
+ console.log('Agent is protocol compliant ✓');
305
+ } else {
306
+ console.log('Compliance issues:', result.issues);
307
+ }
308
+ ```
309
+
310
+ ## Integration with Skills
311
+
312
+ Agents work closely with skills:
313
+
314
+ - **Skills provide**: Capabilities, instructions, constraints
315
+ - **Agents provide**: Execution context, protocol compliance, output handling
316
+
317
+ Example workflow:
318
+
319
+ ```
320
+ 1. Orchestrator identifies need for research
321
+ 2. Loads ct-research-agent skill
322
+ 3. Spawns cleo-subagent with research skill injected
323
+ 4. Agent follows LOOM phases
324
+ 5. Research skill guides information gathering
325
+ 6. Agent writes output, appends to manifest
326
+ 7. Returns summary to orchestrator
327
+ ```
328
+
329
+ ## Dependencies
330
+
331
+ This package has no runtime dependencies. It contains only:
332
+ - Agent protocol definitions (markdown)
333
+ - Template files
334
+ - Example outputs
335
+
336
+ ## License
337
+
338
+ MIT License - see [LICENSE](../LICENSE) for details.
File without changes
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@cleocode/agents",
3
- "version": "2026.3.37",
3
+ "version": "2026.3.40",
4
4
  "description": "CLEO agent protocols and templates",
5
5
  "type": "module",
6
- "license": "MIT"
7
- }
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/kryptobaseddev/cleo",
10
+ "directory": "packages/agents"
11
+ }
12
+ }