Show HN: Ze.sh – a z.sh-derived directory jumper that uses an event clock

jghub1 pts0 comments

z.sh and zoxide (and other frecency-based directory jumpers) couple score decay to wall-clock time. After any extended period of inactivity (e.g. holidays) the first directories visited on return dominate the ranking regardless of prior history, and the tool effectively has to relearn ranking from subsequent navigation.The underlying issue is that wall-clock time during shell inactivity carries no information about directory relevance. ze.sh replaces wall-clock time with an event clock that advances one tick per cd action. Scores decay only while navigation is occurring. Inactive periods leave scores unchanged.ze.sh also replaces the traditional frecency heuristic ([visit count] * recency) with an exponential moving sum over the event series (mathematically closely related to the exponential smoothing used for Unix load averages). This avoids a separate ranking artifact where a long-dormant directory with a large historical visit count jumps to the top on first revisit.The implementation is a single shell file, compatible with bash, zsh, ksh93, and mksh. The database format extends z.sh s format with one additional field, the timestamp field is repurposed to hold the event clock counter.A related project of mine, SD, also uses the event clock and exponential moving sum paradigms but stores the full event history rather than aggregate state. ze.sh explores how far the same ideas can be pushed while remaining close to the original z.sh design.I would be interested in hearing whether others have run into the inactivity-cliff behaviour, and whether there are solutions to the problem that I have not considered.

clock event directory wall time inactivity

Related Articles