Connecting Policy to Data Fragments & The WRL Chunker
1. What It Is
For Policy Follows Data to work at runtime, Caber must recognize a sensitive sentence, clinical record, or financial table cell even after it has been extracted from a PDF, pasted into a Markdown note, retrieved by a vector database, and reformatted inside an LLM prompt or JSON response.
This functional subsystem solves that problem by:
- Assigning every ingested object a canonical Caber Object Resource Identifier (
CORI) that links the object to its storage container, version timestamp, ACLs, and extracted sensitivity classifications. - Fragmenting normalized document text using Caber's proprietary WRL Chunker (Whitespace Remap on Leader), which guarantees 100% indexed byte coverage (
uncovered = 0.0) with a mean overlap density ofc_mean = 2.58and a minimum fragment granularity of 40 bytes. - Indexing the resulting 64 bit
Buzhash64fingerprints and exact byte spans into the Roaring Bitmap Index (.rbix), enabling submillisecond intersection between live runtime streams and the enterprise corpus.
2. How Caber Connects Policy to Data Fragments: Dual Plane Architecture
As shown in Figure 1, Caber connects policy to data fragments through two coupled operational planes:
Plane 1: Asynchronous Data Characterization & Lineage Indexing
- Multisource Ingest & CORI Assignment: Storage scanners and connectors (
S3_Scanner,default_connectors) detect new or modified objects across S3, GCS, Azure Blob, SharePoint, Google Drive, Git, and SQL databases. Each object is assigned a deterministic CORI of the form:text<scheme>⋊⋉<container>⋊⋉<object_path>ⓥ<version_epoch_ms> - Structure Extraction & Zero Shot NER: The Document Parser pipeline (
Docling,Apache Tika, or custom Document Parser SDK plugins) extracts a hierarchicalDocumentTreewith exact byte and line offsets (LineOffsetIndex), whileNER_Service(GLiNER2) tags subdocument spans with zero shot PII, PHI, HIPAA, PCI, and custom sensitivity labels. - WRL Chunker Fragmentation: The normalized text stream is processed by the WRL Chunker, emitting multiresolution 64 bit fingerprints (
nmerhashes) paired with exact[start_byte, end_byte)intervals in the source document. - Roaring
.rbixIndexing & Graph Binding: Fingerprints are written into compressed.rbixshards inshared-storageand merged into the 13 RocksDB column families ofroaring_index.db. Simultaneously,Auth_Analyzerandcaber_governancebind the document'sCORIand its subdocument entity spans to effective Principal permissions (ALLOW_ACCESS,DENY_ACCESS) in Neo4j and OpenSearch (csi_data_Auth).
Plane 2: Synchronous Runtime Interception & Enforcement
- In Band Stream Capture: When an AI application, agent tool, or API route executes,
pycaber(auto)or the Resident Local Rust Gateway intercepts the payload in memory. - Live WRL Chunker Fingerprinting: The live payload is streamed through the exact same WRL Chunker at 76.6 MiB/s per core, producing a set of query fingerprints and their exact byte offsets inside the live request or response.
- Submillisecond
.rbixIntersection: The query fingerprints are intersected againstroaring_index.db(RoaringTreemapbitmap intersection) to identify every upstreamCORIand exact source byte span that contributed to the payload. - Policy Evaluation & Surgical Span Mutation: For every matched source fragment, Caber retrieves the bound policy and freshness rank, evaluates the initiating Human Principal (
obo.user) against the compiled Rego policy bundle, and either permits the payload, surgically redacts only the unauthorized subdocument byte spans in flight, or blocks the call.
3. How the WRL Chunker Works
Traditional Content Defined Chunking (CDC) algorithms such as Rabin Karp, FastCDC, and Asymmetric Extremum (AE) partition a byte stream into disjoint chunks (c_mean = 1.0). If an attacker or an LLM edits a single word near a chunk boundary, the boundary shifts and invalidates the chunk hash. Conversely, indexing every sliding
The WRL Chunker (WhitespaceRemapOnLeader in pycaber) solves both problems using a 4 layer multiresolution architecture that achieves 100% byte coverage while keeping average byte multiplicity under 3 (c_mean = 2.58):
Layer 1: Canonical Stream Remapping (CanonicalStream)
Raw UTF 8 input bytes are normalized into a canonical byte stream before hashing:
- ASCII uppercase bytes (
AthroughZ) are folded to lowercase (athroughz). - Runs of ASCII whitespace (
' ',\t,\n,\r) are collapsed into a single canonical space byte (0x20). - An invertible offset table
offset_map: Vec<u32>records the exact original raw byte offset for every canonical positioni, ensuring that any chunk boundary[c_start, c_end)in canonical space maps back to exact raw byte offsets[raw_start, raw_end)intime.
Layer 2: Fine Resolution Anchor Chunker (AnchorMultiChunkProcessor)
To capture short sentences, table cells, and clinical or financial clauses down to 40 bytes:
- A rolling 64 bit cyclic polynomial hash (
Buzhash64) slides across the canonical stream using a 38 byte leader window (leader_window_bytes = 38). - Local minima of the rolling hash within each window identify content defined anchor positions.
- Around each anchor, the WRL Chunker emits overlapping fine spans using a neighborhood radius
( anchor offset), guaranteeing a 40 byte minimum fragment size ( min_chunk_bytes = 40) that survives adjacent insertions or deletions.
Layers 3 & 4: Coarse and Mid Scale Winnowing Overlays (WinnowOverlay)
To provide fast set intersection on larger paragraphs while bounding total index density:
- Layer 3 (Coarse Overlay): Applies a winnowing window of
W = 80bytes (winnow_coarse_w = 80) over the anchor stream to emit long range structural spans. - Layer 4 (Mid Scale Overlay): Applies a winnowing window of
W = 116bytes (winnow_mid_w = 116) to bridge sentence level and paragraph level matches. - Linear Interval Coverage Verification (
IntervalCoverage): A linearsweep merges intervals across Layers 2, 3, and 4, verifying that 0.0% of canonical bytes remain uncovered ( uncovered_fraction = 0.0) and enforcing the density invariantc_mean = 2.58 < 3.0.
Verified Empirical Performance (CaberEvalBenchmarks)
| Metric | WRL Chunker (WhitespaceRemapOnLeader) | Legacy AE Chunker (ae) | Improvement |
|---|---|---|---|
| Indexed Byte Coverage | 100.0% (uncovered = 0.0) | 100.0% (disjoint) | Zero boundary shift blind spots |
Mean Byte Multiplicity (c_mean) | 2.58 (budget < 3.0) | 1.00 | Multiresolution resilience within < 3x budget |
| Minimum Fragment Granularity | 40 bytes | 64 to 192 bytes | Captures single clauses and record fields |
| Weighted RDR @ k=3 (17 Transforms) | 71.09% | 20.89% | 3.4x higher recall under adversarial edits |
| Subdocument RDR (256 to 512B spans) | 97.92% | 31.40% | Near complete clause attribution |
| False Attribution Rate (Negative Corpus) | 0.0% | 0.0% | Zero false positive policy triggers |
| Single Core Throughput | 76.6 MiB/s | 82.1 MiB/s | Line rate inline stream processing |
4. How the Roaring Bitmap Index (.rbix) Works
Every 64 bit fingerprint emitted by the WRL Chunker is indexed into the Roaring Bitmap Index (.rbix), implemented in pycaber:
- Sharded Storage Artifacts (
.rbix{b,k,d,t}.gz): During document indexing, per object.rbixbundles are staged toshared-storage(CQF/<cori>.rbixb.gz,.rbixk.gz,.rbixd.gz,.rbixt.gz) or workspace shards (rbix/ws_{N}/) containing serializedRoaringTreemapposting lists and Zstd compressed metadata dictionaries. - 13 Column Family RocksDB Engine (
roaring_index.db): The consolidated index stores 64 bit fingerprint keys mapped to compressedRoaringTreemapbitmaps of 32 bit document slot IDs (u32), alongside forward maps (doc_to_nmers), byte offset tables (nmer_offsets), CORI registries (cori_meta), and IDF cluster tables (idf_clusters,idf_dag_edges). See the Schemas &shared-storageReference for the complete 13 column family specification. - Atomic Double Buffered Generation Swaps: Index builds write to an isolated generation directory (
build_{N}/) and atomically flip the active reader via a symlink swap (current -> build_{N}) andArcSwap<RoaringIndexReader>, ensuring lock free concurrent queries during background corpus updates.
6. Key Architecture Decisions & Design Rationale
- ADR 1: Whitespace Remap on Leader vs Fixed Sliding Windows: Fixed size sliding windows create catastrophic index bloat. Pure content defined chunking like FastCDC shifts boundaries on minute edits. The WRL Chunker anchors boundaries on local extreme leaders and snaps cuts to natural whitespace and punctuation tokens, delivering 98.7% byte coverage at 40 byte granularity.
- ADR 2: Roaring Bitmap Indexing (.rbix) vs Dense Embedding Inversion: Dense vector representations struggle with exact subdocument spans and short 40 byte phrases. Caber maps 64 bit Buzhash fingerprints directly to Roaring Bitmaps stored across 13 RocksDB column families, providing deterministic submillisecond intersection without vector hallucination.
- ADR 3: Subdocument Boundary Preservation: Instead of treating files as monolithic opaque strings, Caber preserves exact source page numbers, table cells, and byte offsets through ByteSpanMap structures, ensuring that downstream policy redaction mutates only sensitive spans without destroying surrounding context.