当前位置: 首页 > Skill >

Karpathy Wiki Improve

Karpathy Wiki Improve

1.1.2 2026.11.26 浏览:898
获取Skill文件查看使用说明
作者:顾言许可证:
本文目录展开

karpathy-wiki — OpenClaw Implementation

Based on Andrej Karpathy's LLM Wiki pattern.

Trigger Keywords (Activation)

Activate this skill when the user says anything like:

  • "organize bookmarks" / "digest this link"
  • "research X" / "help me research"
  • "run lint" / "lint check"
  • "relink" / "build connections"
  • "wiki" / "knowledge graph"
  • "Deep Research"

wiki Root

wiki_root: /path/to/your/wiki  # configure to your local path
<wiki_root>/
├── raw/
│   ├── sources/          # raw bookmarks/docs (immutable)
│   └── assets/           # images and resources
├── wiki/
│   ├── entities/        # entity pages (people, products, companies, sites, books)
│   ├── concepts/        # concept pages (tech, theory, methodology)
│   ├── comparisons/     # comparison pages
│   ├── synthesis/       # synthesis/overview pages
│   ├── index.md         # wiki index (entry point)
│   ├── log.md           # operation log (append-only)
│   └── overview.md      # global overview
├── purpose.md           # wiki goal definition (wiki constitution)
└── schema.md            # structure conventions

Core Principles

  1. sources/ is read-only — LLM only writes wiki/, never modifies raw sources
  2. wikilink cross-references — [[page-slug]] syntax for page connections
  3. YAML frontmatter — every page has type/tags/related/sources
  4. Bidirectional links enforced — every write to related must sync back-link
  5. Two-phase Ingest — Analysis → Generation
  6. URL-level traceability — sources contain specific URLs, not just filenames
  7. Lint-driven — periodic health checks, graph stays clean
  8. Deep Research — knowledge gaps auto-discovered and filled

Page Type Taxonomy (entity vs concept boundary)

Type Definition Examples
entity Named, discrete things people/products/companies/sites/books/tools
concept Abstract ideas/theories/methodologies indexing principles, microservices, DI
comparison Multi-option comparisons Vue vs React, MySQL vs PostgreSQL
synthesis Comprehensive overview tech stack panorama, annual summary

Boundary Rules:

  • If it has a specific name → entity ("pdai.tech", "Effective Java")
  • If it's abstract/generic → concept ("MySQL indexing", "dependency injection")
  • Avoid having both entity and concept for the same topic

Naming Convention

entity:
  blogs/sites: use domain or person name
    → mysql-zhu-shuangyin
    → pdai-tech
    → jon-index-blog
  books: use simplified book title
    → effective-java

concept:
  use core terms in kebab-case
    → mysql-innodb
    → jwt-json-web-token
    → dependency-injection

comparison:
  → mysql-postgresql-comparison
  → vue-vs-react

synthesis:
  → go-web-dev-overview
  → 2026-learning-roadmap-summary

Rules:

  • All lowercase, hyphen-separated
  • No mixed Chinese/English
  • Unique slugs, no duplicates

YAML Frontmatter (Required Fields)

---
type: entity | concept | comparison | synthesis
title: Page Title
created: YYYY-MM-DD
updated: YYYY-MM-DD
tags: [tag1, tag2]
related: [page-slug-1, page-slug-2]  # forward reference (back-link auto-added)
sources:
  - file: bookmarks_xxx.md
    urls:
      - https://example.com/article1
      - https://example.com/article2
---

sources.urls is mandatory — URL-level traceability is a core principle.

Quality Thresholds

Every concept/comparison page must have:

Requirement Description
One-line definition frontmatter title or page header >
Core principles ≥ 3 body contains at least 3 substantial points
Related pages ≥ 1 related field is non-empty
Source URLs sources.urls is non-empty
Back-links added every page in related back-links to this page

Every entity page must have:

Requirement Description
One-line description frontmatter title
Key features ≥ 2 body has substantive descriptions
Related pages ≥ 1 related field non-empty
Source URLs sources.urls is non-empty

Page Templates

Entity Page

---
type: entity
title: Entity Name
created: YYYY-MM-DD
updated: YYYY-MM-DD
tags: [tags]
related: [page-slug-1, page-slug-2]
sources:
  - file: bookmarks_xxx.md
    urls:
      - https://example.com
