Skip to content

Graph-aware context selection: pack a file plus its dependency cone (not just compress signatures)Β #1682

Description

@rs545837

Description

Repomix already does something structural that I love: --compress uses Tree-sitter to shrink files down to their signatures. This issue is about the natural next step beyond shrinking content, which is selecting the right content.

The problem: when I'm working on fileA.ts, the context an LLM actually needs is fileA plus the things it calls and imports (its dependency cone), not the whole repo, and not just compressed signatures of unrelated files. Today there's no way to say "pack this file and everything it depends on within N hops."

The idea: graph-aware context selection.

repomix --include "src/auth.ts" --graph --hops 2
# β†’ packs auth.ts + every entity it calls/imports within 2 hops,
#   across files, and nothing irrelevant

This needs a cross-file call graph + import graph at the entity (function/class/method) level, then a bounded BFS from the seed files. It composes perfectly with the existing --compress (select the cone, then compress it). Together that's genuinely minimal, maximally relevant context.

On the engine: I work on sem, an open-source Rust tool that builds exactly this, entity extraction + a deterministic cross-file call/import graph across 32 languages via Tree-sitter, with hop-bounded queries already implemented (sem context --hops N). It could potentially power this for Repomix (as a library or a subprocess), so you wouldn't have to build/maintain the graph layer yourselves. Happy to prototype it if the direction is interesting.

Mostly I wanted to float the idea. Graph-aware selection feels like the logical evolution of what --compress started, and it's the number-one thing I'd want when packing context for a model. Curious whether it fits your roadmap.

Also just on a side note: can't help but compliment that your dog is cute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestideaneeds discussionIssues needing discussion and a decision to be made before action can be taken

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions