What are turns?
A turn is a single entry in a conversation thread. Every message — from the user, from an agent, from the system, or from a tool — is stored as a turn. The API uses “turns” throughout; never “messages.”
Turns are stored at full fidelity in SQLite. Daemion does not compress or summarize history. Agents pull what they need via search tools rather than receiving a predetermined context window.
What does a turn look like?
{ “id”: “trn_07xyz456”, “thread_id”: “thr_01abc123”, “agent_id”: “daemion”, “role”: “assistant”, “content”: “Here is the deploy script…”, “model”: “claude-sonnet-4-6”, “cost_usd”: 0.0012, “project_id”: null, “created_at”: “2026-03-31T14:22:01.000Z” }
Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique turn ID (trn_ prefix) |
thread_id | string | The thread this turn belongs to |
agent_id | string | null | Which agent produced this turn (null for user turns) |
role | string | One of: user, assistant, system, tool |
content | string | The full text of this turn |
model | string | null | Model used for assistant turns; null for user/tool turns |
cost_usd | number | null | Cost of this turn in USD; null for user turns |
project_id | string | null | Project association if set |
created_at | string | ISO 8601 timestamp |
Source: src/gateway/storage.ts:11-21
Why “turns” not “messages”?
The word “message” implies a communication between two parties. A turn captures more precisely: it is one agent’s contribution to an ongoing exchange. A single user request might produce multiple turns — a tool turn for the search result, then an assistant turn for the response. “Turn” reflects the multi-role, multi-step nature of an agent conversation.
How does context assembly use turns?
On each incoming turn, the Context Substrate loads the ~10 most recent turns from SQLite. These are always in context. The agent also has five history tools — search_history, get_thread, list_threads, find_relevant, search_all — to reach further back on demand. See What is the Daemion kernel? for the full context assembly flow.
tool role turn with the result content. This lets the full reasoning chain — including what the agent searched and found — be replayed from history.thr_01abc123; turns by IDs like trn_07xyz456.The API endpoints, field names, and IDs all use turn terminology. Sending a message_id where a turn_id is expected will produce a 404. Check the conversations API for exact parameter names.
For the full conversations API — listing turns, paginating threads, and posting new turns — see Conversations API.