feat(q3): predictive prefetch MVP — anticipate file reads via import graph#77
Merged
Merged
Conversation
…graph Q3 supporting pillar MVP from the northstar plan. When ashlr__read succeeds on a file, a fire-and-forget background task scans the file's imports (lightweight regex — no AST), resolves the top-N neighbors, and pre-warms the snipCompact cache so the next ashlr__read on any of them is instant. Target cold-start improvement: 30-60% on subsequent reads. Tier gates (hardcoded first line of schedulePrefetch): - Free → no work, returns immediately. - Pro → top 3 neighbors. - Team → top 10 neighbors. Constraints respected: - Hard 1.5s wallclock cap. Background task cancels after. - Never blocks the main read path (setImmediate-deferred + no await). - Path traversal guarded to project cwd (security). - ASHLR_PREFETCH=off kill switch documented in docs/operations.md. - Idempotent — re-prefetch of cached path is no-op. Import patterns covered: TS/JS (import/from/require), Python (from/import), basic C/C++ (#include). Skips node_modules and any non-resolvable paths. Telemetry: prefetch_scheduled + prefetch_hit structured events with neighbors_scheduled, neighbors_completed, duration_ms. Tests: 20 new, all green. Tier matrix + kill switch + idempotency + 1.5s budget + cwd-traversal guard + cache hit verified. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First Q3 supporting pillar (Predictive Prefetch). When ashlr__read fires, a fire-and-forget task pre-warms the snipCompact cache for the top-N imported neighbors. Pro=3, Team=10, free=disabled. 1.5s hard wallclock cap, ASHLR_PREFETCH=off kill switch.
Tests
Cold-start delta