Turn local Codex session history into inspectable, project-scoped records without touching the source.
Codex stores rich JSONL sessions locally, but answering a simple question such as "what happened in this project?" means finding the right root tasks, subagents and resumed sessions first. Codex Record Sync makes that discovery reproducible, copies the matching files to a private workspace, and creates smaller views for inspection.
Important
This is an extraction tool, not an anonymizer. Every generated file is private by default and must not be committed or shared without an independent review.
The project grew out of repeated real-world recovery and audit work. Its design follows four opinions:
- The live Codex store is the source of truth. Never analyze an old hand-copied export when a fresh sync is available.
- A project is a set of sessions, not only the newest chat. Root tasks, subagents and resumed sessions can all carry evidence.
- Read-only means read-only. Source JSONL files under the Codex home are never edited.
- Smaller is not the same as safer. Compact output reduces tool-result volume; it does not remove private prompts, paths or credentials.
| Mode | Content | Typical use |
|---|---|---|
raw |
Verbatim JSONL copies | Private backup and forensic inspection |
full |
Messages, tool calls and detailed tool results | Deep debugging |
compact |
Messages, tool calls and structural result summaries | Lower-volume analysis |
clean |
Compact output plus rollback replay deduplication | Reading restarted conversations |
all |
Every output above | Complete private sync |
live Codex store (read-only)
|
v
exact cwd discovery --> private raw copy
|
+-----------> full / compact / clean JSON
Python 3.10 or newer is required. The runtime has no third-party dependencies.
python3 -m pip install .
codex-record-sync list --project-cwd "$PWD"
codex-record-sync sync --project-cwd "$PWD" --mode cleanRun from a source checkout without installing:
PYTHONPATH=src python3 -m codex_record_sync sync \
--project-cwd "$PWD" \
--mode allBy default, the source is ~/.codex and output is written under the current directory:
codex_records/<project-name>/
manifest.json
raw/*.jsonl
extracted/full/*.full.json
extracted/compact/*.compact.json
extracted/clean/*.clean.json
Use --source-root and --output-root to keep the live store and private analysis workspace explicitly separated.
- The source session store is opened read-only.
- Matching uses the real project
cwdrecorded in sessions. - Generated
codex_records/trees and JSONL files are ignored by default. - Repository tests use only synthetic fixtures and never inspect
~/.codex. compactandcleanpreserve message and tool-input text. They are not safe-to-publish formats.
See Privacy for the sharing boundary and Architecture for the event model.
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -p 'test_*.py' -v
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python3 -m codex_record_sync --helpThe fixture suite verifies project discovery, output isolation, all extraction modes and rollback-preamble deduplication.
- Codex's local schema can evolve; new event types may require extractor updates.
- This project does not detect or remove every secret or personal identifier.
- It does not interpret whether a task succeeded; it preserves observable records for later analysis.
- Raw and full modes can be large because fidelity is intentional.
- Versioned adapters for schema changes.
- A machine-readable redaction hook contract, kept separate from extraction.
- More synthetic fixtures for resumed tasks and nested subagents.
- Release artifacts and CI after the public package layout stabilizes.
Bug reports should include a minimal synthetic JSONL reproduction, never a real session. See CONTRIBUTING.md.
MIT. See LICENSE.