The contextTimeline projection value rode every harness delivery channel WHOLE: each session.list row, every control baseline, every follow snapshot, and a full-value broadcast on every state change (with a full-value schema parse per push). The heavy collections (request records, context events, the served surface window, the removed-node archive) are only ever rendered by an OPEN Context tab/modal, so they moved off the wire value. Wire head (buildTimelineHead, ~1KB): the composition breakdown, the stats board's precomputed counters (turns/steps/injects/compactions/prunes), the newest request's billing summary (the headline's derived anchor), the timing/cost totals, and `detailRev` — a revision marker that bumps exactly on detail-mutating folds, the open tab's refetch signal. Detail channel (host/detail.ts): the pre-v0.9 generic Connection RPC shape returns as one narrow endpoint, `/dsh-context` `detail`, serving the collections off the registry's live fold state (`stateOf` — no second fold, no private copy). A nested `ctx.inject(['connection', 'sessions'])` arms it load-order-free; a deployment whose faces never compose keeps the inline wire value unchanged. The baseline-gate fallback path is untouched. Client (client/timelineSource.ts): one per-session detail store shared by the tab and the /context modal — fetch on open, then debounced trailing-edge refetches whenever the pushed detailRev outruns the served detail (single-flight, latest-wins by revision, refold reset, failure backoff, absence stops trailing). Detail-driven cards show a pending/retry note instead of a misleading empty state; the counters and headline render off the head immediately. Both wire generations are reconciled per value (new client + old host renders the inline value untouched; old client + new host degrades to empty charts in the stale-watch window, never a white screen). The chat-jump relay holds its one-shot pin until the detail lands. Fold state keeps the full shape: no stateVersion bump, no cached-row invalidation (the slim view is recomputed per read for cold checkpoints). Compat matrix gains the detail-channel seam probes (HostConnectionRpc, the browser caller, the registry stateOf), verified against the 0.1.2-rc.1 tag. Measured over 263 real session logs from a live deployment, plus live RPC: - per-session wire value: 84–150KB (top sessions) -> 0.6–0.9KB (~100-165x) - all sessions aggregate (session.list rows / control baselines): 4.4MB -> 0.2MB (~22x) - per-client push traffic over one big session's lifetime: 157MB -> 1.8MB (~87x), and the per-push full-value zod parse shrinks by the same factor - detail payloads now flow only for the session being viewed, only while its tab/modal is open (120KB measured live for the biggest session); background sessions cost zero detail traffic Verified visually against the running harness (big/small/cold sessions, a live turn refreshing in place, past-step reconstruction, header epoch and tool schema reads, the /context modal, the Agent network card) with byte-identical card output. 1110 tests, per-file 100% coverage.
dsh-context
The best DeepSeek Harness plugin for Agent's context insights and management.
dsh-context provides full context lifecycle management features.
- Context tab — an UI context dashboard for DeepSeek Harness's context stats, composition, trend, events, and messages.
/contextcommand — the slash command shows the context model for current context composition and recent context evolution.
Install / Update
To Install from any DeepSeek Harness installation:
dsh plugin --profile web add dsh-context
Or to update the dsh-context plugin:
dsh plugin --profile web update dsh-context@latest
Then start the web UI with dsh web. No build step, no restart.
Use it
Three surfaces, one story — what your agent is carrying, how it got there, and what it did with it:
| Where | What you get |
|---|---|
| Context tab | The full dashboard: stats, composition, per-request trend, events, file activity, and the agent network — in every session. |
/context command |
A centered modal with the same composition and context browser, without leaving the chat. |
| Settings → Plugin configuration | Per-user defaults: trend granularity & mode, File Activity sort. |
📊 The Context tab
Open any session and click the Context / 上下文 tab:
| Card | The question it answers |
|---|---|
| Context Stats | Turns, steps, live tool calls & images, context-event tallies — plus a list-price cost estimate (hover the ? for per-1M rates). |
| Token Stats | Where the billed tokens went: cache read/write, uncached input, output — around the cache-hit ring. |
| Timing Stats | How active time split across model calls, tool runs, and overhead. |
| Current Context | What's in the window right now. |
| Context Trend | Every request's size — and its story. |
| Context Browser | What any request was actually assembled from. |
| Context Events | When and why the window changed. |
| File Activity | What the agent did to your files. |
| Agent Network | The whole agent family, live. |
The headline occupancy and composition read the same official token-meter projections as the chat composer's context ring (contextPressure / contextBreakdown), so the figures always match what the ring tells you.
🧱 Current Context — who ate the budget
A six-color stacked bar against the model's full window (hatching = free headroom): system prompt, tool schemas, user messages, injected context, assistant replies, tool results — each with its ≈token figure and share. When a conversation starts degrading, this is where you see which part is responsible.
📈 Context Trend — every request, sized and explained
One stacked bar per model request — finer than per-message — so you watch the window grow turn by turn:
- ✨ Step brief — three plain-language rows under the chart: User recalls the message that opened the turn, In lists what newly entered (usually the previous tool results), Response shows the reply and/or tools called. Click a row to open that exact message in the Context browser.
- ✂ marks the events — compactions and prunes are pinned to the bar where they happened, so the drops explain themselves.
- Read it your way — Step / Turn granularity, Total (cumulative makeup) or Delta (each request's signed change), and sideways scrolling through the whole session. In Delta mode, growth piles up above the baseline and a compaction dives below it:
- Hover & pin — scrub for an instant tooltip; click to pin the full breakdown, with provider-reported Actual Prompt / Output / Cache next to the estimates.
- Live linkage — hovering a bar previews that step's assembled context in the Context browser beside the chart; leaving the chart returns to your own pick.
🧭 Context Browser — open the box of any request
Pick Live (next request) or any retained step, and browse what that request was assembled from: six collapsible categories expand into one row per element with its token price, and every element expands again into its actual content — the system prompt, each tool's JSON schema, message text, reasoning, tool arguments, and tool outputs.
- Who provides each tool — every tool-schema row carries a best-effort source chip:
tool-*first-party packages,dsh-*capability packages,mcp:<server>proxies, or the exact plugin watched live fromtools.register(). Sort by size / name, and filter every category by its own searchable fields:
- Tool results open into the full call — the tool name and arguments with its OK/error status, the result body with line count and a Raw / Markdown toggle:
- Image payloads render as cards — thumbnails with name, dimensions, stored size, and the official DeepSeek image-token estimate (the dsh multimodal pipeline, e.g.
read_imageresults and image attachments):
- Diff against the previous turn — signed delta badges per category (
+Nitems,±Nktokens) tell you what a turn added or reclaimed at one glance. Steps older than a compaction are reconstructed from the removed-message archive — and the card says so when a step's makeup is only approximate.
⚡ Context Events — when and why the window changed
Every injection, compaction, prune, model switch, and plan-mode toggle — labeled with its producer (instruction file, plugin id, skill name), its net token delta (compactions show what they reclaimed), turn/step, and time. The Inject / Compact / Prune / Switch / Mode chips filter the log by kind.
📁 File Activity — what the agent did to your files
One row per touched file — read, written, or searched — aggregated up to whichever step you pick on the trend chart:
- Per-purpose counts with header chips doubling as filters (Read / Written / Searched / Images) and a path search box.
- Line deltas — every
edit/writecontributes its estimated+added / −removedfootprint, per file and summed. - Every mode counts — native tools, the Minimal preset's
str_replace_editor, and the nested calls inside PTCrun_codeprograms are all folded into per-tool rows. - Searches land on real files — matched files get their own ops rows with hit counts.
- Click a row to expand its full operation log — every op jumps straight to the exact tool result in the Context browser.
🕸 Agent Network — the family portrait
The current agent, its parents, and every subagent — one node per agent, colored edges for the lineage, multi-level delegation on one map. Each ring is that session's composition scaled to its window occupancy; hover for tokens, requests, billing, and active time; click to jump into that session's own Context tab. Running agents breathe with a green pulse.
⌨️ /context command
Type /context (or pick it from the / menu) and press Enter:
A centered dialog opens with the Current Composition card and the Context browser — the same composition bar, per-step picker, and vs previous turn diff badges as the tab:
⚙️ Settings
In Settings → Plugins → Plugin configuration, the Context card holds this plugin's per-user preferences — default trend granularity (Step/Turn), default trend mode (Total/Delta), and the File Activity default sort. In-chart and in-card toggles stay per-view and never overwrite the stored preference.
Good to know
- Estimates vs actuals — category figures use dsh's own fixed-density heuristic (the same one as its built-in token meter); the pinned trend details and Token/Timing rings show provider-reported actuals next to them.
- Compatibility — works on
@deepseek-ai/dsh0.1.2-rc1+. The per-release matrix and how it is verified: docs/compatibility.md. - I18n — UI in English and 简体中文.
Like it?
If dsh-context helped you understand what your agent is carrying around, a ⭐ on GitHub is much appreciated — and issues/PRs are welcome!













