How meet-patel-2112/orion---world-state-engine works
Orion is a world-state engine for writers: users manage fictional worlds and manuscripts, inspect extracted entities, relationships and events, resolve contradictions, and ask questions about the world. The principal workflow runs from the web interface through the API and asynchronous processing into structured world state, where consistency checks support later inspection and chat. The tree and excerpts confirm the UI routes, API routing, extraction stages and parts of state/consistency handling; several backend route-to-service and worker links are unsampled, so those relationships are left unasserted or marked unverified.
Main entry points: pipeline.py Story extraction · routes World API routes · App.tsx Application routes · world_state_service.py World state service
Components 25
Writer interface
- Application routes
Frontend/src/App.tsx - World workspace
Frontend/src/pages - Writing room
Frontend/src/pages/WritingRoom.tsx - World client state
Frontend/src/store/useWorldStore.ts - HTTP client
Frontend/src/api/client.ts
Backend API
- API router
backend/app/api/v1/router.py - World API routes
backend/app/api/v1/routes
Extraction processing
- Job workers
backend/app/workers - Extraction task
backend/app/workers/tasks/extraction_task.py - Story extraction
extractor/extractor/pipeline.py - Mention extraction
extractor/extractor/mentions.py - Coreference
extractor/extractor/coref.py - Event extraction
extractor/extractor/events.py - Temporal extraction
extractor/extractor/temporal.py - Facts and relations
extractor/extractor/relations.py - Extractor LLM
extractor/extractor/llm.py
World state
- World state service
backend/app/services/world_state_service.py - World repositories
backend/app/repositories - World records
backend/app/models - SQL database
backend/app/core/database.py
World intelligence
- Consistency service
backend/app/services/consistency_service.py - Consistency rules engine
backend/app/consistency/engine.py - World assistant
backend/app/services/chat_service.py - Chat LLM client
backend/app/pipeline/llm_client.py
Other components
- Writer
Connections 25
- Writer → Application routes: uses
- Application routes → World workspace: routes to
Frontend/src/App.tsx - Application routes → Writing room: routes to
Frontend/src/App.tsx - World workspace → World client state: uses
Frontend/src/pages/WritingRoom.tsx - Writing room → World client state: uses
Frontend/src/store/useWorldStore.ts - World client state → HTTP client: requests through
Frontend/src/store/useWorldStore.ts - HTTP client → World API routes: calls
Frontend/src/api/client.ts - API router → World API routes: registers
backend/app/api/v1/router.py - World API routes → Job workers: dispatches jobs
- Job workers → Extraction task: runs
- Extraction task → Story extraction: invokes
- Story extraction → Mention extraction: runs stage
extractor/extractor/pipeline.py - Story extraction → Coreference: runs stage
extractor/extractor/pipeline.py - Story extraction → Event extraction: runs stage
extractor/extractor/pipeline.py - Story extraction → Temporal extraction: runs stage
extractor/extractor/pipeline.py - Story extraction → Facts and relations: runs stage
extractor/extractor/pipeline.py - Facts and relations → Extractor LLM: generates with
extractor/extractor/relations.py - Story extraction → World state service: returns extraction data
- World state service → World repositories: reads and writes
backend/app/services/world_state_service.py - World repositories → World records: persists records
backend/app/repositories/fact_repo.py - World records → SQL database: uses metadata
backend/app/models/fact.py - World state service → Consistency service: checks changes
backend/app/services/world_state_service.py - Consistency service → Consistency rules engine: evaluates
backend/app/services/consistency_service.py - World API routes → World assistant: serves chat
- World assistant → Chat LLM client: queries
backend/app/services/chat_service.py