Add conversation titles and rename support#49
Conversation
- Auto-generate titles from first user message (truncated to 60 chars) - Add rename command to TUI command palette (Ctrl+K) - Persist title alongside transcript in history.yaml - Display title in StatusBar and TranscriptBrowser - Backward compatible: existing transcripts without titles load correctly Closes #26
…anscripts - Update currentTitle before setTitle in rename so persistConversation captures the new value - Call setTitle after replaceConversation when loading archived transcripts - Remove unused renameTranscript and syncTitle functions
|
Fixed three bugs identified during review:
|
- Batch replaceConversation + setTitle to avoid double persist on transcript load - Pass title through onConversationChange callback instead of relying on closure state - Truncate renamed titles to 60 chars to match auto-generated title behavior - Remove redundant .or(z.undefined()) on archiveIndexEntrySchema.title
|
Pushed fixes for the review findings:
|
Patches AppliedFix 1: Auto-generated title uses wrong message on transcript continuationFile: \src/tui/session.ts:422\ When loading an archived transcript without a title, \ itleGenerated\ is now set to \ rue\ immediately instead of waiting for the next message. This prevents auto-generation from deriving the title from the first user message in the entire history (which could be months old). The transcript browser already falls back to preview text for display, so no user-facing regression. Fix 2: \lastWriteSucceeded\ could reflect a different writeFiles: \src/tui/session.ts:106-166,543-548, \src/core/state-manager.ts:22-37\ Replaced the shared \lastWriteSucceeded\ boolean with a \Promise\ chain. Each write now carries its own success/failure through the queue, so \waitForTranscriptWrites()\ returns whether the actual queued write succeeded, not whatever happened to set the flag last. Build and lint pass. |
Closes #26
Summary
Conversation persistence previously stored only the message transcript in
~/.agent/history.yaml, so saved chats had no human-friendly titles or metadata. This PR adds auto-generated titles, a rename command, and title persistence.What Changed
titlefield is stored alongside messages inhistory.yamland archived transcript files.Files Modified
src/core/transcript-store.tstitleto transcript YAML schema, updated load/save/archive functions, addedrenameTranscript()src/core/state-manager.tstitleto snapshot,initialTitleto options,setTitle()methodsrc/tui/session.tssrc/tui/App.tsxsrc/tui/StreamingRenderer.tsxValidation
npm run buildpasses (TypeScript compilation)npm run lintpasses (ESLint)Risks / Follow-ups
renameTranscript()function intranscript-store.tsis no longer called externally (rename is handled entirely throughstate.setTitle+persistConversation). It can be removed in a follow-up if desired.