Skip to main content

DiffTrail

Reconstruct project history that Git never captured.

Recover lost states and turn them into an evidence-backed Git timeline.

PyPI Python 3.11+ MIT license

Quick start · How it works · Commands · Safety


uvx difftrail init


Git only remembers what you commit. AI coding agents often leave useful intermediate states scattered across patches, tool calls, test output, uncommitted diffs, later file versions, and local session history.

DiffTrail retrospectively collects that evidence, replays every change it can verify, and uses Codex to reconstruct the missing pieces in a separate branch with clearly marked commits that you can revert or refer to.

Quick start

Run without installing

From the Git repository you want to reconstruct:

uvx difftrail init
uvx difftrail reconstruct

Recover one particular state instead:

uvx difftrail reconstruct "before the auth refactor"

If reconstruction is interrupted:

uvx difftrail reconstruct --resume

Install the difftrail command

uv tool install difftrail
difftrail init
difftrail reconstruct

Upgrade later with uv tool upgrade difftrail. DiffTrail requires Python 3.11+, Git, the Codex CLI, and existing Codex authentication.

Until the first PyPI release is published, run the GitHub version directly:

uvx --from git+https://github.com/rishaandesai/difftrail.git difftrail init

How it works

Collect Finds matching Codex sessions, Git history, diffs, patches, file versions, tool calls, test output, and supplied artifacts.
Reconstruct Replays byte-exact changes first, then lets Codex resolve only the remaining gaps.
Preserve Writes reconstructed milestones to a separate branch and worktree with provenance attached as Git notes.

Running difftrail reconstruct with no target reconstructs the complete recoverable history. DiffTrail shows a persistent task progress bar whose total grows when Codex discovers more work. Commands appear as [codex] $ ...; detailed model events and command output stay in the run log.

Commands

Command Purpose
difftrail init Check Python, Git, Codex, local history, and repository readiness.
difftrail reconstruct [TARGET] Scan and reconstruct the full history or one described state.
difftrail reconstruct --resume Continue the latest reconstruction without rescanning or resetting completed work.
difftrail scan [REPO] Collect and normalize evidence without starting reconstruction.
difftrail evidence RUN EVENT Inspect one normalized evidence record.
difftrail explain COMMIT Explain the evidence and classification behind a reconstructed commit.
difftrail publish RUN Push the reconstructed branch and provenance notes to the existing remote.

The lower-level start, replay, commit, and verify commands support the reconstruction workflow and advanced manual use. Run difftrail COMMAND --help for every option.

Safety

DiffTrail is local-first. It never switches or modifies the original worktree, never publishes automatically, stores no model credentials, and never executes a historical command merely because it appeared in agent history.

Every reconstructed file is classified as:

  • exact — original bytes were preserved;
  • reconstructed — the bytes follow from verified evidence;
  • inferred — model judgment affected the result.

Full manifests remain under .git/difftrail/ and travel with published commits through refs/notes/difftrail.

License

MIT

Download files

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

Source Distribution

difftrail-0.1.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

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

difftrail-0.1.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: difftrail-0.1.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.8

File hashes

Hashes for difftrail-0.1.0.tar.gz
Algorithm Hash digest
SHA256 94d41e13d2fdd28a891abfd51b6ab3f7db2c93f52d1c9c8f259291bd983e2fad
MD5 c5344a5e409600c3884b8f214415b19a
BLAKE2b-256 ca8378a1cf7e0a24c092c54a14b3cda97a78e2af54376051688f5dde660b15dc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: difftrail-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.8

File hashes

Hashes for difftrail-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c25d565041560e1237f0064374f30270ce745a7569a48a5190d13c9c14ae8e3
MD5 ba0bfc71654b0216af31ab347c3c3481
BLAKE2b-256 e317d059c22fc5c094b71acdf011cf1882720d3fa3a06c4cbbc60ff117d1f992

See more details on using hashes here.

Supported by

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