Skip to content

dsh-plugin-writing-guard

Verified

dsh-plugin-writing-guard ยท v2.0.1 ยท MIT

Scientific writing & document integrity guard for AI-assisted research - prompt-guided argument economy with deterministic scientific, delivery, journal, and Word integrity checks.

Install

dsh plugin add dsh-plugin-writing-guard

Confirm the layer applied with dsh --profile default --dump-config โ€” see the install guide.

Source

Tags

Creators

Readme

Writing Guard

CI npm License: MIT

Scientific Writing & Document Integrity Guard for AI-assisted research

Less explanation. More argument. Preserve the science.

Writing Guard combines prompt-guided scientific prose discipline with deterministic integrity checks for AI-assisted research. It protects your manuscript across five layers:

Guard Protects against Risk
STYLE Argument economy ้˜ฒๅพกๆ€งๅ†™ไฝœใ€่ฟ‡ๅบฆ่งฃ้‡Šใ€่ฏญไน‰้‡ๅคใ€ๆจกๆฟ่…”
EVIDENCE Scientific drift ๆ•ฐๅ€ผใ€ๅ•ไฝใ€ๅผ•็”จใ€็ป“่ฎบ่ขซๆ”น
JOURNAL Journal mismatch scope/style/convention ไธๅŒน้…
DELIVERY Context leakage promptใ€notesใ€workflow metadata ๆณ„ๆผ
DOCUMENT ๐Ÿ†• Document corruption Word ๆ ผๅผใ€ๅ…ฌๅผใ€่กจๆ ผใ€OOXML ่ขซ็ ดๅ

Prompt-guided writing ยท Deterministic integrity core ยท 394 Tests

npm install dsh-plugin-writing-guard

Writing Guard does not write your paper for you. It makes AI-assisted writing safer to ship.


New in 2.0 โ€” Argument Economy & Control-Plane Separation

Writing Guard 2.0 moves semantic style decisions before generation and keeps deterministic code focused on integrity.

  • Critique is not content โ€” reviewer/user/guard wording is control context, not manuscript evidence.
  • Prefer CUT over REWRITE โ€” if a sentence only prevents criticism, reassures reviewers, advertises importance, or repeats an obvious implication, delete it.
  • Do not close every semantic loop โ€” stop after evidence + necessary interpretation; keep non-obvious statistical interpretation and reproducibility detail.
  • Style-only revisions default to same length or shorter โ€” no explanatory inflation without new supported content.
  • Auto-audit no longer reinjects snippets or rewrite suggestions โ€” only structured rule/action metadata is sent back to the agent.
  • New English/Chinese cues for defensive-purpose framing, semantic-closure markers, and content-free evaluation.

Example:

Avoid:  To prevent data leakage, normalization was carefully performed using only the training data.
Prefer: Normalization parameters were estimated from the training data.

The second sentence states the method fact without importing the defensive reason for mentioning it.


๐Ÿ›ก๏ธ Word Document Guard (introduced in 1.8)

Change what was requested. Verify what wasn't.

AI-assisted document editing introduces a subtle risk: the requested text may improve while unrelated parts of the manuscript silently change.

When you ask an AI agent to "rewrite paragraph 3 only," it may inadvertently modify:

  • equation structures
  • table borders
  • numbering
  • styles
  • section geometry
  • relationships
  • embedded media
  • OOXML package parts

Writing Guard 1.8 introduces a document-integrity layer for Word manuscripts:

Feature What it does
Safe scoped editing Only the specified range can change
Package validation Verifies DOCX/OOXML package integrity after editing
Structural fingerprinting Compares document structure before and after
Equation integrity Checks equation structure, numbering continuity, math-font drift
Scholarly table awareness Distinguishes data tables from layout/figure containers
Pre/post integrity verification Deterministic verification, not "I think it's fine"

Before / After

Without Writing Guard:

"Please improve the wording in paragraph 3."
โ†’ AI agent modifies DOCX.
โ†’ Result: paragraph looks better.
โ†’ Unknown: what else changed?

With Writing Guard:

"Please improve the wording in paragraph 3."
โ†’ Writing Guard:
   โœ“ scope validated
   โœ“ package valid
   โœ“ equations preserved
   โœ“ protected structures unchanged
   โœ“ document fingerprint checked
โ†’ Result: paragraph changed โ€” and unintended document drift is detected.

Quick Start

# Install
dsh plugin add dsh-plugin-writing-guard

# Restart
dsh web

Natural Language Usage

Once installed, you can use natural language:

Say this Writing Guard does this
"ๅธฎๆˆ‘ๆฃ€ๆŸฅ่ฎบๆ–‡ๅ†™ไฝœ่ดจ้‡" writing_word_audit
"ๆŠŠ่กจๆ ผๆ”นๆˆไธ‰็บฟ่กจ" writing_word_format_tables
"ๆ‰ซๆDOCX็ป“ๆž„" writing_word_scan
"ไฟฎๆ”น็ฌฌไธ‰็ซ ็š„XXX" writing_word_edit
"็ผ–่พ‘ๅŽ้ชŒ่ฏ่Œƒๅ›ด" writing_word_scope_check
"ๆฃ€ๆŸฅๆœ‰ๆฒกๆœ‰AIๅ‘ณ" writing_audit

Five Guards โ€” Detailed

STYLE โ€” Argument Economy & Prose Discipline

