Install
openclaw skills install code-agent-orchestrationSkill for orchestrating coding agent sessions from OpenClaw. Covers launching, monitoring, plan approval, lifecycle management, and worktree decisions.
openclaw skills install code-agent-orchestrationUse openclaw-code-agent to run Claude Code or Codex sessions as background coding jobs from chat.
channel manually. Routing comes from agentChannels, the current chat context, and fallbackChannel.agent_respond or agent_launch(..., resume_session_id=...); do not start a fresh session for the same task.name when you care about later follow-up.workdir to the target repo.permission_mode: "plan" when the user wants a real review gate before implementation.permission_mode: "bypassPermissions" only for autonomous execution.defaultWorktreeStrategy now defaults to off. Opt into a worktree strategy explicitly when you want branch isolation.plan mode, the plan belongs in normal session output. Do not ask the coding agent to write plan docs or transcript artifacts unless the user explicitly asked for a file.Example:
agent_launch(
prompt: "Fix the auth middleware bug and add tests",
name: "fix-auth",
workdir: "/home/user/projects/my-app"
)
When a session already exists for the task, keep using it.
agent_respond(session, message, approve=true) or agent_request_plan_approval(...) if delegated approval must escalate to the useragent_respond(session, message)agent_respond(session, message)agent_launch(resume_session_id=session_id, prompt="...")agent_launch is only for genuinely independent workDo not launch a new coding session from a wake event for the same task.
Use:
agent_sessions()
agent_output(session: "fix-auth", lines: 100)
agent_output(session: "fix-auth", full: true)
For worktree follow-through, inspect:
agent_worktree_status()
agent_worktree_status(session: "fix-auth")
Treat that tool's lifecycle, derived state, cleanup disposition, and retained reasons as authoritative. Do not infer cleanup safety from a transcript summary or from branch names alone.
Treat these wake fields as authoritative state when present:
requestedPermissionModeeffectivePermissionMode / currentPermissionModeapprovalExecutionStateUse those deterministic fields instead of inferring behavior from transcript fragments.
Approval/execution meanings:
approved_then_implemented: normal approved executionimplemented_without_required_approval: actual approval bypassawaiting_approval: still stopped at the approval gatenot_plan_gated: no plan gate appliedCompletion ownership:
✅ as the status signal and your follow-up as the factual outcome summary that should usually come right after it.agent_output(..., full=true), diff context, or deterministic tool state.Auto-respond immediately only for:
Forward everything else to the user:
When forwarding, quote the session's exact question. Do not add commentary.
Use permission_mode: "plan" whenever the user wants a real planning checkpoint.
planApproval: "ask"agent_respond(...).planApproval: "delegate"agent_output(session, full=true); do not rely on the truncated preview.agent_respond(..., approve=true) only when the latest actionable plan version is clearly in-bounds and low risk.approval_rationale, for example: agent_respond(session='...', message='Approved. Go ahead.', approve=true, approval_rationale='Scope matches the request and the changes are low risk.')👍 Plan approved line is only a fallback signal, not the full explanation.changes_requested, that stale state should not block approval of the latest revised plan version.agent_request_plan_approval(session='...', summary='...') exactly once so the plugin sends the single canonical user approval prompt.planApproval: "approve"Treat worktrees as temporary task sandboxes, not as generic branch inventory.
Lifecycle meanings:
pending_decision: still waiting for merge / PR / dismiss follow-throughpr_open: PR exists; preserve the sandboxmerged: normal ancestry merge landedreleased: content already landed on the base branch even though SHAs differ after rebase, squash, or cherry-pickdismissed: sandbox intentionally discardedno_change: no committed deltaIf agent_worktree_status reports released, treat that sandbox as already landed. Do not narrate it as “still unmerged” just because the branch appears ahead.
offaskagent_merge or agent_pr unless the user explicitly asks after that.released if its content already landed on base through another path. Confirm that with agent_worktree_status(...) before deciding what follow-up is still needed.delegateagent_merge is acceptable for low-risk, clearly scoped changes that match the task.agent_pr() autonomously in delegate flows. Escalate PR decisions to the user.manualagent_merge or agent_pr.agent_worktree_cleanup(mode: "preview_safe") to review what Clean all safe would remove.agent_worktree_cleanup(mode: "clean_safe") only when the user asked to clean up safe sandboxes.agent_worktree_cleanup(mode: "preview_all") when you need both safe candidates and retained reasons.agent_worktree_status / agent_worktree_cleanup; they are the lifecycle model, not advisory prose.git merge or raw PR commands in place of plugin tools.agent_worktree_cleanup(session: "...", dismiss_session: true) to dismiss permanently.agent_worktree_cleanup to force-delete unresolved worktrees. The supported bulk action is "clean all safe": omit session and let the plugin remove only lifecycle-safe worktrees while preserving anything active, pending, dirty, or PR-open.ask worktree behind the user's back.multi_turn or multi_turn_disabled; all sessions are multi-turn.channel manually unless you are debugging routing.npm i -g openclaw-code-agent