Cambria is a standalone version control system inspired by
Fossil SCM. A repository is a single SQLite database
file (*.db) containing versioned content, history, branches/tags, and
working-directory state.
The implementation uses Go, with SQLite provided by
github.com/mattn/go-sqlite3 (CGo).
Cambria is based on ideas, design, and implementation from Fossil and SQLite, created by D. Richard Hipp.
Design
- Single-file repository: one SQLite database per repo.
- Transactional integrity: repository state changes occur within SQLite transactions.
- Content-addressed storage: artifacts are identified by SHA-256.
- Working directory state tracking (VFILE): tracks working-directory changes via database state.
Design and implementation notes:
- Data model: doc_cambria/CAMBRIA_DATA_MODEL_DESIGN.md
- VCS implementation: doc_cambria/CAMBRIA_VCS_IMPL.md
- VFILE implementation: doc_cambria/CAMBRIA_VFILE_IMPL.md
- Checkin/commit design notes: doc_cambria/CAMBRIA_CHECKIN_PLAN.md
- CLI implementation notes: doc_cambria/CAMBRIA_CLI_IMPL.md
- Authentication & authorization design: doc_cambria/SYNC_IMPLEMENTATION_SUMMARY.md
- Sync protocol design: doc_cambria/SYNC_IMPLEMENTATION_SUMMARY.md
- REST API plan: doc_cambria/SYNC_IMPLEMENTATION_SUMMARY.md
Current Features
Local Version Control
Cambria supports full local (single-machine) workflows:
- Core commands:
init,open,add,commit,checkout,status,diff,log. - Branch/tag labels:
branch,tag. - File lifecycle:
mv,rm. - Merge:
mergeandmerge --abort. - Version/name resolution: UUIDs (full/prefix), branch names, tag names, and
special identifiers like
tipandcurrent.
Network and Distributed Version Control
Cambria has a fully-featured network stack for distributed workflows:
- HTTP Server:
cambria servestarts a server for a repository. - Network Commands:
clone,push,pull, andsynccommands enable multi-user, distributed collaboration. - Authentication: A robust, stateless bearer token authentication system secures the server. Passwords are hashed with Argon2id.
- Authorization: Granular, capability-based permissions (
clone,read,write,admin) are enforced on the server. - Sync Protocol: An efficient, multi-round sync protocol over HTTP (
/xfer) minimizes data transfer.
REST API
The cambria serve command also exposes a versioned REST API for automation and
integration:
GET /api/v1/version: Public endpoint to get server info.GET /api/v1/whoami: Authenticated endpoint to verify user identity.
See doc_cambria/SYNC_IMPLEMENTATION_SUMMARY.md for details on the network stack and how to add new endpoints.
Web UI and Todo App (In Progress)
Cambria is being developed as a web application platform with server-side rendering:
- HTML Template Rendering: Go
html/templatesystem with a shared base layout and page/fragment templates underweb/templates/, all loaded from the repository through the web asset cache. - VCS-backed Asset Cache: Static assets (CSS, JS, images) are served from a SQLite cache populated from versioned repository content, not the filesystem.
- HTMX Integration: Client-side interactivity (e.g. partial updates for todo items) without complex JavaScript.
- Cache-based Serving: All web assets are served from the
web_asset_cachetable, which mirrors the current checkout's file tree for efficient serving.
A small todo-list MVP demonstrates the collection-style app model:
- The app spec lives at
apps/todo.yamland defines atodoscollection and view routes (including/todos). - Records are stored in a generic
recordstable, accessed via helpers inpkg/store/records.go. - HTML routes (
/todos, toggle/delete actions) are wired incmd/cambria/serve.gousing the sameTemplateManagerand asset cache as the rest of the UI. - An end-to-end test script (
scripts/test_todo_app.sh) creates a temporary repo, loads the app spec and web assets, creates a user, logs in, and checks that authenticated/todosrenders successfully.
The web UI will continue to evolve into a full application platform inspired by
PocketBase, with features like user-defined data collections, real-time
updates, and "docs as code" content management. See
CAMBRIA_APP_TODO_PLAN.md and CAMBRIA_UI_PLAN.md for the roadmap.
HTTP Server and Sync Protocol
Cambria includes an HTTP server with authentication and a sync protocol:
- HTTP Server:
cambria serve- Starts an HTTP server for remote access - Authentication: Argon2id-based bearer token authentication with capability-based permissions (clone, read, write, admin, setup)
- Sync Protocol:
/xferendpoint implementing a multi-round conversational protocol for efficient artifact exchange- Transfers artifacts embedded in JSON messages (no separate artifact endpoints needed)
- Supports clone, push, pull, and bidirectional sync operations
- Have/want set reconciliation for efficient transfer
- REST API Endpoints:
GET /api/v1/version- Public endpoint returning server version and project codeGET /api/v1/whoami- Authenticated endpoint returning current user and permissions
Planned Features
Development is ongoing. The following major features are planned for future releases:
- Additional REST Endpoints:
GET /api/v1/status- Working directory statusGET /api/v1/artifact/{uuid}- Individual artifact retrieval for web UIs- Branch, tag, timeline, and user management endpoints
- Web UI Expansion (currently in progress):
- Timeline view for version history
- User authentication and session management for browser-based workflows
- Data collections API for user-defined schemas
- Real-time updates via Server-Sent Events (SSE)
- Markdown editor integration
- Configuration: Support for repository-specific settings in a
.cambria/configfile. - Ignore Patterns: A
.cambriaignorefile for excluding files from version control.
... For implementation details:
- Version control: Start with
doc_cambria/CAMBRIA_VCS_IMPL.mdanddoc_cambria/CAMBRIA_VFILE_IMPL.md - Network Stack (HTTP, Sync, Auth): See
doc_cambria/SYNC_IMPLEMENTATION_SUMMARY.mdfor the complete network architecture and guides for adding new endpoints.
Getting Started
Prerequisites
- Go 1.25.5+ (see
go.mod) CGO_ENABLED=1and a C compiler (e.g.gccorclang) forgo-sqlite3
Build from Source
- Clone the repository:
mkdir cambria
cd cambria
fossil clone https://<username>:<password>@ipsaw.com/cambria cambria.fossil
fossil open cambria.fossil
- Build the
cambriabinary:
go build -o cambria ./cmd/cambria
You can now move the cambria executable to a directory in your $PATH.
Quick Start Workflow
- Initialize a new repository:
cambria init my-project.db
- Create a working directory and open the repository:
mkdir my-project-work
cd my-project-work
cambria open ../my-project.db
This creates a _cambria file that links this directory to the repository
database.
- Add files and make your first commit:
echo "Hello, Cambria!" > README.md
cambria add README.md
cambria commit -m "Initial commit"
- Check the status:
cambria status
- Create a branch and switch to it:
cambria branch feature/new-idea
cambria checkout feature/new-idea
- Make changes and merge them back:
```sh echo "A new feature." > feature.txt cambria add feature.txt cambria commit -m "Implement amazing new feature"
cambria checkout main cambria merge feature/new-idea cambria commit -m "Merge new feature" ```
Project Structure Overview
cambria/
├── cmd/cambria/ # CLI application source
├── pkg/
│ ├── artifact/ # Manifest parsing and generation
│ ├── auth/ # Authentication and authorization (Argon2id, permissions)
│ ├── hash/ # Content hashing (SHA-256)
│ ├── httpapi/ # HTTP server, middleware, and REST handlers
│ ├── store/ # SQLite data access layer
│ ├── sync/ # Sync protocol (client, server, exchange logic)
│ └── vcs/ # High-level version control operations
├── internal/ # Internal helper packages
├── doc_cambria/ # Detailed implementation documentation
└── go.mod # Go module definition
For implementation details:
- Version control: Start with
doc_cambria/CAMBRIA_VCS_IMPL.mdanddoc_cambria/CAMBRIA_VFILE_IMPL.md - Network stack (HTTP, REST API, Sync, Auth): See
doc_cambria/SYNC_IMPLEMENTATION_SUMMARY.mdfor the unified server architecture, sync protocol, and authentication model.
Building and Testing
go build ./...
go test ./...
go test -race ./...
go test -cover ./...
go fmt ./...
Coverage notes (from go test -cover ./...):
- Core libraries (
pkg/*) report non-zero statement coverage. cmd/cambriaandinternal/testutilmay report0.0%depending on which tests exercise those packages.
External Dependencies
Cambria keeps external dependencies minimal and prefers well-maintained, MIT licensed libraries when the standard library is insufficient. Notable dependencies include:
github.com/mattn/go-sqlite3for SQLite database access (CGo-based).github.com/urfave/cli/v3for the CLI framework.github.com/alexedwards/scs/v2for HTTP session management in the web UI.github.com/justinas/nosurffor CSRF protection in the web UI.
Copyright (c) 2026 Nicholas Hildebrant. All rights reserved.