README.md

The Long Noon #

A free-text world router for an original setting. GLM writes the world once, offline, as plain JSON/Markdown files; Jev routes free-text player questions to that pre-written content at play time. Jev never generates text; GLM never sees a player's question.

Setup #

uv sync --extra dev
cp .env.example .env   # then fill in OPENROUTER_API_KEY and JEV_API_KEY

Running #

uv run --extra web uvicorn router.api:app --reload --port 8000

Layout #

lib/            Thin clients: lib/llm.py (GLM via OpenRouter), lib/jev.py
                (TypeSafe/Jev), lib/sanitizer.py (keeps GLM clear of the
                setting's real-world inspirations)
config/         banned_terms.json, glm_style.md (the only setting doc GLM
                is ever shown)
pipeline/       World generation: stage0_bible → stage1_taxonomy →
                stage2_articles → stage3_lint → stage4_routing →
                stage5_queries → stage6_manifest → stage7_dialogue, plus
                cars.py, archivist_reactions.py, orientation.py (the purser's
                boarding scene), factions.py (the glossary), namebank.py,
                procgen.py (anti-repetition prompt helpers: rotated opening
                moves/dialogue tones, an overused-words scan)
router/         Play time: verb_router (research / talk_to / move_to),
                simple_router + gate (one Jev Choice, confidence gate),
                manifest_router, api.py (FastAPI server + session logs)
static/         The single-page frontend (index.html)
world/          The generated world pack. Committed to git — plain files,
                not a build artifact.
scripts/        smoke_test.py, route.py, eval.py, manifest_pick.py
tests/          pytest suite

Commands #

uv run python scripts/smoke_test.py   # one real Jev call, one real GLM call
uv run pytest                          # unit tests (Jev runs in mock mode)
uv run python scripts/eval.py          # routing eval over world/queries.jsonl (live Jev)
uv run python scripts/provider_report.py  # best/worst OpenRouter providers from lib/llm telemetry
uv run python -m pipeline.stage7_dialogue assessor factor   # (re)build NPC banks

Open the UI with ?debug in the URL to see router internals (gate, confidence) under each result.

Deploy #

render.yaml + .python-version deploy the FastAPI service (router/api.py) to Render's free tier — only JEV_API_KEY is needed server-side (GLM/ OPENROUTER_API_KEY is a build-time pipeline credential and never reaches the running server). Push to origin (GitHub) to redeploy; tangled is a public mirror kept in sync alongside it, not a second deploy target.

Status #

256 articles across 8 regions: the first three legs fully written (Tamar-Under-Rock → Singing Dunes → Marrow Bay, with stop manifests for the latter two), plus first-hand content for two more legs (the Pans of Ilm, the Glass Fringe — articles/routing/queries exist, but neither has a stop manifest yet, so they're researchable but not outfittable), plus two off-road hearsay-only regions (the Deepwell Stair, the Last Green) and a deepened Kethara rumor mill. world/routing.json crossed Jev's 255-option Choice ceiling at 256 articles — router/simple_router.py's route() handles this generically (splits into multiple Choice questions in one request), not with the hierarchical region-level beam search PLAN.md describes for real multi-region worlds; that's still the right long-term fix for accuracy at this scale.

Five NPCs: purser (53 lines), sledge-master/assessor/factor/chaplain (24 lines each). Every one covers the same four "obvious question" FAQ topics (the Long Noon sun, no rain, the missing sea, rock-cut cities) in their own voice, so those don't dead-end in a shrug depending on who's asked.