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:
- Provider override —
ToolEnricher::project_argsreturns a vendor-specific projection (e.g. GitLab knows thatget_merge_requests → get_merge_request_discussionsprojectsidtomerge_request_id). - Generic fallback (this module) — when the user (or the
built-in defaults in
tool_defaults) annotates a follow-up with bothprojection: Some("path")andprojection_arg: Some("file_path"), the generic resolver extracts everypathfrom the previous response and emits one prefetch request per match, capped atmax_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.