惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
V
V2EX
博客园 - 【当耐特】
WordPress大学
WordPress大学
爱范儿
爱范儿
美团技术团队
宝玉的分享
宝玉的分享
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
量子位
Hugging Face - Blog
Hugging Face - Blog
B
Blog RSS Feed
Recorded Future
Recorded Future
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园 - 聂微东
H
Hackread – Cybersecurity News, Data Breaches, AI and More
腾讯CDC
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
博客园 - 叶小钗
GbyAI
GbyAI
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
F
Full Disclosure
G
Google Developers Blog
D
Docker
T
Tailwind CSS Blog
C
Check Point Blog
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
B
Blog
博客园 - 三生石上(FineUI控件)
博客园 - Franky
H
Help Net Security
MyScale Blog
MyScale Blog
U
Unit 42
D
DataBreaches.Net
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
L
LangChain Blog
有赞技术团队
有赞技术团队
Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog

Hacker News: Ask HN

The New Window Delete ChatGPT Atlas Spyware Tell HN: Qwen Free Tier Is Discontinued Ask HN: SeedLegals Partnerships in London, worth it? Ask HN: How to highlight talent from untraditional backgrounds? Ask HN: We dont need a programming language now? Durable Object alarm loop: $34k in 8 days, zero users, no platform warning What if Time at the subatomic level has multiple arrows? How to add MidnightBSD Key to UEFI Secure Boot DBX? (Revoked and Forbidden Keys) Ask HN: What's your experience working at xAI as an AI tutor? Any engineers here with experience of clinical data standards? Ask HN: Who is using OpenClaw? Agent Skills for Software Test Automation Ask HN: Who needs contributors? Claude Code is thinking too much Ask HN: What Is the Big-O Order of a Jigsaw Puzzle? Ask HN: Stepping into a new role as a Senior, mentoring dos and dont's? Founder from Zurich heading to SF and Austin for the first time Hacker News No Manual Screenshots: I Built a Scalable Screenshot API Using Cloud Playwright Ask HN: Thought experiment: AGI giving us answers we don't like? Ask HN: I quit my job over weaponized robots to start my own venture 1% Vacancy, 81% Preleased: Where Midmarket Compute Deploys in 2026 Ask HN: Preferred pricing model for sound effects libraries? Copy of the email I sent to my undergraduate professors on Nov 30, 2025 Model API Performance | Hacker News Ask HN: Are open-weight LLMs the new offline encyclopedias? Valgrind 3.27 RC1 is out Claude Code OAuth down for >12 hours Ask HN: What's Better?–Tauri or Electron? Technical SEO vs. content optimization: which one moves rankings? Hacker News Ask HN: Can you cut off AI usage immediately? Nvidia's moat is not what it used to be Ask HN: What's your experience with PoW captchas against form spam? Ask HN: What are all the bad things that AI companies have done which we forgot Ask HN: Is Zero Trust Architecture Overkill? Ask HN: What is the best way to get your first users? Tell HN: OpenAI silently removed Study Mode from ChatGPT Ask HN: How to build an "AI native" company? Tell HN: docker pull fails in spain due to football cloudflare block Launchfolio – Create a portfolio in minutes for free, no account needed 120k USD compute credits from various providers Ask HN: How do you retain what you learn from podcasts? Ask HN: How is everyone dealing with the increase of code reviews? Ask HN: Agentic AI just makes me sad Ask HN: Do you trust AI agents with API keys / private keys? Ask HN: Anyone using Nostr as a lightweight back end/DB for rapid prototyping? Ask HN: What should I do with my app? 130 downloads 3 real subscribers Strong feeling: we are in a folded AI reality Hacker News What comes after Open Source? Ask HN: Former grok-code-fast-1 users, what coding model are you using now? When career anxiety becomes gameplay: lessons in China 'young-faculty simulator' I propose a new programming language, CPC Ask HN: Do you remux WebM to MP4 without re-encoding? Ask HN: How to have a macOS devcontainer in VS Code? I built a free 30-day habit tracker in Google Sheets Ask HN: What is the most annoying part of scheduling meetings? Ask HN: Has anyone reconsidered Antivirus software after recent security news? Tell HN: See the AI Doc Ask HN: Why have we not stepped back on the moon again? Ask HN: How did you specialize as a software engineer? Ask HN: Agentic Permutation of Testing Paths In A System Ask HN: Will AI Redefine Programming? Ask HN: How do you stop playing 20 questions with your AI coding tools Ask HN: Is the telehealth consulting for psychiatry even works? Ask HN: Im back end engineer, not front end – is this just excuse? What tools do you use to visualize algorithms? Tor Browser on Android leaks IP in desktop mode Published on Rapid API | Hacker News Persistent vs. Stubborn / Genius vs. Intelligent Is the pitch deck culture making founders worse at building businesses? Do founders' political views affect how you see a product? Ask HN: Easiest UX for Seniors My app hit 1,152 first-time downloads in a single day Claude API Error: 529 | Hacker News My AI workflow evolved from prompts to a near-autonomous workflow Hacker News Ask HN: Best books on building a programming language I collected startup ideas. It changed how I think about ideas completely Is algorithm still relevant in 2026 Is VC the new PMF strategy? Ask HN: Would you take your engineering team to Buenos Aires for an offsite? Hacker News Artemis 2 Coming Home | Hacker News Ask HN: Recommendations on which models to pay how much for? Open Source card game cuttle.cards has its world championship Saturday at 1pm ET Scanners are too late for AI-driven actions Ask HN: Negotiating Intern Pay Ask HN: Hiring in the age of AI-assisted coding: what works? Amazon Luna Shuts Down without refunds? The Weather Channel RetroCast Now Behind the Scenes and Technical / Design V1.21 Update for Gpumkat | Hacker News Valence and HYVE, RT Physics Attention and a "Synthetic Organism" Ask HN: Its either I or Agent code. Both of us on same codebase is a disaster Ask HN: Does Sam Altman know how to code? Ask HN: Is a purely Markdown-based CRM a terrible idea? Optimized for LLM agents Ask HN: Improving as mid-level dev with forced use of LLMs I built ClawIDE: A web-based IDE for managing multiple Claude Code sessions
Why directory jumpers should use exponential moving sums instead of frecency
jghub · 2026-06-25 · via Hacker News: Ask HN

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.