wiki-self-heal

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

wiki-self-heal

wiki-self-heal

Audit → research → fill → commit. An autonomous pass over a Karpathy-style LLM wiki that finds what's weak or missing, researches high-quality answers, writes them into the wiki, and commits to a dedicated branch for human review.
Inspired by Karpathy's
autoresearch
loop: isolated branch per run, explicit CAN/CANNOT rules, numbered steps, structured logging, simplicity criterion, and a NEVER STOP autonomy directive once the loop begins.
审核 → 研究 → 填补 → 提交。对Karpathy风格的LLM wiki进行自主处理,找出内容薄弱或缺失的部分,研究高质量答案,将其写入wiki,并提交到专用分支供人工审核。
灵感来自Karpathy的
autoresearch
循环:每次运行使用独立分支、明确的CAN/CANNOT规则、分步流程、结构化日志、简洁性准则,以及循环启动后永不停止的自主指令。

When to use

使用场景

User says: "lint my wiki", "self-heal", "find gaps", "auto-research my wiki", "update my second brain", "health check my wiki", "audit my wiki" or "dry run" (audit-only mode), or has scheduled this skill via cron / GitHub Actions / Claude Code triggers.
用户提出以下需求时使用:“lint我的wiki”“自修复”“查找缺口”“自动研究我的wiki”“更新我的第二大脑”“对我的wiki进行健康检查”“审核我的wiki”或“试运行”(仅审核模式),或者通过cron/GitHub Actions/Claude Code触发器定期调度此技能。

Two modes

两种模式

  • Full mode (default) — audit → research → apply → commit. Changes the wiki on a heal branch.
  • Audit-only mode — audit → report. No research, no changes to wiki pages. The audit report itself is still committed to the branch.
Infer the mode from phrasing. If the user says "dry run", "just audit", "audit only", "don't make changes", or "show me the gaps first" → audit-only. If the user just says "lint" or "self-heal" → full mode. If unsure, ask once.
  • 完整模式(默认)——审核→研究→应用→提交。在heal分支上修改wiki。
  • 仅审核模式——审核→报告。不进行研究,不修改wiki页面。审核报告仍会提交到分支。
根据用户表述推断模式。如果用户提到“试运行”“仅审核”“只做审核”“不要修改”或“先让我看看缺口”→仅审核模式。如果用户只说“lint”或“自修复”→完整模式。若不确定,询问一次。

Preconditions

前置条件

Before doing anything:
  1. The vault has Karpathy wiki structure:
    raw/
    ,
    wiki/
    ,
    CLAUDE.md
    ,
    wiki/index.md
    ,
    wiki/log.md
    . If any are missing → stop and suggest running the
    llm-wiki-setup
    skill first.
  2. The vault is a git repo. If not →
    git init && git add . && git commit -m "chore: pre-heal snapshot"
    before continuing.
  3. The git working tree is clean. If dirty → stop and ask the user to commit or stash first.
在执行任何操作前:
  1. 知识库需具备Karpathy wiki结构:
    raw/
    wiki/
    CLAUDE.md
    wiki/index.md
    wiki/log.md
    。若缺少任一文件→停止操作,建议先运行
    llm-wiki-setup
    技能。
  2. 知识库需为git仓库。若不是→先执行
    git init && git add . && git commit -m "chore: pre-heal snapshot"
    再继续。
  3. git工作树需干净。若有未提交变更→停止操作,要求用户先提交或暂存。

Research tool selection

研究工具选择

At the start of the first run in a session, ask once:
I'll default to WebSearch + WebFetch for research. If you have any of these MCPs installed for higher-quality sources, let me know which and I'll prefer them: Apify, Firecrawl, Exa.
Priority order when available: Exa → Firecrawl → Apify → WebSearch/WebFetch. Fall back to the next tool on any failure. Never block the loop on tool selection — WebSearch + WebFetch always work.
在会话中首次运行时,询问用户一次:
我默认使用WebSearch + WebFetch进行研究。如果您安装了以下任一MCP以获取更高质量的数据源,请告知我,我会优先使用:Apify、Firecrawl、Exa。
工具优先级(若可用):Exa → Firecrawl → Apify → WebSearch/WebFetch。若某工具失败,自动 fallback到下一个工具。切勿因工具选择阻塞循环——WebSearch + WebFetch始终可用。

First-run guidance

首次运行指南

The first time this skill runs on a populated wiki, expect the audit to find many gaps. That is normal — the wiki has never been linted before.
Strong recommendation: use audit-only mode for the first run on any vault. Let the user read the audit report, understand the landscape, and decide priorities before any research pass writes pages. Don't dump 50 new pages into a wiki on the first pass without the user seeing what's coming.
If the vault is nearly empty (< 5 wiki pages), skip self-heal entirely — there's nothing meaningful to audit. Suggest the user ingest some sources first.
首次在已填充内容的wiki上运行此技能时,审核可能会发现大量缺口,这是正常现象——wiki此前从未被检查过。
强烈建议:对任何知识库首次运行时使用仅审核模式。让用户先阅读审核报告,了解整体情况,再决定优先级,之后再进行研究并写入内容。切勿在首次运行时未经用户确认就向wiki添加50个新页面。
若知识库几乎为空(少于5个wiki页面),则完全跳过自修复——没有可审核的有意义内容。建议用户先导入一些数据源。

