LLM Wiki
Agent-maintained personal knowledge base: ingest → query → lint → graph.
Ontology is opt-in. If wiki/ontology.yaml does not exist, all commands work exactly as described below. Ontology features are additive — see references/ontology-commands.md.
Project Layout
raw/ # Drop zone for unprocessed docs (originals stay after ingest)
wiki/
index.md # Catalog of all pages — update on every ingest
log.md # Append-only chronological record
overview.md # Living synthesis
history.json # Registry of all ingested sources
ontology.yaml # (OPTIONAL) project ontology schema
synthesis-map.md # Lightweight index of all saved query syntheses (append-only)
originals/ # Read-only archive of source docs
sources/ # One summary page per source (kebab-case.md)
entities/ # People, companies, projects, products (TitleCase.md)
concepts/ # Ideas, frameworks, methods, theories (TitleCase.md)
syntheses/ # Saved query answers (kebab-case.md)
graph/ # graph.json + graph.htmlPage templates and frontmatter schema → see references/templates.md. Wikilinks are case-sensitive: [[PageName]].
/wiki-ingest
Arguments (all optional):
- *(none)* → batch-ingest all files in
raw/ <file>→ single file (e.g.raw/my-article.md)--from <folder>→ use custom source folder instead ofraw/--to <folder>→ copy originals to PARA-structured subfolder (notwiki/originals/)--no-copy→ skip copying originals; incompatible with--to--force-new→ always create new entry (date-suffix slug if duplicate); mutually exclusive with--force-update--force-update→ always overwrite existing entry; mutually exclusive with--force-new--no-interview→ skip ontology Context Interview--batch-defaults→ reuse first file's interview answers as defaults for the rest--summary-only→ extract summary + metadata only; skip full-text conversion
For batch mode, --to PARA rules, file pre-processing (pdf/docx/pptx/xlsx), summary-only strategy, Context Interview → read references/ingest-advanced.md
Ingest Strategy (quick reference)
| Condition | Strategy |
|---|---|
--summary-only flag | summary-only |
.xlsx / .xls | summary-only |
.pptx / .ppt | summary-only |
.pdf > 30 pages | summary-only |
| Everything else | full |
Duplicate Detection
Check wiki/history.json for the candidate slug before ingesting:
--force-new: append today's date (e.g.my-article-20260421); proceed--force-update: overwrite existing entry; proceed- Active slug, no flag: pause and ask — Update / New entry (
<slug-YYYYMMDD>) / Cancel - Deleted slug: treat as fresh ingest (reuse slug, set
status: "active")
Agent-Based Ingest (full strategy)
- Read the source file in full
- Read
wiki/index.mdandwiki/overview.md. Ifwiki/ontology.yamlexists, run Context Interview (seereferences/ingest-advanced.md) unless--no-interview - Derive title and slug: a. Timestamp filename / empty title — if the filename matches
YYYY-MM-DDTHH_MM_SS…or bareYYYY-MM-DD, or the source'stitlefield is empty/whitespace:
- Read the first meaningful content lines (skip blank lines, lone URLs, timestamps) - Generate a concise descriptive title in the source's language (3–7 words) - Slug = kebab-case(title) + -YYYYMMDD date suffix (from file metadata or today) to guarantee uniqueness - If content is < 10 meaningful words or context is unclassifiable, use title 임시메모-YYYYMMDD and assign category 임시메모 b. Named filename — slug = kebab-case(filename, no extension); title = source's title field or first heading
- Select template → see
references/templates.md - Write
wiki/sources/<slug>.mdwithsource_file: wiki/originals/<slug>.md - Copy original to
wiki/originals/<slug>.md(skip if--no-copy; apply PARA rules if--to) - Update
wiki/index.md:
- Place the entry under the matching category ## section (create section if absent); maintain sections in this order: ## 기술/개발 · ## 업무/프로젝트 · ## 개인/생활 · ## 여행 · ## 임시메모 - Format: - [Title](sources/slug.md) — one-line summary (summary is mandatory — never omit or leave blank) - Classify by dominant content signal: - 기술/개발: code, tools, APIs, programming, software, hardware, dev workflows - 업무/프로젝트: work meetings, job-related memos, company projects, career - 개인/생활: accounts, IDs, passwords, addresses, family, finance, household - 여행: travel plans, trekking, transportation, accommodation, places - 임시메모: < 10 meaningful words, single snippet, or ambiguous context
- Update
wiki/overview.md— revise living synthesis if warranted - Create/update entity pages in
wiki/entities/EntityName.md— whenwiki/ontology.yamlexists, deriveclass:+properties:frontmatter from the matching class definition in the ontology; do not invent fields not declared there - Create/update concept pages in
wiki/concepts/ConceptName.md— same ontology-derived frontmatter applies - Flag any contradictions with existing wiki content
- Update
wiki/history.json— always use Write tool (read existing → merge entry → overwrite). Schema → seereferences/ingest-advanced.md - Append to
wiki/log.md:## [YYYY-MM-DD] ingest | <Title> - Post-ingest: check broken
[[wikilinks]], verify all new pages in index, print change summary. Ifwiki/ontology.yamlexists: print any schema warnings from this ingest as a⚠ Schema warningsblock (unknown class, missing required properties, unknown predicates) — these do not block ingest but should be resolved
/wiki-query
$ARGUMENTS = the question to answer
For structural filters (class:, type:, AND/OR/NOT, dotted field paths like context.phase) → read references/query-advanced.md
- Synthesis-map lookup — if
wiki/synthesis-map.mdexists, read it in full; scan all entries and select the top 2–3 most semantically relevant past syntheses; read thosewiki/syntheses/<slug>.mdfiles in full - Read
wiki/index.mdto identify the most relevant pages - Read up to ~10 most relevant pages
- If summaries lack sufficient detail, read the original from the page's
source_filefield - Present the answer with
[[PageName]]wikilink citations; reference matched past syntheses with[[syntheses/slug]]links if they informed the answer - Include
## Sourceslisting every page and synthesis drawn from - End with:
💾 이 답변을 저장하려면: \/wiki-synthesize``
Empty wiki: *"The wiki is empty. Run /wiki-ingest <file> to add your first source."*
/wiki-synthesize
$ARGUMENTS (optional) = custom slug override (e.g. /wiki-synthesize my-custom-slug)
Saves the most recent /wiki-query answer from this session as a reusable synthesis.
- Retrieve the query question and composed answer from the current session context
- Generate a kebab-case slug from the query question (or use the provided override)
- Extract entities, concepts, and relations from the answer
- Write
wiki/syntheses/<slug>.md(template:references/templates.md) - Append to
wiki/synthesis-map.md(append-only — never edit past entries):## YYYY-MM-DD | <slug> Query: <one-line question> Entities: Entity1, Entity2,... Concepts: Concept1, Concept2,... Relations: Subject→predicate→Object,... Preview: <one-sentence answer summary> - Append to
wiki/log.md:## [YYYY-MM-DD] query | <question summary> - Output:
✅ Saved synthesis: [[syntheses/<slug>]]— use/wiki-delete <slug>to remove if not needed
No recent query in session: *"No query found in this session. Run /wiki-query <question> first."*
/wiki-lint
python tools/lint.py
python tools/lint.py --save # save to wiki/lint-report.mdAgent-based checks:
- Orphan pages — pages with no inbound
[[PageName]]links - Broken links —
[[WikiLinks]]pointing to non-existent pages - Missing entity pages — names mentioned in 3+ pages but no
wiki/entities/page - Contradictions — read
## Contradictionssections; cross-check flagged claims - Stale summaries — source pages where
last_updated< related concept/entity pages - Data gaps — questions the wiki can't answer; suggest source type to fill
Ontology checks (7–12), when wiki/ontology.yaml exists → read references/ontology-commands.md
After report, ask: "Save to wiki/lint-report.md?" Append to wiki/log.md: ## [YYYY-MM-DD] lint | Wiki health check
/wiki-graph
python tools/build_graph.py --open
python tools/build_graph.py --report --saveAgent-based fallback:
- Glob every
.mdinwiki/. Build one node per page:{"id": "wiki/...", "label": "Title", "type": "source|entity|concept|synthesis", "color": "<hex>"}Colors:source#4CAF50 ·entity#2196F3 ·concept#FF9800 ·synthesis#9C27B0 - Grep
[[wikilinks]]; resolve each to a node id and create an edge - Write
graph/graph.json; inline its contents intograph/graph.html(template:references/graph-html.md)
Ontology-aware coloring, typed edges, and phase lanes → read references/ontology-commands.md
Append to wiki/log.md: ## [YYYY-MM-DD] graph | Knowledge graph rebuilt
/wiki-sources
- Read
wiki/history.json(if missing → *"No sources ingested yet. Run/wiki-ingest <file>."*) - Print table sorted by
last_updateddesc: Slug Title Ingested Last Updated Status - For each active source, list
pages_created,entities_created,concepts_created
/wiki-update <slug>
- Read
wiki/history.json; error if slug absent orstatus: "deleted" - Find original at
source_file; error if missing - Re-run Agent-Based Ingest steps 1–14 (update mode: do not re-archive original; overwrite source page; merge entity/concept pages)
- Update
wiki/history.json: setlast_updated, refresh entity/concept lists - Append to
wiki/log.md:## [YYYY-MM-DD] wiki-update | <slug> - Output:
✅ Updated source: <slug>. Run /wiki-graph to regenerate the knowledge graph.
/wiki-delete <slug>
- Read
wiki/history.json; error if absent or already"deleted" - Show what will be deleted and ask for confirmation:
- wiki/sources/<slug>.md, source_file archive, orphaned entity/concept pages
- After confirmation: delete source page, archive, and entity/concept pages not referenced by any other source. Update
wiki/index.mdandwiki/overview.md. - Set
"status": "deleted"inwiki/history.json(preserve entry for audit trail) - Append to
wiki/log.md:## [YYYY-MM-DD] wiki-delete | <slug> - Output:
✅ Deleted source: <slug>. Run /wiki-lint to check for remaining broken links.
/wiki-ontology-* commands
Full flow for /wiki-ontology-init, /wiki-ontology-show, /wiki-ontology-validate → read references/ontology-commands.md
Key Gotchas
wiki/originals/is read-only — never modify archived fileswiki/index.mdmust be updated every ingest — stale index breaks/wiki-querywiki/log.mdis append-only — never edit past entrieswiki/history.json: always use Write tool — read existing first, merge, then overwritewiki/synthesis-map.mdis append-only — never edit past entries; keep each entry under ~200 chars per line/wiki-deletenever removes shared pages — cross-check references before deleting entity/concept pages- Source slugs in
sources:frontmatter must exactly match the source filename without extension - All scripts run from the wiki project root (
python tools/..., not from the scripts directory)