dsh-session-inherit: Mechanically hand over long sessions to clean new sessions

Preface

When using agents in DeepSeek Harness (DSH) to modify code or run commands, long sessions can lead to context windows cluttered with historical turns, tool results, and runtime injections. The official client already provides /compact to compress history into summaries, as well as “Fork” in the session menu to copy the entire history prefix. Both methods allow you to “continue working,” but the former may lose specific verifiable information like paths and parameters, while the latter carries a massive amount of old context into the new session.

Below is an introduction to the community plugin dsh-session-inherit (repo MacilyDots/dsh-session-inherit): it adds an “Inherit” entry to the session “…” menu. It extracts anchors—such as tasks, recent user instructions, modified files, tool failures, commands, and to-dos—without calling the model (zero LLM calls) from the source session logs to generate a handover sheet. Then, it creates a new session without old history and sends the handover sheet as the first message. The maintainer is MacilyDots, and it is categorized under “Memory” capabilities in community directories like SkillHub. The current npm package version is 0.5.5, with an MIT license.

What is this

In one sentence: An “Inherit” entry in the session menu + mechanical extraction of a handover sheet + creation of a clean new session to continue work.

The differences from /compact and the official “Fork” are summarized in a table in the README: Compression stays in the same session and the summary tends to be abstract intents; Fork copies the entire history; Inherit only moves verifiable specific anchors, so the new session context starts at a scale of a few thousand characters. The handover sheet generation process involves zero LLM calls, and every item can be traced back to the source session for verification.

Core Features

Session Menu and Command Entry

In the “…” menu at the end of any session row in the sidebar, beyond DSH’s built-in Pin, Rename, Fork, and Archive, this plugin registers Inherit (slot sidebar.workspaces.session.menu.item, id session-inherit, order 350). This operation is available for including cold/idle sessions: reading is performed via sessionQuery.readSession, which does not activate the agent.

An equivalent entry is also available via the /inherit command in the prompt, for example:

/inherit                                  # Inherit current session
/inherit <sessionId>                      # Inherit specified session
/inherit --next run npm test first         # Specify the first step
/inherit <sessionId> --next switch files to continue

Additionally, it registers a session_inherit tool (arguments sessionId, nextStep, start), allowing the agent to propose switching sessions when the context becomes too long.

Handover Sheet Content and Extraction Rules

The handover sheet language follows the interface language (lang in the preview/commit request). The main sections include: Task Goals, Modified Files, Recent Failures, Recent User Instructions, Files Read, Paths Mentioned in Text, Relative References in Project, Recently Executed Commands, To-dos, the Source Session’s Last Reply, and the “Next Step” you filled in the preview. Section titles do not include numbering to avoid inconsistency between numbering and client prompts if a section is empty.

Key points on extraction:

  • Recent User Instructions only retains real user messages where source.kind === 'user', filtering out runtime injections like agent-instructions and runtime-context.
  • Modified Files come from the structured file_path of edit / write tools, sorted by recent modification; paths appearing in the body text are categorized into “Paths Mentioned in Text”.
  • Recent Failures come from tool/result where isError is true, with turn markers; successful results and user interruptions are discarded, and duplicate errors are merged.
  • Absolute paths undergo an existence check; deleted or renamed ones are marked as “(No longer exists)”.

The beginning of the handover sheet includes three execution conventions (general meaning: do not repeat or summarize the handover sheet, read it and directly do the “Next Step”, perform only one specific action for the first step then stop and report).

Behavior When Creating a New Session

After confirming inheritance, the new session title is Inherit: <Source Title>, and the working directory and model routing are consistent with the source session. “Inherit current conversation’s preset” is checked by default; if unchecked, the DSH default preset is used. “Start working immediately after creation” is checked by default: the handover sheet is sent via sessionController.prompt and work starts immediately; if unchecked, it only writes to the log via session:append without triggering the first turn.

The plugin also records repeated inheritance hints in %DSH_HOME%\session-inherit\history.json; if automatic start fails, the dialog box will display the reason and the new session id rather than closing silently.

Reviewing the Source Session: session_read

Since the new session cannot directly read the source session’s multi-frame zstd logs, the plugin additionally provides a read-only tool session_read (mode: search | summary | tail) for searching by keyword, getting structured summaries, or viewing tail events.

Optional Configuration

You can override settings in the profile’s cordis.patch.yml (all optional):

- id: session-inherit
  config:
    enabled: true
    recentUsers: 6
    startByDefault: true
    cacheTtlMs: 120000

Installation and Activation

Installation from npm is recommended (original command from README):

dsh plugin --profile <profile> add dsh-session-inherit

You can also use a link: dependency in the profile’s package.json and list dsh-session-inherit in dsh.profile.bundles; bundles are the authority for loading, writing to dependencies alone will not mount it. A restart of DSH is required after installation. The package.json requires Node >= 22.

The README notes that it has been verified on DSH 0.2.0-rc.2 (Windows); if the menu item does not appear after upgrading DSH, check if the profile’s compatibility.json and peerDependencies match.

Typical Usage

  1. Hover over the target session in the sidebar, click the “…” at the end of the row, and select Inherit (or use /inherit for the current session).
  2. View the source session summary in the preview (turns, number of modified files, number of failures, etc.), and write a specific action in the Next Step input box (e.g., specifying a file and a single operation).
  3. Expand “Full Handover Sheet (Editable)” as needed to fine-tune the content, and confirm whether to inherit the preset and whether to start working immediately after creation.
  4. Click “Create and Inherit”; the new session will open and continue from the handover sheet, leaving the source session unchanged.

If you need to trigger it on the agent side, you can call session_inherit; if you need to verify details of the source session, use session_read in the new session.

Scenarios and Cautions

Suitable for: Sessions with many turns and large historical token counts, where continued work mainly relies on task statements, recent instructions, modified file paths, unresolved tool errors, and to-do status; users who want a new session without old conversation history but do not want to use LLM summaries that lose specific anchors.

Not suitable for or Things to Know: The README explicitly states that the plugin does not cure degradation itself, it only reduces the trigger of “long history + abstract intent”; the handover sheet does not infer the “Next Step” for you, and if left blank, the model may ask first. There are documented limitations regarding mechanical extraction, such as path resolution, the 14,000-character limit for the handover sheet, and the discard strategy by section; if the source session has undergone compaction/*, earlier raw text may no longer be in the logs.

Safety and Trust: The DSH ecosystem follows the idea that “everything is a plugin.” SkillHub (directory page) and others are community sites and have no official affiliation with DeepSeek / High-Flyer. The plugin runs under the current DSH process permissions, and the host registers local loopback preview/commit endpoints; please check the GitHub source code and the MIT license yourself before installation to ensure it complies with your environment policies.

Conclusion

dsh-session-inherit provides a third path to “continue working”: no model calls, no old history, using a mechanical handover sheet to move verifiable context anchors into a clean new session, with optional preset inheritance and immediate work start. For installation commands, configuration options, and limitation descriptions, please refer to the repository README (including README.zh-CN.md).

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye