Sandboxer: 远程 Tmux 任务调度器 - Openclaw Skills

作者:互联网

2026-03-28

AI教程

什么是 Sandboxer?

Sandboxer 是一款高性能的权力用户工具,专为需要弥补自动化脚本与交互式终端环境之间差距的开发人员而构建。通过在 8081 端口运行本地 API,它允许以编程方式创建和管理专门为 Claude Code、Gemini 和 OpenCode 等 AI 工具量身定制的 tmux 会话。该工具是在 Openclaw Skills 生态系统中构建稳健环境的基石,使智能体能够在专用的根级 AI 机器中以完整的终端访问权限运行。

该技能专注于管理位于 /root/workspaces/ 的集中式工作空间结构,该结构作为一个受 git 跟踪的中心,用于存储智能体身份、记忆和项目存储库。通过使用 Sandboxer,开发人员可以确保其 AI 智能体拥有一个一致的环境来执行命令、坚控进度,并在各种编码任务和系统操作中持久化长期记忆。

下载入口:https://github.com/openclaw/skills/tree/main/skills/chriopter/sandboxer-tmux

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install sandboxer-tmux

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 sandboxer-tmux。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Sandboxer 应用场景

  • 在特定项目存储库中生成隔离的 AI 编码会话,以修复错误或实现功能。
  • 自动化长时间运行的终端任务,并通过 REST API 坚控其输出。
  • 编排多智能体工作流,使不同的 Openclaw Skills 与共享的工作空间文件进行交互。
  • 维护智能体规则、记忆和定时任务 (cronjob) 配置的版本控制历史。
  • 向活动的 tmux 会话发送实时击键或复杂的命令序列,无需手动连接终端。
Sandboxer 工作原理
  1. 使用创建端点初始化一个新的 tmux 会话,指定智能体类型和目标目录。
  2. 使用击键注入或转发命令向会话发送特定指令或任务。
  3. 轮询会话坚控或捕获端点以获取实时终端输出和状态更新。
  4. 利用工作空间文件 API 动态读取或更新 CLAUDE.md 或 AGENTS.md 等配置文件。
  5. 触发自动提交功能,将所有工作空间更改(包括记忆日志和任务列表)同步到主 git 存储库。
  6. 一旦验证分发的任务已完成,通过销毁端点安全地终止会话。

Sandboxer 配置指南

要为您的 Openclaw Skills 部署 Sandboxer,请确保您在安装了 tmux 的专用 Linux 环境中运行。Sandboxer localhost:8081,本地请求不需要身份验证。

# 安装并在 8081 端口启动 Sandboxer 服务
# 确保 /root/workspaces 存在并已初始化为 git 仓库

# 示例:为 Claude Code 创建会话
curl "localhost:8081/api/create?type=claude&dir=/root/workspaces/my-agent/data/repos/my-project"

Sandboxer 数据架构与分类体系

Sandboxer 执行严格的组织层级结构,以保持多个 Openclaw Skills 和项目之间的清晰度。元数据和智能体逻辑在顶级 git 仓库中跟踪,而源代码则驻留在嵌套的存储库中。

组件 路径 描述
工作空间根目录 /root/workspaces/ 跟踪 .md 文件和定时任务的主 git 仓库。
智能体文件夹 // 包含 SOUL.md、MEMORY.md 和智能体特定规则。
仓库存储 data/repos/ 包含单个项目 git 克隆的目录。
编码规则 CLAUDE.md 该目录下编码智能体的特定指令。
记忆日志 memory/YYYY-MM-DD.md 用于长期智能体上下文持久化的每日日志。
name: sandboxer
version: 1.0.0
description: Dispatch coding tasks to tmux sessions via Sandboxer. Use when you need to spawn Claude Code, Gemini, OpenCode, bash, or lazygit sessions in workspace repos, monitor their progress, or send them commands.

Sandboxer — Dispatch Tasks to Tmux Sessions

Power-user skill. Sandboxer gives agents full access to tmux sessions, workspace files, and terminal output on your server. Intended for dedicated AI machines where agents run with root access. Not for shared or untrusted environments.

Sandboxer runs on localhost:8081. No auth needed from localhost.

Quick: Dispatch a Task

# 1. Spawn a Claude session in a repo
curl "localhost:8081/api/create?type=claude&dir=/root/workspaces/AGENT/data/repos/PROJECT"

# 2. Send it a task
curl "localhost:8081/api/send?session=SESSION_NAME&text=Fix+the+failing+tests"

# 3. Check progress
curl "localhost:8081/api/session-monitor?session=SESSION_NAME"

# 4. Kill when done
curl "localhost:8081/api/kill?session=SESSION_NAME"

Session types: claude, bash, lazygit, gemini, opencode

Workspace Structure

Sandboxer manages /root/workspaces/ — a single git repo containing all agent workspaces.

/root/workspaces/                          ← git repo (Sandboxer commits this)
├── .gitignore                             ← tracks only .md, .gitignore, cronjobs/
├── /                          ← one folder per OpenClaw agent
│   ├── AGENTS.md                          ← agent behavior rules
│   ├── SOUL.md, USER.md, TOOLS.md         ← agent identity & config
│   ├── MEMORY.md                          ← curated long-term memory
│   ├── TODO.md                            ← workspace task list (P1/P2/P3)
│   ├── CLAUDE.md                          ← coding rules for this workspace
│   ├── memory/YYYY-MM-DD.md               ← daily memory logs
│   ├── cronjobs/                          ← cron configs (tracked by git)
│   └── data/
│       └── repos/                         ← software projects (git clones)
│           ├── /               ← separate git repo
│           │   ├── CLAUDE.md              ← project-specific coding rules
│           │   └── ...source code...
│           └── /

Key rules:

  • data/repos/ contains separate git repos — each project has its own .git, branches, remotes
  • The workspace .gitignore excludes data/ — repo contents stay in their own git, not the workspace commit
  • The workspace git only tracks: .md files, .gitignore, and cronjobs/
  • Always read CLAUDE.md / AGENTS.md in both workspace AND repo before dispatching work to a session

API Reference

Endpoint What
GET /api/sessions List all sessions (status: running/idle/done/error)
GET /api/create?type=T&dir=D Spawn session
GET /api/session-monitor?session=S Last 20 lines + status + duration
GET /api/capture?session=S Full terminal output
GET /api/send?session=S&text=T Send keystrokes
GET /api/forward?session=S&task=T Ctrl+C then send task
GET /api/kill?session=S Kill session
GET /api/workspaces List workspaces (with repos)
GET /api/workspace-repos?workspace=W List repos in workspace
GET /api/repo-tree?path=P Repo file tree with git status
GET/POST /api/workspace/W/file/PATH Read/write workspace files
POST /api/auto-commit?workspace=W Commit workspace changes

POST /api/create accepts JSON body with notify_url — gets called when session finishes.