Per-function code metrics via rust-code-analysis, file-change-driven #30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally filed by @coilysiren on 2026-05-17T20:50:34Z - https://github.com/coilysiren/repo-recall/issues/189
Problem
repo-recall's activity signal (churn) was useful in raw form but is mostly noise in practice. Lockfiles, CI yaml, and migration sequences dominate the ranking; the actually-load-bearing files don't surface. The session-touched join helps but is itself flat: every Claude-visited file gets equal weight.
The missing signal is structural complexity per file and per function. A 5000-line file with 30 nested branches is structurally different from a 30-line config that changes weekly. Without per-function metrics, "what's complex in this codebase" requires the agent to re-derive on demand.
Proposal
Add rust-code-analysis (Mozilla) as a file-change-driven metrics pass in the repo-recall ingest tier. Compute per-file and per-function: cyclomatic complexity, cognitive complexity, halstead variants, LOC variants. Store in the join store. Query reads the columns like any other.
Placement: in repo-recall, not session-lattice. The metrics are part of the join, not a derived view. They're computed at ingest time on file change, stored, never recomputed on read. session-lattice consumes them via the existing read path; no file-content interface is needed.
Trigger: file change event (notify-driven once the per-source refresh-rate refactor lands, mtime-poll until then). Reparse only the changed file, recompute its metrics, update the row.
Why earn its keep
The strongest queries this unlocks:
This is not a complexity-weighted-churn play. Churn isn't load-bearing enough to weight against. The wins are activity-independent.
Coverage caveat
rust-code-analysis supports a curated language set: Python, Rust, JS/TS, Java, C/C++, Kotlin, and a few more. Check the current list against the real
coilysiren/*mix before committing. Languages outside the list get null metrics; the structural-facts pass (sibling issue) still gives them language detection and LOC.Adding a language to rust-code-analysis is upstream work in their crate, not local. If a frequently-used language is missing, that's a deferrable problem, not a blocker.
Out of scope
Open sub-questions
(file_id, function_name, function_start_line)rather than flattened into the file row.recall_repodirectly or behind a dedicatedrecall_function_complexityMCP tool.Origin
Conversation 2026-05-17. Sibling issues: structural-facts pass (cheap baseline), search-router (ripgrep + nucleo), per-source refresh rates.