Extension

dodorz/zot-session-namer

summarize the session and give it a readable, structured title

extension

Install from GitHub and zot copies the extension into $ZOT_HOME/extensions/. Git-installed extensions update with zot update.

shell
zot ext install https://github.com/dodorz/zot-session-namer
repository
dodorz/zot-session-namer
author
dodorz
stars
0
forks
0
open issues
0
language
Python
license
MIT
topics
zot-extension
created
Dec 1, 2026
updated
Dec 1, 2026

Security note: zot extensions can execute code. Review the source before installing third-party extensions.

Readme

zot-session-namer

License: MIT ci Python 3.9+ zot extension

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密钥密码反复询问|排查中

Why

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.

Features

  • Automatic naming after the first reply and then every checkEveryTurns user 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: /name refreshes now, /name <title> sets it verbatim, and the rename_session tool 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-tools call, 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.

Install

Requires zot and Python 3.9+ (standard library only).

git clone https://github.com/dodorz/zot-session-namer.git
zot ext install ./zot-session-namer

Restart zot. /sessions should now show generated titles.

To try it without installing:

zot --ext ./zot-session-namer

To uninstall:

zot ext remove session-namer

Usage

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”.

Configuration

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.

How it works

  1. The extension subscribes to session_start, user_prompt_submit, assistant_message, tool_call, turn_start, and turn_end.

  2. It keeps a bounded digest of the session: the opening request, recent user/assistant text, and the names of tools that were used.

  3. When a title is due (first turn, or checkEveryTurns new 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=1 so the extension does not recurse. The model is asked for {"type": ..., "topic": ..., "progress": ...} as strict JSON.

  4. The result is composed with nameFormat and stored as one {"type":"rename","explicit":true,...} record in the session JSONL — the same record zot writes when you press r in /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) and shutdown, 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.

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 existing sessions

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 title

Empty 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.

Requirements and limitations

  • zot 0.4.x with extension protocol v1 (events and session_alias).
  • Python 3.9+, standard library only.
  • A generated title appears in /sessions once 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) before session_end loses a queued title; run backfill.py afterwards 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 PATH outside $ZOT_HOME/sessions/ are found through ZOT_SESSION_FILE when the host exposes it.
  • The running TUI header does not display session titles; the generated name is shown as a note and in /sessions after 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.

Troubleshooting

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 /sessions while 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; auto uses the language of your user messages.
  • Slow naming: the nested model call is a normal completion; lower timeoutSeconds, point model at a cheaper/faster model, or raise checkEveryTurns.

License

MIT — see LICENSE.