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:

  1. Event monitoring and filtering: Listens to the session/created event and only processes sessions that are isSeeded, have a parentSession, and are not subagent (i.e., forked child sessions).
  2. Recursive tree copying: For each direct sub-agent of the original session, calls the official agents.create to create a complete copy, and recursively copies the entire sub-agent tree.
  3. Metadata preservation: Copies sub-agent panel, routing, descriptor, label, and other metadata.
  4. 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.
  5. Catalog registration: After creating copies, appends the official subagent/catalog to the parent session to ensure copies are visible in the sub-agent panel.
  6. 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.
  7. 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:

  1. 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.
  2. ID usage: You must use the copy IDs returned by list_agents to send messages. The original IDs still belong to the old branch, and the new parent session will return UNAUTHORIZED: belongs to another parent session.
  3. 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.
  4. 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.

Plugin Directory | GitHub Repository