Expert knowledge for contributing to Litestream, a standalone disaster recovery tool for SQLite. Provides architectural understanding, code patterns, critical rules, and debugging procedures for WAL monitoring, LTX replication format, storage backend implementation, multi-level compaction, and SQLite page management. Use when working with Litestream source code, writing storage backends, debugging replication issues, implementing compaction logic, or handling SQLite WAL operations.
name litestream description Expert knowledge for contributing to Litestream, a standalone disaster recovery tool for SQLite. Provides architectural understanding, code patterns, critical rules, and debugging procedures for WAL monitoring, LTX replication format, storage backend implementation, multi-level compaction, and SQLite page management. Use when working with Litestream source code, writing storage backends, debugging replication issues, implementing compaction logic, or handling SQLite WAL operations. license Apache-2.0 metadata {"author":"benbjohnson","version":"1.0","repository":"https://github.com/benbjohnson/litestream"} Litestream Agent Skill Litestream is a standalone disaster recovery tool for SQLite. It runs as a background process, monitors the SQLite WAL (Write-Ahead Log), converts changes to immutable LTX files, and replicates them to cloud storage. It uses modernc.org/sqlite (pure Go, no CGO required). Quick Start
go build -o bin/litestream ./cmd/litestream
go test -race -v ./...
pre-commit run --all-files Critical Rules These invariants must never be violated:
go test -race -v ./...
go test -race -v -run TestReplica_Sync ./... go test -race -v -run TestDB_Sync ./... go test -race -v -run TestStore_CompactDB ./...
go test -coverprofile=coverage.out ./... go tool cover -html=coverage.out Key testing areas: Lock page handling with >1 GB databases and multiple page sizes Race conditions in position updates, WAL monitoring, and checkpointing Eventual consistency in storage backend operations Atomic file operations and cleanup on error paths Environment Validation Run scripts/validate-setup.sh to verify your development environment is correctly configured for Litestream development.