Skip to content
Recovery

Recovery capsules

The six captured domains, when a capsule is taken, where it is stored, and per-domain restore.

GitAegis
The Recovery Capsules panel in GitAegis Doctor, listing capsules the app took by itself before reviewed operations: each with its kind, integrity state, age, size, captured-domain chips and SHA-256.
Capsules GitAegis took on its own, before the operations that needed them: kind, integrity, domains and checksum for each.

Two kinds, one mechanism

A capsule is an ordinary directory of files on disk. A checkpoint is a capsule of type light checkpoint. There is no second mechanism hiding behind the second word. Two kinds exist in this edition:

  • Light checkpoint (chk-…): refs, HEAD, reflogs, the binary index, your staged and unstaged changes as patches, and Git operation markers.
  • Standard capsule (cap-…): everything above, plus an archive of your untracked files and a full git bundle of the repository’s objects and refs.

The create dialog offers only those two. full, repair-evidence and team-support are reserved for a later phase and the store rejects them.

The six domains

A restore is chosen per domain, so these are worth knowing individually rather than as one word.

Capsule domains
DomainWhat is captured
RefsEvery ref with its oid: local branches, remote-tracking branches, tags, notes and GitAegis’s own refs/aegis/ namespace, as the ref tree, packed-refs and the reflogs. Plus HEAD: its symbolic target when attached, its oid when detached.
IndexThe index file byte for byte, including the stage entries of a conflicted merge: stage 1 (base), stage 2 (ours), stage 3 (theirs).
Staged changesgit diff --cached --binary against HEAD. The content of what you had staged, not a list of which files changed.
Working changesgit diff --binary. Modifications to tracked files that had not been staged.
Untracked filesAn uncompressed tar of files Git does not know about yet, built from git ls-files --others --exclude-standard and size-bounded. Standard capsules only.
Operation stateWhat Git was in the middle of: MERGE_HEAD, CHERRY_PICK_HEAD, REVERT_HEAD, BISECT_LOG, ORIG_HEAD, FETCH_HEAD, MERGE_MSG. Read the limits article before relying on this one.

What one capsule directory holds

This is also the answer to “what would leave my machine if I sent someone a capsule”.

Capsule directory entries
EntryContents
manifest.jsonid, repository, label, HEAD ref and oid, Git version, retention expiry, skipped untracked paths, capture notes
checksums.jsona SHA-256 for every other entry: what the restore-time integrity check reads
HEADthe raw .git/HEAD file
refs/a recursive copy of .git/refs
packed-refscopied when the repository has one
reflogs/a recursive copy of .git/logs: includes commit subjects and author identities
index.originalthe binary .git/index, byte for byte
index-metadata.jsonwhether an index was present at all
staged.patchgit diff --cached --binary
unstaged.patchgit diff --binary
operation-state/one file per marker found, or a single none entry
config.sanitizedgit config --local --list with credential-bearing lines stripped. Evidence only, never written back
untracked-files.tarstandard capsules only; uncompressed
repository.bundlestandard capsules only; git bundle create --all, readable by Git with GitAegis nowhere in sight

When a capsule is taken

Automatically, before the operation runs, decided by the plan’s risk level:

  • A caution-risk operation takes a light checkpoint.
  • A destructive-risk operation takes a standard capsule.
  • Lower-risk operations take none, because they remove nothing.
  • Three operations take none even when risky (removing a worktree, updating a submodule and fetching LFS objects) because a capsule of the primary worktree genuinely could not restore them, and advertising one would be a lie.

Capsules are also taken automatically before every Doctor repair, before every maintenance task, and before every restore.

If the capture fails, the operation is blocked and never runs. GitAegis reports that the safety checkpoint could not be created and that the operation was not executed. No control in the interface waives that.

GitAegis refusing a reviewed hard reset because its checkpoint could not be written, stating that the repository and working tree are unchanged.
A destructive plan whose capsule could not be written. No Git command ran.

