Skip to content

feat(titles): built-in session auto-titling with settings controls#35

Merged
setkyar merged 1 commit into
mainfrom
sc-condensed-magnon-b1f1
Jun 3, 2026
Merged

feat(titles): built-in session auto-titling with settings controls#35
setkyar merged 1 commit into
mainfrom
sc-condensed-magnon-b1f1

Conversation

@setkyar
Copy link
Copy Markdown
Contributor

@setkyar setkyar commented Jun 3, 2026

Summary

Moves session auto-titling out of the pi extension and into pi-web itself, so the server-backed /settings page can control it and it works for both TUI- and browser-originated sessions.

Previously the set_tab_title tool and an input handler lived in .pi/extensions/pi-web.ts, running in the agent process where they couldn't read pi-web's settings. Now pi-web owns the feature end to end:

  • New Session Titles settings section: enable toggle, "when to title" (once / every new message — default every message), and a title-model picker populated from /api/models.
  • Title model defaults to a free, instant built-in word heuristic (no AI); choosing a model generates LLM-written titles via a new rpc.OneShotPrompt — an ephemeral, tool-less pi --mode rpc --no-session call that writes nothing to the sessions dir.
  • The file watcher triggers titling on content change; an in-memory de-dupe plus an autoTitle:true session_info marker prevent re-title loops, survive restarts, and never clobber a user's manual rename.
  • Heuristic is rune-safe and keeps Unicode combining marks, so non-Latin scripts (e.g. Burmese) aren't corrupted.
  • Removes the extension's title tool/handler/helpers and their tests; updates README, docs/install.md, and AGENTS.md.

Related issue

Supersedes the closed PR #32 (the env-var PI_WEB_BACKGROUND_TAB_TITLE approach); no tracking issue.

Type of change

  • feat — new feature

Live vs. Export

  • Not applicable — this PR doesn't touch session rendering (titles surface through the existing session_info → reload path)

Testing

  • make check passes (test + build + vet)
  • Frontend tests (vitest) cover the change (settings.test.js model-select population)
  • Go tests (go test ./...) cover the change (auto_title_test.go: gating, modes, de-dupe, multibyte, fallback; settings_test.go: new keys)
  • UI changes verified in a browser

…trols

Auto-titling previously lived in the pi extension (set_tab_title tool +
input handler), which ran in the agent process and couldn't be gated by
the server-backed settings. Move it into pi-web itself so the /settings
page controls it directly and it works for TUI- and browser-originated
sessions alike.

- New /settings "Session Titles" section: enable toggle, "when to title"
  (once / every new message, default every message), and a title model
  picker populated from /api/models.
- Empty model = free built-in word heuristic (no AI); pick a model for
  LLM-written titles via rpc.OneShotPrompt (ephemeral, tool-less
  pi --mode rpc --no-session, no sessions-dir pollution).
- Watcher triggers titling on content change; de-dupe + an autoTitle:true
  session_info marker prevent re-title loops, survive restarts, and never
  clobber a user's manual rename.
- Heuristic is rune-safe and preserves combining marks so non-Latin
  scripts (e.g. Burmese) aren't corrupted.
- Remove the extension's title tool/handler/helpers and their tests.
@setkyar setkyar merged commit a323b99 into main Jun 3, 2026
2 checks passed
@setkyar setkyar deleted the sc-condensed-magnon-b1f1 branch June 3, 2026 04:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant