tbcresearch.
Menu
← Back to the research index
F-012 / Tool

HALO: an archive agents can search, cite and verify without unpacking first

A zero-dependency archive format agents can search, cite and verify without unpacking: 7,299 B against tar.xz -9e's 13,572 B on a pinned docs corpus, at about 0.1 MB/s per core.

Horizontal bars of compressed size as a fraction of tar.xz -9e on the same input, fixed corpora only. B4 docs and JSON: HALO 7,299 bytes (0.54), HALO max 6,517, paq8px 6,211, tar.xz 13,572. B3 repo history: HALO 41,851 (0.60), HALO max 40,948, paq8px 37,295, tar.xz 70,240. B5 compressed containers: HALO 66,879 (0.25), zip 905,295 (3.40), tar.xz 266,484. Old 160-file binary set: HALO default 41,740,682 (0.71), HALO hot 71,402,398 (1.22), zip 80,712,138 (1.38), tar.xz 58,386,744. enwik8: HALO 19,133,360 (0.77), paq8f 18,289,559, record phda9 15,242,496, xz 24,831,648. The paq8 family is smaller than HALO. Open full-size figure. Horizontal bars of compressed size as a fraction of tar.xz -9e on the same input, fixed corpora only. B4 docs and JSON: HALO 7,299 bytes (0.54), HALO max 6,517, paq8px 6,211, tar.xz 13,572. B3 repo history: HALO 41,851 (0.60), HALO max 40,948, paq8px 37,295, tar.xz 70,240. B5 compressed containers: HALO 66,879 (0.25), zip 905,295 (3.40), tar.xz 266,484. Old 160-file binary set: HALO default 41,740,682 (0.71), HALO hot 71,402,398 (1.22), zip 80,712,138 (1.38), tar.xz 58,386,744. enwik8: HALO 19,133,360 (0.77), paq8f 18,289,559, record phda9 15,242,496, xz 24,831,648. The paq8 family is smaller than HALO. Open full-size figure.
Every bar is bytes divided by the tar.xz -9e bytes on the same input, so tar.xz is 1. Byte counts come from the project's README, benchmark log and fast-runner results.json. Fixed corpora only. Select any figure to inspect it at full size.

To a program, a .tar.xz is a brick: to ask it anything you decompress everything, to trust it you re-hash everything, and to survive one flipped bit you hope. HALO starts from the other side. The heaviest reader of stored data is often a program (a retrieval pipeline, an agent, a build system) that queries storage far more often than it writes it, so the packed object should stay usable.

One sectioned .halo container sends each kind of data to a typed codec lane that must reproduce the input bytes exactly. Beside the payload it carries a full-text index, SHA-256 and Merkle receipts per lane, and, as options, Ed25519 signatures, AES-256-GCM encryption and recovery parity. An MCP server mounts the archive read-only, so an agent can search it, read a line range and cite the span, with every read hash-checked and nothing extracted to disk. There are no third-party dependencies: DEFLATE, zstd, xz/LZMA2, SHA-2, AES-256-GCM, Ed25519, JSON, the context-mixing coder and the integer inference engine are all in the tree. A C++20 compiler and CMake are enough to build it.

The source repository is private for now. The code, the benchmark log and the demo script will be linked here when it opens.

What it does

  • Typed lanes that must be exact. Xz/LZMA2, zstd, CSV-column, PNG-structure, raw and the context-mixing lane (HCM3, below) compete per unit, and the smallest verified stream wins. integrity.logical_root commits to paths, sizes and original SHA-256 values independent of grouping, order and codec, and verify recomputes it from decoded bytes.
  • Agent access over MCP. halo mcp archive.halo serves six read-only tools over stdio (table below). A text read returns span_sha256, the SHA-256 of exactly the returned bytes, and a citation_uri such as halo:///src/a.py#L10-L20; resources/read replays that fragment exactly. HALO_MCP_MAX_DECODE_BYTES caps what a session may decode, and calls over the budget are refused.
  • In-place query. Packed with --index, the pinned B3 repo history is 52,069 B (41,851 B without the index, +24.4%), still smaller than tar.xz -9e at 70,240 B. A query reads about 8.8 KB.
  • Unpack in place. halo unpack --in-place needs room for the output plus one small batch, not for the archive and the output together.
  • Knowledge packs. --prime PATH compresses against bytes the reader already holds. The dependency is pinned by SHA-256 and byte count, and the archive refuses to decode without the identical prime.
  • Container recompression. gzip, zlib and ZIP content (.tar.gz, .zip, .docx, .jar) is inflated and recompressed. A small recipe rebuilds the original compressed bytes exactly, so unpack returns the identical file.
  • Also in the format: corruption localisation and repair with --parity, halo optimize (re-encode, verify, swap only if strictly smaller), and an experimental deterministic neural lane.
