Sort items by frecency (frequency + recency) #4543
lalvarezt
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Sorts fzf results based on your selection history, prioritizing items you return to often and those you touched most recently.
Note: Author has stated (#777, #1213) that they're not interested in adding this functionality, so I thought I'll give it a try.
How it works:
raw = log₂(frequency + 1) × 0.5^(age / 30d) × momentumUsage:
Inspired by: zoxide's frecency algorithm for directory jumping.
You can check it here (frecency branch)
https://github.com/lalvarezt/fzf/tree/frecency
Updates
2025-11-18
Configurable frecency parameters: All frecency algorithm parameters are now exposed as command-line flags, allowing users to tune the scoring behavior for different workflows.
--frecency-scale-factor=N(default: 3150.0) — Adjusts score separation in the uint16 range. Increase this value (e.g., 5000 or 10000) if items with similar usage patterns sort inconsistently due to score collisions.--frecency-half-life=DURATION(default: 30d) — Controls decay rate. Use shorter values like7dfor weekly projects where last week's files should fade quickly, or longer values like90dfor reference materials accessed irregularly over months.--frecency-momentum-window=DURATION(default: 6h) — Sets the time window for momentum boost calculation. Use1hfor focused coding sessions or12hfor full workday context.--frecency-momentum-boost=N(default: 0.5, range: 0.0–1.0) — Maximum momentum multiplier. Higher values (e.g.,1.0) strongly favor burst activity; lower values (e.g.,0.2) reduce the burst effect. Set to0.0to disable momentum entirely.Flexible duration parsing: Duration flags accept both Go's native format (
24h,168h) and common shorthands (dfor days,wfor weeks,mofor months,yfor years).Tuning example for weekly projects:
2025-10-29
Tiebreak integration: Frecency now integrates via fzf's standard
--tiebreakmechanism instead of being prepended to criteria.frecencyandscoreas explicit tiebreak criteria--tiebreak,byScoreis not auto-prepended (allows frecency-first sorting)--frecencyflag remains as backward-compatible shorthand for--tiebreak=frecency,score,lengthFlexible criterion ordering: Users can now position frecency anywhere in the sort order:
Frecency scoring: Simplify frecency scaling and optimize for realistic frequency ranges
Score distribution across realistic usage patterns:
2025-10-27
2025-10-15
--frecency-debugto surface raw, decay, momentum, and scaled columns.2025-10-10
Added new actions to manage the frecency database
It can be used like so:
Beta Was this translation helpful? Give feedback.
All reactions