通过 OpenClaw Node 在远程机器上以非交互模式调用 Claude Code。
text
Gateway ──exec host=node──→ Node ──bash -lc──→ claude --bare ──→ AI API
场景命令模板短任务bash -lc 'cd <project> && claude --bare -p "<任务>" --max-turns 10'长任务流式bash -lc 'cd <project> && claude --bare -p "<任务>" --output-format stream-json --verbose --include-partial-messages --max-turns 30'全权限bash -lc 'cd <project> && claude --bare -p "<任务>" --dangerously-skip-permissions --output-format stream-json --verbose --include-partial-messages --max-turns 30'只读分析bash -lc 'cd <project> && claude --bare -p "<任务>" --permission-mode plan --allowedTools "Read,Glob,Grep,LSP" --max-turns 10'
AspectLocalRemote (Node)Command wrapperDirectbash -lc '...' requiredProject pathNativeUse WSL/Linux paths for speedEnv loadingShell-dependentMust be before .bashrc interactive guardExec toolStandardhost=node node=<id>
Same four levels as claude-code-local. See references/permissions.md.
LevelRemote-Specific Note1 ReadSafe—no filesystem writes2 Analyzebash -lc may need Node approval3 EditWrites may trigger Node security policy4 FullSome Nodes block certain write operations
/tmp/ firstcp f f.bak.$(date +%F)json
{
"command": "bash -lc 'cd <project> && claude --bare -p \"<task>\" --max-turns 10'",
"host": "node",
"node": "<your-node-id>",
"background": true,
"timeout": 600
}
For projects on slow cross-filesystem mounts (e.g., WSL /mnt/c/):
bash
git worktree add -b work-branch /home/user/project-worktree main
Shares git data, keeps working files on fast native filesystem.
Ensure API credentials load in non-interactive shells:
bash
# In ~/.bashrc, BEFORE the interactive guard:
export ANTHROPIC_API_KEY=sk-...
# Interactive guard (keep as-is):
case $- in
*i*) ;;
*) return;;
esac
Same as claude-code-local. See its SKILL.md for timing table and checklist.
references/permissions.md — Detailed permission mode behaviorreferences/troubleshooting.md — Remote-specific failure modes