
yoke233/dsh-prime-agent
30Last commit Aug 15, 2026
dsh-prime-agent DSH plugin
dsh-prime-agent is a DSH plugin that provides a persistent TypeScript realm for code mode sessions. It allows ordinary top-level variables, functions, and objects to survive across run_code calls, while maintaining compatibility with official one-shot semantics for other sessions.
How to install the dsh-prime-agent DSH plugin
dsh plugin --profile web add ./dsh-prime-agentCopying does not run this command. Review the repository and version before installing the dsh-prime-agent DSH plugin.
dsh-prime-agent DSH plugin data source
dsh-prime-agent DSH plugin snapshot date: Aug 16, 2026
discovered
What the dsh-prime-agent DSH plugin can do
- Persistent TypeScript Realm: variables, functions, and objects from previous run_code persist in the same session via a long-lived Worker.
- Sub-agent orchestration: support continuable child agents with inbox/outbox pattern and background jobs with separate lifecycle.
- Continual learning (prime_refine): evidence-based persistent refinement of prompts, memories, skills, and subagents with optimistic concurrency and rollback.
- Identity handshake: uses a bootstrap binding (prime_realm_identity) with HMAC proof to securely route requests to the correct persistent realm.
- Configurable: state directory, tool names, code mode requirement, orchestration tools, and pool limits (maxActiveRealms, maxIdleMs, etc.).
Where the dsh-prime-agent DSH plugin fits
- Build complex data structures incrementally across multiple code cells in a single session.
- Orchestrate parallel sub-agents for independent tasks, collecting results via continuable children or background jobs.
- Use the prime_refine tool to capture and apply recurring patterns, user corrections, or stable strategies without manual prompt engineering.
- Share large intermediate results across code cells via live namespace, reducing redundant recomputation.
Who the dsh-prime-agent DSH plugin is for
- Advanced DeepSeek Harness users who need persistent state across code executions.
- Developers building complex agent workflows that require sub-agent orchestration and continual learning.
- Users who want to migrate from one-shot code mode to a more interactive, long-running session.
dsh-prime-agent DSH plugin limitations
- Realm is live-only: abort, timeout, or OOM will hard-kill the Worker and lose all live namespace variables – checkpoints must be explicitly saved to persistent task files.
- Continual learning is secondary; it should not be used to store research materials, task states, or large contexts – only stable, recurring patterns.
- Requires DSH peer range 0.1.x and a pre-configured DSH environment (headless setup requires additional shim installation).
- The prime preset must be manually selected per session; default preset and other presets remain one-shot.
dsh-prime-agent DSH plugin: from the repository README
Quoted from the yoke233/dsh-prime-agent README, the upstream source of the dsh-prime-agent DSH plugin. Copyright remains with the original authors.
`dsh-prime-agent` 是面向 DeepSeek Harness 的 RLM-first 控制面。选中 Prime preset 的会话,其 `run_code` 程序运行在一个经认证的长期 TypeScript Realm 里:上一 cell 声明的普通变量、函数和对象,下一 cell 可以直接使用。 ```ts // 第 1 次 run_code const lookup = new Map(records.map(item => [item.id, item])) const review = async (id) => tools.review_item({ item: lookup.get(id) }) lookup.size // 第 2 次 run_code —— 同一会话的新调用 await review('a') // Map 和函数都还活着 ``` 普通会话完全不受影响,继续使用官方 one-shot 语义。 ## 工作原理 <p align="center"> <img src="./assets/readme/architecture.svg" width="100%" alt="混合运行时路由:run_code 经 DSH Code Mode bridge 进入 PrimeCodeRuntime,握手认证通过的会话路由到持久 Realm Worker,其余请求走官方 one-shot Worker"> </p> - 插件注册固定名称的 `prime_realm_identity` bootstrap binding。`PrimeCodeRuntime` 在执行程序前以 32 字节 CSPRNG challenge 调用它,验证带 session binding 的 HMAC proof 后,才把请求路由到该会话的持久 Realm Worker。 - 没有该 binding 的请求原样委托官方 one-shot Worker;binding 存在但握手失败时明确报错,绝不静默降级。 - Realm 内的工具经跨 run 稳定的 Proxy 与 per-run binding lease 调用:schema、审批、沙箱、日志、并发和取消仍由 DSH 执行,run 结束立即撤销授权。 - Realm 是 live-only 的:abort、timeout、OOM 会 hard-kill Worker 并丢失 namespace,下一次真正执行时会明确提示之前的 bindings 已丢失。跨重启的检查点由程序显式写入持久任务文件。 完整身份协议、namespace 生命周期、Agent 编排与学习层边界见 [当前架构](docs/architecture.md)。 ## 三层数据 | 状态层 | 责任 |
Read the full READMERepository license: MIT
dsh-prime-agent DSH plugin questions
How do I install dsh-prime-agent?
Run `npm install && npm run check` in the repository root, then execute `dsh plugin --profile web add ./dsh-prime-agent`. This installs the plugin along with a bundled patch that replaces the code-runtime provider and a Prime preset that is deployed to $DSH_HOME/.agent-presets on first launch.
How do I enable the persistent realm for a session?
Select the Prime preset when starting a session. The preset is placed in $DSH_HOME/.agent-presets/prime (only if missing). Sessions using other presets will continue to use the official one-shot semantics. You can also configure the default preset in cordis.patch.yml if you want all sessions to use Prime.
What happens if the realm Worker crashes due to timeout or OOM?
The Worker is hard-killed and all live namespace variables are lost. The next run_code will explicitly inform you that previous bindings are gone. To preserve state across restarts, you must explicitly write checkpoints to persistent task files using file system operations.
Can I use dsh-prime-agent in headless mode?
Yes, but you need to install the prime-headless-shim and set up an isolated DSH_HOME with the required dependencies. The README provides a detailed PowerShell script for this. You also need to configure the headless profile to use the Prime preset as the default.
How does the continual learning feature (prime_refine) work?
prime_refine allows the model to persistently store prompts, memories, skills, and subagents. It uses evidence-based transactions with optimistic concurrency. Use `inspect` to view current state, `apply` with a trigger and expected outcome to add entries, and `rollback` to revert to a previous transaction. It is intentionally secondary and should not be used for large contexts or research data.