Introduction

The core design philosophy of DeepSeek Harness (DSH) is “everything is a plugin.” During long-term project development, session context is easily lost, and project knowledge is difficult to distill. The dsh-project-context plugin establishes an independent archiving and memory system inside the project directory, converting DSH’s event-stream sessions into searchable and iterable project-level context.

This plugin is maintained by Wuthering Heights (P02-1010751281) and is licensed under the MIT License. It breaks a DSH session lifecycle into four stages: archiving, organizing, distilling, and handoff.

Installation and Activation

The plugin must first be built or pointed directly to its source directory, then added through a profile.

# 构建或直接指向源码目录
dsh plugin --profile web add /path/to/dsh-project-context

After installation, the cordis.patch.yml configuration inside the package is automatically applied. Verify that the configuration is active:

dsh --profile web --dump-config | grep -A3 project-

Uninstall command:

dsh plugin --profile web remove dsh-project-context

Core Architecture and Data Flow

Internally, the plugin contains four independent but cooperating submodules that manage state through a shared helper.

Four-Stage Processing Flow

  1. Archiving: Preserve event-stream sessions within the project. Manually triggered by /session-log, or driven by the turn/end event. Artifacts include session.jsonl (authoritative data), session.md (full rendering), and INDEX.md (mechanical index).
  2. Organizing: Merge raw conversations with the memory system to generate CONTEXT.md (working-state summary) and MEMORY.md (memory bank), and inject them into each conversation turn. Can be triggered with /context-update.
  3. Distilling: Convert accumulated memory and context into project skills on low-frequency triggers (e.g., every 20 turns or every 30 minutes). Manual trigger: /autolearn.
  4. Handoff: Automatically triggered when context usage exceeds the threshold and no background subagent is running. It hands off the current session summary, recent raw content, and old archive pointers to a new session. Can be manually triggered with /handoff.

Data Layout

Data is stored under .agents/ in the project root directory:

  • session-logs/: session archive copies, including INDEX.md and session details grouped by ID.
  • memory/: memory system.
    • memory.jsonl: authoritative memory log (append-only).
    • MEMORY.md: rendered memory view (human-readable / injection entry point).
    • CONTEXT.md: working-state context (summary/tasks).
    • HANDOFF.md: most recent handoff summary.
  • skills/: distilled project skills.

Concurrency and Locking

The system uses file locks to ensure multi-process-safe writes. MEMORY.md and INDEX.md are backed up at the byte level before being written, preventing data corruption from crashes.

Configuration and Usage

Configuration items are not written into project files; instead, they are written in the current profile’s settings patch document and managed through a project-context entry.

Common Commands

  • Manual archiving: /session-log
  • Manual handoff: /handoff
  • Trigger skill distillation: /autolearn

Verify Configuration

Check whether the plugin configuration is correctly mounted in the profile:

dsh --profile web --dump-config | grep -A3 project-

Notes

  • Version Discrepancy: The README shows the current version as v0.2.0, but package.json records it as 0.2.1. When installing, use the actual runtime environment as the source of truth.
  • Handoff Trigger Conditions: Automatic handoff requires both conditions: the context usage threshold is met and no background subagent is running.
  • Session Paths: Native DSH sessions are stored in ~/.dsh/sessions/; this project’s archive copies are stored in session-logs/. They are independent, but their content is synchronized.
  • Permissions and Security: The plugin runs with the permissions of the current DSH process. It is recommended to review the source code before installation.

Source Code Structure

The plugin source code uses a modular design and is located in the src/ directory:

  • project-context/: archiving module.
  • project-memory/: organizing module.
  • project-autolearn/: distilling module.
  • project-handoff/: handoff module.
  • shared/: utilities shared by the four modules, including locking mechanisms, state facade, filesystem primitives, etc.
  • client/: web settings card and field definitions.

Summary

dsh-project-context provides DSH with a complete project-level memory solution. It manages sessions through mechanical indexes, manages memory through hierarchical organizing, and maintains long-term context through automatic handoff, making it suitable for developers who need to maintain complex project context over the long term.