Skip to content

Add Muse CLI local usage - #47

Open
pekth wants to merge 1 commit into
mainfrom
feat/muse-cli
Open

pekth wants to merge 1 commit into
mainfrom
feat/muse-cli

Conversation

@pekth

@pekth pekth commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Muse CLI users can enable a local usage card in Settings → Providers. The card counts retained native sessions and user/assistant messages without decoding content, reading credentials, spawning Muse, or sending requests. Quota, tokens, and cost remain unavailable; the existing quota-only JSON report has no Muse entry.

The reader handles Muse Code 1.4 native logs, duplicate sequence numbers, task events, malformed final lines, and local-day activity counts. Live and synthetic demo composition both include Muse. README, privacy documentation, KB, demo data, changelog, and ADR 0007 describe the same boundary. A minimal Python validator checks required documentation and ADR index coverage; --write adds missing rows while preserving existing descriptions.

Validation on macOS arm64:

  • Baseline: swift build and 382 tests passed.
  • Candidate: swift build, all 391 tests, Scripts/make-app.sh, and strict ad-hoc signature verification passed.
  • Nine Muse tests cover parsing, discovery, missing/empty history, preference persistence, composition, and native SwiftUI rendering with synthetic data.
  • Synthetic card capture inspected. Interactive app use, installation, and live-account usage are unverified.
  • git diff --check passed.
  • python3 scripts/documentation.py --write and --check passed. Synthetic smoke checks verified failure on missing rows/records and empty documentation, plus recovery through --write.
  • The newer base changes only CI and documentation. Source/test checksums still match the tested macOS candidate.

Model(s): gpt-6.1-sol (xhigh)
Harness: Codex in T3 Code

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds a new local usage provider for Muse CLI.

The PR should not merge until an unreadable Muse log can no longer suppress usage from readable sessions.

Fix All in CodexFindings

  1. P1 One unreadable log hides usage ▶
  2. P2 Muse tray toggle has no effect ▶
  3. P2 Wrong ADR numbers pass validation ▶
  4. P2 Existing ADR statuses are missed ▶
Fix with agent prompt
### Issue 1
Sources/MeterUsage/Services/MuseUsageSource.swift:35-37
If one retained `session.jsonl` is unreadable while others are readable, this catch fails the entire Muse scan instead of counting those sessions. The card shows a read error in place of available usage, and scheduled refreshes back off after the failure.

### Issue 2
Sources/MeterUsage/Views/SettingsView.swift:153
This menu-bar toggle defaults to on, but Muse has neither a quota window nor a service-status source. The tray draws only providers with a quota window or a degraded service status, so changing the toggle cannot make Muse appear there. That leaves users with a setting that appears to control a display it cannot change.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

### Issue 3
scripts/documentation.py:26
The validator checks link targets but ignores the numbers displayed in index rows. A copied row such as `[0008](0007-muse-local-history.md)` passes `--check` even though ADR 0007 has no correctly numbered entry. The coverage check can therefore approve a misleading index.

### Issue 4
scripts/documentation.py:40-41
`--write` recognizes only bullet-style status lines. If it generates a missing row for ADR 0005 or 0006, whose status appears under a `## Status` heading, it writes `See record` instead of the recorded status. The generated index then loses useful status information.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

The PR adds an opt-in Muse CLI card based on local native session logs, synthetic demo data, provider settings, and a documentation validator.

  • Muse contributes session and message counts without supplying quota, token, or cost figures.
  • The review found that one unreadable log can hide otherwise readable usage, and identified misleading menu-bar settings and ADR-validator edge cases.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["Muse session.jsonl files"] --> B["MuseUsageSource scan and parse"]
  B --> C["ProviderUsage counts"]
  C --> D["Usage card"]
  C -. "No quota source" .-> E["Quota-only JSON and tray percentages"]
Loading

Reviews (1) · Last reviewed commit: "feat: add Muse CLI local usage"

Comment on lines +35 to +37
data = try Data(contentsOf: url, options: .mappedIfSafe)
} catch {
throw SourceUnavailable.failed(.muse)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 One unreadable log hides usage

If one retained session.jsonl is unreadable while others are readable, this catch fails the entire Muse scan instead of counting those sessions. The card shows a read error in place of available usage, and scheduled refreshes back off after the failure.

Prompt To Fix With AI
This is a comment left during a code review.
Path: Sources/MeterUsage/Services/MuseUsageSource.swift
Line: 35-37

Comment:
**One unreadable log hides usage**

If one retained `session.jsonl` is unreadable while others are readable, this catch fails the entire Muse scan instead of counting those sessions. The card shows a read error in place of available usage, and scheduled refreshes back off after the failure.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

provider: .muse,
subtitle: "Local sessions and messages",
isOn: $showMuse,
menuBarIsOn: $menuBarMuse

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Muse tray toggle has no effect

This menu-bar toggle defaults to on, but Muse has neither a quota window nor a service-status source. The tray draws only providers with a quota window or a degraded service status, so changing the toggle cannot make Muse appear there. That leaves users with a setting that appears to control a display it cannot change.

Prompt To Fix With AI
This is a comment left during a code review.
Path: Sources/MeterUsage/Views/SettingsView.swift
Line: 153

Comment:
**Muse tray toggle has no effect**

This menu-bar toggle defaults to on, but Muse has neither a quota window nor a service-status source. The tray draws only providers with a quota window or a degraded service status, so changing the toggle cannot make Muse appear there. That leaves users with a setting that appears to control a display it cannot change.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Codex

Comment thread scripts/documentation.py

index = root / "docs/adr/README.md"
content = index.read_text(encoding="utf-8")
indexed = re.findall(r"^\| \[[^\]]+\]\(([^)]+\.md)\)", content, re.MULTILINE)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Wrong ADR numbers pass validation

The validator checks link targets but ignores the numbers displayed in index rows. A copied row such as [0008](0007-muse-local-history.md) passes --check even though ADR 0007 has no correctly numbered entry. The coverage check can therefore approve a misleading index.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/documentation.py
Line: 26

Comment:
**Wrong ADR numbers pass validation**

The validator checks link targets but ignores the numbers displayed in index rows. A copied row such as `[0008](0007-muse-local-history.md)` passes `--check` even though ADR 0007 has no correctly numbered entry. The coverage check can therefore approve a misleading index.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

Comment thread scripts/documentation.py
Comment on lines +40 to +41
status = re.search(r"^- Status: (.+)$", text, re.MULTILINE)
label = status.group(1).replace("|", "\\|") if status else "See record"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Existing ADR statuses are missed

--write recognizes only bullet-style status lines. If it generates a missing row for ADR 0005 or 0006, whose status appears under a ## Status heading, it writes See record instead of the recorded status. The generated index then loses useful status information.

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/documentation.py
Line: 40-41

Comment:
**Existing ADR statuses are missed**

`--write` recognizes only bullet-style status lines. If it generates a missing row for ADR 0005 or 0006, whose status appears under a `## Status` heading, it writes `See record` instead of the recorded status. The generated index then loses useful status information.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Codex

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