Skip to main content

A git-like filesystem that automatically creates narrative commits.

Project description

timecapsule

A git-like filesystem that automatically creates narrative commits.

Quick Start · How It Works · Browsing · LLM Narrator
Python 3.10+ MIT License Version 0.1.0


Every file has a story. timecapsule is a background daemon that watches your project folders and creates narrative commit messages from your changes — automatically.

After 2 minutes of inactivity on a file, it snapshots the changes to a local Git repository. The commit message is generated by a small local LLM that summarizes why you made the changes, not just what changed.

"Renamed parse() to tokenize() after the linter complained about naming — also dropped the unused xml import."

Over time, you get a searchable, browsable timeline of your work. Each file's history becomes a diary.

Quick Start

pip install capsule-narrative
timecapsule

This watches the current directory tree. After 2 minutes of inactivity on a file, it snapshots the changes.

timecapsule /path/to/project          # Watch a specific directory
timecapsule --idle 60                 # Faster snapshots (60s idle)
timecapsule --once                    # One-time snapshot of all files
timecapsule --browse                  # Open the timeline browser TUI
timecapsule --status                  # Show capsule stats

How It Works

File watcher. A background daemon monitors file changes using watchdog. When a file hasn't been modified for 2 minutes (configurable), it triggers a snapshot — you've finished a thought.

Git backend. Each file gets its own orphan branch in a dedicated bare repository at ~/.capsule/timecapsule. The user's real Git repos are never touched. Branches are named by canonical path, so renaming or moving a file can continue its history.

Narrative commit messages. The daemon diffs the current file against its last snapshot and generates a commit message that reads like a diary entry.

Browsing

timecapsule --browse

Opens a Textual TUI that shows:

  • Tracked files — all files with snapshots, sorted by most recent
  • Timeline — commit history for the selected file with narrative messages
  • Diff preview — file content at any selected snapshot

You can scroll through history, search messages, and see exactly what your file looked like at any point.

Ollama

timecapsule works without Ollama — it generates structural commit messages by default ("Added 3 lines to main.py (Python)"). But with Ollama installed, the messages transform into genuine narrative.

ollama pull qwen2.5-coder:1.5b

This ~1GB model runs on any modern laptop and generates commit messages in ~2 seconds. Smaller models like llama3.2:1b also work.

The prompt context includes the file diff, the file path, and the previous commit message for continuity. The LLM explains why the changes were made, not just what changed.

Architecture

~/.capsule/
├── timecapsule/          # Bare git repository
│   └── refs/heads/       # One orphan branch per file
│       ├── home-user-project-main-py
│       ├── home-user-project-readme-md
│       └── ...
└── timeline.db           # SQLite index for fast queries

Each snapshot:

  1. Hashes the file content into a git blob
  2. Creates a tree object referencing the blob
  3. Commits the tree to the file's orphan branch (with parent if one exists)
  4. Records metadata in SQLite for fast timeline queries

The SQLite store makes timecapsule --browse instant — no git log parsing needed.

FAQ

Q: Does it affect my existing Git repos? A: No. timecapsule uses a dedicated bare repository at ~/.capsule/timecapsule. Your .git directories are untouched.

Q: What file types are watched? A: Common source files: .py, .js, .ts, .rs, .go, .java, .md, .json, .yaml, .css, .html, .jsx, .tsx, .c, .cpp, .h, .sh, .rb, .sql, and more.

Q: Can I delete the capsule database? A: Yes — remove ~/.capsule/ to wipe everything. Snapshots are disposable by design.

Q: Does it work on Windows/Mac/Linux? A: Yes. The watcher uses watchdog which works on all three platforms. The git operations are cross-platform.

License

MIT


Every file has a story.

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

capsule_narrative-0.1.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

capsule_narrative-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: capsule_narrative-0.1.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for capsule_narrative-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e9b02467a76ba157f71b484c3c78df6bc57043eccf18a693ac8efb4d8446d47
MD5 f004d286e53415d749ef64ed7c64ea90
BLAKE2b-256 587c91a7ce56a39e63278b6f113dbbf94bd7ca22f70f7b0b8755c387b4927998

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for capsule_narrative-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0020e15c950cf02650564ea211bed7600fd74b36feea849a8daf9fecddde5fef
MD5 b5dc052d7b87899111ad18ebac0c4011
BLAKE2b-256 6d38ad4ac58aaf7d10297b92dec76cbde9d58d9be18e8de4633b909b04e4ce70

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 Pingdom Monitoring Sentry Error logging StatusPage Status page