Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(mcp): per-tool schema budgets and notice ceilings (cat40 cost wave C3+C4)
garrytanea851b39be97
diff --git a/docs/TOOL_CATALOG.md b/docs/TOOL_CATALOG.mdindex 8f6dc599ff..87cf6e1ddd 100644--- a/docs/TOOL_CATALOG.md+++ b/docs/TOOL_CATALOG.md@@ -51,7 +51,7 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `request_tools` | Discover this brain's tool catalog and optionally unlock a wider tool surface for your client. | read | yes | |+| `request_tools` | More tools: no arguments lists your catalog; {tools: [names]} returns schemas; {surface} persists a wider surface for your OAuth client. | read | yes | |## entities@@ -66,33 +66,33 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|| `get_brain_identity` | Brain identity + counters for thin-client banner — remote callers see counters confined to their source grant. | read | | |-| `whoami` | Introspect the calling identity. | read | yes | |+| `whoami` | Your identity: transport, scopes and, over OAuth, client, source_id and federated_read. | read | yes | |## ingest| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `get_ingest_log` | Get recent ingestion log entries | read | yes | |+| `get_ingest_log` | Recent ingestion log entries. | read | yes | || `log_ingest` | Log an ingestion event | write | | |## insights| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `find_anomalies` | Returns statistical anomalies in recent page activity, grouped by cohort (tag or type). | read | yes | |+| `find_anomalies` | Anomalies in recent page activity, grouped by cohort (tag or type) against a baseline. | read | yes | || `find_contradictions` | Stored contradiction reports are temporarily available only to trusted local callers without a source filter. | read | | || `find_experts` | Answers 'who in my brain knows about <topic>'. | read | | || `find_trajectory` | v0.35.4 — return the chronological claim trajectory for an entity (typed metric values over time, plus auto-detected regressions and narrative drift). | read | | || `get_calibration_profile` | Read the active calibration profile for a holder. | read | | |-| `get_recent_salience` | Returns readable pages recently touched and ranked by activity salience and recency. | read | yes | |+| `get_recent_salience` | Recently touched pages ranked by salience. | read | yes | || `volunteer_context` | Push-based context: volunteer brain pages relevant to a rolling conversation window WITHOUT being asked. | read | | |## jobs| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `cancel_job` | Cancel a waiting, active, or delayed job. | admin | yes | |-| `get_agent_job` | Poll an agent job submitted via submit_agent. | agent | yes | |+| `cancel_job` | Cancel a waiting, active or delayed job you may manage. | admin | yes | |+| `get_agent_job` | Poll a submit_agent job: status, result, queue_position. | agent | yes | || `get_job` | Get job status and details by ID. | admin | | || `get_job_progress` | Get structured progress for a running job. | admin | | || `get_job_stats` | Job queue statistics. | admin | | |@@ -102,7 +102,7 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| `resume_job` | Resume a paused job back to waiting | admin | | || `retry_job` | Re-queue a failed or dead job for retry | admin | | || `send_job_message` | Send a sidechannel message to a running job's inbox | admin | | |-| `submit_agent` | Submit an LLM agent job that the worker dispatches via the gateway-native tool loop. | agent | yes | |+| `submit_agent` | Submit an agent job (agent scope; tools and budget bound to your client). | agent | yes | || `submit_job` | Submit a background job. | admin | | |## links@@ -111,11 +111,11 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S|---|---|---|---|---|| `add_link` | Create link between pages | write | | || `find_orphans` | Find disconnected pages. | read | | |-| `get_backlinks` | List incoming links to a page | read | yes | |+| `get_backlinks` | List links pointing to a page. | read | yes | || `get_links` | List outgoing links from a page | read | | |-| `list_link_sources` | List distinct link_source provenances in the brain with edge counts (e.g. | read | yes | |+| `list_link_sources` | Link provenances in the brain (e.g. | read | yes | || `remove_link` | Remove link between pages | write | | |-| `traverse_graph` | Traverse link graph from a page. | read | yes | |+| `traverse_graph` | Walk the link graph from a page. | read | yes | |## loops@@ -137,13 +137,13 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `context_pack` | MEMORY VERB (v1): budget-packed session-boundary bundle for a set of standing entities — entity cards + open threads + hot facts, zero-LLM, sub-second. | read | yes | |-| `delta` | MEMORY VERB (v1): "what changed since T" for heartbeats — pages updated after `since` + hot facts newer than `since` + open-thread events after `since`, zero-LLM. | read | yes | |-| `entity` | MEMORY VERB (v1): inspect ONE known person/company/project card — zero LLM calls, sub-100ms. | read | yes | |-| `forget` | MEMORY VERB (v1): expire a remembered fact by id — the protocol delete verb. | write | yes | |-| `recall` | MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. | read | yes | |-| `remember` | MEMORY VERB (v1): save one fact to durable agent memory — the protocol write verb. | write | yes | |-| `synthesize` | [EXPENSIVE / SLOW — makes LLM calls, seconds-to-minutes latency, costs money] MEMORY VERB (v1): answer a broad question using cross-page LLM reasoning with citations and gap analysis. | read | yes | |+| `context_pack` | MEMORY VERB (v1): budget-packed cards, open threads and hot facts for up to 8 entities, zero LLM. | read | yes | |+| `delta` | MEMORY VERB (v1): what changed since a time (pages, facts, thread events), zero LLM. | read | yes | |+| `entity` | MEMORY VERB (v1): one known person/company/project card, zero LLM. | read | yes | |+| `forget` | MEMORY VERB (v1): expire a remembered fact by its fact_id (never a page slug). | write | yes | |+| `recall` | MEMORY VERB (v1): read saved facts by entity, since or session_id; `query` also searches pages. | read | yes | |+| `remember` | MEMORY VERB (v1): save one fact; provenance required. | write | yes | |+| `synthesize` | [EXPENSIVE / SLOW: LLM calls, costs money] MEMORY VERB (v1): answer a broad question across pages with citations. | read | yes | |## ontology@@ -158,21 +158,21 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `cancel_write_request` | Cancel your accepted write before publication starts. | write | yes | |-| `capture` | Capture a quick note into the brain — the "just remember this" write. | write | yes | |+| `cancel_write_request` | Cancel your accepted write before it publishes. | write | yes | |+| `capture` | Quick note ("just remember this"): auto-slugged under inbox/ by date + content hash, so recapturing is idempotent. | write | yes | || `delete_page` | Soft-delete a page and remove its markdown file from the source working tree (the source local_path, or sync.repo_path when the source has none). | write | | |-| `edit_page` | Change part of an existing page without resending it: prefer this over put_page for small changes to large pages. | write | yes | |+| `edit_page` | Change part of a page: prefer this over put_page for small changes. | write | yes | || `fetch` | Fetch the full text of one search result by its opaque, source-qualified `id` (OpenAI deep-research contract: the search/fetch pair). | read | | || `get_chunks` | Get content chunks for a page | read | | |-| `get_page` | Read a page by slug (supports optional fuzzy matching). | read | yes | |+| `get_page` | Read a page by slug (fuzzy optional; renamed slugs redirect). | read | yes | || `get_raw_data` | Retrieve raw data for a page. | read | | || `get_versions` | Page version history. | read | | |-| `get_write_request` | Read your durable write receipt by request_id. | write | yes | |-| `list_pages` | List pages with optional filters. | read | yes | |-| `list_write_requests` | List your currently authorized write receipts in one source, newest first. | write | yes | |-| `put_page` | Replace a complete canonical Markdown page. | write | yes | |+| `get_write_request` | Read the receipt of your write by request_id (after write_pending or a lost reply). | write | yes | |+| `list_pages` | List pages with filters. | read | yes | |+| `list_write_requests` | List your write receipts in one source, newest first. | write | yes | |+| `put_page` | Replace a complete Markdown page: content REPLACES the whole page. | write | yes | || `put_raw_data` | Store raw API response data for a page | write | | |-| `resolve_slugs` | Fuzzy-resolve a partial slug to matching page slugs | read | yes | |+| `resolve_slugs` | Fuzzy-match a partial slug or title to page slugs. | read | yes | || `restore_page` | v0.26.5 — restore a soft-deleted page (clear deleted_at) and re-create its markdown file on disk (the counterpart to delete_page removing it; the result write_through field reports the outcome). | write | | || `revert_version` | Revert page to a previous version | write | | |@@ -196,8 +196,8 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S|---|---|---|---|---|| `assemble_evidence` | Deliver whole evidence for an ordered list of search hits (each {source_id, slug, chunk_id} from a prior search/query result): the same windows, sections or pages `query` returns with return_unit, packed into token_budget. | read | | || `cache_stats` | Semantic query-cache introspection: resolved knobs (enabled, similarity threshold, TTL) plus row counts and total hits. | admin | | |-| `query` | Hybrid search with vector + keyword + multi-query expansion. | read | yes | |-| `search` | Cheap hybrid search (vector + keyword + RRF) with no LLM expansion. | read | yes | |+| `query` | Ranked hybrid search with multi-query expansion, for concept / synonym / landscape questions: expansion recovers synonym-phrased matches. | read | yes | |+| `search` | Cheap hybrid search (vector + keyword), no LLM expansion, top 20: for exact tokens, names, field values. | read | yes | || `search_by_image` | v0.36 cross-modal Phase 2: image-as-query retrieval. | read | | || `search_modes` | Read-only search-mode dashboard: active mode, EVERY mode-bundle knob resolved with attribution (mode default vs config override), the three frozen bundles, and a reranker_readiness verdict (whether the resolved reranker will actually run; remote callers get the verdict without the host key inventory). | read | | || `search_stats` | Search observability over a window: cache hit rate, intent/mode mix, budget drops, rank-1 score drift, graph-signals failure counts. | admin | | |@@ -208,13 +208,13 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|| `delete_skill` | CAS-delete a canonical shared skill and revoke future managed activation. | write + skill_editor | yes | |-| `get_skill` | Fetch one skill's full instructions by name. | read | yes | `mcp.publish_skills` |-| `get_skill_asset` | Read a bounded, owner-approved file from an exact sealed skill revision. | read | yes | `mcp.publish_skills` |+| `get_skill` | Fetch a skill's prose and follow it: when it says search or store, call the same-named MCP tool here. | read | yes | `mcp.publish_skills` |+| `get_skill_asset` | Read an approved file from an exact skill revision (data only; never executed). | read | yes | `mcp.publish_skills` || `get_skill_policy` | Read the owner publication policy and CAS epoch, including when sharing is disabled. | admin + skill_publisher | | || `join_brain` | Enroll this authenticated principal to follow approved shared skills. | read + skills_member_self | yes | || `leave_brain` | Stop only this principal’s enrollment. | read + skills_member_self | yes | |-| `list_brain_skillpack` | List brain-resident skillpacks this brain ships (per-source). | read | yes | `mcp.publish_skills` |-| `list_skills` | List the skills this agent's brain publishes. | read | yes | `mcp.publish_skills` |+| `list_brain_skillpack` | Skillpacks this brain ships, with skills and a scaffold spec to offer the user. | read | yes | `mcp.publish_skills` |+| `list_skills` | Skills: prose instruction sets (NOT executable code) for tasks with this server's tools, with triggers, usable_tools and unavailable_tools. | read | yes | `mcp.publish_skills` || `put_skill` | Publish a complete file-canonical skill revision with CAS and a durable receipt. | write + skill_editor | yes | || `set_skill_policy` | Explicitly approve a versioned shared-skill disclosure and follow policy. | admin + skill_publisher | | || `sync_brain_skills` | Get a complete authorized shared-skills view and optionally record an own issued-batch delivery acknowledgment. | read + skills_member_self | yes | |@@ -254,6 +254,6 @@ Every non-localOnly operation on the MCP surface: 136 tools across 23 areas. **S| Tool | Description | Scope | Starter | Gate ||---|---|---|---|---|-| `add_timeline_entry` | Append an entry to the canonical Markdown timeline and structured timeline store in one committed write. | write | yes | |+| `add_timeline_entry` | Append a dated entry to a page timeline. | write | yes | || `get_timeline` | Get timeline entries for a page, optionally filtered by date window | read | | |diff --git a/docs/architecture/key-files/mcp.md b/docs/architecture/key-files/mcp.mdindex 3a131848c4..f8c640c813 100644--- a/docs/architecture/key-files/mcp.md+++ b/docs/architecture/key-files/mcp.md@@ -3,7 +3,7 @@[Subsystem index](../KEY_FILES.md). Read only the entries relevant to your change.Current behavior and load-bearing invariants; history belongs in Git and CHANGELOG.-- `src/mcp/dispatch.ts` — shared tool-call dispatch consumed by both stdio (`server.ts`) and HTTP transports. Exports `dispatchToolCall(engine, name, params, opts)`, `buildOperationContext(engine, params, opts)`, and re-exports `normalizeOptionalParams`/`validateParams` from `src/mcp/validate-params.ts` (the validation module — call order normalize → validate → findUnknownParams is load-bearing). Single source of truth for `(ctx, params)` handler arg order and the `OperationContext` shape. Defaults `remote: true` (untrusted); local CLI callers pass `remote: false`. Deny layers, in order: `opts.allowedOps` surface enforcement (hidden op → `unknownToolEnvelope`, byte-identical to a nonexistent op; did-you-mean candidates drawn ONLY from the caller's visible surface minus localOnly minus gated names), unknown op, the localOnly transport backstop (`op.localOnly && transport !== 'stdio'` → same envelope; stdio IS the local surface), param validation, strict/warn unknown-arg handling (reject mode returns `invalid_params` with suggestions; warn mode attaches `_meta.warnings` + a model-visible notice block), then `enforceBoundClientOpAllowList` (the bound-client fence) inside the handler try. `_meta` assembly per docs/protocol/MCP_META_CHANNELS.md: handler-emitted keys via `ctx.emitResponseMeta` (retrieval, warnings) attach first and independently of the `metaHook` (`brain_hot_memory`, built by `src/core/facts/meta-hook.ts` — its 30s cache is keyed by ENGINE IDENTITY + source + visibility tier + session + allow-list hash, so a process hosting multiple engines can never serve one brain's cached facts into another's envelope; each entry's deadline is additionally CLAMPED to the earliest retained `valid_until`, so a fact expiring inside the window never outlives its read-time TTL by cache staleness; every mutating op, successful or not, drops the engine's entries via `invalidateHotMemoryForEngine`, a build that raced it is not stored, and each hit revalidates the source's `fact_withdrawals` watermark so a forget from any process is never served), each producer isolated so one failure never drops another's key; A successful result's content[0] is compact `JSON.stringify(result)` (error envelopes stay indented); `opts.resultRows` threads the transport's row-shape choice into `OperationContext.resultRows`. empty retrieval results get a SECOND model-visible content block via `buildEmptyRetrievalBlock`. Exports `isListLevelDenialEnvelope(parsed)` — the honest-catalog metric classifier: true for op-level denials the tools/list filter should have prevented (`detail: 'config_key=...'` publish-gate backstop, `detail: 'fence=op'` fence op-level deny), false for argument-level denials; serve-http logs matches as `status='denied_after_list'`. Exports `requestLogStatusForResult(result)` — the ONE request-log status decision (`success` / `success_with_warnings` / `accepted_pending` (a `write_pending` with an admitted non-terminal receipt, kept out of the admin error rate; `acceptedPendingReceipt` returns its receipt so serve-http logs the opaque `write_request_id`) / `denied_after_list` / `error`); BOTH HTTP transports (serve-http.ts and the legacy-bearer http-transport.ts) route every tools/call row through it so the honest-catalog metric sees all HTTP traffic (pinned by test/denied-after-list.test.ts + test/http-transport.test.ts). Also exports `summarizeMcpParams(opName, params)` — privacy-preserving redactor for `mcp_request_log` and the admin SSE feed, returns `{redacted, kind, declared_keys, unknown_key_count, approx_bytes}`. Intersects submitted top-level keys against the operation's declared `params` allow-list (declared keys preserved sorted; unknown keys counted but never named, closing the attacker-controlled-key-name leak). Byte counts bucketed up to nearest 1KB so an attacker can't binary-search secret-content sizes by probing. Raw payload visibility is opt-in via `gbrain serve --http --log-full-params` (loud stderr warning). Logging paths route through this helper, not `JSON.stringify(params)`.+- `src/mcp/dispatch.ts` — shared tool-call dispatch consumed by both stdio (`server.ts`) and HTTP transports. Exports `dispatchToolCall(engine, name, params, opts)`, `buildOperationContext(engine, params, opts)`, and re-exports `normalizeOptionalParams`/`validateParams` from `src/mcp/validate-params.ts` (the validation module — call order normalize → validate → findUnknownParams is load-bearing). Single source of truth for `(ctx, params)` handler arg order and the `OperationContext` shape. Defaults `remote: true` (untrusted); local CLI callers pass `remote: false`. Deny layers, in order: `opts.allowedOps` surface enforcement (hidden op → `unknownToolEnvelope`, byte-identical to a nonexistent op; did-you-mean candidates drawn ONLY from the caller's visible surface minus localOnly minus gated names), unknown op, the localOnly transport backstop (`op.localOnly && transport !== 'stdio'` → same envelope; stdio IS the local surface), param validation, strict/warn unknown-arg handling (reject mode returns `invalid_params` with suggestions; warn mode attaches `_meta.warnings` + a model-visible notice block), then `enforceBoundClientOpAllowList` (the bound-client fence) inside the handler try. `_meta` assembly per docs/protocol/MCP_META_CHANNELS.md: handler-emitted keys via `ctx.emitResponseMeta` (retrieval, warnings) attach first and independently of the `metaHook` (`brain_hot_memory`, built by `src/core/facts/meta-hook.ts` — its 30s cache is keyed by ENGINE IDENTITY + source + visibility tier + session + allow-list hash, so a process hosting multiple engines can never serve one brain's cached facts into another's envelope; each entry's deadline is additionally CLAMPED to the earliest retained `valid_until`, so a fact expiring inside the window never outlives its read-time TTL by cache staleness; every mutating op, successful or not, drops the engine's entries via `invalidateHotMemoryForEngine`, a build that raced it is not stored, and each hit revalidates the source's `fact_withdrawals` watermark so a forget from any process is never served), each producer isolated so one failure never drops another's key; A successful result's content[0] is compact `JSON.stringify(result)` (error envelopes stay indented); `opts.resultRows` threads the transport's row-shape choice into `OperationContext.resultRows`. empty retrieval results get a SECOND model-visible content block via `buildEmptyRetrievalBlock`. `retrievalNoticeBlocks` caps the saved-facts block at 1,500 characters and the other-names block at 400 (header included) with whole items only: the first item always shows, later items that would cross the ceiling are counted in a `(+N more…)` marker (pinned by `test/mcp-notice-ceilings.test.ts`). Exports `isListLevelDenialEnvelope(parsed)` — the honest-catalog metric classifier: true for op-level denials the tools/list filter should have prevented (`detail: 'config_key=...'` publish-gate backstop, `detail: 'fence=op'` fence op-level deny), false for argument-level denials; serve-http logs matches as `status='denied_after_list'`. Exports `requestLogStatusForResult(result)` — the ONE request-log status decision (`success` / `success_with_warnings` / `accepted_pending` (a `write_pending` with an admitted non-terminal receipt, kept out of the admin error rate; `acceptedPendingReceipt` returns its receipt so serve-http logs the opaque `write_request_id`) / `denied_after_list` / `error`); BOTH HTTP transports (serve-http.ts and the legacy-bearer http-transport.ts) route every tools/call row through it so the honest-catalog metric sees all HTTP traffic (pinned by test/denied-after-list.test.ts + test/http-transport.test.ts). Also exports `summarizeMcpParams(opName, params)` — privacy-preserving redactor for `mcp_request_log` and the admin SSE feed, returns `{redacted, kind, declared_keys, unknown_key_count, approx_bytes}`. Intersects submitted top-level keys against the operation's declared `params` allow-list (declared keys preserved sorted; unknown keys counted but never named, closing the attacker-controlled-key-name leak). Byte counts bucketed up to nearest 1KB so an attacker can't binary-search secret-content sizes by probing. Raw payload visibility is opt-in via `gbrain serve --http --log-full-params` (loud stderr warning). Logging paths route through this helper, not `JSON.stringify(params)`.- `src/mcp/instructions.ts` — canonical MCP initialize-time agent operating contract. It is compile-time source text (no runtime filesystem dependency; static imports of pure core leaves are fine — the rule bans filesystem/dynamic loading) and is imported by the stdio SDK server, OAuth HTTP SDK server, and legacy raw HTTP initialize path so all transports return the same instructions without drift. The contract covers skill routing, untrusted-content posture, source scope, and the `put_page` whole-page replacement/read-before-write rule. Two append-only extensions compose on top of it, in a fixed order: `buildMcpInstructions({writeback?})` adds the opt-in ambient-writeback section (from `src/core/facts/writeback-instructions.ts`) when `memory.auto_writeback` is enabled — absent/off is BYTE-IDENTICAL to `GBRAIN_MCP_INSTRUCTIONS`, and three exact-equality transport pins depend on that; `resolveMcpInstructions(config, env?, { writeback? })` takes that composed base and appends the operator-set deployment identity LAST under a `Deployment identity:` banner (no transport can weaken the contract): `GBRAIN_MCP_INSTRUCTIONS` env wins when non-blank, else `mcp.instructions` from the FILE plane (`~/.gbrain/config.json`; `gbrain config set|unset mcp.instructions` route there via `FILE_PLANE_DOTTED_KEYS` in `src/commands/config.ts`); an empty or whitespace-only env value is UNSET, not an override, and blank identity + writeback off returns the byte-identical canonical contract. Every transport calls `resolveMcpInstructions` with its own writeback opts: stdio once at boot via the fail-closed resolver (restart-to-flip, the strict-params posture; read failure = OFF bundle, never a wrong visibility posture; a running `gbrain serve` also needs a restart to pick up a new identity); OAuth per request (write-scope-gated, and the section renders only when THIS token's actual visible set — surface filter + bound-client fence — can call `remember`; `extract_facts` advertised under the same predicates); legacy bearer per initialize (surface-clamped: a surface without `remember` gets no section). All three route availability through `ambientOptsFrom(wb, {remember, extractFacts})`. Pinned over a real SDK `StdioClientTransport` by `test/serve-stdio-roundtrip.test.ts`, over raw HTTP by `test/http-transport.test.ts`, the identity plane (incl. the three-way composition order) by `test/mcp-server-identity.test.ts` + `test/config-set-mcp-instructions.test.ts`, and the enabled-state builder/parity matrix by `test/mcp-instructions-writeback.test.ts`.diff --git a/docs/mcp/README.md b/docs/mcp/README.mdindex e7c9b38282..f8087af6ad 100644--- a/docs/mcp/README.md+++ b/docs/mcp/README.md@@ -31,6 +31,10 @@ native OAuth flow if available; otherwise use a private machine handoff. Followthe hosted setup guide and report configuration separately from an observedconnection in this harness.”+Tool descriptions are deliberately short (the starter list is pinned at 25,000+characters by `test/mcp-schema-budget.test.ts`); the longer guidance for each+starter tool is in the [MCP tool reference](TOOL_REFERENCE.md).+Client-specific details: [ChatGPT](CHATGPT.md), [Claude Code](CLAUDE_CODE.md),[Claude Desktop](CLAUDE_DESKTOP.md), [Codex](CODEX.md),[opencode](OPENCODE.md), [Perplexity](PERPLEXITY.md),diff --git a/docs/mcp/TOOL_REFERENCE.md b/docs/mcp/TOOL_REFERENCE.mdnew file mode 100644index 0000000000..3ff9fcad4a--- /dev/null+++ b/docs/mcp/TOOL_REFERENCE.md@@ -0,0 +1,431 @@+# MCP tool reference (starter surface)++The tool descriptions an MCP client receives are kept short, because every+connected agent pays for the whole tool list on every turn. This page keeps+the longer guidance for people: what each starter-surface tool does, its+defaults, and the edge cases behind each parameter. The served schemas+remain the contract; when they and this page differ, the schemas win.++Say to your agent: *"Before you call a gbrain tool you have not used yet,+check docs/mcp/TOOL_REFERENCE.md for its defaults."*++Search and query rows are lean for remote callers by default; see+[Search and query result rows](README.md#search-and-query-result-rows).+The `fields` parameter on `search` and `query` (`lean` or `full`) selects+the row shape per call.++## `add_timeline_entry`++Append an entry to the canonical Markdown timeline and structured timeline store in one committed write. Exact replay changes neither store.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `request_id` | string | Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. |+| `slug` (required) | string | Slug of the page whose timeline to append to. |+| `date` (required) | string | Entry date, strict YYYY-MM-DD (e.g. '2026-04-03'). Timestamps and non-calendar dates are rejected. |+| `summary` (required) | string | One-line summary of what happened on that date. |+| `detail` | string | Longer free-text detail behind the summary. |+| `source` | string | Provenance ref for the entry, e.g. a meeting slug like 'meetings/2026-04-03' or a URL. |++## `cancel_job`++Cancel a waiting, active, or delayed job. Agent-scoped tokens (no admin) can cancel only jobs they own.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `id` (required) | number | Job ID |++## `cancel_write_request`++Cancel your accepted write before publication starts. Returns the actual receipt: running/recovering or already-terminal requests may remain unchanged. Cancellation cannot undo published bytes or a committed fact withdrawal.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `request_id` (required) | string | The original request UUID. Only this principal’s currently authorized requests are accessible. |++## `capture`++Capture a quick note into the brain — the "just remember this" write. Auto-derives a stable inbox/ slug from the content date + hash (recapturing identical text is idempotent), merges frontmatter, refuses binary/empty payloads, then delegates to put_page (inheriting its fences and provenance stamping). Prefer capture for quick notes and put_page when you need to control the slug, type, or an existing page's content. For structured facts about entities, prefer remember.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `source_id` | string | Source to mutate. Defaults to the selected source. Remote callers may only use their current write source. |+| `expected_revision` | string | Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes. |+| `force` | boolean | Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard. |+| `request_id` | string | Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. |+| `who` | string | For event captures, comma-separated entity slugs. |+| `what` | string | For event captures, the event description. |+| `where` | string | For event captures, the location. |+| `kind` | string | For event captures, the event kind. |+| `depth` | string | For event captures, the depth page to link. |+| `content` (required) | string | Markdown or plain text to capture. File paths are NOT accepted over MCP — read the file yourself and pass its content (the CLI --file lane is local-only). |+| `local_file` | string | Trusted local CLI only (--file): the absolute path of the captured file. Recorded as the page origin only when it lies inside the source and names the slug; the path itself is never stored. Remote callers are refused. |+| `slug` | string | Target slug. Default: inbox/YYYY-MM-DD-<sha8-of-content> (stable per content — recapturing identical text hits the same slug); type diary/event routes under life/. Fenced clients: the default lands under your first bound prefix. |+| `type` | string | Page type for the stamped frontmatter. Omitted: the content's frontmatter `type:` when present, else 'note'. An explicit type (this param or a frontmatter `type:`) must be declared by the active schema pack; undeclared types are rejected before writing, naming the declared vocabulary. |++## `context_pack`++MEMORY VERB (v1): budget-packed session-boundary bundle for a set of standing entities — entity cards + open threads + hot facts, zero-LLM, sub-second. Call at session start (warm cold context) and after compaction (rehydrate what the summary lost). WORLD-ONLY by default; pass include_private (honored for LOCAL trusted callers only) to widen all arms. budget_tokens packs server-side (response reports budget_used + dropped_count; cards pack first, then facts). Branch on structured fields, never prose. protocol_version rides every response.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `entities` (required) | string | Comma-separated entity names/slugs to bundle. Capped at 8. |+| `budget_tokens` | number | Server-side token budget (char/4). Cards pack first, then facts; each item costs its rendered line and the envelope + section headers are reserved, so `text` fits the budget. Response adds budget_tokens, budget_used (tokens of `text`), dropped_count. |+| `since` | string | ISO 8601 datetime. When set, open-thread events are filtered to those after this cursor. |+| `session_id` | string | Opaque session id; keys the hot-memory cache and (on the push path) the session cursor. |+| `include_private` | boolean | Local trusted callers only: widen ALL arms to include private facts. Ignored (world-only) for remote callers. Default false. |++## `delta`++MEMORY VERB (v1): "what changed since T" for heartbeats — pages updated after `since` + hot facts newer than `since` + open-thread events after `since`, zero-LLM. Lets a periodic wake maintain warm state in O(changes) instead of re-deriving. Optionally scope thread deltas to `entities`. WORLD-ONLY by default; include_private honored for local trusted callers only. budget_tokens packs server-side (pages first, then facts; threads are never dropped). protocol_version rides every response.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `since` | string | ISO 8601 cursor. Returns pages/facts/thread-events newer than this timestamp. Optional when session_id carries an established cursor. |+| `since_slug` | string | Stateless keyset resume: pass back `next_cursor.slug` from the previous response (paired with `since`=next_cursor.since) to page through pages sharing one timestamp. Ignored when session_id is set (the session cursor carries it). |+| `entities` | string | Optional comma-separated entity scope for thread-event deltas. Capped at 8. |+| `budget_tokens` | number | Server-side token budget (char/4). Pages pack first, then facts; each item costs its rendered line and the envelope + section headers + every thread line are reserved, so `text` fits the budget. Threads are never dropped (budget_used can exceed the budget only when the header + threads alone do). Response adds budget_tokens, budget_used (tokens of `text`), dropped_count. |+| `session_id` | string | Opaque session id. Drives the per-session cursor: the first call establishes it, each call advances it to the newest DELIVERED change (at-least-once — with has_more:true the undelivered tail returns on the next wake). Without it, pass an explicit `since` for a stateless delta. |+| `include_private` | boolean | Local trusted callers only: widen ALL arms to include private facts. Ignored (world-only) for remote callers. Default false. |++## `edit_page`++Change part of an existing page without resending it: prefer this over put_page for small changes to large pages. Read get_page with include_content:true and pass its revision as expected_revision. Each edit replaces old_text with new_text; edits apply in order, each to the text the previous edit produced, and each old_text must match exactly once in that content. Protected takes and facts sections never match (use the takes_* operations or remember/forget). All edits publish together or none do, through the same receipts, fences and write-through as put_page. Returns the new revision and a unified diff of your view (at most 8 KB). Refusals name the edit: edit_no_match, edit_ambiguous_match (with match_count), edit_protected_span, edit_invalid; a stale revision returns revision_conflict with current_revision. Retain request_id and repeat identical arguments after a pending receipt.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `slug` (required) | string | Slug of the existing page to edit. |+| `expected_revision` (required) | string | The `revision` from get_page include_content:true. The edit is refused if the page changed since. |+| `edits` (required) | array | 1 to 50 replacements, applied in order and all or nothing. |+| `source_id` | string | Source to mutate. Defaults to the selected source. Remote callers may only use their current write source. |+| `request_id` | string | Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. |++## `entity`++MEMORY VERB (v1): inspect ONE known person/company/project card — zero LLM calls, sub-100ms. Resolution: alias > exact title > slug-suffix; ties break on most-recently-touched. NEVER errors on a miss: returns found:false plus near-miss suggestions with create_safety hints (exists | probable | unknown — whether writing a new page would duplicate). Routing: for facts/snippets retrieval use recall; for broad questions needing reasoning use synthesize (expensive).++| Parameter | Type | Guidance |+| --- | --- | --- |+| `name` (required) | string | Free-text name, alias, or slug (e.g. "Alice Example", "people/alice-example"). |++## `find_anomalies`++Returns statistical anomalies in recent page activity, grouped by cohort (tag or type). Use this for questions about what stood out, what's unusual, or what changed recently. Returns explanatory cohorts (e.g. '15 pages tagged wedding touched on 2026-04-28, baseline 0.3/day') so you can speak about patterns the user wouldn't have searched for. Cohort kinds: tag, type. Year cohort is deferred to a later release.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `since` | string | ISO date YYYY-MM-DD. Default = today (UTC). |+| `lookback_days` | number | Days of history for the baseline. Default 30. |+| `sigma` | number | Sigma threshold. Default 3.0. |++## `forget`++MEMORY VERB (v1): expire a remembered fact by id — the protocol delete verb. `id` is the opaque string id returned by remember and recall (facts[].fact_id) — never a page slug. Idempotent: forgetting an already-expired fact returns expired:false (success), unknown id returns a not_found error. The fact is expired (audit trail kept), not deleted.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `request_id` | string | Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. |+| `id` (required) | string | Opaque fact id from remember/recall (facts[].fact_id). Never a page slug. |+| `reason` | string | Optional reason, written to the fact's audit trail. Default: "forgotten". |++## `get_agent_job`++Poll an agent job submitted via submit_agent. Returns a trimmed status view (id, status, timestamps, error_text, result) plus queue_position (waiting jobs ahead in claim order; 0 = next) while the job is still waiting. Requires the `agent` OAuth scope; only jobs owned by the calling client are visible.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `id` (required) | number | Job id returned by submit_agent |++## `get_backlinks`++List incoming links to a page++| Parameter | Type | Guidance |+| --- | --- | --- |+| `slug` (required) | string | Slug of the page whose incoming links to list. |+| `source_id` | string | Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers. |+| `all_sources` | boolean | Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely. |++## `get_ingest_log`++Get recent ingestion log entries++| Parameter | Type | Guidance |+| --- | --- | --- |+| `limit` | number | Max entries (default 20) |++## `get_page`++Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (see v0.26.5 recovery window). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns).++| Parameter | Type | Guidance |+| --- | --- | --- |+| `slug` (required) | string | Page slug |+| `fuzzy` | boolean | Enable fuzzy slug resolution (default: false) |+| `include_content` | boolean | #2225: include the canonical serialized `content` field (frontmatter + body + timeline sentinel) for lossless get→edit→put_page round-trips. Default false — it roughly duplicates compiled_truth + timeline, so read-only callers should not pay for it. |+| `include_deleted` | boolean | v0.26.5: surface soft-deleted pages with deleted_at populated (default: false). Used by restore workflows. |+| `include_timeline_entries` | boolean | #5709: also return `timeline_entries`, the page's timeline rows (the same rows and filtering as get_timeline for this caller). Default false to keep the payload small. |+| `source_id` | string | #4329: scope the lookup to a single source (a multi-source brain can hold the same slug in several sources). Defaults to ctx.sourceId / the caller's grant. '__all__' spans every source for trusted local callers, your granted sources for remote callers. |++## `get_recent_salience`++Returns readable pages recently touched and ranked by activity salience and recency. Unrestricted local reads include deterministic 0..1 emotional_weight, take density, and recency decay. Holder-restricted reads count only permitted active takes, use zero emotional_weight, and select recent pages by updated_at; unrestricted local reads retain take-driven touches. Use this when the user asks what's been going on, what's notable, what's hot, anything crazy happening, or for any open-ended 'current state' question about themselves or their work. Do NOT run a semantic search for these — salience surfaces what's unusual without needing a search term.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `days` | number | Window in days. Default 14. |+| `limit` | number | Max results (default 20, capped at 100). |+| `slugPrefix` | string | Optional slug-prefix filter, e.g. 'personal' or 'wiki/people'. |+| `recency_bias` | string (`flat`, `on`) | v0.29.1: how to weight recency in the salience score.<br> 'flat' (DEFAULT) — v0.29.0 behavior. Every page gets 1/(1+days_old).<br> Stable, predictable; what most callers want.<br> 'on' — Per-prefix decay map. concepts/originals/writing/<br> become evergreen (recency component = 0); daily/,<br> media/x/, chat/ decay aggressively. Use when the<br> user explicitly biases for recency-aware salience<br> ('what's been salient lately' vs 'what matters<br> in this brain regardless of when'). |++## `get_skill`++Fetch one skill's full instructions by name. Returns `{name, frontmatter (sanitized), body, usable_tools, unavailable_tools, client_guidance}`. The `body` is prose — read it as your operating instructions for this task, and when it says to search / store / look something up, call the same-named MCP tool on THIS server. There is nothing to 'execute' — the value is the instructions plus your tool calls back to this server. Tools listed in `unavailable_tools` won't work for you (not exposed here, or beyond your access) — adapt accordingly. Size-capped; read-scope; requires the owner to have enabled mcp.publish_skills. On a shared brain, pass schema_version:2 with qualified_id and revision from discovery to fetch exact instructions and their approved dependency manifest. get_skill_asset retrieves declared files from that revision as data; downloading never grants execution or tool permissions.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `schema_version` | number | Request 2 for an immutable canonical revision. |+| `qualified_id` | string | Exact version 2 qualified skill identity. |+| `expected_brain_id` | string | Assert the connected persistent brain identity from version 2 discovery. This never routes to another brain. |+| `source_incarnation` | string | Source incarnation from version 2 discovery. |+| `pack_id` | string | Canonical pack identifier. |+| `revision` | string | Exact immutable revision, or omit for the current head. |+| `name` | string | Skill name exactly as returned by list_skills (or the brain-pack skill slug when source_id is set). |+| `source_id` | string | Optional: fetch a brain-resident pack skill from this source instead of the host catalog. Disambiguates a slug that exists on more than one source (see list_brain_skillpack). |++## `get_skill_asset`++Read a bounded, owner-approved file from an exact sealed skill revision. Does not execute downloaded bytes.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `source_id` | string | Exactly one granted source. |+| `source_incarnation` | string | Expected source incarnation from the qualified catalog. |+| `name` | string | Skill name when not selecting by qualified_id. |+| `pack_id` | string | Pack identifier when not selecting by qualified_id. |+| `qualified_id` | string | Qualified skill key from version 2 discovery. |+| `expected_brain_id` | string | Assert this connected persistent brain identity without routing to another brain. |+| `revision` (required) | string | Immutable revision from get_skill. |+| `path` (required) | string | Exact path in the approved revision file manifest. |++## `get_write_request`++Read your durable write receipt by request_id. Requires write scope and this operation in the current grant. Foreign, missing, and no-longer-accessible requests return the same not_found error; private journal input and recovery bytes are never returned.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `request_id` (required) | string | The original request UUID. Only this principal’s currently authorized requests are accessible. |++## `list_brain_skillpack`++List brain-resident skillpacks this brain ships (per-source). Returns each pack's skills, one-line descriptions, the schema pack it targets + whether that matches this brain, and a git scaffold spec. Read-only; gated by mcp.publish_skills. After orienting, call this and ask the user whether to install any pack the brain offers (gbrain skillpack scaffold <spec>).++## `list_link_sources`++List distinct link_source provenances in the brain with edge counts (e.g. citation-graph, manual, markdown)++## `list_pages`++List pages with optional filters. For 'what's recent / what did I touch this week' questions, use list_pages with sort=updated_desc instead of semantic search. Default 50 rows; remote callers are capped at 100 (local CLI callers' explicit limits are honored). A result with exactly `limit` rows may be truncated. For exhaustive listing, page with updated_after=<last row's updated_at_iso> + updated_after_slug=<last row's slug> until a page returns fewer rows than the limit (the keyset forces sort=updated_asc; a bare updated_after cursor skips rows sharing the cursor timestamp).++| Parameter | Type | Guidance |+| --- | --- | --- |+| `type` | string | Filter by page type |+| `tag` | string | Filter by tag |+| `limit` | number | Max results (default 50; remote callers are capped at 100) |+| `offset` | number | Skip first N rows (pagination). Engine-supported since PageFilters gained offset; previously accepted at the CLI and silently dropped. |+| `updated_after` | string | ISO date (YYYY-MM-DD) or full timestamp. Returns pages with updated_at > value. Bare (without updated_after_slug) this is LOSSY across rows sharing one timestamp — a bulk sync stamps one now() across a transaction; pair with updated_after_slug to page exactly. |+| `updated_after_slug` | string | Keyset cursor slug: pass the last row's slug together with updated_after set to that row's updated_at_iso (column precision — a millisecond-rounded value re-selects same-millisecond rows). Resumes strictly after (updated_at, slug) and forces sort=updated_asc. |+| `sort` | string (`updated_desc`, `updated_asc`, `created_desc`, `slug`) | Sort order. Default updated_desc (matches pre-v0.29). Options: updated_desc, updated_asc, created_desc, slug. |+| `include_deleted` | boolean | v0.26.5: include soft-deleted pages (default: false). Used by restore workflows and operator diagnostics. |+| `source_id` | string | v0.46.25: scope listing to a single source. Defaults to OperationContext.sourceId / federated scope. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources. |++## `list_skills`++List the skills this agent's brain publishes. A skill is a named prose instruction set (NOT executable code) that teaches you how to do a task using this server's other tools. Returns a flat catalog — each entry has a name, one-line description, triggers (phrasings that should invoke it), and `usable_tools` / `unavailable_tools` (which tools the skill calls that you CAN vs CANNOT call given this server + your access). To actually use a skill, call get_skill with its name, read the returned prose, and follow it — calling the correspondingly-named tools on THIS server. The response also carries an `instructions` envelope explaining this protocol. On a shared brain, use schema_version:2 for source-qualified identities, immutable revisions, pagination and complete declared requirements. Only authorized sources and owner-approved file classes are visible; pre-migration servers retain their legacy prose catalog. Read-scope; published only when the brain owner enabled mcp.publish_skills.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `schema_version` | number | Request 2 for the canonical source-qualified sealed catalog; omitted preserves version 1. |+| `limit` | number | Version 2 page size, 1-100. |+| `cursor` | string | Version 2 opaque snapshot cursor. |+| `source_id` | string | Narrow version 2 enumeration to one permitted source. |+| `section` | string | Optional: only skills whose routing section matches this exactly. |++## `list_write_requests`++List your currently authorized write receipts in one source, newest first. Useful when an acknowledgment was lost. Results and pagination exclude other principals and inaccessible targets; no private payloads or cross-principal queue counts are exposed.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `source_id` | string | Source to inspect. Defaults to the caller’s resolved source. |+| `limit` | number | Number of visible receipts, 1–100. Default 25. |+| `before` | string | Opaque next cursor from the previous response. |++## `put_page`++Replace a complete canonical Markdown page. Read get_page with include_content:true and pass its revision as expected_revision; force explicitly overwrites the current revision. Omitting both permits creation only. Retain a UUID request_id and repeat identical arguments after transport failure or a pending receipt. Content, tags, sanitized text projections, versions and the committed receipt publish together; embedding and optional Git effects have separate status. Remote callers preserve protected facts/takes fences; automatic graph links are skipped for untrusted writes. A stdio `gbrain serve` sweeps them at startup + on idle; `gbrain serve --http` does not self-sweep — run `gbrain sweep --once` or use trusted local capture/put_page for inline link extraction. Remote callers receive write_through.warning when no repo is configured. For file input use gbrain capture --file PATH --slug SLUG.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `source_id` | string | Source to mutate. Defaults to the selected source. Remote callers may only use their current write source. |+| `expected_revision` | string | Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes. |+| `force` | boolean | Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard. |+| `request_id` | string | Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. |+| `slug` (required) | string | Page slug |+| `content` (required) | string | Complete markdown content with YAML frontmatter. REPLACES the entire page; this is not a partial edit. Read the canonical page first with `get_page include_content:true` before modifying it. |+| `allow_empty` | boolean | Allow overwriting an existing non-empty page with empty/whitespace-only content (default: false). Without it, put_page rejects the empty overwrite — the empty-stdin failure class. |+| `source_kind` | string | Ingestion channel taxonomy (capture-cli \| put_page \| webhook \| …). Remote callers: SERVER-STAMPED, client value ignored. |+| `source_uri` | string | Original URI/path/message-id the event carried. Remote callers: SERVER-STAMPED null. |+| `ingested_via` | string | Richer label paired with source_kind. Remote callers: SERVER-STAMPED. |++## `query`++Hybrid search with vector + keyword + multi-query expansion. Prefer `query` for concept / synonym / landscape questions ('all the X that do Y', 'the landscape of Z') — expansion recovers synonym- and outcome-phrased matches a single embedding misses. Still top-K, and the default count when `limit` is omitted depends on the configured search mode (10 conservative / 25 balanced / 50 tokenmax — see the `limit` param description); pass `limit` explicitly for a stable count regardless of mode. When the answer needs the surrounding conversation or section, pass `return_unit` ('page' / 'section' / 'window') to get that evidence in one call instead of get_page per hit; conversation pages already come back whole by default (return_unit 'auto'; 'chunk' opts out). For exhaustive enumeration use list_pages; for exact known tokens `search` is cheaper (no expansion LLM call). For personal/emotional questions ('what's going on with me', 'anything notable', 'how am I feeling'), prefer get_recent_salience, find_anomalies, or get_recent_transcripts. Semantic search returns polished pages and misses recent activity bursts. Do NOT assume words like 'crazy', 'notable', or 'big' mean impressive — they often mean difficult or emotionally charged.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `query` | string | Question or topic text for hybrid retrieval with expansion (e.g. 'agents that do web research'). This is the search text param — there is no `text` or `q` param. Optional ONLY because `image` is the alternative entry point; a call with neither fails with invalid_params. |+| `image` | string | Base64-encoded image bytes for image-similarity search (CLI: --image <path>). |+| `image_mime` | string | MIME type for the image bytes (auto-derived from path on CLI; required when calling op directly). |+| `limit` | number | Max results. Omitted or 0 resolves from the active search mode (10 conservative / 25 balanced / 50 tokenmax by default, or the configured `search.searchLimit` override) — for both text queries and image-similarity queries (`image` param). |+| `offset` | number | Skip first N results (for pagination) |+| `types` | array | Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters. |+| `snippet_chars` | number | Cap each result's chunk_text at N characters (a "… [truncated]" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800) |+| `return_unit` | string (`chunk`, `window`, `section`, `page`, `auto`) | Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').<br> 'chunk' — the ranked chunk only (~300-450 tokens per result).<br> 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).<br> 'section' — the enclosing markdown section, or the conversation rounds around the hit.<br> 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.<br> 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.<br>Non-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta. |+| `return_window` | number | Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1). |+| `token_budget` | number | Token budget. Chunk mode, and whenever return_unit is omitted: caps the cumulative chunk payload (results that would overflow are skipped). Explicit non-chunk return_unit: the budget for delivered evidence (default search.return_budget_default = 6000, auto 24000; remote max search.return_budget_max_remote = 32000). |+| `expand` | boolean | Request multi-query expansion (default: true in every search mode, regardless of search.expansion). Set false to opt out. Requires configured embedding and expansion providers; a cloud expander receives the query and may charge for the call. Response metadata expansion_applied reports whether variants were actually used. |+| `detail` | string | Result detail level: low (compiled truth only), medium (default, all with dedup), high (all chunks) |+| `mode` | string | Search mode (conservative\|balanced\|tokenmax). Local callers only; remote uses configured mode. |+| `lang` | string | Filter to chunks where content_chunks.language matches (e.g., typescript, python, ruby) |+| `symbol_kind` | string | Filter to chunks where content_chunks.symbol_type matches (e.g., function, class, method, type, interface) |+| `near_symbol` | string | Anchor retrieval at this qualified symbol name (e.g., BrainEngine.searchKeyword). Enables A2 two-pass. |+| `walk_depth` | number | Structural walk depth 1-2. Default 0 (off). Expands anchors through code_edges with 1/(1+hop) decay. |+| `salience` | string (`off`, `on`, `strong`) | v0.29.1 salience boost — emotional_weight + take_count, NO time component.<br> 'off' — default for entity / canonical / definitional queries<br> 'on' — surface emotionally-weighted + take-rich pages<br> 'strong' — aggressive mattering tilt<br>Omit and gbrain auto-detects from query text. Independent of `recency`. |+| `recency` | string (`off`, `on`, `strong`) | v0.29.1 recency boost — per-prefix age decay, NO mattering signal.<br> 'off' — default for canonical truth<br> 'on' — daily/, media/x/, chat/ decay aggressively; concepts/, originals/, writing/ stay evergreen<br> 'strong' — multiplies the recency factor by 1.5 (use for 'today' / 'right now')<br>Omit and gbrain auto-detects. Independent of `salience` (orthogonal axes). |+| `since` | string | v0.29.1 — filter to pages whose effective_date is >= this. ISO-8601 (YYYY-MM-DD or full timestamp) OR relative ('7d', '2w', '1y'). Replaces deprecated `afterDate`. |+| `until` | string | v0.29.1 — filter to effective_date <= this. Same format as `since`. Replaces deprecated `beforeDate`. YYYY-MM-DD lands at end-of-day. |+| `source_id` | string | v0.34: scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile). Pass '__all__' to span every source for trusted local callers. For remote callers, '__all__' uses the same scope as omission: an OAuth grant when present, otherwise the transport-computed federated sources for grantless local stdio. |+| `cross_modal` | string (`text`, `image`, `both`, `auto`) | v0.36 cross-modal search routing.<br> 'text' (default for non-image-intent queries) — text-only path, no behavior change vs v0.35.<br> 'image' — route the query through Voyage multimodal-3 + the embedding_image column. Best for 'show me photos of...' phrasings.<br> 'both' — run text AND image searches in parallel; merge via weighted RRF.<br> 'auto' — same effect as omitting the field; intent classifier decides based on query phrasing. |+| `embedding_column` | string | v0.36: route vector search through a non-default embedding column. Defaults to 'embedding' (the brain's primary column) unless `search_embedding_column` config sets a different default. Per-call override for A/B benchmarking across providers (e.g. 'embedding_voyage', 'embedding_openai'). Column MUST be declared in the `embedding_columns` config registry — unknown names throw with a paste-ready hint listing valid columns. |+| `adaptive_return` | boolean | v0.41.33 — return a TIGHT, intent-sized result set instead of the full top-K. YOU (the agent) set this per query to serve the user well:<br> TRUE when the user's question has a small, specific answer — a lookup ('what is X', 'who is Y', 'what's my <thing>', 'what did Z decide'), a single-fact recall, or when you'll route the result into a precise downstream step (a classifier, a decision, an exact citation). The user gets the answer, not a wall of loosely-related pages, and you spend fewer tokens reading noise.<br> Omit / FALSE for breadth — 'everything about X', 'list all', 'what do I know about Y', exploration, brainstorming, or any time you'd rather see more candidates and judge for yourself. Recall matters more there, so take the full top-K.<br>Safe by construction: it NEVER returns empty when there are matches (you always get at least the top hit), and it only applies to the first page (omit when paginating). Caps come from config (search.adaptive_return_entity_max / _other_max; default 2 / 6) — pass `limit` 1 alongside this for a hard single-answer cap. |+| `autocut` | boolean | v0.42.3.0 — autocut is the SMART DEFAULT (already ON when the reranker runs, which it does in the default search mode). It returns only the confident cluster by cutting where the relevance score drops off a cliff, so an obvious single answer comes back as 1 result and a genuine handful comes back as that handful — not a fixed wall of 20+.<br> You almost never set this. Pass FALSE only to FORCE the full top-K when you deliberately want breadth — broad exploration, 'show me everything about X', enumeration where you'd rather over-collect and judge for yourself, or when you suspect the top hit is wrong and want to see the alternatives.<br> TRUE is redundant in default mode (it's already on); it only matters to override a brain whose config turned autocut off.<br>Safe by construction: never returns empty when there are matches, only applies to the first page (omit when paginating), and is a no-op when no reranker scored the results (so it can't cut on an untrustworthy signal). Distinct from `adaptive_return`: autocut cuts on the score cliff; adaptive_return caps by question intent. Leave both unset for the smart default. |+| `relational` | boolean | v0.43 — relational recall arm. SMART DEFAULT (on in balanced/tokenmax). When the question is about a RELATIONSHIP ('who invested in widget-co', 'who introduced me to alice', 'what connects fund-a and fund-b'), the brain resolves the named entity and walks its typed-edge graph (invested_in, works_at, founded, …), surfacing the answer even when no passage mentions both sides. Pure no-op for non-relational questions. Pass FALSE to force lexical/vector-only retrieval (e.g. debugging why a graph answer appeared). You almost never set this. |++## `recall`++MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. Filters hot-memory facts by entity / since / session_id; pass `query` to ALSO run hybrid search over pages (results[] arm); pass `budget_tokens` for server-side packing (response reports budget_used + dropped_count — never trims client-side). Remote callers see visibility=world facts only. Routing: for ONE known person/company/project card use `entity` (zero LLM); for broad questions needing reasoning use `synthesize` (expensive). Branch on structured fields (status/kind/evidence), never on prose. Every response carries protocol_version.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `entity` | string | Entity slug (canonical). Returns facts about this entity newest first, each labelled with its source_id. Across several granted sources, same-slug entities that no entity-identity group links are different entities: facts comes back empty and ambiguous_entity names each (source_id, entity_slug); pass source_id to read one. |+| `query` | string | MEMORY_VERBS v1: free-text retrieval over pages (hybrid search arm). Response adds results[] (slug, title, chunk, evidence, create_safety, provenance). Combinable with entity (both arms run). Degrades to keyword-only search when no embedding provider is configured (search_degraded notes it; never an error). |+| `budget_tokens` | number | MEMORY_VERBS v1: server-side token budget (char/4 estimate). Facts pack first, then results. Response adds budget_tokens, budget_used, dropped_count. |+| `budget_policy` | string (`facts_first`, `query_first`) | Optional packing order. facts_first preserves legacy behavior (default). query_first packs the ranked page prefix before facts only with a nonblank query and positive finite budget; a positive budget below one token keeps neither arm. No query or inactive budget preserves legacy behavior. Neither policy skips oversized items or truncates. Supplying this option adds budget_packing accounting. Keep fact-focused/entity-filtered questions on facts_first. |+| `source_id` | string | Optional concrete source id for both facts and page results. Narrows the caller’s authorized scope, including an explicit default; a denied, missing, or archived source fails rather than widening. Omit to preserve the existing context/grant scope. |+| `since` | string | ISO 8601 datetime or duration shorthand (e.g. "8 hours ago"). Filters the FACTS arm only, on event time (valid_from, falling back to created_at); composes with `entity` and `session_id`. An unparseable value is rejected (invalid_params). |+| `session_id` | string | Source session id (e.g. topic-A). Returns facts captured in that session. |+| `include_expired` | boolean | When true, include expired_at IS NOT NULL rows. Default false. |+| `supersessions` | boolean | When true, return only the supersession audit log (facts with superseded_by set), newest first by COALESCE(expired_at, valid_until). |+| `limit` | number | Per-arm cap: max fact rows AND max search results. Default 50, cap 100. |+| `grep` | string | Substring filter on fact text (case-insensitive). Applied in SQL before the limit, so matches on high-cardinality entities are found even outside the newest-N window. |+| `include_pending` | boolean | v0.32: when true, response includes pending_consolidation_count (facts not yet promoted to takes by the dream-cycle consolidate phase). One round trip; backward-compatible (field omitted when false). |+| `return_unit` | string (`chunk`, `window`, `section`, `page`, `auto`) | Evidence unit for the results[] arm (needs `query`; default config search.return_unit = 'auto'). 'window' adds neighbor chunks, 'section' the enclosing section or conversation rounds, 'page' the whole page/session (best for multi-session questions), 'auto' the whole page for conversation pages and the ranked chunk unchanged for everything else (budget_tokens or budget_policy without return_unit keeps chunk packing). Non-chunk units return one result per page with `delivered` metadata and a top-level `delivery` block; the evidence is budgeted by budget_tokens (default 6000, auto 24000) and then packed by recall's usual rules. |+| `return_window` | number | Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1). |++## `remember`++MEMORY VERB (v1): save one fact to durable agent memory — the protocol write verb. provenance is REQUIRED (free text, e.g. "conversation 2026-06-12", "user said in chat", "import: notes.md"). Set `entity` whenever the fact is about a specific person/company/project — entity-scoped recall will not find it otherwise. ttl accepts duration shorthand ("30d", "12h") or an absolute ISO 8601 timestamp; ISO-8601 durations like "P30D" are rejected with a fix. visibility defaults to "world" (readable by every agent connected to this brain; pass "private" for local-CLI-only facts). Response: branch on `status` (inserted|duplicate|superseded), never on `status_text` (human rendering only). On duplicate, `id` is the EXISTING fact's id. For bulk extraction from a raw transcript use extract_facts instead.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `source_id` | string | Source to mutate. Defaults to the selected source. Remote callers may only use their current write source. |+| `expected_revision` | string | Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes. |+| `force` | boolean | Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard. |+| `request_id` | string | Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. |+| `fact` (required) | string | The fact to remember, one claim per call. |+| `provenance` (required) | string | Where this fact came from (REQUIRED, free text, max 500 chars). Examples: "conversation 2026-06-12", "user said in chat", "import: meeting-notes.md". |+| `ttl` | string | Optional expiry: duration shorthand ("30d", "12h", "45m") or absolute ISO 8601 timestamp ("2026-07-12T00:00:00Z"). NOT ISO-8601 durations ("P30D" is rejected). Omit = never expires. |+| `entity` | string | Person/company/project this fact is about (name or slug; canonicalized server-side). Set it whenever the fact has a subject — entity-scoped recall misses unattributed facts. |+| `infer_entity` | boolean | Default true. When `entity` is omitted, link the fact to the one entity page the text names exactly (response `entity_inferred: "mention"`); pass false to save it unattributed. |+| `kind` | string (`event`, `preference`, `commitment`, `belief`, `fact`) | Fact kind: event \| preference \| commitment \| belief \| fact (default). |+| `visibility` | string (`world`, `private`) | world (default): readable by every agent connected to this brain — required for the remote remember→recall round-trip. private: local CLI reads only. |++## `request_tools`++Discover this brain's tool catalog and optionally unlock a wider tool surface for your client. No arguments → the catalog visible to YOUR credentials, grouped by area (tool names + one-line summaries). {tools: ["name", ...]} → full read-only schemas for the visible subset of those names (unknown/hidden names are silently omitted). {surface: "verbs"|"starter"|"full"} → persist that tool surface for this client (bounded by the server ceiling; denied when an operator pinned the surface; ~5 changes/hour), then re-issue tools/list to see the new catalog.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `tools` | array | Fetch full read-only tool schemas for these names. Names outside your visible surface are silently omitted (D5). |+| `surface` | string (`verbs`, `starter`, `full`) | Persist this tool surface for your client. Must not exceed the server ceiling; ignored surfaces stay available via no-arg discovery. Takes effect on your next tools/list. |++## `resolve_slugs`++Fuzzy-resolve a partial slug to matching page slugs++| Parameter | Type | Guidance |+| --- | --- | --- |+| `partial` (required) | string | Partial slug or title text to match, e.g. 'alice-ex' or 'meeting notes'. This is the search text param — there is no `text` param. |+| `source_id` | string | Scope resolution to a single source. Defaults to OperationContext.sourceId; when unset, an unqualified resolve spans every federated source (matching search/get_page). Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources. |++## `search`++Cheap hybrid search (vector + keyword + RRF) with no LLM expansion. Best for exact known tokens, names, and structured-field lookups. A populated result set is NOT proof of coverage — for concept / synonym / landscape questions use `query` (adds multi-query expansion); for exhaustive enumeration use list_pages pagination. Pass `return_unit` ('window' / 'section' / 'page') for whole evidence instead of chunks; conversation pages already come back whole by default (return_unit 'auto'; 'chunk' opts out). For personal/emotional questions, prefer get_recent_salience or find_anomalies — they surface activity bursts without needing a search term. For code-symbol questions (callers, callees, definitions, blast radius), use code_callers / code_callees / code_def / code_refs instead — those return structural graph data, not text chunks. For agent memory reads (saved facts + budget-packed retrieval), prefer the `recall` verb.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `query` (required) | string | Search text. Exact tokens, names, and structured-field values work best here (e.g. 'acme-example series A'), since this op does no LLM expansion. This is the search text param — there is no `text` or `q` param. |+| `limit` | number | Max results (default 20) |+| `offset` | number | Skip first N results (for pagination) |+| `mode` | string | Search mode (conservative\|balanced\|tokenmax). Local callers only. |+| `source_id` | string | Scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile); when unset, an unqualified read spans every federated source. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources. |+| `types` | array | Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters. |+| `snippet_chars` | number | Cap each result's chunk_text at N characters (a "… [truncated]" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800) |+| `return_unit` | string (`chunk`, `window`, `section`, `page`, `auto`) | Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').<br> 'chunk' — the ranked chunk only (~300-450 tokens per result).<br> 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).<br> 'section' — the enclosing markdown section, or the conversation rounds around the hit.<br> 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.<br> 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.<br>Non-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta. |+| `return_window` | number | Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1). |+| `token_budget` | number | Token budget for delivered evidence when return_unit is not 'chunk' (default search.return_budget_default = 6000; auto: search.return_budget_conversation = 24000). Ignored in chunk mode. |+| `salience` | string (`off`, `on`, `strong`) | Salience boost (emotional_weight + take_count, no time component): 'off' \| 'on' \| 'strong'. Omit and gbrain auto-detects from query text. Independent of `recency`. |+| `recency` | string (`off`, `on`, `strong`) | Recency boost (per-prefix age decay, no mattering signal): 'off' \| 'on' \| 'strong'. Omit and gbrain auto-detects. Independent of `salience`. Ignored on the keyword-only opt-out path. |++## `submit_agent`++Submit an LLM agent job that the worker dispatches via the gateway-native tool loop. Requires the `agent` OAuth scope. Tools, source, slug prefixes, max concurrency, and daily budget are bound at OAuth client registration time.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `prompt` (required) | string | User prompt for the agent |+| `model` | string | provider:model string (defaults to models.tier.subagent) |+| `allowed_tools` | array | Subset of bound_tools the agent may invoke |+| `allowed_slug_prefixes` | array | Subset of delegated_slug_prefixes for writes; omit for a job-owned namespace |+| `max_turns` | number | Max LLM turns (default 20, hard cap 100) |+| `queue` | string | Queue name (default "default") |++## `synthesize`++[EXPENSIVE / SLOW — makes LLM calls, seconds-to-minutes latency, costs money] MEMORY VERB (v1): answer a broad question using cross-page LLM reasoning with citations and gap analysis. Prefer recall (facts/snippets) or entity (one known card, zero LLM) for lookups — use synthesize only when the answer requires combining evidence across pages. Response carries a best-effort cost block (model, tokens, usd_estimate) plus compose-status fields (synthesis_status, pages_gathered, takes_gathered, warnings); when the LLM compose step fails but retrieval succeeded, `answer` degrades to an extractive digest of retrieved pages (synthesis_status: "extractive_fallback") instead of an error.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `question` (required) | string | The question to answer. |+| `since` | string | Optional temporal window start (ISO 8601 date or datetime). |+| `until` | string | Optional temporal window end (ISO 8601 date or datetime). |++## `traverse_graph`++Traverse link graph from a page. Remote callers default to bidirectional edges (GraphPath[]) at depth 2 (pass depth explicitly for deeper walks); trusted local no-filter callers keep the legacy node shape at depth 5.++| Parameter | Type | Guidance |+| --- | --- | --- |+| `slug` (required) | string | Slug of the page to start the traversal from, e.g. 'people/alice-example'. This is the start-node param — there is no `start` or `root` param. |+| `depth` | number | Max traversal depth (capped at 10). Default 5, except a remote call that lets direction default to 'both' uses 2 (bidirectional path enumeration is combinatorial on hubs); an explicit depth is always honored up to the cap. |+| `link_type` | string | Filter to one link type (per-edge filter, traversal only follows matching edges) |+| `direction` | string (`in`, `out`, `both`) | Traversal direction ('in', 'out', or 'both'). Remote callers default to 'both'; trusted local no-filter callers keep the legacy outgoing-node output. |+| `source_id` | string | Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers. |+| `all_sources` | boolean | Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely. |++## `whoami`++Introspect the calling identity. Returns one of three transport shapes: {transport: "oauth", client_id, client_name, scopes, expires_at, source_id, federated_read}, {transport: "legacy", token_name, scopes, expires_at: null}, or {transport: "local", scopes: []}, or {transport: "stdio", scopes: []} for the auth-less stdio MCP pipe. Throws unknown_transport when the context is ambiguous (remote=true without auth and no transport marker) — fail-closed posture mirroring the v0.26.9 trust-boundary contract.+diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.tsindex 25bb58d64e..0f2bec2661 100644--- a/src/core/cli-flag-registry.generated.ts+++ b/src/core/cli-flag-registry.generated.ts@@ -23,13 +23,13 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'backfill': ['--batch-size', '--brain', '--concurrency', '--dry-run', '--fresh', '--help', '--json', '--keep-index', '--list', '--max-errors', '--max-rows', '--resume', '--source'],'backup': ['--accept-pending', '--background', '--brain', '--confirm-authority-reviewed', '--confirm-backup-compatible', '--confirm-quiesced', '--dir', '--explain', '--follow', '--full', '--help', '--into', '--json', '--mode', '--no-accept-pending', '--output', '--path', '--progress-interval', '--progress-json', '--quiet', '--restore-only', '--source', '--timeout', '--wait'],'bench': ['--baseline', '--brain', '--force', '--from', '--help', '--json', '--label', '--limit', '--source', '--threshold-jaccard', '--threshold-latency-multiplier', '--threshold-top1', '--to', '--tool'],- 'book-mirror': ['--accept-pending', '--access', '--asof', '--author', '--background', '--bound-slug-prefixes', '--brain', '--chapters-dir', '--context-file', '--date', '--days', '--dry-run', '--entities', '--explain', '--fact', '--federated-read', '--file', '--follow', '--full', '--help', '--http', '--image', '--json', '--kind', '--limit', '--max-turns', '--mode', '--model', '--multimodal', '--no-accept-pending', '--no-confirm', '--no-follow', '--once', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--timeout', '--timeout-ms', '--title', '--trusted-extraction', '--types', '--url', '--wait', '--yes'],+ 'book-mirror': ['--accept-pending', '--access', '--asof', '--author', '--background', '--bound-slug-prefixes', '--brain', '--chapters-dir', '--context-file', '--date', '--days', '--dry-run', '--entities', '--explain', '--fact', '--federated-read', '--follow', '--full', '--help', '--http', '--json', '--kind', '--limit', '--max-turns', '--mode', '--model', '--multimodal', '--no-accept-pending', '--no-confirm', '--no-follow', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--timeout', '--timeout-ms', '--title', '--trusted-extraction', '--types', '--url', '--wait', '--yes'],'bootstrap': ['--abbrev-ref', '--abort', '--accept-visibility-change-consequences', '--active', '--all', '--allow-unverified-remote', '--auto', '--brain', '--branch', '--cached', '--confirm', '--count', '--delete-brain', '--diff-filter', '--dim', '--env', '--error-unmatch', '--exclude-standard', '--exit-code', '--file', '--force', '--gbrain-bin', '--get', '--get-url', '--git-dir', '--git-path', '--harness', '--heads', '--help', '--home', '--hostname', '--http', '--id', '--init', '--install', '--is-ancestor', '--is-inside-work-tree', '--jq', '--json', '--local', '--mcp-even-if-plugin', '--minimal', '--name', '--name-only', '--no-capture', '--no-cron', '--no-hooks', '--no-seat', '--no-tags', '--no-verify', '--no-write-fetch-head', '--only', '--others', '--pat-file', '--path', '--pglite', '--porcelain', '--port', '--private', '--project', '--pure', '--push', '--push-only', '--quiet', '--rebase', '--refresh-operations', '--refresh-skills', '--remove', '--repair', '--scope', '--scopes', '--seat', '--set', '--short', '--show', '--show-toplevel', '--skills', '--skip', '--source', '--status', '--surface', '--to', '--token', '--token-name', '--unset-all', '--url', '--verify', '--version', '--visibility', '--workspace', '--yes'],'brainstorm': ['--brain', '--force-rechunk', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--no-save', '--resume', '--save', '--source', '--stale', '--strict-budget', '--yes'],'cache': ['--brain', '--help', '--json', '--source', '--yes'],- 'calibration': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--dry-run', '--entities', '--fact', '--federated-read', '--file', '--full', '--help', '--holder', '--http', '--image', '--json', '--key-prefix', '--kind', '--limit', '--mode', '--multimodal', '--once', '--page', '--path', '--phase', '--regenerate', '--scrub-gstack', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--trusted-extraction', '--types', '--undo-wave', '--url', '--with-calibration', '--yes'],+ 'calibration': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--dry-run', '--entities', '--fact', '--federated-read', '--full', '--help', '--holder', '--http', '--json', '--key-prefix', '--kind', '--limit', '--mode', '--multimodal', '--page', '--path', '--phase', '--regenerate', '--scrub-gstack', '--session', '--since', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--trusted-extraction', '--types', '--undo-wave', '--url', '--with-calibration', '--yes'],'call': ['--brain', '--help', '--json', '--source'],- 'capture': ['--accept-pending', '--access', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--date', '--days', '--depth', '--entities', '--expected-revision', '--explain', '--fact', '--federated-read', '--file', '--follow', '--force', '--full', '--help', '--http', '--image', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--no-accept-pending', '--once', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--request-id', '--scopes', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--stdin', '--surface', '--take', '--timeline', '--timeout', '--trusted-extraction', '--type', '--types', '--url', '--wait', '--what', '--where', '--who', '--yes'],+ 'capture': ['--accept-pending', '--access', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--date', '--days', '--depth', '--entities', '--expected-revision', '--explain', '--fact', '--federated-read', '--file', '--follow', '--force', '--full', '--help', '--http', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--no-accept-pending', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--request-id', '--scopes', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--stdin', '--surface', '--take', '--timeline', '--timeout', '--trusted-extraction', '--type', '--types', '--url', '--wait', '--what', '--where', '--who', '--yes'],'check-backlinks': ['--accept-pending', '--background', '--brain', '--dir', '--dry-run', '--explain', '--follow', '--help', '--json', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--source', '--timeout', '--wait'],'check-resolvable': ['--brain', '--dry-run', '--fix', '--help', '--json', '--skills-dir', '--source', '--strict', '--verbose'],'check-update': ['--brain', '--ff-only', '--force-retry', '--help', '--json', '--markdown', '--migrate-only', '--no-autopilot-install', '--no-bun-floor-check', '--non-interactive', '--refresh-cache', '--remediation-plan', '--source', '--swap-only', '--version', '--yes'],@@ -51,7 +51,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'edges-backfill': ['--all-sources', '--brain', '--concurrency', '--help', '--json', '--max-chunks', '--source', '--workers'],'embed': ['--accept-pending', '--all', '--background', '--batch-size', '--brain', '--break-lock', '--budget-ms', '--catch-up', '--db-url', '--dim', '--dry-run', '--embedding-dimensions', '--embedding-model', '--explain', '--facts', '--follow', '--force', '--help', '--images', '--include-null-signature', '--json', '--max-cost-usd', '--max-facts', '--no-accept-pending', '--no-embed', '--no-embedding', '--pace', '--pace-max-concurrency', '--path', '--pglite', '--priority', '--progress-interval', '--progress-json', '--quiet', '--show-toplevel', '--slugs', '--source', '--stale', '--status', '--supabase', '--timeout', '--to', '--wait', '--yes'],'engine': ['--apply-rewrites', '--brain', '--break-lock', '--db-url', '--help', '--http', '--json', '--path', '--prefer-postgres', '--probe', '--source', '--supabase', '--url', '--yes'],- 'enrich': ['--accept-pending', '--access', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--concurrency', '--confirm-destructive', '--date', '--days', '--dry-run', '--embedding-dimensions', '--embedding-model', '--entities', '--explain', '--fact', '--federated-read', '--file', '--follow', '--force', '--full', '--help', '--http', '--image', '--input', '--json', '--kind', '--limit', '--max-cost', '--max-cost-usd', '--max-runtime', '--max-usd', '--min-context', '--mode', '--model', '--multimodal', '--no-accept-pending', '--once', '--order', '--output', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--rate', '--reenrich-after', '--resume', '--session', '--since', '--slug', '--slugs', '--source', '--source-id', '--sources', '--stats', '--status', '--surface', '--take', '--thin', '--thin-threshold', '--timeline', '--timeout', '--trusted-extraction', '--types', '--url', '--wait', '--workers', '--yes'],+ 'enrich': ['--accept-pending', '--access', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--concurrency', '--confirm-destructive', '--date', '--days', '--dry-run', '--embedding-dimensions', '--embedding-model', '--entities', '--explain', '--fact', '--federated-read', '--follow', '--force', '--full', '--help', '--http', '--input', '--json', '--kind', '--limit', '--max-cost', '--max-cost-usd', '--max-runtime', '--max-usd', '--min-context', '--mode', '--model', '--multimodal', '--no-accept-pending', '--order', '--output', '--page', '--path', '--progress-interval', '--progress-json', '--quiet', '--rate', '--reenrich-after', '--resume', '--session', '--since', '--slugs', '--source', '--source-id', '--sources', '--stats', '--status', '--surface', '--take', '--thin', '--thin-threshold', '--timeline', '--timeout', '--trusted-extraction', '--types', '--url', '--wait', '--workers', '--yes'],'eval': ['--ab-relational', '--accept-pending', '--against', '--allow-incomplete-judgments', '--allow-mixed-run-config', '--allow-regression', '--asof', '--autocut', '--background', '--baseline', '--batch', '--brain', '--budget-usd', '--budget-usd-answer', '--budget-usd-retrieval', '--by-type', '--by-type-floor', '--by-type-floor-metric', '--candidate', '--capture-pool', '--committed-baseline', '--compare', '--compare-limit', '--concurrent', '--config-a', '--config-b', '--corpus', '--cycles', '--days', '--decide', '--decide-calibration', '--decide-dataset', '--decide-force-on', '--decide-provider', '--decide-threshold', '--dedup-cosine', '--dedup-max-per-page', '--dedup-type-ratio', '--dimensions', '--distance-min', '--draws', '--embed-cache', '--embedder', '--embedding-dimensions', '--embedding-model', '--eval-pool-depth', '--expand', '--expansion', '--expansion-replay', '--expansion-variant-budget', '--explain', '--fixtures', '--follow', '--force-rechunk', '--format', '--from-capture', '--from-db', '--gold', '--grounding-min', '--harness', '--help', '--include-abstention', '--include-holdout', '--input', '--json', '--judge', '--judge-concurrency', '--judge-model', '--justification', '--k', '--keyword-only', '--limit', '--llm', '--max-pair-chars', '--max-tokens', '--max-usd', '--mcp-only', '--md', '--metric', '--min-recall', '--mode', '--model', '--models', '--modes', '--name-only', '--no-accept-pending', '--no-cache', '--no-embed-cache', '--no-expand', '--no-llm', '--no-trajectory', '--older-than', '--out', '--output', '--output-dir', '--parallel', '--parity-baseline', '--pglite', '--progress-interval', '--progress-json', '--qrels', '--queries-file', '--query', '--question-ids', '--questions', '--quiet', '--reader-max-tokens', '--reader-mode', '--receipt-dir', '--record', '--refresh-cache', '--reranker', '--resume-from', '--retrieval-only', '--rrf-k', '--rubric-version', '--runs', '--sample', '--sampling', '--save', '--search-pin', '--seed', '--severity', '--short', '--show-toplevel', '--since', '--skip-replay', '--slot', '--slot-a-model', '--slot-b-model', '--slot-c-model', '--slug', '--slug-prefix', '--source', '--stale', '--status', '--strategy', '--suite', '--suites', '--supabase', '--task', '--threshold', '--threshold-expected-top1', '--threshold-first-relevant-hit', '--threshold-jaccard', '--threshold-latency-multiplier', '--threshold-recall-at-k', '--threshold-top1', '--timeout', '--tool', '--top-k', '--top-regressions', '--until', '--update-baseline', '--usefulness-min', '--vectors', '--verbose', '--verify', '--wait', '--with-code-intel', '--yes'],'export': ['--accept-pending', '--background', '--brain', '--dir', '--explain', '--fix', '--follow', '--help', '--json', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--repo', '--restore-only', '--slug-prefix', '--source', '--timeout', '--type', '--wait'],'extract': ['--accept-pending', '--admin-intent', '--after-slug', '--apply-preview', '--background', '--backup-verified', '--brain', '--break-lock', '--by-mention', '--catch-up', '--checkpoint', '--concurrency', '--confirm', '--db-url', '--dir', '--dry-run', '--expected-epoch', '--expected-state', '--explain', '--follow', '--from-meetings', '--help', '--include-frontmatter', '--infer-dates', '--json', '--kind', '--limit', '--manifest', '--ner', '--no-accept-pending', '--pack', '--path', '--progress-interval', '--progress-json', '--prune-orphans', '--quiet', '--rebuild', '--repair-attendance', '--self-transfer', '--since', '--source', '--source-id', '--stale', '--timeout', '--type', '--verbose', '--wait', '--workers', '--yes'],@@ -70,7 +70,7 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'init': ['--all', '--allow-create-db', '--allow-docker', '--brain', '--break-lock', '--chat-model', '--check', '--content-root', '--db-only', '--dim', '--embedding-dimensions', '--embedding-model', '--entity', '--expansion-model', '--force', '--git', '--grant-types', '--help', '--http', '--issuer-url', '--json', '--key', '--local-postgres', '--mcp-only', '--mcp-url', '--migrate-only', '--model', '--no-embedding', '--no-expand', '--no-git', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--path', '--pglite', '--prefer-postgres', '--probe', '--provenance', '--quiet', '--schema-pack', '--scopes', '--show-toplevel', '--skip-embed-check', '--source', '--stale', '--status', '--supabase', '--surface', '--to', '--touchpoint', '--url', '--version', '--yes'],'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],'integrity': ['--accept-pending', '--auto', '--backend', '--background', '--brain', '--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', '--supabase', '--timeout', '--type', '--url', '--wait'],- 'jobs': ['--abbrev-ref', '--access', '--aliases', '--all', '--allow-empty', '--allow-shell-jobs', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--bound-slug-prefixes', '--brain', '--break-lock', '--by-mention', '--cached', '--catch-up', '--cli-path', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--cost-estimate', '--date', '--days', '--delay', '--detach', '--diff-filter', '--dir', '--drain', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--entities', '--exclude', '--exclude-standard', '--expect', '--explain', '--fact', '--facts', '--federated-read', '--file', '--filters', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--format', '--fresh', '--from-meetings', '--full', '--full-history', '--hard-deadline', '--health-interval', '--help', '--http', '--idempotency-key', '--ids', '--image', '--images', '--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', '--kind', '--limit', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--mcp-only', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name-only', '--ner', '--nice', '--no-auto-embed', '--no-delegate', '--no-embed', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-pull', '--no-renames', '--no-schema-pack', '--no-verify', '--no-worker', '--now', '--older-than', '--once', '--order', '--others', '--output', '--override-disabled', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--path', '--pause', '--phase', '--pid-file', '--priority', '--prune-orphans', '--queue', '--quiet', '--reason', '--rebuild', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--repo', '--reset-checkpoint', '--resume', '--retry-failed', '--review-lower', '--segment-limit', '--select', '--serial', '--session', '--show-toplevel', '--sigkill-rescue', '--since', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--stats', '--status', '--strategy', '--surface', '--swap-only', '--take', '--target', '--thin', '--thin-threshold', '--timeline', '--timeout', '--timeout-ms', '--trusted-extraction', '--type', '--types', '--uninstall', '--url', '--user', '--vectors', '--verbose', '--verify', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],+ 'jobs': ['--abbrev-ref', '--access', '--aliases', '--all', '--allow-empty', '--allow-shell-jobs', '--asof', '--auto', '--background', '--backoff-delay', '--backoff-jitter', '--backoff-type', '--batch-size', '--bound-slug-prefixes', '--brain', '--break-lock', '--by-mention', '--cached', '--catch-up', '--cli-path', '--cluster-errors', '--concurrency', '--confidence', '--confirm-destructive', '--cost-estimate', '--date', '--days', '--delay', '--detach', '--diff-filter', '--dir', '--drain', '--dry-run', '--embedding-dimensions', '--embedding-model', '--empty', '--entities', '--exclude', '--exclude-standard', '--expect', '--explain', '--fact', '--facts', '--federated-read', '--filters', '--fix', '--follow', '--force', '--force-break-lock', '--force-retry', '--format', '--fresh', '--from-meetings', '--full', '--full-history', '--hard-deadline', '--health-interval', '--help', '--http', '--idempotency-key', '--ids', '--images', '--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', '--kind', '--limit', '--lock-duration-ms', '--log-noop', '--markdown', '--max-age', '--max-attempts', '--max-cost-usd', '--max-crashes', '--max-rss', '--max-sources', '--max-stalled', '--max-usd', '--max-waiting', '--mcp-only', '--min-context', '--missing-path', '--mode', '--model', '--multimodal', '--name-only', '--ner', '--nice', '--no-auto-embed', '--no-delegate', '--no-embed', '--no-extract', '--no-gpg-sign', '--no-hard-deadline', '--no-inject', '--no-pull', '--no-renames', '--no-schema-pack', '--no-verify', '--no-worker', '--now', '--older-than', '--once', '--order', '--others', '--output', '--override-disabled', '--pace', '--pace-max-concurrency', '--pack', '--page', '--parallel', '--params', '--path', '--pause', '--phase', '--pid-file', '--priority', '--prune-orphans', '--queue', '--quiet', '--reason', '--rebuild', '--redact-secrets', '--reenrich-after', '--refresh-ms', '--repo', '--reset-checkpoint', '--resume', '--retry-failed', '--review-lower', '--segment-limit', '--select', '--serial', '--session', '--show-toplevel', '--sigkill-rescue', '--since', '--skip-bare-tweet', '--skip-failed', '--skip-urls', '--sleep', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--stats', '--status', '--strategy', '--surface', '--swap-only', '--take', '--target', '--thin', '--thin-threshold', '--timeline', '--timeout', '--timeout-ms', '--trusted-extraction', '--type', '--types', '--uninstall', '--url', '--user', '--vectors', '--verbose', '--verify', '--watch', '--wedge-rescue', '--workers', '--working-tree', '--yes'],'lint': ['--abbrev-ref', '--abort', '--accept-pending', '--all', '--background', '--brain', '--branch', '--cached', '--dry-run', '--exclude', '--exit-code', '--explain', '--file', '--fix', '--follow', '--get', '--get-url', '--git-dir', '--git-path', '--help', '--is-ancestor', '--is-inside-work-tree', '--json', '--local', '--name-only', '--no-accept-pending', '--no-cron', '--no-tags', '--no-verify', '--no-write-fetch-head', '--pat-file', '--path', '--progress-interval', '--progress-json', '--push', '--push-only', '--quiet', '--rebase', '--short', '--show-toplevel', '--source', '--timeout', '--unset-all', '--wait'],'loops': ['--all', '--as-of', '--brain', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--top', '--type'],'lsd': ['--brain', '--force-resume', '--help', '--json', '--judge-model', '--limit', '--list-runs', '--max-cost', '--max-far-set', '--max-ideas-per-judge-call', '--no-save', '--resume', '--save', '--source', '--strict-budget', '--yes'],@@ -80,18 +80,18 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'models': ['--brain', '--embedding-dimensions', '--embedding-model', '--help', '--json', '--skip', '--source', '--status'],'mounts': ['--alias', '--brain', '--database-path', '--database-url', '--db-path', '--db-url', '--engine', '--help', '--id', '--json', '--mcp-url', '--path', '--skills-dir', '--source'],'notability-eval': ['--brain', '--embedding-dimensions', '--embedding-model', '--help', '--in', '--json', '--out', '--repo', '--skip-llm', '--source', '--status', '--target-high', '--target-low', '--target-medium'],- 'onboard': ['--access', '--asof', '--auto', '--bound-slug-prefixes', '--brain', '--check', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--file', '--from-pages', '--full', '--help', '--history', '--http', '--image', '--json', '--kind', '--limit', '--max-usd', '--mode', '--multimodal', '--once', '--page', '--params', '--path', '--remediate', '--remediation-plan', '--resume', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--target-score', '--timeline', '--trusted-extraction', '--types', '--url', '--yes'],+ 'onboard': ['--access', '--asof', '--auto', '--bound-slug-prefixes', '--brain', '--check', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--from-pages', '--full', '--help', '--history', '--http', '--json', '--kind', '--limit', '--max-usd', '--mode', '--multimodal', '--page', '--params', '--path', '--remediate', '--remediation-plan', '--resume', '--session', '--since', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--target-score', '--timeline', '--trusted-extraction', '--types', '--url', '--yes'],'orphans': ['--accept-pending', '--background', '--brain', '--count', '--explain', '--follow', '--help', '--include-pseudo', '--json', '--mode', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--source', '--timeout', '--wait'],'pages': ['--brain', '--dry-run', '--help', '--json', '--older-than', '--source'],'pglite-repair': ['--brain', '--break-lock', '--dry-run', '--help', '--json', '--path', '--source', '--vectors', '--yes'],'post-upgrade': ['--acknowledge-no-backup', '--admin-intent', '--all', '--apply', '--apply-clean-hunks', '--backup-confirmed', '--brain', '--check', '--concurrency', '--confirm-quiesced', '--content-root', '--cost-estimate', '--embedding-dimensions', '--embedding-model', '--expected-epoch', '--expected-state', '--export-db-only', '--export-source', '--ff-only', '--force', '--force-all', '--force-orchestrator', '--force-retry', '--force-schema', '--format', '--help', '--host-dir', '--inject-bootstrap', '--inline', '--install', '--interval', '--json', '--limit', '--list', '--manifest', '--markdown', '--max-rss', '--migrate-only', '--migration', '--mode', '--multimodal', '--name-only', '--no-autopilot-install', '--no-bun-floor-check', '--no-embed', '--no-inject', '--no-worker', '--non-interactive', '--now', '--once', '--path', '--pause', '--quiet', '--reason', '--remediation-plan', '--repo', '--require-db', '--resume', '--self-transfer', '--skills-dir', '--skip-verify', '--source', '--stale', '--status', '--swap-only', '--target', '--uninstall', '--user', '--vectors', '--verify', '--version', '--workers', '--yes'],'pricing': ['--brain', '--help', '--input', '--json', '--max-cost', '--max-runtime', '--output', '--rate', '--source'],'projections': ['--brain', '--enable-dcr', '--help', '--http', '--install', '--json', '--limit', '--now', '--port', '--public-url', '--remove', '--source', '--status', '--surface', '--user'],- 'protocol': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--entities', '--fact', '--federated-read', '--file', '--full', '--help', '--http', '--image', '--json', '--kind', '--limit', '--mode', '--multimodal', '--once', '--page', '--path', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--synthesize', '--take', '--target', '--timeline', '--token', '--trusted-extraction', '--types', '--url', '--yes'],+ 'protocol': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--entities', '--fact', '--federated-read', '--full', '--help', '--http', '--json', '--kind', '--limit', '--mode', '--multimodal', '--page', '--path', '--session', '--since', '--slugs', '--source', '--sources', '--stats', '--surface', '--synthesize', '--take', '--target', '--timeline', '--token', '--trusted-extraction', '--types', '--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'],'quarantine': ['--apply', '--brain', '--force', '--force-rechunk', '--help', '--include-flagged', '--json', '--limit', '--no-embed', '--source', '--source-id', '--stale'],- 'recall': ['--accept-pending', '--access', '--as-context', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--budget-policy', '--budget-tokens', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--file', '--follow', '--full', '--grep', '--help', '--http', '--image', '--include-expired', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--no-accept-pending', '--once', '--page', '--path', '--pending', '--progress-interval', '--progress-json', '--query', '--quiet', '--reason', '--request-id', '--rollup', '--session', '--session-id', '--since', '--since-last-run', '--slug', '--slugs', '--source', '--source-id', '--sources', '--stats', '--supersessions', '--surface', '--take', '--timeline', '--timeout', '--today', '--trusted-extraction', '--types', '--url', '--wait', '--watch', '--yes'],+ 'recall': ['--accept-pending', '--access', '--as-context', '--asof', '--background', '--bound-slug-prefixes', '--brain', '--budget-policy', '--budget-tokens', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--follow', '--full', '--grep', '--help', '--http', '--include-expired', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--no-accept-pending', '--page', '--path', '--pending', '--progress-interval', '--progress-json', '--query', '--quiet', '--reason', '--request-id', '--rollup', '--session', '--session-id', '--since', '--since-last-run', '--slugs', '--source', '--source-id', '--sources', '--stats', '--supersessions', '--surface', '--take', '--timeline', '--timeout', '--today', '--trusted-extraction', '--types', '--url', '--wait', '--watch', '--yes'],'reconcile-links': ['--accept-pending', '--background', '--brain', '--dry-run', '--explain', '--follow', '--help', '--json', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--source', '--timeout', '--wait'],'reindex': ['--accept-pending', '--aliases', '--background', '--brain', '--concurrency', '--cost-estimate', '--dim', '--dry-run', '--embedding-dimensions', '--embedding-model', '--explain', '--follow', '--force', '--force-rechunk', '--help', '--json', '--limit', '--markdown', '--multimodal', '--no-accept-pending', '--no-embed', '--no-embedding', '--pglite', '--progress-interval', '--progress-json', '--quiet', '--repo', '--source', '--stale', '--status', '--supabase', '--timeout', '--to', '--type', '--vectors', '--wait', '--workers', '--yes'],'reindex-code': ['--accept-pending', '--background', '--brain', '--break-lock', '--concurrency', '--db-url', '--dry-run', '--embedding-dimensions', '--embedding-model', '--explain', '--follow', '--force', '--help', '--json', '--max-cost', '--max-cost-usd', '--max-runtime', '--no-accept-pending', '--no-embed', '--path', '--progress-interval', '--progress-json', '--quiet', '--source', '--status', '--timeout', '--wait', '--workers', '--yes'],@@ -126,5 +126,5 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {'upgrade': ['--acknowledge-no-backup', '--admin-intent', '--all', '--apply', '--apply-clean-hunks', '--backup-confirmed', '--brain', '--check', '--concurrency', '--confirm-quiesced', '--content-root', '--cost-estimate', '--embedding-dimensions', '--embedding-model', '--expected-epoch', '--expected-state', '--export-db-only', '--export-source', '--ff-only', '--force', '--force-all', '--force-orchestrator', '--force-retry', '--force-schema', '--format', '--help', '--host-dir', '--inject-bootstrap', '--inline', '--install', '--interval', '--json', '--limit', '--list', '--manifest', '--markdown', '--max-rss', '--migrate-only', '--migration', '--mode', '--multimodal', '--name-only', '--no-autopilot-install', '--no-bun-floor-check', '--no-embed', '--no-inject', '--no-worker', '--non-interactive', '--now', '--once', '--path', '--pause', '--quiet', '--reason', '--remediation-plan', '--repo', '--require-db', '--resume', '--self-transfer', '--skills-dir', '--skip-verify', '--source', '--stale', '--status', '--swap-only', '--target', '--uninstall', '--user', '--vectors', '--verify', '--version', '--workers', '--yes'],'waiting': ['--all', '--as-of', '--brain', '--help', '--json', '--note', '--source', '--stale-ok', '--status', '--top', '--type'],'watch': ['--brain', '--help', '--json', '--max-pages', '--min-confidence', '--source', '--window-turns'],- 'whoknows': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--file', '--full', '--help', '--http', '--image', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--once', '--page', '--path', '--session', '--since', '--slug', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--trusted-extraction', '--types', '--url', '--yes'],+ 'whoknows': ['--access', '--asof', '--bound-slug-prefixes', '--brain', '--date', '--days', '--entities', '--explain', '--fact', '--federated-read', '--full', '--help', '--http', '--json', '--kind', '--limit', '--mcp-only', '--mode', '--multimodal', '--page', '--path', '--session', '--since', '--slugs', '--source', '--sources', '--stats', '--surface', '--take', '--timeline', '--trusted-extraction', '--types', '--url', '--yes'],};diff --git a/src/core/operations-descriptions.ts b/src/core/operations-descriptions.tsindex 471c9c9832..44a931df50 100644--- a/src/core/operations-descriptions.ts+++ b/src/core/operations-descriptions.ts@@ -19,22 +19,10 @@// ──────────────────────────────────────────────────────────────────────────────export const GET_RECENT_SALIENCE_DESCRIPTION =- "Returns readable pages recently touched and ranked by activity salience and recency. " +- "Unrestricted local reads include deterministic 0..1 emotional_weight, take density, and recency decay. " +- "Holder-restricted reads count only permitted active takes, use zero emotional_weight, " +- "and select recent pages by updated_at; unrestricted local reads retain take-driven touches. " +- "Use this when the user asks what's been going on, what's notable, what's hot, " +- "anything crazy happening, or for any open-ended 'current state' question " +- "about themselves or their work. Do NOT run a semantic search for these — " +- "salience surfaces what's unusual without needing a search term.";+ "Recently touched pages ranked by salience. Use this when the user asks what's been going on, what's notable, anything crazy happening. Do NOT run a semantic search for these.";export const FIND_ANOMALIES_DESCRIPTION =- "Returns statistical anomalies in recent page activity, grouped by cohort " +- "(tag or type). Use this for questions about what stood out, what's unusual, " +- "or what changed recently. Returns explanatory cohorts (e.g. '15 pages tagged " +- "wedding touched on 2026-04-28, baseline 0.3/day') so you can speak about " +- "patterns the user wouldn't have searched for. Cohort kinds: tag, type. " +- "Year cohort is deferred to a later release.";+ "Anomalies in recent page activity, grouped by cohort (tag or type) against a baseline. Use for what stood out, what's unusual or changed. Cohort kinds: tag, type.";export const FIND_EXPERTS_DESCRIPTION ="Answers 'who in my brain knows about <topic>'. Returns ranked person/company " +@@ -58,51 +46,13 @@ export const GET_RECENT_TRANSCRIPTS_DESCRIPTION =// ──────────────────────────────────────────────────────────────────────────────export const LIST_PAGES_DESCRIPTION =- "List pages with optional filters. " +- "For 'what's recent / what did I touch this week' questions, use list_pages " +- "with sort=updated_desc instead of semantic search. " +- "Default 50 rows; remote callers are capped at 100 (local CLI callers' explicit " +- "limits are honored). A result with exactly `limit` rows may be truncated. " +- "For exhaustive listing, page with updated_after=<last row's updated_at_iso> + " +- "updated_after_slug=<last row's slug> until a page returns fewer rows than the " +- "limit (the keyset forces sort=updated_asc; a bare updated_after cursor skips " +- "rows sharing the cursor timestamp).";+ "List pages with filters. For 'what's recent / what did I touch this week' use sort=updated_desc. Default 50 rows (remote max 100); a full page may be truncated: continue with updated_after + updated_after_slug from the last row.";export const QUERY_DESCRIPTION =- "Hybrid search with vector + keyword + multi-query expansion. " +- "Prefer `query` for concept / synonym / landscape questions ('all the X that " +- "do Y', 'the landscape of Z') — expansion recovers synonym- and " +- "outcome-phrased matches a single embedding misses. Still top-K, and the " +- "default count when `limit` is omitted depends on the configured search " +- "mode (10 conservative / 25 balanced / 50 tokenmax — see the `limit` param " +- "description); pass `limit` explicitly for a stable count regardless of " +- "mode. When the answer needs the surrounding conversation or section, pass " +- "`return_unit` ('page' / 'section' / 'window') to get that evidence in one call " +- "instead of get_page per hit; conversation pages already come back whole by default (return_unit " +- "'auto'; 'chunk' opts out). For exhaustive enumeration use list_pages; for exact known tokens " +- "`search` is cheaper (no expansion LLM call). " +- "For personal/emotional questions ('what's going on with me', 'anything notable', " +- "'how am I feeling'), prefer get_recent_salience, find_anomalies, or " +- "get_recent_transcripts. Semantic search returns polished pages and misses " +- "recent activity bursts. Do NOT assume words like 'crazy', 'notable', or 'big' " +- "mean impressive — they often mean difficult or emotionally charged.";+ "Ranked hybrid search with multi-query expansion, for concept / synonym / landscape questions: expansion recovers synonym-phrased matches. Still top-K; return_unit returns whole sections or conversations. Lists: list_pages. Exact tokens: `search` is cheaper (no expansion LLM call). Personal questions: get_recent_salience, find_anomalies, get_recent_transcripts. Do NOT assume 'crazy' means impressive (often difficult or emotionally charged). fields: \"full\" adds diagnostics.";export const SEARCH_DESCRIPTION =- "Cheap hybrid search (vector + keyword + RRF) with no LLM expansion. " +- "Best for exact known tokens, names, and structured-field lookups. A populated " +- "result set is NOT proof of coverage — for concept / synonym / landscape " +- "questions use `query` (adds multi-query expansion); for exhaustive " +- "enumeration use list_pages pagination. " +- "Pass `return_unit` ('window' / 'section' / 'page') for whole evidence instead of chunks; " +- "conversation pages already come back whole by default (return_unit 'auto'; 'chunk' opts out). " +- "For personal/emotional questions, " +- "prefer get_recent_salience or find_anomalies — they surface activity bursts " +- "without needing a search term. " +- "For code-symbol questions (callers, callees, definitions, blast radius), use " +- "code_callers / code_callees / code_def / code_refs instead — those return " +- "structural graph data, not text chunks. " +- "For agent memory reads (saved facts + budget-packed retrieval), prefer the " +- "`recall` verb.";+ "Cheap hybrid search (vector + keyword), no LLM expansion, top 20: for exact tokens, names, field values. Results are NOT proof of coverage: concepts or landscape, use `query`; exhaustive lists, list_pages. return_unit returns whole sections or conversations. Personal questions: get_recent_salience; saved facts: recall. fields: \"full\" adds diagnostics.";// ──────────────────────────────────────────────────────────────────────────────// v0.32.6 — contradiction probe MCP surface (M3)@@ -192,33 +142,10 @@ export const CODE_REFS_DESCRIPTION =// ──────────────────────────────────────────────────────────────────────────────export const LIST_SKILLS_DESCRIPTION =- "List the skills this agent's brain publishes. A skill is a named prose " +- "instruction set (NOT executable code) that teaches you how to do a task " +- "using this server's other tools. Returns a flat catalog — each entry has a " +- "name, one-line description, triggers (phrasings that should invoke it), and " +- "`usable_tools` / `unavailable_tools` (which tools the skill calls that you " +- "CAN vs CANNOT call given this server + your access). To actually use a skill, " +- "call get_skill with its name, read the returned prose, and follow it — calling " +- "the correspondingly-named tools on THIS server. The response also carries an " +- "`instructions` envelope explaining this protocol. On a shared brain, use " +- "schema_version:2 for source-qualified identities, immutable revisions, " +- "pagination and complete declared requirements. Only authorized sources and " +- "owner-approved file classes are visible; pre-migration servers retain their " +- "legacy prose catalog. Read-scope; published only when the brain owner enabled mcp.publish_skills.";+ "Skills: prose instruction sets (NOT executable code) for tasks with this server's tools, with triggers, usable_tools and unavailable_tools. Use one via get_skill.";export const GET_SKILL_DESCRIPTION =- "Fetch one skill's full instructions by name. Returns `{name, frontmatter " +- "(sanitized), body, usable_tools, unavailable_tools, client_guidance}`. The " +- "`body` is prose — read it as your operating instructions for this task, and " +- "when it says to search / store / look something up, call the same-named MCP " +- "tool on THIS server. There is nothing to 'execute' — the value is the " +- "instructions plus your tool calls back to this server. Tools listed in " +- "`unavailable_tools` won't work for you (not exposed here, or beyond your " +- "access) — adapt accordingly. Size-capped; read-scope; requires the owner to " +- "have enabled mcp.publish_skills. On a shared brain, pass schema_version:2 " +- "with qualified_id and revision from discovery to fetch exact instructions " +- "and their approved dependency manifest. get_skill_asset retrieves declared " +- "files from that revision as data; downloading never grants execution or tool permissions.";+ "Fetch a skill's prose and follow it: when it says search or store, call the same-named MCP tool here. There is nothing to execute. unavailable_tools won't work for you.";/*** The load-bearing `instructions` envelope for list_skills. Pinned so the@@ -273,9 +200,4 @@ export const SKILL_CLIENT_GUIDANCE = {* test/operations-descriptions.test.ts.*/export const CAPTURE_DESCRIPTION =- 'Capture a quick note into the brain — the "just remember this" write. Auto-derives a ' +- 'stable inbox/ slug from the content date + hash (recapturing identical text is ' +- 'idempotent), merges frontmatter, refuses binary/empty payloads, then delegates to ' +- 'put_page (inheriting its fences and provenance stamping). Prefer capture for quick ' +- 'notes and put_page when you need to control the slug, type, or an existing page\'s ' +- 'content. For structured facts about entities, prefer remember.';+ "Quick note (\"just remember this\"): auto-slugged under inbox/ by date + content hash, so recapturing is idempotent. Use put_page to control slug or type; remember for facts about entities.";diff --git a/src/core/ops/chunks.ts b/src/core/ops/chunks.tsindex 25202d6287..72e4f59fb7 100644--- a/src/core/ops/chunks.ts+++ b/src/core/ops/chunks.ts@@ -15,13 +15,12 @@ import { federatedSearchScope, parseSourceIdParam } from './context.ts';const resolve_slugs: Operation = {name: 'resolve_slugs',outputRedaction: 'no_stored_text',- description: 'Fuzzy-resolve a partial slug to matching page slugs',+ description: 'Fuzzy-match a partial slug or title to page slugs.',params: {- partial: { type: 'string', required: true, description: "Partial slug or title text to match, e.g. 'alice-ex' or 'meeting notes'. This is the search text param — there is no `text` param." },+ partial: { type: 'string', required: true, description: "Partial slug or title, e.g. 'alice-ex'." },source_id: {type: 'string',- description:- "Scope resolution to a single source. Defaults to OperationContext.sourceId; when unset, an unqualified resolve spans every federated source (matching search/get_page). Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources.",+ description: "One source, or '__all__'.",},},handler: async (ctx, p) => {diff --git a/src/core/ops/facts.ts b/src/core/ops/facts.tsindex e22a32a605..a6d4a906d4 100644--- a/src/core/ops/facts.ts+++ b/src/core/ops/facts.ts@@ -202,23 +202,22 @@ function recallEvidencePlan(ctx: OperationContext, p: Record<string, unknown>):const recall: Operation = {name: 'recall',outputRedaction: { retrieval: { localVerbatim: ['facts'] } },- description:- 'MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. Filters hot-memory facts by entity / since / session_id; pass `query` to ALSO run hybrid search over pages (results[] arm); pass `budget_tokens` for server-side packing (response reports budget_used + dropped_count — never trims client-side). Remote callers see visibility=world facts only. Routing: for ONE known person/company/project card use `entity` (zero LLM); for broad questions needing reasoning use `synthesize` (expensive). Branch on structured fields (status/kind/evidence), never on prose. Every response carries protocol_version.',+ description: 'MEMORY VERB (v1): read saved facts by entity, since or session_id; `query` also searches pages. Remote callers see world facts only. One card: entity; reasoning: synthesize.',params: {- entity: { type: 'string', description: 'Entity slug (canonical). Returns facts about this entity newest first, each labelled with its source_id. Across several granted sources, same-slug entities that no entity-identity group links are different entities: facts comes back empty and ambiguous_entity names each (source_id, entity_slug); pass source_id to read one.' },- query: { type: 'string', description: 'MEMORY_VERBS v1: free-text retrieval over pages (hybrid search arm). Response adds results[] (slug, title, chunk, evidence, create_safety, provenance). Combinable with entity (both arms run). Degrades to keyword-only search when no embedding provider is configured (search_degraded notes it; never an error).' },- budget_tokens: { type: 'number', description: 'MEMORY_VERBS v1: server-side token budget (char/4 estimate). Facts pack first, then results. Response adds budget_tokens, budget_used, dropped_count.' },- budget_policy: { type: 'string', enum: ['facts_first', 'query_first'], description: 'Optional packing order. facts_first preserves legacy behavior (default). query_first packs the ranked page prefix before facts only with a nonblank query and positive finite budget; a positive budget below one token keeps neither arm. No query or inactive budget preserves legacy behavior. Neither policy skips oversized items or truncates. Supplying this option adds budget_packing accounting. Keep fact-focused/entity-filtered questions on facts_first.' },- source_id: { type: 'string', description: 'Optional concrete source id for both facts and page results. Narrows the caller’s authorized scope, including an explicit default; a denied, missing, or archived source fails rather than widening. Omit to preserve the existing context/grant scope.' },- since: { type: 'string', description: 'ISO 8601 datetime or duration shorthand (e.g. "8 hours ago"). Filters the FACTS arm only, on event time (valid_from, falling back to created_at); composes with `entity` and `session_id`. An unparseable value is rejected (invalid_params).' },- session_id: { type: 'string', description: 'Source session id (e.g. topic-A). Returns facts captured in that session.' },- include_expired: { type: 'boolean', description: 'When true, include expired_at IS NOT NULL rows. Default false.' },- supersessions: { type: 'boolean', description: 'When true, return only the supersession audit log (facts with superseded_by set), newest first by COALESCE(expired_at, valid_until).' },- limit: { type: 'number', description: 'Per-arm cap: max fact rows AND max search results. Default 50, cap 100.' },- grep: { type: 'string', description: 'Substring filter on fact text (case-insensitive). Applied in SQL before the limit, so matches on high-cardinality entities are found even outside the newest-N window.' },- include_pending: { type: 'boolean', description: 'v0.32: when true, response includes pending_consolidation_count (facts not yet promoted to takes by the dream-cycle consolidate phase). One round trip; backward-compatible (field omitted when false).' },- return_unit: { type: 'string', enum: ['chunk', 'window', 'section', 'page', 'auto'], description: "Evidence unit for the results[] arm (needs `query`; default config search.return_unit = 'auto'). 'window' adds neighbor chunks, 'section' the enclosing section or conversation rounds, 'page' the whole page/session (best for multi-session questions), 'auto' the whole page for conversation pages and the ranked chunk unchanged for everything else (budget_tokens or budget_policy without return_unit keeps chunk packing). Non-chunk units return one result per page with `delivered` metadata and a top-level `delivery` block; the evidence is budgeted by budget_tokens (default 6000, auto 24000) and then packed by recall's usual rules." },- return_window: { type: 'number', description: "Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1)." },+ entity: { type: 'string', description: 'Entity slug; facts about it, newest first.' },+ query: { type: 'string', description: 'Also search pages (results[] arm).' },+ budget_tokens: { type: 'number', description: 'Token budget; facts pack first.' },+ budget_policy: { type: 'string', enum: ['facts_first', 'query_first'], description: 'facts_first (default) or query_first.' },+ source_id: { type: 'string', description: 'Narrow to one source you may read.' },+ since: { type: 'string', description: 'Facts since (ISO 8601 or "8 hours ago").' },+ session_id: { type: 'string', description: 'Facts captured in this session.' },+ include_expired: { type: 'boolean', description: 'Include expired facts.' },+ supersessions: { type: 'boolean', description: 'Only the supersession audit log.' },+ limit: { type: 'number', description: 'Per-arm max (default 50, cap 100).' },+ grep: { type: 'string', description: 'Substring of the fact text.' },+ include_pending: { type: 'boolean', description: 'Add pending count.' },+ return_unit: { type: 'string', enum: ['chunk', 'window', 'section', 'page', 'auto'], description: 'Evidence unit for results[] (see search).' },+ return_window: { type: 'number', description: 'Window size 1-3.' },},scope: 'read',verb: true,@@ -608,14 +607,13 @@ const dropAll = <T>(items: T[]) => ({ items: [] as T[], meta: { budget: 0, used:const context_pack: Operation = {name: 'context_pack',outputRedaction: { retrieval: { localVerbatim: ['facts'] } },- description:- 'MEMORY VERB (v1): budget-packed session-boundary bundle for a set of standing entities — entity cards + open threads + hot facts, zero-LLM, sub-second. Call at session start (warm cold context) and after compaction (rehydrate what the summary lost). WORLD-ONLY by default; pass include_private (honored for LOCAL trusted callers only) to widen all arms. budget_tokens packs server-side (response reports budget_used + dropped_count; cards pack first, then facts). Branch on structured fields, never prose. protocol_version rides every response.',+ description: 'MEMORY VERB (v1): budget-packed cards, open threads and hot facts for up to 8 entities, zero LLM. Call at session start and after compaction.',params: {- entities: { type: 'string', required: true, description: 'Comma-separated entity names/slugs to bundle. Capped at 8.' },- budget_tokens: { type: 'number', description: 'Server-side token budget (char/4). Cards pack first, then facts; each item costs its rendered line and the envelope + section headers are reserved, so `text` fits the budget. Response adds budget_tokens, budget_used (tokens of `text`), dropped_count.' },- since: { type: 'string', description: 'ISO 8601 datetime. When set, open-thread events are filtered to those after this cursor.' },- session_id: { type: 'string', description: 'Opaque session id; keys the hot-memory cache and (on the push path) the session cursor.' },- include_private: { type: 'boolean', description: 'Local trusted callers only: widen ALL arms to include private facts. Ignored (world-only) for remote callers. Default false.' },+ entities: { type: 'string', required: true, description: 'Comma-separated names or slugs (max 8).' },+ budget_tokens: { type: 'number', description: 'Token budget; cards pack first.' },+ since: { type: 'string', description: 'Only open-thread events after this ISO time.' },+ session_id: { type: 'string', description: 'Opaque session id.' },+ include_private: { type: 'boolean', description: 'Local trusted callers only.' },},scope: 'read',verb: true,@@ -723,15 +721,14 @@ const context_pack: Operation = {const delta: Operation = {name: 'delta',outputRedaction: { retrieval: { localVerbatim: ['facts'] } },- description:- 'MEMORY VERB (v1): "what changed since T" for heartbeats — pages updated after `since` + hot facts newer than `since` + open-thread events after `since`, zero-LLM. Lets a periodic wake maintain warm state in O(changes) instead of re-deriving. Optionally scope thread deltas to `entities`. WORLD-ONLY by default; include_private honored for local trusted callers only. budget_tokens packs server-side (pages first, then facts; threads are never dropped). protocol_version rides every response.',+ description: 'MEMORY VERB (v1): what changed since a time (pages, facts, thread events), zero LLM. Keep a cursor with session_id, or pass since.',params: {- since: { type: 'string', description: 'ISO 8601 cursor. Returns pages/facts/thread-events newer than this timestamp. Optional when session_id carries an established cursor.' },- since_slug: { type: 'string', description: 'Stateless keyset resume: pass back `next_cursor.slug` from the previous response (paired with `since`=next_cursor.since) to page through pages sharing one timestamp. Ignored when session_id is set (the session cursor carries it).' },- entities: { type: 'string', description: 'Optional comma-separated entity scope for thread-event deltas. Capped at 8.' },- budget_tokens: { type: 'number', description: 'Server-side token budget (char/4). Pages pack first, then facts; each item costs its rendered line and the envelope + section headers + every thread line are reserved, so `text` fits the budget. Threads are never dropped (budget_used can exceed the budget only when the header + threads alone do). Response adds budget_tokens, budget_used (tokens of `text`), dropped_count.' },- session_id: { type: 'string', description: 'Opaque session id. Drives the per-session cursor: the first call establishes it, each call advances it to the newest DELIVERED change (at-least-once — with has_more:true the undelivered tail returns on the next wake). Without it, pass an explicit `since` for a stateless delta.' },- include_private: { type: 'boolean', description: 'Local trusted callers only: widen ALL arms to include private facts. Ignored (world-only) for remote callers. Default false.' },+ since: { type: 'string', description: 'ISO 8601 cursor (or use session_id).' },+ since_slug: { type: 'string', description: 'next_cursor.slug from the previous response.' },+ entities: { type: 'string', description: 'Entity scope for thread events (max 8).' },+ budget_tokens: { type: 'number', description: 'Token budget; pages pack first.' },+ session_id: { type: 'string', description: 'Opaque session id; keeps a cursor.' },+ include_private: { type: 'boolean', description: 'Local trusted callers only.' },},scope: 'read',verb: true,diff --git a/src/core/ops/ingest-log.ts b/src/core/ops/ingest-log.tsindex c308d627e0..7ccbfe1cba 100644--- a/src/core/ops/ingest-log.ts+++ b/src/core/ops/ingest-log.ts@@ -44,9 +44,9 @@ const log_ingest: Operation = {const get_ingest_log: Operation = {name: 'get_ingest_log',outputRedaction: 'retrieval',- description: 'Get recent ingestion log entries',+ description: 'Recent ingestion log entries.',params: {- limit: { type: 'number', description: 'Max entries (default 20)' },+ limit: { type: 'number', description: 'Default 20.' },},handler: async (ctx, p) => {// Source-scope the log for remote callers (scalar grant → single-elementdiff --git a/src/core/ops/jobs.ts b/src/core/ops/jobs.tsindex d198c3c3c5..eb18e6fab8 100644--- a/src/core/ops/jobs.ts+++ b/src/core/ops/jobs.ts@@ -237,14 +237,14 @@ async function probeQueueStateSafe(const submit_agent: Operation = {name: 'submit_agent',outputRedaction: { exempt: 'admin-scoped job introspection: job params and results are operator data, not retrieved brain text' },- description: 'Submit an LLM agent job that the worker dispatches via the gateway-native tool loop. Requires the `agent` OAuth scope. Tools, source, slug prefixes, max concurrency, and daily budget are bound at OAuth client registration time.',+ description: 'Submit an agent job (agent scope; tools and budget bound to your client). Poll get_agent_job.',params: {- prompt: { type: 'string', required: true, description: 'User prompt for the agent' },- model: { type: 'string', description: 'provider:model string (defaults to models.tier.subagent)' },- allowed_tools: { type: 'array', description: 'Subset of bound_tools the agent may invoke', items: { type: 'string' } },- allowed_slug_prefixes: { type: 'array', description: 'Subset of delegated_slug_prefixes for writes; omit for a job-owned namespace', items: { type: 'string' } },- max_turns: { type: 'number', description: 'Max LLM turns (default 20, hard cap 100)' },- queue: { type: 'string', description: 'Queue name (default "default")' },+ prompt: { type: 'string', description: 'Task prompt.', required: true },+ model: { type: 'string', description: 'provider:model (default: subagent tier).' },+ allowed_tools: { type: 'array', description: 'Subset of your bound tools.', items: { type: 'string' } },+ allowed_slug_prefixes: { type: 'array', description: 'Subset of your write prefixes.', items: { type: 'string' } },+ max_turns: { type: 'number', description: 'Default 20, max 100.' },+ queue: { type: 'string', description: 'Default "default".' },},mutating: true,scope: 'agent',@@ -393,9 +393,9 @@ const submit_agent: Operation = {const get_agent_job: Operation = {name: 'get_agent_job',outputRedaction: 'retrieval',- description: 'Poll an agent job submitted via submit_agent. Returns a trimmed status view (id, status, timestamps, error_text, result) plus queue_position (waiting jobs ahead in claim order; 0 = next) while the job is still waiting. Requires the `agent` OAuth scope; only jobs owned by the calling client are visible.',+ description: 'Poll a submit_agent job: status, result, queue_position.',params: {- id: { type: 'number', required: true, description: 'Job id returned by submit_agent' },+ id: { type: 'number', description: 'Job id.', required: true },},scope: 'agent',handler: async (ctx, p) => {@@ -528,9 +528,9 @@ const list_jobs: Operation = {const cancel_job: Operation = {name: 'cancel_job',outputRedaction: { exempt: 'admin-scoped job introspection: job params and results are operator data, not retrieved brain text' },- description: 'Cancel a waiting, active, or delayed job. Agent-scoped tokens (no admin) can cancel only jobs they own.',+ description: 'Cancel a waiting, active or delayed job you may manage.',params: {- id: { type: 'number', required: true, description: 'Job ID' },+ id: { type: 'number', description: 'Job id.', required: true },},mutating: true,scope: 'admin',diff --git a/src/core/ops/links.ts b/src/core/ops/links.tsindex 5a56efe070..c721557c32 100644--- a/src/core/ops/links.ts+++ b/src/core/ops/links.ts@@ -164,11 +164,11 @@ const remove_link: Operation = {const LINK_SOURCE_ID_PARAM = {type: 'string',- description: "Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers.",+ description: "One source, or '__all__'.",} as const;const LINK_ALL_SOURCES_PARAM = {type: 'boolean',- description: 'Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely.',+ description: 'Same as source_id __all__.',} as const;/**@@ -319,9 +319,9 @@ const get_links: Operation = {const get_backlinks: Operation = {name: 'get_backlinks',outputRedaction: 'retrieval',- description: 'List incoming links to a page',+ description: 'List links pointing to a page.',params: {- slug: { type: 'string', required: true, description: 'Slug of the page whose incoming links to list.' },+ slug: { type: 'string', description: 'Page slug.', required: true },source_id: LINK_SOURCE_ID_PARAM,all_sources: LINK_ALL_SOURCES_PARAM,},@@ -336,7 +336,7 @@ const list_link_sources: Operation = {// v114 (#1941): the read-side counterpart to link-add/link-rm. Since// link_source is now an open kebab provenance (no allowlist), this is how an// agent discovers which provenances a brain actually carries.- description: 'List distinct link_source provenances in the brain with edge counts (e.g. citation-graph, manual, markdown)',+ description: 'Link provenances in the brain (e.g. markdown, manual) with edge counts.',params: {},handler: async (ctx) => {// Route through sourceScopeOpts so the read honors both scalar ctx.sourceId@@ -372,12 +372,12 @@ const DEFAULT_TRAVERSE_DEPTH = 5;const traverse_graph: Operation = {name: 'traverse_graph',outputRedaction: 'retrieval',- description: `Traverse link graph from a page. Remote callers default to bidirectional edges (GraphPath[]) at depth ${REMOTE_BIDIRECTIONAL_DEFAULT_DEPTH} (pass depth explicitly for deeper walks); trusted local no-filter callers keep the legacy node shape at depth ${DEFAULT_TRAVERSE_DEPTH}.`,+ description: `Walk the link graph from a page. Remote callers get bidirectional paths at depth ${REMOTE_BIDIRECTIONAL_DEFAULT_DEPTH} by default.`,params: {- slug: { type: 'string', required: true, description: "Slug of the page to start the traversal from, e.g. 'people/alice-example'. This is the start-node param — there is no `start` or `root` param." },- depth: { type: 'number', description: `Max traversal depth (capped at ${TRAVERSE_DEPTH_CAP}). Default ${DEFAULT_TRAVERSE_DEPTH}, except a remote call that lets direction default to 'both' uses ${REMOTE_BIDIRECTIONAL_DEFAULT_DEPTH} (bidirectional path enumeration is combinatorial on hubs); an explicit depth is always honored up to the cap.` },- link_type: { type: 'string', description: 'Filter to one link type (per-edge filter, traversal only follows matching edges)' },- direction: { type: 'string', enum: ['in', 'out', 'both'], description: "Traversal direction ('in', 'out', or 'both'). Remote callers default to 'both'; trusted local no-filter callers keep the legacy outgoing-node output." },+ slug: { type: 'string', description: 'Start page slug.', required: true },+ depth: { type: 'number', description: `Max depth (cap ${TRAVERSE_DEPTH_CAP}).` },+ link_type: { type: 'string', description: 'Follow only this link type.' },+ direction: { type: 'string', description: 'Remote default both.', enum: ['in', 'out', 'both'] },source_id: LINK_SOURCE_ID_PARAM,all_sources: LINK_ALL_SOURCES_PARAM,},diff --git a/src/core/ops/page-edit.ts b/src/core/ops/page-edit.tsindex 6be8546b03..e3a44f938e 100644--- a/src/core/ops/page-edit.ts+++ b/src/core/ops/page-edit.ts@@ -10,18 +10,18 @@ import { EDIT_PAGE_MAX_EDITS, parsePageEdits } from '../persistence/page-edit.tsconst edit_page: Operation = {name: 'edit_page',outputRedaction: { exempt: "the diff is the caller's own authorized view of the page it just edited (the get_page boundary), secret-redacted when created because the receipt retains it" },- description: 'Change part of an existing page without resending it: prefer this over put_page for small changes to large pages. Read get_page with include_content:true and pass its revision as expected_revision. Each edit replaces old_text with new_text; edits apply in order, each to the text the previous edit produced, and each old_text must match exactly once in that content. Protected takes and facts sections never match (use the takes_* operations or remember/forget). All edits publish together or none do, through the same receipts, fences and write-through as put_page. Returns the new revision and a unified diff of your view (at most 8 KB). Refusals name the edit: edit_no_match, edit_ambiguous_match (with match_count), edit_protected_span, edit_invalid; a stale revision returns revision_conflict with current_revision. Retain request_id and repeat identical arguments after a pending receipt.',+ description: 'Change part of a page: prefer this over put_page for small changes. expected_revision is the revision from get_page include_content:true. Each old_text must match exactly once; edits apply in order, all or none. Stale revision: revision_conflict.',params: {- slug: { type: 'string', required: true, description: 'Slug of the existing page to edit.' },- expected_revision: { type: 'string', required: true, description: 'The `revision` from get_page include_content:true. The edit is refused if the page changed since.' },+ slug: { type: 'string', description: 'Page slug.', required: true },+ expected_revision: { type: 'string', required: true, description: 'revision from get_page include_content:true.' },edits: {type: 'array', required: true,- description: `1 to ${EDIT_PAGE_MAX_EDITS} replacements, applied in order and all or nothing.`,+ description: `1 to ${EDIT_PAGE_MAX_EDITS} {old_text, new_text} replacements.`,items: {type: 'object',properties: {- old_text: { type: 'string', required: true, description: 'Exact existing text (including whitespace) to replace; must occur exactly once in the current content.' },- new_text: { type: 'string', required: true, description: 'Replacement text; empty deletes old_text.' },+ old_text: { type: 'string', required: true, description: 'Exact text to replace (must occur once).' },+ new_text: { type: 'string', required: true, description: 'Replacement; empty deletes.' },},},},diff --git a/src/core/ops/pages.ts b/src/core/ops/pages.tsindex 55a197b85e..7a69ca9478 100644--- a/src/core/ops/pages.ts+++ b/src/core/ops/pages.ts@@ -75,14 +75,14 @@ function stripPrivacyFencesForRemoteReader(page: Page): Page {const get_page: Operation = {name: 'get_page',outputRedaction: { exempt: 'explicit page read by slug/id; governed by page visibility, not output redaction (CEO-17 raw-read exception)' },- description: 'Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (see v0.26.5 recovery window). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns).',+ description: 'Read a page by slug (fuzzy optional; renamed slugs redirect). To edit, pass include_content:true and send `content` to put_page, or use edit_page. Timeline rows need include_timeline_entries.',params: {- slug: { type: 'string', required: true, description: 'Page slug' },- fuzzy: { type: 'boolean', description: 'Enable fuzzy slug resolution (default: false)' },- include_content: { type: 'boolean', description: '#2225: include the canonical serialized `content` field (frontmatter + body + timeline sentinel) for lossless get→edit→put_page round-trips. Default false — it roughly duplicates compiled_truth + timeline, so read-only callers should not pay for it.' },- include_deleted: { type: 'boolean', description: 'v0.26.5: surface soft-deleted pages with deleted_at populated (default: false). Used by restore workflows.' },- include_timeline_entries: { type: 'boolean', description: '#5709: also return `timeline_entries`, the page\'s timeline rows (the same rows and filtering as get_timeline for this caller). Default false to keep the payload small.' },- source_id: { type: 'string', description: "#4329: scope the lookup to a single source (a multi-source brain can hold the same slug in several sources). Defaults to ctx.sourceId / the caller's grant. '__all__' spans every source for trusted local callers, your granted sources for remote callers." },+ slug: { type: 'string', description: 'Page slug.', required: true },+ fuzzy: { type: 'boolean', description: 'Fuzzy slug match.' },+ include_content: { type: 'boolean', description: 'Full markdown + revision, for editing.' },+ include_deleted: { type: 'boolean', description: 'Include soft-deleted pages.' },+ include_timeline_entries: { type: 'boolean', description: 'Also return timeline rows.' },+ source_id: { type: 'string', description: "One source, or '__all__'." },},handler: async (ctx, p) => {const slug = p.slug as string;@@ -282,21 +282,21 @@ const fetch_page: Operation = {const put_page: Operation = {name: 'put_page',outputRedaction: 'no_stored_text',- description: 'Replace a complete canonical Markdown page. Read get_page with include_content:true and pass its revision as expected_revision; force explicitly overwrites the current revision. Omitting both permits creation only. Retain a UUID request_id and repeat identical arguments after transport failure or a pending receipt. Content, tags, sanitized text projections, versions and the committed receipt publish together; embedding and optional Git effects have separate status. Remote callers preserve protected facts/takes fences; automatic graph links are skipped for untrusted writes. A stdio `gbrain serve` sweeps them at startup + on idle; `gbrain serve --http` does not self-sweep — run `gbrain sweep --once` or use trusted local capture/put_page for inline link extraction. Remote callers receive write_through.warning when no repo is configured. For file input use gbrain capture --file PATH --slug SLUG.',+ description: 'Replace a complete Markdown page: content REPLACES the whole page. Read get_page include_content:true; pass its revision as expected_revision (omit to create). Keep a request_id UUID; retry with identical arguments. Remote callers: graph links are skipped; a stdio `gbrain serve` sweeps them later, `gbrain serve --http` does not self-sweep. Small changes: edit_page.',params: {...PAGE_MUTATION_PARAMS,- slug: { type: 'string', required: true, description: 'Page slug' },- content: { type: 'string', required: true, description: 'Complete markdown content with YAML frontmatter. REPLACES the entire page; this is not a partial edit. Read the canonical page first with `get_page include_content:true` before modifying it.' },- allow_empty: { type: 'boolean', required: false, description: 'Allow overwriting an existing non-empty page with empty/whitespace-only content (default: false). Without it, put_page rejects the empty overwrite — the empty-stdin failure class.' },+ slug: { type: 'string', description: 'Page slug.', required: true },+ content: { type: 'string', required: true, description: 'Complete markdown with frontmatter; read get_page include_content:true first.' },+ allow_empty: { type: 'boolean', required: false, description: 'Allow emptying a non-empty page.' },// v0.39.3.0 provenance write-through (WARN-8 + A1 + CV6). Optional fields// for trusted local callers (capture CLI, autopilot, dream cycle). Remote// MCP callers (ctx.remote !== false) have their values OVERRIDDEN with// server stamps below; the params are accepted on the wire only so the// op schema stays uniform across transports. Audit-trail spoofing is// closed structurally — clients cannot poison source_kind labels.- source_kind: { type: 'string', required: false, description: 'Ingestion channel taxonomy (capture-cli | put_page | webhook | …). Remote callers: SERVER-STAMPED, client value ignored.' },- source_uri: { type: 'string', required: false, description: 'Original URI/path/message-id the event carried. Remote callers: SERVER-STAMPED null.' },- ingested_via: { type: 'string', required: false, description: 'Richer label paired with source_kind. Remote callers: SERVER-STAMPED.' },+ source_kind: { type: 'string', description: 'Server-stamped remotely.', required: false },+ source_uri: { type: 'string', description: 'Server-stamped remotely.', required: false },+ ingested_via: { type: 'string', description: 'Server-stamped remotely.', required: false },},mutating: true,scope: 'write',@@ -438,28 +438,26 @@ const list_pages: Operation = {outputRedaction: 'retrieval',description: LIST_PAGES_DESCRIPTION,params: {- type: { type: 'string', description: 'Filter by page type' },- tag: { type: 'string', description: 'Filter by tag' },- limit: { type: 'number', description: 'Max results (default 50; remote callers are capped at 100)' },+ type: { type: 'string', description: 'Page type.' },+ tag: { type: 'string', description: 'Tag.' },+ limit: { type: 'number', description: 'Max rows (default 50; remote max 100).' },offset: {- type: 'number',- description: 'Skip first N rows (pagination). Engine-supported since PageFilters gained offset; previously accepted at the CLI and silently dropped.',+ type: 'number', description: 'Rows to skip.',},// v0.29 — surface filter that already exists on PageFilters.updated_after: {type: 'string',- description: 'ISO date (YYYY-MM-DD) or full timestamp. Returns pages with updated_at > value. Bare (without updated_after_slug) this is LOSSY across rows sharing one timestamp — a bulk sync stamps one now() across a transaction; pair with updated_after_slug to page exactly.',+ description: 'Only pages updated after this ISO time.',},updated_after_slug: {type: 'string',- description: "Keyset cursor slug: pass the last row's slug together with updated_after set to that row's updated_at_iso (column precision — a millisecond-rounded value re-selects same-millisecond rows). Resumes strictly after (updated_at, slug) and forces sort=updated_asc.",+ description: "Last row's slug (with updated_after).",},sort: {- type: 'string',+ type: 'string', description: 'Default updated_desc.',enum: [...LIST_PAGES_SORT_VALUES],- description: 'Sort order. Default updated_desc (matches pre-v0.29). Options: updated_desc, updated_asc, created_desc, slug.',},- include_deleted: { type: 'boolean', description: 'v0.26.5: include soft-deleted pages (default: false). Used by restore workflows and operator diagnostics.' },+ include_deleted: { type: 'boolean', description: 'Include soft-deleted pages.' },// #4400 — list_pages had no source-scoping param at all: unlike// search/query it silently ignored any caller-supplied source and always// fell back to whatever federatedSearchScope() resolved from ctx alone,@@ -468,8 +466,7 @@ const list_pages: Operation = {// `source_id` param already on search/query, same '__all__' semantics.source_id: {type: 'string',- description:- "v0.46.25: scope listing to a single source. Defaults to OperationContext.sourceId / federated scope. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources.",+ description: "One source, or '__all__'.",},},handler: async (ctx, p) => {@@ -610,10 +607,10 @@ const capture: Operation = {params: {...PAGE_MUTATION_PARAMS,...CAPTURE_EVENT_PARAMS,- content: { type: 'string', required: true, description: 'Markdown or plain text to capture. File paths are NOT accepted over MCP — read the file yourself and pass its content (the CLI --file lane is local-only).' },- local_file: { type: 'string', required: false, description: 'Trusted local CLI only (--file): the absolute path of the captured file. Recorded as the page origin only when it lies inside the source and names the slug; the path itself is never stored. Remote callers are refused.' },- slug: { type: 'string', required: false, description: "Target slug. Default: inbox/YYYY-MM-DD-<sha8-of-content> (stable per content — recapturing identical text hits the same slug); type diary/event routes under life/. Fenced clients: the default lands under your first bound prefix." },- type: { type: 'string', required: false, description: "Page type for the stamped frontmatter. Omitted: the content's frontmatter `type:` when present, else 'note'. An explicit type (this param or a frontmatter `type:`) must be declared by the active schema pack; undeclared types are rejected before writing, naming the declared vocabulary." },+ content: { type: 'string', required: true, description: 'Markdown or text (not a file path).' },+ local_file: { type: 'string', description: 'Local CLI only.', required: false },+ slug: { type: 'string', required: false, description: 'Default inbox/<date>-<hash>.' },+ type: { type: 'string', required: false, description: 'Schema-pack page type (default note).' },},scope: 'write',mutating: true,diff --git a/src/core/ops/persistence.ts b/src/core/ops/persistence.tsindex a91224caff..ca1005c787 100644--- a/src/core/ops/persistence.ts+++ b/src/core/ops/persistence.ts@@ -116,13 +116,13 @@ function requiredRequestId(value: unknown): string {return id;}-const requestParam = { type: 'string' as const, required: true, description: 'The original request UUID. Only this principal’s currently authorized requests are accessible.' };+const requestParam = { type: 'string' as const, required: true, description: 'The UUID you sent with the write.' };export const persistenceOperations: Operation[] = [{name: 'get_write_request',outputRedaction: 'no_stored_text',- description: 'Read your durable write receipt by request_id. Requires write scope and this operation in the current grant. Foreign, missing, and no-longer-accessible requests return the same not_found error; private journal input and recovery bytes are never returned.',+ description: 'Read the receipt of your write by request_id (after write_pending or a lost reply).',params: { request_id: requestParam },scope: 'write', mutating: false, area: 'pages',cliHints: { name: 'write-request', positional: ['request_id'] },@@ -138,11 +138,11 @@ export const persistenceOperations: Operation[] = [{name: 'list_write_requests',outputRedaction: 'no_stored_text',- description: 'List your currently authorized write receipts in one source, newest first. Useful when an acknowledgment was lost. Results and pagination exclude other principals and inaccessible targets; no private payloads or cross-principal queue counts are exposed.',+ description: 'List your write receipts in one source, newest first.',params: {- source_id: { type: 'string', description: 'Source to inspect. Defaults to the caller’s resolved source.' },- limit: { type: 'number', default: 25, description: 'Number of visible receipts, 1–100. Default 25.' },- before: { type: 'string', description: 'Opaque next cursor from the previous response.' },+ source_id: { type: 'string', description: 'Default: yours.' },+ limit: { type: 'number', default: 25, description: '1-100 (default 25).' },+ before: { type: 'string', description: 'next cursor from the previous page.' },},scope: 'write', mutating: false, area: 'pages',cliHints: { name: 'write-requests' },@@ -170,7 +170,7 @@ export const persistenceOperations: Operation[] = [{name: 'cancel_write_request',outputRedaction: 'no_stored_text',- description: 'Cancel your accepted write before publication starts. Returns the actual receipt: running/recovering or already-terminal requests may remain unchanged. Cancellation cannot undo published bytes or a committed fact withdrawal.',+ description: 'Cancel your accepted write before it publishes. Returns the actual receipt.',params: { request_id: requestParam },scope: 'write', mutating: true, area: 'pages',cliHints: { name: 'cancel-write-request', positional: ['request_id'] },diff --git a/src/core/ops/request-tools.ts b/src/core/ops/request-tools.tsindex 3579742042..49abb7874e 100644--- a/src/core/ops/request-tools.ts+++ b/src/core/ops/request-tools.ts@@ -113,11 +113,7 @@ async function visibleOpsForCaller(const request_tools: Operation = {name: 'request_tools',outputRedaction: 'no_stored_text',- description:- 'Discover this brain\'s tool catalog and optionally unlock a wider tool surface for your client. ' +- 'No arguments → the catalog visible to YOUR credentials, grouped by area (tool names + one-line summaries). ' +- '{tools: ["name", ...]} → full read-only schemas for the visible subset of those names (unknown/hidden names are silently omitted). ' +- '{surface: "verbs"|"starter"|"full"} → persist that tool surface for this client (bounded by the server ceiling; denied when an operator pinned the surface; ~5 changes/hour), then re-issue tools/list to see the new catalog.',+ description: 'More tools: no arguments lists your catalog; {tools: [names]} returns schemas; {surface} persists a wider surface for your OAuth client.',area: 'discovery',// FOV-4: callable by read OR agent scope — discovery for every token class.agentCallable: true,@@ -125,12 +121,12 @@ const request_tools: Operation = {tools: {type: 'array',items: { type: 'string', description: 'A tool name from the catalog.' },- description: 'Fetch full read-only tool schemas for these names. Names outside your visible surface are silently omitted (D5).',+ description: 'Tool names to fetch schemas for.',},surface: {type: 'string',enum: ['verbs', 'starter', 'full'],- description: 'Persist this tool surface for your client. Must not exceed the server ceiling; ignored surfaces stay available via no-arg discovery. Takes effect on your next tools/list.',+ description: 'Surface to persist for your client.',},},scope: 'read',diff --git a/src/core/ops/salience.ts b/src/core/ops/salience.tsindex 24284b0af5..6e27e08aa8 100644--- a/src/core/ops/salience.ts+++ b/src/core/ops/salience.ts@@ -23,25 +23,16 @@ const get_recent_salience: Operation = {description: GET_RECENT_SALIENCE_DESCRIPTION,scope: 'read',params: {- days: { type: 'number', description: 'Window in days. Default 14.' },- limit: { type: 'number', description: 'Max results (default 20, capped at 100).' },+ days: { type: 'number', description: 'Window in days (default 14).' },+ limit: { type: 'number', description: 'Max results (default 20).' },slugPrefix: {type: 'string',- description: "Optional slug-prefix filter, e.g. 'personal' or 'wiki/people'.",+ description: "Slug prefix, e.g. 'wiki/people'.",},recency_bias: {type: 'string',enum: ['flat', 'on'],- description:- "v0.29.1: how to weight recency in the salience score.\n" +- " 'flat' (DEFAULT) — v0.29.0 behavior. Every page gets 1/(1+days_old).\n" +- " Stable, predictable; what most callers want.\n" +- " 'on' — Per-prefix decay map. concepts/originals/writing/\n" +- " become evergreen (recency component = 0); daily/,\n" +- " media/x/, chat/ decay aggressively. Use when the\n" +- " user explicitly biases for recency-aware salience\n" +- " ('what's been salient lately' vs 'what matters\n" +- " in this brain regardless of when').",+ description: 'flat (default) or on (per-prefix decay).',},},handler: async (ctx, p) => {@@ -74,15 +65,15 @@ const find_anomalies: Operation = {params: {since: {type: 'string',- description: 'ISO date YYYY-MM-DD. Default = today (UTC).',+ description: 'YYYY-MM-DD (default today).',},lookback_days: {type: 'number',- description: 'Days of history for the baseline. Default 30.',+ description: 'Baseline days (default 30).',},sigma: {type: 'number',- description: 'Sigma threshold. Default 3.0.',+ description: 'Threshold (default 3).',},},handler: async (ctx, p) => {diff --git a/src/core/ops/search.ts b/src/core/ops/search.tsindex 5e2bdf7603..eb75e0e3b7 100644--- a/src/core/ops/search.ts+++ b/src/core/ops/search.ts@@ -97,25 +97,18 @@ function searchOutput(ctx: OperationContext, p: Record<string, unknown>, resultsconst FIELDS_PARAM = {type: 'string' as const,enum: ['lean', 'full'],- description: "Row fields. Remote callers get 'lean' rows by default; 'full' adds every ranking diagnostic.",+ description: "lean (remote default) or full.",};/** Evidence delivery params shared by `search` and `query`. */const RETURN_UNIT_PARAM = {type: 'string' as const,enum: ['chunk', 'window', 'section', 'page', 'auto'],- description:- "Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').\n" +- " 'chunk' — the ranked chunk only (~300-450 tokens per result).\n" +- " 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).\n" +- " 'section' — the enclosing markdown section, or the conversation rounds around the hit.\n" +- " 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.\n" +- " 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.\n" +- 'Non-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta.',+ description: "chunk, window, section, page or auto (default; whole page for conversations).",};const RETURN_WINDOW_PARAM = {type: 'number' as const,- description: "Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1).",+ description: 'Neighbor chunks each side for window (1-3).',};/**@@ -459,15 +452,13 @@ function normalizeTypesParam(raw: unknown): string[] | undefined {return types;}-const TYPES_PARAM_DESCRIPTION =- "Filter results to pages whose `type` is in this list (e.g. ['person','company']). " +- 'CLI: --types person,company. Applied at SQL level on every retrieval leg — the same ' +- 'filter `whoknows` uses. Stacks with all other filters.';+const TYPES_PARAM_DESCRIPTION = "Page types, e.g. ['person'].";++const SOURCE_ID_PARAM_DESCRIPTION = "One source, or '__all__'.";+const SALIENCE_PARAM = { type: 'string' as const, enum: ['off', 'on', 'strong'], description: 'Boost emotional pages (default: auto).' };+const RECENCY_PARAM = { type: 'string' as const, enum: ['off', 'on', 'strong'], description: "Boost recent pages (default: auto)." };-const SNIPPET_CHARS_PARAM_DESCRIPTION =- 'Cap each result\'s chunk_text at N characters (a "… [truncated]" marker names the ' +- 'get_page recovery move). 0 forces full text. Unset: subagent tool loops default to ' +- 'the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800)';+const SNIPPET_CHARS_PARAM_DESCRIPTION = 'Max chars per chunk_text (0 = full).';/*** #3800: resolve the effective snippet cap for one call. Explicit@@ -496,43 +487,27 @@ const search: Operation = {outputRedaction: 'retrieval',description: SEARCH_DESCRIPTION,params: {- query: { type: 'string', required: true, description: "Search text. Exact tokens, names, and structured-field values work best here (e.g. 'acme-example series A'), since this op does no LLM expansion. This is the search text param — there is no `text` or `q` param." },- limit: { type: 'number', description: 'Max results (default 20)' },- offset: { type: 'number', description: 'Skip first N results (for pagination)' },- mode: { type: 'string', description: 'Search mode (conservative|balanced|tokenmax). Local callers only.' },+ query: { type: 'string', required: true, description: "Exact tokens or names, e.g. 'acme-example series A'." },+ limit: { type: 'number', description: 'Max results (default 20).' },+ offset: { type: 'number', description: 'Rows to skip.' },+ mode: { type: 'string', description: 'Local callers only.' },// #4398: per-call source scope, mirroring `query` — MCP clients passed it// here, got 'unknown parameter ignored', and read UNSCOPED results.- source_id: {- type: 'string',- description:- "Scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile); when unset, an unqualified read spans every federated source. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources.",- },+ source_id: { type: 'string', description: SOURCE_ID_PARAM_DESCRIPTION },// #3985: multi-type filter (plumbing shipped v0.33; exposed here).types: { type: 'array', items: { type: 'string' }, description: TYPES_PARAM_DESCRIPTION },// #3800: subagent token economy — per-call snippet cap.snippet_chars: { type: 'number', description: SNIPPET_CHARS_PARAM_DESCRIPTION },return_unit: RETURN_UNIT_PARAM,return_window: RETURN_WINDOW_PARAM,- token_budget: { type: 'number', description: "Token budget for delivered evidence when return_unit is not 'chunk' (default search.return_budget_default = 6000; auto: search.return_budget_conversation = 24000). Ignored in chunk mode." },+ token_budget: { type: 'number', description: 'Evidence token budget (default 6000).' },// #4415: explicit ranking-axis overrides (the same knobs `query` has had// since v0.29.1). The auto-detect banks are English regex, so on a// non-English brain the recency/salience stages never fire — these flags// (CLI: --salience / --recency) are the per-call override; the// search.intent_patterns config is the per-brain fix.- salience: {- type: 'string',- enum: ['off', 'on', 'strong'],- description:- "Salience boost (emotional_weight + take_count, no time component): 'off' | 'on' | 'strong'. " +- 'Omit and gbrain auto-detects from query text. Independent of `recency`.',- },- recency: {- type: 'string',- enum: ['off', 'on', 'strong'],- description:- "Recency boost (per-prefix age decay, no mattering signal): 'off' | 'on' | 'strong'. " +- 'Omit and gbrain auto-detects. Independent of `salience`. Ignored on the keyword-only opt-out path.',- },+ salience: SALIENCE_PARAM,+ recency: RECENCY_PARAM,fields: FIELDS_PARAM,},handler: async (ctx, p) => {@@ -641,12 +616,12 @@ const query: Operation = {// validator at src/cli.ts honors `cliHints.altRequired` and admits the// image-only invocation. MCP / programmatic callers must still pass// `query` OR `image` (handler refuses if both are absent).- query: { type: 'string', required: false, description: "Question or topic text for hybrid retrieval with expansion (e.g. 'agents that do web research'). This is the search text param — there is no `text` or `q` param. Optional ONLY because `image` is the alternative entry point; a call with neither fails with invalid_params." },+ query: { type: 'string', required: false, description: "Question or topic (required unless image)." },/** v0.27.1: image-similarity search. Path resolved on the CLI side* before the op fires (the op receives raw bytes neither side; the* CLI loads the file, base64-encodes, and passes through `image`). */- image: { type: 'string', description: 'Base64-encoded image bytes for image-similarity search (CLI: --image <path>).' },- image_mime: { type: 'string', description: 'MIME type for the image bytes (auto-derived from path on CLI; required when calling op directly).' },+ image: { type: 'string', description: 'Base64 image for image search.' },+ image_mime: { type: 'string', description: 'MIME type of image.' },// #4356 — the text/hybrid path no longer hard-defaults this to 20; an// omitted OR falsy (0) `limit` resolves from the active search mode's// searchLimit (10/25/50 for conservative/balanced/tokenmax by default,@@ -663,97 +638,36 @@ const query: Operation = {// param) below now resolves the SAME mode-derived searchLimit as the// text path (was a hard `|| 20` regardless of mode, the last search arm// in this op that didn't honor conservative/balanced/tokenmax).- limit: { type: 'number', description: 'Max results. Omitted or 0 resolves from the active search mode (10 conservative / 25 balanced / 50 tokenmax by default, or the configured `search.searchLimit` override) — for both text queries and image-similarity queries (`image` param).' },- offset: { type: 'number', description: 'Skip first N results (for pagination)' },+ limit: { type: 'number', description: 'Default 10/25/50 by search mode.' },+ offset: { type: 'number', description: 'Rows to skip.' },// #3985: multi-type filter (plumbing shipped v0.33; exposed here).types: { type: 'array', items: { type: 'string' }, description: TYPES_PARAM_DESCRIPTION },// #3800: subagent token economy — per-call snippet cap.snippet_chars: { type: 'number', description: SNIPPET_CHARS_PARAM_DESCRIPTION },return_unit: RETURN_UNIT_PARAM,return_window: RETURN_WINDOW_PARAM,- token_budget: { type: 'number', description: "Token budget. Chunk mode, and whenever return_unit is omitted: caps the cumulative chunk payload (results that would overflow are skipped). Explicit non-chunk return_unit: the budget for delivered evidence (default search.return_budget_default = 6000, auto 24000; remote max search.return_budget_max_remote = 32000)." },- expand: { type: 'boolean', description: 'Request multi-query expansion (default: true in every search mode, regardless of search.expansion). Set false to opt out. Requires configured embedding and expansion providers; a cloud expander receives the query and may charge for the call. Response metadata expansion_applied reports whether variants were actually used.' },- detail: { type: 'string', description: 'Result detail level: low (compiled truth only), medium (default, all with dedup), high (all chunks)' },+ token_budget: { type: 'number', description: 'Token cap on the returned evidence.' },+ expand: { type: 'boolean', description: 'Default true; false skips the expansion LLM call.' },+ detail: { type: 'string', description: 'low (compiled truth only), medium (default) or high (all chunks).' },fields: FIELDS_PARAM,- mode: { type: 'string', description: 'Search mode (conservative|balanced|tokenmax). Local callers only; remote uses configured mode.' },+ mode: { type: 'string', description: 'Local callers only.' },// v0.20.0 Cathedral II Layer 10 C1/C2: language + symbol-kind filters.- lang: { type: 'string', description: 'Filter to chunks where content_chunks.language matches (e.g., typescript, python, ruby)' },- symbol_kind: { type: 'string', description: 'Filter to chunks where content_chunks.symbol_type matches (e.g., function, class, method, type, interface)' },+ lang: { type: 'string', description: 'Code language.' },+ symbol_kind: { type: 'string', description: 'Code symbol type.' },// v0.20.0 Cathedral II Layer 7 (A2) / Layer 10 C3: two-pass structural expansion.- near_symbol: { type: 'string', description: 'Anchor retrieval at this qualified symbol name (e.g., BrainEngine.searchKeyword). Enables A2 two-pass.' },- walk_depth: { type: 'number', description: 'Structural walk depth 1-2. Default 0 (off). Expands anchors through code_edges with 1/(1+hop) decay.' },+ near_symbol: { type: 'string', description: 'Anchor code symbol.' },+ walk_depth: { type: 'number', description: 'Code walk depth 1-2.' },// v0.29.1 — orthogonal recency + salience axes. YOU (the agent) decide.- salience: {- type: 'string',- enum: ['off', 'on', 'strong'],- description:- "v0.29.1 salience boost — emotional_weight + take_count, NO time component.\n" +- " 'off' — default for entity / canonical / definitional queries\n" +- " 'on' — surface emotionally-weighted + take-rich pages\n" +- " 'strong' — aggressive mattering tilt\n" +- "Omit and gbrain auto-detects from query text. Independent of `recency`.",- },- recency: {- type: 'string',- enum: ['off', 'on', 'strong'],- description:- "v0.29.1 recency boost — per-prefix age decay, NO mattering signal.\n" +- " 'off' — default for canonical truth\n" +- " 'on' — daily/, media/x/, chat/ decay aggressively; concepts/, originals/, writing/ stay evergreen\n" +- " 'strong' — multiplies the recency factor by 1.5 (use for 'today' / 'right now')\n" +- "Omit and gbrain auto-detects. Independent of `salience` (orthogonal axes).",- },- since: {- type: 'string',- description:- "v0.29.1 — filter to pages whose effective_date is >= this. ISO-8601 (YYYY-MM-DD or full timestamp) OR relative ('7d', '2w', '1y'). Replaces deprecated `afterDate`.",- },- until: {- type: 'string',- description:- "v0.29.1 — filter to effective_date <= this. Same format as `since`. Replaces deprecated `beforeDate`. YYYY-MM-DD lands at end-of-day.",- },- source_id: {- type: 'string',- description:- "v0.34: scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile). Pass '__all__' to span every source for trusted local callers. For remote callers, '__all__' uses the same scope as omission: an OAuth grant when present, otherwise the transport-computed federated sources for grantless local stdio.",- },- cross_modal: {- type: 'string',- enum: ['text', 'image', 'both', 'auto'],- description:- "v0.36 cross-modal search routing.\n" +- " 'text' (default for non-image-intent queries) — text-only path, no behavior change vs v0.35.\n" +- " 'image' — route the query through Voyage multimodal-3 + the embedding_image column. Best for 'show me photos of...' phrasings.\n" +- " 'both' — run text AND image searches in parallel; merge via weighted RRF.\n" +- " 'auto' — same effect as omitting the field; intent classifier decides based on query phrasing.",- },- embedding_column: {- type: 'string',- description:- "v0.36: route vector search through a non-default embedding column. Defaults to 'embedding' (the brain's primary column) unless `search_embedding_column` config sets a different default. Per-call override for A/B benchmarking across providers (e.g. 'embedding_voyage', 'embedding_openai'). Column MUST be declared in the `embedding_columns` config registry — unknown names throw with a paste-ready hint listing valid columns.",- },- adaptive_return: {- type: 'boolean',- description:- "v0.41.33 — return a TIGHT, intent-sized result set instead of the full top-K. YOU (the agent) set this per query to serve the user well:\n" +- " TRUE when the user's question has a small, specific answer — a lookup ('what is X', 'who is Y', 'what's my <thing>', 'what did Z decide'), a single-fact recall, or when you'll route the result into a precise downstream step (a classifier, a decision, an exact citation). The user gets the answer, not a wall of loosely-related pages, and you spend fewer tokens reading noise.\n" +- " Omit / FALSE for breadth — 'everything about X', 'list all', 'what do I know about Y', exploration, brainstorming, or any time you'd rather see more candidates and judge for yourself. Recall matters more there, so take the full top-K.\n" +- "Safe by construction: it NEVER returns empty when there are matches (you always get at least the top hit), and it only applies to the first page (omit when paginating). Caps come from config (search.adaptive_return_entity_max / _other_max; default 2 / 6) — pass `limit` 1 alongside this for a hard single-answer cap.",- },- autocut: {- type: 'boolean',- description:- "v0.42.3.0 — autocut is the SMART DEFAULT (already ON when the reranker runs, which it does in the default search mode). It returns only the confident cluster by cutting where the relevance score drops off a cliff, so an obvious single answer comes back as 1 result and a genuine handful comes back as that handful — not a fixed wall of 20+.\n" +- " You almost never set this. Pass FALSE only to FORCE the full top-K when you deliberately want breadth — broad exploration, 'show me everything about X', enumeration where you'd rather over-collect and judge for yourself, or when you suspect the top hit is wrong and want to see the alternatives.\n" +- " TRUE is redundant in default mode (it's already on); it only matters to override a brain whose config turned autocut off.\n" +- "Safe by construction: never returns empty when there are matches, only applies to the first page (omit when paginating), and is a no-op when no reranker scored the results (so it can't cut on an untrustworthy signal). Distinct from `adaptive_return`: autocut cuts on the score cliff; adaptive_return caps by question intent. Leave both unset for the smart default.",- },- relational: {- type: 'boolean',- description:- "v0.43 — relational recall arm. SMART DEFAULT (on in balanced/tokenmax). When the question is about a RELATIONSHIP ('who invested in widget-co', 'who introduced me to alice', 'what connects fund-a and fund-b'), the brain resolves the named entity and walks its typed-edge graph (invested_in, works_at, founded, …), surfacing the answer even when no passage mentions both sides. Pure no-op for non-relational questions. Pass FALSE to force lexical/vector-only retrieval (e.g. debugging why a graph answer appeared). You almost never set this.",- },+ salience: SALIENCE_PARAM,+ recency: RECENCY_PARAM,+ since: { type: 'string', description: 'On/after: YYYY-MM-DD or 7d/2w/1y.' },+ until: { type: 'string', description: 'On/before.' },+ source_id: { type: 'string', description: SOURCE_ID_PARAM_DESCRIPTION },+ cross_modal: { type: 'string', enum: ['text', 'image', 'both', 'auto'], description: 'Default auto.' },+ embedding_column: { type: 'string', description: 'Registered embedding column.' },+ adaptive_return: { type: 'boolean', description: 'true when one specific answer is wanted (fewer rows; never returns empty); omit for breadth.' },+ autocut: { type: 'boolean', description: 'Default on (never returns empty); false gives full top-K for breadth. Cuts at the score cliff, unlike adaptive_return.' },+ relational: { type: 'boolean', description: 'Relationship-graph arm (default on).' },},handler: async (ctx, p) => {const startedAt = Date.now();diff --git a/src/core/ops/skills-catalog.ts b/src/core/ops/skills-catalog.tsindex 4668303ce0..ec768fdbd3 100644--- a/src/core/ops/skills-catalog.ts+++ b/src/core/ops/skills-catalog.ts@@ -26,13 +26,13 @@ const list_skills: Operation = {description: LIST_SKILLS_DESCRIPTION,publishGateKey: 'mcp.publish_skills',params: {- schema_version: { type: 'number', description: 'Request 2 for the canonical source-qualified sealed catalog; omitted preserves version 1.' },- limit: { type: 'number', description: 'Version 2 page size, 1-100.' },- cursor: { type: 'string', description: 'Version 2 opaque snapshot cursor.' },- source_id: { type: 'string', description: 'Narrow version 2 enumeration to one permitted source.' },+ schema_version: { type: 'number', description: '2 for the source-qualified catalog.' },+ limit: { type: 'number', description: 'Version 2 page size (1-100).' },+ cursor: { type: 'string', description: 'Version 2 cursor.' },+ source_id: { type: 'string', description: 'Version 2: one source.' },section: {type: 'string',- description: 'Optional: only skills whose routing section matches this exactly.',+ description: 'Only this routing section.',},},handler: async (ctx, p) => {@@ -58,21 +58,19 @@ const get_skill: Operation = {description: GET_SKILL_DESCRIPTION,publishGateKey: 'mcp.publish_skills',params: {- schema_version: { type: 'number', description: 'Request 2 for an immutable canonical revision.' },- qualified_id: { type: 'string', description: 'Exact version 2 qualified skill identity.' },- expected_brain_id: { type: 'string', description: 'Assert the connected persistent brain identity from version 2 discovery. This never routes to another brain.' },- source_incarnation: { type: 'string', description: 'Source incarnation from version 2 discovery.' },- pack_id: { type: 'string', description: 'Canonical pack identifier.' },- revision: { type: 'string', description: 'Exact immutable revision, or omit for the current head.' },+ schema_version: { type: 'number', description: '2 for an exact canonical revision.' },+ qualified_id: { type: 'string', description: 'Version 2 skill id.' },+ expected_brain_id: { type: 'string', description: 'Version 2 brain id to assert.' },+ source_incarnation: { type: 'string', description: 'From discovery.' },+ pack_id: { type: 'string', description: 'Pack id.' },+ revision: { type: 'string', description: 'Exact revision (default: head).' },name: {type: 'string',- description: 'Skill name exactly as returned by list_skills (or the brain-pack skill slug when source_id is set).',+ description: 'Skill name from list_skills.',},source_id: {type: 'string',- description:- 'Optional: fetch a brain-resident pack skill from this source instead of the host catalog. ' +- 'Disambiguates a slug that exists on more than one source (see list_brain_skillpack).',+ description: 'Fetch a brain-resident pack skill from this source.',},},handler: async (ctx, p) => {@@ -102,7 +100,7 @@ const get_skill: Operation = {const sharedSkillKeyParams: Operation['params'] = {source_id: { type: 'string', description: 'Exactly one granted source.' },- source_incarnation: { type: 'string', description: 'Expected source incarnation from the qualified catalog.' },+ source_incarnation: { type: 'string', description: 'From the qualified catalog.' },pack_id: { type: 'string', required: true, description: 'Canonical pack identifier.' },name: { type: 'string', required: true, description: 'Canonical skill name.' },};@@ -118,17 +116,17 @@ const sharedSkillMutationParams: Operation['params'] = {expected_revision: { type: 'string', description: 'Current revision UUID; JSON null for creation.' },};const get_skill_asset: Operation = {- name: 'get_skill_asset', description: 'Read a bounded, owner-approved file from an exact sealed skill revision. Does not execute downloaded bytes.',+ name: 'get_skill_asset', description: 'Read an approved file from an exact skill revision (data only; never executed).',outputRedaction: { exempt: 'skill catalog files are installed instructions read verbatim; redaction would corrupt approved revisions' },scope: 'read', publishGateKey: 'mcp.publish_skills',cliHints: { name: 'skill-asset', positional: [] },params: { source_id: sharedSkillKeyParams.source_id, source_incarnation: sharedSkillKeyParams.source_incarnation,- name: { type: 'string', description: 'Skill name when not selecting by qualified_id.' },- pack_id: { type: 'string', description: 'Pack identifier when not selecting by qualified_id.' },- qualified_id: { type: 'string', description: 'Qualified skill key from version 2 discovery.' },- expected_brain_id: { type: 'string', description: 'Assert this connected persistent brain identity without routing to another brain.' },- revision: { type: 'string', required: true, description: 'Immutable revision from get_skill.' },- path: { type: 'string', required: true, description: 'Exact path in the approved revision file manifest.' } },+ name: { type: 'string', description: 'Skill name.' },+ pack_id: { type: 'string', description: 'Pack id.' },+ qualified_id: { type: 'string', description: 'Version 2 skill id.' },+ expected_brain_id: { type: 'string', description: 'Brain id to assert.' },+ revision: { type: 'string', required: true, description: 'Revision from get_skill.' },+ path: { type: 'string', required: true, description: 'Path in that revision manifest.' } },handler: async (ctx, p) => (await import('../shared-skills/catalog.ts')).getSharedSkillAsset(ctx, { ...sharedSkillReadSelector(p), path: String(p.path ?? '') }),};const put_skill: Operation = {@@ -206,11 +204,7 @@ const retain_skill_revision: Operation = {const list_brain_skillpack: Operation = {name: 'list_brain_skillpack',outputRedaction: { exempt: 'skill catalog files are installed instructions read verbatim; redaction would corrupt approved revisions' },- description:- 'List brain-resident skillpacks this brain ships (per-source). Returns each pack\'s skills, ' +- 'one-line descriptions, the schema pack it targets + whether that matches this brain, and a ' +- 'git scaffold spec. Read-only; gated by mcp.publish_skills. After orienting, call this and ' +- 'ask the user whether to install any pack the brain offers (gbrain skillpack scaffold <spec>).',+ description: 'Skillpacks this brain ships, with skills and a scaffold spec to offer the user.',publishGateKey: 'mcp.publish_skills',params: {},handler: async (ctx) => {diff --git a/src/core/ops/sources.ts b/src/core/ops/sources.tsindex 1566eda5f1..03b7a94640 100644--- a/src/core/ops/sources.ts+++ b/src/core/ops/sources.ts@@ -16,14 +16,7 @@ import { resolveAuthCapabilities } from '../harness/capabilities.ts';const whoami: Operation = {name: 'whoami',outputRedaction: 'no_stored_text',- description:- 'Introspect the calling identity. Returns one of three transport shapes: ' +- '{transport: "oauth", client_id, client_name, scopes, expires_at, source_id, federated_read}, ' +- '{transport: "legacy", token_name, scopes, expires_at: null}, or ' +- '{transport: "local", scopes: []}, or {transport: "stdio", scopes: []} ' +- 'for the auth-less stdio MCP pipe. Throws unknown_transport when the ' +- 'context is ambiguous (remote=true without auth and no transport marker) ' +- '— fail-closed posture mirroring the v0.26.9 trust-boundary contract.',+ description: 'Your identity: transport, scopes and, over OAuth, client, source_id and federated_read.',params: {},scope: 'read',handler: async (ctx) => {diff --git a/src/core/ops/timeline.ts b/src/core/ops/timeline.tsindex d28f9c53e1..f3d04bf359 100644--- a/src/core/ops/timeline.ts+++ b/src/core/ops/timeline.ts@@ -20,14 +20,14 @@ import {const add_timeline_entry: Operation = {name: 'add_timeline_entry',outputRedaction: 'retrieval',- description: 'Append an entry to the canonical Markdown timeline and structured timeline store in one committed write. Exact replay changes neither store.',+ description: 'Append a dated entry to a page timeline. Replaying the same entry changes nothing.',params: {request_id: WRITE_REQUEST_PARAM,- slug: { type: 'string', required: true, description: 'Slug of the page whose timeline to append to.' },- date: { type: 'string', required: true, description: "Entry date, strict YYYY-MM-DD (e.g. '2026-04-03'). Timestamps and non-calendar dates are rejected." },- summary: { type: 'string', required: true, description: 'One-line summary of what happened on that date.' },- detail: { type: 'string', description: 'Longer free-text detail behind the summary.' },- source: { type: 'string', description: "Provenance ref for the entry, e.g. a meeting slug like 'meetings/2026-04-03' or a URL." },+ slug: { type: 'string', description: 'Page slug.', required: true },+ date: { type: 'string', required: true, description: 'YYYY-MM-DD.' },+ summary: { type: 'string', required: true, description: 'One line.' },+ detail: { type: 'string', description: 'Longer text.' },+ source: { type: 'string', description: 'Provenance slug or URL.' },},mutating: true,scope: 'write',diff --git a/src/core/persistence/params.ts b/src/core/persistence/params.tsindex de0a36a084..6d976a26a3 100644--- a/src/core/persistence/params.ts+++ b/src/core/persistence/params.ts@@ -2,11 +2,11 @@ import type { ParamDef } from '../ops/contract.ts';/** Capture input sugar stays data; the owner materializes generated fields once. */export const CAPTURE_EVENT_PARAMS: Record<string, ParamDef> = {- who: { type: 'string', description: 'For event captures, comma-separated entity slugs.' },- what: { type: 'string', description: 'For event captures, the event description.' },- where: { type: 'string', description: 'For event captures, the location.' },- kind: { type: 'string', description: 'For event captures, the event kind.' },- depth: { type: 'string', description: 'For event captures, the depth page to link.' },+ who: { type: 'string', description: 'Event: comma-separated entity slugs.' },+ what: { type: 'string', description: 'Event.' },+ where: { type: 'string', description: 'Event place.' },+ kind: { type: 'string', description: 'Event kind.' },+ depth: { type: 'string', description: 'Event depth page to link.' },};import { WRITE_REQUEST_STATES, WRITE_HEALTH_REASONS, WRITE_HEALTH_ASSESSMENTS, WRITE_HEALTH_ACTIONS } from './types.ts';@@ -16,21 +16,21 @@ import { WRITE_REQUEST_STATES, WRITE_HEALTH_REASONS, WRITE_HEALTH_ASSESSMENTS, W*/export const WRITE_REQUEST_PARAM: ParamDef = {type: 'string',- description: 'Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.',+ description: 'UUID; retry with it on timeout.',};export const PAGE_MUTATION_PARAMS: Record<string, ParamDef> = {source_id: {type: 'string',- description: 'Source to mutate. Defaults to the selected source. Remote callers may only use their current write source.',+ description: 'Write source.',},expected_revision: {type: 'string',- description: 'Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.',+ description: 'Revision read; omit to create.',},force: {type: 'boolean',- description: 'Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.',+ description: 'Ignore the revision.',},request_id: WRITE_REQUEST_PARAM,};diff --git a/src/core/verbs.ts b/src/core/verbs.tsindex 7f57864d6f..bebc4b6708 100644--- a/src/core/verbs.ts+++ b/src/core/verbs.ts@@ -61,48 +61,35 @@ const PROVENANCE_MAX = 500;const remember: Operation = {name: 'remember',outputRedaction: 'no_stored_text',- description:- 'MEMORY VERB (v1): save one fact to durable agent memory — the protocol write verb. ' +- 'provenance is REQUIRED (free text, e.g. "conversation 2026-06-12", "user said in chat", "import: notes.md"). ' +- 'Set `entity` whenever the fact is about a specific person/company/project — entity-scoped recall will not find it otherwise. ' +- 'ttl accepts duration shorthand ("30d", "12h") or an absolute ISO 8601 timestamp; ISO-8601 durations like "P30D" are rejected with a fix. ' +- 'visibility defaults to "world" (readable by every agent connected to this brain; pass "private" for local-CLI-only facts). ' +- 'Response: branch on `status` (inserted|duplicate|superseded), never on `status_text` (human rendering only). ' +- 'On duplicate, `id` is the EXISTING fact\'s id. For bulk extraction from a raw transcript use extract_facts instead.',+ description: 'MEMORY VERB (v1): save one fact; provenance required. Set `entity` when the fact has a subject, or entity-scoped recall misses it. Branch on `status` (inserted|duplicate|superseded). write_pending carries a receipt: poll get_write_request.',params: {...PAGE_MUTATION_PARAMS,- fact: { type: 'string', required: true, description: 'The fact to remember, one claim per call.' },+ fact: { type: 'string', description: 'One claim.', required: true },provenance: {type: 'string',required: true,- description:- 'Where this fact came from (REQUIRED, free text, max 500 chars). Examples: "conversation 2026-06-12", "user said in chat", "import: meeting-notes.md".',+ description: 'Where the fact came from (max 500 chars).',},ttl: {type: 'string',- description:- 'Optional expiry: duration shorthand ("30d", "12h", "45m") or absolute ISO 8601 timestamp ("2026-07-12T00:00:00Z"). NOT ISO-8601 durations ("P30D" is rejected). Omit = never expires.',+ description: '"30d", "12h" or ISO 8601 time; omit = never.',},entity: {type: 'string',- description:- 'Person/company/project this fact is about (name or slug; canonicalized server-side). Set it whenever the fact has a subject — entity-scoped recall misses unattributed facts.',+ description: 'Who or what it is about (name or slug).',},infer_entity: {type: 'boolean',- description:- 'Default true. When `entity` is omitted, link the fact to the one entity page the text names exactly (response `entity_inferred: "mention"`); pass false to save it unattributed.',+ description: 'Default true.',},kind: {- type: 'string',+ type: 'string', description: 'Default fact.',enum: [...FACT_KINDS],- description: 'Fact kind: event | preference | commitment | belief | fact (default).',},visibility: {type: 'string',enum: ['world', 'private'],- description:- 'world (default): readable by every agent connected to this brain — required for the remote remember→recall round-trip. private: local CLI reads only.',+ description: 'world (default) or private (local CLI only).',},},mutating: true,@@ -172,14 +159,9 @@ const remember: Operation = {const entity: Operation = {name: 'entity',outputRedaction: 'retrieval',- description:- 'MEMORY VERB (v1): inspect ONE known person/company/project card — zero LLM calls, sub-100ms. ' +- 'Resolution: alias > exact title > slug-suffix; ties break on most-recently-touched. ' +- 'NEVER errors on a miss: returns found:false plus near-miss suggestions with create_safety hints ' +- '(exists | probable | unknown — whether writing a new page would duplicate). ' +- 'Routing: for facts/snippets retrieval use recall; for broad questions needing reasoning use synthesize (expensive).',+ description: 'MEMORY VERB (v1): one known person/company/project card, zero LLM. A miss returns found:false with near matches and create_safety, so you do not duplicate a page. Facts: recall.',params: {- name: { type: 'string', required: true, description: 'Free-text name, alias, or slug (e.g. "Alice Example", "people/alice-example").' },+ name: { type: 'string', required: true, description: 'Name, alias or slug (e.g. "Alice Example").' },},scope: 'read',verb: true,@@ -227,18 +209,11 @@ const SYNTHESIS_FAILURE_CODES: Record<string, string> = {const synthesize: Operation = {name: 'synthesize',outputRedaction: 'retrieval',- description:- '[EXPENSIVE / SLOW — makes LLM calls, seconds-to-minutes latency, costs money] ' +- 'MEMORY VERB (v1): answer a broad question using cross-page LLM reasoning with citations and gap analysis. ' +- 'Prefer recall (facts/snippets) or entity (one known card, zero LLM) for lookups — use synthesize only when the answer ' +- 'requires combining evidence across pages. Response carries a best-effort cost block (model, tokens, usd_estimate) ' +- 'plus compose-status fields (synthesis_status, pages_gathered, takes_gathered, warnings); when the LLM compose step ' +- 'fails but retrieval succeeded, `answer` degrades to an extractive digest of retrieved pages ' +- '(synthesis_status: "extractive_fallback") instead of an error.',+ description: '[EXPENSIVE / SLOW: LLM calls, costs money] MEMORY VERB (v1): answer a broad question across pages with citations. For lookups use recall or entity.',params: {- question: { type: 'string', required: true, description: 'The question to answer.' },- since: { type: 'string', description: 'Optional temporal window start (ISO 8601 date or datetime).' },- until: { type: 'string', description: 'Optional temporal window end (ISO 8601 date or datetime).' },+ question: { type: 'string', description: 'The question.', required: true },+ since: { type: 'string', description: 'Window start (ISO 8601).' },+ until: { type: 'string', description: 'Window end (ISO 8601).' },},scope: 'read',verb: true,@@ -350,15 +325,11 @@ const synthesize: Operation = {const forget: Operation = {name: 'forget',outputRedaction: 'no_stored_text',- description:- 'MEMORY VERB (v1): expire a remembered fact by id — the protocol delete verb. ' +- '`id` is the opaque string id returned by remember and recall (facts[].fact_id) — never a page slug. ' +- 'Idempotent: forgetting an already-expired fact returns expired:false (success), unknown id returns a not_found error. ' +- 'The fact is expired (audit trail kept), not deleted.',+ description: 'MEMORY VERB (v1): expire a remembered fact by its fact_id (never a page slug). Idempotent; the audit trail is kept.',params: {request_id: WRITE_REQUEST_PARAM,- id: { type: 'string', required: true, description: 'Opaque fact id from remember/recall (facts[].fact_id). Never a page slug.' },- reason: { type: 'string', description: 'Optional reason, written to the fact\'s audit trail. Default: "forgotten".' },+ id: { type: 'string', required: true, description: 'fact_id from remember or recall.' },+ reason: { type: 'string', description: 'Audit note (default "forgotten").' },},mutating: true,scope: 'write',diff --git a/src/mcp/dispatch.ts b/src/mcp/dispatch.tsindex b67a33f0cf..0806ffb36a 100644--- a/src/mcp/dispatch.ts+++ b/src/mcp/dispatch.ts@@ -354,16 +354,35 @@ export function retrievalNoticeBlocks(result: unknown, retrieval: unknown): striconst blocks: string[] = empty ? [empty] : [];if (typeof r.type_filter_notice === 'string') blocks.push(r.type_filter_notice);if (r.other_names?.length) {- blocks.push(`Other names in these results (documents may use either; search the one you have not tried): ${r.other_names- .map(n => `${n.alias} = ${n.name} (declared in ${n.slug})`).join('; ')}.`);+ const { text, more } = wholeItemsWithin('Other names in these results (documents may use either; search the one you have not tried): ',+ r.other_names.map(n => `${n.alias} = ${n.name} (declared in ${n.slug})`), '; ', OTHER_NAMES_NOTICE_MAX_CHARS);+ blocks.push(`${text}${more ? ` (+${more} more)` : ''}.`);}if (r.saved_facts?.length) {- blocks.push(`Saved facts (remember) matching this query, newest first; recall returns more:\n${r.saved_facts- .map(f => `- ${f.fact} [entity: ${f.entity_slug ?? 'none'}; saved ${String(f.valid_from).slice(0, 10)}; provenance: ${f.source}]`).join('\n')}`);+ const { text, more } = wholeItemsWithin('Saved facts (remember) matching this query, newest first; recall returns more:\n',+ r.saved_facts.map(f => `- ${f.fact} [entity: ${f.entity_slug ?? 'none'}; saved ${String(f.valid_from).slice(0, 10)}; provenance: ${f.source}]`),+ '\n', SAVED_FACTS_NOTICE_MAX_CHARS);+ blocks.push(more ? `${text}\n(+${more} more; recall returns them)` : text);}return blocks;}+/** C4: character ceilings for the model-visible notice blocks (header included). */+export const SAVED_FACTS_NOTICE_MAX_CHARS = 1_500;+export const OTHER_NAMES_NOTICE_MAX_CHARS = 400;++/**+ * Whole items after `head` while the block stays within `max` characters;+ * an item is never cut, so its provenance stays intact. The first item is+ * always shown, even alone over the ceiling. `more` counts the items left out.+ */+function wholeItemsWithin(head: string, items: string[], sep: string, max: number): { text: string; more: number } {+ let text = head + items[0];+ let shown = 1;+ while (shown < items.length && text.length + sep.length + items[shown].length <= max) text += sep + items[shown++];+ return { text, more: items.length - shown };+}+/*** D8: render the second (model-visible) content block for an empty retrieval* result from the handler-emitted `retrieval` meta. Returns null when thediff --git a/test/fixtures/goldens/cli/help-and-errors.json b/test/fixtures/goldens/cli/help-and-errors.jsonindex 86c02f3c3b..a1ab1569d7 100644--- a/test/fixtures/goldens/cli/help-and-errors.json+++ b/test/fixtures/goldens/cli/help-and-errors.json@@ -668,61 +668,37 @@"stdout": ["Usage: gbrain query <query> [options]","",- "Hybrid search with vector + keyword + multi-query expansion. Prefer `query` for concept / synonym / landscape questions ('all the X that do Y', 'the landscape of Z') — expansion recovers synonym- and outcome-phrased matches a single embedding misses. Still top-K, and the default count when `limit` is omitted depends on the configured search mode (10 conservative / 25 balanced / 50 tokenmax — see the `limit` param description); pass `limit` explicitly for a stable count regardless of mode. When the answer needs the surrounding conversation or section, pass `return_unit` ('page' / 'section' / 'window') to get that evidence in one call instead of get_page per hit; conversation pages already come back whole by default (return_unit 'auto'; 'chunk' opts out). For exhaustive enumeration use list_pages; for exact known tokens `search` is cheaper (no expansion LLM call). For personal/emotional questions ('what's going on with me', 'anything notable', 'how am I feeling'), prefer get_recent_salience, find_anomalies, or get_recent_transcripts. Semantic search returns polished pages and misses recent activity bursts. Do NOT assume words like 'crazy', 'notable', or 'big' mean impressive — they often mean difficult or emotionally charged.",+ "Ranked hybrid search with multi-query expansion, for concept / synonym / landscape questions: expansion recovers synonym-phrased matches. Still top-K; return_unit returns whole sections or conversations. Lists: list_pages. Exact tokens: `search` is cheaper (no expansion LLM call). Personal questions: get_recent_salience, find_anomalies, get_recent_transcripts. Do NOT assume 'crazy' means impressive (often difficult or emotionally charged). fields: \"full\" adds diagnostics.","","Options:",- " <query> Question or topic text for hybrid retrieval with expansion (e.g. 'agents that do web research'). This is the search text param — there is no `text` or `q` param. Optional ONLY because `image` is the alternative entry point; a call with neither fails with invalid_params.",- " --image Base64-encoded image bytes for image-similarity search (CLI: --image <path>).",- " --image-mime MIME type for the image bytes (auto-derived from path on CLI; required when calling op directly).",- " --limit Max results. Omitted or 0 resolves from the active search mode (10 conservative / 25 balanced / 50 tokenmax by default, or the configured `search.searchLimit` override) — for both text queries and image-similarity queries (`image` param).",- " --offset Skip first N results (for pagination)",- " --types Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters.",- " --snippet-chars Cap each result's chunk_text at N characters (a \"… [truncated]\" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800)",- " --return-unit Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').",- " 'chunk' — the ranked chunk only (~300-450 tokens per result).",- " 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).",- " 'section' — the enclosing markdown section, or the conversation rounds around the hit.",- " 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.",- " 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.",- "Non-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta.",- " --return-window Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1).",- " --token-budget Token budget. Chunk mode, and whenever return_unit is omitted: caps the cumulative chunk payload (results that would overflow are skipped). Explicit non-chunk return_unit: the budget for delivered evidence (default search.return_budget_default = 6000, auto 24000; remote max search.return_budget_max_remote = 32000).",- " --expand Request multi-query expansion (default: true in every search mode, regardless of search.expansion). Set false to opt out. Requires configured embedding and expansion providers; a cloud expander receives the query and may charge for the call. Response metadata expansion_applied reports whether variants were actually used.",- " --detail Result detail level: low (compiled truth only), medium (default, all with dedup), high (all chunks)",- " --fields Row fields. Remote callers get 'lean' rows by default; 'full' adds every ranking diagnostic.",- " --mode Search mode (conservative|balanced|tokenmax). Local callers only; remote uses configured mode.",- " --lang Filter to chunks where content_chunks.language matches (e.g., typescript, python, ruby)",- " --symbol-kind Filter to chunks where content_chunks.symbol_type matches (e.g., function, class, method, type, interface)",- " --near-symbol Anchor retrieval at this qualified symbol name (e.g., BrainEngine.searchKeyword). Enables A2 two-pass.",- " --walk-depth Structural walk depth 1-2. Default 0 (off). Expands anchors through code_edges with 1/(1+hop) decay.",- " --salience v0.29.1 salience boost — emotional_weight + take_count, NO time component.",- " 'off' — default for entity / canonical / definitional queries",- " 'on' — surface emotionally-weighted + take-rich pages",- " 'strong' — aggressive mattering tilt",- "Omit and gbrain auto-detects from query text. Independent of `recency`.",- " --recency v0.29.1 recency boost — per-prefix age decay, NO mattering signal.",- " 'off' — default for canonical truth",- " 'on' — daily/, media/x/, chat/ decay aggressively; concepts/, originals/, writing/ stay evergreen",- " 'strong' — multiplies the recency factor by 1.5 (use for 'today' / 'right now')",- "Omit and gbrain auto-detects. Independent of `salience` (orthogonal axes).",- " --since v0.29.1 — filter to pages whose effective_date is >= this. ISO-8601 (YYYY-MM-DD or full timestamp) OR relative ('7d', '2w', '1y'). Replaces deprecated `afterDate`.",- " --until v0.29.1 — filter to effective_date <= this. Same format as `since`. Replaces deprecated `beforeDate`. YYYY-MM-DD lands at end-of-day.",- " --source-id v0.34: scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile). Pass '__all__' to span every source for trusted local callers. For remote callers, '__all__' uses the same scope as omission: an OAuth grant when present, otherwise the transport-computed federated sources for grantless local stdio.",- " --cross-modal v0.36 cross-modal search routing.",- " 'text' (default for non-image-intent queries) — text-only path, no behavior change vs v0.35.",- " 'image' — route the query through Voyage multimodal-3 + the embedding_image column. Best for 'show me photos of...' phrasings.",- " 'both' — run text AND image searches in parallel; merge via weighted RRF.",- " 'auto' — same effect as omitting the field; intent classifier decides based on query phrasing.",- " --embedding-column v0.36: route vector search through a non-default embedding column. Defaults to 'embedding' (the brain's primary column) unless `search_embedding_column` config sets a different default. Per-call override for A/B benchmarking across providers (e.g. 'embedding_voyage', 'embedding_openai'). Column MUST be declared in the `embedding_columns` config registry — unknown names throw with a paste-ready hint listing valid columns.",- " --adaptive-return v0.41.33 — return a TIGHT, intent-sized result set instead of the full top-K. YOU (the agent) set this per query to serve the user well:",- " TRUE when the user's question has a small, specific answer — a lookup ('what is X', 'who is Y', 'what's my <thing>', 'what did Z decide'), a single-fact recall, or when you'll route the result into a precise downstream step (a classifier, a decision, an exact citation). The user gets the answer, not a wall of loosely-related pages, and you spend fewer tokens reading noise.",- " Omit / FALSE for breadth — 'everything about X', 'list all', 'what do I know about Y', exploration, brainstorming, or any time you'd rather see more candidates and judge for yourself. Recall matters more there, so take the full top-K.",- "Safe by construction: it NEVER returns empty when there are matches (you always get at least the top hit), and it only applies to the first page (omit when paginating). Caps come from config (search.adaptive_return_entity_max / _other_max; default 2 / 6) — pass `limit` 1 alongside this for a hard single-answer cap.",- " --autocut v0.42.3.0 — autocut is the SMART DEFAULT (already ON when the reranker runs, which it does in the default search mode). It returns only the confident cluster by cutting where the relevance score drops off a cliff, so an obvious single answer comes back as 1 result and a genuine handful comes back as that handful — not a fixed wall of 20+.",- " You almost never set this. Pass FALSE only to FORCE the full top-K when you deliberately want breadth — broad exploration, 'show me everything about X', enumeration where you'd rather over-collect and judge for yourself, or when you suspect the top hit is wrong and want to see the alternatives.",- " TRUE is redundant in default mode (it's already on); it only matters to override a brain whose config turned autocut off.",- "Safe by construction: never returns empty when there are matches, only applies to the first page (omit when paginating), and is a no-op when no reranker scored the results (so it can't cut on an untrustworthy signal). Distinct from `adaptive_return`: autocut cuts on the score cliff; adaptive_return caps by question intent. Leave both unset for the smart default.",- " --relational v0.43 — relational recall arm. SMART DEFAULT (on in balanced/tokenmax). When the question is about a RELATIONSHIP ('who invested in widget-co', 'who introduced me to alice', 'what connects fund-a and fund-b'), the brain resolves the named entity and walks its typed-edge graph (invested_in, works_at, founded, …), surfacing the answer even when no passage mentions both sides. Pure no-op for non-relational questions. Pass FALSE to force lexical/vector-only retrieval (e.g. debugging why a graph answer appeared). You almost never set this."+ " <query> Question or topic (required unless image).",+ " --image Base64 image for image search.",+ " --image-mime MIME type of image.",+ " --limit Default 10/25/50 by search mode.",+ " --offset Rows to skip.",+ " --types Page types, e.g. ['person'].",+ " --snippet-chars Max chars per chunk_text (0 = full).",+ " --return-unit chunk, window, section, page or auto (default; whole page for conversations).",+ " --return-window Neighbor chunks each side for window (1-3).",+ " --token-budget Token cap on the returned evidence.",+ " --expand Default true; false skips the expansion LLM call.",+ " --detail low (compiled truth only), medium (default) or high (all chunks).",+ " --fields lean (remote default) or full.",+ " --mode Local callers only.",+ " --lang Code language.",+ " --symbol-kind Code symbol type.",+ " --near-symbol Anchor code symbol.",+ " --walk-depth Code walk depth 1-2.",+ " --salience Boost emotional pages (default: auto).",+ " --recency Boost recent pages (default: auto).",+ " --since On/after: YYYY-MM-DD or 7d/2w/1y.",+ " --until On/before.",+ " --source-id One source, or '__all__'.",+ " --cross-modal Default auto.",+ " --embedding-column Registered embedding column.",+ " --adaptive-return true when one specific answer is wanted (fewer rows; never returns empty); omit for breadth.",+ " --autocut Default on (never returns empty); false gives full top-K for breadth. Cuts at the score cliff, unlike adaptive_return.",+ " --relational Relationship-graph arm (default on)."]},{diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.jsonindex ac6dc76c01..19f02971fe 100644--- a/test/fixtures/goldens/cli/tools-json.json+++ b/test/fixtures/goldens/cli/tools-json.json@@ -2,8 +2,8 @@"golden": {"exitCode": 0,"stderr": "",- "stdoutBytes": 210416,- "stdoutSha256": "04c1305a174bd8b1967a39df87e39dd3818325c5197d6bbe48c8f2833dcb808d",+ "stdoutBytes": 171828,+ "stdoutSha256": "63b1c4278bade0ea6ab1590f30f150ddde4cfd6e47826a582bffecee58e2cf43","toolNames": ["remember","entity",@@ -163,7 +163,7 @@],"tools": [{- "description": "MEMORY VERB (v1): save one fact to durable agent memory — the protocol write verb. provenance is REQUIRED (free text, e.g. \"conversation 2026-06-12\", \"user said in chat\", \"import: notes.md\"). Set `entity` whenever the fact is about a specific person/company/project — entity-scoped recall will not find it otherwise. ttl accepts duration shorthand (\"30d\", \"12h\") or an absolute ISO 8601 timestamp; ISO-8601 durations like \"P30D\" are rejected with a fix. visibility defaults to \"world\" (readable by every agent connected to this brain; pass \"private\" for local-CLI-only facts). Response: branch on `status` (inserted|duplicate|superseded), never on `status_text` (human rendering only). On duplicate, `id` is the EXISTING fact's id. For bulk extraction from a raw transcript use extract_facts instead.",+ "description": "MEMORY VERB (v1): save one fact; provenance required. Set `entity` when the fact has a subject, or entity-scoped recall misses it. Branch on `status` (inserted|duplicate|superseded). write_pending carries a receipt: poll get_write_request.","name": "remember","parameters": {"entity": "string?",@@ -181,27 +181,27 @@"schema": {"properties": {"entity": {- "description": "Person/company/project this fact is about (name or slug; canonicalized server-side). Set it whenever the fact has a subject — entity-scoped recall misses unattributed facts.",+ "description": "Who or what it is about (name or slug).","type": "string"},"expected_revision": {- "description": "Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.",+ "description": "Revision read; omit to create.","type": "string"},"fact": {- "description": "The fact to remember, one claim per call.",+ "description": "One claim.","type": "string"},"force": {- "description": "Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.",+ "description": "Ignore the revision.","type": "boolean"},"infer_entity": {- "description": "Default true. When `entity` is omitted, link the fact to the one entity page the text names exactly (response `entity_inferred: \"mention\"`); pass false to save it unattributed.",+ "description": "Default true.","type": "boolean"},"kind": {- "description": "Fact kind: event | preference | commitment | belief | fact (default).",+ "description": "Default fact.","enum": ["event","preference",@@ -212,23 +212,23 @@"type": "string"},"provenance": {- "description": "Where this fact came from (REQUIRED, free text, max 500 chars). Examples: \"conversation 2026-06-12\", \"user said in chat\", \"import: meeting-notes.md\".",+ "description": "Where the fact came from (max 500 chars).","type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"source_id": {- "description": "Source to mutate. Defaults to the selected source. Remote callers may only use their current write source.",+ "description": "Write source.","type": "string"},"ttl": {- "description": "Optional expiry: duration shorthand (\"30d\", \"12h\", \"45m\") or absolute ISO 8601 timestamp (\"2026-07-12T00:00:00Z\"). NOT ISO-8601 durations (\"P30D\" is rejected). Omit = never expires.",+ "description": "\"30d\", \"12h\" or ISO 8601 time; omit = never.","type": "string"},"visibility": {- "description": "world (default): readable by every agent connected to this brain — required for the remote remember→recall round-trip. private: local CLI reads only.",+ "description": "world (default) or private (local CLI only).","enum": ["world","private"@@ -244,7 +244,7 @@}},{- "description": "MEMORY VERB (v1): inspect ONE known person/company/project card — zero LLM calls, sub-100ms. Resolution: alias > exact title > slug-suffix; ties break on most-recently-touched. NEVER errors on a miss: returns found:false plus near-miss suggestions with create_safety hints (exists | probable | unknown — whether writing a new page would duplicate). Routing: for facts/snippets retrieval use recall; for broad questions needing reasoning use synthesize (expensive).",+ "description": "MEMORY VERB (v1): one known person/company/project card, zero LLM. A miss returns found:false with near matches and create_safety, so you do not duplicate a page. Facts: recall.","name": "entity","parameters": {"name": "string"@@ -252,7 +252,7 @@"schema": {"properties": {"name": {- "description": "Free-text name, alias, or slug (e.g. \"Alice Example\", \"people/alice-example\").",+ "description": "Name, alias or slug (e.g. \"Alice Example\").","type": "string"}},@@ -263,7 +263,7 @@}},{- "description": "[EXPENSIVE / SLOW — makes LLM calls, seconds-to-minutes latency, costs money] MEMORY VERB (v1): answer a broad question using cross-page LLM reasoning with citations and gap analysis. Prefer recall (facts/snippets) or entity (one known card, zero LLM) for lookups — use synthesize only when the answer requires combining evidence across pages. Response carries a best-effort cost block (model, tokens, usd_estimate) plus compose-status fields (synthesis_status, pages_gathered, takes_gathered, warnings); when the LLM compose step fails but retrieval succeeded, `answer` degrades to an extractive digest of retrieved pages (synthesis_status: \"extractive_fallback\") instead of an error.",+ "description": "[EXPENSIVE / SLOW: LLM calls, costs money] MEMORY VERB (v1): answer a broad question across pages with citations. For lookups use recall or entity.","name": "synthesize","parameters": {"question": "string",@@ -273,15 +273,15 @@"schema": {"properties": {"question": {- "description": "The question to answer.",+ "description": "The question.","type": "string"},"since": {- "description": "Optional temporal window start (ISO 8601 date or datetime).",+ "description": "Window start (ISO 8601).","type": "string"},"until": {- "description": "Optional temporal window end (ISO 8601 date or datetime).",+ "description": "Window end (ISO 8601).","type": "string"}},@@ -292,7 +292,7 @@}},{- "description": "MEMORY VERB (v1): expire a remembered fact by id — the protocol delete verb. `id` is the opaque string id returned by remember and recall (facts[].fact_id) — never a page slug. Idempotent: forgetting an already-expired fact returns expired:false (success), unknown id returns a not_found error. The fact is expired (audit trail kept), not deleted.",+ "description": "MEMORY VERB (v1): expire a remembered fact by its fact_id (never a page slug). Idempotent; the audit trail is kept.","name": "forget","parameters": {"id": "string",@@ -302,15 +302,15 @@"schema": {"properties": {"id": {- "description": "Opaque fact id from remember/recall (facts[].fact_id). Never a page slug.",+ "description": "fact_id from remember or recall.","type": "string"},"reason": {- "description": "Optional reason, written to the fact's audit trail. Default: \"forgotten\".",+ "description": "Audit note (default \"forgotten\").","type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"}},@@ -321,7 +321,7 @@}},{- "description": "Read a page by slug (supports optional fuzzy matching). Slug aliases left by renames redirect to the canonical page in the source that owns the alias (archived sources excluded); a redirected read reports `resolved_slug`. To edit a page, pass include_content: true — the returned `content` field is the canonical full markdown (frontmatter + body + timeline sentinel); edit THAT and pass it back to put_page to round-trip losslessly. Reassembling compiled_truth/timeline by hand risks dropping sections. Soft-deleted pages are hidden by default; pass include_deleted: true to surface them with deleted_at populated (see v0.26.5 recovery window). `timeline` is only the markdown section after the timeline sentinel; entries written by add_timeline_entry or extraction live in timeline rows, which include_timeline_entries: true returns as `timeline_entries` (the same rows get_timeline returns).",+ "description": "Read a page by slug (fuzzy optional; renamed slugs redirect). To edit, pass include_content:true and send `content` to put_page, or use edit_page. Timeline rows need include_timeline_entries.","name": "get_page","parameters": {"fuzzy": "boolean?",@@ -334,27 +334,27 @@"schema": {"properties": {"fuzzy": {- "description": "Enable fuzzy slug resolution (default: false)",+ "description": "Fuzzy slug match.","type": "boolean"},"include_content": {- "description": "#2225: include the canonical serialized `content` field (frontmatter + body + timeline sentinel) for lossless get→edit→put_page round-trips. Default false — it roughly duplicates compiled_truth + timeline, so read-only callers should not pay for it.",+ "description": "Full markdown + revision, for editing.","type": "boolean"},"include_deleted": {- "description": "v0.26.5: surface soft-deleted pages with deleted_at populated (default: false). Used by restore workflows.",+ "description": "Include soft-deleted pages.","type": "boolean"},"include_timeline_entries": {- "description": "#5709: also return `timeline_entries`, the page's timeline rows (the same rows and filtering as get_timeline for this caller). Default false to keep the payload small.",+ "description": "Also return timeline rows.","type": "boolean"},"slug": {- "description": "Page slug",+ "description": "Page slug.","type": "string"},"source_id": {- "description": "#4329: scope the lookup to a single source (a multi-source brain can hold the same slug in several sources). Defaults to ctx.sourceId / the caller's grant. '__all__' spans every source for trusted local callers, your granted sources for remote callers.",+ "description": "One source, or '__all__'.","type": "string"}},@@ -365,7 +365,7 @@}},{- "description": "Replace a complete canonical Markdown page. Read get_page with include_content:true and pass its revision as expected_revision; force explicitly overwrites the current revision. Omitting both permits creation only. Retain a UUID request_id and repeat identical arguments after transport failure or a pending receipt. Content, tags, sanitized text projections, versions and the committed receipt publish together; embedding and optional Git effects have separate status. Remote callers preserve protected facts/takes fences; automatic graph links are skipped for untrusted writes. A stdio `gbrain serve` sweeps them at startup + on idle; `gbrain serve --http` does not self-sweep — run `gbrain sweep --once` or use trusted local capture/put_page for inline link extraction. Remote callers receive write_through.warning when no repo is configured. For file input use gbrain capture --file PATH --slug SLUG.",+ "description": "Replace a complete Markdown page: content REPLACES the whole page. Read get_page include_content:true; pass its revision as expected_revision (omit to create). Keep a request_id UUID; retry with identical arguments. Remote callers: graph links are skipped; a stdio `gbrain serve` sweeps them later, `gbrain serve --http` does not self-sweep. Small changes: edit_page.","name": "put_page","parameters": {"allow_empty": "boolean?",@@ -382,43 +382,43 @@"schema": {"properties": {"allow_empty": {- "description": "Allow overwriting an existing non-empty page with empty/whitespace-only content (default: false). Without it, put_page rejects the empty overwrite — the empty-stdin failure class.",+ "description": "Allow emptying a non-empty page.","type": "boolean"},"content": {- "description": "Complete markdown content with YAML frontmatter. REPLACES the entire page; this is not a partial edit. Read the canonical page first with `get_page include_content:true` before modifying it.",+ "description": "Complete markdown with frontmatter; read get_page include_content:true first.","type": "string"},"expected_revision": {- "description": "Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.",+ "description": "Revision read; omit to create.","type": "string"},"force": {- "description": "Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.",+ "description": "Ignore the revision.","type": "boolean"},"ingested_via": {- "description": "Richer label paired with source_kind. Remote callers: SERVER-STAMPED.",+ "description": "Server-stamped remotely.","type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {- "description": "Page slug",+ "description": "Page slug.","type": "string"},"source_id": {- "description": "Source to mutate. Defaults to the selected source. Remote callers may only use their current write source.",+ "description": "Write source.","type": "string"},"source_kind": {- "description": "Ingestion channel taxonomy (capture-cli | put_page | webhook | …). Remote callers: SERVER-STAMPED, client value ignored.",+ "description": "Server-stamped remotely.","type": "string"},"source_uri": {- "description": "Original URI/path/message-id the event carried. Remote callers: SERVER-STAMPED null.",+ "description": "Server-stamped remotely.","type": "string"}},@@ -443,11 +443,11 @@"schema": {"properties": {"expected_revision": {- "description": "Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.",+ "description": "Revision read; omit to create.","type": "string"},"force": {- "description": "Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.",+ "description": "Ignore the revision.","type": "boolean"},"purge": {@@ -455,7 +455,7 @@"type": "boolean"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {@@ -474,7 +474,7 @@}},{- "description": "List pages with optional filters. For 'what's recent / what did I touch this week' questions, use list_pages with sort=updated_desc instead of semantic search. Default 50 rows; remote callers are capped at 100 (local CLI callers' explicit limits are honored). A result with exactly `limit` rows may be truncated. For exhaustive listing, page with updated_after=<last row's updated_at_iso> + updated_after_slug=<last row's slug> until a page returns fewer rows than the limit (the keyset forces sort=updated_asc; a bare updated_after cursor skips rows sharing the cursor timestamp).",+ "description": "List pages with filters. For 'what's recent / what did I touch this week' use sort=updated_desc. Default 50 rows (remote max 100); a full page may be truncated: continue with updated_after + updated_after_slug from the last row.","name": "list_pages","parameters": {"include_deleted": "boolean?",@@ -490,19 +490,19 @@"schema": {"properties": {"include_deleted": {- "description": "v0.26.5: include soft-deleted pages (default: false). Used by restore workflows and operator diagnostics.",+ "description": "Include soft-deleted pages.","type": "boolean"},"limit": {- "description": "Max results (default 50; remote callers are capped at 100)",+ "description": "Max rows (default 50; remote max 100).","type": "number"},"offset": {- "description": "Skip first N rows (pagination). Engine-supported since PageFilters gained offset; previously accepted at the CLI and silently dropped.",+ "description": "Rows to skip.","type": "number"},"sort": {- "description": "Sort order. Default updated_desc (matches pre-v0.29). Options: updated_desc, updated_asc, created_desc, slug.",+ "description": "Default updated_desc.","enum": ["updated_desc","updated_asc",@@ -512,23 +512,23 @@"type": "string"},"source_id": {- "description": "v0.46.25: scope listing to a single source. Defaults to OperationContext.sourceId / federated scope. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources.",+ "description": "One source, or '__all__'.","type": "string"},"tag": {- "description": "Filter by tag",+ "description": "Tag.","type": "string"},"type": {- "description": "Filter by page type",+ "description": "Page type.","type": "string"},"updated_after": {- "description": "ISO date (YYYY-MM-DD) or full timestamp. Returns pages with updated_at > value. Bare (without updated_after_slug) this is LOSSY across rows sharing one timestamp — a bulk sync stamps one now() across a transaction; pair with updated_after_slug to page exactly.",+ "description": "Only pages updated after this ISO time.","type": "string"},"updated_after_slug": {- "description": "Keyset cursor slug: pass the last row's slug together with updated_after set to that row's updated_at_iso (column precision — a millisecond-rounded value re-selects same-millisecond rows). Resumes strictly after (updated_at, slug) and forces sort=updated_asc.",+ "description": "Last row's slug (with updated_after).","type": "string"}},@@ -549,15 +549,15 @@"schema": {"properties": {"expected_revision": {- "description": "Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.",+ "description": "Revision read; omit to create.","type": "string"},"force": {- "description": "Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.",+ "description": "Ignore the revision.","type": "boolean"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {@@ -593,7 +593,7 @@}},{- "description": "Capture a quick note into the brain — the \"just remember this\" write. Auto-derives a stable inbox/ slug from the content date + hash (recapturing identical text is idempotent), merges frontmatter, refuses binary/empty payloads, then delegates to put_page (inheriting its fences and provenance stamping). Prefer capture for quick notes and put_page when you need to control the slug, type, or an existing page's content. For structured facts about entities, prefer remember.",+ "description": "Quick note (\"just remember this\"): auto-slugged under inbox/ by date + content hash, so recapturing is idempotent. Use put_page to control slug or type; remember for facts about entities.","name": "capture","parameters": {"content": "string",@@ -613,55 +613,55 @@"schema": {"properties": {"content": {- "description": "Markdown or plain text to capture. File paths are NOT accepted over MCP — read the file yourself and pass its content (the CLI --file lane is local-only).",+ "description": "Markdown or text (not a file path).","type": "string"},"depth": {- "description": "For event captures, the depth page to link.",+ "description": "Event depth page to link.","type": "string"},"expected_revision": {- "description": "Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.",+ "description": "Revision read; omit to create.","type": "string"},"force": {- "description": "Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.",+ "description": "Ignore the revision.","type": "boolean"},"kind": {- "description": "For event captures, the event kind.",+ "description": "Event kind.","type": "string"},"local_file": {- "description": "Trusted local CLI only (--file): the absolute path of the captured file. Recorded as the page origin only when it lies inside the source and names the slug; the path itself is never stored. Remote callers are refused.",+ "description": "Local CLI only.","type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {- "description": "Target slug. Default: inbox/YYYY-MM-DD-<sha8-of-content> (stable per content — recapturing identical text hits the same slug); type diary/event routes under life/. Fenced clients: the default lands under your first bound prefix.",+ "description": "Default inbox/<date>-<hash>.","type": "string"},"source_id": {- "description": "Source to mutate. Defaults to the selected source. Remote callers may only use their current write source.",+ "description": "Write source.","type": "string"},"type": {- "description": "Page type for the stamped frontmatter. Omitted: the content's frontmatter `type:` when present, else 'note'. An explicit type (this param or a frontmatter `type:`) must be declared by the active schema pack; undeclared types are rejected before writing, naming the declared vocabulary.",+ "description": "Schema-pack page type (default note).","type": "string"},"what": {- "description": "For event captures, the event description.",+ "description": "Event.","type": "string"},"where": {- "description": "For event captures, the location.",+ "description": "Event place.","type": "string"},"who": {- "description": "For event captures, comma-separated entity slugs.",+ "description": "Event: comma-separated entity slugs.","type": "string"}},@@ -691,7 +691,7 @@}},{- "description": "Change part of an existing page without resending it: prefer this over put_page for small changes to large pages. Read get_page with include_content:true and pass its revision as expected_revision. Each edit replaces old_text with new_text; edits apply in order, each to the text the previous edit produced, and each old_text must match exactly once in that content. Protected takes and facts sections never match (use the takes_* operations or remember/forget). All edits publish together or none do, through the same receipts, fences and write-through as put_page. Returns the new revision and a unified diff of your view (at most 8 KB). Refusals name the edit: edit_no_match, edit_ambiguous_match (with match_count), edit_protected_span, edit_invalid; a stale revision returns revision_conflict with current_revision. Retain request_id and repeat identical arguments after a pending receipt.",+ "description": "Change part of a page: prefer this over put_page for small changes. expected_revision is the revision from get_page include_content:true. Each old_text must match exactly once; edits apply in order, all or none. Stale revision: revision_conflict.","name": "edit_page","parameters": {"edits": "array",@@ -703,16 +703,16 @@"schema": {"properties": {"edits": {- "description": "1 to 50 replacements, applied in order and all or nothing.",+ "description": "1 to 50 {old_text, new_text} replacements.","items": {"additionalProperties": false,"properties": {"new_text": {- "description": "Replacement text; empty deletes old_text.",+ "description": "Replacement; empty deletes.","type": "string"},"old_text": {- "description": "Exact existing text (including whitespace) to replace; must occur exactly once in the current content.",+ "description": "Exact text to replace (must occur once).","type": "string"}},@@ -725,19 +725,19 @@"type": "array"},"expected_revision": {- "description": "The `revision` from get_page include_content:true. The edit is refused if the page changed since.",+ "description": "revision from get_page include_content:true.","type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {- "description": "Slug of the existing page to edit.",+ "description": "Page slug.","type": "string"},"source_id": {- "description": "Source to mutate. Defaults to the selected source. Remote callers may only use their current write source.",+ "description": "Write source.","type": "string"}},@@ -750,7 +750,7 @@}},{- "description": "Read your durable write receipt by request_id. Requires write scope and this operation in the current grant. Foreign, missing, and no-longer-accessible requests return the same not_found error; private journal input and recovery bytes are never returned.",+ "description": "Read the receipt of your write by request_id (after write_pending or a lost reply).","name": "get_write_request","parameters": {"request_id": "string"@@ -758,7 +758,7 @@"schema": {"properties": {"request_id": {- "description": "The original request UUID. Only this principal’s currently authorized requests are accessible.",+ "description": "The UUID you sent with the write.","type": "string"}},@@ -769,7 +769,7 @@}},{- "description": "List your currently authorized write receipts in one source, newest first. Useful when an acknowledgment was lost. Results and pagination exclude other principals and inaccessible targets; no private payloads or cross-principal queue counts are exposed.",+ "description": "List your write receipts in one source, newest first.","name": "list_write_requests","parameters": {"before": "string?",@@ -779,16 +779,16 @@"schema": {"properties": {"before": {- "description": "Opaque next cursor from the previous response.",+ "description": "next cursor from the previous page.","type": "string"},"limit": {"default": 25,- "description": "Number of visible receipts, 1–100. Default 25.",+ "description": "1-100 (default 25).","type": "number"},"source_id": {- "description": "Source to inspect. Defaults to the caller’s resolved source.",+ "description": "Default: yours.","type": "string"}},@@ -797,7 +797,7 @@}},{- "description": "Cancel your accepted write before publication starts. Returns the actual receipt: running/recovering or already-terminal requests may remain unchanged. Cancellation cannot undo published bytes or a committed fact withdrawal.",+ "description": "Cancel your accepted write before it publishes. Returns the actual receipt.","name": "cancel_write_request","parameters": {"request_id": "string"@@ -805,7 +805,7 @@"schema": {"properties": {"request_id": {- "description": "The original request UUID. Only this principal’s currently authorized requests are accessible.",+ "description": "The UUID you sent with the write.","type": "string"}},@@ -816,7 +816,7 @@}},{- "description": "Cheap hybrid search (vector + keyword + RRF) with no LLM expansion. Best for exact known tokens, names, and structured-field lookups. A populated result set is NOT proof of coverage — for concept / synonym / landscape questions use `query` (adds multi-query expansion); for exhaustive enumeration use list_pages pagination. Pass `return_unit` ('window' / 'section' / 'page') for whole evidence instead of chunks; conversation pages already come back whole by default (return_unit 'auto'; 'chunk' opts out). For personal/emotional questions, prefer get_recent_salience or find_anomalies — they surface activity bursts without needing a search term. For code-symbol questions (callers, callees, definitions, blast radius), use code_callers / code_callees / code_def / code_refs instead — those return structural graph data, not text chunks. For agent memory reads (saved facts + budget-packed retrieval), prefer the `recall` verb.",+ "description": "Cheap hybrid search (vector + keyword), no LLM expansion, top 20: for exact tokens, names, field values. Results are NOT proof of coverage: concepts or landscape, use `query`; exhaustive lists, list_pages. return_unit returns whole sections or conversations. Personal questions: get_recent_salience; saved facts: recall. fields: \"full\" adds diagnostics.","name": "search","parameters": {"fields": "string?",@@ -836,7 +836,7 @@"schema": {"properties": {"fields": {- "description": "Row fields. Remote callers get 'lean' rows by default; 'full' adds every ranking diagnostic.",+ "description": "lean (remote default) or full.","enum": ["lean","full"@@ -844,23 +844,23 @@"type": "string"},"limit": {- "description": "Max results (default 20)",+ "description": "Max results (default 20).","type": "number"},"mode": {- "description": "Search mode (conservative|balanced|tokenmax). Local callers only.",+ "description": "Local callers only.","type": "string"},"offset": {- "description": "Skip first N results (for pagination)",+ "description": "Rows to skip.","type": "number"},"query": {- "description": "Search text. Exact tokens, names, and structured-field values work best here (e.g. 'acme-example series A'), since this op does no LLM expansion. This is the search text param — there is no `text` or `q` param.",+ "description": "Exact tokens or names, e.g. 'acme-example series A'.","type": "string"},"recency": {- "description": "Recency boost (per-prefix age decay, no mattering signal): 'off' | 'on' | 'strong'. Omit and gbrain auto-detects. Independent of `salience`. Ignored on the keyword-only opt-out path.",+ "description": "Boost recent pages (default: auto).","enum": ["off","on",@@ -869,7 +869,7 @@"type": "string"},"return_unit": {- "description": "Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').\n 'chunk' — the ranked chunk only (~300-450 tokens per result).\n 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).\n 'section' — the enclosing markdown section, or the conversation rounds around the hit.\n 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.\n 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.\nNon-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta.",+ "description": "chunk, window, section, page or auto (default; whole page for conversations).","enum": ["chunk","window",@@ -880,11 +880,11 @@"type": "string"},"return_window": {- "description": "Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1).",+ "description": "Neighbor chunks each side for window (1-3).","type": "number"},"salience": {- "description": "Salience boost (emotional_weight + take_count, no time component): 'off' | 'on' | 'strong'. Omit and gbrain auto-detects from query text. Independent of `recency`.",+ "description": "Boost emotional pages (default: auto).","enum": ["off","on",@@ -893,19 +893,19 @@"type": "string"},"snippet_chars": {- "description": "Cap each result's chunk_text at N characters (a \"… [truncated]\" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800)",+ "description": "Max chars per chunk_text (0 = full).","type": "number"},"source_id": {- "description": "Scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile); when unset, an unqualified read spans every federated source. Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources.",+ "description": "One source, or '__all__'.","type": "string"},"token_budget": {- "description": "Token budget for delivered evidence when return_unit is not 'chunk' (default search.return_budget_default = 6000; auto: search.return_budget_conversation = 24000). Ignored in chunk mode.",+ "description": "Evidence token budget (default 6000).","type": "number"},"types": {- "description": "Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters.",+ "description": "Page types, e.g. ['person'].","items": {"type": "string"},@@ -919,7 +919,7 @@}},{- "description": "Hybrid search with vector + keyword + multi-query expansion. Prefer `query` for concept / synonym / landscape questions ('all the X that do Y', 'the landscape of Z') — expansion recovers synonym- and outcome-phrased matches a single embedding misses. Still top-K, and the default count when `limit` is omitted depends on the configured search mode (10 conservative / 25 balanced / 50 tokenmax — see the `limit` param description); pass `limit` explicitly for a stable count regardless of mode. When the answer needs the surrounding conversation or section, pass `return_unit` ('page' / 'section' / 'window') to get that evidence in one call instead of get_page per hit; conversation pages already come back whole by default (return_unit 'auto'; 'chunk' opts out). For exhaustive enumeration use list_pages; for exact known tokens `search` is cheaper (no expansion LLM call). For personal/emotional questions ('what's going on with me', 'anything notable', 'how am I feeling'), prefer get_recent_salience, find_anomalies, or get_recent_transcripts. Semantic search returns polished pages and misses recent activity bursts. Do NOT assume words like 'crazy', 'notable', or 'big' mean impressive — they often mean difficult or emotionally charged.",+ "description": "Ranked hybrid search with multi-query expansion, for concept / synonym / landscape questions: expansion recovers synonym-phrased matches. Still top-K; return_unit returns whole sections or conversations. Lists: list_pages. Exact tokens: `search` is cheaper (no expansion LLM call). Personal questions: get_recent_salience, find_anomalies, get_recent_transcripts. Do NOT assume 'crazy' means impressive (often difficult or emotionally charged). fields: \"full\" adds diagnostics.","name": "query","parameters": {"adaptive_return": "boolean?",@@ -954,15 +954,15 @@"schema": {"properties": {"adaptive_return": {- "description": "v0.41.33 — return a TIGHT, intent-sized result set instead of the full top-K. YOU (the agent) set this per query to serve the user well:\n TRUE when the user's question has a small, specific answer — a lookup ('what is X', 'who is Y', 'what's my <thing>', 'what did Z decide'), a single-fact recall, or when you'll route the result into a precise downstream step (a classifier, a decision, an exact citation). The user gets the answer, not a wall of loosely-related pages, and you spend fewer tokens reading noise.\n Omit / FALSE for breadth — 'everything about X', 'list all', 'what do I know about Y', exploration, brainstorming, or any time you'd rather see more candidates and judge for yourself. Recall matters more there, so take the full top-K.\nSafe by construction: it NEVER returns empty when there are matches (you always get at least the top hit), and it only applies to the first page (omit when paginating). Caps come from config (search.adaptive_return_entity_max / _other_max; default 2 / 6) — pass `limit` 1 alongside this for a hard single-answer cap.",+ "description": "true when one specific answer is wanted (fewer rows; never returns empty); omit for breadth.","type": "boolean"},"autocut": {- "description": "v0.42.3.0 — autocut is the SMART DEFAULT (already ON when the reranker runs, which it does in the default search mode). It returns only the confident cluster by cutting where the relevance score drops off a cliff, so an obvious single answer comes back as 1 result and a genuine handful comes back as that handful — not a fixed wall of 20+.\n You almost never set this. Pass FALSE only to FORCE the full top-K when you deliberately want breadth — broad exploration, 'show me everything about X', enumeration where you'd rather over-collect and judge for yourself, or when you suspect the top hit is wrong and want to see the alternatives.\n TRUE is redundant in default mode (it's already on); it only matters to override a brain whose config turned autocut off.\nSafe by construction: never returns empty when there are matches, only applies to the first page (omit when paginating), and is a no-op when no reranker scored the results (so it can't cut on an untrustworthy signal). Distinct from `adaptive_return`: autocut cuts on the score cliff; adaptive_return caps by question intent. Leave both unset for the smart default.",+ "description": "Default on (never returns empty); false gives full top-K for breadth. Cuts at the score cliff, unlike adaptive_return.","type": "boolean"},"cross_modal": {- "description": "v0.36 cross-modal search routing.\n 'text' (default for non-image-intent queries) — text-only path, no behavior change vs v0.35.\n 'image' — route the query through Voyage multimodal-3 + the embedding_image column. Best for 'show me photos of...' phrasings.\n 'both' — run text AND image searches in parallel; merge via weighted RRF.\n 'auto' — same effect as omitting the field; intent classifier decides based on query phrasing.",+ "description": "Default auto.","enum": ["text","image",@@ -972,19 +972,19 @@"type": "string"},"detail": {- "description": "Result detail level: low (compiled truth only), medium (default, all with dedup), high (all chunks)",+ "description": "low (compiled truth only), medium (default) or high (all chunks).","type": "string"},"embedding_column": {- "description": "v0.36: route vector search through a non-default embedding column. Defaults to 'embedding' (the brain's primary column) unless `search_embedding_column` config sets a different default. Per-call override for A/B benchmarking across providers (e.g. 'embedding_voyage', 'embedding_openai'). Column MUST be declared in the `embedding_columns` config registry — unknown names throw with a paste-ready hint listing valid columns.",+ "description": "Registered embedding column.","type": "string"},"expand": {- "description": "Request multi-query expansion (default: true in every search mode, regardless of search.expansion). Set false to opt out. Requires configured embedding and expansion providers; a cloud expander receives the query and may charge for the call. Response metadata expansion_applied reports whether variants were actually used.",+ "description": "Default true; false skips the expansion LLM call.","type": "boolean"},"fields": {- "description": "Row fields. Remote callers get 'lean' rows by default; 'full' adds every ranking diagnostic.",+ "description": "lean (remote default) or full.","enum": ["lean","full"@@ -992,39 +992,39 @@"type": "string"},"image": {- "description": "Base64-encoded image bytes for image-similarity search (CLI: --image <path>).",+ "description": "Base64 image for image search.","type": "string"},"image_mime": {- "description": "MIME type for the image bytes (auto-derived from path on CLI; required when calling op directly).",+ "description": "MIME type of image.","type": "string"},"lang": {- "description": "Filter to chunks where content_chunks.language matches (e.g., typescript, python, ruby)",+ "description": "Code language.","type": "string"},"limit": {- "description": "Max results. Omitted or 0 resolves from the active search mode (10 conservative / 25 balanced / 50 tokenmax by default, or the configured `search.searchLimit` override) — for both text queries and image-similarity queries (`image` param).",+ "description": "Default 10/25/50 by search mode.","type": "number"},"mode": {- "description": "Search mode (conservative|balanced|tokenmax). Local callers only; remote uses configured mode.",+ "description": "Local callers only.","type": "string"},"near_symbol": {- "description": "Anchor retrieval at this qualified symbol name (e.g., BrainEngine.searchKeyword). Enables A2 two-pass.",+ "description": "Anchor code symbol.","type": "string"},"offset": {- "description": "Skip first N results (for pagination)",+ "description": "Rows to skip.","type": "number"},"query": {- "description": "Question or topic text for hybrid retrieval with expansion (e.g. 'agents that do web research'). This is the search text param — there is no `text` or `q` param. Optional ONLY because `image` is the alternative entry point; a call with neither fails with invalid_params.",+ "description": "Question or topic (required unless image).","type": "string"},"recency": {- "description": "v0.29.1 recency boost — per-prefix age decay, NO mattering signal.\n 'off' — default for canonical truth\n 'on' — daily/, media/x/, chat/ decay aggressively; concepts/, originals/, writing/ stay evergreen\n 'strong' — multiplies the recency factor by 1.5 (use for 'today' / 'right now')\nOmit and gbrain auto-detects. Independent of `salience` (orthogonal axes).",+ "description": "Boost recent pages (default: auto).","enum": ["off","on",@@ -1033,11 +1033,11 @@"type": "string"},"relational": {- "description": "v0.43 — relational recall arm. SMART DEFAULT (on in balanced/tokenmax). When the question is about a RELATIONSHIP ('who invested in widget-co', 'who introduced me to alice', 'what connects fund-a and fund-b'), the brain resolves the named entity and walks its typed-edge graph (invested_in, works_at, founded, …), surfacing the answer even when no passage mentions both sides. Pure no-op for non-relational questions. Pass FALSE to force lexical/vector-only retrieval (e.g. debugging why a graph answer appeared). You almost never set this.",+ "description": "Relationship-graph arm (default on).","type": "boolean"},"return_unit": {- "description": "Evidence unit returned in each result's chunk_text (default: config search.return_unit, which defaults to 'auto').\n 'chunk' — the ranked chunk only (~300-450 tokens per result).\n 'window' — the hit chunk plus return_window neighbor chunks each side (local context, ~3x chunk).\n 'section' — the enclosing markdown section, or the conversation rounds around the hit.\n 'page' — the whole page/session, capped. Use for multi-session or temporal questions where the answer needs the whole conversation.\n 'auto' — the whole page for conversation pages (conversation/transcript/chat/meeting/slack/imessage types, chat/ or conversations/ slugs), the ranked chunk unchanged for everything else. When no hit is a conversation the response is exactly the chunk response.\nNon-chunk units return one result per page, packed into token_budget (default 6000, auto 24000; remote max 32000), with a `delivered` object (unit, chunk_ids, match_spans, tokens, truncated; reason under auto) per result and `delivery` in the response meta.",+ "description": "chunk, window, section, page or auto (default; whole page for conversations).","enum": ["chunk","window",@@ -1048,11 +1048,11 @@"type": "string"},"return_window": {- "description": "Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1).",+ "description": "Neighbor chunks each side for window (1-3).","type": "number"},"salience": {- "description": "v0.29.1 salience boost — emotional_weight + take_count, NO time component.\n 'off' — default for entity / canonical / definitional queries\n 'on' — surface emotionally-weighted + take-rich pages\n 'strong' — aggressive mattering tilt\nOmit and gbrain auto-detects from query text. Independent of `recency`.",+ "description": "Boost emotional pages (default: auto).","enum": ["off","on",@@ -1061,38 +1061,38 @@"type": "string"},"since": {- "description": "v0.29.1 — filter to pages whose effective_date is >= this. ISO-8601 (YYYY-MM-DD or full timestamp) OR relative ('7d', '2w', '1y'). Replaces deprecated `afterDate`.",+ "description": "On/after: YYYY-MM-DD or 7d/2w/1y.","type": "string"},"snippet_chars": {- "description": "Cap each result's chunk_text at N characters (a \"… [truncated]\" marker names the get_page recovery move). 0 forces full text. Unset: subagent tool loops default to the agent.search_snippet_chars config (300; 0=full); every other caller gets full text. (#3800)",+ "description": "Max chars per chunk_text (0 = full).","type": "number"},"source_id": {- "description": "v0.34: scope search to a single source. Defaults to OperationContext.sourceId (set from CLI --source / GBRAIN_SOURCE / .gbrain-source dotfile). Pass '__all__' to span every source for trusted local callers. For remote callers, '__all__' uses the same scope as omission: an OAuth grant when present, otherwise the transport-computed federated sources for grantless local stdio.",+ "description": "One source, or '__all__'.","type": "string"},"symbol_kind": {- "description": "Filter to chunks where content_chunks.symbol_type matches (e.g., function, class, method, type, interface)",+ "description": "Code symbol type.","type": "string"},"token_budget": {- "description": "Token budget. Chunk mode, and whenever return_unit is omitted: caps the cumulative chunk payload (results that would overflow are skipped). Explicit non-chunk return_unit: the budget for delivered evidence (default search.return_budget_default = 6000, auto 24000; remote max search.return_budget_max_remote = 32000).",+ "description": "Token cap on the returned evidence.","type": "number"},"types": {- "description": "Filter results to pages whose `type` is in this list (e.g. ['person','company']). CLI: --types person,company. Applied at SQL level on every retrieval leg — the same filter `whoknows` uses. Stacks with all other filters.",+ "description": "Page types, e.g. ['person'].","items": {"type": "string"},"type": "array"},"until": {- "description": "v0.29.1 — filter to effective_date <= this. Same format as `since`. Replaces deprecated `beforeDate`. YYYY-MM-DD lands at end-of-day.",+ "description": "On/before.","type": "string"},"walk_depth": {- "description": "Structural walk depth 1-2. Default 0 (off). Expands anchors through code_edges with 1/(1+hop) decay.",+ "description": "Code walk depth 1-2.","type": "number"}},@@ -1140,7 +1140,7 @@"type": "string"},"return_window": {- "description": "Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1).",+ "description": "Neighbor chunks each side for window (1-3).","type": "number"},"token_budget": {@@ -1264,7 +1264,7 @@"schema": {"properties": {"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {@@ -1294,7 +1294,7 @@"schema": {"properties": {"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {@@ -1418,7 +1418,7 @@"schema": {"properties": {"all_sources": {- "description": "Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely.",+ "description": "Same as source_id __all__.","type": "boolean"},"slug": {@@ -1426,7 +1426,7 @@"type": "string"},"source_id": {- "description": "Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers.",+ "description": "One source, or '__all__'.","type": "string"}},@@ -1437,7 +1437,7 @@}},{- "description": "List incoming links to a page",+ "description": "List links pointing to a page.","name": "get_backlinks","parameters": {"all_sources": "boolean?",@@ -1447,15 +1447,15 @@"schema": {"properties": {"all_sources": {- "description": "Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely.",+ "description": "Same as source_id __all__.","type": "boolean"},"slug": {- "description": "Slug of the page whose incoming links to list.",+ "description": "Page slug.","type": "string"},"source_id": {- "description": "Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers.",+ "description": "One source, or '__all__'.","type": "string"}},@@ -1466,7 +1466,7 @@}},{- "description": "List distinct link_source provenances in the brain with edge counts (e.g. citation-graph, manual, markdown)",+ "description": "Link provenances in the brain (e.g. markdown, manual) with edge counts.","name": "list_link_sources","parameters": {},"schema": {@@ -1476,7 +1476,7 @@}},{- "description": "Traverse link graph from a page. Remote callers default to bidirectional edges (GraphPath[]) at depth 2 (pass depth explicitly for deeper walks); trusted local no-filter callers keep the legacy node shape at depth 5.",+ "description": "Walk the link graph from a page. Remote callers get bidirectional paths at depth 2 by default.","name": "traverse_graph","parameters": {"all_sources": "boolean?",@@ -1489,15 +1489,15 @@"schema": {"properties": {"all_sources": {- "description": "Span sources (equivalent to source_id=__all__): every source locally, only your readable sources remotely.",+ "description": "Same as source_id __all__.","type": "boolean"},"depth": {- "description": "Max traversal depth (capped at 10). Default 5, except a remote call that lets direction default to 'both' uses 2 (bidirectional path enumeration is combinatorial on hubs); an explicit depth is always honored up to the cap.",+ "description": "Max depth (cap 10).","type": "number"},"direction": {- "description": "Traversal direction ('in', 'out', or 'both'). Remote callers default to 'both'; trusted local no-filter callers keep the legacy outgoing-node output.",+ "description": "Remote default both.","enum": ["in","out",@@ -1506,15 +1506,15 @@"type": "string"},"link_type": {- "description": "Filter to one link type (per-edge filter, traversal only follows matching edges)",+ "description": "Follow only this link type.","type": "string"},"slug": {- "description": "Slug of the page to start the traversal from, e.g. 'people/alice-example'. This is the start-node param — there is no `start` or `root` param.",+ "description": "Start page slug.","type": "string"},"source_id": {- "description": "Scope the read to one source (a multi-source brain can hold the same slug in several sources). Omitted: your granted sources remotely (a connection with no grant reads every federated source); locally, the resolved source, or every federated source when no --source / GBRAIN_SOURCE / .gbrain-source pinned it. '__all__' spans every source for trusted local callers and only your readable sources for remote callers.",+ "description": "One source, or '__all__'.","type": "string"}},@@ -1525,7 +1525,7 @@}},{- "description": "Append an entry to the canonical Markdown timeline and structured timeline store in one committed write. Exact replay changes neither store.",+ "description": "Append a dated entry to a page timeline. Replaying the same entry changes nothing.","name": "add_timeline_entry","parameters": {"date": "string",@@ -1538,27 +1538,27 @@"schema": {"properties": {"date": {- "description": "Entry date, strict YYYY-MM-DD (e.g. '2026-04-03'). Timestamps and non-calendar dates are rejected.",+ "description": "YYYY-MM-DD.","type": "string"},"detail": {- "description": "Longer free-text detail behind the summary.",+ "description": "Longer text.","type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {- "description": "Slug of the page whose timeline to append to.",+ "description": "Page slug.","type": "string"},"source": {- "description": "Provenance ref for the entry, e.g. a meeting slug like 'meetings/2026-04-03' or a URL.",+ "description": "Provenance slug or URL.","type": "string"},"summary": {- "description": "One-line summary of what happened on that date.",+ "description": "One line.","type": "string"}},@@ -1677,15 +1677,15 @@"schema": {"properties": {"expected_revision": {- "description": "Revision returned by the page read. Required when replacing an existing page unless force is true. Omit both for create-only writes.",+ "description": "Revision read; omit to create.","type": "string"},"force": {- "description": "Explicitly overwrite the current revision. Mutually exclusive with expected_revision; does not bypass authorization or the empty-content guard.",+ "description": "Ignore the revision.","type": "boolean"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"slug": {@@ -1693,7 +1693,7 @@"type": "string"},"source_id": {- "description": "Source to mutate. Defaults to the selected source. Remote callers may only use their current write source.",+ "description": "Write source.","type": "string"},"version_id": {@@ -1785,7 +1785,7 @@}},{- "description": "List the skills this agent's brain publishes. A skill is a named prose instruction set (NOT executable code) that teaches you how to do a task using this server's other tools. Returns a flat catalog — each entry has a name, one-line description, triggers (phrasings that should invoke it), and `usable_tools` / `unavailable_tools` (which tools the skill calls that you CAN vs CANNOT call given this server + your access). To actually use a skill, call get_skill with its name, read the returned prose, and follow it — calling the correspondingly-named tools on THIS server. The response also carries an `instructions` envelope explaining this protocol. On a shared brain, use schema_version:2 for source-qualified identities, immutable revisions, pagination and complete declared requirements. Only authorized sources and owner-approved file classes are visible; pre-migration servers retain their legacy prose catalog. Read-scope; published only when the brain owner enabled mcp.publish_skills.",+ "description": "Skills: prose instruction sets (NOT executable code) for tasks with this server's tools, with triggers, usable_tools and unavailable_tools. Use one via get_skill.","name": "list_skills","parameters": {"cursor": "string?",@@ -1797,23 +1797,23 @@"schema": {"properties": {"cursor": {- "description": "Version 2 opaque snapshot cursor.",+ "description": "Version 2 cursor.","type": "string"},"limit": {- "description": "Version 2 page size, 1-100.",+ "description": "Version 2 page size (1-100).","type": "number"},"schema_version": {- "description": "Request 2 for the canonical source-qualified sealed catalog; omitted preserves version 1.",+ "description": "2 for the source-qualified catalog.","type": "number"},"section": {- "description": "Optional: only skills whose routing section matches this exactly.",+ "description": "Only this routing section.","type": "string"},"source_id": {- "description": "Narrow version 2 enumeration to one permitted source.",+ "description": "Version 2: one source.","type": "string"}},@@ -1822,7 +1822,7 @@}},{- "description": "Fetch one skill's full instructions by name. Returns `{name, frontmatter (sanitized), body, usable_tools, unavailable_tools, client_guidance}`. The `body` is prose — read it as your operating instructions for this task, and when it says to search / store / look something up, call the same-named MCP tool on THIS server. There is nothing to 'execute' — the value is the instructions plus your tool calls back to this server. Tools listed in `unavailable_tools` won't work for you (not exposed here, or beyond your access) — adapt accordingly. Size-capped; read-scope; requires the owner to have enabled mcp.publish_skills. On a shared brain, pass schema_version:2 with qualified_id and revision from discovery to fetch exact instructions and their approved dependency manifest. get_skill_asset retrieves declared files from that revision as data; downloading never grants execution or tool permissions.",+ "description": "Fetch a skill's prose and follow it: when it says search or store, call the same-named MCP tool here. There is nothing to execute. unavailable_tools won't work for you.","name": "get_skill","parameters": {"expected_brain_id": "string?",@@ -1837,35 +1837,35 @@"schema": {"properties": {"expected_brain_id": {- "description": "Assert the connected persistent brain identity from version 2 discovery. This never routes to another brain.",+ "description": "Version 2 brain id to assert.","type": "string"},"name": {- "description": "Skill name exactly as returned by list_skills (or the brain-pack skill slug when source_id is set).",+ "description": "Skill name from list_skills.","type": "string"},"pack_id": {- "description": "Canonical pack identifier.",+ "description": "Pack id.","type": "string"},"qualified_id": {- "description": "Exact version 2 qualified skill identity.",+ "description": "Version 2 skill id.","type": "string"},"revision": {- "description": "Exact immutable revision, or omit for the current head.",+ "description": "Exact revision (default: head).","type": "string"},"schema_version": {- "description": "Request 2 for an immutable canonical revision.",+ "description": "2 for an exact canonical revision.","type": "number"},"source_id": {- "description": "Optional: fetch a brain-resident pack skill from this source instead of the host catalog. Disambiguates a slug that exists on more than one source (see list_brain_skillpack).",+ "description": "Fetch a brain-resident pack skill from this source.","type": "string"},"source_incarnation": {- "description": "Source incarnation from version 2 discovery.",+ "description": "From discovery.","type": "string"}},@@ -1874,7 +1874,7 @@}},{- "description": "List brain-resident skillpacks this brain ships (per-source). Returns each pack's skills, one-line descriptions, the schema pack it targets + whether that matches this brain, and a git scaffold spec. Read-only; gated by mcp.publish_skills. After orienting, call this and ask the user whether to install any pack the brain offers (gbrain skillpack scaffold <spec>).",+ "description": "Skillpacks this brain ships, with skills and a scaffold spec to offer the user.","name": "list_brain_skillpack","parameters": {},"schema": {@@ -1904,7 +1904,7 @@}},{- "description": "Read a bounded, owner-approved file from an exact sealed skill revision. Does not execute downloaded bytes.",+ "description": "Read an approved file from an exact skill revision (data only; never executed).","name": "get_skill_asset","parameters": {"expected_brain_id": "string?",@@ -1919,27 +1919,27 @@"schema": {"properties": {"expected_brain_id": {- "description": "Assert this connected persistent brain identity without routing to another brain.",+ "description": "Brain id to assert.","type": "string"},"name": {- "description": "Skill name when not selecting by qualified_id.",+ "description": "Skill name.","type": "string"},"pack_id": {- "description": "Pack identifier when not selecting by qualified_id.",+ "description": "Pack id.","type": "string"},"path": {- "description": "Exact path in the approved revision file manifest.",+ "description": "Path in that revision manifest.","type": "string"},"qualified_id": {- "description": "Qualified skill key from version 2 discovery.",+ "description": "Version 2 skill id.","type": "string"},"revision": {- "description": "Immutable revision from get_skill.",+ "description": "Revision from get_skill.","type": "string"},"source_id": {@@ -1947,7 +1947,7 @@"type": "string"},"source_incarnation": {- "description": "Expected source incarnation from the qualified catalog.",+ "description": "From the qualified catalog.","type": "string"}},@@ -2019,7 +2019,7 @@"type": "string"},"source_incarnation": {- "description": "Expected source incarnation from the qualified catalog.",+ "description": "From the qualified catalog.","type": "string"},"triggers": {@@ -2073,7 +2073,7 @@"type": "string"},"source_incarnation": {- "description": "Expected source incarnation from the qualified catalog.",+ "description": "From the qualified catalog.","type": "string"}},@@ -2281,7 +2281,7 @@"type": "string"},"source_incarnation": {- "description": "Expected source incarnation from the qualified catalog.",+ "description": "From the qualified catalog.","type": "string"},"triggers": {@@ -2480,7 +2480,7 @@}},{- "description": "Fuzzy-resolve a partial slug to matching page slugs",+ "description": "Fuzzy-match a partial slug or title to page slugs.","name": "resolve_slugs","parameters": {"partial": "string",@@ -2489,11 +2489,11 @@"schema": {"properties": {"partial": {- "description": "Partial slug or title text to match, e.g. 'alice-ex' or 'meeting notes'. This is the search text param — there is no `text` param.",+ "description": "Partial slug or title, e.g. 'alice-ex'.","type": "string"},"source_id": {- "description": "Scope resolution to a single source. Defaults to OperationContext.sourceId; when unset, an unqualified resolve spans every federated source (matching search/get_page). Pass '__all__' to span every source for trusted local callers; for remote callers '__all__' spans only your granted sources.",+ "description": "One source, or '__all__'.","type": "string"}},@@ -2563,7 +2563,7 @@}},{- "description": "Get recent ingestion log entries",+ "description": "Recent ingestion log entries.","name": "get_ingest_log","parameters": {"limit": "number?"@@ -2571,7 +2571,7 @@"schema": {"properties": {"limit": {- "description": "Max entries (default 20)",+ "description": "Default 20.","type": "number"}},@@ -2761,7 +2761,7 @@}},{- "description": "Cancel a waiting, active, or delayed job. Agent-scoped tokens (no admin) can cancel only jobs they own.",+ "description": "Cancel a waiting, active or delayed job you may manage.","name": "cancel_job","parameters": {"id": "number"@@ -2769,7 +2769,7 @@"schema": {"properties": {"id": {- "description": "Job ID",+ "description": "Job id.","type": "number"}},@@ -2910,7 +2910,7 @@}},{- "description": "Submit an LLM agent job that the worker dispatches via the gateway-native tool loop. Requires the `agent` OAuth scope. Tools, source, slug prefixes, max concurrency, and daily budget are bound at OAuth client registration time.",+ "description": "Submit an agent job (agent scope; tools and budget bound to your client). Poll get_agent_job.","name": "submit_agent","parameters": {"allowed_slug_prefixes": "array?",@@ -2923,33 +2923,33 @@"schema": {"properties": {"allowed_slug_prefixes": {- "description": "Subset of delegated_slug_prefixes for writes; omit for a job-owned namespace",+ "description": "Subset of your write prefixes.","items": {"type": "string"},"type": "array"},"allowed_tools": {- "description": "Subset of bound_tools the agent may invoke",+ "description": "Subset of your bound tools.","items": {"type": "string"},"type": "array"},"max_turns": {- "description": "Max LLM turns (default 20, hard cap 100)",+ "description": "Default 20, max 100.","type": "number"},"model": {- "description": "provider:model string (defaults to models.tier.subagent)",+ "description": "provider:model (default: subagent tier).","type": "string"},"prompt": {- "description": "User prompt for the agent",+ "description": "Task prompt.","type": "string"},"queue": {- "description": "Queue name (default \"default\")",+ "description": "Default \"default\".","type": "string"}},@@ -2960,7 +2960,7 @@}},{- "description": "Poll an agent job submitted via submit_agent. Returns a trimmed status view (id, status, timestamps, error_text, result) plus queue_position (waiting jobs ahead in claim order; 0 = next) while the job is still waiting. Requires the `agent` OAuth scope; only jobs owned by the calling client are visible.",+ "description": "Poll a submit_agent job: status, result, queue_position.","name": "get_agent_job","parameters": {"id": "number"@@ -2968,7 +2968,7 @@"schema": {"properties": {"id": {- "description": "Job id returned by submit_agent",+ "description": "Job id.","type": "number"}},@@ -3282,7 +3282,7 @@"type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"since": {@@ -3330,7 +3330,7 @@"type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"row_num": {@@ -3396,7 +3396,7 @@"type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"resolved_by": {@@ -3468,7 +3468,7 @@"type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"},"row_num": {@@ -3501,7 +3501,7 @@}},{- "description": "Introspect the calling identity. Returns one of three transport shapes: {transport: \"oauth\", client_id, client_name, scopes, expires_at, source_id, federated_read}, {transport: \"legacy\", token_name, scopes, expires_at: null}, or {transport: \"local\", scopes: []}, or {transport: \"stdio\", scopes: []} for the auth-less stdio MCP pipe. Throws unknown_transport when the context is ambiguous (remote=true without auth and no transport marker) — fail-closed posture mirroring the v0.26.9 trust-boundary contract.",+ "description": "Your identity: transport, scopes and, over OAuth, client, source_id and federated_read.","name": "whoami","parameters": {},"schema": {@@ -3665,7 +3665,7 @@}},{- "description": "Discover this brain's tool catalog and optionally unlock a wider tool surface for your client. No arguments → the catalog visible to YOUR credentials, grouped by area (tool names + one-line summaries). {tools: [\"name\", ...]} → full read-only schemas for the visible subset of those names (unknown/hidden names are silently omitted). {surface: \"verbs\"|\"starter\"|\"full\"} → persist that tool surface for this client (bounded by the server ceiling; denied when an operator pinned the surface; ~5 changes/hour), then re-issue tools/list to see the new catalog.",+ "description": "More tools: no arguments lists your catalog; {tools: [names]} returns schemas; {surface} persists a wider surface for your OAuth client.","name": "request_tools","parameters": {"surface": "string?",@@ -3674,7 +3674,7 @@"schema": {"properties": {"surface": {- "description": "Persist this tool surface for your client. Must not exceed the server ceiling; ignored surfaces stay available via no-arg discovery. Takes effect on your next tools/list.",+ "description": "Surface to persist for your client.","enum": ["verbs","starter",@@ -3683,7 +3683,7 @@"type": "string"},"tools": {- "description": "Fetch full read-only tool schemas for these names. Names outside your visible surface are silently omitted (D5).",+ "description": "Tool names to fetch schemas for.","items": {"description": "A tool name from the catalog.","type": "string"@@ -3696,7 +3696,7 @@}},{- "description": "Returns readable pages recently touched and ranked by activity salience and recency. Unrestricted local reads include deterministic 0..1 emotional_weight, take density, and recency decay. Holder-restricted reads count only permitted active takes, use zero emotional_weight, and select recent pages by updated_at; unrestricted local reads retain take-driven touches. Use this when the user asks what's been going on, what's notable, what's hot, anything crazy happening, or for any open-ended 'current state' question about themselves or their work. Do NOT run a semantic search for these — salience surfaces what's unusual without needing a search term.",+ "description": "Recently touched pages ranked by salience. Use this when the user asks what's been going on, what's notable, anything crazy happening. Do NOT run a semantic search for these.","name": "get_recent_salience","parameters": {"days": "number?",@@ -3707,15 +3707,15 @@"schema": {"properties": {"days": {- "description": "Window in days. Default 14.",+ "description": "Window in days (default 14).","type": "number"},"limit": {- "description": "Max results (default 20, capped at 100).",+ "description": "Max results (default 20).","type": "number"},"recency_bias": {- "description": "v0.29.1: how to weight recency in the salience score.\n 'flat' (DEFAULT) — v0.29.0 behavior. Every page gets 1/(1+days_old).\n Stable, predictable; what most callers want.\n 'on' — Per-prefix decay map. concepts/originals/writing/\n become evergreen (recency component = 0); daily/,\n media/x/, chat/ decay aggressively. Use when the\n user explicitly biases for recency-aware salience\n ('what's been salient lately' vs 'what matters\n in this brain regardless of when').",+ "description": "flat (default) or on (per-prefix decay).","enum": ["flat","on"@@ -3723,7 +3723,7 @@"type": "string"},"slugPrefix": {- "description": "Optional slug-prefix filter, e.g. 'personal' or 'wiki/people'.",+ "description": "Slug prefix, e.g. 'wiki/people'.","type": "string"}},@@ -3732,7 +3732,7 @@}},{- "description": "Returns statistical anomalies in recent page activity, grouped by cohort (tag or type). Use this for questions about what stood out, what's unusual, or what changed recently. Returns explanatory cohorts (e.g. '15 pages tagged wedding touched on 2026-04-28, baseline 0.3/day') so you can speak about patterns the user wouldn't have searched for. Cohort kinds: tag, type. Year cohort is deferred to a later release.",+ "description": "Anomalies in recent page activity, grouped by cohort (tag or type) against a baseline. Use for what stood out, what's unusual or changed. Cohort kinds: tag, type.","name": "find_anomalies","parameters": {"lookback_days": "number?",@@ -3742,15 +3742,15 @@"schema": {"properties": {"lookback_days": {- "description": "Days of history for the baseline. Default 30.",+ "description": "Baseline days (default 30).","type": "number"},"sigma": {- "description": "Sigma threshold. Default 3.0.",+ "description": "Threshold (default 3).","type": "number"},"since": {- "description": "ISO date YYYY-MM-DD. Default = today (UTC).",+ "description": "YYYY-MM-DD (default today).","type": "string"}},@@ -4371,7 +4371,7 @@"type": "boolean"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID. Managed extraction returns durable receipts; when omitted, each call gets a new UUID. Unmanaged extraction retains its legacy non-journaled behavior.",+ "description": "UUID; retry with it on timeout. Managed extraction returns durable receipts; when omitted, each call gets a new UUID. Unmanaged extraction retains its legacy non-journaled behavior.","type": "string"},"session_id": {@@ -4402,7 +4402,7 @@}},{- "description": "MEMORY VERB (v1): retrieve saved facts/snippets — the protocol read verb. Filters hot-memory facts by entity / since / session_id; pass `query` to ALSO run hybrid search over pages (results[] arm); pass `budget_tokens` for server-side packing (response reports budget_used + dropped_count — never trims client-side). Remote callers see visibility=world facts only. Routing: for ONE known person/company/project card use `entity` (zero LLM); for broad questions needing reasoning use `synthesize` (expensive). Branch on structured fields (status/kind/evidence), never on prose. Every response carries protocol_version.",+ "description": "MEMORY VERB (v1): read saved facts by entity, since or session_id; `query` also searches pages. Remote callers see world facts only. One card: entity; reasoning: synthesize.","name": "recall","parameters": {"budget_policy": "string?",@@ -4423,7 +4423,7 @@"schema": {"properties": {"budget_policy": {- "description": "Optional packing order. facts_first preserves legacy behavior (default). query_first packs the ranked page prefix before facts only with a nonblank query and positive finite budget; a positive budget below one token keeps neither arm. No query or inactive budget preserves legacy behavior. Neither policy skips oversized items or truncates. Supplying this option adds budget_packing accounting. Keep fact-focused/entity-filtered questions on facts_first.",+ "description": "facts_first (default) or query_first.","enum": ["facts_first","query_first"@@ -4431,35 +4431,35 @@"type": "string"},"budget_tokens": {- "description": "MEMORY_VERBS v1: server-side token budget (char/4 estimate). Facts pack first, then results. Response adds budget_tokens, budget_used, dropped_count.",+ "description": "Token budget; facts pack first.","type": "number"},"entity": {- "description": "Entity slug (canonical). Returns facts about this entity newest first, each labelled with its source_id. Across several granted sources, same-slug entities that no entity-identity group links are different entities: facts comes back empty and ambiguous_entity names each (source_id, entity_slug); pass source_id to read one.",+ "description": "Entity slug; facts about it, newest first.","type": "string"},"grep": {- "description": "Substring filter on fact text (case-insensitive). Applied in SQL before the limit, so matches on high-cardinality entities are found even outside the newest-N window.",+ "description": "Substring of the fact text.","type": "string"},"include_expired": {- "description": "When true, include expired_at IS NOT NULL rows. Default false.",+ "description": "Include expired facts.","type": "boolean"},"include_pending": {- "description": "v0.32: when true, response includes pending_consolidation_count (facts not yet promoted to takes by the dream-cycle consolidate phase). One round trip; backward-compatible (field omitted when false).",+ "description": "Add pending count.","type": "boolean"},"limit": {- "description": "Per-arm cap: max fact rows AND max search results. Default 50, cap 100.",+ "description": "Per-arm max (default 50, cap 100).","type": "number"},"query": {- "description": "MEMORY_VERBS v1: free-text retrieval over pages (hybrid search arm). Response adds results[] (slug, title, chunk, evidence, create_safety, provenance). Combinable with entity (both arms run). Degrades to keyword-only search when no embedding provider is configured (search_degraded notes it; never an error).",+ "description": "Also search pages (results[] arm).","type": "string"},"return_unit": {- "description": "Evidence unit for the results[] arm (needs `query`; default config search.return_unit = 'auto'). 'window' adds neighbor chunks, 'section' the enclosing section or conversation rounds, 'page' the whole page/session (best for multi-session questions), 'auto' the whole page for conversation pages and the ranked chunk unchanged for everything else (budget_tokens or budget_policy without return_unit keeps chunk packing). Non-chunk units return one result per page with `delivered` metadata and a top-level `delivery` block; the evidence is budgeted by budget_tokens (default 6000, auto 24000) and then packed by recall's usual rules.",+ "description": "Evidence unit for results[] (see search).","enum": ["chunk","window",@@ -4470,23 +4470,23 @@"type": "string"},"return_window": {- "description": "Neighbor chunks on each side for return_unit 'window' (integer 1-3, default 1).",+ "description": "Window size 1-3.","type": "number"},"session_id": {- "description": "Source session id (e.g. topic-A). Returns facts captured in that session.",+ "description": "Facts captured in this session.","type": "string"},"since": {- "description": "ISO 8601 datetime or duration shorthand (e.g. \"8 hours ago\"). Filters the FACTS arm only, on event time (valid_from, falling back to created_at); composes with `entity` and `session_id`. An unparseable value is rejected (invalid_params).",+ "description": "Facts since (ISO 8601 or \"8 hours ago\").","type": "string"},"source_id": {- "description": "Optional concrete source id for both facts and page results. Narrows the caller’s authorized scope, including an explicit default; a denied, missing, or archived source fails rather than widening. Omit to preserve the existing context/grant scope.",+ "description": "Narrow to one source you may read.","type": "string"},"supersessions": {- "description": "When true, return only the supersession audit log (facts with superseded_by set), newest first by COALESCE(expired_at, valid_until).",+ "description": "Only the supersession audit log.","type": "boolean"}},@@ -4495,7 +4495,7 @@}},{- "description": "MEMORY VERB (v1): budget-packed session-boundary bundle for a set of standing entities — entity cards + open threads + hot facts, zero-LLM, sub-second. Call at session start (warm cold context) and after compaction (rehydrate what the summary lost). WORLD-ONLY by default; pass include_private (honored for LOCAL trusted callers only) to widen all arms. budget_tokens packs server-side (response reports budget_used + dropped_count; cards pack first, then facts). Branch on structured fields, never prose. protocol_version rides every response.",+ "description": "MEMORY VERB (v1): budget-packed cards, open threads and hot facts for up to 8 entities, zero LLM. Call at session start and after compaction.","name": "context_pack","parameters": {"budget_tokens": "number?",@@ -4507,23 +4507,23 @@"schema": {"properties": {"budget_tokens": {- "description": "Server-side token budget (char/4). Cards pack first, then facts; each item costs its rendered line and the envelope + section headers are reserved, so `text` fits the budget. Response adds budget_tokens, budget_used (tokens of `text`), dropped_count.",+ "description": "Token budget; cards pack first.","type": "number"},"entities": {- "description": "Comma-separated entity names/slugs to bundle. Capped at 8.",+ "description": "Comma-separated names or slugs (max 8).","type": "string"},"include_private": {- "description": "Local trusted callers only: widen ALL arms to include private facts. Ignored (world-only) for remote callers. Default false.",+ "description": "Local trusted callers only.","type": "boolean"},"session_id": {- "description": "Opaque session id; keys the hot-memory cache and (on the push path) the session cursor.",+ "description": "Opaque session id.","type": "string"},"since": {- "description": "ISO 8601 datetime. When set, open-thread events are filtered to those after this cursor.",+ "description": "Only open-thread events after this ISO time.","type": "string"}},@@ -4534,7 +4534,7 @@}},{- "description": "MEMORY VERB (v1): \"what changed since T\" for heartbeats — pages updated after `since` + hot facts newer than `since` + open-thread events after `since`, zero-LLM. Lets a periodic wake maintain warm state in O(changes) instead of re-deriving. Optionally scope thread deltas to `entities`. WORLD-ONLY by default; include_private honored for local trusted callers only. budget_tokens packs server-side (pages first, then facts; threads are never dropped). protocol_version rides every response.",+ "description": "MEMORY VERB (v1): what changed since a time (pages, facts, thread events), zero LLM. Keep a cursor with session_id, or pass since.","name": "delta","parameters": {"budget_tokens": "number?",@@ -4547,27 +4547,27 @@"schema": {"properties": {"budget_tokens": {- "description": "Server-side token budget (char/4). Pages pack first, then facts; each item costs its rendered line and the envelope + section headers + every thread line are reserved, so `text` fits the budget. Threads are never dropped (budget_used can exceed the budget only when the header + threads alone do). Response adds budget_tokens, budget_used (tokens of `text`), dropped_count.",+ "description": "Token budget; pages pack first.","type": "number"},"entities": {- "description": "Optional comma-separated entity scope for thread-event deltas. Capped at 8.",+ "description": "Entity scope for thread events (max 8).","type": "string"},"include_private": {- "description": "Local trusted callers only: widen ALL arms to include private facts. Ignored (world-only) for remote callers. Default false.",+ "description": "Local trusted callers only.","type": "boolean"},"session_id": {- "description": "Opaque session id. Drives the per-session cursor: the first call establishes it, each call advances it to the newest DELIVERED change (at-least-once — with has_more:true the undelivered tail returns on the next wake). Without it, pass an explicit `since` for a stateless delta.",+ "description": "Opaque session id; keeps a cursor.","type": "string"},"since": {- "description": "ISO 8601 cursor. Returns pages/facts/thread-events newer than this timestamp. Optional when session_id carries an established cursor.",+ "description": "ISO 8601 cursor (or use session_id).","type": "string"},"since_slug": {- "description": "Stateless keyset resume: pass back `next_cursor.slug` from the previous response (paired with `since`=next_cursor.since) to page through pages sharing one timestamp. Ignored when session_id is set (the session cursor carries it).",+ "description": "next_cursor.slug from the previous response.","type": "string"}},@@ -4594,7 +4594,7 @@"type": "string"},"request_id": {- "description": "Optional caller-generated UUID for this write. Reuse the same UUID and original arguments to recover its outcome after a timeout; a different intent requires a new UUID.",+ "description": "UUID; retry with it on timeout.","type": "string"}},diff --git a/test/mcp-notice-ceilings.test.ts b/test/mcp-notice-ceilings.test.tsnew file mode 100644index 0000000000..583d835e61--- /dev/null+++ b/test/mcp-notice-ceilings.test.ts@@ -0,0 +1,96 @@+/**+ * C4 (cost wave): the saved-facts and other-names notice blocks have hard+ * character ceilings (1,500 and 400, header included). Items are whole: a+ * fact or alias pair is never cut, so its provenance stays intact; the first+ * item is always shown even when it alone is over the ceiling; a marker+ * counts what was left out. Under the ceilings the blocks are unchanged.+ */+import { describe, expect, test } from 'bun:test';+import { OTHER_NAMES_NOTICE_MAX_CHARS, SAVED_FACTS_NOTICE_MAX_CHARS, retrievalNoticeBlocks } from '../src/mcp/dispatch.ts';++const FACTS_HEAD = 'Saved facts (remember) matching this query, newest first; recall returns more:\n';+const NAMES_HEAD = 'Other names in these results (documents may use either; search the one you have not tried): ';++const fact = (text: string, i = 0) => ({ fact: text, entity_slug: `e${i}`, valid_from: '2026-09-01T00:00:00Z', source: 'user update' });+const factLine = (f: ReturnType<typeof fact>) => `- ${f.fact} [entity: ${f.entity_slug}; saved 2026-09-01; provenance: ${f.source}]`;+const factsBlock = (facts: Array<ReturnType<typeof fact>>) => retrievalNoticeBlocks([{}], { saved_facts: facts })[0];+const pair = (alias: string, i = 0) => ({ name: `Name ${i}`, alias, slug: `crm/n${i}` });+const pairText = (p: ReturnType<typeof pair>) => `${p.alias} = ${p.name} (declared in ${p.slug})`;+const namesBlock = (pairs: Array<ReturnType<typeof pair>>) => retrievalNoticeBlocks([{}], { other_names: pairs })[0];++/** A fact whose rendered line is exactly `len` characters. */+function factOfLine(len: number, i: number) {+ const base = factLine(fact('', i)).length;+ return fact('x'.repeat(len - base), i);+}++describe('saved facts notice: 1,500 characters, whole facts', () => {+ test('constants', () => {+ expect(SAVED_FACTS_NOTICE_MAX_CHARS).toBe(1500);+ expect(OTHER_NAMES_NOTICE_MAX_CHARS).toBe(400);+ });++ test('under the ceiling the block is unchanged', () => {+ const facts = [fact('The billing contact for Acme Example is a new person.', 1), fact('Renewal quotes go to billing.', 2)];+ expect(factsBlock(facts)).toBe(`${FACTS_HEAD}${facts.map(factLine).join('\n')}`);+ });++ test('a block of exactly 1,500 characters keeps every fact', () => {+ const first = factOfLine(700, 1);+ const second = factOfLine(1500 - FACTS_HEAD.length - 700 - 1, 2);+ const block = factsBlock([first, second]);+ expect(block.length).toBe(1500);+ expect(block).not.toContain('more; recall returns them');+ });++ test('one character over drops the whole last fact and counts it', () => {+ const first = factOfLine(700, 1);+ const second = factOfLine(1500 - FACTS_HEAD.length - 700, 2);+ const block = factsBlock([first, second]);+ expect(block).toBe(`${FACTS_HEAD}${factLine(first)}\n(+1 more; recall returns them)`);+ });++ test('a first fact alone over the ceiling is shown whole; the ceiling applies from the second', () => {+ const big = factOfLine(1600, 1);+ const block = factsBlock([big, fact('small', 2), fact('small too', 3)]);+ expect(block).toBe(`${FACTS_HEAD}${factLine(big)}\n(+2 more; recall returns them)`);+ });++ test('shown facts are never cut: every line is a complete rendered fact', () => {+ const facts = Array.from({ length: 5 }, (_, i) => factOfLine(400, i));+ const block = factsBlock(facts);+ expect(block.length).toBeLessThanOrEqual(1500 + '\n(+9 more; recall returns them)'.length);+ const lines = block.slice(FACTS_HEAD.length).split('\n');+ const shown = lines.filter(l => l.startsWith('- '));+ expect(shown).toEqual(facts.slice(0, shown.length).map(factLine));+ expect(lines.at(-1)).toBe(`(+${5 - shown.length} more; recall returns them)`);+ });+});++describe('other names notice: 400 characters, whole pairs', () => {+ test('under the ceiling the block is unchanged', () => {+ const pairs = [pair('NULA', 1), pair('ACME', 2)];+ expect(namesBlock(pairs)).toBe(`${NAMES_HEAD}${pairs.map(pairText).join('; ')}.`);+ });++ test('exactly 400 characters before the closing period keeps every pair', () => {+ const first = pair('A'.repeat(100), 1);+ const rest = 400 - NAMES_HEAD.length - pairText(first).length - 2 - pairText(pair('', 2)).length;+ const second = pair('B'.repeat(rest), 2);+ const block = namesBlock([first, second]);+ expect(block.length).toBe(401);+ expect(block).not.toContain('more)');+ });++ test('one character over drops the whole last pair and counts it', () => {+ const first = pair('A'.repeat(100), 1);+ const rest = 400 - NAMES_HEAD.length - pairText(first).length - 2 - pairText(pair('', 2)).length + 1;+ const block = namesBlock([first, pair('B'.repeat(rest), 2)]);+ expect(block).toBe(`${NAMES_HEAD}${pairText(first)} (+1 more).`);+ });++ test('a first pair alone over the ceiling is shown whole', () => {+ const big = pair('Z'.repeat(450), 1);+ expect(namesBlock([big, pair('Q', 2)])).toBe(`${NAMES_HEAD}${pairText(big)} (+1 more).`);+ });+});diff --git a/test/mcp-schema-budget.test.ts b/test/mcp-schema-budget.test.tsnew file mode 100644index 0000000000..ee3ee76cfb--- /dev/null+++ b/test/mcp-schema-budget.test.ts@@ -0,0 +1,152 @@+/**+ * C3 (cost wave): the starter-surface tool list is re-sent to the model on+ * every turn, so its size is a cost every connected agent pays. This file+ * pins:+ * - the served starter list (Cat 40 configuration: `gbrain serve --surface+ * starter`, no skill grants) at 25,000 characters or less, with+ * `mcp.publish_skills` on (fresh-init default) and off, and its cl100k+ * token count;+ * - the initialize instructions at their recorded size, so guidance cut+ * from the schemas cannot move there instead;+ * - a per-tool budget (the whole tool definition) for every starter op,+ * under the hard caps of 1,200 characters per description and 200 per+ * parameter description;+ * - the minimum guidance each tool must keep (DX-14): purpose, required+ * input, consequential defaults, the next call, the recovery move.+ * The longer pre-cut guidance lives in docs/mcp/TOOL_REFERENCE.md.+ *+ * Raising a number here needs a reason in the commit message and a check+ * that the served list still fits 25,000 characters. Measured on this+ * branch: 24,763 characters, 5,568 cl100k tokens (was 59,969 / 13,077).+ */+import { afterAll, beforeAll, describe, expect, test } from 'bun:test';+import { PGLiteEngine } from '../src/core/pglite-engine.ts';+import { operations, type Operation } from '../src/core/operations.ts';+import { filterOpsForSurface, STARTER_OPS } from '../src/mcp/surface.ts';+import { buildToolDefs } from '../src/mcp/tool-defs.ts';+import { stdioVisibleTools } from '../src/mcp/server.ts';+import { GBRAIN_MCP_INSTRUCTIONS } from '../src/mcp/instructions.ts';+import { cl100kAvailable, estimateTokens } from '../src/core/chunkers/token-estimate.ts';++const SERVED_STARTER_MAX_CHARS = 25_000;+const SERVED_STARTER_MAX_TOKENS = 5_700;+const INSTRUCTIONS_MAX_CHARS = 4_042;+const DESCRIPTION_HARD_CAP = 1_200;+const PARAM_DESCRIPTION_HARD_CAP = 200;++/** Per-tool budget: JSON.stringify of the served tool definition. */+const TOOL_BUDGETS: Record<string, number> = {+ add_timeline_entry: 630, cancel_job: 250, cancel_write_request: 330, capture: 1250, context_pack: 760,+ delete_skill: 810, delta: 830, edit_page: 1090, entity: 460, find_anomalies: 500, forget: 560, get_agent_job: 220,+ get_backlinks: 350, get_ingest_log: 200, get_page: 810, get_recent_salience: 630, get_skill: 910,+ get_skill_asset: 780, get_write_request: 300, join_brain: 560, leave_brain: 540, list_brain_skillpack: 200,+ list_link_sources: 190, list_pages: 1090, list_skills: 640, list_write_requests: 390, put_page: 1320,+ put_skill: 1420, query: 3220, recall: 1590, remember: 1370, request_tools: 560, resolve_slugs: 330, search: 1760,+ submit_agent: 750, sync_brain_skills: 770, synthesize: 550, traverse_graph: 660, whoami: 190,+};++/** DX-14: phrases each tool's description must keep. */+const MINIMUM_GUIDANCE: Record<string, string[]> = {+ search: ['no LLM expansion', 'top 20', 'NOT proof of coverage', '`query`', 'list_pages', 'return_unit', 'fields: "full"'],+ query: ['expansion', 'Still top-K', 'return_unit', 'list_pages', '`search` is cheaper', 'LLM call', 'fields: "full"'],+ put_page: ['REPLACES the whole page', 'get_page include_content:true', 'expected_revision', 'request_id', 'edit_page'],+ edit_page: ['prefer this over put_page', 'expected_revision', 'exactly once', 'all or none', 'revision_conflict'],+ get_page: ['include_content:true', 'put_page', 'edit_page'],+ list_pages: ['sort=updated_desc', 'Default 50', 'truncated', 'updated_after_slug'],+ capture: ['inbox/', 'idempotent', 'put_page', 'remember'],+ remember: ['provenance', '`entity`', '`status`', 'write_pending', 'get_write_request'],+ recall: ['entity', '`query`', 'world facts only', 'synthesize'],+ entity: ['zero LLM', 'found:false', 'create_safety', 'recall'],+ forget: ['fact_id', 'Idempotent'],+ synthesize: ['[EXPENSIVE', 'recall', 'entity'],+ context_pack: ['session start', 'compaction'],+ delta: ['session_id', 'since'],+ get_write_request: ['request_id', 'write_pending'],+ list_write_requests: ['newest first'],+ cancel_write_request: ['receipt'],+ request_tools: ['{tools', '{surface}'],+ list_skills: ['NOT executable code', 'get_skill', 'usable_tools', 'unavailable_tools'],+ get_skill: ['same-named MCP tool', 'nothing to execute', 'unavailable_tools'],+ get_recent_salience: ['Use this when the user asks', 'Do NOT run a semantic search'],+ find_anomalies: ['grouped by cohort', 'Cohort kinds: tag, type'],+ submit_agent: ['agent scope', 'get_agent_job'],+ get_agent_job: ['submit_agent', 'queue_position'],+ whoami: ['source_id', 'federated_read'],+ traverse_graph: ['depth'],+};++const size = (ops: Operation[]) => JSON.stringify(buildToolDefs(ops)).length - 2 - Math.max(0, ops.length - 1);++let engine: PGLiteEngine;+beforeAll(async () => {+ engine = new PGLiteEngine();+ await engine.connect({});+ await engine.initSchema();+}, 120_000);+afterAll(async () => { await engine?.disconnect(); });++async function served(publishSkills: boolean): Promise<Operation[]> {+ await engine.setConfig('mcp.publish_skills', String(publishSkills));+ return stdioVisibleTools(engine, filterOpsForSurface(operations, 'starter'));+}++describe('served starter tool list (Cat 40 configuration)', () => {+ test('publish_skills on (the fresh-init default): 34 tools within 25,000 characters', async () => {+ const ops = await served(true);+ expect(ops.map(o => o.name)).toContain('get_skill');+ expect(ops.length).toBe(34);+ expect(size(ops)).toBeLessThanOrEqual(SERVED_STARTER_MAX_CHARS);+ });++ test('publish_skills off: within 25,000 characters', async () => {+ const ops = await served(false);+ expect(ops.map(o => o.name)).not.toContain('get_skill');+ expect(size(ops)).toBeLessThanOrEqual(SERVED_STARTER_MAX_CHARS);+ });++ test('cl100k token ceiling', async () => {+ if (!cl100kAvailable()) return;+ expect(estimateTokens(JSON.stringify(buildToolDefs(await served(true))))).toBeLessThanOrEqual(SERVED_STARTER_MAX_TOKENS);+ });++ test('initialize instructions stay at or below their recorded size', () => {+ expect(GBRAIN_MCP_INSTRUCTIONS.length).toBeLessThanOrEqual(INSTRUCTIONS_MAX_CHARS);+ });+});++describe('per-tool schema budgets', () => {+ const starter = operations.filter(o => STARTER_OPS.has(o.name));++ test('every starter op has a budget', () => {+ expect(starter.map(o => o.name).sort()).toEqual(Object.keys(TOOL_BUDGETS).sort());+ });++ for (const op of operations.filter(o => STARTER_OPS.has(o.name))) {+ test(`${op.name} fits its budget and the hard caps`, () => {+ const [def] = buildToolDefs([op]);+ expect(JSON.stringify(def).length).toBeLessThanOrEqual(TOOL_BUDGETS[op.name]);+ expect(op.description.length).toBeLessThanOrEqual(DESCRIPTION_HARD_CAP);+ const walk = (p: { description?: string; items?: unknown; properties?: Record<string, unknown> }, path: string): void => {+ expect((p.description ?? '').length, path).toBeLessThanOrEqual(PARAM_DESCRIPTION_HARD_CAP);+ if (p.items) walk(p.items as never, `${path}[]`);+ for (const [k, v] of Object.entries(p.properties ?? {})) walk(v as never, `${path}.${k}`);+ };+ for (const [k, p] of Object.entries(op.params)) walk(p as never, `${op.name}.${k}`);+ });+ }+});++describe('minimum guidance (DX-14)', () => {+ for (const [name, phrases] of Object.entries(MINIMUM_GUIDANCE)) {+ test(name, () => {+ const op = operations.find(o => o.name === name)!;+ for (const phrase of phrases) expect(op.description, `${name}: ${phrase}`).toContain(phrase);+ });+ }++ test('every required input of a starter tool is declared in its schema', () => {+ for (const def of buildToolDefs(operations.filter(o => STARTER_OPS.has(o.name)))) {+ for (const key of def.inputSchema.required) expect(def.inputSchema.properties, `${def.name}.${key}`).toHaveProperty(key);+ }+ });+});