codex-token-discipline

codex-token-discipline is a skill for Claude Code, Codex from perhapsspy/project-legibility. It costs 69 tokens per session (1,241 once invoked), scanned A, original, MIT.

A set of practices for controlling the cost and size of coding-agent work when logs, diffs, browser steps, subagents, or repeated context loading may grow large. It focuses on collecting only the evidence needed for the current phase.

In plain words
What is it for?
Use it to set output limits, delegate bounded side work, reuse evidence, and leave compact handoff notes during exploration, implementation, verification, or release work.
Why use it?
It helps avoid wasting context and usage on noisy output, repeated reads, unnecessary retries, or overly broad delegation.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/perhapsspy/project-legibility/codex-token-discipline
Any agent
npx skills add perhapsspy/project-legibility --skill codex-token-discipline
Clone the repo
git clone --depth 1 https://github.com/perhapsspy/project-legibility

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for codex-token-discipline

README.md
[![agentmods](https://agentmods.dev/badge/skills/perhapsspy/project-legibility/codex-token-discipline.svg)](https://agentmods.dev/skills/perhapsspy/project-legibility/codex-token-discipline)
Your own site
<a href="https://agentmods.dev/skills/perhapsspy/project-legibility/codex-token-discipline"><img src="https://agentmods.dev/badge/skills/perhapsspy/project-legibility/codex-token-discipline.svg" alt="Measured on agentmods" height="20"></a>
Per session 69 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,241 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00069 $0.01241
Opus 5 $0.00034 $0.00620
Sonnet 5 $0.00014 $0.00248
Haiku 4.5 $0.00007 $0.00124

Measured 4d ago against content hash 62c1358711bf, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codex-token-discipline scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/summarize_codex_usage.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/project-legibility/skills/codex-token-discipline/SKILL.md · 103 lines

How it starts

The opening of the file, as written. The whole thing — 103 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Codex Token Discipline

Purpose

Reduce total root-and-child cost without weakening task success, required evidence, or the requested deliverable.

Keep reads, tool output, retries, and delegation bounded. Preserve reusable evidence and escalate only the unresolved part.

Operating Frame

Use only what changes behavior:

  1. Name the current phase: explore, plan, implement, verify, publish, or handoff.
  2. Define the next evidence needed before reading broadly.
  3. Before a potentially noisy tool call, define the smallest useful return shape and output budget.
  4. Delegate noisy side work only when it can return distilled findings with evidence.
  5. At phase boundaries, save compact resume state and hand session-continuation decisions to the owning director when one exists.

Skip the ritual for small edits, direct answers, and simple commands.

Preflight Output Contract

Prevent excess output before it enters the main context; do not rely on summarizing it afterward.

  • For any unpredictable or batch command, name the required return shape first: status, count, paths, selected fields, or first actionable failure.
  • Set a finite return budget on the tool call. For exec-family calls, default to an explicit budget at or below 2,000 tokens unless named evidence requires more; do not wait for a single large-output threshold.
  • Filter, aggregate, or select at the source. For tests and builds, return the exit status, first actionable failure, and command before requesting more detail.
  • When full output is useful for later inspection, write it to a task-local or temporary artifact and return only its path, size, compact summary, and first actionable failure. Inspect bounded slices from the artifact as needed.
  • Do not create an artifact for disposable output that can be reduced at the source.

Summary-First Reads

Start narrow; widen only when it changes the next decision.

  • Search with rg or file lists before opening files.
  • Prefer git diff --stat, git diff --name-only, focused git diff -- <path>, and targeted sed -n ranges before full diffs.
  • For logs and command output, use tail, head, jq, counts, filters, or error searches before full transcripts.
  • Treat every returned tool result as future input cost. Prefer counts, paths, summaries, or selected evidence before full output.
  • After a failure, widen from the saved artifact or rerun only the smallest failing scope; avoid repeated full transcripts in the main thread.

Read the full file on GitHub · 103 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 103 lines · 69 tokens per session scan A 62c1358711bf

Subscribe to this mod's changes

codex-token-discipline is a skill published in the GitHub repository perhapsspy/project-legibility (5 stars, last pushed today), licensed MIT. It adds 69 tokens to every session and 1,241 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

qa

Browser-based QA verification. Launches a real browser, navigates the app, clicks buttons, fills forms, and tests user flows. Works as a standalone skill or as a phase end condition in campaigns. Requires Playwright (optional dependency, graceful skip if not installed).

SethGammon/Citadel · 56 tokens

live-preview

Mid-build visual verification loop. Takes screenshots of components during construction, not just after. Catches visual regressions and invisible features before they compound. Requires Playwright or similar screenshot tool.

SethGammon/Citadel · 40 tokens

author

Write a new doc in the right place with the right name. Use when asked to "write a doc", "where should this doc go", "add an ADR", "document this decision", "new spec", or "new feature plan".

MedAdemBHA/docflow · 51 tokens

router

Find the right doc before reading code. Use when asked "where is X documented", "is there a spec/ADR for X", "what's the roadmap", "open bugs", "read the docs about X", or "share the docs".

MedAdemBHA/docflow · 52 tokens

changelog

Record shipped work in the monthly changelog (append-only). Use when something ships or when asked "what changed", "add to changelog", "release notes", or "what shipped this month".

MedAdemBHA/docflow · 43 tokens

init

Set up docflow in a repo with no docs yet: scaffold the docs tree, write docflow.json, add agent guidance. Use when asked to "set up docflow", "initialize docs", "scaffold docs", or "make this repo use docflow".

MedAdemBHA/docflow · 56 tokens