Reverie
by seabearDEV
README.md
# Reverie
> Bicameral memory for AI-assisted development.
A CLI + MCP server that bootstraps persistent project context for any AI agent — Claude Code, Copilot, ChatGPT, Cursor, and beyond. Agents read the project's "other voice" at session start, write back what they learn, and Reverie grows session over session.
A SeaBear Studios product · [seabear.dev/work/reverie](https://seabear.dev/work/reverie/)
> Previously known as **codexCLI**. See the [CHANGELOG](CHANGELOG.md) for the rebrand provenance and migration notes.
## Table of Contents
- [Overview](#overview)
- [Features](#features)
- [Installation](#installation)
- [Environment Variables](#environment-variables)
- [Usage](#usage)
- [Storing Data](#storing-data)
- [Retrieving Data](#retrieving-data)
- [Running Commands](#running-commands)
- [Searching](#searching)
- [Aliases](#aliases)
- [Copying Data](#copying-data)
- [Renaming](#renaming)
- [Editing Data](#editing-data)
- [Removing Data](#removing-data)
- [Context (Knowledge Summary)](#context-knowledge-summary)
- [Run Confirmation](#run-confirmation)
- [Interpolation](#interpolation)
- [Conditional Interpolation](#conditional-interpolation)
- [Exec Interpolation](#exec-interpolation)
- [Encryption](#encryption)
- [Configuration](#configuration)
- [Project-Scoped Data](#project-scoped-data)
- [Data Management](#data-management)
- [Staleness Detection](#staleness-detection)
- [Schema Validation](#schema-validation)
- [Shell Wrapper](#shell-wrapper)
- [Shell Tab-Completion](#shell-tab-completion)
- [Scripting Tips](#scripting-tips)
- [Structured JSON Output](#structured-json-output)
- [Debugging](#debugging)
- [Command Reference](#command-reference)
- [MCP Server (AI Agent Integration)](#mcp-server-ai-agent-integration)
- [Documentation](#documentation)
- [Development](#development)
- [License](#license)
## Overview
Reverie is a command-line tool and AI agent knowledge base. It stores structured information using hierarchical dot notation (similar to JSON) and exposes it to AI agents via MCP. The goal: make AI agents more effective by giving them persistent, shared project context across sessions.
## Features
- **Hierarchical Data Storage**: Store data using intuitive dot notation paths (e.g., `server.production.ip`)
- **Command Runner**: Execute stored shell commands with dry-run, composition (`:`) and chaining (`&&`), and optional per-entry confirmation
- **Interpolation**: Reference stored values with `${key}`, execute stored commands with `$(key)`, and use conditional defaults `${key:-fallback}` — all resolved at read time
- **Aliases**: Create shortcuts to frequently accessed paths
- **Encryption**: Password-protect sensitive values
- **Search**: Find entries by searching keys or values
- **Tree Visualization**: Display nested data in a tree-like structure
- **Clipboard Integration**: Copy values directly to clipboard (macOS, Linux, Windows)
- **Inline Editing**: Open entries in `$EDITOR` / `$VISUAL` for quick edits
- **Structured Output**: A global `--json` flag — or `RVR_OUTPUT=json` for the whole session — wraps *every* command (reads and mutations) in one versioned envelope (`reverie`/`ok`/`command`/`result`/`warnings`/`error`) with a frozen `error.code` set and a non-zero exit on failure, so AI agents can drive Reverie through the CLI when MCP isn't available
- **Command Manifest**: `rvr manifest --json` emits the full command/flag tree plus the MCP-tool ↔ CLI-command map — the `tools/list` analog for CLI-driven agents
- **Stdin Values**: Pipe values into `set` from other commands, or feed a multi-line value from a heredoc or a file
- **Project-Scoped Data**: Opt-in `.reverie/` per project — project entries take precedence, fall through to global
- **Smart Init**: `rvr init` scans your codebase, populates `.reverie/` with project/commands/files/deps/conventions/context entries, generates `CLAUDE.md` and an agent-agnostic `AGENTS.md`, and seeds the three-file knowledge convention
- **Auto-Backup**: Automatic timestamped backups with configurable rotation (`max_backups` setting)
- **File Locking**: Advisory locking prevents data corruption from concurrent access
- **Shell Tab-Completion**: Full tab-completion for Bash and Zsh (commands, flags, keys, aliases)
- **Staleness Detection**: Track when entries were last updated, find stale knowledge (`rvr stale`), inline `[untracked]` / `[Nd]` warnings on `get` and `context` output
- **Schema Validation**: Check entries against recommended namespaces (`rvr lint`)
- **MCP Server**: 20 tools for any MCP-compatible AI agent (Claude Code, Copilot, ChatGPT, etc.) via the Model Context Protocol
- **Telemetry & Audit**: Track usage patterns with scope-aware telemetry (`rvr stats`) and full audit log with before/after diffs, hit/miss tracking, and per-entry metrics (`rvr audit --detailed`). Includes [net token savings with self-calibrating exploration cost estimates](docs/token-savings.md), miss-path tracking, and per-agent breakdown.
- **Cross-Session Handoff**: `reverie_context` surfaces a top banner from `context.next_session` so the next session reads where things stand before any other work (auto-staled past 7 days)
- **Project-Resolution Guardrail**: writes refuse with a structured `PROJECT_UNRESOLVED` error when no `.reverie/` resolves and no explicit scope is given — prevents project-shaped data from silently landing in the global store
- **Index-First Bootstrap**: `reverie_context` / `rvr context` is a front page — pinned namespaces (`project.*`, `commands.*`, `conventions.*` by default; override per store with a `system.bootstrap.pinned` entry) render in full, and every other entry is one line: key, first-line gist, and the bytes you get by opening it with `rvr get <key>`. Nothing is hidden, and entries that fit on one line render whole
- **Bootstrap Size Budget**: when the projected response exceeds `bootstrap_max_response_bytes` (default 28KB — under the 30,000-character inline cap of the Claude Code Bash tool, so the bootstrap arrives in context rather than in a saved file), pinned namespaces are demoted to index lines first (largest first, nothing lost), then every index gist narrows to one shared width (80 → 40 characters → keys only, so every key stays visible), and only then are entries dropped by priority — `files.*`, then `arch.*`, then large `context.*` — with notices naming what changed. `tier:"full"` opts out
- **Write-Amp Guard**: `reverie_set` / `rvr set` warns on the 3rd+ write of the same key in a session within 30 minutes — informational, the write still succeeds. Helps agents notice when a key is being used as scratch space rather than a stable seed. The `context.next_session` handoff is exempt: it is rewritten by design
- **CLI Agent Sessions**: separate `rvr` invocations count as one session — automatically inside Claude Code (its session id is detected), elsewhere by exporting `RVR_SESSION=<any-id>` — so the write-amp guard (a `WRITE_AMP` warning in the JSON envelope's `warnings[]`) and miss-path telemetry work across invocations, the same session guardrails MCP agents get
- **Size Projection**: `rvr context --size-only` (or MCP `sizeOnly: true`) reports per-namespace entry/byte counts and the effective budget — answers "how big is my bootstrap" without paying for the bootstrap; `find --keys` returns matching keys without their values
## Installation
### Homebrew (macOS / Linux)
```bash
brew tap seabearDEV/reverie
brew install rvr
```
### Download Binary
Download the latest release for your platform from [GitHub Releases](https://github.com/seabearDEV/reverie/releases/latest).
```bash
# macOS (Apple Silicon)
curl -fsSL https://github.com/seabearDEV/reverie/releases/latest/download/rvr-macos-arm64 -o rvr
chmod +x rvr && sudo mv rvr /usr/local/bin/
# macOS (Intel)
curl -fsSL https://github.com/seabearDEV/reverie/releases/latest/download/rvr-macos-x64 -o rvr
chmod +x rvr && sudo mv rvr /usr/local/bin/
# Linux (x64)
curl -fsSL https://github.com/seabearDEV/reverie/releases/latest/download/rvr-linux-x64 -o rvr
chmod +x rvr && sudo mv rvr /usr/local/bin/
# Linux (ARM64)
curl -fsSL https://github.com/seabearDEV/reverie/releases/latest/download/rvr-linux-arm64 -o rvr
chmod +x rvr && sudo mv rvr /usr/local/bin/
# Windows (x64) — download from:
# https://github.com/seabearDEV/reverie/releases/latest/download/rvr-win-x64.exe
# First run will prompt to install shell completions
rvr
```
### Install from Source
> **Note:** Installing from source registers the development binary `rvr-dev` (not `rvr`). All examples in this README use `rvr`, but substitute `rvr-dev` if you installed from source. The production `rvr` binary is available via Homebrew or the GitHub Releases download above.
Building and running from source needs [Bun](https://bun.sh) on your PATH: the build output is a Bun script, and the test runner is Bun's.
Ensure npm's global binaries are in your PATH by adding the following to your shell profile (`.bashrc`, `.zshrc`, or equivalent):
```bash
export PATH="$(npm config get prefix)/bin:$PATH"
```
```bash
git clone https://github.com/seabearDEV/reverie.git
cd reverie
bun install
bun run build
npm install -g .
```
If `rvr-dev` is not found after installing, verify that npm's global bin directory is in your PATH:
```bash
echo $PATH | grep -o "$(npm config get prefix)/bin"
```
## Environment Variables
Reverie honors a small set of environment variables for deployment-time configuration. All are optional — sensible defaults work for most users. (For interactive UI preferences like color and pager, see [Configuration](#configuration) under Usage.)
| Variable | Purpose | Default |
| --- | --- | --- |
| `RVR_DATA_DIR` | Override the global data directory. Must be an absolute path. All global state lives here: the entry store (`store/`), config, audit log, telemetry. | `~/.reverie` |
| `RVR_PROJECT` | Explicit path to a `.reverie/` directory, a legacy `.codexcli.json` file, or a containing directory. Fails closed if the path doesn't resolve — no `cwd` walk-up fallback. | unset (walk up from `cwd`) |
| `RVR_PROJECT_DIR` | MCP-server launcher hint — the directory the server should treat as the project root. Equivalent to passing `--cwd <dir>`. Applied via `setProjectRootOverride` (no `process.chdir`), so it works whether the server is run as a binary or imported. | unset |
| `RVR_NO_PROJECT` | Disable project-file lookup entirely. Set to any non-empty value (e.g. `1`) and `findProjectFile()` returns `null` regardless of `cwd` or `RVR_PROJECT`. | unset |
| `RVR_AGENT_NAME` | Identifier recorded in the audit and telemetry logs for the calling agent. Used by `rvr stats` and `rvr audit` to break down activity per agent. When unset, the harness is detected from env fingerprints (Claude Code, Codex, Cursor, Copilot, Gemini, Aider) and rows carry `agentDetected: true`; the explicit name always wins. | unset (ambient detection) |
| `RVR_TEST` | Set to `1` (or `true`) to tag telemetry/audit rows `test: true`. Tagged rows are excluded from `stats`/`audit` by default (`--include-test` / `include_test` opts back in) so test runs never distort usage data. | unset |
| `RVR_OUTPUT` | When set to `json`, every command emits the structured JSON envelope on stdout (equivalent to passing `--json`), session-wide. Diagnostics and prompts go to stderr. | unset |
| `RVR_SESSION` | Shared session id for CLI-driven agents: invocations with the same id count as one session, with guardrail state (write-amp window, miss-path tracking) persisted to `~/.reverie/sessions/<id>.json` (TTL-pruned after 24h). Unset → the harness's own session id is used when Reverie detects one (Claude Code today); otherwise each invocation is its own session. | unset |
| `RVR_STDIN_WAIT_MS` | How long, in milliseconds, a `set` carrying only `-a`, `--confirm` or `--no-confirm` waits for a first byte on a stdin that is open and silent before it applies the flag alone. `0` does not wait; a value too large for a timer is capped at about 24.8 days. | `2000` |
| `RVR_DISABLE_LOCKING` | **Test-only.** When set to `1`, `withFileLock` falls back to running its closure without acquiring the file lock if lock acquisition fails. The default (production) behavior since v1.11 is to fail closed and propagate the lock error. Production code should never set this — there are no known production environments where lock acquisition is expected to fail. Tests that intentionally exercise contended-lock scenarios use this opt-out instead. | unset |
### Notes
- **`RVR_DATA_DIR` must be absolute.** Relative paths (`./mydata`, `~/foo`) are rejected with a hard error rather than silently resolved against `process.cwd()`. Pass an expanded absolute path.
- **Verify your data directory** at any time with `rvr info` — the `Data` line shows the resolved path and is annotated with `(RVR_DATA_DIR)` when the env var is set.
- **Pin the project root** for the MCP server in `.claude.json` by setting `"env": { "RVR_PROJECT": "<repo path>" }` in the reverie MCP block. This is more deterministic than relying on `cwd` walk-up.
## Usage
### Storing Data
```bash
# Set a simple entry
rvr set mykey "my value"
# Set a nested entry using dot notation
rvr set server.production.ip 192.168.1.100
# Set with an alias
rvr set server.production.ip 192.168.1.100 -a ip
# Overwrite without confirmation
rvr set server.production.ip 10.0.0.1 -f
# Read value interactively (avoids shell expansion of $, !, etc.)
rvr set secret.token -p
# Same, but with visible input
rvr set secret.token -p --show
# Encrypt a value
rvr set api.key sk-secret-123 -e
# Mark an entry as requiring confirmation before running
rvr set commands.deploy "./deploy.sh" --confirm
# Remove the confirmation requirement from an entry
rvr set commands.deploy --no-confirm
# Batch set multiple key=value pairs
rvr set a=1 b=2 c=3
# Pipe a value from stdin
echo "my value" | rvr set mykey
# Multi-line value from a heredoc (or `rvr set mykey < notes.txt`)
rvr set arch.cache <<'EOF'
Two layers: in-process LRU, then Redis.
Invalidate on write, never on read.
EOF
# Pipe from another command
curl -s https://api.example.com/token | rvr set api.token
```
After setting an entry, you'll be asked interactively whether it should require confirmation to run. Use `--confirm` or `--no-confirm` to skip the prompt.
A `set` with no value and only `-a`, `--confirm` or `--no-confirm` updates the alias or the flag. If stdin is a pipe or a file with something on it, that is taken as the value. If stdin is open and nothing arrives within two seconds (an agent's shell often looks like this), the flag is applied alone and a warning on stderr says so (`warnings[]` code `STDIN_SILENT` in JSON); `RVR_STDIN_WAIT_MS` changes the wait. `rvr alias set` and `rvr confirm set` never read stdin.
### Retrieving Data
When inside a project directory (one with a `.reverie/` store), `get` shows project entries by default. Use `-G` for global entries or `-A` for both. Outside a project, `get` shows global entries. Looking up a specific key always falls through from project to global automatically.
```bash
# List keys in the current scope
rvr get
# List keys with values
rvr get -v
# Get a specific entry (leaf values always show their value)
rvr get server.production.ip
# List keys in a namespace
rvr get server
# List keys in a namespace with values
rvr get server -v
# Show global entries only (when inside a project)
rvr get -G
# Show entries from all scopes with section headers
rvr get -A
# Limit key depth (1 = top-level, 2 = two levels, etc.)
rvr get -k 1
rvr get -k 2 -v # two levels with values
# Display as a tree structure (keys only by default)
rvr get --tree
rvr get --tree --values # tree with values
rvr get --tree -k 2 # tree limited to 2 levels
# Output plain text without colors (for scripting)
rvr get server.production.ip -p
# Show stored value before interpolation
rvr get paths.myproject --source
# Decrypt an encrypted value
rvr get api.key -d
# Copy value to clipboard
rvr get server.ip -c
# Output as JSON (for scripting)
rvr get server --json
# List all aliases
rvr alias list
```
### Running Commands
Commands run immediately by default. Entries marked with `--confirm` at set time will prompt before executing. Use `-y` to skip the prompt.
```bash
# Execute a stored command (runs immediately unless marked --confirm)
rvr run deploy.cmd
# Skip the confirmation prompt (for entries marked --confirm)
rvr run deploy.cmd -y
# Dry run (print without executing)
rvr run deploy.cmd --dry
# Chain multiple commands with &&
rvr run nav.project commands.list -y
# → cd /path/to/project && ls -l
# Compose a command from fragments using :
rvr run commands.cd:paths.project -y
# → cd /path/to/project
# Combine composition and chaining
rvr run commands.cd:paths.project commands.list -y
# → cd /path/to/project && ls -l
# Multiple colon-separated segments
rvr run commands.scp:files.config:targets.prod -y
# → scp ./config.yml admin@prod:/etc/app/
# Decrypt and run an encrypted command
rvr run secret.script -d -y
# Capture output for piping (instead of inheriting stdio)
rvr run cmd.echo --capture | tr a-z A-Z
# Stored command chain (macro) — value is space-separated key refs
rvr set macros.deploy "commands.build commands.test commands.deploy"
rvr run macros.deploy --chain -y
# → npm run build && npm test && ./deploy.sh
```
### Searching
```bash
# Search keys and values
rvr find 192.168
# Search data entries only (skip aliases)
rvr find prod -e
# Search aliases only
rvr find ip -a
# Show results as a tree
rvr find server -t
# Output as JSON (for scripting)
rvr find prod --json
# Search with regex
rvr find "prod.*ip" --regex
# Search keys only (skip value matching)
rvr find "server" --keys
# Search values only (skip key matching)
rvr find "10.0" --values
```
### Aliases
Aliases are shortcuts to frequently used key paths. Managed via the `alias` subcommand:
```bash
# Create an alias
rvr alias set ip server.production.ip
# List all aliases
rvr alias list
# Remove an alias
rvr alias remove ip
# Rename an alias
rvr alias rename ip sip
# Use an alias anywhere you'd use a key
rvr get ip
rvr run ip
# Create an alias inline when setting an entry
rvr set server.production.ip 192.168.1.100 -a ip
# Remove an entry and its alias
rvr remove server.production.ip
```
Each store has its own aliases, and an alias command changes only the list of the store it writes: the project's without `-G` (outside a project the command is refused), the global one with it. A name looks through both, the project's first. So without `-G`, `alias remove` removes the project's alias of that name and says when a global alias of the same name still resolves; when only the global store has the alias, it changes nothing, says so, and asks for `-G`. The MCP tools (`reverie_alias_remove`, `reverie_remove` with `is_alias`) behave the same way: without a `scope` they remove the project's alias, and `scope: "global"` removes the global one.
An alias is looked up before an entry, so an alias named after an entry would stand in for it wherever the name is used. Every command that adds an alias (`alias set`, `alias rename`, `set -a`, `rename --set-alias`, an import, and their MCP counterparts) refuses a name that is the key of an entry in either store, in another case too, with `INVALID_INPUT`. A flagged command is gated under the name you type as well as the entry an alias points it to (see [Run Confirmation](#run-confirmation)).
### Copying Data
Copy an entry (or an entire subtree) to a new key:
```bash
# Copy a single entry
rvr copy server.ip server.ip.backup
# Copy an entire subtree
rvr copy server server.backup
# Overwrite destination without confirmation
rvr cp server.ip server.ip.backup -f
```
### Renaming
Rename entry keys or aliases without re-creating them:
```bash
# Rename an entry key (moves the value, updates aliases, flags the new key if the old one required confirmation)
rvr rename server.old server.new
# Rename an alias
rvr alias rename oldalias newalias
# Rename a key and set a new alias on it
rvr rename server.old server.new --set-alias sn
```
A rename is one step: the value, the aliases that point at it and the new keys' confirmation flags move together, or nothing changes. The aliases re-pointed are those of the store the rename writes: without `-G`, the project's. A global alias that points at the old key is left as it is, since in another project that key may be the project's own entry, and the rename says so. Renaming onto a name that is also an alias's works, but the alias is looked up first and hides the entry; the rename says so. Name the entry as it is stored. On a filesystem that ignores case, `rvr rename Commands.Deploy …` opens the file of `commands.deploy`, and the rename is refused with the stored name rather than copying the entry. The same name in another Unicode normalization counts as the stored one. A rename is also refused while either store's confirmation list cannot be read.
### Editing Data
Open a stored value in your `$EDITOR` (or `$VISUAL`) for inline editing:
```bash
# Edit an entry in your default editor
rvr edit server.production.ip
# Edit an encrypted entry (decrypts before editing, re-encrypts on save)
rvr edit api.key --decrypt
```
### Removing Data
Removing an entry prompts for confirmation. Use `-f` to skip.
```bash
# Remove an entry (prompts for confirmation)
rvr remove server.old
# Remove without confirmation
rvr remove server.old -f
# Remove an alias only (keep the entry)
rvr alias remove myalias
```
### Interpolation
Reference stored values inside other values with `${key}` syntax. References are resolved at read time.
```bash
# Store a base path
rvr set paths.github "/Users/me/Projects/github.com"
# Reference it in another entry
rvr set paths.myproject 'cd ${paths.github}/myproject'
# Resolves at read time
rvr get paths.myproject
# → cd /Users/me/Projects/github.com/myproject
# Works with run too
rvr run paths.myproject -y
# Use --source to see the raw stored value
rvr get paths.myproject --source
# Use --prompt (-p) when setting to avoid shell expansion of ${}
rvr set paths.myproject -p
```
A reference resolves in the store of the entry that holds it. In a global entry, `${key}` and `$(key)`, and the aliases they name, read the global store only, all the way down: inside a project, even one you just cloned, your own global commands neither show nor run that project's entries, with or without `-G`. In a project entry they read the project, then the global store, the way a lookup by key does; a global entry reached that way still resolves its own references in the global store. `get`, `find`, `lint`, `run` and its preview, and the MCP tools all follow this rule, so what a read shows is what a run runs. A command that has to pick up a project's values belongs in that project's store.
A reference that does not resolve — no such key — does not make the entry unreadable. `get` returns the value as written and warns (on stderr; `warnings[]` with code `INTERPOLATION_UNRESOLVED` in JSON), `set` warns when it stores one, and `rvr lint` lists them. At `set`, a value that is encrypted, or typed at the masked `--prompt`, is not inspected, because the warning quotes the reference. `run` still refuses to execute a command with an unresolved reference. For text that only looks like a reference, such as documentation for a tool that uses `${VAR}` itself, escape it:
```bash
rvr set conventions.robot 'Use \${EMPTY} to clear the field'
rvr get conventions.robot
# → Use ${EMPTY} to clear the field
```
#### Conditional Interpolation
Use bash-style modifiers for fallback values and required-key checks:
```bash
# Default value — use fallback when key is not found
rvr set greeting 'Hello, ${user.name:-stranger}!'
rvr get greeting
# → Hello, stranger! (if user.name doesn't exist)
# → Hello, Alice! (if user.name is "Alice")
# Required value — throw a custom error when key is not found
rvr set deploy.cmd 'ssh ${deploy.host:?deploy.host must be set first}'
rvr run deploy.cmd
# → Error: deploy.host must be set first
# Nested defaults — the fallback can itself contain ${} references
rvr set url '${api.url:-${api.default_url}}/endpoint'
# Empty default — resolves to empty string when key is missing
rvr set optional '${maybe.key:-}'
```
#### Exec Interpolation
Use `$(key)` inside a stored command to run another stored command and paste its output in. The key must reference a stored string value containing a shell command. Only `rvr run` (and `reverie_run`) executes it; reads, `--dry` and previews show `$(key)` as written.
```bash
# Store a command
rvr set system.user "whoami"
# Reference it with $(key) — at run time it executes and its output is pasted in
rvr set cmd.home 'ls /Users/$(system.user)'
rvr run cmd.home --dry
# → $ ls /Users/$(system.user)
rvr run cmd.home # runs: ls /Users/kh
# Aliases work too
rvr set system.user -a user
rvr set cmd.home 'ls /Users/$(user)'
```
Exec interpolation supports:
- **Recursion**: stored commands can contain `${key}` or `$(key)` references that resolve before execution
- **Caching**: in one `rvr run`, an entry's command is executed once, however often it is referenced; `reverie_run` with `chain: true` executes it once per chain member
- **Circular detection**: `$(a)` → `$(b)` → `$(a)` throws an error
- **Timeout**: commands are killed after 10 seconds
- **Cross-type references**: `${key}` values can contain `$(key)` and vice versa
The output is data, not code:
- **Plain output only.** Trailing newlines are dropped, as the shell does. If what remains holds shell syntax (`` ` `` `$` `;` `&` `|` `<` `>` `(` `)` `'` `"` `\` `#` or a newline), the run stops with an error naming the key, and nothing further executes. Plain output (words, paths, versions) is pasted as is and splits into arguments like any unquoted text.
- **Not scanned again.** Text that output or a `${key}` value put into a command is never read for `$(key)` references, and a `$(…)` cannot take its key from a `${…}`. Write the key itself.
### Encryption
```bash
# Encrypt a value (prompts for password twice)
rvr set api.key sk-secret-123 -e
# Encrypted values show as [encrypted]
rvr get api.key
# → api.key: [encrypted]
# Decrypt to view
rvr get api.key -d
# Decrypt and copy to clipboard
rvr get api.key -d -c
# Decrypt and run
rvr run secret.deploy -d -y
# Clear terminal after setting sensitive data
rvr set api.key -p -e -c
```
### Configuration
```bash
# Show all settings
rvr config
# Get a specific setting
rvr config get theme
# Change a setting
rvr config set theme dark
rvr config set colors false
# Return a setting to its default
rvr config unset theme
# Show version, stats, and storage paths
rvr info
# Show usage examples
rvr config examples
```
Available settings:
| Setting | Values | Description |
|--------------------|------------------------------|----------------------------------------------------------------|
| `colors` | `true` / `false` | Enable/disable colored output |
| `theme` | `default` / `dark` / `light` | UI theme |
| `max_backups` | integer (default: `10`) | Number of auto-backups to keep (`0` to disable) |
| `import_max_bytes` | integer (default: `52428800` / 50 MB) | Reject import files larger than this (bytes) to prevent OOM |
| `bootstrap_max_response_bytes` | integer (default: `28672` / 28 KB) | Size budget for `rvr context` / `reverie_context` before entries are demoted or dropped |
| `bootstrap_gist_chars` | integer (default: `160`) | Longest gist on a bootstrap index line |
`config.json` (in the data directory) stores only the settings you changed; every other setting is its current default, so a default that changes in a later release reaches you. Setting a value equal to the default stores nothing, the same as `rvr config unset`. `rvr config get` always reports the value in effect. Earlier releases wrote every default to the file on first run, so until this install's first config write, a value equal to a default any release shipped, or to today's default, counts as unset. Reading never rewrites `config.json`; the first `config set` or `config unset` stores the cleaned form, and every write lists the settings it stored in `config.format` beside it. If an older Reverie still running (an MCP server started before the upgrade, say) rewrites `config.json` whole, the settings in that list keep their values and any other setting it wrote at an old default follows the current one, with a one-line note; `rvr config unset <key>` returns a setting to the default. `config.format` belongs with `config.json`: copy or restore the two together. A write refuses a `config.json` that does not parse rather than replacing it.
### Project-Scoped Data
Reverie supports per-project knowledge stores that live alongside your code. The `.reverie/` directory is designed to be committed to version control, creating a shared knowledge base that persists across sessions, team members, and AI agents. As of v1.10.0, each entry is its own JSON file inside the directory (`.reverie/arch.storage.json`, `.reverie/commands.build.json`, etc.) — this eliminates merge conflict churn when multiple devs add different entries on parallel branches. Two branches that write the *same* entry still conflict in that entry's file; Reverie reports such a file instead of reading or overwriting it (see "When a store file cannot be read" in [the schema guide](docs/schema-guide.md)). Use CLI or MCP tools to edit; hand-editing the wrapper files is unsupported. The store seeds its own `.gitignore` for per-clone state (`_epoch.json`, the crash-safety counter) so only entries and shared sidecars are committed; repos created before that landed untrack it once with `git rm --cached .reverie/_epoch.json`.
```bash
# Initialize a project — scans codebase, creates .reverie/ and CLAUDE.md
rvr init
# Preview what init would create
rvr init --dry-run
# Init without CLAUDE.md generation
rvr init --no-claude
# Init without codebase scan (empty .reverie/)
rvr init --no-scan
# Store project knowledge
rvr set commands.build "npm run build"
rvr set commands.test "npm test"
rvr set arch.api "REST endpoints in src/routes/, validated by Zod schemas"
rvr set conventions.errors "Always use AppError class from src/utils/errors.ts"
rvr set context.auth "JWT tokens expire after 1h, refresh via /api/refresh"
# get shows project entries only (when inside a project)
rvr get
# Single-key lookups fall through to global transparently
rvr get paths.github # not in project → found in global
# Use -G to see global entries only
rvr get -G
# Use -A to see both scopes with section headers
rvr get -A
# Use -G to explicitly write to global while inside a project
rvr set server.ip 192.168.1.100 -G
# Remove the project store
rvr init --remove
```
**Scope flags:** The `-G` / `--global` flag is available on `set`, `get`, `run`, `find`, `copy`, `edit`, `rename`, and `remove`. Data management commands (`export`, `import`, `reset`) also support `-P` / `--project`, which needs a project: outside one, `-P` is refused with `PROJECT_UNRESOLVED` before any prompt or backup, and nothing is changed. With `-G`, a name you type resolves through the global aliases only, so a project's `_aliases.json` cannot point a `-G` command at another global entry; without it, the project's aliases apply over the global ones, and a write still lands in the project store.
#### Recommended Schema
> **Deep dive:** See the [Schema Guide](docs/schema-guide.md) for the full rationale behind the file structure, what makes a good entry, and a walkthrough of the Reverie project's own `.reverie/` as a reference implementation.
When using Reverie as a project knowledge base (especially with AI agents via MCP), we recommend organizing entries under these namespaces:
| Namespace | Purpose | Examples |
|---|---|---|
| `project.*` | Basic metadata | `project.name`, `project.stack`, `project.description` |
| `commands.*` | Build, test, deploy commands | `commands.build`, `commands.test`, `commands.deploy.staging` |
| `arch.*` | Architecture and design decisions | `arch.storage`, `arch.api`, `arch.auth` |
| `conventions.*` | Coding patterns, naming, style | `conventions.types`, `conventions.errors`, `conventions.testing` |
| `context.*` | Non-obvious gotchas, edge cases | `context.migration`, `context.legacy`, `context.performance` |
| `files.*` | Key file paths and their roles | `files.entry`, `files.config`, `files.routes` |
| `deps.*` | Notable dependencies and why | `deps.commander`, `deps.vitest`, `deps.zod` |
Keep values concise — one sentence or a short command. Use multiple keys under the same namespace for detail. Don't store things easily derived from `package.json` or the code itself; store insights, decisions, and context that would otherwise be lost.
#### AI Agent Workflow
When an AI agent connects via MCP, the recommended workflow is:
1. Call `reverie_context` as your **first** tool call to bootstrap session knowledge. Pick the right tier for the task:
- `tier:"essential"` — answering questions, small fixes, single-file edits
- omit / `tier:"standard"` — multi-file changes, bug fixes, new features (default)
- `tier:"full"` — refactoring subsystems, changing architecture, onboarding to the codebase
2. Check relevant namespaces (`arch`, `conventions`, `context`, `files`) before exploring the codebase
3. Record non-obvious discoveries with `reverie_set` as you work
4. Update stale entries when you find they no longer match the code
Agent usage is tracked automatically — run `rvr stats` to see bootstrap rate, write-back rate, and namespace coverage trends.
#### The Knowledge Flywheel
Every AI session has the same problem: the agent starts from zero, spends thousands of tokens exploring the codebase, and all that understanding vanishes when the session ends. Reverie turns that into a compounding asset.
Here's how it works in practice:
1. **You run `rvr init`** in a new project. The CLI scans the codebase in milliseconds and creates a skeleton `.reverie/` with project metadata, commands, file paths, dependencies, and conventions it can detect from the filesystem.
2. **First AI session begins.** The agent calls `reverie_context`, sees the skeleton, and recognizes it's a fresh project (`context.initialized: scaffold`). Before starting your task, it reads the actual source code — entry points, core modules, config files — and populates the deep knowledge: architecture decisions in `arch.*`, non-obvious gotchas in `context.*`, and rich file descriptions in `files.*`. This deep analysis runs once.
3. **Every session after that** — whether it's Claude, Copilot, Cursor, ChatGPT, or any other MCP-compatible agent — bootstraps the full knowledge base in a single `reverie_context` call. No re-exploration. No wasted tokens.
4. **The flywheel accelerates.** Agent A discovers a database migration gotcha on Monday and stores it in `context.migration`. Agent B (different tool, different session) hits the same area on Tuesday and benefits immediately — it already knows about the gotcha. Agent B discovers an API pattern and stores it in `arch.api`. Agent C benefits on Wednesday.
The knowledge base grows with every session. The token cost per session drops. `rvr stats` shows you the trend: bootstrap rate, hit rate, estimated tokens saved, per-namespace coverage. The more you use it, the more efficient every agent becomes.
Because the knowledge lives in `.reverie/` (plain JSON files committed to your repo), it works across machines, across team members, and across AI tools. No vendor lock-in, no cloud dependency, no API keys. Just files that get smarter over time.
### Data Management
All data (entries, aliases, confirm metadata) is stored in a directory with one JSON file per entry plus `_aliases.json` and `_confirm.json` sidecars — `~/.reverie/store/` for global data, `.reverie/` for project-scoped data. Pre-v1.10.0 unified `.codexcli.json` / `data.json` files are automatically migrated on first access and the old file is renamed to `.backup`.
```bash
# Export data to a timestamped file
rvr data export entries
# Export to a specific file
rvr data export aliases -o my-aliases.json
# Export with pretty-printed JSON
rvr data export entries --pretty
# Export confirm metadata
rvr data export confirm
# Export everything to a single file (roundtrips with `data import all`)
rvr data export all -o backup.json
# Legacy behavior: write per-section files (entries/aliases/confirm)
rvr data export all -o backup.json --split
# Export only global data (when a project file exists)
rvr data export entries -G
# Import data from a file (replaces existing)
rvr data import entries backup.json
# Import and merge with existing data
rvr data import entries backup.json --merge
# Preview changes without importing
rvr data import entries backup.json --merge --preview
# Reset data to empty state (prompts first)
rvr data reset entries
# Reset without confirmation
rvr data reset all -f
```
> **Auto-backup:** Before destructive operations (`data reset`, non-merge `data import`), Reverie automatically creates a timestamped backup in `~/.reverie/.backups/`. The last 10 backups are kept by default — configure with `rvr config set max_backups <n>` (set to `0` to disable rotation).
### Context (Knowledge Summary)
Get a compact summary of stored project knowledge — the same view AI agents get via `reverie_context`:
```bash
# Front page (standard tier — pinned namespaces in full, one line per other entry)
rvr context
# Pinned namespaces only (project/commands/conventions by default)
rvr context --tier essential
# Show everything
rvr context --tier full
# Output as JSON
rvr context --json
# Plain text without colors
rvr context -p
```
### Run Confirmation
Mark commands that should prompt before executing:
```bash
# Require confirmation before running
rvr confirm set commands.deploy
# List keys requiring confirmation
rvr confirm list
# Remove confirmation requirement
rvr confirm remove commands.deploy
# Skip confirmation at run time with -y
rvr run commands.deploy -y
```
The key has to name an entry, in the project store or the global one, whichever list `-G` picks: `confirm set` and `set <key> --confirm` refuse a key that is in neither, and a namespace. The flag is listed under the name the entry is stored as, so it gates wherever the store is copied: on a default macOS volume, `rvr confirm set commands.DEPLOY` lists `commands.deploy`, and `commands.fix` (with the fi ligature) lists `commands.fix`. Inside a project, an entry stored only in the global store gets its flag in the global list, which every project reads and every rename sees; an entry in the project store gets it in the project's list, or the global one with `-G`. If the global list cannot be used (the store cannot be written, or its list cannot be read), a global-only entry's flag goes in the project's list, with a warning that it applies only in that project. Where the two stores spell one entry differently, the flag is listed under each spelling. The success line says when the name or the list is not the one you gave. `set <key> <value> --confirm` stores the value and its flag (and a `-a` alias) in one write: all of it, or nothing.
A flagged command asks for confirmation under any spelling that reaches it, directly, through a `${reference}` or through an alias: on a filesystem that ignores case, `rvr run commands.Deploy` opens the entry stored as `commands.deploy`, and is gated like it. A flag also gates its name wherever the name is used, whatever an alias makes of it: every key given to `run`, a `--chain` entry and each key it lists, and every `${…}` and `$(…)` a run reaches are checked as written and as their alias resolves. So a cloned project's `_aliases.json` cannot point a name you flagged at a command of its own and run it unasked. `confirm remove` clears the flag listed under the name it is given, in the list it is given for. If the key is still gated afterwards — by a flag under another spelling, by the other store's list, or by a list that cannot be read — it names every one of them; it exits 1 only when it removed nothing. Renaming an entry or a namespace flags the new keys of the gated entries it moves and leaves the old names flagged (a rename is refused while either list cannot be read, since it could not carry a flag from that list), and removing one leaves its flags listed too: a flag gates its name in every project, and the global list may be gating another project's entry of the same name. Clear a flag with `confirm remove` once nothing uses it.
While the global `_aliases.json` cannot be read, every run in a project asks, except a `-G` one (MCP: `scope: "global"`): the check cannot see whether a project alias stands in front of a global alias to a flagged command. While a `_confirm.json` cannot be read, every run asks.
The check is made once, before the command runs, over the store as it is at that moment. A `$(…)` command that writes entries partway through a run, or another session that writes one while `rvr run` waits at its prompt, can change what a later reference in that run reads, and that change is not checked. The flag is a prompt for what a run names and refers to, not a sandbox for what its commands do: a command that can write the store could as well run `rvr run <flagged> --yes` itself.
### Staleness Detection
Track when entries were last updated and find stale knowledge that may need refreshing.
```bash
# Show entries not updated in 30 days (default)
rvr stale
# Show entries not updated in 7 days
rvr stale 7
# Output as JSON
rvr stale --json
```
Timestamps are tracked automatically when entries are set, copied, or renamed.
Staleness is also surfaced inline — `rvr get` and `reverie_context` (MCP) append tags to stale or untracked entries:
- `[untracked]` — entry has no update timestamp (predates staleness tracking). Most suspect.
- `[47d]` — entry hasn't been updated in 47 days. Verify before trusting version numbers, URLs, or commands.
The CLI `get` command prints a yellow warning for stale/untracked entries. Fresh entries show no tag.
### Schema Validation
Check entries against the recommended namespace schema to keep your knowledge base organized.
```bash
# Check for entries outside recommended namespaces
rvr lint
# Output as JSON
rvr lint --json
# Check global store only
rvr lint -G
```
Default namespaces: `project`, `commands`, `arch`, `conventions`, `context`, `files`, `deps`, `system`. Entries outside them are listed as guidance and `lint` still exits 0. Declaring extra namespaces is not supported for directory stores yet.
`lint` exits 1 when the store itself needs repair: a file that does not parse, two keys that differ only by case, or a key stored both as an entry and as a namespace (`ns.k.json` beside `ns.k.sub.json`, after a hand edit or a git merge). In that last case listings show only the entry, and `rename` refuses it; `rvr copy` what you want to keep to a free key, then `rvr rm ns.k` removes both. `--json` lists such keys in `result.entryNamespacePairs`.
### Shell Wrapper
By default, `rvr run` executes commands in a child process. This means shell builtins like `cd`, `export`, and `alias` have no effect on your current shell.
After running `rvr config completions install`, a shell wrapper function is added to your shell profile that fixes this. When you use `rvr run` (or `rvr r`), the wrapper:
1. Calls the real `rvr` binary with `--source`, which prints the resolved command to stdout instead of executing it — the command and nothing else; warnings and everything else go to stderr
2. Captures that output and `eval`s it in your current shell
All other `rvr` commands pass through to the binary unchanged. So does a `run` with `--json` (or with `RVR_OUTPUT=json` set) or `--dry`: what it prints is a JSON envelope or a preview, and the wrapper never evaluates it. `--source` itself never prints JSON: given `--json` or `RVR_OUTPUT=json`, it prints the command as usual and notes on stderr that JSON output is off.
```bash
# Store a navigation command
rvr set paths.myproject 'cd ~/Projects/my-project'
# This actually changes your directory (with the wrapper installed)
rvr r paths.myproject -y
# Without the wrapper, cd would run in a child process and have no effect
```
The wrapper is installed automatically by `rvr config completions install`. If you already have completions installed, run it again to add the wrapper, then `source` your shell profile. Running it again also updates a wrapper installed by an earlier version, which evaluated `--json` output; one you have edited by hand is left alone, and the install tells you how to remove it. If your shell profile is read-only (home-manager, for one), the install saves the current wrapper in `~/.reverie/shell-wrapper.sh` for you to paste where the profile is generated from.
### Shell Tab-Completion
Reverie supports tab-completion for Bash and Zsh, including commands, flags, stored keys, alias names, and more.
#### Quick Setup
```bash
rvr config completions install
```
This appends a completion loader and shell wrapper to your `~/.zshrc` or `~/.bashrc` and tells you to restart your shell (or `source` the file).
#### Manual Setup
If you prefer to set it up yourself:
```bash
# Zsh - add to ~/.zshrc
eval "$(rvr config completions zsh)"
# Bash - add to ~/.bashrc or ~/.bash_profile
eval "$(rvr config completions bash)"
```
#### What Gets Completed
| Context | Completions |
|---|---|
| `rvr <TAB>` | All commands (`set`, `get`, `run`, `find`, `edit`, `copy`, `remove`, `rename`, `alias`, `confirm`, `context`, `info`, `init`, `stale`, `lint`, `stats`, `audit`, `config`, `data`) |
| `rvr get <TAB>` | Flags + stored data keys + aliases + namespace prefixes |
| `rvr run <TAB>` | Flags + stored data keys + aliases |
| `rvr run cd:<TAB>` | Data keys + aliases (completes the segment after `:`) |
| `rvr set <TAB>` | Flags + namespace prefixes (one level at a time) |
| `rvr alias <TAB>` | Subcommands (`set`, `remove`, `list`, `rename`) |
| `rvr confirm <TAB>` | Subcommands (`set`, `remove`, `list`) |
| `rvr config <TAB>` | Subcommands (`set`, `get`, `unset`, `info`, `examples`, `completions`) |
| `rvr config set <TAB>` | Config keys (`colors`, `theme`, `max_backups`, …); `get` and `unset` too |
| `rvr data <TAB>` | Subcommands (`export`, `import`, `reset`) |
| `rvr data export <TAB>` | `entries`, `aliases`, `confirm`, `all` |
### Scripting Tips
```bash
# Use plain output in other commands
ssh $(rvr get server.ip -p)
# Decrypt and copy to clipboard
rvr get api.key -d -c
# Decrypt and run without prompt
rvr run deploy.cmd -d -y
# Preview a command with interpolation
rvr run paths.myproject --dry -y
```
### Structured JSON Output
Pass the global `--json` flag (`rvr --json <cmd>`) or set `RVR_OUTPUT=json` once for the session to make **every** command — reads *and* mutations — print exactly one versioned envelope on stdout. Diagnostics and prompts go to stderr; failures set a non-zero exit code. This is the path for AI agents that can't run the MCP server (`rvr init` also writes an `AGENTS.md` describing it).
```bash
rvr --json get server.ip
# { "reverie": "1", "ok": true, "command": "get", "result": { "server.ip": "10.0.0.1" } }
RVR_OUTPUT=json rvr set deploy.cmd "kubectl apply -f ." # session-wide
rvr --json manifest # full command/flag tree + MCP↔CLI map (the tools/list analog)
```
On failure, `ok` is `false`, the envelope carries `error.code` from a frozen set, and the process exits non-zero — branch on the code, not on prose:
```bash
rvr --json get missing.key
# { "reverie": "1", "ok": false, "command": "get", "error": { "code": "NOT_FOUND", "message": "Entry 'missing.key' not found" } }
```
Error codes: `PROJECT_UNRESOLVED`, `NOT_FOUND`, `INVALID_INPUT`, `REQUIRES_CONFIRMATION`, `ENCRYPTED_NO_PASSWORD`, `DECRYPT_FAILED`, `COMMAND_FAILED`, `INPUT_REQUIRED`, `IO`, `STORE_UNREADABLE`, `RUNTIME`. (Note: `--json` on reads nests the value under `result` — a deliberate break from the pre-1.1.0 bare-value shape.) Non-fatal notices (e.g. context `[trimmed]`) appear in `warnings[]`; `run` on a `--confirm` entry without `--yes` returns `REQUIRES_CONFIRMATION` with the resolved command in `error.preview`.
### Debugging
```bash
rvr --debug get server.production
```
## Command Reference
| Command | Alias | Signature | Description |
|---|---|---|---|
| `set` | `s` | `<key> [value]` | Set an entry (value optional with `-a`; supports `key=val` batch) |
| `get` | `g` | `[key]` | List keys (default) or retrieve entries with `-v` |
| `run` | `r` | `<keys...>` | Execute stored command(s) (`:` compose, `&&` chain) |
| `find` | `f` | `<term>` | Find entries by key or value (also: `search`) |
| `edit` | `e` | `<key>` | Open an entry's value in `$EDITOR` |
| `copy` | `cp` | `<source> <dest>` | Copy an entry to a new key |
| `remove` | `rm` | `<key>` | Remove an entry and its alias |
| `rename` | `rn` | `<old> <new>` | Rename an entry key or alias |
| `context` | | `[--tier <tier>]` | Bootstrap front page (essential, standard, full) |
| `info` | | | Show version, stats, and storage paths |
| `manifest` | | `[--json]` | Command/flag tree + MCP↔CLI map (the `tools/list` analog for agents) |
| `alias` | | `<subcommand>` | Manage key aliases (set, remove, list, rename) |
| `confirm` | | `<subcommand>` | Manage run confirmation (set, remove, list) |
| `init` | | | Initialize project (`.reverie/` + codebase scan + `CLAUDE.md` + `AGENTS.md`; `--no-claude` / `--no-agents` to skip) |
| `stale` | | `[days]` | Show entries not updated in N days (default 30) |
| `lint` | | | Check entries against namespace schema (`--json`) |
| `stats` | | | View usage telemetry and trends, incl. organic vs bulk write split (`--period`, `--detailed`, `--include-test`, `--json`) |
| `audit` | | `[key]` | Query audit log with before/after diffs (`--detailed`, `--cli`, `--mcp`, `--hits`, `--misses`, `--redundant`, `--include-test`, `--include-self-ref`); `--follow` streams live — with `--json`, as raw NDJSON rows for watcher agents (`--exclude-session <id>` to ignore your own traffic) |
| `config` | | `<subcommand>` | View or change configuration settings |
| `data` | | `<subcommand>` | Manage stored data (export, import, reset) |
**Alias subcommands:** `set <name> <path>`, `remove <name>`, `list`, `rename <old> <new>`
**Confirm subcommands:** `set <key>`, `remove <key>`, `list`
**Config subcommands:** `set <key> <value>`, `get [key]`, `unset <key>`, `info`, `examples`, `llm-instructions [--surface <mcp\|cli>]`, `completions <bash\|zsh\|install>`
**Data subcommands:** `export <type>`, `import <type> <file>`, `reset <type>`
**Scope flags:** `-G` / `--global` targets the global store. `-A` / `--all` on `get` shows both scopes with section headers.
**Structured output:** the global `--json` flag (`rvr --json <cmd>`) or `RVR_OUTPUT=json` wraps any command's output in the JSON envelope — see [Scripting Tips](#scripting-tips).
## MCP Server (AI Agent Integration)
Reverie includes a built-in [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server, allowing any MCP-compatible AI agent to read and write your Reverie data store as a native tool. Works with Claude Code, Claude Desktop, GitHub Copilot, ChatGPT, and any other client that supports MCP.
### Setup
#### Claude Code
**Homebrew / binary install (global):**
```bash
claude mcp add reverie -- rvr mcp-server
```
**Per-project** (recommended — enables project-scoped data):
```bash
claude mcp add reverie --scope project -- rvr mcp-server --cwd .
```
The `--scope project` makes the registration per-project in Claude Code, and `--cwd .` tells the MCP server to use the project root for `.reverie/` detection. You can also use the `RVR_PROJECT_DIR` environment variable instead of `--cwd`.
**npm global install** (`npm install -g .`) — dev mode:
```bash
claude mcp add reverie -- rvr-dev mcp-server
```
**From source** (development):
```bash
claude mcp add reverie -- bun /absolute/path/to/dist/mcp-server.js
```
> The standalone `rvr-dev-mcp` command also still works for npm installs.
#### Claude Desktop
**Homebrew / binary install:**
```json
{
"mcpServers": {
"reverie": {
"command": "rvr",
"args": ["mcp-server"]
}
}
}
```
**npm global install** (dev mode):
```json
{
"mcpServers": {
"reverie": {
"command": "rvr-dev",
"args": ["mcp-server"]
}
}
}
```
**From source:**
```json
{
"mcpServers": {
"reverie": {
"command": "bun",
"args": ["/absolute/path/to/dist/mcp-server.js"]
}
}
}
```
### Available Tools
| Tool | Description |
|---|---|
| `reverie_set` | Store project knowledge as a key-value entry (dot notation, optional alias, optional encryption) |
| `reverie_get` | Retrieve stored knowledge by dot-notation key, or list all entries (staleness tags on stale/untracked entries, optional decrypt) |
| `reverie_remove` | Remove a stored entry or alias by key |
| `reverie_copy` | Copy an entry to a new key (optional force to overwrite) |
| `reverie_rename` | Rename an entry key or alias (re-points the aliases of the store it writes, carries confirm flags to the new keys) |
| `reverie_find` | Search stored knowledge by keyword (keys, values, or both; regex supported) |
| `reverie_alias_set` | Create or update an alias for a dot-notation path |
| `reverie_alias_remove` | Remove an alias |
| `reverie_alias_list` | List all defined aliases |
| `reverie_run` | Execute a stored shell command by key (dry-run, interpolation, confirmation prompts) |
| `reverie_config_get` | Get one or all configuration settings |
| `reverie_config_set` | Set a configuration setting (colors, theme, max_backups) |
| `reverie_config_unset` | Return a configuration setting to its default |
| `reverie_export` | Export data and/or aliases as JSON text |
| `reverie_import` | Import data and/or aliases from a JSON string (merge, replace, or preview) |
| `reverie_reset` | Reset data and/or aliases to empty state |
| `reverie_context` | Bootstrap front page — pinned namespaces in full, one-line gists for the rest (use at session start; tiers: essential, standard, full; staleness tags on stale/untracked entries) |
| `reverie_stale` | Find entries not updated recently (threshold in days, default 30) |
| `reverie_stats` | View usage telemetry and [token savings](docs/token-savings.md) (hit rate, exploration cost avoided, per-namespace breakdown, trends) |
| `reverie_audit` | Query the audit log of data mutations (before/after diffs, agent identity, scope, success/fail) |
All data-touching tools accept an optional `scope` parameter (`"project"` or `"global"`). When listing entries (no key), `reverie_get` defaults to project-only if a `.reverie/` exists — pass `all: true` to see both scopes. Single-key lookups fall through from project to global automatically. `scope: "project"` needs a project (found through `RVR_PROJECT`, the client's roots or the server's working directory): with none, every tool refuses it with `PROJECT_UNRESOLVED`, reads and `reverie_run` included, and changes nothing. Omit `scope` to read through to the global store, or pass `"global"`. The server looks for the project once and keeps the answer: after `rvr init` creates one under a server that started without it, restart the server — until then its unscoped writes and `scope: "project"` calls refuse rather than land in the wrong store, and every `reverie_run` asks first.
### LLM Instructions
When an AI agent connects via MCP, Reverie sends built-in instructions that guide how the agent interacts with the data store (schema, scope, tool tips, effective usage patterns). These defaults are immutable and stay up to date as features are added.
To add project-specific guidance, set `system.llm.instructions` — your text is **appended** to the defaults as a `PROJECT CONTEXT` section, not a replacement:
```bash
# Add project-specific instructions for AI agents
rvr set system.llm.instructions "This is a monorepo. Always check arch.modules before modifying shared code. Never store secrets, even encrypted."
# View the effective instructions (defaults + your additions)
rvr config llm-instructions
# View just the built-in defaults
rvr config llm-instructions --default
# View the CLI-surface instructions (for agents driving rvr instead of MCP)
rvr config llm-instructions --surface cli
# Remove your custom additions (reverts to defaults only)
rvr rm system.llm.instructions
```
Instructions are **surface-aware**: the `mcp` surface (default) guides agents using the MCP tools; the `cli` surface (`--surface cli`) guides agents driving the `rvr` CLI with `--json` — the same workflow `rvr init` writes into `AGENTS.md`. For the cohort that can't run an MCP server, the CLI is a first-class agent target (see [Scripting Tips](#scripting-tips) and `rvr manifest --json`).
### Verifying the MCP Server
```bash
# Binary / Homebrew install:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}' | rvr mcp-server
# From source:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}' | node dist/mcp-server.js
```
A successful response will include `"serverInfo":{"name":"reverie"}` in the JSON output.
## Documentation
| Document | Description |
|---|---|
| [Schema Guide](docs/schema-guide.md) | How to structure your `.reverie/` store — namespaces, store anatomy, good vs bad entries, reference examples |
| [Token Savings](docs/token-savings.md) | How Reverie measures AI agent efficiency — every metric explained, estimation methodology, limitations |
| [Roadmap](docs/ROADMAP.md) | Completed features, upcoming milestones, long-term vision |
| [Dogfooding](docs/dogfooding.md) | How Reverie found and fixed its own bugs using its own MCP tools |
## Development
```bash
bun install # Install dependencies
bun run build # Build the project
bun run test # Run all tests (not `bun test`: the script runs files in parallel workers, which also isolates them)
bun run test:watch # Run tests in watch mode
bun run dev:watch # Watch mode — recompiles on file changes
bun run lint # Run ESLint
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be deployed
Maintenance
ActivityNo data
ResponsivenessOutdated data