TT-Wang/dsh-slice-agent-loop

Plugin插件 Native原生 ⭐ 6 BSD-3-Clause Vision & Media视觉与多媒体Sessions & Context会话与上下文

一个即插即用的DeepSeek Harness智能体循环,其上下文引擎采用有界切片而非不断增长的记录。

Project Overview项目介绍

This is a native DSH plugin built exclusively for DeepSeek Harness versions 0.1.5-rc1 and 0.1.5-rc2, that implements a custom conversational context retention policy. It runs alongside the stock DSH agent loop, and preserves all of the host’s original lifecycle management, scheduler, inbox, persistence, and full request reconstruction logic. It is an additive add-on that only adds new context slicing functionality without modifying any core code, and the repository includes pre-built generated artifacts for direct installation via DSH’s built-in plugin installer.

It is intended for developers running long-lived agent sessions who need to retain access to full historical context without bloating the size of the current active prompt. It is most commonly used alongside the Agent Swarm DSH plugin, where it acts as the session context layer for each individual worker session in a swarm mission. It compresses the size of older context while keeping all original records available for recall, and users can retrieve any older conversation turns or tool results using the built-in recall_turn and expand_result tools whenever needed.

The plugin is released under the open-source BSD-3-Clause license, and it already bundles all required generated build artifacts so no extra compilation step is needed. You must keep the stock agent-loop and agent-loop-invariant modules enabled to use it, and you should not install the standalone dsh-tool-result-fold plugin alongside this one, as this plugin already bundles that functionality internally and duplicate registration will cause a load error. It does not guarantee reduced token billing, because provider caching may not recognize already sealed content, so you should test it with your typical workload to confirm it meets your needs.

这是一个专为 DeepSeek Harness 开发的原生插件,为 0.1.5-rc1 和 0.1.5-rc2 版本实现了一套对话上下文保留策略。它和原生代理循环并行运行,完整保留了宿主的生命周期、调度器、收件箱、持久化以及全请求重建逻辑,采用仅追加的日志模型封存超出保留数量的旧对话轮次,不对核心代码做侵入修改。

该插件主要面向需要长时间运行代理会话、又希望保留完整历史上下文不膨胀当前提示词的开发者。它通常和同为原生 DSH 插件的 Agent Swarm 配合使用,作为每个工作会话的上下文层,在压缩旧上下文体积的同时保留所有原始记录的召回入口。用户需要时可通过内置的 recall_turn、expand_result 等工具召回任意旧对话轮次或工具结果。

该插件采用 BSD-3-Clause 许可证开源,可直接通过 DSH 的插件安装器从本仓库安装使用。用户需要保持原生的 agent-loop 及相关模块处于启用状态,且不要同时安装独立版本的 dsh-tool-result-fold 插件,因为本插件已经内置了该功能。它不保证能减少 token 计费,因为服务商缓存可能无法命中已封存的内容。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:TT-Wang/dsh-slice-agent-loop

把 TT-Wang/dsh-slice-agent-loop 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-slice-agent-loop

中文

A conversational-context retention policy for DeepSeek Harness 0.1.7-rc.2 / 0.1.7-rc.1 (session format V4). It runs alongside the stock agent loop, keeping the host's lifecycle, scheduler, inbox, persistence, request-series handling and full request-reconstruction invariant. The patch is additive: it adds this plugin and nothing else.

History model: an append-only tape

At the first step of a turn, eligible assistant/tool spans from completed turns beyond history.keepRecentTurns (default 0) are sealed into frozen [slice tape v1 …] user/message surface replacements at their original positions, with source kind plugin:slice:history. Existing entries are never re-rendered or nested. Sealing preserves the surface prefix through the last existing entry; newly eligible older nodes are left in place rather than backfilled ahead of that prefix. Protected nodes can split a turn into several entries.

Every original human user message still present on the host surface stays verbatim at its original node, in every turn. User text is not copied into the tape. The system prompt (surface node 0, replaced in place only by the host) and every other system/message / developer/message node are never sealed or cited. Instruction messages, multimodal input and the newest runtime-context snapshot (source kind runtime-context) also keep their original sources and positions. Superseded snapshots can be absorbed with their turn only after the frozen prefix. A snapshot that becomes superseded later, before an existing entry, stays raw at its original position. Snapshot text is never rendered as a human request. Raw events remain in the session log and can be recalled after sealing, folding or resume.

Frozen entries preserve their bytes, but this does not guarantee that each request bills only one new entry: a seal can make everything after its position miss the provider cache, including retained raw turns. See Prefix behaviour.

Entry contents

One entry renders, in order:

  • a header naming the span: [slice tape v1 · turns N-M · K turn(s) sealed · recall_turn({"turn":"<n>","view":"dialogue"}) returns a turn's dialogue; expand_result({"seq":<q>,"formatVersion":4}) returns a tool result];
  • per sealed turn: [turn N], then every visible assistant text message in that span, in source order, each with a reply wrapper and its source locator; by default the entire text is preserved, including whitespace and messages preceding a tool call;
  • the turn's read index line (below);
  • the turn's tool lines — [tool turn N step S seq Q · <name> · <size> chars · expand_result({"seq":Q,"formatVersion":4})], at most 6 per turn, each pointing at the durable log record instead of repeating the text.

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-memory-connect 下一个 Next dsh-research →