Repository navigation
Description
Overview
New ai-chat nodes should default to the title "Untitled". Once a conversation has accumulated a few messages, the title should be automatically generated by summarizing the conversation via the LLM — but only while the model is otherwise idle, only using a separate context/thread from the live conversation, and never overriding a title the user has set or edited themselves.
Problem Statement
User-facing requirements:
- New ai-chat nodes default to title "Untitled" on creation
- After a few messages accumulate, the LLM generates a concise summary title from the conversation
- Title generation runs against a SEPARATE context/thread from the live conversation — it must not share or consume the active chat's context window
- Automatic title generation only fires when the current title is still "Untitled" — once a user manually sets or edits a title, the automatic mechanism must never override it
- Title generation runs as a background/queued task, not inline with a chat turn
- The queued title-generation task is only processed when the LLM is otherwise idle — it must not compete with or delay active foreground/live-conversation inference
Current state (confirmed via codebase investigation):
-
No title field exists.
AiChatNode(packages/desktop-app/src/lib/types/ai-chat-node.ts:30-43) has notitleproperty. The displayed title is currently derived from.contentat render time:node-card-inline.svelte:55(node?.content?.split('\n')[0]?.slice(0,120)) andai-chat-node-viewer.svelte:400(node?.content ?? 'AI Chat'). A real title field (or title-bearing property) defaulting to "Untitled" on creation does not exist today. The exact ai-chat node creation call site was not pinned down during investigation — locate it during implementation (search Tauri commands /NodeService::createcall sites for ai-chat node instantiation). -
No idle/queue infrastructure exists for the chat/completion model. The only existing scheduler,
EmbeddingScheduler(packages/core/src/services/embedding_processor.rs:85-178), implements ADR-053's active-first priority gate — but it arbitrates embedding work across multiple open databases, not chat-inference contention with background jobs.GgufModelManager/CompositeModelManager(packages/agent/src/local_agent/) have no busy/idle flag, semaphore, or task queue today. A new, lightweight idle-gated queue for the chat/completion model is required. -
No isolated one-shot inference mechanism exists for chat-style prompts. Embedding generation is stateless per-call, but that runs against a separate embedding model with its own manager. For a chat-style summarization prompt against the same completion model used for live conversation, no scratch/ephemeral-session mechanism exists that bypasses an ai-chat node's own
properties.messageshistory. New plumbing is needed: an isolated one-shot inference call that does not append to or read from the live conversation's context.
Architecture Impact
ADR-030 (decisions/030-prompt-skill-node-architecture.md, Status: Proposed) defines skill nodes as a mechanism for scoping which tools a ReAct-loop model sees on a user-initiated turn, discovered via semantic search against user intent (packages/agent/src/skill_pipeline.rs:227, seed_skill_nodes()). This is the wrong fit for a one-shot background summarization call — a "title generation skill" would never be selected by the intent-driven skill-discovery pipeline described in ADR-030, since it is never meant to be user-invoked or intent-matched. This issue does not use the skill node mechanism; it uses a hardcoded prompt template instead (following the simpler prompt_templates.rs pattern, or ADR-030's plain prompt node shape without the skill wrapper, if graph-stored prompts are preferred). This does not reverse or extend ADR-030 — it's a deliberate non-use of that mechanism for a task it wasn't designed for, and ADR-030 remains proposed/unaffected.
ADR-053 (decisions/053-one-daemon-multiple-databases.md, Accepted) establishes "active-database priority" for the embedding model shared across multiple open databases (referencing ADR-045's embedding-egress discipline). This issue's idle-gated task queue is a new, separate mechanism scoped to the chat/completion model, not a change to ADR-053's embedding scheduler — it follows the same shape (idle/active priority) but is complementary infrastructure, not a modification of ADR-053 itself. No companion nodespace-docs change is required for ADR-053, though documenting the new chat-model idle-queue as its own future ADR may be worth considering once implemented (not a blocking requirement for this issue).
Implementation Approach
Phase 1: Title Field and Default
- Add a title field (or title-bearing property) to the ai-chat node type, defaulting to "Untitled" on creation
- Locate and update the ai-chat node creation path to set this default
- Add a guard so any automatic title-generation mechanism only writes the title when its current value is still "Untitled" — a user-set or user-edited title (any value other than "Untitled") must never be overwritten automatically
Phase 2: Summarization Prompt Template
- Add a hardcoded prompt template for generating a concise conversation title from a set of messages (not a discoverable
skillnode — see Architecture Impact) - Template takes the accumulated messages (or a subset/summary of them) as input and returns a short title string
Phase 3: Idle-Gated Background Task Queue
- Implement a lightweight queue/gate for the chat/completion model, conceptually mirroring
EmbeddingScheduler's active-first/idle-priority pattern (ADR-053) but scoped separately to the chat/completion model rather than embeddings - Queue a title-generation task once a conversation crosses a message-count threshold (implementer's judgment on a reasonable default, e.g. in the range of 4-6 messages; make it easy to adjust)
- Task is only dispatched when the chat/completion model is not mid-turn on a live conversation
Phase 4: Isolated One-Shot Inference Call
- Implement an inference call mechanism that invokes the chat/completion model with the summarization prompt in isolation — a separate context/thread that does not append to, read from, or otherwise share state with the live ai-chat node's
properties.messagesconversation history
Acceptance Criteria
- New ai-chat nodes default to title "Untitled"
- After a conversation accumulates a few messages, a title is generated automatically from the conversation content
- A user-set or user-edited title is never overwritten by the automatic title-generation mechanism
- Title generation does not block, delay, or share context with live conversation turns
- Title-generation tasks are only processed when the chat/completion model is idle (not mid-turn on a live conversation)
- Tests pass (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
- ai-chat-node.ts:
packages/desktop-app/src/lib/types/ai-chat-node.ts:30-43— current type definition, no title field - node-card-inline.svelte:
packages/desktop-app/src/lib/components/node-card-inline.svelte:55— current content-derived title display - ai-chat-node-viewer.svelte:
packages/desktop-app/src/lib/components/viewers/ai-chat-node-viewer.svelte:400— current content-derived title display - embedding_processor.rs:
packages/core/src/services/embedding_processor.rs:85-178—EmbeddingScheduler, the closest existing pattern for idle/active-priority scheduling to mirror (not reuse directly — a new mechanism scoped to the chat/completion model) - local_agent/:
packages/agent/src/local_agent/—GgufModelManager/CompositeModelManager, where a busy/idle flag or semaphore would need to be introduced - skill_pipeline.rs:
packages/agent/src/skill_pipeline.rs:227—seed_skill_nodes(), the skill-seeding pattern confirmed NOT to be the right fit for this feature
Testing Requirements
- Unit test: new ai-chat node defaults to "Untitled"
- Unit test: title-generation mechanism does not overwrite a non-"Untitled" title
- Unit test/integration test: title-generation task is deferred while the chat model is mid-turn, and processed once idle
- Integration test: title generation does not mutate or read the live conversation's
properties.messages
Non-Goals
This issue does not build a general-purpose task queue for arbitrary background LLM work. Scope is specifically title generation for ai-chat nodes, though the underlying idle-gating mechanism may be designed with future reuse in mind.
Related Issues
- Optimistic updateNode merge doesn't flatten properties.* into top-level fields, causing ai-chat UI to lag behind RPC round-trip #1695 (unrelated — different ai-chat bug, optimistic-update reactivity)
- Exclude ai-chat nodes from embedding/vectorization #1696 (unrelated — ai-chat embedding exclusion)
- Ai-chat nodes can be deleted via backspace, losing the entire conversation #1697 (unrelated — ai-chat backspace-deletion protection)
Activity
malibio commentedon Sep 7, 2026
Blocked on manual rename: filed as #2380 (item 1).
This issue's requirement that "once a user manually sets or edits a title, the automatic mechanism must never override it" is unimplementable as things stand —
ai-chat-node-viewer.svelte:433renders the title as a static<h2>with no edit affordance, and there is none in the sidebar either. So the override guard protects a title users have no way to set.Phase 1 here adds the title field and the guard, but no UI to exercise it. Worth either taking #2380 first, or folding its rename UI into Phase 1 — otherwise this ships a "never override the user" rule that can never fire.
#2380 also covers a second, unrelated-to-LLM bug found alongside it: tab titles stay "Loading..." permanently, because the sidebar sets that placeholder expecting a viewer to replace it and no viewer ever calls
updateTabContent.mstomar125 commentedon Sep 12, 2026
Board-accuracy check (2026-09-12): the comment above says this is "blocked on manual rename: filed as #2380" because the ai-chat viewer had no title-edit affordance, so the "never override a user-set title" acceptance criterion was unimplementable.
That blocker is now resolved — #2380 was closed 2026-09-08, fixed via merged PR #2463, which added click-to-edit rename in the ai-chat viewer header (
aiChatDisplayTitle/resolveChatTitleCommitin the newai-chat-title.ts, wired into the sidebar chat list too). The override guard this issue asks for now has a real user-facing edit path to protect.Not implementing the actual auto-title feature here — just correcting the record so whoever picks this up doesn't re-derive that it's still blocked. Status stays Backlog (already correct); no board field changes needed.
malibio commentedon Sep 17, 2026
Baseline (worktree issue-1698-ai-chat-titles): Frontend: 5084 passed, 1 failed (247 test files, 246 passed). The single failure is a pre-existing cross-file timing flake in browser-sync-service.ts (a scheduleReconnect timer firing after teardown) — that file passes 47/47 when run in isolation, and it is unrelated to ai-chat.
malibio commentedon Sep 17, 2026
Investigation findings (corrections to the issue text)
Two premises in the issue turned out to be stale, and one design point needs recording.
1.
CompositeModelManagerdoes not exist.grepfinds zero hits repo-wide. There is exactly oneModelManagerimpl,GgufModelManager, and it never touches inference —load()only flips a status enum (model_manager.rs:744-745: 'actual inference engine loading is handled by ChatInferenceEngine, not the model manager'). So there is genuinely no busy/idle flag there, as the issue says, but not on the type the issue names.2. An isolated one-shot inference mechanism already exists (issue says it does not). The pattern is established twice — conversation summarization (
agent_loop.rs:3383-3414) andresolve_querydecomposition (tools.rs:2680-2744) — both building anInferenceRequest { messages, tools: None, temperature, max_tokens }and callingengine.generatedirectly with a chunk-collecting closure.InferenceRequestis fully self-contained, so it shares no state with any chat session. Phase 4 is therefore factoring out this existing shape, not new plumbing.3. The idle signal must be process-global.
has_active_turns()(local_agent_service.rs:476) already reports whether a live turn is in flight, butturn_tokenslives on the per-databaseLocalAgentServiceInnerwhile the engine is process-global (SharedLocalAgent). A per-DB gate would let database A's title job compete with database B's live turn. The gate therefore belongs onSharedLocalAgent.Also note
ChatEngine::inference_lock(nlp-engine/src/chat/mod.rs:329) is an unfair tokioMutex: it serializes generations but offers no priority, so a background job that acquires it first blocks a live turn for the full generation. The new gate must sit abovegenerate()rather than relying on that mutex.4. Title representation. The title is
node.content(the ai-chat schema declares notitlefield;AiChatNode::into_nodesetstitle: None). Today a new chat is created withcontent: ''and'Untitled chat'is a display-only placeholder inai-chat-title.ts. Per maintainer decision we will persist the literal"Untitled"at creation and guard oncontent == "Untitled", as this issue specifies. Recording the known consequence: a user who manually types exactly "Untitled" is indistinguishable from an untitled chat and their title will be auto-overwritten once.5. Scope: AI-Chat UI only. Per maintainer note, titling is gated on the daemon-driven native turn path (
run_ai_chat_turn→append_assistant_message). PTY capture never mints ai-chat nodes (capture_service.rs:1-7) and does not run that path, so external agents are excluded structurally rather than by a provider name check. PTY-captured conversations keep using their existingcapture:summaryfield.Auto-generate ai-chat titles via an idle-gated background task (closes …