Introduction

The plugin architecture of DeepSeek Harness (DSH) is intended to address long-term context management. Models do not have persistent memory, and prompts alone cannot ensure a consistent context for every workspace. dsh-trilogy is a Host plugin that takes over the creation, loading, and persistence of memory files. Instead of relying on the model to follow instructions, it enforces memory behavior on the host side through the plugin.

Plugin Positioning

  • Name: dsh-trilogy
  • One-line summary: Maintains three Markdown memory files for each workspace: automatic creation, automatic loading, automatic recording.
  • Maintainer: TodayJin
  • License: MIT

Installation and Enablement

Prerequisites: pnpm is available in PATH, DSH version 0.1.7-rc.2.

Install via local link; after changing code, restart dsh web to take effect:

dsh plugin --profile web add link:D:/path/to/dsh-trilogy

Uninstalling the plugin does not delete the project’s memory/ directory:

dsh plugin --profile web remove dsh-trilogy

Core Features

This plugin maintains three files under <project root>/memory/ for each workspace:

  • PROJECT.md: Records the current project state and is edited in place.
  • DECISIONS.md: Records decisions and rejected options, appended at the top.
  • SESSIONS.md: Records what happened, appended at the top.

Key capabilities:
1. Automatic creation and loading: Files are created automatically when a session starts; the contents of the three files are injected automatically (no duplicate injection if unchanged).
2. Tool support: Provides tools memory_checkpoint (categorized recording), memory_read (read files), and memory_search (BM25 search).
3. Area classification: Supports categorizing records by area tags; each area has at least one guaranteed entry, while the remaining allocation is weighted by activity.
4. GUI: Provides a browser half-screen interface for viewing, editing, exporting/importing, archiving, and restoring memory.
5. Injection budget control: Strictly limits injection volume; the full SESSIONS.md is not injected, only the most recent N log entries are injected.

Usage

No configuration is required after installation. Start a session in any project, and the memory/ directory and the boot block in AGENTS.md will be created automatically.

1. Bootstrap (Initial Population)

If PROJECT.md is still empty, the plugin injects an instruction asking the model to read the README, run test commands, and populate the five fixed sections of PROJECT.md. The instruction disappears automatically after completion.

2. Session Injection Mechanism

At the start of each session, the three files are automatically injected into the context.
* Deduplication: No duplicate injection if contents have not changed.
* Log strategy: The full SESSIONS.md is not injected; only the most recent N log entries are injected (default 15).
* Budget downgrade: If the total injection budget is exceeded, PROJECT.md is kept first, then the number of log entries is reduced, and historical logs are dropped last.

3. Record Progress

Use the memory_checkpoint tool:
* Parameters support sessions[] (with optional area), decisions[], project[], and notes.
* The tool writes content to the corresponding files based on the routing table.
* Use the memory_search tool to search memory content (including archives).

4. GUI Operations

Find “Project Memory” in the DSH Web settings:
* View and edit: Browse by file purpose in tabs (current state / decisions / logs / archive).
* Clear and forget: Clearing deletes the memory files; forgetting only removes the registry indexes and does not delete the files on disk.
* Import/export: Supports exporting memory/ as a JSON package and importing it on another machine or workspace.

Configuration and Injection Strategy

Override configuration by id in the profile’s cordis.patch.yml:

- id: trilogy
  config:
    injectBudgetBytes: 24000
    nudgeMaxPerSession: 5

Key configuration items:

Key Default Description
sessionEntriesInjected 15 Determines how many SESSIONS log entries are injected into the context
projectRootStrategy "workspace" "workspace" means the workspace is the project root; "marker" means searching upward for .git
projectStaleDays 14 Number of days after which PROJECT.md is considered stale
writeBootBlock true Whether to append a Memory section to AGENTS.md

Injection priority:
When injection budget is insufficient, degrade in the following order:
1. Fully inject all three files;
2. Halve the number of log entries step by step (15 -> 7 -> 3 -> 1);
3. Keep only part of the SESSIONS.md entries;
4. Keep only the head of DECISIONS.md;
5. Truncate PROJECT.md last.

Security and Considerations

  1. Local access restriction: All /trilogy routes are restricted to local access (non-loopback requests return 403) to prevent unauthorized access.
  2. Data persistence: The plugin does not rely on the model to maintain memory; it is fully guaranteed by the host plugin. Uninstalling the plugin does not delete the project’s memory/ directory.
  3. UI icons: If a specific icon is missing, it automatically falls back to a colored dot.
  4. Customizable templates: Templates for the three files and the boot block are located in templates/ and can be customized.

Summary

dsh-trilogy addresses context discontinuity in DSH through the Host plugin mechanism. It enforces the “three-file” project memory structure and ensures the model can retrieve context efficiently through intelligent injection budgets and area classification strategies. It is suitable for development scenarios that require long-term project context maintenance and multi-session collaboration.