Automatic, content-aware session titles for the zot
coding agent, in the style of pi's session-namer.
Instead of a session being remembered by its first prompt, it gets a name that tells you at a glance what it was about:
2026-12-01|Fix|SSH密钥密码反复询问|排查中
2026-12-01|Feature|zot会话自动命名扩展|已完成
2026-12-01|Research|pgvector vs sqlite-vec|结论待定
zot's session picker (/sessions) shows it right after the alias:
[test-rename] 2026-12-01|Fix|SSH密钥密码反复询问|排查中
zot already gives every session a stable alias (chatty-lake) and falls back to
the first user prompt as a title. After a long session that first prompt no
longer describes the work: you debugged for two hours, but the picker still says
"hi". This extension summarizes the conversation and keeps a structured title up
to date.
- Automatic naming after the first reply and then every
checkEveryTurnsuser turns (default 4). Titles are persisted when the session ends — the extension leaves a running session's journal alone (see below). - Structured format out of the box — date, type, topic, progress — fully configurable.
- Language aware:
nameLanguage: "auto"follows the language you write in. The type stays in the configured English vocabulary. - Manual overrides:
/namerefreshes now,/name <title>sets it verbatim, and therename_sessiontool lets the agent rename it when you ask. - Respects you: once a session has a title you wrote yourself, automatic renaming stops for that session.
- Resume-safe: resumed sessions are re-seeded from the transcript, so titles stay coherent across restarts.
- Provider-agnostic: summarization runs as a nested
zot -p --no-session --no-toolscall, reusing your existing zot credentials, provider, and model. No extra API key, no provider-specific code. - Never blocks the UI: model calls run off the event loop; if the call fails or times out, a heuristic title built from the opening request is used.
Requires zot and Python 3.9+ (standard library only).
git clone https://github.com/dodorz/zot-session-namer.git
zot ext install ./zot-session-namerRestart zot. /sessions should now show generated titles.
To try it without installing:
zot --ext ./zot-session-namerTo uninstall:
zot ext remove session-namer| Command | Effect |
|---|---|
/name |
Summarize the current session and rename it now. |
/name <title> |
Set that title verbatim, without a model call. |
/sessions → r |
zot's built-in rename; it also disables auto-naming here. |
tool rename_session |
The agent can rename the session, e.g. when you ask “name this session”. |
session-namer.json lives next to extension.json (the file installed by
zot ext install). If it is missing, the extension falls back to
~/.pi/agent/session-namer.json, so zot and pi can share one naming style.
{
"model": "inherit",
"thinkingLevel": "inherit",
"timeZone": "auto",
"checkEveryTurns": 4,
"nameFormat": "{date}|{type}|{topic}|{progress}",
"types": ["Feature", "Design", "Fix", "Optimization", "Release",
"Exploration", "Documentation", "Research"],
"nameLanguage": "auto",
"nameOnFirstTurn": true,
"maxTranscriptChars": 8000,
"timeoutSeconds": 90,
"notifyOnRename": true
}| key | default | meaning |
|---|---|---|
model |
"inherit" |
"inherit" uses the host provider/model; otherwise model-id or provider/model-id. |
thinkingLevel |
"inherit" |
"inherit" or a zot reasoning level (off, low, high, …). |
timeZone |
"auto" |
IANA zone for {date}, or auto for local time. |
checkEveryTurns |
4 |
Refresh the title after this many new user turns. |
nameFormat |
{date}|{type}|{topic}|{progress} |
Template with {date}, {type}, {topic}, {progress}. |
types |
8 values | Allowed {type} vocabulary; the model must pick one. |
nameLanguage |
"auto" |
auto follows your messages; or Chinese, English, … |
nameOnFirstTurn |
true |
Name the session right after the first reply. |
maxTranscriptChars |
8000 |
Digest budget sent to the summarizer. |
timeoutSeconds |
90 |
Budget for the nested zot -p call. |
notifyOnRename |
true |
Show session name → … in the notes area. |
A terser style is equally valid:
{ "nameFormat": "{type}: {topic} ({progress})" }Generated titles are capped at zot's 120-character title limit; control
characters and the | separator inside fields are normalized.
-
The extension subscribes to
session_start,user_prompt_submit,assistant_message,tool_call,turn_start, andturn_end. -
It keeps a bounded digest of the session: the opening request, recent user/assistant text, and the names of tools that were used.
-
When a title is due (first turn, or
checkEveryTurnsnew turns), it runs:zot -p --no-session --no-tools --system-prompt <naming rules> \ --provider <host provider> --model <host model>
The child process is marked with
ZOT_SESSION_NAMER_DISABLE=1so the extension does not recurse. The model is asked for{"type": ..., "topic": ..., "progress": ...}as strict JSON. -
The result is composed with
nameFormatand stored as one{"type":"rename","explicit":true,...}record in the session JSONL — the same record zot writes when you pressrin/sessions.When it is written matters. zot keeps its own write offset for the session journal and appends without
O_APPEND. A record written by another process while zot still owns the file is overwritten by zot's next record, and if that record is shorter it can leave a corrupt partial line. So:- While a live zot has the file open, the title is queued and the note
says
session name → … (saved on exit). - On
session_end(exit,/new,/clear, switching sessions) andshutdown, the queued title is appended, verified, and retried. The record is then the last line in the journal and survives. - Sessions not held open by any zot process (for example via
backfill.py) are renamed immediately.
- While a live zot has the file open, the title is queued and the note
says
The extension never reads credentials itself and never rewrites the session file; it only appends complete lines, and only when the host is done writing.
backfill.py applies the same naming logic to every session already on disk:
./backfill.py --dry-run # preview titles, write nothing
./backfill.py # name every non-empty session
./backfill.py --alias tidy-birch --force # one session, overwrite its titleEmpty sessions and titles you set yourself are skipped unless --force is
used. Sessions currently open in a running zot are skipped (on Linux the
script checks /proc), because a title written now would be overwritten by
zot's next message. Close those sessions, then rerun the script; --allow-open
forces a write but is unsafe for the reason above.
- zot 0.4.x with extension protocol v1 (events and
session_alias). - Python 3.9+, standard library only.
- A generated title appears in
/sessionsonce the session ends: zot 0.4.x has no extension frame for renaming, and an external append to a live journal is overwritten by the host (and may corrupt a partial line). While the session runs, the title is shown as a note and queued. - A hard crash (
SIGKILL) beforesession_endloses a queued title; runbackfill.pyafterwards if you want it back. - Sessions started with
--no-session, RPC sessions, and continuous host conversations have no named transcript file, so renaming is skipped there. - Sessions opened with
--session PATHoutside$ZOT_HOME/sessions/are found throughZOT_SESSION_FILEwhen the host exposes it. - The running TUI header does not display session titles; the generated name is
shown as a note and in
/sessionsafter the session closes. - Current zot has no extension frame for renaming a session, hence the
append-a-rename-record approach. If such a frame is added, it is a one-line
change in
apply_title.
zot ext logs session-namer -f # stderr of the extension- Nothing happens: confirm the extension is enabled with
zot ext list; restart zot after installing. - The title is not in
/sessionswhile the session is running: expected; it is queued until the session ends. The note already shows the name. - “no persisted session file”: the session runs with
--no-session, or the host did not expose an alias/path. - Titles are English while I write Chinese: check
nameLanguage;autouses the language of your user messages. - Slow naming: the nested model call is a normal completion; lower
timeoutSeconds, pointmodelat a cheaper/faster model, or raisecheckEveryTurns.
MIT — see LICENSE.