Repository navigation
Releases
Codex Retain 0.2.0
Codex Retain 0.2.0
Universal local Codex client and version compatibility release. Removes the
hardcoded codex-cli 0.153.4 version pin, exact SQLite schema checksum check,
and private triggers inside Codex's database so Codex Retain works across Codex
CLI, macOS Codex Desktop (/Applications/Codex.app), IDE extensions, and
past, current, and future Codex versions sharing $CODEX_HOME.
What changed
- Capability-based storage contract (no version pin): Automatically selects
the highest numericstate_<N>.sqlitein$CODEX_HOME, validates the core
threadscontract (idPK,rollout_path,archived,archived_at), and
dynamically adapts to optional columns and tables (name,title,
history_mode,is_pinned,thread_section_id,thread_sections,
thread_spawn_edges,backfill_state,_sqlx_migrations). - Forward-compatible safeguards: Dynamically discovers
"Pinned"sections
inthread_sections, protects unknown protective columns onthreads(such
aspinned_atoris_starred), skips unknown per-threadhistory_mode
values without blocking eligible peers, detects child tables with
ON DELETE RESTRICTorNO ACTIONforeign keys tothreadsbefore staging
any files, and fails closed on missing core columns, failed_sqlx_migrations,
incompletebackfill_state, or self-referentialON DELETE CASCADE. - External sidecar epoch tracker (
state_dir/tracker.sqlite): Moves
tracked archive epochs out of Codex's database into a private (0o600,
DELETEjournal mode,synchronous=FULL) SQLite sidecar inside the utility
state directory. Injects zerocodex_retain_*tables or triggers into Codex's
database, survivesstate_5.sqlite -> state_6.sqliteupgrades cleanly, and
quietly syncs archive/restore transitions during paused scheduled runs (opening
Codex strictly read-only). - Codex Desktop and CLI-less operation: Makes
--codex-binoptional
(diagnostics only) so Desktop-only and IDE-only setups work withoutcodexon
PATHand scheduled runs never spawncodex --versionor require Node.js.
doctorandstatusauto-discover local CLI and macOS Codex Desktop
installations and report their versions. - Codex Desktop pin protection: Reads
$CODEX_HOME/.codex-global-state.json
when present (O_NOFOLLOW, regular-file validation, 16 MiB cap, stamp-cached
with live re-verification underBEGIN IMMEDIATE), protecting Desktop-pinned
threads across known JSON shapes and failing closed on unreadable, corrupt, or
symlinked global state. - Seamless
0.1.xupgrade: Existing0.1.xpolicies with legacy
codex_retain_*tables/triggers instate_5.sqliteremain readable during
read-onlystatus/previewand automatically migrate their tracked epochs
intotracker.sqlitewhile removing legacy triggers on the firstrun(or
disable/uninstall).
Update
brew update
brew upgrade dankosik/codex-retain/codex-retain
codex-retain --version
codex-retain statusInstaller users can rerun the installer at the same installation directory.
Installation does not enable retention. Existing policies, exclusions, and
captured archive periods are preserved; upgrading from 0.1.x no longer
requires disabling Retain before Codex upgrades.
Compatibility and verification
- macOS 15+ release archives for Apple Silicon (
aarch64-apple-darwin) and
Intel (x86_64-apple-darwin), covering Codex CLI, Codex Desktop, and IDE
clients sharing$CODEX_HOME. - Linux remains experimental for read-only core,
doctor, andpreviewpaths;
destructive commands and scheduling remain macOS-only. - All automated validation uses synthetic profiles (
240Rust unit and
integration tests includingtests/universal.rs, plus release and skill
maintenance suites).
Codex Retain 0.1.5
Codex Retain 0.1.5
Major peak-memory and CPU optimization release across archive scanning,
rollout-lineage discovery, report serialization, and batched deletion, while
preserving all existing CLI, JSON, policy, capture, recovery-journal, and
safety contracts.
What changed
- Compact report storage and streaming JSON: Replaces per-entry heap
materialization with 28-byteCompactEntryrecords, chunked byte arenas,
interned diagnostics, and direct 64 KiB buffered JSON output (itoa) across
enable,preview,run, andrun --scheduled. Text and scheduled runs
materialize only the 30 display entries and up to 10 diagnostic skips needed
forlast-run.json. - SQLite scan and statement reuse: Decouples large archive reads into
sequential scans (visit_archived_compact), adds due-count pre-sizing for
summary/text paths, compiles per-batch SQL statements once per run, and
bounds SQLite page caches (cache_size = -256RO /-512RW) with
PRAGMA shrink_memorybefore inventory peaks. - Direct descriptor traversal and compact inventory: Replaces
walkdir
withrustix::fs::Dirand directory-relative syscalls (openat,statat,
fstat,unlinkat,renameat_with), packs standard rollout filenames
inline intoHeaderCache(48-byte slabs) andOwnedRollout, reuseszstd
decoders across files, and switches internal hot maps/sets to a per-process
seededwymixhasher. - Targeted narrow hot-path crates: Uses
memchrfor SIMD newline/NUL
scans,simdutf8for SIMD UTF-8 validation paired withserde_json
from_str(with coldfrom_slicefallback for exact error diagnostics on
invalid UTF-8),itoafor integer formatting, andsmallvecfor small
per-batch scratch buffers. - Smaller release binary: Removes
walkdir(and its transitive
dependencies) and enables full symbol stripping (strip = true), reducing
the ARM64 macOS release binary from 4.43 MiB to 3.54 MiB (−20.1%). - Dependency security updates and attributions: Updated
rusqliteto
0.41.1(libsqlite3-sys 0.39.1/ SQLite3.54.1),rustixto1.1.6,
andzstdto0.14.3(zstd-safe 8.2.0,zstd-sys 2.1.2+zstd.1.5.7) to
addressRUSTSEC-2026-0391,RUSTSEC-2026-0398,RUSTSEC-2026-0403,
RUSTSEC-2026-0410,RUSTSEC-2026-0459, andRUSTSEC-2026-0486, and
regeneratedTHIRD_PARTY_NOTICES.mdand
docs/evidence/dependency-licenses.jsonfor the updatedCargo.lock.
Measured impact (local ARM64 macOS, synthetic profiles)
Paired /usr/bin/time -l measurements comparing local Rust 1.98.1 release
builds of 0.1.4 and 0.1.5 on identical synthetic profiles:
| Synthetic workload | 0.1.4 footprint | 0.1.5 footprint | 0.1.4 user CPU | 0.1.5 user CPU |
|---|---|---|---|---|
enable --json (100k archives) |
111.05 MiB | 9.30 MiB (−91.6%) | 0.28 s | 0.17 s |
preview --json (100k archives) |
26.48 MiB | 7.00 MiB (−73.6%) | 0.16 s | 0.07 s |
preview text (100k archives) |
26.45 MiB | 2.16 MiB (−91.8%) | 0.14 s | < 0.01 s |
run --scheduled (100k, none due) |
4.42 MiB | 2.41 MiB (−45.5%) | 0.14 s | < 0.01 s |
run --json (delete 10k archives) |
29.00 MiB | 7.94 MiB (−72.6%) | 1.22 s | 0.32 s |
run --scheduled (delete 10k) |
27.50 MiB | 7.80 MiB (−71.6%) | 0.86 s | 0.34 s |
preview --json (99k active + 1k arch) |
11.11 MiB | 3.83 MiB (−65.5%) | 1.27 s | 0.41 s |
run --json (99k active + 1k arch, 1 due) |
50.25 MiB | 8.05 MiB (−84.0%) | 0.77 s | 0.23 s |
These local measurements use synthetic profiles on ARM64 macOS and do not
establish cold-cache I/O latency, Intel macOS timings, or live-writer latency.
Update
brew update
brew upgrade dankosik/codex-retain/codex-retain
codex-retain --version
codex-retain statusInstaller users can rerun the installer at the same installation directory.
Installation does not enable retention. Existing policies, exclusions,
captured archive periods, and journal schemas remain unchanged.
Compatibility remains the reviewed Codex 0.153.4 storage protocol, with macOS
15+ packages for Apple Silicon and Intel. All validation uses synthetic
profiles.
Codex Retain 0.1.4
Codex Retain 0.1.4
Retention starts helping during setup: enable --days 30 --yes now performs
the first cleanup immediately, using Codex's existing archive dates.
- Existing chats recorded as archived more than the selected number of days
ago can be removed during enable. Recent archives keep their remaining time.
Missing, invalid and future archive dates remain protected. - Pins, exclusions, dependent chats, shared history, writer locks and artifact
checks apply to the initial cleanup exactly as they do to later runs. - Hourly scheduling continues after the initial cleanup.
--no-schedulealso
cleans once during enable, with subsequent passes run manually. - Initial results are saved in the normal last-run receipt. Artifact problems
return exit 3 with the policy still enabled for later retries. - The
enableJSON response advances to schema 2.existing_archives_assessed,
initial_archive_clockandinitial_cleanupreplace the fresh-grace fields.
Policy, capture, recovery-journal and other command schemas are unchanged.
At activation, Retain trusts the existing archived_at recorded by Codex. Codex
can reconstruct that timestamp during metadata repair, so it does not prove
continuous archive time before Retain was installed. Retain never substitutes
chat creation time, last-message time or file mtime for a missing archive date.
After activation, archive/restore/rearchive and timestamp-repair transitions
continue to be captured transactionally.
Update and adopt the new initial cleanup
brew update
brew upgrade dankosik/codex-retain/codex-retain
codex-retain --versionAn ordinary package update preserves an already enabled policy and its captured
periods. To explicitly adopt historical archive dates, disable and re-enable
using the same profile, Codex executable, retention days and scheduling options:
codex-retain disable
codex-retain enable --days 30 --yes
codex-retain statusUse your original --state-dir, --codex-home, --codex-bin and --no-schedule
options when customized. Exclusions are preserved. Re-enabling can permanently
delete old eligible archives immediately. Installing a binary by itself still
does not enable retention or delete chats.
Compatibility remains the reviewed Codex 0.153.4 protocol, with macOS 15+
packages for Apple Silicon and Intel. Validation uses synthetic profiles.
Codex Retain 0.1.3
Codex Retain 0.1.3
Reduces repeated rollout-header reads during large archive cleanups while
preserving fresh filesystem discovery and dependency checks before each group.
- Reuses parsed headers within one run only when a fresh file stat matches
identity, size, modification/change times, permissions and link count. New or
changed files are read again; missing files leave the next dependency graph.
Recent timestamps must leave the coarse clock window before a header can be
cached, preventing same-size edits with unchanged timestamp fields from
reusing old dependencies.
Orphan files and every physical copy remain part of discovery. - Continues to validate candidate and staged files independently under the
existing locks and SQLite transaction. A new dependency still blocks deletion,
including when SQLite itself has not changed. - Syncs each distinct source/staging directory once before the SQL commit,
retaining the separate barrier after staged-file removal. - Refreshes the README with current format coverage, installation examples,
recovery behavior and performance evidence. Includes all previously local
verification reports and raw benchmark receipts. - Keeps the generated Homebrew formula loadable during cross-platform tap
validation while retaining its explicit macOS 15+ installation requirement.
The first large preview still reads the full header inventory. Earlier
optimization measurements used a candidate that preceded the final timestamp
freshness correction; its timing gains are not claimed for these release
archives. Small paginated timings were noisy and did not establish a speedup.
Historical measurements and limits.
Update
brew update
brew upgrade dankosik/codex-retain/codex-retain
codex-retain --version
codex-retain statusInstaller users can rerun the installer at the same installation directory.
Installation does not enable retention. Existing policy, exclusions, archive
grace periods and journal schemas remain unchanged. Finish pending recovery
with 0.1.2 or newer before downgrading to an older reader.
Compatibility remains the reviewed Codex 0.153.4 storage protocol, with macOS
15+ archives for Apple Silicon and Intel. Native conformance evidence uses
isolated synthetic profiles; organizational relationships are constructed after
native startup and are not a model-driven spawn certification. Separate
projection caches and other secondary stores remain outside cleanup.
Codex Retain 0.1.2
Codex Retain 0.1.2
Removes the blanket skip for spawn-related archives and consistent physical
copies while preserving the configured retention period.
- Plans removal from leaves to roots. Expired children can be removed while a
pinned or active parent survives; surviving children and shared-history
dependents protect their prerequisites. Fully expired chains finish in one run. - Rechecks SQL and file-header dependencies under the state transaction and
locks each candidate plus its owning ancestors. Incident spawn edges are
removed in the same transaction as the selected rows. - Includes every verified physical copy owned by an eligible archived thread,
acrosssessionsandarchived_sessions, plain JSONL and zstd. Directory
placement alone does not determine whether its owner is active. - Adds
preview --at RFC3339for a read-only future retention forecast. It
changes neither the policy nor archive clocks, and cannot be used withrun. - Adds journal schema 4 with distinct physical-file slots and cross-directory
recovery. Earlier journals remain readable. The journal and ancestor locks
remain bounded to 128 files/IDs; ambiguous ownership and unsafe files fail closed. - Explicitly releases the scheduler installation lock when its guard is dropped.
Update
brew update
brew upgrade dankosik/codex-retain/codex-retain
codex-retain --version
codex-retain statusThe existing policy, exclusions, pins and archive grace periods are preserved.
Finish pending recovery with 0.1.2 before downgrading: older releases cannot
recover schema-4 journals.
Compatibility remains Codex 0.153.4 on macOS 15+ for ARM64 and Intel. Validation
uses synthetic profiles; the organizational harness constructs hierarchy
metadata after native thread creation and shutdown rather than claiming native
model-driven spawning. Separate projection caches, secondary stores and global
traces remain outside cleanup. Supported-client coordination is not a guarantee
of complete erasure or protection against arbitrary foreign writers.
Codex Retain 0.1.1
Codex Retain 0.1.1
Fixes 0.1.0 skipping paginated archives while reporting verified compatibility.
- Supports archived paginated JSONL and zstd rollouts, including multiple
segments belonging to one thread after revert. - Preserves a thread while another thread still references any of its segments.
Removing an expired leaf never removes the source it depends on. - Keeps pins, exclusions, spawn-related protection and existing retention clocks.
- Adds history-format counts to doctor/status, separately from schema/binary
validation and actual deletion eligibility. - Adds journal schema 3 for restartable multi-segment deletion, including owner
validation during recovery. The journal remains bounded to 128 files.
Update
brew update
brew upgrade dankosik/codex-retain/codex-retain
codex-retain --version
codex-retain statusInstaller users can rerun the installer from the latest release. Existing
policies and their grace periods are preserved; no re-enabling is needed when
updating at the same installation path.
Compatibility remains Codex 0.153.4 on macOS 15+ for ARM64 and Intel. Native
synthetic conformance was exercised with both the npm CLI and the tested Desktop
embedded 0.153.4 executable. This does not certify arbitrary Desktop builds.
Separate paginated projection caches and other secondary stores are retained.
Complete any pending recovery with 0.1.1 before downgrading: 0.1.0 cannot read
schema-3 journals.
Codex Retain 0.1.0
Codex Retain 0.1.0
First public release: configurable retention for archived local Codex chats,
with preview, exclusions, pause/resume, and hourly macOS scheduling.
Install
macOS 15 or later, Apple Silicon or Intel; no Rust runtime required:
curl -fsSL https://github.com/Dankosik/codex-retain/releases/download/0.1.0/install.sh -o /tmp/codex-retain-install.sh
CODEX_RETAIN_VERSION=0.1.0 sh /tmp/codex-retain-install.shThe installer checks SHA-256 and installs to ~/.local/bin. Add that directory
to PATH, then run codex-retain doctor. Installation does not enable cleanup.
Rerun the latest release's installer to update at the same path.
Homebrew instructions and source installation are in the
README.
Archives include licenses; SHA256SUMS covers both architecture archives.
Compatibility
The storage adapter supports Codex CLI 0.153.4 local legacy history. Codex
Desktop's embedded server is not certified by a separate installed CLI version.
Spawn-related and paginated/shared histories are skipped. Linux is experimental
for core/preview; destructive operations and scheduling are macOS-only.
Binaries are not Developer ID signed or notarized.
Deletion is permanent once explicitly enabled with --yes. Existing archives
receive a fresh full grace period. Review compatibility and preview before
relying on automatic cleanup.