← Back to home@Kerberos255

dsh-lossless-context

Traceable context compaction for DeepSeek Harness: hierarchical summaries, source retrieval and verified DM session rotation.

Stars
0
Language
JavaScript
Created
Oct 8, 2026
Updated
Oct 15, 2026

Introduction

Lossless Context for DeepSeek Harness

简体中文 · DeepSeek Harness · Security

A hierarchical context-compaction and retrieval backend for DSH. Keep the native session history intact while building traceable summary nodes and allowing agents to retrieve their original supporting text.

Features

  • Uses the native DSH compaction transaction; the plugin does not replace or delete source session logs.
  • Summarizes bounded, tool-call-safe event groups into a layered source DAG.
  • Exposes lcm_grep, lcm_describe, and lcm_expand for authorized session-local retrieval; lcm_expand also accepts a search term (the former lcm_expand_query behavior).
  • Adapts headroom, target summary length and output budgets to the actual selected model; model failures, timeouts and truncated summaries are handled with bounded attempts and safe commit rules.
  • Can prepare reusable summary leaves during idle maintenance without committing compaction.
  • Optionally rotates eligible owner-verified Discord/Feishu direct-message sessions after a verified Dream & Memory handoff; recent rotation failures are backed off rather than retried every idle turn.

Install and enable

Requires a compatible DSH host with its native session, token-meter and compaction services. See package.json for peer dependencies.

dsh plugin --profile desktop add github:Kerberos255/dsh-lossless-context

Then open Settings → Plugins → Lossless Context, enable the backend, and choose the dsh-lossless-context/agent compaction backend for the agent preset that should use it. Installing the settings plugin alone does not guarantee that every preset uses this backend. Restart when changing plugin code or preset composition.

How it works

Native session events
  → native compaction selection
  → bounded summary leaves → merged summary DAG
  → native commit (only on success)
  → searchable index with references to source event IDs

The current session keeps its native record. Retrieval and expansion resolve back to original source events. Model/provider limits and existing policies control thresholds; unavailable model metadata causes a safe error instead of invented budgets.

Safety, storage, and tests

The plugin stores derived indexes under DSH's data directory, not a second complete conversation history. Invalid, cancelled, oversized or truncated summaries are not committed. Private-channel auto-rotation requires verified owner/workspace bindings and completed Dream evidence; ordinary desktop/group/unverified sessions are not silently moved.

Run npm test for portable policy/regression tests. Real compaction and summary quality require an active model and DSH host. Example settings: config.example.json. Historical notes: CHANGELOG.md.

Related: Dream & Memory · Channel Core.

MIT licensed. See LICENSE.

Optional plugin diagnostics

The plugin optionally emits privacy-restricted operation and failure metadata to dsh-plugin-diagnostics. Diagnostics contain event type, status, fixed error code and elapsed time; conversation content and credentials are not logged. The diagnostics plugin is optional and does not change the host requirements.

Editable compaction guidance

Leaf and merged summaries can include customizable default quality guidance emphasizing project decisions, exact file paths/configuration names, validation evidence, and task state changes. A Restore default button resets the setting. Guidance supplements the native compaction protocol: tool pairing, source retention, cancellation and complete-transaction checks are unchanged. Changes to the summary policy invalidate stale reusable leaves.