WriteHarness
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WriteHarness Propose a patch to S1.3 to tighten the intro and cite Kim 2019"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
WriteHarness
File-first 科研深度长文 × 微信公众号写作 Harness(MCP Server + CLI + 薄 Web 伴侣台)
核心哲学:$\text{Writing Agent} = \text{AI Host (T3 Code / Cursor / Claude Code)} + \text{WriteHarness}$
不重造聊天壳、不重造富文本编辑器、不堆多模型审批流。把对话、多 Agent 协同和代码能力交给现有最强 AI 宿主;WriteHarness 专心做好四件通用工具干不好的硬活: ① 精准三溯源(PDF 原页 / 网页离线快照 / 发布元数据) · ② 短编号定点改稿与红绿 Diff 门禁 · ③ 确定性体检与封顶式自进化法则 · ④ 一源双发(微信公众号草稿箱 + 离线知识库静态页)。
核心特性
单一事实源(File-first + Git):每篇文章正文唯一位于
workspace/<slug>/article.md(纯标准 Markdown + YAML Frontmatter),绝不往正文插入私有 HTML 注释块;引文只使用人类可读的[@citekey]。SQLite 仅作.harness/index.sqlite可随时删除重建的 FTS5 派生索引。精准三溯源双向联动:支持 PDF、网页 URL、DOI(自动补全 Crossref 出版元数据)与本地代码不可变归档到
sources/<sha8>/。在 Web 伴侣台点击任意正文引文,右侧直接呈现 PDF.js 原文精确页码渲染、沙箱隔离网页离线快照或带行号代码切片;点击来源卡片可反向跳转全部引用段落。短编号定点协同 & 写隔离红绿 Diff:正文自动编号为清爽的
S1.1、S2.3(并支持 T3 Code 内置浏览器元素点选data-block-id)。AI 禁止静默覆写正文,只能经由 MCP 工具propose_patch_tool提交修改提案;网页通过 WebSocket 秒级亮出词级红绿 Diff,点 接受 原子写回并自动 Git Commit,点 退回 可顺手勾选记入长期写作偏好。反膨胀克制设计:
Web 伴侣台严格守在 3 个主 Tab(
阅读与溯源/体检与批注/排版与发布)+ 1 个只读「编委抽屉」(透明查看 6 角色提示词与绑定工具);用 3 套写作模式预设(
硬核推导/公众号长文/速写草稿)取代一堆碎片参数滑块;个人写作法则库
playbooks/global-rules.md严格封顶 ≤ 15 条(满额进一出一),杜绝“规则垃圾场”。
一源双发 & 微信草稿箱直推:同一份
article.md一键渲染为 4 套微信公众号内联主题(Stripe Docs / 石墨极简 / Medium / 课程讲义)并在 390px 手机壳实时预览,内置纯 Python 合规校验与官方微信公众号草稿箱 API(支持--dry-run安全预检,止步草稿箱),同时可导出带交互溯源弹窗的独立离线知识库 HTML 页面。
Related MCP server: vibelore
系统架构
T3 Code / Cursor / Claude Code / Claude Desktop
│ (MCP stdio / streamable-http)
▼
┌──────────────────────────────────────────────────────┐
│ WriteHarness MCP Server & CLI │
│ 7 Atomic Tools + 2 Resource Families (agents/rules) │
└──────────────┬────────────────────────┬──────────────┘
│ │
▼ ▼
workspace/<slug>/ (Git Truth) Single-Process Web UI
├── article.md (Markdown) http://127.0.0.1:4173
├── sources/<sha8>/ (PDF/HTML) ├── 阅读与三溯源 (PDF.js/KaTeX)
├── ledger/ (claims/inbox/diff) ├── 体检与批注队列 + 法则库
└── out/ (WeChat + KB HTML) └── 390px 微信排版预览 & 双发快速安装
前置依赖
Python 3.11+
Node.js 20+(仅从源码首次构建前端时需要;安装打包好的
.whl发行包时无需 Node)
方式 1:从源码本地安装(推荐开发者与持续打磨)
git clone https://github.com/cihebiyql/write-harness.git
cd write-harness
# 1. 构建薄 Web 前端
cd web && npm install && npm run build && cd ..
# 2. 可编辑安装 Python 包(自动注册 write-harness 与 write-harness-mcp 命令)
pip install -e .方式 2:打包成标准 Wheel 分发包
python scripts/build_dist.py
# 生成 dist/write_harness-0.1.0-py3-none-any.whl(已内嵌前端静态产物与默认角色库)
pip install dist/write_harness-0.1.0-py3-none-any.whlMCP Server 配置指南
WriteHarness 是一个标准的 MCP (Model Context Protocol) Server,提供独立启动命令 write-harness-mcp(等价于 python -m harness.mcp_server)。
1. 在 T3 Code / Cursor / Claude Desktop 中配置
在你的 MCP 配置文件(如 .cursor/mcp.json、claude_desktop_config.json 或 T3 Code MCP 设置)中加入:
{
"mcpServers": {
"write-harness": {
"command": "write-harness-mcp",
"env": {
"WRITE_HARNESS_HOME": "/absolute/path/to/your/write-harness"
}
}
}
}如果使用虚拟环境或未将 Scripts 加入 PATH,也可把
"command"改为你的 Python 路径,并加"args": ["-m", "harness.mcp_server"]。
2. 在 Claude Code 中一行接入
claude mcp add write-harness --env WRITE_HARNESS_HOME=/path/to/write-harness -- write-harness-mcp3. 暴露的 MCP 能力清单
类型 | 名称 | 权限 / 说明 |
Tool |
| 列出当前工作区全部文章、阶段、模式与块数 |
Tool |
| 按短编号(如 |
Tool |
| 三溯源不可变入库(PDF / 网页 URL / DOI / 本地代码)并重建 FTS5 索引 |
Tool |
| 检索已入库 PDF 页码、网页快照与代码切片 |
Tool |
| 读取网页端勾选段号提交的定点批注队列 |
Tool |
| 唯一写提案口:提交待审红绿 Diff,严禁直接覆写 |
Tool |
| 运行确定性传感器:证据断链、图片限制、模式阈值与微信 HTML 校验 |
Resource |
| 读取当前生效的个人写作法则库(硬上限 ≤ 15 条) |
Resource |
| 读取 6 位专职编委角色提示词(如 |
日常写作闭环(5 分钟上手)
1. 启动单进程薄 Web 伴侣台
write-harness ui --port 4173
# 或 Windows 双击 start.bat打开 http://127.0.0.1:4173(或直接在 T3 Code 内置浏览器预览 localhost:4173)。仓库内置了一篇完整端到端样稿 workspace/xgboost-deep-dive(《手推 XGBoost:从残差拟合到二阶牛顿树》,含 KDD 2016 / NeurIPS 2017 原论文 PDF、官方文档离线快照与纯 NumPy 实跑复现脚本),启动即可体验。
2. 创建新文章与三溯源入库
# 初始化新选题
write-harness init my-topic --title "文章标题" --theme stripe
# 入库论文 PDF(自动按页切片 + Crossref 补齐 DOI 出版信息)
write-harness ingest my-topic https://arxiv.org/pdf/1603.02754.pdf \
--citekey chen2016xgboost --tier primary_evidence --doi 10.1145/2939672.2939785
# 入库网页离线快照 / 本地实跑代码
write-harness ingest my-topic https://xgboost.readthedocs.io/en/stable/tutorials/model.html --citekey xgbdocs
write-harness ingest my-topic ./workspace/my-topic/raw/exp.py --citekey expcode3. 三种顺手的定点改稿姿势
直接口头报编号:在 T3 Code / Cursor 聊天框说「把
S1.2改得更接地气,让科学编辑复核S4.5的公式」,AI 自动调用多角色协同并通过propose_patch_tool把红绿 Diff 推回网页。T3 Code 内置浏览器点选模块:页面段落自带
id="block-S1.2" data-block-id="S1.2",点选加入聊天框即可精准定位。网页勾选攒批注:点击段落左侧短编号按钮勾选多段 → 底部弹出派单条写入队列 → 在 AI 宿主里说一句「处理网页批注」批量协同修改;小错字直接双击段落原地写回。
4. 硬校验与一源双发(含微信草稿箱)
# 渲染微信公众号 HTML(4 主题可选:stripe / minimal / medium / course)与独立离线知识库网页
write-harness render xgboost-deep-dive --theme stripe
# 运行确定性体检(0 ERROR 方可推送)
write-harness check xgboost-deep-dive
# 微信草稿箱安全预检(不发网络请求)
write-harness publish-wechat xgboost-deep-dive --theme stripe --dry-run
# 配置 .env 中的 WECHAT_APP_ID / WECHAT_APP_SECRET 后真实写入微信草稿箱(止步草稿箱,绝不自动群发)
write-harness publish-wechat xgboost-deep-dive --theme stripe微信草稿箱凭证配置:复制
.env.example为.env并填入公众号WECHAT_APP_ID与WECHAT_APP_SECRET(.env已在.gitignore中忽略,切勿提交到仓库)。
预设 6 角色与目录结构
角色文件 | 定位 | 绑定工具型能力 |
| 检索资料 |
|
| 深度撰稿 |
|
| 润色去味 |
|
| 科学编辑审核 |
|
| 平台内容审稿 | 公众号合规/钩子/节奏 + 知识库深度双维审稿 |
| 排版与视觉分镜 | 4 主题微信渲染、离线知识库导出、草稿箱 API 封装 |
write-harness/
├── AGENTS.md # AI 宿主协作铁律与命令速查
├── agents/ # 6 份精简可读的角色提示词(Git 托管)
├── playbooks/ # 个人写作法则库(硬上限 <= 15 条防熵增)
├── harness/ # 纯 Python 内核(MCP Server / CLI / FastAPI / 三溯源 / 微信 API)
├── web/ # 薄 React + Tailwind + KaTeX + PDF.js 伴侣台(3 主 Tab + 编委抽屉)
├── scripts/build_dist.py # 一键打包 wheel/sdist
└── workspace/ # 写作项目区(内含 xgboost-deep-dive 完整示例)License
Available Tools
7 toolsget_article_contextC
Get bounded article context by short block IDs (e.g. ['S2.3']), plus active playbooks & agent roles.
Inputs: slug (required), scope, targets. Returns: result
ingest_source_toolB
Ingest a PDF file, code file, or web URL into immutable sources// and rebuild FTS index.
Inputs: slug (required), input_ref (required), doi, year, +6 more. Returns: result
list_articlesA
List all article workspaces with their stage, mode, block count, and pending diff count.
Inputs: no named parameters. Returns: result
propose_patch_toolB
Write-isolated patch proposal. Never overwrites article.md; sends a reviewable diff to the Web UI.
Inputs: slug (required), block_id (required), rationale (required), new_markdown (required), +3 more. Returns: result
read_inbox_toolC
Read targeted block annotations submitted from the Web companion UI.
Inputs: slug (required), only_open. Returns: result
run_diagnostics_toolB
Run deterministic checks: provenance, anchor integrity, image limits, readability & WeChat HTML checks.
Inputs: slug (required). Returns: result
search_sources_toolC
Search indexed PDF pages, web snapshots, and code chunks in the project's sources.
Inputs: slug (required), query (required), tier, limit. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The seven tools mostly map to distinct operations: source ingestion vs. source search are clearly separated by read/write semantics, and propose_patch_tool vs. run_diagnostics_tool are unmistakably divergent. The only mild overlap is read_inbox_tool (block annotations/pending diffs) versus list_articles (which also reports pending diff counts), which could blur where an agent goes to inspect review state.
Naming is readable but inconsistent: five tools use a verb_noun pattern with a redundant `_tool` suffix, while list_articles and get_article_context use bare names without the suffix. Within that pattern, `ingest_source_tool` and `search_sources_tool` vary singular/plural on the same noun.
Seven tools is well within the ideal 3-15 range for a writing harness covering ingestion, retrieval, review, context, patching, and diagnostics. Each tool corresponds to a distinct phase of the article workflow rather than being filler.
The surface covers the full ingest → search → read inbox → get context → propose patch → diagnose loop, but has notable gaps: there is no tool to create a new article workspace (only list existing ones), no way to resolve or reply to inbox annotations, and no tool to remove or refresh an ingested source. These are workable around via the Web companion UI, so the gaps are minor rather than blocking.
Maintenance
Related MCP Connectors
A blog CMS that AI agents write into over MCP: Markdown drafts, versions, media, human approval.
Publish Git-backed multilingual novels with agents, safe layouts, reviews, and author approval.
Versioned artifact review for people and AI agents, with contextual comments and human control.
MCP-native collaborative markdown editor with real-time AI document editing
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables managing WeChat Official Account content as code, with Markdown editing, review, image processing, approval workflows, and draft publishing through a local MCP server.MIT
- AlicenseAqualityBmaintenanceEnables AI hosts to plan, draft, and check long-form novel chapters while honoring canon settings, character state, arcs, and check ordering, with approval-gated atomic commits. It keeps world, character, and chapter files as the human-editable source of truth, with snapshots and rollback for recovery.2713 npmApache 2.0
- AlicenseAqualityBmaintenanceEnables local-first document versioning with content-addressable storage, word-level AST diffs, and AI-compliance auditing for LLM agents.6MIT
- AlicenseAqualityCmaintenanceEnables AI tools to preview and publish Markdown articles to WeChat Official Accounts, automatically converting content into WeChat-optimized HTML and handling cover images. Also lets users query publish status and read/like/comment statistics through natural language.51MIT