Skip to content

sessions

kolega-code sessions manages the local session records that the TUI and ask --save create. Sessions hold the conversation history, the project they belong to, and the model configuration in use.

Terminal window
kolega-code sessions <list|delete|export> [options]

See Settings & API Keys for where session files are stored, and Sessions & Resuming for how resuming works in the TUI.

List saved sessions, optionally filtered to one project.

Terminal window
kolega-code sessions list --project .
Option Description
--project <PATH> Only show sessions for this project
--state-dir <PATH> Directory for CLI session state

Each saved session is shown as a labeled block:

Updated: 2026-07-19T10:00:00+00:00
Title: Improve session listing
Mode: code
Project: /path/to/project
Resume ID: 0123456789abcdef0123456789abcdef

Sessions are ordered from oldest to newest, so the most recently updated session and its Resume ID appear nearest the shell prompt. Pass that Resume ID to --resume, sessions delete, or sessions export.

Delete a session by ID.

Terminal window
kolega-code sessions delete <session_id>
Argument / option Description
session_id The Resume ID shown by sessions list (required)
--state-dir <PATH> Directory for CLI session state

Export a session to stdout or a file, in one of two formats.

Terminal window
kolega-code sessions export <session_id> # replay JSON (default)
kolega-code sessions export <session_id> --output run.json
kolega-code sessions export <session_id> --format events-jsonl # semantic event log
kolega-code sessions export <session_id> --format atif --output trajectory.json
Argument / option Description
session_id The Resume ID shown by sessions list (required)
--format <json|events-jsonl|atif> json (default): effective-history replay snapshot. events-jsonl: the canonical public semantic event log. atif: a validated ATIF v1.7 trajectory
--output <PATH> Write the export to a file instead of stdout
--state-dir <PATH> Directory for CLI session state

The default json format includes the session metadata, model configuration summary, and full effective message history (superseded context epochs and rewound turns are omitted) — handy for archiving, debugging, or analysis.

events-jsonl emits one v2 event envelope per line — the same records, ids, and sequence numbers ask --json streams live (see JSON output). It is the complete auditable trajectory: turns, LLM responses with call ids, tool calls/results correlated by canonical id, subagent lineage, compactions, rewinds, and terminal records. Sessions recorded by older Kolega versions export with deterministic fallbacks (derived root agent identity); facts those sessions never captured are not invented. Secrets are scrubbed and provider-opaque replay state is excluded in both formats’ event output.

atif converts the same events into an ATIF v1.7 trajectory document, validated before anything is written. One source: agent step per LLM inference (with per-step token metrics), tool results attached as observations on the step that made the call, compactions and rewinds preserved as auditable system steps, and subagents embedded as complete subagent_trajectories referenced from their dispatch call. Oversized tool results are fully hydrated into the document. If the trajectory contains images, stdout export refuses and asks for --output; file export writes assets to <output-stem>.assets/ with relative paths, atomically. Legacy (v1) sessions convert with explicit conversion_warnings in the document’s extra. ask --atif-output FILE writes the same document directly at the end of a run — completed, failed, or cancelled, with or without --save.