MCP tool What it does
archive_info Sizes, modalities, codec lanes, capabilities, Merkle root, decode budget
list_files Entries with glob and prefix filters, paginated; reports each file's decode_unit
read_file A line range (text) or byte range (base64); every read is SHA-256 checked
search Uses the in-archive index when packed with --index, otherwise scans decoded text; reports which (index or scan)
grep Regex or literal search over decoded text, with path, line and citation URI per match
verify Re-checks the integrity receipts
claude mcp add halo-notes -- halo mcp /abs/path/notes.halo

An agent reads it without unzipping

An indexed .halo archive of the B3 repo history, 52,069 bytes, is served by halo mcp over stdio. An agent calls search, grep and read_file. A text read returns span_sha256 and a halo:/// citation URI. One indexed search consulted 8,810 bytes of the 52,069-byte archive; the demo's working directory is empty before and after. Open full-size figure. An indexed .halo archive of the B3 repo history, 52,069 bytes, is served by halo mcp over stdio. An agent calls search, grep and read_file. A text read returns span_sha256 and a halo:/// citation URI. One indexed search consulted 8,810 bytes of the 52,069-byte archive; the demo's working directory is empty before and after. Open full-size figure.
The server decodes in memory only what a call needs. The 8,810 B is bytes_consulted.total from the live demo run on the indexed B3 archive.

The demo in the repository runs this against the real thing with the official Python MCP SDK, not a transcript. On the indexed B3 archive, search for "compression" answered from the index (mode: index) and consulted 8,810 B. A separate one-file archive (6,871 B raw, 2,439 B archived) was read with grep and a five-line read_file; the client independently checked the span hash and resolved the citation resource back to the same text. Earlier, on a 130.7 MB corpus, a full-text query read 0.84 % of the bytes in 9.4 ms. That figure is historical and was not re-run.

Decoding is not free of structure. A small file inside a solid group can cost the whole group (at most 8 MiB), and list_files and read_file report each file's decode_unit so the cost is visible before the read.

Results

All results are on fixed corpora and say nothing about other data. B3, B4 and B5 are SHA-256-pinned inputs (benchmarks/corpora/PINNED.json); the binary set is 40 shared libraries from /usr/lib plus a C++ tree and is not pinned; enwik8 is the standard 100 MB file. Every HALO archive in the table was verified, unpacked and compared byte for byte.

Input HALO tar.xz -9e Other
B4 docs and JSON, 89 files, 3,233,189 B 7,299 B (--profile max: 6,517 B) 13,572 B paq8px -8 on the tar: 6,211 B
B3 versioned repo tree, 720 files, 5,224,797 B 41,851 B (--profile max: 40,948 B) 70,240 B paq8px -8 on the tar: 37,295 B
B3 with a seekable search index (--index) 52,069 B 70,240 B
B5 compressed containers, 11 files (tar.gz, zip, docx, jar, zlib, tar), 4,899,116 B 66,879 B 266,484 B zip: 905,295 B
B4 docs as a GNU gzip -9 .tar.gz (320,245 B) 7,718 B, restores the identical .tar.gz 13,572 B (of the contents)
B3 newer versions, primed with the older ones 3,646 B plus a 2,452,612 B prime the reader must hold 65,216 B, self-contained unprimed HALO: 43,023 B
Old 160-file binary set, 195,489,542 B, default profile 41,740,682 B 58,386,744 B
Same set, --profile hot 71,402,398 B 58,386,744 B zip -9: 80,712,138 B
enwik8, 100,000,000 B, HCM3 stream 19,133,360 B (1.531 bits/char) xz -9e: 24,831,648 B paq8f: 18,289,559 B; record, phda9: 15,242,496 B
enwik8_100k, neural lane (experimental) 16,143 B xz -9e: 33,016 B single pinned 135M model

On B3 and B4 together the fast runner's geometric-mean ratio against tar.xz -9e is 1.7666, with correctness_failures=0; pack takes 85.1 s and unpack 83.6 s for both corpora. Two notes on the table:

  • The binary rows are from the old 160-file set. It was regenerated afterwards and now has 163 files, so the numbers are not byte-comparable with the new set. The default profile's 28 min 14 s pack and 13 min 13 s unpack (--jobs 8, 4 cores, 4.3 GB peak RSS) are for that set too. The hot profile is for speed: it packs the set in 13.1 s, and it competes with zip, not xz.
  • The enwik8 row is a raw HCM3 stream, not a complete archive. HCM3 is 22.9 % smaller than xz -9e there and 4.6 % larger than paq8f. The built-in prior does not help at this size: it costs 11,885 B more.

