← 返回 Skills 市场
Lobster Fork Mode
作者
wangxiaofei860208-source
· GitHub ↗
· v1.0.0
· MIT-0
100
总下载
0
收藏
1
当前安装
1
版本数
在 OpenClaw 中安装
/install lobster-fork-mode
功能描述
Fork子Agent模式 — 子Agent继承父上下文。当需要子Agent了解父会话的关键上下文时自动激活。
使用说明 (SKILL.md)
Fork Mode — 子Agent上下文继承
参考 Claude Code 的 forkSubagent.ts 和 runForkedAgent()。
问题
sessions_spawn 创建的子Agent是全新会话,没有父会话的上下文。这导致子Agent缺少关键信息。
解决方案
在spawn子Agent时,手动注入父上下文。
Fork 模板
Step 1: 收集父上下文
需要注入的上下文:
1. 当前任务的目标和约束
2. 相关文件路径和关键代码片段
3. 已做出的决策和原因
4. 用户偏好(从MEMORY.md提取)
5. 项目结构概要
Step 2: 构建Fork Prompt
你是一个子Agent,从父会话 fork 出来。以下是你的继承上下文:
## 父会话上下文
{从Step 1收集的信息}
## 你的任务
{具体任务描述}
## 约束
- 工具白名单:{从Agent定义读取}
- 不要修改父会话的文件(除非明确要求)
- 完成后返回:{期望的输出格式}
Step 3: Spawn
sessions_spawn:
runtime: "subagent"
mode: "run"
task: "{Fork Prompt}"
streamTo: "parent"
上下文大小控制
| 上下文类型 | 最大长度 | 截断策略 |
|---|---|---|
| 任务目标 | 500字 | 保留核心需求 |
| 文件路径 | 10个文件 | 保留最相关的 |
| 代码片段 | 2000字 | 保留签名+关键逻辑 |
| 决策记录 | 5条 | 保留最新的 |
| 用户偏好 | 3条 | 保留最相关的 |
缓存共享(模拟Claude Code的CacheSafeParams)
OpenClaw没有prompt cache共享机制,但可以通过以下方式减少重复:
- 子Agent使用相同模型(model: zai/glm-5.1)
- system prompt结构一致
- 避免在task中重复注入完整的SKILL.md内容
适用场景
| 场景 | Fork模式 | 普通spawn |
|---|---|---|
| 需要了解项目背景 | ✅ | ❌ |
| 需要知道已做决策 | ✅ | ❌ |
| 纯机械任务(格式化、搜索) | ❌ | ✅ |
| 需要用户偏好 | ✅ | ❌ |
| 独立的新项目 | ❌ | ✅ |
安全使用建议
This skill appears internally consistent, but it explicitly recommends copying parent-session context (including MEMORY.md entries, code snippets, file paths, and decision history) into spawned subagents. Before installing or using it: 1) Review what your agent stores in MEMORY.md and other session memories — remove or redact secrets (API keys, passwords, PII) that should not be shared with child agents. 2) Ensure the agent's tool whitelist and permissions are correctly configured so forked subagents cannot access additional tools or external endpoints. 3) Limit which files and how much code are injected (follow the documented truncation rules). 4) Test in a safe environment with non-sensitive data to verify behavior. If you need stricter controls (e.g., preventing any memory sharing), do not enable this skill or modify the fork template to sanitize or omit sensitive fields.
功能分析
Type: OpenClaw Skill
Name: lobster-fork-mode
Version: 1.0.0
The 'lobster-fork-mode' skill is a utility designed to improve sub-agent performance by providing a template for context inheritance. It outlines a process for gathering session data (goals, code snippets, and user preferences) and passing it to child agents via the 'sessions_spawn' tool. The logic is entirely focused on internal agent coordination and lacks any indicators of data exfiltration, malicious execution, or unauthorized access.
能力评估
Purpose & Capability
The skill's metadata declares sessions_spawn, read, and memory_search capabilities which are precisely what a 'forked subagent inheriting parent context' feature needs. No unrelated binaries, env vars, or config paths are requested.
Instruction Scope
SKILL.md explicitly instructs collecting parent task goals, file paths, code snippets, decision history, and user preferences (from MEMORY.md) and injecting them into the child agent. That is coherent with the purpose but means the subagent will receive potentially sensitive context; the instructions themselves do not attempt to access anything beyond the declared capabilities.
Install Mechanism
Instruction-only skill with no install spec and no code files — minimal attack surface from installation.
Credentials
No environment variables, credentials, or external config are requested. The declared read and memory_search capabilities justify the data the skill asks to access.
Persistence & Privilege
always is false and the skill is user-invocable and allowed to be invoked autonomously (platform default). The skill does not request permanent system presence or modify other skills' configs.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install lobster-fork-mode - 安装完成后,直接呼叫该 Skill 的名称或使用
/lobster-fork-mode触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
lobster-fork-mode v1.0.0
- Introduces fork mode to allow subAgents to inherit essential parent session context.
- Defines a manual injection process for key parent context during subAgent spawn.
- Provides structured templates for context collection, fork prompt generation, and session spawning.
- Outlines practical context size management and truncation strategies.
- Includes guidance for cache parameter consistency and scenarios best suited for fork mode.
元数据
常见问题
Lobster Fork Mode 是什么?
Fork子Agent模式 — 子Agent继承父上下文。当需要子Agent了解父会话的关键上下文时自动激活。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 100 次。
如何安装 Lobster Fork Mode?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install lobster-fork-mode」即可一键安装,无需额外配置。
Lobster Fork Mode 是免费的吗?
是的,Lobster Fork Mode 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Lobster Fork Mode 支持哪些平台?
Lobster Fork Mode 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Lobster Fork Mode?
由 wangxiaofei860208-source(@wangxiaofei860208-source)开发并维护,当前版本 v1.0.0。
推荐 Skills