frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Why directory jumpers should use exponential moving sums instead of frecency

3•jghub•1h ago
Directory jumpers such as z.sh and zoxide need to rank candidate directories from a stream of past navigation events. Most implementations use some form of frecency: a score combining historical visit count with recency.

The details vary, but the basic idea is always

   score = frequency × recency
where frequency measures how often a directory has been visited and recency depends on last visit time. After evaluating some tools, I have become convinced that this scoring model is wrong. The reason concerns the structure of the formula itself.

## Problem 1: historical visits never really disappear

Suppose a directory visited many times before but now dormant for months. A frecency system typically preserves the large historical count and only reduces the recency term. The directory therefore retains a large amount of "latent weight".

When visited again, the recency term resets while the historical count remains intact. Consequently, a directory that has been irrelevant for months can jump straight back to a top rank after a single revisit. Many users of directory jumpers have observed this behavior. It is one of the reasons people occasionally edit the database manually.

The underlying issue is that the scoring model stores

   (total historical usage) × (current recency)
rather than the decayed contribution of individual visits.

## Exponential moving sum (EMS)

A more natural model is to treat visits as unit impulses and let each individual impulse decay exponentially until query time

   score(t) = Σ exp(-λ(t - ti))
and to sum over all past visits. A long dormant directory, if revisited once, will get score≈1, independent of ancient visit history. This is exactly the same mathematical formalism that appears throughout signal processing and streaming statistics. Unix load averages are one example.

A remarkable property of EMS is that storing the full history is not required. Rather, recursive score computation is possible:

   score(t) = score(tlast) · exp(-λ(t - tlast)) + 1
requiring only the previous score and the timestamp of the last event.

## Problem 2: wall-clock time is not always meaningful

most directory jumpers use wall-clock time as their notion of time. Therefore, scores continue to decay during periods where no shell activity occurs (e.g. holidays). After a sufficiently long absence, all scores are pushed toward zero. The first few directories visited after returning then dominate the ranking, without good reason to treat the previously visited ones as having lost relevance in the meantime.

One alternative is to replace wall-clock time with an event-driven clock. This clock advances once per navigation event:

   tick = tick + 1
Under this model, time stops when the user is inactive. Decay reflects actually ongoing navigation activity rather than elapsed wall-clock time. This addresses a failure mode that is different from the frecency issue above. In fact, the two ideas are largely orthogonal:

* exponential moving sums solve the reanimation of long-dormant high-frequency entries

* event clocks prevent rankings from being distorted by long inactive periods

Why I ended up implementing this

I previously wrote a directory-navigation tool that stores complete event history and uses an event-clock exponential moving sum internally. Later I wondered how much of that behavior could be reproduced in a much simpler aggregate-state database similar to z.sh. That experiment became ze.sh.

The implementation turned out to be surprisingly small and tt accurately produces the desired EMS ranking behavior without need for retaining the full event stream.

What surprised me most is not that the approach works, but that exponential moving sums seem relatively uncommon in this category of tools despite being a standard solution in many other domains involving event streams and ranking.

The hits keep on coming for Cisco vulnerabilities

https://www.theregister.com/security/2026/06/24/the-hits-keep-on-coming-for-cisco-vulnerabilities...
1•Bender•25s ago•0 comments

Bring back human

https://github.com/microsoft/WSL/issues/8090
1•sedatk•1m ago•0 comments

Mlx-chronos: benchmark suite and leaderboard for MLX inference engines

https://github.com/igurss/mlx-chronos
1•igurss•1m ago•0 comments

Dark Forests and the New Internet

https://www.ystrickler.com/dark-forests-and-the-new-internet/
1•abnercoimbre•1m ago•0 comments

When humans prompt AIs to prompt humans within dreams

https://projectmorpheus.ai/
1•alignthis•1m ago•0 comments

Toronto gets 1.5B dollars to reduce development charges

https://www.toronto.ca/news/city-of-toronto-secures-1-5-billion-in-canada-ontario-partnership-to-...
1•csunoser•2m ago•0 comments

