TT-Wang/dsh-slice-agent-loop ↗★ 6
@dsh-external/dsh-slice-agent-loop
Durable context retention and recall policy for the stock DeepSeek Harness agent loop 适合需要精细控制历史会话 Turn 保留数量以优化上下文窗口的用户。
Install
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:TT-Wang/dsh-slice-agent-loopREADME
Read the full README ↗Configuration
- id: slice-agent-loop
name: '@dsh-external/dsh-slice-agent-loop'
config:
defaultReasoningEffort: inherit
fold:
pinSteps: 0
history:
keepRecentTurns: 0
| Setting | Meaning |
|---|---|
history.keepRecentTurns | Completed turns whose eligible assistant/tool spans stay raw at the tail (default 0: seal at the first step of the next turn). All original human user messages stay raw regardless of this value. Raising it retains more original assistant/tool structure; unchanged raw turns may still hit the cache, but sealing an older turn can invalidate the prefix before that tail. There is no pressure threshold or fallback size target. |
history.entryMaxChars | Optional cap on each new entry, in Unicode code points; omitted by default. Explicit values must be safe integers of at least 256. Enabling it permits assistant-text/index reduction with recall markers. It cannot shorten original user nodes and does not cap the whole tape. |
maxStepsPerTurn | Optional positive step cap. Omit it to let the stock loop control termination; set it explicitly to stop before dispatching beyond that many model steps. |
defaultReasoningEffort | off, low, high, max, or inherit (default). By default, the host/model chooses the reasoning budget; an explicit request choice always wins. Capability-gated: the default is injected only when the resolved model declares that effort (declaredEfforts in src/effort-default.ts); unknown capabilities keep the adapter default; a declared capability that omits the requested effort warns once per route. |
digest | Content-routing options from src/slice/result-digest.ts. |
fold | Tool-result folding options: enabled, pinSteps, pinMaxChars, spillPreviewMinBytes, backoffAfterExpansions. |
fold.pinSteps / pinMaxChars | Position-based protection is opt-in (pinSteps: 0 by default). If enabled, results smaller than pinMaxChars (default 8,000) in those first steps remain raw. Content-based protections apply at every step. |
fold.backoffAfterExpansions | Default 2 distinct folded result blocks fully retrieved, with a full-retrieval rate of at least 50%, stops future folding for that tool/resource for the session. Resource identity is the exact file_path/path, or, without a path, the complete arguments with object keys sorted. Partial grep/lines queries and repeated retrievals of the same block do not advance backoff; other resources remain eligible. The spill path uses the same rule. |
Upgrading an existing profile
Updating the plugin does not remove explicit values from your profile. To adopt the current defaults:
- Remove
maxStepsPerTurn: 50(or another existing cap) to let the stock loop control termination. Keep a positive integer only if you want an explicit step limit;0andnullare invalid. - Remove
defaultReasoningEffort: lowor change it toinheritto use the host/model choice. Explicit request-level choices still take precedence. - Remove
fold.pinSteps: 2or set it to0to apply content-based folding from the first step. Recognized source code, error results and recalled originals retain their existing protections. Resource-scoped backoff applies automatically. - Remove
history.pinFirstTurnandhistory.pinUserChars; both are retired and now prevent loading with migration guidance. Every original human user node is preserved, so neither a first-turn switch nor a user-excerpt budget applies. - Remove
history.entryMaxChars: 8000(or another explicit cap) to preserve all assistant text in future entries. Retain a valid value only if you deliberately want bounded entry text and recall-based recovery. - Remove
maxRequestCharsandmaxHistoryChars; these retired keys now prevent the plugin from loading.
Keep any supported override you intentionally want. Existing frozen tape entries are not rewritten: previously clipped content is still available through recall, but upgrading does not automatically restore it to the surface. The new preservation rules apply to future seals and the text then present on the host surface; they do not resurrect content already hidden by host compaction or another plugin.
The request budget is gone. Entries replace tool-result/reasoning bodies with recallable records while keeping visible dialogue by default, and accumulate with the conversation; neither total history nor the open turn has a hard size bound here. Configure context-window handling in the host composition. Preserving longer dialogue can increase context use and input cost; the tape alone does not prevent overflow. The plugin does not reject requests based on their character count or shrink the tape by rewriting existing entries.
- Retired user-retention keys now fail at load: remove
history.pinFirstTurnandhistory.pinUserChars. All original human user messages stay in place; there is no replacement user-text budget. - Retired budget keys now fail at load: remove
maxRequestCharsandmaxHistoryChars. They previously parsed without enforcing a limit; accepting them silently suggested protection that did not exist. Configure context-window handling in the host. - Fail at load, naming where each went:
history.highWaterChars,history.lowWaterChars,history.keepRecentChars,history.checkpointMaxChars(Retired history configuration : …— replacements arehistory.keepRecentTurns, counted in turns, andhistory.entryMaxChars; the two water marks have no counterpart, because there is no pressure threshold left to cross), plus the retired driver keysmaxParallelToolCalls,inTurnSeal,tape,state(Retired slice configuration : …). modeaccepts onlyslice;stateandstreamfail at load. An unrecognised key in either section fails with the valid-key list.
Entry headers are [slice tape v1 …], warn messages are prefixed slice tape:, and the retired [slice checkpoint v1 …] / # SESSION TAPE replacements still parse: a session recorded by an older build resumes with them as ordinary sealed entries. Entries from a format-3 session come back from the host's V3→V4 restore with source kind plugin:slice:history and unchanged text, and remain frozen.