How the compressor works

Bytes added to HCM3's 4,649,818-byte output on bin16m when one part is switched off. Final probability from mix_c0_ only: +321,675 (+6.92%). Sparse and indirect contexts: +142,504 (+3.06%). Column, class, category and word-gap contexts: +87,256 (+1.88%), of which class and category histories: +72,704 (+1.56%). Run feature: +59,728 (+1.28%). Extra match candidates: +42,265 (+0.91%). APMs and post-refiner: +31,078 (+0.67%). Middle and top mixers: +31,051 (+0.67%). A reviewing model's prediction is marked on each row. Below, the same 16 MiB: HCM3 4,649,818, lpaq1 -9 5,774,931, xz -9e 5,863,916, zstd -19 6,431,835 bytes. Open full-size figure. Bytes added to HCM3's 4,649,818-byte output on bin16m when one part is switched off. Final probability from mix_c0_ only: +321,675 (+6.92%). Sparse and indirect contexts: +142,504 (+3.06%). Column, class, category and word-gap contexts: +87,256 (+1.88%), of which class and category histories: +72,704 (+1.56%). Run feature: +59,728 (+1.28%). Extra match candidates: +42,265 (+0.91%). APMs and post-refiner: +31,078 (+0.67%). Middle and top mixers: +31,051 (+0.67%). A reviewing model's prediction is marked on each row. Below, the same 16 MiB: HCM3 4,649,818, lpaq1 -9 5,774,931, xz -9e 5,863,916, zstd -19 6,431,835 bytes. Open full-size figure.
Ablations on bin16m: 16 slices of 1 MiB spread across the 195 MB binary tar, one pinned core. Each row is one run with the named part switched off, so the deltas are not additive. Numbers are from the benchmark log's M3 and M6 tables.

The default lane, HCM3 (codec 21), is an integer-only context-mixing coder: a bank of 46 hashed contexts predicts each bit, five first-layer mixer selectors weigh them, then middle and top mixers, APMs and a post-refiner refine the probability for the arithmetic coder. Compared with its predecessor HCM2 it adds seven run-collapsed character-category contexts, word-gap and previous-line token contexts, and count-adaptive SSE with a 31-bit post-map, which is 1.58 % smaller on a fixed four-file evaluation set. It is tried per solid group or text chunk and kept only when smaller than every other candidate. --profile max also tries codec 23, HCM3 warmed on a pinned 1 MiB built-in prior, which is 2.99 % smaller on the evaluation set and 10.1 % smaller on held-out text, at about 13 s and 430 MiB once per process.

There is no floating point anywhere in the lane. The HCM3, HPM3 and HBP3 golden bitstreams (585, 423 and 557 bytes) are byte-identical on x86_64, AArch64, big-endian PowerPC64 and i686, and the AArch64 and PowerPC64 archives unpack on x86_64 and the reverse. Those runs are static builds under QEMU, which is emulation and not a hardware lab, and i686 is unit tests only: the archive CLI does not build for -m32. Execution found three real 32-bit bugs that same-build round trips could not (a size_t << 40 in the context hash, a DEFLATE output budget capped by the input bit bound, and a zstd default budget of 0), all fixed without changing 64-bit output.

What carries the edge on binaries was measured, not argued. On bin16m HCM3 codes to 4,649,818 B, 20.7 % below xz -9e -T1 (5,863,916 B), at 0.062 MB/s. Before each run an outside reviewing model (Kimi K3.1 Pro, in the debate transcripts under docs/debates/) predicted the cost of removing a part; it landed within range on 3 of 8. The reading in the log:

  • Routing in the five first-layer selectors matters most: forcing the final probability from mix_c0_ alone costs 321,675 B, and the log reads R3 minus R7 (about 290 KB) as first-layer routing.
  • Sparse and indirect contexts cost 142,504 B when off, and the punctuation-preserving class and category histories, which are not text-only, 72,704 B.
  • The deep mixer layers, the calibration stack and the three extra match candidates are each worth under 1 %.

A lightweight design does not reach the same place. An lpaq-shaped predictor (6 orders, word, 1 match, 1 mixer, 2 APMs) lands on xz: lpaq1 -9 is 5,774,931 B, 1.5 % below xz, and a generic "8 to 12 light contexts" variant was rejected on that evidence.

