← Back to Skills Marketplace
wangxiaofei860208-source

Lobster Fork Mode

by wangxiaofei860208-source · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
100
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install lobster-fork-mode
Description
Fork子Agent模式 — 子Agent继承父上下文。当需要子Agent了解父会话的关键上下文时自动激活。
README (SKILL.md)

Fork Mode — 子Agent上下文继承

参考 Claude Code 的 forkSubagent.tsrunForkedAgent()

问题

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共享机制,但可以通过以下方式减少重复:

  1. 子Agent使用相同模型(model: zai/glm-5.1)
  2. system prompt结构一致
  3. 避免在task中重复注入完整的SKILL.md内容

适用场景

场景 Fork模式 普通spawn
需要了解项目背景
需要知道已做决策
纯机械任务(格式化、搜索)
需要用户偏好
独立的新项目
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install lobster-fork-mode
  3. After installation, invoke the skill by name or use /lobster-fork-mode
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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.
Metadata
Slug lobster-fork-mode
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is Lobster Fork Mode?

Fork子Agent模式 — 子Agent继承父上下文。当需要子Agent了解父会话的关键上下文时自动激活。 It is an AI Agent Skill for Claude Code / OpenClaw, with 100 downloads so far.

How do I install Lobster Fork Mode?

Run "/install lobster-fork-mode" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Lobster Fork Mode free?

Yes, Lobster Fork Mode is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Lobster Fork Mode support?

Lobster Fork Mode is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Lobster Fork Mode?

It is built and maintained by wangxiaofei860208-source (@wangxiaofei860208-source); the current version is v1.0.0.

💬 Comments