SuperAPI AI Directory

llm-wiki

Agents & models

View repository

Updated 10-15 21:10

About this skill

LLM Wiki

Turn the LLM into your Wiki maintainer. The LLM incrementally builds and maintains a persistent, interlinked Markdown knowledge base. Knowledge is compiled once and continuously updated, rather than re-derived each time.

Inspiration:

When to Use

Situations where the AI should proactively judge and use this skill:

  1. The user wants to build a knowledge base - "Help me organize these materials", "I want to build a wiki"
  2. The user provided new learning materials - Dropped an article, paper, or book chapter that needs to be organized
  3. The user wants to query existing knowledge - "What have I read before about this concept?"
  4. The user wants to maintain knowledge base health - "Check the wiki for contradictions"
  5. The user solved a problem - "Done", "Fixed it", "That works"
  6. The user is doing long-term research - Cross-week/month topic research that requires knowledge accumulation

Situations where it is not needed:

  • One-off Q&A that does not require persistent knowledge

Execution entry point

Step 1: Determine the user's intent

Based on the user's words, determine which operation to perform:

User intent Operation to perform
"Build a knowledge base", "Initialize wiki" init
"Help me process this article", "I added new material", "Take a look at this link" ingest
"Done", "Fixed it", "Problem solved" compound
"What is X?", "Help me summarize Y" query
"Check the wiki", "Organize the knowledge base" lint
Intent is unclear Ask the user to choose

When the intent is unclear, ask:

你想执行哪个操作?
  1. init     - 初始化知识库
  2. ingest   - 摄入新资料
  3. compound - 记录解决问题的经验
  4. query    - 查询已有知识
  5. lint     - 健康检查

Step 2: Check whether it is already initialized

Before any operation (except init itself), check whether the ~/llm-wiki/ directory exists:

  • Exists → Continue with the target operation
  • Does not exist → Automatically run init first without asking the user, then perform the target operation
# 检测方法
ls ~/llm-wiki/wiki/index.md 2>/dev/null

Operation: init (initialization)

When to perform

  • The user explicitly requests initialization
  • When it is detected before other operations that ~/llm-wiki/ does not exist, perform automatically

Workflow

1. Create the directory structure

mkdir -p ~/llm-wiki/raw/{articles,papers,books,notes,assets}
mkdir -p ~/llm-wiki/wiki/{entities,concepts,topics,sources,solutions}

If the user mentioned a knowledge base topic in previous conversation, adjust the raw/ subdirectories accordingly.

2. Create index.md

# Wiki Index

## 概览
- [[overview]] - 整体综述

## 来源
<!-- 摄入的原始资料摘要,按时间倒序 -->

## 实体
<!-- 人物、组织、产品等,按名称排序 -->

## 概念
<!-- 理论、方法、术语等,按名称排序 -->

## 主题
<!-- 综合分析、比较等,按名称排序 -->

## 经验
<!-- 解决问题的经验和洞察(compound 产生) -->

3. Create log.md

# Wiki Log

<!-- 操作记录按时间追加在此,格式:## [YYYY-MM-DD] 操作类型 | 描述 -->

4. Create overview.md

---
type: overview
created: YYYY-MM-DD
---

# 知识库概览

> 本 Wiki 由 LLM 自动维护。你负责选题和提问,LLM 负责总结、交叉引用、归档和维护。

## 当前状态
- 来源数量:0
- 总页面数:0(含 index、log、overview)
- 最近更新:-

## 核心发现
<!-- 随着知识积累,这里将总结最重要的发现 -->

5. Output confirmation

Wiki 知识库已初始化! ~/llm-wiki/

接下来你可以:
  - 把资料放入 raw/ 目录,我来整理(ingest)
  - 给我链接或文本,我帮你保存并处理(ingest)
  - 解决了问题后告诉我,我帮你记录(compound)
  - 随时问我关于 Wiki 中已有知识的问题(query)
  - 让我检查 Wiki 的健康状况(lint)

If it is an automatic initialization (not explicitly requested by the user), simplify the output to one line:已自动初始化知识库 ~/llm-wiki/, then continue with the target operation.


Operation: ingest (ingest materials)

Process new raw materials and integrate the knowledge into the Wiki. One new piece of material may affect 10-15 Wiki pages.

