← All projectsSKILL / OPEN SOURCE

Codex Token Xray

See where your
context goes.

Read actual session logs to inspect tool results, skill bodies, and instructions. Find what can be trimmed and review the changes first.

02 / CODEX
CONTEXT BREAKDOWN↗
Tool resultsSkill bodiesInstructions
Read session logs. Find where tokens go.
Illustration of report categories
LUCIANLABS / CODEX TOKEN XRAYBuilt to be used. And shared.
HOW IT WORKS

How to use it.

01

Read the session logs.

Analyze local Codex session logs. Reports and backups stay on your computer.

02

Find what takes space.

Inspect tool outputs, skill bodies, and project instructions. Totals use recorded usage; category shares are size-based estimates.

03

Review before changing.

Review proposed changes and backups before trimming your own skills and instructions or removing selected unused skills.

IN DEPTH

In depth

Numbers measured from 12 real sessions, and what this skill changes and leaves alone.

What real sessions showed

These come from reading 12 real Codex sessions on one machine. Where the tokens go turned out to differ from the usual guesses.

~33,000tokens spent before you type anything: app instructions 12,000 · base 5,000 · skill list 6,000
Over halfof the context during work is tool results
39 vs 36,000one skill’s description per session vs its body, read 19 times

The 33,000 tokens at start-up are out of your hands. During work, every file read in full lands in the context as is. And what pays to trim is a skill’s body, not its description.

It does three things

  • It lists skills no session read in the last 90 days and removes only the ones you pick, after zipping the whole folder; one command restores it. Skills you wrote are never removed by the tool.
  • It trims your own long skills: what every run needs stays in SKILL.md, the rest moves into references files. Nothing is deleted.
  • It trims the project’s AGENTS.md the same way.

It shows the diff and asks once before changing anything. Skills by other people and Codex’s own skills and plugins are never edited: their authors keep tuning them, and an update would overwrite the edit.

Can you trust the numbers?

  • Token totals are Codex’s own usage records; nothing is estimated there.
  • The split by category is estimated from size. Against real growth it matched at about 0.85, and every report prints that ratio.
  • Savings show up in sessions started after the trim.

Where your data stays

Session logs are read from ~/.codex/sessions on your machine, with no network access. Reports and backups live only under ~/.codex-token-xray. Add --project to look only at sessions started in the current folder.

FAQ

How is it different from Astra Xray?

Astra Xray cleans up the skill list and instructions Codex hands to GPT-6 Astra. Codex Token Xray measures where tokens actually went, for any model, and trims the heavy parts.

What do I need?

Python 3.9 or newer. Add -g to the install command to use it in every project.

GET STARTED

Try it in
your workflow.

After installing, type $codex-token-xray in Codex. Requires Python 3.9 or newer.

TERMINAL
npx skills add Seokwoooo/codex-token-xray
Read the full guide on GitHub ↗
← Explore other projects