Sessions

Name, resume, inspect, prune, fork, compact, and export transcripts.

Every turn is appended to a JSONL transcript under $ZOT_HOME. Resume the last session with -c, pick one with -r, or browse them all from /sessions. Jump between past turns with /jump without editing history. Run /session to open the session actions picker.

Free up context without losing the thread with /compact, which summarizes the transcript into a single message and keeps the last few exchanges verbatim. In interactive mode, zot also auto-compacts when context usage reaches the threshold selected under /settings: off, 70%, 80%, 85% (default), or 90% of the model's advertised context window. Turning the threshold off disables percentage-based compaction, but manual /compact and automatic recovery from payload-too-large responses remain available.

For locally executed interactive sessions, the status bar shows compactions: N after a successful compaction. It counts manual and automatic compactions since the latest user request began, including pre-request compaction and context-overflow recovery. The count remains visible after the response finishes and resets when the next request starts. Queued input resets it only when it enters the conversation. Failed or cancelled compactions do not increment it. Zero is hidden. The count is display-only, is not restored from saved sessions, and is not currently synchronized to attached continuous-host views.

For work that should survive client detachment or recover after interruption, use Continuous execution. An attached zot --continuous TUI reads committed host history instead of persisting a local session. Continuous import and export bridge session transcripts, but exported transcripts are not full store backups.

Compaction mode

Merge compaction_mode into $ZOT_HOME/config.json, then restart zot:

$ZOT_HOME/config.json
{
  "compaction_mode": "in_place"
}
  • side (default) sends the transcript as text to a separate summarization request with its own system prompt and no tools. Missing or empty values keep this existing behavior.
  • in_place uses the active model, system prompt, tool definitions, reasoning settings, and structured message prefix, then appends a summary instruction. When recent messages are kept verbatim, only the older prefix is sent for summarization.

In-place mode makes provider prompt-cache reuse possible, but cache hits and speedups depend on the provider. Context-window or payload-size rejection retries once with the side request. If the model requests a tool instead of completing the summary, zot retries in place once with a stronger "No tools now. Just summarize." instruction. If the retry also requests tools, zot falls back to the tool-free side request. This recovery is bounded to two in-place attempts and one side request. The side fallback can still fail, including if it is too large.

Cancellation, authentication errors, and request-transform failures do not trigger recovery. Failed attempts do not replace history, and failed tool-call responses are not included in retries. History is replaced only after a summary succeeds.

Automatic tool-call recovery requires a zot build containing commit 1d75884. Older builds fail compaction on an unexpected tool call.

Zot does not execute local tools during summarization, regardless of remaining context headroom. Provider-hosted tools remain advertised in in-place mode and may run remotely despite the no-tools instruction. Use side mode to avoid advertising them.

Both modes support the custom instructions below and apply to manual, automatic, and continuous-host compaction. In-place mode uses the active model, not a separately configured compaction model. The mode is a startup configuration option, not a live /settings toggle, CLI flag, or per-request RPC field. Direct core integrations can set Agent.CompactionMode to "side" or "in_place" before use. Use a zot build that includes optional in-place compaction.

Compaction instructions

Create $ZOT_HOME/COMPACT.md to replace the built-in summary template for manual and automatic summaries. The file controls the summary's content and format. For per-run additions, use the repeatable flag:

shell
zot --append-compaction-prompt "Reference Markdown documents by path instead of repeating their contents."

For example:

$ZOT_HOME/COMPACT.md
Summarize the conversation as a concise handoff for another coding assistant.
Use sections for current work, completed changes, unresolved issues, key decisions,
and next steps.
Reference existing Markdown documents by exact path instead of repeating their
contents. Preserve essential context that is not recorded in those documents.

A nonblank COMPACT.md replaces the built-in summary template in both modes. Flag values are appended to the selected template in command-line order. In side mode, the separate summarization system prompt requires summarizing rather than continuing the conversation, without imposing the built-in format on custom templates. SYSTEM.md, ordinary system-prompt flags, and AGENTS.md do not configure that separate system prompt. In-place mode retains the active system prompt, including its normal overrides and loaded instructions, and puts the summary-only requirement in the final instruction.

Missing or blank files retain the built-in template. Other file-read failures stop startup with an error. Instructions are loaded when the agent is configured, so restart zot after editing the file. They also apply to resumed sessions but are not stored as session settings. Without custom instructions, compaction behavior is unchanged.

The summarizer cannot execute local tools in either mode. It cannot open local referenced files or verify that they contain enough information to resume work. Keep essential context in the summary even when referencing documents.

Continuous hosts use the same configured guidance, followed by any per-request conversation.compact instructions. The Go SDK exposes Config.AppendCompactionPrompt. Direct core users can set Agent.CompactionPrompt to replace the template and Agent.CompactionInstructions to append guidance before use.

Readable session names

New sessions in the local store receive readable aliases such as chatty-lake. Use -s NAME or --session-name NAME to create a session with a chosen alias or resume it if it already exists:

shell
zot -s my_session                      # create or resume in this directory
zot --session-name my_session          # the same lookup
zot --cwd ~/project -s release-review  # use another working directory

Aliases are case-insensitive and normalized to lowercase. They must start with an ASCII letter or digit and contain 1 to 64 ASCII letters, digits, hyphens, or underscores. Uniqueness is scoped to the working directory and named-agent session namespace, not every project on the machine.

