4fe3bc37bc
When the user @-mentions a file, score it; on the next mention popup,
re-sort completions so files mentioned often + recently float to the top.
Never-mentioned candidates fall back to the workspace ranker's order
without surprises.
* New `tui/file_frecency.rs` module:
- `FrecencyRecord { path, count, last_used }`, persisted as a JSONL
append at `~/.deepseek/file-frecency.jsonl`.
- `record_mention(path)` bumps the count, stamps the time, appends a
line, and evicts to a 1000-entry cap (matches the issue's acceptance
criterion). Eviction drops the lowest-scored entries.
- `rerank_by_frecency(candidates)` decays each record's score by
`count * exp(-ln(2) * age / HALF_LIFE)` (7-day half-life — same as
the OPENCODE source) and stable-sorts the candidate list.
* Wired into `find_file_mention_completions` so the menu shows
re-ranked entries automatically.
* Wired into both confirmation paths: `apply_mention_menu_selection`
(Enter / Tab on the popup) and `try_autocomplete_file_mention`'s
unique-match shortcut.
I/O is best-effort: a missing home directory, a permission failure,
or a corrupt JSONL line gets silently skipped — frecency loss is never
worth blocking the user's autocomplete.
Two unit tests cover the core: rerank floats a hot path above
never-mentioned ones (and preserves the original order for ties), and
score decay drops a stale-but-popular entry below a fresh one after
~8 half-lives.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>