Introduction¶
When DSH’s official fork feature creates a new session, the sub-agent records from the original session still point to the old session. As a result, in the forked conversation, the sub-agent panel is empty: the records remain on disk, but they are disconnected from the new conversation. dsh-fork-relink listens for the session/created event, creates complete copies of the original session’s direct sub-agents, and attaches them under the new session.
Features¶
This plugin uses official events to migrate and retain sub-agents:
- Event monitoring and filtering: Listens to the
session/createdevent and only processes sessions that areisSeeded, have aparentSession, and are notsubagent(i.e., forked child sessions). - Recursive tree copying: For each direct sub-agent of the original session, calls the official
agents.createto create a complete copy, and recursively copies the entire sub-agent tree. - Metadata preservation: Copies sub-agent panel, routing, descriptor, label, and other metadata.
- Cold session mechanism: Copies are cold sessions; after being persisted to disk, live instances are released. Copies and originals do not interfere with each other, and copies are woken via the official recovery path.
- Catalog registration: After creating copies, appends the official
subagent/catalogto the parent session to ensure copies are visible in the sub-agent panel. - Log generation handling: Reads session logs by generation (
session.vN.jsonl.zstd), automatically reads the highest-generation file, and does not hard-code the generation number. - Runtime status filtering: Skips sub-agents currently running to avoid conflicts with in-memory state, and records skipped entries in the log.
Install and Enable¶
After installing the plugin, restart dsh web for changes to take effect.
Install from GitHub¶
dsh plugin --profile web add github:Enosensu/dsh-fork-relink
Local Development¶
Point directly to the working directory:
dsh plugin --profile web add "link:<本目录>"
Uninstall¶
dsh plugin --profile web remove dsh-fork-relink
Usage and Limitations¶
After installing the plugin, forked conversations automatically have sub-agent copies, but note the following limitations:
- Cold session wake-up: Copies are cold sessions and must be woken up via cold recovery when sending the first message. The plugin log records the addressability of each copy.
- ID usage: You must use the copy IDs returned by
list_agentsto send messages. The original IDs still belong to the old branch, and the new parent session will returnUNAUTHORIZED: belongs to another parent session. - Queued messages: Inherited queued messages are no longer presented by this plugin. Version 0.3.0 removed the placeholder entry, and the official queue entry directly displays inherited items.
- Zero dependencies: The plugin has no dependencies and performs no file rewrites; all operations are completed through the official API.
Use Cases¶
This plugin is suitable for developers who need to continue interacting with original sub-agents in new forked conversations. It resolves the issue where, after an official fork, the sub-agent panel is empty and records are not visible in the new conversation, but users are required to use copy IDs after forking.