The loop

循环流程

Full procedure with commands and edge cases in references/loop.md. Core sequence:
  1. Read state
    CLAUDE.md
    ,
    wiki/index.md
    , last 10 entries of
    wiki/log.md
    .
  2. Create branch
    git checkout -b wiki-heal/$(date +%Y-%m-%d)
    . Append
    -2
    ,
    -3
    , etc. if a branch for today already exists.
  3. Audit — scan for the 6 gap types per references/audit.md. Write findings to
    wiki/audits/audit-<date>.md
    and add an entry under the
    ## Audits
    section of
    wiki/index.md
    .
  4. Audit-only early exit — if audit-only mode: commit the audit report and index update, append the log entry, print the audit-only report, stop.
  5. Prioritize — pick top N (default N=3) high-severity, skill-addressable gaps. Skip gaps needing human judgment.
  6. Research each gap — apply the quality gates in references/research-quality.md. Every factual claim needs ≥ 2 independent sources. Reject SEO spam and content farms.
  7. Apply — create or update wiki pages with cited findings. Update
    wiki/index.md
    . Add bidirectional
    [[wikilinks]]
    .
  8. Log — append one consolidated entry to
    wiki/log.md
    per references/log-format.md.
  9. Commit
    git add wiki/ && git commit -m "heal: <n> gaps addressed, <s> skipped"
    . Leave on branch. Do not merge.
  10. Report — print the final summary in the format below.
包含命令和边缘情况的完整流程见references/loop.md。核心步骤:
  1. 读取状态——读取
    CLAUDE.md
    wiki/index.md
    wiki/log.md
    的最后10条记录。
  2. 创建分支——执行
    git checkout -b wiki-heal/$(date +%Y-%m-%d)
    。若当日已有同名分支,则追加
    -2
    -3
    等后缀。
  3. 审核——根据references/audit.md扫描6类缺口。将结果写入
    wiki/audits/audit-<date>.md
    ,并在
    wiki/index.md
    ## Audits
    部分添加一条记录。
  4. 仅审核模式提前退出——若为仅审核模式:提交审核报告和索引更新,追加日志条目,打印仅审核报告,停止操作。
  5. 优先级排序——挑选前N个(默认N=3)高优先级、技能可处理的缺口。跳过需要人工判断的缺口。
  6. 逐个研究缺口——应用references/research-quality.md中的质量标准。每个事实性声明需至少2个独立数据源。拒绝SEO垃圾内容和内容农场。
  7. 应用变更——创建或更新wiki页面并添加引用来源。更新
    wiki/index.md
    。添加双向
    [[wikilinks]]
  8. 记录日志——根据references/log-format.md
    wiki/log.md
    追加一条整合记录。
  9. 提交变更——执行
    git add wiki/ && git commit -m "heal: <n> gaps addressed, <s> skipped"
    停留在分支上,不要合并
  10. 生成报告——按以下格式打印最终总结。

Simplicity criterion

简洁性准则

All else equal, fewer new pages wins. A 1-source stub that only restates what's already in
[[related-page]]
should be skipped or merged into the existing page, not created as its own file. Prefer updating existing pages over creating new ones when a concept already has a home. Adding 20 thin orphan pages is a regression, not progress.
If a run ends with zero new pages because all gaps were better addressed by updating existing pages → that is a successful run, not a failed one. Report it accordingly.
在其他条件相同的情况下,新增页面越少越好。仅重述
[[related-page]]
已有内容的单来源 stub应被跳过或合并到现有页面,而非创建新文件。当概念已有对应页面时,优先更新现有页面而非创建新页面。添加20个内容单薄的孤立页面是倒退,而非进步。
若某次运行因所有缺口都更适合通过更新现有页面解决而未新增任何页面→这是一次成功的运行,而非失败。需如实报告。

CAN / CANNOT

允许/禁止操作

