DSH Paper Writing Discipline Guardian: Detects AI-generated formulaic language and defensive phrasing, safeguards numbers, citations, and claim strength before and after editing, and aligns with target journal's writing style.
- Language
- JavaScript
- License
- MIT
- Branch
- master
Install
$ dsh plugin --profile web add dsh-plugin-writing-guardRun the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial
Install via your agent
Install the DeepSeek Harness plugin xmutfyh/dsh-plugin-writing-guard for me: review the repository at https://github.com/xmutfyh/dsh-plugin-writing-guard first, then run the install command and verify the plugin loads successfully.
Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.
At a Glance
A writing discipline guardian for academic authors: When writing or revising papers in DSH, it automatically detects AI mechanical phrasing, defensive self-deprecation, and revision process residuals, and performs integrity checks on numbers, citations, and claim strength before and after polishing, upholding the bottom line that "language can be changed, evidence cannot."
Core Capabilities
- Revision Process Residual Detection: Identifies terms that only appear in revision contexts like "revised/as requested/本轮/审稿人要求/投稿前/修订稿"; handles document types like rebuttal/cover_letter separately
- STYLE AI Voice Removal: Detects "不是X而是Y" (not X but Y), triple parallelism, dash/colon abuse, high-frequency LLM words like delve/tapestry, abstract adverb density, and hollow buzzword overload
- EVIDENCE Integrity Lock: When original is enabled, compares numbers, percentages, p-values, \cite/\ref, DOIs, claim strength, negatives/null results, scope boundaries, and evidence status (reported/observed/measured…) before and after revision
- Journal Writing Fit: Generates Journal Profile based on multiple representative papers from target journals, reporting syntactic/voice/citation/scientific claim/rhetorical structure fit percentages and confidence per section
- Author Style Drift Detection: Builds rhythm fingerprints from author historical papers (sentence/paragraph length patterns), detects sentence length distribution deviation in new manuscripts
- Auto Incremental Audit: Monitors write/edit operations on paper files (.md/.tex/.txt with paper path features or in knowledge base layouts like 01_manuscript), compares by file fingerprint, only injects new/resolved items to avoid repetitive alerts
Technical Implementation
- Language: TypeScript
- Key Dependencies: @deepseek-ai/cordis, @deepseek-ai/dsh-tools, @deepseek-ai/dsh-llm, Node.js built-in fs/path/os
- Architecture Pattern: Cordis plugin + tools hook injection; listens to
tools/pre-executeto capture pre-revision preimage (exec.token keyed),tools/post-executetriggers audit,agent/turn-stoppingmaintains per-turn injection count; injects audit results as additionalContexts into next turn viadsh-llm's createUserMessage - Entry File: src/index.ts (i.e., lib/index.js, built artifacts already committed to lib/) + cordis.patch.yml (injects plugin lines to host composite)
Use Cases
When Chinese/English paper authors use AI to assist with revisions in DSH, they fear two things most: AI's habitual addition of "correct but unnecessary" transitional phrases and defensive clichés, and the quiet corruption of numbers, citations, and claim strength after polishing. This plugin is suitable for continuous baseline checking in the paper writing/revision process: review while writing, check while revising, and especially run incremental review closer to submission. It does not rewrite text—it only marks the locations, severity, and modification suggestions for rule hits; the decision always remains with the author.
Prerequisites & Compatibility
| Dependency | Minimum Version | Description |
|---|---|---|
| DeepSeek Harness | 0.1.0-rc.6+ | Minimum version declared in peerDependency; otherwise cordis hooks and tools events won't be available |
| Node.js | >=18 | engines.node constraint |
| Platform | Cross-platform | Only depends on Node standard library fs/path/os; no native modules |
| @deepseek-ai/cordis | ^4.0.1 | Provides Context, tools event registration |
| @deepseek-ai/dsh-tools | ^0.1.0-rc.6 | defineTool tool definition |
| @deepseek-ai/dsh-llm | ^0.1.0-rc.6 | createUserMessage context injection |
Installation
dsh plugin --profile web add github:xmutfyh/dsh-plugin-writing-guard
Configuration Options
| Config | Type | Description | Default |
|---|---|---|---|
| autoBrief | boolean | Whether to automatically inject writing discipline quick-check list each turn (confirm before enabling as it may be intrusive; off by default) | false |
| verboseByDefault | boolean | Whether audit output lists each suggestion by default (off only outputs summary) | false |
| autoAuditOnWrite | boolean | Whether to automatically audit and inject results after writing paper files (monitors write/edit hitting paper paths) | true |
| autoAuditMinSeverity | low / medium / high | Minimum severity for auto-audit; levels below this won't be injected | high |
| mode | conservative / balanced / strict | Preset mode, overrides autoAuditMinSeverity (conservative only high-risk, strict includes low-risk). Explicit autoAuditMinSeverity takes priority | — |
| maxAutoInjectPerTurn | number | Maximum auto-injections per agent per turn (prevents spam) | 2 |
| projectResidueTerms | string[] | Project terms appended to default internal vocabulary; hits reported as medium | [] |
| stateFile | string | Incremental audit state file path; defaults to ~/.dsh/plugins/dsh-plugin-writing-guard/state.json | — |
FAQ
Q: Will it secretly rewrite my paper?
A: No. Full rewriting is not its responsibility—it only outputs the location, severity, and modification suggestions for hits; the original text remains untouched; all rules are deterministic regex/statistics, no LLM calls.
Q: Will it conflict with the "Academic Humanizer" plugin if installed together?
A: No responsibility conflict. Humanizer leans toward handing finished text to another model for rewriting, while Writing Guard leans toward continuous detection of style and evidence integrity during the writing/revision process. They can complement each other: let Writing Guard hold the bottom line first, then have Humanizer do style polishing.
Q: I don't want to be interrupted by auto-audit while writing. How to disable?
A: Set autoAuditOnWrite to false in plugin config; manually invoke the writing_audit tool when needed; also increase maxAutoInjectPerTurn or set autoAuditMinSeverity to high.
Q: How does it automatically capture pre/post revision comparison?
A: The plugin listens to the tools/pre-execute hook, caches file content before write/edit using exec.token as key; after write completes in tools/post-execute, reads the latest file content for comparison. Concurrent edits to the same file don't interfere across different tokens; when preimage is missing, falls back to persistent baseline cache (up to 20 files, 4MB total).
Q: Is the 512KB per file / 4MB total limit a bottleneck?
A: Not for typical papers. Baseline cache is "last observed full text"; files over 512KB skip persistence (no truncation to avoid false integrity results), but this edit is still covered by execution preimage; over 20 files, oldest by timestamp are evicted.
Q: How to troubleshoot errors?
A: State write failures are reported via ctx.logger.warn (previously silently swallowed), logs show specific failure reasons; lost incremental state means next audit reinjects all issues—errors won't be quietly swallowed.
Learning Curve
Beginner — plug-and-play; default config covers 90% of scenarios; only need to configure Journal Profile for more refined journal fit.
Known Issues & Limitations
- Only supports text file audit: .docx/.doc/.pdf throws error directly, need to convert via anydoc to Markdown first
- Auto-audit only hits paper path features (paths contain manuscript/paper/回复/rebuttal keywords in Chinese/English, or located in knowledge base directories like 01_manuscript/02_reviews/08_response); files in other locations won't be auto-audited
- English paper path features use regex word boundaries to avoid false matches like newspaper/synthesis/coverage/paperwork; Chinese is more lenient, substring matching
- Frequency rules use "absolute count + per-thousand density" dual gating to avoid false hits on terminology; low-sample sections may still generate suggested changes, ultimately author's judgment
- Journal style adjustments (Journal Fit) always have lower priority than scientific integrity: when original only supports "associated with", no Journal Profile can push to change to "caused"
- Detection rules are probabilistic signals: hits require manual review; legitimate technical terms and proper limitations ("样本量有限", "结果可能不完全可靠") won't trigger false positives
- Plugin version, fingerprint rule version, and schemaVersion are written to state.json; on restart, if fingerprintVersion doesn't match, baselines are cleared (no fake resolved/added), first audit after upgrade re-establishes baselines
- Incremental audit state persistence uses tmp + rename atomic writes; empty/whitespace stateFile path falls back to default path—no silent failure from config errors
去 AI 腔 · 守住证据 · 写向目标期刊
Writing Guard 是面向 DeepSeek Harness 的科研论文写作守卫: 减少机械化、模板化和防御性的 AI 写作, 保护 AI 润色前后的科研事实与 scientific commitments, 并根据目标期刊代表论文校准 manuscript 的写作分布。
Less AI. More Evidence. Better Journal Fit.
Language can change. Evidence cannot.
Local · Deterministic · Zero Network · Zero LLM
STYLE / EVIDENCE / JOURNAL 三大支柱
-
去 AI 腔 / STYLE 识别并减少机械化、模板化、过度防御的 AI 写作,包括 revision residue、defensive writing、空洞热词与结构化套话。不是隐藏 AI,而是消除 AI 带来的坏写作。
AI 越强,越会写“正确但没必要”的句子。
-
守住证据 / EVIDENCE 数字、p 值、引用与 DOI 不能在润色中无声漂移;null finding 不能消失,correlation 不能变 causation,scope 和 evidence status 不能被悄悄改变。语言可以改,证据不能改。
-
写向目标期刊 / JOURNAL 从目标期刊代表论文中蒸馏 section-level 写作分布、科学主张模式与 rhetorical moves。不是只学“怎么措辞”,也比较目标期刊各章节通常“写什么、按什么顺序写”。
Quick Start
dsh plugin --profile web add dsh-plugin-writing-guard
dsh web
npm 已发布。也支持 GitHub / 本地源码安装,见下方完整安装说明。
How it works
写作规则 → Agent revision → automatic guard → targeted revision
Writing Guard 不是写完全文后一次性 Humanize,而是在 DSH 论文工作流中持续工作:
- 写作前加载
writing_rules - 写作 / 修改时由
writing_audit自动检查 - 修改后自动对比前后版本,保护 Scholarship / Epistemic invariants
STYLE — 去 AI 腔
检测范围:
- 修改过程残留:
revised、as requested、本轮、审稿人要求 - 防御性写作:concession stacking、limitation pre-emption、generic value claim、unnecessary epistemic retreat
- 机械化修辞:
不是X而是Y、rather than滥用、三连排比、破折号 / 冒号滥用 - LLM 高频词:
delve/tapestry/testament/leverage等(密度规则,单次不报警) - 中文套话与“的”字链、平均句长异常等
密度阈值按语言独立计算:英文按词数、中文按 CJK 字数,双门槛避免误伤术语。
EVIDENCE — Scholarship + Epistemic Lock
Writing Guard 在 AI 润色前后对比并保护:
- 数字、百分数、p 值、置信区间、单位
\cite/\ref、Figure/Table 编号、DOI- 因果力与证据力:
associated with不能被悄悄改成caused - 否定 / 零结果:
no significant difference不能消失或翻转 - scope 边界与 evidence status:不能从“观察到 / 报告”被改成直接声称
每个问题带 findingKind:INVARIANT / VIOLATION / CANDIDATE / ADVISORY,并输出完整性回归报告。
JOURNAL — 面向目标期刊写作
Writing Guard 从多篇目标期刊代表论文中按文章独立统计,生成 corpus-aware Journal Profile。
当前比较五类信号:
- 句法结构:句长、段长等
- 语态与人称:passive voice、first-person usage
- 引用:bibliographic citations、figure/table references
- 科学主张:claim density、causal/evidential strength、hedging、scope、null findings
- 修辞结构:rhetorical move coverage、canonical order、section-bound transition fit
Journal Fit 按章节输出,并同时报告 corpus size 与 confidence。
Scientific Integrity > Journal Fit
Journal Fit 采用五组权重:句法结构 20% / 语态人称 10% / 引用 15% / 科学主张 35% / 修辞结构 20%。
四个 DSH Tools
| 工具 | 用途 |
|---|---|
writing_rules | 返回写作纪律速查,写作前加载 |
writing_audit | 主审计入口:检查 STYLE 问题,比较 revision 前后的 Scholarship / Epistemic invariants,并可加载 Style Profile 与 Journal Profile |
writing_style_profile | 从作者历史论文学习风格指标,输出 JSON 供 audit 使用 |
writing_journal_profile | 从目标期刊代表论文蒸馏 Journal Profile,输出 JSON 供 audit 使用 |
Document-aware auditing
同一段文字在不同文档里含义不同。插件按文档类型应用规则:
| profile | 说明 | 例:as requested by the reviewer |
|---|---|---|
manuscript | 论文正文 | 🔴 修改过程残留,报警 |
rebuttal | 逐条回复信 | ✅ 正常表述,不报警 |
cover_letter | 投稿信 | 🔴 残留,报警 |
review / notes / unknown | 其他 | 保守处理 |
writing_audit 可通过 profile 参数指定,或从文件路径自动检测(rebuttal/cover_letter/manuscript 关键词)。
Automatic / incremental audit
插件监听 tools/post-execute:write / edit 写入论文类文件(.md / .tex / .txt)时自动审计,结果注入模型下一条请求。
- 按文件持久化审计状态,每次只注入增量(新增 / 已解决 / 仍存在)
- 无变化 → 不重复注入
- 自动捕获修改前文本,直接运行 Scholarship Lock + Epistemic Lock
完整安装说明
# 从 npm 安装(已发布,推荐)
dsh plugin --profile web add dsh-plugin-writing-guard
# 从 GitHub 安装(lib/ 已提交,无需构建)
dsh plugin --profile web add github:xmutfyh/dsh-plugin-writing-guard
# 或从 GitHub tarball 安装
dsh plugin --profile web add https://github.com/xmutfyh/dsh-plugin-writing-guard/archive/refs/heads/master.tar.gz
# 或从本地源码目录安装
dsh plugin --profile web add ./path/to/dsh-plugin-writing-guard
# 重启生效
dsh web
仓库:https://github.com/xmutfyh/dsh-plugin-writing-guard
Why not Humanizer / AI Detector?
| Writing Guard | Humanizer | AI Detector | |
|---|---|---|---|
| 写作前规则 | ✅ | ❌ | ❌ |
| 写作过程中检查 | ✅ | 通常 ❌ | ❌ |
| 自动监听论文修改 | ✅ | ❌ | ❌ |
| 整段重写 | ❌ | ✅ | ❌ |
| 风格问题定位(可解释) | ✅ | 部分 | 部分 |
| 本地规则检查(零网络零 LLM) | ✅ | 通常需 LLM | 视工具而定 |
Humanizer 是写完再改,Writing Guard 是边写边防。
Security & Privacy
- 所有规则本地运行:零网络、零 LLM、无子进程
- 插件只读取 Agent 正在写入的论文文件,并写入
~/.dsh/plugins/dsh-plugin-writing-guard/下的增量状态 - 不收集、不上传论文内容
- 详见 SECURITY.md
Tests
npm test
300+ 项确定性 TP / TN / boundary / regression 测试,覆盖:
- STYLE、Scholarship Lock、Epistemic Lock
- claim alignment、local citation integrity
- Journal Profile、Journal Fit
- Rhetorical semantics(中文 / medoid / transition)
CI 在每次 push / PR 自动执行 build + tests。
FAQ
这是 DSH 的论文去 AI 味插件吗?
可以这样理解,但 Writing Guard 与传统 Humanizer 不同。它主要在论文写作和修改过程中检测常见 AI 写作风格,而不是将全文交给另一个模型进行重写。
支持中文论文吗?
支持。规则同时覆盖中文和英文论文中常见的机械化表达、模板化过渡、修改过程残留和防御性写作;中英文分别按 CJK 字数 / 英文词数独立计算密度阈值。
支持 SCI / English academic writing 吗?
支持。writing_audit 可检查英文 manuscript 中的 revision residue、defensive writing、LLM-overused expressions 以及常见 AI-style sentence patterns。
Writing Guard 和 academic-humanizer 有什么区别?
academic-humanizer 更偏向对已有文本进行自然化编辑;Writing Guard 更偏向在 DSH 论文工作流中持续检查和预防。二者可以配合使用。
CHANGELOG
完整版本演化、修复记录与测试增量见 CHANGELOG.md。
License
MIT
Read the usage guide →
Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.
Listing badge
[](https://deepseek-plugin.org/plugins/xmutfyh/dsh-plugin-writing-guard)Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.