遐想
用于人工智能辅助开发的双摄像头记忆。
一个CLI+MCP服务器,为任何AI代理(Claude Code、Copilot、ChatGPT、Cursor等)引导持久的项目上下文。代理在会话开始时读取项目的“其他声音”,写回他们学到的东西,Reverie在会话中不断增长会话。
SeaBear Studios的产品· seabear.dev/幻想
以前称为 codexCLI。请参阅 更新日志 关于品牌重塑的起源和迁移说明。
目录
- 存储数据 - 检索数据 - 运行命令 - 搜索 - 别名 - 复制数据 - 重命名 - 编辑数据 - 删除数据 - 上下文(知识总结) - 运行确认 - 插值 - 条件插值 - 执行插值 - 加密 - 配置 - 项目范围数据 - 数据管理 - 稳定性检测 - 模式验证 - 外壳包装 - Shell选项卡完成 - 脚本编写技巧 - 调试
概述
Reverie是一个命令行工具和AI代理知识库。它使用分层点表示法(类似于JSON)存储结构化信息,并通过MCP将其暴露给AI代理。目标:通过在会话中为AI代理提供持久、共享的项目上下文,使其更有效。
特性
- 分层数据存储:使用直观的点符号路径存储数据(例如。,
server.production.ip) - 命令运行器:使用模拟运行、组合执行存储的shell命令(
:)和链接(&&),以及可选的每次输入确认 - 插值:参考存储值
${key},使用执行存储的命令$(key),并使用条件默认值${key:-fallback}--在读取时全部解决 - 别名:创建频繁访问路径的快捷方式
- 加密:密码保护敏感值
- 搜索:通过搜索关键字或值查找条目
- 树可视化:以树状结构显示嵌套数据
- 剪贴板集成:将值直接复制到剪贴板(macOS、Linux、Windows)
- 行内编辑:打开条目
$EDITOR/$VISUAL用于快速编辑 - JSON输出:机器可读
--json旗上get和find用于脚本编写 - 标准管道:管道值输入
set来自其他命令 - 项目范围数据:选择加入
.reverie/每个项目--项目条目优先,落入全局 - 智能初始化:
rvr init扫描你的代码库,填充.reverie/使用项目/命令/文件/deps/约定/上下文条目,生成CLAUDE.md,并启动了三文件知识约定 - 自动备份:自动带时间戳的备份,可配置轮换(
max_backups设置) - 文件锁定:咨询锁定可防止并发访问造成的数据损坏
- Shell选项卡完成:Bash和Zsh的完整选项卡完成(命令、标志、键、别名)
- 稳定性检测:跟踪条目上次更新的时间,查找过时的知识(
rvr stale),内联[untracked]/[Nd]警告get和context输出 - 模式验证:根据推荐的命名空间检查条目(
rvr lint),可通过以下方式定制_schema.namespaces - MCP服务器:通过模型上下文协议为任何MCP兼容的AI代理(Claude Code、Copilot、ChatGPT等)提供19个工具
- 遥测与审计:使用范围感知遥测技术跟踪使用模式(
rvr stats)以及完整的审计日志,包括前后差异、命中/未命中跟踪和每条记录指标(rvr audit --detailed).包含 通过自校准勘探成本估算实现净代币节省、错过路径跟踪和每个代理的故障。 - 跨会话切换:
reverie_context从以下位置显示顶部横幅context.next_session因此,下一节课将阅读其他工作之前的情况(自动跟踪过去7天) - 项目决议护栏:用结构化的方式写拒绝
PROJECT_UNRESOLVED否时出错.reverie/解析并且没有给出明确的作用域--防止项目形状的数据静默地登录到全局存储中 - Bootstrap大小预算:
reverie_context当预计响应超过时,按优先级删除条目bootstrap_max_response_bytes(默认50KB)--files.*首先,然后arch.*,然后大context.*最大的第一个,有一行修剪的通知,列出了被删除的内容。tier:"full"选择退出 - 写入放大器保护:
reverie_set在30分钟内对会话中的同一密钥进行第3次+次写入时发出警告——信息性的,写入仍然成功。帮助代理注意到密钥何时被用作暂存空间而不是稳定的种子
安装
自制(macOS/Linux)
brew tap seabearDEV/reverie
brew install rvr下载二进制文件
从以下网址下载适用于您平台的最新版本 .
# 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从源代码安装
注: 从源代码安装会注册开发二进制文件rvr-dev(不是rvr).此README中的所有示例都使用rvr,但替换rvr-dev如果是从源代码安装的。生产rvr二进制文件可通过Homebrew或上面的GitHub Release下载获得。
通过在shell配置文件中添加以下内容,确保npm的全局二进制文件在PATH中(.bashrc, .zshrc或同等):
export PATH="$(npm config get prefix)/bin:$PATH"git clone https://github.com/seabearDEV/reverie.git
cd reverie
npm install
npm run build
npm install -g .如果 rvr-dev 安装后找不到,请验证npm的全局bin目录是否在您的PATH中:
echo $PATH | grep -o "$(npm config get prefix)/bin"环境变量
Reverie支持一组用于部署时配置的环境变量。所有这些都是可选的——合理的默认值对大多数用户都适用。(有关颜色和分页等交互式UI首选项,请参阅 配置 使用中。)
| 变量 | 目的 | 默认值 |
|---|---|---|
RVR_DATA_DIR | 覆盖全局数据目录。必须是绝对路径。全球所有州都住在这里:入口商店(store/)、配置、审计日志、遥测。 | ~/.reverie |
RVR_PROJECT | 到a的显式路径 .reverie/ 目录,遗留 .codexcli.json 文件或包含目录。如果路径未解析,则失败关闭——否 cwd 后退。 | 未设置(从 cwd) |
RVR_PROJECT_DIR | MCP服务器启动器提示——服务器应将目录视为项目根目录。相当于通过 --cwd .通过以下方式申请 setProjectRootOverride (没有 process.chdir),因此无论服务器是作为二进制文件运行还是导入,它都能正常工作。 | 未设置 |
RVR_NO_PROJECT | 完全禁用项目文件查找。设置为任何非空值(例如。 1)以及 findProjectFile() 回报 null 不管 cwd 或 RVR_PROJECT. | 未设置 |
RVR_AGENT_NAME | 记录在呼叫代理的审计和遥测日志中的标识符。被...使用 rvr stats 和 rvr audit 分解每个代理(Claude、Cursor、Copilot等)的活动。 | 未设置 |
RVR_DISABLE_LOCKING | 仅测试。 当设置为 1, withFileLock 如果锁获取失败,则返回运行其闭包而不获取文件锁。自v1.11以来的默认(生产)行为是失败关闭并传播锁错误。生产代码永远不应该设置此项——目前还没有已知的生产环境中锁获取会失败。有意执行争用锁场景的测试会使用这种选择退出。 | 未设置 |
备注
RVR_DATA_DIR必须是绝对的。 相对路径(./mydata,~/foo)被硬错误拒绝,而不是默默地解决process.cwd().通过一条扩展的绝对路径。- 验证您的数据目录 在任何时候与
rvr info--theData该行显示了解析的路径,并附有注释(RVR_DATA_DIR)当envvar被设置时。 - 固定项目根目录 对于中的MCP服务器
.claude.json通过设置"env": { "RVR_PROJECT": "" }在混响MCP块中。这比依赖更具确定性cwd走上去。
用法
存储数据
# 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
# Pipe from another command
curl -s https://api.example.com/token | rvr set api.token设置条目后,系统将交互式地询问您是否需要确认才能运行。使用 --confirm 或 --no-confirm 跳过提示。
检索数据
当在项目目录(一个带有 .reverie/ 商店), get 默认情况下显示项目条目。使用 -G 对于全球条目或 -A 对于两者。在项目之外, get 显示全局条目。从项目到全局,查找特定密钥总是自动完成的。
# 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运行命令
默认情况下,命令会立即运行。标记为的条目 --confirm 在设定时间执行前会提示。使用 -y 跳过提示。
# 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搜索
# 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别名
别名是常用关键路径的快捷方式。通过管理 alias 子命令:
# 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复制数据
将条目(或整个子树)复制到新键:
# 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重命名
重命名条目密钥或别名,而不重新创建它们:
# Rename an entry key (moves the value, updates aliases)
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编辑数据
在您的 $EDITOR (或 $VISUAL)对于内联编辑:
# 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删除数据
删除条目会提示确认。使用 -f 跳过。
# 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插值
引用其他值中的存储值 ${key} 语法。引用在读取时解析。
# 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条件插值
对回退值和所需的键检查使用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:-}'执行插值
使用 $(key) 执行存储的命令并替换其stdout。键必须引用包含shell命令的存储字符串值。
# Store a command
rvr set system.user "whoami"
# Reference it with $(key) — executes the command and substitutes the output
rvr set paths.home '/Users/$(system.user)'
rvr get paths.home
# → /Users/kh
# See the raw value without executing
rvr get paths.home --source
# → /Users/$(system.user)
# Aliases work too
rvr set system.user -a user
rvr set paths.home '/Users/$(user)'Exec插值支持:
- 递归:存储的命令可以包含
${key}或$(key)执行前解析的引用 - 缓存:每次插值过程只执行一次相同的键
- 圆形检测:
$(a)→$(b)→$(a)抛出错误 - 超时:命令在10秒后被终止
- 交叉类型引用:
${key}值可以包含$(key)反之亦然
加密
# 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配置
# 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
# Show version, stats, and storage paths
rvr info
# Show usage examples
rvr config examples可用设置:
| 设置 | 值 | 说明 |
|---|---|---|
colors | true / false | 启用/禁用彩色输出 |
theme | default / dark / light | UI主题 |
max_backups | 整数(默认值: 10) | 要保留的自动备份数量(0 禁用) |
import_max_bytes | 整数(默认值: 52428800 /50 MB) | 拒绝大于此(字节)的导入文件以防止OOM |
项目范围数据
Reverie支持与代码一起存在的每个项目的知识库。这 .reverie/ 目录旨在致力于版本控制,创建一个跨会话、团队成员和AI代理的共享知识库。从v1.10.0开始,每个条目都是目录中自己的JSON文件(.reverie/arch.storage.json, .reverie/commands.build.json等等)——这消除了当多个开发人员在并行分支上添加不同条目时合并冲突的混乱。使用CLI或MCP工具进行编辑;不支持手动编辑包装文件。
# 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范围标志: 这 -G / --global 标志可用 set, get, run, find, copy, edit, rename,以及 remove.数据管理命令(export, import, reset)也支持 -P / --project.
推荐架构
深潜: 看 架构指南 了解文件结构背后的全部原理,什么是好的条目,以及Reverie项目自己的演练 .reverie/ 作为参考实现。当使用Reverie作为项目知识库时(特别是通过MCP使用AI代理时),我们建议在这些名称空间下组织条目:
| 命名空间 | 目的 | 示例 |
|---|---|---|
project.* | 基本元数据 | project.name, project.stack, project.description |
commands.* | 构建、测试、部署命令 | commands.build, commands.test, commands.deploy.staging |
arch.* | 架构和设计决策 | arch.storage, arch.api, arch.auth |
conventions.* | 编码模式、命名、风格 | conventions.types, conventions.errors, conventions.testing |
context.* | 不明显的陷阱,边缘案例 | context.migration, context.legacy, context.performance |
files.* | 关键文件路径及其作用 | files.entry, files.config, files.routes |
deps.* | 显著的依赖关系及其原因 | deps.commander, deps.vitest, deps.zod |
保持值简洁——一句话或一个简短的命令。使用同一命名空间下的多个键以获取详细信息。不要储存容易衍生出来的东西 package.json 或者代码本身;存储否则会丢失的见解、决策和上下文。
AI代理工作流
当AI代理通过MCP连接时,建议的工作流程是:
- 呼叫
reverie_context如你的 第一 工具调用引导会话知识。为任务选择正确的层级:
- tier:"essential" --回答问题、小修复、单文件编辑 - 省略/ tier:"standard" --多文件更改、错误修复、新功能(默认) - tier:"full" --重构子系统、更改架构、加入代码库
- 检查相关命名空间(
arch,conventions,context,files)在探索代码库之前 - 记录不明显的发现
reverie_set当你工作时 - 当发现过时条目不再与代码匹配时,更新它们
自动跟踪代理使用情况--运行 rvr stats 查看引导率、回写率和命名空间覆盖率趋势。
知识飞轮
每个AI会话都有同样的问题:代理从零开始,花费数千个令牌探索代码库,当会话结束时,所有这些理解都消失了。Reverie将其转化为复合资产。
以下是它在实践中的工作原理:
- 你跑
rvr init在一个新项目中。CLI在毫秒内扫描代码库并创建骨架.reverie/通过项目元数据、命令、文件路径、依赖关系和约定,它可以从文件系统中检测到。
- 第一次AI会议开始。 代理人打电话来
reverie_context,看到骨架,并意识到这是一个新项目(context.initialized: scaffold).在开始任务之前,它会读取实际的源代码——入口点、核心模块、配置文件——并填充深层知识:arch.*,不明显的陷阱context.*,以及丰富的文件描述files.*这种深入分析只进行一次。
- 之后的每一次会议 --无论是Claude、Copilot、Cursor、ChatGPT还是任何其他兼容MCP的代理,都可以在单个代理中引导完整的知识库
reverie_context电话。没有重新探索。没有浪费代币。
- 飞轮加速。 代理A在周一发现了一个数据库迁移陷阱,并将其存储在
context.migration代理B(不同的工具,不同的会话)在周二到达同一区域并立即受益——它已经知道了陷阱。代理B发现API模式并将其存储在arch.api代理人C将于周三受益。
知识库随着每次会话而增长。每个会话的令牌成本下降。 rvr stats 显示了趋势:引导率、命中率、估计保存的令牌、每个命名空间的覆盖率。你使用得越多,每个代理的效率就越高。
因为知识存在于 .reverie/ (提交到您的仓库的纯JSON文件),它跨机器、跨团队成员和跨AI工具工作。没有供应商锁定,没有云依赖,没有API密钥。只是随着时间的推移变得更智能的文件。
数据管理
所有数据(条目、别名、确认元数据)都存储在一个目录中,每个条目加一个JSON文件 _aliases.json 和 _confirm.json 侧三轮-- ~/.reverie/store/ 对于全球数据, .reverie/ 用于项目范围的数据。v1.10.0之前统一 .codexcli.json / data.json 文件在首次访问时会自动迁移,旧文件将重命名为 .backup.
# 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自动备份: 破坏性操作前(data reset,不合并data import),Reverie会自动在中创建带时间戳的备份~/.reverie/.backups/。默认情况下保留最后10个备份--配置为rvr config set max_backups(设置为0禁用旋转)。
上下文(知识总结)
获取存储的项目知识的简洁摘要——与AI代理所获得的视图相同 reverie_context:
# Show project knowledge (standard tier — excludes arch.*)
rvr context
# Show only essential entries (project/commands/conventions)
rvr context --tier essential
# Show everything
rvr context --tier full
# Output as JSON
rvr context --json
# Plain text without colors
rvr context -p运行确认
标记执行前应提示的命令:
# 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稳定性检测
跟踪条目上次更新的时间,并查找可能需要刷新的过时知识。
# 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当设置、复制或重命名条目时,会自动跟踪时间戳。
固着也浮出水面-- rvr get 和 reverie_context (MCP)为过时或未跟踪的条目添加标签:
[untracked]--条目没有更新时间戳(早于过时跟踪)。最可疑。[47d]--该条目已有47天未更新。在信任版本号、URL或命令之前进行验证。
CLI get 命令为过时/未跟踪的条目打印黄色警告。新条目未显示标签。
模式验证
根据推荐的命名空间模式检查条目,以保持知识库的组织性。
# Check for entries outside recommended namespaces
rvr lint
# Output as JSON
rvr lint --json
# Check global store only
rvr lint -G默认命名空间: project, commands, arch, conventions, context, files, deps, system。在中添加自定义命名空间 .reverie/:
{
"_schema": { "namespaces": ["myapp", "infra"] }
}外壳包装
默认情况下, rvr run 在子进程中执行命令。这意味着shell内置了类似 cd, export,以及 alias 对当前的shell没有影响。
运行后 rvr config completions install,将一个shell包装器函数添加到您的shell配置文件中,以修复此问题。当你使用 rvr run (或 rvr r),包装:
- 呼唤真实
rvr二进制与--source,它将原始命令输出到stdout,而不是执行它 - 捕获该输出并
eval它在你现在的壳里吗
所有其他 rvr 命令原封不动地传递到二进制文件。
# 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包装程序由以下程序自动安装 rvr config completions install。如果您已经安装了补全,请再次运行它以添加包装器,然后 source 您的shell配置文件。
Shell选项卡完成
Reverie支持Bash和Zsh的制表符补全,包括命令、标志、存储密钥、别名等。
快速设置
rvr config completions install这会将一个完成加载器和shell包装器附加到您的 ~/.zshrc 或 ~/.bashrc 告诉重新启动shell(或 source 文件)。
手动设置
如果您更喜欢自己设置:
# Zsh - add to ~/.zshrc
eval "$(rvr config completions zsh)"
# Bash - add to ~/.bashrc or ~/.bash_profile
eval "$(rvr config completions bash)"完成什么
| 背景 | 完成情况 |
|---|---|
rvr | 所有命令(set, get, run, find, edit, copy, remove, rename, alias, confirm, context, info, init, stale, lint, stats, audit, config, data) |
rvr get | 标志+存储的数据键+别名+命名空间前缀 |
rvr run | 标志+存储的数据键+别名 |
rvr run cd: | 数据键+别名(完成后段 :) |
rvr set | 标志+命名空间前缀(一次一个级别) |
rvr alias | 子命令(set, remove, list, rename) |
rvr confirm | 子命令(set, remove, list) |
rvr config | 子命令(set, get, info, examples, completions) |
rvr config set | 配置键(colors, theme, max_backups) |
rvr data | 子命令(export, import, reset) |
rvr data export | entries, aliases, confirm, all |
脚本编写技巧
# Use raw output in other commands
ssh $(rvr get server.ip -r)
# 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调试
rvr --debug get server.production命令参考
| 命令 | 别名 | 签名 | 描述 |
|---|---|---|---|
set | s | [value] | 设置一个条目(值可选 -a;支持 key=val 批次) |
get | g | [key] | 列出密钥(默认)或使用以下命令检索条目 -v |
run | r | `` | 执行存储的命令(: 组成, && 链条) |
find | f | `` | 按键或值查找条目(也可: search) |
edit | e | `` | 在中打开条目的值 $EDITOR |
copy | cp | | 将条目复制到新密钥 |
remove | rm | `` | 删除条目及其别名 |
rename | rn | ` | |
| ` | 重命名条目密钥或别名 | ||
context | [--tier ] | 展示简洁的知识总结(基本、标准、完整) | |
info | 显示版本、统计信息和存储路径 | ||
alias | `` | 管理关键别名(设置、删除、列出、重命名) | |
confirm | `` | 管理运行确认(设置、删除、列出) | |
init | 初始化项目(.reverie/ +代码库扫描+ CLAUDE.md) | ||
stale | [days] | 显示N天内未更新的条目(默认值30) | |
lint | 根据命名空间架构检查条目(--json) | ||
stats | 查看MCP使用遥测和趋势(--period, --detailed, --json) | ||
audit | [key] | 使用前后差异查询审核日志(--detailed, --cli, --mcp, --hits, --misses, --redundant) | |
config | `` | 查看或更改配置设置 | |
data | `` | 管理存储的数据(导出、导入、重置) |
别名子命令: set , remove , list, rename
确认子命令: set , remove , list
配置子命令: set , get [key], info, examples, completions
数据子命令: export , import , reset
范围标志: -G / --global 以全球商店为目标。 -A / --all 上 get 显示了带有节标题的两个作用域。
MCP服务器(AI代理集成)
Reverie内置 模型上下文协议 (MCP)服务器,允许任何兼容MCP的AI代理作为本机工具读取和写入您的Reverie数据存储。适用于Claude Code、Claude Desktop、GitHub Copilot、ChatGPT和任何其他支持MCP的客户端。
设置
克劳德代码
自制/二进制安装(全局):
claude mcp add reverie -- rvr mcp-server每个项目 (推荐--启用项目范围的数据):
claude mcp add reverie --scope project -- rvr mcp-server --cwd .这 --scope project 在Claude Code中为每个项目进行注册,以及 --cwd . 告诉MCP服务器将项目根用于 .reverie/ 检测。您还可以使用 RVR_PROJECT_DIR 环境变量而不是 --cwd.
npm全局安装 (npm install -g .)--dev模式:
claude mcp add reverie -- rvr-dev mcp-server来源 (开发):
claude mcp add reverie -- node /absolute/path/to/dist/mcp-server.js独立 rvr-dev-mcp 命令仍然适用于npm安装。克劳德桌面版
自制/二进制安装:
{
"mcpServers": {
"reverie": {
"command": "rvr",
"args": ["mcp-server"]
}
}
}npm全局安装 (开发模式):
{
"mcpServers": {
"reverie": {
"command": "rvr-dev",
"args": ["mcp-server"]
}
}
}来源:
{
"mcpServers": {
"reverie": {
"command": "node",
"args": ["/absolute/path/to/dist/mcp-server.js"]
}
}
}可用工具
| 工具 | 说明 |
|---|---|
reverie_set | 将项目知识存储为键值条目(点符号、可选别名、可选加密) |
reverie_get | 通过点符号键检索存储的知识,或列出所有条目(过时/未跟踪条目上的过时标签,可选解密) |
reverie_remove | 按键删除存储的条目或别名 |
reverie_copy | 将条目复制到新密钥(可选强制覆盖) |
reverie_rename | 重命名条目密钥或别名(重新指向别名,迁移确认元数据) |
reverie_search | 按关键字(键、值或两者)搜索存储的知识 |
reverie_alias_set | 为点标记路径创建或更新别名 |
reverie_alias_remove | 删除别名 |
reverie_alias_list | 列出所有已定义的别名 |
reverie_run | 按键执行存储的shell命令(干运行、插值、确认提示) |
reverie_config_get | 获取一个或所有配置设置 |
reverie_config_set | 设置配置设置(颜色、主题、max_backups) |
reverie_export | 将数据和/或别名导出为JSON文本 |
reverie_import | 从JSON字符串导入数据和/或别名(合并、替换或预览) |
reverie_reset | 将数据和/或别名重置为空状态 |
reverie_context | 存储的项目知识的简明摘要(在会话开始时使用;支持层次:基本、标准、完整;过时/未跟踪条目上的过时标签) |
reverie_stale | 查找最近未更新的条目(阈值以天为单位,默认值为30) |
reverie_stats | 查看使用遥测和 代币储蓄 (命中率、避免的探索成本、每个命名空间的细分、趋势) |
reverie_audit | 查询数据突变的审计日志(差异、代理身份、范围、成功/失败之前/之后) |
所有数据触摸工具都接受可选 scope 参数("project" 或 "global").当列出条目(无密钥)时, reverie_get 仅当满足以下条件时,默认为项目 .reverie/ 存在--通过 all: true 查看这两个范围。从项目到全局自动执行单键查找。
LLM说明
当AI代理通过MCP连接时,Reverie会发送内置指令,指导代理如何与数据存储交互(模式、范围、工具提示、有效使用模式)。这些默认值是不可变的,并且随着功能的添加而保持最新。
要添加特定于项目的指导,请设置 system.llm.instructions --您的文本是 附加 作为默认值 PROJECT CONTEXT 部分,而非替代:
# 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
# Remove your custom additions (reverts to defaults only)
rvr rm system.llm.instructions验证MCP服务器
# 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成功的响应将包括 "serverInfo":{"name":"reverie"} 在JSON输出中。
文档
| 文档 | 描述 |
|---|---|
| 架构指南 | 如何构建你的 .reverie/ store——名称空间、文件剖析、好条目与坏条目、参考示例 |
| 代币节省 | Reverie如何衡量AI代理效率——每个指标的解释、估计方法、局限性 |
| 路线图 | 已完成的功能、即将到来的里程碑、长期愿景 |
| 吃狗粮 | Reverie如何使用自己的MCP工具发现并修复自己的错误 |
发展
npm install # Install dependencies
npm run build # Build the project
npm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run dev:watch # Watch mode — recompiles on file changes
npm run lint # Run ESLint许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。
