session-source-fork
它能做什么
这项技能讲解如何利用分叉,从早前的 Claude 或 Codex 对话开始一个新的智能体席位。适合希望新智能体从之前会话的历史出发的团队。
适用场景
- ✓当你希望新席位从之前的运行时对话开始的时候。
- ✓当你编写 rig 规格中的成员,需要从早前会话分叉时。
- ✓当你需要为新席位在分叉、重建、恢复和全新启动之间做选择时。
技能链接
https://github.com/mvschwarz/openrig/blob/main/packages/daemon/specs/agents/shared/skills/core/session-source-fork/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请基于之前的 Codex 会话分叉出一个新的评审席位,但要让它与原席位明确分开。”
每周 5 个新技能,1 分钟读完。
工作原理
它在规格中声明会话来源,创建一个拥有自己令牌的新席位,并且绝不会把父席位的令牌写入新席位。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
session_source Fork
session_source is a member-level OpenRig field that declares how a
newly-launched managed seat should derive its initial conversation
continuity from a prior runtime conversation source.
v1 supports one mode: fork — start a new managed seat from a
prior native runtime conversation source without claiming the original
seat continued.
The schema is runtime-neutral; implementation is runtime-specific (Claude and Codex have their own native fork commands).
Use this when
- Authoring a rig spec member that should fork from a prior session
- Authoring a
rig expandpayload withsession_source - Reasoning about whether to use
forkvsrebuildvsresumevsfreshfor a new seat - Composing fork + handover (seat-handover-over-fork) — see
seat-continuity-and-handoverskill
Don't use this when
- The seat is being restored, not created. Restore continues an existing managed seat. Fork creates a new seat.
- The continuity is artifact-backed mental-model rebuild (packet-derived understanding, not native runtime continuity). Use
mode: rebuild(seeseat-continuity-and-handoverfor the rebuild surface) — do NOT collapse fork into artifact-backed reentry; the distinction is load-bearing. - The runtime is
terminal. Terminal runtime rejectssession_source.
The shape (canonical YAML)
members:
- id: reviewer-2
runtime: claude-code # or "codex"; not valid on terminal
agent_ref: specs/agents/reviewer.yaml
profile: reviewer
cwd: .
session_source:
mode: fork
ref:
kind: native_id # v1 fork mode supports native_id only
value: "0b0165d7-cb4d-4650-90de-15c0a1ede9e6"
Rules:
modev1 only valid value:fork.ref.kindv1 supportsnative_idonly. Schema rejectsartifact_path,name,last, andartifact_setpre-launch with explicit deferred/weaker/wrong-mode error messages (seepackages/daemon/src/domain/rigspec-schema.tsvalidateSessionSourceFork). Adapter-level refusal exists as defensive handling but should not be reachable in v1 because schema rejects first.valuerequired forref.kind: native_idin v1 (the only schema-accepted kind). Future-state value semantics forartifact_path/name/lastare not active in v1 because schema rejects those kinds pre-launch.rig expandaccepts the same shape so dynamically-added members can carry session-source attribution.
The primitive does NOT introduce a new top-level command. It flows through existing rig spec and expansion pathways.
State model
session_source is a launch-time input, not a long-lived stateful field:
- Declared — present in member config or expansion payload
- Resolved — at launch time, OpenRig resolves the
refagainst the runtime - Realized — runtime fork succeeds; new managed seat receives a NEW native continuity token (Claude session id or Codex thread id). OpenRig persists that NEW token. Parent token is NEVER written onto the new seat.
- Failed — resolution or fork failed; seat not launched as a fork; clear error names the resolution step that failed
Once realized, session_source is essentially history. Restoring the
seat later is restore of the new seat, not re-fork-from-parent.
Failure modes (5)
- Source session id not found — runtime cannot resolve
native_id. Action: emit error naming runtime + missing id; do NOT silently launch fresh. (Future-state note: whenartifact_pathis supported in a follow-up slice, it could become a candidate fallback for Claude; in v1 schema rejectsartifact_pathpre-launch so no fallback path exists.) - Source artifact path missing (out of v1 scope) — would apply once
ref.kind: artifact_pathbecomes schema-accepted. v1 schema rejects this kind pre-launch. - Unsupported runtime/kind combination (largely pre-empted in v1 by schema rejection) — schema rejects all non-
native_idkinds upfront. Adapter-level refusal exists as defensive handling but is not reached in v1. - Fork launch failed after source resolution — runtime command (
claude --resume <parent> --fork-sessionorcodex fork <id>) returned non-zero or hung. Preserve runtime stderr; do not record new seat as launched; do not write parent token onto seat. - Persistence inconsistency — fork succeeded but seat-token persistence cannot record new continuity token. Internal failure: seat is not considered launched
常见问题
新席位会取代旧席位吗?
不会。这项技能说明,分叉会创建一个新席位,而不会声称原席位已经继续。
支持哪些运行时?
第一版支持 Claude 和 Codex,使用它们原生的对话 ID。
它能恢复已有的席位吗?
不能。恢复是让已有席位继续运行,而分叉则会创建一个新席位。
详情
作者的原始描述
Use when authoring a rig spec member or `rig expand` payload that needs to start a new managed seat from a prior runtime conversation source — `session_source: { mode: fork, ref: { kind, value } }`. v1 supports `mode: fork` with `ref.kind: native_id` for Claude and Codex. The new seat persists a NEW post-fork token; the parent token is NEVER written onto the new seat. NOT for restoring an existing seat or for artifact-backed mental-model rebuild.
repo: mvschwarz/openrig
热度
- GitHub 星标
- 8.6k
- 排名
- #12412
- 许可证
- Apache-2.0
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-operated-software
8.6k帮你的智能体设计、构建或调试一个后端包含 AI 智能体的持续运行应用,例如基于 Markdown 或 JSON 的智能体控制层。
agent-operated-workflows
8.6k帮你的智能体判断一个有边界的流程应由 AI 智能体还是普通代码执行,并基于已验证的证据从中断处恢复。
applying-a-permission-policy
8.6k帮你的智能体在团队设置时配置 AI 编程智能体使用的命令权限,让常规命令减少审批提示。
claude-compaction-restore
8.6k帮助 Claude Code 智能体在上下文被压缩后,借助保存的恢复图、对话记录和它改动过的文件,重建工作认知。