DeepSeek Harness Plugin: dsh-fact-lock-rewrite

Introduction

When running agents in DeepSeek Harness (DSH) to write copy, the most common problem is that rewrites distort facts: a price shifts from ¥299 to ¥199, inventory changes from 12 units to 200, or a model number like X200 Pro becomes X200 Pro 5G. These errors often pass a casual human read-through (“seems fine”) but can undermine sales conversion, compliance, and brand credibility. This plugin gives DSH a two-pass fact-lock rewrite pipeline: first, lock the non-negotiable facts in place; then rewrite. If any locked item doesn’t match, the entire output is rejected with the conflict pinpointed at line:column. Only a full match allows a “Publish.”

Plugin Positioning

dsh-fact-lock-rewrite is a DeepSeek Harness workflow plugin maintained by dingchenhui0618-arch. It turns “remove the AI flavor” from a single prompt instruction into a verifiable diff: through a code-level two-pass pipeline, it extracts facts first, then rewrites, then compares — any change to a locked item triggers a full rejection. The plugin does exactly one thing and builds it as a testable, configurable, integrable DSH capability.

Core Features

The plugin’s core capability centers on “fact protection.”

Two-Pass Pipeline

Source ──① Lock──► fact-lock.json (type / fact text / normalized value / line:col)
                        │
                        ├── Each fact is replaced with a ⟦f1⟧ placeholder; the model may only edit text between placeholders
                        ▼
                  ② Rewrite ──► Compare ──┬─ All match ──► Pass: side-by-side diff of source/rewrite ──► Publishable
                                         └─ Any mismatch ─► Full rejection + conflict located at line:column

The first pass only extracts facts and writes the results to fact-lock.json for your review; the second pass uses placeholders to isolate facts, so the model can only rewrite the surrounding text and cannot alter the facts themselves; the comparison stage checks every locked item, and any single mismatch triggers rejection.

Fact Types

The plugin recognizes the following eight categories of facts:

  • Price: ¥299, 299 元, 到手价 259, 7.5 折, 满 300 减 50, 9.9 包邮
  • Inventory: 库存 12 件, 仅剩 3 台, 限量 200 份, 已售 1.2 万件
  • Model number: iPhone 16 Pro, X200 Pro, RTX4090, A7M4, SKU-12345
  • Specifications: 256GB, 6.7 英寸, 5000mAh, 1.5 匹, 120x80cm
  • Dates: 2026年11月20日, 2026-11-20, 11月20日, 今晚 8 点, 双11
  • After-sales commitments: 7 天无理由退换, 一年保修, 假一赔十, 顺丰包邮, 48 小时内发货
  • Links: https://…, www.…, bare domains
  • Contact info: 400-820-8820, mobile numbers, email addresses, WeChat IDs

Comparison is done after normalization: full-width/half-width characters, whitespace, ¥/¥, and Chinese numerals (七天 ↔ 7 天) are not considered changes.

Conflict Determination

Determination is split into three tiers:

  • The fact is still present, only the wording differs (¥299 → 299 元, 到手价 259 → 到手 259, 七天 → 7 天): pass, with a “format change only” note recorded.
  • Amounts/quantities/dates/model numbers/links have changed, disappeared, or an extra item has appeared: reject the entire output.
  • Qualifiers have changed: 原价→现价, 仅剩→已售, 限量→库存, 无理由→包退: reject the entire output (the number didn’t change, but the fact did).

The third tier is what this plugin truly cares about: 仅剩 12 件 and 12 件 carry the same number but make different commitments.

Usage

Panel Usage

A “Fact Lock” tab appears in the DSH conversation view:

  • Lock Facts: Run only the first pass; displays the fact-lock results (type / fact text / normalized value / line:column) so you can confirm the model extracted them correctly.
  • Rewrite & Verify: Runs the full two-pass pipeline; if it passes, a side-by-side diff is shown; if it fails, only the conflict list is provided and the rewritten text is withheld.
  • Verify Existing Rewrite: Paste a draft written by someone else (or another model); performs comparison only, no rewriting.

Two-Level Gate

  • Save Draft: Available at any time; drafts are labeled with “3 conflicts / unverified” — a draft is a working copy, not a publication.
  • Publish: The button is only enabled after Verification Passed; when conflicts exist, the button is disabled and the reason is stated. Publication records are appended to $DSH_HOME/fact-lock-published.jsonl.

For Agents: Two Tools

Tool Purpose
fact_lock_rewrite Runs the full two-pass pipeline; on conflict returns withheld: true, and the rewritten text is not returned.
fact_lock_check Verification only: {source, rewrite} → conflicts + location + diff; can serve as a final pre-publication check.

Command Line (without DSH)

node bin/fact-lock.mjs lock  copy.txt --out fact-lock.json
node bin/fact-lock.mjs check copy.txt rewrite.txt --facts fact-lock.json   # exit code 0 = pass / 1 = reject
node bin/fact-lock.mjs diff  copy.txt rewrite.txt

The check exit code can be chained directly before a publication script.

Configuration

In the config section of the plugin entry in cordis.patch.yml:

Key Default Meaning
maxChars 6000 Maximum character count for a single source document
strictSurface false When true, format changes are also treated as conflicts
publishPath $DSH_HOME/fact-lock-published.jsonl File path for publication records

Limitations

  • Fact extraction is rule-based, not model-judged. It cannot recognize commitments without numbers (下周三发货, 手慢无), nor bare numbers (a standalone 4090 is not treated as a model number; RTX 4090 is).
  • Fabrication outside of locked facts is not blocked. A new metaphor like “these earbuds are like giving your ears a vacation” is not a fact change; only fabrications involving the eight categories above will trigger rejection.
  • Format changes are allowed by default (¥299 → 299 元). For stricter enforcement, enable strictSurface: even formatting must match character-for-character.
  • Qualifiers are judged by fixed families (原价/现价/立减, 仅剩/限量/已售, 无理由/包退/保修). Synonymous rewrites within the same family pass; cross-family changes are rejected. No semantic reasoning is performed.
  • This is not a legal or compliance review. It guarantees that the rewrite didn’t alter facts; it does not guarantee the facts themselves are true.

Installation & Enablement

dsh plugin --profile <your-profile> add github:dingchenhui0618-arch/dsh-fact-lock-rewrite

After installation, restart DSH. The “Fact Lock” tab will appear in the conversation view, and agents can invoke fact_lock_rewrite / fact_lock_check.

Use Cases

Suitable for scenarios that require locking facts into copy: e-commerce listings, product descriptions, promotional announcements, Bilibili video scripts, etc. The plugin runs with the current dsh process permissions; review the source code and license before installation.

Summary

dsh-fact-lock-rewrite turns “remove the AI flavor” from a single prompt instruction into a verifiable diff, implementing fact protection through a two-pass pipeline: lock first, rewrite second, compare last — any change to a locked item triggers full rejection. It is not a legal review, but it guarantees the rewrite hasn’t altered facts, making it suitable for workflows that need to lock critical information such as prices, inventory, model numbers, dates, commitments, and links into copy.

Plugin directory: https://www.skillhub.cn/plugins/dingchenhui0618-arch/dsh-fact-lock-rewrite
GitHub: https://github.com/dingchenhui0618-arch/dsh-fact-lock-rewrite

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye