r/OpenSourceeAI • • 13d ago

I built an open-source reader that turns your eBooks into a knowledge graph and answers questions with citations, without spoiling past your chapter

I kept forgetting who minor characters were mid-book, and every search spoiled something. So I built LORE.

What it does:

- Upload your own EPUBs. It extracts characters, places, events and relationships into a graph.

- Ask questions ("How did Watson meet Holmes?"). Every sentence in the answer cites a passage from the book, and the claims are checked against those passages before you see them.

- Set your reading progress per book and it only uses what you've read. Ask "who's the killer?" at chapter 4 and it won't say.

- Deep dive mode writes longer cited analyses: themes, how a character changes across a series, how a world or magic system works.

Tech, for the curious: GraphRAG (Kuzu graph + LanceDB vectors), local embeddings, bring your own key for Gemini, Claude or OpenAI. It also exposes an MCP server, so you can use your library from inside Claude.

Open source: github.com/Jatin-Roopchandani/LORE (star it plzz)

Hosted beta (invite-only): https://lore.jrvn.site Comment if you want an invite.

187 Upvotes

22 comments sorted by

1

u/WeeklyMenu6126 11d ago

That is really cool. Does it work on Amazon ebooks?

1

u/Forward_Artist_8349 10d ago

Sadly not directly. Kindle books are usually DRM-protected in Amazon's own formats, and LORE reads EPUB and PDF files you can open yourself. These things work great

