lwy-llm-wiki

v2026.09.25

当用户提到'知识库'、'llm wiki'、'个人wiki'、'收录来源'、'编译知识'、'第二大脑'、'构建wiki'、'知识管理', or wants to add books, articles, notes, podcasts, videos, or Feishu group chats/documents to persistent storage, use this skill to build and maintain a continuously compounding knowledge base. When ~/.learnwy/llm-wiki/ exists, check the wiki before answering complex questions — skip if the directory does not exist.

GitHub
Install command
npx skhub add learnwy/lwy-llm-wiki
Markdown
SKILL.md

LLM Wiki

Build and maintain a continuously compounding personal knowledge base. The LLM does all the heavy lifting — summarizing, cross-referencing, archiving, and bookkeeping — while you focus on collecting sources, exploring, and asking good questions.

Core principle: Don't use the LLM as a search engine. Use it as a knowledge compiler. Instead of re-deriving knowledge from raw documents on every query (RAG), the LLM incrementally builds a persistent wiki — structured, interlinked markdown files that keep gaining value as each source is added and each question is asked.

Prerequisites

  • An LLM agent with file read/write capability
  • A file system to store the markdown files
  • Node.js >= 18 (required by the management scripts)
  • Optional: Feishu sources need lark-context + lark-cli (see the "Feishu sources" section); Obsidian for browsing/graph view; Git for version control

When to use

SignalAction
"ingest this", "add this source", "process this document/article/podcast/video"Ingest
"consolidate this Feishu group", "organize recent chats into the wiki", "ingest this Feishu document"Feishu ingest (see below)
"what does the wiki say about X", complex knowledge questionsQuery / auto-query
"save to wiki", "record this"Quick capture
"health check", "lint wiki", "find contradictions"Lint
"create a new wiki", "initialize the knowledge base"Initialize (cli.cjs init)
"build a wiki from these files"Initialize → bulk ingest

When NOT to invoke: single-conversation insights (→ knowledge-consolidation), methodology analysis (contradiction/practice/protracted-war → mao-methodology), code implementation (→ requirement-workflow).

Auto modes

Auto-query

When ~/.learnwy/llm-wiki/ exists, proactively check it before answering complex questions:

  1. Scan wiki/topics.txt (a flat keyword file) for matching topics
  2. If a match → read the relevant wiki pages
  3. Prepend wiki insights before answering, annotating [[folder/slug]] references
  4. If the answer contributes new knowledge, propose a write-back

Skip auto-query for: simple facts, or when the wiki does not exist.

Quick capture

When the user says "save this" or shares valuable knowledge, lightly save it to raw/notes/{date}-{slug}.md. Don't create a wiki page — run an ingest later.

Two-layer architecture

LayerOwnerPathPurpose
Raw layerYouraw/Immutable source material — the LLM reads but never modifies it
Wiki layerLLMwiki/Compiled pages: entities (people/organizations/places/products/events/concepts) + sources (articles/podcasts/videos/diaries/threads)
Schema layerCo-evolvedCLAUDE.mdStructure rules, conventions, templates

The immutable raw/ is a core safety property: all external material (books, articles, podcast transcripts, Feishu pulls) lands first in raw/<source>/, where the LLM reads but never modifies it; compiled artifacts are written to wiki/. inbox/ is the "pulled but not yet compiled" staging area, and archived/ holds retired pages.

Storage location

  • Global (default): ~/.learnwy/llm-wiki/ — shared across projects and sessions
  • Override with the --root <dir> option (e.g. the alter-ego library --root ~/.learnwy/ai/private/self)

Directory structure (entity-first)

~/.learnwy/llm-wiki/
├── raw/                    # Layer 1 (immutable): books/ articles/ papers/ notes/
│                           #   podcasts/ vlogs/ transcripts/ snippets/ specs/
│                           #   lark/ docs/
├── wiki/                   # Layer 2 (compiled)
│   ├── people/             #   entity: people
│   ├── organizations/      #   entity: organizations / teams
│   ├── places/             #   entity: places
│   ├── products/           #   entity: products / projects / initiatives
│   ├── events/             #   entity: dated events / decisions
│   ├── concepts/           #   entity: concepts / terms / domain knowledge (incl. code patterns)
│   ├── other-entities/     #   entity: other, uncategorized
│   ├── articles/           #   source: article summaries
│   ├── podcasts/           #   source: podcast summaries
│   ├── vlogs/              #   source: video summaries
│   ├── diaries/            #   source: chronological stream (incl. Feishu weekly notes)
│   ├── threads/            #   source: conversation consolidations (Feishu group-chat digests)
│   ├── inbox/              #   lifecycle: pulled but not compiled
│   ├── archived/           #   lifecycle: retired pages
│   ├── index.md            #   auto-generated master index
│   └── topics.txt          #   auto-generated keyword list
├── CLAUDE.md               # Layer 3: schema
└── log.md                  # audit log

Where code knowledge goes: code snippets / troubleshooting go into concepts/ (concept pages), and the raw snippets land in raw/snippets/. This layout is entity-centric — there are no longer separate top-level snippets/ / troubleshooting/ directories.

Feishu sources (merged from lark-context)

