Artifact 0b80e2ca1c0228776df4bb4e723d500dec66e3df2df0a7019acf257fe2b2d5f8:
- File docs/manual/sessions.md — part of check-in [9e408ec0ef] at 2026-11-24 12:43:12 on branch pic-folder — Self-ignoring .pic, 0600 journal files, dotfiles warning (user: dmestas, size: 8571) [annotate] [blame] [check-ins using] [more...]
Sessions
A session is a conversation in the workspace's journal, WORKSPACE/.pic/journal.sqlite. pic
sessions lists them, pic log [ID] shows one's entries, pic name ID NAME names one, and -c or
--session ID continues one in ask, chat, tui and RPC mode.
A conversation's title is its name, or until it has one, the first line of its first prompt. The
same title shows in pic sessions, the terminal's /resume, its footer and the top right of its
prompt box, a paired phone's list and its notifications, so a conversation is called the same
everywhere. /name in the terminal names it.
The .pic folder
WORKSPACE/.pic/ holds the journal and keeps itself out of version control: pic writes
.pic/.gitignore containing * when it is missing, so git add -A adds nothing from it. Your own
ignore files are never touched. The journal and its -wal and -shm files are readable by you
alone (mode 0600), and a journal an earlier pic made is tightened the next time it is opened.
Fossil and zit read only project-level ignore settings, not .gitignore, and skip names beginning
with a dot unless their dotfiles setting is on. When the workspace is a checkout of either with
dotfiles on and no ignore rule covering .pic, pic says so once, the first time it writes
.pic/.gitignore, with the line to add: .pic/* in .fossil-settings/ignore-glob or
.zit-settings/ignore-glob. pic doctor says so whenever it is the case.
Several pics in one project
More than one pic can work in a project at the same time, each in its own conversation. While one
runs a long task, start another in a second terminal: pic ask a side question (a new
conversation), continue a different conversation with --session ID, or look at the running one
with pic sessions, pic log ID and pic dump. pic sessions marks a conversation another pic is
working (in use by pid N).
A conversation is worked by one pic at a time. Asking into one that another pic is working is refused:
pic: conversation ab12cd34 is in use by another pic process (pid 4711)
pic cancel KEY is refused the same way while the request's own pic runs it; press Ctrl-C there
(or send that pid SIGINT). pic run finishes the requests nobody is running and says which it left
to their owners. -c continues the conversation changed most recently, which may be the one the
other pic is working; name yours with --session ID.
If a pic is killed, its conversation is free again as soon as its running command has been stopped. The next pic to open the journal settles what it left (durability); nothing another pic is doing is touched.
Two conversations can change the same file. pic does not merge their work; tools says what an edit or write that meets the other's change is told. Upgrading pic to a version with a new journal format needs the other pics in that project closed first; pic says so and changes nothing until they are.
Deleting
Deleting a conversation hides it from every list (pic sessions, /resume, -c, a paired
phone) and is undone as easily:
- In
/resume,d(or Delete, or Backspace) deletes the selected conversation, andubrings it back while the picker is open. Space marks several;dthen deletes the marked ones together. /deletedeletes the conversation you are in (your next message starts a new one),/delete IDor/delete NAMEanother./restorebrings back the one deleted last,/restore IDthat one, and/trashlists the deleted ones: Enter restores one.pic sessions delete ID|NAME...,pic sessions restore [ID|NAME]andpic sessions trashdo the same in a shell.- On a paired phone, swipe a conversation left or open its … menu and choose Delete; Undo is on the notice that follows.
A conversation that is running, here or in another pic, cannot be deleted until it stops: pic says so and changes nothing. A request cannot be sent to a deleted conversation; restore it first.
Thirty days after it was deleted, a conversation is purged for good: its prompts, replies, tool
calls and their output, and its name are removed from the journal. pic sessions empty-trash
purges every deleted one now. What it cost still counts in pic usage. A fork of a deleted
conversation keeps the messages it shares with it; they go once the fork is deleted too. Copies
made elsewhere before, such as an export or what ctx has archived, are not touched.
Forking
To go back to an earlier message and also put files back, use rewind.
/fork with no argument opens Pi's "Fork from Message" picker of your earlier messages: Enter
forks the path before the chosen message into a new conversation and puts that message in the
editor. /fork ENTRY forks after an entry (see pic log). On the command line, pic fork ID --at
ENTRY does the same.
Compaction and branch summaries
Compaction and branch summaries take Pi's settings, in Pi's settings.json shape (pic settings
compaction '{"reserveTokens":16384,"keepRecentTokens":20000}'): compaction.enabled (default true;
off stops automatic compaction, overflow recovery included, as in Pi, but not pic compact;
/settings Auto-compact and the RPC command set_auto_compaction set it),
compaction.reserveTokens, compaction.keepRecentTokens,
compaction.modelOverrides["provider/model"], branchSummary.reserveTokens and
branchSummary.skipPrompt. Leaving a branch in /tree asks Pi's "Summarize branch?"; a summary
(pic fork ID --at ENTRY --summarize) is a journaled, priced request, and the new conversation
starts with Pi's branch_summary entry.
The defaults are in settings. pic compact [ID [INSTRUCTIONS]] and
/compact [FOCUS] compact before the next request.
Compacting a conversation you come back to
The provider keeps a conversation's prompt cached for a while (five minutes by default, an hour
with cacheRetention long). Come back later and the next request pays to send the whole
conversation again, so pic compacts it first when it is above 100000 tokens, which costs less: in
a replay of 28 real long sessions it cut the cost of the next three requests by 38% with about the
same results. --lapse off (setting lapseCompaction) turns this off; --lapse-floor sets the
size and --lapse-seconds the cache lifetime pic assumes. Details are in benchmarks.
Only the first request after you send a message counts as coming back: a slow tool call in the middle of a reply never compacts it.
By default such a compaction makes no summary: pic keeps the newest messages, about
compaction.keepRecentTokens (20000) tokens of them as the provider counts tokens, and drops
everything older, so it costs no request at all. (pic estimates a token as four characters, which
undercounts code; it corrects the estimate with the token count the provider reported for the
conversation's last reply.) It cuts where one of your messages begins (inside one long task, where a
reply begins), so a tool call always stays with its result, and the files read and modified are
still listed. A SessionStart hook then runs with source compact, so a tool such as ctx can bring
back what matters from the dropped part. Set lapseMode to summary for Pi's summary instead.
To show what this saves rather than estimate it, pic leaves one such return in ten uncompacted, at
random (setting lapseHoldout, from 0 to 1; 0 never holds one out). pic usage --lapse compares
the cost from each return to the next one in that conversation, compacted against held out, for
each mode in turn (a return held out counts for the mode pic would have compacted in):
cold caches: 41 compacted, 5 held out, 12 under the floor
trim: 41 compacted, 5 held out
cost from each to the next in its session: compacted $0.9120 on average, held out $1.4740
compacted / held out: 0.62 (95% interval 0.48 to 0.81)
saved: $23.04 over 41 compactions (95% interval $11.20 to $31.90)
It says "not enough to compare yet" until each side has five. Because the held-out returns are
chosen at random, the comparison is fair, but it is only as sure as its interval: with few
held-out returns the interval is wide, and a raised lapseHoldout narrows it sooner at the price
of fewer compactions.
Exporting
pic export --html ID writes a conversation as one self-contained HTML page, pic export --pi
writes conversations as Pi session lines, and pic import PATH reads a Pi session back as a new
conversation.