← All posts

LLM Wiki and Agent Knowledge Management: Preserving Context, Meaning in Use, and the Recall vs. Maintenance Boundary

I first learned about the LLM Wiki pattern systematically during a technical talk on how to make a review agent's knowledge base improve through actual use.

Before that, in my own multi-agent project CrewDesk, I had built what almost everyone reaches for first: vector-indexed "knowledge packs" plus a local SQLite vector memory store. In practice, it felt off. Nobody maintained the knowledge packs (only 2 built-in entries ever sat in the database), while every real architectural decision and postmortem I cared about ended up as plain Markdown committed to Git.

The first half of that talk covered how to add a knowledge feedback loop to a review agent. The second half pushed much deeper into knowledge management itself: the real question is not "Markdown vs. vector DB," but how much applicability context survives after compilation, how real usage feeds corrections back into the wiki, and where the boundary sits between maintaining compiled knowledge and optimizing retrieval of primary sources.

This post follows the spine of that discussion, paired with concrete code and tradeoffs from implementing a Git-backed Wiki and hybrid recall layer myself.

LLM Wiki & Agent Knowledge Management: immutable primary sources, context-preserving atomic wiki, meaning-in-use correction loop, and the recall vs. maintenance boundary

1. Breaking a False Binary: Wiki and RAG Do Not Compete on the Same Layer

Debates around agent knowledge often pit LLM Wiki against RAG as if choosing one kills the other. In reality, a wiki is simply another way for a model to consult external knowledge. The real fault line is when the system pays the reasoning cost to synthesize raw material:

DimensionPure RAGAgent MemoryLLM Wiki
Question answeredWhat does the source document say?What has this user told me?What do we currently know about this topic?
When reasoning happensQuery time (re-synthesized each call)Split (extract on write, fetch on read)Ingest and maintenance time (compiled once, reused)
StatefulnessStateless by defaultPersistent per userCompounding domain knowledge
Primary blind spotChunking strips context; old chunks beat new fixesKnows the user, blind to domain rulesBad writes amplify; depends on ongoing maintenance

(Compare Andrej Karpathy's LLM Wiki gist and Vishal Mysore's three-way comparison.)

The first half of the talk laid out a pragmatic baseline that adds a feedback loop without rewriting an existing review agent from scratch:

  1. Keep primary sources read-only as ground truth. The knowledge base stores citations and links back to originals and never mutates them.
  2. Maintain a readable, editable, versioned Markdown wiki on top. Compile atomic knowledge, summaries, and cross-links so the agent does not re-derive everything from scratch on every prompt.
  3. Close the loop with logs, Q&A capture, and correction write-backs. Confirmed insights from real reviews get filed back; errors trigger edits to the knowledge page.
  4. Run hygiene sweeps for staleness, contradictions, and missing links. Let AI draft repairs, then have humans inspect them.

Immediately after that baseline came the sharpest pushback in the room: does finely extracting knowledge and building structured pages actually beat retrieving the right primary documents and letting the model read them fresh? Answering that led straight into the deeper principles below.

2. What Compilation Usually Loses: Applicability Context and Real "Atomicity"

A better question than "should we build a wiki?" is: after we process raw sources into structured knowledge, how much usable context is still left?

Many extraction pipelines break documents down into bare entity – attribute – relation triples or fixed 512-token chunks. That routinely strips away applicability context. The same concept can mean different things — and trigger different rules — across business regions, compliance regimes, or runtime modes. Knowing a textbook definition does not tell a review agent which interpretation governs the task in front of it.

That points to a concrete rule for what makes an "atomic" unit of knowledge truly atomic: it is not an entity name, and it is not necessarily short. It is the smallest self-contained statement that preserves its full applicability conditions.

