How the Lore Engine Works

a world-building brain that never lies, never forgets, and always names its sources
EXPLAIN IT LIKE I'M 5

1The big idea, in one breath

It's a super-smart librarian for a made-up fantasy world β€” one who read every book, remembers exactly when each thing happened, and will only answer a question by pointing at the page it came from.

You're writing a D&D-style world. You've got hundreds of notes β€” who's whose kid, when a kingdom fell, who was king in year 340. An AI wants to answer questions about your world ("Did House Vyr rule the Crimson Throne in the Second Age?"). The problem: AI is a confident liar. It'll happily make up a king who never existed.

The Lore Engine sits between your notes and the AI. The AI asks the engine; the engine looks up the real answer with a real time-stamp and a real citation; the AI is not allowed to answer from its own imagination.

2Why not just... ask the AI directly?

Plain AI 🫠

"Did Aldric found House Vyr?"

"Yes, Aldric founded House Vyr in 200 TA."

…he didn't. The AI guessed. You'll never know it guessed.

Lore Engine βœ…

"Did Aldric found House Vyr?"

"No β€” House Vyr was founded by Theron in 200 TA (chronicles-vyr.md). Aldric was his son, born 280 TA."

Cited. Time-checked. True.

Every claim the engine returns is tagged with the document it came from. So the AI can say "according to the chronicles of House Vyr..." β€” or know to distrust a single shaky source.

3The cast of characters

πŸ“š

Your Codex the notes

Markdown files + YAML β€” character bios, timelines, family trees, maps. The raw truth of your world, written by you.

πŸ—„οΈ

Cognee the filing cabinet

The open-source engine underneath. It reads your notes, chops them up, and files them away. We don't build storage β€” we borrow Cognee's.

πŸ•ΈοΈ

Neo4j the web of facts

A database that stores facts as a web (a "graph"). "Aldric —son of→ Theron —ruled→ House Vyr." Following the threads is what makes reasoning possible.

🧠

Minimax-M3 the brain

The AI model that reads your prose and pulls facts out of it ("Aldric was born in 280 TA" β†’ a structured fact). Also the brain that answers when you ask a question.

πŸ”§

The 45 Tools the questions

The Lore Engine's own toolbox the AI can pick from: was_true_at, who_is, list_lineage... each does one little job, like a single drawer in a workbench.

πŸ›‘οΈ

The Consistency Engine the fact-checker

A night-watchman that scans for impossible things: a guy at a battle 200 years before he was born, a kingdom in two places at once. It flags β€” it never deletes.

4How a question gets answered

You ask a question. Here's the trip it takes:

You "Who is Aldric?" AI picks a tool β†’ who_is(Aldric) Lore Engine looks up the web of facts Neo4j graph the actual data Answer + sources facts, time-stamps, citations AI rewrites nicely in character voice You smile it's actually true The AI never answers from memory. It must call a tool and cite a source first.
One round-trip: question β†’ tool β†’ graph β†’ cited answer.

5Why time is the whole game

People change. Kingdoms fall. "Who rules Valdorn?" has a different answer in year 100 vs year 500. A normal database would give you one answer and quietly be wrong for every other year.

Every fact in the Lore Engine has a time window β€” a "valid from" and "valid until." Asking "was this true at time T?" is the engine's signature move.

year 0 year 340 year 600 House Vyr rules (200 β†’ 380) "year 300?" β†’ TRUE βœ… "year 500?" β†’ FALSE ❌
Same fact, different year, different answer β€” because the fact carries its own time window.

ELI5: every fact is like a job with a start date and an end date. "Who's the boss?" only makes sense if you also say when.

6When the books disagree

Two sources, same fact, different stories. Book A says Aldric's father is Theron. Book B says it's Maric. What now?

The engine does not pick a winner. It keeps both, marks them as disputed, and tells the AI: "sources disagree on this β€” here are both, you decide how to present it."

Book A father = Theron Book B father = Maric ⚠️ Disputed edge both kept, both flagged
Disagreement is preserved, not silently overwritten.

And every fact has a confidence score β€” two numbers, actually. One for "did we extract this right?" and one for "how much do we trust the book it came from?" A rumor scores low; an official chronicle scores high. The engine uses the lower of the two, so one weak link drags the whole fact down. Honest by default.

7How your lore gets in

Two doors into the engine:

DoorWhat goes inWho does the work
πŸ“‹ Structured YAMLTimelines, family trees, maps β€” neat typed filesFiled directly. Fast, exact, no AI needed.
πŸ“– Prose markdownYour story chapters, dialogue, descriptionsThe AI reads it and pulls facts out ("Aldric, born 280 TA, son of Theron").

ELI5: the YAML door is you handing the librarian a neat index card. The prose door is you handing the librarian a novel and letting it write its own index cards. Both end up in the same web of facts.

Crucially: the AI never writes to the world. Only you do. The AI reads, asks, and answers β€” it does not get to change the canon. That's the world-builder's job, always.

8The safety net (the fact-checker)

Even good books contain mistakes. The Consistency Engine is a night-watchman that roams the web of facts and flags things that are impossible:

The golden rule: the engine flags, it never deletes. When you "retcon" (retroactively fix) a fact, the old version is kept and marked "superseded," not erased. So you can still ask "what was true before the retcon?" History is preserved, even when it changes.

9What makes this different from a wiki?

A wiki πŸ“„

  • Stores text.
  • You read it yourself.
  • One answer, no sense of time.
  • No idea when facts were true.

Lore Engine 🧠

  • Stores facts as a web the AI can traverse.
  • The AI reasons and answers, with citations.
  • Every fact knows when it was true.
  • Flags its own contradictions and gaps.

A wiki is a pile of pages. The Lore Engine is a thinking model of your world β€” one an AI can actually interrogate, trust, and cite.

10So, the whole thing in one picture

πŸ“– Your Codex markdown + YAML πŸ“š Cognee reads & files 🧠 Minimax-M3 extracts facts πŸ•ΈοΈ Neo4j web of facts πŸ›‘οΈ + πŸ”§ fact-checker & tools Your notes β†’ filed by Cognee β†’ facts pulled by the AI brain, stored in the graph, guarded by the fact-checker.
The whole machine, end to end.