Skip to content

About

🦞 macOS desktop widget that monitors Claude API session health β€” know when to molt

Resources

Stars

5 stars

Watchers

0 watching

Forks

Repository files navigation

Molty Meter

Molty Meter is a macOS widget that monitors your Moltbot sessions in real time. It pulls session data from your local OpenClaw install and monthly cost data from the Anthropic Admin API.

Molty Meter

The arc shows how full your context window is. As it fills, Molty's status changes:

Context Used Status What It Means
< 40% "Let's go!" Fresh session, full speed ahead
40–65% "Cruising" Smooth sailing
65–85% "Wrap it up" Context is getting heavy, messages cost more
> 85% "Time to molt!" Start a fresh session now

The circle fills as your monthly spend approaches your budget.

The forecast tells you whether you'll get through the month under budget at your current burn rate. If you're on pace, it says "On track". If you're projected to go over, Molty estimates when you'll hit your limit β€” like "Feb 22".

Why It Matters

As your context window fills up, every message gets more expensive. The model processes all prior context on every turn.

When the context window hits its limit, your provider compacts (summarizes) the conversation to make room. This buys you more turns, but the compaction itself burns tokens β€” and the summarized context is lossy. You lose nuance, the model starts repeating itself, and you're paying more for worse results.

That's the molt. When Molty warns you, start a fresh session. Clean context, sharper responses, cheaper messages. Session hygiene is budget hygiene.

Add Molty Meter to Your Desktop

1. Clone and build

git clone https://github.com/lizmyers/molty-meter.git
cd molty-meter && swift build -c release

Build the release configuration, not the default debug build β€” if you set Molty to launch at login (below), a LaunchAgent pointing at .build/debug/ will silently break the next time you rebuild during development, since that path gets overwritten by routine swift build runs. .build/release/ only changes when you explicitly rebuild release.

2. Launch

.build/release/MoltyMeter

Molty appears on your desktop. Drag it wherever you want β€” it remembers its position between launches.

3. Connect your data

Molty reads session data by calling openclaw sessions --json, which reflects whatever OpenClaw is running locally and tracking from your AI sessions. This is where context window and session cost data comes from β€” all local, via the openclaw CLI on your machine (not a network call).

OpenClaw works with Claude subscriptions (Pro, Max) β€” not just API keys. Run openclaw onboard and choose your auth method. Setup details here.

4. Add your Anthropic Admin API key (recommended)

For monthly cost tracking, Molty pulls real billing data from Anthropic's API β€” the same numbers on your cost page. Molty refreshes this every 30 minutes. Current-day costs may lag slightly as billing data syncs on Anthropic's side.

Edit ~/.molty-meter.json:

{
  "monthlyBudget": 200,
  "anthropicAdminKey": "sk-ant-admin01-your-key-here"
}

Important: This must be an Admin API key (sk-ant-admin...), not a regular API key. You need the admin role in your Anthropic org to create one.

Don't have an admin key? Molty still works β€” it estimates monthly costs from local OpenClaw session data instead.

5. Start on login (optional)

The reliable way is a LaunchAgent pointed at the release build:

cat > ~/Library/LaunchAgents/com.you.molty-meter.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.you.molty-meter</string>
    <key>ProgramArguments</key>
    <array>
        <string>/YOUR/PATH/TO/molty-meter/.build/release/MoltyMeter</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <false/>
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
    </dict>
</dict>
</plist>
EOF

launchctl load ~/Library/LaunchAgents/com.you.molty-meter.plist

Two things that matter here:

  • Point it at .build/release/, not .build/debug/. A LaunchAgent pointed at the debug build will silently fail to survive a reboot the next time routine development overwrites that path β€” this exact bug shipped for months before being caught.
  • The EnvironmentVariables PATH block matters: without it, a login-launched Molty can't find the openclaw CLI it now shells out to for session data, and the widget will show "No active session" even while you're actively working.

Alternatively, use System Settings > General > Login Items and add your release build manually β€” simpler, but you're responsible for remembering to point it at .build/release/ after every rebuild.

To disable: launchctl unload ~/Library/LaunchAgents/com.you.molty-meter.plist

Works With Your Provider

Molty Meter works with any provider supported by OpenClaw. Session data (context window, tokens, model) comes from your local OpenClaw install automatically. For monthly cost tracking, it depends on what your provider offers:

Provider Session Data Monthly Cost Data What You Need
Anthropic Via OpenClaw Admin API Admin API key (sk-ant-admin...)
OpenAI Via OpenClaw Costs API Org Admin API key
OpenRouter Via OpenClaw Activity API Same API key (sk-or-...)
AWS Bedrock Via OpenClaw Cost Explorer API IAM credentials
Google Gemini Via OpenClaw Cloud Billing API GCP service account
Mistral Via OpenClaw No API (console only) Estimated from tokens
Ollama Via OpenClaw Free (local) β€”

Molty currently has a built-in integration for the Anthropic Admin API. Other provider billing integrations are on the roadmap. Without a billing API, Molty estimates costs from token counts in your session data.

You can set your budget from the in-app Settings (gear icon) instead of editing the JSON file.

Just Want Token Usage?

If you only want to surface token usage, without cost tracking, check out Token Ticker. It's a simple widget that reads session data directly from OpenClaw.

Requirements

  • macOS 13+
  • OpenClaw, installed and reachable via the openclaw CLI (Molty calls openclaw sessions --json for live session data)

Changelog

v1.5

  • Fix: "No active session" shown permanently. OpenClaw migrated session storage from a flat ~/.openclaw/agents/*/sessions/sessions.json file into a SQLite-backed store; that file no longer exists on current OpenClaw installs, so Molty's old direct-file read always silently found nothing. Now reads live session data via openclaw sessions --json instead, which tracks whatever storage format OpenClaw uses underneath.
  • Fix: widget could float above whatever app you were using. Launch no longer steals keyboard focus (orderFront instead of makeKeyAndOrderFront).
  • Darker, less transparent background by default.

v1.4

  • Apple-style frosted glass effect. Widget now uses NSVisualEffectView with blur material to match macOS Weather widget aesthetic. Features forced dark appearance with desktop wallpaper blur in both light and dark modes.

v1.3

  • Light mode fix: updated background styling. Widget now uses a semi-transparent black background with white text in both light and dark modes, matching macOS Weather widget aesthetic. Removed drop shadow for cleaner appearance.

v1.2

  • Fix: model display now tracks the actual model in use. Previously the meter could show a stale model name from sessions.json. Now reads modelOverride from OpenClaw session data, so switching models (e.g. Haiku to Gemma) updates correctly β€” even when the provider falls back silently.
  • Local model support. When using a local model (Ollama, etc.), Monthly shows $0.00 and Forecast shows "No bills!"
  • Session sorting by recency. When multiple sessions exist, Molty picks the most recently active one.

v1.1

  • Multi-provider support (Anthropic, OpenAI, unknown/local)
  • Switch to cost_report endpoint for exact Anthropic billing
  • Add pointer cursor on clickable elements
  • Add links to provider cost pages

License

MIT


Built by Liz Myers with help from Claude and Molty β€” Shell yeah!

About

🦞 macOS desktop widget that monitors Claude API session health β€” know when to molt

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages