Introduction

In the DSH ecosystem, long-term memory management for Agents is a common pain point. Developers often encounter situations where Agents forget earlier instructions, mistake unreliable information for user preferences, and struggle to trace or correct erroneous memories. The dsh-adaptive-context plugin (Adaptive Context Plane, ACP) aims to solve these problems. It is a governance-enabled long-term memory system, maintained by Icstick, and categorized under “memory”.

The core value of ACP lies in transforming memory management from a “black box” into an “auditable ledger”. Through explicit evidence recording, write gates, and user permission controls, it ensures that contextual information injected into Agents is authoritative, accurate, and traceable.

Core Features

  1. Evidence ledger: A SQLite-based append-only ledger. Each piece of evidence records its source, authority level (7 levels), and domain (6 categories). Replaying the same event only produces one entry.
  2. Governance: Includes write gates (blocking secrets, privacy, and prompt injection), read gates (filtering by scope/status/qualification), and user rights (view, export, correction, deletion, etc.).
  3. Context orchestration: Executed in the pre-step phase of each conversation turn. Through dual-channel ranking (text + semantic) and content deduplication, it controls the injection budget and avoids redundant information.
  4. User model: Explicitly models user facts, preferences, work state, expression style, and more, while rejecting vague inference.
  5. Background settling: Runs in the background after each turn. When evidence accumulates to a certain threshold or after a time interval, LLM refinement is triggered. Failures do not advance the watermark; the same batch is retried in the next turn, and rule-based fallback is used only when the LLM is completely unavailable.
  6. Temporal truth: Evidence carries effective start and end times, enabling queries on historical views. Superseded evidence remains visible at the old point in time, preserving the complete evolution chain.
  7. Expression style promotion: Style candidates take effect only after passing a human approval gate or satisfying policy guardrails, and rollback is supported.
  8. Multi-source routing: Supports parallel recall from multiple memory sources, with independent timeouts so they do not drag each other down; if the primary path fails, it automatically falls back to the backup path.
  9. Audit and export: All critical operations are logged (who, when, why), and full import/export of evidence and audit data in JSONL format is supported.
  10. Offline consolidation: The slow loop organizes evidence and observations into stable candidate conclusions, physically separated; promotion must pass a human gate.

Installation and Configuration

Installing this plugin requires executing CLI commands and manually completing the configuration.

  1. Install the plugin:
    dsh plugin --profile <profile> add github:Icstick/dsh-adaptive-context
*Note: This command only installs dependencies and reconciles bundles; it does not automatically write configuration entries.*
  1. Configure the data directory:
    Plugin runtime depends on an explicitly configured data directory. Edit the cordis.patch.yml in the profile root directory and add the following:
    - id: adaptive-context
      name: dsh-adaptive-context
      config:
        ledgerDir: C:\path\to\acp-data    # 必填:账本目录的绝对路径
*Note: The `DSH_HOME` environment variable is not reliable; `ledgerDir` must be explicitly specified.*
  1. Install and restart:
    Enter the profile directory, run pnpm install, then restart dsh.

Typical Usage

ACP’s design philosophy is “evidence is truth”. The following are fact-based usage scenarios:

  1. Day one: Tell the Agent, “Remember that I like to keep configuration and code separate.” This statement is recorded by ACP as a user fact evidence entry with an authoritative source, and is automatically injected into new sessions afterward.
  2. Second week: You find that the code generated by the Agent has incorrect indentation and correct it: “I said to use 4 spaces.” This statement is written as a “user correction,” while the previous incorrect old evidence is marked as “superseded.” From then on, only the new preference is injected.
  3. One month later: You need to migrate environments. Export all evidence in JSONL format and import it into the new environment. At this point, you can fully review the evolution from “user preference” to “correction” to “final preference”.

Notes

  1. Configuration override rules: In cordis.patch.yml, when multiple entries have the same id (for example, adaptive-context), the later entry fully overrides the earlier one; they are not merged.
  2. Configuration changes: targetDomain is deprecated. memosBaseUrl and memosEnabled were removed on 2026-10-01. These keys are retained in the configuration only for compatibility display and no longer take effect.
  3. Runtime environment: The plugin runs with the permissions of the current dsh process. It is recommended to review the source code and license (MIT) before installation.

Summary

ACP provides DSH with a structured long-term memory solution. By standardizing the processes of memory writing, retrieval, and governance, it solves the problems of uncontrolled and difficult-to-maintain Agent memory. For long-running Agent projects with high requirements for contextual consistency, this is an essential tool.