claude-code-noninteractive-in-node
简介
claude-code-noninteractive-in-node
原始描述
Call Claude Code as a non-interactive coding agent on a remote machine via OpenClaw Node. Use when: (1) Your coding agent is on a separate machine from the G...
通过你的 Agent 添加
安装目录:claude-code-remote/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: claude-code-remote
description: "Call Claude Code as a non-interactive coding agent on a remote machine via OpenClaw Node. Use when: (1) Your coding agent is on a separate machine from the Gateway, (2) You need to delegate coding tasks to a Claude Code instance connected via Node, (3) You want to use a worktree or fast local filesystem for remote projects, (4) Environment variables need login shell loading via bash -lc, (5) You're coordinating multi-agent workflows across machines."
Claude Code Remote (OpenClaw Node)
通过 OpenClaw Node 在远程机器上以非交互模式调用 Claude Code。
Gateway ──exec host=node──→ Node ──bash -lc──→ claude --bare ──→ AI API
Quick Reference
场景
命令模板
短任务
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'
Key Differences from Local
Aspect
Local
Remote (Node)
Command wrapper
Direct
bash -lc '...' required
Project path
Native
Use WSL/Linux paths for speed
Env loading
Shell-dependent
Must be before .bashrc interactive guard
Exec tool
Standard
host=node node=<id>
Permission Modes
| 场景 | 命令模板 |
|---|---|
| 短任务 | 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' |
| Aspect | Local | Remote (Node) |
|---|---|---|
| Command wrapper | Direct | bash -lc '...' required |
| Project path | Native | Use WSL/Linux paths for speed |
| Env loading | Shell-dependent | Must be before .bashrc interactive guard |
| Exec tool | Standard | host=node node=<id> |
Permission Modes
Same four levels as claude-code-local. See references/permissions.md.
| Level | Remote-Specific Note |
|---|---|
| 1 Read | Safe—no filesystem writes |
| 2 Analyze | bash -lc may need Node approval |
| 3 Edit | Writes may trigger Node security policy |
| 4 Full | Some Nodes block certain write operations |
Node Security Workarounds
- Multi-line heredocs → Write script to
/tmp/ first
- Inline Python → Same, use script file
- Write operations → Backup before modifying:
cp f f.bak.$(date +%F)
OpenClaw Exec Configuration
{
"command": "bash -lc 'cd <project> && claude --bare -p \"<task>\" --max-turns 10'",
"host": "node",
"node": "<your-node-id>",
"background": true,
"timeout": 600
}
Worktree Setup
/tmp/ firstcp f f.bak.$(date +%F){
"command": "bash -lc 'cd <project> && claude --bare -p \"<task>\" --max-turns 10'",
"host": "node",
"node": "<your-node-id>",
"background": true,
"timeout": 600
}
Worktree Setup
For projects on slow cross-filesystem mounts (e.g., WSL /mnt/c/):
git worktree add -b work-branch /home/user/project-worktree main
Shares git data, keeps working files on fast native filesystem.
Environment Setup
Ensure API credentials load in non-interactive shells:
# In ~/.bashrc, BEFORE the interactive guard:
export ANTHROPIC_API_KEY=sk-...
# Interactive guard (keep as-is):
case $- in
*i*) ;;
*) return;;
esac
Timing & Post-Task
Same as claude-code-local. See its SKILL.md for timing table and checklist.
References
references/permissions.md — Detailed permission mode behavior
references/troubleshooting.md — Remote-specific failure modes
references/permissions.md — Detailed permission mode behaviorreferences/troubleshooting.md — Remote-specific failure modes正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。