Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

GST-359 D: regenerate the tool catalog, manifests and contract goldens; ledger and isolation-matrix rows for memory_recall and memory_write

garrytan82cc3b6a8452
diff --git a/docs/TOOL_CATALOG.md b/docs/TOOL_CATALOG.md
index c5a85e00c9..a8c35ebe0b 100644
--- a/docs/TOOL_CATALOG.md
+++ b/docs/TOOL_CATALOG.md
@@ -4,7 +4,7 @@
<!-- Regenerate: bun run scripts/generate-tool-catalog.ts -->
<!-- Freshness-guarded by scripts/check-tool-catalog-fresh.sh (bun run verify). -->
-Every non-localOnly operation on the MCP surface: 162 tools across 25 areas. **Starter** marks membership in the ~40-op `starter` surface (`src/mcp/surface.ts`); **Gate** names the config key that must be true before remote callers see/call the op (`gbrain config set <key> true`). What a given token actually sees is further filtered per request by scope, bound-client fence, publish gates, and the per-client surface — see `docs/operations/mcp-surface-runbook.md`. Area names are non-contractual groupings.
+Every non-localOnly operation on the MCP surface: 164 tools across 25 areas. **Starter** marks membership in the ~40-op `starter` surface (`src/mcp/surface.ts`); **Gate** names the config key that must be true before remote callers see/call the op (`gbrain config set <key> true`). What a given token actually sees is further filtered per request by scope, bound-client fence, publish gates, and the per-client surface — see `docs/operations/mcp-surface-runbook.md`. Area names are non-contractual groupings.
## admin
@@ -144,6 +144,8 @@ Every non-localOnly operation on the MCP surface: 162 tools across 25 areas. **S
| `confirm_memory` | Owner only: mark a fact, take or page as confirmed by the user (trust tier user_confirmed). | write | | |
| `extract_facts` | Extract personal-knowledge facts (events, preferences, commitments, beliefs, ideas, and plain facts) from a conversation turn into the per-source hot memory. | write | | |
| `forget_fact` | Forget a fact by recording a durable withdrawal in its source and visibility. | write | | |
+| `memory_recall` | Facts for the person this call serves, one per line: their own recent facts first, then facts matching query. | read | | |
+| `memory_write` | Save facts for the person this call serves, readable by them alone. | write | | |
## memory-verbs
diff --git a/plugin/README.md b/plugin/README.md
index e61c503726..691da2e6b6 100644
--- a/plugin/README.md
+++ b/plugin/README.md
@@ -8,7 +8,7 @@ addition/exclusion).
## MCP surface note (read once)
-The plugin's MCP server runs `gbrain serve --surface full` — 183
+The plugin's MCP server runs `gbrain serve --surface full` — 185
operations, the same surface every stdio registration gbrain writes pins.
Every gbrain operation the bundled skills name is on it. A harness that caps
its tool count can narrow this machine's plugin surface with
diff --git a/src/core/operation-loaders.generated.ts b/src/core/operation-loaders.generated.ts
index f824bdb4f6..46a02e2444 100644
--- a/src/core/operation-loaders.generated.ts
+++ b/src/core/operation-loaders.generated.ts
@@ -37,6 +37,7 @@ const load_page_upload = () => import('./ops/page-upload.ts') as Promise<Record<
const load_pages = () => import('./ops/pages.ts') as Promise<Record<string, unknown>>;
const load_persistence = () => import('./ops/persistence.ts') as Promise<Record<string, unknown>>;
const load_purge = () => import('./ops/purge.ts') as Promise<Record<string, unknown>>;
+const load_qm_memory = () => import('./ops/qm-memory.ts') as Promise<Record<string, unknown>>;
const load_questions = () => import('./ops/questions.ts') as Promise<Record<string, unknown>>;
const load_raw_data = () => import('./ops/raw-data.ts') as Promise<Record<string, unknown>>;
const load_request_tools = () => import('./ops/request-tools.ts') as Promise<Record<string, unknown>>;
@@ -209,6 +210,8 @@ export const OPERATION_LOADERS: Record<string, readonly [() => Promise<Record<st
"purge_fact": [load_purge, "purgeOperations"],
"list_page_purges": [load_purge, "purgeOperations"],
"unpurge_page": [load_purge, "purgeOperations"],
+ "memory_recall": [load_qm_memory, "qmMemoryOperations"],
+ "memory_write": [load_qm_memory, "qmMemoryOperations"],
"find_contradictions": [load_insights, "find_contradictions"],
"find_experts": [load_insights, "find_experts"],
"find_trajectory": [load_insights, "find_trajectory"],
diff --git a/src/core/operation-manifest.generated.ts b/src/core/operation-manifest.generated.ts
index c191ad0514..d36e816f5b 100644
--- a/src/core/operation-manifest.generated.ts
+++ b/src/core/operation-manifest.generated.ts
@@ -6107,6 +6107,97 @@ export const OPERATION_MANIFEST: OperationMeta[] = [
"hidden": true
}
},
+ {
+ "name": "memory_recall",
+ "mutating": false,
+ "idempotent": true,
+ "outputRedaction": {
+ "exempt": "renders its own bounded text: fact text passes the retrieval redactor before the max_chars cut"
+ },
+ "description": "Facts for the person this call serves, one per line: their own recent facts first, then facts matching query. Never page bodies. For QM; agents use recall.",
+ "params": {
+ "query": {
+ "type": "string",
+ "required": true,
+ "description": "What the turn is about; ranks the facts."
+ },
+ "max_chars": {
+ "type": "number",
+ "description": "Text cap, 200-12000 (default 6000)."
+ },
+ "acting_user": {
+ "type": "string",
+ "description": "Set by the trusted system: equal to the x-qm-actor header, or omit.",
+ "fullSurfaceOnly": true
+ }
+ },
+ "scope": "read",
+ "annotations": {
+ "title": "memory_recall (QM memory read)",
+ "readOnlyHint": true
+ },
+ "area": "memory"
+ },
+ {
+ "name": "memory_write",
+ "mutating": true,
+ "idempotent": true,
+ "outputRedaction": "no_stored_text",
+ "description": "Save facts for the person this call serves, readable by them alone. Needs an attested person. The same idempotency_key replays the first receipt. For QM; agents use remember.",
+ "params": {
+ "facts": {
+ "type": "array",
+ "required": true,
+ "description": "1-20 facts.",
+ "items": {
+ "type": "object",
+ "properties": {
+ "fact": {
+ "type": "string",
+ "required": true,
+ "description": "One claim."
+ },
+ "provenance": {
+ "type": "string",
+ "required": true,
+ "description": "Where it came from (<=200 chars)."
+ },
+ "kind": {
+ "type": "string",
+ "enum": [
+ "event",
+ "preference",
+ "commitment",
+ "belief",
+ "fact"
+ ],
+ "description": "Default fact."
+ },
+ "valid_from": {
+ "type": "string",
+ "description": "When it became true (ISO 8601)."
+ }
+ }
+ }
+ },
+ "idempotency_key": {
+ "type": "string",
+ "required": true,
+ "description": "1-128 visible ASCII characters; the same key replays this write."
+ },
+ "acting_user": {
+ "type": "string",
+ "description": "Set by the trusted system: equal to the x-qm-actor header, or omit.",
+ "fullSurfaceOnly": true
+ }
+ },
+ "scope": "write",
+ "annotations": {
+ "title": "memory_write (QM memory write)",
+ "idempotentHint": true
+ },
+ "area": "memory"
+ },
{
"name": "find_contradictions",
"mutating": false,
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index eedd70d184..35d2d18016 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": 264227,
- "stdoutSha256": "f1f964ec0bac00c293cdf8e2dfdd28c67c75cde928f45b71f189690e93762e67",
+ "stdoutBytes": 267201,
+ "stdoutSha256": "9572ed8710168f1ca343b8471caf198aad30542b1e0c007e903f2472235d2c02",
"toolNames": [
"remember",
"entity",
@@ -156,6 +156,8 @@
"purge_fact",
"list_page_purges",
"unpurge_page",
+ "memory_recall",
+ "memory_write",
"find_contradictions",
"find_experts",
"find_trajectory",
@@ -7084,6 +7086,108 @@
},
"scope": "admin"
},
+ {
+ "description": "Facts for the person this call serves, one per line: their own recent facts first, then facts matching query. Never page bodies. For QM; agents use recall.",
+ "idempotent": true,
+ "local_only": false,
+ "mutating": false,
+ "name": "memory_recall",
+ "parameters": {
+ "acting_user": "string?",
+ "max_chars": "number?",
+ "query": "string"
+ },
+ "required_scopes": [],
+ "schema": {
+ "properties": {
+ "acting_user": {
+ "description": "Set by the trusted system: equal to the x-qm-actor header, or omit.",
+ "type": "string"
+ },
+ "max_chars": {
+ "description": "Text cap, 200-12000 (default 6000).",
+ "type": "number"
+ },
+ "query": {
+ "description": "What the turn is about; ranks the facts.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "query"
+ ],
+ "type": "object"
+ },
+ "scope": "read"
+ },
+ {
+ "description": "Save facts for the person this call serves, readable by them alone. Needs an attested person. The same idempotency_key replays the first receipt. For QM; agents use remember.",
+ "idempotent": true,
+ "local_only": false,
+ "mutating": true,
+ "name": "memory_write",
+ "parameters": {
+ "acting_user": "string?",
+ "facts": "array",
+ "idempotency_key": "string"
+ },
+ "required_scopes": [],
+ "schema": {
+ "properties": {
+ "acting_user": {
+ "description": "Set by the trusted system: equal to the x-qm-actor header, or omit.",
+ "type": "string"
+ },
+ "facts": {
+ "description": "1-20 facts.",
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "fact": {
+ "description": "One claim.",
+ "type": "string"
+ },
+ "kind": {
+ "description": "Default fact.",
+ "enum": [
+ "event",
+ "preference",
+ "commitment",
+ "belief",
+ "fact"
+ ],
+ "type": "string"
+ },
+ "provenance": {
+ "description": "Where it came from (<=200 chars).",
+ "type": "string"
+ },
+ "valid_from": {
+ "description": "When it became true (ISO 8601).",
+ "type": "string"
+ }
+ },
+ "required": [
+ "fact",
+ "provenance"
+ ],
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "idempotency_key": {
+ "description": "1-128 visible ASCII characters; the same key replays this write.",
+ "type": "string"
+ }
+ },
+ "required": [
+ "facts",
+ "idempotency_key"
+ ],
+ "type": "object"
+ },
+ "scope": "write"
+ },
{
"description": "Return suspected-contradiction findings from the most recent `gbrain eval suspected-contradictions` probe run, optionally filtered by slug and/or severity. Use this when the user asks 'what's inconsistent in my brain', 'show me contradictions about Acme', 'high-severity issues only', or wants to act on the probe's findings without re-running it. Returns {contradictions: [{a, b, severity, axis, confidence, resolution_command}]}. Remote, source-scoped or min_trust callers get only findings whose two sides they can read now (each side re-read live, with source_id, trust_tier and origin) and total_visible instead of the run total. Reads the stored run without triggering a new probe; users run `gbrain eval suspected-contradictions` for that.",
"idempotent": true,
diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.json
index 47b7cb9911..13497efe4d 100644
--- a/test/fixtures/goldens/exports/types.json
+++ b/test/fixtures/goldens/exports/types.json
@@ -3892,7 +3892,7 @@
"kind": "type",
"name": "RecallFactReadOpts",
"signature": [
- "FactListOpts & { entitySlug?: string; }"
+ "FactListOpts & { entitySlug?: string; sourceMarkdownSlug?: string; }"
]
},
{
@@ -6438,6 +6438,7 @@
"admissionOrigin?: AdmissionOrigin | undefined",
"allowedSlugPrefixes?: string[] | undefined",
"applyRemoteReadPolicy?: boolean | undefined",
+ "attestedOp?: string | undefined",
"auth?: AuthInfo | undefined",
"brainId?: string | undefined",
"cliOpts?: { quiet: boolean; progressJson: boolean; progressInterval: number; } | undefined",
diff --git a/test/operations-coverage-ledger.test.ts b/test/operations-coverage-ledger.test.ts
index 47ccdd5321..b6f7776c4e 100644
--- a/test/operations-coverage-ledger.test.ts
+++ b/test/operations-coverage-ledger.test.ts
@@ -33,6 +33,8 @@ const LEDGER: Record<string, string> = {
entity: 'test/memory-verbs-conformance.test.ts',
synthesize: 'test/memory-verbs-conformance.test.ts',
forget: 'test/memory-verbs-conformance.test.ts',
+ memory_recall: 'test/qm-memory-tools.test.ts',
+ memory_write: 'test/qm-memory-tools.test.ts',
get_page: 'test/get-page-federated-scope.test.ts',
put_page: 'test/put-page-provenance.test.ts',
put_pages: 'test/put-pages-batch.test.ts',
diff --git a/test/operations-source-isolation-matrix.test.ts b/test/operations-source-isolation-matrix.test.ts
index a0dd5e4582..235ff1a56d 100644
--- a/test/operations-source-isolation-matrix.test.ts
+++ b/test/operations-source-isolation-matrix.test.ts
@@ -182,6 +182,7 @@ const MATRIX: Row[] = [
{ name: 'get_recent_salience', mode: 'isolated', args: { limit: 50 } },
{ name: 'find_anomalies', mode: 'isolated', args: {} },
{ name: 'recall', mode: 'isolated', args: { query: 'BETAMARKER', limit: 20 } },
+ { name: 'memory_recall', mode: 'isolated', args: { query: 'BETAMARKER works' } },
{ name: 'find_contradictions', mode: 'isolated', args: {} },
{ name: 'find_experts', mode: 'isolated', args: { topic: 'BETAMARKER', limit: 10 } },
{ name: 'chronicle_day', mode: 'isolated', args: { date: TODAY } },