DSH Plugins Marketplace

DSH Plugins

Plugins

/

Tools & Capabilities

/

dsh-context-monitor

d

dsh-context-monitor

Manifest valid

Context usage for DeepSeek Harness — a usage ring in the composer status row whose popover splits the context by messages, tools, system prompt, skills and memory files, and a Context Lens tab listing

UI (client)hasBundlePatch

dsh-context-monitor

Renamed from dsh-context-lens on 2026-11-11 and from dsh-claude-context on 2026-11-16 (its API routes, tab kind and saved state keep the context-lens names, so open tabs and preferences carry over).

Part of a set of independent DeepSeek Harness UI bundles: dsh-composer-display (the input box and what sits on it), dsh-conversation-enhancer (the conversation view), dsh-whale-theme (background, glass, fonts and its own Settings › 主题 page) and dsh-context-monitor (context usage in the composer and in a 上下文透视 tab). Each one works on its own; they share one build script, vendored here as scripts/.

A DeepSeek Harness bundle that shows what is in a session's context, in two levels.

Install

client.js is committed, so a checkout runs as-is — no build step is needed to use it.

  • GUI: 插件 → 添加插件 → 安装第三方插件, enter github:DaYangtuo247/dsh-context-monitor (or the absolute path of a local checkout), then enable the bundle in 设置 › 插件.
  • CLI: dsh plugin --profile <profile> add github:DaYangtuo247/dsh-context-monitor, then enable it in 设置 › 插件.

Built and tested against DeepSeek Harness 0.2.2-rc.3 (DSH NEXT 2.0.23).

Compact view

