📚knowledge-base
- プラグイン
- desktop-commander
- ソース
- GitHub で見る ↗
説明
Markdown形式のナレッジベースを作成・管理し、あらゆるAIエージェントが読み込み、検索、更新できるようにします。 次のような場合に使用: - ナレッジベースを開始したい - ノートを追加または更新したい - エージェントやLLMが利用するドキュメント/ノートを整理したい - ノートのインデックスを構築したい - 既存のMarkdownナレッジベースのクリーンアップ/メンテナンスを実行したい トリガーキーワード: 「knowledge base」、「KB」、「notes for the agent」、「index of notes」、「second brain」、「docs for AI context」、「add a note」、「update the KB」
原文を表示
Create and maintain a Markdown knowledge base that any AI agent can read, search, and update. Use when the user wants to start a knowledge base, add or update notes, organize docs/notes for an agent or LLM to consume, build an index of notes, or run a cleanup/maintenance pass on an existing MD knowledge base. Triggers include "knowledge base", "KB", "notes for the agent", "index of notes", "second brain", "docs for AI context", "add a note", "update the KB".
ユースケース
- ✓ナレッジベースを開始したい
- ✓ノートを追加または更新したい
- ✓AIエージェント用のドキュメントを整理する
- ✓ノートのインデックスを構築する
- ✓Markdownナレッジベースをメンテナンスする
本文(日本語訳)
Knowledge Base (Markdown、agent可読形式)
Knowledge Base (KB) はMarkdownファイルのフォルダであり、任意の AI agentがベクトルデータベースなしでナビゲートできるように設計されています。agentは1つのindexファイルを読み、説明文から関連するノートを選択し、必要なもののみを開きます。KB全体は読みやすく、indexは簡潔に保つ必要があります。indexはコンテキストにロードされるため、高信号性が必須です。
新しいKBを作成する際、ノートを追加・編集する際、またはメンテナンスを実施する際は、以下のルールを適用してください。ユーザーのリクエストが曖昧な場合(新規KB vs ノート追加 vs クリーンアップ)は、実行する前にどれかを確認してください。
コア原則(その理由)
-
Indexファースト・ナビゲーション。 Indexはマップであり、コンテナではありません。agentは
INDEX.mdを読み、ワンライン説明文でノートを選択し、そのファイルのみを開きます。ノートがindexに登録されていない限り、KB内に「存在する」わけではありません。 -
アトミック性。 1ノート1トピック。タイトルに「and」が必要なら、おそらく2つのノートです。アトミックなノートは検索、リンク、再利用が容易です。
-
安定的なID。 すべてのノートは永続的で変わらない、再利用されないIDを持つため、リンクは名前変更や移動後も生き残ります。
-
理由を伴ったリンク。 2つのノートが接続する場合、なぜかを記述します(前提条件、サポート、対比、参照)。接続はノートそのものと同等の価値を持ちます。
-
簡潔な指示。
INDEX.mdの指示は短く、高信号性を保つ必要があります。agentのコンテキスト予算と競い合うためです。本体はオンデマンドでロードされます。 -
検索に向けた構造化。 明確なH1タイトルとH2/H3セクションにより、agentはノート全体ではなく関連スライスを取得できます。
フォルダ構造(トピック別にネスト)
knowledge-base/
INDEX.md # エントリーポイント: 指示 + 全ノート登録簿
topics/
<topic>/
_topic.md # トピックマップ: このトピックが何をカバーするか + そのノート
<slug>.md # 1つのアトミックなノート
assets/ # ノートで参照される画像・添付ファイル
- トピックフォルダは短い小文字の名詞(
auth,billing,deploys)。 _topic.mdはトピックレベルのコンテンツマップ(MOC): 簡潔な紹介とそのトピック内のすべてのノートへのリンク。便宜的なビューです。INDEX.mdが情報源です。
命名規則
- 小文字の kebab-case、予測可能で grep可能:
topics/auth/session-tokens.md。 - ファイル名にスペース、大文字、日付は禁止(日付はfrontmatterに)。
- ファイル名slugはノートの
idのslug部分と一致するべき。
必須frontmatter(すべてのノート)
---
id: 20260618-session-tokens # IDスキーム: YYYYMMDD-slug。安定的。再利用・変更禁止。
title: Session tokens # 人間向けタイトル、ノートのH1でもある
tags: [auth, security] # INDEX.mdの統制済みリストのみ
created: 2026-06-18
updated: 2026-06-18
related: [20260618-auth-flow] # リンク先ノートのID
summary: このノートが何をカバーするかを示す1文。
---
-
id:YYYYMMDD-slug。ソート可能、読みやすく、安定的。同日の異なるタイトルのノートはslugで区別。同じ日・同じslugで衝突するなら-2,-3を追加(INDEX.md登録簿を確認してから割り当て)。割り当てたら、idは永続的。 -
summary: この文がindex登録簿に入る — agentがノートを開くべきか決めるのに役立つように記述。 -
updated: 本体が変わるたびにバンプ。
ノート本体の形
# Session tokens
> Summary: 1文(frontmatterのsummaryを反映)。
## Context
このノートが存在する理由 / いつ適用されるか。
## Details
実際のコンテンツ、短いH2/H3セクション。
## Related
- [Auth flow](auth-flow.md) — 前提条件: トークンはauth flowで発行されます。
- [Rate limiting](../api/rate-limiting.md) — 参照: トークンはrate-limitキーを持ちます。
- ノート間で 相対リンク を使用し、フレーズで関係を注釈。
- すべてのリンク先もノートの
relatedfrontmatterに表示されるべき。
INDEX.md(唯一の情報源)
INDEX.md は2部構成: agentの操作指示と登録簿。
# Knowledge Base — Index
## このKBの使い方(agent向け)
1. このindexを最初に読みます。説明文でノートを選択し、そのノートのみを開きます。
2. 質問に答えるには、すべてをスキャンするより1~3個の特定ノートを開くのが好ましい。
3. ノートの `id` を記載して情報の出所を示します。
## このKBの更新方法(agent向け)
- 新規アイデア → 新規ノート(アトミック)を作成。同じアイデアが変更 → ノートを原位置で編集し `updated` をバンプ。
- 作成・リネーム・削除は、同じ変更で必ずこの登録簿とトピックの `_topic.md` を更新。
- 統制済み語彙のタグのみ使用; 新規タグはここに追加してから使用。
## 統制済みタグ
`auth`, `security`, `billing`, `api`, `ops` <!-- 意図的に拡張 -->
## 登録簿
### auth
- `20260618-auth-flow` — **Authentication flow** — `topics/auth/auth-flow.md` — エンドツーエンドでユーザーセッションが確立される方法。
- `20260618-session-tokens` — **Session tokens** — `topics/auth/session-tokens.md` — トークンフォーマット、ライフタイム、ローテーション。
### billing
- `20260618-invoicing` — **Invoicing** — `topics/billing/invoicing.md` — 請求書がどのように生成・送付されるか。
登録簿行フォーマット: `id` — **Title** — `path` — ワンライン説明。
_topic.md(トピックマップ)
# Auth
認証、セッション、アクセス制御をカバーするノート。
- [Authentication flow](auth-flow.md) — セッションがどのように確立されるか。
- [Session tokens](session-tokens.md) — トークンフォーマット、ライフタイム、ローテーション。
ワークフロー
新規KBを作成
- 上記のフォルダ構造用に
create_directory。 write_fileINDEX.mdに指示ブロック、空の統制済みタグリスト、空の登録簿。- 最初のトピックフォルダ +
_topic.mdを追加、次に最初のノート(各write_fileで)。 INDEX.mdに登録し_topic.mdからリンク —edit_blockで両方、変更行のみ。
ノートを追加
- トピックフォルダを選択または作成(
list_directoryで確認)。 write_fileノート(kebab-caseのslug)完全なfrontmatterと本体形。- クロスリンクを追加(
relatedに反映)。 INDEX.mdに登録し_topic.mdにリンク(edit_blockで)— 同じ変更。
ノートを更新
- 同じアイデア、新情報 → ノートを原位置で
edit_block、updatedをバンプ、登録簿行が変更ならedit_block。 - 本当に新規アイデア → このノートを拡張する代わりに新規アトミックノートを
write_file。
メンテナンスパス(必要に応じて実施)
start_search(ripgrep)でテキストスキャン、get_file_info / list_directory で存在確認 — 組み合わせるとスケールで扱えます:
-
孤立ノート(インバウンドリンクなし — アウトバウンドは関係なし): KBでノートの
idとファイル名slugをstart_search、自己マッチは割引(ノート自身、INDEX.md,_topic.md)。残っているのは本当の参照; 残っていない = 孤立、関連ノート/MOCからリンクするか архив。 -
リンク切れ / ドリフト: テキストヒットから解決を推測しない — 文字列が存在してもファイルが存在するわけではない。各登録簿パスと
related:ターゲットをget_file_info(またはトピック別list_directory)で確認、ディスク上のすべてのファイルが登録されていることを確認。テキスト比較はタイトル/summary のズレ半分のみ。 -
非アトミックノート: 複数トピックをカバーするまで成長したノート → 分割。
-
重複: ほぼ同一のノート → マージ、1つの
idを保持、リンクをリダイレクト。 -
タグ拡散:
INDEX.mdの統制済みリストを読み、frontmattertags:行をstart_search、リストにないタグをフラグ → 調整。
read_multiple_files で候補を一括取得、edit_block で修正適用、変更内容をレポート。
KB編集を終了する前のチェックリスト
- [ ] すべての新規/変更ノートに完全で有効なfrontmatterがある。
- [ ]
idは一意で変更なし; ファイル名slugはid slugと一致。 - [ ] すべてのリンクが解決し
relatedに反映されている。 - [ ]
INDEX.md登録簿とトピック_topic.mdが変更を反映。 - [ ] タグは統制済み語彙から。
- [ ] 変更したすべてのノートで
updatedをバンプ。
原文(English)を表示
Knowledge Base (Markdown, agent-readable)
A knowledge base (KB) here is a folder of Markdown files designed so any AI agent can navigate it without a vector database: the agent reads one index file, picks the relevant notes by their descriptions, and opens only those. Keep the whole KB readable and the index lean — the index is what gets loaded into context, so it must be high-signal.
Apply the rules below when creating a new KB, adding/editing notes, or doing a maintenance pass. When the user's request is ambiguous (new KB vs. add note vs. cleanup), ask which one before acting.
Core principles (the "why")
- Index-first navigation. The index is a map, not a container. An agent
reads
INDEX.md, selects notes by their one-line descriptions, then opens only those files. No note is "in" the KB unless it's registered in the index. - Atomicity. One topic per note. If a title needs an "and", it's probably two notes. Atomic notes are easier to find, link, and reuse.
- Stable IDs. Every note has a permanent ID that never changes and is never reused, so links survive renames and moves.
- Linked with reason. When two notes connect, state why (prerequisite, supports, contrasts, see-also). Connections carry as much value as the notes.
- Lean instructions. Keep
INDEX.mdinstructions short and high-signal — it competes for the agent's context budget. Bodies load on demand. - Structured for retrieval. Clear H1 title and H2/H3 sections so an agent can grab the relevant slice of a note, not the whole thing.
Folder structure (nested by topic)
knowledge-base/
INDEX.md # entry point: instructions + full note registry
topics/
<topic>/
_topic.md # topic map: what this topic covers + its notes
<slug>.md # one atomic note
assets/ # images / attachments referenced by notes
- Topic folders are short, lowercase nouns (
auth,billing,deploys). _topic.mdis the topic-level map of content (MOC): a short intro plus links to every note in that topic. It is a convenience view;INDEX.mdremains the source of truth.
Naming rules
- Lowercase kebab-case, predictable and greppable:
topics/auth/session-tokens.md. - No spaces, no uppercase, no dates in filenames (dates live in frontmatter).
- The filename slug should match the note's
idslug portion.
Required frontmatter (every note)
---
id: 20260618-session-tokens # ID scheme: YYYYMMDD-slug. Stable. Never reuse or change.
title: Session tokens # human title, also the note's H1
tags: [auth, security] # only tags from the controlled list in INDEX.md
created: 2026-06-18
updated: 2026-06-18
related: [20260618-auth-flow] # IDs of linked notes
summary: One scannable sentence describing what this note covers.
---
id:YYYYMMDD-slug. Sortable, readable, stable. Different-titled same-day notes differ by slug; if two same-day notes would collide on the same slug, append-2,-3, … (check theINDEX.mdregistry before assigning). Once assigned, the id is permanent.summary: this exact sentence is what goes in the index registry — write it to help an agent decide whether to open the note.updated: bump it whenever the body changes.
Note body shape
# Session tokens
> Summary: One sentence (mirrors frontmatter summary).
## Context
Why this note exists / when it applies.
## Details
The actual content, in short H2/H3 sections.
## Related
- [Auth flow](auth-flow.md) — prerequisite: tokens are issued during the auth flow.
- [Rate limiting](../api/rate-limiting.md) — see-also: tokens carry the rate-limit key.
- Use relative links between notes and annotate the relationship in a phrase.
- Every link target should also appear in the note's
relatedfrontmatter.
INDEX.md (the single source of truth)
INDEX.md has two parts: operating instructions for agents, and the registry.
# Knowledge Base — Index
## How to use this KB (for agents)
1. Read this index first. Pick notes by their descriptions; open only those.
2. To answer a question, prefer opening 1–3 specific notes over scanning everything.
3. Cite the note `id` when you use information from it.
## How to update this KB (for agents)
- New idea → create a new note (atomic). Same idea changed → edit the note in place and bump `updated`.
- Any create / rename / delete MUST update this registry and the topic's `_topic.md` in the same change.
- Use only tags from the controlled vocabulary below; add a new tag here before using it.
## Controlled tags
`auth`, `security`, `billing`, `api`, `ops` <!-- extend deliberately -->
## Registry
### auth
- `20260618-auth-flow` — **Authentication flow** — `topics/auth/auth-flow.md` — How a user session is established end to end.
- `20260618-session-tokens` — **Session tokens** — `topics/auth/session-tokens.md` — Token format, lifetime, and rotation.
### billing
- `20260618-invoicing` — **Invoicing** — `topics/billing/invoicing.md` — How invoices are generated and sent.
Registry line format: `id` — **Title** — `path` — one-line description.
_topic.md (topic map)
# Auth
Notes covering authentication, sessions, and access control.
- [Authentication flow](auth-flow.md) — how a session is established.
- [Session tokens](session-tokens.md) — token format, lifetime, rotation.
Workflows
Create a new KB
create_directoryfor the folder structure above.write_fileINDEX.mdwith the instructions block, an empty controlled-tag list, and an empty registry.- Add the first topic folder +
_topic.md, then the first note (each viawrite_file). - Register the note in
INDEX.mdand link it from_topic.md—edit_blockboth so you touch only the changed lines.
Add a note
- Pick or create the topic folder (
list_directoryto see what's there). write_filethe note (kebab-case slug) with full frontmatter and the body shape.- Add cross-links (and mirror them in
related). - Register it in
INDEX.mdand link it in_topic.mdwithedit_block— same change.
Update a note
- Same idea, new information →
edit_blockthe note in place, bumpupdated, andedit_blockthe registry line if the scope changed. - Genuinely new idea →
write_filea new atomic note instead of expanding this one.
Maintenance pass (run on demand)
Use start_search (ripgrep) for text scans and get_file_info / list_directory
for existence checks — together they make this tractable at scale:
- Orphans (no inbound links — outbound doesn't matter):
start_searchthe KB for the note'sidand filename slug, then discount the self-matches that always exist — the note's own file,INDEX.md, and its_topic.md. Anything left is a genuine inbound reference; nothing left = orphan, so link it from a relevant note/MOC or archive it. - Broken links / drift: don't infer resolution from a text hit — a string
existing doesn't mean the file does. Confirm each registry path and
related:target exists withget_file_info(orlist_directoryper topic), and that every file on disk is registered. Use a text compare only for the titles/summaries-out-of-sync half. - Non-atomic notes: notes that grew to cover multiple topics → split them.
- Duplicates: near-identical notes → merge, keep one
id, redirect links. - Tag sprawl: read the controlled list from
INDEX.md, thenstart_searchthe frontmattertags:lines and flag any tag not on the list → reconcile. Pull candidates in bulk withread_multiple_files, apply fixes withedit_block, and report what changed.
Checklist before finishing any KB edit
- [ ] Every new/changed note has complete, valid frontmatter.
- [ ]
idis unique and unchanged; filename slug matches the id slug. - [ ] All links resolve and are mirrored in
related. - [ ]
INDEX.mdregistry and the topic_topic.mdreflect the change. - [ ] Tags are from the controlled vocabulary.
- [ ]
updatedbumped on every changed note.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。