Skip to content

sirop-d/codex-pet-limit-rings

 
 

Repository files navigation

codex-pet-limit-rings

Codex pets are tiny ambient companions for the work happening in Codex. This project adds one more layer to that idea: your pet can quietly show how much Codex capacity you have left, without turning the app into a dashboard.

The experience is a small macOS companion app. It watches where the Codex pet is, draws two polished rings around it, and keeps those rings attached to the pet as it moves. It does not patch Codex, change pet art, or modify the Codex app bundle.

It works with whatever Codex pet you like. Built-in pet, custom pet, tiny dog, robot, weather daemon, or anything else: the app does not care. It only follows the pet window that Codex is already showing.

Always-visible reset countdown readouts under a Codex pet

sirop-d Fork

This fork keeps the upstream companion-app boundary, while exploring a more readable always-on reset readout for daily use.

In the sirop tuning, the reset countdowns stay visible below the pet instead of appearing only as hover labels near ring endpoints:

  • The left readout shows the short-window remaining percentage and reset countdown.
  • The right readout shows the weekly remaining percentage with a w prefix and its reset countdown.
  • The readouts are placed close under the rings so the pet and speech bubble stay readable.
  • The two readout capsules shrink to the needed text width, then match the wider capsule so the bottom pair stays balanced.
  • Ring opacity can be softened from the menu bar without changing the selected colors.
  • Double-clicking the pet can open a folder picker rooted at /Users/sirop/Documents/*🍀sirop; choosing a folder opens it in Codex so you can start a new project chat from that folder.
  • The goal is to keep usage awareness ambient: visible at a glance, but not turned into a full dashboard.

The upstream-style hover readouts are still part of the original project shape:

Codex Pet Limit Rings around a Codex pet

What You See

The rings are designed to be glanceable:

  • The outer ring shows the short-window limit remaining.
  • The inner ring shows the weekly limit remaining.
  • sirop tuning can keep bottom reset readouts visible for both limits.
  • Outer and inner healthy ring colors can be selected separately per pet from menu-bar presets or macOS Custom... colors.
  • Color moves from calm green/blue to amber and red as capacity gets low.
  • The bottom readouts show exact remaining percentages and reset countdowns at a glance, with matched compact capsule widths.
  • A small menu-bar icon lets you hide the rings, choose colors, change ring opacity, choose a sirop folder, refresh data, or quit.

When the Codex pet is closed, the rings disappear. When the pet comes back, they come back too. On multi-display setups, the rings stay with the pet instead of jumping to whichever screen is focused.

Because the rings are drawn in a separate transparent overlay, they do not need pet-specific sprites, masks, metadata, or configuration. Change pets in Codex and the rings follow the new one automatically.

Why It Works This Way

The important design choice is the companion boundary. A menu item inside Codex itself would mean patching Electron app files and redoing that patch after app updates. That is brittle and hard to open source.

codex-pet-limit-rings stays outside the Codex app. It reads local Codex state, asks ChatGPT for live usage data using the local Codex/ChatGPT token, and renders its own transparent always-on-top window around the pet. The result is reversible, inspectable, and easy for another Codex agent to install or modify.

Pet wakeups are handled by a lightweight filesystem watcher on Codex's local global-state file, with a slow fallback timer as a safety net. That lets the rings snap back when the pet is re-enabled without constantly polling for position changes.

Quick Start

Install the rings as a login item:

tools/install-limit-rings.sh

You should see a small rings icon in the macOS menu bar. Use that menu to toggle Show Rings, choose outer and inner ring colors, adjust ring opacity, choose a sirop folder and start a new Codex project chat from it, refresh the latest usage data, or quit.

Then use any Codex pet normally. No pet setup step is required.

Run a development build without installing the login item:

tools/run-limit-rings.sh

Uninstall everything the installer adds, including saved ring visibility and color preferences:

tools/uninstall-limit-rings.sh

Give This Repo To Codex

This repository is structured so a Codex agent can pick it up from a GitHub link.

Ask the agent:

Use the bundled codex-pet-limit-rings skill from this repository. Install the rings companion for my Codex pet, verify the LaunchAgent is running, and confirm the rings stay anchored to the pet.

The agent should read:

  • AGENTS.md for the project contract.
  • skills/codex-pet-limit-rings/SKILL.md for the install, debug, and validation workflow.
  • docs/limit-rings.md for the data and rendering model.

To install the bundled skill into local Codex:

tools/install-codex-skill.sh

Data And Privacy

The app reads only local Codex files and one ChatGPT usage endpoint:

  • ~/.codex/.codex-global-state.json tells it whether the pet is open and where it is.
  • ~/.codex/auth.json provides the local bearer token used to read live usage from ChatGPT.
  • ~/.codex/logs_2.sqlite is used as a cached fallback if live usage is unavailable.

It does not require an OpenAI API key. It does not send pet images, screenshots, prompts, or repo contents anywhere.

Project Shape

tools/
  codex-pet-limit-rings.swift      native macOS companion app
  install-limit-rings.sh           build, install, and start at login
  uninstall-limit-rings.sh         remove the app and login item
  run-limit-rings.sh               development launch
  build-limit-rings.sh             app bundle builder
  install-codex-skill.sh           copy the bundled skill into ~/.codex/skills

skills/codex-pet-limit-rings/
  SKILL.md                         Codex-agent workflow for this project

docs/
  limit-rings.md                   implementation contract and data flow

experiments/weather-pets/
  earlier weather-pet renderer     kept as a separate experiment

Development

Build the app:

tools/build-limit-rings.sh

Render a static preview PNG:

swiftc tools/codex-pet-limit-rings.swift -o tmp/codex-pet-limit-rings -framework AppKit -lsqlite3
tmp/codex-pet-limit-rings --preview tmp/limit-rings-preview.png --size 164

Validate the shell scripts:

bash -n tools/*.sh

Experiments

The original exploration included a Python renderer for weather-mutated Codex pets. That work now lives under experiments/weather-pets/ so the public repo can stay focused on limit rings while preserving the larger idea: Codex pets can become ambient interfaces for state, context, and mood.

Acknowledgements

This repository is forked from petergpt/codex-pet-limit-rings and preserves the original MIT license.

License

MIT. See LICENSE.

About

Usage-limit rings for Codex pets.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Swift 67.0%
  • Python 29.6%
  • Shell 3.4%