Skip to content

feat(q3): predictive prefetch MVP — anticipate file reads via import graph#77

Merged
masonwyatt23 merged 1 commit into
mainfrom
feat/q3-predictive-prefetch-mvp
May 23, 2026
Merged

feat(q3): predictive prefetch MVP — anticipate file reads via import graph#77
masonwyatt23 merged 1 commit into
mainfrom
feat/q3-predictive-prefetch-mvp

Conversation

@masonwyatt23
Copy link
Copy Markdown
Member

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

  • 20 new tests, all green. Tier matrix + kill switch + idempotency + 1.5s budget + cwd-traversal guard + cache hit verified.

Cold-start delta

  • Estimated 30-60% reduction on follow-on ashlr__read calls within a session.

…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>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ashlr-plugin-site Ready Ready Preview, Comment May 23, 2026 2:23am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant