01
Bootstrap layer
The runtime is installed into each repository with phantasm bootstrap.
That creates the local .phantasm/ layout, tracked config files, and the
state directory that holds the live runtime.
02
Request layer
Phantasm exposes one explicit JSON request/response contract through
handle-request. Operations are versioned, auditable, and separated into
mutations, reads, snapshots, and maintenance flows.
The read-only describe operation returns the complete machine-readable
API schema, operation params, safety rules, and runnable examples for agents.
03
Persistence layer
The source of truth is one authoritative SQLite store per project under
.phantasm/state/store.sqlite. Runtime caches may exist, but durable memory
truth lives in local state, not in prompt text or transient agent memory. Current
runtimes automatically repair older v1 stores that are missing
quality_json metadata columns.
04
Memory domain layer
The runtime stores authoritative records, suggestions, review items, raw evidence,
operations, idempotency receipts, trust decisions, and backup metadata. The system is
designed to preserve lifecycle and auditability, not just similarity search hits.