
valorbrain
io.github.ValorBrain/valorbrain
Shared memory for AI agents and teams: store, search and correct dated facts and decisions.
Documentation
@valorbrain/cli
Agent-native memory for AI agents and the humans who work with them. Zero dependencies, Node >= 18.
Quickstart
npx @valorbrain/cli init --agent --agent-caller claude-code
npx @valorbrain/cli add "the deploy key lives in the ops vault"
npx @valorbrain/cli search "deploy key"
That's the whole signup: no email, no dashboard, no card. Two credentials land
in ~/.valorbrain/config.json (mode 0600) and work immediately:
| Credential | Prefix | Works on |
|---|---|---|
REST key (api_key) | vb_agent_… | the REST API (https://valorbrain-api.valor.digital) and the claim (init --email); legacy account key, refused by MCP |
MCP token (mcp_token) | vbm_… | the hosted MCP server (https://mcpbrain.valor.digital/mcp); the engine REST API accepts it too, but this CLI only sends it to MCP |
The MCP token is shown once by the server — the config file is the only place
it lives. init --agent prints both credentials, labeled, and the next step
for the clients it finds on PATH (claude, codex, gemini), the same
commands as https://valorbrain.com.br/connect.md. These are CLIs with hooks, so
the first command is the connect installer — npx -y @valorbrain/connect@latest --token <mcp_token> --harness <claude-code|codex|gemini-cli>, MCP + rules +
hooks — followed by one consent line: the hooks send the prompt of each turn to
your ValorBrain workspace; opt out with --prompt off and --checkpoint off
(or VALORBRAIN_SEND_PROMPT=off / VALORBRAIN_CHECKPOINT=off; Gemini CLI passes
them to its hooks too, except on a GitHub runner, and the saved choices always
work); to drop only the hooks, re-run the install with --mcp-only; --remove
undoes everything (MCP entry, rules, hooks, saved credentials)
(what leaves your machine).
The no-hooks path follows: the same command with --mcp-only (MCP server +
rules, nothing sent per turn), or the plain MCP command by hand. When the
account lives on an engine other than the public one (--url), the connect
commands carry --api <engine> so connect talks to that engine. With
--json the same data comes as next_steps. init --agent refuses to replace
an existing config (that would create a second account and drop both keys);
pass --force to replace it, and a backup is written first.
Commands
| Command | What it does |
|---|---|
init --agent [--agent-caller <platform>] [--force] | Creates an account with a REST key and an MCP token |
init --email <address> [--otp <code>] | Binds the account to an email via OTP — neither credential changes. With --json, the first call sends the code and the second (--otp) verifies it |
identify <platform> | Records which agent is calling (idempotent) |
add <text> / --file <path> | Stores a memory (--collection, --title, --type decision|observation|problem|milestone|handoff|lesson|note, --sensitivity public|internal|private|company_confidential) |
add --key <name> <text> | Stores it under a stable path (cli/key/<slug>): adding the same key again revises the memory (action: updated, revision_count + 1) |
add --supersedes <docid|path> <text> | Marks an older memory as superseded by this one (repeatable) |
search <query> | Search (--collection, --limit 1-100, --mode auto|keyword|semantic|hybrid) |
forget <docid> | Forgets a memory (soft delete; it stops appearing in search) |
list | Lists collections |
status | Local config + remote health |
mcp [--token vbm_…] | Bridges stdio MCP clients to the hosted MCP server (uses the saved mcp_token) |
help --json | The whole surface, machine-readable — generated from the same spec the parser enforces |
Global flags work in any position, before or after the command: --json for
single-object machine-readable output, --api-key for an explicit REST key
(--key is an alias, except after add, where it is the memory key), and
--url to point at another deployment (on mcp, the MCP URL). --agent only
exists on init.
Unknown flags are errors — their values never end up in a memory. Text that
starts with a dash goes after --: valorbrain add -- "-5 °C at night".
With --json, errors are one object on stdout too:
{ "ok": false, "error": "…", "code": "unknown_flag", "exit_code": 2 }.
Exit codes: 0 ok · 1 server or network failure · 2 usage error · 3
credential missing, of the wrong type, or rejected (401/403).
Environment: VALORBRAIN_API_KEY (REST key), VALORBRAIN_MCP_TOKEN (MCP
token), VALORBRAIN_API_URL, VALORBRAIN_MCP_URL. Still accepted with a
warning on stderr: VALORBRAIN_TOKEN (a vbm_ value is the MCP token,
anything else the REST key), VALORBRAIN_API_TOKEN, VALORBRAIN_URL. A vbm_
token is never sent to the REST API.
Notes for agents
- Say who you are.
--agent-calleris self-declared and never inferred from the environment — the env sniff only suggests. Usage attribution only works if you declare it. - Your text is stored verbatim. Portuguese stays Portuguese, English stays English — nothing is translated or paraphrased on write.
- The notice in
initoutput is for you. It tells you what to surface to your human at your next user-facing turn. Do not skip it.
Connecting MCP clients
Clients that speak streamable HTTP connect directly, with the MCP token as a bearer (Claude Code example):
claude mcp add --transport http --scope user valorbrain https://mcpbrain.valor.digital/mcp \
--header "Authorization: Bearer vbm_…"
Clients that only speak stdio go through the proxy, which reads the saved
mcp_token (or --token / VALORBRAIN_MCP_TOKEN):
{
"mcpServers": {
"valorbrain": {
"command": "npx",
"args": ["-y", "@valorbrain/cli", "mcp"]
}
}
}
The proxy only sends vbm_ tokens. A REST key (vb_agent_…) is refused
locally with an explanation instead of reaching the server, and any HTTP
error from the MCP host comes back to the client as a JSON-RPC error carrying
the request id.
Self-hosting
Point at your own deployment:
valorbrain --url https://your-engine.example.com init --agent
REST base default: https://valorbrain-api.valor.digital · MCP default:
https://mcpbrain.valor.digital/mcp
License
MIT — see LICENSE.
No installation packages available.