← Back to Leaderboard
Llena13144

lena13144/lorecodex

Tree-indexed RAG that retrieves whole fiction scenes without embeddings

View on GitHub ↗
Engineering Health (Methodology)
A · 87/100
Maintenance Activity
● Updated today
Latest Release
v3.3.0
Commercial License Check
MIT · Commercial Friendly

Automated SPDX check for reference only — not legal advice. Disclaimer

Maintenance35/35
Fork Adoption12/25
Release Cadence20/20
License Clarity20/20
Self-HostedLocal AIAPI
Total Stars
★ 21
24h Growth
+1
7d Growth
+8
Forks
3

GitHub Star History

Tracked from daily D1 telemetry snapshots. Hover any data point for exact daily star counts.

lena13144/lorecodex Star History (2026-11-20 - 2026-12-04) DAILY STAR HISTORY (15-DAY D1 TELEMETRY) +20 in 14d · avg +1/day 25 13 0 2026-11-20: ★ 12026-11-21: ★ 52026-11-22: ★ 112026-11-23: ★ 122026-11-24: ★ 122026-11-25: ★ 122026-11-26: ★ 132026-11-27: ★ 132026-11-28: ★ 152026-11-29: ★ 152026-11-30: ★ 172026-12-01: ★ 192026-12-02: ★ 192026-12-03: ★ 212026-12-04: ★ 21 ★ 21 11-20 11-27 12-04

Evidence-Backed Technical Brief

AI Deep Review

Architecture & Core Mechanics

LoreCodex is a tree-indexed RAG store for narrative text. A volume → arc → scene hierarchy separates navigation metadata in tree_index.json from source text in tree_texts.json. LLM-assisted indexing adds scene summaries, volume overviews, aliases, and a glossary without replacing the source. SillyTavern and TauriTavern run retrieval in the browser through browser_engine.js, with IndexedDB or SillyTavern's /api/files for persistence. The browser and Node paths share a zero-dependency JavaScript ESM retrieval core; the Node entrypoints require Node.js 18 or newer.

The default agent browses the hierarchy, searches aliases or character timelines, and calls read_scene before it can select a scene. That tool reads up to ten scenes per call. Selected scenes enter the generation prompt in source order, alongside a retrieval guide. The same core is available through the Node HTTP service, MCP stdio at src/mcp_server.js, and the DeepSeek Harness plugin at src/dsh_plugin.js. The MCP interface distinguishes six direct lookup tools from two corpus-building or index writeback tools and one delegated retrieval tool.

Key Capabilities & Differentiators

The browser workbench imports TXT with UTF-8 or GB18030 detection, EPUB, Markdown, SillyTavern worldbook JSON, V2 character cards with character_book, and .lorepack.json. Structural preflight lets users check the split before spending model calls. LLM indexing can resume from saved progress and upgrade individual volumes. Full-text alias expansion finds appearances omitted from the scene metadata and marks them [CAMEO]. Character timelines are not restricted to a top-K candidate list, and the local Loria notebook stores verified source pointers and decaying co-occurrence links. Both are useful for recurring queries across volumes, with maxOrder limiting chapter-bound retrieval and notebook recall.

For chat endpoints without function calling, low-cost mode narrows candidates at the volume and scene levels before one final Chat selection call. The optional Decision path pools volumes and uses multiple keys; candidate assembly reserves slots for grep and notebook hits. If all Decision keys hit HTTP 429, retrieval can fall back to chunked reranking or local BM25F plus grep. The chat model can use an OpenAI-compatible endpoint, including compatible DeepSeek or Gemini endpoints and OpenRouter. The single final Chat call does not include any Decision or rerank requests made upstream.

Trade-offs & Limitations

A hand-maintained worldbook is simpler for a small set of stable facts. LoreCodex earns its setup cost when a chat needs exact dialogue, aliases, or an intact scene rather than a short entry. Compared with fixed-chunk vector RAG, the hierarchy preserves scene boundaries and reading order and avoids vector rebuilds. The trade-off is a stronger dependence on clean imports, accurate summaries, and good alias coverage. Local lexical fallback can miss paraphrases with little word overlap; optional model ranking provides a semantic path at the cost of request volume and latency.

Building the LLM-enhanced index costs model time up front. The deep agent typically takes two to four tool round trips when it checks the source, and injecting several full scenes can consume substantial context even in low-cost mode. Size browser memory and disk against the actual corpus and benchmark end-to-end retrieval with the chosen endpoint, context window, and concurrency. maxOrder follows reading order rather than in-world chronology, and general setting entries not tied to chapters are exempt, so test both nonlinear narratives and unassigned lore before relying on spoiler protection.

Hardware & Deployment Guide

Start with the SillyTavern or TauriTavern extension if browser storage and direct model access meet your needs. It does not require a separate Node or Python backend. For a standalone workbench, shared on-disk corpora under corpora/, or a provider whose endpoint runs into browser CORS restrictions, run node src/server.js on Node.js 18 or later. It listens on 127.0.0.1:5240 by default; binding with --host 0.0.0.0 requires --token or the APITOKEN environment variable. The Python 3 builder supports offline splitting with --no-llm. npm test runs offline tests without an API key, including mock indexing, resume behavior, and spoiler gating.

