Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Memory architecture

Castellan memory is the coordination substrate plus durable episode artifacts — not a vector store or conversation archive.

Layers

LayerWhatWhere
HotBlackboard, PheromoneField, schedulerIn-process
WarmEpisodes, traces, checkpoints, topology archive.castellan/ JSON or SQLite
ColdTurso Sync (planned)Multi-machine share
flowchart TB
    subgraph hot["Hot"]
        BB[Blackboard]
        FIELD[PheromoneField]
        SCHED[Scheduler]
    end

    subgraph warm["Warm"]
        EP[episodes]
        TR[traces]
        TA[topology archive]
    end

    RUN[castellan run] --> SCHED
    SCHED --> FIELD
    RUN --> BB
    RUN --> EP
    RUN --> TR
    EVOLVE[castellan evolve] --> EP
    EVOLVE --> TA
    MCP[castellan mcp] --> warm
    REPLAY[castellan replay] --> EP

    classDef runtime stroke:#0969da,stroke-width:2px
    classDef substrate stroke:#8250df,stroke-width:2px
    classDef evolve stroke:#d97706,stroke-width:2px

    class RUN,REPLAY runtime
    class BB,FIELD,SCHED,MCP substrate
    class EVOLVE,EP,TR,TA evolve

Compared to vector-RAG systems: Castellan memory is environment-mediated — typed slots and zone signals, not embedding similarity. See Coordination model.

Today (JSON default)

castellan run --goal "reach target" --plugin gridworld
castellan replay --episode .castellan/episodes/<id>.json
castellan memory status
ArtifactPath
Episodes.castellan/episodes/<goal-id>.json
Traces.castellan/traces/<goal-id>.jsonl
Topology archive.castellan/topology_archive.json

Live episodes: castellan_read_blackboard, castellan_deposit_signalMCP tools.

SQLite backend

Set [memory] backend = "sqlite" in castellan.toml:

  • castellan_recall — query episodes, checkpoints, observations
  • castellan_remember — persist agent observations (not live field deposits)
  • castellan_query_field_history — sparse field snapshots at checkpoints

castellan evolve reads SQL aggregates when backend is sqlite. Full config: castellan.toml.

What never goes in the database

DataWhy
Live pheromone ticksIn-process decay semantics
Conversation transcriptsAnti-coordination — see Coordination model
Vector embeddingsOut of scope v1

Engineering detail

SQL schema, MemoryStore trait, sync policy: MEMORY_ARCHITECTURE.md (maintainer spec).