The litmus test is simple — remove any qualifying clause and check whether the meaning changes:

  • Take a structural compliance statement such as "Commercial data is partially exempt under US data-sovereignty scenarios":
    • Drop "US" and the geographic scope breaks.
    • Drop "data-sovereignty scenarios" and the triggering condition vanishes.
    • Drop "partially" and the degree of the conclusion becomes false.
  • The exact same thing happened in my own codebase. In CrewDesk, standalone CLI mode safely auto-backfills .oma/memory/learned.md into a local SQLite store, whereas multi-agent server mode must forbid auto-backfilling workspace files — otherwise untrusted repo text or sub-agent notes become persistent prompt injections into front-desk routing. Writing "never backfill learned.md" without its runtime scope makes the rule false for CLI development.

In Markdown on disk, I encode scope, provenance (sources), and explicit replacement chains (supersedes) directly into each page:

---
title: Long-Term Memory Write Boundary
maintainedBy: pa
status: confirmed
updated: 2026-11-23T08:12:00.000Z
sources:
  - conversation:conv_01J...:140-168
  - file:raw/files/security-review.md
supersedes:
  - decisions/auto-backfill-learned-md.md
---

Scope: Multi-agent server dispatch path only (standalone CLI keeps local backfill).

The server never auto-syncs workspace `.oma/memory/learned.md`.
Product-level memories may only be written via `remember` during runs where
`authorization === "user"`, appended to `personal/<agentId>/memories.md`.
See [[PA Permission Model]].

Under raw/conversations/, I store only ledger sequence pointers (conversation: <id>, range: 140-168) rather than duplicating chat transcripts that would drift. When a decision changes, the old page flips to status: superseded and the new page lists it in supersedes — keeping context, evidence, and evolution in one diffable file.

3. Meaning in Use: Why Traditional Wikis Rot and Why Humans Stay in the Loop

Why do company wikis almost always rot within six months?

It is tempting to blame writing friction and assume LLMs will fix it. The talk identified a deeper cause: authors and users are disconnected. People who already understand a system write the docs and rarely read them again; people who actually rely on those docs during live work discover stale assumptions, yet have no low-friction way to push corrections back. Even if LLMs drive writing cost near zero, that disconnect does not fix itself.

Whether knowledge is accurate, complete, and applicable can only be verified in real tasks — meaning in use. Automated lint passes alone cannot tell you that.

I saw this clearly when implementing wiki_lint. On every write, the backend runs findingsFor() inline and hands structural findings right back to the writer while context is still hot:

function findingsFor(page: WikiPage, pages: readonly WikiPage[]): WikiLintFinding[] {
  const out: WikiLintFinding[] = [];
  if (page.frontmatter.sources.length === 0) {
    out.push({ code: "unsourced", path: page.path, detail: "no sources" });
  }
  const linked = pages.some(
    (other) => other.path !== page.path && findLinkAt(other.body, [page.path, page.frontmatter.title]) >= 0,
  );
  if (!linked) {
    out.push({ code: "orphan", path: page.path, detail: "no inbound links" });
  }
  return out;
}

That catches missing citations, orphan pages, and dangling supersedes links immediately — but it checks structure, not semantic fitness. A perfectly cited, well-linked page can still mislead a live review if the underlying boundary condition shifted.

Full self-correction loops do not solve this yet either. The speaker shared an experiment where an agent repeatedly studied a goal, self-graded its wiki, and rewrote pages — only to discover the model could not reliably judge when the knowledge was "good enough," forcing a hard iteration cap.

In the short term, humans stay necessary for judging domain fitness: when a user spots an inapplicable conclusion during a task, they need more than a thumbs-up/down button — they need a direct path to inspect sources, diagnose the gap, and patch the page. That works in small teams, though it places real expectations on users.

Once humans and agents co-maintain the same Markdown repository, one engineering guardrail becomes non-negotiable: background agent updates must never silently overwrite a human edit. Every write in my wiki service runs through an in-process per-page queue and a 16-char sha256 optimistic lock (CAS):

return withPageLock(input.path, async () => {
  const current = readPage(input.path);
  if (input.expectedRevision !== (current?.revision ?? null)) {
    // Reject stale writes and return the latest page so the writer re-reads and merges
    return { ok: false, reason: "conflict", current };
  }
  // Union-merge sources and supersedes so prior provenance is never dropped
  store.write(input.path, serializePage({ path: input.path, frontmatter, body }), {
    author: input.agentId,
    summary: `wiki: update ${input.path}`,
  });
  return { ok: true, page: readPage(input.path) };
});

