@cleocode/agents 2026.4.109 → 2026.4.110
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 +171 -270
- package/meta/README.md +73 -0
- package/meta/agent-architect.cant +113 -0
- package/package.json +3 -1
- package/seed-agents/README.md +70 -50
- package/seed-agents/code-worker-generic.cant +65 -0
- package/seed-agents/dev-lead-generic.cant +64 -0
- package/seed-agents/docs-worker-generic.cant +61 -0
- package/seed-agents/orchestrator-generic.cant +59 -0
- package/seed-agents/cleo-db-lead.cant +0 -38
- package/seed-agents/cleo-dev.cant +0 -53
- package/seed-agents/cleo-historian.cant +0 -63
- package/seed-agents/cleo-prime.cant +0 -48
- package/seed-agents/cleo-rust-lead.cant +0 -55
- package/seed-agents/cleoos-opus-orchestrator.cant +0 -44
- /package/{seed-agents/cleo-subagent.cant → cleo-subagent.cant} +0 -0
package/README.md
CHANGED
|
@@ -1,338 +1,239 @@
|
|
|
1
1
|
# @cleocode/agents
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Universal subagent protocol, generic starter templates, and meta-agents for the
|
|
4
|
+
CLEO ecosystem.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Scope (v2026.4.110 and later)
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Per [ADR-055](../../docs/adr/ADR-055-agents-architecture-and-meta-agents.md), this
|
|
9
|
+
package ships exactly three surfaces:
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
1. **`cleo-subagent.cant`** — the universal protocol base every agent extends.
|
|
12
|
+
2. **`seed-agents/`** — four generic role templates with `{{variable}}`
|
|
13
|
+
placeholders.
|
|
14
|
+
3. **`meta/`** — meta-agents that synthesize other agents from project context.
|
|
10
15
|
|
|
11
|
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
- Communicate through structured channels
|
|
16
|
+
The package also ships **harness adapters** (`harness-adapters/claude-code/…`)
|
|
17
|
+
when a second harness surface is present. CleoCode-team dogfood personas (the
|
|
18
|
+
former `cleo-prime`, `cleo-dev`, `cleo-historian`, `cleo-rust-lead`,
|
|
19
|
+
`cleo-db-lead`, `cleoos-opus-orchestrator`) moved to `.cleo/cant/agents/` in the
|
|
20
|
+
cleocode repository and are NOT shipped to users.
|
|
17
21
|
|
|
18
|
-
##
|
|
22
|
+
## Package Tree
|
|
19
23
|
|
|
20
|
-
```bash
|
|
21
|
-
npm install @cleocode/agents
|
|
22
24
|
```
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
packages/agents/
|
|
26
|
+
├── package.json
|
|
27
|
+
├── README.md # this file
|
|
28
|
+
├── cleo-subagent.cant # universal protocol base
|
|
29
|
+
├── seed-agents/
|
|
30
|
+
│ ├── README.md
|
|
31
|
+
│ ├── orchestrator-generic.cant # coordinates the starter team
|
|
32
|
+
│ ├── dev-lead-generic.cant # decides HOW, reviews workers
|
|
33
|
+
│ ├── code-worker-generic.cant # writes code within globs
|
|
34
|
+
│ └── docs-worker-generic.cant # writes/edits documentation
|
|
35
|
+
├── meta/
|
|
36
|
+
│ ├── README.md
|
|
37
|
+
│ └── agent-architect.cant # meta-agent: synthesizes agents
|
|
38
|
+
└── harness-adapters/
|
|
39
|
+
└── claude-code/
|
|
40
|
+
└── cleo-subagent.AGENT.md # Claude Code adapter for subagent base
|
|
26
41
|
```
|
|
27
42
|
|
|
28
|
-
|
|
29
|
-
yarn add @cleocode/agents
|
|
30
|
-
```
|
|
43
|
+
## The Universal Protocol Base: `cleo-subagent.cant`
|
|
31
44
|
|
|
32
|
-
|
|
45
|
+
Every CLEO agent extends `cleo-subagent.cant`. It defines:
|
|
33
46
|
|
|
34
|
-
|
|
47
|
+
- **RFC 2119 constraints** (BASE-001…BASE-007) — manifest append, no content in
|
|
48
|
+
responses, `cleo complete` as the terminal, output-before-manifest ordering,
|
|
49
|
+
focus before work, no fabrication, research linking.
|
|
50
|
+
- **LOOM lifecycle** — Spawn → Execute → Output → Return, with explicit
|
|
51
|
+
stage-specific guidance injected at spawn time.
|
|
52
|
+
- **Return format contract** — three allowed response strings, everything else
|
|
53
|
+
goes to files and the manifest.
|
|
54
|
+
- **Error handling** — status classification, retryable exit codes, staleness
|
|
55
|
+
and evidence rules (ADR-051).
|
|
35
56
|
|
|
36
|
-
The
|
|
57
|
+
The matching harness adapter (`harness-adapters/claude-code/cleo-subagent.AGENT.md`)
|
|
58
|
+
translates the protocol into Claude Code's `AGENT.md` frontmatter format. New
|
|
59
|
+
harnesses (OpenAI, Cursor, Codex, etc.) get sibling directories under
|
|
60
|
+
`harness-adapters/`.
|
|
37
61
|
|
|
38
|
-
|
|
62
|
+
## Generic Starter Templates
|
|
39
63
|
|
|
40
|
-
|
|
64
|
+
The four seed templates are parameterized blueprints with `{{variable}}`
|
|
65
|
+
placeholders. They MUST remain project-agnostic — no CLEO-internal references,
|
|
66
|
+
no tool-chain assumptions beyond what the template explicitly parameterizes.
|
|
41
67
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
68
|
+
| Template | Role | Purpose |
|
|
69
|
+
|----------|------|---------|
|
|
70
|
+
| `orchestrator-generic.cant` | orchestrator | Reads tasks, routes to the dev-lead, synthesizes results. Does not execute code. |
|
|
71
|
+
| `dev-lead-generic.cant` | lead | Decomposes work, reviews output, decides technical direction. Dispatch-only authority; no Edit/Write/Bash. |
|
|
72
|
+
| `code-worker-generic.cant` | worker | Writes code within declared globs. Runs `{{test_command}}` and `{{build_command}}`. Holds Edit/Write/Bash. |
|
|
73
|
+
| `docs-worker-generic.cant` | worker | Writes documentation (README, TSDoc, guides) within doc globs. Holds Edit/Write/Bash scoped to docs. |
|
|
46
74
|
|
|
47
|
-
|
|
75
|
+
These four make a complete starter team: one orchestrator + one lead + two
|
|
76
|
+
workers. For projects that need richer topologies, the `agent-architect`
|
|
77
|
+
meta-agent (see below) synthesizes additional personas.
|
|
48
78
|
|
|
49
|
-
|
|
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 |
|
|
79
|
+
## How Variables Work
|
|
58
80
|
|
|
59
|
-
|
|
81
|
+
CLEO uses mustache `{{var}}` syntax for template substitution, per
|
|
82
|
+
[ADR-055 D033](../../docs/adr/ADR-055-agents-architecture-and-meta-agents.md).
|
|
60
83
|
|
|
61
|
-
|
|
84
|
+
### Syntax
|
|
62
85
|
|
|
63
|
-
|
|
86
|
+
- `{{name}}` — simple variable
|
|
87
|
+
- `{{object.key}}` — dot-notation for nested values
|
|
88
|
+
- `{{inputs.taskId}}` — already used in starter `.cantbook` playbooks
|
|
64
89
|
|
|
65
|
-
|
|
66
|
-
# 1. Read task context
|
|
67
|
-
cleo show {{TASK_ID}}
|
|
90
|
+
### Resolver Chain
|
|
68
91
|
|
|
69
|
-
|
|
70
|
-
cleo start {{TASK_ID}}
|
|
71
|
-
```
|
|
92
|
+
Variables resolve in priority order at **spawn time** (not install time):
|
|
72
93
|
|
|
73
|
-
**
|
|
94
|
+
1. **Explicit bindings** — highest priority; passed programmatically from the
|
|
95
|
+
task or orchestrator.
|
|
96
|
+
2. **Session context** — `playbook_runs.bindings`, task + epic identifiers, user.
|
|
97
|
+
3. **Project context** — `.cleo/project-context.json`, traversed via
|
|
98
|
+
dot-notation (e.g., `{{conventions.typeSystem}}` reads
|
|
99
|
+
`conventions.typeSystem` from project-context.json).
|
|
100
|
+
4. **Environment variables** — `CLEO_*` or `CANT_*` prefix, uppercase name
|
|
101
|
+
(`{{tech_stack}}` tries `CLEO_TECH_STACK` then `CANT_TECH_STACK`).
|
|
102
|
+
5. **Default value** — when `SubstitutionOptions.defaultValue` is set.
|
|
103
|
+
6. **Missing** — strict mode throws `E_TEMPLATE_RESOLUTION`; non-strict leaves
|
|
104
|
+
`{{var}}` literal in the rendered output.
|
|
74
105
|
|
|
75
|
-
|
|
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
|
|
106
|
+
### Why Lazy (Spawn-Time)?
|
|
85
107
|
|
|
86
|
-
|
|
108
|
+
Templates install with `{{...}}` placeholders intact. Resolution happens inside
|
|
109
|
+
`orchestrateSpawnExecute` right before `composeSpawnPayload`, which means:
|
|
87
110
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
111
|
+
- The same template can spawn differently under different bindings.
|
|
112
|
+
- BRAIN-provided context (mental-model slices, memory queries) can feed the
|
|
113
|
+
resolver.
|
|
114
|
+
- Project context changes (e.g., bumping `testing.framework`) are picked up on
|
|
115
|
+
the next spawn without reinstalling.
|
|
91
116
|
|
|
92
|
-
|
|
93
|
-
|
|
117
|
+
Full specification lives in R2 (`R2-VARIABLE-SYNTAX-DESIGN.md`). The resolver
|
|
118
|
+
implementation ships in `packages/cant/src/variable-resolver.ts`.
|
|
94
119
|
|
|
95
|
-
|
|
96
|
-
cleo complete {{TASK_ID}}
|
|
97
|
-
```
|
|
120
|
+
## Authoring a New Agent
|
|
98
121
|
|
|
99
|
-
|
|
122
|
+
### 1. Start from a template or from `cleo-subagent.cant`
|
|
100
123
|
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
|
|
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}}` | `.cleo/agent-outputs` | Output directory |
|
|
122
|
-
| `{{MANIFEST_PATH}}` | `{{OUTPUT_DIR}}/MANIFEST.jsonl` | Manifest location |
|
|
123
|
-
|
|
124
|
-
#### Error Handling
|
|
124
|
+
```bash
|
|
125
|
+
cp packages/agents/seed-agents/code-worker-generic.cant \
|
|
126
|
+
my-project/.cleo/cant/agents/my-worker.cant
|
|
127
|
+
```
|
|
125
128
|
|
|
126
|
-
|
|
129
|
+
Edit the agent name, tune the description + skills + tool list, replace
|
|
130
|
+
`{{variable}}` placeholders with either literal values (if project-specific) or
|
|
131
|
+
leave them for lazy resolution at spawn time.
|
|
127
132
|
|
|
128
|
-
|
|
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
|
+
### 2. Validate the CANT syntax
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
```bash
|
|
136
|
+
cleo cant validate my-project/.cleo/cant/agents/my-worker.cant
|
|
137
|
+
```
|
|
135
138
|
|
|
136
|
-
|
|
139
|
+
The validator enforces the 42-rule engine (kind/version, required frontmatter,
|
|
140
|
+
role/parent coherence, skill references, permission globs).
|
|
137
141
|
|
|
138
|
-
|
|
142
|
+
### 3. Install into the registry
|
|
139
143
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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 |
|
|
144
|
+
```bash
|
|
145
|
+
cleo agent install my-project/.cleo/cant/agents/my-worker.cant
|
|
146
|
+
```
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
This atomically copies the file to the canonical project-tier path
|
|
149
|
+
(`.cleo/cant/agents/my-worker.cant`), writes the `agents` registry row, and
|
|
150
|
+
populates the `agent_skills` junction. Use `--global` for
|
|
151
|
+
`~/.local/share/cleo/cant/agents/`.
|
|
148
152
|
|
|
149
|
-
|
|
153
|
+
### 4. Verify resolver coverage
|
|
150
154
|
|
|
155
|
+
```bash
|
|
156
|
+
cleo agent doctor --json
|
|
151
157
|
```
|
|
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
158
|
|
|
162
|
-
|
|
159
|
+
Checks D-001 (orphan files) through D-010 (legacy JSON imports). Resolves D-002
|
|
160
|
+
(orphan rows) and D-003 (sha-mismatch) by default; opt into D-008 path
|
|
161
|
+
migration or legacy-JSON import with flags.
|
|
163
162
|
|
|
164
|
-
|
|
163
|
+
## Installing Agents
|
|
165
164
|
|
|
166
|
-
|
|
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
|
-
```
|
|
165
|
+
CLEO installs agents in two places:
|
|
178
166
|
|
|
179
|
-
|
|
167
|
+
- **Global** — `~/.local/share/cleo/cant/agents/` via `cleo agent install --global`
|
|
168
|
+
or `cleo init --install-seed-agents`.
|
|
169
|
+
- **Project** — `{projectRoot}/.cleo/cant/agents/` via `cleo agent install`
|
|
170
|
+
(default).
|
|
180
171
|
|
|
181
|
-
|
|
172
|
+
### Static install (seed templates)
|
|
182
173
|
|
|
183
174
|
```bash
|
|
184
|
-
|
|
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"}'
|
|
175
|
+
cleo init --install-seed-agents
|
|
189
176
|
```
|
|
190
177
|
|
|
191
|
-
|
|
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
|
-
```
|
|
178
|
+
Copies the four generic templates + `cleo-subagent.cant` into the global tier,
|
|
179
|
+
writes the `.seed-version` marker, and is idempotent on subsequent runs.
|
|
208
180
|
|
|
209
|
-
|
|
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
|
|
181
|
+
### Meta-agent-driven install (synthesized personas)
|
|
276
182
|
|
|
277
|
-
```
|
|
278
|
-
cleo-
|
|
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
|
|
183
|
+
```bash
|
|
184
|
+
cleo init --install-seed-agents
|
|
288
185
|
```
|
|
289
186
|
|
|
290
|
-
|
|
187
|
+
Per [ADR-055 D034](../../docs/adr/ADR-055-agents-architecture-and-meta-agents.md),
|
|
188
|
+
the same command invokes `agent-architect` behind the scenes. The meta-agent:
|
|
291
189
|
|
|
292
|
-
|
|
190
|
+
1. Reads `.cleo/project-context.json`.
|
|
191
|
+
2. Loads the four generic templates from `packages/agents/seed-agents/`.
|
|
192
|
+
3. Synthesizes project-customized personas (e.g., `myproject-lead.cant`,
|
|
193
|
+
`myproject-code-worker.cant`) in `.cleo/cant/agents/`.
|
|
194
|
+
4. Falls back to the static copy if the dispatcher is unavailable (offline, CI
|
|
195
|
+
without LLM access, explicit `--skip-agent-synthesis`).
|
|
293
196
|
|
|
294
|
-
|
|
295
|
-
|
|
197
|
+
See `docs/meta-agents.md` for the full meta-agent developer guide and the
|
|
198
|
+
architect's contract.
|
|
296
199
|
|
|
297
|
-
|
|
298
|
-
const result = await compliance.validateAgent({
|
|
299
|
-
agentPath: './agents/my-agent',
|
|
300
|
-
baseProtocol: 'cleo-subagent'
|
|
301
|
-
});
|
|
200
|
+
## Tier Precedence (Resolver Chain)
|
|
302
201
|
|
|
303
|
-
|
|
304
|
-
console.log('Agent is protocol compliant ✓');
|
|
305
|
-
} else {
|
|
306
|
-
console.log('Compliance issues:', result.issues);
|
|
307
|
-
}
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
## Integration with Skills
|
|
202
|
+
Agent resolution at spawn time walks four tiers in order (per T899):
|
|
311
203
|
|
|
312
|
-
|
|
204
|
+
1. **project** — `{projectRoot}/.cleo/cant/agents/{agentId}.cant`
|
|
205
|
+
2. **global** — `~/.local/share/cleo/cant/agents/{agentId}.cant`
|
|
206
|
+
3. **packaged** — `packages/agents/seed-agents/{agentId}.cant` (the files this
|
|
207
|
+
package ships)
|
|
208
|
+
4. **fallback** — seed file on disk with no registry row, synthesized envelope
|
|
209
|
+
with `canSpawn=false`
|
|
313
210
|
|
|
314
|
-
|
|
315
|
-
|
|
211
|
+
The `DEPRECATED_ALIASES` table (readonly, frozen) transparently rewrites old
|
|
212
|
+
IDs before the tier walk — it currently contains
|
|
213
|
+
`cleoos-opus-orchestrator → cleo-prime` (T889 identity consolidation).
|
|
316
214
|
|
|
317
|
-
|
|
215
|
+
## Contract Guarantees
|
|
318
216
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
217
|
+
- **Atomic install** — `packages/core/src/store/agent-install.ts` wraps the
|
|
218
|
+
`.cant` copy, `agents` row upsert, and `agent_skills` junction rewrite in a
|
|
219
|
+
single `BEGIN IMMEDIATE TRANSACTION`. On any failure the file is unlinked if
|
|
220
|
+
this call created it and the DB rolls back.
|
|
221
|
+
- **Idempotent seed install** — `packages/core/src/agents/seed-install.ts`
|
|
222
|
+
compares `.seed-version` against the bundled `package.json` version and
|
|
223
|
+
returns early when they match.
|
|
224
|
+
- **Doctor drift reporting** — `packages/core/src/store/agent-doctor.ts` emits
|
|
225
|
+
D-001…D-010 codes for orphan files, SHA mismatch, legacy paths, missing
|
|
226
|
+
skills, and legacy JSON registries. Default reconcile repairs D-002 and D-003;
|
|
227
|
+
all others are opt-in.
|
|
328
228
|
|
|
329
|
-
##
|
|
229
|
+
## See Also
|
|
330
230
|
|
|
331
|
-
|
|
332
|
-
- Agent
|
|
333
|
-
-
|
|
334
|
-
|
|
231
|
+
- [ADR-055 — Agents Architecture + Meta-Agents](../../docs/adr/ADR-055-agents-architecture-and-meta-agents.md)
|
|
232
|
+
- [Meta-Agent Developer Guide](../../docs/meta-agents.md)
|
|
233
|
+
- [Package boundary contract](../../AGENTS.md) — canonical layering for every
|
|
234
|
+
CLEO package
|
|
235
|
+
- R1–R4 research artifacts under `.cleo/agent-outputs/T-AGENTS-PRE-WAVE/`
|
|
335
236
|
|
|
336
237
|
## License
|
|
337
238
|
|
|
338
|
-
MIT
|
|
239
|
+
MIT — see [LICENSE](../../LICENSE).
|
package/meta/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @cleocode/agents/meta — Meta-Agent Tier
|
|
2
|
+
|
|
3
|
+
**Status**: Shipped in v2026.4.110 (epic T1232, task T1239)
|
|
4
|
+
**Design**: [ADR-055](../../../docs/adr/ADR-055-agents-architecture-and-meta-agents.md) · [R4 design doc](../../../.cleo/agent-outputs/T-AGENTS-PRE-WAVE/R4-META-AGENT-DESIGN.md)
|
|
5
|
+
|
|
6
|
+
## Purpose
|
|
7
|
+
|
|
8
|
+
Meta-agents are specialised CLEO agents whose sole responsibility is to
|
|
9
|
+
construct other agents (or other artifacts — skills, playbooks, manifests).
|
|
10
|
+
They differ from subagents in that subagents are task executors spawned
|
|
11
|
+
dynamically to perform work, whereas meta-agents are compositional tools that
|
|
12
|
+
generate new CANT artefacts; they run during project initialisation (or
|
|
13
|
+
re-bootstrap) to customise the agent ecology, whereas subagents run repeatedly
|
|
14
|
+
as part of multi-stage playbook flows.
|
|
15
|
+
|
|
16
|
+
## Roster
|
|
17
|
+
|
|
18
|
+
| Meta-Agent | Filename | Purpose |
|
|
19
|
+
|-------------------|----------------------------|-------------------------------------------------------------------|
|
|
20
|
+
| `agent-architect` | `agent-architect.cant` | Synthesise project-specific agents from templates + project-context.json |
|
|
21
|
+
| `skill-architect` | (future — T1241 roadmap) | Generate custom skill stubs based on project type |
|
|
22
|
+
| `playbook-architect` | (future — T1241 roadmap) | Generate DAG-shaped playbooks from high-level workflow specs |
|
|
23
|
+
|
|
24
|
+
## Invocation
|
|
25
|
+
|
|
26
|
+
### Via `cleo init --install-seed-agents`
|
|
27
|
+
|
|
28
|
+
The CLI dispatch layer calls `ensureSeedAgentsInstalled` from
|
|
29
|
+
`@cleocode/core/agents/seed-install`. When a project has
|
|
30
|
+
`.cleo/project-context.json` and a runnable orchestrator is available, the
|
|
31
|
+
installer hands control to `agent-architect` to synthesise customised agents
|
|
32
|
+
into `.cleo/cant/agents/`. When the orchestrator is unavailable OR
|
|
33
|
+
project-context.json is missing, the installer falls back to the legacy
|
|
34
|
+
static-copy behaviour (with variable substitution via
|
|
35
|
+
`@cleocode/core/agents/variable-substitution`).
|
|
36
|
+
|
|
37
|
+
### Via playbook node
|
|
38
|
+
|
|
39
|
+
Any `.cantbook` playbook may invoke a meta-agent through the standard
|
|
40
|
+
agentic-node contract:
|
|
41
|
+
|
|
42
|
+
```yaml
|
|
43
|
+
- id: architect_agents
|
|
44
|
+
type: agentic
|
|
45
|
+
agent: agent-architect
|
|
46
|
+
role: specialist
|
|
47
|
+
inputs:
|
|
48
|
+
projectName: "my-monorepo"
|
|
49
|
+
tier: "2"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The playbook runtime dispatches via `AgentDispatcher` (see
|
|
53
|
+
`@cleocode/core/playbooks/agent-dispatcher`), which resolves the agent id
|
|
54
|
+
across the 5-tier precedence chain:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
meta > project > global > packaged > fallback
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Safety & Constraints
|
|
61
|
+
|
|
62
|
+
1. **No circular synthesis** — a meta-agent MUST NOT invoke another meta-agent
|
|
63
|
+
synchronously during its own run. Downstream meta-agents are scheduled via
|
|
64
|
+
separate playbook nodes.
|
|
65
|
+
2. **Fail-closed** — when agent-architect errors out, the caller falls back to
|
|
66
|
+
static seed-agents; project init never silently produces an empty agent
|
|
67
|
+
directory.
|
|
68
|
+
3. **Manifest-audited** — every synthesised agent appends a
|
|
69
|
+
`pipeline.manifest` row with `type: agent_created`, allowing
|
|
70
|
+
`cleo manifest list --type=agent_created` to reproduce synthesis history.
|
|
71
|
+
|
|
72
|
+
See [ADR-055](../../../docs/adr/ADR-055-agents-architecture-and-meta-agents.md)
|
|
73
|
+
for the full architectural rationale.
|