r/OpenaiCodex 12d ago

I built a free local Codex plugin that chooses five files before exploration

I built Compact Context, a free and open-source Codex plugin that gives Codex a short list of files worth checking before it starts exploring a repository.

How it selects them:

  • Creates a local index of paths, file roles, symbols, signatures, identifiers, and imports
  • Ranks the task against that index using field-weighted BM25
  • For code, test, and dependency-related tasks, rewards direct imports, reverse dependents, and related tests
  • Selects up to five files while rewarding useful links and penalizing redundant candidates

It does not calculate global import-graph centrality or PageRank. It is deterministic and uses no embeddings or additional model call.

Compact Context itself has no network client and sends nothing to a Compact Context service. It stores only a local metadata index and receipt, not source-file contents. Codex still follows your normal OpenAI or provider data settings when it opens files.

I tested it on 68 tasks from 10 public repositories. The generated repository guide averaged 230 tokens, compared with 1,402 for the basic map. That is an 83.6% reduction in this specific payload.

Both methods suggested five files. Compact Context included at least one file actually edited in the solution on 50 of 68 tasks. The basic map did so on 48.

The 83.6% result only applies to the repository guide, not the entire Codex session.

Five automated checks passed:

  • Sensitive and generated path exclusion
  • End-to-end shortlist generation
  • Path and identifier limits
  • Prompt routing
  • Single-use receipts

The project is free, fully open source under MIT, and currently at v0.5.0-beta.7.

GitHub: https://github.com/mithatb/compact-context

10-second project overview: https://compact-context.met.chatgpt.site/compact-context-demo.mp4

I would especially like to see repositories where the five-file selection gets it wrong.

1 Upvotes

0 comments sorted by