> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ccs.kaitran.ca/llms.txt
> Use this file to discover all available pages before exploring further.

# CCS Bar

> Native macOS menu-bar companion for quota, spend, and account controls

# CCS Bar

CCS Bar is the native macOS menu-bar companion for CCS. It gives you a fast
quota and spend glance without opening the dashboard, then lets you jump into
account controls when you need them.

> [!NOTE]
>
> CCS Bar is macOS-only. It talks to your local CCS server over loopback and
> does not call Claude, Codex, or CLIProxy providers directly.

> [!WARNING]
>
> CCS Bar v1 expects the default local CCS data directory at `~/.ccs`. Custom
> `CCS_HOME` or `CCS_DIR` layouts may not be discovered by the native app yet.

## Current Snapshot

![CCS Bar macOS menu-bar panel with sanitized quota, spend, and account rows](https://mintcdn.com/ccs-7e541244/a4mGiZwpOPapy2pG/assets/screenshots/ccs-bar-panel.webp?fit=max\&auto=format\&n=a4mGiZwpOPapy2pG\&q=85\&s=10ce22e7fd810d6fc8700f91b036da58)

The screenshot uses sanitized demo account names and usage values. The layout
matches the current panel structure: native subscription rows first, spend
summary next, pool accounts below, and quick actions in the footer.

## Install And Run

**1. Install the app**

```bash theme={null}
ccs bar install
```

This downloads `CCS Bar.app` from the `ccs-bar-latest` release into
`~/Applications`, clears the macOS Gatekeeper quarantine, and records how to
start the local server so the app can launch it on its own.

**2. Open it like any Mac app**

Launch CCS Bar from Spotlight, Finder, or the Dock. The first time you open
the menu, it starts the local CCS server in the background and connects. You
do not need to keep a terminal open.

**3. Or start it from the CLI**

```bash theme={null}
ccs bar
ccs bar --port 3999
```

`ccs bar` starts the server in the background and returns your prompt right
away, then opens the app. If a server is already running it reuses it. Add
`--port` to choose an exact loopback port.

**4. Reinstall or remove when needed**

```bash theme={null}
ccs bar install --launch
ccs bar uninstall
```

## Updating

CCS Bar keeps itself current. When a newer build is published it shows an
**Update available** row at the top of the menu. Click **Update Now** and the app
downloads the new version, replaces itself, and reopens. You never need a
terminal.

Automatic checks are on by default. You can turn them off in **Settings >
Updates** ("Check for CCS Bar updates automatically"). You can also update at any
time from the CLI with `ccs bar install`, which always fetches the latest
published build.

The in-app updater runs `ccs bar install` for you, so keep the CCS CLI on your
PATH and reasonably up to date.

## Commands

| Command | What it does |
| - | - |
| `ccs bar` | Start the background server if needed, then open the app |
| `ccs bar --port <n>` | Start or move the server to an exact port from 1 to 65535 |
| `ccs bar stop` | Stop the background server |
| `ccs bar status` | Show the process-record, PID, and HTTP reachability state |
| `ccs bar serve` | Run the server in the current terminal (advanced; `ccs bar` runs this for you in the background) |
| `ccs bar install` | Install or update the app |
| `ccs bar uninstall` | Remove the app |

### Port And Lifecycle Behavior

* `--port` accepts only an integer from `1` to `65535`. CCS fails instead of
  silently choosing another port when the value is invalid or occupied.
* The selected port is sticky. Later launches try it first, including after
  `ccs bar stop`; if it is unavailable, a launch without `--port` can use a
  standard fallback port.
* When moving a running server, CCS checks the destination before stopping the
  current server. If the replacement cannot start or become ready, CCS tries to
  restore the prior server. If restoration also fails, it preserves the prior
  discovery and launch files for recovery.
* `ccs bar stop` verifies both the PID and the process start identity before it
  sends `SIGTERM`. A mismatch, permission error, signal failure, or timeout
  leaves the recovery files untouched instead of risking another process or
  losing diagnostic state.

> [!WARNING]
>
> Older CCS versions stored only a number in `server.pid`. Current versions
> treat that legacy record as unverifiable: `ccs bar status` reports it as
> invalid, and `ccs bar stop` refuses to signal the PID or delete recovery
> files. Do not run `kill` against that number alone because macOS may have
> reused it. Confirm and quit the CCS server in Activity Monitor, or restart the
> Mac; only after confirming it is stopped should you move the stale
> `server.pid` and `bar.json` aside and run `ccs bar` again.

## What It Shows

> [card] Native subscription quota
>
> Claude Code and Codex rows show quota windows, reset timing, and the
> tightest remaining window first. Codex usage refreshes live, and a refresh
> control on the card pulls the latest reading on demand.

> [card] Spend at a glance
>
> A spend chart you can switch between Today, 7-day, and 30-day, with
> time-axis labels (hours for today, days for the wider windows). Totals come
> from local CCS usage data.

> [card] Account control
>
> Pause, resume, set default, solo an account, or use tier-lock from the menu.

> [card] Dashboard handoff
>
> Open the dashboard, refresh data, change icon style, or open settings
> without leaving the menu.

## How It Works

![CCS Bar loopback data flow diagram](https://mintcdn.com/ccs-7e541244/a4mGiZwpOPapy2pG/assets/screenshots/ccs-bar-loopback-flow.svg?fit=max\&auto=format\&n=a4mGiZwpOPapy2pG\&q=85\&s=ab49bf65c8df302649f98086a628dcaa)

The CCS web server runs as a background process, separate from your terminal.
When you open the app it checks the usual local ports for a running server, and
if it does not find one it starts the server itself using the launch details
recorded at install time. That is why a plain double-click works without the
CLI.

CCS Bar keeps a few small files under `~/.ccs`:

| File | Purpose |
| - | - |
| `~/.ccs/bar.json` | The live server address the app connects to |
| `~/.ccs/bar/launch.json` | How to start the server, recorded at install, so the app can start it without a shell PATH |
| `~/.ccs/bar/server.pid` | Verified background-process record used by `ccs bar stop` and `ccs bar status` |

`~/.ccs/bar.json` looks like this:

```json theme={null}
{ "baseUrl": "http://127.0.0.1:3000", "port": 3000, "authMode": "loopback" }
```

The app then calls local endpoints:

| Endpoint | Used for |
| - | - |
| `GET /api/bar/summary` | account rows, quota, health, reset timing |
| `GET /api/bar/summary?refresh=true` | provider-backed refresh when the menu opens |
| `GET /api/bar/analytics` | spend windows, sparkline, top models, surface breakdown |
| account action endpoints | pause, resume, default, solo, tier-lock |

Provider traffic stays in CCS. The native app only talks to localhost.

## Panel Map

![Annotated CCS Bar panel map](https://mintcdn.com/ccs-7e541244/a4mGiZwpOPapy2pG/assets/screenshots/ccs-bar-panel-map.svg?fit=max\&auto=format\&n=a4mGiZwpOPapy2pG\&q=85\&s=630c277774603862122e2dcbf56cdace)

The panel is organized for quick triage:

* **Header**: CCS identity, app version, refresh state
* **Subscriptions**: Claude Code and Codex first, sorted by the tightest quota
* **Spend**: a Today / 7-day / 30-day chart with time-axis labels below quota
* **Pool accounts**: CLIProxy account rows after native subscriptions
* **Footer**: dashboard, icon style, settings, refresh, quit

## Feedback Wanted

CCS Bar is new enough that real workflow feedback matters. Please open an issue
for rough edges, missing controls, unclear quota labels, menu sizing, install
friction, or any idea that would make the bar more useful.

> [card] [Report an issue](https://github.com/kaitranntt/ccs/issues/new/choose)
>
> Bugs, confusing states, install problems, and missing provider data.

> [card] [Suggest an improvement](https://github.com/kaitranntt/ccs/issues/new/choose)
>
> Workflow ideas, panel layout feedback, and new account actions.

## Troubleshooting

| Symptom | What to try |
| - | - |
| Menu shows "CCS is not running" | Open the menu again to let the app start the server, or run `ccs bar status` to check and `ccs bar` to start it |
| Requested port is busy | Choose another free port, or stop the process using that port; CCS leaves an existing Bar server running when the destination preflight fails |
| `server.pid` is invalid after an upgrade | Do not signal the recorded number blindly; follow the legacy PID safety steps above |
| Install says the server predates CCS Bar | Update CCS, restart `ccs bar`, then reinstall |
| macOS blocks first launch | Right-click the app and choose Open, or rerun `ccs bar install` |
| Quota looks stale | Reopen the menu, use the footer refresh, or the refresh control on the Codex card to force a live pull |
| Remote dashboard bind does not work | Keep CCS Bar on loopback; v1 expects `127.0.0.1` |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.