Schema
CREATE TABLE messages (
id INTEGER PRIMARY KEY AUTOINCREMENT,
session_key TEXT NOT NULL,
role TEXT NOT NULL,
content TEXT NOT NULL,
created_at TEXT NOT NULL
);
Semantics
session_keyis the thread id (chat_sessions.id). The name predates the table; it is kept so existing queries and data stay valid.- We keep the transcript, not the agent. No
X-Hermes-Session-Keyis sent with a turn. Hermes therefore keeps no copy, and the app replays what it wants from here — which is why context can be compressed 5.3× before it is paid for. - Failures are persisted. An error reply is stored like any other assistant message, so the transcript on reload matches what the bubble showed. Storing only successes once left a user message with no reply in the thread forever.
Ordering
id ascending is chronological for a thread; created_at exists for display and for the
"when" label, not for ordering.
Rendered from nx-master/data-model/messages.md · OKF bundle · regenerate with npm run render