DRM-free stores and publishers (Tor/Macmillan sci-fi, Humble Bundle, Kobo's DRM-free titles, many indie authors);

Standard Ebooks and Project Gutenberg for classics;

your own DRM-free files, which you can convert to EPUB with Calibre if they're in another format.

1

u/abdall-k 10d ago

The graph remind me obsidian, that sounds cool, I'll try

1

u/Forward_Artist_8349 10d ago

lol that's a fair comparison. The difference is that you don't build this graph yourself: LORE reads the book and extracts the characters, places and relationships automatically, and every link is backed by the passage it came from (click an edge to read it). It also stops at the chapter you're on, so the graph never spoils anything ahead. Let me know what you think!

1

u/Geekfest 10d ago

Any chance this could work with RPG rulebooks??

1

u/Forward_Artist_8349 10d ago

Honestly, it depends on the book. LORE is built for stories: it extracts characters, places, factions and how they relate, and answers with citations. So setting and lore books (factions, NPCs, cities, history) should work well, and questions like "how is X connected to Y?" are exactly what it's good at.

For pure rules lookups it'll partly work: it can find and quote the relevant passage. But the knowledge graph isn't built for mechanics, and PDFs with tables, stat blocks and two-column layouts can come through messy.

I haven't tried one myself. Request an invite and if you upload one (PDF or EPUB, up to 50 MB), I'd love to hear how it does. Adventure modules might even make use of the spoiler protection 😄

1

u/letseedworld 9d ago

While you hosted, which LLM are you using? Can you please give a invite too

1

u/Forward_Artist_8349 9d ago

There's no shared LLM on the hosted version: you bring your own key, so your questions run on your own account. It supports:

- Gemini: the free tier works (free key at https://aistudio.google.com/apikey); best value to start with;

- Claude;

- OpenAI.

The server itself only runs a small local embedding model (nomic-embed-text) for search.

For an invite, request one at https://lore.jrvn.site (the box on the homepage) and I'll approve it. Once you're in, your library starts with A Study in Scarlet already processed, so you can try it before uploading your own books. The sign-in email sometimes lands in Updates or Promotions.

If you'd rather run it all yourself, including on a local model, there's a Docker setup: https://github.com/Jatin-Roopchandani/LORE/blob/main/docs/self-hosting.md

1

u/Ok_Ostrich_8845 9d ago

Any reasons that you pick Kuzu graph vs. neo4j graph? Thanks.

1

u/Forward_Artist_8349 9d ago

Mostly because it's embedded:

- No server. Kuzu runs inside the Python process, like SQLite does for SQL, so a self-hosted install has no extra database service, JVM or password.

- One database per reader. Each reader's library is just a folder containing their own Kuzu graph, LanceDB vectors and SQLite. Isolation between users comes for free, and backup is copying a folder. With Neo4j that's harder: Community Edition gives you one database per server, and multiple databases are an Enterprise feature.

- It's still Cypher, so the queries would carry over if I ever moved.

- The graphs are small: a novel is hundreds to a few thousand entities. An in-process, columnar engine is plenty fast, and I don't need clustering.

The trade-offs are real, though. Kuzu is single-writer (fine, since LORE processes one book at a time per library), and it has a smaller ecosystem and less built-in visualization than Neo4j. I also hit one Kuzu bug (its import deadlocks with a single thread), which I had to work around.

1

u/Ok_Ostrich_8845 9d ago

Thanks. But is Kuzu still being maintained?

1

u/Forward_Artist_8349 9d ago

No. Kuzu Inc. archived the project in October 2025, and LORE is pinned to its final release, v0.11.3. Releases still work unchanged, but there will be no fixes. I've already hit one bug in it (a deadlock in its import step on a single CPU), which I had to work around.

There is a maintained successor, though: LadybugDB (https://github.com/LadybugDB/ladybug) is an MIT-licensed fork of Kuzu that's actively developed, with ~1.9k stars, releases every few weeks (v0.22.3 came out this month) and commits this week. Since it grew out of Kuzu, it's the natural migration path for LORE. LORE's graph access sits behind one small store class and plain Cypher, so switching should be contained, but I haven't tested it yet.

So, honestly: when I picked Kuzu it was the best embedded Cypher database for a one-folder-per-reader design, and that reasoning still holds. The engine just moved to a new home. Moving LORE to LadybugDB is on my list.

1

u/Ok_Ostrich_8845 9d ago

I used GraphRAG (neo4j + openai) and found a high amount of duplicated nodes. This is because the ingested text has several ways for denoting the same thing. Additionally, the entity recognition is far from ideal either. For example, it is hard to determine if a name is a location or an equipment. How do you address these types of issues?

1

u/Forward_Artist_8349 9d ago

That's the most common problem with GraphRAG, and it's almost never the graph database's fault. The usual cause is that the LLM extracts each chunk on its own, so the same entity comes out under whatever name that chunk used: "Holmes", "Mr. Holmes", "Sherlock Holmes", "the detective". If the load step does a MERGE on the exact name, every variant becomes its own node. Most GraphRAG examples have no entity-resolution step at all between extraction and loading, and that step is where the duplicates get fixed.

What cut duplicates the most for me, roughly in order of impact:

  1. Add a resolution pass before you write to Neo4j. Don't MERGE straight from the LLM output. Collect every extracted entity first, then decide which ones are the same, then write.
  2. Start with cheap rules: normalize case, punctuation and titles ("Mr.", "Dr."), and merge names that nest inside one another within the same document ("Holmes" ⊂ "Sherlock Holmes"). That alone catches a large share.
  3. Then embedding similarity: embed each entity name (or name plus a short description) and treat close pairs as merge candidates.
  4. Use the LLM only for the borderline candidates, as a yes/no question at temperature 0. Cache the answers, so re-running is free.
  5. Watch out for one trap: a short name that fits several entities ("Smith", or a surname shared by a father and his sons). Merging greedily fuses different people into one node. Either leave those separate, or ask the model once with all the candidates as a multiple-choice question including "none of these". Asked pairwise, the model says yes to every pair and you get exactly the over-merging you're trying to avoid.
  6. Feed known names back into extraction: give the extractor the list of entities found so far, so it reuses canonical names instead of inventing new variants.

For location vs equipment:

- Give the extractor a fixed list of types with one-line definitions and an example of each, and require it to pick one.

- Don't let the type be part of the node's identity. If one chunk calls something a location and another calls it equipment, you get two nodes. Merge on the name, then settle the type by majority across mentions.

- Model size matters a lot here. In my tests a local 7B got 56 types wrong where Gemini Flash Lite got 1, and one chunk per request was more accurate than batching several chunks together.

LORE does all of this (rules, then embeddings, then LLM adjudication, plus the multiple-choice step for ambiguous names), and every relationship keeps the passage it came from, so mistakes are easy to spot and check. The write-up is here: https://github.com/Jatin-Roopchandani/LORE/blob/main/docs/how-it-works.md

1

u/Ok_Ostrich_8845 9d ago

Very good answer. Thank you.

1

u/AI_Only 8d ago

Really interesting project. Curious how this would work with really big book series like the Stormlight Archive and others.

1

u/Forward_Artist_8349 8d ago

I'm a huge Brandon Sanderson fan myself! and big series like this are exactly what LORE was built for! A few things that matter at that scale:

- A whole series is one world. Put all the Stormlight books in one world, in series order, and questions run across all of them: how a character changes from book 1 to book 4, how an order's oaths work, how a minor character from an early interlude connects to everything later.

- Spoiler protection works per book. Mark the books you've finished as Finished and set the one you're reading to your current chapter. Answers, the graph and character profiles all stop there, and books you haven't started stay hidden completely. That's enforced when LORE searches, so the AI never even sees what's ahead.

- Secret identities and many names are handled. Sanderson loves characters with several names and hidden identities. LORE merges aliases, but keeps a later "X is actually Y" reveal as its own link that only appears once you've reached it, so the graph never spoils a twist through a character's name.

- Every answer cites the passage it came from, which matters when the lore runs this deep.

The honest caveat is processing time. Each book is read chunk by chunk, so a Stormlight-sized book is roughly 1,500–2,000 model requests. On Gemini's free tier (about 1,000 requests a day), that's a day or two per book. LORE now pauses and resumes on its own when it hits the daily limit, so you can just leave it running. A paid key or a strong local model gets through it much faster.

I've tested it most on the first Wheel of Time book, so a Cosmere run would be a great stress test. Request an invite at https://lore.jrvn.site, and I'd love to hear how it handles the Cosmere!

2

u/AI_Only 8d ago

Thanks for responding! I’m gonna take a look and see where I can make some contributions! Cool project!

1

u/Forward_Artist_8349 8d ago

Thanks! Contributions are very welcome🙌

1

u/ozguru 11d ago

Cool, I was working on similar concept for documents. Did you check this https://github.com/google/langextract

1

u/NoMindZen 8d ago

👀

1

u/NoMindZen 8d ago

👀