openclaw-code-agent 2.3.1 → 3.0.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 +164 -8
- package/dist/index.js +110 -53
- package/openclaw.plugin.json +16 -2
- package/package.json +21 -8
- package/skills/code-agent-orchestration/SKILL.md +151 -14
- package/workflows/plan-approval.lobster +0 -15
package/openclaw.plugin.json
CHANGED
|
@@ -140,19 +140,29 @@
|
|
|
140
140
|
},
|
|
141
141
|
"planApproval": {
|
|
142
142
|
"type": "string",
|
|
143
|
-
"default": "
|
|
143
|
+
"default": "ask",
|
|
144
144
|
"enum": [
|
|
145
145
|
"approve",
|
|
146
146
|
"ask",
|
|
147
147
|
"delegate"
|
|
148
148
|
],
|
|
149
|
-
"description": "Plan approval behavior. '
|
|
149
|
+
"description": "Plan approval behavior. 'ask' (default): orchestrator always forwards plans to the user for approval. 'delegate': orchestrator autonomously decides whether to approve low-risk plans or escalate to the user. 'approve': orchestrator can auto-approve after verification."
|
|
150
150
|
},
|
|
151
151
|
"defaultHarness": {
|
|
152
152
|
"type": "string",
|
|
153
153
|
"default": "claude-code",
|
|
154
154
|
"description": "Default agent harness when agent_launch omits the harness parameter."
|
|
155
155
|
},
|
|
156
|
+
"defaultWorktreeStrategy": {
|
|
157
|
+
"type": "string",
|
|
158
|
+
"default": "ask",
|
|
159
|
+
"enum": ["off", "manual", "ask", "delegate", "auto-merge", "auto-pr"],
|
|
160
|
+
"description": "Default worktree strategy for all new sessions when agent_launch omits worktree_strategy. 'ask' (default) = push branch and notify user with inline buttons (merge / open PR / dismiss). 'off' = no worktree. 'manual' = create worktree, no automatic action. 'delegate' = push branch and wake orchestrator to autonomously decide (merge, PR, or escalate). 'auto-merge' = auto-merge to base branch on completion. 'auto-pr' = auto-create/update GitHub PR on completion."
|
|
161
|
+
},
|
|
162
|
+
"worktreeDir": {
|
|
163
|
+
"type": "string",
|
|
164
|
+
"description": "Base directory for agent worktrees. Defaults to <repoRoot>/.worktrees when unset. Overridden by OPENCLAW_WORKTREE_DIR env var."
|
|
165
|
+
},
|
|
156
166
|
"allowedModels": {
|
|
157
167
|
"type": "array",
|
|
158
168
|
"items": {
|
|
@@ -212,6 +222,10 @@
|
|
|
212
222
|
"planApproval": {
|
|
213
223
|
"label": "Plan approval policy",
|
|
214
224
|
"help": "Choose whether plans are auto-approved, always escalated, or delegated to the orchestrator."
|
|
225
|
+
},
|
|
226
|
+
"defaultWorktreeStrategy": {
|
|
227
|
+
"label": "Default worktree strategy",
|
|
228
|
+
"help": "Applies to all sessions that don't specify worktree_strategy explicitly. 'ask' (default) creates worktrees and prompts user with inline buttons on completion. 'off' disables worktrees globally. 'delegate' wakes the orchestrator to decide autonomously. 'auto-merge' and 'auto-pr' are fully automated."
|
|
215
229
|
}
|
|
216
230
|
},
|
|
217
231
|
"skills": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-code-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,16 +22,16 @@
|
|
|
22
22
|
"LICENSE"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@anthropic-ai/claude-agent-sdk": "^0.2.
|
|
26
|
-
"@openai/codex-sdk": "^0.
|
|
25
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.81",
|
|
26
|
+
"@openai/codex-sdk": "^0.116.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@sinclair/typebox": "^0.34.48",
|
|
30
|
-
"@types/node": "^25.
|
|
31
|
-
"esbuild": "^0.27.
|
|
32
|
-
"nanoid": "^
|
|
30
|
+
"@types/node": "^25.5.0",
|
|
31
|
+
"esbuild": "^0.27.4",
|
|
32
|
+
"nanoid": "^5.1.7",
|
|
33
33
|
"tsx": "^4.21.0",
|
|
34
|
-
"typescript": "^
|
|
34
|
+
"typescript": "^6.0.2"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"openclaw",
|
|
@@ -62,5 +62,18 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"description": "An OpenClaw plugin that orchestrates coding agent sessions as managed background processes. Launch, monitor, and control coding agents (Claude Code, Codex, and more) directly from your AI gateway."
|
|
65
|
+
"description": "An OpenClaw plugin that orchestrates coding agent sessions as managed background processes. Launch, monitor, and control coding agents (Claude Code, Codex, and more) directly from your AI gateway.",
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"openclaw": ">=2026.3.22"
|
|
68
|
+
},
|
|
69
|
+
"pnpm": {
|
|
70
|
+
"onlyBuiltDependencies": [
|
|
71
|
+
"esbuild",
|
|
72
|
+
"koffi",
|
|
73
|
+
"protobufjs",
|
|
74
|
+
"sharp",
|
|
75
|
+
"@img/sharp-linux-x64",
|
|
76
|
+
"@img/sharp-linux-arm64"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
66
79
|
}
|
|
@@ -161,7 +161,7 @@ agent_sessions(status: "completed")
|
|
|
161
161
|
# Summary (last 50 lines)
|
|
162
162
|
agent_output(session: "fix-null-auth")
|
|
163
163
|
|
|
164
|
-
# Full output (up to
|
|
164
|
+
# Full output (up to 2000 lines)
|
|
165
165
|
agent_output(session: "fix-null-auth", full: true)
|
|
166
166
|
|
|
167
167
|
# Specific last N lines
|
|
@@ -284,13 +284,48 @@ Notifications are routed to the Telegram thread/topic where the session was laun
|
|
|
284
284
|
| Event | What happens |
|
|
285
285
|
|---|---|
|
|
286
286
|
| Session starts | Silent (command response confirms launch) |
|
|
287
|
-
| Session completed |
|
|
288
|
-
| Session
|
|
289
|
-
|
|
|
290
|
-
|
|
|
287
|
+
| Session completed | `✅ Completed` — brief one-liner to originating thread |
|
|
288
|
+
| Session completed (deliverable mode) | `📄 Deliverable ready` — when launched with `output_mode: "deliverable"` |
|
|
289
|
+
| Session failed | `❌ Failed` — error notification with `harnessSessionId` and resume guidance |
|
|
290
|
+
| Waiting for input | `❓ Waiting for input` — wake event (only when the agent actually asks a question) |
|
|
291
|
+
| Turn completes without a question | `⏸️ Paused after turn \| Auto-resumable` |
|
|
292
|
+
| `agent_respond` send | `↪️` — notification sent for every `agent_respond` call |
|
|
293
|
+
| `agent_respond` plan approval | `👍` — notification sent when `approve: true` |
|
|
291
294
|
| Session auto-resumes | `▶️ Auto-resumed` |
|
|
292
295
|
| Session idle-times out | `💤 Idle timeout` |
|
|
293
296
|
| Session is forcibly stopped | `⛔ Stopped ...` with the specific stop reason |
|
|
297
|
+
| Worktree decision pending (`ask`) | Inline Telegram buttons sent to user (Merge locally / Create PR) — Alice must NOT preempt |
|
|
298
|
+
| Worktree decision pending (`delegate`) | Wake sent to Alice with diff context — Alice must decide and call `agent_merge` or `agent_pr` |
|
|
299
|
+
|
|
300
|
+
### Sending completion summaries — use `message send`, not inline reply
|
|
301
|
+
|
|
302
|
+
When you process a CC session completion wake and want to notify the user with a summary, **always send the summary via the `message` tool** rather than as an inline session reply:
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Correct — standalone message, guaranteed notification ping
|
|
306
|
+
openclaw message send --channel telegram --target <chatId> --thread-id <topicId> \
|
|
307
|
+
--message "✅ [session-name] Done — <one-line summary>"
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**Why this matters**: Alice's inline session replies are sent as Telegram *replies* (`reply_to_message_id`) to the message that triggered the wake. Because the plugin's ⏸️ status notification typically arrives just before the wake fires, Alice's reply targets that bot message — and Telegram does not re-ping the user when a bot replies to a recent bot message in an already-active topic thread. The `message` tool sends a standalone new message (`message_thread_id` only, no `reply_to_message_id`), which always generates a fresh notification ping.
|
|
311
|
+
|
|
312
|
+
**Rule**: Inline replies are fine for conversational back-and-forth. For any user-facing "session done" notification that must reliably reach the user, use `message send` explicitly.
|
|
313
|
+
|
|
314
|
+
The Telegram chat ID and topic thread ID are available from the current conversation context.
|
|
315
|
+
|
|
316
|
+
### Worktree `ask` strategy — no duplicate summary
|
|
317
|
+
|
|
318
|
+
When a session completes with `worktree_strategy: "ask"`, the plugin sends the user a single consolidated Telegram message that contains:
|
|
319
|
+
- The full commit list and diff stats
|
|
320
|
+
- The ⬇️ Merge locally / 🔀 Create PR inline buttons
|
|
321
|
+
|
|
322
|
+
**Do NOT send a separate completion summary.** The button message IS the completion signal. Sending an additional "✅ Done!" or "Here's what was done:" message creates duplicates and confuses the user.
|
|
323
|
+
|
|
324
|
+
This applies when the wake message says "Worktree strategy buttons delivered to user." — treat that as confirmation that the user is already fully informed. Take no further action until the user clicks a button.
|
|
325
|
+
|
|
326
|
+
**Buttons are handled automatically by the plugin.** When the user taps a button, the plugin's callback router dispatches the action (`agent_merge` or `agent_pr`) directly — no agent `agent_merge`/`agent_pr` call is needed in response to a button tap. If the action succeeds, the plugin sends a result notification. If the action fails, a failure notification is sent. Alice does not need to poll or intervene.
|
|
327
|
+
|
|
328
|
+
---
|
|
294
329
|
|
|
295
330
|
### Plan → Execute mode switch
|
|
296
331
|
|
|
@@ -300,13 +335,13 @@ Sessions start in `plan` mode by default. When you reply with **only** an approv
|
|
|
300
335
|
|
|
301
336
|
The `approve` parameter on `agent_respond` escalates session permissions to `bypassPermissions`. It works in two scenarios:
|
|
302
337
|
|
|
303
|
-
1. **Plan mode approval**: When a session has a pending plan approval (after `ExitPlanMode` / `set_permission_mode`), `approve: true` approves the plan and switches to `bypassPermissions`.
|
|
304
|
-
2. **`
|
|
338
|
+
1. **Plan mode approval**: When a session has a pending plan approval (after `ExitPlanMode` / `set_permission_mode`), `approve: true` approves the plan and switches to `bypassPermissions`. Sends a 👍 notification.
|
|
339
|
+
2. **`default` mode escalation**: When a session in `default` mode keeps prompting for shell/exec command permissions, `approve: true` escalates to `bypassPermissions` to skip all remaining prompts.
|
|
305
340
|
|
|
306
341
|
If the session is already in `bypassPermissions` mode, `approve: true` is a no-op. In `plan` mode without a pending plan, it is ignored.
|
|
307
342
|
|
|
308
343
|
```
|
|
309
|
-
# Escalate
|
|
344
|
+
# Escalate a session that keeps prompting for bash permissions
|
|
310
345
|
agent_respond(session: "fix-auth", message: "proceed", approve: true)
|
|
311
346
|
```
|
|
312
347
|
|
|
@@ -314,9 +349,9 @@ agent_respond(session: "fix-auth", message: "proceed", approve: true)
|
|
|
314
349
|
|
|
315
350
|
The `planApproval` config controls how the orchestrator handles plan-approval events:
|
|
316
351
|
|
|
317
|
-
- **`
|
|
352
|
+
- **`ask`** (default): The orchestrator always forwards plans to the user. It never auto-approves on the user's behalf.
|
|
353
|
+
- **`delegate`**: The orchestrator autonomously decides whether to approve or escalate each plan to the user. Approve when the plan is low-risk, well-scoped, and matches the original task. Escalate when the plan involves destructive operations, credentials/production, architectural decisions, scope expansion, or ambiguous requirements. When in doubt, always escalate.
|
|
318
354
|
- **`approve`**: The orchestrator can auto-approve straightforward, low-risk plans. Before approving, it verifies the working directory, codebase, and scope.
|
|
319
|
-
- **`ask`**: The orchestrator always forwards plans to the user. It never auto-approves on the user's behalf.
|
|
320
355
|
|
|
321
356
|
#### Delegate mode decision criteria
|
|
322
357
|
|
|
@@ -337,7 +372,103 @@ When operating in `delegate` mode, **approve** the plan directly if ALL of the f
|
|
|
337
372
|
|
|
338
373
|
---
|
|
339
374
|
|
|
340
|
-
## 7.
|
|
375
|
+
## 7. Worktree workflow
|
|
376
|
+
|
|
377
|
+
When a session uses `worktree_strategy`, the agent runs in an isolated git branch. After completion, the branch needs to be merged or published as a PR.
|
|
378
|
+
|
|
379
|
+
### Strategies at a glance
|
|
380
|
+
|
|
381
|
+
| Strategy | What it does | When to use |
|
|
382
|
+
|---|---|---|
|
|
383
|
+
| `off` | No worktree. Session runs in main checkout | Simple/trusted tasks where isolation isn't needed |
|
|
384
|
+
| `ask` (default) | Push branch and send inline buttons (Merge locally / Create PR); wake orchestrator with full decision context | User should decide — the interactive default |
|
|
385
|
+
| `delegate` | Push branch and wake orchestrator to decide autonomously (merge, create PR, or leave for later) | Set via `defaultWorktreeStrategy` config — orchestrator decides autonomously |
|
|
386
|
+
| `auto-merge` | Automatically merge back to base branch on completion; spawns conflict-resolver if needed | Trusted tasks on a safe branch |
|
|
387
|
+
| `auto-pr` | Automatically open a GitHub PR on completion (requires `gh`) | Feature branches needing review |
|
|
388
|
+
| `manual` | Push the branch; no further action — user handles merge/PR manually | You want to review diffs before merging |
|
|
389
|
+
|
|
390
|
+
### Launch with worktree isolation
|
|
391
|
+
|
|
392
|
+
```
|
|
393
|
+
agent_launch(
|
|
394
|
+
prompt: "Implement the new user settings page",
|
|
395
|
+
name: "user-settings",
|
|
396
|
+
workdir: "/app",
|
|
397
|
+
worktree_strategy: "auto-pr"
|
|
398
|
+
)
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### Post-completion behavior by strategy
|
|
402
|
+
|
|
403
|
+
When a session with a worktree completes, your action depends on the strategy:
|
|
404
|
+
|
|
405
|
+
| Strategy | What to do after completion |
|
|
406
|
+
|---|---|
|
|
407
|
+
| `ask` | **Do nothing.** The plugin sends inline Telegram buttons (Merge locally / Create PR) to the user. **Never** call `agent_merge`, `agent_pr`, or any `git` command — wait for the user to decide. |
|
|
408
|
+
| `delegate` | You receive a `worktree-delegate` wake with diff context. Evaluate and act (see *Delegate mode* below). |
|
|
409
|
+
| `auto-merge` | No action needed — merge happens automatically. Watch for `worktree-merge-success` or `worktree-merge-conflict` notification. |
|
|
410
|
+
| `auto-pr` | No action needed — PR is created/updated automatically. |
|
|
411
|
+
| `manual` | Call `agent_merge` or `agent_pr` **only** when the user explicitly asks. |
|
|
412
|
+
| `off` | No worktree — nothing to merge. |
|
|
413
|
+
|
|
414
|
+
Note: the ⏸️ turn-complete wake is suppressed for both `ask` and `delegate` strategies — the worktree decision notification replaces it as the completion signal.
|
|
415
|
+
|
|
416
|
+
### Delegate mode: deciding merge vs PR
|
|
417
|
+
|
|
418
|
+
When you receive a `worktree-delegate` wake:
|
|
419
|
+
|
|
420
|
+
1. **Evaluate the diff** — read the commit count, files changed, and diff summary included in the wake message
|
|
421
|
+
2. **Compare to original task scope** — does the diff match what was asked?
|
|
422
|
+
3. **Decide:**
|
|
423
|
+
- **Call `agent_merge`** when: changes are low-risk, well-scoped, match the original task, and no code review is needed
|
|
424
|
+
- **Call `agent_pr`** when: changes are non-trivial, touch many files, introduce significant complexity, or when uncertain
|
|
425
|
+
- **Escalate to the user** when: changes are ambiguous, out of scope, or involve sensitive areas
|
|
426
|
+
4. **Notify the user briefly** — send a short message with your decision and one-sentence reasoning (e.g. "Merged `agent/feature-x` — straightforward 2-file change matching the original task.")
|
|
427
|
+
5. **Never use raw `git` commands** — always use `agent_merge` or `agent_pr`
|
|
428
|
+
|
|
429
|
+
### Check worktree status
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
agent_worktree_status() # all sessions with worktrees
|
|
433
|
+
agent_worktree_status(session: "user-settings") # specific session
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
### Manual merge or PR after `manual`/`ask`
|
|
437
|
+
|
|
438
|
+
```
|
|
439
|
+
# Merge back to base branch
|
|
440
|
+
agent_merge(session: "user-settings", strategy: "merge")
|
|
441
|
+
|
|
442
|
+
# Or create/update a GitHub PR
|
|
443
|
+
agent_pr(session: "user-settings", title: "Add user settings page")
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Resume with worktree context
|
|
447
|
+
|
|
448
|
+
When resuming a session that had a worktree, the worktree context (branch, strategy, PR URL) is inherited automatically — no need to pass `worktree_strategy` again:
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
agent_launch(
|
|
452
|
+
prompt: "Continue — also add unit tests",
|
|
453
|
+
resume_session_id: "user-settings"
|
|
454
|
+
)
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Deliverable mode
|
|
458
|
+
|
|
459
|
+
For document/report generation tasks, use `output_mode: "deliverable"` to send 📄 instead of ✅:
|
|
460
|
+
|
|
461
|
+
```
|
|
462
|
+
agent_launch(
|
|
463
|
+
prompt: "Write a technical spec for the new auth system",
|
|
464
|
+
name: "auth-spec",
|
|
465
|
+
output_mode: "deliverable"
|
|
466
|
+
)
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## 8. Best practices
|
|
341
472
|
|
|
342
473
|
### Launch checklist
|
|
343
474
|
|
|
@@ -367,7 +498,7 @@ When a session completes, keep summaries brief:
|
|
|
367
498
|
|
|
368
499
|
---
|
|
369
500
|
|
|
370
|
-
##
|
|
501
|
+
## 9. Anti-patterns
|
|
371
502
|
|
|
372
503
|
| Anti-pattern | Consequence | Fix |
|
|
373
504
|
|---|---|---|
|
|
@@ -377,16 +508,22 @@ When a session completes, keep summaries brief:
|
|
|
377
508
|
| Passing `channel` explicitly | Bypasses automatic routing | Let `agentChannels` handle routing automatically |
|
|
378
509
|
| Not checking the result of a completed session | User doesn't know what happened | Always read `agent_output` and summarize briefly |
|
|
379
510
|
| Launching too many sessions in parallel | `maxSessions` limit reached | Respect the limit, prioritize, sequence if necessary |
|
|
511
|
+
| Calling `agent_merge` or `agent_pr` when strategy is `ask` | Bypasses the user's inline-button decision | Wait for the Telegram buttons — do nothing until the user decides |
|
|
512
|
+
| Using raw `git merge` instead of `agent_merge` | Skips conflict resolution, cleanup, and session state tracking | Always use `agent_merge` when the user asks to merge a worktree branch |
|
|
380
513
|
|
|
381
514
|
---
|
|
382
515
|
|
|
383
|
-
##
|
|
516
|
+
## 10. Quick tool reference
|
|
384
517
|
|
|
385
518
|
| Tool | Usage | Key parameters |
|
|
386
519
|
|---|---|---|
|
|
387
|
-
| `agent_launch` | Launch a session | `prompt`, `name`, `workdir`, `multi_turn` |
|
|
520
|
+
| `agent_launch` | Launch a session | `prompt`, `name`, `workdir`, `multi_turn`, `worktree_strategy`, `output_mode` |
|
|
388
521
|
| `agent_sessions` | List sessions | `status` (all/running/completed/failed/killed) |
|
|
389
522
|
| `agent_output` | Read the output | `session`, `full`, `lines` |
|
|
390
523
|
| `agent_kill` | Kill or complete a session | `session`, `reason` (`"completed"` or omit) |
|
|
391
524
|
| `agent_respond` | Send a follow-up | `session`, `message`, `interrupt`, `approve` |
|
|
392
525
|
| `agent_stats` | Usage metrics | none |
|
|
526
|
+
| `agent_worktree_status` | Show worktree status for sessions | `session` (optional — omit for all) |
|
|
527
|
+
| `agent_merge` | Merge worktree branch to base | `session`, `base_branch`, `strategy`, `push`, `delete_branch` |
|
|
528
|
+
| `agent_pr` | Create/update GitHub PR for worktree branch | `session`, `title`, `body`, `base_branch`, `force_new` |
|
|
529
|
+
| `agent_worktree_cleanup` | Clean up merged agent/* branches | `workdir`, `base_branch`, `skip_session_check`, `dry_run`, `session` |
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
name: plan-approval
|
|
2
|
-
args:
|
|
3
|
-
session_id:
|
|
4
|
-
required: true
|
|
5
|
-
session_name:
|
|
6
|
-
required: true
|
|
7
|
-
plan_summary:
|
|
8
|
-
required: true
|
|
9
|
-
steps:
|
|
10
|
-
- id: approve
|
|
11
|
-
approval: required
|
|
12
|
-
|
|
13
|
-
- id: proceed
|
|
14
|
-
command: openclaw.invoke --tool agent_respond --args-json '{"session":"$session_id","message":"Approved. Go ahead.","approve":true}'
|
|
15
|
-
condition: $approve.approved
|