DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

mafawu /

mafawu/HandYourSession

Verified

会话交接插件:协议内置,无需额外 skill。写交接、接手前先 check、回合结束后按登记开新会话。Self-contained session handoff for coding agents.

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@6a021338

HandYourSession

会话交接插件:协议内置,不装 skill。一个包,一次安装,交接成为会话里的一等动作。

包名与 cordis id 用 hand-your-session(npm 与插件系统的命名约束),显示名是 HandYourSession。

为什么没有独立 skill

规则不写成 SKILL.md 让你另外装,而是:

  • 会话第一步注入一次:六节写法、三态判定、交出与接手步骤;
  • 写进工具描述:模型选工具时看到的就是那一节的要点;
  • 随时可取全文:handoff_guide 返回完整协议。

流程:先问,再写

用户明确要求交接 / 换会话 / 交给别人
        ↓
① 问一次(三选一)        ← 询问在最前面,答案决定写多细
   现在交接并开新会话 / 只生成 / 不交接
        ↓
② 跑现场命令 → ③ 分账 → ④ handoff_write → check
        ↓
⑤ 选"现在切换"才调 handoff_switch,写 pending.json
        ↓
回合结束 ──→ 插件读 pending → 建新会话 → 投递首条消息 → 标记 switch: done

「只生成」可以写得短;「现在切换」必须让陌生人能独立开工。

不主动询问:没有用户明确要求时,插件不写文件、不调工具,也不会提示"要不要交接"。上下文将满不是理由。

工具

工具 作用
handoff_guide 返回完整协议
handoff_write 写交接:采集 git 现场、拼头部、落盘、跑 check,不过就返回错误
handoff_pickup 读最新交接:文件、任务、漂移、check、正文、首条消息
handoff_switch 登记切换(requested)或取消(declined);不立刻切
handoff_status 诊断:当前配置、pending、最新交接、最近切换日志

配置

- id: hand-your-session
  name: hand-your-session
  config:
    autoRemind: true        # 会话第一步注入协议 + 交接提醒
    injectProtocol: true    # 关掉只留交接提醒
    switchOnPending: true   # 回合结束发现 pending 就切;false 则只登记不切
    dirName: .handoff

switchOnPending 默认开:只有当模型调了 handoff_switch 才会写 pending,而那次调用发生在用户明确选择“现在交接并开新会话”之后——所以 pending 本身就是同意。想彻底关掉自动切换,把它设成 false(旧的 autoSwitch: false 仍然认)。

切换没发生时怎么查

插件把每一步写进 .handoff/.switch.log(时间 + 事件),失败不会静默:

2026-11-13T14:55:02+08:00 开始切换:交接 .handoff/xxx.handoff.md,route=opencode-go/deepseek-v4.1-flash
2026-11-13T14:55:02+08:00 切换成功:handoff-a1b2c3d4(cwd 形态 meta.cwd)

工具里也有 handoff_status,返回同一个日志的尾部。常见的三种“没切”:

日志 含义
没有 开始切换 没有 pending,或回合结束时读不到 cwd
切换失败:… agents.create 的几种形态都失败,日志会逐个写原因
交接未通过 check 文件本身有硬错误,先修文件

安装与更新

npm pack                                  # 生成 hand-your-session-x.y.z.tgz
# 用 DSH 插件管理器安装该 tgz

profile 的依赖指向具体的 tgz 文件,不要删它,否则下次 pnpm install 会失败。

测试

npm test        # node test/setup.mjs && node test/mock.mjs

8 组断言:工具清单与协议顺序、写/拒写/读、注入一次、只给 session 也能切、无 pending 不动、check 不过不切、declined 与开关关闭、协议无占位符。

已知未定

  1. agents.create 的 cwd 传参形态:依次尝试 meta.cwd → sessionOptions.cwd → 不带 cwd → 只带 sessionId,成功的形态写进日志,真机确认后删掉多余的。
  2. 客户端不会自动跳转:插件能拿到新 session id 并写回交接,GUI 聚焦仍需手动。
  3. turn/end 载荷形态做了兼容({agent} / {session} / 两者都有),真机日志里能看到实际走到哪一支。

目录

HandYourSession/
├─ package.json / cordis.patch.yml / LICENSE
├─ lib/
│  ├─ index.js      5 个工具 + 2 个钩子
│  ├─ protocol.js   协议正文(取代独立 skill)
│  ├─ store.js      git 现场、交接文件、pending、漂移
│  └─ text.js       提醒与首条消息
├─ scripts/handoff.mjs   CLI:write / check / list / resume
└─ test/{setup,mock}.mjs
DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout
—/ 5

No ratings yet

Verified DSH bundle

Commit 6a02133833e8

Community comments

No comments yet. Be the first to write one.