feat: context_pack — task-specific, evidence-linked context under a token budget #35
Labels
No labels
code-review
correctness
dos
performance
security
severity/high
severity/low
severity/medium
tech-debt
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
h-dv/code-index#35
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Product
A task-oriented successor/complement to
repo_map: given symbols, files, a diff, or a short task focus, return the smallest evidence-linked context package needed to reason or edit safely.Contents
Why
repo_mapis excellent orientation, but an edit usually triggers several sequential tool calls: search target, inspect outline, walk dependencies, find tests, search analogues, then manually fit everything into context. A server-side pack can share graph traversal, deduplicate spans, and spend tokens on evidence rather than repeated envelopes.This is not “ask the server to understand arbitrary prose.” Initial focus inputs can be exact symbol names/IDs, paths, and changed-symbol handles. Natural-language extraction may remain client-side.
Selection algorithm
Acceptance
Triage: P0 — next product milestone
Make this the task-oriented context compiler rather than introducing a competing
task_contexttool. Add an optional shorttask/focus_textinput, used only for deterministic lexical symbol/text seed discovery; do not claim arbitrary natural-language understanding.V1 should ship without waiting for #27 or #28 and include:
change_impactexplain_dependencyStable handles (#37) are the cross-reindex contract and should land first or in the same milestone. Benchmark against representative coding tasks: tool calls, source tokens read, time to correct file, relevant-context precision/recall, and test-selection quality.
Minimal context_pack v1 shipped in v0.7.0 (mission I031, built on #37 stable handles). Keeping this issue open for the v2 vision (analogue expansion #27, cycle awareness #28, richer ranked-witness variety).
What landed (v1)
context_pack({ symbol_ids?, handles?, paths?, diff_base?, task_terms?, token_budget=4000, project })→ a single deterministic, budget-classed context bundle assembled from explicit seeds:cross_project_seedissue rather than silently mixed in — this closes the same cross-project identity-confusion class #37 exists to prevent.seed_issuescarries missing / ambiguous / cross-project / no-match-for-task-term, each with its offending input.symbol_ids(generation-local),handles(durable, resolved via #37),paths(file → symbols, cappedPATH_SYMBOL_CAP=64),diff_base(changed symbols), andtask_terms— lexical focus terms each run throughsearch_symbols; matches become seeds, no-match → a seed issue (NL extraction stays client-side).tokens_usedis the true serialized size of the response (serde_json::to_string(&resp).len()/4), and abudget_exceededflag is set rather than silently truncating past the ceiling.MAX_SEEDS=128. Every returned item carries an inclusion reason, score, and (for symbols) astable_handle. Dependents are deduped across chunks.Benchmark
Against the current multi-tool workflow (self-index): context assembly is 1 pack call vs a 5-call manual sequence (search → get_symbol → find_callers → dependents → tests). The pack front-loads all evidence — targets + ~40 dependents + ~21 test-role files — into one larger payload: a clear round-trip win, with an honest byte trade-off surfaced via
budget_exceededand true-sizetokens_used.Review
Deep adversarial review (17 agents: 11 confirmed / 2 refuted), all confirmed fixed with regression tests. Headline: cross-project seed-id mixing (project-local numeric ids from different projects) — now single-project-disciplined with
cross_project_seedreporting.Deferred to v2 (this issue stays open)