Files
CharacterGardenStack/thoughts.md
spencer 998635f542 feat: implement processTurn function to handle turn processing and world state updates
refactor: remove legacy types.ts file and update frontend to use new contracts

feat: add applyActions function to manage action application and world state mutation

chore: remove empty .gitkeep file from sqlite data directory

refactor: update frontend App component to align with new API contracts and improve UX

docs: revise project.md to reflect updated architecture and system requirements

docs: update thoughts.md with current status, architecture decisions, and remaining checks
2026-04-24 01:04:17 -04:00

2.1 KiB

thoughts.md

Current Status (clean-break)

  • Backend is running the new contract-native API shape:
    • GET /api/state -> { worldState, turns }
    • POST /api/turn -> { rawText, actions, validation, worldState }
  • Runtime blocker is resolved:
    • old SQLite schema conflict (turns.raw_text) was fixed by wiping old DB state
    • stale legacy files removed from backend source tree:
      • app/src/types.ts
      • app/src/latentEntities.ts
      • app/src/llmAdapter.ts
  • Door/key MVP smoke checks pass:
    • open door before key -> locked_requires_key
    • take key -> success
    • open door after key -> success

Architecture Now

  • Core contracts in app/src/contracts/:
    • action.ts
    • validation.ts
    • turn.ts
    • entity.ts
    • world.ts
  • Deterministic truth engine:
    • app/src/truthEngine.ts with validateActions(actions, worldState)
  • Ordered turn pipeline:
    • app/src/turns/processTurn.ts parse -> validate -> apply -> persist
  • World mutation:
    • app/src/world/applyActions.ts
  • Persistence:
    • app/src/db.ts with tables turns, actions, validation_results, entities, world_states
  • App seed domain:
    • app/src/app.ts door/key world (room_start, room_exit, player, door_1, key_1)

New Endpoint

  • Added POST /api/reset in app/src/index.ts
  • App-level reset implementation in app/src/app.ts
  • DB wipe support in app/src/db.ts
  • Verified reset behavior:
    • returns { worldState, turns }
    • turns is empty after reset
    • player and key_1 return to room_start

Frontend Migration Notes

  • frontend/src/App.tsx migrated to consume new backend contracts.
  • Removed dependencies on old fields (narration, events, beliefs, summaries, parser_feedback).
  • Turn submit flow now refreshes snapshot via GET /api/state after POST /api/turn.
  • Reset call now sends JSON body/content-type to satisfy Fastify media-type validation.

Remaining Checks

  1. Frontend build pass completed in container (docker compose exec frontend npm run build).
  2. Validate inspector UX manually against the door/key flow.
  3. Expand parser coverage only within current clean MVP domain.