Workplace Skill
Manage multiple project workplaces with per-workspace agents, isolated memory, and Swarm-style agent orchestration.
/workplace Command (Telegram / Slash)
Hierarchical navigation with parent → child drill-down.
- -
/workplace or /workplace list → Show top-level view: parent workspaces and standalone workplaces as buttons. Parents show (N) child count. Current workspace marked with ✓. - Click a parent button → Drill into children. Shows child buttons + "Use parent" + "← Back".
/workplace <name> → If standalone or child, switch directly. If parent with children, show drill-in./workplace parent:child → Direct switch using colon syntax (e.g. log-stream:logstream)./workplace status → Current workspace card with parent, linked, agents, deploy envs./workplace agents → Agent list with start/stop buttons.
Colon Syntax
INLINECODE8 resolves parent by name, then finds child under that parent. Supports quick switching without navigating menus.
Context Switching
When the user switches workplaces (via button click, name, or colon syntax):
- 1. Update
~/.openclaw/workspace/.workplaces/current.json with the selected UUID and path - Update
lastActive in INLINECODE11 - Load the new workspace's
.workplace/config.json for context - Send confirmation: name, path, parent (if any), linked workplaces, agent list
- Subsequent messages in the session should be aware of the active workspace context
Read current.json at the start of any workplace operation to know which workspace is active.
See telegram-ui.md for full button layouts, callback routing, and platform fallbacks.
Quick Reference
| Command | Action |
|---|
| INLINECODE14 | Initialize workplace (scan existing or set up new) |
| INLINECODE15 |
List all workplaces (inline buttons to switch) |
|
workplace switch <name\|uuid> | Switch active workplace |
|
workplace scan [path] | Discover .git workplaces in subdirectories |
|
workplace link <path> | Link a related workplace |
|
workplace unlink <path\|uuid> | Remove a linked workplace |
|
workplace status | Current workplace info + agent status |
|
workplace agents | List agents in current workplace |
|
workplace agent start <name> | Start an agent (runs as sub-agent) |
|
workplace agent stop <name> | Stop a running agent |
|
workplace kernel start | Start persistent kernel agent |
|
workplace kernel stop | Stop kernel agent |
|
workplace export [zip\|json] | Export workplace config |
|
workplace import <file> | Import workplace from export |
|
workplace delete <name\|uuid> | Remove from registry |
|
workplace deploy <env> | Show/run deploy instructions |
|
workplace sync <ide> | Generate context for cursor/claude/opencode/all |
Architecture
Registry
Central registry at ~/.openclaw/workspace/.workplaces/:
- -
registry.json — all known workplaces with UUID, path, hostname, links - INLINECODE33 — currently active workplace
Per-Workplace Structure
Each project gets a .workplace/ directory:
CODEBLOCK0
Workplace Detection
- - Any directory with
.git/ is a potential workplace - Submodules included as nested workplaces
- Parent workplace auto-detected from parent directories
- Manual linking via INLINECODE36
Workflows
Initialize a Workplace
- 1. Run INLINECODE37
- For existing projects: scan file structure, read
*.md files, analyze project type, suggest agents - For empty folders: ask project name, description, language/framework, roles needed
- Creates
.workplace/ structure, registers in central registry, sets as current - See init-guide.md for full flow details
Agent System
Agents are defined as .md files in .workplace/agents/ with YAML frontmatter (name, role, triggers, handoff_to). Run agents via sessions_spawn with system prompts built from their definitions + workplace context.
- - See agent-system.md for agent creation, Swarm handoff, and runtime details
Inter-Agent Communication
Agents communicate via chat.md using a structured message protocol. The Rust file-watcher server monitors changes and outputs parsed messages as JSON lines.
Rust File-Watcher Server
Binary at assets/bin/workplace-server-{os}-{arch}. Build from source with scripts/build.sh.
CODEBLOCK1
Export/Import
- - ZIP: Full
.workplace/ folder (memory excluded by default) - JSON: Config + agent definitions + deploy docs as portable manifest
- Import generates a new UUID to avoid collisions
Chat UI (Telegram / Discord)
On platforms with inline buttons, workplace list shows a clickable switcher. workplace agents shows start/stop buttons per agent. workplace deploy shows environment buttons.
See telegram-ui.md for message formats, button components, and callback handling.
Fallback: numbered text lists on platforms without button support (WhatsApp, Signal).
IDE Integration
Sync workplace context to external coding tools:
- - Cursor →
.cursor/rules/workplace.mdc (MDC with frontmatter) - Claude Code →
CLAUDE.md (markdown, marker-based updates) - OpenCode →
opencode.jsonc instructions field
Run workplace sync all to update all detected IDEs, or target one: workplace sync cursor.
See ide-sync.md for implementation details.
Scripts
| Script | Purpose |
|---|
| INLINECODE55 | Initialize .workplace/ in a directory |
| INLINECODE56 |
Find .git workplaces under a path |
|
scripts/build.sh | Build Rust server for current platform |
Supermemory Integration
Each workplace uses its UUID as containerTag for supermemory operations:
- - Kernel agent saves structure summaries and project facts
- All workplace memories are isolated by containerTag
- Enables cross-session project state awareness
Command Details
See commands.md for full command reference with examples.
工作区技能
使用每个工作区独立的代理、隔离的内存和Swarm风格的代理编排来管理多个项目工作区。
/workplace 命令(Telegram / 斜杠命令)
支持父级→子级下钻的层级导航。
- - /workplace 或 /workplace list → 显示顶层视图:父工作区和独立工作区以按钮形式展示。父级显示(N)子级数量。当前工作区标记为✓。
- 点击父级按钮 → 下钻到子级。显示子级按钮 + 使用父级 + ← 返回。
- /workplace <名称> → 如果是独立或子工作区,直接切换。如果是带子级的父工作区,显示下钻界面。
- /workplace 父级:子级 → 使用冒号语法直接切换(例如 log-stream:logstream)。
- /workplace status → 显示当前工作区卡片,包含父级、关联、代理、部署环境。
- /workplace agents → 显示代理列表及启动/停止按钮。
冒号语法
/workplace log-stream:logstream 按名称解析父级,然后在父级下查找子级。支持无需导航菜单的快速切换。
上下文切换
当用户切换工作区时(通过按钮点击、名称或冒号语法):
- 1. 使用选定的UUID和路径更新 ~/.openclaw/workspace/.workplaces/current.json
- 更新 registry.json 中的 lastActive
- 加载新工作区的 .workplace/config.json 获取上下文
- 发送确认信息:名称、路径、父级(如有)、关联工作区、代理列表
- 会话中的后续消息应感知活动工作区上下文
在任何工作区操作开始时读取 current.json,以了解当前活动的工作区。
完整的按钮布局、回调路由和平台回退方案请参见 telegram-ui.md。
快速参考
| 命令 | 操作 |
|---|
| workplace init [路径] | 初始化工作区(扫描现有或新建) |
| workplace list |
列出所有工作区(内联按钮切换) |
| workplace switch <名称\|UUID> | 切换活动工作区 |
| workplace scan [路径] | 在子目录中发现.git工作区 |
| workplace link <路径> | 关联相关工作区 |
| workplace unlink <路径\|UUID> | 移除关联的工作区 |
| workplace status | 当前工作区信息 + 代理状态 |
| workplace agents | 列出当前工作区中的代理 |
| workplace agent start <名称> | 启动代理(作为子代理运行) |
| workplace agent stop <名称> | 停止运行中的代理 |
| workplace kernel start | 启动持久化内核代理 |
| workplace kernel stop | 停止内核代理 |
| workplace export [zip\|json] | 导出工作区配置 |
| workplace import <文件> | 从导出文件导入工作区 |
| workplace delete <名称\|UUID> | 从注册表中移除 |
| workplace deploy <环境> | 显示/运行部署指令 |
| workplace sync
| 为cursor/claude/opencode/all生成上下文 |
架构
注册表
中央注册表位于 ~/.openclaw/workspace/.workplaces/:
- - registry.json — 所有已知工作区,包含UUID、路径、主机名、关联信息
- current.json — 当前活动工作区
每个工作区的结构
每个项目都有一个 .workplace/ 目录:
.workplace/
├── config.json # UUID、名称、路径、主机名、关联、父级
├── agents/*.md # 代理角色定义(始终包含kernel.md)
├── memory/ # 隔离的每日日志(YYYY-MM-DD.md)
├── skills/ # 工作区特定技能(用户通过git管理)
├── chat.md # 代理间通信
├── structure.json # 自动扫描的文件树
├── full-tree.md # 包含父级和关联工作区的完整树(按主机名)
├── process-status.json # 代理运行时状态和错误
└── deploy/ # 部署文档:dev.md、main.md、pre.md
工作区检测
- - 任何包含 .git/ 的目录都是潜在的工作区
- 子模块作为嵌套工作区包含
- 父工作区从父目录自动检测
- 通过 workplace link 手动关联
工作流程
初始化工作区
- 1. 运行 scripts/initworkplace.sh <路径> [--name <名称>] [--desc <描述>]
- 对于现有项目:扫描文件结构、读取 *.md 文件、分析项目类型、建议代理
- 对于空文件夹:询问项目名称、描述、语言/框架、所需角色
- 创建 .workplace/ 结构,在中央注册表中注册,设置为当前工作区
- 完整流程详情请参见 init-guide.md
代理系统
代理定义为 .workplace/agents/ 中的 .md 文件,带有YAML前置元数据(名称、角色、触发器、交接目标)。通过 sessions_spawn 运行代理,系统提示由其定义和工作区上下文构建。
代理间通信
代理通过 chat.md 使用结构化消息协议进行通信。Rust文件监视服务器监控更改,并将解析后的消息以JSON行格式输出。
Rust文件监视服务器
二进制文件位于 assets/bin/workplace-server-{os}-{arch}。使用 scripts/build.sh 从源码构建。
bash
为工作区启动服务器
workplace-server /path/to/project
服务器为每条新的chat.md消息输出JSON行到stdout
{timestamp:...,sender:coder,recipient:reviewer,broadcast:[],message:...,line_number:1}
导出/导入
- - ZIP:完整的 .workplace/ 文件夹(默认排除内存)
- JSON:配置 + 代理定义 + 部署文档作为可移植清单
- 导入生成新的UUID以避免冲突
聊天界面(Telegram / Discord)
在支持内联按钮的平台上,workplace list 显示可点击的切换器。workplace agents 为每个代理显示启动/停止按钮。workplace deploy 显示环境按钮。
消息格式、按钮组件和回调处理请参见 telegram-ui.md。
回退方案:在不支持按钮的平台上(WhatsApp、Signal)显示编号文本列表。
IDE集成
将工作区上下文同步到外部编码工具:
- - Cursor → .cursor/rules/workplace.mdc(带前置元数据的MDC)
- Claude Code → CLAUDE.md(markdown,基于标记的更新)
- OpenCode → opencode.jsonc 指令字段
运行 workplace sync all 更新所有检测到的IDE,或指定目标:workplace sync cursor。
实现细节请参见 ide-sync.md。
脚本
| 脚本 | 用途 |
|---|
| scripts/initworkplace.sh | 在目录中初始化.workplace/ |
| scripts/scanworkplaces.sh |
在路径下查找.git工作区 |
| scripts/build.sh | 为当前平台构建Rust服务器 |
Supermemory集成
每个工作区使用其UUID作为 containerTag 进行supermemory操作:
- - 内核代理保存结构摘要和项目事实
- 所有工作区内存按containerTag隔离
- 实现跨会话的项目状态感知
命令详情
完整命令参考及示例请参见 commands.md。