Workflow

1. Determine the materials to be processed

By priority:

  1. The user specified a specific resource(link, text, file path) → process only that resource
  2. The user says "process new resources" → scan raw/ for unprocessed files
  3. The user says "process all new resources" → batch process

Determine processed/unprocessed: Compare raw/ files with the wiki/sources/ of the source summary page in source frontmatter field. Having a corresponding summary page = processed.

发现 3 个未处理的资料:
  1. raw/articles/attention-paper.pdf
  2. raw/notes/meeting-2026-04-05.md
  3. raw/papers/bert-paper.pdf

要全部处理,还是选择其中几个?(默认全部)

2. Save the raw resource (only needed for URLs/text)

  • URL → fetch and save to raw/articles/
  • Text → save to raw/notes/
  • Existing file → read directly

3. Read and extract

Read the raw resource, identify core arguments, key entities, important concepts, data/facts, and relationships with other sources.

4. Discuss with the user (recommended, skip during batch processing)

这篇资料的核心要点:
1. ...
2. ...

涉及的关键实体/概念:A、B、C
你想重点关注哪些方面?

5. Create a source summary page

Create in wiki/sources/ , file name:YYYY-MM-DD-简短名称.md

---
type: source
date: YYYY-MM-DD
source: raw/path/to/file
tags: [tag1, tag2]
---

# 来源:标题

## 核心要点
- 要点 1

## 关键引用
> 原文引用

## 与其他来源的关系
- 与 [[other-source]] 在 X 方面相互印证
- 与 [[contradicting-source]] 在 Y 方面存在矛盾

## 衍生概念
- [[concept-a]]

6. Update entity pages and concept pages

For each entity and concept involved in the resource:

  • Existing page → append new information, cite the source
  • New page → create using the template

Entity/concept page template:

---
type: entity  # 或 concept
created: YYYY-MM-DD
updated: YYYY-MM-DD
sources: [source-a, source-b]
---

# 名称

## 定义
简要描述。

## 关键信息
- 信息点 1(来源:[[source-a]])

## 关联
- 相关概念:[[concept-x]]

## 开放问题
- 尚未解答的问题

Note:

  • When new information contradicts existing content, keep both versions and clearly mark them
  • Cite a source for every factual claim

7. Update topic pages (if needed)

8. Update index.md, overview.md

9. Append to log.md

## [YYYY-MM-DD] ingest | 资料标题

- **来源**:raw/path/to/file
- **新增页面**:page-a, page-b
- **更新页面**:page-c, page-d
- **影响范围**:N 个页面

10. Output a summary

处理完成。

新增:
  - 来源摘要:[[source-name]]
  - 实体:[[entity-a]], [[entity-b]]
  - 概念:[[concept-c]]

更新:
  - [[concept-d]] - 补充了关于 X 的说明

⚠️ 发现矛盾:
  - [[concept-d]] 中关于 Y 的描述与 [[source-old]] 不一致

Operation: compound (experience accumulation)

Document the experience of solving a problem and write it to wiki/solutions/. Knowledge compounding: spend time researching the first time, and after documenting, it takes only a few minutes to solve next time.

When to execute

  • The user says "done", "fixed", "problem solved"
  • A valuable debugging, exploration, or analysis process has just been completed
  • A pattern, technique, or best practice worth recording has been discovered

Not worth recording: typos, obvious minor changes, one-off non-reproducible issues. Just tell the user the reason.

Dual track

Bug Track(problem solving): suitable for fixing bugs and resolving errors.

---
type: solution
track: bug
date: YYYY-MM-DD
tags: [tag1, tag2]
---

# 问题标题

## 问题
1-2 句话描述。

## 症状
- 可观察到的异常行为

## 调查过程
1. ❌ 尝试 A → 失败原因
2. ✅ 最终方案

## 根因
原因解释。

