Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

feat(mcp): new registrations list the memory verbs over the full surface (serve --advertise verbs)

garrytan0ae7a9b440c0
diff --git a/INSTALL_FOR_AGENTS.md b/INSTALL_FOR_AGENTS.md
index ed160199f3..e70ed3c769 100644
--- a/INSTALL_FOR_AGENTS.md
+++ b/INSTALL_FOR_AGENTS.md
@@ -490,7 +490,7 @@ model gbrain removed in v0.33, needs `gbrain skillpack migrate-fence` once.)
**If you are Hermes:** register gbrain as your MCP server:
```bash
-printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve --surface full
+printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve --surface full --advertise verbs
```
Keep `--args` last (everything after it becomes server argv) and verify with
@@ -500,7 +500,7 @@ Keep `--args` last (everything after it becomes server argv) and verify with
**If you are Grok Build** (xAI's `grok` CLI): register gbrain as your MCP server:
```bash
-grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full
+grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
The add is lazy (exit 0 without connecting) — verify with
@@ -516,7 +516,7 @@ install, follow `BOOTSTRAP_FOR_AGENTS.md` instead of this page. For the
brain-only MCP registration:
```bash
-opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full
+opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
The add is lazy (exit 0 without connecting) — verify with `opencode mcp list`,
diff --git a/README.md b/README.md
index 970bd0bb9f..1a25bc8231 100644
--- a/README.md
+++ b/README.md
@@ -185,7 +185,7 @@ The agent starts with keyless memory and verifies it. API keys, automatic captur
### Lighter ways in
-**Just want a memory for your coding agent — no identity, no repo.** On Claude Code or Codex use `gbrain setup` (above). By hand: `gbrain init --pglite --no-embedding`, then `codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full` (`claude mcp add` takes the same argv; `--surface verbs` or `starter` for a harness that caps its tool count). Saved memories are brain-wide by default; pass `visibility: "private"` for local-only facts.
+**Just want a memory for your coding agent — no identity, no repo.** On Claude Code or Codex use `gbrain setup` (above). By hand: `gbrain init --pglite --no-embedding`, then `codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs` (`claude mcp add` takes the same argv; the tool list shows the seven memory verbs and `request_tools`, and every operation stays callable; drop `--advertise verbs` to list everything). Saved memories are brain-wide by default; pass `visibility: "private"` for local-only facts.
**Already have a brain on a remote host** (OpenClaw, Hermes, or any `gbrain serve --http`)? Point your laptop agents at it with one command each — `--install` wires it up and smoke-tests the token before handoff:
@@ -222,15 +222,15 @@ Choose the connection instructions for your actual product:
**Upgrading a brain indexed before v0.48.3.0?** Rebuild its search chunks first: [upgrade recovery guide](skills/migrations/v0.48.3.0.md). **Say to your agent:** *"Upgrade gbrain and check whether my search index needs rebuilding."*
-- **[Claude Code](docs/mcp/CLAUDE_CODE.md)** — plugin: `/plugin marketplace add garrytan/gbrain` + `/plugin install gbrain@gbrain` (MCP + skills; persona variants `gbrain-coding` / `gbrain-daily` install curated subsets; pick one). Marketplace-free skills: `gbrain skillpack scaffold --harness claude-code` copies a persona-curated skill set into your user-scope skills dir. Or local one-liner: `claude mcp add gbrain -- "$(command -v gbrain)" serve`. Remote with just a bearer token: `gbrain connect https://your-host/mcp --token gbrain_xxx` prints a paste-ready block (or `--install` wires it up and smoke-tests the token).
+- **[Claude Code](docs/mcp/CLAUDE_CODE.md)** — plugin: `/plugin marketplace add garrytan/gbrain` + `/plugin install gbrain@gbrain` (MCP + skills; persona variants `gbrain-coding` / `gbrain-daily` install curated subsets; pick one). Marketplace-free skills: `gbrain skillpack scaffold --harness claude-code` copies a persona-curated skill set into your user-scope skills dir. Or local one-liner: `claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs`. Remote with just a bearer token: `gbrain connect https://your-host/mcp --token gbrain_xxx` prints a paste-ready block (or `--install` wires it up and smoke-tests the token).
- **[Codex](docs/mcp/CODEX.md)** — plugin (recommended): `codex plugin marketplace add garrytan/gbrain@codex-plugin` + `codex plugin add gbrain@gbrain` installs the MCP server AND the curated skill set. Or connect-only: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent codex` (or `--install`); the token path reads `$GBRAIN_REMOTE_TOKEN` at runtime, while the private-handoff installer writes a private managed HTTP header so the connection survives a new shell.
-- **[Cursor / Windsurf / any stdio MCP client](docs/mcp/CLAUDE_CODE.md)** — same shape, add `{"command": "gbrain", "args": ["serve", "--surface", "full"]}` to your MCP config.
-- **[Hermes](docs/mcp/HERMES.md)** — `printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve --surface full`. Keep `--args` last, and verify with `hermes mcp test gbrain` (the add exits 0 even on failure).
+- **[Cursor / Windsurf / any stdio MCP client](docs/mcp/CLAUDE_CODE.md)** — same shape, add `{"command": "gbrain", "args": ["serve", "--surface", "full", "--advertise", "verbs"]}` to your MCP config.
+- **[Hermes](docs/mcp/HERMES.md)** — `printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve --surface full --advertise verbs`. Keep `--args` last, and verify with `hermes mcp test gbrain` (the add exits 0 even on failure).
- **[Grok Bot](docs/guides/grok-bot.md)** — recommended: keep the brain on your computer, publish it with `gbrain mcp expose --funnel`, grant the Bot a `memory-writer` client and install the thin CLI at `/workspace/gbrain`; or install memory inside the Bot computer when no machine of yours stays online. Bots share local files and credentials; sources organize memory without isolating Bots. **Say to your agent:** *"connect grok bot to my brain"*.
- **[Muse personal agent](docs/guides/muse.md)** — first verify its durable user-files location; then either connect it to your published brain (`gbrain mcp expose --funnel` + thin CLI) or install the local CLI there. Native MCP configuration and skill activation are not assumed. **Say to your agent:** *"connect muse to my brain"*.
-- **[Grok Build](docs/mcp/GROK.md)** — `grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full`. The add is lazy (exit 0 without connecting) — verify with `grok mcp doctor gbrain`, which spawns the server. Verified against Grok Build v1.0.4.
-- **[opencode](docs/mcp/OPENCODE.md)** (opencode.ai / SST — not OpenClaw) — `opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full`, or let `gbrain bootstrap hooks --harness opencode` write the config for you (opencode is a bootstrap-supported harness — it reads AGENTS.md natively). The add is lazy — verify with `opencode mcp list`, which spawns the server (`✓ gbrain connected`). Remote: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent opencode [--install]` — the config stores only the `{env:GBRAIN_REMOTE_TOKEN}` interpolation. Verified against opencode v1.18.18.
-- **[OpenClaw](docs/mcp/OPENCLAW.md)** — the ClawHub bundle plugin registers gbrain automatically (`openclaw.plugin.json` ships in this repo), or register the stdio server with `openclaw mcp add gbrain --command "$(command -v gbrain)" --arg serve --env GBRAIN_HOME=$HOME` (absolute path: the launchd gateway PATH lacks `~/.bun/bin`); verify with `openclaw mcp list`.
+- **[Grok Build](docs/mcp/GROK.md)** — `grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full --advertise verbs`. The add is lazy (exit 0 without connecting) — verify with `grok mcp doctor gbrain`, which spawns the server. Verified against Grok Build v1.0.4.
+- **[opencode](docs/mcp/OPENCODE.md)** (opencode.ai / SST — not OpenClaw) — `opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full --advertise verbs`, or let `gbrain bootstrap hooks --harness opencode` write the config for you (opencode is a bootstrap-supported harness — it reads AGENTS.md natively). The add is lazy — verify with `opencode mcp list`, which spawns the server (`✓ gbrain connected`). Remote: `gbrain connect https://your-host/mcp --token gbrain_xxx --agent opencode [--install]` — the config stores only the `{env:GBRAIN_REMOTE_TOKEN}` interpolation. Verified against opencode v1.18.18.
+- **[OpenClaw](docs/mcp/OPENCLAW.md)** — the ClawHub bundle plugin registers gbrain automatically (`openclaw.plugin.json` ships in this repo), or register the stdio server with `openclaw mcp add gbrain --command "$(command -v gbrain)" --arg serve --arg --surface --arg full --arg --advertise --arg verbs --env GBRAIN_HOME=$HOME` (absolute path: the launchd gateway PATH lacks `~/.bun/bin`); verify with `openclaw mcp list`.
- **[Claude Desktop (Cowork)](docs/mcp/CLAUDE_DESKTOP.md)** — Settings → Integrations → add the URL of your HTTP server. Remote only; the local `claude_desktop_config.json` does not work for remote servers.
- **[Claude Cowork (team plan)](docs/mcp/CLAUDE_COWORK.md)** — org Owner adds the connector under Organization Settings → Connectors.
- **[Perplexity Computer](docs/mcp/PERPLEXITY.md)** — choose native OAuth or a managed bearer connection according to the actual connector settings. The owner registers the matching client and delivers any confidential credentials privately.
diff --git a/docs/INSTALL.md b/docs/INSTALL.md
index e9b421cd37..e4380cb5da 100644
--- a/docs/INSTALL.md
+++ b/docs/INSTALL.md
@@ -129,11 +129,11 @@ gbrain autopilot --install # background daemon for nightly enrichment
**Wire this same local brain into your coding agent** — zero server, zero token:
```bash
-claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full # Claude Code
-codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full # Codex
+claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs # Claude Code
+codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs # Codex
```
-The agent spawns `gbrain serve` as a stdio subprocess against your local brain. `--surface full` (what every registration gbrain writes pins) serves every operation, the seven-verb memory protocol ([MEMORY_VERBS v1](protocol/MEMORY_VERBS_v1.md)) included; a harness that caps its tool count can register `--surface starter` (the verbs plus the daily-driver set, 40 ops) or `--surface verbs` (only the seven verbs). Full walkthrough (both this local path and connecting to a remote brain), plus the brain-first protocol to paste into `CLAUDE.md` / `AGENTS.md`: **[Give your coding agent a memory](tutorials/connect-coding-agent.md)**.
+The agent spawns `gbrain serve` as a stdio subprocess against your local brain. `--surface full --advertise verbs` is what every registration gbrain writes: every operation stays callable, and the tool list shows the seven memory verbs ([MEMORY_VERBS v1](protocol/MEMORY_VERBS_v1.md)) plus `request_tools`, which lists the other tools and returns any tool's full schema. Drop `--advertise verbs` to list every operation, or register `--surface starter` (the verbs plus the daily-driver set, 40 ops) or `--surface verbs` (only the seven verbs, nothing else callable). Full walkthrough (both this local path and connecting to a remote brain), plus the brain-first protocol to paste into `CLAUDE.md` / `AGENTS.md`: **[Give your coding agent a memory](tutorials/connect-coding-agent.md)**.
## 3. MCP server (any MCP client)
diff --git a/docs/guides/remote-mcp.md b/docs/guides/remote-mcp.md
index 996803c364..6ce2d1bc90 100644
--- a/docs/guides/remote-mcp.md
+++ b/docs/guides/remote-mcp.md
@@ -32,7 +32,7 @@ in this shape.
## What `gbrain mcp expose` does
```bash
-gbrain mcp expose # tailnet-only, port 3131, full surface, service installed
+gbrain mcp expose # tailnet-only, port 3131, full surface listing the memory verbs, service installed
gbrain mcp expose --funnel # also reachable by cloud agents (public HTTPS)
gbrain mcp expose --dry-run # print the plan, change nothing
```
@@ -83,7 +83,7 @@ alone. Which exit 2 it is matters:
The wrapper reads the admin token from its file at run time, sources your
shell profile and `~/.gbrain/env`, prepends the Bun directory to `PATH`, and
`exec`s `gbrain serve --http --port N --public-url URL [--surface X]
-[--enable-dcr]`. The token never lands in the plist, unit or wrapper.
+[--advertise verbs] [--enable-dcr]`. The token never lands in the plist, unit or wrapper.
Paths above use the default GBrain home. Use the receipt's `admin_token_file`
and `mcp_url` for the intended server, especially with a custom `GBRAIN_HOME`.
@@ -146,7 +146,7 @@ gbrain mcp expose --remove [--yes] [--json]
| --- | --- |
| `--port N` | Local port for `gbrain serve --http` (default `3131`). Tailscale proxies `:443` on your MagicDNS name to it. With `--status` or `--remove` and no receipt, the port whose leftover `:443` handler is looked for and cleaned up. |
| `--funnel` | Public HTTPS via Tailscale Funnel instead of tailnet-only Serve. Required for cloud agents. |
-| `--surface verbs\|starter\|full` | Tool surface of the served MCP server (default `full`, same as `serve --http`). |
+| `--surface verbs\|starter\|full` | Tool surface of the served MCP server, listed in full. Without it the server serves `full` and runs with `--advertise verbs`: clients without their own surface see the seven memory verbs and `request_tools`, and every operation stays callable. An exposure made before this default keeps listing everything when re-run. |
| `--enable-dcr` | Turn on self-service client registration on the served server (off by default; every self-registered connection still stops for your approval in the admin dashboard). |
| `--no-tailscale` | Skip Tailscale entirely: install the service on loopback only, publish nothing. Exclusive with `--funnel`. |
| `--no-service` | Do not create a user service; only publish a server you run yourself. Also the way to publish from a host with no brain config (`no_brain_config`). |
@@ -157,7 +157,7 @@ gbrain mcp expose --remove [--yes] [--json]
| `--json` | One JSON document on stdout: `{ status, receipt, checks: [{name, status, detail}], next_actions, reason?, message? }`; prose goes to stderr. |
`--status` and `--remove` are exclusive with each other. Defaults: port
-3131, tailnet-only, `--surface full`, DCR off, service installed whenever a
+3131, tailnet-only, `--surface full` listing the memory verbs (`--advertise verbs`), DCR off, service installed whenever a
supervisor exists.
### `--status`
diff --git a/docs/guides/setup.md b/docs/guides/setup.md
index 407a5644c6..e48000d4b0 100644
--- a/docs/guides/setup.md
+++ b/docs/guides/setup.md
@@ -23,9 +23,9 @@ Before it writes anything, setup resolves and prints:
|---|---|
| Brain | This install's config (`GBRAIN_HOME`). With none, a new keyless PGLite brain from `gbrain init --pglite --no-embedding`. |
| Source | `--source`, else `GBRAIN_SOURCE`, else unpinned (the server uses the brain's default source). |
-| Transport | Local stdio: the harness starts `<launcher> serve --surface <surface>`. |
+| Transport | Local stdio: the harness starts `<launcher> serve --surface <surface>`, plus `--advertise verbs` on a new registration that chose no surface. |
| Launcher | `--gbrain-bin`, else the absolute `gbrain` on `PATH` (GUI-launched hosts inherit no `PATH`, so a bare name is never written). |
-| Surface | `--surface`, else `GBRAIN_SURFACE`, else the surface already registered, else `full`. |
+| Surface | `--surface`, else `GBRAIN_SURFACE`, else the surface already registered, else `full`. A chosen surface is listed in full. A new registration that chose none serves `full` and lists only the seven memory verbs and `request_tools` (`--advertise verbs`); every operation stays callable and `request_tools` returns any tool's schema. An existing registration keeps its listing. |
| Owner | Who owns the MCP name now: nobody, this setup (its receipt), or the gbrain Claude Code or Codex plugin (setup then adds hooks only). |
It refuses with a coded error, before any write, when the target is not safe:
diff --git a/docs/mcp/CLAUDE_CODE.md b/docs/mcp/CLAUDE_CODE.md
index b7a4b05d0e..455cce63fc 100644
--- a/docs/mcp/CLAUDE_CODE.md
+++ b/docs/mcp/CLAUDE_CODE.md
@@ -69,7 +69,7 @@ tools use the plugin lane's own approval flow.
## Option 1: Local (recommended, zero server needed)
```bash
-claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full
+claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
That's it. Claude Code spawns `gbrain serve` as a stdio subprocess. No server, no
diff --git a/docs/mcp/CODEX.md b/docs/mcp/CODEX.md
index 08c864280f..019cba9d20 100644
--- a/docs/mcp/CODEX.md
+++ b/docs/mcp/CODEX.md
@@ -227,7 +227,7 @@ codex mcp remove gbrain
- The token is a long-lived, full-access secret. Keep `GBRAIN_REMOTE_TOKEN` out of
version control and prefer a scoped token if your host supports one.
- Local stdio also works if you run the brain on the same machine:
- `codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full` — the
+ `codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs` — the
whole operation catalog, memory verbs ([MEMORY_VERBS v1](../protocol/MEMORY_VERBS_v1.md))
included, the surface every registration gbrain writes pins. A
`GBRAIN_SURFACE` value in the Codex server entry's `env` table overrides the
diff --git a/docs/mcp/GROK.md b/docs/mcp/GROK.md
index 1609b04019..d3911096b7 100644
--- a/docs/mcp/GROK.md
+++ b/docs/mcp/GROK.md
@@ -18,7 +18,7 @@ tunnel, no token needed. Works with both PGLite and Supabase engines.
## Register (recommended)
```bash
-grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full
+grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
`--surface full` serves the whole operation catalog, the seven-verb memory
diff --git a/docs/mcp/HERMES.md b/docs/mcp/HERMES.md
index 635deea025..6af91d54d6 100644
--- a/docs/mcp/HERMES.md
+++ b/docs/mcp/HERMES.md
@@ -11,9 +11,14 @@ no token needed. Works with both PGLite and Supabase engines.
## Register (recommended)
```bash
-printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve
+printf 'Y\n' | hermes mcp add gbrain --env GBRAIN_HOME=$HOME --connect-timeout 60 --command $(which gbrain) --args serve --surface full --advertise verbs
```
+The tool list shows the seven memory verbs (`recall`, `remember`, `entity`, …)
+plus `request_tools`; every other operation stays callable, and `request_tools`
+lists it and returns its schema. Drop `--advertise verbs` to list every
+operation.
+
`hermes mcp add` performs a real MCP handshake and tool discovery at add time,
then prompts `Enable all N tools? [Y/n/select]:`. Three gotchas, all observed:
@@ -41,6 +46,10 @@ mcp_servers:
command: gbrain
args:
- serve
+ - --surface
+ - full
+ - --advertise
+ - verbs
env:
GBRAIN_HOME: /home/alice-example
connect_timeout: 60.0
diff --git a/docs/mcp/OPENCLAW.md b/docs/mcp/OPENCLAW.md
index 3680eab69d..208c9bf708 100644
--- a/docs/mcp/OPENCLAW.md
+++ b/docs/mcp/OPENCLAW.md
@@ -55,17 +55,18 @@ OpenClaw keeps MCP servers under `mcp.servers` in `~/.openclaw/openclaw.json`
(`openclaw config schema` shows the key path). Register gbrain with the CLI:
```bash
-openclaw mcp add gbrain --command "$(command -v gbrain)" --arg serve --env GBRAIN_HOME=$HOME
+openclaw mcp add gbrain --command "$(command -v gbrain)" --arg serve --arg --surface --arg full --arg --advertise --arg verbs --env GBRAIN_HOME=$HOME
```
Use an absolute `--command` path: the launchd-started gateway's `PATH` does
not include `~/.bun/bin`, so a bare `gbrain` fails to spawn. `--env` is
optional: a PGLite brain needs no `DATABASE_URL`
(`--env DATABASE_URL=postgresql://...` for Postgres), and `GBRAIN_HOME` only
-matters when the brain home isn't `~/.gbrain`. For the seven-verb memory
-protocol ([MEMORY_VERBS v1](../protocol/MEMORY_VERBS_v1.md)) instead of the
-full operation catalog, pass `--surface verbs` as additional `--arg` values
-(check `openclaw mcp add --help` for your version's spelling).
+matters when the brain home isn't `~/.gbrain`. `--surface full --advertise verbs`
+lists the seven-verb memory protocol ([MEMORY_VERBS v1](../protocol/MEMORY_VERBS_v1.md))
+plus `request_tools` and keeps every operation callable; drop the
+`--advertise verbs` values to list the full catalog (check
+`openclaw mcp add --help` for your version's `--arg` spelling).
Leave `GBRAIN_SOURCE` unset in the MCP env unless you deliberately want
single-source retrieval: a pin scopes every tool (search, `get_brain_identity`
diff --git a/docs/mcp/OPENCODE.md b/docs/mcp/OPENCODE.md
index 523418d1e3..9b72b1da72 100644
--- a/docs/mcp/OPENCODE.md
+++ b/docs/mcp/OPENCODE.md
@@ -21,7 +21,7 @@ brain contract loads with zero extra configuration.
## Register (recommended)
```bash
-opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full
+opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
`--surface full` serves the whole operation catalog, the seven-verb memory
diff --git a/docs/protocol/MEMORY_VERBS_v1.md b/docs/protocol/MEMORY_VERBS_v1.md
index cd9d3682ed..fe383bc22d 100644
--- a/docs/protocol/MEMORY_VERBS_v1.md
+++ b/docs/protocol/MEMORY_VERBS_v1.md
@@ -49,7 +49,7 @@ the same registry.
```bash
gbrain init --pglite # 2-second local brain
-claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full # every operation, the verbs included
+claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs # lists the verbs; every operation stays callable
gbrain remember "gbrain install check" --provenance install-check
gbrain recall --query "gbrain install check" # …now ask your agent in a NEW session
```
@@ -64,24 +64,30 @@ If `claude` is not found: install Claude Code first, or use a block below.
**Codex**
```bash
-codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full
+codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
**Grok Build** (verify with `grok mcp doctor gbrain` — the add is lazy)
```bash
-grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full
+grok mcp add gbrain -e "GBRAIN_HOME=$HOME" -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
**opencode** (verify with `opencode mcp list` — the add is lazy, and list SPAWNS the server)
```bash
-opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full
+opencode mcp add gbrain --env GBRAIN_HOME=$HOME -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
**OpenClaw / any stdio MCP host** — register the server command
-`gbrain serve --surface full`. Remote brains: `gbrain serve --http` on the
+`gbrain serve --surface full --advertise verbs`. Remote brains: `gbrain serve --http` on the
host, then `gbrain connect https://host/mcp --token gbrain_xxx --install` on
each client.
+**Listing:** `--advertise verbs` (what gbrain's own registrations write)
+shows the seven verbs plus `request_tools` in tools/list while everything
+`--surface` allows stays callable; `request_tools` lists the rest and returns
+full schemas, and a tool it describes joins the session's list. An explicit
+`--surface` without `--advertise` lists that whole surface.
+
**Surface modes:** `--surface verbs` exposes EXACTLY the seven verbs —
advertised list AND dispatch are filtered fail-closed (a hidden op returns
`unknown_tool` even when called by name). `--surface starter` exposes the
diff --git a/docs/tutorials/connect-coding-agent.md b/docs/tutorials/connect-coding-agent.md
index fad913c084..a7f01f6340 100644
--- a/docs/tutorials/connect-coding-agent.md
+++ b/docs/tutorials/connect-coding-agent.md
@@ -83,10 +83,10 @@ Configure the agent you are using:
```bash
# Claude Code
-claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full
+claude mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs
# Codex
-codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full
+codex mcp add gbrain -- "$(command -v gbrain)" serve --surface full --advertise verbs
```
These launch a local stdio MCP process. Use the same intended brain and source
diff --git a/src/cli/help/serve.ts b/src/cli/help/serve.ts
index 3282834200..672f87c15e 100644
--- a/src/cli/help/serve.ts
+++ b/src/cli/help/serve.ts
@@ -4,12 +4,13 @@ import type { CliHelpSpec } from '../command-table.ts';
export const help: CliHelpSpec = {
summary: 'Run the MCP server: stdio by default, or OAuth 2.1 HTTP with --http.',
usage: [
- 'gbrain serve [--surface verbs|starter|full] [--access full|read-only] [--source-guard] [--stdio-idle-timeout <s>] [--fail-fast] [--cli-socket]',
- 'gbrain serve --http [--port <n>] [--bind <host>] [--public-url <url>] [--token-ttl <s>] [--enable-dcr] [--surface …]',
+ 'gbrain serve [--surface verbs|starter|full] [--advertise verbs|starter|full] [--access full|read-only] [--source-guard] [--stdio-idle-timeout <s>] [--fail-fast] [--cli-socket]',
+ 'gbrain serve --http [--port <n>] [--bind <host>] [--public-url <url>] [--token-ttl <s>] [--enable-dcr] [--surface …] [--advertise …]',
].join('\n'),
flags: [
{ name: '--http', type: 'boolean', desc: 'Serve over HTTP with OAuth 2.1, the admin dashboard and per-token scopes.' },
{ name: '--surface', type: 'enum', values: ['verbs', 'starter', 'full'], desc: 'Tool surface: the 7 memory verbs, the daily-driver ops, or every operation. stdio: env GBRAIN_SURFACE > --surface > config mcp_surface > full; --http ignores GBRAIN_SURFACE.' },
+ { name: '--advertise', type: 'enum', values: ['verbs', 'starter', 'full'], desc: 'The tools tools/list shows, narrower than --surface; every tool --surface allows stays callable and request_tools (always listed) describes the rest. Overrides config mcp.advertised_surface. Registrations gbrain writes pass --advertise verbs.' },
{ name: '--access', type: 'enum', values: ['full', 'read-only'], desc: 'stdio only: read-only exposes read-scoped, non-mutating operations.' },
{ name: '--source-guard', type: 'boolean', desc: 'stdio only: refuse writes unless the source binding is deliberate or unambiguous.' },
{ name: '--stdio-idle-timeout', type: 'number', desc: 'stdio only: exit after this many idle seconds (0 = never).' },
diff --git a/src/cli/top-help.ts b/src/cli/top-help.ts
index 6aa1429e00..a8535c4a02 100644
--- a/src/cli/top-help.ts
+++ b/src/cli/top-help.ts
@@ -206,6 +206,8 @@ ADMIN
--surface verbs|starter|full Tool surface: the 7 memory verbs, the ~20-op
starter set, or every op (default full).
On --http this is the per-client CEILING.
+ --advertise verbs|starter|full List only this surface in tools/list (plus
+ request_tools); the rest stays callable.
--access read-only|full stdio: list and dispatch only read operations
serve --http [--port N] HTTP MCP server with OAuth 2.1
--token-ttl N Access token TTL in seconds, 60-7776000 (default: 3600)
diff --git a/src/commands/bootstrap.ts b/src/commands/bootstrap.ts
index bafff61013..862e50565d 100644
--- a/src/commands/bootstrap.ts
+++ b/src/commands/bootstrap.ts
@@ -64,7 +64,7 @@ import {
removeClaudeHooks,
} from '../core/bootstrap/hooks.ts';
import { removeCodexHooks, writeCodexHooks } from '../core/bootstrap/codex-hooks.ts';
-import { isRegistrationSurface, registeredSurface, stdioServeArgv } from '../core/mcp-registration.ts';
+import { isRegistrationSurface, registeredAdvertise, registeredSurface, registrationAdvertise, stdioServeArgv } from '../core/mcp-registration.ts';
import type { McpSurface } from '../mcp/surface.ts';
import {
guardReceiptOverwrite,
@@ -397,7 +397,7 @@ async function verifyMcpTargetsWorkspace(
name: string,
gbrainBin: string,
sourceId: string,
-): Promise<{ verdict: 'match' | 'mismatch' | 'unknown'; surface?: McpSurface | null }> {
+): Promise<{ verdict: 'match' | 'mismatch' | 'unknown'; surface?: McpSurface | null; advertise?: McpSurface | null }> {
// Exec-lane harnesses only. opencode registrations go through the direct
// JSONC writer whose 4-state fingerprint IS the [FIX7] check (structural,
// no exec) — it never routes here; 'unknown' keeps a stray call honest.
@@ -419,7 +419,7 @@ async function verifyMcpTargetsWorkspace(
if (out.trim() === '') return { verdict: 'unknown' };
const hasBin = out.includes(gbrainBin);
const hasSource = out.includes(`GBRAIN_SOURCE=${sourceId}`);
- return { verdict: hasBin && hasSource ? 'match' : 'mismatch', surface: registeredSurface(out) };
+ return { verdict: hasBin && hasSource ? 'match' : 'mismatch', surface: registeredSurface(out), advertise: registeredAdvertise(out) };
}
/** Wall-clock cap on the best-effort `opencode mcp list` probe: `mcp list`
@@ -1284,7 +1284,7 @@ async function runHooks(
// no absolute machine paths in a file that travels, and no fail-open
// analog exists — the sharing warning below is the mitigation).
const configPath = mcpScope === 'project' ? opencodeProjectConfigPath(ws) : opencodeGlobalConfigPath();
- const command = stdioServeArgv(mcpScope === 'project' ? 'gbrain' : gbrainBin, surfaceFlag ?? undefined);
+ const command = stdioServeArgv(mcpScope === 'project' ? 'gbrain' : gbrainBin, surfaceFlag ?? undefined, registrationAdvertise({ userChoseSurface: surfaceFlag !== null }));
const entry = {
kind: 'local' as const,
name: 'gbrain',
@@ -1315,7 +1315,7 @@ async function runHooks(
const existingKind = opencodeEntryKind(existing, 'gbrain', { sourceId });
const priorCommand = ((existing.mcp as Record<string, { command?: unknown }> | undefined)?.gbrain)?.command;
const prior = existingKind !== 'absent' && !surfaceFlag && Array.isArray(priorCommand) ? registeredSurface(priorCommand.join(' ')) : undefined;
- if (prior !== undefined) entry.command = stdioServeArgv(command[0], prior);
+ if (prior !== undefined) entry.command = stdioServeArgv(command[0], prior, registeredAdvertise((priorCommand as unknown[]).join(' ')));
if (existingKind === 'ours-other-source') {
console.error(`existing 'gbrain' opencode entry targets a DIFFERENT workspace — replacing it.`);
}
@@ -1436,10 +1436,10 @@ async function runHooks(
'workspace-bound registration with `--mcp-even-if-plugin`.',
);
}
- const buildArgvs = (surface?: McpSurface | null) => harness === 'claude-code'
- ? registerClaudeMcp({ gbrainBin, scope: mcpScope, sourceId, surface, ...(gbrainHome ? { gbrainHome } : {}) })
- : registerCodexMcp({ gbrainBin, sourceId, surface, ...(gbrainHome ? { gbrainHome } : {}) });
- const argvs = mcpPluginOwned ? [] : buildArgvs(surfaceFlag ?? undefined);
+ const buildArgvs = (surface?: McpSurface | null, advertise?: McpSurface | null) => harness === 'claude-code'
+ ? registerClaudeMcp({ gbrainBin, scope: mcpScope, sourceId, surface, advertise, ...(gbrainHome ? { gbrainHome } : {}) })
+ : registerCodexMcp({ gbrainBin, sourceId, surface, advertise, ...(gbrainHome ? { gbrainHome } : {}) });
+ const argvs = mcpPluginOwned ? [] : buildArgvs(surfaceFlag ?? undefined, registrationAdvertise({ userChoseSurface: surfaceFlag !== null }));
for (const argv of argvs) {
const mcpName = argv[3] ?? 'gbrain'; // ['<host>','mcp','add',<name>,…]
const res = await runner(argv);
@@ -1461,7 +1461,7 @@ async function runHooks(
// [FIX7] "already registered" is NOT proof the registration is OURS.
// Verify it targets this workspace's serve; if it points elsewhere,
// remove + re-add rather than blessing a foreign/stale registration.
- const { verdict, surface: priorSurface } = await verifyMcpTargetsWorkspace(runner, harness, mcpName, gbrainBin, sourceId);
+ const { verdict, surface: priorSurface, advertise: priorAdvertise } = await verifyMcpTargetsWorkspace(runner, harness, mcpName, gbrainBin, sourceId);
if (verdict === 'match') {
console.log('MCP server already registered for this workspace — kept.');
} else if (verdict === 'mismatch') {
@@ -1487,7 +1487,7 @@ async function runHooks(
);
return 1;
}
- const re = await runner(surfaceFlag || priorSurface === undefined ? argv : buildArgvs(priorSurface)[0]);
+ const re = await runner(surfaceFlag || priorSurface === undefined ? argv : buildArgvs(priorSurface, priorAdvertise)[0]);
if (re.code !== 0 && !/already exists|already registered/i.test(re.stderr + re.stdout)) {
console.error(`MCP re-registration failed (${argv.join(' ')}): ${re.stderr.trim() || `exit ${re.code}`}`);
return 1;
diff --git a/src/commands/init-first-run.ts b/src/commands/init-first-run.ts
index 30f667eee2..96cd0fb090 100644
--- a/src/commands/init-first-run.ts
+++ b/src/commands/init-first-run.ts
@@ -168,8 +168,8 @@ export function firstRunJson(bundle: Notice[]): { notices?: unknown[]; contract_
/**
* The harness registration line for init's quickstart: the readiness
- * `harness_wiring` fix (absolute binary, `--surface full` unless
- * `gbrain init --surface` names another) for the detected harness, else the
+ * `harness_wiring` fix (absolute binary, `--surface full --advertise verbs`
+ * unless `gbrain init --surface` names another) for the detected harness, else the
* Claude Code registration built the same way. Null when the gbrain binary
* has no absolute path (never registered bare).
*/
diff --git a/src/commands/init.ts b/src/commands/init.ts
index c88f88e427..9526125acc 100644
--- a/src/commands/init.ts
+++ b/src/commands/init.ts
@@ -1860,7 +1860,8 @@ OPTIONS
--chat-model <PROVIDER:MODEL>
Default subagent driver (v0.27+)
--no-embedding Defer embedding setup (skips the embedding-key check)
- --surface <verbs|starter|full> Tool surface the printed harness registration pins (default full)
+ --surface <verbs|starter|full> Tool surface the printed harness registration pins, listed in full
+ (default: full, listing the memory verbs and request_tools)
--search-mode <conservative|balanced|tokenmax> Record the operator's search mode (no first-run ask; an existing brain's mode needs --force)
--skip-embed-check Skip the init-time embedding-key validation (config +
live test-embed). Also via GBRAIN_INIT_SKIP_EMBED_CHECK=1
diff --git a/src/commands/mcp-expose.ts b/src/commands/mcp-expose.ts
index f3134369f7..ffbbc5b8ae 100644
--- a/src/commands/mcp-expose.ts
+++ b/src/commands/mcp-expose.ts
@@ -47,7 +47,7 @@ import {
SERVE_LAUNCHD_LABEL, SERVE_SYSTEMD_UNIT, uninstallServeService, wrapperPath as wrapperPathFor, writeExposeReceipt,
type ExposeReceipt, type ServiceState, type ServiceTarget, type UninstallServiceResult,
} from '../core/serve-service.ts';
-import { shellQuote } from '../core/mcp-registration.ts';
+import { registrationAdvertise, shellQuote } from '../core/mcp-registration.ts';
import { cliRenderContext, renderNotice } from '../core/agent-output.ts';
import { EXPOSE_FRICTION_REASONS, hostedOptionLine, hostedOptionMuted, hostedOptionNotice } from '../core/onboard/hosted-option.ts';
@@ -67,7 +67,9 @@ node attribute) enabled — otherwise exit 2 with the admin URL to fix it.
--port N Local port for the gbrain HTTP server (default: 3131)
--funnel Publish on the public internet via Tailscale Funnel (cloud agents:
Grok Bot, Muse, ChatGPT). Default is tailnet-only — your own devices.
---surface X MCP tool surface: verbs | starter | full (default: full)
+--surface X MCP tool surface: verbs | starter | full, listed in full (default: full,
+ listing the memory verbs and request_tools; an earlier exposure
+ keeps its listing)
--enable-dcr Allow OAuth Dynamic Client Registration on the server
--no-tailscale Skip every Tailscale step (you publish the port yourself)
--no-service Publish only; do not install or start the user service
@@ -257,6 +259,8 @@ export interface ExposeOptions {
port: number;
funnel: boolean;
surface: Surface;
+ /** --surface was passed: that surface is listed in full (no --advertise). */
+ surfaceChosen: boolean;
enableDcr: boolean;
noTailscale: boolean;
noService: boolean;
@@ -287,6 +291,7 @@ export function parseExposeArgs(args: string[]): ExposeOptions {
port,
funnel: args.includes('--funnel'),
surface: (rawSurface as Surface | undefined) ?? 'full',
+ surfaceChosen: rawSurface !== undefined,
enableDcr: args.includes('--enable-dcr'),
noTailscale: args.includes('--no-tailscale'),
noService: args.includes('--no-service'),
@@ -618,6 +623,7 @@ async function runPublish(d: Resolved, s: Session, opts: ExposeOptions): Promise
const engine = engineKind(cfg);
const receiptPath = receiptPathFor(d.serveDir);
const existing = readExposeReceipt(receiptPath);
+ const advertise = registrationAdvertise({ userChoseSurface: opts.surfaceChosen, prior: existing });
const tailscaleBinary = opts.noTailscale ? null : findTailscaleBinary({ which: d.which, fileExists: d.fileExists });
const hasBrew = !!d.which('brew');
const installPlan = tailscaleInstallPlan(d.platform, hasBrew);
@@ -632,7 +638,7 @@ async function runPublish(d: Resolved, s: Session, opts: ExposeOptions): Promise
// mapping stays live and unfindable. Refused before consent; `--remove` first.
const tailscaleReceipt = opts.noTailscale && existing?.tailscale.dns_name ? existing : null;
const plan: string[] = [];
- plan.push(`Server gbrain serve (HTTP) on 127.0.0.1:${opts.port} (surface ${opts.surface}${opts.enableDcr ? ', DCR on' : ''}); engine ${engine}`);
+ plan.push(`Server gbrain serve (HTTP) on 127.0.0.1:${opts.port} (surface ${opts.surface}${advertise ? `, listing ${advertise === 'verbs' ? 'the memory verbs and request_tools' : advertise}` : ''}${opts.enableDcr ? ', DCR on' : ''}); engine ${engine}`);
if (tailscaleReceipt) plan.push(`Tailscale ${opts.dryRun ? 'WOULD BE REFUSED' : 'REFUSED'} (--no-tailscale): this brain is already published on your tailnet at ${tailscaleReceipt.public_url} — run \`gbrain mcp expose --remove --yes\` first, or re-run without --no-tailscale`);
else if (opts.noTailscale) plan.push('Tailscale skipped (--no-tailscale): you publish the port yourself');
else if (tailscaleBinary) plan.push(`Tailscale ${tailscaleBinary} — sign in if needed, then \`tailscale ${tailscaleServeArgv(opts.port, { funnel: opts.funnel }).join(' ')}\``);
@@ -901,6 +907,7 @@ async function runPublish(d: Resolved, s: Session, opts: ExposeOptions): Promise
admin_url: `${publicUrl}/admin`,
mode,
surface: opts.surface,
+ ...(advertise ? { advertise } : {}),
enable_dcr: opts.enableDcr,
tailscale: { binary, dns_name: tsStatus?.dnsName ?? null, tailscale_version: tsStatus?.version ?? null },
service: serviceReceipt,
@@ -928,7 +935,7 @@ async function runPublish(d: Resolved, s: Session, opts: ExposeOptions): Promise
// (a foreign listener was already refused in the plan step, before publishing)
const content = renderServeWrapper({
gbrainCommand: d.gbrainCommand(), adminTokenPath: tokenPath, gbrainEnvFile: d.gbrainEnvFile, gbrainHome: d.env.GBRAIN_HOME,
- runtimeDir: d.runtimeDir, port: opts.port, publicUrl: publicUrl!, surface: opts.surface, enableDcr: opts.enableDcr,
+ runtimeDir: d.runtimeDir, port: opts.port, publicUrl: publicUrl!, surface: opts.surface, advertise, enableDcr: opts.enableDcr,
});
const installed = await installServeService({
target, wrapperPath: wrapper, wrapperContent: content, home: d.home, logPath: serveLogPath(d.serveDir), errPath: serveErrPath(d.serveDir),
@@ -972,7 +979,7 @@ async function runPublish(d: Resolved, s: Session, opts: ExposeOptions): Promise
// 9. verify
if (opts.noService && !listeningBefore && !keptService) {
s.check('verify.local', 'skipped', `--no-service and nothing listens on ${localHealthUrl} yet`);
- s.say(`Nothing listens on 127.0.0.1:${opts.port} yet — start the server: ${['gbrain', ...serveCommandArgv({ port: opts.port, publicUrl: publicUrl!, surface: opts.surface, enableDcr: opts.enableDcr })].join(' ')}`);
+ s.say(`Nothing listens on 127.0.0.1:${opts.port} yet — start the server: ${['gbrain', ...serveCommandArgv({ port: opts.port, publicUrl: publicUrl!, surface: opts.surface, advertise, enableDcr: opts.enableDcr })].join(' ')}`);
} else if (target === 'none' && !opts.noService && !listeningBefore) {
s.check('verify.local', 'skipped', 'manual service: start the wrapper, then run --status');
} else {
@@ -1054,7 +1061,7 @@ function publishFlags(opts: ExposeOptions): string[] {
const parts: string[] = [];
if (opts.port !== DEFAULT_EXPOSE_PORT) parts.push('--port', String(opts.port));
if (opts.funnel) parts.push('--funnel');
- if (opts.surface !== 'full') parts.push('--surface', opts.surface);
+ if (opts.surfaceChosen) parts.push('--surface', opts.surface);
if (opts.enableDcr) parts.push('--enable-dcr');
if (opts.noTailscale) parts.push('--no-tailscale');
if (opts.noService) parts.push('--no-service');
diff --git a/src/commands/serve-http-mcp.ts b/src/commands/serve-http-mcp.ts
index d760c179a6..e4c752622c 100644
--- a/src/commands/serve-http-mcp.ts
+++ b/src/commands/serve-http-mcp.ts
@@ -209,7 +209,7 @@ function createMcpRequestServer(
// F1: the contract for THIS token's callable set + readiness tail, resolved at initialize.
installInstructionsResolver(server, async () => resolveMcpInstructions(config, process.env, {
writeback: writebackOpts,
- tools: await httpInstructionTools(engine, config, { ops: mcpOperations, surface, auth: authInfo, allowedOps: surfaceAllowedOps, cache: ctx.readinessCache }),
+ tools: await httpInstructionTools(engine, config, { ops: mcpOperations, surface, auth: authInfo, allowedOps: surfaceAllowedOps, cache: ctx.readinessCache, advertise: ctx.advertise ?? null }),
...await readInstructionContent(engine),
}));
installCapabilitiesResource(server, async () => {
@@ -246,7 +246,7 @@ async function listMcpTools(ctx: ServeHttpContext, state: McpRequestState) {
const [gateDisabled, strictParamsMode, advertised] = await Promise.all([
disabledOpsForPublishGates(engine, config),
resolveStrictParamsMode(engine, config),
- resolveAdvertisedSurface(engine, config),
+ resolveAdvertisedSurface(engine, config, ctx.advertise ?? null),
]);
// FOV-4: `agent` deliberately implies only itself, which would strand
// agent-only tokens with ZERO discovery — ops flagged `agentCallable`
@@ -416,7 +416,7 @@ async function callMcpTool(ctx: ServeHttpContext, state: McpRequestState, reques
// WP4 (D2): request_tools bounds its catalog + persist by this.
surfaceCeiling,
// D2: a callable tool the advertised surface leaves out of tools/list (same rule as listMcpTools).
- isListed: async op => !!authInfo.surface || advertisedOps([op], surface, await resolveAdvertisedSurface(engine, ctx.config)).length > 0,
+ isListed: async op => !!authInfo.surface || advertisedOps([op], surface, await resolveAdvertisedSurface(engine, ctx.config, ctx.advertise ?? null)).length > 0,
resultRows,
...(thinClient ? { thinClient: true } : {}),
// v0.31 follow-up fix: thread auth so the whoami op (and any
diff --git a/src/commands/serve-http.ts b/src/commands/serve-http.ts
index 3642556d04..ecead26fc4 100644
--- a/src/commands/serve-http.ts
+++ b/src/commands/serve-http.ts
@@ -397,6 +397,8 @@ interface ServeHttpOptions {
* so per-client rows can narrow below it but never widen past it.
*/
surface?: McpSurface;
+ /** --advertise: the surface tools/list shows to clients without their own surface (callable set unchanged). */
+ advertise?: McpSurface;
/**
* #2624: force-print the generated admin bootstrap token even on a
* non-TTY (containerized) start. By default the raw token is only printed
@@ -475,6 +477,8 @@ export interface ServeHttpContext {
logFullParams: boolean | undefined;
/** --surface: the server tool-surface ceiling. */
surface: McpSurface | undefined;
+ /** --advertise: what tools/list shows; null leaves it to mcp.advertised_surface. */
+ advertise?: McpSurface | null;
/** Every non-localOnly operation: the only op list the network surface sees. */
mcpOperationsBase: Operation[];
issuerUrl: URL;
@@ -816,7 +820,7 @@ export async function buildServeHttpApp(app: express.Express, engine: BrainEngin
const requireAdmin = createRequireAdmin(adminSessions);
const { ingestRateLimiter, githubWebhookLimiter } = createWebhookLimiters();
const ctx: ServeHttpContext = {
- noticeLedger: new NoticeLedger(), readinessCache: createReadinessCache(), engine, config, sql, bind, enableDcr, logFullParams, surface: options.surface, mcpOperationsBase,
+ noticeLedger: new NoticeLedger(), readinessCache: createReadinessCache(), engine, config, sql, bind, enableDcr, logFullParams, surface: options.surface, advertise: options.advertise ?? null, mcpOperationsBase,
issuerUrl, mcpResourceUrl, resourceMetadataUrl, oauthProvider, resourceVerifier,
bootstrapHash, adminSessions, adminCookie,
magicLinkNonces: new Map<string, number>(),
diff --git a/src/commands/serve.ts b/src/commands/serve.ts
index 3a191bd538..2960654cd3 100644
--- a/src/commands/serve.ts
+++ b/src/commands/serve.ts
@@ -106,7 +106,7 @@ export interface ServeOptions {
// (which unconditionally attaches a 'data' listener to real
// process.stdin and would pollute the test runner's stdin handle).
// Defaults to the real implementation when omitted.
- startMcpServer?: (engine: BrainEngine, opts?: { surface?: 'verbs' | 'starter' | 'full'; surfaceSource?: 'env' | 'flag' | 'config' | 'default'; invalidSurfaceEnv?: string; sourceGuard?: boolean; onBootPhase?: (phase: string) => void; access?: 'full' | 'read-only' }) => Promise<void>;
+ startMcpServer?: (engine: BrainEngine, opts?: { surface?: 'verbs' | 'starter' | 'full'; surfaceSource?: 'env' | 'flag' | 'config' | 'default'; invalidSurfaceEnv?: string; sourceGuard?: boolean; onBootPhase?: (phase: string) => void; access?: 'full' | 'read-only'; advertise?: 'verbs' | 'starter' | 'full' }) => Promise<void>;
// Test seam for the parent-process watchdog. The default
// (`readLiveParentPid`) reads the live kernel PPID via `ps` on POSIX
// because `process.ppid` is captured at process creation and does not
@@ -250,9 +250,10 @@ export async function runServe(
// ceiling never widens without an explicit --surface restart).
// 'verbs' exposes exactly the seven protocol verbs (the quickstart surface);
// 'starter' the ~20-op daily-driver set; 'full' keeps every operation.
- const { parseSurfaceFlag, resolveSurfaceWithSource, resolveStdioSurface, parseAccessFlag, SURFACE_SOURCE_LABEL } = await import('../mcp/surface.ts');
+ const { parseSurfaceFlag, parseAdvertiseFlag, resolveSurfaceWithSource, resolveStdioSurface, parseAccessFlag, SURFACE_SOURCE_LABEL } = await import('../mcp/surface.ts');
const { loadConfig, MERGED_CONFIG_BY_ENGINE } = await import('../core/config.ts');
const surfaceFlag = parseSurfaceFlag(args);
+ const advertise = parseAdvertiseFlag(args);
const resolved = isHttp ? resolveSurfaceWithSource(surfaceFlag, loadConfig()) : resolveStdioSurface(surfaceFlag, loadConfig());
const surface = resolved.surface;
if (isHttp && process.env.GBRAIN_SURFACE) {
@@ -261,7 +262,7 @@ export async function runServe(
if (resolved.invalidEnv !== undefined) {
console.error(`[gbrain serve] ignoring GBRAIN_SURFACE="${resolved.invalidEnv}" (use verbs | starter | full)`);
}
- console.error(`[gbrain serve] surface=${surface} (source: ${SURFACE_SOURCE_LABEL[resolved.source]})`);
+ console.error(`[gbrain serve] surface=${surface} (source: ${SURFACE_SOURCE_LABEL[resolved.source]})${advertise ? ` advertise=${advertise}` : ''}`);
void (await import('../core/serve-behavior-notice.ts')).logServeBehaviorNotice(engine, loadConfig());
// #6543 (A6): serve's stuck, desync and recovery events go to the pool-recovery audit `doctor --only pool_reap_health` reads.
if (engine.kind === 'postgres') {
@@ -389,7 +390,7 @@ export async function runServe(
const cliSocket = cliSocketOn ? await (await import('../core/cli-socket/server.ts')).startCliSocket(engine, httpLog) : null;
try {
- await runHttp(engine, { port, tokenTtl, enableDcr, enableDcrInsecure, publicUrl, logFullParams, bind, suppressBootstrapToken, printAdminToken, surface, adoptServer: opts.adoptServer });
+ await runHttp(engine, { port, tokenTtl, enableDcr, enableDcrInsecure, publicUrl, logFullParams, bind, suppressBootstrapToken, printAdminToken, surface, ...(advertise ? { advertise } : {}), adoptServer: opts.adoptServer });
} finally {
stallWatchdog?.dispose();
corpusDrain?.cancel();
@@ -467,7 +468,7 @@ export async function runServe(
}
try {
- await start(engine, { surface, surfaceSource: resolved.source, ...(resolved.invalidEnv !== undefined ? { invalidSurfaceEnv: resolved.invalidEnv } : {}), ...(sourceGuard ? { sourceGuard } : {}), onBootPhase: phase => { bootPhase = phase; bootProgressAt = Date.now(); }, ...(access === 'read-only' ? { access } : {}) });
+ await start(engine, { surface, surfaceSource: resolved.source, ...(resolved.invalidEnv !== undefined ? { invalidSurfaceEnv: resolved.invalidEnv } : {}), ...(sourceGuard ? { sourceGuard } : {}), onBootPhase: phase => { bootPhase = phase; bootProgressAt = Date.now(); }, ...(access === 'read-only' ? { access } : {}), ...(advertise ? { advertise } : {}) });
// `--stdio-idle-timeout` arms its timer during lifecycle installation,
// but its stdin activity listener must wait until startMcpServer has
// attached the MCP SDK transport listener. Attaching any `data` listener
diff --git a/src/commands/setup.ts b/src/commands/setup.ts
index 43cf61a904..d443d4426f 100644
--- a/src/commands/setup.ts
+++ b/src/commands/setup.ts
@@ -31,7 +31,7 @@ import { hostedOptionMuted, hostedOptionNotice, writeHostedOption } from '../cor
import { writeJsonDocument } from '../core/cli-force-exit.ts';
import { configDir, gbrainPath, loadConfig, type GBrainConfig } from '../core/config.ts';
import { resolveGbrainBin } from '../core/gbrain-bin.ts';
-import { isRegistrationSurface, isValidName, REGISTRATION_SURFACE } from '../core/mcp-registration.ts';
+import { isRegistrationSurface, isValidName, REGISTRATION_SURFACE, registrationAdvertise, stdioServeArgv } from '../core/mcp-registration.ts';
import { isValidSourceId } from '../core/source-id.ts';
import { peekLock } from '../core/pglite-lock.ts';
import { claudePluginProvidesName, codexPluginProvidesName } from '../core/bootstrap/plugin-lanes.ts';
@@ -89,8 +89,10 @@ and the hook trust entries in $CODEX_HOME/config.toml, the hooks in hooks.json.
Flags:
--dry-run Print the target and every step; write nothing.
--json One JSON document on stdout (target, decisions, steps, states).
- --surface S MCP tool surface: verbs, starter or full (default: GBRAIN_SURFACE,
- then the surface already registered, then full).
+ --surface S MCP tool surface: verbs, starter or full, listed in full (default:
+ GBRAIN_SURFACE, then the registration already there, then full
+ with only the memory verbs and request_tools listed:
+ serve --surface full --advertise verbs).
--scope user|project Wiring scope: every Claude Code session (user, default) or only
sessions in this directory (project: ~/.claude.json projects
entry + .claude/settings.local.json). Codex: user only.
@@ -201,6 +203,7 @@ interface Target {
transport: 'local-stdio';
launcher: string;
surface: McpSurface;
+ advertise?: McpSurface;
registration_owner: 'none' | 'setup' | 'plugin';
live_owner: { pid: number; transport: 'stdio' | 'http'; ours: boolean } | null;
scope: WiringScope;
@@ -247,7 +250,7 @@ function describeTarget(t: Target, out: Out, harness: SetupHarnessId = 'claude-c
say(out, `Target (${HARNESS_LABEL[harness]}, ${t.scope} scope):`);
say(out, ` brain ${brain}`);
say(out, ` source ${t.source.id ? `'${t.source.id}' (pinned, from ${t.source.from === 'flag' ? '--source' : 'GBRAIN_SOURCE'})` : 'the brain\'s default source (unpinned)'}`);
- say(out, ` transport stdio MCP: ${t.launcher} serve --surface ${t.surface}`);
+ say(out, ` transport stdio MCP: ${stdioServeArgv(t.launcher, t.surface, t.advertise ?? null).join(' ')}${t.advertise ? ` (lists the ${t.advertise === 'verbs' ? 'memory verbs and request_tools' : `${t.advertise} tools`}; every ${t.surface} tool stays callable)` : ''}`);
say(out, ` owner ${t.registration_owner === 'setup' ? `this setup (${t.receipt_path})` : t.registration_owner === 'plugin' ? `the gbrain ${HARNESS_LABEL[harness]} plugin (MCP); setup adds hooks only` : `none yet; setup will own '${t.name}'`}`);
if (t.live_owner) say(out, ` live gbrain ${t.live_owner.transport === 'http' ? 'serve --http' : 'stdio serve'} PID ${t.live_owner.pid}${t.live_owner.ours ? ' (started by this registration)' : ''}`);
say(out, ` files ${t.config_path} (MCP${t.hooks_path ? ' + hook trust' : ''}), ${t.hooks_path ?? t.settings_path} (hooks)`);
@@ -327,14 +330,22 @@ export async function runSetup(args: string[]): Promise<number> {
const consent = resolveConsent(flags, prior, cfg, scope, notes);
const envSurface = process.env.GBRAIN_SURFACE;
if (envSurface && !isRegistrationSurface(envSurface)) notes.push(`GBRAIN_SURFACE='${envSurface}' is not verbs, starter or full; ignored.`);
- const surface: McpSurface = flags.surface ?? (isRegistrationSurface(envSurface) ? envSurface : undefined) ?? prior?.surface ?? REGISTRATION_SURFACE;
+ const chosenSurface = flags.surface ?? (isRegistrationSurface(envSurface) ? envSurface : undefined);
+ const surface: McpSurface = chosenSurface ?? prior?.surface ?? REGISTRATION_SURFACE;
+ const advertise = registrationAdvertise({ userChoseSurface: chosenSurface !== undefined, prior });
const sourceId = flags.source ?? (process.env.GBRAIN_SOURCE && isValidSourceId(process.env.GBRAIN_SOURCE) ? process.env.GBRAIN_SOURCE : null);
- const plan: ClaudeSetupPlan = {
+ let plan: ClaudeSetupPlan = {
name: flags.name, scope, ...(projectDir ? { projectDir } : {}), launcher, brainHome,
...(process.env.GBRAIN_HOME?.trim() ? { gbrainHomeEnv: process.env.GBRAIN_HOME.trim() } : {}),
- sourceId, surface, events: hookEvents<ClaudeHookEvent>(consent, 'claude-code'),
+ sourceId, surface, advertise, events: hookEvents<ClaudeHookEvent>(consent, 'claude-code'),
};
- const found = inspectClaudeSetup(plan);
+ let found = inspectClaudeSetup(plan);
+ // An entry identical to setup's own except that it lists everything (the form before the verbs listing default) is kept as it is.
+ if (found.mcp.state === 'unowned' && !prior && chosenSurface === undefined && plan.advertise) {
+ const listed: ClaudeSetupPlan = { ...plan, advertise: null };
+ const again = inspectClaudeSetup(listed);
+ if (again.mcp.state === 'current') { plan = listed; found = again; }
+ }
if (found.mcp.state === 'remote') return refuse(hostedConnection(found.mcp.url ?? 'a hosted brain', true, flags.name), out);
const pluginOwner = flags.name === 'gbrain' ? claudePluginProvidesName(claudeUserSettingsPath(), 'gbrain') : null;
@@ -343,7 +354,7 @@ export async function runSetup(args: string[]): Promise<number> {
brain: !cfg ? { kind: 'new-local-pglite', path: gbrainPath('brain.pglite'), config_dir: brainHome }
: cfg.engine === 'pglite' ? { kind: 'local-pglite', path: dataDir, config_dir: brainHome } : { kind: 'local-postgres', config_dir: brainHome },
source: { id: sourceId, pinned: sourceId !== null, from: flags.source ? 'flag' : sourceId ? 'env' : 'brain-default' },
- transport: 'local-stdio', launcher, surface,
+ transport: 'local-stdio', launcher, surface, ...(plan.advertise ? { advertise: plan.advertise } : {}),
registration_owner: pluginOwner ? 'plugin' : prior ? 'setup' : 'none',
live_owner: liveOwner, scope, name: flags.name,
config_path: found.configPath, settings_path: found.settingsPath, receipt_path: found.receiptPath,
@@ -466,14 +477,21 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainCon
const consent = resolveConsent(flags, prior, cfg, 'user', notes);
const envSurface = process.env.GBRAIN_SURFACE;
if (envSurface && !isRegistrationSurface(envSurface)) notes.push(`GBRAIN_SURFACE='${envSurface}' is not verbs, starter or full; ignored.`);
- const surface: McpSurface = flags.surface ?? (isRegistrationSurface(envSurface) ? envSurface : undefined) ?? prior?.surface ?? REGISTRATION_SURFACE;
+ const chosenSurface = flags.surface ?? (isRegistrationSurface(envSurface) ? envSurface : undefined);
+ const surface: McpSurface = chosenSurface ?? prior?.surface ?? REGISTRATION_SURFACE;
+ const advertise = registrationAdvertise({ userChoseSurface: chosenSurface !== undefined, prior });
const sourceId = flags.source ?? (process.env.GBRAIN_SOURCE && isValidSourceId(process.env.GBRAIN_SOURCE) ? process.env.GBRAIN_SOURCE : null);
- const plan: CodexSetupPlan = {
+ let plan: CodexSetupPlan = {
name: flags.name, launcher, brainHome,
...(process.env.GBRAIN_HOME?.trim() ? { gbrainHomeEnv: process.env.GBRAIN_HOME.trim() } : {}),
- sourceId, surface, events: hookEvents<CodexSetupEvent>(consent, 'codex'),
+ sourceId, surface, advertise, events: hookEvents<CodexSetupEvent>(consent, 'codex'),
};
- const found = inspectCodexSetup(plan);
+ let found = inspectCodexSetup(plan);
+ if (found.mcp.state === 'unowned' && !prior && chosenSurface === undefined && plan.advertise) {
+ const listed: CodexSetupPlan = { ...plan, advertise: null };
+ const again = inspectCodexSetup(listed);
+ if (again.mcp.state === 'current') { plan = listed; found = again; }
+ }
if (found.mcp.state === 'remote') return refuse(hostedConnection(found.mcp.url ?? 'a hosted brain', true, flags.name, 'codex'), out);
const pluginOwner = codexPluginProvidesName(paths.configPath, flags.name);
@@ -482,7 +500,7 @@ async function runCodexSetup(flags: SetupFlags, launcher: string, cfg: GBrainCon
brain: !cfg ? { kind: 'new-local-pglite', path: gbrainPath('brain.pglite'), config_dir: brainHome }
: cfg.engine === 'pglite' ? { kind: 'local-pglite', path: dataDir, config_dir: brainHome } : { kind: 'local-postgres', config_dir: brainHome },
source: { id: sourceId, pinned: sourceId !== null, from: flags.source ? 'flag' : sourceId ? 'env' : 'brain-default' },
- transport: 'local-stdio', launcher, surface,
+ transport: 'local-stdio', launcher, surface, ...(plan.advertise ? { advertise: plan.advertise } : {}),
registration_owner: pluginOwner ? 'plugin' : prior ? 'setup' : 'none',
live_owner: liveOwner, scope: 'user', name: flags.name,
config_path: found.configPath, hooks_path: found.hooksPath, receipt_path: found.receiptPath,
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 632e6cc838..9e68e60586 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -1267,6 +1267,8 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;
{ since: '0.60.448.0', id: 'git_canonical_declared_classes', text: '`gbrain sources git-gap` now declares every page of a source without a checkout `database_only_source` instead of counting it as not compared. On a git-canonical source (`config.canonical = "git"`, off by default and set by nothing yet), private, alias-private and lineage-private pages, `storage.db_only` directories, never-filed derive folders and ignored paths keep no file in Git (no file, no commit, no Git effect), a page turning private is published as the commit that removes its file, and a write that would commit a private page (`git_private_commit_refused`), store an undeclared page without a file (`git_home_required`), commit a file under an LFS rule without `storage.git_lfs` (`git_lfs_not_enabled`) or come from a writer without the git protocol (`git_protocol_required`) is refused.' },
{ since: '0.60.452.0', id: 'starter_tools_list_params_gbra156', text: 'The starter MCP tool list is about 27% smaller: it leaves out parameters MCP callers cannot use (local-only, server-set provenance) and rarely needed ones (legacy, admin, versioned skill catalog, image and code search, tuning and recovery knobs with safe defaults). Every left-out parameter is still accepted, and `request_tools {tools: [names]}` now returns each tool\'s full schema with every optional parameter, also on a server capped at starter. Memory verb descriptions no longer start with `MEMORY VERB (v1):`. The verbs and full surfaces list every parameter as before.' },
{ since: '0.60.452.0', id: 'sources_not_readable_gbra156', text: 'An unscoped `search`, `query`, `recall` or `list_pages` from a token or agent connection with no source grant that comes back empty, while every source it can read holds no page and other sources do, now carries a `sources_not_readable` notice (kind degraded). It says the empty result is not proof of absence, never names a hidden source, and its fix is `gbrain sources federate <source>` on the brain host, or a grant for the token. Granted tokens and OAuth clients never get it.' },
+ // GBRA-199. since: 'TBD' is stamped at the merge slot.
+ { since: 'TBD', id: 'registration_lists_verbs_gbra199', text: 'New MCP registrations gbrain writes now list only the seven memory verbs (`recall`, `remember`, `entity`, …) and `request_tools` in tools/list: `gbrain setup claude-code|codex`, `gbrain bootstrap hooks`, the readiness and `gbrain init` registration lines (`serve --surface full --advertise verbs`) and `gbrain mcp expose` (its `serve --http` runs with `--advertise verbs`, so clients without their own surface see that list). Every operation stays callable, `request_tools` lists the rest and returns any tool\'s full schema, and a tool it describes joins the session\'s list. The initialize instructions follow the listed tools, so they point agents at `recall` instead of `search`. Existing registrations and exposures keep their listing, and an explicit `--surface full` (or starter, or verbs) lists that whole surface. New `gbrain serve --advertise <verbs|starter|full>` sets the listing per server and wins over config `mcp.advertised_surface`; a listing narrower than the callable set now always includes `request_tools`. Plugin manifests, a bare `serve` and grant-profile clients (whose surface is pinned) are unchanged.' },
{ since: '0.60.452.0', id: 'sources_add_federation_warning_gbra156', text: '`gbrain sources add` without `--federated` or `--no-federated` now warns on stderr that the new source is not federated, so a remote token or agent connection with no source grant cannot read its pages, and names `gbrain sources federate <id>` and `gbrain auth rescope --token <name> --sources <id>`. The stored default is still non-federated.' },
];
diff --git a/src/core/bootstrap/hooks.ts b/src/core/bootstrap/hooks.ts
index cac93d4e5c..be3affdb37 100644
--- a/src/core/bootstrap/hooks.ts
+++ b/src/core/bootstrap/hooks.ts
@@ -1120,6 +1120,8 @@ export interface ClaudeMcpRegistration {
gbrainHome?: string;
/** The serve surface; default REGISTRATION_SURFACE, `null` = bare `serve` (never-narrow carry-over). */
surface?: McpSurface | null;
+ /** `serve --advertise`; null lists the whole surface (registrationAdvertise decides). */
+ advertise?: McpSurface | null;
}
export type CodexMcpRegistration = Omit<ClaudeMcpRegistration, 'scope'>;
@@ -1131,9 +1133,10 @@ export type CodexMcpRegistration = Omit<ClaudeMcpRegistration, 'scope'>;
*
* The serve argv comes from `stdioServeArgv`: `--surface full` by default
* (REGISTRATION_SURFACE; bootstrap's contract — put_page, get_page,
- * add_timeline_entry, search, query — is in it, and a pre-existing `mcp_surface: verbs` config row cannot
- * narrow a pinned registration); `surface` carries an existing entry's form
- * over on replacement or applies `--surface`.
+ * add_timeline_entry, search, query — stays callable, and a pre-existing `mcp_surface: verbs` config row cannot
+ * narrow a pinned registration), listing the memory verbs and request_tools
+ * when `advertise` is 'verbs'; `surface`/`advertise` carry an existing
+ * entry's form over on replacement or apply `--surface`.
*/
export function registerClaudeMcp(p: ClaudeMcpRegistration): string[][] {
if (!isAbsolute(p.gbrainBin)) {
@@ -1146,7 +1149,7 @@ export function registerClaudeMcp(p: ClaudeMcpRegistration): string[][] {
'-e', `GBRAIN_SOURCE=${p.sourceId}`,
];
if (p.gbrainHome) argv.push('-e', `GBRAIN_HOME=${p.gbrainHome}`);
- argv.push('--', ...stdioServeArgv(p.gbrainBin, p.surface));
+ argv.push('--', ...stdioServeArgv(p.gbrainBin, p.surface, p.advertise ?? null));
return [argv];
}
@@ -1163,6 +1166,6 @@ export function registerCodexMcp(p: CodexMcpRegistration): string[][] {
const name = p.name ?? 'gbrain';
const argv = ['codex', 'mcp', 'add', name, '--env', `GBRAIN_SOURCE=${p.sourceId}`];
if (p.gbrainHome) argv.push('--env', `GBRAIN_HOME=${p.gbrainHome}`);
- argv.push('--', ...stdioServeArgv(p.gbrainBin, p.surface));
+ argv.push('--', ...stdioServeArgv(p.gbrainBin, p.surface, p.advertise ?? null));
return [argv];
}
diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.ts
index bd3f26a305..e5f42fc8c7 100644
--- a/src/core/cli-flag-registry.generated.ts
+++ b/src/core/cli-flag-registry.generated.ts
@@ -26,7 +26,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'beliefs': ['--apply', '--archived-at', '--brain', '--from-url-env', '--help', '--json', '--probe', '--purge-mirror', '--since', '--source'],
'bench': ['--baseline', '--brain', '--force', '--from', '--help', '--json', '--label', '--limit', '--source', '--threshold-jaccard', '--threshold-latency-multiplier', '--threshold-top1', '--to', '--tool'],
'book-mirror': ['--accept-pending', '--access', '--add', '--all', '--allowed-operations', '--asof', '--author', '--background', '--body', '--bound-slug-prefixes', '--brain', '--chapters-dir', '--client', '--context-file', '--cursor', '--date', '--dated-since', '--days', '--dry-run', '--entities', '--explain', '--federated-read', '--follow', '--from-index', '--full', '--fuzzy', '--group', '--group-by', '--help', '--http', '--id', '--include-deleted', '--json', '--kind', '--limit', '--max-cost', '--max-cost-usd', '--max-turns', '--max-usd', '--model', '--multimodal', '--no-accept-pending', '--no-autopilot-install', '--no-confirm', '--no-follow', '--page', '--params', '--path', '--phase', '--prefer', '--progress-interval', '--progress-json', '--purge', '--quiet', '--recent', '--refresh-operations', '--row', '--scopes', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stale', '--surface', '--timeout', '--timeout-ms', '--timings', '--title', '--to', '--updated-after', '--url', '--wait', '--yes'],
- 'bootstrap': ['--abbrev-ref', '--accept-visibility-change-consequences', '--active', '--add', '--adopt', '--all', '--allow-unverified-remote', '--auto', '--autostash', '--batch-check', '--bearer-token-env-var', '--brain', '--branch', '--cached', '--confirm', '--count', '--delete-brain', '--diff-filter', '--dim', '--dry-run', '--enable', '--env', '--error-unmatch', '--exclude-standard', '--expect-remote', '--ff-only', '--file', '--force', '--gbrain-bin', '--get', '--get-all', '--git-dir', '--git-path', '--hard', '--harness', '--header', '--heads', '--help', '--home', '--hostname', '--http', '--id', '--init', '--install', '--is-inside-work-tree', '--issuer-url', '--jq', '--json', '--keep-checkout', '--local', '--local-env-vars', '--mcp-even-if-plugin', '--mcp-only', '--mcp-url', '--minimal', '--name', '--name-only', '--no-autostash', '--no-capture', '--no-cron', '--no-hooks', '--no-seat', '--no-tags', '--no-verify', '--oauth-client-id', '--oauth-client-secret', '--only', '--operations', '--others', '--pat-file', '--path', '--pglite', '--porcelain', '--port', '--private', '--project', '--pull', '--pure', '--push-only', '--quiet', '--rebase', '--refresh-operations', '--refresh-skills', '--remove', '--repair', '--require-clean', '--resolve', '--scope', '--scopes', '--seat', '--set', '--short', '--show', '--show-toplevel', '--skills', '--skip', '--source', '--sources', '--status', '--surface', '--to', '--token', '--token-name', '--unset-all', '--url', '--verify', '--version', '--visibility', '--workspace', '--yes'],
+ 'bootstrap': ['--abbrev-ref', '--accept-visibility-change-consequences', '--active', '--add', '--adopt', '--advertise', '--all', '--allow-unverified-remote', '--auto', '--autostash', '--batch-check', '--bearer-token-env-var', '--brain', '--branch', '--cached', '--confirm', '--count', '--delete-brain', '--diff-filter', '--dim', '--dry-run', '--enable', '--env', '--error-unmatch', '--exclude-standard', '--expect-remote', '--ff-only', '--file', '--force', '--gbrain-bin', '--get', '--get-all', '--git-dir', '--git-path', '--hard', '--harness', '--header', '--heads', '--help', '--home', '--hostname', '--http', '--id', '--init', '--install', '--is-inside-work-tree', '--issuer-url', '--jq', '--json', '--keep-checkout', '--local', '--local-env-vars', '--mcp-even-if-plugin', '--mcp-only', '--mcp-url', '--minimal', '--name', '--name-only', '--no-autostash', '--no-capture', '--no-cron', '--no-hooks', '--no-seat', '--no-tags', '--no-verify', '--oauth-client-id', '--oauth-client-secret', '--only', '--operations', '--others', '--pat-file', '--path', '--pglite', '--porcelain', '--port', '--private', '--project', '--pull', '--pure', '--push-only', '--quiet', '--rebase', '--refresh-operations', '--refresh-skills', '--remove', '--repair', '--require-clean', '--resolve', '--scope', '--scopes', '--seat', '--set', '--short', '--show', '--show-toplevel', '--skills', '--skip', '--source', '--sources', '--status', '--surface', '--to', '--token', '--token-name', '--unset-all', '--url', '--verify', '--version', '--visibility', '--workspace', '--yes'],
'brainstorm': ['--admin-intent', '--brain', '--confirm-relocated-root', '--dir', '--expected-epoch', '--expected-state', '--force-rechunk', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--manifest', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--max-usd', '--no-save', '--path', '--probe', '--resume', '--save', '--self-transfer', '--source', '--source-id', '--stale', '--strict-budget', '--yes'],
'cache': ['--brain', '--help', '--json', '--source', '--yes'],
'calibration': ['--access', '--add', '--all', '--allowed-operations', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--client', '--cursor', '--date', '--dated-since', '--days', '--dry-run', '--entities', '--federated-read', '--from-index', '--full', '--fuzzy', '--group-by', '--help', '--holder', '--http', '--id', '--include-deleted', '--json', '--key-prefix', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--page', '--params', '--path', '--phase', '--prefer', '--purge', '--recent', '--refresh-operations', '--regenerate', '--row', '--scopes', '--scrub-gstack', '--session', '--since', '--slugs', '--source', '--sources', '--stale', '--surface', '--to', '--undo-wave', '--updated-after', '--url', '--with-calibration', '--yes'],
@@ -42,7 +42,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'code-refs': ['--all-sources', '--brain', '--force', '--help', '--json', '--lang', '--limit', '--no-embed', '--no-json', '--probe', '--source', '--yes'],
'compile-context': ['--brain', '--budget', '--check', '--error-unmatch', '--git-path', '--help', '--include', '--include-core', '--json', '--out', '--remove-core', '--revision', '--show-toplevel', '--source', '--stdout', '--target'],
'config': ['--accept-pending', '--admin-intent', '--all', '--all-from', '--apply', '--background', '--brain', '--budget-ms', '--call-site', '--confirm-quiesced', '--coverage-override', '--dataset', '--db-url', '--diff-filter', '--dim', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--exclude', '--expected-state', '--explain', '--file', '--fix', '--follow', '--force', '--format', '--from', '--full', '--hard-deadline', '--harness', '--help', '--http', '--id', '--include-hidden', '--include-withdrawals', '--input', '--items-out', '--json', '--limit', '--markdown', '--min', '--name-only', '--no-accept-pending', '--no-autopilot-install', '--no-embed', '--no-embedding', '--no-extract', '--no-hard-deadline', '--no-hooks', '--no-llm', '--no-pull', '--no-renames', '--no-schema-pack', '--only', '--out', '--path', '--pattern', '--phase', '--probe', '--progress-interval', '--progress-json', '--provider', '--publish', '--query', '--quiet', '--raw', '--recommended', '--remediate', '--remediation-plan', '--remove', '--repo', '--revision', '--session', '--shadow', '--since', '--slot', '--source', '--src-subpath', '--stale', '--status', '--stdin', '--strategy', '--suite', '--surface', '--target', '--threshold', '--tier', '--timeout', '--timings', '--to', '--url', '--wait', '--what-if-threshold', '--working-tree', '--yes'],
- 'connect': ['--agent', '--auto', '--bearer-token-env-var', '--bind', '--brain', '--client-id', '--client-secret', '--credentials-file', '--env', '--force', '--fresh-token', '--grant-types', '--harness', '--header', '--help', '--http', '--install', '--issuer-url', '--json', '--mcp-only', '--mcp-url', '--name', '--oauth', '--oauth-client-id', '--oauth-client-secret', '--public-url', '--pure', '--register', '--remove', '--root', '--scope', '--scopes', '--show-token', '--source', '--status', '--surface', '--timeout-ms', '--token', '--token-endpoint-auth-method', '--url', '--version', '--yes'],
+ 'connect': ['--advertise', '--agent', '--auto', '--bearer-token-env-var', '--bind', '--brain', '--client-id', '--client-secret', '--credentials-file', '--env', '--force', '--fresh-token', '--grant-types', '--harness', '--header', '--help', '--http', '--install', '--issuer-url', '--json', '--mcp-only', '--mcp-url', '--name', '--oauth', '--oauth-client-id', '--oauth-client-secret', '--public-url', '--pure', '--register', '--remove', '--root', '--scope', '--scopes', '--show-token', '--source', '--status', '--surface', '--timeout-ms', '--token', '--token-endpoint-auth-method', '--url', '--version', '--yes'],
'connectors': ['--accept-pending', '--all', '--background', '--brain', '--cookie', '--deadline', '--dry-run', '--embed', '--explain', '--follow', '--force', '--full', '--help', '--install', '--json', '--limit', '--max-requests', '--no-accept-pending', '--no-browser', '--probe', '--progress-interval', '--progress-json', '--quiet', '--source', '--timeout', '--timings', '--token', '--try-oauth', '--wait', '--window-days', '--workers', '--yes'],
'conversation-parser': ['--brain', '--help', '--json', '--source'],
'core': ['--apply', '--brain', '--fail-fast', '--help', '--include-core', '--json', '--priority', '--revision', '--slug', '--source', '--tools-json'],
@@ -50,7 +50,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'db-repair': ['--accept-pending', '--apply', '--apply-rewrites', '--background', '--brain', '--break-lock', '--db-url', '--dry-run', '--explain', '--filter', '--follow', '--force', '--force-retry', '--format', '--help', '--http', '--json', '--legacy-lock', '--locks', '--name', '--no-accept-pending', '--path', '--prefer-postgres', '--probe', '--progress-interval', '--progress-json', '--quiet', '--remediate', '--restart', '--skip-verify', '--source', '--statement-timeout', '--supabase', '--timeout', '--timings', '--undo-last-rewrite', '--url', '--version', '--wait', '--yes'],
'decide': ['--accept-all', '--all', '--all-from', '--apply', '--brain', '--call-site', '--dataset', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--expect', '--from', '--help', '--include-withdrawals', '--input', '--items-out', '--json', '--kind', '--limit', '--max-cost', '--max-usd', '--min', '--non-interactive', '--out', '--provenance', '--provider', '--query', '--rate', '--reason', '--reason-family', '--recommended', '--remove', '--shadow', '--since', '--slot', '--source', '--status', '--suite', '--target', '--threshold', '--trust', '--undo', '--uri-prefix', '--version', '--what-if-threshold', '--yes'],
'diag': ['--access', '--add', '--all', '--allowed-operations', '--apply', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--budget-ms', '--client', '--count', '--cursor', '--date', '--dated-since', '--days', '--detach', '--entities', '--expect', '--expected-revision', '--federated-read', '--format', '--from-index', '--full', '--fuzzy', '--group-by', '--held', '--help', '--http', '--id', '--include-ambiguous', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--no-pull', '--no-walk', '--only', '--page', '--params', '--path', '--phase', '--prefer', '--preview', '--purge', '--query', '--recent', '--refresh-operations', '--replace', '--restart-only', '--reverse', '--row', '--scopes', '--session', '--side', '--since', '--slug', '--slugs', '--source', '--source-id', '--sources', '--stale', '--state', '--surface', '--to', '--updated-after', '--url', '--yes'],
- 'doctor': ['--abandon', '--abbrev-ref', '--accept-pending', '--access', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--after', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--applied', '--apply', '--apply-rewrites', '--assign-corpus', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catch-up', '--channel', '--check', '--cherry-mark', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--concurrency', '--confidence', '--confirm', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--conversation', '--count', '--cursor', '--dataset', '--day', '--db-url', '--deadline', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--format', '--fresh', '--fresh-token', '--from', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--generation', '--get', '--get-all', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--images', '--include-ambiguous', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--install', '--is-ancestor', '--is-inside-work-tree', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link-source', '--link-type', '--list', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--mcp-only', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--older-than', '--once', '--only', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--preset', '--preview', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--query', '--question', '--queue', '--quiet', '--rate', '--reader-mode', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--resolve', '--restart-only', '--restore-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--run', '--sample', '--save', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--select', '--self-transfer', '--semantic', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skills-dir', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--type', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset-all', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--window', '--workers', '--working-tree', '--workspace', '--write-tree', '--yes'],
+ 'doctor': ['--abandon', '--abbrev-ref', '--accept-pending', '--access', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt', '--adopt-columns', '--adopt-permissions', '--advertise', '--after', '--aggressive', '--aliases', '--all', '--all-drifted', '--all-from', '--allow-old-serve', '--allow-outside-source-root', '--allow-shell-jobs', '--allow-unverified-remote', '--allowed-operations', '--applied', '--apply', '--apply-rewrites', '--assign-corpus', '--audit', '--auto', '--auto-additive', '--auto-fix', '--autostash', '--background', '--batch', '--batch-check', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--cached', '--cacheinfo', '--call-site', '--catch-up', '--channel', '--check', '--cherry-mark', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--concurrency', '--confidence', '--confirm', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--contacts-dir', '--content-audit', '--content-root', '--conversation', '--count', '--cursor', '--dataset', '--day', '--db-url', '--deadline', '--delegated-namespace', '--delegated-slug-prefixes', '--delete-brain', '--dest', '--detach', '--detail', '--diff-filter', '--dim', '--dimensions', '--dir', '--disable', '--drain', '--drain-timeout', '--dry-run', '--egress', '--embedding-dimensions', '--embedding-model', '--enable', '--enable-dcr', '--end-of-options', '--entity', '--env', '--error-unmatch', '--exclude', '--exclude-standard', '--exit-code', '--expand', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--expected-epoch', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--federated', '--federated-read', '--fetch-timeout-ms', '--ff-only', '--file', '--first-parent', '--fix', '--follow', '--force', '--force-break-lock', '--force-rechunk', '--force-remove', '--force-retry', '--force-schema', '--format', '--fresh', '--fresh-token', '--from', '--from-meetings', '--from-pages', '--full', '--full-tree', '--fuzzy', '--generation', '--get', '--get-all', '--get-url', '--git-common-dir', '--git-dir', '--git-path', '--group', '--group-by', '--hard', '--hard-deadline', '--harness', '--held', '--help', '--hold-state', '--holds', '--home', '--http', '--id', '--if-version', '--ignore-env-override', '--images', '--include-ambiguous', '--include-cross-entity', '--include-deleted', '--include-failures', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-pseudo', '--include-repairs', '--include-withdrawals', '--index-audit', '--index-info', '--infer-dates', '--init', '--input', '--install', '--is-ancestor', '--is-inside-work-tree', '--items-out', '--job-isolation', '--jq', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--lang', '--left-right', '--legacy-lock', '--limit', '--link-source', '--link-type', '--list', '--literal-pathspecs', '--local', '--local-env-vars', '--locks', '--log-noop', '--manifest', '--markdown', '--max-cost', '--max-cost-usd', '--max-count', '--max-facts', '--max-jobs', '--max-requests', '--max-rss', '--max-runtime', '--max-usd', '--max-waiting', '--mcp-only', '--merge-base', '--migrate-legacy', '--migrate-only', '--migration', '--min', '--min-n', '--mode', '--model', '--multimodal', '--name', '--name-only', '--name-status', '--nice', '--no-accept-pending', '--no-autopilot-install', '--no-autostash', '--no-capture', '--no-commit-id', '--no-confirm', '--no-cron', '--no-delegate', '--no-edit', '--no-embed', '--no-embed-cache', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-gpg-sign', '--no-hooks', '--no-lanes', '--no-llm', '--no-merges', '--no-migrate', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-seat', '--no-tags', '--no-verify', '--no-walk', '--no-write-fetch-head', '--non-interactive', '--not', '--now', '--older-than', '--once', '--only', '--operations', '--others', '--out', '--output', '--oversized', '--overwrite', '--page', '--parallel', '--params', '--parents', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--path-format', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--port', '--prefer', '--prefer-postgres', '--preset', '--preview', '--probe', '--probe-pglite', '--profile', '--progress-interval', '--progress-json', '--project', '--provenance', '--provider', '--providers', '--prune-orphans', '--public-url', '--pull', '--pure', '--purge', '--push', '--push-only', '--query', '--question', '--queue', '--quiet', '--rate', '--reader-mode', '--reauth', '--rebase', '--rebuild', '--recommended', '--redact-paths', '--reference-date', '--refresh', '--refresh-operations', '--refresh-skills', '--regenerate', '--reissue', '--relative', '--relower', '--remediate', '--remediation-plan', '--remove', '--remove-core', '--repair', '--repair-unknown-markers', '--replace', '--repo', '--request', '--request-id', '--require-clean', '--reranker', '--reset', '--reset-checkpoint', '--reset-default', '--resolve', '--restart-only', '--restore-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--reverse', '--review-lower', '--revision', '--right-only', '--rollback-to-source', '--root', '--run', '--sample', '--save', '--scope', '--scopes', '--search-mode', '--seat', '--section', '--select', '--self-transfer', '--semantic', '--session', '--session-id', '--set', '--set-upstream-to', '--shadow', '--short', '--show-current', '--show-object-format', '--show-prefix', '--show-token', '--show-toplevel', '--side', '--since', '--since-last-run', '--skills-dir', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--skip-verify', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--staged', '--stale', '--stat', '--state', '--statement-timeout', '--status', '--stdin', '--stop-mcp', '--strategy', '--strict', '--suite', '--supabase', '--surface', '--swap-only', '--symbol-kind', '--symbolic-full-name', '--takes-holders', '--target', '--target-score', '--threshold', '--tier', '--timeout', '--timings', '--to', '--token', '--token-ttl', '--top-k', '--topo-order', '--trust', '--type', '--unindexed', '--uninstall', '--unsafe-bypass-dream-guard', '--unset-all', '--untracked-files', '--url', '--url-env', '--user', '--vacuum', '--vectors', '--verbose', '--verify', '--version', '--wait', '--wait-drain', '--warn-only', '--watch', '--what-if-threshold', '--window', '--workers', '--working-tree', '--workspace', '--write-tree', '--yes'],
'dream': ['--audit-rejects', '--brain', '--cancel-unmatched', '--date', '--dir', '--drain', '--dry-run', '--eval-run', '--force', '--from', '--help', '--input', '--install', '--json', '--limit', '--list', '--max-usd', '--once', '--path', '--phase', '--probe', '--pull', '--reconcile-queue', '--since', '--source', '--source-id', '--threshold', '--to', '--unsafe-bypass-dream-guard', '--window', '--yes'],
'edge-proposals': ['--access', '--add', '--all', '--all-applied', '--all-held', '--allowed-operations', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--client', '--cursor', '--date', '--dated-since', '--days', '--entities', '--federated-read', '--from-index', '--full', '--fuzzy', '--group-by', '--help', '--http', '--id', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--page', '--params', '--path', '--phase', '--prefer', '--purge', '--recent', '--refresh-operations', '--row', '--scopes', '--session', '--since', '--slugs', '--source', '--sources', '--stale', '--status', '--surface', '--to', '--updated-after', '--url', '--yes'],
'edges-backfill': ['--all-sources', '--brain', '--concurrency', '--help', '--json', '--max-chunks', '--source', '--workers'],
@@ -76,7 +76,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'graph-query': ['--brain', '--depth', '--direction', '--help', '--hop', '--include-foreign', '--json', '--mcp-only', '--request-id', '--source', '--type'],
'hook': ['--allow-unverified-remote', '--auto', '--batch-check', '--brain', '--branch', '--cached', '--count', '--diff-filter', '--enable', '--end-of-options', '--env', '--get', '--harness', '--help', '--jq', '--json', '--limit', '--name-only', '--others', '--pat-file', '--path', '--porcelain', '--pure', '--quiet', '--remove', '--seat', '--session', '--show-current', '--show-toplevel', '--since', '--source', '--yes'],
'import': ['--accept-pending', '--admin-intent', '--allow-empty', '--allow-noncanonical-root', '--apply', '--background', '--batch-check', '--brain', '--cached', '--confirm-relocated-root', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--expected-epoch', '--expected-state', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--literal-pathspecs', '--log-noop', '--manifest', '--name-only', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-gpg-sign', '--no-pull', '--no-renames', '--no-verify', '--only', '--others', '--path', '--probe', '--progress-interval', '--progress-json', '--quiet', '--self-transfer', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--timings', '--to', '--url', '--verify', '--wait', '--workers'],
- 'init': ['--access', '--acknowledge-managed', '--adopt', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--applied', '--apply', '--assign-corpus', '--audit', '--auto', '--auto-additive', '--background', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--catch-up', '--channel', '--chat-model', '--check', '--class', '--clear-never-installed', '--cli-socket', '--client', '--close', '--confirm-relocated-root', '--conflicts', '--content-root', '--conversation', '--cursor', '--db-only', '--deadline', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--fix', '--force', '--force-retry', '--format', '--fresh-token', '--from', '--from-meetings', '--full', '--git', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-cross-entity', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--install', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--mcp-only', '--mcp-url', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--older-than', '--once', '--only', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--preview', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--query', '--question', '--quiet', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retry-failed', '--retry-parked', '--save', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--self-transfer', '--semantic', '--session', '--session-id', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],
+ 'init': ['--access', '--acknowledge-managed', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--applied', '--apply', '--assign-corpus', '--audit', '--auto', '--auto-additive', '--background', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--catch-up', '--channel', '--chat-model', '--check', '--class', '--clear-never-installed', '--cli-socket', '--client', '--close', '--confirm-relocated-root', '--conflicts', '--content-root', '--conversation', '--cursor', '--db-only', '--deadline', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--fix', '--force', '--force-retry', '--format', '--fresh-token', '--from', '--from-meetings', '--full', '--git', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-cross-entity', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--install', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--mcp-only', '--mcp-url', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--older-than', '--once', '--only', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--preview', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--query', '--question', '--quiet', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retry-failed', '--retry-parked', '--save', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--self-transfer', '--semantic', '--session', '--session-id', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],
'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],
'integrity': ['--accept-pending', '--auto', '--backend', '--background', '--body', '--brain', '--check', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--skip-bare-tweet', '--skip-urls', '--source', '--timeout', '--timings', '--type', '--wait'],
'jobs': ['--abbrev-ref', '--access', '--account', '--acknowledge-managed', '--add', '--admin-intent', '--adopt-slug-path', '--aliases', '--all', '--all-sources', '--allow-empty', '--allow-shell-jobs', '--allowed-operations', '--apply', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--body', '--bound-slug-prefixes', '--brain', '--break-lock', '--budget-ms', '--by-mention', '--cached', '--catch-up', '--channel', '--check', '--cli-path', '--client', '--close', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--confirm-relocated-root', '--cost-estimate', '--cursor', '--date', '--dated-since', '--days', '--delay', '--detach', '--detail', '--diff-filter', '--dir', '--drain', '--drain-timeout', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--enable', '--entities', '--exclude', '--exclude-standard', '--expect', '--expect-local', '--expect-upstream', '--expected-state', '--explain', '--facts', '--federated-read', '--ff-only', '--file', '--filters', '--finished-since', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--format', '--fresh', '--from-index', '--from-meetings', '--full', '--full-history', '--fuzzy', '--git', '--grammar-diagnostics', '--group', '--group-by', '--hard-deadline', '--health-interval', '--held', '--help', '--hold-state', '--http', '--id', '--idempotency-key', '--ids', '--images', '--include-ambiguous', '--include-deleted', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--include-null-signature', '--infer-dates', '--inject-bootstrap', '--inline', '--input', '--install', '--interval', '--is-ancestor', '--is-shallow-repository', '--job-id', '--job-isolation', '--json', '--keep', '--kind', '--lanes', '--legacy-lock', '--limit', '--list', '--local', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--mcp-only', '--migration', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name', '--name-only', '--ner', '--nice', '--no-auto-embed', '--no-autopilot-install', '--no-bulk', '--no-confirm', '--no-delegate', '--no-embed', '--no-embedding', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-lanes', '--no-llm', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-verify', '--no-worker', '--non-interactive', '--now', '--older-than', '--once', '--only', '--order', '--others', '--output', '--override-disabled', '--oversized', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--parked-code', '--pat-file', '--path', '--pause', '--pglite', '--phase', '--pid-file', '--plan', '--port', '--prefer', '--preview', '--priority', '--probe', '--prune-orphans', '--pull', '--purge', '--question', '--queue', '--queue-only', '--quiet', '--rate', '--reason', '--rebuild', '--recent', '--record', '--redact-paths', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--refresh-operations', '--remediate', '--repo', '--request-id', '--reset-checkpoint', '--restart-only', '--resume', '--retry-failed', '--retry-global', '--retry-held', '--retry-parked', '--review-lower', '--row', '--scope', '--scopes', '--section', '--segment-limit', '--select', '--self-transfer', '--serial', '--session', '--show-toplevel', '--side', '--sigkill-rescue', '--since', '--skip', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-guard', '--source-id', '--sources', '--src-subpath', '--stale', '--state', '--statement-timeout', '--status', '--stop-mcp', '--strategy', '--suites', '--surface', '--swap-only', '--target', '--thin', '--thin-threshold', '--tier', '--timeout', '--timeout-ms', '--to', '--token', '--trust', '--type', '--types', '--uninstall', '--updated-after', '--url', '--user', '--vectors', '--verbose', '--verify', '--version', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],
@@ -84,7 +84,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'loops': ['--all', '--as-of', '--brain', '--dry-run', '--fail-fast', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--tools-json', '--top', '--type'],
'lsd': ['--brain', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--max-usd', '--no-save', '--resume', '--save', '--source', '--strict-budget', '--yes'],
'maintain': ['--account', '--admin-intent', '--adopt-columns', '--adopt-permissions', '--after', '--all', '--allow-outside-source-root', '--apply', '--assign-corpus', '--audit', '--background', '--brain', '--break-lock', '--budget-ms', '--by-mention', '--cached', '--catch-up', '--class', '--concurrency', '--conflicts', '--contacts-dir', '--content-audit', '--conversation', '--count', '--detach', '--detail', '--dim', '--dir', '--drain', '--dry-run', '--enable', '--entity', '--expect', '--expected-revision', '--expected-state', '--explain', '--facts', '--fast', '--fix', '--follow', '--force', '--force-retry', '--force-schema', '--format', '--from-meetings', '--full', '--group-by', '--hard-deadline', '--harness', '--held', '--help', '--http', '--id', '--images', '--include-ambiguous', '--include-flagged', '--include-frontmatter', '--include-gitignored', '--include-repairs', '--index-audit', '--infer-dates', '--install', '--json', '--keep-checkout', '--kind', '--lang', '--left-right', '--limit', '--link-source', '--link-type', '--list', '--locks', '--markdown', '--max-cost', '--max-cost-usd', '--max-jobs', '--max-rss', '--max-usd', '--migrate-legacy', '--migrate-only', '--multimodal', '--name', '--name-only', '--ner', '--no-autopilot-install', '--no-capture', '--no-delegate', '--no-embed', '--no-pull', '--no-renames', '--once', '--only', '--operations', '--oversized', '--pack', '--page', '--parallel', '--params', '--path', '--pending', '--pglite', '--phase', '--pid-file', '--plan', '--porcelain', '--prefer', '--preview', '--probe', '--probe-pglite', '--project', '--providers', '--prune-orphans', '--pull', '--push-only', '--query', '--question', '--queue', '--quiet', '--reader-mode', '--reauth', '--rebuild', '--regenerate', '--remediate', '--remediation-plan', '--remove', '--remove-core', '--request-id', '--reset', '--reset-default', '--restart-only', '--resume', '--retry-failed', '--retry-held', '--retry-parked', '--reverse', '--safe', '--scope', '--scopes', '--show-current', '--show-toplevel', '--since', '--skills-dir', '--skip-failed', '--slot', '--slug', '--slugs', '--source', '--source-id', '--sources', '--staged', '--stale', '--stat', '--state', '--status', '--supabase', '--symbol-kind', '--takes-holders', '--target', '--target-score', '--tier', '--to', '--token', '--top-k', '--type', '--unindexed', '--url-env', '--verbose', '--verify', '--version', '--window', '--workers', '--yes'],
- 'mcp': ['--admin-token-file', '--agent', '--arg', '--bearer-token-env-var', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--client', '--credentials-file', '--credentials-out', '--delegate', '--delegated-namespace', '--delegated-slug-prefixes', '--dry-run', '--enable-dcr', '--federated-read', '--flow', '--force', '--funnel', '--harness', '--header', '--help', '--if-version', '--install', '--issuer-url', '--json', '--limit', '--mcp-only', '--mcp-url', '--no-install', '--no-service', '--no-tailscale', '--oauth-client-id', '--oauth-client-secret', '--oauth-request', '--port', '--profile', '--queue', '--redirect-uri', '--remove', '--resume', '--root', '--scope', '--scopes', '--skills', '--source', '--status', '--surface', '--timeout-ms', '--token', '--token-endpoint-auth-method', '--token-ttl', '--url', '--yes'],
+ 'mcp': ['--admin-token-file', '--advertise', '--agent', '--arg', '--bearer-token-env-var', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--client', '--credentials-file', '--credentials-out', '--delegate', '--delegated-namespace', '--delegated-slug-prefixes', '--dry-run', '--enable-dcr', '--federated-read', '--flow', '--force', '--funnel', '--harness', '--header', '--help', '--if-version', '--install', '--issuer-url', '--json', '--limit', '--mcp-only', '--mcp-url', '--no-install', '--no-service', '--no-tailscale', '--oauth-client-id', '--oauth-client-secret', '--oauth-request', '--port', '--profile', '--queue', '--redirect-uri', '--remove', '--resume', '--root', '--scope', '--scopes', '--skills', '--source', '--status', '--surface', '--timeout-ms', '--token', '--token-endpoint-auth-method', '--token-ttl', '--url', '--yes'],
'migrate': ['--accept-pending', '--admin-intent', '--all', '--apply', '--background', '--batch-size', '--brain', '--catch-up', '--dim', '--drain-timeout', '--dry-run', '--embedding-dimensions', '--embedding-model', '--expect', '--expected-epoch', '--expected-state', '--explain', '--facts', '--follow', '--force', '--force-retry', '--harness', '--held', '--help', '--ignore-env-override', '--images', '--include-null-signature', '--json', '--locks', '--manifest', '--max-cost', '--max-cost-usd', '--max-usd', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-migrate', '--non-interactive', '--only', '--oversized', '--pace', '--pace-max-concurrency', '--path', '--pglite', '--plan', '--priority', '--probe', '--progress-interval', '--progress-json', '--quiet', '--replace', '--reranker', '--resume', '--retarget', '--rollback-to-source', '--scope', '--skip-verify', '--slugs', '--source', '--stale', '--statement-timeout', '--status', '--timeout', '--timings', '--to', '--trigger-bypass', '--trust', '--url', '--url-env', '--wait', '--yes'],
'models': ['--batch', '--brain', '--concurrent', '--cycles', '--dim', '--dimensions', '--embedding-dimensions', '--embedding-model', '--help', '--json', '--limit', '--max-tokens', '--max-usd', '--output', '--receipt-dir', '--skip', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--source', '--status', '--task', '--to', '--yes'],
'mounts': ['--alias', '--brain', '--database-path', '--database-url', '--db-path', '--db-url', '--engine', '--help', '--id', '--json', '--mcp-url', '--path', '--skills-dir', '--source'],
@@ -96,7 +96,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'pglite-repair': ['--brain', '--break-lock', '--dry-run', '--expect', '--help', '--http', '--json', '--legacy-lock', '--path', '--probe', '--source', '--vectors', '--yes'],
'post-upgrade': ['--accept-reviewed-inventory', '--acknowledge-no-backup', '--admin-intent', '--all', '--all-applied', '--apply', '--apply-clean-hunks', '--backup-confirmed', '--brain', '--catch-up', '--changed', '--channel', '--check', '--concurrency', '--confirm-quiesced', '--confirm-relocated-root', '--content-root', '--cost-estimate', '--embedding-dimensions', '--embedding-model', '--exit-code', '--expand', '--expected-epoch', '--expected-state', '--explain', '--export-db-only', '--export-source', '--ff-only', '--force', '--force-all', '--force-orchestrator', '--force-retry', '--force-schema', '--format', '--held', '--help', '--host-dir', '--images', '--inject-bootstrap', '--inline', '--install', '--interval', '--is-ancestor', '--json', '--limit', '--list', '--manifest', '--markdown', '--max-rss', '--max-usd', '--migrate-only', '--migration', '--mode', '--multimodal', '--name-only', '--no-autopilot-install', '--no-bun-floor-check', '--no-embed', '--no-expand', '--no-inject', '--no-restart', '--no-worker', '--non-interactive', '--now', '--once', '--only', '--oversized', '--path', '--pause', '--phase', '--quiet', '--reason', '--refs', '--remediation-plan', '--repo', '--require-db', '--restart-only', '--resume', '--retry-global', '--search-mode', '--self-transfer', '--skills-dir', '--skip-verify', '--source', '--stale', '--statement-timeout', '--status', '--stop-mcp', '--swap-only', '--tags', '--target', '--uninstall', '--user', '--value', '--vectors', '--verify', '--version', '--workers', '--yes'],
'pricing': ['--brain', '--help', '--input', '--json', '--max-cost', '--max-runtime', '--output', '--rate', '--source'],
- 'projections': ['--brain', '--dry-run', '--enable-dcr', '--help', '--http', '--images', '--install', '--json', '--limit', '--now', '--only', '--port', '--public-url', '--remove', '--source', '--stale', '--status', '--surface', '--user'],
+ 'projections': ['--advertise', '--brain', '--dry-run', '--enable-dcr', '--help', '--http', '--images', '--install', '--json', '--limit', '--now', '--only', '--port', '--public-url', '--remove', '--source', '--stale', '--status', '--surface', '--user'],
'protocol': ['--access', '--add', '--all', '--allowed-operations', '--asof', '--body', '--bound-slug-prefixes', '--brain', '--client', '--cursor', '--date', '--dated-since', '--days', '--entities', '--federated-read', '--from-index', '--full', '--fuzzy', '--group-by', '--help', '--http', '--id', '--include-deleted', '--json', '--kind', '--limit', '--max-usd', '--model', '--multimodal', '--no-autopilot-install', '--page', '--params', '--path', '--phase', '--prefer', '--provenance', '--purge', '--recent', '--refresh-operations', '--row', '--scopes', '--session', '--since', '--slugs', '--source', '--sources', '--stale', '--surface', '--synthesize', '--target', '--to', '--token', '--updated-after', '--url', '--yes'],
'providers': ['--brain', '--embedding-dimensions', '--embedding-model', '--help', '--json', '--model', '--source', '--status', '--touchpoint'],
'publish': ['--accent', '--bg', '--border', '--brain', '--card-bg', '--code-bg', '--error', '--fg', '--help', '--json', '--link', '--muted', '--out', '--password', '--source', '--title'],
@@ -120,8 +120,8 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'salience': ['--brain', '--days', '--help', '--json', '--kind', '--limit', '--mcp-only', '--request-id', '--slug-prefix', '--source'],
'schema': ['--alias', '--apply', '--as-filing-rules', '--brain', '--dims', '--expert', '--expert-routing', '--extractable', '--fields', '--force', '--help', '--inverse', '--json', '--kind', '--no-prefix', '--pack', '--page-type', '--path', '--prefix', '--primitive', '--schema-pack', '--since', '--source', '--source-id', '--target-type', '--to', '--with-db'],
'self-upgrade': ['--apply', '--brain', '--channel', '--check-only', '--clear-never-installed', '--exit-code', '--ff-only', '--force', '--force-retry', '--help', '--is-ancestor', '--json', '--markdown', '--migrate-only', '--no-autopilot-install', '--no-bun-floor-check', '--no-restart', '--non-interactive', '--quiet', '--refresh-cache', '--refs', '--remediation-plan', '--restart-only', '--source', '--stop-mcp', '--swap-only', '--tags', '--version', '--yes'],
- 'serve': ['--access', '--add', '--adopt-columns', '--adopt-permissions', '--all-new', '--apply-rewrites', '--bind', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--cli-socket', '--client', '--days', '--delegated-namespace', '--delegated-slug-prefixes', '--enable-dcr', '--enable-dcr-insecure', '--expect', '--fail-fast', '--federated-read', '--grant-types', '--harness', '--help', '--http', '--id', '--if-version', '--json', '--log-full-params', '--migrate-legacy', '--min-trust', '--no-embedding', '--no-pull', '--oauth-request', '--only', '--operations', '--path', '--pglite', '--port', '--prefer-postgres', '--print-admin-token', '--profile', '--provenance', '--public-url', '--read-sources', '--redirect-uri', '--refresh-operations', '--repair', '--reset-default', '--retry-failed', '--scopes', '--source', '--source-guard', '--source-id', '--sources', '--stale', '--stdio-idle-timeout', '--suppress-bootstrap-token', '--surface', '--takes-holders', '--token', '--token-endpoint-auth-method', '--token-ttl', '--tools-json', '--url', '--usage', '--yes'],
- 'setup': ['--auto', '--bearer-token-env-var', '--brain', '--break-lock', '--capture', '--dry-run', '--env', '--gbrain-bin', '--harness', '--header', '--help', '--http', '--install', '--issuer-url', '--json', '--legacy-lock', '--mcp-only', '--mcp-url', '--name', '--no-capture', '--no-embedding', '--no-hooks', '--no-providers', '--oauth-client-id', '--oauth-client-secret', '--only', '--path', '--pglite', '--probe', '--providers', '--pure', '--remove', '--save', '--scope', '--source', '--surface', '--token', '--url', '--yes'],
+ 'serve': ['--access', '--add', '--adopt-columns', '--adopt-permissions', '--advertise', '--all-new', '--apply-rewrites', '--bind', '--bound-brain', '--bound-max-concurrent', '--bound-slug-prefixes', '--bound-source', '--bound-tools', '--brain', '--budget-usd-per-day', '--cli-socket', '--client', '--days', '--delegated-namespace', '--delegated-slug-prefixes', '--enable-dcr', '--enable-dcr-insecure', '--expect', '--fail-fast', '--federated-read', '--grant-types', '--harness', '--help', '--http', '--id', '--if-version', '--json', '--log-full-params', '--migrate-legacy', '--min-trust', '--no-embedding', '--no-pull', '--oauth-request', '--only', '--operations', '--path', '--pglite', '--port', '--prefer-postgres', '--print-admin-token', '--profile', '--provenance', '--public-url', '--read-sources', '--redirect-uri', '--refresh-operations', '--repair', '--reset-default', '--retry-failed', '--scopes', '--source', '--source-guard', '--source-id', '--sources', '--stale', '--stdio-idle-timeout', '--suppress-bootstrap-token', '--surface', '--takes-holders', '--token', '--token-endpoint-auth-method', '--token-ttl', '--tools-json', '--url', '--usage', '--yes'],
+ 'setup': ['--advertise', '--auto', '--bearer-token-env-var', '--brain', '--break-lock', '--capture', '--dry-run', '--env', '--gbrain-bin', '--harness', '--header', '--help', '--http', '--install', '--issuer-url', '--json', '--legacy-lock', '--mcp-only', '--mcp-url', '--name', '--no-capture', '--no-embedding', '--no-hooks', '--no-providers', '--oauth-client-id', '--oauth-client-secret', '--only', '--path', '--pglite', '--probe', '--providers', '--pure', '--remove', '--save', '--scope', '--source', '--surface', '--token', '--url', '--yes'],
'skillify': ['--brain', '--description', '--dry-run', '--force', '--help', '--json', '--mutating', '--recent', '--skills-dir', '--source', '--strict', '--triggers', '--writes-pages', '--writes-to'],
'skillopt': ['--all', '--allow-mutate-bundled', '--background', '--batch-size', '--benchmark', '--bootstrap-from-routing', '--bootstrap-from-skill', '--bootstrap-reviewed', '--bootstrap-tasks', '--brain', '--brain-wide-max-cost-usd', '--dry-run', '--epochs', '--follow', '--force', '--held-out', '--help', '--json', '--judge-model', '--lr', '--lr-schedule', '--max-cost-usd', '--max-runtime-min', '--max-usd', '--models-strict', '--no-max-cost', '--no-mutate', '--optimizer-model', '--patch', '--reflect-max-tokens', '--resume', '--rewrite', '--skills-dir', '--source', '--split', '--status', '--target-model', '--target-models'],
'skillpack': ['--all', '--apply-clean-hunks', '--author', '--auto', '--brain', '--dest', '--dry-run', '--env', '--exit-code', '--fast', '--fix', '--force-unlock', '--format', '--from', '--full', '--harness', '--help', '--homepage', '--json', '--license', '--list', '--minimal', '--name-only', '--no-cache', '--no-lint', '--note', '--out', '--overwrite-local', '--persona', '--probe', '--pure', '--push', '--quick', '--quiet', '--refresh', '--repo', '--schema-pack', '--scope', '--short', '--since', '--skill', '--skills', '--skills-dir', '--skip-doctor', '--source', '--strict', '--stub', '--supabase', '--target', '--tier', '--trust', '--url', '--verify', '--version', '--workspace', '--yes'],
diff --git a/src/core/mcp-registration.ts b/src/core/mcp-registration.ts
index 6de0b2e738..665ea77dc4 100644
--- a/src/core/mcp-registration.ts
+++ b/src/core/mcp-registration.ts
@@ -23,18 +23,51 @@ export { shellQuote };
*/
export const REGISTRATION_SURFACE: McpSurface = 'full';
+/**
+ * What a new registration's tools/list shows: the seven memory verbs plus
+ * request_tools (`serve --advertise verbs`). Everything REGISTRATION_SURFACE
+ * allows stays callable, and request_tools returns any tool's full schema.
+ * Approved 2026-10-25 on harness-evals#70: no pass-rate cost, no
+ * cross-scope reads, recall about 3x faster than search. Applies only when
+ * the user chose no surface: an explicit `--surface` or GBRAIN_SURFACE lists
+ * that surface in full, and an existing registration keeps its own form.
+ */
+export const REGISTRATION_ADVERTISE: McpSurface = 'verbs';
+
/** A registration command's surface value (`verbs`, `starter` or `full`). */
export function isRegistrationSurface(v: unknown): v is McpSurface {
return v === 'verbs' || v === 'starter' || v === 'full';
}
+const SURFACE_ORDER: readonly McpSurface[] = ['verbs', 'starter', 'full'];
+
+/**
+ * `<bin> serve --surface <surface> [--advertise <advertise>]`. `null` renders
+ * a bare `<bin> serve` (config/default resolution): never-narrow keeps an
+ * existing bare registration bare when it replaces it. `--advertise` is
+ * written only when it is narrower than the surface.
+ */
+export function stdioServeArgv(bin: string, surface: McpSurface | null = REGISTRATION_SURFACE, advertise: McpSurface | null = null): string[] {
+ if (!surface) return [bin, 'serve'];
+ return [bin, 'serve', '--surface', surface, ...(advertise && SURFACE_ORDER.indexOf(advertise) < SURFACE_ORDER.indexOf(surface) ? ['--advertise', advertise] : [])];
+}
+
/**
- * `<bin> serve --surface <surface>`. `null` renders a bare `<bin> serve`
- * (config/default resolution): never-narrow keeps an existing bare
- * registration bare when it replaces it.
+ * The listing a registration writes. A surface the user chose (flag or
+ * GBRAIN_SURFACE) is listed in full; an existing registration keeps its own
+ * `--advertise` (none on registrations written before this default); a new
+ * registration lists REGISTRATION_ADVERTISE.
*/
-export function stdioServeArgv(bin: string, surface: McpSurface | null = REGISTRATION_SURFACE): string[] {
- return surface ? [bin, 'serve', '--surface', surface] : [bin, 'serve'];
+export function registrationAdvertise(opts: { userChoseSurface: boolean; prior?: { advertise?: McpSurface | null } | null }): McpSurface | null {
+ if (opts.userChoseSurface) return null;
+ if (opts.prior) return opts.prior.advertise ?? null;
+ return REGISTRATION_ADVERTISE;
+}
+
+/** An existing registration's `--advertise` value, `null` when it lists everything it serves. */
+export function registeredAdvertise(text: string): McpSurface | null {
+ const m = /--advertise[\s=]+["']?(verbs|starter|full)\b/.exec(text);
+ return m ? m[1] as McpSurface : null;
}
/**
diff --git a/src/core/readiness.ts b/src/core/readiness.ts
index e621bc5b51..e97c7f79ed 100644
--- a/src/core/readiness.ts
+++ b/src/core/readiness.ts
@@ -25,7 +25,7 @@
*/
import type { GBrainConfig } from './config.ts';
import type { McpSurface } from '../mcp/surface.ts';
-import { REGISTRATION_SURFACE, stdioServeArgv } from './mcp-registration.ts';
+import { REGISTRATION_SURFACE, registrationAdvertise, stdioServeArgv } from './mcp-registration.ts';
import { gbrainPath } from './config.ts';
import type { BrainEngine } from './engine.ts';
import { redactForTransport, type Action, type ActionInput, type Effect, type Transport } from './agent-output.ts';
@@ -411,15 +411,17 @@ const SURFACE_GLOSS: Record<McpSurface, string> = {
full: 'every operation',
};
-function stdioRegistration(h: ReadinessHarness, bin: string, surface: McpSurface = REGISTRATION_SURFACE): Action {
- const serve = stdioServeArgv(bin, surface);
+function stdioRegistration(h: ReadinessHarness, bin: string, chosen?: McpSurface): Action {
+ const surface = chosen ?? REGISTRATION_SURFACE;
+ const advertise = registrationAdvertise({ userChoseSurface: chosen !== undefined });
+ const serve = stdioServeArgv(bin, surface, advertise);
const argv = h === 'claude-code' ? ['claude', 'mcp', 'add', 'gbrain', '--', ...serve]
: h === 'codex' ? ['codex', 'mcp', 'add', 'gbrain', '--', ...serve]
- : ['gbrain', 'bootstrap', 'hooks', '--harness', 'opencode', '--no-hooks', ...(surface === REGISTRATION_SURFACE ? [] : ['--surface', surface])];
+ : ['gbrain', 'bootstrap', 'hooks', '--harness', 'opencode', '--no-hooks', ...(chosen ? ['--surface', chosen] : [])];
const hooks = h === 'opencode' ? ' No lifecycle hooks are installed (--no-hooks); it must run inside an initialized agent workspace.' : ' No hooks, tool pre-approvals or tokens are added.';
return {
argv, consent: ['persistent_install'], actor: 'agent', requires_exclusive: false,
- why: `Registers gbrain as a stdio MCP server (${serve.join(' ')}, ${SURFACE_GLOSS[surface]}) in ${HARNESS_DESTINATION[h]}, so new ${HARNESS_LABEL[h]} sessions get memory tools.${hooks}`,
+ why: `Registers gbrain as a stdio MCP server (${serve.join(' ')}, ${advertise ? `listing ${SURFACE_GLOSS[advertise]} and request_tools; ${SURFACE_GLOSS[surface]} stays callable` : SURFACE_GLOSS[surface]}) in ${HARNESS_DESTINATION[h]}, so new ${HARNESS_LABEL[h]} sessions get memory tools.${hooks}`,
user_message: `I'd like to add gbrain's memory tools to ${HARNESS_LABEL[h]} by writing one MCP server entry to ${HARNESS_DESTINATION[h]}. OK?`,
verify: VERIFY('harness_wiring'), docs: MEMORY_VERBS_INSTALL,
};
@@ -462,7 +464,7 @@ export function harnessWiringEntry(input: HarnessWiringInput): ReadinessEntry {
if (harnesses.length === 0) {
return { ...base, state: 'missing', reason: 'no_harness_detected', why: 'No agent harness was detected.',
fix: { consent: ['persistent_install'], actor: 'user', requires_exclusive: false, docs: MEMORY_VERBS_INSTALL,
- why: `Register \`<absolute path to gbrain> serve --surface ${input.surface ?? REGISTRATION_SURFACE}\` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw).`,
+ why: `Register \`${stdioServeArgv('<absolute path to gbrain>', input.surface ?? REGISTRATION_SURFACE, registrationAdvertise({ userChoseSurface: input.surface !== undefined })).join(' ')}\` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw).`,
user_message: 'Which agent app should get gbrain memory? The install guide has a one-line command for each.' } };
}
if (lockOwner?.transport === 'http') {
diff --git a/src/core/serve-service.ts b/src/core/serve-service.ts
index f92acca230..9fd3058242 100644
--- a/src/core/serve-service.ts
+++ b/src/core/serve-service.ts
@@ -153,13 +153,16 @@ export interface ServeCommandParams {
port: number;
publicUrl: string;
surface?: 'verbs' | 'starter' | 'full';
+ /** `serve --advertise`: what tools/list shows clients without their own surface. */
+ advertise?: 'verbs' | 'starter' | 'full' | null;
enableDcr?: boolean;
}
-/** `serve --http --port N --public-url URL [--surface X] [--enable-dcr]` as argv. */
+/** `serve --http --port N --public-url URL [--surface X] [--advertise Y] [--enable-dcr]` as argv. */
export function serveCommandArgv(p: ServeCommandParams): string[] {
const argv = ['serve', '--http', '--port', String(p.port), '--public-url', p.publicUrl];
if (p.surface) argv.push('--surface', p.surface);
+ if (p.advertise) argv.push('--advertise', p.advertise);
if (p.enableDcr) argv.push('--enable-dcr');
return argv;
}
@@ -555,6 +558,8 @@ export interface ExposeReceipt {
admin_url: string;
mode: 'tailnet' | 'funnel';
surface: 'verbs' | 'starter' | 'full';
+ /** The serve's `--advertise`; absent on exposures written before the verbs listing default (they list everything). */
+ advertise?: 'verbs' | 'starter' | 'full';
enable_dcr: boolean;
tailscale: { binary: string | null; dns_name: string | null; tailscale_version: string | null };
service: { target: ServiceTarget; unit_path: string | null; plist_path: string | null; wrapper_path: string; state: ServiceState | 'skipped' };
diff --git a/src/core/setup/claude-code.ts b/src/core/setup/claude-code.ts
index 2b8b8b5a50..a73907985c 100644
--- a/src/core/setup/claude-code.ts
+++ b/src/core/setup/claude-code.ts
@@ -64,6 +64,8 @@ export interface ClaudeSetupReceipt {
project_dir?: string;
source_id: string | null;
surface: McpSurface;
+ /** The registration's `--advertise` (absent: tools/list shows the whole surface). */
+ advertise?: McpSurface;
config_path: string;
entry_hash: string | null;
pending_entry_hash: string | null;
@@ -90,6 +92,8 @@ export interface ClaudeSetupPlan {
gbrainHomeEnv?: string;
sourceId: string | null;
surface: McpSurface;
+ /** `serve --advertise`; null lists the whole surface. */
+ advertise: McpSurface | null;
events: ClaudeHookEvent[];
}
@@ -173,7 +177,7 @@ export function desiredMcpEntry(plan: ClaudeSetupPlan): Record<string, unknown>
const env: Record<string, string> = {};
if (plan.gbrainHomeEnv) env.GBRAIN_HOME = plan.gbrainHomeEnv;
if (plan.sourceId) env.GBRAIN_SOURCE = plan.sourceId;
- return { type: 'stdio', command: plan.launcher, args: stdioServeArgv(plan.launcher, plan.surface).slice(1), env };
+ return { type: 'stdio', command: plan.launcher, args: stdioServeArgv(plan.launcher, plan.surface, plan.advertise).slice(1), env };
}
export function desiredHookHashes(plan: ClaudeSetupPlan): HookHashes {
@@ -288,7 +292,7 @@ export async function applyClaudeSetup(
harness: 'claude-code', connection: 'local-stdio', setup_receipt_version: 1, status: 'prepared',
name: plan.name, gbrain_home: plan.brainHome, launcher: plan.launcher, scope: plan.scope,
...(plan.projectDir ? { project_dir: plan.projectDir } : {}),
- source_id: plan.sourceId, surface: plan.surface, config_path: paths.configPath,
+ source_id: plan.sourceId, surface: plan.surface, ...(plan.advertise ? { advertise: plan.advertise } : {}), config_path: paths.configPath,
entry_hash: prior?.entry_hash ?? null, pending_entry_hash: opts.pluginOwner ? null : desiredHash,
...(prior?.mcp_adopted ? { mcp_adopted: true } : {}),
...(opts.pluginOwner ? { mcp_plugin: opts.pluginOwner } : {}),
diff --git a/src/core/setup/codex.ts b/src/core/setup/codex.ts
index 94b195d823..9127e4118e 100644
--- a/src/core/setup/codex.ts
+++ b/src/core/setup/codex.ts
@@ -69,6 +69,8 @@ export interface CodexSetupReceipt {
launcher: string;
source_id: string | null;
surface: McpSurface;
+ /** The registration's `--advertise` (absent: tools/list shows the whole surface). */
+ advertise?: McpSurface;
config_path: string;
hooks_path: string;
entry_hash: string | null;
@@ -91,6 +93,8 @@ export interface CodexSetupPlan {
gbrainHomeEnv?: string;
sourceId: string | null;
surface: McpSurface;
+ /** `serve --advertise`; null lists the whole surface. */
+ advertise: McpSurface | null;
events: CodexSetupEvent[];
}
@@ -131,11 +135,11 @@ export function readCodexSetupReceipt(receiptPath: string): { setup: CodexSetupR
const writeReceipt = (path: string, receipt: CodexSetupReceipt) => atomicWriteTextFile(path, `${JSON.stringify(receipt, null, 2)}\n`, { forceMode: 0o600 });
-export function desiredCodexMcpEntry(plan: Pick<CodexSetupPlan, 'launcher' | 'surface' | 'gbrainHomeEnv' | 'sourceId'>): Record<string, CodexTomlValue> {
+export function desiredCodexMcpEntry(plan: Pick<CodexSetupPlan, 'launcher' | 'surface' | 'advertise' | 'gbrainHomeEnv' | 'sourceId'>): Record<string, CodexTomlValue> {
const env: Record<string, string> = {};
if (plan.gbrainHomeEnv) env.GBRAIN_HOME = plan.gbrainHomeEnv;
if (plan.sourceId) env.GBRAIN_SOURCE = plan.sourceId;
- return { command: plan.launcher, args: stdioServeArgv(plan.launcher, plan.surface).slice(1), ...(Object.keys(env).length ? { env } : {}) };
+ return { command: plan.launcher, args: stdioServeArgv(plan.launcher, plan.surface, plan.advertise).slice(1), ...(Object.keys(env).length ? { env } : {}) };
}
function desiredGroups(plan: CodexSetupPlan): Partial<Record<CodexSetupEvent, CodexHookGroup>> {
@@ -259,7 +263,7 @@ export async function applyCodexSetup(
const receipt: CodexSetupReceipt = {
harness: 'codex', connection: 'local-stdio', setup_receipt_version: CODEX_SETUP_RECEIPT_VERSION, status: 'prepared',
name: plan.name, gbrain_home: plan.brainHome, ...(plan.gbrainHomeEnv ? { gbrain_home_env: plan.gbrainHomeEnv } : {}),
- launcher: plan.launcher, source_id: plan.sourceId, surface: plan.surface,
+ launcher: plan.launcher, source_id: plan.sourceId, surface: plan.surface, ...(plan.advertise ? { advertise: plan.advertise } : {}),
config_path: paths.configPath, hooks_path: paths.hooksPath,
entry_hash: prior?.entry_hash ?? null, pending_entry_hash: opts.pluginOwner ? null : desiredHash,
...(prior?.mcp_adopted ? { mcp_adopted: true } : {}),
diff --git a/src/mcp/initialize-context.ts b/src/mcp/initialize-context.ts
index 40801d5cde..afa60dfbbb 100644
--- a/src/mcp/initialize-context.ts
+++ b/src/mcp/initialize-context.ts
@@ -37,7 +37,7 @@ export async function instructionReadiness(
/** HTTP (OAuth and legacy bearer): the same filters tools/list applies, publish gates read on initialize. */
export async function httpInstructionTools(
engine: BrainEngine, config: GBrainConfig | null | undefined,
- opts: { ops: readonly OperationMeta[]; surface: 'verbs' | 'starter' | 'full'; auth: AuthInfo; allowedOps?: ReadonlySet<string>; cache?: ReadinessCache },
+ opts: { ops: readonly OperationMeta[]; surface: 'verbs' | 'starter' | 'full'; auth: AuthInfo; allowedOps?: ReadonlySet<string>; cache?: ReadinessCache; advertise?: 'verbs' | 'starter' | 'full' | null },
): Promise<InstructionTools> {
const gateDisabled = await disabledOpsForPublishGates(engine, config ?? undefined).catch(() => new Set(opts.ops.map(o => o.name)));
const publishGates = publishGatesFromDisabled(opts.ops, gateDisabled);
@@ -45,8 +45,9 @@ export async function httpInstructionTools(
isCallable(op, { transport: 'http', surface: opts.surface, scopes: opts.auth.scopes, publishGates, allowedOps: opts.allowedOps })
&& opAllowedForBoundClient(opts.auth, op)).map(op => op.name));
const callable = opts.ops.filter(op => names.has(op.name));
- const listed = opts.auth.surface ? callable : advertisedOps(callable, opts.surface, await resolveAdvertisedSurface(engine, config));
- return { callable: n => names.has(n), readiness: await instructionReadiness(engine, config, 'http', opts.cache), hiddenCallable: callable.length - listed.length };
+ const listed = opts.auth.surface ? callable : advertisedOps(callable, opts.surface, await resolveAdvertisedSurface(engine, config, opts.advertise ?? null));
+ const listedNames = new Set(listed.map(op => op.name));
+ return { callable: n => listedNames.has(n), readiness: await instructionReadiness(engine, config, 'http', opts.cache), hiddenCallable: callable.length - listed.length };
}
/**
diff --git a/src/mcp/server.ts b/src/mcp/server.ts
index dda7e3b742..1c91273b41 100644
--- a/src/mcp/server.ts
+++ b/src/mcp/server.ts
@@ -318,7 +318,7 @@ function stdioSurfaceSession(
return { session, finishResult, statusResult };
}
-export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpSurface; surfaceSource?: SurfaceSource; invalidSurfaceEnv?: string; sourceGuard?: boolean; onBootPhase?: (phase: string) => void; access?: McpAccess } = {}) {
+export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpSurface; surfaceSource?: SurfaceSource; invalidSurfaceEnv?: string; sourceGuard?: boolean; onBootPhase?: (phase: string) => void; access?: McpAccess; advertise?: McpSurface } = {}) {
const config = loadConfig();
const bootPhase = (phase: string) => { try { opts.onBootPhase?.(phase); } catch { /* diagnostic only */ } };
// Refuse to serve a well-formed GBRAIN_SOURCE that no active source row
@@ -371,16 +371,16 @@ export async function startMcpServer(engine: BrainEngine, opts: { surface?: McpS
instructions: resolveMcpInstructions(config, process.env, { writeback: writebackOpts }),
},
);
- const listing = stdioToolListing(() => resolveAdvertisedSurface(isEngineDegraded(engine) ? null : engine, config), session, server);
+ const listing = stdioToolListing(() => resolveAdvertisedSurface(isEngineDegraded(engine) ? null : engine, config, opts.advertise ?? null), session, server);
// F1: callable-set contract + readiness tail (or status-only line), resolved at client initialize.
installInstructionsResolver(server, async () => {
if (statusMode && isEngineDegraded(engine)) {
return resolveMcpInstructions(config, process.env, { tools: { callable: n => n === STATUS_TOOL_NAME, statusLine: statusInstructionLine(statusMode) } });
}
- const visibleOps = await stdioVisibleTools(engine, session.surfacedOps), visible = new Set(visibleOps.map(op => op.name));
+ const visibleOps = await stdioVisibleTools(engine, session.surfacedOps), listedOps = await listing.listed(visibleOps), listed = new Set(listedOps.map(op => op.name));
return resolveMcpInstructions(config, process.env, {
writeback: writebackOpts, ...await readInstructionContent(engine),
- tools: { callable: n => visible.has(n), readiness: await instructionReadiness(engine, config, 'stdio'), hiddenCallable: visibleOps.length - (await listing.listed(visibleOps)).length },
+ tools: { callable: n => listed.has(n), readiness: await instructionReadiness(engine, config, 'stdio'), hiddenCallable: visibleOps.length - listedOps.length },
});
}, gate.initializeAnswered);
diff --git a/src/mcp/surface.ts b/src/mcp/surface.ts
index cacde3cf64..a9eb4ac966 100644
--- a/src/mcp/surface.ts
+++ b/src/mcp/surface.ts
@@ -148,6 +148,22 @@ export function parseSurfaceFlag(args: string[]): McpSurface | null {
return raw;
}
+/**
+ * `--advertise`: the surface tools/list shows, narrower than what is callable.
+ * Registrations gbrain writes pass `--advertise verbs` (REGISTRATION_ADVERTISE);
+ * absent, `mcp.advertised_surface` decides.
+ */
+export function parseAdvertiseFlag(args: string[]): McpSurface | null {
+ const idx = args.indexOf('--advertise');
+ if (idx < 0) return null;
+ const raw = args[idx + 1];
+ if (raw === undefined || raw.startsWith('--') || !isMcpSurface(raw)) {
+ throw opError('invalid_params', `--advertise takes verbs, starter or full${raw === undefined || raw.startsWith('--') ? '' : ` (got "${raw}")`}`,
+ 'Pass --advertise verbs (list the 7 memory verbs and request_tools), --advertise starter or --advertise full. Every tool the surface allows stays callable.');
+ }
+ return raw;
+}
+
/**
* #4768: stdio access ceiling. `--access read-only` intersects the selected
* surface with operations that are read-scoped, non-mutating and need no
@@ -343,7 +359,8 @@ export async function resolveDefaultClientSurface(
* the advertised list is a context-cost choice. DB plane wins, file plane
* falls back; unset or unrecognized = advertise the whole callable set.
*/
-export async function resolveAdvertisedSurface(engine: BrainEngine | null, config: GBrainConfig | null | undefined): Promise<McpSurface | null> {
+export async function resolveAdvertisedSurface(engine: BrainEngine | null, config: GBrainConfig | null | undefined, flag: McpSurface | null = null): Promise<McpSurface | null> {
+ if (flag) return flag;
if (engine) {
try {
const dbVal = await engine.getConfig('mcp.advertised_surface');
@@ -355,11 +372,16 @@ export async function resolveAdvertisedSurface(engine: BrainEngine | null, confi
return isMcpSurface(fileVal) ? fileVal : null;
}
-/** The tools to list: the callable set narrowed to the advertised surface (never wider). */
+/**
+ * The tools to list: the callable set narrowed to the advertised surface
+ * (never wider). A narrowed list always keeps request_tools when it is
+ * callable: it is how an agent reaches the unlisted tools (the verbs surface
+ * itself has none).
+ */
export function advertisedOps<T extends OperationMeta>(callable: T[], callableSurface: McpSurface, advertised: McpSurface | null): T[] {
if (!advertised || !surfaceWiderThan(callableSurface, advertised)) return callable;
const listed = new Set(filterOpsForSurface(callable, advertised).map(op => op.name));
- return callable.filter(op => listed.has(op.name));
+ return callable.filter(op => listed.has(op.name) || op.name === 'request_tools');
}
/**
diff --git a/test/mcp-advertised-surface.test.ts b/test/mcp-advertised-surface.test.ts
index fedda4e385..7c9240369c 100644
--- a/test/mcp-advertised-surface.test.ts
+++ b/test/mcp-advertised-surface.test.ts
@@ -13,7 +13,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
import { ToolListChangedNotificationSchema } from '@modelcontextprotocol/sdk/types.js';
import { operations } from '../src/core/operations.ts';
-import { advertisedOps, filterOpsForSurface, resolveAdvertisedSurface } from '../src/mcp/surface.ts';
+import { advertisedOps, filterOpsForSurface, parseAdvertiseFlag, resolveAdvertisedSurface } from '../src/mcp/surface.ts';
import { buildMcpInstructions } from '../src/mcp/instructions.ts';
import { keylessBrainEnv } from './helpers/provider-env.ts';
@@ -52,14 +52,25 @@ beforeAll(async () => {
afterAll(() => { rmSync(home, { recursive: true, force: true }); });
describe('advertised surface (pure)', () => {
- test('narrows the callable list, never widens it', () => {
+ test('narrows the callable list, never widens it, and keeps request_tools so the rest stays reachable', () => {
const full = filterOpsForSurface(operations, 'full');
- expect(advertisedOps(full, 'full', 'verbs').map(o => o.name).sort()).toEqual(filterOpsForSurface(operations, 'verbs').map(o => o.name).sort());
+ expect(advertisedOps(full, 'full', 'verbs').map(o => o.name).sort()).toEqual([...filterOpsForSurface(operations, 'verbs').map(o => o.name), 'request_tools'].sort());
+ expect(advertisedOps(full.filter(o => o.name !== 'request_tools'), 'full', 'verbs').map(o => o.name)).not.toContain('request_tools');
const verbs = filterOpsForSurface(operations, 'verbs');
expect(advertisedOps(verbs, 'verbs', 'full')).toBe(verbs);
expect(advertisedOps(full, 'full', null)).toBe(full);
});
+ test('the --advertise flag wins over both config planes', async () => {
+ const engine = { getConfig: async (k: string) => (k === 'mcp.advertised_surface' ? 'starter' : null) } as never;
+ expect(await resolveAdvertisedSurface(engine, { mcp: { advertised_surface: 'starter' } } as never, 'verbs')).toBe('verbs');
+ expect(await resolveAdvertisedSurface(engine, null, null)).toBe('starter');
+ expect(parseAdvertiseFlag(['--surface', 'full', '--advertise', 'verbs'])).toBe('verbs');
+ expect(parseAdvertiseFlag(['--surface', 'full'])).toBeNull();
+ expect(() => parseAdvertiseFlag(['--advertise', 'everything'])).toThrow('--advertise takes verbs, starter or full');
+ expect(() => parseAdvertiseFlag(['--advertise'])).toThrow('--advertise takes verbs, starter or full');
+ });
+
test('the database plane wins over the file plane; unrecognized values advertise everything', async () => {
const engine = { getConfig: async (k: string) => (k === 'mcp.advertised_surface' ? 'starter' : null) } as never;
expect(await resolveAdvertisedSurface(engine, { mcp: { advertised_surface: 'verbs' } } as never)).toBe('starter');
@@ -79,7 +90,7 @@ describe('stdio session', () => {
test('lists the verbs, calls an unlisted tool, and lists it once request_tools describes it', async () => {
await session([], async (client, changed) => {
const listed = (await client.listTools()).tools.map(t => t.name);
- expect(listed.sort()).toEqual(filterOpsForSurface(operations, 'verbs').map(o => o.name).sort());
+ expect(listed.sort()).toEqual([...filterOpsForSurface(operations, 'verbs').map(o => o.name), 'request_tools'].sort());
expect(listed).not.toContain('put_page');
const put = await client.callTool({ name: 'put_page', arguments: { slug: 'notes/advertised', content: '---\ntype: note\ntitle: Advertised\n---\nHidden but callable.\n' } });
expect(put.isError).toBeFalsy();
@@ -124,6 +135,32 @@ describe('stdio session', () => {
}
}, 180_000);
+ test('serve --surface full --advertise verbs (the registration default) lists the verbs and request_tools over any config, instructs from that list, and keeps every operation callable', async () => {
+ const advertise = await gbrain(['config', 'set', 'mcp.advertised_surface', 'full']);
+ expect(advertise.code).toBe(0);
+ try {
+ await session(['--surface', 'full', '--advertise', 'verbs'], async (client) => {
+ const listed = (await client.listTools()).tools.map(t => t.name);
+ expect(listed.sort()).toEqual([...filterOpsForSurface(operations, 'verbs').map(o => o.name), 'request_tools'].sort());
+ const instructions = client.getInstructions() ?? '';
+ expect(instructions).toContain('Use `recall` before external lookup');
+ expect(instructions).toContain('more are callable. Call request_tools');
+ expect(instructions).not.toContain('Use `search` or `query` before external lookup');
+ const put = await client.callTool({ name: 'put_page', arguments: { slug: 'notes/advertise-flag', content: '---\ntype: note\ntitle: Advertise flag\n---\nCallable while unlisted.\n' } });
+ expect(put.isError).toBeFalsy();
+ const described = await client.callTool({ name: 'request_tools', arguments: { tools: ['search'] } });
+ expect(described.isError).toBeFalsy();
+ expect(JSON.parse((described as { content: Array<{ text: string }> }).content[0].text).tools.map((t: { name: string }) => t.name)).toEqual(['search']);
+ });
+ await session(['--surface', 'full'], async (client) => {
+ expect((await client.listTools()).tools.map(t => t.name)).toContain('put_page');
+ });
+ } finally {
+ const restore = await gbrain(['config', 'set', 'mcp.advertised_surface', 'verbs']);
+ expect(restore.code).toBe(0);
+ }
+ }, 180_000);
+
test('the callable ceiling still blocks', async () => {
await session(['--surface', 'verbs'], async (client) => {
const put = await client.callTool({ name: 'put_page', arguments: { slug: 'notes/blocked', content: 'x' } });
diff --git a/test/mcp-expose.test.ts b/test/mcp-expose.test.ts
index 821a88ccb0..ee278e7d37 100644
--- a/test/mcp-expose.test.ts
+++ b/test/mcp-expose.test.ts
@@ -593,7 +593,8 @@ describe('happy path: linux-systemd', () => {
// wrapper + unit shape
const wrapper = readFileSync(wrapperPath(f.serveDir), 'utf-8');
expect(wrapper).toContain(`GBRAIN_ADMIN_BOOTSTRAP_TOKEN="$(cat '${adminTokenPath(f.serveDir)}')"`);
- expect(wrapper).toContain(`serve --http --port 3131 --public-url https://${DNS} --surface full`);
+ expect(wrapper).toContain(`serve --http --port 3131 --public-url https://${DNS} --surface full --advertise verbs`);
+ expect(receipt.advertise).toBe('verbs');
expect(wrapper).not.toContain('export GBRAIN_HOME');
expect(readFileSync(f.deps.unitPath!, 'utf-8')).toContain(`ExecStart=${wrapperPath(f.serveDir)}`);
// exec ledger: enable + restart (a reinstall relaunches the regenerated wrapper), never enable --now
@@ -657,6 +658,7 @@ describe('happy path: linux-systemd', () => {
expect(joinedCalls(f)).toContain(`${TS} funnel --bg 4000`);
const receipt = readExposeReceipt(receiptPath(f.serveDir))!;
expect(receipt).toMatchObject({ mode: 'funnel', port: 4000, surface: 'verbs', enable_dcr: true });
+ expect(receipt.advertise).toBeUndefined();
const wrapper = readFileSync(wrapperPath(f.serveDir), 'utf-8');
expect(wrapper).toContain(`export GBRAIN_HOME='${join(f.home, 'custom')}'`);
expect(wrapper).toContain('--port 4000 --public-url https://your-machine.your-tailnet.ts.net --surface verbs --enable-dcr');
@@ -696,6 +698,21 @@ describe('happy path: linux-systemd', () => {
expect(second.updated_at).toBe('2026-06-02T00:00:00.000Z');
expect(checkOf(jsonDoc(f), 'admin_token')?.detail).toContain('reused');
});
+
+ test('an exposure from before the verbs listing default keeps listing everything when re-run; --surface full lists everything', async () => {
+ const f = fakeTailnet();
+ expect(await runMcpExpose(['--yes'], f.deps)).toBe(0);
+ const { advertise: _dropped, ...older } = readExposeReceipt(receiptPath(f.serveDir))!;
+ writeExposeReceipt(receiptPath(f.serveDir), older);
+ expect(await runMcpExpose(['--yes'], f.deps)).toBe(0);
+ expect(readExposeReceipt(receiptPath(f.serveDir))!.advertise).toBeUndefined();
+ expect(readFileSync(wrapperPath(f.serveDir), 'utf-8')).not.toContain('--advertise');
+
+ const g = fakeTailnet();
+ expect(await runMcpExpose(['--yes', '--surface', 'full'], g.deps)).toBe(0);
+ expect(readExposeReceipt(receiptPath(g.serveDir))!.advertise).toBeUndefined();
+ expect(readFileSync(wrapperPath(g.serveDir), 'utf-8')).toContain(`--public-url https://${DNS} --surface full\n`);
+ });
});
describe('hosted_option', () => {
diff --git a/test/mcp-registration.test.ts b/test/mcp-registration.test.ts
index a17099b4b7..f0fb73df7f 100644
--- a/test/mcp-registration.test.ts
+++ b/test/mcp-registration.test.ts
@@ -13,7 +13,7 @@ import { spawnSync } from 'node:child_process';
import { mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
-import { REGISTRATION_SURFACE, registeredSurface, stdioServeArgv } from '../src/core/mcp-registration.ts';
+import { REGISTRATION_ADVERTISE, REGISTRATION_SURFACE, registeredAdvertise, registeredSurface, registrationAdvertise, stdioServeArgv } from '../src/core/mcp-registration.ts';
import { harnessWiringEntry } from '../src/core/readiness.ts';
import { registerClaudeMcp, registerCodexMcp } from '../src/core/bootstrap/hooks.ts';
import { resolveSurfaceWithSource } from '../src/mcp/surface.ts';
@@ -32,6 +32,28 @@ describe('REGISTRATION_SURFACE and stdioServeArgv', () => {
expect(stdioServeArgv(BIN, null)).toEqual([BIN, 'serve']);
});
+ test('new registrations list the memory verbs; --advertise is written only when narrower than the surface', () => {
+ expect(REGISTRATION_ADVERTISE).toBe('verbs');
+ expect(stdioServeArgv(BIN, REGISTRATION_SURFACE, REGISTRATION_ADVERTISE)).toEqual([BIN, 'serve', '--surface', 'full', '--advertise', 'verbs']);
+ expect(stdioServeArgv(BIN, 'starter', 'verbs')).toEqual([BIN, 'serve', '--surface', 'starter', '--advertise', 'verbs']);
+ expect(stdioServeArgv(BIN, 'verbs', 'verbs')).toEqual([BIN, 'serve', '--surface', 'verbs']);
+ expect(stdioServeArgv(BIN, null, 'verbs')).toEqual([BIN, 'serve']);
+ });
+
+ test('registrationAdvertise: a chosen surface lists in full, an existing registration keeps its listing, a new one lists the verbs', () => {
+ expect(registrationAdvertise({ userChoseSurface: false })).toBe('verbs');
+ expect(registrationAdvertise({ userChoseSurface: true })).toBeNull();
+ expect(registrationAdvertise({ userChoseSurface: false, prior: {} })).toBeNull();
+ expect(registrationAdvertise({ userChoseSurface: false, prior: { advertise: 'starter' } })).toBe('starter');
+ expect(registrationAdvertise({ userChoseSurface: true, prior: { advertise: 'verbs' } })).toBeNull();
+ });
+
+ test('registeredAdvertise reads an existing registration\'s listing', () => {
+ expect(registeredAdvertise(`${BIN} serve --surface full --advertise verbs`)).toBe('verbs');
+ expect(registeredAdvertise('Args: serve --surface full --advertise=starter')).toBe('starter');
+ expect(registeredAdvertise(`${BIN} serve --surface full`)).toBeNull();
+ });
+
test('registeredSurface reads a pinned value, a bare serve, or nothing', () => {
expect(registeredSurface(`gbrain:\n Command: ${BIN}\n Args: serve --surface full\n`)).toBe('full');
expect(registeredSurface(`${BIN} serve --surface=verbs --source-guard`)).toBe('verbs');
@@ -42,17 +64,24 @@ describe('REGISTRATION_SURFACE and stdioServeArgv', () => {
describe('every stdio registration path builds from REGISTRATION_SURFACE', () => {
test('readiness harness_wiring: Claude Code and Codex pin the surface; opencode runs bootstrap hooks', () => {
- expect(wiring('claude-code')?.argv).toEqual(['claude', 'mcp', 'add', 'gbrain', '--', ...stdioServeArgv(BIN)]);
- expect(wiring('codex')?.argv).toEqual(['codex', 'mcp', 'add', 'gbrain', '--', ...stdioServeArgv(BIN)]);
+ expect(wiring('claude-code')?.argv).toEqual(['claude', 'mcp', 'add', 'gbrain', '--', ...stdioServeArgv(BIN, REGISTRATION_SURFACE, REGISTRATION_ADVERTISE)]);
+ expect(wiring('codex')?.argv).toEqual(['codex', 'mcp', 'add', 'gbrain', '--', ...stdioServeArgv(BIN, REGISTRATION_SURFACE, REGISTRATION_ADVERTISE)]);
expect(wiring('opencode')?.argv).toEqual(['gbrain', 'bootstrap', 'hooks', '--harness', 'opencode', '--no-hooks']);
- expect(wiring('claude-code')?.why).toContain(`${BIN} serve --surface full`);
+ expect(wiring('claude-code')?.why).toContain(`${BIN} serve --surface full --advertise verbs`);
});
test('init --surface reaches the readiness fix (the quickstart line and the first-run harness decision read it)', () => {
expect(wiring('claude-code', 'starter')?.argv).toEqual(['claude', 'mcp', 'add', 'gbrain', '--', BIN, 'serve', '--surface', 'starter']);
expect(wiring('opencode', 'verbs')?.argv).toEqual(['gbrain', 'bootstrap', 'hooks', '--harness', 'opencode', '--no-hooks', '--surface', 'verbs']);
const missing = harnessWiringEntry({ transport: 'cli', harnesses: [], lockOwner: null, gbrainBin: BIN }).fix;
- expect(missing?.why).toContain('serve --surface full');
+ expect(missing?.why).toContain('serve --surface full --advertise verbs');
+ });
+
+ test('bootstrap hooks: registerClaudeMcp and registerCodexMcp write --advertise when given', () => {
+ const claude = registerClaudeMcp({ gbrainBin: BIN, scope: 'user', sourceId: 'workspace', advertise: 'verbs' })[0];
+ const codex = registerCodexMcp({ gbrainBin: BIN, sourceId: 'workspace', advertise: 'verbs' })[0];
+ expect(claude.slice(claude.indexOf('--') + 1)).toEqual([BIN, 'serve', '--surface', 'full', '--advertise', 'verbs']);
+ expect(codex.slice(codex.indexOf('--') + 1)).toEqual([BIN, 'serve', '--surface', 'full', '--advertise', 'verbs']);
});
test('bootstrap hooks: registerClaudeMcp and registerCodexMcp default to the surface and carry an existing form', () => {
@@ -120,6 +149,22 @@ describe('S0: README, docs/mcp, INSTALL, BOOTSTRAP, push-context and the manifes
expect(offenders).toEqual([]);
});
+ test('every harness registration command in the install docs lists the memory verbs (--advertise verbs)', () => {
+ const offenders: string[] = [];
+ let commands = 0;
+ for (const file of DOCS) {
+ readFileSync(join(ROOT, file), 'utf8').split('\n').forEach((line, i) => {
+ for (const m of line.matchAll(/\bmcp add\b[^`\n|]*?\bserve\b([^`\n|]*)/g)) {
+ commands++;
+ if (/--access[\s=]+read-only/.test(m[1])) continue;
+ if (!new RegExp(`--advertise(?:[\\s=]+|\\s+--arg\\s+)${REGISTRATION_ADVERTISE}\\b`).test(m[1])) offenders.push(`${file}:${i + 1}: ${line.trim()}`);
+ }
+ });
+ }
+ expect(commands).toBeGreaterThan(10);
+ expect(offenders).toEqual([]);
+ });
+
test('the plugin manifests pin the registration surface; the OpenClaw bundle runs a bare serve, whose default is the same value', () => {
for (const file of ['.codex-plugin/mcp.json', '.claude-plugin/plugin.json']) {
const args = (JSON.parse(readFileSync(join(ROOT, file), 'utf8')) as { mcpServers: { gbrain: { args: string[] } } }).mcpServers.gbrain.args;
diff --git a/test/readiness.test.ts b/test/readiness.test.ts
index ce5b4d8987..824d06ee1d 100644
--- a/test/readiness.test.ts
+++ b/test/readiness.test.ts
@@ -168,13 +168,13 @@ describe('harness_wiring by state', () => {
const BIN = '/opt/gbrain/bin/gbrain';
const owner = (transport: 'stdio' | 'http', is_self = false): LockOwner => ({ pid: 4242, transport, is_self });
- test('one harness, no serve: harness-native stdio registration with the absolute binary and --surface full', () => {
+ test('one harness, no serve: harness-native stdio registration with the absolute binary, --surface full and --advertise verbs', () => {
const claude = harnessWiringEntry({ transport: 'cli', harnesses: ['claude-code'], lockOwner: null, gbrainBin: BIN });
- expect(claude.fix?.argv).toEqual(['claude', 'mcp', 'add', 'gbrain', '--', BIN, 'serve', '--surface', 'full']);
+ expect(claude.fix?.argv).toEqual(['claude', 'mcp', 'add', 'gbrain', '--', BIN, 'serve', '--surface', 'full', '--advertise', 'verbs']);
expect(claude.fix?.consent).toEqual(['persistent_install']);
expect(claude.fix?.why).toContain('~/.claude.json');
expect(harnessWiringEntry({ transport: 'cli', harnesses: ['codex'], lockOwner: null, gbrainBin: BIN }).fix?.argv)
- .toEqual(['codex', 'mcp', 'add', 'gbrain', '--', BIN, 'serve', '--surface', 'full']);
+ .toEqual(['codex', 'mcp', 'add', 'gbrain', '--', BIN, 'serve', '--surface', 'full', '--advertise', 'verbs']);
expect(harnessWiringEntry({ transport: 'cli', harnesses: ['opencode'], lockOwner: null, gbrainBin: BIN }).fix?.argv)
.toEqual(['gbrain', 'bootstrap', 'hooks', '--harness', 'opencode', '--no-hooks']);
});
diff --git a/test/setup.test.ts b/test/setup.test.ts
index c0acaa41f7..8a3dc4fe89 100644
--- a/test/setup.test.ts
+++ b/test/setup.test.ts
@@ -81,7 +81,7 @@ describe('gbrain setup claude-code: install lifecycle', () => {
expect(first.doc.consent.providers).toMatchObject({ value: 'declined', source: 'default' });
expect(readJson(join(b.gbrainHome, '.gbrain', 'config.json')).embedding_disabled).toBe(true);
const entry = readJson(claudeJson(b)).mcpServers.gbrain;
- expect(entry).toEqual({ type: 'stdio', command: b.bin, args: ['serve', '--surface', 'full'], env: { GBRAIN_HOME: b.gbrainHome } });
+ expect(entry).toEqual({ type: 'stdio', command: b.bin, args: ['serve', '--surface', 'full', '--advertise', 'verbs'], env: { GBRAIN_HOME: b.gbrainHome } });
expect(Object.keys(readJson(settings(b)).hooks).sort()).toEqual(['SessionStart', 'UserPromptSubmit']);
expect(readJson(receipt(b)).status).toBe('installed');
const [bundle] = first.doc.notices;
@@ -304,11 +304,32 @@ describe('gbrain setup: setup migrations on the brain it creates (Cat 41 run 4)'
});
describe('gbrain setup claude-code: target first', () => {
+ test('an explicit --surface full lists every operation, and a later run without flags keeps that registration as it is', async () => {
+ const b = box();
+ const first = await setup(b, ['claude-code', '--surface', 'full', '--json']);
+ expect(first.exitCode).toBe(0);
+ expect(first.doc.target.advertise).toBeUndefined();
+ const listedFull = { type: 'stdio', command: b.bin, args: ['serve', '--surface', 'full'], env: { GBRAIN_HOME: b.gbrainHome } };
+ expect(readJson(claudeJson(b)).mcpServers.gbrain).toEqual(listedFull);
+ const again = await setup(b, ['claude-code', '--json']);
+ expect(again.exitCode).toBe(0);
+ expect(again.doc.steps.find((s: any) => s.step === 'mcp').action).toBe('keep');
+ expect(readJson(claudeJson(b)).mcpServers.gbrain).toEqual(listedFull);
+ });
+
+ test('--dry-run on a new install shows the verbs listing over the full surface', async () => {
+ const b = box();
+ const r = await setup(b, ['claude-code', '--dry-run', '--json']);
+ expect(r.exitCode).toBe(0);
+ expect(r.doc.target).toMatchObject({ surface: 'full', advertise: 'verbs' });
+ });
+
test('--dry-run prints the target and writes nothing; GBRAIN_SURFACE is honoured', async () => {
const b = box();
const r = await setup(b, ['claude-code', '--dry-run', '--json'], { GBRAIN_SURFACE: 'starter' });
expect(r.exitCode).toBe(0);
expect(r.doc.target).toMatchObject({ transport: 'local-stdio', surface: 'starter', registration_owner: 'none', launcher: b.bin });
+ expect(r.doc.target.advertise).toBeUndefined();
expect(r.doc.steps.find((s: any) => s.step === 'brain').detail).toContain('--no-embedding');
expect(existsSync(claudeJson(b))).toBe(false);
expect(existsSync(join(b.gbrainHome, '.gbrain'))).toBe(false);
@@ -511,7 +532,7 @@ describe('gbrain setup codex: install lifecycle', () => {
expect(first.doc.capability).toMatchObject({ harness: 'codex', setup: 'supported', push: 'native-verified', read_events: ['SessionStart', 'UserPromptSubmit'] });
expect(first.doc.consent.capture).toMatchObject({ value: 'declined', source: 'default' });
expect(readJson(join(b.gbrainHome, '.gbrain', 'config.json')).embedding_disabled).toBe(true);
- expect(toml(b).mcp_servers.gbrain).toEqual({ command: b.bin, args: ['serve', '--surface', 'full'], env: { GBRAIN_HOME: b.gbrainHome } });
+ expect(toml(b).mcp_servers.gbrain).toEqual({ command: b.bin, args: ['serve', '--surface', 'full', '--advertise', 'verbs'], env: { GBRAIN_HOME: b.gbrainHome } });
expect(Object.keys(readJson(hooksJson(b)).hooks).sort()).toEqual(['SessionStart', 'UserPromptSubmit']);
expect(groups(b, 'UserPromptSubmit')).toEqual([{ hooks: [{ type: 'command', timeout: 15,
command: `env GBRAIN_HOOK_LANE=setup GBRAIN_HOME=${b.gbrainHome} ${b.bin} hook user-prompt --harness codex` }] }]);