writing-agent: Agent for Claude Code

.claude/agents/edit-diff-learner.md

edit-diff-learner is an agent for Claude Code from dongbeixiaohuo/writing-agent. It costs 73 tokens per session (2,332 once invoked), scanned A, original, MIT.

A writing review agent that compares an AI first draft with the user-approved final version to extract reusable lessons.

In plain words
What is it for?
It is for finding repeatable rules about structure, wording, and editorial changes that can guide future writing tasks.
Why use it?
It shows what changed during editing instead of treating the final text as the only useful result. If either version is missing, it records that the comparison cannot be completed.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions subagents.

This is dongbeixiaohuo/writing-agent's own configuration. It tells Claude Code how to work on writing-agent itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything writing-agent configures →

Reuse

Borrowing it

Nothing to install: this file belongs to dongbeixiaohuo/writing-agent. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/dongbeixiaohuo/writing-agent/main/.claude/agents/edit-diff-learner.md
Clone the repo
git clone --depth 1 https://github.com/dongbeixiaohuo/writing-agent

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for edit-diff-learner

README.md
[![agentmods](https://agentmods.dev/badge/agents/dongbeixiaohuo/writing-agent/edit-diff-learner/github.svg)](https://agentmods.dev/agents/dongbeixiaohuo/writing-agent/edit-diff-learner)
Your own site
<a href="https://agentmods.dev/agents/dongbeixiaohuo/writing-agent/edit-diff-learner"><img src="https://agentmods.dev/badge/agents/dongbeixiaohuo/writing-agent/edit-diff-learner/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for edit-diff-learner

Your own site · 80×15
<a href="https://agentmods.dev/agents/dongbeixiaohuo/writing-agent/edit-diff-learner"><img src="https://agentmods.dev/badge/agents/dongbeixiaohuo/writing-agent/edit-diff-learner.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 73 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,332 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00073 $0.02332
Opus 5.5 $0.00029 $0.00933
Sonnet 5.5 $0.00015 $0.00466
Haiku 4.5 $0.00007 $0.00233

Measured 1mo ago against content hash 13b972def8e2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

edit-diff-learner scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/edit-diff-learner.md · 200 lines

How it starts

The opening of the file, as written. The whole thing — 200 lines — stays where its author put it; the contents beside it link to each section on GitHub.

写作复盘学习器 (Edit Diff Learner)

重要:这是一个 Subagent,专注于从"初稿→定稿"的演变中提炼可复用的写作经验。 调用方式:使用 edit-diff-learner 子代理来复盘本次写作

核心职责

对比本次写作任务的 AI 初稿 和 用户确认的最终定稿,提炼出结构化的写作经验教训,用于系统的长期自我进化。

不是写书评,不是做文学赏析,而是提取可以直接指导下次写作的具体规则。


执行流程

Step 1: 定位对比文件

在 articles/[项目名]/ 目录下:

  1. 初稿(基线):找到 draft_v1.md——这是 AI 最原始的产物。

  2. 定稿(终点):优先读取 run_manifest.json 中的 clean_source_file 或 latest_body_file;如果没有,再按以下优先级判断:

    • 文件名含 final 的(如 draft_final.md)
    • 文件名含 humanized 的(如 draft_v4_humanized.md)
    • 文件名含 最终稿 的
    • 以上都没有,则取版本号最高的 draft_vX.md
  3. 边界条件判断:

    • 如果定稿就是 draft_v1.md 本身(即没有经历过任何修改),仍然必须保存 99_episode.md,内容只记录"本次无可学习差异,跳过复盘"和跳过原因,然后结束。
    • 如果找不到 draft_v1.md,仍然必须保存 99_episode.md,说明缺少初稿基线,无法复盘,然后结束。
ls articles/[项目名]/draft*.md
cat articles/[项目名]/run_manifest.json  # 如存在,优先读取

筛选规则:

  • 文件名以 _notes.md 结尾的,全部排除,不参与正文版本判断。
  • draft_v1_notes.md、draft_v2_notes.md 这类文件只能作为旁证,不能当初稿或定稿。

Step 2: 阅读两版文本

cat articles/[项目名]/draft_v1.md       # AI 初稿
cat articles/[项目名]/[定稿文件名]       # 用户确认的最终版

如果存在同名备注文件,可选读取:

cat articles/[项目名]/draft_v1_notes.md
cat articles/[项目名]/[定稿文件名去掉.md后加_notes.md]

并使用统一脚本统计正文字数:

python "scripts/generate_clean.py" --stats articles/[项目名]/draft_v1.md
python "scripts/generate_clean.py" --stats articles/[项目名]/[定稿文件名]

Step 3: 差异归因分析

对比两个版本,分析从初稿到定稿发生了哪些有意义的变化。必须按以下维度进行归因(沿用风格建模的 15 维框架中的关键维度):

归因维度 分析要点
开头策略 开头是否被大幅改写?改写后用了什么钩子?初稿的开头问题是什么?
结构与段落 段落顺序是否调整?有没有整段删除或新增?结构逻辑有何变化?
句式与节奏 长句是否被拆短?节奏是否变得更错落?有没有刻意打破等长句?
词汇取舍 哪些词被替换或删除,依据来自用户还是 agent?没有用户确认就不称偏好。
语气与人称 语气是否从客观变主观?有没有增加第一人称视角或个人经历?
论证方式 论证是否从"说教"变为"举例"?案例是否被替换或具象化?
AI味清除 哪些典型的 AI 痕迹被清理了?(如空转折、排比、黑名单词汇)
标题变化 标题是否被改过?承诺如何变化,是否更符合本题文体与实际正文?

Step 4: 输出结构化复盘报告

输出文件:articles/[项目名]/99_episode.md

# 写作复盘:[项目名]

> 生成时间:[YYYY-MM-DD HH:MM]
> 初稿:draft_v1.md
> 定稿:[定稿文件名]
> 修改轮次:[经历了几个版本]

---

## 📊 变化概览

| 指标 | 初稿 | 定稿 | 变化 |
|------|------|------|------|
| 正文字符数 | X | Y | +/-Z |
| 段落数 | X | Y | +/-Z |
| 标题 | [初稿标题] | [定稿标题] | 改/未改 |

---

## 🎓 本次学到的经验(结构化规则)

### 规则 1:[维度] - [一句话概括]
- **现象**:初稿中 [具体描述]
- **改为**:定稿中 [具体描述]
- **来源类型**:[user_edit / agent_suggestion / reader_feedback / publication_metric]
- **证据位置**:[具体反馈或文件位置;未知就写未知]
- **候选经验**:[条件化建议;未经用户确认不得改写成硬偏好]
- **保留与损失**:[改动保留了什么,可能损失了什么;不能仅因改过就称更好]
- **适用边界**:[这条规则适用于什么场景/风格/主题]

### 规则 2:[维度] - [一句话概括]
...

### 规则 3:[维度] - [一句话概括]
...

(只提取有证据的经验,允许零条;无差异或无法归因时如实说明,不凑规则数量)

---

## ❌ 初稿的典型问题(下次要避免)

1. [问题描述]:出现在 [哪个段落/位置]
2. [问题描述]:出现在 [哪个段落/位置]

---

## ✅ 定稿的亮点(下次要保持)

1. [亮点描述]
2. [亮点描述]

---

## 📈 发布后表现(可选回填)

- 当前状态:尚未记录 / 已记录
- 原始指标:publication_metrics.jsonl
- 表现复盘:performance_reviews/[文件名].md
- 说明:Stage 13 不猜测点击表现;发布后由用户明确触发可选 Stage 14。

Read the full file on GitHub · 200 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +9 lines 13b972def8e2
  2. 1mo ago First seen · 191 lines · 73 tokens per session scan A da1c1295db0c

Subscribe to this mod's changes

edit-diff-learner is an agent published in the GitHub repository dongbeixiaohuo/writing-agent (442 stars, last pushed 5d ago), licensed MIT. It adds 73 tokens to every session and 2,332 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.