DSH plugin reference budget: route, options, then 64 KiB
In DSH plugin, how much a reference gets truncated depends not on how many sessions you selected but on which budget tier this prepare used: the last assembled route, agent options, or the 64 KiB fallback. The same reference behaving differently across sessions usually starts here.
DeepSeek Harness: Same reference, different truncation
First check whether the two sessions share a model and an assembly state. (source) Scene:
Session A: route assembled, 128k context -> reference complete
Session B: not assembled yet, agent options -> reference truncated
The user sees "same action, different result"; in reality the two prepares received different budgets.
The difference is not random but tied to session lifecycle: new sessions, sessions that just switched models, and sessions that have not sent a message yet can all land on different branches.
DeepSeek Harness: Three budget sources
Priority from high to low; a tier is used only when the previous one is unavailable. (source) Comparison:
| Order | Source | Used when |
|---|---|---|
| 1 | Last assembled route | The session has been assembled |
| 2 | agent options | Not assembled yet, but configured |
| 3 | 64 KiB | Model capacity or adapter missing |
The official wording: automatic budgets use the last assembled route, or agent options before any assembly.
Tier three is not designed for normal sessions; it is a fallback for incomplete information.
DeepSeek Harness: When 64 KiB applies
Only when capacity information is unavailable; it is not a global default. (source) Two triggers:
- Missing model capacity — no information about how much context the model can take;
- Missing adapter — no layer available to report capacity.
Either one makes prepare use 64 KiB. That is enough for a usable reference but far below a large-context model.
A frequent misdiagnosis: attributing truncation to 64 KiB when the session never took that branch. Confirm the assembly state before blaming the fallback.
DeepSeek Harness: Metadata failures are not budget problems
They fail prepare outright instead of degrading. (source) Rules:
- Other metadata query failures reject preparation;
- Cancellation rejects preparation and publishes no context.
The official material deliberately separates these from "missing capacity": the latter has a fallback value, the former does not.
If an implementation treats them all as "continue with 64 KiB", users get a context that looks normal but is incomplete, with no error to show for it.
The right approach is visible failure with a readable error code.
DeepSeek Harness: Budget follows the model
Not the number of references. (source) Three points:
- More references mean fewer messages retained per session;
- A larger model capacity pushes the truncation point later;
- Switching models and preparing again can change the result.
The third is often missed: switching models mid-session does not recompute context that was already prepared.
If a product needs consistency across a switch, trigger a fresh prepare at switch time instead of reusing the old result.
Another source is misapplied: treating the maximum output setting as the context budget. They measure different capacities, and conflating them truncates references too early.
If a product lets users limit reference size, map that limit into prepare's budget parameter rather than dropping a few messages on the host side — the latter leaves no omission facts.
Recording which budget tier was used matters too: the same reference behaves differently under route and options branches, and logs that omit the tier cannot explain it later.
DeepSeek Harness: Three verification groups
Three comparisons cover the three tiers. (source) Steps:
- Reference long content from an assembled session and record retained messages;
- Reference the same content from a new, unassembled session and record the count;
- Simulate missing capacity information and confirm 64 KiB applies;
- Make a metadata query fail and confirm prepare errors instead of returning empty context.
Groups 1 and 2 distinguish route from options; group 3 confirms the fallback; group 4 confirms failures are not swallowed.
When recording, do not stop at "was it truncated". Record retainedMessages and omittedBytes so different budgets can actually be compared.
After budget comes the truncation facts. Read DSH plugin truncation fields; for gaps caused by source compaction, read DSH plugin referencing a compacted session; for the wider picture, read how DSH plugin implements session references.
Sources: DeepSeek Harness reference - Session references, session-reference/src/index.ts
FAQ
Because the two DSH plugin prepares received different budgets. DSH plugin uses the last assembled route when available, agent options before assembly, and 64 KiB only when capacity or an adapter is missing.
No, 64 KiB is DSH plugin's fallback rather than a default budget. It is a fallback for incomplete information, used only when model capacity or an adapter is unavailable. A normally assembled session never reaches that branch.
No, DSH plugin rejects prepare on metadata failures instead of falling back. Both other metadata failures and cancellation reject it; only missing capacity triggers the fallback. Only missing capacity or a missing adapter triggers the fallback.
DSH plugin should trigger a new prepare if consistency matters. DSH plugin does not recompute previously prepared context automatically; the budget at prepare time decides how much was kept.
Related Terms
- last assembled route
- The last assembled route is the highest-priority automatic budget source, used once a session has been assembled.— DeepSeek Harness reference - Session references
- agent options
- Agent options are the second budget source, used before any route assembly has happened.— DeepSeek Harness reference - Session references
- 64 KiB fallback
- The 64 KiB fallback applies when model capacity or an adapter is missing, keeping preparation bounded without capacity metadata.— DeepSeek Harness reference - Session references
- retainedMessages
- retainedMessages records how many messages survived preparation, which makes budget branches comparable.— session-reference/src/index.ts
Sources
- DeepSeek Harness reference - Session references· deepseek-ai
- session-reference/src/index.ts· deepseek-ai