agentleFS
zoo3323zoo3323/usage-statusline/skills/refresh/SKILL.md

refresh

Skill1 starsChanged 31 days agoMITView on GitHub

Refresh the Codex and Claude usage gauges right now and report the numbers. Use when the user asks for "/refresh", "refresh usage", or "show me my usage now".

12 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 10 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If that script does not exist, the status line is not set up here.

    line 16

“Common” is measured: kept by at least 6 in 10 of the 10 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

refresh

Both usage gauges refresh in the background at most once every 5 minutes, so the status line can be up to 5 minutes behind. Use this skill when the user wants the current numbers immediately.

Steps

  1. Note the mtime of the two cache files, then run ~/.claude/scripts/usage-refresh.sh with Bash. It refreshes both caches and prints nothing.
    • If that script does not exist, the status line is not set up here. Say so, point to /usage-statusline:setup when this skill came with the plugin, and stop.
  2. Read the caches:
    • Codex — ~/.claude/codex-status/codex-usage.json: rate_limit.primary_window.used_percent (5-hour), rate_limit.secondary_window.used_percent (weekly), rate_limit.primary_window.reset_at (Unix epoch).
    • Claude — ~/.claude/codex-status/claude-usage.json: five_hour.used_percentage, seven_day.used_percentage, five_hour.resets_at (Unix epoch), fetched_at.
  3. A cache whose mtime did not change means one of two things — tell them apart by how old the file is:
    • Under a minute old: the poll was skipped on purpose, because the numbers were already current. Nothing is wrong.
    • Older than that: this half failed and its numbers are older than they look. Usual causes are Codex not being logged in (~/.codex/auth.json missing), the Claude usage endpoint rate-limiting the call (it answers bursts with 429 for a few minutes), or an OAuth token that expired before Claude Code rotated it. Report a stale half as stale rather than presenting old numbers as current.
  4. Report the numbers in a line or two. The status line picks them up within a second or two.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.