An LLM-maintained Markdown knowledge base is a file-first memory architecture where an agent incrementally turns raw source material into a structured, interlinked wiki. Instead of treating knowledge as opaque embeddings in a vector database, the system stores durable Markdown pages that humans and agents can both read, review, diff, edit, and version-control.
The pattern is useful for personal research libraries, coding-agent workspaces, departmental knowledge bases, and long-running analysis projects where the corpus is large enough to exceed a chat context but small enough that curated structure matters more than web-scale retrieval. The agent acts less like a search engine and more like a librarian: ingest sources, write synthesis pages, create backlinks, lint for contradictions, and keep indexes current.
This does not make vector search obsolete. Dense retrieval remains the right tool for massive, frequently changing corpora and low-latency recall. The Markdown-wiki pattern is strongest when auditability, compounding synthesis, source traceability, and human ownership matter more than indexing millions of documents.
The system begins with a raw input area containing clipped articles, papers, repository writeups, datasets, images, transcripts, or manual records. These files are treated as evidence, not as the polished knowledge base. Keeping raw material separate prevents synthesized pages from becoming the only source of truth.
The agent reads raw inputs and writes organized pages: concept explainers, source summaries, entity pages, project records, indexes, and relationship maps. The output is plain Markdown so it can be inspected in any editor, rendered by static-site tooling, or committed to Git.
A maintenance pass scans for broken links, orphan pages, stale statements, missing citations, duplicate concepts, and contradictions. This is the step that turns a one-time summary dump into a living memory system.
The core move is to spend model tokens transforming knowledge into durable files, not just answering the current prompt. Future sessions start from the compiled wiki instead of rediscovering the same raw context.
A practical layout separates raw evidence, generated wiki pages, schemas, and maintenance logs. The schema file gives the agent stable rules for naming, citation, page ownership, and when to update versus create.
knowledge-base/
AGENTS.md # Rules for agent edits and quality gates
raw/
papers/
clippings/
repos/
images/
wiki/
index.md
concepts/
sources/
projects/
entities/
logs/
ingest-log.md
lint-log.md
An ingest pass reads one or more raw files, extracts durable facts, writes source summaries, updates concept pages, and adds backlinks. The agent should preserve citations to raw files or source URLs so claims can be traced and corrected later.
def ingest(source_path, wiki):
source = read_raw_source(source_path)
summary = llm_extract_source_summary(source)
concepts = llm_extract_concepts(source)
wiki.write(f"wiki/sources/{slug(source_path)}.md", summary)
for concept in concepts:
page = wiki.read_or_new(f"wiki/concepts/{concept.slug}.md")
updated = llm_merge_concept_page(page, concept, citation=source_path)
wiki.write(page.path, updated)
wiki.update_index()
wiki.append_log("logs/ingest-log.md", source_path)
At query time, the agent reads indexes, follows links, opens concept pages, and pulls raw evidence only when needed. The retrieval trace is visible: which files were opened, which links were followed, and which raw sources support the answer.
A research agent can ingest papers and web articles into source pages, maintain concept summaries, and keep a project index updated. The next session starts with the already-compiled map rather than re-reading dozens of PDFs from scratch.
For software projects, the wiki can hold architecture decisions, module maps, integration records, debugging history, and runbook fragments. Agents can update these files after major implementation steps so future sessions avoid repeated repository rediscovery.
Small teams can use the pattern to convert scattered documents into an auditable internal wiki. Human review remains important: agents can propose updates, but owners should approve pages that affect policy, customer commitments, security, or operational practice.
Commit every ingest and lint pass. Git diffs make agent edits inspectable, rollbackable, and attributable. Branches are useful when a large ingest touches many pages or when source quality is uncertain.
git checkout -b kb/ingest-openxla-pjrt
python tools/ingest.py raw/clippings/pjrt.md
python tools/lint_wiki.py --changed
git diff -- wiki/
git commit -am "Ingest PJRT source records into ML infrastructure wiki"
Mark which directories the agent may edit freely and which require approval. A common split is raw evidence as append-only, generated source summaries as agent-owned, and policy or decision pages as human-reviewed.
Lint passes should produce actionable findings rather than vague quality comments. Examples include missing citation, broken local link, duplicate heading, stale date, contradiction with source page, orphan concept, and uncited claim.