Case study · Open source
libfossil
A pure-Go reader and writer for Fossil SCM repositories. No CGo, static binaries, WASM-ready. Built to be embedded inside agent processes that need a content-addressed, fork-tolerant version-control substrate without shelling out to a binary.
Project
Embeddable Fossil library
Engagement
Original library design and build
Status
v0.4 · alpha · open source
Overview
A typed handle on .fossil files.
Fossil ships as a single C binary that bundles a content-addressed DAG, an HTTP sync protocol, and a SQLite-backed storage format. libfossil keeps the storage format and sync wire and re-implements the read and write paths in pure Go.
A Go service can open a repo, read the timeline, commit changes, and sync over HTTP as typed function calls instead of parsed CLI text. No subprocess, no version drift, no exec calls in the request path.

Architecture
One core, three pluggable axes.
Repo is the only handle application code touches. The three axes around it decide how SQLite runs, how sync talks to remotes, and where telemetry goes.

- db driver — modernc/sqlite for pure Go ergonomics; ncruces/sqlite for a smaller WASM footprint.
- transport — HTTP
/xferby default; swap in custom for NATS, iroh, or mesh. - observer — wire commits, syncs, and read-side traffic into existing telemetry.
- callers — the same core powers the libfossil CLI, library users, and WASM builds.
Why it matters
Forks are first-class. Cleanup is not a tax.
When five to ten agents work on the same codebase in parallel, the bottleneck stops being model quality. It is version control.
Library, not subprocess.
Embed Fossil into Go services. No os/exec, no parsing CLI text on every call.
Static binaries.
Cross-compile in seconds. WASM works out of the box.
One library, three axes.
Repo is the only handle. SQLite driver, transport, and observer are pluggable.
Format-compatible.
Repos round-trip cleanly with the upstream
fossilbinary.
Compared to neighbors
Library, not subprocess. No CGo, no host binary.
The two existing ways to talk to a Fossil repo from Go are shelling out to fossil or CGo bindings to libsqlite. libfossil lives between them.

Specifications
Boring on purpose.
Language
Go (no CGo)
Module
github.com/danmestas/libfossil
Storage
.fossil (SQLite)
Drivers
modernc · ncruces (pluggable)
Targets
linux · darwin · windows · wasip1
Sync
HTTP /xfer · pluggable
Observability
context.Context · OpenTelemetry
License
MIT · alpha
Related
One piece of a small substrate.
libfossil is the storage layer alongside DagNats (workflow orchestration) and EdgeSync (mesh sync) — three utilities that give autonomous coding agents a sandbox to collaborate in.
Reach out
Questions about the library, want to use it for something, or just want to compare notes — send me an email.
[email protected]