Submodular Context Packaging
Submodular Context Packaging formulates agent context assembly as a budgeted facility-location and diversity optimization problem over heading-scoped wiki sections rather than naive top- document concatenation.
depends-on veriwiki-architecture compares llm-wiki-vs-rag
Algorithmic Formulation
Given a query with IDF-weighted terms , total character budget , and per-source cap :
- Candidate Pool Generation:
search_bm25fscores structured fields (title,tags,headings,claims,body). When graph expansion is enabled,typed_personalized_pagerankpropagates mass from top lexical seeds across relation-weighted, hub-penalized edges: - Cost-Normalized Greedy Marginal Gain: Over live-rebound heading sections ,
submodular_select_excerptsgreedily maximizes query-term coverage while penalizing pairwise Jaccard overlap: scaled by with seed-balanced discovery slots reserved for multi-hop graph evidence. - Cryptographic Live Rebinding (
[W1..Wk]): Every emitted citation re-verifies physical path confinement insidewiki/, computes livepage_sha256andsection_sha256, redacts unsafe local/private provenance, and attachesepistemic_warningsif the cited page has activecontradictsorsuperseded_byedges.
Counterpoints and Gaps
- INFERRED: Token-set Jaccard redundancy penalization captures lexical duplication deterministically in sub-millisecond latency, whereas paraphrased semantic duplication across multilingual notes requires an optional dense embedding adapter (
VERIWIKI_SEMANTIC_URL).