Reads the files that AGENTS.md references with @path imports and injects their content into model context, with byte budgets, compaction re-seeding and a six-language settings card. v0.3.x expands the imports of every instruction file the harness loaded, including a project AGENTS.md picked up mid-session (needs DSH 0.2.0+); use 0.2.x on DSH 0.1.7.
Install
# from npm (prebuilt)
dsh plugin --profile web add dsh-context-imports
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:ciskonc/dsh-context-imports
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
dsh-context-imports
Inject the files referenced from AGENTS.md into model context at session start.
DeepSeek Harness injects AGENTS.md itself, but the @path references inside it stay as plain text and the model never sees them. This plugin expands those references the way Claude Code does: it reads each referenced file and adds the content to the session context.
English | 中文
Why
| Without this plugin | With it | |
|---|---|---|
| AGENTS.md itself | Injected by the stock agent-instructions plugin | Still injected by it, no duplication |
@docs/architecture.md references |
Plain text, ignored | Full file content in context |
| Nested imports | Nobody handles them | Expanded recursively, depth limited |
| After compaction | Referenced files are gone with the history | Re-injected automatically |
| Resumed sessions | May stack a second copy | Skipped when one is already present |
How it works
agent/session-start (startup / resume / clear / compact) records the scene
agent/pre-step (every step) decides whether to inject
├─ scan the instruction files (default AGENTS.md, CLAUDE.md) for @path imports
│ ├─ fenced code blocks are skipped; the path must have a file extension
│ ├─ relative paths resolve against the importing file's directory
│ └─ duplicates collapse by resolved path, so import cycles are harmless
├─ merge the explicit files list (injected in full; instruction files are
│ scanned but never re-injected)
├─ budgets: 64 KB per file (truncated with a note), 128 KB total (skipped
│ with a note); a missing file becomes a one-line note instead of an error
├─ at most one injection stays in the active history: the full event log is
│ fingerprint-scanned, and compaction that removes the block re-enables it
└─ the bundle is appended to the end of the step messages, after AGENTS.md
and every other context injection
The injected message is a <system-reminder> containing <file path="..."> blocks and nothing else. Set template if you want your own framing around it.
Features
- Expands
@pathimports recursively. Default depth is 3; import cycles and duplicates are collapsed. - Follows the imports of every instruction file the harness loaded — including a project's AGENTS.md it picks up mid-session once the agent touches files under it.
- Triggers on new sessions, resume, clear, and after compaction. Each scene can be turned off.
- Never sends the same file twice: a file already in the model's context is left alone, and a newly loaded instruction file adds exactly its own imported files.
- Six-language settings card (zh, en, ja, fr, ru, ko) under Settings, Plugins, Plugin configuration. Every option is editable there and applies without a reload.
- Byte budgets per file and in total. Missing files are reported, never fatal.
- Uses the official API surface only: cordis events,
createUserMessagefrom dsh-llm, a schemastery config, and the optional dsh-settings namespace. No feature-plugin dependencies.
Configuration
| Field | Default | Description |
|---|---|---|
files |
[] |
Extra files to inject, relative to the session working directory or absolute |
scanImports |
true |
Scan AGENTS.md and the other instruction files for @imports |
instructionFiles |
["AGENTS.md", "CLAUDE.md"] |
Files to scan. They are never re-injected themselves |
expandLoadedInstructions |
true |
Also follow the imports of the instruction files the harness itself loaded, including a project AGENTS.md it brought in mid-session |
maxDepth |
3 |
How many levels of nested imports to follow |
maxFileBytes |
65536 |
Per-file cap in bytes; larger files are truncated |
maxTotalBytes |
131072 |
Total budget; files beyond it are skipped with a note |
injectOn |
all four | Which session-start scenes trigger injection |
template |
"" |
Custom wrapper text. {{content}} marks where the files go; empty uses the plain wrapper |
Install
dsh plugin --profile web add dsh-context-imports
It works with no configuration: AGENTS.md and CLAUDE.md are scanned and their imports injected. To build from source instead:
git clone https://github.com/ciskonc/dsh-context-imports.git
cd dsh-context-imports
npm install
DSH_CHECKOUT=<path-to-your-dsh-installation> npm run build
npm run build:client
Compatibility
| Plugin version | DeepSeek Harness | Notes |
|---|---|---|
| 0.3.1+ | ≥ 0.2.0-rc.1(0.3.1 tested on 0.2.1-rc.2 and 0.2.1-rc.3) | Current line. Adds expandLoadedInstructions: the imports of every instruction file the harness loaded are expanded, including a project AGENTS.md it brings in mid-session. Injection is incremental — a file already in the context is never sent twice. Needs the host's published instruction scopes (agent-instructions message source + agent.inbox.nextStep), so it targets DSH ≥ 0.2.0 |
| 0.3.0 | ≥ 0.2.0-rc.1(tested on 0.2.1-rc.2) | Same feature, but the inbox lookup read session.inbox instead of agent.inbox and therefore never fired — the step-batch path carried the feature on its own. Fixed in 0.3.1 |
| 0.2.3 | ≥ 0.1.7-rc.1(tested on 0.2.0-rc.1, 0.2.0-rc.2 and 0.2.1-rc.2) | Config access hardened: on DSH ≥ 0.2.0-rc.2 the volatile config projection no longer fills schema defaults, so every field is normalized at entry (0.2.2 could crash session creation or silently skip injection there). Note: on DSH ≥ 0.2.0-rc.2 install via dsh plugin add only — the loader verifies lockfile consistency, hand-copied node_modules are silently dropped |
| 0.2.0 – 0.2.2 | ≥ 0.1.7-rc.1(0.2.1 tested on 0.1.7-rc.2 and 0.2.0-rc.1; 0.2.2 tested on 0.2.0-rc.1) | 0.2.2 fixed re-injection after compaction and settings-page mounting, but on DSH ≥ 0.2.0-rc.2 it can crash session creation (injectOn.includes is not a function) or silently skip injection (cfg.files is not iterable) — upgrade to 0.2.3 |
| 0.1.x | 0.1.5-rc.1 – 0.1.5-rc.3(tested on 0.1.5-rc.2/rc.3) | Legacy line. Does not work on 0.1.7 — it waits on the removed settingsScope service and the removed agent/session-start event |
Each release note names the DSH version it was tested against.
Development
| File | Role |
|---|---|
src/index.ts |
Host side: session-start ledger, import expansion, budgets, pre-step injection, settings namespace |
src/client/index.ts |
Browser side: six-language dictionaries and the settings card slot |
src/client/form.ts |
Staged form model behind the card |
src/client/ContextImportsCard.tsx |
The card component |
License
Links
More in this category
vectorize-io/hindsight#coding-agents★ 58107
Hindsight, agent memory that learns: long-term project memory with auto recall and retain, knowledge pages, deep reflection, and per-repo memory banks.
volcengine/OpenViking#examples/dsh-memory-plugin★ 41402
OpenViking memory and context bundle for DeepSeek Harness: pre-step auto-recall and profile injection, session capture, `viking://` URI guarding, and recall/write memory tools backed by an OpenViking server.
MemTensor/MemOS#memos-local-plugin★ 12229
Local-first memory plugin for DeepSeek Harness: layered L1/L2/L3 memory with automatic capture, manual memos_* retrieval tools, and a built-in memory viewer.
agentscope-ai/ReMe#dsh★ 3742
Connects DeepSeek Harness to ReMe's local-first, self-evolving personal knowledge base: automatically captures completed main-agent conversations as user-owned Markdown memory, searches conversations and source material through reme_search with BM25, optional embeddings, and wikilink expansion, and schedules daily memory consolidation.
zilliztech/memsearch#MemSearch★ 2816
Shared Markdown memory for DSH and other coding agents, with automatic capture, pre-step context injection, searchable recall, and memory-to-skill self-evolution through a review panel.
vshulcz/deja-vu#extensions/dsh★ 1375
Reads the session files forty-two other coding agents on this machine already wrote (Claude Code, Codex, Cursor, VS Code Copilot Chat, opencode, OpenClaw, Hermes, Kimi, Cline, Zed and more), including sessions from before it was installed: six tools (deja_recall, deja_session, deja_blame, deja_fix, deja_how, deja_remember), a /deja command, and optional automatic recall added to the runtime context. Local BM25 index, no LLM, no embeddings, no network (dsh plugin --profile web add dsh-deja).
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.