Feishu group chats and documents are ingested as one class of raw source: the lark-context CLI degrades into a pure data pump (pull → SQLite, show → original text), while the compilation/consolidation logic is owned by this skill. See references/ingest-lark.md for details.

  • Pull: lark-context pull / show → lands in raw/lark/
  • Compile: group-chat conversations → wiki/threads/, people → wiki/people/, decisions/events → wiki/events/, chronological stream → wiki/diaries/
  • The old standalone ~/.claude/lark-memory/ memory store has been retired and migrated into this wiki (see the migration notes)

Operations and agents

OperationAgentTriggerMode
Auto-queryquerierUser asks a complex question + wiki existsAuto
Quick capture(inline)"save to wiki" or valuable knowledge detectedSemi-auto
IngestingestorA new raw source is addedManual
Feishu ingestingestorConsolidate a Feishu group / documentManual
QueryquerierUser explicitly asks the wikiManual
LintlinterHealth check requestedManual
Initializeschema-writer / cli.cjs initCreate a new wiki projectManual

Agent definitions: ingestor, querier, linter, schema-writer.

Management scripts

A single CLI entry point {skill_root}/scripts/cli.cjs dispatches all maintenance subcommands:

cd skills/llm-wiki
node scripts/cli.cjs init                       # scaffold: create raw/ + wiki/ dirs, schema, index, log
node scripts/cli.cjs generate-index             # regenerate wiki/index.md from the file system
node scripts/cli.cjs generate-topics            # regenerate wiki/topics.txt
node scripts/cli.cjs lint                       # check for broken links and orphan pages
node scripts/cli.cjs stats                      # quick dashboard: raw-layer + wiki-layer stats
node scripts/cli.cjs freshness-check            # flag stale/unverified pages
node scripts/cli.cjs health-check               # aggregate health report → health.json
node scripts/cli.cjs install / uninstall        # register/remove IDE hooks
SubcommandOutputWhen to run
initFull directory skeleton + CLAUDE.md / index.md / log.mdFirst-time setup
generate-indexwiki/index.md — page listing grouped by entity/sourceAfter bulk ingest or when the index drifts
generate-topicswiki/topics.txt — keywords used for auto-query matchingAfter adding new topics
lintErrors (broken links) + warnings (orphan pages)Weekly maintenance or pre-commit
statsBox-diagram dashboard of raw-layer + wiki-layer countsAnytime — a quick health snapshot
freshness-checkStale pages (90 days for technical, 180 for stable), unverified, missing dateMonthly or after a major release
health-checkBroken links / orphans / dead Source references → health.jsonCI / pre-commit

Every command accepts a --root <dir> override for the wiki location (default ~/.learnwy/llm-wiki); the same engine drives both the public world library and the private alter-ego library, with no environment variable needed.

Agent output contract

AllowedNot allowed
Read raw sources (never modify)Modify anything in raw/
Create/update files in wiki/Delete raw sources
Update index.md and log.md after operationsCreate pages with no cross-references
Flag contradictions between sourcesSilently overwrite existing content

Every operation must: (1) record to log.md, (2) update index.md, (3) check for contradictions, (4) maintain cross-references.

Execution checklist

Before an operation: Does the wiki exist? → Does CLAUDE.md exist? → Is the raw source in the correct subdirectory (Feishu → raw/lark/)? → Set Verified: no for easily-stale content.

After an operation: Is log.md updated? → Does index.md reflect the change? → Are cross-references added (cap 5, use "See also" beyond that)? → Is topics.txt updated when there's a new topic?

Scope boundaries

This skill handles: wiki initialization, ingest (incl. Feishu), query, lint, cross-referencing, index maintenance.

It does not handle: single insights (→ knowledge-consolidation), methodology analysis (→ mao-methodology), code implementation (→ requirement-workflow).

Reference docs (load on demand)

  • Page templates — entity and source page templates: people / organizations / places / products / events / concepts / articles / podcasts / videos / diaries / threads / index
  • Feishu ingest workflow — pull → land in raw/lark → compile into threads/people/events/diaries
  • Workflows and reference — composite workflows, error handling, core concepts, extension roadmap

Hooks

Register global hooks via learnwy-dispatch (~/.claude/settings.json + ~/.trae/hooks.json), because the wiki lives at ~/.learnwy/llm-wiki/.

EventLib functionPurpose
SessionStartlib/session-scan.tsInject up to 30 wiki topics into the session context
UserPromptSubmitlib/prompt-scan.tsMatch the user's question ↔ topics keywords → inject relevant page hints

Install/uninstall: node scripts/cli.cjs install|uninstall --scope global --target both (provided by src/shared/install-entry.ts, shared by all hook-type skills).

From knowledge-consolidation

KC's promote subcommand copies a project-level knowledge document to raw/notes/<date>-<slug>.md, with a frontmatter back-pointer. On the next ingest, treat them as ordinary raw sources (they usually merge into a wiki/concepts/ page and form a [[link]] with the original KC document). This is a one-way inflow channel from "project-local fix log" to "global compounding knowledge base".

Discovery
Tags

No tags published for this skill.

Version
Latest version metadata

Version

v2026.09.25

Published

Sep 25, 2026

Category

Uncategorized

License

MIT

Source path

skills/lwy-llm-wiki

Default branch

main

Latest commit

d727b38

Tree SHA

8dd1452