Sessions and Resume
A session is a recoverable event and message log, not a process snapshot. CodeN persists system, user, assistant, and tool messages plus required state in JSONL. Resume rebuilds context and repairs interrupted tool calls that lack results with explicit errors, so the model sees the real incomplete state.
Sessions
Section titled “Sessions”Session identity and location
Section titled “Session identity and location”- A session ID is a UUID referenced via
--resume <session-id>; it must match[A-Za-z0-9][A-Za-z0-9._-]{0,127}. - Files live under
$XDG_DATA_HOME/coden/sessions/<workspace-hash>/:<id>.jsonl(session records) and<id>.trace.jsonl(runtime event trace). - Directories are
0700and files0600; sessions and traces may contain reasoning content and sensitive input — do not share them without review.
Recorded content
Section titled “Recorded content”| Record type | Data |
|---|---|
session.created |
workspace and session ID |
message |
every system/user/assistant/tool message |
tool.call.updated |
hook-updated tool input |
context.compacted |
compaction summary and source range |
session.title |
explicit title |
session.thinking |
thinking level (turn-start snapshot) |
session.reset |
/new reset marker |
The first non-hook user message becomes the session title automatically; after /new, the title is reset to the next first message.
Resuming
Section titled “Resuming”coden --resume # list sessions for the current workspacecoden --resume <session-id> # resume a specific session- Resume rebuilds system messages (fresh system prompt, tool catalog, and skill name list), restores message history, the compaction summary and range, and the last saved thinking level.
- Trailing unfinished tool calls are repaired as
runtime.interrupted: tool execution did not complete...errors with a recorded warning. - Corrupt mid-file records raise a per-line error; only an incomplete final line is ignored with a warning.
- Thinking-level resolution on resume: explicit
--thinking> saved session value > user/project config > default; an explicit override is written back to the session.
Listing output
Section titled “Listing output”<id> <title> (<N> messages, YYYY-MM-DD HH:MM)- Sorted by last activity, newest first; untitled sessions show
(no title); trace files are excluded. - The listing carries no token usage or other account information.
Related references
Section titled “Related references”Session Storage
Section titled “Session Storage”Location
Section titled “Location”$XDG_DATA_HOME/coden/sessions/<workspace-hash>/├── <session-id>.jsonl # session records└── <session-id>.trace.jsonl # runtime event trace- Default
~/.local/share/coden;XDG_DATA_HOMErelocates everything. - Directories are
0700and files0600; sessions are partitioned by workspace hash (the same path shares a directory across processes). - Session IDs are UUIDs matching
[A-Za-z0-9][A-Za-z0-9._-]{0,127}.
JSONL records
Section titled “JSONL records”One record per line:
{"version":1,"id":"…","timestamp":"2026-08-31T12:00:00.000Z","type":"message","data":{"role":"user","content":"…"}}Record types and resume semantics are covered in Sessions. Immutable during recovery: message structure checks (isMessage), and tool-call update uniqueness (tool.call.updated must match exactly one assistant toolCalls).
Resume validation
Section titled “Resume validation”- Parsed line by line; an invalid non-final record throws (with the line number), and only an incomplete final line is ignored with a warning.
- Trailing unfinished tool calls are repaired automatically:
runtime.interrupted: tool execution did not complete before the previous process exited. - After a successful recover the store is created, and later messages append to the same file.
Backup and cleanup
Section titled “Backup and cleanup”| Operation | Conclusion |
|---|---|
| backup | copy <id>.jsonl and <id>.trace.jsonl; preserve permissions (0600) |
| delete | removing both files clears the session; there are no other indexes |
| migrate | after changing XDG_DATA_HOME, all sessions/traces/global plugins follow the new directory |
Sensitivity
Section titled “Sensitivity”Session files may contain model reasoning, redacted-thinking, signatures, user input, and code fragments. Do not commit, share, or distribute them without review; keep local private permissions.