Git tracks the snapshots you choose to commit. It does not track the folder you have been editing for three hours without committing, which is exactly where people lose work. Kalpa watches a directory and logs every filesystem event into a local SQLite database, so any folder gets a history whether or not it is a repository.
Repo: swadhinbiswas/kalpa · Install: pip install kalpa
What it does
Point it at a folder and it starts watching. State lives in a .kalpa/ directory beside the files, with no remote server and no staging area.
kalpa watch ./my-project --background
rm -rf src/
kalpa undo # restores what was just destroyed
kalpa timeline
kalpa replay --speed 3x
kalpa fork --from "1 hour ago"
kalpa diff "2 hours ago" "now"
kalpa snapshot --label "before-refactor"
Time arguments accept natural language: 5 minutes ago, yesterday, yesterday 6pm, or an absolute timestamp. fork materializes a copy of the folder at a past state, diff compares two points in time, and undo restores the last destructive change.
How it stores history
The watcher uses watchdog to receive create, modify, rename and delete events, and each one is written to SQLite as a row in a timeline. File contents are stored as incremental deltas compressed with zstandard, which keeps the database small even for an active directory. The architecture is flat: no daemon to manage and no background server. The --background flag forks the watcher and records a PID file.
The modules are separated by job: watcher for events, snapshot for deltas, storage for SQLite and compression, plus replay, fork, diff, timeline, config, and a Textual TUI. That separation is why fork and diff are cheap: they read from the same event log that the watcher wrote, rather than reconstructing state from files.
Why not just git
Git answers a different question. It records intent at commit time and ignores everything between commits, and some folders should never be a repository at all: config directories, data folders, scratch work. Kalpa records what actually happened, including the rm -rf you did not mean. The two coexist fine. A repository can have a Kalpa watch on top of it for the uncommitted hours.
Working on it
106 tests cover the modules across Linux, macOS and Windows on Python 3.12 and 3.13, run through GitHub Actions. Building it reinforced a lesson I keep meeting in data systems: an append-only event log with a query layer is a small idea that answers a surprising number of questions. Replay, diff and fork are all reads against the same log, which is why the storage layer is the part worth getting right first.
The repository above has the source and the TUI.
Reach me at swadhinbiswas.cse@gmail.com or on GitHub and LinkedIn.
No comments yet.