Skip to content
benjaminbelagaPublic

About

Comux: open source macOS AI coding assistant quota monitor

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Cortex

Project identity. Cortex is Benjamin Belaga's open-source macOS quota monitor, built on an upstream open-source codebase (MIT — see NOTICE.md for attribution and the reconciliation reference). The application bundle ships as Cortex.app on disk and the menu-bar item shows the Cortex label, while the underlying codebase keeps the upstream internal target name (Cortex) and class names for mergeability with upstream/main. The bundle ID is fr.yoyaku.cortex (migrated from upstream's in E4, with non-destructive Keychain/UserDefaults migration). The source never ships provider credentials; local accounts remain in macOS Keychain.

Coming from the upstream app. E4 renamed the bundle id from com.tddworks.claudebar to fr.yoyaku.cortex. On first launch Cortex copies the Keychain items and UserDefaults keys it needs into the new namespace and leaves the old ones untouched (an explicit new value always wins). macOS treats the renamed bundle as a different app, so permission prompts (Accessibility, Automation, Notifications, Login Items) come back once, and Sparkle cannot auto-update across bundle ids — the first Cortex build after the rename needs a manual install.

Build Tests Swift 6.2 Platform

A macOS menu bar application that monitors AI coding assistant usage quotas in real time. Keep track of your Claude, OpenAI Codex, Google Gemini, GitHub Copilot, Google Antigravity, Cursor, AWS Bedrock, AWS Kiro, Kimi, DeepSeek, Mistral, MiniMax, Alibaba Coding Plan, Z.ai, Amp Code, OpenCode Go, Oh My Pi, Grok Build, Command Code, and Vercel at a glance.

Featuring full MacBook Touch Bar integration with persistent, centered multi-provider quota gauges, MacBook Notch Live Activity, Multi-Account Switching, and Raycast-style User Extensions.

Screenshots — the application UI and icon are Cortex-branded. Release screenshots are generated from the same build and contain no local account data.

Multi-Account Switching & Multi-Window Quotas

Cortex supports seamless Multi-Account Switching for providers that support multiple logins (e.g. personal, work, client accounts). Configure multiple accounts in Settings > Providers, and switch between them from the account catalogue or provider row menu.

Each provider displays separate progress bars for multiple quota windows—for example, tracking your 5-hour session quota and 7-day weekly quota simultaneously with dedicated countdown timers.


Quota Thresholds & Color Coding

Every quota is tracked in real time and color-coded based on remaining capacity:

Remaining Status Color Description
> 50% Healthy Blue / Green Ample quota available
20-50% Warning Yellow / Amber Approaching usage threshold or accelerated burn rate
< 20% Critical Red Low quota remaining; alerts triggered
0% Depleted Gray Quota exhausted

Features

  • Multi-Provider Support - Monitor Claude, Codex, Gemini, GitHub Copilot, Antigravity, Z.ai, Kimi, Kiro, Amp, OpenCode Go, Oh My Pi, Grok, and Command Code quotas in one place
  • Provider Enable/Disable - Toggle individual providers on/off from Settings to customize your monitoring
  • Real-Time Quota Tracking - View Session, Weekly, and Model-specific usage percentages
  • Multiple Themes - Light, Dark, CLI, Christmas, and imported terminal themes (.itermcolors)
  • Automatic Adaptation - System theme follows your macOS appearance; Christmas auto-enables during the holiday season
  • Visual Status Indicators - Color-coded progress bars (green/yellow/red) show quota health
  • System Notifications - Get alerted when quota status changes to warning or critical
  • Touch Bar Integration - Persistent MacBook Touch Bar widget with real-time multi-provider gauges, progress bars, and an interactive pixel mascot (learn more)
  • Notify! iPhone Publishing - Push quota state to your iPhone via Notify! on three surfaces: a Lock Screen Live Activity showing up to six quota windows, a Home Screen widget carrying that same content but staying put, and a Lock Screen widget gauge for one chosen quota (off by default, see below)
  • Auto-Refresh - Automatically updates quotas at configurable intervals
  • Keyboard Shortcuts - Quick access with ⌘D (Dashboard) and ⌘R (Refresh)

