@cleocode/cleo 2026.3.26 → 2026.3.27

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.
@@ -0,0 +1,315 @@
1
+ # CLEO Claude Code Plugin
2
+
3
+ **Version**: 0.70.1
4
+ **Status**: Optional Enhancement
5
+ **Architecture**: Hybrid (Injection + Plugin)
6
+
7
+ ---
8
+
9
+ ## Overview
10
+
11
+ CLEO uses a **hybrid approach** for multi-agent integration:
12
+
13
+ | Component | Purpose | Support |
14
+ |-----------|---------|---------|
15
+ | **Injection System** | Multi-agent task management | 16+ agents (Claude, Cursor, Windsurf, Gemini, etc.) |
16
+ | **Plugin System** | Claude Code hooks | Claude Code only |
17
+
18
+ **Most users need injection only.** The plugin adds optional Claude Code-specific hooks for advanced users.
19
+
20
+ ---
21
+
22
+ ## Architecture
23
+
24
+ ### Primary: Injection System
25
+
26
+ The injection system provides CLEO task management to **all LLM agents** via registry-based auto-discovery:
27
+
28
+ **Location**: `schemas/agent-registry.json`
29
+ **Agents Supported**: claude-code, cursor, windsurf, gemini, copilot, roo-code, cline, continue, aider, bolt, replit, lovable, v0, devin, and more.
30
+
31
+ **How it works**:
32
+ 1. `cleo init` discovers installed agents automatically
33
+ 2. Injects task management instructions to agent config files
34
+ 3. Agents reference external docs via `@~/.cleo/docs/TODO_Task_Management.md`
35
+ 4. Works with any agent that supports config file injection
36
+
37
+ **Supported files**: `CLAUDE.md`, `CURSOR.md`, `.windsurfrules`, `GEMINI.md`, etc.
38
+
39
+ ### Optional: Plugin System
40
+
41
+ The plugin adds **Claude Code-specific hooks** for terminal integration:
42
+
43
+ **Location**: `.claude-plugin/`
44
+ **Capabilities**: SessionStart hook for automatic session binding
45
+ **Limitation**: Claude Code only (not portable to other agents)
46
+
47
+ **What the plugin provides**:
48
+ - **SessionStart Hook**: Auto-binds CLEO session to Claude terminal via `CLEO_SESSION` env var
49
+ - **TTY Integration**: Seamless session continuity across Claude Code restarts
50
+
51
+ **What it does NOT provide**:
52
+ - ❌ Slash commands (future enhancement)
53
+ - ❌ Custom agents (future enhancement)
54
+ - ❌ Portability to other agents (injection system handles this)
55
+
56
+ ---
57
+
58
+ ## When to Use Plugin
59
+
60
+ ### Use Injection Only (Default) ✓
61
+
62
+ **Recommended for**:
63
+ - Multi-agent workflows (Cursor, Windsurf, Gemini, etc.)
64
+ - Standard Claude Code usage
65
+ - Users who don't need automatic session binding
66
+
67
+ **What you get**:
68
+ - Full CLEO task management (`cleo` CLI)
69
+ - Multi-session support
70
+ - Orchestration and subagents
71
+ - Works in all supported agents
72
+
73
+ ### Add Plugin (Advanced) ⚡
74
+
75
+ **Recommended for**:
76
+ - Heavy Claude Code users
77
+ - Multi-session power users
78
+ - Users who want automatic session binding
79
+
80
+ **What you get**:
81
+ - Everything from injection system
82
+ - **PLUS**: SessionStart hook for automatic `CLEO_SESSION` binding
83
+ - **PLUS**: TTY-aware session continuity
84
+
85
+ ---
86
+
87
+ ## Installation
88
+
89
+ ### Default Installation (Injection Only)
90
+
91
+ ```bash
92
+ # Install CLEO with multi-agent support
93
+ curl -fsSL https://github.com/kryptobaseddev/cleo/releases/latest/download/install.sh | bash
94
+
95
+ # Setup agent configurations (auto-discovers installed agents)
96
+ cleo init
97
+
98
+ # Verify injection
99
+ cleo doctor
100
+ ```
101
+
102
+ **Result**: CLEO works in all supported agents via injection system.
103
+
104
+ ### Advanced Installation (Injection + Plugin)
105
+
106
+ ```bash
107
+ # Install CLEO with Claude Code plugin
108
+ curl -fsSL https://github.com/kryptobaseddev/cleo/releases/latest/download/install.sh | bash -s -- --with-plugin
109
+
110
+ # Setup agent configurations
111
+ cleo init
112
+
113
+ # Verify both injection and plugin
114
+ cleo doctor
115
+ ```
116
+
117
+ **Result**: CLEO works in all agents + Claude Code gets SessionStart hook.
118
+
119
+ ---
120
+
121
+ ## Plugin Structure
122
+
123
+ ```
124
+ .claude-plugin/
125
+ ├── plugin.json # Plugin manifest
126
+ ├── hooks/
127
+ │ ├── hooks.json # Hook configuration
128
+ │ └── scripts/
129
+ │ └── session-start.sh # SessionStart hook implementation
130
+ └── README.md # This file
131
+ ```
132
+
133
+ ### plugin.json
134
+
135
+ Plugin manifest defining capabilities:
136
+
137
+ ```json
138
+ {
139
+ "name": "cleo",
140
+ "version": "0.70.1",
141
+ "capabilities": {
142
+ "task_management": true,
143
+ "multi_session": true,
144
+ "orchestration": true
145
+ },
146
+ "hooks": {
147
+ "enabled": true,
148
+ "directory": "hooks",
149
+ "manifest": "hooks/hooks.json"
150
+ }
151
+ }
152
+ ```
153
+
154
+ ### hooks.json
155
+
156
+ Hook configuration for SessionStart event:
157
+
158
+ ```json
159
+ {
160
+ "SessionStart": [{
161
+ "matcher": "*",
162
+ "hooks": [{
163
+ "type": "command",
164
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/session-start.sh",
165
+ "timeout": 10
166
+ }]
167
+ }]
168
+ }
169
+ ```
170
+
171
+ ### session-start.sh
172
+
173
+ Auto-binds active CLEO session to Claude terminal:
174
+
175
+ **What it does**:
176
+ 1. Checks for active CLEO session (`.cleo/.current-session`)
177
+ 2. Verifies session is active via `cleo session status`
178
+ 3. Exports `CLEO_SESSION` env var for terminal
179
+ 4. Creates `.cleo/.session-env` for manual sourcing (if needed)
180
+
181
+ **Exit conditions** (silent):
182
+ - CLEO not installed
183
+ - No `.cleo` directory (not a CLEO project)
184
+ - No active session
185
+ - Session inactive/ended
186
+
187
+ ---
188
+
189
+ ## Usage
190
+
191
+ ### With Injection Only
192
+
193
+ Standard CLI workflow:
194
+
195
+ ```bash
196
+ # Start session manually
197
+ cleo session start --scope epic:T1074 --auto-focus
198
+
199
+ # Use cleo commands with CLEO_SESSION env var
200
+ export CLEO_SESSION="session_20260127_123456_abc123"
201
+ cleo list --parent T1074
202
+ cleo complete T1087
203
+
204
+ # End session
205
+ cleo session end --note "Completed plugin docs"
206
+ ```
207
+
208
+ ### With Plugin
209
+
210
+ Plugin auto-binds session on Claude Code start:
211
+
212
+ ```bash
213
+ # Start session (manually or via orchestrator)
214
+ cleo session start --scope epic:T1074 --auto-focus
215
+
216
+ # Claude Code starts → plugin auto-exports CLEO_SESSION
217
+ # ✓ CLEO session bound: session_20260127_123456_abc123
218
+
219
+ # Use cleo commands (no manual export needed)
220
+ cleo list --parent T1074
221
+ cleo complete T1087
222
+
223
+ # End session
224
+ cleo session end --note "Completed plugin docs"
225
+ ```
226
+
227
+ **Key difference**: Plugin eliminates manual `export CLEO_SESSION=...` step.
228
+
229
+ ---
230
+
231
+ ## Hybrid Benefits
232
+
233
+ | Benefit | Injection | Plugin |
234
+ |---------|-----------|--------|
235
+ | Multi-agent support | ✓ | ❌ |
236
+ | Claude Code support | ✓ | ✓ |
237
+ | Task management | ✓ | ✓ |
238
+ | Multi-session | ✓ | ✓ |
239
+ | Auto session binding | ❌ | ✓ |
240
+ | TTY continuity | ❌ | ✓ |
241
+
242
+ **Philosophy**: Injection provides portability, plugin provides polish.
243
+
244
+ ---
245
+
246
+ ## Decision Tree
247
+
248
+ ```
249
+ Do you use Claude Code exclusively?
250
+ ├─ Yes
251
+ │ └─ Do you want automatic session binding?
252
+ │ ├─ Yes → Install with --with-plugin
253
+ │ └─ No → Install default (injection only)
254
+ └─ No (multi-agent workflow)
255
+ └─ Install default (injection only)
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Troubleshooting
261
+
262
+ ### Plugin Not Working
263
+
264
+ **Symptom**: SessionStart hook not firing
265
+
266
+ **Check**:
267
+ 1. Plugin installed: `ls .claude-plugin/`
268
+ 2. Hooks enabled: `cat .claude-plugin/plugin.json | jq '.hooks.enabled'`
269
+ 3. CLEO session active: `cleo session status`
270
+ 4. Claude Code version: Plugin requires Claude Code 1.0.0+
271
+
272
+ ### Session Not Auto-Binding
273
+
274
+ **Symptom**: `CLEO_SESSION` not set after Claude Code start
275
+
276
+ **Check**:
277
+ 1. Active session exists: `cat .cleo/.current-session`
278
+ 2. Session is active: `cleo session status`
279
+ 3. Hook script executable: `ls -l .claude-plugin/hooks/scripts/session-start.sh`
280
+ 4. Manual test: `bash .claude-plugin/hooks/scripts/session-start.sh`
281
+
282
+ ### Injection vs Plugin Conflict
283
+
284
+ **Symptom**: Duplicate task management instructions
285
+
286
+ **Resolution**: No conflict. Injection and plugin are complementary:
287
+ - Injection: Provides task management docs to agent
288
+ - Plugin: Provides terminal integration hooks
289
+
290
+ Both can coexist safely.
291
+
292
+ ---
293
+
294
+ ## Future Enhancements
295
+
296
+ **Planned plugin features** (not in v0.70.1):
297
+ - Slash commands (`/cleo add "Task"`)
298
+ - Custom agents (`ct-orchestrator`, `ct-epic-architect`)
299
+ - Agent-to-agent communication (consensus protocol)
300
+ - Git workflow integration
301
+
302
+ **Current status**: Plugin provides SessionStart hook only. All other features use standard CLI.
303
+
304
+ ---
305
+
306
+ ## References
307
+
308
+ - **Injection System**: `schemas/agent-registry.json`
309
+ - **Setup Guide**: `docs/guides/AGENT-REGISTRATION.md`
310
+ - **Subagent Architecture**: `docs/architecture/CLEO-SUBAGENT.md`
311
+ - **Protocol Stack**: `src/protocols/`
312
+
313
+ ---
314
+
315
+ **Key Insight**: CLEO uses injection for portability, plugin for Claude Code polish. Most users need injection only.
@@ -0,0 +1,56 @@
1
+ {
2
+ "description": "CLEO task management and brain memory hooks",
3
+ "hooks": {
4
+ "SessionStart": [
5
+ {
6
+ "matcher": "*",
7
+ "hooks": [
8
+ {
9
+ "type": "command",
10
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/session-start.sh",
11
+ "timeout": 10
12
+ },
13
+ {
14
+ "type": "command",
15
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/brain-start.sh",
16
+ "timeout": 5
17
+ }
18
+ ]
19
+ }
20
+ ],
21
+ "UserPromptSubmit": [
22
+ {
23
+ "hooks": [
24
+ {
25
+ "type": "command",
26
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/brain-context.sh",
27
+ "timeout": 8
28
+ }
29
+ ]
30
+ }
31
+ ],
32
+ "PostToolUse": [
33
+ {
34
+ "matcher": "*",
35
+ "hooks": [
36
+ {
37
+ "type": "command",
38
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/brain-hook.sh observation",
39
+ "timeout": 5
40
+ }
41
+ ]
42
+ }
43
+ ],
44
+ "Stop": [
45
+ {
46
+ "hooks": [
47
+ {
48
+ "type": "command",
49
+ "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/brain-hook.sh summarize",
50
+ "timeout": 30
51
+ }
52
+ ]
53
+ }
54
+ ]
55
+ }
56
+ }
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ # UserPromptSubmit: inject recent CLEO brain observations as context
3
+ # Claude Code reads stdout from this hook and includes it in the session context.
4
+ # Must be fast (<3s) and always exit 0.
5
+
6
+ CLEO_BIN="${HOME}/.cleo/bin/cleo"
7
+
8
+ # Bail fast if cleo not available or no .cleo dir
9
+ [[ ! -x "$CLEO_BIN" ]] && exit 0
10
+ [[ ! -d ".cleo" ]] && exit 0
11
+
12
+ # Query recent brain observations — compact format
13
+ CONTEXT=$("$CLEO_BIN" memory find "session task decision pattern learning" --limit 15 --json 2>/dev/null | \
14
+ python3 -c "
15
+ import json, sys
16
+ try:
17
+ d = json.loads(sys.stdin.read())
18
+ hits = d.get('result', {}).get('results', [])
19
+ if not hits:
20
+ sys.exit(0)
21
+ lines = ['## CLEO Brain Context (recent memories)\n']
22
+ for h in hits:
23
+ t = h.get('type', 'observation')
24
+ icon = {'observation': 'O', 'decision': 'D', 'pattern': 'P', 'learning': 'L'}.get(t, 'O')
25
+ title = h.get('title', '')[:90]
26
+ date = h.get('date', '')[:10]
27
+ lines.append(f'- [{icon}] {date} {title}')
28
+ print('\n'.join(lines))
29
+ print()
30
+ except Exception:
31
+ pass
32
+ " 2>/dev/null || true)
33
+
34
+ [[ -n "$CONTEXT" ]] && echo "$CONTEXT"
35
+ exit 0
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env bash
2
+ # Fire-and-forget: send hook event to brain worker
3
+ # Always exits 0 — never blocks Claude Code
4
+ EVENT="$1"
5
+ WORKER_PORT=37778
6
+
7
+ # Read stdin
8
+ INPUT=$(cat 2>/dev/null || echo '{}')
9
+
10
+ # Non-blocking curl to worker
11
+ curl -sf --max-time 5 \
12
+ -X POST "http://127.0.0.1:${WORKER_PORT}/hook" \
13
+ -H "Content-Type: application/json" \
14
+ -d "{\"event\":\"${EVENT}\",\"data\":$(echo "$INPUT" | python3 -c 'import json,sys; print(json.dumps(json.load(sys.stdin)))' 2>/dev/null || echo '\"{}\"')}" \
15
+ >/dev/null 2>&1 || true
16
+
17
+ exit 0
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ # SessionStart hook — starts the brain worker if not running
3
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
4
+ node "$SCRIPT_DIR/brain-worker.cjs" start 2>/dev/null &
5
+ disown 2>/dev/null || true
6
+ exit 0