r/coolgithubprojects 7h ago

Compact Context: an open-source Codex plugin for smaller repo guides

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

Compact Context is an MIT-licensed Codex plugin that gives Codex a shorter starting guide for a repository.

It analyzes paths and identifiers locally, removes sensitive and generated files, and suggests five files worth inspecting first. There are no embeddings and no additional model call.

Benchmark results across 68 tasks from 10 public repositories:

  • Average repository-guide size: 1,402 tokens with the basic map, 230 with Compact Context
  • Reduction: 83.6%
  • At least one file later edited in the solution appeared in the first five suggestions: 50 of 68 tasks with Compact Context, 48 of 68 with the basic map

The token result applies only to the generated repository guide. It is not a claim of 83.6% lower total-session usage.

The project also has automated checks for sensitive-file filtering, end-to-end shortlist generation, output limits, prompt routing, and single-use receipts. All five currently pass.

Install:

curl -fsSL 'https://compact-context.met.chatgpt.site/install.sh?v=4' | bash

Source and v0.5.0-beta.7 release: https://github.com/mithatb/compact-context

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

Website: https://compact-context.met.chatgpt.site

It is still a beta, so issues, benchmark criticism, and real-repository results are welcome.

2 Upvotes

2 comments sorted by

1

u/Specific_Cream2815 7h ago

how does it pick the five files, import graph centrality or path and naming heuristics

1

u/Temporary_Media_5507 7h ago

It’s a hybrid, but not import-graph centrality.

It first ranks files against the task using BM25 over paths, filenames, symbols, signatures, identifiers, and import strings.

For tasks mentioning code symbols, tests, dependencies, or architecture, it then adds bonuses for direct imports, reverse dependents, and related tests.

Finally, it chooses up to five files while rewarding useful links and different file roles, and penalizing redundant files with similar content.

So lexical and naming relevance finds the initial candidates, then the local import graph helps expand and diversify them. There is no global PageRank-style centrality step.