## 解决方案
\`\`\`
// 修改前
...
// 修改后
...
\`\`\`

## 防范
如何避免再次出现。

## 关联
- [[concept-a]]

Knowledge Track(experience insights): suitable for summarizing patterns, best practices, and workflow techniques.

---
type: solution
track: knowledge
date: YYYY-MM-DD
tags: [tag1, tag2]
---

# 洞察标题

## 背景
什么情况下产生的这个经验。

## 指导
具体的实践、模式或建议。

## 为什么重要
遵循或不遵循这个实践的影响。

## 何时适用
这个经验在什么条件下适用。

## 关联
- [[concept-a]]

Workflow

  1. Extract information from context — problem description, investigation process, root cause, solution, key code
  2. Choose the track — solving a specific problem → Bug Track; summarizing experience/patterns → Knowledge Track
  3. Check for overlap — search wiki/solutions/ for existing similar documents. High overlap → update the existing document; low or none → create a new document
  4. Write the document — wiki/solutions/YYYY-MM-DD-简短名称.md
  5. Update index.md、overview.md、log.md
  6. Output a summary

Operation: query (query knowledge)

Answer questions based on Wiki content. Good answers are archived back to the Wiki.

Core principles

Good answers should be archived back to the Wiki. Comprehensive analysis involving multiple sources, comparison tables, new findings → save as a new topic page.

Workflow

  1. Read index.md to get the full picture
  2. Locate relevant pages — find the 2-5 most relevant pages (including sources, solutions)
  3. Synthesize an answer — use [[wikilink]] citations, note sources
  4. Archive valuable answers — save as wiki/topics/ new pages
  5. Suggest follow-up exploration — information gaps, materials that can be supplemented

Operation: lint (health check)

Detect issues such as contradictions, orphan pages, and missing concepts to keep the Wiki healthy long-term.

When to run

  • When the user says "check the wiki", "tidy up the knowledge base"
  • Run periodically when the Wiki has accumulated 20+ pages
  • After adding a batch of important materials each time

6 checks

Check item Method
Contradiction detection Compare descriptions of the same topic across different pages
Outdated information Page updated date is much earlier than related sources
Orphan pages Inbound [[wikilink]] pages with 0
Missing pages Referenced by [[wikilink]] but not created
Missing cross-references Pages that share 2+ sources but do not link to each other
Data gaps "Open questions" in concept pages, directions not explored in depth in the overview

Workflow

  1. Read the full picture (ls -R wiki/ + wiki/index.md)
  2. Check item by item
  3. Generate a report (statistics + issues listed by priority)
  4. Ask the user whether to auto-fix (create missing pages, add cross-references, etc.)
  5. Apply fixes, update log.md

Two-layer architecture

~/llm-wiki/
├── raw/                    # 原始资料(不可变)
│   ├── articles/
│   ├── papers/
│   ├── books/
│   ├── notes/
│   └── assets/
└── wiki/                   # LLM 维护的 Wiki
    ├── index.md            # 内容目录
    ├── log.md              # 操作日志
    ├── overview.md         # 整体概览
    ├── entities/           # 实体页
    ├── concepts/           # 概念页
    ├── topics/             # 主题页
    ├── sources/            # 来源摘要
    └── solutions/          # 经验文档

File naming conventions

Type Path format
Source summary wiki/sources/YYYY-MM-DD-简短名称.md
Entity page wiki/entities/名称.md
Concept page wiki/concepts/概念名.md
Topic page wiki/topics/主题名.md
Experience document wiki/solutions/YYYY-MM-DD-简短名称.md

All file names use lowercase English + hyphens.

Writing conventions

  • Each page starts with YAML frontmatter (type, date, tags, sources)
  • Use [[wikilink]] to create links between pages
  • Annotate the source for every factual claim
  • When new and old information contradict, keep both versions and annotate them
  • Keep pages concise, focused on one topic

Obsidian integration

The Wiki directory can be opened directly with Obsidian: Graph View, Web Clipper, Dataview, Marp plugins.

Examples

ingest — ingest materials

User: 我把 Attention Is All You Need 的论文放进 raw/papers/ 了

Agent: 我来处理这篇论文。

[读取 raw/papers/attention-is-all-you-need.pdf]
[提取关键信息]

这篇论文的核心要点:
1. 提出了 Transformer 架构,完全基于注意力机制,抛弃了 RNN/CNN
2. 引入了 Multi-Head Self-Attention 和 Positional Encoding
3. 在机器翻译任务上达到 SOTA

涉及实体:Google Brain、Ashish Vaswani 等 8 位作者
涉及概念:Self-Attention、Multi-Head Attention、Positional Encoding、Layer Normalization

要重点关注哪些方面?

User: 重点看 Self-Attention 的设计思路

Agent: [创建 wiki/sources/2026-04-06-attention-paper.md]
[创建 wiki/concepts/self-attention.md - 重点展开设计思路]
[创建 wiki/entities/transformer.md]
[创建 wiki/entities/google-brain.md]
[创建 wiki/concepts/multi-head-attention.md]
[创建 wiki/concepts/positional-encoding.md]
[更新 wiki/overview.md]
[更新 wiki/index.md]
[追加 wiki/log.md]

处理完成。新增 6 个页面,Self-Attention 概念页重点展开了 Scaled Dot-Product 的设计动机。

compound — experience accumulation

Bug Track:

User: 搞定了,是数据库连接池配置的问题

Agent: 这是一个值得记录的经验。让我整理一下。

[回顾对话上下文]
[检查 wiki/solutions/ 是否有重叠]
[创建 wiki/solutions/2026-04-06-db-connection-pool-exhausted.md]

经验已文档化。Bug Track。

摘要:
  问题:高并发下数据库连接池耗尽,请求超时
  根因:默认连接池大小 5 不够,且未配置连接超时回收
  解决:调整 pool size 为 20,添加 idle timeout 配置

关联到 Wiki 中已有的 [[database-connections]] 概念页。

Knowledge Track:

User: 我发现一个规律,用 debounce 处理搜索输入比 throttle 效果好

Agent: 好洞察,让我记录下来。

[创建 wiki/solutions/2026-04-06-debounce-vs-throttle-search.md]
[检查是否已有相关概念页]

经验已文档化。Knowledge Track。

核心建议:搜索输入场景用 debounce(等用户停止输入后才触发),
优于 throttle(固定间隔触发),因为搜索需要完整的关键词。

Wiki 中还没有 debounce 和 throttle 的概念页,要创建吗?

query — query knowledge

User: Self-Attention 和普通 Attention 有什么区别?

Agent: [读取 wiki/index.md]
[定位 wiki/concepts/self-attention.md, wiki/concepts/attention.md]
[综合回答]

## Self-Attention vs 普通 Attention

**普通 Attention**(来源:[[source-a]]):
- Query 和 Key/Value 来自不同序列
- 典型场景:翻译任务中目标语言关注源语言

**Self-Attention**(来源:[[2026-04-06-attention-paper]]):
- Query、Key、Value 都来自同一序列
- 每个位置可关注序列中所有其他位置

| 维度 | 普通 Attention | Self-Attention |
|------|---------------|----------------|
| Q/K/V 来源 | Q ≠ KV | Q = K = V |
| 捕获关系 | 跨序列 | 序列内部 |
| 计算复杂度 | O(n×m) | O(n²) |

这个比较已保存为 [[self-attention-vs-attention]]。

lint — health check

User: 检查一下 wiki

Agent: [读取 wiki/index.md]
[扫描 wiki/ 全部页面]
[逐项检查]

#### 🔗 孤儿页面(1)
1. [[layer-normalization]] - 0 个入站链接

#### 📝 缺失页面(2)
1. [[residual-connection]] - 被引用 4 次
2. [[softmax]] - 被引用 2 次

### 建议操作
1. [高] 创建 [[residual-connection]](被引用 4 次)
2. [高] 创建 [[softmax]](被引用 2 次)
3. [中] 在 [[positional-encoding]] 补充:不同架构使用不同方案
4. [低] 为 [[layer-normalization]] 添加入站链接

要我自动修复吗?

User: 1 和 2 你先创建,3 和 4 我看看再说

Agent: 好的,我来创建 residual-connection 和 softmax。

[创建 wiki/concepts/residual-connection.md]
[创建 wiki/concepts/softmax.md]
[更新 wiki/index.md]
[追加 wiki/log.md]

已创建:
- [[residual-connection]] - 基于 [[attention-paper]] 的描述
- [[softmax]] - 作为 Self-Attention 中的关键计算步骤

矛盾和孤儿页面先保留,你随时可以让我处理。

Applicable scenarios

Active learning (ingest):

  • Academic research, reading notes, competitor analysis, course notes

Experience accumulation (compound):

  • Engineering practice (bug fixes, best practices), team knowledge base, workflow optimization, personal growth