The room is the world model. Actions are the transition function. Views are the observation function. The audit log is the trajectory. What's missing? The reward signal. That's adaptive salience.
— kernel.ts, closing comment
v6 established the constraint: two axioms (register action, register view), everything else derived. v7 completed the identity model: MCP clients ARE agents, not credential holders.
Both versions still maintain five entity tables: rooms, agents, state, actions, views. Plus auth tables. That's proliferation — a symptom of treating different interpretations of state as different kinds of state.
Actions are state. Views are state. Agents are state. v8 takes this literally.
A sync room is exactly two things:
State — a finite partial function from located keys to versioned values. The current projection of all truth.
Log — an append-only sequence of events. The complete causal history.
Everything else is convention and interpretation.
state(room_id, scope, key) → { value, revision, hash, updated_at }
log(room_id, seq) → { kind, ts, agent, payload }
| Scope Prefix | Interpretation | Replaces |
|---|---|---|
_shared | Shared substrate | (unchanged) |
_actions | Write affordances | actions table |
_views | Read lenses | views table |
_agents | Participant presence | agents table |
_messages | Communication log | (unchanged) |
_audit | Event history | (unchanged) |
_help | Guidance namespace | (unchanged) |
_config | Room configuration | _shared._dashboard |
{agent-id} | Agent-private scope | (unchanged) |
The audit trail (now: log) is optimised for sequential replay. The log_index table makes it queryable by affected key:
CREATE TABLE log_index (
room_id TEXT NOT NULL,
seq INTEGER NOT NULL,
scope TEXT NOT NULL,
key TEXT NOT NULL
);
CREATE INDEX idx_li_key ON log_index(room_id, scope, key);
CREATE INDEX idx_li_seq ON log_index(room_id, seq);
This replaces proposed state_history and view_journal tables. The log IS the history.
Phase 1 is additive. Existing tables remain. New scope conventions are populated in parallel. Reads fall back to legacy tables when scope data is absent. Once validated, legacy tables become read-only, then removable.
The buildContext and dashboardPoll functions detect whether a room is v8 (has _actions scope entries) or legacy (has rows in actions table) and assemble context accordingly. This lets existing rooms continue working while new rooms use the unified model.
- Schema: Add
log_indextable. No changes to existing tables. - Log index population: On every audit append, also populate
log_index. - Registration path:
_register_actionand_register_viewwrite to both legacy tables AND_actions/_viewsscopes (dual-write). - Context assembly: Read from scope-based entries when present, fall back to legacy tables.
- Agent join: Write to
_agentsscope in addition toagentstable. - Temporal queries: New endpoints using
log_indexfor key history. - Deprecation: Stop reading from legacy tables for rooms that have scope entries.