Skip to main content

Crate reliary_pack

Crate reliary_pack 

Source
Expand description

Holographic codebase pack generator.

Produces a cache-stable, model-readable representation of a codebase that pre-loads enough information into an LLM’s context to answer most codebase questions without tool calls.

§Format

Each symbol gets one entry:

## <symbol_name>
L2: <signature>  [<file>:<line>]
L3: <surprise facts only>

L2 (signature) is always present — it anchors the model’s prior. L3 (surprise) is present only when the function deviates from what a trained model would predict.

§Cross-references

Uses the SQLite index (occurrence + block + scope_binding tables) for precise, disambiguated cross-references — not regex word matching.

§Surprise detection

Uses skeleton-frequency analysis: lines whose aggressive_skeleton is rare across the codebase are “surprising”; lines whose skeleton is common are “expected” (the model’s prior handles them).

Structs§

HierarchicalPack
PackEntry
A pack entry parsed into searchable fields.
Symbol

Enums§

GateDecision
Gate decision returned by should_inject_pack.
PackFormat
Pack format — controls which layers are included.
SliceDecision
Slice a full pack for a specific query using BM25 scoring.

Functions§

adaptive_slice
Slice a pack for a specific query, but only if the classifier says it’s worth it. Returns (sliced_content, decision) so callers can log/meter the decision.
compute_complexity_score
Compute a composite complexity score for the codebase from the SQLite index.
compute_complexity_score_for
C12: Complexity score using an already-open connection. Combines 5 query_row calls into fewer queries via prepare_cached.
gate_decision
Decide whether to inject the pack based on the codebase’s complexity score.
gate_decision_for
C1: Gate decision using an already-open connection (no double open).
generate_hierarchical_pack
Generate a hierarchical pack: top-level map + per-module packs.
generate_pack
Generate a holographic pack for a codebase.
generate_pack_auto
Auto-mode: gate + hotspot selection combined.
generate_pack_hotspot
Generate a hotspot-selected pack: top-K symbols by composite score.
generate_pack_hotspot_with
C1: Hotspot pack using an already-open connection.
parse_pack_entries
Parse a full pack string into individual entries.
should_inject_pack
Convenience: run the full gate pipeline for a codebase path.
should_slice_for_query
Classify a query text to decide whether the sliced pack is worth sending.
slice_pack_for_query
“which symbols to include” problem that hotspot selection can’t solve.