RelayVault

RelayVault stores redacted task checkpoints in a local SQLite WAL database and provides MCP, REST, and CLI interfaces for handing work between models. Detected secrets are replaced with stable workspace-specific tokens; their original values are encrypted in the local vault.
[Model A: Claude / GPT]
|
(commit)
v
[RelayVault Redaction Engine] ----(Fernet AES ciphertext)----> [Local SQLite secret_vault]
| [master.key (0600)]
| Scrubbed <RV_VAULT:...> DAG state
v
[Model B: DeepSeek / Kimi / Gemini / Grok]
|
| Code with <RV_VAULT:...> intact
v
[Local CLI: relayvault rehydrate-file]
The boundary protects the outgoing redacted handoff to Model B, not plaintext already sent to Model A before a commit. To avoid sending secrets to either model, run dehydrate-file locally before supplying text to a model, and review the resulting text. Detection is heuristic and cannot guarantee that all sensitive data is removed.
Install and quickstart
Python 3.11 or later is required. RelayVault 0.2.0 is available on PyPI. Existing vaults require the explicit v2 migration. For a clean installation:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install "relayvault==0.2.0"
# Choose a long random value; keep it outside source control.
export RELAYVAULT_API_KEY="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
export RELAYVAULT_WORKSPACES='{"example":["read","write"]}'
relayvault serve-api --host 127.0.0.1 --port 8000
In another terminal, with the same environment and RELAYVAULT_HOME:
curl -sS -X POST http://127.0.0.1:8000/v1/checkpoints/commit \
-H "Authorization: Bearer $RELAYVAULT_API_KEY" -H 'Content-Type: application/json' \
-d '{"workspace_id":"example", "source_model":"model-a", "objective":"Implement a retry handler"}'
curl -sS -X POST http://127.0.0.1:8000/v1/checkpoints/checkout \
-H "Authorization: Bearer $RELAYVAULT_API_KEY" -H 'Content-Type: application/json' \
-d '{"workspace_id":"example", "target_model":"model-b"}'
The server also exposes /openapi.json, /docs, and /v1/schemas/tools. RELAYVAULT_HOME selects the data directory; the default is ~/.relayvault. All clients that need to share a vault must use the same home and salt.
For development from a cloned repository, use the hash-pinned dependencies and editable install instead of the PyPI installation command:
python -m pip install --require-hashes -r requirements-dev.lock
python -m pip install --no-deps --no-build-isolation -e .
Connect MCP clients
These examples run the server locally over stdio. By default the available tools are relayvault_commit_checkpoint, relayvault_checkout_handoff, and relayvault_list_history; agent rehydration is disabled. The CLI and REST examples below do not require an MCP client.
Claude Code
From the directory containing your .venv, use an absolute executable path so the server does not depend on the client's PATH. Set a shared vault home explicitly:
claude mcp add --transport stdio \
--env "RELAYVAULT_HOME=$HOME/.relayvault" \
relayvault -- "$PWD/.venv/bin/relayvault-mcp"
claude mcp get relayvault
See the Claude Code MCP documentation for scopes and troubleshooting.
Claude Desktop
Add this entry to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows, or ~/.config/Claude/claude_desktop_config.json on Linux. Replace both example paths with absolute paths on your machine; on Windows use the virtual environment's Scripts\\relayvault-mcp.exe and escaped JSON backslashes. Merge the entry with any existing mcpServers, then fully restart Claude Desktop.
{
"mcpServers": {
"relayvault": {
"command": "/absolute/path/to/relayvault/.venv/bin/relayvault-mcp",
"args": [],
"env": {"RELAYVAULT_HOME": "/absolute/path/to/.relayvault"}
}
}
}
See MCP's local server configuration guide.
Cursor
Add this entry to .cursor/mcp.json in a project or ~/.cursor/mcp.json for the current user. Replace the example paths with absolute paths, and restart or reload Cursor.
{
"mcpServers": {
"relayvault": {
"type": "stdio",
"command": "/absolute/path/to/relayvault/.venv/bin/relayvault-mcp",
"args": [],
"env": {"RELAYVAULT_HOME": "/absolute/path/to/.relayvault"}
}
}
}
See Cursor's MCP configuration. Do not set RELAYVAULT_ALLOW_AGENT_REHYDRATE in model-facing client configurations unless the client is trusted to receive plaintext secrets.
REST and provider function calling
Run RelayVault locally as shown in Quickstart. The /v1/schemas/tools response contains two model-facing function definitions for openai_deepseek_kimi_grok, anthropic_claude, and google_gemini; it never contains a rehydration function. The following examples send a new request to an external provider, may incur charges, and require that provider's credentials and access to a compatible model. Use only reviewed, redacted content.
OpenAI, DeepSeek, and Kimi: Chat Completions
Choose one configuration and a model available to your account. These examples target the Chat Completions tool format; some OpenAI models require the Responses API instead.
# OpenAI:
export PROVIDER_URL='https://api.openai.com/v1/chat/completions'
export PROVIDER_API_KEY="$OPENAI_API_KEY"
# DeepSeek (use instead of the two lines above):
# export PROVIDER_URL='https://api.deepseek.com/chat/completions'
# export PROVIDER_API_KEY="$DEEPSEEK_API_KEY"
# Kimi / Moonshot international (use instead):
# export PROVIDER_URL='https://api.moonshot.ai/v1/chat/completions'
# export PROVIDER_API_KEY="$KIMI_API_KEY"
export MODEL='replace-with-a-chat-completions-model-available-to-your-account'
python - <<'PY'
import os
import httpx
schemas = httpx.get('http://127.0.0.1:8000/v1/schemas/tools').raise_for_status().json()
response = httpx.post(
os.environ['PROVIDER_URL'],
headers={'Authorization': 'Bearer ' + os.environ['PROVIDER_API_KEY']},
json={
'model': os.environ['MODEL'],
'messages': [{'role': 'user', 'content': 'Check out the latest handoff for workspace example.'}],
'tools': schemas['openai_deepseek_kimi_grok'],
},
timeout=60,
)
response.raise_for_status()
print(response.json())
PY
This prints the provider response, including any proposed tool calls. The application must validate the function name and arguments, execute only the intended local endpoint (/v1/checkpoints/commit or /v1/checkpoints/checkout) with RELAYVAULT_API_KEY, and return the tool result to the provider in its required format. Sending schemas alone does not execute the functions. Never pass either RelayVault credential to the provider. See OpenAI Chat Completions tools, DeepSeek Chat Completions, and Kimi provider configuration.
Gemini: generateContent
Set GEMINI_API_KEY and choose an available model in MODEL. This example converts the exported function parameters to Gemini's parametersJsonSchema field and prints any proposed function call; the application must validate, execute, and return results as described above.
export MODEL='replace-with-a-gemini-model-available-to-your-account'
python - <<'PY'
import os
import httpx
schemas = httpx.get('http://127.0.0.1:8000/v1/schemas/tools').raise_for_status().json()
declarations = []
for group in schemas['google_gemini']:
for function in group['function_declarations']:
declarations.append({
'name': function['name'],
'description': function['description'],
'parametersJsonSchema': function['parameters'],
})
response = httpx.post(
'https://generativelanguage.googleapis.com/v1beta/models/' + os.environ['MODEL'] + ':generateContent',
headers={'x-goog-api-key': os.environ['GEMINI_API_KEY']},
json={
'contents': [{'parts': [{'text': 'Check out the latest handoff for workspace example.'}]}],
'tools': [{'functionDeclarations': declarations}],
},
timeout=60,
)
response.raise_for_status()
print(response.json())
PY
See the Gemini function declaration reference for provider schema and response details. Provider model availability and supported schemas can change; test the integration against your selected model before deployment.
HTTP authentication and workspace permissions
Stdio trusts the OS user running the server. Both HTTP MCP transports and REST require explicit workspace grants. For a single client use the Quickstart environment above; for multiple clients set RELAYVAULT_AUTH_FILE to a private 0600 JSON file:
{
"coding-agent": {
"key": "replace-with-a-unique-random-agent-key",
"workspaces": {"example": ["read", "write"]}
},
"reviewer": {
"key": "replace-with-another-random-key",
"workspaces": {"example": ["read"]}
}
}
This file takes precedence over RELAYVAULT_API_KEY / RELAYVAULT_WORKSPACES. Wildcard workspaces are not accepted. Send the selected client's key as Authorization: Bearer .... For HTTP MCP, use relayvault serve-mcp --transport streamable-http --port 8090 (/mcp), or legacy --transport sse (/sse). These listeners bind to localhost; expose them through an authenticated TLS deployment only after configuring network controls. Clients must support explicitly supplied bearer headers; RelayVault is not an OAuth authorization server.
REST rehydration is disabled until a different RELAYVAULT_REHYDRATE_KEY is configured. It requires the ordinary credential, workspace read permission and both additional headers, even on loopback:
# Set on the trusted server and rehydration host; do not give it to the agent.
export RELAYVAULT_REHYDRATE_KEY="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"
# Restart the server with this environment, then send a local restoration request:
curl -sS http://127.0.0.1:8000/v1/vault/rehydrate \
-H "Authorization: Bearer $RELAYVAULT_API_KEY" \
-H 'X-RelayVault-Local-Intent: rehydrate' \
-H "X-RelayVault-Rehydrate-Key: $RELAYVAULT_REHYDRATE_KEY" \
-H 'Content-Type: application/json' \
-d '{"workspace_id":"example","text_with_vault_tokens":"paste the exact vaulted output here"}'
The endpoint is absent from OpenAPI/tool schemas. Proxy deployments require the separate rehydration key, just like local deployments; client addresses and forwarding headers never grant decryption privileges.
Detection preview and local review
The default block-uncertain policy rejects unclassified high-entropy credential-like strings. Review mode also withholds checkpoint exports until a trusted local review:
export RELAYVAULT_REDACTION_POLICY=review
relayvault preview-file --workspace example --file config.py
relayvault dehydrate-file --workspace example --file config.py --in-place --reviewed
# After an MCP/REST commit, use the returned commit hash:
relayvault inspect-checkpoint --workspace example --commit COMMIT_HASH
relayvault approve-checkpoint --workspace example --commit COMMIT_HASH --reviewed
Review the actual output for unstructured PII and unexpected credentials before approving. There is no model-facing approval tool. Optional RELAYVAULT_DETECTORS_FILE points to trusted JSON such as [{"name":"EMPLOYEE_ID","pattern":"EMP-[0-9]{6}"}]; add bounded patterns and regression cases for your domain.
CLI reference
| Command |
Purpose and options |
serve-mcp [--transport stdio\|sse\|streamable-http] [--port 8090] [--allow-agent-rehydrate] |
MCP; stdio default. HTTP requires bearer keys and workspace grants. Plaintext opt-in is stdio-only. |
serve-api [--host 127.0.0.1] [--port 8000] |
REST; requires bearer keys and workspace grants. |
preview-file --workspace ID --file PATH |
Display detected spans as preview markers and an uncertainty count without vaulting the file. |
dehydrate-file --workspace ID --file PATH [--in-place] [--reviewed] |
Vault detected values; review policy requires explicit local review. |
rehydrate-file --workspace ID --file PATH [--in-place] [--allow-partial] |
Restore tokens; unresolved/malformed tokens fail by default. |
log --workspace ID [--branch BRANCH] |
Integrity-checked, redacted history. |
inspect-checkpoint --workspace ID --commit HASH |
Trusted local preview of a pending checkpoint. |
approve-checkpoint --workspace ID --commit HASH --reviewed |
Approve that exact reviewed checkpoint for export. |
verify-vault |
Verify every record, checkpoint, head and lineage. |
backup --destination NEW_DIR |
Consistent SQLite snapshot with key and salt configuration. |
restore --source BACKUP_DIR --destination NEW_DIR |
Verify and restore into a new home. |
rotate-key --destination NEW_DIR |
Reencrypt into a new home; preserve tokens and checkpoint IDs. |
migrate-vault --destination NEW_DIR |
Explicit legacy migration; preserve old token recovery and require local checkpoint reviews. |
Prefix commands with relayvault. File commands support UTF-8 and preserve original bytes/line endings on successful round trips. Atomic in-place rehydration writes a 0600 plaintext file. relayvault-mcp is the stdio entry point. Stop clients before maintenance/cutover and update their RELAYVAULT_HOME together; maintenance commands never overwrite the source or an existing destination.
Security model & limitations