Sessions & Messages

dsh-magic-context

xiaohj233/dsh-magic-context/packages/dsh-plugin · ★ 7

xiaohj233

Magic Context — DeepSeek Harness adapter (Host / Agent / Client + profile bundle). Loads the shared Magic SQLite store and registers ctx_* tools, /ctx-* commands, knowledge injection…

License
MIT
Added
2026-10-30
Maintenance
active
Install kind
github
Manifest details
Manifest status
Declared
Manifest path
package.json#dsh
Manifest checked
2026-10-30T14:25:27.095Z
Lifecycle scripts
None found

Static manifest checks report declarations only; they are not compatibility or security review.

安装

dsh plugin --profile web add 'github:xiaohj233/dsh-magic-context#6c82abd4d75c63516421c6e1692d1b7d1636b8e4&path:/packages/dsh-plugin'

GitHub 源码安装:首次需按提示配置 allowBuilds 构建授权后重试

For install and environment setup, plus plugin development tutorials, see DSH community docs ↗

README

Source README · body: en · Read Chinese README

Table of contents
  1. About
  2. Installation
  3. Feature overview
  4. Verification status
  5. Constraints & boundaries
  6. License

English | 中文

Version DSH Magic Context Harness Community Tests License

A community port of Magic Context — tested and built in the Magic Context monorepo development worktree; this repo is the release mirror (dist prebuilt and shipped with each tag) to DeepSeek Harness (DSH). Not affiliated with the official DSH or Magic Context projects; capability alignment is tracked in Features.

E2E harness


About

An adapter layer that ports Magic Context to DSH: DSH sessions can use Magic Context's knowledge injection, context management and memory, while sharing the same SQLite store as OpenCode/Pi (harness='dsh' row isolation) with zero changes to OpenCode/Pi behavior.

Use cases:

  • Reuse existing Magic Context memories in DSH (shared with OpenCode/Pi).
  • DSH sessions that want m0/m1 knowledge injection, §N§ tags, historian compaction, and Dreamer scheduled tasks.
  • DSH users who want the /ctx-* tool family (search/memory/note/expand/ reduce/embed/recomp/wrapup).

Installation

In your DSH profile's package.json (the profile directory is $DSH_HOME/profiles/<name>/; dsh plugin --profile <name> install runs there automatically):

{
  "dependencies": {
    "dsh-magic-context": "github:xiaohj233/dsh-magic-context#v0.1.0&path:/packages/dsh-plugin"
  },
  "dsh": {
    "profile": {
      "bundles": ["dsh-magic-context"]
    }
  }
}

⚠️ Keep your profile's existing dsh.profile.bundles entries (e.g. @deepseek-ai/dsh-base, @deepseek-ai/dsh-web-app, @deepseek-ai/dsh-headless) and only append "dsh-magic-context".

Then install dependencies and restart dsh:

dsh plugin --profile <name> install
# or: cd $DSH_HOME/profiles/<name> && pnpm install

After restarting, initialize:

dsh-magic-context setup    # generates the magic-standard thin preset
dsh-magic-context doctor   # verifies the install

Select the magic-standard preset for new sessions (Web UI: Settings → Agent preset, or settings.yaml: agent-presets.default: magic-standard).

⚠️ Prerequisite: Magic's agent-side capabilities (knowledge injection, ctx_* tools, /ctx-* commands, historian, Dreamer, the Magic compaction policy) are loaded only in sessions that select the magic-standard preset. Sessions without it run with pure official semantics — only the host side stays resident (shared-DB initialization + status/diagnostics endpoints), with no Magic intervention. To make the plugin effective by default, set settings.yaml's agent-presets.default to magic-standard.

The adapter package (dsh-magic-context-adapter) is resolved automatically by the main package's github: dependency — no separate install needed.

The first session automatically creates the shared SQLite (~/.local/share/cortexkit/magic-context/context.db).

Feature overview

  • Knowledge mode: m0/m1 baseline injection (incl. Mural images), auto-search, §N§ tags
  • Context management: DshTranscript + SurfaceMutationCoordinator (CAS + outbox saga), historian background compartments, Magic compaction policy, cache classification SOFT+/SOFT/HARD
  • Automation: all Dreamer tasks, Sidekick /ctx-aug, /ctx-recomp /ctx-wrapup /ctx-session-upgrade, /ctx-embed, feedback bridge
  • Maintenance: setup/doctor, upgrade contract gate, no-write-back safety (shipped preset mounted read-only)
  • Web: status card + Remote diagnostics endpoint

Full parity table: docs/FEATURES.md.

Verification status

  • 177/177 tests green (dsh-plugin) + adapter-api 14/14 + typecheck 0 errors
  • Install verified on an isolated non-global DSH: npm install → setup (thin preset) → doctor 6/6 → thin-preset mount → knowledge injection (m0/§N§ tags) → real model path (local relay deepseek-v4-flash answered with the Magic-injected context) → shared SQLite harness='dsh' rows written
  • OpenCode/Pi unchanged (shared DB compatible)

Constraints & boundaries

  • No DSH source modifications; never rewrites llm/stream messages[]; OpenCode/Pi behavior unchanged.
  • Compatibility baseline: DSH 0.1.0-rc.6 (run the contract gate before upgrading).
  • Known boundaries: see docs/FEATURES.md (differences).

License

MIT (same as Magic Context and DSH). Upstream copyright notices are in each package's NOTICE.