Preface¶
When developing long-running agents on DeepSeek Harness (DSH), history records accumulate continuously. The conventional approach is to compress history, but this leads to loss of details, and the compressed summary often becomes the sole “source of truth,” causing information distortion. dsh-epistemic-fold provides a contract-preserving context runtime solution. It folds old trajectories out of the hot context while retaining precise historical records, ensuring that lossy summaries are no longer treated as authoritative sources.
Plugin Positioning¶
Maintained by orangeofcarl0-sys, this plugin is a context runtime component for DSH. By maintaining a monotonic folding frontier, it ensures that raw history can be retrieved and restored while keeping the context window size manageable.
Core Features¶
The plugin provides the following capabilities:
- Precise History Recovery: Through archiving and recall mechanisms, ensuring persistent historical messages can be retrieved accurately.
- Hot Context Folding: Old trajectories leave the active prompt and enter compact checkpoints, freeing up the context window.
- Monotonic Folding Frontier: The folding process maintains unidirectional progression, avoiding repeated rewriting of previous summaries.
- Deterministic State Representation: The current state can be represented independently of narrative text.
- Non-Authoritative Summaries: Lossy summaries are no longer the sole source of truth; precise archives are retrieved only when needed.
- Runtime Monitoring: The sidebar displays context pressure, folding counts, archive status, and retrieval activity.
- Retrieval Tools: Provides
context_searchandcontext_recalltools, allowing agents to proactively retrieve history.
Installation and Activation¶
First, install the plugin via command. The plugin must be loaded after dsh-web-app to patch DSH’s preset configuration.
dsh plugin --profile <name> add github:orangeofcarl0-sys/dsh-epistemic-fold#v0.1.0
Note: In the Profile bundle configuration, ensure that
dsh-web-appis listed beforedsh-epistemic-fold.
Typical Usage¶
1. Set Context Mode¶
The plugin offers three modes to balance context window usage and retention strategies:
/context mode economy
/context mode balanced
/context mode quality
- Economy: Keep the hot context lean, restoring old details on demand.
- Balanced: Retain a larger literal tail.
- Quality: Adds semantic justification checkpoints on top of the balanced mode.
2. Check Runtime Status¶
Use the command to view current context pressure, folding counts, and archive status.
/context status
The status interface is located in the sidebar; it is independent of model history and does not consume context window space.
3. Use Retrieval Tools¶
When the agent requires historical details, it can use the registered tools:
context_search: Locates relevant folded history and bounded literal excerpts.context_recall: Retrieves checkpoint views or precisely archived messages.
Use Cases and Notes¶
This plugin is suitable for long-running agent tasks with limited context windows. Please note the following facts during use:
- Branch Locking: The
github:owner/repoformat points to the default branch by default, not a Release version. To lock a specific version, a tag must be explicitly specified (e.g.,#v0.1.0). - Load Order: The plugin must be loaded after
dsh-web-app; otherwise, it cannot correctly patch the DSH presets. - Status UI: The status UI is not part of the model history; viewing status does not consume context.
Summary¶
dsh-epistemic-fold solves the information loss problem in long-running agent context management by separating “active context” from “archived history.” It demotes lossy summaries to auxiliary information, ensuring traceability of agent behavior and consistency of state through precise archiving and retrieval mechanisms.
- Plugin Directory: https://www.skillhub.cn/plugins/orangeofcarl0-sys/dsh-epistemic-fold
- GitHub Repository: https://github.com/orangeofcarl0-sys/dsh-epistemic-fold