| name | wiki |
| license | MIT |
| metadata | {"version":"0.0.1"} |
| description | Use this skill to build and maintain a personal LLM-powered knowledge base (wiki) in the current project. Invoke it for: ingesting articles, URLs, PDFs, or pasted text into the wiki; querying "what do I know about X"; asking about topics in your knowledge base; linting wiki quality. Triggers include /wiki, "add to wiki", "wikiに追加", "ingest this", "このURLをwikiに", "Xについて何を知ってる?", "知識ベースを検索", "lint the wiki", "矛盾チェック", "Karpathy wiki", "LLM wiki", or any request to save a source to a personal knowledge base. If the user says /wiki or mentions adding knowledge anywhere, use this skill — don't try to handle it ad hoc.
|
Wiki Skill
Build and maintain a personal knowledge base using the Karpathy LLM-wiki pattern.
You manage two directories at the project root: raw/ (immutable source material you read
but never modify) and wiki/ (compiled knowledge pages you own entirely).
Language rule: All wiki pages, raw file content, and compiled articles are written in
Japanese. Metadata field keys (Updated:, Sources:, Raw:, Published:,
Collected:) stay in English so grep and log operations keep working uniformly.
The compile metaphor: Raw sources are source code; the wiki is the compiled binary.
Synthesis happens once at ingest time and compounds — when you add a new source you integrate
its knowledge into the existing wiki rather than re-deriving it at query time.
Architecture
<project-root>/
├── raw/ # Immutable sources. You read, never modify.
│ └── <topic>/
│ └── YYYY-MM-DD-slug.md
└── wiki/ # LLM-owned. You have full authority here.
├── index.md # Global catalog (one row per article)
├── log.md # Append-only operation log
└── <topic>/
└── article-name.md
Templates for all file formats are in references/ relative to this SKILL.md.
Read them when you need the exact format before creating or updating a file.
Intent Routing
/wiki accepts an explicit subcommand or natural language — infer the operation:
| User says | Operation |
|---|
| URL / file path / "これを読んで" / "追加して" / "ingest" | Ingest |
| "Xについて何を知ってる?" / "summarize" / "compare" / "query" | Query |
| "lint" / "矛盾チェック" / "リンク確認" / "整合性" | Lint |
Initialization (first ingest only, idempotent)
Before the very first Ingest, check whether raw/ and wiki/ exist.
Create only what is missing — never overwrite existing files:
raw/ with raw/.gitkeep
wiki/ with wiki/.gitkeep
wiki/index.md — heading # ナレッジベース索引, empty body
wiki/log.md — heading # Wiki ログ, empty body
If Query or Lint is invoked and the wiki structure does not exist, respond:
"まず何かをingestして、wikiを初期化してください。" Do not auto-create on Query/Lint.
Ingest
Always both steps — Fetch then Compile — no exceptions.
Step 1 — Fetch (save to raw/)
-
Retrieve the source using available web/file tools. If nothing can reach it, ask the
user to paste the content directly.
-
Choose a topic directory. Scan existing raw/ subdirectories; reuse one when the topic
is close enough. Create a new subdirectory only for genuinely distinct topics. Topic
names should be concise, lowercase, kebab-case English (e.g. machine-learning,
web-dev, productivity).
-
Save as raw/<topic>/YYYY-MM-DD-slug.md:
- Slug from source title, kebab-case, max 60 chars.
- If published date is unknown, omit the date prefix (
slug.md).
- On filename collision, append a numeric suffix (
slug-2.md).
- Translate/clean the content into Japanese. Preserve the original meaning faithfully;
clean formatting noise only. Do not rewrite opinions.
- See
references/raw-template.md for the exact header format.
Step 2 — Compile (write/update wiki/)
Determine where the new content belongs — these are not mutually exclusive:
- Same core thesis as an existing article → merge. Add the new source to the article's
Raw: field; update affected sections with new information.
- New concept → create a new article in the most relevant topic directory. Name the
file after the concept, not the raw file.
- Spans multiple topics → place in the primary topic; add
## 関連記事 cross-references
to articles in other topics.
Conflict handling: If new content contradicts existing content, annotate the
disagreement inline with source attribution. When the conflicting content spans separate
articles, note it in both and cross-link them.
Article format is in references/article-template.md. Key path rule:
links from wiki/<topic>/article.md to raw files use ../../raw/<topic>/<file>.md.
Step 3 — Cascade Updates
After writing the primary article, check for ripple effects:
- Scan other articles in the same topic directory for content materially affected by the
new source.
- Scan
wiki/index.md entries in other topics for related concepts.
- Update every article whose content changes. Refresh its
Updated: date.
- Archive pages are never cascade-updated (they are point-in-time snapshots).
Step 4 — Post-Ingest Bookkeeping
Update wiki/index.md: add or update one row per touched article. Format is in
references/index-template.md. The Updated: date reflects when the article's knowledge
content last changed, not the filesystem timestamp.
Append to wiki/log.md:
## [YYYY-MM-DD] ingest | <primary article title>
- Updated: <cascade-updated article title>
- Updated: <another article title>
Omit - Updated: lines when no cascade updates occurred.
Query
Answer questions using wiki knowledge. Examples: "Xについて何を知ってる?",
"AとBを比較して", "〜に関して知識ベースにある内容を教えて".
- Read
wiki/index.md to locate relevant articles.
- Read those articles.
- Synthesize a Japanese answer. Prefer wiki content over your own training knowledge.
Cite sources with markdown links using project-root-relative paths:
[記事タイトル](wiki/topic/article.md).
- Output the answer in the conversation. Do not write any files for a plain query.
Archiving a Query Answer
When the user explicitly asks to save or archive the answer (e.g., "これをwikiに保存して",
"archive this"):
- Write the answer as a new wiki page following
references/archive-template.md.
Sources: → markdown links to the wiki articles cited in the answer.
- No
Raw: field (content comes from wiki synthesis, not raw sources).
- File name reflects the query topic:
wiki/<topic>/query-topic-overview.md.
- When rewriting conversation citations into the archive file, convert
project-root-relative paths (
wiki/topic/article.md) to file-relative paths
(../topic/article.md or article.md for same directory).
- Always create a new page. Never merge an archived answer into an existing article.
- Update
wiki/index.md: prefix the summary with [Archived].
- Append to
wiki/log.md:
## [YYYY-MM-DD] query | Archived: <page title>
Lint
Quality checks on the wiki. Two tiers with different authority levels.
Tier 1 — Deterministic Checks (auto-fix silently)
Index ↔ file consistency — compare wiki/index.md against actual files in wiki/
(excluding index.md and log.md):
- File exists but missing from index → add entry with
(要約なし) placeholder; use the
article's Updated: date if present, else today's date.
- Index entry points to a nonexistent file → mark as
[MISSING] in the index. Do not
delete the entry; let the user decide.
Internal link validity — for every markdown link in wiki/ article files (body and
Sources: field, excluding Raw: links and index.md/log.md):
- Target does not exist → search
wiki/ for a file with the same name.
- Exactly one match → fix the path.
- Zero or multiple matches → report to user; do not auto-fix.
Raw reference validity — every link in a Raw: field must point to an existing file:
- Target does not exist → search
raw/ for a file with the same name.
- Exactly one match → fix the path.
- Zero or multiple matches → report to user.
See Also / 関連記事 — within each topic directory:
- Add obviously missing cross-references between related articles.
- Remove links to deleted files.
Tier 2 — Heuristic Checks (report only, no auto-fix)
Use judgment. Report findings without changing files:
- Factual contradictions across articles without conflict annotations.
- Outdated claims that newer ingested sources have superseded.
- Orphan pages with no inbound links from other wiki articles.
- Missing cross-topic references for concepts that appear in multiple topics.
- Concepts frequently mentioned across articles but lacking a dedicated page.
- Archive pages whose cited source articles have been substantially updated since archival.
Post-Lint
Append to wiki/log.md:
## [YYYY-MM-DD] lint | <N> issues found, <M> auto-fixed
Report deterministic fixes inline (e.g., "3件のリンク切れを修正しました"). List heuristic
findings as bullet points under a ### 要確認 heading in the conversation.
Conventions
- Standard markdown throughout. No custom markup.
wiki/ supports one level of topic subdirectories only. No deeper nesting.
- Date semantics:
Collected: / Archived: → today's date (when the operation runs)
Published: → date from the source; use Unknown when unavailable
Updated: → when the article's knowledge content last changed (not the file's mtime)
- Link path rules:
- Inside
wiki/ files → file-relative paths (e.g., ../other-topic/article.md)
- In conversation output → project-root-relative (e.g.,
wiki/topic/article.md)
ingest updates both wiki/index.md and wiki/log.md.
query (archived) updates both. Plain queries update neither.
lint updates wiki/log.md always; updates wiki/index.md only when auto-fixing index entries.