βββββββ βββββββ βββββββ βββββββββββ βββ βββββββ ββββββββββββββββ ββββββββββ βββββββββββ
βββββββββββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββ βββββββββββ
βββ βββ ββββββ βββββββββ ββββββ ββββββββββββββ βββββββββββ βββ βββββββββ
βββ βββ ββββββ βββββββββ ββββββ ββββββββββββββ βββββββββββ βββ βββββββββ
βββββββββββββββββββββββββββββββββββββ βββ βββ ββββββββββββββββββββββββββββββββββββββββββββ
βββββββ βββββββ βββββββ βββββββββββ βββ βββ βββββββββββββββββββ βββββββ βββββββ ββββββββ
Read-Only-First Diagnostic, Forensics & Recovery Toolkit for OpenAI Codex Sessions
Migration notice β 2026-08-23: The copy-only recovery core is now being developed inside Vetto as the first provider-neutral
vetto rescueadapter. This repository remains public and thecodex-rescuepackage remains available for compatibility while the0.2.0-alpha.*integration is tested. Existing users do not need to migrate immediately.
Run instantly without installation (zero setup required):
# Diagnostic inspection on your latest Codex session
npx --yes codex-rescue doctor --latest
# Batch analyze all local Codex sessions
npx --yes codex-rescue doctor --all
# List and discover all local Codex sessions
npx --yes codex-rescue sessions
# Explain any diagnostic finding code
npx --yes codex-rescue explain OVERSIZED_PAYLOADOr install globally via npm:
npm install -g codex-rescue
codex-rescue --helpCodex Rescue inspects local OpenAI Codex session rollouts (.jsonl), correlates SQLite index / projection layers, diagnoses persistence hazards, and creates reproducible recovery forks without ever mutating source session data in place.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CODEX RESCUE ARCHITECTURE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββΊ 1. ROLLOUTS (.jsonl) βββΊ Bounded Reader / Stream Hashing
ββββΊ 2. SQLITE (state.db) βββΊ Read-Only Projection Verification
ββββΊ 3. GIT WORKTREE βββΊ Fingerprint & Head Drift Check
β
βΌ
βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ
β DIAGNOSTICS & FORENSICS β ββββΊ β SAFE RECOVERY & FORK β
β (doctor / diff / graph) β β (salvage / plan / bundle) β
βββββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ
Important
Safety Guarantee: Codex Rescue operates read-only-first. It never rewrites original session JSONL files, never invents missing tool outputs, and never blindly replays side effects with uncertain state.
| Command | Purpose | Description |
|---|---|---|
sessions |
Session Inventory | Discovers and filters all local sessions on disk vs SQLite state (--latest, --orphans, --unindexed). |
doctor |
Health Inspection | Deep structural, projection, tool-pairing, and ordinal diagnostics (--all, --changed, --latest). |
explain |
Finding Reference | Self-contained explanations with exact evidence, risks, and recommended actions. |
diff |
Layer Divergence | Compares raw rollout JSONL vs SQLite state DB vs Git repository state. |
timeline |
Forensic Events | Generates a chronological, privacy-safe lifecycle timeline of a session. |
graph |
Agent Hierarchy | Visualizes parent-child subagent trees and session invocation graphs. |
storage |
Disk Footprint | Profiles session storage usage, large payloads, and media anomalies. |
schema |
Schema Analysis | Validates persisted schema generations and recognized record coverage. |
workspace |
Path Portability | Verifies saved working directory across POSIX, Windows, and WSL environments. |
writer |
Lock Inspector | Inspects active writer locks and Win32/POSIX process ownership. |
plan |
Recovery Plan | Generates a structured, reversible repair plan with pre-flight invariants. |
apply-plan |
Safe Plan Apply | Safely executes a verified recovery plan with pre-mutation backup. |
bundle |
Support Bundle | Exports a sanitized diagnostic bundle for bug reports (secrets redacted). |
redact-check |
Privacy Audit | Scans support bundles and artifacts for accidental leaks or credentials. |
report |
Offline HTML | Produces a clean, standalone offline HTML diagnostic dashboard. |
salvage |
Safe Forking | Extracts durable history into a clean recovery fork (--fork). |
verify |
Handoff Check | Verifies recovery artifacts and repository HEAD before continuation. |
auto |
Autopilot | Alpha7 unified autopilot controller across CLI/desktop/IDE surfaces (--repair-safe, --yes). |
self-test |
Capability Check | Runs Rescue capability, environment, privacy-engine and trust-verdict self-test. |
desktop |
Desktop Inspection | Codex Desktop status, doctor, sessions, diff, paths, writer and logs inspection. |
compatibility |
Compat Matrix | Inspects schema and runtime compatibility across rollout/SQLite generations. |
portable |
Portable Packages | Export, inspect and import portable session packages (--dry-run supported). |
share |
Safe Share Report | Generates a privacy-redacted diagnostic share report. |
simulate-plan |
Plan Sandbox | Simulates a recovery plan in a temporary sandbox without touching source data. |
- Bounded chunk streaming reader prevents memory exhaustion.
- Strict semantic distinction:
VALID_BUT_OVERSIZEDβ well-formed JSON exceeding byte thresholds.MALFORMED_RECORDβ corrupted byte sequence / NUL injections.TRUNCATED_TRANSCRIPTβ incomplete EOF record.
- Prohibits
HEALTHYverdict and refuses mutating plans on unparsed source records.
- Reconciles canonical rollout progressions with derived SQLite projection cursors.
- Detects
WEDGED_PROJECTIONand ordinal sequence anomalies. - Supports atomic derived projection cursor realignment with guaranteed rollout immutability.
- Standard npm package bundles pre-compiled standalone executables:
linux-x64windows-x64darwin-arm64(Apple Silicon)darwin-x64(Intel macOS)
- Zero runtime downloads, zero
curl | sh, zeroshell: true, and zero Python requirements for npm users.
Alpha7 is the "reality gate" milestone: every diagnostic claim is now grounded in observable local evidence, and every unsafe path fails closed.
- Unified Autopilot (
auto): single controller that routes across CLI, Desktop and IDE surfaces with explicit--repair-safeconfirmation gates. - Local Incident Intelligence: blackbox real-state observer, desktop multi-DB state adapter, and process tracking β presentation state is never treated as authoritative runtime truth.
- Disaster Recovery Primitives: transactional derived-state recovery engine, portable migration roundtrip, and derived index reconstruction.
- Trust Contracts: privacy engine and trust verdicts in
self-test; incident trust fails closed; unverified portable import and mutation are blocked. - Scale Qualification: bounded storage health diagnostics, streaming storage profiling, and peak RSS monitoring under large-file stress.
- Resilience Fixes: compaction 404 resiliency, forensic tail salvage, canonical thread identity everywhere, Windows extended-path normalization, and writer probes that never match Rescue itself.
# Run on the latest active session
codex-rescue doctor --latest
# Run on a specific rollout file
codex-rescue doctor ~/.codex/sessions/rollout-example.jsonl
# Incremental scan of only changed sessions
codex-rescue doctor --changed
# Structured JSON output
codex-rescue doctor --latest --jsoncodex-rescue explain WEDGED_PROJECTION
codex-rescue explain OVERSIZED_PAYLOAD
codex-rescue explain UNFINISHED_TOOL_CALL# Compare rollout against SQLite projection and Git
codex-rescue diff --latest
# View privacy-safe event timeline
codex-rescue timeline --latest --max-events 50# Generate a structured recovery plan
codex-rescue plan --latest > recovery_plan.json
# Execute recovery plan with mandatory pre-flight checks and backup
codex-rescue apply-plan recovery_plan.json# Create sanitized bundle (removes keys, tokens, personal paths)
codex-rescue bundle --latest -o support_bundle.json
# Audit bundle for potential leaks
codex-rescue redact-check support_bundle.json
# Generate standalone offline HTML diagnostic report
codex-rescue report --latest -o report.html| Channel | Identifier | Status | Install Command |
|---|---|---|---|
| npm (npx) | codex-rescue |
Active | npx --yes codex-rescue doctor --latest |
| npm (global) | codex-rescue |
Active | npm install -g codex-rescue |
| GitHub Releases | v0.1.0-alpha.7 |
Active | Download Release Assets |
Codex rollouts and SQLite stores may contain private prompts, proprietary source code, secrets, API tokens, and local file paths.
- Zero Telemetry: Codex Rescue never makes outbound telemetry or analytics network requests.
- Metadata-Only Diagnostics: Diagnostic dumps aggregate schema kinds and counts rather than raw prompt/code strings.
- Path Sanitization: User directories and private environments are masked during support bundle creation.
Run test suites and packaging audits:
# Clone repository
git clone https://github.com/shleder/codex-rescue.git
cd codex-rescue
# Run npm security allowlist and packaging tests
node --test npm/tests/*.test.cjs
# Run E2E test harness
python tests/e2e/harness_e2e.py --tier allDistributed under the MIT License. Copyright (c) 2026 shleder.