Expand description
Session titles (W031): a bounded, one-shot titler and its sanitiser.
A session’s title is the semantic name a human finds it by — a short
phrase (“fix flaky retry backoff”) that beats the opaque {millis}_{uuid8}
file id and the first user line. It lives in the transcript, not the file
name: crate::session::SessionEntry::Title, last write wins, read back by
crate::session::Session::title.
§Who calls this module (and who reads it)
crate::loop_— the auto-trigger (W031 D1, block-inline): at the turn boundary immediately afterAgentEvent::TurnEndis sent, when the session has noTitleentry yet andtitle_after_turnsassistant turns exist (D2), and at most once per run (the latch). It appends the entry through its own&mut Sessionand streamsAgentEvent::SessionTitle.- The CLI’s
config.rsreadsDEFAULT_TITLE_AFTER_TURNSto resolve[session] title_after_turns, andmain.rsreadsCOMPACTION_SUMMARY_PREFIX(re-exported frommessage) to keep the--resumepicker from printing a compaction summary as a first user line. - NOTHING calls
generateto rename explicitly:/renameand--titlego straight toAgent::set_titleand never touch a model.
So this module is a public surface with two external readers plus the loop — it is not private to the loop.
Re-exports§
pub use crate::message::COMPACTION_SUMMARY_PREFIX;
Constants§
- DEFAULT_
TITLE_ AFTER_ TURNS - Auto-title once this many assistant turns exist (W031 D2).
0= never auto-title. The CLI’s[session] title_after_turns/WCODE_TITLE_AFTER_TURNSoverride it; absent config resolves to this. - TITLE_
CLAMP - Hard cap on a produced title, in chars (not bytes). A title is a name, so
it is a hard cut with no ellipsis — see
sanitize.