Introduction¶
The philosophy behind DeepSeek Harness is “everything is a plugin.” In agent development, we often need to solidify domain-specific workflows into reusable capabilities rather than reinventing the wheel every time. Official government document writing is a prime example: the structure, formatting, and phrasing all follow strict conventions and require repeated refinement and fact verification.
gongwen-writer is a DeepSeek Harness plugin designed for Chinese official document writing. From initial research and framework candidates, to GB/T 9704-compliant Word output, real-time polished drafts, paragraph-by-paragraph and sentence-by-sentence refinement, political accuracy verification, and project memory — everything is handled within the local workspace.
Plugin Scope and Problems It Solves¶
gongwen-writer is maintained by hexiaobai2012 (Alex). It is a workflow-type plugin that focuses on solving four core problems in Chinese official document writing:
- Correct document type and structure: Notices, requests for instructions, reports, official letters, meeting minutes, and speeches each have their own structure;
- Correct formatting: Margins, fonts, line spacing, page numbers, and signature blocks must comply with GB/T 9704;
- Accurate political language: Conference dates, session numbers, leaders’ titles, important speeches, and document numbers must not be written from memory;
- Traceable revisions: Every structural adjustment, paragraph change, and sentence edit must be reviewable and restorable.
The plugin ships with a built-in GB/T 9704 renderer, does not depend on gongwen-skill, and all processing is completed locally.
Core Capabilities¶
Initial Research + Three Framework Candidates¶
When generating the first draft framework, the plugin performs online research first, then presents 3 candidates with different structures:
- Task-deployment type: organized by task areas;
- Problem-oriented type: organized by problem → cause → countermeasures;
- Timeline type: organized by phases.
Each candidate includes sections, tasks per section, logical chain, applicable scenarios, and risks. Use gongwen_draft action=frames to save candidates, and select_frame to finalize before writing the body text.
Self-Contained GB/T 9704 Word Rendering¶
The plugin uses python/render_docx.py together with python-docx to directly generate Word files:
- A4, top margin 37mm, bottom 35mm, left 28mm, right 26mm;
- Fixed line spacing 28pt throughout, 0 spacing before and after paragraphs;
- Title in 22pt FZXiaoBiaoSong Simplified, not bold, centered;
- Body in 16pt FangSong_GB2312, first-line indent of 2 characters;
- Level-1 headings in SimHei, level-2 headings in KaiTi_GB2312;
- Salutation flush left (no indent);
- Page number “- 1 -” in 14pt FangSong, right-aligned on odd pages, left-aligned on even pages;
- Signature block with 4-character right margin on the first line; date and continuation lines aligned to the center of the first line.
Real-Time Polished Draft¶
After each create, replace, apply, insert, delete, or move operation, the plugin automatically rewrites <Title>_Polished.docx in the workspace root, and simultaneously maintains a fixed preview file at .gongwen-writer/preview/Current_Polished_Draft.docx. Once the sidebar “Polished Draft” button or the present file card is opened, subsequent modifications are automatically refreshed.
Political Language Verification¶
The plugin scans conference dates, conference names/session numbers, leaders’ titles, important speech content, important directives, document numbers, and fixed phrasings. It only accepts body text from official government website sources and authoritative outlets such as People’s Daily Online, Communist Party Members Network, and Xinhua News Agency, producing a verdict of “Verified / Conflict / Unverified / Requires Manual Review.” By default it only reports; when autoCorrect=true, it only auto-replaces dates and document numbers that have an exact official source sentence. The verification report is written to the project’s factcheck.md and factcheck.json. Before export, if verification has not been performed, the body has been modified after verification, or P0 unresolved items remain, a factcheckWarning is returned.
Official WeChat Public Account Research¶
Use gongwen_research action=search sources:["wechat"] to discover mp.weixin.qq.com articles, and action=read to open and verify the public account name via local Chrome. Only whitelisted official accounts can be saved as official reference materials. Reading requires DSH approval and Chrome is automatically closed upon completion.
Project Memory and Refinement¶
The plugin automatically injects focus areas, audience/speaker, structure, framework candidates, confirmed items, pending tasks, and recent changes. gongwen_polish supports structure review, paragraph-by-paragraph, sentence-by-sentence, alternative proposals, adopt/discard, and history rollback. Each modification records before/after content, rationale, and timestamp.
Installation and Activation¶
From DSH Plugin Marketplace¶
Search for “Official Document Writing Assistant” or gongwen-writer in the DSH plugin marketplace and click Install.
From npm¶
dsh plugin --profile <profile> add gongwen-writer
From Source¶
git clone https://github.com/hexiaobai2012/gongwen-writer.git
dsh plugin --profile <profile> add ./gongwen-writer
Environment Requirements¶
- DeepSeek Harness, Node.js >= 22;
- Python 3.10+ with
python-docxinstalled (usually included in the DSH built-in runtime); - Optional: local Chrome, for reading WeChat public accounts or pages requiring browser rendering.
Check the environment:
gongwen_export action=doctor
Typical Usage¶
Quick Start¶
Type the following in a DSH conversation:
Help me draft a notice on conducting a special fire safety inspection.
The issuing authority is the Office of XX County People's Government,
and the primary recipients are all townships and county-level departments.
The first round will perform research and present 3 framework candidates, along with a clear explanation of focus areas, title, subheadings, and logical chain. Body text is only written after a framework is selected.
After the initial draft is generated:
Start the refinement.
Progress paragraph by paragraph; for sentence-level detail, say “go sentence by sentence on this paragraph.” When done, simply say “export.”
Tool Commands¶
| Tool | Purpose |
|---|---|
gongwen_draft |
guide / import / brief / create / frames / select_frame / get / update / set_outline / replace / insert / delete / move / render |
gongwen_polish |
start / structure / next / show / focus / propose / apply / discard / skip / finish / status / rewind / history |
gongwen_memory |
get / save / brief |
gongwen_research |
search / read / list / remove (includes official WeChat public accounts) |
gongwen_factcheck |
scan / check / verify |
gongwen_browser |
open / close / status |
gongwen_export |
export / doctor |
Data and Privacy¶
Project data, previews, reports, and reference materials are all stored in the workspace under .gongwen-writer/. No API key is embedded, and official documents are never proactively uploaded. Browser and WeChat public account reading require user approval; research only accesses official sources explicitly requested by the user. When cloud models/cloud search are used, data is sent to the respective service provider per DSH configuration. Generated .docx files and the .gongwen-writer/ directory should not be committed to public repositories.
Data locations:
<workspace>/
<Title>_Polished.docx # Rebuilt in real time after each modification
.gongwen-writer/
preview/Current_Polished_Draft.docx # Stable sidebar preview
preview.json
projects/<project-id>/project.json # Metadata, paragraphs, memory, revisions
projects/<project-id>/draft.md
projects/<project-id>/refs/
Use Cases and Cautions¶
gongwen-writer is suitable for scenarios involving Chinese official document writing, GB/T 9704 formatting, and political language verification. The plugin runs with the current DSH process permissions; review the source code and license before installation. The plugin is open-sourced under the MIT license, maintained by Alex (hexiaobai2012).
Known Limitations¶
- The current implementation covers the core GB/T 9704 layout but does not include special formats such as red-letter headers, editorial notes, or table name cards;
- PDF/scanned document OCR is not yet supported;
- Fact verification is an auxiliary tool and cannot replace manual review and sign-off;
- WeChat public accounts may trigger verification pages, requiring a retry or opening via mobile;
- Client Slots for different DSH versions may require a page refresh to take effect.
Summary¶
gongwen-writer encapsulates the entire official document writing workflow — from research, framework candidates, format rendering, and real-time polishing to political language verification and project memory — into a single reusable plugin. For developers or teams that frequently handle Chinese official documents, this significantly improves efficiency while ensuring format compliance and phrasing accuracy.
- Plugin directory: https://www.skillhub.cn/plugins/hexiaobai2012/gongwen-writer
- GitHub: https://github.com/hexiaobai2012/gongwen-writer