---

# Entity Name

> One-line description (used in index.md summary).

## Overview
Main content and background.

## Key Features
- Feature 1
- Feature 2

## Related
- [[page-slug]] — reason (back-link auto-added)

## Sources
- [Article Title](https://example.com) — source description

Concept Page

---
type: concept
title: Concept Name
created: YYYY-MM-DD
updated: YYYY-MM-DD
tags: [tags]
related: [page-slug-1, page-slug-2]
sources:
  - file: bookmarks_xxx.md
    urls:
      - https://example.com/article1
---

# Concept Name

> One-line definition.

## Core Principles
- Principle 1
- Principle 2
- Principle 3

## Use Cases
- Use case 1

## Related
- [[page-slug]] — reason

## Counter-arguments / Data Gaps
- Known limitations
- Uncovered aspects

## Sources
- [Article Title](https://example.com) — source description

Comparison Page

---
type: comparison
title: A vs B
created: YYYY-MM-DD
updated: YYYY-MM-DD
tags: [tag1, tag2]
related: [page-slug-a, page-slug-b]
sources:
  - file: bookmarks_xxx.md
    urls:
      - https://example.com/comparison
---

# A vs B

> One-line summary: A is better for X, B is better for Y.

## Overview
Why these two are compared and when this comparison matters.

## Comparison Dimensions

| Dimension | A | B |
|-----------|---|---|
| Dimension 1 | detail | detail |
| Dimension 2 | detail | detail |

## When to Choose A
- Scenario 1
- Scenario 2

## When to Choose B
- Scenario 1
- Scenario 2

## Related
- [[page-slug-a]] — A's entity
- [[page-slug-b]] — B's entity

## Sources
- [Source Title](https://example.com) — source description

Synthesis Page

---
type: synthesis
title: Topic Overview
created: YYYY-MM-DD
updated: YYYY-MM-DD
tags: [tag1, tag2]
related: [page-slug-1, page-slug-2]
sources:
  - file: bookmarks_xxx.md
    urls:
      - https://example.com/overview
---

# Topic Overview

> One-line summary of this knowledge domain.

## Scope
What this synthesis covers.

## Key Concepts
- [[concept-1]] — brief description
- [[concept-2]] — brief description

## Key Entities
- [[entity-1]] — brief description

## Landscape
- Trend or pattern 1
- Trend or pattern 2

## Knowledge Gaps
- What needs deeper research

## Related
- [[page-slug-1]] — reason

## Sources
- [Source Title](https://example.com) — source description

Operations

Ingest (Collection & Digestion)

Phase 1 — Analysis

## Key Entities
Identified entities

## Key Concepts
Identified core concepts

## Main Arguments & Findings
Key arguments and findings

## Connections to Existing Wiki
Relations to existing wiki pages

## Contradictions & Tensions
Conflicts with existing knowledge

## Coverage Gaps
What was mentioned but not covered deeply?
What related topics are missing?

## Recommendations
New/update which pages

Phase 2 — Generation

  1. Create/update target pages (with urls in sources)
  2. Sync related + back-link (bidirectional link enforcement)
  3. Verify pages meet quality thresholds
  4. Update index.md
  5. Append to log.md

Output format — always write exactly this structure, no deviations:

## Ingest Plan

### Pages to create/update
| Action | File | Summary |
|---------|------|---------|
| CREATE | wiki/concepts/page-slug.md | 1-line description |
| UPDATE | wiki/entities/backlink-target.md | add related: page-slug |

### Back-link sync
- [[A]] → add B to related → check B has A, add if missing

### index.md update
- Add: `- [[page-slug]] — 1-line description (concept/entity)`

### log.md entry
- `[YYYY-MM-DD] Ingest: N pages, sources: bookmarks_xxx.md`

Phase 2 execution: follow the plan exactly. Write files using the templates in Page Templates section.

Query

Always follow this priority when answering:

  1. Read index.md → find candidate pages by tag/topic match
  2. Read candidate pages → extract claims + sources.urls
  3. web_fetch top sources → verify critical claims (flag ⚠️ if can't reach)
  4. Synthesize → answer with confidence annotation (✅/⚠️/❌)
  5. Cite sources → always include the specific URL that confirmed each claim

When wiki has no relevant page: fall back to web_search, then optionally ingest the result to wiki.

Relink (Automatic Relationship Discovery)

Trigger: batch ingest complete / periodic heartbeat

Process:

1. Scan all wiki/*.md tags and body text
2. Extract core topics from each page
3. Find page pairs sharing tags/topics
4. Analyze relationship strength pairwise
5. Generate recommended link list (candidate)
6. User confirms before writing (back-link sync)

Execution steps:

# 1. Collect all related pairs (shared tags)
grep -r "^tags:" wiki/concepts/ wiki/entities/ | analyze

# 2. List orphan pages
for f in wiki/**/*.md; do
  related=$(grep "^related:" "$f")
  inbound=$(grep -r "^* [[$(basename $f .md)]]" wiki/)
  [ -z "$related" ] && [ -z "$inbound" ] && echo "$f is orphan"
done

# 3. LLM generates relink suggestion report
#    Format:
#    [[page-A]] <--> [[page-B]]  reason: shared tag MySQL B+tree
#    [[page-C]] --> [[page-D]]   reason: C mentions D but not linked

Write rules:

  • Update A's related to add B
  • Update B's related to add A
  • Append to log.md

Lint (Health Check) — Enhanced

Trigger: user request / periodic heartbeat

Scan dimensions (6):

# Dimension Description
1 Orphan pages No related pages, no inbound links
2 Dangling references related references non-existent slugs
3 One-way links A→B but B→A missing
4 Contradiction detection Same claim described differently across pages
5 Quality threshold Page fails minimum quality (no urls/no related/principles<3)
6 Naming drift Slug style inconsistent (mixed case/mixed Chinese-English)

Lint report format:

## Lint Report — YYYY-MM-DD

### Orphan Pages (N)
- [[page]] — no related, no inbound

### One-way Links (N)
- [[A]] → [[B]] (B not back-linking A)

### Dangling References (N)
- [[page]] references non-existent [[nonexistent]]

### Quality Failures (N)
- [[page]] — missing urls source
- [[page]] — empty related

### Contradictions (N)
- [[page-A]] says: X is Y
- [[page-B]] says: X is Z

### Naming Issues (N)
- [[page]] — slug has uppercase/mixed Chinese-English

### Recommended Actions
1. [Priority 1]
2. [Priority 2]

Deep Research

Trigger: lint finds Coverage Gaps / user says "research X"

Process:

1. Discover knowledge gap
   lint report "missing coverage" items
   user says "research XXX"

2. Generate 3-5 search queries
   Format: each query should be specific enough to return distinct results
   Example gap "MySQL MVCC":
     → "MySQL MVCC multi-version concurrency control principles"
     → "MySQL MVCC undo log implementation"
     → "MySQL MVCC ReadView isolation levels"

3. Multi-source search
   Execute web_search for each query (max 5 queries)
   Collect top 3 results per query

4. Ingest results
   Write raw search results to raw/sources/deep-research-YYYYMMDD.md
   Execute full ingest pipeline

5. relink + lint
   Complete bidirectional links
   Run lint to verify health

Deep Research output:

## Research Report: [Topic]

### Gap Identified
[What was missing]

### Search Queries Used
1. query text → N results
2. query text → N results

### Key Findings
- Finding 1 [source](url)
- Finding 2 [source](url)

### New Pages Created
- [[new-page-1]] — 1-line description
- [[new-page-2]] — 1-line description

### Recommendations
- [next research direction]

purpose.md (Wiki Constitution)

Every wiki should have purpose.md defining:

# purpose.md

## Goal
Who is this wiki for? What problem does it solve?

## Core Questions
What core questions must this wiki answer?

## Scope
What domains are covered?
What is explicitly excluded?

## Evolution Direction
Near-term (3 months): fill gaps in which domains?
Mid-term (6 months): what state to achieve?
Long-term (1 year): what is the ideal wiki form?

## Quality Standards
What is the minimum quality threshold?

Source Traceability Chain

User bookmarks (Chrome export)
  ↓
raw/sources/bookmarks_xxx.md  (immutable)
  ↓  Ingest writes
wiki/xxx.md
  sources:
    - file: bookmarks_xxx.md
      urls:
        - https://example.com  ← specific URL
  ↓  Query time
OpenClaw reads wiki → reads sources.urls → web_fetch original URL → verify

Use Cases

  • User asks technical question (check wiki first, then search)
  • User says "help me digest this link"
  • User requests "organize my collected content on XXX"
  • User requests "run lint"
  • User requests "relink"
  • User requests "research X" (Deep Research)
  • Periodic heartbeat triggers lint + relink + quality check

Confidence Annotations

Annotation Meaning
✅ Verified wiki content matches original URL source
⚠️ Inferred wiki content is LLM inference based on source, not direct quote
❌ Disputed wiki content contradicts source, needs verification

Bidirectional Link Write Rules (Enforced)

Every time you modify the related field:

When writing A's related to add B:
  1. Add B to A's related: [...]
  2. Check if B's related already has A
  3. If not, add A as back-link
  4. If yes, skip

Prohibited:

  • ❌ Write A→B only, skip B→A
  • ❌ Leave related empty with no links added
  • ❌ sources has only file, no urls

Common Mistakes

Mistake Why it's wrong Correct approach
Create entity + concept for same topic Double maintenance, confuses graph Pick one: named → entity, abstract → concept
Skip back-link when adding related One-way links break graph traversal Always sync back-link when modifying related
Use Chinese in slugs Breaks tooling, inconsistent Use pinyin or English, not mysql-suo-yin
Put only filename in sources Loses URL-level traceability Always include urls: [https://...]
Leave concept page with < 3 core principles Fails quality threshold Force extraction of ≥ 3 substantive points
Write ingest output as prose description Hard to execute, format inconsistent Always use structured Ingest Plan format (table + steps)

File Setup Reminder

On first wiki setup, you must create:

  • purpose.md — wiki constitution (goal, scope, quality standards)
  • schema.md — structure conventions (naming rules, page templates)
  • wiki/index.md — entry point with domain overview
  • wiki/log.md — operation log (append-only)

Without these, lint and relink cannot run properly.

Author

zhangmengyang/karpathy-wiki-improve

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,018
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,013
Skill 文件
  • SKILL.md
    • karpathy-wiki — OpenClaw Implementation
    • Trigger Keywords (Activation)
    • wiki Root
    • Core Principles
    • Page Type Taxonomy (entity vs concept boundary)
    • Naming Convention
    • YAML Frontmatter (Required Fields)
    • Quality Thresholds
    • Page Templates
      • Entity Page
      • Concept Page
      • Comparison Page
      • Synthesis Page
    • Operations
      • Ingest (Collection & Digestion)
      • Query
      • Relink (Automatic Relationship Discovery)
      • Lint (Health Check) — Enhanced
      • Deep Research
    • purpose.md (Wiki Constitution)
    • Source Traceability Chain
    • Use Cases
    • Confidence Annotations
    • Bidirectional Link Write Rules (Enforced)
    • Common Mistakes
    • File Setup Reminder
    • Author
  • 项目或源文件

相关 Skill

更多
LLM Wiki LLM Wiki 创建并维护一个持久化的、由大语言模型(LLM)维护的知识库(wiki),遵循Andrej Karpathy的模式。LLM主动构建并维护相互连接的内容...
Obsidian Wiki Obsidian Wiki Build and maintain a compiled LLM Wiki inside an Obsidian vault following Karpathy's pattern. Use when working with an Obsidian vault as a persistent knowled...
knowledge-harvest-system knowledge-harvest-system 基于 Karpathy LLM Wiki 方法论的对话知识回流系统——三组件闭环(Signal Detector → Brain Ops → Knowledge Harvest),让 Agent 从过目就忘变成持续学习。
Z1矩阵宫殿记忆法 Z1矩阵宫殿记忆法 构建并运营文件驱动的记忆宫殿,用于多智能体系统,融合空间记忆外壳与持续维护的 LLM Wiki 反射层。
multi-agent-llm-wiki multi-agent-llm-wiki 多Agent协作的LLM Wiki知识库管理 — 基于Karpathy的LLM Wiki模式,支持首次用户引导、Ingest/Query/Lint三大操作,由蚁群协作完成。