Repository navigation
feat(sessions): full-text search, live updates and in-progress sessions - #93
Merged
Merged
Conversation
- SessionSearchIndex: opt-in SQLite FTS5 (trigram) index of what the reader shows (prompts, replies, tool steps with their errors), one row per transcript item so a hit can be scrolled to. Terms shorter than three characters fall back to LIKE. Updated per session by version; running sessions wait until they stop, gone sessions are dropped, and a schema version mismatch rebuilds it. Lives in ~/Library/Caches/AIUsage/Sessions (directory 0700, file 0600). - SessionSourceMonitor: FSEvents on the three data directories, filtered to session records (Codex logs, -shm files and Claude debug output are ignored). Roots go through realpath, because URL.resolvingSymlinksInPath strips /private and events under /private/var never matched. - Claude: appended records are read from the last offset instead of re-parsing the whole file; an inode change, a smaller file or an offset not right after a record falls back to a full read. A 14.7 MB session took ~0.25 s on every change before. - In progress: Claude Code's sessions/<pid>.json registry (pid alive and its start time matches procStart), Codex's latest inProgress turn and OpenCode v1's unfinished assistant message, the last two only within 30 minutes so crash leftovers expire. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V35ctfkV86ww1dY6Gs1d9d
- The Session Center page and the menu bar Recent Sessions watch for changes while visible and rescan within ~1.5 s; nothing runs when both are hidden. The open transcript keeps its content and scroll position while it reloads, and follows new content when scrolled to the bottom. - "In progress" / "Waiting for input" labels in list rows, the reader header and the menu bar. Resuming an active session asks first, since two processes would write to the same session. - Full-text search is off by default. It is turned on from the hint under the search field or the "…" menu, after a prompt that explains the local index; turning it off deletes the index. Results show the matching line, and opening one scrolls to it with the terms highlighted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V35ctfkV86ww1dY6Gs1d9d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V35ctfkV86ww1dY6Gs1d9d
The Xcode 26 compiler on the macos-26 runner crashed ("failed to produce
diagnostic") on an expression that declared a local `excerpt` while
calling the `excerpt(session:…)` method inside its own initializer,
through nested optionals. Swift 6.4 accepted it. That expression and two
similar ones (a double-optional `?? nil`, and the same shadowing in the
store's `select`) are now plain `if let` code.
Also fixes two warnings the earlier build check missed: the app target
defaults to MainActor isolation, so the cancellation flag read by the
background indexer is now `nonisolated`, and the file-watcher callback
unwraps `self` before hopping to the main actor.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V35ctfkV86ww1dY6Gs1d9d
- Reader header stays on one line: the resume label shortens, then the tool
name, the copy button and the status text fold away as space runs out.
- Metadata is fixed at two lines (location, then facts) and truncates
instead of running past the edge; long titles stop at three lines.
- Resume is an accent split button (resume / choose terminal); copy and
more are matching icon buttons.
- Collapsed step groups hug their summary; inline code gets a background;
English plurals are correct ("1 step", "ran 1 command").
- Working sessions show in green, waiting-for-input in amber.
- Tool filter segments size to their labels; footer fits on one line with
key hints; empty search offers the next step.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V35ctfkV86ww1dY6Gs1d9d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #92: the first two items of the Session Center roadmap. Design notes are in
docs/SESSION_CENTER_DESIGN.md§3.2, §3.4 and §3.5.Full-text search (opt-in)
SessionSearchIndex: SQLite FTS5 with thetrigramtokenizer, so Chinese works without word segmentation. Terms shorter than three characters (e.g. 登录) can't use trigram and fall back toLIKEwith%/_escaped.user_versionmismatch rebuilds.~/Library/Caches/AIUsage/Sessions, 0700/0600, never uploaded); turning it off deletes it.Live updates
SessionSourceMonitor: FSEvents on the three data directories, filtered to session records. Codex's log database,-shmfiles and Claude debug output are ignored.In progress
~/.claude/sessions/<pid>.json. The pid must be alive and its start time (sysctl) must matchprocStart, the same check Claude Code uses, so reused PIDs don't count.idleshows "Waiting for input", anything else shows "In progress".inProgressinthread_turnsand had activity in the last 30 minutes. This Mac has four crash-leftoverinProgressturns (oldest from June) that the window excludes.time.completed, within 30 minutes). The legacy JSON storage rewrites message files in place, so the scan cache can't see completion. v2 has no sample yet.Testing
swift test --package-path QuotaBackend: 503 tests pass (3 skipped, as onmain), including 14 newSessionLiveSearchTests:%_and quotes, incremental updates, schema rebuild, permissions, no recreation after deleteSessionCenterStore:/private/varwere filtered outNotes
onDisappearstops monitoring, and the resume confirmation alert. If the popover never reports disappearing, monitoring just stays on; scans of unchanged data take ~2 ms.Localizable.strings, as in feat: Session Center — browse, read and resume local Claude Code, Codex and OpenCode sessions #92.🤖 Generated with Claude Code
https://claude.ai/code/session_01V35ctfkV86ww1dY6Gs1d9d