v3.2.2 hardened st-files synchronization with revision checks and recovery safeguards. Upgrade all participating clients before relying on conflict detection: older clients can overwrite files without advancing rev. SillyTavern file sync keeps API keys local, but configured hosted model endpoints still receive the inputs needed for inference. v3.3.0 removes the Embedding and Int8 vector layer entirely, so the earlier vector-assisted path is no longer a deployment option.

Source fidelity: Volume → arc → scene indexing preserves complete scenes and returns selected text in source order.
Vector-free ranking: v3.3.0 removes Embedding and Int8 indexes; optional Decision and chunked rerank fall back to local BM25F plus alias grep under rate limits.
Retrieval modes: The default agent reads source scenes before selecting them; low-cost mode needs no function calling and uses one final Chat call after candidate selection.
Spoiler control: maxOrder gates retrieval and Loria notebook recall by reading order; general setting entries without chapter assignments are exempt.
Multi-device storage: IndexedDB or SillyTavern st-files, with revision checks, conflict backups, and deletion tombstones in st-files mode.
Portable libraries: .lorepack.json carries the full corpus; .loreindex.json carries the index and can be reattached to a local source file.
Best For

SillyTavern and TauriTavern roleplay, or MCP-based lore research, where exact dialogue, recurring aliases, and chapter-level spoiler limits matter.

Skip If

A small worldbook already covers your needs, your corpus lacks useful narrative structure, or normal chat retrieval must work without any model calls.

Reviewed on 2026-12-04 · Grounded in GitHub README, root file tree & releasesMethodology

Quick Start & Installation

Self-HostedLocal AIAPI
# 离线全量测试(无需 API Key,覆盖双端解析、Mock LLM 建库与断点续传、MCP、dsh 插件、防剧透门控与别名搜索)
npm test

# 构建 dist/releases/ 下的 4 个发行包
npm run build:releases

Comparison vs. Top RAG, Data & Memory Alternatives

Full comparison →
RepositoryStars7d TrendStackLicenseCore Positioning
lorecodex ★21+8JavaScriptMITTree-indexed RAG that retrieves whole fiction scenes without embeddings
firecrawl216.5k+4.6kTypeScriptAGPL-3.0Local and hosted web ingestion that turns sites into RAG-ready Markdown
markitdown199.7k+909PythonMITPython library and CLI that turn mixed-format documents into Markdown for RAG in
claude-mem121.7k+1.4kTypeScriptApache-2.0Hook-driven memory and hybrid search for coding agents that need cross-session r

AI Context Briefing (for Claude / Cursor / Windsurf)

Standardized architecture summary & quickstart commands ready to paste into coding agents.

Raw .md ↗
curl -sL https://repoforai.com/repo/lena13144/lorecodex.md

Embed Star History Chart & Badges in README.md

Full-history Star History SVGs and velocity cards on GitHub Camo: drop-in replacement for OSSInsight and Star History widgets.

lena13144/lorecodex Star History on RepoForAI

Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).

Frequently Asked Questions about lorecodex

How does LoreCodex put source text into a chat, and can I use it outside SillyTavern?

In SillyTavern, the generate_interceptor runs after the user message is recorded and before the generation prompt is assembled. It passes the message and recent turns to retrieval, which can supply a guide and complete source scenes to the writing model. Other agent hosts can use src/mcp_server.js over MCP stdio. Its six direct lookup tools browse, search, and read without calling a separate retrieval model.

Do I need a GPU, and what should I size for?

There is no embedding model or vector index in v3.3.0, so local storage and lexical lookup do not require a GPU. Size RAM and storage against corpus size, and measure the prompt load from full-scene injection. Offline splitting and direct lookup are distinct from normal chat retrieval, which uses a configured model. If that model runs locally, size its hardware separately for the chosen model, context length, and concurrency.

Can I use it commercially or self-host a library of published fiction?

The MIT license permits commercial use and self-hosting of the software, subject to retaining the copyright and license notices in copies or substantial portions. It does not grant rights to imported books or game scripts. Before sharing a .lorepack.json or using a hosted model, verify that you can distribute or transmit the source material. An index-only .loreindex.json omits source text but can still contain summaries and spoiler-bearing metadata.

When is this a better fit than a worldbook or vector RAG?

Choose a worldbook when a small set of curated facts and keyword triggers is enough. Choose LoreCodex when the job is to recover exact dialogue, resolve aliases, or retrieve scenes within a reader's progress limit. Prefer a general vector RAG stack if your main workload is semantic search over heterogeneous documents with little useful hierarchy. For a borderline corpus, test paraphrased queries, missed aliases, and scene-level context costs before committing.

Upstream README & Documentation

This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.

Maintaining lena13144/lorecodex? Pin to Homepage + competitor /alternatives pages with a custom Cloud/Demo CTA.Feature lena13144/lorecodex on Homepage & Alternatives ($19)
WEEKLY BREAKOUT DIGEST

Top 10 Breakout Open-Source AI Repos, Every Thursday

Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.

Zero spam · 1-click unsubscribe · Privacy Policy

Saved in your browser · Export Markdown RFC tables or jump into /vs compare