Repository navigation
Measure onboarding tokens on the last merged PR - #677
Conversation
The onboarding page's token card measured one lookup on the repo's most central symbol, which read as a demo. It now asks what an agent starting the last merged PR would ask: the PR's title. git's history on the default branch names the PR (merge commits and squash merges), skipping bots, release chores and PRs that changed no product code. The answer is measured as before (ask's own pack against reading the files whole), and the summary carries the PR: number, title, GitHub link, up to 20 of the code files it changed, how many it changed, and how many of those the answer pointed to. With no such PR the central-symbol lookup is used, as before. On trailhq/trail-cloud: PR #25, ~90% fewer tokens, the answer pointed to 1 of its 4 files. On honojs/hono: PR #5405, ~75%, 1 of its 1 file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🌱 graft blast radius1 area changed → 1 area can be affected. 3 dependent symbols, depth 2. flowchart TB
A0(("CLI Initialization<br/>3 symbols"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0 reached;
Who knows this code — 2 people across 2 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 3 dependent symbols, grouped by areaCLI Initialization — 3 symbols in 1 file
Test signal per changed area — 1 ✓Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
The onboarding page's token card measured one lookup on the repo's most central symbol. It read like a demo, and the review asked for "tokens your last PR would have saved".
What changes
lastMergedPrs(repo)reads git's history on the default branch (origin/HEAD, elseHEAD). It finds merged PRs from merge commits (Merge pull request #N from …, title on the body's first line) and squash merges (Title (#N)). It skips bots, release chores and PRs that changed no product code still in the repo. No network and no GitHub API.tokensOnOneLookuptries the last PR first. The question is the PR's title, the lookup an agent starting that PR would make, and it's measured exactly as before (ask's pack against reading the files it covers whole). With no such PR it falls back to the central-symbol lookup.tokens.prcarries{ number, title, url, files (≤20), changed, found }.foundis how many of the PR's code files the answer pointed to.Real runs
Tests
found/changed, and the fallback with no git.graft-to-trail,hosts-trail, moving a graft repo to trail) fail the same way on main's code on this machine, so they're unrelated.The web side (trail-cloud) shows the PR on the card with a link.
🤖 Generated with Claude Code