StateOverview

State & Memory Overview

Causet models two related concepts: entity state (what rules read and write during an intent) and application memory (accumulated history on an entity over time). Both are derived from events — neither is manually patched in application code.


The derivation chain

Entity snapshots update synchronously on the write path. Projection tables update asynchronously.


Declaring state

# app.causet
includes:
  states: [./states/**/*.state.causet]
state:
  user:
    entity_key: user_id
    fields:
      - name: concert_count
        type: int
        default: 0
      - name: following_count
        type: int
        default: 0

In this section

PageWhat it covers
ConceptEntity state vs application memory
Entity StateField types, paths, state: DSL
Application MemoryAccumulated context from events
User MemoryPreferences, history, statistics
Derived StateWhy all state is derived
Event-Sourced StatePattern and trade-offs
Rebuilding MemoryReplay to reconstruct snapshots
Best PracticesPaths, defaults, _tmp/
ExamplesConcert-app memory patterns

Next steps