Manually: press ⌘K and run Create Recovery Capsule, or use Doctor (⌘5) → Capsules → create.

Where capsules are stored

capsule path
~/Library/Application Support/dev.gitaegis.app/aegis/capsules/<repository-id>/<capsule-id>/

Outside your repository, so a capsule survives operations that rewrite .git, and on this Mac only. The capsule index (id, repository, kind, label, expiry, pinned) is a table in ~/Library/Application Support/dev.gitaegis.app/aegis/app.db; the content is the directory.

Restoring, domain by domain

Doctor (⌘5) → Capsules → pick a capsule → Restore. Domains the capsule did not capture are disabled in the dialog and marked not captured, rather than offered and then quietly skipped. Choosing Complete state restores every restorable domain in that particular capsule. It does not imply that a light checkpoint has an untracked-file archive.

The capsule restore dialog with its six domains listed, each independently selectable.
Restore the domain you actually need back. A full overwrite is never the only option.

What happens, in order:

  1. Integrity is verified. Every entry is re-checked against checksums.json. A corrupt capsule is refused outright. It is never partially applied.
  2. A fresh standard capsule is taken of the current state, and becomes the rollback target for the restore itself. Restoring is not a one-way door.
  3. The selected domains are applied. Refs move by compare-and-swap (git update-ref <name> <oid> <current>), so a ref that has moved since capture is refused and reported rather than silently overwritten. HEAD is restored by writing .git/HEAD. The index is written back byte for byte. Staged changes are applied with git apply --cached, and skipped if you also selected the index, which already carries them. Working changes are applied with git apply. Untracked files are extracted from the tar, and an existing file is never overwritten. A collision is written alongside as <path>.restored, <path>.restored-2 and so on, with the count reported.
  4. Postconditions are checked. HEAD must resolve and git status --porcelain=v2 must parse. If a check fails, or any ref update was refused, the operation ends as requires-intervention with the exact list, never as a silent partial success.

Undo

The repository toolbar has an Undo action. It finds the most recent succeeded or partially-succeeded operation that has both a rollback plan and a checkpoint, and restores that checkpoint with all domains selected. If nothing qualifies it says Nothing to undo rather than doing something approximate.

Retention: ninety days, then gone

Every capsule is stamped with an expiry 90 days after it was created. Expired capsules are deleted, and the deletion is permanent. Shortly after each launch GitAegis removes every capsule whose stamp has passed, deletes its directory, and reports how many went and how much disk that freed. A capsule holds copies of your repository content, so a removed one cannot be recovered from anywhere in the app.

Three kinds are never removed:

  • Pinned capsules, whatever their stamp says.
  • Capsules referenced by an operation that never finished. They are the rollback for work still in flight, so they survive until it resolves.
  • Capsules that have not yet expired. The stamp decides, not the age.

The same pass reclaims capsule directories left without a database row, which is what a crash midway through writing a capsule leaves behind.

To pin one, use the pin control on its card in Doctor → Capsules. The pin is written to the catalogue immediately and the card re-reads the stored row, so what you see after the click is what the next sweep will see. Unpinning is equally real: an unpinned capsule past its expiry goes on the next sweep.

One consequence to know before you need it: if a Flight Recorder event pointed at a capsule that has been removed, the event stays on the timeline but loses its checkpoint link. Restore on it then recreates deleted ref pointers only, and no longer offers index, staged or working-tree domains it cannot deliver.

30-day trial · No card required

A recovery capsule before every risky Git operation.

You see the exact commands before they run, and the operation is refused if the capsule cannot be written.

Requires Git 2.38.0 or newer, already installed.

Every risky operation, in this order

  1. Previewthe exact commands, shown before anything runs
  2. Capsulerefs, index, staged and working changes, untracked files, operation state: written to disk first
  3. Executethe commands as shown, or not at all
  4. Journalplan, commands, capsule id, outcome
No capsule, no operation. Restore plans, previews, and takes its own capsule.