> ## Documentation Index
> Fetch the complete documentation index at: https://docs.x402layer.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent Vault — CLI

> Back up, restore, and migrate agents from the terminal with the agentvault CLI — browser wallet login, scheduled backups, safe restores.

## Install & sign in

```bash theme={null}
npm i -g @singularity-layer/agentvault

agentvault login            # opens your browser — connect wallet, approve, done
agentvault login --api-key  # headless machines: paste a compute API key instead
```

The browser flow mints a scoped API key for this machine automatically. For
`--api-key`, create one under **Settings → API Keys** in the dashboard.

## Back up

```bash theme={null}
agentvault backup --all     # detect every local agent, encrypt, upload
agentvault list             # agents and snapshot counts
```

You'll be asked for a **backup passphrase** — the encryption key is derived
from it on your machine. <Warning>A lost passphrase is unrecoverable. Not by
support, not by anyone. Write it down.</Warning>

## Restore & migrate

```bash theme={null}
agentvault restore              # pick a snapshot → passphrase → safe unpack
agentvault restore --dest ~/x   # restore into a specific directory
```

* **Machine → machine:** back up on the old box, `login` + `restore` on the new one.
* **Machine ↔ pod:** snapshots are wallet-scoped — they appear in every pod's
  **Backups** tab restore picker, and pod snapshots appear in the CLI.

Restores are hardened: path-traversal and link entries are rejected, dangerous
permission bits are stripped, and on pods the previous state is parked in a
`.pre-restore` directory until the next restore.

## Back up anything (universal mode)

Not on OpenClaw or Hermes? Any directory becomes a vaultable agent:

```bash theme={null}
agentvault backup --path ~/my-agent --name "My Agent"
```

Works for Claude Code state, Cursor, custom stacks — whatever holds your
agent's brain. Each directory gets its own lineage (same folder → same
history), and restores work exactly like the built-in agents.

## Automatic backups

```bash theme={null}
agentvault passphrase set                      # store passphrase in the OS keychain
agentvault daemon install --frequency weekly   # or daily (launchd / systemd)
agentvault daemon status
```

## Commands

| Command                              | What it does                           |
| ------------------------------------ | -------------------------------------- |
| `login [--api-key]`                  | Browser wallet sign-in, or paste a key |
| `backup [--all] [--non-interactive]` | Encrypt + upload detected agents       |
| `restore [--dest <dir>]`             | Download, decrypt, safely unpack       |
| `list`                               | Agents and snapshots                   |
| `passphrase set\|clear`              | Keychain passphrase for scheduled runs |
| `daemon install\|uninstall\|status`  | Automatic backups                      |
