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 :

  1. Candidate Pool Generation: search_bm25f scores structured fields (title , tags , headings , claims , body ). When graph expansion is enabled, typed_personalized_pagerank propagates mass from top lexical seeds across relation-weighted, hub-penalized edges:
  2. Cost-Normalized Greedy Marginal Gain: Over live-rebound heading sections , submodular_select_excerpts greedily maximizes query-term coverage while penalizing pairwise Jaccard overlap: scaled by with seed-balanced discovery slots reserved for multi-hop graph evidence.
  3. Cryptographic Live Rebinding ([W1..Wk]): Every emitted citation re-verifies physical path confinement inside wiki/, computes live page_sha256 and section_sha256, redacts unsafe local/private provenance, and attaches epistemic_warnings if the cited page has active contradicts or superseded_by edges.

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).