docs/06-sessions.md

06 — Sessions

The state model. Every interaction with the agent is a session. Sessions persist, resume, fork, and replay. The CLI and the Mac app read the same session store on this Mac. Attach to a running Mac thread from the terminal. Optional account sync lets you read a session on another device and continue it there as a new session. Branch a session to explore an alternate approach. Replay sessions as a debugging tool or for sharing with teammates.

Session model

A session (a *thread* in the Mac app) is one conversation with the agent in one folder, stored as an event log. picasso list and picasso search <query> find sessions; picasso resume [id], picasso -c and picasso --resume <id> reopen one with its full history; picasso fork [id] branches one; picasso replay <id> prints its events as JSON lines; picasso share [id] writes or revokes a redacted share file. In the TUI: /sessions, /continue, /search, /fork, /undo, /rewind [files|chat|both] [turn], /replay, /share, /export.

Inbox zero and archive

Threads group by what they need from you: Needs you (an approval or a question is waiting), Working (a turn is running) and Settled (folded by default). Mac sidebar rows carry a badge (Approval, Input, Done, Working Nm, or the age). The TUI resume picker groups the same way, with a Recent group between Working and Settled.

Archive is one click with Undo: ⌘⌫ archives and ⌘Z brings it back, ⌥⌘⌫ deletes, on the Mac; e archives and u undoes in the TUI picker. The thread header shows a "project / title" breadcrumb; clicking the project opens Threads narrowed to it ("Show all projects" clears it).

The librarian

Threads started without a project are filed into the right project after their first turns by one subagent, the librarian. It has its own daily token budget (when spent it waits until local midnight), can be paused, and can be asked to look at every thread without a project. It shows what it will look at next and what it filed recently.

SurfaceHow
MacThe Librarian page (sidebar or ⌘K): Pause, Look at everything, Next / Recent.
TUI`/librarian [pause \resume \look-all \budget <tokens>]`
CLI`picasso librarian status\pause\resume\look-all\budget <tokens> [--json] (for example picasso librarian budget 300k`)

The librarian runs inside a running engine (the Mac app or an open TUI); the CLI commands read and change its shared state.

My Work

My Work lists the files your sessions made or presented, newest first, and starts a similar one ("Make another like this: <name>").

Context timeline

What entered a thread's context, turn by turn: the additions each turn made, compaction, per-step cache hit or miss, and subagent lanes. It reads the session log only (no engine start, no model call); missing data reads "No usage reported" or "Size not recorded" rather than a guess.

Pull request wake-ups

picasso pr watch <pr> (a number, owner/repo#N or a URL) watches a pull request for a session; one combined update wakes the thread when checks finish, a review arrives or the branch conflicts. picasso pr status lists what a session watches. In the TUI, /pr watch <n> and /pr unwatch <n>.

Keeping threads running

With Settings › General › "Keep threads running when Picasso quits" (Mac, off by default) or picasso service install (CLI, macOS), a resident runner (a LaunchAgent) keeps running turns and schedules going after the app or terminal closes. It restarts only at a quiet moment and refuses to start, saying why in Settings › General, when a plugin or identity check fails. picasso service status shows its pid and engine version; picasso service uninstall removes it. Schedules are described in 09-hooks-and-commands.md.

Importing history

picasso import [claude|codex|opencode|all] [--dry-run] [--status] [--json], /import and Settings › Import bring past Claude Code, Codex and OpenCode sessions in as read-only threads. See history-import.md.

Shared on one Mac

Attach to a running Mac thread

While Picasso for Mac is running, picasso attach --mac reads the discovery file ~/.picasso/run/mac-helper.json (0600) and joins a running thread over the app's loopback relay: it streams the thread's events, sends prompts, cancels, and answers approvals and questions. The file carries a per-launch local-attach token that works only from loopback and only on the thread and interaction routes; it cannot create threads or grant "always allow". Turning off Settings › Engine › "Allow terminal attach" in the Mac app stops the file from being written. Nothing is synthesized when the app is not running: the command says so and exits. See docs/mac-relay.md §2b–2c.

Optional account sync

Runtime note

The Picasso session store persists LoopEvent-derived session events from the engine adapter, and the Picasso session id is the engine's session id. See architecture.