/check
扫描全 wiki,发现结构、链接、字段、graph 的健康问题,生成分级修复建议。
覆盖 runtime/schema/entities.yaml 中声明的所有 entity 类型(papers, concepts, topics, people, ideas, experiments, methods, Summary, foundations),以及 graph edge / citation 一致性。重点检查包括:idea novelty-score 合理性、idea 失败原因完整性、experiment linked_idea 有效性。
Inputs
- 全 wiki 目录(默认
wiki/)
- 可选:
--json 标志(通过 tools/lint.py 输出 JSON 格式)
- 可选:
--fix 标志(自动修复确定性问题)
- 可选:
--fix --dry-run(预览修复但不执行)
- 可选:
--suggest 标志(显示非自动修复问题的建议)
Outputs
- Lint report(直接报告给用户)
- 可选写入文件:
wiki/outputs/lint-report-{date}.md
Wiki Interaction
Reads
wiki/papers/*.md — 论文页面字段和链接
wiki/concepts/*.md — 概念页面字段和链接
wiki/topics/*.md — 方向页面字段和链接
wiki/people/*.md — 人物页面字段和链接
wiki/ideas/*.md — idea status、novelty_score、failure_reason、origin_gaps、target_venue
wiki/experiments/*.md — experiment status、linked_idea、outcome
wiki/methods/*.md — method type、source_papers、parent/child 链
wiki/Summary/*.md — 综述页面字段
wiki/foundations/*.md — foundations(终端 — 仅检查入链)
wiki/graph/edges.jsonl — semantic graph edge 一致性检查
wiki/graph/citations.jsonl — bibliographic citation 一致性检查
wiki/index.md — 对照页面完整性
Writes
- 不直接修改 wiki 内容(仅报告,除非指定
--fix)
wiki/log.md — 通过 tools/research_wiki.py log 记录 lint 结果摘要
Workflow
前置:确认工作目录为 wiki 项目根(包含 wiki/、raw/、tools/ 的目录)。
设 WIKI_ROOT=wiki/。
Step 1: 运行自动化 lint 工具
默认模式(只报告):
python3 tools/lint.py --wiki-dir wiki/ --json
自动修复模式(用户指定 --fix 时):
python3 tools/lint.py --wiki-dir wiki/ --fix --json
自动修复确定性问题(xref 反向链接补全、缺失字段填默认值),输出修复报告。
预览模式(用户指定 --fix --dry-run 时):
python3 tools/lint.py --wiki-dir wiki/ --fix --dry-run --json
预览会修复什么,不实际执行。
解析 JSON 输出,获取所有自动检测到的 issues(及修复结果)。
Step 2: 结构完整性(自动化覆盖)
自动化工具检查以下项目:
- Broken wikilinks:
[[slug]] 目标文件不存在
- Orphan pages:无任何入链的页面
- 必填字段缺失(按
runtime/schema/entities.yaml 中声明的每种 entity)。权威源:runtime.loader.REQUIRED_FIELDS。当前集合:
- papers: title, slug, tags, importance
- concepts: title, tags, maturity, key_papers
- topics: title, tags
- people: name
- methods: name, slug, type, tags
- Summary: title, scope, key_topics
- ideas: title, slug, status, origin, tags, priority
- experiments: title, slug, status, linked_idea, hypothesis, tags
- foundations: title, slug, domain, status
Step 3: 字段值验证(自动化覆盖)
- Enum 值检查(来源:
runtime.loader.VALID_VALUES):
- papers.importance ∈ {1,2,3,4,5}
- concepts.maturity ∈ {stable, active, emerging, deprecated}
- ideas.status ∈ {proposed, in_progress, tested, validated, failed}
- ideas.priority ∈ {1,2,3,4,5}
- experiments.status ∈ {planned, running, completed, abandoned}
- experiments.outcome ∈ {succeeded, failed, inconclusive}
- methods.type ∈ {architecture, training, inference, evaluation, data, benchmark, system, optimization, prompting, protocol, other}
- foundations.status ∈ {mainstream, historical}
- Idea novelty_score(若存在)∈ [1, 5](整数)
- Idea failure_reason:status=failed 时必须非空(anti-repetition memory)
- Experiment linked_idea:引用的 idea 页面必须存在
Step 4: Cross Reference 对称性(自动化覆盖)
检查 runtime/schema/xref.yaml 中定义的所有双向链接规则:
| 正向链接 |
检查的反向链接 |
papers ## Related → concepts |
concepts.key_papers 含 paper slug |
papers wikilink → people |
people ## Recent work 含 paper slug |
topics.key_people → people |
people ## Research areas 含 topic slug |
concepts.key_papers → papers |
papers ## Related 含 concept slug |
ideas.origin_gaps → concepts |
concepts.linked_ideas 含 idea slug |
ideas.origin_gaps → topics |
topics.linked_ideas 含 idea slug |
experiments.linked_idea → ideas |
ideas.linked_experiments 含 experiment slug |
methods.source_papers → papers |
papers ## Related 含 method slug |
methods.parent_methods ↔ methods.child_methods |
互逆 |
Step 5: Graph Edge 一致性(自动化覆盖)
- JSON 格式有效性:每行都是合法 JSON
- 必填字段:每条 edge 有 from, to, type
- Edge type 合法性:semantic edges 使用当前 endpoint-aware type set;旧 paper-paper / paper-concept 类型给出迁移 warning
- Edge confidence:
/ingest 写出的 paper-paper 与 paper-concept semantic edges 使用 confidence: high|medium|low
- Citation layer:
graph/citations.jsonl 使用 type: cites、合法 source/date、paper endpoints,且不写 confidence 字段
- Dangling nodes:from/to 引用的 wiki 页面必须存在
Step 6: 内容质量(LLM 辅助)
自动化工具可检测的:
- importance=5 的论文无 concept 页引用
- maturity=stable 的 concept 只有 1 篇 key_paper
- topics 的
## Open problems 章节为空(同样标记空的 ### Known gaps / ### Methodological gaps 子章节)
LLM 额外判断(需要阅读内容):
- Concept 近似重复检测:扫描所有 concept 页面的 title + aliases,判断是否有语义相同/高度相似的概念对(如 "attention mechanism" 和 "self-attention")。对疑似重复对输出合并建议。
- Method 近似重复检测:在
wiki/methods/*.md 上做相同检测,对比 name + tags + ## Mechanism 摘要。
- 矛盾表述检测(不同页面对同一事实的描述不一致)
- SOTA 记录超过 6 个月未更新
- people 的
## Recent work 超过 6 个月未更新
- Idea novelty_score 与
## Novelty argument 强度不匹配(低分 + 论证扎实,或高分 + 论证薄弱)
- 高 priority idea 长期停留在 proposed 状态且无
linked_experiments
Step 7: 生成报告
按优先级排序输出:
## Lint Report — YYYY-MM-DD
**Summary**: N 🔴, M 🟡, K 🔵
### 🔴 需立即修复
1. [file] — {issue description}
### 🟡 建议修复
1. [file] — {issue description}
### 🔵 可选优化
1. [file] — {issue description}
分类标准:
- 🔴 需立即修复:broken links、missing required fields、invalid enum values、failed idea without failure_reason、invalid JSON in edges、novelty_score 越界
- 🟡 建议修复:xref asymmetry、dangling graph edges、broken
linked_idea 引用、unknown edge types
- 🔵 可选优化:orphan pages、quality suggestions、empty sections
记录日志:
python3 tools/research_wiki.py log wiki/ "check | report: N 🔴, M 🟡, K 🔵"
Constraints
- 默认只报告:不带
--fix 时只报告不修复
--fix 仅修复确定性问题:xref 反向链接补全、缺失字段填安全默认值。不确定的问题输出建议(--suggest),由用户手动批准
- raw/ 只读:不修改
raw/ 下的文件
- graph/ 只读:lint 不修改 graph 文件,仅检查一致性
- LLM 判断标注来源:自动化检查和 LLM 判断在报告中明确区分
- 幂等:多次运行产生相同结果(除非 wiki 内容变化)
Error Handling
- wiki/ 不存在:报错并建议运行
/init
- graph 文件不存在:跳过缺失 graph 文件的检查,在报告中注明
- 部分目录缺失:跳过缺失目录的检查,在报告中列出缺失目录
Dependencies
Tools(via Bash)
python3 tools/lint.py --wiki-dir wiki/ [--json] [--fix] [--dry-run] [--suggest] — 自动化结构检查 + 修复(核心依赖)
python3 tools/research_wiki.py log wiki/ "<message>" — 追加日志
python3 tools/research_wiki.py stats wiki/ — 获取统计信息(可选,用于报告)
1---2name: check3description: 扫描全 wiki 发现健康问题,生成分级修复建议报告(覆盖 runtime/schema/entities.yaml 中全部 entity 类型 + graph 一致性)4---56# /check78> 扫描全 wiki,发现结构、链接、字段、graph 的健康问题,生成分级修复建议。9> 覆盖 `runtime/schema/entities.yaml` 中声明的所有 entity 类型(papers, concepts, topics, people, ideas, experiments, methods, Summary, foundations),以及 graph edge / citation 一致性。重点检查包括:idea novelty-score 合理性、idea 失败原因完整性、experiment `linked_idea` 有效性。1011## Inputs1213- 全 wiki 目录(默认 `wiki/`)14- 可选:`--json` 标志(通过 tools/lint.py 输出 JSON 格式)15- 可选:`--fix` 标志(自动修复确定性问题)16- 可选:`--fix --dry-run`(预览修复但不执行)17- 可选:`--suggest` 标志(显示非自动修复问题的建议)1819## Outputs2021- Lint report(直接报告给用户)22- 可选写入文件:`wiki/outputs/lint-report-{date}.md`2324## Wiki Interaction2526### Reads27- `wiki/papers/*.md` — 论文页面字段和链接28- `wiki/concepts/*.md` — 概念页面字段和链接29- `wiki/topics/*.md` — 方向页面字段和链接30- `wiki/people/*.md` — 人物页面字段和链接31- `wiki/ideas/*.md` — idea status、novelty_score、failure_reason、origin_gaps、target_venue32- `wiki/experiments/*.md` — experiment status、linked_idea、outcome33- `wiki/methods/*.md` — method type、source_papers、parent/child 链34- `wiki/Summary/*.md` — 综述页面字段35- `wiki/foundations/*.md` — foundations(终端 — 仅检查入链)36- `wiki/graph/edges.jsonl` — semantic graph edge 一致性检查37- `wiki/graph/citations.jsonl` — bibliographic citation 一致性检查38- `wiki/index.md` — 对照页面完整性3940### Writes41- 不直接修改 wiki 内容(仅报告,除非指定 `--fix`)42- `wiki/log.md` — 通过 `tools/research_wiki.py log` 记录 lint 结果摘要4344## Workflow4546**前置**:确认工作目录为 wiki 项目根(包含 `wiki/`、`raw/`、`tools/` 的目录)。47设 `WIKI_ROOT=wiki/`。4849### Step 1: 运行自动化 lint 工具5051**默认模式(只报告)**:52```bash53python3 tools/lint.py --wiki-dir wiki/ --json54```5556**自动修复模式**(用户指定 `--fix` 时):57```bash58python3 tools/lint.py --wiki-dir wiki/ --fix --json59```60自动修复确定性问题(xref 反向链接补全、缺失字段填默认值),输出修复报告。6162**预览模式**(用户指定 `--fix --dry-run` 时):63```bash64python3 tools/lint.py --wiki-dir wiki/ --fix --dry-run --json65```66预览会修复什么,不实际执行。6768解析 JSON 输出,获取所有自动检测到的 issues(及修复结果)。6970### Step 2: 结构完整性(自动化覆盖)7172自动化工具检查以下项目:73741. **Broken wikilinks**:`[[slug]]` 目标文件不存在752. **Orphan pages**:无任何入链的页面763. **必填字段缺失**(按 `runtime/schema/entities.yaml` 中声明的每种 entity)。权威源:`runtime.loader.REQUIRED_FIELDS`。当前集合:77 - papers: title, slug, tags, importance78 - concepts: title, tags, maturity, key_papers79 - topics: title, tags80 - people: name81 - methods: name, slug, type, tags82 - Summary: title, scope, key_topics83 - ideas: title, slug, status, origin, tags, priority84 - experiments: title, slug, status, linked_idea, hypothesis, tags85 - foundations: title, slug, domain, status8687### Step 3: 字段值验证(自动化覆盖)88891. **Enum 值检查**(来源:`runtime.loader.VALID_VALUES`):90 - papers.importance ∈ {1,2,3,4,5}91 - concepts.maturity ∈ {stable, active, emerging, deprecated}92 - ideas.status ∈ {proposed, in_progress, tested, validated, failed}93 - ideas.priority ∈ {1,2,3,4,5}94 - experiments.status ∈ {planned, running, completed, abandoned}95 - experiments.outcome ∈ {succeeded, failed, inconclusive}96 - methods.type ∈ {architecture, training, inference, evaluation, data, benchmark, system, optimization, prompting, protocol, other}97 - foundations.status ∈ {mainstream, historical}982. **Idea novelty_score**(若存在)∈ [1, 5](整数)993. **Idea failure_reason**:status=failed 时必须非空(anti-repetition memory)1004. **Experiment linked_idea**:引用的 idea 页面必须存在101102### Step 4: Cross Reference 对称性(自动化覆盖)103104检查 `runtime/schema/xref.yaml` 中定义的所有双向链接规则:105106| 正向链接 | 检查的反向链接 |107|----------|---------------|108| `papers ## Related → concepts` | `concepts.key_papers` 含 paper slug |109| `papers wikilink → people` | `people ## Recent work` 含 paper slug |110| `topics.key_people → people` | `people ## Research areas` 含 topic slug |111| `concepts.key_papers → papers` | `papers ## Related` 含 concept slug |112| `ideas.origin_gaps → concepts` | `concepts.linked_ideas` 含 idea slug |113| `ideas.origin_gaps → topics` | `topics.linked_ideas` 含 idea slug |114| `experiments.linked_idea → ideas` | `ideas.linked_experiments` 含 experiment slug |115| `methods.source_papers → papers` | `papers ## Related` 含 method slug |116| `methods.parent_methods ↔ methods.child_methods` | 互逆 |117118### Step 5: Graph Edge 一致性(自动化覆盖)1191201. **JSON 格式有效性**:每行都是合法 JSON1212. **必填字段**:每条 edge 有 from, to, type1223. **Edge type 合法性**:semantic edges 使用当前 endpoint-aware type set;旧 paper-paper / paper-concept 类型给出迁移 warning1234. **Edge confidence**:`/ingest` 写出的 paper-paper 与 paper-concept semantic edges 使用 `confidence: high|medium|low`1245. **Citation layer**:`graph/citations.jsonl` 使用 `type: cites`、合法 source/date、paper endpoints,且不写 confidence 字段1256. **Dangling nodes**:from/to 引用的 wiki 页面必须存在126127### Step 6: 内容质量(LLM 辅助)128129自动化工具可检测的:1301. importance=5 的论文无 concept 页引用1312. maturity=stable 的 concept 只有 1 篇 key_paper1323. topics 的 `## Open problems` 章节为空(同样标记空的 `### Known gaps` / `### Methodological gaps` 子章节)133134LLM 额外判断(需要阅读内容):1351. **Concept 近似重复检测**:扫描所有 concept 页面的 title + aliases,判断是否有语义相同/高度相似的概念对(如 "attention mechanism" 和 "self-attention")。对疑似重复对输出合并建议。1362. **Method 近似重复检测**:在 `wiki/methods/*.md` 上做相同检测,对比 `name` + `tags` + `## Mechanism` 摘要。1373. 矛盾表述检测(不同页面对同一事实的描述不一致)1384. SOTA 记录超过 6 个月未更新1395. people 的 `## Recent work` 超过 6 个月未更新1406. Idea novelty_score 与 `## Novelty argument` 强度不匹配(低分 + 论证扎实,或高分 + 论证薄弱)1417. 高 priority idea 长期停留在 proposed 状态且无 `linked_experiments`142143### Step 7: 生成报告144145按优先级排序输出:146147```148## Lint Report — YYYY-MM-DD149150**Summary**: N 🔴, M 🟡, K 🔵151152### 🔴 需立即修复1531. [file] — {issue description}154155### 🟡 建议修复1561. [file] — {issue description}157158### 🔵 可选优化1591. [file] — {issue description}160```161162分类标准:163- **🔴 需立即修复**:broken links、missing required fields、invalid enum values、failed idea without failure_reason、invalid JSON in edges、novelty_score 越界164- **🟡 建议修复**:xref asymmetry、dangling graph edges、broken `linked_idea` 引用、unknown edge types165- **🔵 可选优化**:orphan pages、quality suggestions、empty sections166167记录日志:168```bash169python3 tools/research_wiki.py log wiki/ "check | report: N 🔴, M 🟡, K 🔵"170```171172## Constraints173174- **默认只报告**:不带 `--fix` 时只报告不修复175- **`--fix` 仅修复确定性问题**:xref 反向链接补全、缺失字段填安全默认值。不确定的问题输出建议(`--suggest`),由用户手动批准176- **raw/ 只读**:不修改 `raw/` 下的文件177- **graph/ 只读**:lint 不修改 graph 文件,仅检查一致性178- **LLM 判断标注来源**:自动化检查和 LLM 判断在报告中明确区分179- **幂等**:多次运行产生相同结果(除非 wiki 内容变化)180181## Error Handling182183- **wiki/ 不存在**:报错并建议运行 `/init`184- **graph 文件不存在**:跳过缺失 graph 文件的检查,在报告中注明185- **部分目录缺失**:跳过缺失目录的检查,在报告中列出缺失目录186187## Dependencies188189### Tools(via Bash)190- `python3 tools/lint.py --wiki-dir wiki/ [--json] [--fix] [--dry-run] [--suggest]` — 自动化结构检查 + 修复(核心依赖)191- `python3 tools/research_wiki.py log wiki/ "<message>"` — 追加日志192- `python3 tools/research_wiki.py stats wiki/` — 获取统计信息(可选,用于报告)