Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codex Context Bar

CI

Small native macOS menu-bar monitor for the current Codex context window.

It reads only:

~/.codex/sessions/**/*.jsonl

The displayed context percentage is calculated from the newest Codex event_msg/token_count record:

last_token_usage.input_tokens / model_context_window

Build:

./build.sh

Install and enable login startup:

./install.sh

What it shows

The menu-bar title is CTX plus a five-cell bar and a percentage, e.g. CTX ▰▰▱▱▱ 38%. The dropdown lists, for the newest session: context percent with used/window tokens, model, input and cached-input tokens, output tokens, the window size, when the record was written, and the session file name. Refresh Now (⌘R) and Quit (⌘Q) are at the bottom; refresh is otherwise every 2 seconds.

Only the last 512 KiB of a session file is read — the interesting record is the newest one, so the whole transcript is never parsed. Nothing leaves the machine: there is no network code in the binary.

Tests

./build.sh && ./tests/run.sh

tests/run.sh points the reader at tests/fixtures/sessions via CODEX_CONTEXT_BAR_ROOT and asserts the exact percentage, the model name and that a malformed line does not abort the scan. That env var exists for this — unset in normal use, when ~/.codex/sessions applies. CI runs it on every push.

Requirements

macOS 13 or newer (-mmacosx-version-min=13.0), Apple clang. No dependencies beyond Cocoa — the whole program is one 388-line main.m built by a 30-line build.sh.

Licence

MIT.

About

macOS menu-bar monitor for the Codex context window. 388 lines of Objective-C, Cocoa only, no network; reader asserted against a fixture session in CI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages