Skip to main content

chat-timeline

Export chat history from Cursor, Claude Code, and Codex and build a git-tracked, LLM-friendly project timeline.

The result is three artifacts that live inside your repo:

  • timeline/timeline.md — chronological, compact, ready for an LLM to read.
  • timeline/contents/timeline.json — referenced content keyed by entry ID.
  • timeline/sessions/session.md — full chat exports + git index context.

A built-in git pre-commit hook keeps the timeline in sync with your commits automatically.

Works on Windows, macOS, and Linux. Pure stdlib — no runtime dependencies.


Install + configure (one command)

pipx install chat-timeline && timeline init

pipx not available? The equivalent is:

python -m pip install --user chat-timeline && timeline init

timeline init is idempotent and does everything for you:

  1. Resolves the project root (git rev-parse --show-toplevel).
  2. Creates timeline/ with chats/, sessions/, contents/, and the archive folder.
  3. Writes timeline/.gitignore and a managed block in the project's .gitignore.
  4. Installs LLM_INSTRUCTIONS.md for downstream prompts.
  5. Installs the git pre-commit hook (calls timeline -p on each commit).

To reverse: timeline deinit removes the hook and the managed .gitignore block. Your exported data is left untouched.

Git worktrees

Run timeline init once per worktree, but understand what is shared and what is not:

  • The package — install once. pipx puts timeline on your PATH for every worktree.
  • The hook — shared. Git hooks live in the repo's common dir, so the hook installed from any worktree fires in all of them. Re-running timeline init elsewhere detects it and does nothing.
  • The timeline and its state — per worktree. timeline/, .precommit_state.json, and the tracked-chat set belong to the working tree you are in, which is also how the agents see it: Claude Code and Codex key their session storage on the working directory, so a worktree genuinely has its own chat history.

So the shared hook fires everywhere but only does work where a timeline/.precommit_state.json exists. In a worktree you have not inited yet, it says so and skips. Note that timeline deinit removes the shared hook — it disarms every worktree, not just the current one.


Daily use

timeline                  # interactive selector → exports + session + timeline
timeline claude           # claude only
timeline cursor 1-5       # cursor chats #1..#5
timeline -t               # rebuild timeline only (incremental)
timeline -t -rt           # rebuild timeline from scratch
timeline -p               # pre-commit standalone (auto-detects modified chats)

Equivalent: python -m chat_timeline ….

Full flag reference: timeline --help.

Interactive selector keys

Key Action
↑ ↓ move pointer
PgUp PgDn page
Home End jump to first/last
Space toggle chat (or entry, when expanded)
→ expand chat to entries
← collapse / jump back to parent
a toggle select-all
t cycle tracking mode (chat) or toggle exclude/force-add (entry). Hold 3s to clear tracking.
p toggle pre-commit auto mode
o toggle timeline archive rotation for this run
h cycle hot filter: off → chat (keep chats with any file-changing turn) → entry (keep only file-changing turns)
Tab switch list ↔ numeric input
Enter confirm · Esc cancel

What it reads (per source)

Source Storage location Notes
Cursor %APPDATA%/Cursor/User/workspaceStorage/ (Win), ~/Library/Application Support/Cursor/User/workspaceStorage/ (mac), ~/.config/Cursor/User/workspaceStorage/ (linux) SQLite
Claude Code ~/.claude/projects/<slug>/*.jsonl Cross-runtime: Windows reads WSL data, WSL reads Windows data
Codex ~/.codex/sessions/**/*.jsonl Same cross-runtime discovery

Nothing is transmitted anywhere. Everything runs locally on your machine.


Configuration

Env var Effect
TIMELINE_PROJECT_ROOT Override the auto-detected git toplevel.
TIMELINE_HOME Override the default <project>/timeline location.
TIMELINE_AMEND Set by the pre-commit hook on git commit --amend.

Scan cache

To keep wide-scope scans fast, parsed Codex session metadata is cached under <TIMELINE_HOME>/.cache/sessions/codex/<sha1>.json, keyed by JSONL mtime + size. The cache is regenerated on demand — safe to delete, and already covered by the managed .gitignore block.


Pre-commit hook details

The hook is a POSIX shell script that:

  1. Detects git commit --amend from the parent process's cmdline.
  2. Calls the installed timeline entry point, with fallbacks to python -m chat_timeline and wsl.exe timeline.
  3. Stages any updated timeline files into the commit.

On Windows it runs under Git Bash (which ships with Git for Windows).


Status

v0.2.0 ships the modular layout (sources/, tui/, markdown.py, git_utils.py, session.py, timeline.py, precommit.py, app.py, _state.py) with no _legacy/ block — the CLI and on-disk format are unchanged from v0.1.x.


Contributing

See CONTRIBUTING.md. Bug reports welcome — please include the output of timeline --version and your OS + Python version.

License

MIT. See LICENSE.

Metadata

Release files for chat-timeline 0.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chat-timeline 0.3.3
File Size Uploaded Provenance Actions
chat_timeline-0.3.3.tar.gz 69.2 kB With provenance Details for chat_timeline-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chat-timeline 0.3.3
File Interpreter ABI Platform Actions
chat_timeline-0.3.3-py3-none-any.whl Python 3 none any Details for chat_timeline-0.3.3-py3-none-any.whl

Total release size: 149.8 kB

Release files / chat_timeline-0.3.3.tar.gz

Download URL chat_timeline-0.3.3.tar.gz
Size 69.2 kB
Tags Source
SHA-256 checksum
How to use checksums
715f1690858c11296ac3321275d7ef08f3cd5feff3c5586190d31d7f53044732
BLAKE2b-256 checksum
How to use checksums
c9475761021c4dfc464e0fd9cd43ed64272ac3a9ab2136c82df26dfe08090827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release files / chat_timeline-0.3.3-py3-none-any.whl

Download URL chat_timeline-0.3.3-py3-none-any.whl
Size 80.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dd9984db47cd24d1fd7dcb7abedc2186cb84e9bca1f795a60a28dacf09169c3
BLAKE2b-256 checksum
How to use checksums
b3807d0bd66bd6a65d52424ee1bcfa5754b94d6f588d0081775d332e78f5c3c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Security for chat-timeline 0.3.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for chat_timeline-0.3.3.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page