Guides the host model before writing, then uses deterministic cues to audit mechanical, defensive, and over-explained prose:

  • Revision residue: revised, as requested, ๆœฌ่ฝฎ, ๅฎก็จฟไบบ่ฆๆฑ‚
  • Defensive writing: concession stacking, limitation pre-emption
  • Mechanical rhetoric: ไธๆ˜ฏX่€Œๆ˜ฏY, rather than abuse, triple parallelism
  • LLM high-frequency words: delve / tapestry / testament (density-based)
  • Chinese patterns and average sentence length anomalies

EVIDENCE โ€” Scholarship + Epistemic Lock

Protects scientific facts during AI editing:

  • Numbers, percentages, p-values, confidence intervals, units
  • Citations, Figure/Table numbers, DOI
  • Causal strength: associated with cannot become caused
  • Null findings: no significant difference cannot disappear
  • Scope boundaries and evidence status

JOURNAL โ€” Target Journal Fit

Calibrates manuscript against target journal conventions:

  • Syntax structure (sentence length, paragraph length)
  • Voice and person (passive voice, first-person usage)
  • Citations (bibliographic, figure/table references)
  • Scientific claims (claim density, causal/evidential strength)
  • Rhetorical moves (coverage, canonical order)

DELIVERY โ€” Context Leakage Detection

Stops workflow context from leaking into final artifacts:

  • Rejected alternatives
  • Revision process residue
  • Provenance leakage
  • Defensive hedge leakage

DOCUMENT โ€” Word Document Integrity ๐Ÿ†•

Safely edit Word manuscripts without breaking structure:

writing_word_scan โ†’ writing_word_edit โ†’ writing_word_scope_check

13 tools for complete document integrity:

Tool Purpose
writing_word_scan Structural scan
writing_word_edit Safe scoped editing
writing_word_audit Writing audit for .docx
writing_word_scope_check Scope integrity verification
writing_word_format_tables Three-line table formatting
writing_word_audit_equations OMML equation audit
writing_word_package_validate OOXML package validation
writing_word_fingerprint Baseline formatting fingerprint
writing_audit Text writing audit
writing_rules Writing guidelines
writing_style_profile Author style profile
writing_journal_profile Journal profile
writing_delivery_audit Delivery integrity audit

Installation

# From npm (recommended)
dsh plugin add dsh-plugin-writing-guard

# From GitHub
dsh plugin add github:xmutfyh/dsh-plugin-writing-guard

# From local source
dsh plugin add ./path/to/dsh-plugin-writing-guard

Prerequisites:

  • Node.js โ‰ฅ 18
  • Python 3.10+ with python-docx (pip install python-docx)

Architecture

Writing Guard
โ”œโ”€โ”€ STYLE (writing_audit)
โ”‚   โ”œโ”€โ”€ Revision residue detection
โ”‚   โ”œโ”€โ”€ AI style patterns
โ”‚   โ””โ”€โ”€ Density-based thresholds
โ”œโ”€โ”€ EVIDENCE (Scholarship/Epistemic Lock)
โ”‚   โ”œโ”€โ”€ Number/unit preservation
โ”‚   โ”œโ”€โ”€ Citation integrity
โ”‚   โ””โ”€โ”€ Claim strength conservation
โ”œโ”€โ”€ JOURNAL (Journal Profile)
โ”‚   โ”œโ”€โ”€ Corpus-aware analysis
โ”‚   โ”œโ”€โ”€ Section-level comparison
โ”‚   โ””โ”€โ”€ Rhetorical move matching
โ”œโ”€โ”€ DELIVERY (CAL Detection)
โ”‚   โ”œโ”€โ”€ Rejected alternative leakage
โ”‚   โ”œโ”€โ”€ Process residue
โ”‚   โ””โ”€โ”€ Baseline reality check
โ””โ”€โ”€ DOCUMENT (Word Guard) ๐Ÿ†•
    โ”œโ”€โ”€ Structural scanning
    โ”œโ”€โ”€ Safe editing
    โ”œโ”€โ”€ Package validation
    โ”œโ”€โ”€ Fingerprinting
    โ””โ”€โ”€ Equation audit

Design principle: Baseline manuscript > journal/template > plugin defaults.

The LLM/agent decides what should change. Deterministic Word code decides how to make that change without silently altering unrelated formatting.


Tests

npm test

394 deterministic tests covering:

  • STYLE, Scholarship Lock, Epistemic Lock
  • Claim alignment, local citation integrity
  • Journal Profile, Journal Fit
  • DELIVERY (CAL detection)
  • Word Guard (v1.8.2): OOXML validation, fingerprinting, equation audit

Security & Privacy

  • Deterministic integrity checks run locally; semantic writing decisions are handled by the host model under the Writing Guard policy.
  • The plugin only reads files being edited.
  • The plugin itself does not upload or collect manuscript content.
  • See SECURITY.md

Why Writing Guard?

Writing Guard Humanizer AI Detector
Pre-writing rules โœ… โŒ โŒ
During-writing checks โœ… Usually โŒ โŒ
Auto-monitor manuscript โœ… โŒ โŒ
Full rewrite โŒ โœ… โŒ
Explainable issues โœ… Partial Partial
Deterministic integrity checks โœ… Usually no Depends

Humanizer rewrites after writing. Writing Guard prevents during writing.


Brand

                  WRITING GUARD
                       โ”‚
       Scientific Writing & Document Integrity
                       โ”‚
 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 STYLE   EVIDENCE   JOURNAL   DELIVERY   DOCUMENT
                                            โ”‚
                               Change what was requested.
                               Verify what wasn't.

Classic slogan: Less AI. More Evidence. Better Journal Fit. Clean Delivery.

Document slogan: Change what was requested. Verify what wasn't.


CHANGELOG

See CHANGELOG.md.

License

MIT