Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

#6696: register get_brain_health and the new engine/writer surfaces in their inventories

garrytanf5cf9a27d46c
diff --git a/docs/TOOL_CATALOG.md b/docs/TOOL_CATALOG.md
index 4f761fc9c3..73a62000a5 100644
--- a/docs/TOOL_CATALOG.md
+++ b/docs/TOOL_CATALOG.md
@@ -4,12 +4,13 @@
<!-- 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: 151 tools across 26 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: 151 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
| Tool | Description | Scope | Starter | Gate |
|---|---|---|---|---|
+| `get_brain_health` | Brain health as bands for agents without admin scope: write capacity (ok, low or critical, with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. | read | | |
| `get_health` | Brain health dashboard (embed coverage, stale pages, orphans) — remote callers see counters confined to their source grant. | admin | | |
| `get_stats` | Brain statistics (page count, chunk count, etc.) — remote callers see counters confined to their source grant. | admin | | |
| `get_status_snapshot` | Snapshot for `gbrain status` thin-client mode: sync freshness + last cycle + queue depths + worker liveness. | admin | | |
@@ -163,12 +164,6 @@ Every non-localOnly operation on the MCP surface: 151 tools across 26 areas. **S
| `ontology_get` | Life Chronicle: the current resolved per-entity ontology (dimension → value) at `asof` (default now), with provenance + confidence + validity. | read | | |
| `ontology_propose` | Life Chronicle: record one ontology observation (entity has dimension=value), sourced + confidence-weighted + bi-temporal. | write | | |
-## other
-
-| Tool | Description | Scope | Starter | Gate |
-|---|---|---|---|---|
-| `get_brain_health` | Brain health as bands for agents without admin scope: write capacity (ok\|low\|critical with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. | read | | |
-
## pages
| Tool | Description | Scope | Starter | Gate |
diff --git a/docs/architecture/canonical-writers.tsv b/docs/architecture/canonical-writers.tsv
index 6dd512a660..bd36a4a01c 100644
--- a/docs/architecture/canonical-writers.tsv
+++ b/docs/architecture/canonical-writers.tsv
@@ -214,6 +214,7 @@ src/core/repair/ontology-facts.ts 1 coordinator `gbrain repair ontology-facts` (
src/core/repair/conversation-labels.ts 4 coordinator `gbrain repair conversation-labels` expires preview-approved label-misattributed conversation facts, expires the page completion marker and writes the not-extractable outcome, under the page key: one database-only managed_maintenance_conversation_label_retire request per batch of up to 25 pages on a managed brain (the preparer reclassifies each page under its lock), one maintenanceTransaction per batch on an unmanaged brain.
src/core/persistence/atom-maintenance.ts 1 coordinator A managed atom retirement stamps retired_by/retired_at on the tombstone inside the coordinator publication of its managed_atom_delete request, after the page deletion path removed the canonical file, so the database row and file change commit or roll back together.
src/core/repair/stale-atoms.ts 2 coordinator gbrain repair stale-atoms retires an atom on a managed brain through a managed_maintenance_retire_stale_atoms coordinated request (the marker stamp runs in its publication); only an unmanaged brain soft-deletes and stamps in a direct page-locked transaction, where no canonical writer enforcement applies.
+src/core/repair/ghost-pages.ts 1 coordinator `gbrain repair ghost-pages` (#6696 B5) retires a preview-approved ghost page (its canonical file is gone): on a managed brain only through a managed_maintenance_retire_ghost_page request whose preparer reruns the classifier under the approved owner and prepares a delete_page with allowMissingFile that refuses unless the file target is the approved path with no bytes (a restored file refuses at preparation or at filesystem publication); only an unmanaged brain versions and soft-deletes directly, inside maintenanceTransaction under the page lock after the revision, page id and file-absence recheck.
src/core/repair/frontmatter.ts 2 coordinator `gbrain repair frontmatter --apply` (#5988) publishes a managed source's repaired file only through submitManagedFileRepair (the managed_file_repair request, preview-hash bound). On an unmanaged (legacy) source it writes the previewed bytes after a backup, moves a renamed page with updateSlug and its source_path in one maintenanceTransaction, then imports the file through importFromFile; no canonical writer enforcement applies there.
src/commands/sources-mirror.ts 1 engine_guard `gbrain sources mirror-readonly|mirror-writable` (#5409) updates only sources.config.mirror_read_only, exactly as `sources federate` updates sources.config.federated; the sources managed_writer_guard trigger governs the row and no page, fact or file is written.
src/core/sync-upstream.ts 1 engine_guard `recordUpstreamObservation` (#5255/#5176) updates only sources.upstream_checked_at, upstream_commit and upstream_behind, observations of the checkout's Git upstream outside managed_writer_guard's protected topology and checkpoint tuples; no page, fact or file is written, and a failure never fails the sync.
diff --git a/docs/architecture/system-of-record.md b/docs/architecture/system-of-record.md
index 39402c92e1..a745cb5ab8 100644
--- a/docs/architecture/system-of-record.md
+++ b/docs/architecture/system-of-record.md
@@ -276,6 +276,7 @@ or a physical projection that leaves attribution untouched):
- `src/core/repair/conversation-labels.ts` (4): a request on managed brains; the unmanaged label retirement runs in `maintenanceTransaction`.
- `src/core/repair/extractor-facts.ts` (1): a request on managed brains; the unmanaged extractor-facts restore runs in `maintenanceTransaction`.
- `src/core/repair/frontmatter.ts` (1): a `managed_file_repair` request on managed sources; the unmanaged rename runs in `maintenanceTransaction`.
+- `src/core/repair/ghost-pages.ts` (2): `gbrain repair ghost-pages` retirement: a receipted `managed_maintenance_retire_ghost_page` request (a prepared `delete_page` with no file bytes) on managed brains; the unmanaged version and soft delete run in `maintenanceTransaction` after the same recheck.
- `src/core/repair/ontology-facts.ts` (1): a coordinated database-only write (`coordinatedDatabaseWrite`, the `ontology_propose` path) on managed brains; the unmanaged ontology-facts restore runs in `maintenanceTransaction`.
- `src/core/repair/stale-atoms.ts` (3): a request on managed brains; the unmanaged retirement runs in `maintenanceTransaction`.
- `src/core/repair/take-supersession.ts` (1): `gbrain repair take-supersession` reprojection: a receipted `managed_maintenance_take_reproject` request on managed brains, `maintenanceTransaction` on unmanaged ones; fence edits go through a revision-bound `put_page`.
diff --git a/src/cli/help/doctor.ts b/src/cli/help/doctor.ts
index be1e3acf9f..e89a625d8e 100644
--- a/src/cli/help/doctor.ts
+++ b/src/cli/help/doctor.ts
@@ -43,7 +43,6 @@ export const help: CliHelpSpec = {
examples: [
'gbrain doctor --json',
'gbrain doctor --only harness_wiring --json',
- 'gbrain doctor --tier ops --json',
'gbrain doctor --remediation-plan --json',
'gbrain doctor --remediate --yes --include-repairs --expect <plan_hash> --max-usd 5',
],
diff --git a/src/commands/doctor/registry.ts b/src/commands/doctor/registry.ts
index fccbfaa984..a9a2b251fa 100644
--- a/src/commands/doctor/registry.ts
+++ b/src/commands/doctor/registry.ts
@@ -215,8 +215,8 @@ export const DOCTOR_CHECK_REGISTRY: readonly DoctorEntry[] = [
coreMemoryEntry,
persistenceConsumersEntry,
atomHeldFailedEntry,
- fenceIntegrityEntry,
ghostPagesEntry,
+ fenceIntegrityEntry,
searchModeEntry,
];
diff --git a/src/core/eligibility/registry.ts b/src/core/eligibility/registry.ts
index c8c333e5aa..540a577a4d 100644
--- a/src/core/eligibility/registry.ts
+++ b/src/core/eligibility/registry.ts
@@ -50,7 +50,7 @@ export const OP_READ_TRUST: Readonly<Record<string, ReadTrustHandling>> = {
sources_inspect: 'text_free', request_tools: 'text_free', connectors_status: 'text_free',
get_active_schema_pack: 'text_free', list_schema_packs: 'text_free', schema_stats: 'text_free', schema_lint: 'text_free',
schema_graph: 'text_free', schema_explain_type: 'text_free',
- list_write_conflicts: 'text_free',
+ list_write_conflicts: 'text_free', get_brain_health: 'text_free',
};
/** The class an op resolves to; an unlisted read op is held to the strictest (`labeled`) rule. */
diff --git a/src/core/operation-load.ts b/src/core/operation-load.ts
index ad49d7ae17..ef2ebfd745 100644
--- a/src/core/operation-load.ts
+++ b/src/core/operation-load.ts
@@ -56,7 +56,7 @@ const OP_AREAS: Record<string, string> = {
ontology_get: 'ontology', ontology_propose: 'ontology',
ontology_dimensions: 'ontology', ontology_conflicts: 'ontology',
// admin + operations
- get_stats: 'admin', get_health: 'admin', run_doctor: 'admin', mute_notice: 'admin',
+ get_stats: 'admin', get_health: 'admin', run_doctor: 'admin', get_brain_health: 'admin', mute_notice: 'admin',
get_status_snapshot: 'admin', run_onboard: 'admin', run_skillopt: 'admin',
migrate_embeddings: 'admin', code_traversal_cache_clear: 'admin', get_write_attribution: 'admin',
// identity
diff --git a/src/core/operation-manifest.generated.ts b/src/core/operation-manifest.generated.ts
index 8044555d8b..b5c25446fa 100644
--- a/src/core/operation-manifest.generated.ts
+++ b/src/core/operation-manifest.generated.ts
@@ -2050,9 +2050,10 @@ export const OPERATION_MANIFEST: OperationMeta[] = [
"mutating": false,
"idempotent": true,
"outputRedaction": "no_stored_text",
- "description": "Brain health as bands for agents without admin scope: write capacity (ok|low|critical with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. No slugs. Cached 60 s.",
+ "description": "Brain health as bands for agents without admin scope: write capacity (ok, low or critical, with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. No slugs. Cached 60 s.",
"params": {},
- "scope": "read"
+ "scope": "read",
+ "area": "admin"
},
{
"name": "get_versions",
diff --git a/src/core/ops/admin.ts b/src/core/ops/admin.ts
index 5e7450884c..362e8b2c2a 100644
--- a/src/core/ops/admin.ts
+++ b/src/core/ops/admin.ts
@@ -308,7 +308,7 @@ const get_brain_health: Operation = {
mutating: false,
idempotent: true,
outputRedaction: 'no_stored_text',
- description: 'Brain health as bands for agents without admin scope: write capacity (ok|low|critical with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. No slugs. Cached 60 s.',
+ description: 'Brain health as bands for agents without admin scope: write capacity (ok, low or critical, with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. No slugs. Cached 60 s.',
params: {},
handler: async (ctx) => {
const scope = sourceScopeOpts(ctx);
diff --git a/test/doctor-ops-remote-6696.test.ts b/test/doctor-ops-remote-6696.test.ts
index f4200ff8e9..74b999996a 100644
--- a/test/doctor-ops-remote-6696.test.ts
+++ b/test/doctor-ops-remote-6696.test.ts
@@ -109,6 +109,13 @@ describe('get_brain_health bands', () => {
expect(['1-9', 'unknown']).toContain(out.write_failures.band);
});
+ test('a federated grant scopes the bands to its sources, never the brain', async () => {
+ const op = operations.find((o) => o.name === 'get_brain_health')!;
+ const band = async (allowedSources: string[]) => ((await op.handler(ctx({ sourceId: undefined, auth: { allowedSources } as never }), {})) as { write_failures: { band: string } }).write_failures.band;
+ expect(await band(['fund-b'])).toBe('1-9');
+ expect(await band(['acme-a'])).toBe('10-99');
+ });
+
test('capacity fixes verify through MCP get_brain_health and the CLI', () => {
expect(capacityVerify()).toMatchObject({ argv: ['gbrain', 'doctor', '--only', 'persistence_capacity', '--json'], mcp: { tool: 'get_brain_health', arguments: {} } });
});
diff --git a/test/engine-surface-coverage.test.ts b/test/engine-surface-coverage.test.ts
index 499d0656e7..51271613bd 100644
--- a/test/engine-surface-coverage.test.ts
+++ b/test/engine-surface-coverage.test.ts
@@ -58,7 +58,7 @@ const INTERFACE_METHODS: readonly string[] = [
// Chunks
'upsertChunks', 'getChunks', 'getChunkPage', 'getChunkWindows', 'countStaleChunks', 'sumStaleChunkChars', 'setPageEmbeddingSignature',
'invalidateStaleSignatureEmbeddings', 'invalidateContentDriftEmbeddings', 'listStaleChunks',
- 'countChunklessPagesWithContent', 'listChunklessPagesWithContent', 'deleteChunks',
+ 'countChunklessPagesWithContent', 'listChunklessPagesWithContent', 'readEmbeddingStateCounts', 'listEmbeddingStateRows', 'deleteChunks',
// Extraction watermark
'countStalePagesForExtraction', 'listStalePagesForExtraction', 'markPagesExtractedBatch', 'markPagesAttendanceBlocked',
// #6454 stale reserved frontmatter keys
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index f250725468..f7010548e5 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": 237445,
- "stdoutSha256": "01f29ef770729b0a738319c1b0fc8dd5ba4526669f95d3c95a33ccc500531580",
+ "stdoutBytes": 237450,
+ "stdoutSha256": "0887ac72521b84dfb730c8cae62b512a813617c581101f7af7574823534b3824",
"toolNames": [
"remember",
"entity",
@@ -2465,7 +2465,7 @@
"scope": "admin"
},
{
- "description": "Brain health as bands for agents without admin scope: write capacity (ok|low|critical with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. No slugs. Cached 60 s.",
+ "description": "Brain health as bands for agents without admin scope: write capacity (ok, low or critical, with a days band) and counts of write failures, ghost pages and unsearchable chunks as bands, for the sources you can read. No slugs. Cached 60 s.",
"idempotent": true,
"local_only": false,
"mutating": false,
diff --git a/test/fixtures/goldens/doctor/content-pglite-human.json b/test/fixtures/goldens/doctor/content-pglite-human.json
index e3d0583569..a97a49a8fd 100644
--- a/test/fixtures/goldens/doctor/content-pglite-human.json
+++ b/test/fixtures/goldens/doctor/content-pglite-human.json
@@ -187,8 +187,8 @@
" [OK] consumers_without_heartbeat: PGLite admits one process; no consumer heartbeat rows are kept.",
" [OK] host_identity_mismatch: This process's host identity (<home>/.gbrain/persistence/host.json) owns every binding this filesystem holds.",
" [OK] extract_atoms_held_failed: No managed atom page or transcript is held after repeated extraction failures.",
- " [OK] fence_integrity: No malformed facts or takes fence is held, stored or waiting in a checkout (2 source(s) scanned).",
" [OK] ghost_pages: No live page is missing its canonical file (5 page(s) inspected).",
+ " [OK] fence_integrity: No malformed facts or takes fence is held, stored or waiting in a checkout (2 source(s) scanned).",
" [OK] search_mode: Mode: conservative (no per-key overrides — mode bundle is canonical).",
" [OK] hidden_by_search_policy: No pages hidden by search-exclude policy.",
" [OK] eval_drift: No retrieval-affecting files changed in working tree.",
diff --git a/test/fixtures/goldens/doctor/content-pglite-json.json b/test/fixtures/goldens/doctor/content-pglite-json.json
index 0e1323b1fb..7ef8a015f9 100644
--- a/test/fixtures/goldens/doctor/content-pglite-json.json
+++ b/test/fixtures/goldens/doctor/content-pglite-json.json
@@ -2659,6 +2659,33 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "notes",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 5,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (5 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -2784,33 +2811,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "notes",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 5,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (5 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
index 5f0981b2bc..9b119d98c3 100644
--- a/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-pglite-json.json
@@ -2779,6 +2779,38 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "notes",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "plain",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 20,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (20 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -3072,38 +3104,6 @@
"name": "fence_integrity",
"status": "warn"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "notes",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "plain",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 20,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (20 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
@@ -6442,6 +6442,38 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "notes",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "plain",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 20,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (20 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -6735,38 +6767,6 @@
"name": "fence_integrity",
"status": "warn"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "notes",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "plain",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 20,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (20 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
index 2bb515aa0d..2c8042dd90 100644
--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
@@ -2776,6 +2776,38 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "notes",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "plain",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 20,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (20 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -3069,38 +3101,6 @@
"name": "fence_integrity",
"status": "warn"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "notes",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "plain",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 20,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (20 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
@@ -6434,6 +6434,38 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "notes",
+ "status": "known"
+ },
+ {
+ "count": 0,
+ "source_id": "plain",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 20,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (20 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -6727,38 +6759,6 @@
"name": "fence_integrity",
"status": "warn"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "notes",
- "status": "known"
- },
- {
- "count": 0,
- "source_id": "plain",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 20,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (20 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.json
index 8781073674..c34f417240 100644
--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json
+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json
@@ -2477,6 +2477,28 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 0,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (0 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -2555,28 +2577,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 0,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (0 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.json
index 125074040f..6603b78b25 100644
--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json
+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json
@@ -2529,6 +2529,28 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 0,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (0 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -2607,28 +2629,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 0,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (0 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/doctor/json-postgres-fresh.json b/test/fixtures/goldens/doctor/json-postgres-fresh.json
index 1880629593..23c9fed13e 100644
--- a/test/fixtures/goldens/doctor/json-postgres-fresh.json
+++ b/test/fixtures/goldens/doctor/json-postgres-fresh.json
@@ -2526,6 +2526,28 @@
"name": "extract_atoms_held_failed",
"status": "ok"
},
+ {
+ "category": "brain",
+ "details": {
+ "by_source": [
+ {
+ "count": 0,
+ "source_id": "default",
+ "status": "known"
+ }
+ ],
+ "count": 0,
+ "docs": "docs/guides/repair.md#ghost-pages",
+ "exact": true,
+ "inspected": 0,
+ "samples": [],
+ "truncated": false
+ },
+ "elapsed_ms": "<volatile>",
+ "message": "No live page is missing its canonical file (0 page(s) inspected).",
+ "name": "ghost_pages",
+ "status": "ok"
+ },
{
"category": "brain",
"details": {
@@ -2604,28 +2626,6 @@
"name": "fence_integrity",
"status": "ok"
},
- {
- "category": "brain",
- "details": {
- "by_source": [
- {
- "count": 0,
- "source_id": "default",
- "status": "known"
- }
- ],
- "count": 0,
- "docs": "docs/guides/repair.md#ghost-pages",
- "exact": true,
- "inspected": 0,
- "samples": [],
- "truncated": false
- },
- "elapsed_ms": "<volatile>",
- "message": "No live page is missing its canonical file (0 page(s) inspected).",
- "name": "ghost_pages",
- "status": "ok"
- },
{
"category": "ops",
"elapsed_ms": "<volatile>",
diff --git a/test/fixtures/goldens/doctor/registry-build-checks.json b/test/fixtures/goldens/doctor/registry-build-checks.json
index 668458c090..9eb264ac84 100644
--- a/test/fixtures/goldens/doctor/registry-build-checks.json
+++ b/test/fixtures/goldens/doctor/registry-build-checks.json
@@ -799,11 +799,11 @@
},
{
"category": "brain",
- "name": "fence_integrity"
+ "name": "ghost_pages"
},
{
"category": "brain",
- "name": "ghost_pages"
+ "name": "fence_integrity"
},
{
"category": "ops",
diff --git a/test/fixtures/goldens/postgres-engine-gauge/acquires-by-case.json b/test/fixtures/goldens/postgres-engine-gauge/acquires-by-case.json
index 72c01d7589..0b835050b0 100644
--- a/test/fixtures/goldens/postgres-engine-gauge/acquires-by-case.json
+++ b/test/fixtures/goldens/postgres-engine-gauge/acquires-by-case.json
@@ -199,6 +199,12 @@
"listCorpusSample#seed": {
"tx": 1
},
+ "listEmbeddingStateRows#default": {
+ "raw": 1
+ },
+ "listEmbeddingStateRows#sourceIds": {
+ "raw": 1
+ },
"listEnrichCandidates#default": {},
"listEnrichCandidates#sourceId": {},
"listEnrichCandidates#sourceIds+reenrich": {},
@@ -283,6 +289,15 @@
"raw": 4,
"tx": 1
},
+ "readEmbeddingStateCounts#full": {
+ "raw": 1
+ },
+ "readEmbeddingStateCounts#full+sourceIds": {
+ "raw": 1
+ },
+ "readEmbeddingStateCounts#ops": {
+ "raw": 1
+ },
"readPageSnapshot#default": {},
"readPageSnapshot#sourceId": {},
"readPageSnapshotsBatch#default": {},
diff --git a/test/fixtures/goldens/rls-scope-inventory.json b/test/fixtures/goldens/rls-scope-inventory.json
index 56f1c5bb77..680a6d2133 100644
--- a/test/fixtures/goldens/rls-scope-inventory.json
+++ b/test/fixtures/goldens/rls-scope-inventory.json
@@ -1800,6 +1800,34 @@
"src-a"
]
},
+ "listEmbeddingStateRows#default": {
+ "flagOffLanes": [
+ "pool"
+ ],
+ "flagOffOpensTransaction": false,
+ "flagOn": "scoped",
+ "flagOnLanes": [
+ "pool",
+ "tx"
+ ],
+ "flagOnScopes": [
+ "*"
+ ]
+ },
+ "listEmbeddingStateRows#sourceIds": {
+ "flagOffLanes": [
+ "pool"
+ ],
+ "flagOffOpensTransaction": false,
+ "flagOn": "scoped",
+ "flagOnLanes": [
+ "pool",
+ "tx"
+ ],
+ "flagOnScopes": [
+ "src-a"
+ ]
+ },
"listEnrichCandidates#default": {
"flagOffLanes": [
"pool"
@@ -2523,6 +2551,48 @@
"default"
]
},
+ "readEmbeddingStateCounts#full": {
+ "flagOffLanes": [
+ "pool"
+ ],
+ "flagOffOpensTransaction": false,
+ "flagOn": "scoped",
+ "flagOnLanes": [
+ "pool",
+ "tx"
+ ],
+ "flagOnScopes": [
+ "*"
+ ]
+ },
+ "readEmbeddingStateCounts#full+sourceIds": {
+ "flagOffLanes": [
+ "pool"
+ ],
+ "flagOffOpensTransaction": false,
+ "flagOn": "scoped",
+ "flagOnLanes": [
+ "pool",
+ "tx"
+ ],
+ "flagOnScopes": [
+ "src-a"
+ ]
+ },
+ "readEmbeddingStateCounts#ops": {
+ "flagOffLanes": [
+ "pool"
+ ],
+ "flagOffOpensTransaction": false,
+ "flagOn": "scoped",
+ "flagOnLanes": [
+ "pool",
+ "tx"
+ ],
+ "flagOnScopes": [
+ "*"
+ ]
+ },
"readPageSnapshot#default": {
"flagOffLanes": [
"pool"
@@ -3475,7 +3545,7 @@
}
},
"static": {
- "callSites": 30,
+ "callSites": 32,
"directMethods": {
"_searchKeywordCJK": 1,
"countChunklessPagesWithContent": 1,
@@ -3493,12 +3563,14 @@
"getLinks": 1,
"listChunklessPagesWithContent": 1,
"listCorpusSample": 1,
+ "listEmbeddingStateRows": 1,
"listLinkSources": 1,
"listPages": 1,
"listPrefixSampledPages": 1,
"listStaleChunks": 1,
"listStaleFrontmatterKeyPages": 1,
"listStalePagesForExtraction": 1,
+ "readEmbeddingStateCounts": 1,
"readPageSnapshot": 1,
"readPageSnapshotsBatch": 1,
"runVectorAttempt": 1,
@@ -3614,6 +3686,7 @@
"listChunklessPagesWithContent": "direct",
"listConfigKeys": "none",
"listCorpusSample": "direct",
+ "listEmbeddingStateRows": "direct",
"listEnrichCandidates": "none",
"listEvalCandidates": "none",
"listEvalCaptureFailures": "none",
@@ -3646,6 +3719,7 @@
"putDreamVerdict": "none",
"putPage": "none",
"putRawData": "none",
+ "readEmbeddingStateCounts": "direct",
"readPageSnapshot": "direct",
"readPageSnapshotsBatch": "direct",
"reconnect": "none",
diff --git a/test/operations-coverage-ledger.test.ts b/test/operations-coverage-ledger.test.ts
index 50a1072063..5b40945850 100644
--- a/test/operations-coverage-ledger.test.ts
+++ b/test/operations-coverage-ledger.test.ts
@@ -72,6 +72,7 @@ const LEDGER: Record<string, string> = {
get_stats: 'test/cli-bigint-normalize.test.ts',
get_health: 'test/doctor-timeline-metric-labels-2298.test.ts',
run_doctor: 'test/truthful-catalog.e2e-lite.test.ts',
+ get_brain_health: 'test/doctor-ops-remote-6696.test.ts',
get_versions: 'test/get-page-federated-scope.test.ts',
get_write_attribution: 'test/write-attribution-read.test.ts',
revert_version: 'test/e2e/mechanical.test.ts',
diff --git a/test/operations-source-isolation-matrix.test.ts b/test/operations-source-isolation-matrix.test.ts
index e6ab34508a..bef49034aa 100644
--- a/test/operations-source-isolation-matrix.test.ts
+++ b/test/operations-source-isolation-matrix.test.ts
@@ -127,6 +127,7 @@ const MATRIX: Row[] = [
// Deliberately brain-wide (config / registry / identity — not source data).
{ name: 'search_modes', mode: 'brainwide', args: {}, rationale: 'reports search config knobs, no page data' },
{ name: 'get_brain_identity', mode: 'brainwide', args: {}, rationale: 'brain-level identity document by design' },
+ { name: 'get_brain_health', mode: 'skip', reason: 'returns count bands with no slug or source identity, so the beta-marker scan here would pass vacuously; test/doctor-ops-remote-6696.test.ts seeds per-source write failures and pins the handler to the scalar and federated grant' },
{ name: 'whoami', mode: 'brainwide', args: {}, rationale: 'caller identity/transport echo, no page data' },
{ name: 'sources_list', mode: 'brainwide', args: {}, rationale: 'listing sources is its purpose; exposes ids/names only' },
{ name: 'request_tools', mode: 'brainwide', args: { tools: ['get_page'] }, rationale: 'tool registry surface, no page data' },
diff --git a/test/postgres-rls-scope-inventory.test.ts b/test/postgres-rls-scope-inventory.test.ts
index aba80754e9..69b7a1afb1 100644
--- a/test/postgres-rls-scope-inventory.test.ts
+++ b/test/postgres-rls-scope-inventory.test.ts
@@ -154,8 +154,8 @@ describe('EO4 RLS scope inventory (master)', () => {
const scoping = astScoping(capture.ast);
const callSites = Object.values(capture.ast).reduce((a, m) => a + m.directCallSites, 0);
- expect(callSites).toBe(30);
- expect(Object.values(capture.ast).filter((m) => m.directCallSites > 0).length).toBe(30);
+ expect(callSites).toBe(32);
+ expect(Object.values(capture.ast).filter((m) => m.directCallSites > 0).length).toBe(32);
const byMethod = new Map<string, RuntimeObservation[]>();
for (const [key, obs] of Object.entries(capture.runtime)) {
diff --git a/test/retrieval-op-redaction.test.ts b/test/retrieval-op-redaction.test.ts
index b84daa7816..3090044b42 100644
--- a/test/retrieval-op-redaction.test.ts
+++ b/test/retrieval-op-redaction.test.ts
@@ -187,6 +187,7 @@ const SWEEP: Record<string, Row> = {
get_tags: { args: { slug: 'notes/n1' } },
list_link_sources: { args: {} },
get_brain_identity: { args: {} },
+ get_brain_health: { args: {} },
list_skills: { skip: 'bundled skills catalog from the install tree (throws outside an installed skills dir)' },
join_brain: { skip: 'shared-skills enrollment needs an explicit member grant; returns membership ids' },
leave_brain: { skip: 'shared-skills membership op; returns membership ids' },