# thoughts.md ## Current Status - Scaffold complete: `charactergarden/` folder structure created per spec section 9 - Core contracts defined in `app/src/types.ts`: Entity, Action, Verb, ValidationResult, StateChange, GameEvent, Turn, Belief, Fact, Affordance, Summary - `docker-compose.yml` created; ollama service gated behind `--profile llm` (not required for MVP) - `.env` / `.env.example` / `.gitignore` in place - Container-first runtime files added: app/frontend Dockerfiles and `.dockerignore`s - **Truth Engine implemented** in `app/src/truthEngine.ts` — pure function, no I/O, no LLM - `validate(actions, worldState)` → ValidationResult - `applyChanges(worldState, changes)` → new WorldState (immutable) - All 8 verbs handled with explicit rejection reasons - `move` now supports a built-in offscene room convention via `createOffsceneRoom()` - `latentEntities.ts` can promote plausible personal items from belief to fact when the actor has carrying context - `db.ts` added with SQLite schema + persistence helpers for `entities`, `events`, `turns`, `beliefs`, and `summaries` - Minimal Fastify server + app pipeline added with seeded world state and fallback parser - Minimal Vite React inspector added for visual boot testing and state inspection ## Current Architecture Decisions - App: Node.js + Fastify + TypeScript - Frontend: React + Vite + TypeScript - Database: better-sqlite3 (synchronous, no ORM) - Ollama is optional; system must work without it (per section 14) - `Event` type renamed `GameEvent` in code to avoid collision with the DOM `Event` global - Latent personal items are gated by facts-derived affordances, not accepted directly from beliefs - The offscene room is represented as a normal room entity with id `offscene` - App and frontend should be run and validated through Docker Compose rather than host-installed Node ## Next Steps 1. Implement App service / turn flow (`app/src/app.ts`) per section 6 2. Validate Docker boot and iterate on any compile/runtime failures 3. Expand fallback parser coverage and tighten truth-engine world rules 4. Add LLM adapter implementation beyond fallback parsing ## Open Questions - Should room/location be an Entity attribute or a separate entity type? - What is the initial world state for the MVP (1–2 rooms, ≤3 characters)? - Should latent personal-item plausibility live only on actor attributes, or also look at worn item/container entities? ## Session Notes - 2026-04-23: Project started. Scaffold, type contracts, .gitignore, and .env.example created. - 2026-04-23: Truth Engine implemented. Pure validation with per-verb handlers and immutable applyChanges helper. - 2026-04-23: Added facts/affordances + latent entity resolver for improv-style personal items, plus offscene room support. - 2026-04-23: Added SQLite schema module. Host `npm install` is blocked by `better-sqlite3` on Windows Node 25, so runtime validation should happen inside Docker on an LTS Node image instead. - 2026-04-23: Added minimal backend/frontend boot slice so the project can be tested visually through Docker.