Session Git:把分叉会话画成分支树,一键合并回主会话

Introduction

In DeepSeek Harness (DSH), it is common to explore a new line of thought by “forking” a session from a reply. However, the main session cannot see what happens inside the fork: conclusions, modified files, run commands, and the decisions you made in the fork often have to be narrated manually so the Agent in the main session can continue. Below, we introduce the community plugin dsh-session-git (Category: Workflow). It visualizes forked sessions as a branch map and merges branch outcomes back into the main session as summaries (digests), reducing repetitive input.

What is it

Session Git is released by maintainer glk1220, current package version is 0.1.0 (MIT License). It aims to: provide a branch view for forked sessions within Harness and support merging completed branch work back into the main session. The plugin does not send session data over the network; it reads local session records during merging and processes locally.

Core Features

Branch Map

  • Right sidebar Session Git tab: Displays the branch tree around the current session—where each branch forked, its own turn count, and the extent of merging.
  • Left sidebar Session Git panel: Lists all forked trees within the workspace.

One-click Merge

  • In the main session, you can click Merge here for a specific branch; inside a branch, you can click Merge into parent.
  • Typing the slash command /merge also triggers a merge; typing just /merge opens the branch selector.

Incremental Merge

  • When merging the same branch again, by default only new content since the last merge is included. To redo from the fork point, add --all.

Default Silent Delivery

  • The digest generated by the merge is queued by default and provided to the Agent with the context in your next message, interrupting the current conversation. There is a hint bar above the input box indicating the merge is queued. If you want the Agent to act immediately, you can add --wake or write a note after -- (sent along with the digest).

Unmerged Reminders

  • When returning to the main session and a branch has new work that hasn’t been merged yet, the hint bar above the input box offers Merge here or Ignore; the reminder will appear again after the branch completes another round.

Agent-side Capabilities

  • Runtime context can inform the Agent which branches exist in the current session. After enabling tools in the configuration, the Agent can call session_branches and session_branch_merge. When a user says “bring the conclusions from the branch into this,” the Agent can use these tools; content read via this path is also counted towards the merge status.

Installation and Activation

Requires DeepSeek Harness 0.2.1-rc.5 or later (matches engines.dsh in package.json).

In the Harness GUI: Open Plugins → Add plugin → Install a third-party plugin, and enter the GitHub repository address:

https://github.com/glk1220/dsh-session-git

Installing from GitHub requires local access to GitHub; you can also download the repository and fill in the absolute path to the plugin directory in the same dialog.

Command line installation:

dsh plugin --profile web add github:glk1220/dsh-session-git

Restart Harness as prompted.

The plugin runs with the permissions of the current DSH process. Before installing a third-party plugin, it is recommended to check the source code and LICENSE on GitHub to ensure it meets your security and compliance requirements. The community directory skillhub.cn is an independent site with no official affiliation with DeepSeek / Hyperscience.

Typical Usage

Interface Workflow

  1. Click Branch into a new conversation below a reply, or select Fork session from the sidebar session menu to explore in the fork.
  2. After finishing, click Merge into parent in Session Git on the right side of the fork; or return to the main session and click Merge here in the strip above the input box.
  3. Send the next message as usual in the main session; the Agent will see the branch digest in the context and answer.

The sidebar allows setting digest granularity: Summary, Full, Conclusion only; Let the agent act right away is equivalent to --wake.

Slash Commands

/merge [#number|title|id] [summary|full|last|Nturns] [--all] [--wake] [--up] [-- note]
/branches
Form Meaning
/merge Directly merge if only one branch; if multiple, merge the branch with unique new intervals or list options. Within a fork with no sub-branches, merge into the parent session. Typing just the command opens the branch selector.
/merge #2 Select by number on the map; title (partial match) or first 4+ chars of session id also work.
summary / full / last Detail level of digest, default summary.
turns:3 Only the last 3 turns, full details.
--all Ignore previous merges, redo from fork point.
--wake Immediately wake the Agent after merging.
--up Merge the current branch into the parent session.
-- note Content after -- is sent along with your message and the digest.
/branches Print the branch map in the conversation.

What the Digest Contains

The digest is background material provided to the Agent. It may compress step details if too long. Main sections include:

  1. Relationship between branch and session: fork position, turns covered by this merge.
  2. Branch goal (if set).
  3. Each turn: user messages, Agent reply points, tools used, work delegated to subagent.
  4. User decisions in the branch (e.g., answers to questions asked of the Agent).
  5. Changed files and executed commands.
  6. To-do list and compaction summary.
  7. Final conclusion of the branch.

It will start by stating: plans and to-dos in the branch are for record-keeping and require your confirmation; if the two sessions share a working directory, file changes in the branch are already on disk and take precedence.

Configuration

In the profile’s cordis.patch.yml, you can override the entire config with id session-git:

Option Default Meaning
runtimeContext true Inform the Agent which branches exist in the current session in runtime context (mostly immutable facts, reducing repetitive pushes).
tools true Provide session_branches and session_branch_merge tools.
maxDigestChars 24000 Single digest character limit, 2000–200000.
maxContextBranches 8 Maximum number of branches listed in runtime context.
locale auto Language of command results and digest: auto follows the conversation, zh / en forced.

Use Cases and Notes

Who is this for: Developers who frequently fork multiple lines of exploration in Harness and want the main session Agent to automatically inherit branch conclusions and operation records.

Known Limitations (from upstream README):

  • Merges in the queue are similar to queued messages: if Stop is clicked or Harness is restarted before the Agent reads them, they might be cancelled; the hint bar will show unmerged again, and re-merging won’t lose branch content.
  • Silent merges do not appear in the conversation flow (Harness does not render pure context injection), check status via the input box strip and branch map.
  • Subagent sessions are not on the map; branches under them hang off the most recent visible session.

DSH’s ecosystem philosophy is “everything is a plugin”; Session Git solves the gap between forked exploration and main session context, bringing results back via a branch tree and merge without the need to retype and recount.

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

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

Xiaoye