LLM-Maintained Markdown Knowledge Bases: Architecture, Workflow, and Risks

    This article explains an approach for individual researchers who accumulate hundreds to thousands of source files and want an LLM to compile them into a traceable Markdown knowledge base. It compares retrieval-augmented generation and pure note management, then describes the core architecture: plain-text Markdown storage, three-layer separation between raw sources, compiled wiki entries, and reports; lightweight indexes; and an ingestion workflow that normalizes sources into Markdown. It also covers key tradeoffs and risks, including model rewrite errors and cumulative errors.

    Background: Easy to Collect, Hard to Retrieve

    Researchers read papers every day, inspect code repositories, and save technical articles. Materials accumulate, and the real difficulty is not collection but retrieval. Thousands of independent notes may sit in the same directory. Each file is complete on its own, but there are almost no relationships between files. To understand everything known about a topic, a researcher has to rely on keyword search, get a pile of scattered fragments, and then read, compare, and synthesize them manually. This consumes a large amount of attention and must be repeated every time.

    The problem comes down to two points. First, knowledge has no structure, and search results are disconnected from one another. Second, knowledge does not update automatically. Old conclusions drift away from new material, and no one is responsible for detecting conflicts.

    Two Common Approaches and Their Tradeoffs

    Retrieval-Augmented Generation (RAG)

    A conventional RAG pipeline splits documents, converts each chunk into a vector with an embedding model, and writes the vectors into a vector index. At query time, it computes similarity between the question vector and chunk vectors, retrieves the closest chunks, and passes them together with the question to a language model to generate an answer.

    This approach is mature in enterprise scenarios with large corpora, multiple users, and permission isolation. In a personal setting, it has three clear costs: it requires maintaining an index, update jobs, and storage; chunk boundaries can split context, so a complete argument may be divided in half; and answers depend on implicit similarity computation, making it hard for users to determine which file a conclusion came from.

    Pure Note Management

    Pure note management is simple, controllable, and works offline. The downside is that knowledge does not connect proactively. Links are maintained entirely by hand, and once the user becomes negligent, the knowledge base degrades into a pile of files.

    Comparison of the Three Approaches

    Dimension RAG Pure notes Markdown knowledge base (this approach)
    Applicable scale Large scale, multiple users Dozens to hundreds of notes Hundreds to thousands, single user or small team
    Maintenance cost Index, update jobs, storage Manual organization and linking LLM call costs plus limited manual review
    Traceability Weak, relies on similarity Strong, but links depend on people Strong, each conclusion carries its original source
    Chunking loss Yes No Compiles whole original files, with less fragmentation
    Offline capability Requires index and model service Fully offline Depends on the model; a local model is optional
    Main failure mode Missed recall, unclear sources Broken links, knowledge accumulation Model rewrite errors, gradual error accumulation

    All three approaches have appropriate use cases. When material is small and only needs to be browsed by the user, pure notes are enough. When material is large and must serve many users, RAG is more suitable. For individual researchers with a medium amount of material who care about traceability and version management, this approach is more likely to be useful.

    Core Idea: Let the Model Read and Write Markdown

    The key idea can be summarized as follows: do not rely on a vector index; instead, let a language model read plain-text files directly and maintain those files itself.

    Not relying on a vector database does not mean there is no index. This approach uses three lightweight indexes: a catalog index (wiki/index.md, which lists all entries and summaries), an inverted index (a keyword-to-entry mapping), and a link graph (backlinks.json, which records which pages reference each entry). When a reader queries the knowledge base, the system checks the index first and then reads a small number of related files. It does not need to scan all material every time.

    Key Decision 1: Store Everything as Plain-Text Markdown

    • The format is simple, and language models understand it reliably.
    • Each file is a readable, independent unit that is easy to review manually.
    • Files can be tracked directly in Git, so every change has a diff record.
    • The knowledge base is decoupled from any specific editor. Switching tools or migrating data requires no format conversion.

    Key Decision 2: Three-Layer Separation with Clear Responsibilities

    • Raw layer (raw/): unprocessed material, append-only, never modified.
    • Compiled layer (wiki/): model-generated entries, indexes, and links. These are derived artifacts and can be regenerated.
    • Report layer (reports/): issues found by health checks and records of repairs.

    Raw material is the sole source of truth. All derived content must be traceable back to it. When errors occur, the compiled layer can be rolled back while the raw layer remains untouched.

    Directory Structure

    1. kb/
    2. ├── raw/ Raw layer, append-only, set to read-only
    3. │ └── 3f9a1c2b7d-20261124T080000Z.md
    4. ├── assets/ Local images and other resources
    5. ├── wiki/ Compiled layer, derived artifacts
    6. │ ├── index.md Catalog index
    7. │ ├── backlinks.json Backlink table
    8. │ └── concepts/ Entry files
    9. ├── wiki_backup/ Pre-compilation backups, named by timestamp
    10. ├── reports/ Health-check reports and ingestion error logs
    11. ├── sources.json Source registry (URL, version, hash)
    12. └── .git/ Version control

    Raw files use frontmatter to record metadata:

    1. ---
    2. source: https://example.com/article # Canonical source URL
    3. saved_at: 2026-11-24T08:00:00Z # Ingestion time (UTC)
    4. content_hash: 9c1e... # SHA-256 of the body, used for deduplication
    5. license: personal research use # Copyright or usage restriction
    6. ---

    To migrate the knowledge base, copy the entire directory. sources.json can be exported as CSV for use by other tools.

    Stage 1: Ingestion, Normalized to Markdown

    Compilation requires consistent input formats. Web pages, paper excerpts, and documentation in code repositories must first be converted to Markdown. In practice, pay attention to the following points:

    • Download images to assets/ to avoid broken external links.
    • Keep the canonical URL and ingestion time as source metadata.
    • Remove tracking parameters and login tokens. Do not collect pages that require login to view.
    • For formats such as PDF, perform text extraction first and then manually check formulas and tables, because extraction tools often scramble both types of content.
    • Retry network failures. After repeated failures, write the error to reports/ingest_errors.log rather than silently skipping it.

    The core helpers of the ingestion script are shown below. Web-to-Markdown conversion can be handled by any mature conversion tool. The save routine uses these helpers and a registry to skip unchanged content while retaining older versions.

    1. import datetime
    2. import hashlib
    3. import json
    4. import pathlib
    5. from urllib.parse import urlsplit, urlunsplit
    6. RAW_DIR = pathlib.Path("raw")
    7. REGISTRY = pathlib.Path("sources.json")
    8. def normalize_url(url: str) -> str:
    9. """Normalize protocol and host casing, and drop the fragment identifier."""
    10. parts = urlsplit(url.strip())
    11. return urlunsplit((parts.scheme.lower(), parts.netloc.lower(), parts.path, parts.query, ""))
    12. def content_hash(text: str) -> str:
    13. return hashlib.sha256(text.encode("utf-8")).hexdigest()