CAN:
  • Create new wiki pages (when justified by the simplicity criterion)
  • Update existing wiki pages
  • Update
    wiki/index.md
    (including a new
    ## Audits
    section if one doesn't exist yet)
  • Append to
    wiki/log.md
  • Create
    wiki/audits/audit-<date>.md
  • Download new sources to
    raw/
    if research pulls in a fresh document (note in log)
  • Create a heal branch and commit to it
CANNOT:
  • Modify any existing file in
    raw/
  • Delete any wiki page (always flag for human review instead)
  • Add any factual claim without ≥ 2 qualifying sources
  • Merge the heal branch into main
  • Skip the log or commit step
  • Pause the loop to ask "should I continue?" (see Autonomy rule below)
允许
  • 创建新的wiki页面(符合简洁性准则时)
  • 更新现有wiki页面
  • 更新
    wiki/index.md
    (若
    ## Audits
    部分不存在则添加)
  • wiki/log.md
    追加内容
  • 创建
    wiki/audits/audit-<date>.md
  • 若研究获取到新文档,将其下载到
    raw/
    (在日志中注明)
  • 创建heal分支并提交变更
禁止
  • 修改
    raw/
    中的任何现有文件
  • 删除任何wiki页面(需标记后供人工审核)
  • 添加无至少2个合格来源支持的事实性声明
  • 将heal分支合并到主分支
  • 跳过日志或提交步骤
  • 暂停循环询问“是否继续?”(见下方自主规则)

Autonomy rule

自主规则

Once the loop begins (after preconditions and tool selection), do not pause to ask the human if you should continue. The human may be asleep, away, or expecting autonomous operation. Work through the top-N gaps, then stop and report. Only stop early if:
  • A CANNOT rule would be violated
  • Quality gates fail for all sources on a gap → skip that gap, log reason, continue to the next
  • The heal branch has drifted from main by more than 50 commits → stop and report
  • A git operation fails → stop and report
循环启动后(完成前置条件和工具选择后),请勿暂停询问用户是否继续。用户可能正在睡觉、不在场或期望自主运行。处理完前N个缺口后停止并报告。仅在以下情况提前停止:
  • 即将违反禁止规则
  • 某缺口的所有数据源均未通过质量标准→跳过该缺口,记录原因,继续处理下一个
  • heal分支与主分支差异超过50次提交→停止并报告
  • git操作失败→停止并报告

Scheduling

调度建议

Recommended cadence: weekly for active vaults (daily or near-daily ingest), monthly for slow vaults, on-demand after each research burst. Full recipes in references/scheduling.md — macOS launchd/cron, GitHub Actions (opens a PR automatically), and Claude Code scheduled triggers.
First run guidance: always run
wiki-self-heal
manually at least once — ideally in audit-only mode — before automating it. Never schedule a skill you haven't observed end-to-end.
推荐频率:活跃知识库(每日或近每日导入内容)每周一次,低活跃度知识库每月一次,每次研究爆发后按需运行。完整配置方案见references/scheduling.md——macOS launchd/cron、GitHub Actions(自动创建PR)、Claude Code定时触发器。
首次运行指南:在自动化前,至少手动运行一次
wiki-self-heal
——理想情况下使用仅审核模式。切勿调度未全程观察过的技能。

Output format

输出格式

Full mode

完整模式

Wiki self-heal pass — <YYYY-MM-DD>
Branch: wiki-heal/<tag>
Mode:   full

Audit:     <N> gaps found (HIGH: <h>, MEDIUM: <m>, LOW: <l>)
Addressed: <n>
Skipped:   <s>

New pages:
  - [[<page>]] — <one-line summary> (sources: <k>)

Updated pages:
  - [[<page>]] — <what changed>

Skipped gaps:
  - [<type>] <title> — reason: <short reason>

Sources added: <k>
Commit:        <short-hash>
Status:        keep

Review: git diff main..wiki-heal/<tag>
Merge:  git checkout main && git merge wiki-heal/<tag>
Wiki self-heal pass — <YYYY-MM-DD>
Branch: wiki-heal/<tag>
Mode:   full

Audit:     <N> gaps found (HIGH: <h>, MEDIUM: <m>, LOW: <l>)
Addressed: <n>
Skipped:   <s>

New pages:
  - [[<page>]] — <one-line summary> (sources: <k>)

Updated pages:
  - [[<page>]] — <what changed>

Skipped gaps:
  - [<type>] <title> — reason: <short reason>

Sources added: <k>
Commit:        <short-hash>
Status:        keep

Review: git diff main..wiki-heal/<tag>
Merge:  git checkout main && git merge wiki-heal/<tag>

Audit-only mode

仅审核模式

Wiki audit — <YYYY-MM-DD>
Branch: wiki-heal/<tag>   (audit-only — no changes to wiki pages)
Mode:   audit-only

Scanned:    <N> wiki pages
Gaps found: <total> (HIGH: <h>, MEDIUM: <m>, LOW: <l>)

Top priorities (first 5):
  1. [<type>] <title> — <one-line detail>
  2. [<type>] <title> — <one-line detail>
  3. ...

Audit report: wiki/audits/audit-<date>.md
Commit:       <short-hash>
Status:       keep

Next step:
  Review wiki/audits/audit-<date>.md, then:
  - "Run wiki-self-heal on the top <k> high-priority gaps"
  - or edit the audit report and ask me to address specific items
Wiki audit — <YYYY-MM-DD>
Branch: wiki-heal/<tag>   (audit-only — no changes to wiki pages)
Mode:   audit-only

Scanned:    <N> wiki pages
Gaps found: <total> (HIGH: <h>, MEDIUM: <m>, LOW: <l>)

Top priorities (first 5):
  1. [<type>] <title> — <one-line detail>
  2. [<type>] <title> — <one-line detail>
  3. ...

Audit report: wiki/audits/audit-<date>.md
Commit:       <short-hash>
Status:       keep

Next step:
  Review wiki/audits/audit-<date>.md, then:
  - "Run wiki-self-heal on the top <k> high-priority gaps"
  - or edit the audit report and ask me to address specific items