Expand description
Spreading activation — associative retrieval over a weighted graph.
§The idea (cognitive science → retrieval)
In ACT-R and classic semantic-network models (Collins & Loftus 1975), recall works by spreading activation: cue concepts light up, and energy flows along associative links to related concepts, attenuating with distance. Items that many short, strong paths reach end up most activated — i.e. most relevant to the cue.
We apply this to code: seed activation at the files/symbols a task names, then spread it across the project graph (imports, calls, co-access). The resulting activation is an associative relevance signal that complements lexical BM25 — it surfaces files that are structurally close to the seeds even when they share no query terms.
§Convergence
Each node’s outgoing edges are fan-out-normalised (they sum to 1), so a node
re-emits at most decay · energy (with decay < 1). Total energy in the
system is therefore strictly decreasing, guaranteeing termination; a firing
threshold prunes negligible pulses so cost stays near the active frontier.
Functions§
- related_
ranked - Convenience: spread from
seedsand return the top-knon-seed nodes by activation, strongest first — the files most associatively related to the cues but not already named by them. - spread
- Spread
seedsoveradjacencyfor up toiterationshops.