Skip to main content

Module projection

Module projection 

Source
Expand description

Paper 3 — argument projection for speculative pre-fetch.

When the planner picks a FollowUpLink (e.g. Glob → Read), the host needs concrete args to dispatch the prefetch. Two paths produce them:

  1. Provider overrideToolEnricher::project_args returns a vendor-specific projection (e.g. GitLab knows that get_merge_requests → get_merge_request_discussions projects id to merge_request_id).
  2. Generic fallback (this module) — when the user (or the built-in defaults in tool_defaults) annotates a follow-up with both projection: Some("path") and projection_arg: Some("file_path"), the generic resolver extracts every path from the previous response and emits one prefetch request per match, capped at max_per_link.

Both paths return Vec<Value> — one JSON object per prefetch request the host should dispatch. Empty Vec means “nothing to prefetch from this link”.

Constants§

MAX_PROJECTIONS_PER_LINK
Hard cap on prefetches generated from a single follow-up link. Mirrors the corpus finding that top-3 prefetch covers > 80% of cited follow-ups (paper3_corpus_findings.md §Glob → Read, §Grep → Read). Higher would just waste rate-limit budget.

Functions§

extract_args
Built-in projection extractors for the canonical Paper-3 chains.
extract_host
Extract the host portion of a URL for rate-limit grouping. Returns the lower-cased host without scheme, port, path, or query.