For executables, HALO has its own x86-64 and AArch64 branch filters, with regions taken from ELF and PE section tables. A filtered candidate is kept only when strictly smaller, and it won on all 40 shared objects of the old set. Independent units run on a worker pool (--jobs N) and commit in original order, so the archive bytes do not depend on the worker count: --jobs 1 and --jobs 8 both produced the 41,740,682 B archive.

Unpack in place

On a 260 MiB disk with 155,791,360 bytes free, a standard unpack of the 195 MB set needs 204,664,582 bytes and is refused; unpack --in-place needs 79,866,197 bytes and restores all 160 files byte-identically in 3.4 seconds. Twenty of twenty kill -9 trials resumed to byte-identical output. The archive measured was larger than zip -9 (80,712,138 bytes) and tar.xz -9e (58,386,744 bytes). Open full-size figure. On a 260 MiB disk with 155,791,360 bytes free, a standard unpack of the 195 MB set needs 204,664,582 bytes and is refused; unpack --in-place needs 79,866,197 bytes and restores all 160 files byte-identically in 3.4 seconds. Twenty of twenty kill -9 trials resumed to byte-identical output. The archive measured was larger than zip -9 (80,712,138 bytes) and tar.xz -9e (58,386,744 bytes). Open full-size figure.
Measured on the old 160-file set with the hot-profile archive of 2026-10-23 (116,836,972 B) on a 260 MiB tmpfs. A later round made the hot archive 71,402,398 B; the in-place run was not repeated on it.

halo unpack --in-place was prompted by hatchzip's extract-from-the-end, truncate-as-you-go idea. HALO first copies the archive's metadata into a journal and checks every payload hash before it destroys anything. It then decodes chunks from the end of the archive down: each batch is written into pre-sized sparse output files and fsynced, recorded in the journal, and only then cut off the archive with truncate. A batch is 1/64 of the archive, clamped to 1 to 64 MiB. Every decode unit is bounded (256 KiB content-defined chunks, solid groups of at most 8 MiB), so there is no huge solid block that has to be refused. At the end the archive and journal are gone and every file has been re-hashed against the logical root. halo check prints the exact plan first and changes nothing.

On 195 MB of real data the standard unpack needed 204,664,582 B and does not fit; --in-place needed 79,866,197 B, and restored all 160 files byte-identically with the logical root verified in 3.4 s. With kill -9 at random points, 20 of 20 trials resumed to byte-identical output (7 were killed twice). Archives with --delta chunks are refused. Against hatchzip 0.1.2 on the same data and disk, peak disk use is about equal for both tools.

The same test found a bug in HALO's normal unpack: on a full disk it exited 0 with 127 of 160 files truncated, because write_file never checked the stream after writing. It now fails with "write failed (disk full?)", and the same unchecked-close pattern was fixed in sign, copy_prefix and the sync writer.

Honest losses