Tip

You can also enable Burn Rate Warnings in Settings > General to trigger alerts based on your real-time consumption velocity against remaining time rather than fixed percentage cutoffs.

Touch Bar Integration

Cortex features native, system-wide Touch Bar integration for MacBook Pro models equipped with an Apple Touch Bar (including M1/M2 and Intel). This runs 100% natively inside Cortex—requiring zero third-party apps (no BetterTouchTool or MTMR required) and no special accessibility permissions.

Key Touch Bar Features

  • Always Visible System-Wide (placement: 0): Uses macOS system-modal function bar presentation. The widget remains persistently visible across all full-screen windows and apps, automatically re-asserting on app switching and system unlock while keeping your system Escape key and Control Strip media/volume controls intact.
  • Centered, Clean Multi-Provider Quota Gauges:
    • Balanced, centered layout across the Touch Bar for single or multi-provider views.
    • Displays authentic provider logos (Claude, Gemini, Antigravity, GitHub Copilot, Codex, etc.).
    • Multi-segment provider views matching your menu bar configuration (e.g. [Logo] Gemini 40% | [Logo] Claude 0%).
    • High-precision bold monospaced percentage readout with warning indicator (!) when quota is critical (≥ 90%).
    • Sleek rounded progress bars with 100% track reference and adaptive color coding (healthy blue, warning amber, critical red).
    • Reset countdown timer (e.g., 2:15, 35m, 3d).
  • Battery-Friendly & Ultra Lightweight: Redraws only when quota state updates; consumes 0% idle CPU and zero background animation overhead.
  • One-Tap Access: Tap anywhere on the quota gauges on the Touch Bar to instantly summon the full Cortex dropdown popover (cortex://open).

Tip

For detailed architecture, Touch Bar configuration, and customization details, see the Full Touch Bar Guide.

MacBook Notch Live Activity

Cortex can render Claude Code's session and quota state directly in your MacBook notch (Settings > General > Notch Live Activity):

  • Idle Mode: Displays your selected provider's most depleted quota at a glance.
  • Active Session Mode: Displays repository name, elapsed time, and the number of active subagents fanned out.
  • Permission Alert: Prominently highlights when Claude Code is waiting for permission in terminal.
  • Hover Popover: Hovering expands the notch into a full status view with active session list, quota cards, and quick action buttons.
  • Virtual Notch: Displays without a physical notch (or external monitors) automatically receive an elegant virtual notch sized to the menu bar.

Note

Read the complete documentation at docs/features/notch-live-activity.md.

Requirements

  • macOS 15+
  • Swift 6.2+
  • Providers and CLI tools you wish to monitor:
    • Claude - CLI mode (claude) or direct OAuth API mode
    • Codex - CLI RPC mode (codex) or ChatGPT backend API mode
    • Gemini - gemini CLI
    • GitHub Copilot - Billing API or Internal Copilot API mode
    • Antigravity - Auto-detected when running locally
    • Cursor - Auto-detected via local SQLite DB and usage API
    • AWS Bedrock - AWS SSO profile or IAM credentials
    • AWS Kiro - kiro-cli via uv tool install kiro-cli
    • Kimi - kimi CLI mode (recommended) or API cookie mode
    • DeepSeek - API key configured in Settings
    • Mistral - Backed by Vibe session logs
    • MiniMax - Coding Plan API key (International / China)
    • Alibaba Coding Plan - Model Studio API key or browser cookie
    • Z.ai - Configure Claude Code with GLM Coding Plan endpoint
    • Amp Code - Auto-detected when amp CLI is installed
    • OpenCode Go - Local SQLite DB or Zen API key
    • Oh My Pi - Aggregates account usage via omp usage --json
    • Grok Build - Tracks xAI credits using CLI OAuth credentials
    • Command Code - Tracks 5-hour, weekly, and monthly credit windows from the same API the cmd CLI uses
    • Vercel - Token-based quota tracking
    • Custom Extensions - Drop custom scripts into ~/.claudebar/extensions/

Provider Setup Guides

Kimi Setup

Kimi supports two probe modes, configurable in Settings > Kimi Configuration:

  • CLI Mode (Recommended): Launches interactive kimi and executes /usage. Requires uv tool install kimi-cli or pip install kimi-cli. No Full Disk Access required.
  • API Mode: Calls Kimi Connect-RPC directly using browser cookie auth. Requires Full Disk Access for Cortex in System Settings > Privacy & Security > Full Disk Access (or set KIMI_AUTH_TOKEN).
AWS Kiro Setup

Kiro monitors AWS Kiro (formerly CodeWhisperer) usage via kiro-cli.

  • Install: uv tool install kiro-cli or pip install kiro-cli
  • Authenticate: Run kiro-cli and complete the login prompt (or use Kiro IDE).
AWS Bedrock Setup

Monitors daily spend, token counts, and per-model breakdowns via CloudWatch.

  • Configure AWS SSO profile or environment variables in Settings > Bedrock.
  • Select target inference regions (e.g. us-east-1, us-west-2).
Alibaba Coding Plan Setup

Monitors 5-hour session, weekly, and monthly quotas on Alibaba Model Studio / Bailian.

  • Choose region: International (modelstudio.console.alibabacloud.com) or China Mainland (bailian.console.aliyun.com).
  • Authenticate via API key or browser cookie extraction.
Cursor Setup

Automatically detects your active Cursor IDE installation and reads authentication tokens from Cursor's local SQLite database. Displays included requests and on-demand spend.

URL Schemes

Cortex supports the cortex:// URL scheme for quick actions from Raycast, Alfred, Touch Bar widgets, or terminal. The legacy claudebar:// scheme remains registered for migrated installations:

URL Scheme Action CLI Example
cortex://open Toggles the Cortex dropdown popover open cortex://open
cortex://refresh Triggers immediate quota refresh for all providers open cortex://refresh
cortex://settings Opens the Cortex Settings window open cortex://settings

Notify! Setup

Publishing quota state to your iPhone is optional and off by default. It is configured in Settings > Notify!.

  1. Get Notify!. It runs on Mac, on iOS, and on any device through web push.
  2. For the Live Activity, open Notify! once on the iPhone or iPad you are publishing to. One cannot be started until that device has registered a push-to-start credential, and only opening the app produces one. Skip this step if you only want the widgets, which are polled rather than pushed, and skip it for a Mac or browser ID, which cannot show a Live Activity at all.
  3. In Notify!, copy your device ID and device token.
  4. Put them in the Device ID and Token fields in Cortex's Notify! settings pane and press Save Link. Pasting a whole notification URL into the Device ID field works too, Cortex splits it across both. Verify Device confirms the pair against Notify! and names the phone it belongs to. Then turn Publish to Notify! on.

The Live Activity needs an iPhone or iPad ID. Notify! also issues IDs for Macs and browsers, and those keep both widgets perfectly well, but Notify! cannot start a Live Activity on one, so Cortex disables just that switch and says why. A group ID receives notifications but owns no Lock Screen or Home Screen of its own, so it gets none of the three.

All three surfaces can be turned off separately, and you can choose which quota the gauge shows. The Home Screen widget shows the same thing as the Live Activity, and the difference is that it stays: a Live Activity appears while something is happening and then goes away, while the Home Screen widget sits where you put it and always shows the latest state. It needs a recent Notify! app, where you turn it on under Settings > Home Screen Widgets, and you place it yourself through iOS's own widget picker. Notify! can also switch the surface off at its own end while it is still rolling out; Cortex treats that as "not yet", pauses just that widget, and carries on publishing the other two.

Note that this sends provider names, quota window labels and remaining percentages to a third-party service. The device token is stored in the Keychain, not in ~/.claudebar/settings.json. A build you compile yourself is ad-hoc signed and the Keychain refuses it, so on those the token falls back to Cortex's app credentials and the pane says so.

Full details: docs/features/notify.md.

Installation

Build from Source (recommended until the first signed release)

git clone https://github.com/benjaminbelaga/Cortex.git
cd cortex

# Install Tuist (if not installed)
brew install tuist

# Install dependencies and build
tuist install
tuist build Cortex -C Release

Note

No Homebrew cask and no signed release exist yet — see docs/release/RELEASE_SETUP.md for the release checklist. A self-compiled build is ad-hoc signed.

Usage

After building, open the generated Xcode workspace and run the app:

tuist generate
open Cortex.xcworkspace

Then press Cmd+R in Xcode to run. The app will appear in your menu bar. Click to view quota details for each provider.

Built for a YOYAKU machine — and usable without one

Cortex is developed on a machine with llm-router serving shared quota snapshots. Two behaviors reflect that origin and stay inert elsewhere:

  • Curated defaults: niche native providers and pay-as-you-go connectors are hidden until explicitly enabled from the + catalogue. Nothing is ever deleted — re-enabling is one click.
  • Legacy alias binding (default/webmaster/tech → router aliases): runs only when the precise pre-migration signature is detected (integration.legacyAliasBinding, default off for fresh installs).

A fresh install without llm-router gets native Claude/Codex rows via the autonomous probes (see RouterSourceModeMigration for the exact fresh-install defaults).

Development

The project uses Tuist for dependency management and Xcode project generation.

Quick Start

# Install Tuist (if not installed)
brew install tuist

# Install dependencies
tuist install

# Generate Xcode project and open
tuist generate
open Cortex.xcworkspace

Build & Test

# Build the project
tuist build

# Run all tests
tuist test

# Run tests with coverage
tuist test --result-bundle-path TestResults.xcresult -- -enableCodeCoverage YES

# Build release configuration
tuist build Cortex -C Release

Secret Scan (required before pushing)

Cortex is a public repository: a credential that reaches main is leaked the moment it lands. Every path to main therefore runs the same gitleaks scan (scripts/secret-scan.sh, rules in .gitleaks.toml): the publish script, the CI secret-scan job, and a pre-push hook you install once per clone:

brew install gitleaks
scripts/install-git-hooks.sh        # installs .git/hooks/pre-push

scripts/secret-scan.sh              # scan origin/main..HEAD by hand
scripts/secret-scan.sh --worktree   # scan uncommitted changes

A finding aborts the push (output is redacted). Rotate the credential first, then rewrite the commit — a rotated key is the only acceptable fix, never an allowlist entry. Only literal test fixtures belong in .gitleaks.toml.

SwiftUI Previews

After opening in Xcode, SwiftUI previews will work with Cmd+Option+Return. The project is configured with ENABLE_DEBUG_DYLIB for preview support.

Architecture

Full documentation: docs/architecture/ARCHITECTURE.md

Cortex uses a layered architecture with QuotaMonitor as the single source of truth:

Layer Purpose
App SwiftUI views consuming domain directly (no ViewModel)
Domain Rich models, QuotaMonitor, repository protocols
Infrastructure Probes, storage implementations, adapters, drivers

Key Design Decisions

  • Single Source of Truth - QuotaMonitor owns all provider state
  • Repository Pattern - Settings and credentials abstracted behind injectable protocols (JSONSettingsRepository)
  • Protocol-Based DI - @Mockable protocols enable testability
  • Chicago School TDD - Tests verify state changes, not method calls
  • No ViewModel/AppState - Views consume domain directly

Import Terminal Theme

Match Cortex's appearance to your terminal. Import any .itermcolors file:

  1. Open Settings (gear icon)
  2. Click Import .itermcolors
  3. Select your file (export from iTerm2: Preferences > Profiles > Colors > Color Presets > Export)

450+ pre-made schemes available at iTerm2-Color-Schemes.

Imported themes are saved in ~/.claudebar/themes/ and persist across restarts.

User Extensions

Create your own provider monitoring modules by dropping a manifest and script into ~/.claudebar/extensions/. Extensions can define quota grids, daily usage cards, and automated HTTP health checks.

See docs/features/extensions.md for full specification and example implementations.

Contributing

Adding a New AI Provider

Use the add-provider skill to guide you through adding new providers with TDD:

Tell Claude Code: "I want to add a new provider for [ProviderName]"

The skill guides you through: Parsing Tests → Probe Tests → Implementation → Registration.

See .claude/skills/add-provider/SKILL.md for details and AntigravityUsageProbe as a reference implementation.

Dependencies

  • Sparkle - Auto-update framework
  • Mockable - Protocol mocking for tests
  • Tuist - Xcode project generation (for SwiftUI previews)

Releasing

Releases are automated on the zero-cost YOYAKU macOS runner and are bound to an exact main commit through gha-safe.

For detailed setup instructions, see docs/release/RELEASE_SETUP.md.

Release Workflow

The workflow uses Tuist to generate the Xcode project:

gha-safe + exact SHA → tuist generate → xcodebuild → Sign & Notarize → Provenance → GitHub Release

Version is set in Sources/App/Info.plist and flows through to Sparkle auto-updates.

Quick Start

  1. Configure the release authority (see full guide):

    • GitHub secret SPARKLE_EDDSA_PRIVATE_KEY
    • Developer ID identity in the trusted runner's login Keychain
    • notarytool Keychain profile YOYAKU-NOTARY
  2. Verify your certificate:

    ./scripts/verify-p12.sh /path/to/certificate.p12
  3. Create a release from the exact checked-in version on main:

    RELEASE_SHA="$(git rev-parse main)"
    gha-safe dispatch --repo yoyaku-group/Cortex --workflow release.yml \
      --ref main --expected-sha "$RELEASE_SHA" --apply

The workflow will automatically build, sign, notarize, and publish to GitHub Releases.

Contributors

Thanks goes to these wonderful people (emoji key):

itshan
itshan

💻 📖 🚧
Avish Jha
Avish Jha

💻
Ramiro
Ramiro

💻
LunarECL
LunarECL

💻
Chandler Anderson
Chandler Anderson

💻
Matt Farmer
Matt Farmer

💻
Alex
Alex

💻
sailesh
sailesh

💻
Billy Smith
Billy Smith

💻
nero
nero

💻
BryanYue
BryanYue

💻
Tony Tang
Tony Tang

💻
Frank Hommers
Frank Hommers

💻
Marcus Quinn
Marcus Quinn

💻
hagiwara takayuki
hagiwara takayuki

💻
jeffscottmtl
jeffscottmtl

💻
Tom
Tom

💻
Jeff Welling
Jeff Welling

💻
Zada5
Zada5

💻
fredericoricco-debug
fredericoricco-debug

💻
Kegan Hollern
Kegan Hollern

💻
Jeff Green
Jeff Green

💻
Benjamin Belaga
Benjamin Belaga

💻
romanvalent
romanvalent

💻
Amogh Akshintala
Amogh Akshintala

💻
Daniel Nakolah
Daniel Nakolah

💻
Mitsi-ag
Mitsi-ag

💻
José Cancino Linares
José Cancino Linares

💻
logancox
logancox

💻
y5mei
y5mei

💻
Hanson Kim
Hanson Kim

💻
Add your contributions

This project follows the all-contributors specification. Contributions of any kind welcome!

To credit someone, comment on any issue or pull request:

@all-contributors please add @username for code, doc

Multiple Providers in the Menu Bar

In Settings → Menu Bar, enable percentage or duration display and select up to three providers. Each selected provider has its own card for choosing a quota, an optional secondary quota, and stacked text size. Their existing logos identify the readouts, while tooltips retain provider names. All displayed providers refresh in the background. Choices are preserved when a provider is removed and added again, and existing single-provider settings are retained. Providers awaiting data show —.

License

MIT

About

Comux: open source macOS AI coding assistant quota monitor

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages