Skip to content

About

Project-scoped discovery and privacy-aware extraction for local Codex session records.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Codex Record Sync

Turn local Codex session history into inspectable, project-scoped records without touching the source.

English | 简体中文

Python 3.10+ Standard library only License: MIT

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.

Why this exists

The project grew out of repeated real-world recovery and audit work. Its design follows four opinions:

  1. The live Codex store is the source of truth. Never analyze an old hand-copied export when a fresh sync is available.
  2. A project is a set of sessions, not only the newest chat. Root tasks, subagents and resumed sessions can all carry evidence.
  3. Read-only means read-only. Source JSONL files under the Codex home are never edited.
  4. Smaller is not the same as safer. Compact output reduces tool-result volume; it does not remove private prompts, paths or credentials.

What it produces

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

Quick start

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 clean

Run from a source checkout without installing:

PYTHONPATH=src python3 -m codex_record_sync sync \
  --project-cwd "$PWD" \
  --mode all

By 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.

Safety model

  • The source session store is opened read-only.
  • Matching uses the real project cwd recorded in sessions.
  • Generated codex_records/ trees and JSONL files are ignored by default.
  • Repository tests use only synthetic fixtures and never inspect ~/.codex.
  • compact and clean preserve message and tool-input text. They are not safe-to-publish formats.

See Privacy for the sharing boundary and Architecture for the event model.

Verification

PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests -p 'test_*.py' -v
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=src python3 -m codex_record_sync --help

The fixture suite verifies project discovery, output isolation, all extraction modes and rollback-preamble deduplication.

Current limits

  • 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.

Roadmap

  • 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.

Contributing

Bug reports should include a minimal synthetic JSONL reproduction, never a real session. See CONTRIBUTING.md.

License

MIT. See LICENSE.

About

Project-scoped discovery and privacy-aware extraction for local Codex session records.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages