@cleocode/adapters 2026.4.24 → 2026.4.26
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/index.js +47 -5
- package/dist/index.js.map +3 -3
- package/dist/providers/claude-code/install.d.ts +12 -1
- package/dist/providers/claude-code/install.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/providers/claude-code/commands/orchestrator.md +132 -0
- package/src/providers/claude-code/install.ts +57 -4
|
@@ -15,7 +15,8 @@ import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cle
|
|
|
15
15
|
*
|
|
16
16
|
* Manages CLEO's integration with Claude Code by:
|
|
17
17
|
* 1. Ensuring CLAUDE.md contains @-references to CLEO instruction files
|
|
18
|
-
* 2.
|
|
18
|
+
* 2. Installing adapter-provided commands to .claude/commands/
|
|
19
|
+
* 3. Registering the brain observation plugin in ~/.claude/settings.json
|
|
19
20
|
*
|
|
20
21
|
* @remarks
|
|
21
22
|
* Installation is idempotent -- running install multiple times on the same
|
|
@@ -57,6 +58,16 @@ export declare class ClaudeCodeInstallProvider implements AdapterInstallProvider
|
|
|
57
58
|
* @returns true if the file was created or modified
|
|
58
59
|
*/
|
|
59
60
|
private updateInstructionFile;
|
|
61
|
+
/**
|
|
62
|
+
* Install Claude Code-specific commands to .claude/commands/ in the project.
|
|
63
|
+
*
|
|
64
|
+
* These commands extend CLEO's provider-neutral skills with Claude Code-specific
|
|
65
|
+
* operational patterns (Agent tool spawn templates, model assignment, context guardrails).
|
|
66
|
+
*
|
|
67
|
+
* @param projectDir - Project root directory
|
|
68
|
+
* @returns Array of installed command filenames
|
|
69
|
+
*/
|
|
70
|
+
private installCommands;
|
|
60
71
|
/**
|
|
61
72
|
* Register the CLEO brain plugin in ~/.claude/settings.json.
|
|
62
73
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../src/providers/claude-code/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaH,OAAO,KAAK,EAAE,sBAAsB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAYjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,yBAA0B,YAAW,sBAAsB;IACtE;;;;;OAKG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAgC9D;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAEhC;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAkBrC;;;;;;OAMG;IACG,2BAA2B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpE;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA+B7B;;;;;;;;OAQG;IACH,OAAO,CAAC,eAAe;IAsBvB;;;;OAIG;IACH,OAAO,CAAC,cAAc;CAiCvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleocode/adapters",
|
|
3
|
-
"version": "2026.4.
|
|
3
|
+
"version": "2026.4.26",
|
|
4
4
|
"description": "Unified provider adapters for CLEO (Claude Code, OpenCode, Cursor)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@cleocode/
|
|
16
|
-
"@cleocode/
|
|
15
|
+
"@cleocode/caamp": "2026.4.26",
|
|
16
|
+
"@cleocode/contracts": "2026.4.26"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"engines": {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Orchestrator Mode (Claude Code)
|
|
2
|
+
|
|
3
|
+
Load the `/ct-orchestrator` skill. You are now the Orchestrator.
|
|
4
|
+
|
|
5
|
+
This command extends ct-orchestrator with **Claude Code-specific** operational guidance for spawning subagents via the Agent tool.
|
|
6
|
+
|
|
7
|
+
## Session Startup
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cleo session status # Resume existing?
|
|
11
|
+
cleo dash # Project overview
|
|
12
|
+
cleo current # Active task?
|
|
13
|
+
cleo orchestrate start --epic TXXX # Full state + pipeline + next task
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then ask the human what they want to focus on today. Follow LOOM (RCASD -> IVTR) lifecycle for all work.
|
|
17
|
+
|
|
18
|
+
## Agent Tool — Spawn Patterns
|
|
19
|
+
|
|
20
|
+
In Claude Code, subagent execution uses the **Agent tool**. The prompt comes from `cleo orchestrate spawn`.
|
|
21
|
+
|
|
22
|
+
### Team Lead (RCASD planning, validation, complex reasoning)
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
Agent({
|
|
26
|
+
description: "Team Lead: [epic domain] (T####)",
|
|
27
|
+
subagent_type: "cleo-subagent",
|
|
28
|
+
model: "sonnet",
|
|
29
|
+
prompt: "<resolved prompt from cleo orchestrate spawn T####>"
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Worker (focused implementation, testing)
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
Agent({
|
|
37
|
+
description: "Worker: [task title] (T####)",
|
|
38
|
+
subagent_type: "cleo-subagent",
|
|
39
|
+
model: "haiku",
|
|
40
|
+
prompt: "<resolved prompt from cleo orchestrate spawn T####>"
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Explorer (quick research, codebase investigation)
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Agent({
|
|
48
|
+
description: "Explorer: [research topic] (T####)",
|
|
49
|
+
subagent_type: "cleo-subagent",
|
|
50
|
+
model: "haiku",
|
|
51
|
+
prompt: "<resolved prompt from cleo orchestrate spawn T####>"
|
|
52
|
+
})
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Parallel Spawn (independent tasks in same wave)
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
// Spawn multiple agents in a single message for parallel execution
|
|
59
|
+
Agent({
|
|
60
|
+
description: "Worker: Task A (T1001)",
|
|
61
|
+
subagent_type: "cleo-subagent",
|
|
62
|
+
model: "haiku",
|
|
63
|
+
run_in_background: true,
|
|
64
|
+
prompt: "<prompt A>"
|
|
65
|
+
})
|
|
66
|
+
Agent({
|
|
67
|
+
description: "Worker: Task B (T1002)",
|
|
68
|
+
subagent_type: "cleo-subagent",
|
|
69
|
+
model: "haiku",
|
|
70
|
+
run_in_background: true,
|
|
71
|
+
prompt: "<prompt B>"
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Model Assignment
|
|
76
|
+
|
|
77
|
+
| Role | Model | Rationale |
|
|
78
|
+
|------|-------|-----------|
|
|
79
|
+
| Orchestrator (you) | opus | Strategic coordination, HITL interface |
|
|
80
|
+
| Team Leads | sonnet | Architecture, specs, validation |
|
|
81
|
+
| Workers | haiku | Implementation, testing, focused changes |
|
|
82
|
+
| Explorers | haiku | Quick research, codebase reads |
|
|
83
|
+
|
|
84
|
+
Model assignment is an **optimization** — if a model tier is unavailable, use whatever is available. Never block on model selection.
|
|
85
|
+
|
|
86
|
+
## Two-Step Spawn Flow
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
1. cleo orchestrate spawn T#### --json → Get fully-resolved prompt
|
|
90
|
+
2. Agent({ ..., prompt: <resolved> }) → Execute via Agent tool
|
|
91
|
+
3. Wait for return message → "[Type] complete/partial/blocked..."
|
|
92
|
+
4. cleo manifest show <id> → Read key_findings from manifest
|
|
93
|
+
5. Next spawn or report to human
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Quality Gates
|
|
97
|
+
|
|
98
|
+
### Before marking ANY task done:
|
|
99
|
+
1. Manifest entry exists with key_findings
|
|
100
|
+
2. Return message matches valid format
|
|
101
|
+
3. Acceptance criteria explicitly verified (not assumed)
|
|
102
|
+
4. No regressions in existing functionality
|
|
103
|
+
|
|
104
|
+
### On failure (IVTR loop):
|
|
105
|
+
1. Read manifest for failure details
|
|
106
|
+
2. Add feedback to next spawn prompt
|
|
107
|
+
3. Re-spawn worker with: original prompt + failure context + explicit checklist
|
|
108
|
+
4. Max 2 retries — then escalate to HITL
|
|
109
|
+
|
|
110
|
+
## Guardrails (Claude Code-Specific)
|
|
111
|
+
|
|
112
|
+
| Rule | Enforcement |
|
|
113
|
+
|------|-------------|
|
|
114
|
+
| NEVER write code yourself | All code via Agent() spawns |
|
|
115
|
+
| NEVER read full source files | Only manifests, task outputs, and spawn results |
|
|
116
|
+
| NEVER use `run_in_background: false` for heavy work | Background workers protect your context |
|
|
117
|
+
| NEVER call TaskOutput on subagent results | Read MANIFEST.jsonl via `cleo manifest show` |
|
|
118
|
+
| ALWAYS use `subagent_type: "cleo-subagent"` | Ensures protocol injection |
|
|
119
|
+
| ALWAYS include task ID in description | Traceability: "Worker: Auth module (T1586)" |
|
|
120
|
+
| ALWAYS check `cleo orchestrate ready` before spawning | Dependency order enforcement |
|
|
121
|
+
|
|
122
|
+
## Context Protection
|
|
123
|
+
|
|
124
|
+
Your context window is precious. Protect it:
|
|
125
|
+
|
|
126
|
+
| Strategy | How |
|
|
127
|
+
|----------|-----|
|
|
128
|
+
| Read manifests, not files | `cleo manifest show <id>` over reading source |
|
|
129
|
+
| Keep task state in CLEO | `cleo show T####` to recall details on demand |
|
|
130
|
+
| Background heavy workers | `run_in_background: true` for implementation tasks |
|
|
131
|
+
| End sessions with notes | `cleo session end --note "handoff summary"` |
|
|
132
|
+
| Delegate investigation | Spawn Explore agents for codebase questions |
|
|
@@ -10,20 +10,36 @@
|
|
|
10
10
|
* @task T5240
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
copyFileSync,
|
|
15
|
+
existsSync,
|
|
16
|
+
mkdirSync,
|
|
17
|
+
readdirSync,
|
|
18
|
+
readFileSync,
|
|
19
|
+
writeFileSync,
|
|
20
|
+
} from 'node:fs';
|
|
14
21
|
import { homedir } from 'node:os';
|
|
15
|
-
import { join } from 'node:path';
|
|
22
|
+
import { dirname, join } from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
16
24
|
import type { AdapterInstallProvider, InstallOptions, InstallResult } from '@cleocode/contracts';
|
|
17
25
|
|
|
18
26
|
/** Lines that should appear in CLAUDE.md to reference CLEO. */
|
|
19
27
|
const INSTRUCTION_REFERENCES = ['@~/.cleo/templates/CLEO-INJECTION.md', '@.cleo/memory-bridge.md'];
|
|
20
28
|
|
|
29
|
+
/** Resolve the commands directory bundled with this adapter. */
|
|
30
|
+
function getAdapterCommandsDir(): string {
|
|
31
|
+
// Works in both ESM (import.meta.url) and compiled output
|
|
32
|
+
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
33
|
+
return join(thisDir, 'commands');
|
|
34
|
+
}
|
|
35
|
+
|
|
21
36
|
/**
|
|
22
37
|
* Install provider for Claude Code.
|
|
23
38
|
*
|
|
24
39
|
* Manages CLEO's integration with Claude Code by:
|
|
25
40
|
* 1. Ensuring CLAUDE.md contains @-references to CLEO instruction files
|
|
26
|
-
* 2.
|
|
41
|
+
* 2. Installing adapter-provided commands to .claude/commands/
|
|
42
|
+
* 3. Registering the brain observation plugin in ~/.claude/settings.json
|
|
27
43
|
*
|
|
28
44
|
* @remarks
|
|
29
45
|
* Installation is idempotent -- running install multiple times on the same
|
|
@@ -50,7 +66,13 @@ export class ClaudeCodeInstallProvider implements AdapterInstallProvider {
|
|
|
50
66
|
details.instructionFile = join(projectDir, 'CLAUDE.md');
|
|
51
67
|
}
|
|
52
68
|
|
|
53
|
-
// Step 2:
|
|
69
|
+
// Step 2: Install adapter-provided commands to .claude/commands/
|
|
70
|
+
const commandsInstalled = this.installCommands(projectDir);
|
|
71
|
+
if (commandsInstalled.length > 0) {
|
|
72
|
+
details.commands = commandsInstalled;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Step 3: Register plugin in ~/.claude/settings.json
|
|
54
76
|
const pluginResult = this.registerPlugin();
|
|
55
77
|
if (pluginResult) {
|
|
56
78
|
details.plugin = pluginResult;
|
|
@@ -141,6 +163,37 @@ export class ClaudeCodeInstallProvider implements AdapterInstallProvider {
|
|
|
141
163
|
return true;
|
|
142
164
|
}
|
|
143
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Install Claude Code-specific commands to .claude/commands/ in the project.
|
|
168
|
+
*
|
|
169
|
+
* These commands extend CLEO's provider-neutral skills with Claude Code-specific
|
|
170
|
+
* operational patterns (Agent tool spawn templates, model assignment, context guardrails).
|
|
171
|
+
*
|
|
172
|
+
* @param projectDir - Project root directory
|
|
173
|
+
* @returns Array of installed command filenames
|
|
174
|
+
*/
|
|
175
|
+
private installCommands(projectDir: string): string[] {
|
|
176
|
+
const adapterCommandsDir = getAdapterCommandsDir();
|
|
177
|
+
if (!existsSync(adapterCommandsDir)) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const targetDir = join(projectDir, '.claude', 'commands');
|
|
182
|
+
mkdirSync(targetDir, { recursive: true });
|
|
183
|
+
|
|
184
|
+
const installed: string[] = [];
|
|
185
|
+
const files = readdirSync(adapterCommandsDir).filter((f) => f.endsWith('.md'));
|
|
186
|
+
|
|
187
|
+
for (const file of files) {
|
|
188
|
+
const src = join(adapterCommandsDir, file);
|
|
189
|
+
const dest = join(targetDir, file);
|
|
190
|
+
copyFileSync(src, dest);
|
|
191
|
+
installed.push(file);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return installed;
|
|
195
|
+
}
|
|
196
|
+
|
|
144
197
|
/**
|
|
145
198
|
* Register the CLEO brain plugin in ~/.claude/settings.json.
|
|
146
199
|
*
|