Repository navigation
v0.8.9:技能根指向账号真实的 ~/.agents(自动迁移旧版私有根)/ Skill Root Moves to the Account's Real ~/.agents
中文
新功能
- 🟢 技能与全局指令改指账号真实的
~/.agents:DSH_AGENTS_HOME从本工具私有的btsd321/.agents改为远端账号的~/.agents(dsh 的默认值)。用户在同一台机器上早已维护的技能与~/.agents/AGENTS.md全局指令,现在在远端会话里直接生效;远端窗口里装的技能,原生 dsh 也共享同一份。同一远端账号下换工作目录开会话,技能依然在。 - 旧版私有根自动迁移:首次连接把
btsd321/.agents里的技能与AGENTS.md并入~/.agents——同名冲突项不迁移(保留新版,旧副本原地留下),第三方安装器元数据.skill-lock.json不搬运(dsh 的技能发现只扫目录,本工具不伪造来源/hash)。迁移幂等、失败只跳过该阶段、不影响会话;写入经base/tmp/agents.lock的 flock 串行化,多个会话同时连接不会互相踩。 - 迁移后旧版空目录与本工具旧
.lock自动收尾(rmdir只删空目录,有冲突项或第三方元数据时保留)。
修复
- 代码审查发现:迁移「无可迁项」分支的旧根收尾(
rm .lock/rmdir)此前绕过 flock,与「所有写~/.agents的动作共用同一把锁」不一致;现在收尾与搬运走同一临界区。 AGENTS.md的搬运结果不再复用技能名输出通道(技能根里若存在同名平铺技能AGENTS.md会被误记成全局指令),改用独立标签区分。- 预建
~/.agents/skills改为失败容忍:该根现在归用户(可能是只读目录、软链或普通文件),预建只是 watcher 优化,失败交由 dsh 自带的轮询兜底,不该连会话启动一起挂掉。 clean不再删除任何 agent 目录:~/.agents(技能与全局AGENTS.md)属于用户数据,与 plugin store 同一纪律;旧btsd321/.agents也保留,避免丢掉未迁移的同名冲突项。- 锁文件从
.agents/.lock迁到base/tmp/agents.lock,不再往用户目录写本工具的内部文件。
文档
- README(中/英)、usage(中/英)更新:技能根位置、本工具对
~/.agents的两处写操作(预建空skills/+ 迁移)、clean语义、迁移规则,以及「被复用的旧远端进程仍带旧DSH_AGENTS_HOME,需重启远端会话才读到新根」。 - lessons 第 11/22 条重写:记录技能根从「会话级 → 工具机器级 → 账号级」三代演进与判据(dsh 的
agent-instructions与skill-filesystem只认这个根)。 - 单测同步:
remote-paths/agents-lock断言新归属;新增迁移计划用例(冲突不迁移、平铺.md、AGENTS.md冲突);删除clean-agents旧用例。
验证
pnpm run typecheck零错误;scripts/check-plugin.ts全通过;单元测试 664 个用例 661 通过 / 3 skipped(既有 POSIX-only)/ 0 失败。- 依赖真实 POSIX shell 的 WSL 冒烟:在
/tmp沙箱跑完整迁移——非冲突技能迁走、同名冲突保留、AGENTS.md首次迁移且二次冲突跳过、旧.lock清理、空旧根移除、二次调用幂等,全部符合预期;锁文件落在base/tmp/agents.lock。 build:plugin重建后lib/可复现(工作区干净),产物内联版本0.8.9。
English
Features
- 🟢 Skills and global instructions now use the account's real
~/.agents:DSH_AGENTS_HOMEmoves from this tool's privatebtsd321/.agentsto the remote account's~/.agents(dsh's default). Skills and the~/.agents/AGENTS.mdglobal instructions you already maintain on that machine now apply directly in remote sessions, and skills installed from the remote window are shared with native dsh. Opening a session in a different working directory on the same account keeps your skills. - Automatic migration of the old private root: on first connect, skills and
AGENTS.mdunderbtsd321/.agentsare merged into~/.agents— same-name entries are not migrated (the new copy wins and the old one stays in place), and external installer metadata (.skill-lock.json) is not carried over (dsh's skill discovery only scans directories; this tool does not fabricate source/hash records). The migration is idempotent, a failure only skips the stage and never blocks the session, and writes are serialized by a flock atbase/tmp/agents.lockso concurrent sessions cannot step on each other. - Empty legacy directories and the tool's old
.lockare cleaned up afterwards (rmdironly removes empty directories; conflicts or third-party metadata are kept).
Fixes
- Found in code review: the no-op branch's legacy cleanup (
rm .lock/rmdir) bypassed the flock, contradicting the rule that every write to~/.agentsshares one lock; cleanup and moves now run in the same critical section. - The
AGENTS.mdmove result no longer reuses the skill-name output channel (a flat skill namedAGENTS.mdwould have been misreported as the global instruction file); it now uses its own tags. - Pre-creating
~/.agents/skillsis now failure-tolerant: the root belongs to the user (it may be read-only, a symlink, or a regular file), pre-creation is only a watcher optimization, and dsh's own polling is the fallback — it must not take session startup down with it. cleanno longer deletes any agent directory:~/.agents(skills and globalAGENTS.md) is user data, the same discipline as the plugin store; the oldbtsd321/.agentsis kept too so unmigrated same-name conflicts are not lost.- The lock file moves from
.agents/.locktobase/tmp/agents.lock, so this tool no longer writes its internal lock into the user's home.
Documentation
- README (zh/en) and usage (zh/en): skill root location, the two places this tool writes into
~/.agents(emptyskills/pre-create + migration),cleansemantics, migration rules, and the note that a reused remote process still carries the oldDSH_AGENTS_HOMEand needs a restart to read the migrated skills. - lessons #11/#22 rewritten: the three-generation evolution of the skill root (session-level → tool machine-level → account-level) and the evidence behind it (dsh's
agent-instructionsandskill-filesystemonly read that root). - Tests updated:
remote-paths/agents-lockassert the new ownership; new migration-plan cases (conflict skip, flat.md,AGENTS.mdconflict); the obsoleteclean-agentscases are removed.
Verification
pnpm run typecheckclean;scripts/check-plugin.tsfully passing; 664 unit tests — 661 passed / 3 skipped (pre-existing POSIX-only) / 0 failed.- WSL smoke test driven by a real POSIX shell: a complete migration in a
/tmpsandbox — non-conflicting skills moved, same-name conflicts kept,AGENTS.mdmigrated once and skipped on the second run, old.lockremoved, empty legacy root removed, second call idempotent; all as expected, with the lock atbase/tmp/agents.lock. build:pluginreproduceslib/exactly (clean working tree); the bundle inlines version0.8.9.
Full Changelog: v0.8.8...v0.8.9