CodexFold
English

Keep every Codex session. Store the repeats once.

Long Codex sessions carry the same instructions, file reads and tool output again and again. CodexFold finds byte-identical content, keeps one copy in a local store and checks every restore against the original SHA-256.

Install with Go
go install github.com/samekind/codexfold/cmd/codexfold@v0.4.0-beta.2

Preview release v0.4.0-beta.2. The command-line tool runs on macOS, Linux and Windows. The transparent filesystem is opt-in and still being qualified.

Drawn from the macOS menu-bar app. Figures are the maintainer’s Mac on 5 November 2026; the curve is illustrative.

Repeated content is stored once

Every Codex turn records project instructions, the files it read and tool output, so the same bytes recur across sessions. CodexFold moves them into a shared store, leaves references in the sessions and rebuilds every byte on restore.

Three sessions, each holding its own copy of the same content.

  • Project instructions
  • The same file, read again
  • Repeated tool output
  • Pasted log
  • Content unique to one session

Illustration, not to scale.

Measured on 58 real sessions

A representative local corpus of 16.01 GB, including large active and archived sessions. Exact deduplication halved it, and Zstandard packing halved what remained.

Disk space comes back only after native copies and loose objects are retired, which is not yet an automatic production policy. Read the validation report

Folded source
15.47 GB
After exact deduplication
7.72 GB
Packed, with manifests
4.36 GB
  • 57 of 57 restores matched the original size and SHA-256.
  • 16.0 GB scanned across three duplicate layers in 303 seconds.
  • 1 session that was still being written was rejected before its manifest was committed.

Status, space and incidents at a glance

Both platforms have a graphical interface. CodexFold works in the background, and the interface tells you whether it is healthy and how much space it has saved.

macOS menu-bar app

Shows health, space saved, current read and write speed and a compact trend. The dashboard adds 1-hour, 24-hour, 7-day and 30-day history and a timeline of failures that lasted at least ten seconds.

Windows tray app

Adjust the automatic folding interval and scope, review 30 days of storage history and incident details, and export JSON diagnostics.

Drawn from the Windows tray dashboard, whose interface is currently in Chinese. Figures reuse the readings above; the curves show steady operation and are illustrative.

From scan to verified restore

  1. Scan

    Measure exact duplicate fields, records and chunks. Scanning is read-only.

  2. Fold

    Preview first. With --apply, CodexFold writes shared objects and a versioned manifest. The original session file stays where it is.

  3. Verify and restore

    doctor checks every manifest and object. unfold rebuilds the file and confirms its size and SHA-256 before anything is replaced.

$ codexfold scan --all --layers field,record,cdc
sessions=8 corpus=48.69 MiB processed=48.69 MiB skipped=0 appended=0 duration=440ms index=1.00 MiB missing=0 changed=0

LAYER   OBJECTS    UNIQUE     DUPLICATES  DUPLICATE BYTES  CORPUS SHARE
cdc     594        594        0           0 B                0.00%
field   1472       513        959         31.14 MiB         63.97%
record  1960       1480       480         15.56 MiB         31.97%

$ codexfold fold 6a04b768-cdfd-c692-70ce-f666db3df52f
session=6a04b768-cdfd-c692-70ce-f666db3df52f verified=true dry_run=true parts=495 records=0 fields=247 residual=248 new=683.28 KiB removed=false manifest=~/.codex/fold-store/manifests/6a04b768-cdfd-c692-70ce-f666db3df52f.json

$ codexfold fold 6a04b768-cdfd-c692-70ce-f666db3df52f --apply
session=6a04b768-cdfd-c692-70ce-f666db3df52f verified=true dry_run=false parts=495 records=0 fields=247 residual=248 new=683.28 KiB removed=false manifest=~/.codex/fold-store/manifests/6a04b768-cdfd-c692-70ce-f666db3df52f.json

$ codexfold doctor
manifests=1 verified=1 objects=274 issues=0 store=~/.codex/fold-store

$ codexfold unfold 6a04b768-cdfd-c692-70ce-f666db3df52f --to restored.jsonl
session=6a04b768-cdfd-c692-70ce-f666db3df52f verified=true bytes=8.17 MiB target=restored.jsonl
A real run on a synthetic sample of 8 sessions. The home directory is shortened to ~.

What CodexFold will and won't do

Where it runs today

The command-line tool ships for macOS, Linux and Windows on amd64 and arm64, with checksums. The transparent filesystem is a preview on every platform.

macOS 27 Preview

Apple-native FSKit extension. Building the app needs Xcode 27, an eligible Apple development team and source signing. It is not notarized for general installation.

Maintainer guide

Linux Preview

FUSE3 mount, validated for unprivileged mounts, crash recovery and remount. Validation with a real Codex client is still open.

Linux validation

Windows Preview

WinFsp filesystem with a native tray app, built from source. Desktop GUI, reboot and SYSTEM service qualification are still open.

Windows preview guide
Download from GitHub Releases