OPEN-SOURCE CODEX CONTEXT PLUGIN

Same Codex. 83.6% fewer tokens to show it where to start.

Compact Context replaces a long repository map with five short file hints. Codex still has access to every file. In 68 public tasks, the shorter hint included the eventual edit file 50 times; the longer baseline did so 48 times.

MIT licensed · no separate service · no embeddings · does not rewrite source

CANDIDATE PAYLOAD / ACTUAL BETA TURNLOCAL HOOK

> fix the receipt marker race in turn_start.py and context_receipt.py

FIVE STARTING SUGGESTIONS — NOT A FILE LIMIT

  1. tests/test_receipt_hook.pytest · symbols:run_raw, run_event, parse_json · why:BM25, path-part, related-test
  2. plugins/compact-codebase/hooks/turn_start.pysource · symbols:read_event, bounded_identifier, git_probe · why:BM25, path-part, signature
  3. plugins/compact-codebase/hooks/context_receipt.pysource · symbols:read_event, marker_path, pointer_path · why:BM25, path-part, signature
  4. plugins/compact-codebase/skills/compact-codebase-context/scripts/repo_context.pysource · symbols:deadline_ns, check_deadline, remaining_timeout · why:BM25, path-part, signature
  5. benchmarks/codex_session/runtime.pysource · symbols:validate_codex_api_key, clean_environment, command · why:BM25, path-part, signature
MAP-COMPARISON RECEIPT AFTER THE RESPONSE~686 repository-map tokens avoided73% smaller · 5 files · est.

Codex can still search every repository file after this hint · inspect receipt data ↗

WHAT THE SAVING MEANS

83.6% fewer tokens for the starting map—not the whole task.

Same repository access, shorter hint

Both methods suggest up to five files where Codex should begin. Compact Context sends much less text to make that suggestion.

Codex still has access to the complete repository and continues its normal search after the hint.

PUBLIC BENCHMARK · 68 TASKS

Shorter starting guidance. Comparable file targeting.

Two ways of suggesting where Codex should start were compared across ten public repositories. Neither method restricted which files Codex could inspect afterward.

83.6%

fewer starting-map tokens

1,402 → 230 tokens per task

1,172

fewer input tokens

used before normal repository search

50/68

edit file suggested

longer baseline map: 48/68

WHAT 50/68 MEANS

The starting list contained the file later edited.

For each task, the benchmark knew which file needed changing and checked whether it appeared in the five starting suggestions. Compact Context included it in 50 of 68 tasks; the longer lexical map included it in 48 of 68. Both could still search the whole repository afterward. This measures the initial hint—not task completion or code quality.

WHAT RUNS BEFORE THE MODEL

A smaller starting hint—not a smaller repository.

Compact Context suggests useful places to begin. It does not summarize source, block files, or replace Codex’s normal repository search.

  1. 01 / SCAN

    Use Git as the boundary.

    Read tracked and non-ignored untracked files. Skip dependencies, build output, binaries, symlinks, oversized files, and credential-shaped content.

  2. 02 / INDEX

    Cache code metadata locally.

    Record paths, file roles, symbols, signatures, imports, frequent identifiers, hashes, and resolved local dependencies.

  3. 03 / RANK

    Score evidence with field-weighted BM25.

    Exact paths and symbols carry the most weight. Imports, rare identifiers, dependents, and related tests add cross-file evidence.

  4. 04 / SELECT

    Choose complementary files.

    A greedy selector takes up to five useful candidates, rewards linked files and different roles, and penalizes duplicate evidence.

  5. 05 / SEND OR ABSTAIN

    Add a bounded hint, or add nothing.

    The automatic map is capped at 650 estimated tokens. Weak matches, small direct repositories, and failures leave the normal Codex turn untouched.

MAP-COMPARISON RECEIPT

The saving ends the answer. You cannot miss it.

When Compact Context supplies a starting hint, the normal Codex response ends with the estimated input saved for that hint. It does not claim a saving for the complete task.

CODEX ANSWER FOOTERRepository map: ~686 tokens avoided (est.) · 73% smaller · 5 filesAdded only when Compact Context supplied the shortlist for that answer.
~686 avoided
estimated difference from the five-file reference map
73% smaller
249-token shortlist versus a 935-token reference map
5 files
starting suggestions only; Codex can still search every file

The public benchmark uses exact o200k counts. The live receipt uses a clearly labeled characters ÷ 4 estimate and does not claim complete-session savings.

0.5.0-BETA.7

One command. Two approval clicks.

Paste one Terminal command. It installs the plugin, opens the Codex hook review, and takes you directly to the two approvals.

RECOMMENDEDCodex desktop / local

A short five-file starting hint before qualifying coding prompts, plus a footer showing the estimated input saved for that hint. Codex keeps normal access to the full repository.

curl -fsSL 'https://compact-context.met.chatgpt.site/install.sh?v=4' | bash
  1. 01
    Paste the command in Terminal once.
  2. 02
    The /hooks review opens automatically. Approve UserPromptSubmit and Stop.
  3. 03
    Quit the CLI, fully reopen Codex Desktop, and start a new chat.
PREVIEWRepository / Codex cloud

Check the skill into an existing codebase so the repository carries the shortlist workflow with it. This mode is a preview, not the automatic hook install.

curl -fsSL https://compact-context.met.chatgpt.site/install-repo-skill.sh | bash
  1. 01
    Run from the repository root.
  2. 02
    Review and commit .agents/skills/compact-codebase-context.
  3. 03
    Codex discovers the skill from the repository; qualifying runs report a scoped map receipt in the response.

The installer is open source and verifies the downloaded ZIP against the published SHA-256 before installation.

OPEN RESEARCH LEDGER · SEPARATE LLM-IR EXPERIMENT

The proof still fails. We publish the losses.

v0.0.8 fixed most of the parser failure exposed by the first frozen run, then faced a new untouched slice. Qwen still produced only 4/20 correct LIR solutions at Pass@1 versus 17/20 in Python. No breakthrough, no-quality-loss, or token-saving claim is supported.

LIR v0.0.84/20Pass@1 · 5/20 after repair
Python17/20Pass@1 · 18/20 after repair
PLAIN DEFINITION

IR means intermediate representation. The model writes a small code-like notation, a compiler turns it into JavaScript, and tests run the result. We tested whether that detour would use fewer tokens than ordinary Python. It did not.

WHAT THE FAILURE TAUGHT US

The parser improved. The quality gap remained.

First-attempt compiler failures fell from 20/20 in v0.0.7 to 2/20 in v0.0.8. The remaining losses were unsupported operations and incorrect algorithms from the unfamiliar grammar.

v0.0.8 TOKEN ECONOMICS1,197 versus 238.5 tokens per correct solution

LIR used about 5.02× as many session-amortized tokens per correct solution as Python. The target was at least 25% fewer.

This language experiment is separate from Compact Context’s shipped repository-routing benchmark above. The negative result does not change the measured 1,402 → 230 map-token comparison; it prevents a broader model-efficiency claim.

PRODUCTION CLAIM STATUS

The 30% complete-workload cost target is not a published claim yet.

That test uses matched completed tasks, native provider billing, hidden tests, 450 runs, and three unrelated model families. The 30% full-workload claim will ship only after it passes.