Foreword¶
As long sessions run, the context accumulates more and more: early data occupies tokens, and truly useful information gets drowned out, making it hard to know where to start deleting. The philosophy of DSH (DeepSeek Harness) is “everything is a plugin,” and context governance can similarly be delegated to a plugin rather than scattered across various prompts and scripts.
Below is an introduction to dsh-agent-context, a DSH plugin that combines context injection, usage metering, and pruning tools.
What is it¶
dsh-agent-context is a DSH plugin maintained by jonah791. In one sentence: injection and management of session context. It provides three capabilities within a single plugin: the /context command, the ctx.contextMeter service, and a set of pruning tools, where the pruning part is merged from the author’s previous plugin dsh-agent-context-pruner.
The license is MIT, noted in both the README and package.json.
Core Features¶
The README lists two feature highlights:
- Context injection: injecting context content into session requests on demand;
- Session awareness: integrated with the agent session model.
On this basis, the plugin’s ecosystem convention declaration confirms a few things:
- Provides the
/contextcommand; - Provides the
ctx.contextMeterservice; - Provides five pruning tools:
prune_candidates,prune_apply,prune_guard,prune_stats,expand; - Declares four injection points:
commands,tokenMeter,sessionProjections,tools.
In other words, this plugin not only hooks up a command but also registers commands, connects to token metering, participates in session projections, and provides tools externally. In terms of runtime, the plugin is declared as runtime: host-only, envDeps as none (pure logic / standard Node), and has no special authorization boundaries.
Installation and Enablement¶
The README does not provide one-click installation commands like dsh plugin add. The installation method is to manually clone the repository into your self-plugins directory and then use pnpm to install dependencies and build:
cd <你的 self-plugins 目录>
git clone https://github.com/jonah791/dsh-agent-context.git
cd dsh-agent-context
pnpm install
pnpm build
First, enter your self-plugins directory, clone the repository, then run pnpm install to install dependencies and pnpm build to complete the build. After the steps above, the plugin is installed.
Regarding dependencies, the plugin’s peerDependencies cover a set of @deepseek-ai packages:
@deepseek-ai/cordis
@deepseek-ai/dsh-agent
@deepseek-ai/dsh-commands
@deepseek-ai/dsh-session
@deepseek-ai/dsh-session-projection
@deepseek-ai/dsh-token-meter
@deepseek-ai/schemastery
@deepseek-ai/dsh-tools
The compatibility declaration is cordis ^4.0.1 / dsh-tools ^0.1.0-rc.6. These are peer dependencies; specific versions are provided by the DSH host environment, and the plugin itself does not bundle them.
Available Entry Points¶
As of the time of README retrieval, the repository does not provide complete usage examples. The confirmed entry points fall into three categories:
/contextcommand: called within a session; the README does not elaborate on its parameters and behavior;ctx.contextMeterservice: a context metering service mounted on ctx, accessible by code;- Five pruning tools:
prune_candidates,prune_apply,prune_guard,prune_stats,expand, registered under the tools injection point.
The specific parameters and behavior of each tool are not elaborated on in the README; it is recommended to read the repository source code directly before use.
Suitable Scenarios and Notes¶
Suitable for:
- Developers running long-session agents on DSH who need to control context volume;
- People who want to inject context content into sessions on demand rather than stuffing all data in at once;
- People who want to converge context metering and pruning into a single plugin for unified maintenance.
Notes:
- The plugin runs with the permissions of the current DSH process. Before installing third-party plugins, be sure to check the source code and license; dsh-agent-context uses the MIT license;
- The plugin declares
runtime: host-only,envDepsas none, andboundaryas having no special authorization boundaries; - Installation requires no one-click command; it needs to be manually cloned into the
self-pluginsdirectory and built locally; - The pruning capability is merged from
dsh-agent-context-pruner. If you previously installed that plugin separately, note that its functionality has been merged into this plugin; - Compatibility follows the declaration: cordis ^4.0.1 / dsh-tools ^0.1.0-rc.6.
Summary¶
dsh-agent-context bundles the /context command, the ctx.contextMeter service, and five pruning tools into one plugin, covering context injection, metering, and pruning. It is suitable for developers maintaining long sessions on DSH. Installation involves manual cloning and local building; remember to check the source code and license before getting started.
- Community Directory: https://www.skillhub.cn/plugins/jonah791/dsh-agent-context (A community-maintained independent directory site, with no official affiliation with DeepSeek / Huafan)
- GitHub Repository: https://github.com/jonah791/dsh-agent-context