/sessions shows the alias beside the title or first prompt. Pressing r edits the display title, not the lookup alias. UUIDs remain the internal session identity. Forks and imports receive fresh aliases, while existing transcripts remain readable without migration. --session PATH still selects a file by path and does not automatically assign an alias. Empty sessions, including explicitly named ones, are removed on close.

A second writer to an aliased transcript is rejected, whether it opens the session by name, path, or the picker. Locks are released on close or process exit, including a crash. Small .lock sidecar files intentionally remain on disk. Do not remove them while zot is running. These locks coordinate cooperating current zot processes on local filesystems, not external editors or older binaries. Read-only inspection and export remain available while a session is running.

--session-name conflicts with --session, --continue, --resume, and --no-session. The flag is not supported in RPC mode or continuous execution, whose conversations use a separate title API.

Start a fresh session

Run /new to persist the current conversation and start an empty session without exiting zot. It keeps the same working directory, provider, model, tools, extensions, jail state, and other runtime configuration. It does not make a model call. The previous conversation remains available through /sessions.

If a turn is active, /new cancels it before rotating sessions. It also resets transcript usage, queued prompts, session-scoped tool approvals, and pinned-skill preparation. Background agents stay running, while /swarm switches to the new session's scope.

/new requires session persistence. With --no-session, it is hidden from autocomplete and /help. Typing it directly reports that sessions are disabled. You can bind a shortcut such as alt+n to /new under TUI settings, leaving ctrl+n available for an optional navigation binding.

Clear context and pinned skills

/clear empties the active in-memory conversation without creating a new session. It also prepares your project and global pins for the next message, without starting a model turn. Use /new instead when you want to preserve the current conversation as a distinct entry in /sessions. Fresh sessions prepare pins too. Continuing, resuming, importing, or branching an existing session does not reload them. /compact summarizes existing context and preserves the original pinned instructions if the session has a saved snapshot. It does not reload pins. See Skills for availability, scope, and supported modes.

Prune stored sessions

Run zot sessions prune outside the TUI to find stored sessions whose recorded working directories no longer exist. zot groups them by directory, shows the session count and human-readable stored size in binary units such as KiB and MiB, lets you select entries such as 1,3-5, and asks before permanently deleting anything. This command does not initialize a model or require provider credentials.

Add --older-than AGE to select sessions by time since their last activity, including sessions for directories that still exist. Supported units are m (minutes), h (hours), d (24-hour days), w (7-day weeks), mo (calendar months), and y (calendar years). Use --cwd PATH with --older-than to restrict matches to one working directory. zot rechecks each selected session immediately before deletion and preserves it if it became active recently.

shell
zot sessions prune --dry-run                         # list missing-directory groups
zot sessions prune --older-than 4h --dry-run         # inspect sessions inactive for four hours
zot sessions prune --older-than 1mo --cwd ~/project  # select old sessions for one directory
zot sessions prune --older-than 1y --all              # select every match, then confirm
zot sessions prune --older-than 30d --all --yes       # delete every match without prompting

Fail-closed cleanup

For missing-directory pruning, permission failures, malformed or symlinked session entries, non-absolute working directories, and filesystem errors other than not found are reported and preserved. A deleted directory and a path hidden by some unmounted filesystems are indistinguishable, so review the selection and ensure remote filesystems are mounted before deleting. --all still asks for confirmation; --yes skips it and requires --all. The scan includes normal and named-agent sessions below $ZOT_HOME/sessions/, but not explicit session files stored elsewhere or swarm-agent state.

Timeline

Choose timeline from the /session picker, or run /session timeline directly, to replace the chat area with a read-only view of the current system prompt, user and assistant messages, and tool calls. It does not modify the transcript.

The header shows the latest provider-reported context usage and an estimated composition for the system prompt, tool definitions, and messages. Composition uses a simple byte estimate and is directional rather than tokenizer-exact. Actual usage can remain zero until the provider reports usage for a completed turn.

KeyAction
[[up]] / [[down]]Select the previous or next event.
[[pgup]] / [[pgdn]]Move through the timeline eight events at a time.
[[tab]] / [[shift+tab]]Switch between summary, payload, result, schema, and timing details.
[[/]]Search event labels, summaries, payloads, and results.
[[ctrl+e]]Export the timeline as private-permission JSON to ~/Downloads, falling back to the home directory.
[[esc]]Clear an active search or return to chat.

Timing and export details

Timing is derived from transcript timestamps, so events without recorded timestamps show timing as unavailable. JSON exports include event payloads, tool results, schemas, context usage, and export time. Images are represented by MIME type and byte size; their raw data is not embedded.

Session actions

Type /session, then a space, to autocomplete each action and see its description.

  • /session timeline inspects context composition, messages, tool calls, and their recorded details.
  • /session export writes the transcript to a portable .zotsession file.
  • /session import pulls one back in as a first-class resumable session.
  • /session fork branches from any past user message into a new session.
  • /session tree shows every branch in this directory and lets you switch into any of them.

Export covers only the main chat thread. /swarm subagents are not bundled: their per-agent state lives in a unix-socket inbox and a session file on disk, neither of which round-trips through a JSONL file.