Lorewright Wiki
Lorewright Engineering Wiki
This wiki is maintained as compiled engineering knowledge from repo sources, not as standalone prose. Every page traces back to concrete source files — schemas, route modules, pipeline scripts — through its source_paths frontmatter. The goal is to make the wiki a derived artifact of the codebase rather than an independent document that drifts out of sync.
Lorewright exposes that content through two repo-owned surfaces:
- Public static wiki:
site/buildswiki/into https://madsenjake0.wiki for public browsing. - FastAPI wiki API:
server/wiki.pyserves/api/wiki/*for engineering consumers and API-only diagnostics.
Design Rationale
The wiki exists because code comments and docstrings capture what but rarely capture why or how subsystems relate. A separate documentation site would drift from reality, so the wiki is kept inside the repo and maintained as part of every code change (see the ingest operation in AGENTS.md). Two publishing surfaces serve two audiences: the static site gives read-only public access with zero runtime cost, while the FastAPI API provides machine-readable metadata (staleness, health, commit history) for internal tooling and agent workflows.
The alternative — a standalone Notion/Confluence wiki — was rejected because it breaks the single-source-of-truth principle. Wiki pages here are versioned with the code, reviewed in the same PRs, and validated by the same CI pipeline.
Assumptions & Constraints
- Source-backed provenance: every non-index page must cite at least one
source_pathsentry. This is enforced by the lint operation and the/api/wiki/healthendpoint. If a page can't point at real code, it doesn't belong in this wiki. - Flat file structure: all pages live at
wiki/*.mdwith no subdirectories. The hierarchy is expressed throughparentfrontmatter, not filesystem nesting. This keeps the static site build simple (globwiki/*.md) and the FastAPI walker trivial. - Frontmatter is the schema: the eight required fields (
title,parent,order,tags,kind,status,summary,source_paths) are validated at read time byserver/wiki.py. Missing or invalid fields produce 422 errors from the API and broken pages on the static site. The field set is intentionally small and stable — adding a field means updating the parser, the static build, and every existing page. - Append-only log:
wiki/log.mdis the audit trail. It records what changed and why, not the full diff. This is a lightweight alternative to git-log archaeology when you need to understand wiki evolution quickly.
Catalog By Kind
Overview
currentArchitecture: System map, boundaries, and cross-cutting invariants.currentDecisions: Decision index and architecture records.
Subsystems
currentEngine: Core package ownership and runtime extension points.currentServer: FastAPI route ownership and request/response patterns.currentData Pipeline: SRD and homebrew ingest and generation flow.currentSQLite Schema: SQLite storage and merged view conventions.currentProgressions: Generated artifact layout and schema anchors.currentHomebrew: Canonical authoring model and projection behavior.currentDM Orchestration: Model gateway, tool registry, and session orchestration.currentGRPO Combat: 36-example GRPO combat enrichment workflow with exact FIREBALL-sourced allied HP and app DB dependency.
API Contracts
currentAPI Contracts: Stable API surfaces for progression, homebrew, rebuild, and wiki endpoints.currentSRD Level-Up Contracts: Canonical SRD level-up schema and apply/validate error semantics.
Runbooks
currentRebuild Runbook: Repeatable db-refresh and progression rebuild operations.currentTesting Strategy: Test matrix and required checks per subsystem change.currentMVP Prototype Backlog: Prototype backlog for a playable SRD 2014 DM loop with Mem0-backed memory and deterministic combat.currentVercel Deployment Runbook: Public static wiki deployment and redeploy operations.currentWiki Log: Append-only wiki ingest and lint timeline.
Decisions
currentDecision: Wiki Maintenance Contract: Decision record for source-backed wiki maintenance.currentDecision: Vercel Wiki Deployment: Deploy wiki as a static Next.js site to Vercel.currentDecision: Mem0 Memory and Deterministic Combat Boundary: Use Mem0 for campaign memory while engine code owns deterministic combat resolution.
Glossary
currentGlossary: Shared terms used across pipeline, APIs, and docs.
Conceptual Model
The wiki forms a directed acyclic graph rooted at this index page. Each page declares a parent and links to related pages via double-bracket wiki-link syntax. The graph has three structural roles:
- Hub pages (this index, Architecture, Decisions) organize the catalog and provide cross-cutting context. They link downward to subsystem and decision pages.
- Leaf pages (subsystem, API, runbook, decision, glossary) carry the actual engineering content. They link upward to a parent and laterally to related pages.
- The log (Wiki Log) is a special append-only page that records temporal events — ingests, lint fixes, decision additions — forming a timeline orthogonal to the graph structure.
The kind field partitions pages into six categories that map to distinct reading patterns: overviews for orientation, subsystems for deep dives, API pages for contract lookup, runbooks for operational procedures, decisions for historical context, and the glossary for term definitions. This partitioning is reflected in the catalog groupings above.
Operating Notes
- Frontmatter schema and maintenance rules live in
AGENTS.md. - The static site reads top-level
wiki/*.mdfiles at build time; the FastAPI wiki API walkswiki/recursively and attaches backlink, staleness, and source metadata. That difference is documented behavior for now. - API-only wiki capabilities include
GET /api/wiki/health,GET /api/wiki/commits,GET /api/wiki/source, and thetocplussource_metadatafields returned byGET /api/wiki/pages/{slug}. - Any task that changes routes, pipeline logic, schemas, manifests, or rebuild workflow must update impacted pages, this catalog, and Wiki Log.