Create and maintain a structured, AI-oriented knowledge base. Supports four modes: first-time creation, incremental ingestion (from inbox, conversation, or URL), auto-reorganization, and health check (lint). Trigger when users mention: creating a knowledge base, organizing knowledge, digesting documents, processing inbox, adding knowledge, wiki management, organizing materials, ingesting articles, fetching content from URLs, updating the knowledge base, health check, lint, check knowledge base, etc. Even casual phrases like "help me organize this", "save this for later", "there's new stuff in inbox", "check my knowledge base for problems", "is my wiki healthy" should trigger this skill.
Manage a structured knowledge base designed for AI consumption. The core idea: humans feed raw materials, AI digests and maintains everything.
<kb-root>/
├── README.md # For humans: purpose, structure, usage guide
├── _surface.md # Root index (flat phase: lists every page; categorized phase: lists only categories)
├── _rules.md # Operation rules (human-maintained, LLM read-only)
├── log.md # Append-only operation log
├── inbox/ # Raw materials waiting to be digested
│ └── _processed/ # Originals moved here after digestion (never deleted)
└── wiki/ # All knowledge pages (maintained by LLM)
├── page_a.md # Flat phase: pages sit directly under wiki/
└── crypto/ # Categorized phase: pages grouped into subfolders
├── _index.md # Sub-index: one-line index of every page in this category
└── page_b.md
Core mechanism — hierarchical index:
The knowledge base has two phases, transitioning automatically as content grows:
_surface.md_surface.md_surface.md lists only category folders. Each subfolder has its own _index.md. LLM reads _surface.md → picks a category → reads that _index.md → loads the target page.This keeps _surface.md short no matter how large the wiki grows.
First, confirm the knowledge base path. If the user hasn't specified one, ask: "Where should the knowledge base live?"
Once you have the path, detect the current mode:
Pre-check: If the user explicitly asks for a health check or lint (e.g. "check my wiki", "is my knowledge base healthy"), go directly to Mode 4: Lint regardless of inbox state or other signals.
Otherwise, follow this priority:
_surface.md → First-time creation (migrate existing docs)inbox/ has files → Incremental mode (digest from inbox)Execute in order:
inbox/, wiki/)README.md (use template below, replace knowledge base name)_rules.md (use template below)_surface.md with header line onlylog.md with first entryThe directory already has files but isn't in knowledge base format:
_surface.md, _rules.md, README.md, log.md, inbox/, wiki/)wiki/, add index line to _surface.mdinbox/, then digest using incremental mode_rules.md or README.mdlog.mdCheck in this priority order:
inbox/ has files → Source A (inbox digestion)inbox/_surface.md_surface.md to identify the relevant category, then read that category's _index.mdwiki/_index.md and add a new category entry to _surface.md_surface.md_index.md (add entry, update the category summary and last-updated line), and update the category line in _surface.md if the description needs adjusting_index.md or _surface.md) and verify its category summary still accurately reflects the content. If not, update it. Knowledge flows bottom-up: page changes propagate upward through the index hierarchyinbox/_processed/ (never delete originals — they serve as the source of truth if re-ingestion is needed)log.mdUser provided text content directly in the conversation:
_surface.md or subfolder _index.md) and log.md. Run bubble-up check (same as Source A)User provided a link:
inbox/ as backup, extract knowledge into wiki/wiki/, keep original URL in page frontmatterinbox/ to inbox/_processed/ (same as Source A — keep the traceability chain)_surface.md or subfolder _index.md) and log.md. Run bubble-up check (same as Source A)After every incremental operation, check the file count in wiki/:
| File count | Action |
|---|---|
| < 20 | Do nothing. Keep flat structure. |
| 20 – 50 | Suggest to user: "wiki/ now has X files. Want me to organize them into subfolders by topic?" |
| > 50 | Strongly recommend: "wiki/ has X files — this is getting hard to navigate. I strongly suggest organizing by topic." |
Reorganization steps (must get user consent first):
_surface.md contentProposed organization:
- crypto/ (12 files): on-chain analysis, token research
- tools/ (8 files): tool guides, API docs
- research/ (6 files): paper summaries, study notes
_index.md in each new subfolder (migrate the relevant entries from _surface.md)_surface.md: replace individual page entries with category-level entries pointing to each subfolder's _index.md[[]] links) in wiki pages to reflect new pathslog.mdCategory splitting: If any single subfolder exceeds 30 pages, suggest splitting it into sub-categories (e.g. crypto/ → crypto/defi/, crypto/mev/). The same reorganization rules apply: show the plan, get user consent, then execute. Each new sub-category gets its own _index.md, and the parent _index.md is rewritten to list sub-categories instead of individual pages.
Important: Any operation that moves, renames, or restructures files requires showing the plan and getting explicit user approval before execution.
When the user asks to check the knowledge base health:
Pre-check: First verify the knowledge base structure exists at the given path. If the path doesn't exist, has no _surface.md, or is missing wiki/, tell the user: "No valid knowledge base found at this path. Want me to create one?" Do not proceed with lint checks on a non-existent or incomplete structure.
If the structure is valid, run all checks below and present a report.
Wiki pages that exist as files but have no entry in any index (_surface.md or _index.md).
.md files under wiki/ (excluding _index.md files)_surface.md (flat phase) or the parent folder's _index.md (categorized phase)Index entries or [[]] cross-references that point to pages that don't exist.
_surface.md and all _index.md files, check every link target exists as a file[[page-name]] reference resolves to an existing fileMultiple pages covering the same topic, potentially with conflicting information.
_surface.md (and _index.md files if categorized) to get all page titles and descriptionsPages with outdated content based on their updated frontmatter date.
updated is more than 90 days agoMismatches between the index and the actual file structure.
wiki/ has an _index.md_surface.md category entries match actual file countsAfter running all checks, present results to the user in this format:
Knowledge Base Health Report
=============================
Orphan Pages (not in any index):
- wiki/forgotten_note.md
Broken References:
- _surface.md → wiki/deleted_page.md (file missing)
- wiki/solana_mev.md → [[old_page]] (target missing)
Potential Duplicates:
- wiki/defi_basics.md ↔ wiki/defi_intro.md (overlapping content about DeFi fundamentals)
Stale Pages (not updated in 90+ days):
- wiki/old_research.md (last updated: 2025-12-01)
Index Issues:
- wiki/crypto/ has no _index.md
- _surface.md says crypto/ has 15 pages, actually has 18
✅ No issues: [list any checks that passed clean]
After the report, ask the user: "Want me to fix any of these issues?" Then only act on what the user approves. Fixes may include:
updated date after reviewing stale pages_index.md filesRecord the lint operation in log.md.
---