Skip to content

feat: add session topic to Recent Sessions table#148

Merged
phuryn merged 1 commit into
phuryn:mainfrom
arojunior:add-session-topic
Jul 1, 2026
Merged

feat: add session topic to Recent Sessions table#148
phuryn merged 1 commit into
phuryn:mainfrom
arojunior:add-session-topic

Conversation

@arojunior

Copy link
Copy Markdown

Summary

  • Extracts session titles from Claude Code's custom-title and ai-title JSONL records, with a fallback to the first user message (truncated to 100 chars, skipping IDE context blocks)
  • Adds a Topic column to the Recent Sessions table in the dashboard and includes it in CSV exports
  • Adds topic TEXT column to the sessions DB table with _ensure_column() migration for existing databases

Title priority: custom-title > ai-title > first user message

Closes #147

Test plan

  • Run a full rescan (python cli.py scan) and verify the sessions table has a topic column populated
  • Open the dashboard and confirm the Topic column appears in the Recent Sessions table
  • Verify custom titles (user-set labels) take priority over AI-generated ones
  • Verify sessions without title records fall back to the first user message
  • Export sessions to CSV and confirm the Topic column is included
  • Test schema migration: start with an existing usage.db (no topic column), run a scan, and verify the column is added

🤖 Generated with Claude Code

Extract session titles from Claude Code's custom-title and ai-title
JSONL records, falling back to the first user message when no title
exists. Display the topic in the dashboard's Recent Sessions table
and include it in CSV exports.

Priority: custom-title > ai-title > first user message.

Closes phuryn#147

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
phuryn added a commit that referenced this pull request Jul 1, 2026
… tests (#147)

Follow-up to @arojunior's PR #148 (merged above), applying review feedback:

- Remove the first-user-message fallback (_extract_user_topic /
  MAX_TOPIC_LENGTH and both fallback blocks). An untitled session now shows
  an empty Topic instead of its opening prompt — keeps prompt text out of the
  table/CSV and matches Claude Code's own titles (custom-title > ai-title >
  empty).
- Guard upsert_sessions so a title-only record (sessionId but no timestamp)
  can't INSERT a token-less phantom row. Existing sessions still fall through
  to UPDATE, so a title Claude Code appends after the turns is still captured
  on the next incremental scan.
- Add 9 scanner tests: custom-title precedence (both orderings), ai-title
  fallback, empty when no title (even with user text present), DB persistence,
  incremental late-title capture, topic preserved across a title-less rescan,
  and no phantom row.
- Bump to v1.5.4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@phuryn phuryn merged commit 20e6c21 into phuryn:main Jul 1, 2026
phuryn added a commit that referenced this pull request Jul 1, 2026
…xtension fixes (#147)

Merge DEV: adds a Title column to Recent Sessions (from Claude Code's
custom-title / ai-title records, @arojunior's PR #148 preserved), a one-time
backfill of pre-existing sessions, full session IDs in the CSV export, an
"Untitled" placeholder, and VS Code extension fixes (20s readiness timeout,
Retry-on-failure button).

Closes #147.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@phuryn

phuryn commented Jul 1, 2026

Copy link
Copy Markdown
Owner

🎉 Shipped in v1.5.4.

Thanks @arojunior — your session-title work is the heart of this. I landed your commit with a --no-ff merge so your authorship is preserved verbatim (4fba47f), then layered the review + testing refinements as follow-up commits on top:

  • No first-message fallback — an untitled session now shows a muted Untitled placeholder rather than falling back to the first user prompt, so prompt text never leaks into the table/CSV. Priority is custom-titleai-title → Untitled.
  • One-time backfill — existing databases get titles for old sessions too: a single pass reads the custom-title / ai-title records from already-scanned transcripts (turns are left untouched, so token totals can't drift), gated by a schema_meta marker so it runs exactly once.
  • No phantom rows — a title-only record can no longer create a token-less session row.
  • Column polish — renamed to Title (matches Claude Code's own custom-title / ai-title), placed after Project, wraps long titles, min-width 160px.
  • CSV export now carries full session IDs (the table still shows the 8-char prefix).
  • VS Code extension — 20s readiness timeout on cold start (the backfill can slow the first launch) + a Retry button shown only when a start fails.
  • Tests — added scanner, dashboard, and sidebar coverage.

Thanks again for the contribution! 🙏

— Claude Code & the maintainer

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.

Add session topic to Recent Sessions table

2 participants