openclaw-code-agent 2.3.1 → 3.1.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.
- package/README.md +80 -359
- package/dist/index.js +125 -63
- package/openclaw.plugin.json +25 -34
- package/package.json +31 -11
- package/skills/code-agent-orchestration/SKILL.md +147 -299
- package/workflows/plan-approval.lobster +0 -15
package/README.md
CHANGED
|
@@ -4,66 +4,52 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/openclaw-code-agent)
|
|
5
5
|
[](LICENSE)
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`openclaw-code-agent` is the OpenClaw plugin for running Claude Code and Codex as managed background coding sessions from chat. Launch work from Telegram, Discord, or any OpenClaw-supported channel, review the plan before execution, keep the job isolated in its own git worktree, and merge or open a PR without leaving the thread.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **Plan -> Review -> Execute**. `plan` is the default launch mode, with `ask`, `delegate`, and `approve` deciding how much plan approval autonomy the orchestrator gets.
|
|
10
|
+
- **Optional worktree isolation**. New sessions default to `off`; opt into `ask`, `delegate`, `auto-merge`, or `auto-pr` when you want worktree-backed branch isolation and post-run branch handling.
|
|
11
|
+
- **State-driven decision UX**. `ask` sends explicit action buttons for **Merge locally**, **Create PR**, **Decide later**, and **Dismiss**. The same action-token model now backs both Telegram and Discord interactive callbacks.
|
|
12
|
+
- **Full session lifecycle**. Suspend, resume, fork, interrupt, and recover sessions across restarts with persisted metadata and output.
|
|
13
|
+
- **Real operator visibility**. `agent_sessions`, `agent_output`, and `agent_stats` show status, buffered output, duration, and USD cost.
|
|
14
|
+
- **Two harnesses, one control plane**. Claude Code and Codex share the same tools, routing, notification pipeline, and worktree strategy model while each backend uses its own native execution substrate.
|
|
15
|
+
- **One continuation primitive**. `agent_respond` is the only way to continue, approve, revise, or redirect an existing session. Forks still go through `agent_launch(..., resume_session_id=..., fork_session=true)`.
|
|
10
16
|
|
|
11
|
-
|
|
17
|
+
Need the version-pinned ACP breakdown? See [docs/ACP-COMPARISON.md](docs/ACP-COMPARISON.md).
|
|
12
18
|
|
|
13
|
-
|
|
19
|
+
## From Prompt To Merged Branch
|
|
14
20
|
|
|
15
|
-
|
|
21
|
+
1. Launch a coding session from chat with `/agent ...` or `agent_launch(...)`.
|
|
22
|
+
2. Review the plan in the same thread before anything touches the repo.
|
|
23
|
+
3. Let the agent finish in an isolated worktree, then merge or publish the result from chat.
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
### Plan First
|
|
18
26
|
|
|
19
|
-
|
|
20
|
-
<img src="assets/ask-readme.gif" alt="Ask mode demo showing plan review and approval before execution">
|
|
27
|
+
The differentiator is the plan-review loop. Claude Code and Codex both feed the same review UX now: the plugin receives a structured plan artifact, keeps execution blocked until approval, and resumes the same session with `agent_respond(..., approve=true)`.
|
|
21
28
|
|
|
22
|
-
|
|
29
|
+
<img src="assets/ask-readme.gif" alt="Plan review in ask mode with inline approval controls">
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
*`ask` mode keeps the human in the loop: the plan lands back in the originating thread, and execution only starts after approval.*
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
### Finish Cleanly
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
When the task is done, the plugin can leave the branch for review, merge it automatically, or help create a PR. In `ask`, the user gets the same explicit decision buttons in the originating thread. In `delegate`, the orchestrator receives the diff context, may merge if safe, and always escalates PR decisions to the user. Planning artifacts belong in `/tmp/` — the agent will not commit analysis notes to the branch.
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
<img src="assets/delegate-readme.gif" alt="Delegated worktree flow with autonomous follow-through">
|
|
31
38
|
|
|
32
|
-
|
|
33
|
-
|-------|--------|-------|
|
|
34
|
-
| [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | ✅ Supported | Full support via `@anthropic-ai/claude-agent-sdk` |
|
|
35
|
-
| [Codex](https://github.com/openai/codex) | ✅ Supported | Full support via `@openai/codex-sdk` thread API |
|
|
36
|
-
| Other agents | 🚧 Planned | Plugin architecture supports adding new harnesses |
|
|
39
|
+
*The main checkout stays clean. The branch lifecycle happens in the worktree, and the chat thread stays current on what was shipped.*
|
|
37
40
|
|
|
38
|
-
|
|
41
|
+
## Supported Harnesses
|
|
39
42
|
|
|
40
|
-
|
|
43
|
+
| Harness | Status | Notes |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | Supported | Native harness via `@anthropic-ai/claude-agent-sdk` |
|
|
46
|
+
| [Codex](https://github.com/openai/codex) | Supported | Native harness via Codex App Server over stdio |
|
|
41
47
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- **Multi-session management** — Run multiple concurrent coding agent sessions, each with a unique ID and human-readable name
|
|
45
|
-
- **Plan → Execute workflow** — Claude Code sessions expose plan mode; Codex uses a soft first-turn planning prompt while staying externally in implement mode
|
|
46
|
-
- **Real Codex approval policy support** — Codex sessions default to the real Codex SDK/CLI `approvalPolicy: "on-request"` and can be pinned back to `"never"` via `harnesses.codex.approvalPolicy`
|
|
47
|
-
- **Thread-based routing** — Notifications go to the Telegram thread/topic where the session was launched
|
|
48
|
-
- **Pause + auto-resume** — Non-question turn completion pauses sessions (`done`) and next `agent_respond` auto-resumes with context intact
|
|
49
|
-
- **Turn-end wake signaling** — Every turn end emits a deterministic wake signal with output preview and waiting hint
|
|
50
|
-
- **Smart waiting detection** — Heuristic waiting detector reduces false-positive wake escalations
|
|
51
|
-
- **Multi-turn conversations** — Send follow-up messages, interrupt, or iterate with a running agent
|
|
52
|
-
- **Session resume & fork** — Resume any completed session or fork it into a new conversation branch
|
|
53
|
-
- **Merged session listing** — `agent_sessions` shows active + persisted sessions in one view (deduped by internal session ID)
|
|
54
|
-
- **Pending MessageStream safety** — queued follow-ups are preserved across turn completion so messages are not dropped
|
|
55
|
-
- **Codex SDK streaming harness** — uses `@openai/codex-sdk` thread streaming with soft first-turn planning, waiting detection, and activity heartbeats
|
|
56
|
-
- **Multi-agent support** — Route notifications to the correct agent/chat via workspace-based channel mapping
|
|
57
|
-
- **Auto-respond rules** — Orchestrator auto-handles permission requests and confirmations; forwards real decisions to you
|
|
58
|
-
- **Anti-cascade protection** — Orchestrator never launches new sessions from wake events
|
|
59
|
-
- **Automatic cleanup** — Completed sessions are garbage-collected after a configurable TTL (`sessionGcAgeMinutes`, default 24h); IDs persist for resume
|
|
60
|
-
- **Harness-agnostic architecture** — Pluggable `AgentHarness` interface allows adding new coding agent backends
|
|
61
|
-
|
|
62
|
-
---
|
|
48
|
+
Launches and notifications work from Telegram, Discord, or any OpenClaw-supported channel. Telegram and Discord now share the same action-token callback flow for plan approvals, question options, resume/restart, and worktree decisions.
|
|
63
49
|
|
|
64
50
|
## Quick Start
|
|
65
51
|
|
|
66
|
-
|
|
52
|
+
Install and enable the plugin:
|
|
67
53
|
|
|
68
54
|
```bash
|
|
69
55
|
openclaw plugins install openclaw-code-agent
|
|
@@ -71,9 +57,7 @@ openclaw plugins enable openclaw-code-agent
|
|
|
71
57
|
openclaw gateway restart
|
|
72
58
|
```
|
|
73
59
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
Add to `~/.openclaw/openclaw.json` under `plugins.entries["openclaw-code-agent"]`:
|
|
60
|
+
Add a minimal config block under `plugins.entries["openclaw-code-agent"]` in `~/.openclaw/openclaw.json`:
|
|
77
61
|
|
|
78
62
|
```json
|
|
79
63
|
{
|
|
@@ -83,17 +67,17 @@ Add to `~/.openclaw/openclaw.json` under `plugins.entries["openclaw-code-agent"]
|
|
|
83
67
|
"enabled": true,
|
|
84
68
|
"config": {
|
|
85
69
|
"fallbackChannel": "telegram|my-bot|123456789",
|
|
86
|
-
"
|
|
70
|
+
"planApproval": "ask",
|
|
71
|
+
"defaultWorktreeStrategy": "off",
|
|
87
72
|
"harnesses": {
|
|
88
|
-
"codex": {
|
|
89
|
-
"defaultModel": "gpt-5.4",
|
|
90
|
-
"allowedModels": ["gpt-5.4"],
|
|
91
|
-
"reasoningEffort": "medium",
|
|
92
|
-
"approvalPolicy": "on-request"
|
|
93
|
-
},
|
|
94
73
|
"claude-code": {
|
|
95
74
|
"defaultModel": "sonnet",
|
|
96
75
|
"allowedModels": ["sonnet", "opus"]
|
|
76
|
+
},
|
|
77
|
+
"codex": {
|
|
78
|
+
"defaultModel": "gpt-5.4",
|
|
79
|
+
"allowedModels": ["gpt-5.4"],
|
|
80
|
+
"reasoningEffort": "medium"
|
|
97
81
|
}
|
|
98
82
|
}
|
|
99
83
|
}
|
|
@@ -103,336 +87,73 @@ Add to `~/.openclaw/openclaw.json` under `plugins.entries["openclaw-code-agent"]
|
|
|
103
87
|
}
|
|
104
88
|
```
|
|
105
89
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
### 2a. Codex auth safety
|
|
109
|
-
|
|
110
|
-
If you run Codex sessions, strongly recommend forcing ChatGPT login in your Codex config:
|
|
90
|
+
If you run Codex sessions, keep Codex on the ChatGPT auth path:
|
|
111
91
|
|
|
112
92
|
```toml
|
|
113
93
|
forced_login_method = "chatgpt"
|
|
114
94
|
```
|
|
115
95
|
|
|
116
|
-
Put that in `~/.codex/config.toml`.
|
|
96
|
+
Put that in `~/.codex/config.toml`.
|
|
117
97
|
|
|
118
|
-
|
|
98
|
+
Codex approval behavior is fixed to the supported execution path, and OpenClaw handles review gates through `permissionMode` plus `planApproval`.
|
|
119
99
|
|
|
120
|
-
|
|
121
|
-
2. A coding agent session launches and explores the task. Claude Code exposes **plan mode**; Codex can do a plan-first turn without surfacing plan mode in session status
|
|
122
|
-
3. The agent's questions and plan appear in the **same Telegram thread** where you launched
|
|
123
|
-
4. When a session is awaiting plan approval, approve it with `agent_respond(..., approve=true)` and the session switches to implement mode
|
|
124
|
-
5. The agent implements with full permissions, then you get a brief completion summary
|
|
125
|
-
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
## Tools
|
|
129
|
-
|
|
130
|
-
| Tool | Description | Key Parameters |
|
|
131
|
-
|------|-------------|----------------|
|
|
132
|
-
| `agent_launch` | Start a new coding agent session in background | `prompt`, `name`, `workdir`, `model`, `resume_session_id`, `fork_session`, `permission_mode`, `harness` |
|
|
133
|
-
| `agent_respond` | Send a follow-up message to a running session | `session`, `message`, `interrupt`, `approve`, `userInitiated` |
|
|
134
|
-
| `agent_kill` | Terminate or complete a running session | `session`, `reason` |
|
|
135
|
-
| `agent_output` | Read buffered output from a session | `session`, `lines`, `full` |
|
|
136
|
-
| `agent_sessions` | List recent sessions (5 by default, `full` for 24h view) | `status`, `full` |
|
|
137
|
-
| `agent_stats` | Show usage metrics (counts, durations, costs) | *(none)* |
|
|
138
|
-
|
|
139
|
-
Core orchestration workflows use `agent_launch`, `agent_respond`, `agent_output`, `agent_sessions`, and `agent_kill`.
|
|
140
|
-
|
|
141
|
-
All tools are also available as **chat commands** (`/agent`, `/agent_respond`, `/agent_kill`, `/agent_sessions`, `/agent_resume`, `/agent_stats`, `/agent_output`).
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
## Usage Examples
|
|
100
|
+
Launch a first session:
|
|
146
101
|
|
|
147
102
|
```bash
|
|
148
|
-
|
|
149
|
-
/agent Fix the authentication bug in src/auth.ts
|
|
150
|
-
/agent --name fix-auth Fix the authentication bug
|
|
151
|
-
|
|
152
|
-
# Monitor
|
|
103
|
+
/agent --name fix-auth Fix the auth middleware bug
|
|
153
104
|
/agent_sessions
|
|
154
|
-
/
|
|
155
|
-
|
|
156
|
-
# Interact with a running session
|
|
157
|
-
/agent_respond fix-auth Also add unit tests
|
|
158
|
-
/agent_respond --interrupt fix-auth Stop that and do this instead
|
|
159
|
-
|
|
160
|
-
# Approve a pending plan (tool call)
|
|
161
|
-
agent_respond(session='fix-auth', message='Approved. Go ahead.', approve=true)
|
|
162
|
-
|
|
163
|
-
# Lifecycle management
|
|
164
|
-
/agent_kill fix-auth
|
|
165
|
-
/agent_resume fix-auth Add error handling
|
|
166
|
-
/agent_resume --fork fix-auth Try a different approach
|
|
167
|
-
/agent_stats
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Notifications
|
|
173
|
-
|
|
174
|
-
The plugin sends targeted notifications to the originating Telegram thread:
|
|
175
|
-
|
|
176
|
-
| Emoji | Event | Description |
|
|
177
|
-
|-------|-------|-------------|
|
|
178
|
-
| 🚀 | Launched | Session started with prompt summary |
|
|
179
|
-
| ❓ | Waiting for input | Session is waiting for user input |
|
|
180
|
-
| 📋 | Plan ready | Plan approval requested — reply "go" to approve |
|
|
181
|
-
| ⏸️ | Paused after turn | Turn completed, session paused (auto-resumable) |
|
|
182
|
-
| ↪️ | Redirected | Active work was intentionally interrupted and redirected in-place |
|
|
183
|
-
| ▶️ | Auto-resumed | Session resumed on the next `agent_respond` |
|
|
184
|
-
| ✅ | Completed | Completion summary with cost and duration |
|
|
185
|
-
| ❌ | Failed | Error notification with hint |
|
|
186
|
-
| 💤 | Idle timeout | Session timed out while waiting; auto-resumes on next respond |
|
|
187
|
-
| ⛔ | Stopped | Session was stopped by user, shutdown, or another forced stop |
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
## Plan → Execute Mode Switch
|
|
192
|
-
|
|
193
|
-
- **Claude Code** starts in `plan` mode by default. Approve a pending plan with `agent_respond(..., approve=true)` and the session switches to `bypassPermissions`.
|
|
194
|
-
- **Codex** does not surface `plan` or `awaiting-plan-approval` in session state. When launched with `permissionMode: "plan"`, its first turn is prompted to return a plan and ask whether to proceed, while the exposed session phase remains implementation-oriented.
|
|
195
|
-
- For **Codex**, plugin `permissionMode` is a plugin-orchestrated planning/approval workflow. It is not the same thing as the Codex SDK/CLI `approvalPolicy`.
|
|
196
|
-
- The real Codex SDK/CLI approval behavior is controlled by `harnesses.codex.approvalPolicy`. Supported values are `"on-request"` (default) and `"never"`.
|
|
197
|
-
|
|
198
|
-
On approval, the plugin prepends a system instruction telling the agent to exit plan mode and implement with full permissions.
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
## Auto-Respond Rules
|
|
203
|
-
|
|
204
|
-
The orchestrator agent follows strict auto-respond rules to minimize noise:
|
|
205
|
-
|
|
206
|
-
**Auto-respond (immediate):**
|
|
207
|
-
- Permission requests (file read/write/bash) → "Yes, proceed."
|
|
208
|
-
- Explicit "should I continue?" confirmations → "Yes, continue."
|
|
209
|
-
|
|
210
|
-
**Forward to user (everything else):**
|
|
211
|
-
- Architecture/design decisions
|
|
212
|
-
- Destructive operations
|
|
213
|
-
- Scope changes
|
|
214
|
-
- Credential/production questions
|
|
215
|
-
- Any ambiguous or non-trivial question
|
|
216
|
-
|
|
217
|
-
When forwarding, the orchestrator quotes the agent's exact question without adding its own commentary.
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
## Configuration
|
|
222
|
-
|
|
223
|
-
Set values in `~/.openclaw/openclaw.json` under `plugins.entries["openclaw-code-agent"].config`:
|
|
224
|
-
|
|
225
|
-
| Option | Type | Default | Description |
|
|
226
|
-
|--------|------|---------|-------------|
|
|
227
|
-
| `agentChannels` | `object` | — | Map workdir paths → notification channels (see [docs/AGENT_CHANNELS.md](docs/AGENT_CHANNELS.md)) |
|
|
228
|
-
| `fallbackChannel` | `string` | — | Default notification channel when no workspace match found |
|
|
229
|
-
| `maxSessions` | `number` | `20` | Maximum concurrent sessions |
|
|
230
|
-
| `maxAutoResponds` | `number` | `10` | Max consecutive auto-responds before requiring user input |
|
|
231
|
-
| `permissionMode` | `string` | `"plan"` | Plugin orchestration mode: `"default"` / `"plan"` / `"acceptEdits"` / `"bypassPermissions"` |
|
|
232
|
-
| `idleTimeoutMinutes` | `number` | `15` | Idle timeout before auto-kill |
|
|
233
|
-
| `sessionGcAgeMinutes` | `number` | `1440` | TTL for completed/failed/killed runtime sessions before GC eviction |
|
|
234
|
-
| `maxPersistedSessions` | `number` | `10000` | Max completed sessions kept for resume; the 24h GC TTL (`sessionGcAgeMinutes`) is the primary retention control |
|
|
235
|
-
| `planApproval` | `string` | `"delegate"` | `"approve"` (orchestrator can auto-approve) / `"ask"` (always forward to user) / `"delegate"` (orchestrator decides) |
|
|
236
|
-
| `defaultHarness` | `string` | `"claude-code"` | Default harness for new sessions (`"claude-code"` / `"codex"`) |
|
|
237
|
-
| `harnesses` | `object` | built-in defaults | Per-harness defaults and restrictions. Built-in defaults: `claude-code.defaultModel = "sonnet"`, `claude-code.allowedModels = ["sonnet","opus"]`, `codex.defaultModel = "gpt-5.4"`, `codex.allowedModels = ["gpt-5.4"]`, `codex.reasoningEffort = "medium"`, `codex.approvalPolicy = "on-request"` |
|
|
238
|
-
| `defaultWorkdir` | `string` | — | Default working directory for new sessions |
|
|
239
|
-
|
|
240
|
-
### Permission Mode Mapping By Harness
|
|
241
|
-
|
|
242
|
-
Permission modes are shared at the plugin API, but each harness maps them differently:
|
|
243
|
-
|
|
244
|
-
- **Claude Code harness**
|
|
245
|
-
- `default`, `plan`, `acceptEdits`, `bypassPermissions` are passed through the SDK
|
|
246
|
-
- **Codex harness**
|
|
247
|
-
- Always runs with SDK thread option `sandboxMode: "danger-full-access"`
|
|
248
|
-
- Uses Codex SDK/CLI `approvalPolicy: "on-request"` by default, or `"never"` when `harnesses.codex.approvalPolicy` is set
|
|
249
|
-
- Supports `harnesses.codex.defaultModel`, `harnesses.codex.allowedModels`, `harnesses.codex.reasoningEffort`, and `harnesses.codex.approvalPolicy`
|
|
250
|
-
- In `bypassPermissions`, the harness adds filesystem root (`/` on POSIX) to Codex `additionalDirectories`, plus optional extras from `OPENCLAW_CODEX_BYPASS_ADDITIONAL_DIRS` (comma-separated)
|
|
251
|
-
- `setPermissionMode()` is applied by recreating the thread on the next turn via `resumeThread` (same thread ID)
|
|
252
|
-
- `plan` / `acceptEdits` remain plugin behavioral orchestration constraints (planning/approval flow), not Codex sandbox or SDK approval settings
|
|
253
|
-
|
|
254
|
-
### Runtime Environment Overrides
|
|
255
|
-
|
|
256
|
-
- `OPENCLAW_CODE_AGENT_SESSIONS_PATH` — explicit persisted session index path
|
|
257
|
-
- `OPENCLAW_HOME` — base dir for persisted session index when explicit path is unset (`$OPENCLAW_HOME/code-agent-sessions.json`)
|
|
258
|
-
- `OPENCLAW_CODEX_BYPASS_ADDITIONAL_DIRS` — comma-separated extra directories for Codex bypass mode
|
|
259
|
-
- `OPENCLAW_CODEX_HEARTBEAT_MS` — Codex activity heartbeat interval in milliseconds (default `10000`)
|
|
260
|
-
|
|
261
|
-
### Session Lifecycle + GC
|
|
262
|
-
|
|
263
|
-
- Active sessions live in runtime memory (`SessionManager.sessions`)
|
|
264
|
-
- Terminal sessions are persisted with metadata/output stubs for resume and listing
|
|
265
|
-
- Runtime records are evicted after `sessionGcAgeMinutes` (default 1440 / 24h)
|
|
266
|
-
- Eviction means **removed from runtime cache**, not deleted permanently; persisted session records remain resumable
|
|
267
|
-
|
|
268
|
-
### Example
|
|
269
|
-
|
|
270
|
-
```json
|
|
271
|
-
{
|
|
272
|
-
"plugins": {
|
|
273
|
-
"entries": {
|
|
274
|
-
"openclaw-code-agent": {
|
|
275
|
-
"enabled": true,
|
|
276
|
-
"config": {
|
|
277
|
-
"maxSessions": 3,
|
|
278
|
-
"harnesses": {
|
|
279
|
-
"codex": {
|
|
280
|
-
"defaultModel": "gpt-5.4",
|
|
281
|
-
"allowedModels": ["gpt-5.4"],
|
|
282
|
-
"reasoningEffort": "high",
|
|
283
|
-
"approvalPolicy": "on-request"
|
|
284
|
-
},
|
|
285
|
-
"claude-code": {
|
|
286
|
-
"defaultModel": "sonnet",
|
|
287
|
-
"allowedModels": ["sonnet", "opus"]
|
|
288
|
-
}
|
|
289
|
-
},
|
|
290
|
-
"permissionMode": "plan",
|
|
291
|
-
"fallbackChannel": "telegram|my-bot|123456789",
|
|
292
|
-
"agentChannels": {
|
|
293
|
-
"/home/user/project-alpha": "telegram|my-bot|123456789",
|
|
294
|
-
"/home/user/project-beta": "telegram|ops-bot|987654321"
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
## Orchestration Skill
|
|
306
|
-
|
|
307
|
-
<details>
|
|
308
|
-
<summary>Example orchestration skill (click to expand)</summary>
|
|
309
|
-
|
|
310
|
-
The plugin is a **transparent transport layer** — business logic lives in **OpenClaw skills**:
|
|
311
|
-
|
|
312
|
-
```markdown
|
|
313
|
-
---
|
|
314
|
-
name: Coding Agent Orchestrator
|
|
315
|
-
description: Orchestrates coding agent sessions with auto-response rules.
|
|
316
|
-
metadata: {"openclaw": {"requires": {"plugins": ["openclaw-code-agent"]}}}
|
|
317
|
-
---
|
|
318
|
-
|
|
319
|
-
# Coding Agent Orchestrator
|
|
320
|
-
|
|
321
|
-
## Anti-cascade rule
|
|
322
|
-
When woken by a waiting-for-input or completion event, ONLY use agent_respond
|
|
323
|
-
or agent_output for the referenced session. NEVER launch new sessions from wake events.
|
|
324
|
-
|
|
325
|
-
## Auto-response rules
|
|
326
|
-
|
|
327
|
-
When a coding agent session asks a question, analyze and decide:
|
|
328
|
-
|
|
329
|
-
### Auto-respond (use `agent_respond` immediately):
|
|
330
|
-
- Permission requests for file reads, writes, or bash commands -> "Yes, proceed."
|
|
331
|
-
- Confirmations like "Should I continue?" -> "Yes, continue."
|
|
332
|
-
|
|
333
|
-
### Forward to user (everything else):
|
|
334
|
-
- Architecture decisions, destructive operations, ambiguous requirements,
|
|
335
|
-
scope changes, credential/production questions
|
|
336
|
-
- Quote the agent's exact question. No commentary.
|
|
337
|
-
|
|
338
|
-
## Workflow
|
|
339
|
-
1. User sends a coding task -> `agent_launch(prompt, ...)`
|
|
340
|
-
2. Session runs in background. Monitor via wake events.
|
|
341
|
-
3. On wake event -> `agent_output` to read the question, then auto-respond or forward.
|
|
342
|
-
4. On completion -> summarize briefly: files changed, cost, duration, issues.
|
|
105
|
+
/agent_respond fix-auth Add unit tests too
|
|
106
|
+
agent_launch(prompt="<new task>", resume_session_id="fix-auth", fork_session=true)
|
|
343
107
|
```
|
|
344
108
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
</details>
|
|
348
|
-
|
|
349
|
-
---
|
|
350
|
-
|
|
351
|
-
## Architecture
|
|
109
|
+
For multi-workspace or multi-bot setups, configure `agentChannels`. The full routing rules, config matrix, and notification behavior live in [docs/REFERENCE.md](docs/REFERENCE.md).
|
|
352
110
|
|
|
353
|
-
|
|
111
|
+
Prefer fully routable channel strings such as `telegram|123456789` or `telegram|my-bot|123456789`. A bare provider like `telegram` is only a weak fallback; the plugin now repairs topic routing from `originSessionKey` when possible, but explicit channels are still the safer default.
|
|
354
112
|
|
|
355
|
-
|
|
356
|
-
|----------|-------------|
|
|
357
|
-
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | System design, component breakdown, and data flow |
|
|
358
|
-
| [docs/NOTIFICATIONS.md](docs/NOTIFICATIONS.md) | Notification architecture, delivery model, and wake mechanism |
|
|
359
|
-
| [docs/AGENT_CHANNELS.md](docs/AGENT_CHANNELS.md) | Multi-agent setup, notification routing, and workspace mapping |
|
|
360
|
-
| [docs/TOOLS.md](docs/TOOLS.md) | Detailed tool reference with parameters and examples |
|
|
361
|
-
| [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) | Development guide, project structure, and build instructions |
|
|
113
|
+
### Upgrade Note For 3.1.0
|
|
362
114
|
|
|
363
|
-
|
|
115
|
+
`3.1.0` is a maintenance release focused on reliability, explicit session state, and release-tooling hardening.
|
|
364
116
|
|
|
365
|
-
|
|
117
|
+
- Upgrading archives old or invalid persisted session stores to a timestamped `.legacy-*.json` backup and starts with a fresh index.
|
|
118
|
+
- Legacy Codex SDK session entries are archived and not loaded by the App Server backend.
|
|
119
|
+
- App Server-backed Codex sessions are now the only supported Codex runtime path.
|
|
120
|
+
- Contributors and release automation should use `pnpm verify` as the canonical validation gate.
|
|
366
121
|
|
|
367
|
-
|
|
122
|
+
### Backend Capabilities
|
|
368
123
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
# Build (esbuild → dist/index.js)
|
|
374
|
-
pnpm run build
|
|
124
|
+
- Claude Code stays on plugin-managed worktrees.
|
|
125
|
+
- Codex now runs through App Server structured events and may execute inside a native backend-managed worktree.
|
|
126
|
+
- Merge, PR, reminder, and decision policy remain plugin-owned above both backends.
|
|
127
|
+
- Operators should continue sessions by plugin session ID or name. Backend conversation IDs are accepted only for recovery and diagnostics.
|
|
375
128
|
|
|
376
|
-
|
|
377
|
-
pnpm run typecheck
|
|
378
|
-
|
|
379
|
-
# Run tests
|
|
380
|
-
pnpm test
|
|
381
|
-
```
|
|
129
|
+
## Tool Surface
|
|
382
130
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
│ ├── types.ts # TypeScript interfaces
|
|
396
|
-
│ ├── config.ts # Config singleton + channel resolution
|
|
397
|
-
│ ├── format.ts # Formatting utilities
|
|
398
|
-
│ ├── singletons.ts # Module-level singleton refs
|
|
399
|
-
│ ├── session.ts # Session class (state machine, timers, harness)
|
|
400
|
-
│ ├── session-manager.ts # Session pool management + lifecycle
|
|
401
|
-
│ ├── session-store.ts # Persisted session/index storage abstraction
|
|
402
|
-
│ ├── session-metrics.ts # Metrics recorder abstraction
|
|
403
|
-
│ ├── wake-dispatcher.ts # Wake delivery + retry abstraction
|
|
404
|
-
│ ├── notifications.ts # Notification service
|
|
405
|
-
│ ├── actions/respond.ts # Shared respond logic (tool + command)
|
|
406
|
-
│ ├── application/ # Shared app-layer logic used by tools + commands
|
|
407
|
-
│ ├── tools/ # Tool implementations (6 tools)
|
|
408
|
-
│ └── commands/ # Chat command implementations (7 commands)
|
|
409
|
-
├── tests/ # Unit tests (node:test + tsx)
|
|
410
|
-
├── skills/ # Orchestration skill definitions
|
|
411
|
-
└── docs/ # Architecture & reference docs
|
|
412
|
-
```
|
|
131
|
+
| Tool | Purpose |
|
|
132
|
+
| --- | --- |
|
|
133
|
+
| `agent_launch` | Start a background coding session |
|
|
134
|
+
| `agent_respond` | Reply, redirect, approve a plan, or escalate permissions |
|
|
135
|
+
| `agent_output` | Read buffered session output |
|
|
136
|
+
| `agent_sessions` | List active and recent sessions |
|
|
137
|
+
| `agent_kill` | Stop or mark a session completed |
|
|
138
|
+
| `agent_stats` | Show aggregate usage and cost |
|
|
139
|
+
| `agent_merge` | Merge a worktree branch back to base |
|
|
140
|
+
| `agent_pr` | Create or update a GitHub PR |
|
|
141
|
+
| `agent_worktree_status` | Show branch, PR, and pending-decision state |
|
|
142
|
+
| `agent_worktree_cleanup` | Clean up merged agent branches or dismiss a pending worktree decision |
|
|
413
143
|
|
|
414
|
-
|
|
144
|
+
The chat command surface mirrors the common workflows: `/agent`, `/agent_sessions`, `/agent_output`, `/agent_respond`, `/agent_kill`, and `/agent_stats`.
|
|
415
145
|
|
|
416
|
-
##
|
|
146
|
+
## Docs
|
|
417
147
|
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
1. Fork the repository
|
|
428
|
-
2. Create a feature branch
|
|
429
|
-
3. Make your changes with tests
|
|
430
|
-
4. Submit a pull request
|
|
431
|
-
|
|
432
|
-
---
|
|
148
|
+
| Doc | What It Covers |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| [docs/REFERENCE.md](docs/REFERENCE.md) | Install, config, tools, commands, notifications, routing, worktrees, troubleshooting |
|
|
151
|
+
| [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Session manager, harness model, notification pipeline, persistence, worktree internals |
|
|
152
|
+
| [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) | Local setup, repo layout, build/test flow, extension points |
|
|
153
|
+
| [docs/ACP-COMPARISON.md](docs/ACP-COMPARISON.md) | Current comparison with OpenClaw core ACP |
|
|
154
|
+
| [skills/code-agent-orchestration/SKILL.md](skills/code-agent-orchestration/SKILL.md) | Operational skill for orchestrating sessions from an agent |
|
|
155
|
+
| [CHANGELOG.md](CHANGELOG.md) | Release history |
|
|
433
156
|
|
|
434
157
|
## License
|
|
435
158
|
|
|
436
|
-
MIT
|
|
437
|
-
|
|
438
|
-
Originally based on [alizarion/openclaw-claude-code-plugin](https://github.com/alizarion/openclaw-claude-code-plugin). Renamed to `openclaw-code-agent` to be harness-agnostic.
|
|
159
|
+
MIT. See [LICENSE](LICENSE).
|