feat: add macOS menu-bar experience - #24
Merged
Merged
Conversation
Add an always-available menu-bar extra to the read-only macOS app: connection state, quick counts, candidate counts by lifecycle state, the most recent candidates, and Open/Refresh/Quit actions. Add an opt-in "menu-bar-only" Dock-icon preference (runtime activation policy, no LSUIElement). Surface the v0.2 model-synthesis provenance block and the install target in mutation detail. Fix a read-only open bug for cleanly-checkpointed WAL databases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015LY7xtercMc3NtLeX2z4YV
- Re-open the read-only connection on reload()/refresh so an immutable point-in-time snapshot advances; a cleanly checkpointed DB is the common path, so Refresh now surfaces rows written after the reader was created. - openReadable retries a failed immutable open once with a plain read-only open (canRead probe) before degrading to empty, guarding the concurrent-writer / changed-file case. - recentMutations/mutations share a bounded LIMIT query using json_extract for the title instead of decoding every candidate package on the main actor. - reload() computes overview() once and passes it into menuBarSnapshot. - Restrict URI path encoding to ASCII unreserved characters. - Update stale v6 fixture comment to v8; add a refresh-sees-new-rows test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015LY7xtercMc3NtLeX2z4YV
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.
Claim
Gives the read-only macOS app the menu-bar presence the blueprint always
envisioned for 0.1.0: an always-available
MenuBarExtraalongside the existingmain window, showing a live read-only summary of the open database even when the
window is closed.
What changed (
apps/macos/**+docs/guides/macos-app.mdonly)MenuBarView,.menuBarExtraStyle(.window)): connectionstate (file + schema compatibility), quick counts (sessions, events,
candidates), candidate counts by lifecycle state, the N most recent candidates
with state/detector, and Open Autophagy / Refresh / Quit actions.
Read-only, refresh-on-open, no daemon.
DatabaseReader.menuBarSnapshot(...)assembles a pure
MenuBarSnapshotfrom cheapCOUNT/GROUP BYqueries(
mutationStateCounts,recentMutations); the SwiftUI layer stays thin. Theapp runs as a regular Dock app and a menu-bar extra (both scenes).
AppSettings,UserDefaults)runs the app as an accessory (no Dock icon) via
NSApplication.setActivationPolicyat runtime — no
LSUIElementbaked into the bundle, so the default stays anormal Dock app.
provenanceblock (provider / model name / revision / optional digest) whenpresent, and the installation target (Codex vs Claude Code repo skill).
checkpointed (its
-wal/-shmsidecars removed — the normal state after a CLIrun) could not be read: a read-only connection cannot build the shared-memory
index WAL needs, so every query silently failed and the app showed the file as
empty / "not an Autophagy database".
Databasenow opens such files withSQLite
immutable=1(reading the fully checkpointed main file as apoint-in-time snapshot) and opens normally when a live
-walsidecar ispresent.
knownSchemaVersionwas already 8 — nothing schema-related bumped.Evidence
swift buildclean (no warnings),swift test— 35 tests pass, includingnew coverage for provenance decode, install-target display, state counts, the
menu-bar snapshot assembly (connected + disconnected),
AppSettings, and aregression test for the checkpointed-WAL-without-sidecars case.
mise run checkpasses at repo root (fmt + lint + test + docs + ci; exit 0)./tmp(import fixtures →mutations propose, 3 candidates), then asserted the view-model stateheadlessly through
AutophagyKitagainst that real, cleanly-closed DB — 14sessions, 22 events, 3 candidates, schema v8 supported.
make-app-bundle.shstill produces a working bundle with noLSUIElement(verified default remains a normal Dock app).
Privacy
Still strictly read-only. The menu bar reads the same local database through the
same read-only +
query_onlyconnection; it adds no write path and no export.Provenance surfaces model identity only (never endpoints, keys, prompts, or
payloads). Nothing new leaves the machine.
Decision record
The menu-bar addition stays inside the read-only charter that ADR 0005 already
anticipated ("moving to ... a menu-bar presentation later is an additive
packaging change; it does not alter the read-only or CLI-mediation boundaries"),
so no new ADR is warranted.
🤖 Generated with Claude Code