Local repository format#
<worktree>/
├── .rvcignore Git-compatible ignore rules (tracked)
└── .rvc/
├── config.toml core/project/user/ai/run/remote settings (no secrets)
├── HEAD "ref: refs/heads/<branch>\n" or "<commit id>\n" (detached)
├── objects/ab/cdef… content-addressed store; first byte = codec ('Z' zlib | 'R' raw)
├── objects/tmp/ in-flight writes (published with atomic rename)
├── refs/heads|tags|releases|remotes/<name> one file per ref containing an object id
├── logs/<ref> reflog, JSON lines {ts, old, new, msg}
├── index.db SQLite staging index (files + staged research graph)
├── runs/<run_key>/ experiment buffers (events.jsonl, meta.json, stdout/stderr)
├── locks/ operation locks (commit, index, gc)
├── cache/ai.db model response cache + token usage (derived, deletable)
├── audit_state.json finding statuses (workflow state, not history)
├── MERGE_HEAD / ORIG_HEAD / MERGE_MSG / MERGE_CONFLICTS only during a merge
└── staging/ reserved
Index (index.db)#
The index holds the complete next research state: files (path → blob or external
reference, plus a stat cache: size, mtime_ns, inode), entities (entity id → staged version),
edges (edge key → edge object). A commit snapshots exactly the index. Files whose mtime is
within 2 s of the index write are stored with mtime_ns = 0 (racy-clean protection) and are
re-hashed on the next status.
Reference updates#
Every ref update takes <ref>.lock with O_CREAT|O_EXCL, checks the expected old value
(compare-and-swap), writes <ref>.tmp, fsyncs, renames over the ref, then appends to the
reflog. Locks held by dead processes are reclaimed. RefConflict means someone else moved
the ref; nothing was changed.
Object writes#
Objects stream to objects/tmp/obj-*, are hashed while written, fsynced, then renamed into
place. If the id already exists the temp file is discarded (deduplication). Incompressible
content (sampled on the first MiB) and objects > 64 MiB are stored raw.
Ignore defaults#
Always applied before .rvcignore: VCS dirs, .env* (except .env.example), keys and
credential files (*.pem, *.key, id_rsa*, credentials.json, service-account*.json,
.aws/, .ssh/, …), caches (__pycache__/, .ipynb_checkpoints/, node_modules/, venvs),
and tracker-local state (wandb/, mlruns/). Negate with !pattern when needed.
Large files#
core.large_file_threshold (default 512 MiB) refuses to store bigger files unless
rvc add --large; alternatively track them by immutable reference with
rvc artifact add-external PATH --uri … --digest sha256:…. A mutable URL alone is not accepted.
Limitations (v1)#
- Flat manifests: a commit touching one file in an N-file repo rewrites an O(N) manifest (measured: 20 000 files → 0.86 s commit). Sharded manifests are a planned format change.
- Symlinks are not tracked.
- The staging index is single-writer per repository (SQLite + locks), like Git.