dsh-injection-manager: Inspect and Control Context Injection Before the First Request

Preface

When running agent conversations in DeepSeek Harness (DSH), the first request is often packed with system prompts, runtime contexts, skill catalogs, tool schemas, and workspace rules. Most of this content does not appear in the chat interface and is difficult to turn off individually. The more skills and MCP services, the faster the repeated billing directory items and tool declarations will consume the context window, and attention gets diluted.

dsh-injection-manager is a community-maintained client-side plugin, released by IWHBIWHB on GitHub and in the SkillHub directory. It consolidates “what the next first request will carry, whether it can be disabled, and what it looks like after being disabled” into a single interface and command. It changes injection strategies via session-level switches rather than modifying files on your disk.

What is This

In a nutshell: Before the agent sends its first request, list and measure the prompt segments, runtime contexts, skill catalogs, tool schemas, and workspace rules that will be injected; allow opening the original text, toggling by suite, setting token budgets, and performing health checks and cross-session statistics.

  • Maintainer: IWHBIWHB
  • License: MIT (README badge)
  • npm package name: dsh-injection-manager, current version in docs is 2.0.1
  • Compatibility: DSH 0.2.2-rc.3+ (README badge)
  • Runtime Environment: Node >= 20 (package.json)

The plugin targets “Agent-first” observability: window pressure from occupancy comes from the host’s built-in contextPressure; each line’s token estimate is calculated by the plugin itself. The model-side tool context_injection is intentionally designed as read-only, with switches operated manually in the panel or commands.

Core Features

Four Interfaces, Each Answering a Question

Entry Question Answered
Manage (管理) What is in the next first request: cluster by suite, health check, inline preview and content drawer
Insights (洞察) How the first request changes with sessions: cross-session trends, composition, heaviest suite, current session event timeline
Settings (设置) Which strategy to apply: presets, master switches for four channels, prefix/suffix, budget, import/export, undo history, validation and version
Commands and Tools /inject in Composer, read-only tool context_injection, and the Composer chip’s line usage

Since 2.0.0, the panel has evolved from a “list with switches” to a control panel: content drawer (path, line number, search, copy, truncation hints), deterministic health items (e.g., heavy-suite, budget-gap, catalog-truncated), insights page, read-only routes, events.json / stats.json, and /inject health. Details can be found in the CHANGELOG and docs/DETAIL.md in the repository.

Managed Channels and Effects of Disabling

Channel Mechanism After Disabling
Prompt sections Session-level system-prompt/assemble filter drops segments by name Corresponding text no longer enters system prompt
Runtime contexts Same-name filtering (excluding required items) Approvals/sandboxes snapshots no longer enter first request
Skill catalog Session-registered same-name, non-callable skills That skill disappears from model’s visible directory
Tool schemas tools.restrict({ deny }) Definitions and parameters are no longer sent down
Workspace rules Read-only display Cannot be disabled via this plugin

Workspace rules (like AGENTS.md / CLAUDE.md) are injected by dsh-agent-instructions as user messages in agent/pre-step; DSH 0.2.2 has no public suppression hooks yet. The plugin does not edit these files; it only displays the actual injected body in the drawer and marks whether it is in the load path. Working directory, sub-agent identity, and other necessary contexts are also read-only.

Suite Grouping at a Glance

The list is grouped by suite by default, rather than hundreds of lines:

  • One MCP service = One suite (Reference machine in docs: 230 REA-related items consolidated into one line, approx 66,715 tokens, accounting for ~79.6% of the first request)
  • Non-MCP tools clustered by naming prefix; skills grouped by provider; paragraphs and contexts grouped by namespace

When disabling the entire REA suite, the demo data in the docs drops from ~83.8k tokens to ~17.1k; Undo can recover, and all are session-level registrations, not persisting to disk files.

Health Checks, Budgets, and Presets

The settings page allows configuring presets, master switches for the four channels, custom prefix/suffix, token budgets, and import/export/undo. The management page health bar provides items that can be addressed with one click for heavy suites, budget gaps, catalog truncation, etc. The sidebar and composer chip display a compact snapshot (e.g., first token and window occupancy percentage).

The UI supports zh / en / ja / es / fr / de / ru / pt (README badge).

Installation and Enabling

Installation command is based on the GitHub README:

dsh plugin add github:IWHBIWHB/dsh-injection-manager
# or: Plugins → Add plugin → pick this directory

After adding, refresh the page, and the Context injection (上下文注入) entry will appear on the left sidebar.

The plugin runs under current DSH process permissions. Please review the source code and MIT license yourself before installing; the community directory SkillHub and DeepSeek / Synthflow have no official affiliation; they are independent收录 sites in the DSH “everything is a plugin” ecosystem.

Typical Usage

Panel

  1. Open the left sidebar “Context injection”.
  2. Manage: View KPIs, request lines, and suite list; expand suites to see items; use the content drawer to read raw JSON, skill bodies, or full AGENTS.md.
  3. Insights: View cross-session first request trends, heaviest suite rankings, and current session event timeline (data includes source and coverage notes).
  4. Settings: Select presets, adjust budgets, export strategies; use undo history to rollback session-level switches.

Composer Commands

The /inject subcommands recorded in the README include:

  • health — Health-related reports
  • all / minimal — Full/minimal views of the strategy (see repo docs)
  • budget N / apply [N] — Application related to budgets
  • undo — Rollback session-level injection changes

Additionally, there is the read-only model tool context_injection (can pull snapshots, optionally full text of items), suitable for referencing numbers in orchestration without replacing manual switch toggling.

Applicable Scenarios and Notes

Who is this for

  • DSH users who have a large MCP mounted locally, hoard many skills, have opaque first request tokens, and want to “see then reduce”.
  • Developers who need to compare first injection trends across multiple sessions or troubleshoot whether a specific suite has been filling the window for years.
  • People who want to perform undoable experiments via presets and budgets but don’t want to manually edit prompt files.

Notes

  • All switches are session-scoped; they do not modify skill, rule, or MCP configuration source files in the repository.
  • The Workspace rules channel is observational only; it cannot disable the injection from dsh-agent-instructions via the plugin.
  • Percentages and token counts in the docs are real-world examples on the author’s reference machine/fixtures; your environment numbers will differ, so rely on the panel and /inject output.
  • The plugin’s GitHub stars are 0 (directory clue), not indicating feature completeness; issues can be raised at Issues.

Conclusion

dsh-injection-manager breaks the “invisible payload” of the DSH first request into a measurable list: you can read the original text, disable by suite, set budgets and undo, and track cross-session changes in the insights page. If you are currently worrying about context windows and MCP volume, you can install the plugin first and answer those three fixed questions on the Manage page—what the next round will carry, whether it can be disabled, and what remains after disabling.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye