Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions — Claude Code remembers previous context within the same workdir. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.). ALWAYS run synchronously and ALWAYS include the result in your reply.
Use when starting a fresh task or new topic.
OUTPUT=$(/home/xmanel/.openclaw/workspace/run-claude.sh "prompt" "/workdir")
echo "$OUTPUT"
Use when the user is following up on a previous Claude task in the same workdir. Claude Code will have full memory of what was done before — files read, edits made, context gathered.
OUTPUT=$(/home/xmanel/.openclaw/workspace/run-claude.sh --continue "prompt" "/workdir")
echo "$OUTPUT"
Use --continue when the user says things like:
Use a new session when:
Claude Code stores sessions per-directory in ~/.claude/projects/.
As long as you use the same workdir, --continue picks up exactly where it left off —
same file context, same conversation history, same edits.
# New session
OUTPUT=$(cd /workdir && env -u CLAUDECODE claude --permission-mode bypassPermissions --print "task" 2>&1)
# Continue session
OUTPUT=$(cd /workdir && env -u CLAUDECODE claude --permission-mode bypassPermissions --print --continue "task" 2>&1)
| Context | Workdir |
|---|---|
| General/scripts | /home/xmanel/.openclaw/workspace |
| Trading | /home/xmanel/.openclaw/workspace/hyperliquid |