Every change lands as a plain Git commit that anyone can diff, edit, or revert.

CrewDesk Git Wiki UI showing topic pages, backlinks, and structure checks

In day-to-day operation, knowledge acquisition runs into a built-in tension:

  • Without a concrete goal, extraction turns vague and misses applicability conditions.
  • Focused only on today's goal, it filters out adjacent context from the source that future tasks will need.

The practical middle ground from the discussion is to accept incomplete capture on pass one, and refine through repeated use. The same topic can be studied multiple times from different angles — business review, engineering implementation, operations — gradually merging those perspectives. Adjacent facts noticed in the source material do not need to be discarded immediately (keeping grounded facts already present in the source, not asking the model to invent new ones).

That also challenges the habit of organizing everything into a fixed folder tree.

My current wiki still splits pages into projects/, decisions/, concepts/, and lessons/, with a single auto-generated index.md at the root. That works fine from 10 to a few hundred pages, but rigid folders lock in a single taxonomy up front when one context-bound fact often serves several unrelated tasks.

A healthier long-term structure leans on three habits:

  1. Connect knowledge via bidirectional links instead of forcing one canonical directory slot.
  2. Maintain multiple task-specific indexes that evolve from usage feedback, rather than fracturing a page's context to please a single search pipeline.
  3. Allow merging, splitting, and refactoring existing pages as new sources arrive — not append-only accumulation.

On the retrieval side, keeping things thin helps avoid noise:

  • Gate turn-start recall with deterministic code cues (recall/cues.ts: CN/EN back-reference cues with strict \b word boundaries so "commit" and "edit" do not falsely match "it", plus issue IDs, file paths, and error codes), and return { hits, searched, skipped } so the model distinguishes "not searched," "unavailable," and "searched with no match."
  • When a wiki grows past ~1,000 pages and a flat index stops scanning cleanly, layer hybrid search (normalized cosine + keyword, bypassing SQLite FTS5's unicode61 CJK blind spot, fused via RRF K = 60 with clean fallback to keyword-only when embeddings are absent) on top of the same Wiki as a rebuildable index instead of creating a second knowledge system.

5. The Unresolved Boundary: Recall Primary Sources vs. Maintain Compiled Knowledge

What made the talk genuinely useful was that it did not pretend to have settled the core architectural divide. At the end, two honest camps remained:

StanceCore ClaimOpen Questions to Prove
Recall-firstMaintainers should not pre-define knowledge; focus on retrieving the most relevant, authoritative primary sources for the model to read fresh, measured by task resolution.How do you handle repeated multi-document synthesis cost, consistency, and retaining hard-won corrections?
Maintenance-firstCompile context-bound understanding and have users inspect, correct, and evolve the wiki in use.Who has authority to revise conclusions? How do you keep primary sources authoritative? How much real gain does it beat raw-source retrieval by?

Neither side wins universally today. Matching the tool to data shape and team habits is more honest:

  • 100,000+ tickets, raw logs, and fast-churning PDF/legal corpora: stay recall-first with hybrid RAG (BM25 + vector + rerank).
  • 10 to 1,000 evolving decisions, review lessons, and repo conventions: an LLM Wiki is worth building — provided the team accepts lightweight correction-in-use and guards originals and human edits with raw/ pointers, sources / supersedes, and CAS locks.
  • Beyond ~1,000 wiki pages: stack hybrid search on top of the Markdown repo as a disposable index rather than splitting truth across two systems.

Looking back, the lasting idea from that talk is simpler than any specific framework: acquire knowledge with a concrete goal, preserve its full applicability conditions, accept that early passes are incomplete, and refine it through real task feedback. It is still an evolving practice rather than a settled blueprint — but it matches how real engineering knowledge actually grows far better than shredding everything into opaque vector chunks.


References & Source Code:

Want to try it on your own machine?

Both CrewDesk and oma are MIT open source — run locally on Bun + SQLite in two commands.