Map
โ†‘LLM Wiki Pattern

Files as Graph Database

Wiki conceptpkmgraph-databasemarkdown โ†ณ show in map Markdown
title
Files as Graph Database
type
concept
summary
Markdown files as nodes, wikilinks as edges โ€” why a plain vault satisfies graph-database semantics
tags
pkm, graph-database, markdown
created
2026-04-09
updated
2026-04-22

A plain directory of markdown files with wikilinks satisfies the structural requirements of a graph database: nodes (files), edges (links), and optional labels (folders, frontmatter tags). You don't need a graph store to query a graph โ€” you need a graph.

The mapping is literal:

  • Node = one markdown file, identified by its filename
  • Edge = a wikilink [[other-file]] inside the file's body
  • Node properties = YAML frontmatter
  • Edge type / label = context around the link, or dedicated frontmatter fields like parent: or sources:
  • Index / taxonomy = folder structure

What you give up compared to a real graph database: no indexed edge traversal, no query language, no ACID guarantees, no multi-hop joins in constant time. What you gain: every tool on your machine already reads it. Grep is a query engine. Git is version control. Obsidian is a visualizer. An LLM with file access is a natural-language query interface.

The approach scales further than expected. filesystem-is-graph-database reports ~52k files maintained this way. The reason it holds up is that most PKM queries aren't graph queries in the Cypher sense โ€” they're "find everything related to X and show me the content." Ripgrep handles that in milliseconds. Actual multi-hop traversal is rare; when it matters, an LLM doing a bounded search through linked files is usually good enough.

The key design choice is making the graph legible to tools that don't know it's a graph. Filenames must be unique so wikilinks resolve unambiguously. Folders should be shallow enough that link-following, not directory-walking, is the primary navigation pattern. Frontmatter should be consistent so it can be parsed without per-file special cases.

This is the underlying bet behind the llm-wiki-pattern and behind this Second Brain itself. It also connects to obsidian at the convention level โ€” Obsidian happens to treat files exactly this way, which is why vaults port cleanly between Obsidian and pure-CLI workflows. The same shape carries through to publication: a digital-garden published with quartz preserves nodes, edges, and frontmatter without any translation step.