Libra is a partial implementation of a Git client, developed in Rust.
The goal is not to build a perfect, 100% feature-complete reimplementation of Git (if you want that, take a look at gitoxide). Instead, Libra is evolving into an AI agent–native version control system.
The libra code command starts an interactive TUI (with a background web server) that is designed to be driven collaboratively by AI agents and humans.
$ libra
Usage: libra <COMMAND>
Commands:
init Initialize a new repository
clone Clone a repository into a new directory
code Start Libra Code interactive TUI (with background web server)
add Add file contents to the index
rm Remove files from the working tree and from the index
restore Restore working tree files
status Show the working tree status
clean Remove untracked files from the working tree
stash Stash the changes in a dirty working directory away
lfs Large File Storage
log Show commit logs
show Show various types of objects
branch List, create, or delete branches
tag Create a new tag
commit Record changes to the repository
switch Switch branches
rebase Reapply commits on top of another base tip
merge Merge changes
reset Reset current HEAD to specified state
cherry-pick Apply the changes introduced by some existing commits
push Update remote refs along with associated objects
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
diff Show changes between commits, commit and working tree, etc
blame Show author and history of each line of a file
revert Revert some existing commits
remote Manage set of tracked repositories
open Open the repository in the browser
config Manage repository configurations
reflog Manage the log of reference changes (e.g., HEAD, branches)
worktree Manage multiple working trees attached to this repository
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print versionLibra Code supports three operation modes, each designed for different use cases.
Starts an interactive Terminal User Interface along with a background web server.
This is the standard mode for developers who want to work directly in the terminal with AI assistance.
libra code- Storage: Uses the local project directory (
.libra/) to isolate history and context per project.
Runs only the web server without the TUI.
Useful for remote development or when you prefer using the browser interface exclusively.
libra code --web- Storage: Uses the local project directory (
.libra/).
Runs the Model Context Protocol (MCP) server over standard input/output.
This mode is designed for integration with AI clients like Claude Desktop.
libra code --stdio- Storage: Uses the local project directory (
.libra/) for history persistence (same as TUI/Web modes).
The directory must be writable by the calling process (including sandboxed desktop AI apps).
To use Libra with Claude Desktop, add the following to your claude_desktop_config.json:
{
"mcpServers": {
"libra": {
"command": "/path/to/libra",
"args": ["code", "--stdio"]
}
}
}The codebase is designed to be clean and easy to read, making it maintainable and approachable for developers of all skill levels.
- Windows
- Linux
- macOS
Libra’s core implementation is essentially compatible with Git (developed with reference to Git’s own documentation), including support for on-disk formats such as:
objectsindexpackpack-index
This allows Libra to interact seamlessly with Git servers (for example, push and pull work with standard Git remotes).
While maintaining compatibility with Git, Libra intentionally diverges in some areas:
- Uses an SQLite database to manage loosely structured files such as
config,HEAD, andrefs, providing unified and transactional management instead of plain-text files.
Libra implements a worktree subcommand that is broadly compatible with git worktree, allowing you to manage multiple working directories attached to the same repository storage.
Unlike git worktree remove, Libra does not delete worktree directories on disk by default.
Supported subcommands:
libra worktree add <path>– create a new linked working tree at<path>libra worktree list– list all registered working trees (including the main worktree)libra worktree lock <path> [--reason <msg>]– mark a worktree as locked with an optional reasonlibra worktree unlock <path>– unlock a previously locked worktreelibra worktree move <src> <dest>– move a worktree directory to a new locationlibra worktree prune– prune missing or non-existent worktrees from the registrylibra worktree remove <path>– remove a worktree from the registry without deleting its directory on disk (the main worktree cannot be removed)libra worktree repair– repair inconsistent worktree state if the registry and directories get out of sync
Libra supports using S3-compatible object storage (AWS S3, Cloudflare R2, MinIO, etc.) as an alternative or supplement to local storage.
This feature implements a tiered storage architecture:
- Small objects (< threshold) – stored in both local and remote storage
- Large objects (≥ threshold) – stored in remote storage with a local LRU cache
If LIBRA_STORAGE_TYPE is not set, Libra falls back to local-only storage under .libra/objects.
Configure object storage by setting these environment variables:
| Variable | Description | Required (for S3/R2) | Default |
|---|---|---|---|
LIBRA_STORAGE_TYPE |
Storage backend type: s3 or r2 |
Yes | – |
LIBRA_STORAGE_BUCKET |
Bucket name | Yes | libra |
LIBRA_STORAGE_ENDPOINT |
S3-compatible endpoint URL (required for R2) | Yes (for R2) | AWS S3 default |
LIBRA_STORAGE_REGION |
Region for bucket | No | auto |
LIBRA_STORAGE_ACCESS_KEY |
Access key ID | Yes | – |
LIBRA_STORAGE_SECRET_KEY |
Secret access key | Yes | – |
LIBRA_STORAGE_THRESHOLD |
Size threshold in bytes for tiering | No | 1048576 (1 MB) |
LIBRA_STORAGE_CACHE_SIZE |
Local cache size limit in bytes | No | 209715200 (200 MB) |
LIBRA_STORAGE_ALLOW_HTTP |
Allow HTTP (non-TLS) endpoints for testing (not for prod) | No | false |
Note: If any mandatory variable is invalid or empty (for example, empty bucket or credentials), Libra automatically falls back to local storage and logs an error message.
The following Git top-level commands are currently not implemented in Libra (excluding submodule and subtree, which are intentionally omitted):
gc– garbage-collect unreachable objects and pack filesprune– remove loose objects that are no longer reachablefsck– verify repository integritymaintenance– periodic maintenance taskscat-file– display raw object contentshash-object– compute object hash for raw datarev-parse– resolve revisions, refs, and object IDsrev-list– list reachable commitsdescribe– human-readable description based on tagsshow-ref– list all refssymbolic-ref– read/write symbolic refsverify-pack– validate pack filespack-objects/unpack-objects– pack and unpack object collectionsls-remote– list remote referencesremote-show– show detailed remote inforemote-prune– prune stale remote-tracking branchesfetch-pack/push-pack– low-level fetch/push operationsgrep– search file contents with regexbisect– binary search for a bad commitfilter-branch(orgit filter-repo) – rewrite historynotes– attach arbitrary metadata to objectsarchive– create tar/zip archives of tree snapshotsrebase --autosquash/rebase --reapply-cherry-picks– advanced rebase options
These commands are slated for future implementation according to the project roadmap.
Libra does not provide the submodule or subtree commands. Because Libra stores objects in an S3-compatible backend and is designed around a Monorepo layout with Trunk-based Development, the use-cases that git submodule/git subtree address (embedding separate repositories) are handled differently – large external data lives in S3 and all code lives in a single repository.
This design choice simplifies dependency management and aligns with Libra’s goal of supporting ultra-large repositories while keeping a single source of truth.
Before submitting a Pull Request, please ensure your code passes the following checks:
# Run clippy with all warnings treated as errors
cargo clippy --all-targets --all-features -- -D warnings
# Check code formatting (requires nightly toolchain)
cargo +nightly fmt --all --checkBoth commands must complete without any warnings. The clippy check treats all warnings as errors, and the formatter check ensures code follows the project style guide.
If the formatting check fails, you can automatically fix formatting issues by running:
cargo +nightly fmt --allThis project builds with Buck2. Please install both Buck2 and cargo-buckal before development:
# Install buck2: download the latest release tarball from
# https://github.com/facebook/buck2/releases, extract the binary,
# and place it in ~/.cargo/bin (ensure ~/.cargo/bin is on PATH).
# Example (replace <tag> and <platform> with the latest for your OS):
wget https://github.com/facebook/buck2/releases/download/<tag>/buck2-<platform>.tar.gz
tar -xzf buck2-<platform>.tar.gz
mv buck2 ~/.cargo/bin/
# Install cargo-buckal (requires Rust toolchain)
cargo install --git https://github.com/buck2hub/cargo-buckal.gitPull Requests must also pass the Buck2 build:
cargo buckal buildWhen you update dependencies in Cargo.toml, regenerate Buck metadata and third-party lockfiles:
cargo buckal migrate