A usage ring in the composer's bottom status row (conversation.composer.dock), taking the place of dsh's built-in context-meter percentage (that meter is not a slot, so CSS hides it only while this ring is mounted; disable the plugin and the built-in one comes back). Click it for a compact popover: a header with 查看上下文透视 → (the model and window are in its tooltip); % used used / window with a chip for what is left before compaction; a stacked bar in the same categories and colours as 概览; a one-line caption with the compaction threshold and where the number comes from (the pre-compression size is in its tooltip); then rows on two levels, each named in Chinese with its English term. The top level is these groups (消息 Messages, 系统工具 System tools, MCP 工具 MCP tools, 系统提示 System prompt, 技能 Skills, 记忆文件 Memory files), biggest first. A group with more than one part has a small chevron after its name (no empty arrow column, so every row's dot lines up): 消息 opens into 概览's categories (工具结果, 思考过程, 工具调用, …) and 记忆文件 into the AGENTS.md / CLAUDE.md files in context. After those come the autocompact buffer, free space, and deferred MCP / system tools with the size they would add if loaded (shown as — % because they are not in context). Tool and skill lists are left to the full view, to keep the popover short. Hovering a row or a bar segment highlights both (a group lights all its segments; the rest dims), and every non-empty part keeps at least a visible sliver of the bar. It pops in, the usage counts up, the bar sweeps open and the rows fade in one after another (off under prefers-reduced-motion).

上下文透视 / Context Lens

One tab in the conversation's top View row (next to 对话 / 轨迹), always for that conversation and always live: it refreshes whenever the contextPressure projection changes (every 5 s when it is absent). Its sections are switched by a segmented control in a sticky toolbar (not a second underlined tab row), which also shows live usage (% · used / window) and a 实时 indicator; toolbar and content use the full width of the view (charts draw at their real pixel width, so text and height stay fixed), and the last section is remembered. The view only reads the context, so while it is open the conversation hides its composer area (input box, task dock and status row: [data-composer-seat]) and its chat-width drag handles ([data-width-handle]), both scoped by [data-conversation-content]:has(.clx-pane); switching back to 对话 or any other view brings it back. Every list (概览's 分类明细, 消息, both 工具 tables, 技能, 记忆文件, the 轨迹 turns) uses one item style: rounded rows with no hairlines and a chevron. Opening an item grows that row into one block tinted in its category colour (header and content together); the content lines up with the row's text column, a nested list puts its arrows under the parent's dot, and a nested open item is a lighter block inside the tint. Expanded text has no inner box: a slim line with size and the 渲染 / 原文 switch (time and call id in its tooltip; part labels only when a message has several parts or is a tool call), then the content, with code and JSON on a lighter panel; dsh's code-block banner is reduced to its copy button. The view and the popover are marked translate="no", so page-translation extensions don't duplicate previews and JSON. Sections animate in (cards rise, list rows fade, bars grow) and the section switcher's pill slides between sections; all motion is off under prefers-reduced-motion.

  • 概览: a usage card (ring, % used, used / window, where the number comes from, model, max output, compaction threshold and what is left before it, the stacked 13-category bar); 分类明细 as clickable rows, each named in Chinese with its English term next to it (tokens, share bar, % of used, item count; % of window and the raw estimate on hover). Clicking a row shows what is in it: tool definitions with descriptions for 系统工具 / MCP 工具, catalog entries for 技能, each AGENTS.md / CLAUDE.md file and its size for 记忆文件 (agent-instructions messages, split by file), injected-context sources for 注入上下文, and the largest messages (expandable in place) for the others, with "show all N in Messages" that opens 消息 filtered to that category. Then 上下文增长 (the former 趋势 tab: cumulative growth by node with threshold / window lines and click-to-jump, or tokens added by turn), the compaction policy, and an always-open 计算口径与原始数据 (calibration, last request usage and cache hit rate, event type counts). The usage card's stacked bar is interactive: hover a segment or legend item to preview that part, click to pin it (click again to clear). The rest of the bar and legend dims and the matching 分类明细 row is tinted; the tooltip gives its tokens, % of window, % of used and item count. Free space and the autocompact buffer can be highlighted too. Opening 概览 animates it: cards rise in one after another, the usage % and token count count up (the ring follows them), the stacked bar sweeps open, category rows slide in and their bars grow in turn, the growth line draws itself, and an opened category drops into place; live changes ease from the old value to the new one. All of it is off under prefers-reduced-motion.
  • 执行流程: the conversation's lifecycle diagram: 会话开始 → 用户输入 → 回合开始 → [智能体循环: 模型请求 → 模型输出 → 工具调用 → 工具执行 → 工具结果 → 子智能体 → 待办 → 步骤结束 ↺] → 回合结束 → 上下文压缩, with side nodes for goal / goal rounds / queued input / context injection / approval / model switch / plan mode / schedule / title / deliverables / workspace changes. It shows where the conversation is, not a replay:
    • Live (default): the stage the conversation is in now glows (idle → 用户输入; model generating; tool job running; waiting for approval), and the path the current step has taken so far is drawn as numbered nodes joined by moving arrows. While a turn is open the section refreshes every 2.5 s. The status card shows the phase, turn / step, running jobs and pending approvals with elapsed time, the last event, and the current context (used / window, compaction threshold, composition bar).
    • Node figures: each node shows a grey ×N (how many times it happened) and, for stages whose content is in the context, the tokens it holds now in bold (模型请求 = tool definitions, 上下文注入 = system prompt + skills + memory files + injected context, 用户输入, 模型输出 = text + reasoning, 工具调用, 工具结果, 上下文压缩 = summaries). A count never stands in for tokens or the other way round.
    • Counting rules (checked against the event log): a prompt sent while idle reaches the agent through dsh's inbox (agent/inbox/spliced insert, then a claim when the turn starts, then the user/message); that whole chain is one 用户输入. 排队输入 counts only input added while a turn is running (into the next step or next turn); claims are not shown, cancels are. [工具执行] counts background jobs (job/registered; bash and the like), not start + finish events; tools without a job run inline and go 工具调用 → 工具结果 directly. 模型输出 includes aborted/retried attempts.
    • Trajectory: every model request (step), grouped by turn, oldest first like the conversation (the list stays pinned to the newest step while you are at its bottom, and the turn header sticks while scrolling), with its tools, errors and the real prompt size it sent (bar = share of the window). Pick a step (or click a diagram node to jump to the latest step that passed through it) to see the stages it went through in order, its tools, cache hit and output, and the context composition at that request: nodes appended before it plus tool definitions, scaled to the prompt the provider reported. ‹ / › walk the steps; 回到当前 returns to live.
    • The goal card shows objective, phase, rounds and history when a goal is set.
  • 消息: every context node with category filter chips, search, order / size sort. Click one to read its full model-visible content, rendered with dsh's own primitives (the ones 轨迹 uses): Markdown for text and reasoning, a collapsible JSON tree for JSON, highlighted code for tool output, with a 渲染 / 原文 switch and a fold for long parts. A message that touched a file (read / edit / write / read_image …) also gets a 预览 button that opens the real file in dsh's right Sidebar (the same document preview 记忆文件 uses), so Markdown, code and images render there rather than inline — an image result is only metadata here, so the sidebar is the one way to actually see it. The path is the result's resolved <path> or the call's file_path (made absolute against cwd); the button reports inline when the sidebar or a matching preview is absent. Tool output that dsh truncated (head + [...] + tail, rest spilled to a file) is flagged with the spill path. Tool calls and results are kept together: in order sort a result row sits indented under the message that called it (↳ #43, labelled "read 的结果 ← #41"), and a calling message is labelled "调用 read×2, bash". Opening a message that made tool calls shows each call (name, arguments) with its result directly below it; opening a tool result shows the call that asked for it first. A call with no result says so (still running, interrupted, or compacted out), as does a result whose call is no longer in context.
  • 工具: tool definitions as rows (kind, parameter count, cost bar, tokens); open one to read its full description rendered, every parameter with type, required / optional, description and enum values, and the raw JSON Schema (fetched on demand from the tool route). Tool usage rows (calls, call tokens, results, result tokens, largest result, a call / result bar) open to that tool's invocations in time order (the latest 20, with a button for earlier ones): one row per call, showing #call → #result, its arguments, a result preview, an error flag, and a call / result bar with the total; expanding it shows the call and its result together. File-touching invocations carry the same 预览 button as 消息. Shell tools (bash and the like) are left out of that table and get their own 命令执行 card, because a command can fail, run long or keep going in the background: status filters 全部 / 失败 / 慢 (≥ 10 s) / 后台 with counts; on the left (on top, laid out across, when the card is narrower than 880 px) a summary (runs, total time, failures and rate, background runs), 值得注意 (slowest command, program with most failures; click to jump or filter) and the programs the commands ran (parsed from the command line, cd / assignments / shell keywords / heredoc bodies left out and a leading $VAR resolved from earlier assignments, so a python3 - <<EOF script counts as python3, not its body; ×uses · runs, a bar, click to filter; a failure is charged to the last program, whose exit code the line returns); on the right the commands, newest or slowest first, with a text filter. Each row shows ✓ / ✕ / a spinner, a leading cd <dir> && as a small folder chip (last path segment; full path on hover) so the command itself stays visible, the command with programs, operators, redirections and strings picked out, badges (exit code, 后台, 内联 when there is no job), duration and T1 S100 · time. Opening one shows its description, exit code, duration, job, directory, output size and whether it is still in context, then the command and its output together. Records come from the event log (tool/call → job/registered / job/settled → tool/result), so commands compacted out of context still count; the exit code is read from the job's exit code: N detail or the output's [exit code: N]. Deferred tools are listed below.
  • 技能: every skill the registry offers this session's agent (ctx.skills.list({ cwd, scope })), merged with the session's skill catalog and the skills actually loaded (<skill_content> in a skill tool result or a /name injection). Each shows its full description, when-to-use, path, provider, source, invocation policy, catalog cost, load records (click to open the message) and the full SKILL.md, rendered. Filter by loaded / in catalog / not in catalog, or search.
  • 记忆文件: two columns (stacked below about 1020 px): on the left a 文件结构 tree, styled like a folder-structure guide: the files and folders dsh reads for this conversation, each with connector lines, a dotted leader and a coloured pill saying what it is for — the project root (or working directory without .git) with AGENTS.md / CLAUDE.md / .local overlays, .git/, .dsh/skills/ and .agents/skills/, plus each level down to the working directory; ~/.dsh/ ($DSH_HOME) with AGENTS.md, skills/, cordis.patch.yml, profiles/<current>/cordis.patch.yml (from the launcher's profileContext), .env and sessions/; ~/.agents/ ($DSH_AGENTS_HOME) with AGENTS.md and skills/. Each entry shows what is on disk now — ✓ loaded (with tokens; the pill is still a link to that file's message), size, skill count, or 未创建 (faded) — and skill folders list their skills (five, then 还有 N 个) with the registry's description. Clicking any file row opens that file in dsh's own right Sidebar (the document preview tab: Markdown, code, images, PDF and Office, plus its file tree, line navigation and reload controls) instead of rendering its content here, so this plugin never has to read or render a file; the tab reports noSidebar / noViewer inline when the right Sidebar or a matching preview is not loaded. Colours: green roots, orange memory files, skill colour for skills, teal config, blue data. On the right, the workspace instruction files dsh-agent-instructions loaded (AGENTS.md / CLAUDE.md and their .local overlays: ~/.dsh/AGENTS.md, ~/.agents/AGENTS.md, then each level from the project root to the working directory), with status (active / updated / removed / replaced by a new baseline), token cost and rendered content; each one also has a 在右侧栏预览 link that opens the file as it is on disk in the right sidebar, while the rendered content stays the in-context snapshot; with a one-line empty state pointing at the tree when nothing is loaded. Below it, 运行时上下文: the environment facts dsh attaches to every request (working directory, file sandbox, approval policy, harness source, web URL, time), as a label / value list with the raw section key on hover and a link to the message; it is labelled as not part of memory.

How the numbers are made

  • Used is what the next request will occupy:
    • When tokenMeter could anchor to provider usage, its total is used directly ("按实际用量校准").
    • Otherwise the plugin uses the last request's reported prompt (input + cache read + cache write) plus every context node appended since ("按上次请求实际用量推算"). This is the same figure the contextPressure projection publishes.
    • The meter's own surface estimate is shown as 原始上下文估算(压缩前). The difference is what request-time compression (e.g. billion-context folding) saved.
  • Categories:
    • The meter prices each context node.
    • Nodes are classified by event type and message source:
      • system-prompt
      • skill-catalog
      • runtime-context / time-context → injected
      • compact-checkpoint → summary
      • user, assistant text / reasoning / tool calls, tool results
    • Assistant nodes are split across their parts in proportion to a character heuristic (CJK = 1 token/char, otherwise 4 chars/token).
    • Tool definitions are priced with the same heuristic. A tool named mcp__<server>__<tool> counts as MCP.
    • Everything is then scaled by one calibration factor so the categories sum to used. When request-time compression is active, the real split differs from these proportions.
  • Auto-compact:
    • compaction-basic: threshold = min(window × thresholdRatio, window − maxTokens − headroomTokens), read from the live instance config and model overrides.
    • billion-context (it disables stock compaction): the forced-compress nudge (compress.maxContextLimit, default 75%) and emergency truncation (compress.emergencyThresholdPercent, default 95%). Defaults are labelled when no custom value is found.
    • Buffer = window − threshold. Free = window − used − buffer.

Host routes (read-only, owner-authenticated shared connection)

  • POST /api/context-lens/breakdown {sessionId} — category totals, tools (deferred ones sized too), skills, memory files in context, per-node sizes (tool results carry callId / callSeq, assistant messages their calls), invocations (every tool call paired with its result by call id: name, args, call / result seq, tokens, result preview, error), commands (one record per shell call: command, description, programs, turn / step, call / result seq, job, duration, exit code, status ok / failed / running, slow, background, inline, output preview) with shellTools and slowMs, calibration and compaction policy
  • POST /api/context-lens/flow {sessionId} — session events mapped to lifecycle stages, goal fold, turn summaries, per-step trajectories (stages, tools, errors, usage, prompt tokens) and the live state (phase, stage, open jobs, pending approvals)
  • POST /api/context-lens/node {sessionId, seq} — full content of one node (capped at 120k chars); a tool-call part also gets its result's resultSeq, and a tool result gets the call that asked for it
  • POST /api/context-lens/sources {sessionId} — memory files (loaded, plus every candidate location on disk), skill registry / catalog / loads, runtime context, and structure (the file-structure tree: each node with role, path, exists, loaded / tokens, size, skill items)
  • POST /api/context-lens/skill {sessionId, name} — one skill's full instructions from the registry
  • POST /api/context-lens/tool {sessionId, name} — one tool's full description, parameters (type, required, description, enum) and JSON Schema from the session's request header
  • POST /api/context-lens/sessions — live sessions held by the Host (unused by the current UI)

A session must be loaded on the Host. Opening it in the web UI is enough.

Files

  • index.js — Host half: classification, calibration, compaction policy, flow, sources, routes. Uses the optional skills and agents services when present.
  • client.js — Built by build.mjs from src/ (edit the sources, not this file). Browser half: composer dock ring + popover (conversation.composer.dock), top View tab (conversation.view). File rows in 记忆文件 open through the right Sidebar's ctx.sidebarRight (dsh-resource://file/session/… addresses), so the built-in document preview does the reading and rendering. No third-party libraries (Markdown / JSON / code rendering reuses @deepseek-ai/dsh-client-ui-primitives, with a plain fallback); theme colours come from --dsw-alias-* tokens, and literal colours are used only for the categorical data palette.
  • cordis.patch.yml — inserts the context-lens row.

Develop

Edit the sources under src/ (TypeScript, checked by tsc), then rebuild client.js:

pnpm install            # once: sass + typescript
pnpm build              # tsc -p . → .build/{lib,parts}, Sass → .build/styles, then client.js
pnpm typecheck          # types only
pnpm check              # build + corner-shape gate + .verify/smoke.mjs
  • src/lib/ holds the dictionaries (i18n.ts) and the category palette and formatters (data.ts) — no part() call in there.
  • src/styles/00-text.scss is the whole stylesheet; the shared build compiles it to CSS_TEXT in .build/styles/, and src/lib/styles.d.ts declares that global for tsc.
  • src/parts/01-context-lens.ts holds every component plus the two slot registrations (the composer dock ring and the 上下文透视 tab).
  • TypeScript runs in script mode — no import/export anywhere: build.mjs concatenates src/lib/*.ts then src/parts/*.ts into one IIFE, so all files share one global scope and src/types.d.ts describes what is already in scope (part, the kit surface, Kit / PartContext / PartModule).

.verify/smoke.mjs is this bundle's gate: it loads client.js the way the harness does (stub React, stub page), then checks the module id, the locale namespace and its 444 keys, both slot registrations with their ids and orders, and compares the compiled stylesheet byte for byte with .baseline/css.txt. .baseline/client.js is the pre-migration bundle, kept for reference.

License

MIT — see LICENSE. Copyright (c) 2026 DaYangtuo247. DeepSeek Harness and the DeepSeek name belong to their owners; this bundle is an independent add-on and ships no DeepSeek code.

Comments

Loading…

Similar plugins

dsh-command-context

by Lovenndme

Adds a /context slash command to DeepSeek Harness: shows how much of the session context window is used, how much is free, and a per-category breakdown (system prompt, memory files, skills, messages,

Tools & CapabilitiesSessions & MessagesManifest valid

★ 1

MIT

JavaScript

Nov 3, 2026

dsh plugin --profile web add dsh-command-context

by icanfinish11

Context window optimization for DeepSeek Harness agents. Sandboxes tool output in-process (only what you print enters the conversation), persists session memory in an FTS5 knowledge base, and enforces

Sessions & MessagesManifest valid

★ 9

↓ 127/wk

JavaScript

Sep 9, 2026

dsh plugin --profile web add dsh-context-mode

by AllShadowAnan

User-set absolute context ceiling for DeepSeek Harness: auto-compacts a session once it reaches a configured token limit. External plugin with a dedicated Settings page.

Terminal & ClientsSessions & MessagesManifest valid

★ 2

MIT

JavaScript

Oct 8, 2026

dsh plugin --profile web add dsh-context-compressor

by majia007

Context profiles for DSH (deepseek-harness): pick which tools and which system prompt each new conversation receives.

Sessions & MessagesManifest valid

★ 0

MIT

JavaScript

Nov 17, 2026

dsh plugin --profile web add @jia-tools/dsh-session-context-config

by Hanochhu

Context offloading for DeepSeek Harness: consumed tool calls and their results are replaced in the model-visible history by a short stub, while the originals stay in the session log for replay.

Sessions & MessagesManifest valid

★ 0

MIT

JavaScript

Sep 24, 2026

dsh plugin --profile web add dsh-context-offload

Context fullness bands, the per-session compaction threshold derived from the model window, per-step cost computed from cache read and cache write rates, cache-hit, DeepSeek balance with the peak/off-

Tools & CapabilitiesManifest valid

★ 0

dsh plugin --profile web add dsh-context-governor