Multi-Ontology Narrative Intelligence Through Omniversal Representation
An Auto-GM system for tabletop RPGs and narrative games, built on a data-first, canonization-driven architecture.
MONITOR is a narrative intelligence system for tabletop RPGs. It combines a canonical graph, narrative memory, semantic retrieval, and loop-based agents so worlds and sessions stay coherent over time.
- Interactive play: the web chat flow in
packages/ui/backend/src/monitor_ui/routers/chat.py - Wired CLI commands:
monitor state,monitor rules,monitor mechanics,monitor ingest, andmonitor playtest - Live data-layer MCP families:
neo4j_*,mongodb_*,qdrant_*, andingest_*
- Data-first — persistent state lives in databases, not prompt memory
- Canonization-driven — proposals become canon only after explicit evaluation
- Layered —
cli → agents → data-layer - Provenance-aware — canonical facts keep evidence links to sources or scenes
┌──────────────────────────────────────────────────────────┐
│ USER SURFACES │
│ Web UI (FastAPI + Next.js) | CLI (`monitor ...`) │
└────────────────────────┬─────────────────────────────────┘
│ dispatches to
┌────────────────────────▼─────────────────────────────────┐
│ AGENTS + LANGGRAPH LOOPS │
│ SceneLoop | StoryLoop | TurnLoop | ConversationLoop │
│ WorldBuildingLoop | Narrator | Resolver | CanonKeeper │
└────────────────────────┬─────────────────────────────────┘
│ data-layer tools
┌────────────────────────▼─────────────────────────────────┐
│ DATA LAYER API │
│ - Authority enforcement (CanonKeeper owns scene canon) │
│ - Schema validation (Pydantic models) │
│ - Live MCP families: `neo4j_*`, `mongodb_*`, │
│ `qdrant_*`, and `ingest_*` │
└─┬────────┬────────┬────────┬──────────┬──────────────────┘
│ │ │ │ │
▼ ▼ ▼ ▼ ▼
Neo4j MongoDB Qdrant PostgreSQL MinIO
(+ OpenSearch is provisioned in infra and remains optional)
uv sync # installs all four packages (uv workspace)
cp env.example .env # fill in secrets / provider keys
cp env.example infra/.envdocker compose --env-file .env -f infra/docker-compose.yml up -d
# or ./dev.sh for the infra + local backend/frontend comboAll nine containers report healthy; curl localhost:8001/api/health?deep=true
aggregates component status.
uv run python scripts/demo_millhaven.py # Millhaven world + ready session
# open http://localhost:3000/play and pick "The Millhaven Disappearances"
uv run monitor playtest live --turns 3 # scripted live session via CLIuv run pytest packages tests -q # ~5,900 tests, < 6 minutes
RUN_E2E=1 RUN_INTEGRATION=1 uv run pytest tests/e2e -q --timeout=300 # full-stack e2e
docs/USE_CASES.mddescribes the broader target command surface (play,manage,query, and more).packages/cli/src/monitor_cli/main.pyis the source of truth for what is currently wired up in the repo.Current runtime reality: the primary interactive play surface is the web chat UI, and
monitor playtestis the wired CLI path for end-to-end autonomous-GM validation.
- Copy
env.exampleto.envand reuse the same values ininfra/.envfor Docker-based local runs. - To publish the values to GitHub Actions secrets/variables, run
scripts/push_env_to_github.sh env.example(or pass your.env) — requires authenticatedghCLI. - To audit drift between
env.exampleand GitHub Actions, runscripts/check_env_drift.sh env.example; it reports missing/extra keys without printing values.
- PR auto-labeling and test reminder: runs in CI via
.github/workflows/auto-label.yml, or manually withscripts/auto_label_and_comment.sh <pr#>. - Weekly health snapshot:
scripts/weekly_health_report.sh --days 7 [--discussion <category>|--issue <number>]to print or post merged PRs, stale issues, and failing runs. - Rerun failed workflows:
scripts/rerun_failed_workflow.sh --pr <number> [--comment](or--branch <name>) to restart the latest failed run.
Use the canonical docs below instead of hunting through overlapping summaries:
| Canon doc | Purpose |
|---|---|
docs/STATUS.md |
Live verified status — tests, gates, stack health |
SYSTEM.md |
Product vision, goals, and operating modes |
STRUCTURE.md |
Repo layout and folder ownership |
ARCHITECTURE.md |
Layer boundaries and dependency rules |
docs/README.md |
Documentation index and placement rules |
docs/USE_CASES.md |
Use-case catalog and workflow targets |
docs/AI_DOCS.md |
Contributor and agent quick navigation |
infra/README.md |
Local infrastructure setup and maintenance |
For subsystem detail, see docs/architecture/ and docs/ontology/. Historical planning notes live under docs/archive/.
Before changing code or docs:
- Read
SYSTEM.md,STRUCTURE.md, andARCHITECTURE.md - Respect layer boundaries (
cli → agents → data-layer) - Add or update tests for behavior changes
- Reference the relevant use-case ID in your PR or commit message
See CONTRIBUTING.md, AGENT_SETUP.md, and docs/AI_DOCS.md for contributor workflow details.
MIT License. See LICENSE for details.