agentleFS
doublejdoublej/consult-user-mcp/macos-app/CLAUDE.md

consult-user-mcp / macos-app

CLAUDE.md39 starsChanged 4 months agoMITView on GitHub

The persistent half of the macOS product. A menu-bar app that owns user settings, dialog history, project tracking, updates, the install wizard, and a debug menu for firing test dialogs. It never shows a dialog itself — it configures the [[Dialog CLI]] that does. Swift + SwiftUI + AppKit, flat Sources/. ~7.8k LOC. Two processes, one file. The Tray App and the Dialog CLI never talk directly. They share ~/Library/Application Support/ConsultUserMCP/settings.json. The direction of travel is not one-way: So @AppStorage/UserDefaults…

The file

We split this CLAUDE.md into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    The debug menu loads dialog JSON from test-cases/cases/: Never hardcode dialog JSON in AppDelegate.swift.

    line 25
  2. Very specific:

    AFK mode short-circuits everything: When on, dialogs return {"afk": true} without being shown.

    line 29

≈ “Common” is an estimate: at least 1 in 5 of the 27,641 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

Tray App (macOS)

What this is

The persistent half of the macOS product. A menu-bar app that owns user settings, dialog history, project tracking, updates, the install wizard, and a debug menu for firing test dialogs. It never shows a dialog itself — it configures the [[Dialog CLI]] that does.

Swift + SwiftUI + AppKit, flat Sources/. ~7.8k LOC.

Mental model

Two processes, one file. The Tray App and the Dialog CLI never talk directly. They share ~/Library/Application Support/ConsultUserMCP/settings.json.

The direction of travel is not one-way:

  • Tray App → file: user preferences, exported from @AppStorage.
  • Dialog CLI → file: snoozeUntil, written when the user snoozes from inside a dialog.
  • Tray App polls the file (pollTimer + lastModified in DialogSettings.swift) to notice snoozes it did not make.

So @AppStorage/UserDefaults is the tray app's own store, and settings.json is the contract with the CLI. A setting that only exists in @AppStorage is invisible to dialogs.

The app bundle is the delivery mechanism. Contents/Resources/ carries the [[Baseprompt]], the Dialog CLI binary, and the Sketch CLI binary. bun run dev is what refreshes them.

Important invariants

  • The debug menu loads dialog JSON from test-cases/cases/. Never hardcode dialog JSON in AppDelegate.swift. Adding a dialog type means adding fixtures there and wiring a menu item — not pasting a literal.
  • A new user-facing setting needs three edits, not one: the @AppStorage property here, the export into settings.json, and the reader in dialog-cli/Sources/DialogCLI/Utilities/UserSettings.swift. Miss the third and the setting appears to work and does nothing.
  • ~/Library/Application Support/ConsultUserMCP/ cannot be renamed. Existing users' settings, history, and snooze state live there.
  • The bundled base-prompt.md is what clients actually receive. Editing the source under Sources/Resources/ changes nothing until bun run dev copies it. See .claude/rules/baseprompt.md.
  • AFK mode short-circuits everything. When on, dialogs return {"afk": true} without being shown. Auto-triggers on sleep and idle are separate flags from the manual toggle (afkAutoEnabled), so a manual toggle is not auto-cleared.

Common change patterns

Adding a setting → DialogSettings.swift property, the settings.json export, the CLI reader, and a control in the relevant *SettingsView.swift.

Adding a debug-menu dialog → a fixture in test-cases/cases/<type>/, then a menu item in AppDelegate.swift that loads it.

Touching install or update flows → InstallWizard.swift, InstallHelper.swift, ClaudeMdInstaller.swift, UpdateManager.swift. These write outside the app's own container; test on a clean-ish account if you can.

AppDelegate.swift is ~33KB and does menu construction, notifications, and dialog spawning. Split it along those seams if you are already in there — but keep the debug-menu-loads-from-fixtures invariant intact.

Verification

bun run dev     # from repo root — builds and installs, then restart the tray app

There are no automated tests here. Verify by hand: open the debug menu, fire each dialog type, confirm settings changes reach a live dialog.

Do that in the container. container/launch.sh shell boots a clean Tahoe account with no prior install — which is the state the install wizard, the update flow and first-run actually have to work in, and the one a developer machine can never get back to. It also means firing every dialog type does not take over your own screen. See ../container/README.md.

bash scripts/validate-baseprompt-version.sh gates baseprompt edits.

Related context

  • ../dialog-cli/CLAUDE.md — the process on the other side of settings.json
  • ../test-cases/CLAUDE.md — where debug-menu fixtures come from
  • .claude/rules/baseprompt.md, .claude/skills/release-app/SKILL.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.