AI Agent Hub
Back to plugins
🤖

dsh-fork-perf

Model Inference Updated 2026.08.17

Run the following command in DeepSeek Harness:

dsh plugin install orangeofcarl0-sys/dsh-fork-perf

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install orangeofcarl0-sys/dsh-fork-perf in your terminal to install this plugin; the full source is available at https://github.com/orangeofcarl0-sys/dsh-fork-perf

About this plugin

In DSH, forking a conversation that has grown past 15 MB forces the engine to perform multiple full deep-copies of the entire event log on every branch. Under a realistic 18 MB / 20 k-event workload, a single fork generates roughly 500 ms of synchronous blocking—enough to tear through a streaming LLM response, freeze the UI, and trip transport-layer heartbeat retries. This is the problem dsh-fork-perf targets.

The plugin exploits a straightforward observation: the seed events handed to a fork are already deep-frozen, immutable pure JSON trees that passed full JSON-boundary and surface validation at the moment they were ingested. No downstream code can mutate them, so the deep copies originally meant to provide isolation are semantically redundant. dsh-fork-perf re-routes the fork seed through the fromRestore channel to reuse those frozen references in place, and swaps the structuredClone(seed) call inside PersistenceCoordinator.initFor for the same reference-reuse pattern. The child-session header and on-disk layout remain field-for-field identical to the official fork path. Under identical load the fork body drops from 344 ms to about 19 ms (an 18x speedup) and initFor falls from 135 ms to near zero. A three-layer fallback (capability probe, runtime exception guard, config toggle) together with a clean dispose path guarantee the plugin can be removed safely at any time.

If you regularly manage large multi-turn DSH sessions, fork branches frequently for parallel experiments or context comparisons, and are paying a real cost in stream interruptions and UI stutters, this lightweight drop-in patch eliminates the dominant bottleneck on the fork path.

Use Cases

  • Frequent forking on large multi-turn sessions over 15 ms without hundreds of milliseconds of synchronous blocking
  • Streaming LLM responses interrupted by fork deep-copies, UI freezes, or heartbeat timeout retries in DSH
  • Running multiple parallel forks for experiment comparison without cumulative deep-copy latency

Best For

  • AI application developers working with long-form DSH conversations
  • AI researchers who frequently branch sessions for parallel experiments
  • Engineers focused on DSH inference-path performance