chore: ignore raw and wiki, update remote

This commit is contained in:
2026-04-16 13:13:32 +08:00
parent b02eb12d1d
commit 753f7841e8
11 changed files with 1038 additions and 155 deletions

352
CLAUDE.md
View File

@@ -1,78 +1,132 @@
# LLM Wiki Agent — Schema & Workflow Instructions
# LLM Wiki Agent — Schema & Workflow Instructions(中文版增强规范)
This wiki is maintained entirely by Claude Code. No API key or Python scripts needed — just open this repo in Claude Code and talk to it.
本 Wiki 完全由 Claude Code 自动维护。无需 API Key Python 脚本 —— 只需在 Claude Code 中打开本仓库并与其对话。
## Slash Commands (Claude Code)
---
# 🔴 全局强制规则CRITICAL
| Command | What to say |
|---|---|
| `/wiki-ingest` | `ingest raw/my-article.md` |
| `/wiki-query` | `query: what are the main themes?` |
| `/wiki-lint` | `lint the wiki` |
| `/wiki-graph` | `build the knowledge graph` |
## 1. 输出语言(必须遵守)
Or just describe what you want in plain English:
- *"Ingest this file: raw/papers/attention-is-all-you-need.md"*
- *"What does the wiki say about transformer models?"*
- *"Check the wiki for orphan pages and contradictions"*
- *"Build the graph and show me what's connected to RAG"*
- 所有输出必须使用**简体中文**
- 专有名词允许保留英文,但首次出现必须附带中文解释
- 如果原始文件名是中文则source页面的名称尽量用中文不要用拼音表示, 如果有特殊字符可以忽略
- 禁止中英混合句(术语除外)
- 不允许输出纯英文总结或分析
Claude Code reads this file automatically and follows the workflows below.
示例:
Transformer变压器模型一种基于注意力机制的神经网络架构
---
## Directory Layout
## 2. 输出风格(严格限制)
```
raw/ # Immutable source documents — never modify these
wiki/ # Claude owns this layer entirely
index.md # Catalog of all pages — update on every ingest
log.md # Append-only chronological record
overview.md # Living synthesis across all sources
sources/ # One summary page per source document
entities/ # People, companies, projects, products
concepts/ # Ideas, frameworks, methods, theories
syntheses/ # Saved query answers
graph/ # Auto-generated graph data
tools/ # Optional standalone Python scripts (require ANTHROPIC_API_KEY)
```
所有输出必须:
- 去修辞(禁止 narrative 风格)
- 去模糊(禁止“可能”“大概”等词)
- 信息密度最大化
- 面向“知识结构化”,而非阅读体验
优先级:
结构 > 关系 > 结论 > 描述
---
## Page Format
## 3. 结构化语义(必须)
Every wiki page uses this frontmatter:
所有页面必须遵循结构化语义规则:
- Summary 必须使用固定字段
- Claim 必须符合标准语法
- Connections 必须使用关系类型
- 禁止自由发挥
---
# Slash CommandsClaude Code
| Command | 使用方式 |
| -------------- | --------------------------- |
| `/wiki-ingest` | `ingest raw/your-file.md` |
| `/wiki-query` | `query: 你的问题` |
| `/wiki-lint` | `lint the wiki` |
| `/wiki-graph` | `build the knowledge graph` |
---
## 自然语言示例
- ingest raw/papers/attention-is-all-you-need.md
- query: Transformer 的核心机制是什么?
- lint the wiki
- build the graph and analyze RAG
Claude Code 会自动读取本文件并执行以下工作流。
---
# Directory Layout目录结构
```
raw/ # 原始文档(不可修改)
wiki/ # 知识层(由 Claude 完全维护)
index.md # 页面索引(每次 ingest 必须更新)
log.md # 追加式日志
overview.md # 全局知识总结
sources/ # 每个原始文档对应一个页面
entities/ # 实体(人/公司/产品/项目)
concepts/ # 概念(方法/理论/框架)
syntheses/ # 查询结果沉淀
graph/ # 自动生成的图数据
tools/ # 可选 Python 工具 (require ANTHROPIC_API_KEY)
````
---
# Page Format页面格式
每个页面必须包含:
```yaml
---
id: unique_id
title: "Page Title"
type: source | entity | concept | synthesis
tags: []
sources: [] # list of source slugs that inform this page
sources: [] # 来源
last_updated: YYYY-MM-DD
---
```
````
Use `[[PageName]]` wikilinks to link to other wiki pages.
必须使用 `[[PageName]]` 进行链接。
---
## Ingest Workflow
# Ingest Workflow(摄取流程)
**重要** 请严格按照摄取流程进行操作,每分析一个页面必须要创建/更新source pageentity, concept等。不可遗漏
Triggered by: *"ingest <file>"* or `/wiki-ingest`
触发方式:
- `/wiki-ingest`
- 或:`ingest <file>`
## 执行步骤(严格顺序)
1. 使用 Read 工具完整读取 source 文档
2. 读取 `wiki/index.md` 和 `wiki/overview.md`
3. 生成 `wiki/sources/原始中文名.md` (非中文使用 slug.md)
4. 更新 `wiki/index.md`
5. 更新 `wiki/overview.md`(如有必要)
6. 创建或更新 Entity 页面
7. 创建或更新 Concept 页面
8. 检测并记录冲突
9. 追加 `wiki/log.md`
Steps (in order):
1. Read the source document fully using the Read tool
2. Read `wiki/index.md` and `wiki/overview.md` for current wiki context
3. Write `wiki/sources/<slug>.md` — use the source page format below
4. Update `wiki/index.md` — add entry under Sources section
5. Update `wiki/overview.md` — revise synthesis if warranted
6. Update/create entity pages for key people, companies, projects mentioned
7. Update/create concept pages for key ideas and frameworks discussed
8. Flag any contradictions with existing wiki content
9. Append to `wiki/log.md`: `## [YYYY-MM-DD] ingest | <Title>`
---
### Source Page Format
# Source Page Format(增强结构)
```markdown
---
@@ -80,32 +134,46 @@ title: "Source Title"
type: source
tags: []
date: YYYY-MM-DD
source_file: raw/...
---
## Source File
- [[raw/...]]
## Summary
24 sentence summary.
- 核心主题:
- 问题域:
- 方法/机制:
- 结论/价值:
## Key Claims
- Claim 1
- Claim 2
- (必须符合:主体 + 机制 + 结果)
## Key Quotes
> "Quote here" — context
> "引用内容" — 上下文说明
## Key Concepts
- [[ConceptName]]:定义
## Key Entities
- [[EntityName]]:角色说明
## Connections
- [[EntityName]] — how they relate
- [[ConceptName]] — how it connects
- [[A]] ← depends_on ← [[B]]
- [[C]] ← extends ← [[D]]
## Contradictions
- Contradicts [[OtherPage]] on: ...
- 与 [[OtherPage]] 冲突:
- 冲突点:
- 当前观点:
- 对方观点:
```
### Domain-Specific Templates
---
If the source falls into a specific domain (e.g., personal diary, meeting notes), the agent should use a specialized template instead of the default generic one above:
# Domain-Specific Templates领域模板
## Diary / Journal
#### Diary / Journal Template
```markdown
---
title: "YYYY-MM-DD Diary"
@@ -114,18 +182,16 @@ tags: [diary]
date: YYYY-MM-DD
---
## Event Summary
...
## Key Decisions
...
## Energy & Mood
...
## Connections
...
## Shifts & Contradictions
...
```
#### Meeting Notes Template
---
## Meeting Notes
```markdown
---
title: "Meeting Title"
@@ -134,97 +200,153 @@ tags: [meeting]
date: YYYY-MM-DD
---
## Goal
...
## Key Discussions
...
## Decisions Made
...
## Action Items
...
```
---
## Query Workflow
# Entity & Concept Rules关键增强
Triggered by: *"query: <question>"* or `/wiki-query`
## Entity实体
Steps:
1. Read `wiki/index.md` to identify relevant pages
2. Read those pages with the Read tool
3. Synthesize an answer with inline citations as `[[PageName]]` wikilinks
4. Ask the user if they want the answer filed as `wiki/syntheses/<slug>.md`
创建条件:
- 出现 ≥ 2 次
- 对主题有关键影响
类型:
- 人 / 公司 / 产品 / 项目
---
## Lint Workflow
## Concept概念
创建条件:
- 可抽象
- 可复用
- 非具体实例
---
Triggered by: *"lint the wiki"* or `/wiki-lint`
## 命名规范(强制)
- 使用唯一标准名称
- 所有别名写入页面:
Use Grep and Read tools to check for:
- **Orphan pages** — wiki pages with no inbound `[[links]]` from other pages
- **Broken links** — `[[WikiLinks]]` pointing to pages that don't exist
- **Contradictions** — claims that conflict across pages
- **Stale summaries** — pages not updated after newer sources
- **Missing entity pages** — entities mentioned in 3+ pages but lacking their own page
- **Data gaps** — questions the wiki can't answer; suggest new sources
Output a lint report and ask if the user wants it saved to `wiki/lint-report.md`.
```markdown
## Aliases
- GPT4
- GPT-4
```
---
## Graph Workflow
## 去重机制(必须)
Triggered by: *"build the knowledge graph"* or `/wiki-graph`
When the user asks to build the graph, run `tools/build_graph.py` which:
- Pass 1: Parses all `[[wikilinks]]` → deterministic `EXTRACTED` edges
- Pass 2: Infers implicit relationships → `INFERRED` edges with confidence scores
- Runs Louvain community detection
- Outputs `graph/graph.json` + `graph/graph.html`
If the user doesn't have Python/dependencies set up, instead generate the graph data manually:
1. Use Grep to find all `[[wikilinks]]` across wiki pages
2. Build a node/edge list
3. Write `graph/graph.json` directly
4. Write `graph/graph.html` using the vis.js template
创建前必须:
1. 搜索 index
2. 判断是否存在
3. 存在则更新
---
## Naming Conventions
# Query Workflow查询流程
- Source slugs: `kebab-case` matching source filename
- Entity pages: `TitleCase.md` (e.g. `OpenAI.md`, `SamAltman.md`)
- Concept pages: `TitleCase.md` (e.g. `ReinforcementLearning.md`, `RAG.md`)
- Source pages: `kebab-case.md`
触发:
- `/wiki-query`
- 或:`query: 问题`
## Index Format
---
## 步骤
1. 读取 index
2. 找到相关页面
3. 使用 Read 工具加载
4. 输出结构化答案
5. 使用 `[[Page]]` 引用
6. 询问是否保存为 synthesis
---
# Lint Workflow校验
检查内容:
- 孤立页面
- 断链
- 冲突
- 过期内容
- 缺失Entity
- 缺失Concept
- 知识空白
---
# Graph Workflow知识图谱
触发:
- `/wiki-graph`
---
执行:
- 优先运行 `tools/build_graph.py`
- 否则手动构建:
步骤:
1. 提取所有 `[[links]]`
2. 构建节点与边
3. 输出 `graph.json`
---
# Naming Conventions命名规范
- Source保留原始中文名称去除特殊符号非中文使用 kebab-case
- EntityTitleCase
- ConceptTitleCase
---
# Index Format索引结构
```markdown
# Wiki Index
## Overview
- [Overview](overview.md) — living synthesis
- [Overview](overview.md)
## Sources
- [Source Title](sources/slug.md) — one-line summary
- [Title](sources/原始中文名.md)
## Entities
- [Entity Name](entities/EntityName.md) — one-line description
- [Entity](entities/Entity.md)
## Concepts
- [Concept Name](concepts/ConceptName.md) — one-line description
- [Concept](concepts/Concept.md)
## Syntheses
- [Analysis Title](syntheses/slug.md) — what question it answers
- [Title](syntheses/slug.md)
```
## Log Format
---
Each entry starts with `## [YYYY-MM-DD] <operation> | <title>` so it's grep-parseable:
# Log Format日志
```
grep "^## \[" wiki/log.md | tail -10
## [YYYY-MM-DD] ingest | 标题
```
Operations: `ingest`, `query`, `lint`, `graph`
---
# ✅ 最终目标
该系统用于:
- 知识沉淀
- 结构化理解
- 自动图谱构建
- Agent 推理支持
---
# END