Experiments that failed their gates are recorded in the benchmark log, and these are the ones that matter for reading the table above.

  • The semantic index missed its bar. With --codec llm-ac-det --hsem, the neural pass also pools hidden states into an int8 passage index. On 36 queries fixed in advance over a 100 KB corpus, recall@10 was 40.0 against 34.0 for the existing HRR index: +6 points against a +10 bar set before the run (bootstrap interval -14 to +26). It scored 0 of 12 on exact-identifier queries, and the index was 4.1 times the archive. The code stays as an opt-in experiment and is not a headline claim.
  • A byte match and escape mode was killed. It was the one remaining large single-core speed idea, gated on ratio. The share of coding time eligible for it was 98 % on the B4 tar and 92 % on the B3 tar but only 7.8 % on bin16m, and the ratio loss was +80 % on B4, +20.5 % on B3 and +0.57 % on bin16m: the full model codes matched bytes almost for free.
  • Version-family deltas lost on B3. The best COPY/INSERT line delta came to 44,804 B against the 42,864 B that solid HCM1 already used (+1,940 B). The deltas copy 4.85 MB, but their operations cost 4,078 B, more than the roughly 4 KB HCM1 spends on the repeated content. Nothing was integrated.
  • A reversible JSON transform made things worse. It was byte-exact on 10,000 fuzzed inputs, but on B4 the JSON files grew from 85,268 to 89,182 B (+4.6 %) and the whole tar from 7,220 to 14,275 B (+97.7 %). Splitting streams destroys cross-stream context. The code was removed.
  • A light binary context mixer is not a middle lane, as shown above, and a faster HCM3 variant that drops the middle and top mixers, the APM stack and the extra match inputs was estimated at about 4.75 to 4.79 MB on bin16m (gate 4.70 MB) and 0.070 to 0.080 MB/s (gate 0.15 MB/s). It failed both gates and was not built. Those two figures are estimates, not measurements.
  • It is slow. HCM3 runs at about 0.1 to 0.15 MB/s per core each way and uses up to about 400 MB per stream; it is instruction-bound (about 77,000 instructions per byte, IPC 0.95 on the first MiB of enwik8). A 3 MB .tar.gz takes about two minutes to pack, and full enwik8 took 2,165 s to encode and 1,606 s to decode under contention at 670 MB peak.
  • paq8px is still smaller. On the same tars it is about 11 % smaller than HALO's B3 archive and about 15 % smaller on B4 (37,295 B and 6,211 B against 41,851 B and 7,299 B; computed from those byte counts), though it took about 20 minutes. On enwik8, paq8f and the Hutter record are smaller than HCM3 as well.
  • The hot profile is not an xz competitor. At 71,402,398 B it is 11.5 % smaller than zip -9 and 1.22 times the size of tar.xz -9e.
  • Indexing costs space. --index adds about 24 % on the small corpora (B4 7,299 to 9,020 B), and the default index budget prunes rare terms.
  • Scope. The cryptography is HALO's own code. It passes the official FIPS, NIST and RFC vectors and 100,000 AES-GCM and 100,000 Ed25519 differential cases against Python's cryptography, and it has not had an independent audit. The context-mixing fuzz targets ran far fewer inputs in the 5-minute campaign (470 to 799 executions each) than the zstd, lzma and inflate targets (1.5 to 1.8 million each), and longer runs are pending. The neural lane is experimental and tied to one pinned 135M model. HALO is a byte-exact content bundle and not a tar replacement: POSIX modes, owners, times, symlinks, hardlinks and xattrs are not preserved. Several original paper workloads (the original B5 search corpora, Braindrop MEG, the custom Qwen model) were unavailable and are not counted.

Reproduce

These steps need the repository, which is private for now.

cd halo
# toolchain only: a C++20 compiler and CMake, no libraries
cmake -S . -B build/cmake-native
cmake --build build/cmake-native -j --target halo_cli halo_archive_cli halo_container_cli
build/cmake-native/halo_cli pack ./any-folder out.halo
build/cmake-native/halo_cli verify out.halo
build/cmake-native/halo_cli unpack out.halo ./restored
# pinned B3 and B4 scoring: complete archives, byte-exact restore, receipts
bash scripts/autoresearch_setup.sh
./autoresearch.sh
# three minutes of live acts: pack, MCP agent reads, --prime, tamper and repair
demo/hackathon/run.sh

./autoresearch.sh builds the fast-run binaries and writes results.json under build/autoresearch-runs/. The demo needs Python 3, uv with the mcp SDK prepared in advance, and GNU tar, xz, zip, diff and cmp for the live comparisons. Every number it prints is measured live. The benchmark log (benchmarks/autoresearch.md) holds the exact commands, artifacts, rejected experiments and coverage limits, and tests/cross/README.md and fuzz/README.md describe the cross-architecture and fuzzing harnesses. There is no DOI yet; the README says one will be added at release.

Credits and licences

  • HALO is MIT licensed. The cryptography and every codec are implemented in the tree, and the binaries link only the C and C++ runtimes (libc, libm, libgcc_s and libstdc++ in the demo's check).
  • The context-mixing design follows mechanisms described in clean-room specifications under docs/cleanroom/. They were written from studying the GPL compressors paq8px and cmix (and a structured-text PAQ variant) and contain no code; the HCM3 implementers worked only from them. paq8px and lpaq1 were used only as reference measurements, and the enwik8 figures for paq8f and phda9 are the reference values quoted in the README.
  • The built-in prior is public domain: Jane Austen's Persuasion and Mark Twain's Roughing It from Project Gutenberg, and SQLite's public-domain C header. Provenance, hashes and held-out sources are in docs/cm3-prior/.
  • enwik8 is the Large Text Compression Benchmark / Hutter Prize file. The neural lane uses SmolLM2-135M-Instruct (Q8_0 GGUF), downloaded separately and pinned by SHA-256. In-place unpacking was prompted by hatchzip.
  • Design disputes were argued between two language models in the transcripts under docs/debates/, then settled by measurement.

Cite this entry

@misc{tbc_halo,
  title = {HALO: an archive agents can search, cite and verify without unpacking first},
  author = {{TBC Research}},
  year = {2026},
  note = {F-012, catalogue version 1},
  howpublished = {\url{https://tbcresearch.org/research/halo/}}
}
← All research