Introduction

In the long-session workflow of DeepSeek Harness (DSH), context compaction (compaction/summary) is a necessary mechanism to maintain conversational coherence. However, summaries after compaction often lose critical prerequisite settings. When the model later does not know that “the sect has been exterminated” or that “the Ninth Heaven cannot be entered,” the story logic will collapse. The upstream plugin ICCuse/dsh-premise-guard mainly targets ASCII anchors (such as paths and key-value pairs) and does not sufficiently support Chinese content. dsh-premise-guard-cn builds on this with Chinese-first adaptation, adding a manual anchor list and tool support to automatically detect and inject prerequisite warnings after compaction.

Core Features

This plugin mainly includes the following capabilities:

Chinese-First Automatic Anchor Extraction

The plugin includes built-in anchor extraction rules for Chinese content, prioritizing the following as prerequisite anchors:
- Phrases inside Chinese quotation marks (double quotes, book title marks, and corner quotes);
- Term chains separated by the Chinese enumeration comma (、), or arrow-based term chains (such as “Body Refining→Qi Refining”);
- Numbered anchors (such as W12, A07);
- Chinese relative paths in the repository/workspace (such as “Settings/Character Card/Lin Wan.md”);
- Numbers and quantities (such as “12 chapters” or “300—500 li”);
- Long Chinese strings (length ≥ 12 characters);
- Retains the original fallback support for ASCII patterns (paths, key-value pairs, and error codes).

The matching rule requires at least 4 Chinese characters and filters out stop words.

Manual Anchor List

The plugin allows maintaining a manual anchor list through a file. By default, the list file is located at <workspace>/.dsh-meow/anchors.md. If an anchor from the list appeared in a compressed segment but is missing from the summary, the plugin marks it with a [Annotation] priority warning.

Tools and Commands

  • premise_anchor tool: a tool that the model can invoke directly. It supports list, add, and remove operations for maintaining the anchor list in the current workspace.
  • /anchor command: a user command for operating the default list ($DSH_HOME/anchors.md). To operate on the workspace list, use the premise_anchor tool or edit the file directly.

Automatic Warning Injection

The plugin triggers a check only after a compaction/summary event. It compares the compressed segment with the summary text. When critical anchors are found to be missing, it automatically injects a Chinese warning in the next step, prompting the model to check the logs.

Installation and Activation

Run the following command in the terminal to install the plugin:

dsh plugin --profile web add "github:111111AAA111111/dsh-premise-guard-cn"

After installation, restart the DSH process. The plugin is loaded with the bundle at startup.

Typical Usage

Maintaining the Anchor List

Create or edit .dsh-meow/anchors.md in the root directory of your workspace, and add prerequisite anchors line by line:

# 关键前提锚点清单
- “主角的师门在灭门之夜全军覆没”
- 炼体→炼气→炼神
道基一成,方向不可改

After adding or removing lines, the next context compaction takes effect immediately.

Using Commands or Tools

  • Use the /anchor command to manage the default list.
  • In a conversation, ask the model to invoke the premise_anchor tool to add, remove, or query anchors.

Viewing Warnings

When a compacted summary loses an anchor, the system outputs a warning like this:

⚠️ 前提告警【前提守卫 premise-guard-cn】:刚才的上下文压缩(seqs 12-40)生成的摘要丢失了以下关键锚点:
- 【标注】“主角的师门在灭门之夜全军覆没”
- 修炼共分九重天,第九重从未有人真正踏足
若这些前提仍然重要,用 session 事件工具从日志读回被压缩区间核对;若摘要已用等价表述保留,或前提已不再影响当前工作,忽略本提醒。

Applicability and Notes

  • Applicable scenarios: Mainly intended for Chinese-language novels, long-form creative writing, or projects with complex settings.
  • Trigger timing: Checks are performed only after a compaction/summary event.
  • Matching mechanism: Matches are literal substring matches, not semantic judgments. If the summary retains the prerequisite using equivalent wording, the plugin may still produce a false positive. The warning text prompts the model to judge for itself.
  • Boundary note: The anchor list and warnings are tool clues; they do not replace the project’s formal notes or authoritative source decisions.
  • License: MIT. Modified from ICCuse/dsh-premise-guard, retaining the original author’s attribution.

Summary

dsh-premise-guard-cn provides a targeted prerequisite-loss prevention mechanism for Chinese long-form writing scenarios. Through automatic anchor extraction and manual list maintenance, it proactively alerts the model to critical settings that may have been lost after context compaction, reducing the risk of logical collapse in long conversations.

GitHub Repository