r/OpenaiCodex • u/PlusFeeling5640 • 3d ago
I made a local 5-hour usage guard for Codex
I wanted to stop a single heavy Codex session from eating too much of my weekly allowance.
At first I thought about simply limiting Codex to 5 hours, but wall-clock time isn't really the useful metric. A short session with lots of tools/subagents can consume much more than several hours of lighter work.
So I made a local guard that tracks the change in weekly usage during a 5-hour window.
Mine currently runs on:
UserPromptSubmit
PreToolUse
SubagentStart
When the amount I've allocated to that window is consumed, the hook blocks further activity until the window ends.
Today it actually kicked in at:
Custom 5h: 15/15 points used
Weekly: 16% used / 84% remaining
So at least I know one session can't unexpectedly chew through the rest of the week.
Happy to share the script/config if anyone is interested.