Expand description
lvz-context — the token-efficiency engine (§6.1).
This crate holds the largest token levers, all usable offline and independent of any provider:
skeleton— tree-sitter file-skeleton extraction: keep signatures + types + docs, elide bodies (multi-language: Rust, Python, JavaScript, TypeScript).symbols— recursive symbol-dependency graph; drives the skeleton-radius knobNviasymbols::skeleton_with_radius.anchor— hash-anchored edits: address lines by a short content hash so edits don’t require resending the file, and stale edits are rejected rather than misapplied.diff— token-efficient unified diffs: emit only changed hunks, never full rewrites.tokens/budget— deterministic token estimate + the §6.5 budget-fixture loop that gates skeleton-radius regressions in CI.
These are the primitives the agent uses to read less and write less; the skeleton-radius
knob N (§6.5) drives skeleton::skeletonize’s keep_bodies set.
Modules§
- anchor
- Hash-anchored edits (§6.1): address a line by a short stable hash of its content instead of resending the whole file. The model reads anchored lines once, then targets edits by anchor — no full-file round-trips, and an edit that no longer matches is rejected rather than silently misapplied.
- budget
- The budget-fixture loop (§6.5): token-efficiency CI for the skeleton-radius
knob
N. - diff
- Token-efficient diffs (§6.1): emit minimal unified hunks, never full-file rewrites. Small context radii keep the token cost proportional to what actually changed.
- skeleton
- File-skeleton extraction (§6.1, the largest token lever): keep signatures,
type definitions, and surrounding doc comments; replace function/method bodies with a
placeholder. Bodies named in
keep_bodiesare retained — the building block for the skeleton-radius knobN(“include full bodies for symbols within N hops of the target”). - symbols
- Recursive symbol-dependency tracking (§6.1) — the graph that makes the
skeleton-radius knob
Nreal: “include full bodies for symbols withinNdependency hops of the edit target.” - tokens
- A cheap, deterministic token estimator for the budget-fixture loop (§6.4–§6.5).
Enums§
- Lang
- A source language Lavoisier can parse for skeletons and symbols.