Atlas – open-source deep research you own

https://github.com/steel-dev/atlas
2•nkko•2m ago•0 comments

The Simpsons Hit and Run Running in the Browser

https://shar-wasm.cjoseph.workers.dev/?skipmovie
1•nopakos•2m ago•1 comments

Visualizing React imports without a build, to debug deep import failures

https://blog.crossui.com/2026/06/bypass-the-broken-import
1•linb•3m ago•0 comments

An Update from PlayStation Studios [Bungie Layoffs]

https://sonyinteractive.com/en/news/blog/an-update-from-playstation-studios-2/
1•toomuchtodo•3m ago•1 comments

Notion shutting down its AI-powered email client, including Mac and iOS apps

https://9to5mac.com/2026/06/25/notion-shutting-down-its-ai-powered-email-client-including-mac-and...
2•cdrnsf•4m ago•0 comments

PGlite reaches 10M weekly downloads

https://electric.ax/blog/2026/06/25/pglite-reaches-10-million-weekly-downloads
1•samwillis•5m ago•0 comments

Digital ID brain trust will meet behind closed doors

https://www.theregister.com/public-sector/2026/06/25/digital-id-brain-trust-will-meet-behind-clos...
1•Bender•6m ago•0 comments

Influential Books on Ethics

https://www.thecollector.com/influential-books-ethics/
1•Tomte•7m ago•0 comments

The Same Hetzner Cluster Scored 14, Then a Perfect 100, Eight Days Later

https://webbynode.com/articles/same-provider-same-78-plan-one-hetzner-region-scored-92-another-sc...
1•gsgreen•7m ago•0 comments

How to curate observability data for AI agents

https://www.multiplayer.app/blog/how-to-curate-observability-data-for-ai-agents/
1•argoeris•7m ago•0 comments

Show HN: Poly Grid – A terminal grid where agents flag you when they need input

https://poly-grid.com/
1•suttles•7m ago•0 comments

Show HN: I used Claude to write a tactics JSON for a football game

https://aiworldcup.game/
1•maybal•8m ago•0 comments

Show HN: A directory of no‑AI, privacy‑first software alternatives

https://noaialternative.com/
1•TheOmkarBirje•8m ago•0 comments

Potatoes Reshaped People's DNA

https://www.smithsonianmag.com/smart-news/potatoes-didnt-just-feed-ancient-indigenous-communities...
1•Tomte•8m ago•0 comments

Efficiency, UUIDs and SQLite

https://vespa-mrs.github.io/vespa.io/development/project_dev/database/DatabaseUuidEfficiency.html
1•tosh•9m ago•0 comments

Why iPhones Prices Don't Change

https://asymco.com/2026/06/25/why-iphones-prices-dont-change/
2•speckx•9m ago•0 comments

A no-bullshit running knowledge base

https://running.wiki/
1•iamacyborg•10m ago•0 comments

Deno 2.9

https://deno.com/blog/v2.9
6•enz•10m ago•0 comments

European Commission lines up Amazon and Microsoft for cloud gatekeeper status

https://www.theregister.com/legal/2026/06/25/european-commission-lines-up-amazon-and-microsoft-fo...
3•Bender•10m ago•0 comments

UK school's network left wide open for invasion, student found

https://www.theregister.com/security/2026/06/25/uk-schools-network-left-wide-open-for-invasion-st...
1•Bender•11m ago•0 comments

Velo3D: Fraudster Parlayed a SPAC and Sham Relationship with SpaceX into $390M

https://www.morpheus-research.com/email/48701562-bd5c-492b-8591-3d2acb5632d8/
1•toomuchtodo•12m ago•1 comments

Why Dark Sky Lighting?

https://www.savingourstars.org/darkskylighting
1•alexandrehtrb•14m ago•0 comments

Show HN: An open source app for navigating CS conferences

https://github.com/CuriousG102/conference-planner
1•curiousg•14m ago•0 comments

Holy shit, we just invented a new agentic memory architecture

1•shoman3003•14m ago•1 comments