Skip to main content

Offline integrity checks and non-destructive recovery bundles for Codex rollout JSONL

Project description

Agent Session Rescue

Agent Session Rescue is an offline, non-destructive CLI for inspecting one explicitly selected Codex rollout JSONL file and creating a separate, hash-audited recovery bundle.

Version 0.1.0 is a narrow beta. It does not modify Codex files, indexes, SQLite databases, configuration, or application state, and it does not promise that every damaged thread can be made resumable.

Install

Python 3.11 or newer is required. The package has no runtime dependencies.

python3 -m pip install agent-session-rescue
session-rescue --help

To install from a source checkout instead, run python3 -m pip install . in the repository root.

Read-only scan

Choose the rollout file yourself. v0 never crawls ~/.codex or chooses a session on your behalf.

session-rescue scan /path/to/rollout.jsonl
session-rescue scan /path/to/rollout.jsonl --format json

The report includes only structural metadata: the displayed input path, SHA-256, byte and record counts, finding codes, locations, sizes, and recovery limitations. It does not echo prompts, tool output, encrypted reasoning, inline images, or environment values.

Explicit salvage

Salvage is a second, explicit command and requires a new or empty output directory:

session-rescue salvage /path/to/rollout.jsonl --output ./recovery-bundle

Depending on the findings, the bundle can contain:

  • manifest.json: input/output hashes, transformations, byte counts, and loss warnings.
  • report.json: the same metadata-only structural report.
  • resume.md: bounded user/assistant text plus tool names/statuses; no raw tool output or binary data.
  • quarantine/: exact malformed fragments that could not be parsed.
  • attachments/: safely decoded oversized data payloads addressed by SHA-256.
  • repaired.jsonl: only when all transformations are supported and the candidate passes the same validator.

The original input hash and byte length are checked again after salvage. The product never installs repaired.jsonl into Codex; reintegration is outside the v0 support boundary.

Records over the 8 MiB parser cap are never decoded or parsed. Salvage can stream their exact bytes into quarantine, but it will not emit a repaired copy.

Exit codes

  • 0: supported file is structurally clean.
  • 1: findings exist and every blocking finding has a supported salvage transformation.
  • 2: only partial recovery/export is safe; no loadable repaired JSONL is promised.
  • 3: invalid invocation, unreadable input, unsafe output, or unsupported schema.
  • 4: unexpected internal failure; the original remains unchanged.

The stable finding catalog is in docs/findings.md. The recovery bundle and data-loss contract is in docs/repair-contract.md.

Privacy and safety

  • No network access, account, cloud storage, background process, or CLI telemetry.
  • Default scan performs no writes.
  • salvage writes only under the explicitly selected new/empty output directory.
  • The input rollout, Codex indexes, SQLite, and configuration are never modified.
  • Recovery outputs can contain sensitive session text or raw fragments. Protect, review, and delete the bundle like the original session.

See SECURITY.md before using salvage on a real session.

v0 non-goals

No Claude Code/OpenClaw/Cursor/Copilot/Gemini formats, live tracing, observability dashboard, model calls, semantic replay, AI summarization, GUI, cloud sync, automatic Codex-state repair, licensing system, workflow engine, scheduler, or management UI.

Local verification

PYTHONPATH=src python3 -m unittest discover -s tests -v
python3 scripts/dry_run.py
python3 -m compileall -q src tests scripts

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_session_rescue-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_session_rescue-0.1.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file agent_session_rescue-0.1.0.tar.gz.

File metadata

  • Download URL: agent_session_rescue-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for agent_session_rescue-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af6b838d3af5242819216d3645bfae632f22fed19fabd595f516ce8ef65cfa85
MD5 c7168b8c1b3b951a0820c6793dd15576
BLAKE2b-256 628d1e5224fdd4ec92d89a88400e57ec5ba84ddbf128989761d809c4f1b28c1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_session_rescue-0.1.0.tar.gz:

Publisher: publish.yml on haozhn/agent-session-rescue

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file agent_session_rescue-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_session_rescue-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11f3ea1a73cd745aa7e9167e7e7b272b0e8366a4d9115c4d4900624f54163721
MD5 f878c2dae68a9938e093f7bcdf8dc3cb
BLAKE2b-256 207d5ff588769aa5b8ce0f17912f8da702215eafa094dc334040c22cb586bfca

See more details on using hashes here.

Provenance

The following attestation bundles were made for agent_session_rescue-0.1.0-py3-none-any.whl:

Publisher: publish.yml on haozhn/agent-session-rescue

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page