How I turned three philosophy books into a 1,200-document knowledge graph
Marcus Aurelius says virtue is acting according to nature and reason, serving the common good as naturally as the eye sees. Machiavelli says a prince who acts entirely virtuously will be ruined among so much evil. Nietzsche warns against becoming enslaved to one's own virtues, noting that every virtue inclines toward stupidity.
Same word. Three completely different meanings across seventeen centuries. I wanted to see how many concepts work like this — where the surface agreement hides a deep disagreement — so I built a knowledge graph connecting Meditations (170 AD), The Prince (1513), and Beyond Good and Evil (1886).
The result: Seventeen Centuries — 838 text fragments, 340+ concept files, and category documents that let you trace how ideas evolved across time. The first article built from the graph is Virtue across seventeen centuries, which follows the concept from Stoic duty through political pragmatism to Nietzsche's genealogical critique.
Why a graph, not a database
I needed a structure where the same concept could belong to multiple contexts simultaneously. Virtue belongs under the Stoic worldview and under Machiavelli's political theory and under Nietzsche's critique of morality. Folders force single placement. A database would work but then I lose the thing I actually use — being able to open a file, read it, edit it, link from it.
IWE uses inclusion links — a markdown link on its own line defines a parent-child relationship. A document can have multiple parents. The entire graph is plain markdown files in a flat directory. No database, no special format. I edit them in my text editor, query them from the CLI, and an AI agent can read the same files.
The five-stage pipeline
Stage 1 — Fragment extraction. Parsers for Standard Ebooks XHTML split each book into atomic markdown files — one per aphorism, passage, or chapter. Nietzsche yielded 296 fragments, Marcus Aurelius 515, Machiavelli 27.
# 146
He who fights with monsters should be careful lest he thereby
become a monster. And if thou gaze long into an abyss, the abyss
will also gaze into thee.
Stage 2 — Entity extraction. An LLM read each fragment and identified 3–7 significant entities: philosophical concepts, historical figures, themes. Each entity got its own file. Fragment text was updated with inline links so the graph forms through the content itself:
...life itself is [Will to Power](will-to-power.md);
[self-preservation](self-preservation.md) is only one...
Stage 3 — Flattening and merging. Each book started in its own directory with its own virtue.md, soul.md, plato.md. This stage moved everything into a single flat directory and merged overlapping concepts. Ten concepts appeared in multiple books — virtue, soul, Plato, Socrates, truth, nature, gods, Epicurus, cruelty, free will. These became the most valuable documents in the graph because they're where the real contrasts live.
Stage 4 — Categories. With 340+ concept files floating in a flat directory, I needed entry points. Categories like philosophers, virtues, power-dynamics, and moral-systems emerged from the content. Each is a document with inclusion links to its members — and because IWE supports multiple parents, Socrates belongs to both philosophers and ancient-cultures without duplication.
Stage 5 — Summaries. An LLM analyzed the referenced fragments for each merged concept and wrote comparative summaries. This turned simple backlink indexes into the comparative analysis that makes the graph worth reading — and worth writing articles from.
Why this structure pays off
The graph is queryable from the CLI:
iwe retrieve -k virtue --depth 2 # virtue + linked fragments
iwe find --refs-to will-to-power # everything referencing will-to-power
iwe tree -k bge # Beyond Good and Evil as a tree
retrieve --depth 2 pulls a concept, its backlinks to fragments, and the fragment content in one call. That's how the virtue article was written — retrieve the concept, read the fragments side by side, write the analysis. An AI agent uses the same commands and the same files.
The most surprising result was how much structure emerged from just inclusion links. No tags, no folders, no metadata beyond the links themselves. The graph has clear clusters around each book, bridges through shared concepts, and category entry points — all from markdown files linking to each other.
Browse the graph: https://iwe.pub/seventeen-centuries/ GitHub: https://github.com/iwe-org/seventeen-centuries IWE: https://github.com/iwe-org/iwe