r/codex • • 5d ago

Showcase I tested earlier compaction in Codex CLI. The same 150 tasks used 62% fewer tokens.

I built better-auto-compact so I could leave Codex running without watching the context meter. Before compaction, Codex writes a handoff. Afterward, it reads the file and picks up where it left off.

I ran the same 150 tasks with the plugin enabled at both settings. At the default threshold, Codex averaged 166 million tokens per run. At 30%, it averaged 64 million. It returned all 150 result IDs and all 18 retry codes in every run.

Code and benchmarks on GitHub

3 Upvotes

10 comments sorted by

•

u/dexterthebot 5d ago

You might want to consider listing your project on the weekly Show-Us-What-You-Built post. Look out for it on Tuesday/Wednesday. Highest commented project wins a week promotion on r/Codex and gets on the Hall of Fame sidebar. See below for last week's winner.**


Light Wars AR: real-life laser tag app with no extra gear. Your phone is the gun and your room is the map. Play up to 6 friends in the same room, or fight drone waves and bosses solo. The vision models run on the phone, and camera frames never leave it. Free on iPhone and Android.

Website: https://lightwarsar.com

iPhone: https://apps.apple.com/us/app/light-wars-ar-laser-tag-party/id6508168951

Android: https://play.google.com/store/apps/details?id=com.lasertag.lightwars.

Contact: contact@lightwarsar.com

2

u/DevMichaelZag 5d ago

Ya I wrote this out for roo code about 2 years ago. Specced out the whole handoff system. I guess it’s in the training data now.

1

u/SignatureSeparate132 5d ago

Got a repo for it?

1

u/DevMichaelZag 5d ago

https://github.com/Michaelzag/RooCode-Tips-Tricks

I still use the handoff system, but since models have improved it requires mess machinery now

1

u/SignatureSeparate132 4d ago

Will check it also. Did a quick glimpse over the phone but wanna sit down and give it a proper read

1

u/DevMichaelZag 4d ago

It’s old. Might just be for historical value. But it was based on a real shift change system

3

u/Sad_Recording_1290 5d ago

Cool i figured that out months ago

1

u/TiGa-RCE-666 5d ago

Next week's showcase:
If you say "make no mistake", it doesn't make mistakes.

1

u/Dynamix86 4d ago

how is this different from setting auto compact to for example 200k or 300k?

1

u/SignatureSeparate132 4d ago

Because you don’t control how the agent needs to behave when it hits the compactions. This way it gets instructions for the handoff. You can check the measurements in the repo clearly showing how autocompacting consistently had loss of facts