Skip to content

feat(priority): add dependency centrality ranking for LLM context packing (fixes #255) - #260

Closed
Adeolu5678 wants to merge 2 commits into
prooflinedev:mainfrom
Adeolu5678:feature/dependency-centrality
Closed

Adeolu5678 wants to merge 2 commits into
prooflinedev:mainfrom
Adeolu5678:feature/dependency-centrality

Conversation

@Adeolu5678

Copy link
Copy Markdown

Problem

Fixes #255.

When packing repository contents to fit within strict LLM context budgets (--tokens, --max-size), \yek\ previously relied solely on Git commit recency (\compute_recentness_boost). While recency is a helpful heuristic for ongoing work, it introduces a severe bias against stable, foundational architectural hub files (\lib.rs, \models.rs, \schema.prisma, \ ypes.ts, \main.go). These core interfaces rarely change and receive a near-zero boost, causing \yek\ to evict the most critical architectural context when token budgets are tight in favor of peripheral recent edits.

Solution: In-Degree Dependency Centrality

This PR implements an in-degree dependency centrality engine that computes structural importance alongside Git commit recency:

  1. Cross-Language Specifier Extraction (\�xtract_import_specifiers): Fast, lightweight regex scanner supporting TypeScript/JavaScript, Rust, Python, Go, and C/C++.
  2. Project File Path Resolution (\ProjectFileCatalog): Robust resolution handling relative imports (./, ../), directory module entries (\mod.rs, \index.ts, _init_.py), extension stripping, and file stems.
  3. Normalized Hybrid Priority (\compute_hybrid_priority_boost): Combines centrality and recency with configurable weights (\centrality_weight = 0.6,
    ecency_weight = 0.4). Gracefully falls back if Git history is unavailable.
  4. Non-blocking Pipeline Integration: Runs seamlessly during repo collection without bottlenecking Rayon parallel processing.

Verification (\prove-it-works)

  • \cargo check: 0 errors
  • \cargo clippy --all-targets: 0 warnings
  • \cargo test: 268 tests passed, 0 failed across all test suites
  • Added empirical test verifying that an architectural hub file outranks a freshly-committed peripheral leaf under context pressure.

Copilot AI balanced review requested due to automatic review settings November 16, 2026 20:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

mohsen1 commented Nov 17, 2026

Copy link
Copy Markdown
Member

Codex

Closing as out of scope. We’re keeping Yek focused and aren’t expanding its feature set.

@mohsen1 mohsen1 closed this Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Priority: recency boost misranks core files. Dependency centrality as an additional signal

3 participants