Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

feat(recall,entity): fact keying, name+topic split, opt-in no_results exit (#4828, #7177)

garrytane2d484ccc372
diff --git a/docs/guides/exit-codes.md b/docs/guides/exit-codes.md
index 12f1a6e545..5d92702396 100644
--- a/docs/guides/exit-codes.md
+++ b/docs/guides/exit-codes.md
@@ -16,6 +16,7 @@ the exit code first, then reads the JSON document (`--json`) for the details:
| 3 | `confirmation_required`: nothing ran | consent payload (`effects`, `user_message`, `fix`) | stop, relay `user_message` to the user, run `fix.command` only after they agree |
| 10 | the write was accepted and is still pending | write receipt | poll the receipt (`gbrain write-request -- <id>`); `--accept-pending` maps this to 0 |
| 11 | partial, resumable budget stop | result with `remaining_*` and `resume_command` | run `resume_command` (it is safe to re-run) |
+| 12 | `no_results`: `gbrain recall` (an entity, text, `--grep`, `--question` or `--query` lookup) or `gbrain entity` matched nothing. Opt-in: only with `GBRAIN_FAIL_ON_EMPTY=1`; otherwise a miss exits 0 | recall's list output: `status: "no_results"`; entity: `found: false` | treat it as a miss, not a failure; a script that filters stdout can branch on it |
| 13 | `pending_verify`: `gbrain bootstrap harness --token` wired a PGLite brain while no serve answered; nothing failed, nothing verified yet | the harness result with `status: "pending_verify"` and `fix` | tell the user to start `gbrain serve --http`, then run `fix.command` with the same token; `bootstrap harness --status` stays partial until it passes ([pending verify](bootstrap.md#pending-verify)) |
| 14 | `bootstrap_cleanup_pending`: `gbrain bootstrap harness` (or `--status`) wired and verified the harness, but earlier shared-skills enrollments or carried token ids are not cleaned up yet | the harness result with `status: "cleanup_pending"`, a per-id `cleanup` list and `fix` | follow `fix.next`: `run` re-runs the same command; `tell_user_to_run` relays the owner's revoke or restore step, then re-run ([cleanup pending](bootstrap.md#cleanup-pending)) |
| 69 | `gbrain serve` exited on its own after its persistence consumer reported `restart_required` for `GBRAIN_SERVE_RESTART_REQUIRED_EXIT_SECONDS` (`serve_unhealthy_exit`; opt-in) | `[gbrain serve] error code=serve_unhealthy_exit` line on stderr | nothing: the supervisor (the installed service restarts on failure) starts a fresh serve; if it repeats, follow [the unhealthy exit](../ENGINES.md#serve-unhealthy-exit) |
diff --git a/docs/protocol/AGENT_OPERATOR_v1.md b/docs/protocol/AGENT_OPERATOR_v1.md
index 27a51c0fff..e42467e264 100644
--- a/docs/protocol/AGENT_OPERATOR_v1.md
+++ b/docs/protocol/AGENT_OPERATOR_v1.md
@@ -997,6 +997,7 @@ that work in this conversation.
| 3 | `confirmation_required`, nothing ran | stop, relay `user_message`, run `fix.command` only after the user agrees |
| 10 | write accepted, still pending | poll the receipt (`gbrain write-request -- <id>`) |
| 11 | partial, resumable budget stop | run `resume_command` |
+| 12 | `no_results`: a recall or entity lookup matched nothing (only with `GBRAIN_FAIL_ON_EMPTY=1`) | treat it as a miss, not a failure |
| 13 | `pending_verify`: a harness wired, verification waits for the serve | start the serve, then run `fix.command` |
| 14 | `bootstrap_cleanup_pending`: a harness is wired; old shared-skills enrollments or token ids still await cleanup | follow `fix.next` (re-run, or relay the owner's revoke step), then re-run |
| 75 | another runner holds the migration lock | wait, then retry |
diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsv
index 43b9f4c481..33eeeb9e97 100644
--- a/scripts/module-size-limits.tsv
+++ b/scripts/module-size-limits.tsv
@@ -3,7 +3,7 @@
# Raising a ceiling is a conscious, reviewer-visible act. Lower ceilings in
# the same commit as any peel (the guard fails on >50 lines of stale slack).
# Columns: path max_lines policy note
-src/cli/main.ts 2986 ratchet +1 W1 belief ledger: `gbrain beliefs --help` in SELF_HELP_WITHOUT_ENGINE; +1 Cat 41 run 4: recall's SELF_HELP_WITHOUT_ENGINE table entry (a dispatch table row cannot move); moved from src/cli.ts at 3214 (cold start: src/cli.ts is now the 66-line entry with the --version/help fast path; the top-level help text moved to cli/top-help.ts and the exit seam became runCli/exitOnFatalCliError); +2 #6340: the sync status / sync unblock preflight skip (logic in commands/sync/operator.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +2 retrieval feedback: answer id line on stderr and additive answer_id on --json search/query rows (logic in feedback/record.ts); +1 feedback help line and its D3 table-dispatch entry (logic in commands/feedback.ts); 6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); P3 x engine graduation composition: both deltas re-summed at the merge; 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); P3 x foundations-2 composition: deltas re-summed at the merge; 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); P3 x P1 (v0.60.57.0) composition: deltas re-summed at the merge; 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); -25 agent-operator follow-up Item 3: the host connect moved to core/engine-connect.ts (throw-only connectEngineForServe, wrapped by connectEngine; the graduation connect gate moved with it); 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); -25 agent-operator follow-up Item 3: the host connect moved to core/engine-connect.ts (throw-only connectEngineForServe, wrapped by connectEngine; the graduation connect gate moved with it); +2 entity recall: the human `gbrain entity` card prints referenced_by groups and a non-complete mention coverage; cat40 entity wave merge with v0.60.61.0 (3179 measured); +3 #4772 (W14 PR3): get_health text output says the entity ratios are n/a because the schema pack did not load (entity_types_status); +1 C4: gbrain questions CLI-only dispatch row (its help line is in cli/top-help.ts); +1 #6696 (A4): a local write captures the capacity notices (one call; logic in cli/op-notices.ts captureCapacityNotices); +1 large pages A6: the stdin cap reads PAGE_MAX_BYTES from core/page-size-policy.ts; +3 Wave B PR 2: local gbrain get of a segmented page streams on the page_body_segmented refusal (logic in cli/page-render.ts streamSegmentedGet); +1 #6712 PR 3 (L7): the sync_retry_failed_deprecated notice call (logic in commands/sync/args.ts noteRetryFailedDeprecated);+1 Cat 41 run 4: recall's SELF_HELP_WITHOUT_ENGINE table entry (a dispatch table row cannot move); +1 GBRA-133 PR 2a: sync trigger through a live PGLite serve (logic in commands/sync-delegate.ts maybeTriggerThroughServe); +1 GBRA-133 PR 2a merge: master and the sync trigger serve hand-off each added a dispatch row; -30 GBRA-155: the entity card renderer moved to cli/entity-format.ts
+src/cli/main.ts 2988 ratchet +1 W1 belief ledger: `gbrain beliefs --help` in SELF_HELP_WITHOUT_ENGINE; +1 Cat 41 run 4: recall's SELF_HELP_WITHOUT_ENGINE table entry (a dispatch table row cannot move); moved from src/cli.ts at 3214 (cold start: src/cli.ts is now the 66-line entry with the --version/help fast path; the top-level help text moved to cli/top-help.ts and the exit seam became runCli/exitOnFatalCliError); +2 #6340: the sync status / sync unblock preflight skip (logic in commands/sync/operator.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +2 retrieval feedback: answer id line on stderr and additive answer_id on --json search/query rows (logic in feedback/record.ts); +1 feedback help line and its D3 table-dispatch entry (logic in commands/feedback.ts); 6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); P3 x engine graduation composition: both deltas re-summed at the merge; 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); P3 x foundations-2 composition: deltas re-summed at the merge; 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); P3 x P1 (v0.60.57.0) composition: deltas re-summed at the merge; 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); -25 agent-operator follow-up Item 3: the host connect moved to core/engine-connect.ts (throw-only connectEngineForServe, wrapped by connectEngine; the graduation connect gate moved with it); 1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); -25 agent-operator follow-up Item 3: the host connect moved to core/engine-connect.ts (throw-only connectEngineForServe, wrapped by connectEngine; the graduation connect gate moved with it); +2 entity recall: the human `gbrain entity` card prints referenced_by groups and a non-complete mention coverage; cat40 entity wave merge with v0.60.61.0 (3179 measured); +3 #4772 (W14 PR3): get_health text output says the entity ratios are n/a because the schema pack did not load (entity_types_status); +1 C4: gbrain questions CLI-only dispatch row (its help line is in cli/top-help.ts); +1 #6696 (A4): a local write captures the capacity notices (one call; logic in cli/op-notices.ts captureCapacityNotices); +1 large pages A6: the stdin cap reads PAGE_MAX_BYTES from core/page-size-policy.ts; +3 Wave B PR 2: local gbrain get of a segmented page streams on the page_body_segmented refusal (logic in cli/page-render.ts streamSegmentedGet); +1 #6712 PR 3 (L7): the sync_retry_failed_deprecated notice call (logic in commands/sync/args.ts noteRetryFailedDeprecated);+1 Cat 41 run 4: recall's SELF_HELP_WITHOUT_ENGINE table entry (a dispatch table row cannot move); +1 GBRA-133 PR 2a: sync trigger through a live PGLite serve (logic in commands/sync-delegate.ts maybeTriggerThroughServe); +1 GBRA-133 PR 2a merge: master and the sync trigger serve hand-off each added a dispatch row; -30 GBRA-155: the entity card renderer moved to cli/entity-format.ts; +2 #7177: the entity no-results exit on the local and routed paths (logic in cli/entity-format.ts markEntityMiss)
src/commands/autopilot.ts 1662 ratchet refactor wave 1 split target (W4 autopilot, cut line); ceiling rationale: docs/architecture/key-files/commands-1.md entry for src/commands/autopilot.ts; +2 fix wave 5: nosemgrep justifications on the per-brain job launchctl/systemctl calls (#5195); +2 #5813: boot reconcile names attempted and running versions in log + audit; +2 #5855: Bun floor gate before the swap and the swap-refusal hold (logic in core/bun-floor.ts); +3 agent operator wave E9: --dry-run and the persistent_install consent gate before anything is written (logic in autopilot/install-consent.ts); +8 GBRA-130 C-6/A-10: the --retry-global mode row, help line and --phase value flag, and --status reading the brain-wide maintenance verdict into its JSON, text and exit code (logic in core/minions/global-maintenance-stall.ts and autopilot-retry-global.ts); +12 GBRA-133 #7003: --status grades from the daemon's heartbeat sidecar (two report fields and their doc line, the classifier's daemon input and threshold branch, the import and the showStatus read; logic in core/autopilot-heartbeat.ts)
src/commands/doctor.ts 688 ratchet +2 Wave B decision #10: Check.skipped_segmented field (logic in doctor/check-fix.ts withSkippedSegmented); +19 #6696 doctor tiers: Check.elapsed_ms and DoctorReport tier/complete/unknown_sections/elapsed_ms/budget_ms fields, buildChecks/runDoctor deadline params (logic in doctor/budget.ts); +1 agent operator gate fixes: --probe consent gate (logic in doctor/probe-consent.ts); refactor wave 1 split target (W4 doctor); ceiling rationale: docs/architecture/key-files/commands-2.md entry for src/commands/doctor.ts
src/commands/embed.ts 2304 ratchet +2 agent operator wave D2: --json failure envelope via writeCliError; lowered v0.46.26.0: embedBatchWithBackoff + retry cluster peeled to core/embed-retry.ts (core/commands layering fix); grown wave-g (#4530): per-model input-limit wiring; wave-k #3622 reimpl: --stale zero-progress failure quarantine; +29 #4668 (#4530): oversize-heal call sites in both --stale drains — kept low by peeling the healed-row remap to core/embed-oversize-heal.ts (shared with embed-stale.ts); +35 #4647 (refs #4599): per-tick timeout+abort on the single-flight lock heartbeat refresh (interval deliberately NOT unref'd); +122 refs #4599: stall-watchdog race around the drain + shared idempotent flushAndRelease + CLI stall exit mapping (watchdog machinery itself lives in core/embed-stall.ts); +12: adversarial-review hardening (healed_splits progress key + heal-tick comment); #5105: guarded derived projection preparation and read seals; #5105: conditional embedding installer wiring; archived eligibility: active-only dispatch with honest stranded-work reporting; explicit archived admission: live-source snapshots and honest refused-installation failures; +2 fw3: embed --stale --images dispatch (sweep lives in core/embed-stale-images.ts); +5 #5289: dry run reports restamp-only chunks apart from chunks to embed (count lives in core/embedding-invalidation.ts); +6 #4616: keep a partially refused batch in embedPageTexts and name the recovery command in failure samples (guard lives in core/ai/embedding-guard.ts); +5 #5226: embed summary counts distinct pages; +3 #5804: null projection snapshot counted as a failure with one batch summary in embed --stale; +18 wave 8 lane D1: #5527 mixed-space warning subtracts current-model chunks (+4), #5885 takes option/result fields and the stale-drain takes call (pass lives in core/embed-takes.ts); +9 Foundations 1 F4d: time-budget stop result fields, stdout verdict and stop recording in embed --stale (logic in core/embed-budget-stop.ts); +8 green-master lane A: chunkless install re-reads through retryProjectionConflict instead of recording an unavailable page (retry lives in core/page-state/projections.ts, failure line in core/agent-output.ts); +8 fix wave 13 P1.18: runEmbed consent parameter, cost-cap stop wiring and result fields, --slugs parsing to the next flag (cap, verdict and resume logic live in core/embed-cost-cap.ts); +28 large pages A9/T3/T16: --held listing and per-page cap metering on every embed path (logic in core/page-embedding-budget.ts meterPageBatch/spendGrant/heldEmbedArgv), approvedPageCapUsd from --max-usd on --slugs; +1 #6722: an explicit slug embed skips an embed_skip page (it keeps keyword chunks, never vectors); merge v0.60.240.0: large pages and master growth compose at 2265; +39 large pages Wave B lane 1e: segmented pages route to the keyset sweep on the slug, --all and --stale paths, with a dry-run count and provenance stamp (logic in core/page-body/segmented-embedding.ts)
diff --git a/skills/conventions/agent-operator-protocol.md b/skills/conventions/agent-operator-protocol.md
index 58d347384e..3cc8e84130 100644
--- a/skills/conventions/agent-operator-protocol.md
+++ b/skills/conventions/agent-operator-protocol.md
@@ -999,6 +999,7 @@ that work in this conversation.
| 3 | `confirmation_required`, nothing ran | stop, relay `user_message`, run `fix.command` only after the user agrees |
| 10 | write accepted, still pending | poll the receipt (`gbrain write-request -- <id>`) |
| 11 | partial, resumable budget stop | run `resume_command` |
+| 12 | `no_results`: a recall or entity lookup matched nothing (only with `GBRAIN_FAIL_ON_EMPTY=1`) | treat it as a miss, not a failure |
| 13 | `pending_verify`: a harness wired, verification waits for the serve | start the serve, then run `fix.command` |
| 14 | `bootstrap_cleanup_pending`: a harness is wired; old shared-skills enrollments or token ids still await cleanup | follow `fix.next` (re-run, or relay the owner's revoke step), then re-run |
| 75 | another runner holds the migration lock | wait, then retry |
diff --git a/src/cli/entity-format.ts b/src/cli/entity-format.ts
index ee5dae451b..1b37a90b3d 100644
--- a/src/cli/entity-format.ts
+++ b/src/cli/entity-format.ts
@@ -4,19 +4,29 @@
* ratchet), like remember-format.ts.
*/
+import { markNoResults } from './no-results.ts';
+
/* eslint-disable @typescript-eslint/no-explicit-any -- renders the verb's JSON envelope */
+
+/** #7177: `gbrain entity` found no page and no text mention: with GBRAIN_FAIL_ON_EMPTY=1, exit NO_RESULTS_EXIT_CODE (human and --json alike). */
+export function markEntityMiss(opName: string, r: any): void {
+ if (opName === 'entity' && r && r.found === false && !r.text_mentions?.total) markNoResults('entity');
+}
+
export function formatEntityResult(r: any): string {
if (!r.found) {
- const coverage = r.coverage && r.coverage.state !== 'complete' ? ` Mention coverage: ${r.coverage.state}, ${r.coverage.pending_pages} page(s) pending.` : '';
const tm = r.text_mentions;
const lines = tm?.total
- ? [`No entity page. The name appears in the text of ${tm.total}${tm.capped ? '+' : ''} page(s) (unlinked text matches). (${r.latency_ms}ms)${coverage}`,
+ ? [`No entity page. The name appears in the text of ${tm.total}${tm.capped ? '+' : ''} page(s) (unlinked text matches).`,
...tm.pages.map((p: any) => ` ${p.date ?? ' '} ${p.slug} — ${p.title}`)]
- : [`No entity found. (${r.latency_ms}ms)${coverage}${tm?.unread ? ` Text matches not checked (${tm.unread}); search the name with gbrain search.` : ''}`];
+ : ['No entity found.'];
if (Array.isArray(r.suggestions) && r.suggestions.length) {
lines.push(r.ambiguous ? 'Several entities match this name; pick one:' : 'Did you mean:');
for (const s of r.suggestions) lines.push(` ${s.slug} — ${s.title} [${s.create_safety}]`);
}
+ if (!tm?.total && tm?.unread) lines.push(` text matches not checked (${tm.unread}); search the name with gbrain search`);
+ if (r.coverage && r.coverage.state !== 'complete') lines.push(` mention coverage: ${r.coverage.state}, ${r.coverage.pending_pages} page(s) pending`);
+ lines.push(` (${r.latency_ms}ms)`);
return lines.join('\n') + '\n';
}
const c = r.card;
diff --git a/src/cli/main.ts b/src/cli/main.ts
index 621d95b679..56ef56932d 100755
--- a/src/cli/main.ts
+++ b/src/cli/main.ts
@@ -76,7 +76,7 @@ import {
type CliDispatchContext,
} from './command-table.ts';
import { formatRememberResult } from './remember-format.ts';
-import { formatEntityResult } from './entity-format.ts';
+import { formatEntityResult, markEntityMiss } from './entity-format.ts';
import { applyCliOpNotices, captureCapacityNotices, captureOpNotice } from './op-notices.ts';
// db-availability loop: best-effort brain-id for the GBRAIN_DB_ACCESS marker,
@@ -724,6 +724,7 @@ async function runSharedOperation(command: string, subArgs: string[], cliOpts: C
);
setCliExitVerdict(1);
}
+ markEntityMiss(op.name, result);
maybePrintConceptNudge(op.name, params);
} catch (e: unknown) {
// v0.42.20.0 (codex D4): on error, set exitCode + return so the `finally`
@@ -819,6 +820,7 @@ async function runThinClientRouted(
const output = formatResult(op.name, result, params);
// Awaited delivery (#3423) — same contract as the local-engine path.
if (output) await writeStdoutFinal(output);
+ markEntityMiss(op.name, result);
maybePrintConceptNudge(op.name, params);
} catch (e: unknown) {
if (e instanceof RemoteMcpError) {
diff --git a/src/cli/no-results.ts b/src/cli/no-results.ts
new file mode 100644
index 0000000000..dfd1c374c4
--- /dev/null
+++ b/src/cli/no-results.ts
@@ -0,0 +1,15 @@
+/**
+ * #7177: the opt-in "nothing matched" exit (NO_RESULTS_EXIT_CODE) for lookup
+ * commands. With GBRAIN_FAIL_ON_EMPTY=1 a miss exits 12 with one stderr line;
+ * without it the exit stays 0 (a non-zero exit under --json is a failure
+ * document in the agent operator contract), and --json still says
+ * `status: "no_results"` (recall) or `found: false` (entity).
+ */
+import { NO_RESULTS_EXIT_CODE } from '../core/exit-codes.ts';
+import { setCliExitVerdict } from '../core/cli-force-exit.ts';
+
+export function markNoResults(command: string): void {
+ if (process.env.GBRAIN_FAIL_ON_EMPTY !== '1') return;
+ process.stderr.write(`[${command}] exit ${NO_RESULTS_EXIT_CODE} (no_results): nothing matched (GBRAIN_FAIL_ON_EMPTY=1).\n`);
+ setCliExitVerdict(NO_RESULTS_EXIT_CODE);
+}
diff --git a/src/commands/recall.ts b/src/commands/recall.ts
index f9b0a3514c..8a439b1c9b 100644
--- a/src/commands/recall.ts
+++ b/src/commands/recall.ts
@@ -62,6 +62,8 @@ const KIND_ICON: Record<FactKind, string> = {
interface ParsedFlags {
entity: string | null;
+ /** #4828/#7166: the entity came from --entity (never split or widened), not the bare positional. */
+ entityExplicit: boolean;
since: Date | null;
sessionId: string | null;
grep: string | null;
@@ -97,6 +99,7 @@ const DEFAULT_FALLBACK_HOURS = 24;
function parseFlags(args: string[]): ParsedFlags {
const out: ParsedFlags = {
entity: null,
+ entityExplicit: false,
since: null,
sessionId: null,
grep: null,
@@ -219,7 +222,7 @@ function parseFlags(args: string[]): ParsedFlags {
fix: { argv: ['gbrain', 'recall', '--entity', entityFlag], consent: [], actor: 'agent', why: 'Recall the --entity value only.', requires_exclusive: false },
});
}
- if (entityFlag !== null) out.entity = entityFlag;
+ if (entityFlag !== null) { out.entity = entityFlag; out.entityExplicit = true; }
else if (positional) out.entity = positional;
out.budgetTokens = (out.budgetPolicy === 'query_first' && out.query?.trim()
? Number(rawBudget)
@@ -451,6 +454,8 @@ async function runRecallVerb(engine: BrainEngine, flags: ParsedFlags, sourceId?:
// An older server ignores `question` (warn-mode params) and answers without facts_order.
const unranked = flags.question !== null && result.facts_order !== 'relevance'
? 'note: this brain did not rank facts by the question (its server predates question ranking); facts are newest first.' : null;
+ const matched = result.facts.length + (result.results?.length ?? 0);
+ await markRecallMiss(flags, matched);
if (flags.json) {
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
if (unranked) process.stderr.write(unranked + '\n');
@@ -491,7 +496,7 @@ async function runRecallVerb(engine: BrainEngine, flags: ParsedFlags, sourceId?:
* already ran); --supersessions/--session-id keep their own arms.
*/
function entityTextFallbackApplies(flags: ParsedFlags, matched: number): boolean {
- return matched === 0 && !!flags.entity && !flags.grep && !flags.supersessions && !flags.sessionId;
+ return matched === 0 && !!flags.entity && !flags.entityExplicit && !flags.grep && !flags.supersessions && !flags.sessionId;
}
function noteEntityTextFallback(entity: string, matched: number): void {
@@ -522,6 +527,67 @@ async function keylessQuestionFallback(engine: BrainEngine, flags: ParsedFlags,
return true;
}
+/**
+ * #4828: agents ask `gbrain recall "<name> <topic>"`. The bare positional is
+ * resolved as one entity (the whole phrase names none), then grepped as one
+ * literal string (the topic words are a paraphrase), so recall answered "No
+ * matching facts." while the person's facts were there. When a multi-word
+ * positional matched nothing, try the leading (then trailing) one to three
+ * words as the entity, with recall's own resolver (an exact page, alias,
+ * basename, or a bare name only one page expands to), and show that entity's facts with those mentioning the other words
+ * first. No model or embedding call; an explicit --entity is never split.
+ */
+const SPLIT_MAX_NAME_WORDS = 3;
+
+function entitySplitApplies(flags: ParsedFlags): boolean {
+ return !!flags.entity && !flags.entityExplicit && /\s/.test(flags.entity.trim()) && !flags.grep && !flags.supersessions && !flags.sessionId;
+}
+
+/** Name spans to try, longest first: leading words, then trailing words. */
+export function entitySplitSpans(positional: string): Array<{ name: string; topic: string }> {
+ const words = positional.trim().split(/\s+/);
+ const out: Array<{ name: string; topic: string }> = [];
+ for (let k = Math.min(SPLIT_MAX_NAME_WORDS, words.length - 1); k >= 1; k--) {
+ out.push({ name: words.slice(0, k).join(' '), topic: words.slice(k).join(' ') });
+ out.push({ name: words.slice(words.length - k).join(' '), topic: words.slice(0, words.length - k).join(' ') });
+ }
+ return out;
+}
+
+const topicStems = (topic: string) => [...new Set(topic.toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(w => w.length >= 3).map(w => w.slice(0, 4)))];
+
+/** Facts that share more topic word stems first; otherwise the input (recency) order. */
+export function rankByTopic(rows: FactRow[], topic: string): FactRow[] {
+ const stems = topicStems(topic);
+ if (!stems.length) return rows;
+ const score = (f: FactRow) => {
+ const words = f.fact.toLowerCase().split(/[^\p{L}\p{N}]+/u);
+ return stems.filter(s => words.some(w => w.startsWith(s))).length;
+ };
+ return rows.map((r, i) => ({ r, i, s: score(r) })).sort((a, b) => b.s - a.s || a.i - b.i).map(x => x.r);
+}
+
+function noteEntitySplit(positional: string, name: string, slug: string, topic: string, n: number): void {
+ process.stderr.write(
+ `[recall] no facts matched '${positional}' as one entity or text; '${name}' is ${slug}: showing its ${n} fact(s), those mentioning '${topic}' first. ` +
+ `Same as: gbrain recall --entity ${slug} (add --question ${JSON.stringify(topic)} to rank them by meaning).\n`,
+ );
+}
+
+async function entitySplitLocal(engine: BrainEngine, flags: ParsedFlags, sourceId: string, resolvedSince: Date | null): Promise<FactRow[]> {
+ if (!entitySplitApplies(flags)) return [];
+ const { resolveEntitySlugWithSource } = await import('../core/entities/resolve.ts');
+ for (const span of entitySplitSpans(flags.entity!)) {
+ const resolved = await resolveEntitySlugWithSource(engine, sourceId, span.name);
+ if (!resolved || resolved.source === 'fallback_slugify') continue;
+ const rows = await fetchRowsLocal(engine, { ...flags, entity: resolved.slug, entityExplicit: true }, sourceId, resolvedSince);
+ if (!rows.length) continue;
+ noteEntitySplit(flags.entity!, span.name, resolved.slug, span.topic, rows.length);
+ return rankByTopic(rows, span.topic);
+ }
+ return [];
+}
+
async function runRecallOnce(
engine: BrainEngine,
flags: ParsedFlags,
@@ -595,6 +661,7 @@ async function runRecallOnce(
rows = pageable
? await fetchCursorPage(engine, flags, sourceId, cursor!)
: await fetchRowsLocal(engine, flags, sourceId, resolvedSince);
+ if (rows.length === 0 && !pageable) rows = await entitySplitLocal(engine, flags, sourceId, resolvedSince);
if (rows.length === 0 && cursorVariant === 'briefing' && await keylessQuestionFallback(engine, flags, sourceId)) return wallClockCursor(tStart);
if (flags.pending) {
pendingCount = await engine.countUnconsolidatedFacts(sourceId);
@@ -615,6 +682,7 @@ async function runRecallOnce(
const payload: Record<string, unknown> = {
facts: rows.map(factRowToJson),
total: rows.length,
+ ...(recallMissed(flags, rows.length) ? { status: 'no_results' } : {}),
};
if (rollup) payload.top_entities = rollup;
if (pendingCount !== undefined) payload.pending_consolidation_count = pendingCount;
@@ -633,9 +701,27 @@ async function runRecallOnce(
}
}
+ await markRecallMiss(flags, rows.length);
return cursor ? advanceCursor(sourceId, cursorVariant, rows, flags.limit, pageable, thinClient, tStart) : wallClockCursor(tStart);
}
+/**
+ * #7177: a recall that looked something up (an entity or text, --grep,
+ * --question, --query) and matched nothing is a miss: the list render's
+ * --json adds `status: "no_results"` (the verb path prints the operation's
+ * envelope verbatim, where `total: 0` says it), and GBRAIN_FAIL_ON_EMPTY=1
+ * exits NO_RESULTS_EXIT_CODE.
+ * A feed read (--watch, --since-last-run, no filter) with nothing new is not.
+ */
+function recallMissed(flags: ParsedFlags, matched: number): boolean {
+ const lookup = !!flags.entity || !!flags.grep || flags.question !== null || !!flags.query;
+ return matched === 0 && lookup && flags.watchSeconds === null && !flags.sinceLastRun;
+}
+
+async function markRecallMiss(flags: ParsedFlags, matched: number): Promise<void> {
+ if (recallMissed(flags, matched)) (await import('../cli/no-results.ts')).markNoResults('recall');
+}
+
function wallClockCursor(since: Date): RecallCursor {
return { since, resumeAfter: null };
}
@@ -695,7 +781,11 @@ async function fetchCursorPage(engine: BrainEngine, flags: ParsedFlags, sourceId
...narrow,
});
if (!flags.entity) return (await page({})).reverse();
- const entityRows = await page({ entitySlug: (await resolveEntitySlug(engine, sourceId, flags.entity)) ?? flags.entity });
+ const slugs = await entityFactSlugs(engine, sourceId, (await resolveEntitySlug(engine, sourceId, flags.entity)) ?? flags.entity);
+ const keyOf = (r: FactRow) => [r.created_at_iso ?? new Date(r.created_at).toISOString(), r.id] as const;
+ const entityRows = (await Promise.all(slugs.map(entitySlug => page({ entitySlug })))).flat()
+ .sort((a, b) => { const [ka, ia] = keyOf(a), [kb, ib] = keyOf(b); return ka < kb ? -1 : ka > kb ? 1 : ia - ib; })
+ .slice(0, flags.limit);
if (!entityTextFallbackApplies(flags, entityRows.length)) return entityRows.reverse();
const textRows = await page({ grep: flags.entity.toLowerCase() });
if (textRows.length === 0) return entityRows.reverse();
@@ -703,6 +793,18 @@ async function fetchCursorPage(engine: BrainEngine, flags: ParsedFlags, sourceId
return textRows.reverse();
}
+/** #4828: every entity_slug this entity's facts may be saved under (siblings, title subject, bare basename). */
+async function entityFactSlugs(engine: BrainEngine, sourceId: string, slug: string): Promise<string[]> {
+ const { factEntitySlugs } = await import('../core/mentions/siblings.ts');
+ return factEntitySlugs(engine, sourceId, slug, { excludePrivate: false }).catch(() => [slug]);
+}
+
+function mergeNewestFirst(lists: FactRow[][], limit: number, keyOf: (r: FactRow) => Date | string | null | undefined): FactRow[] {
+ if (lists.length === 1) return lists[0]!;
+ const time = (r: FactRow) => { const v = keyOf(r); return (v instanceof Date ? v.getTime() : v ? Date.parse(String(v)) : 0) || 0; };
+ return lists.flat().sort((a, b) => time(b) - time(a)).slice(0, limit);
+}
+
async function fetchRowsLocal(
engine: BrainEngine,
flags: ParsedFlags,
@@ -722,24 +824,27 @@ async function fetchRowsLocal(
if (flags.entity) {
const slug = (await resolveEntitySlug(engine, sourceId, flags.entity)) ?? flags.entity;
// With a window, entity ANDs onto since in one query (before LIMIT);
- // without one, the entity arm keeps its valid_from ordering.
- const rows = resolvedSince
- ? await engine.listFactsSince(sourceId, resolvedSince, {
+ // without one, the entity arm keeps its valid_from ordering. #4828: read
+ // every slug the entity's facts may be saved under, as the recall op does.
+ const slugs = await entityFactSlugs(engine, sourceId, slug);
+ const lists = await Promise.all(slugs.map(entitySlug => resolvedSince
+ ? engine.listFactsSince(sourceId, resolvedSince, {
eventTime: windowEventTime,
- entitySlug: slug,
+ entitySlug,
sessionId: flags.sessionId || undefined,
activeOnly: !flags.includeExpired,
limit: flags.limit,
grep: flags.grep ?? undefined,
excludeAuditRows: true,
})
- : await engine.listFactsByEntity(sourceId, slug, {
+ : engine.listFactsByEntity(sourceId, entitySlug, {
sessionId: flags.sessionId || undefined,
activeOnly: !flags.includeExpired,
limit: flags.limit,
grep: flags.grep ?? undefined,
excludeAuditRows: true,
- });
+ })));
+ const rows = mergeNewestFirst(lists, flags.limit, resolvedSince && !windowEventTime ? r => r.created_at : r => r.valid_from ?? r.created_at);
// #4720: the bare positional is entity-first, but keyless/casual usage
// treats it as a literal word from fact text (`gbrain recall commas`).
// resolveEntitySlug never returns null for non-empty input (slugify is
diff --git a/src/core/behavior-change-notice.ts b/src/core/behavior-change-notice.ts
index 4e49446ea9..21054bc079 100644
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@ -1023,6 +1023,9 @@ export const BEHAVIOR_CHANGES: ReadonlyArray<{ since: string; text: ChangeText;
{ since: '0.60.327.0', text: 'Fact extraction no longer rewrites the facts it stores: the prompt-injection filter used to delete words such as "System" before a parenthesis, so "Business System (ABS)" was saved as "Business [redacted](ABS)". Injection phrases are now neutralized only where stored facts are rendered into a model prompt (standing questions, turn context, proactive briefs). `gbrain doctor --only facts_redaction_marker` counts facts damaged earlier; `gbrain repair redacted-facts` previews what a source page can prove and changes nothing until you apply the printed `--apply --expect <hash>` command.' },
{ since: '0.60.327.0', text: 'The embed sweep that finds chunks whose text changed after they were embedded now runs in 5,000-chunk batches, keeps its place between runs (at most 60 seconds per run) and starts a new pass once a day (`embed.content_drift.pass_interval_hours`, default 24); before, one statement covered the whole brain and a large brain cancelled it on every run. `gbrain doctor --only content_drift_sweep` shows each pass and any error.' },
{ since: '0.60.328.0', id: 'google_api_access_probe', text: 'A managed Google source whose enabled services cannot name the account (an API disabled for the OAuth project, a scope not granted) now resolves it through the OAuth userinfo endpoint: the account pins, the services that work keep syncing, the run is `partial`, and the disabled API is reported as `api_not_enabled` instead of failing the whole sync. `connector_account_changed` is raised only when an account resolved and differs from the pin; when nothing can name the account (userinfo also failing), the sync fails with the underlying error, a network failure included, instead of refusing as an account change. `gbrain google setup` now probes every requested service before registering a source and stops (exit 2, `status: api_access_blocked`) naming each disabled API with its Google Cloud project and enable link, or each scope not granted, in one report. `gbrain google status` adds `accounts[].api_access` and exits 1 while a problem remains, and doctor adds `google_api_access`, read from what the last sync recorded. A Google 403 for insufficient authentication scopes is now `scope_missing` (before: `upstream`, and a calendar read named it `calendar_unreadable`).' },
+ { since: '0.60.328.0', text: '`gbrain entity <name>` now resolves one unambiguous name variant when no exact name matches (a nickname, an initial, a title in front, reversed order, a one-letter surname typo, a surname only one page has), across every source you can read, and says so in `card.match`; a variant two pages share is a miss with `ambiguous: true`. Cards list `possible_duplicates` (title-prefixed person pages, never merged), and a miss or a card with no backlinks or facts while mention coverage is incomplete lists the pages whose text names it (`text_mentions`). The human miss line is now just "No entity found."; timing and mention coverage print on their own lines. `gbrain config set entity.name_variants false` (or `variants: false`) keeps exact names only. Doctor adds `person_title_duplicates`, which lists such pairs with the merge to review and changes nothing.' },
+ { since: '0.60.328.0', text: '`gbrain recall <entity>` on a local brain now reads every slug the entity\'s facts may be saved under, as the recall operation already did (identity siblings, the title subject, and the bare basename when no other page claims it), so facts saved before the page existed show up. `gbrain recall "<name> <topic words>"` that matched nothing as one entity or text now recalls the leading or trailing name\'s facts with the topic matches first, with a note naming the entity. `recall --entity <x>` is accepted (never split or widened to a text match). With `GBRAIN_FAIL_ON_EMPTY=1`, a recall or entity lookup that matches nothing exits 12 (`no_results`); by default it still exits 0, and recall\'s list `--json` adds `status: "no_results"`.' },
+ { since: '0.60.328.0', text: 'A search for an identifier (an email, a URL, a phone number in any common format, a long number, a hex id or a code such as an invoice number) now puts the pages that contain it verbatim first (`exact_lookup: identifier`) before the ranked results; dates and ordinary words are unchanged.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */
diff --git a/src/core/entities/resolve.ts b/src/core/entities/resolve.ts
index b36e9aa2ec..8fc0596b2f 100644
--- a/src/core/entities/resolve.ts
+++ b/src/core/entities/resolve.ts
@@ -357,6 +357,8 @@ function isBareName(raw: string): boolean {
// analysis/runbook documents (`infra/hive-dependency-audit-…`), and any such
// doc would trip the ambiguity gate and re-break bare-token resolution.
const PREFIX_EXPANSION_DIRS = ['people', 'companies', 'hosts', 'projects'] as const;
+/** Directories a bare entity name resolves under (findExactBasenameCandidates); factEntitySlugs reads the same set. */
+export const BASENAME_DIRS = [...PREFIX_EXPANSION_DIRS, 'concepts'] as const;
async function findExactBasenameCandidates(
engine: BrainEngine,
@@ -371,7 +373,7 @@ async function findExactBasenameCandidates(
`SELECT slug FROM pages
WHERE source_id = $1 AND deleted_at IS NULL AND slug = ANY($2::text[])
LIMIT 2`,
- [source_id, [...PREFIX_EXPANSION_DIRS, 'concepts'].map(dir => `${dir}/${token}`)],
+ [source_id, BASENAME_DIRS.map(dir => `${dir}/${token}`)],
);
} catch {
return [];
@@ -519,7 +521,7 @@ export async function resolveStrictEntityReference(
}
const token = slugify(trimmed);
if (!trimmed.includes('/') && token.includes('-')) {
- const basename = await pick(await live([...PREFIX_EXPANSION_DIRS, 'concepts'].map(dir => `${dir}/${token}`)), 'basename');
+ const basename = await pick(await live(BASENAME_DIRS.map(dir => `${dir}/${token}`)), 'basename');
if (basename) return basename;
}
const orgVariant = await pick(await live(orgDirVariants(trimmed)), 'basename');
diff --git a/src/core/exit-codes.ts b/src/core/exit-codes.ts
index 3be802a65d..0d113dab1a 100644
--- a/src/core/exit-codes.ts
+++ b/src/core/exit-codes.ts
@@ -6,6 +6,7 @@
* 0 ok · 1 failed (class/retryable in JSON) · 2 usage / invalid input ·
* 3 confirmation_required (its ONLY meaning) · 10 write pending ·
* 11 resumable budget stop · 13 harness wired, verification pending ·
+ * 12 no results (a lookup matched nothing; opt-in, GBRAIN_FAIL_ON_EMPTY=1) ·
* 14 harness wired, shared-skills/token cleanup pending ·
* 69 serve exited unhealthy · 75 migration
* lock held · 124 timeout · 130 interrupted. `test/exit-codes.test.ts` enumerates every literal
@@ -46,6 +47,17 @@ export const PENDING_WRITE_EXIT_CODE = 10;
*/
export const BUDGET_STOP_EXIT_CODE = 11;
+/**
+ * #7177, opt-in with GBRAIN_FAIL_ON_EMPTY=1: a lookup ran and matched nothing
+ * (`gbrain recall <entity|text>`, `--grep`, `--question`, `--query`;
+ * `gbrain entity <name>` with no page and no text mention). Distinct from 0 so
+ * a script that filters stdout can still tell a miss from a hit, and from 1,
+ * which means the command failed. A feed read (`--since-last-run`, `--watch`,
+ * no filter) that finds nothing new is not a miss. Off by default: a miss
+ * exits 0 and --json carries the status.
+ */
+export const NO_RESULTS_EXIT_CODE = 12;
+
/**
* #6661: `gbrain bootstrap harness --token` on a PGLite brain wired every
* target while no serve answered (`pending_verify`): nothing failed, nothing
diff --git a/src/core/mentions/siblings.ts b/src/core/mentions/siblings.ts
index 8b349d48e8..c7240f8ffa 100644
--- a/src/core/mentions/siblings.ts
+++ b/src/core/mentions/siblings.ts
@@ -123,9 +123,12 @@ export async function siblingCanonical(engine: BrainEngine, sourceId: string, sl
/**
* Every `entity_slug` facts about this page may be stored under: the page,
- * its identity siblings and the slug of its title subject (what a fact saved
- * by name got before its siblings resolved). The entity card and recall read
- * all of them, so a saved fact shows up whichever sibling a reader asks for.
+ * its identity siblings, the slug of its title subject (what a fact saved
+ * by name got before its siblings resolved) and its bare basename
+ * (`companies/acme-example` -> `acme-example`, what a fact saved before the
+ * page existed got, #4828) when no other page claims that basename. The
+ * entity card and recall read all of them, so a saved fact shows up whichever
+ * sibling a reader asks for.
*/
export async function factEntitySlugs(engine: BrainEngine, sourceId: string, slug: string, opts: { excludePrivate?: boolean } = {}): Promise<string[]> {
const [page] = await engine.executeRaw<{ title: string | null }>(
@@ -134,5 +137,19 @@ export async function factEntitySlugs(engine: BrainEngine, sourceId: string, slu
const siblings = await readIdentitySiblings(engine, sourceId, { slug, title: page.title }, { excludePrivate: opts.excludePrivate ?? true });
const { slugify } = await import('../entities/resolve.ts');
const subject = slugify(titleName(page.title ?? ''));
- return [...new Set([slug, ...siblings.pages.map(p => p.slug), ...(subject && subject !== slug ? [subject] : [])])];
+ const basename = await unclaimedBasename(engine, sourceId, slug);
+ return [...new Set([slug, ...siblings.pages.map(p => p.slug), ...(subject && subject !== slug ? [subject] : []), ...(basename ? [basename] : [])])];
+}
+
+/** The page's bare basename, when no page sits at it or at the same basename under another entity directory. */
+async function unclaimedBasename(engine: BrainEngine, sourceId: string, slug: string): Promise<string | null> {
+ const cut = slug.lastIndexOf('/');
+ if (cut <= 0) return null;
+ const basename = slug.slice(cut + 1);
+ if (!basename) return null;
+ const { BASENAME_DIRS } = await import('../entities/resolve.ts');
+ const claimants = [basename, ...BASENAME_DIRS.map(dir => `${dir}/${basename}`)].filter(s => s !== slug);
+ const rows = await engine.executeRaw<{ slug: string }>(
+ 'SELECT slug FROM pages WHERE source_id = $1 AND deleted_at IS NULL AND slug = ANY($2::text[]) LIMIT 1', [sourceId, claimants]).catch(() => null);
+ return rows && rows.length === 0 ? basename : null;
}
diff --git a/src/core/types.ts b/src/core/types.ts
index 140abbe46e..9fe408d265 100644
--- a/src/core/types.ts
+++ b/src/core/types.ts
@@ -1106,8 +1106,7 @@ export interface SearchResult {
keyword_hit?: boolean;
/**
* #1663 — set when the structural exact-lookup tier promoted/injected this
- * result (query was the page's slug or exact normalized title, or #7163 an
- * identifier the page's text contains). Drives the
+ * result (the page's slug or exact title, or #7163 an identifier its text holds). Drives the
* autocut preserve predicate (tier hits carry no rerank_score) and
* `--explain` telemetry; evidence still reads via alias_hit /
* title_match_boost so the frozen EVIDENCE_ENUM is untouched.
diff --git a/src/core/verbs.ts b/src/core/verbs.ts
index ece78f44ad..839c41cc7d 100644
--- a/src/core/verbs.ts
+++ b/src/core/verbs.ts
@@ -223,7 +223,7 @@ const entity: Operation = {
names: { type: 'array', items: { type: 'string' }, description: 'Or up to 50 names/codes at once: compact rows.' },
source_id: { type: 'string', description: 'Read only this source. Default: your source first, then every source you can read.', fullSurfaceOnly: true },
prefer_source_id: { type: 'string', description: 'Source to try first (thin clients send .gbrain-source here); never narrows.', fullSurfaceOnly: true },
- variants: { type: 'boolean', description: 'Default true: when no exact name matches, resolve one unambiguous name variant (nickname, initial, title, order, surname typo, unique surname; card.match says which). false: exact names only.' },
+ variants: { type: 'boolean', description: 'false: exact names only. Default true: with no exact match, one unambiguous name variant (card.match says which).', fullSurfaceOnly: true },
},
scope: 'read',
verb: true,
diff --git a/test/exit-codes.test.ts b/test/exit-codes.test.ts
index 9eace7cc30..6f1577f4c2 100644
--- a/test/exit-codes.test.ts
+++ b/test/exit-codes.test.ts
@@ -35,6 +35,7 @@ describe('exit code table', () => {
expect(exitCodes.CONFIRMATION_REQUIRED_EXIT_CODE).toBe(3);
expect(exitCodes.PENDING_WRITE_EXIT_CODE).toBe(10);
expect(exitCodes.BUDGET_STOP_EXIT_CODE).toBe(11);
+ expect(exitCodes.NO_RESULTS_EXIT_CODE).toBe(12);
expect(exitCodes.HARNESS_PENDING_VERIFY_EXIT_CODE).toBe(13);
expect(exitCodes.HARNESS_CLEANUP_PENDING_EXIT_CODE).toBe(14);
expect(exitCodes.SERVE_UNHEALTHY_EXIT_CODE).toBe(69);
diff --git a/test/fixtures/goldens/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.json
index 76169f3a9c..4f8f5149db 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": 253109,
- "stdoutSha256": "52884f634d8625753ff796aab76902ff1c4faf428fe04f7a03cc6857f157c24f",
+ "stdoutBytes": 253031,
+ "stdoutSha256": "30e63509c2ccc1987bb7de17c1cb0bcb6ca952d30592836975eae34b0e0ac47b",
"toolNames": [
"remember",
"entity",
@@ -332,7 +332,7 @@
"type": "string"
},
"variants": {
- "description": "Default true: when no exact name matches, resolve one unambiguous name variant (nickname, initial, title, order, surname typo, unique surname; card.match says which). false: exact names only.",
+ "description": "false: exact names only. Default true: with no exact match, one unambiguous name variant (card.match says which).",
"type": "boolean"
}
},
diff --git a/test/fixtures/goldens/exports/types.json b/test/fixtures/goldens/exports/types.json
index de6eb6e6a5..5305a73a99 100644
--- a/test/fixtures/goldens/exports/types.json
+++ b/test/fixtures/goldens/exports/types.json
@@ -1493,7 +1493,7 @@
"entity_anchored?: \"entity\" | \"linked\" | undefined",
"evidence?: Evidence | undefined",
"evidence_omitted?: boolean | undefined",
- "exact_lookup?: \"title\" | \"slug\" | undefined",
+ "exact_lookup?: \"title\" | \"slug\" | \"identifier\" | undefined",
"exact_match_boost?: number | undefined",
"fact_id?: string | undefined",
"fact_row?: { id: number; valid_from: string; valid_until: string | null; } | undefined",
@@ -9497,7 +9497,7 @@
"entity_anchored?: \"entity\" | \"linked\" | undefined",
"evidence?: Evidence | undefined",
"evidence_omitted?: boolean | undefined",
- "exact_lookup?: \"title\" | \"slug\" | undefined",
+ "exact_lookup?: \"title\" | \"slug\" | \"identifier\" | undefined",
"exact_match_boost?: number | undefined",
"fact_id?: string | undefined",
"fact_row?: { id: number; valid_from: string; valid_until: string | null; } | undefined",
diff --git a/test/no-results-exit-7177.test.ts b/test/no-results-exit-7177.test.ts
new file mode 100644
index 0000000000..b3cbc7c450
--- /dev/null
+++ b/test/no-results-exit-7177.test.ts
@@ -0,0 +1,130 @@
+/**
+ * #7177: recall and entity misses exited 0 with nothing to tell them from a
+ * hit, so an agent that piped them through grep could not tell. A lookup
+ * that matches nothing now says `status: "no_results"` under --json, and
+ * with GBRAIN_FAIL_ON_EMPTY=1 exits NO_RESULTS_EXIT_CODE (12) with one stderr
+ * line; a feed read with nothing new, and every hit, never do. The default
+ * exit stays 0. PGLite only.
+ */
+import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
+import { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { runRecall } from '../src/commands/recall.ts';
+import { formatEntityResult, markEntityMiss } from '../src/cli/entity-format.ts';
+import { currentExitCode, _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';
+import { NO_RESULTS_EXIT_CODE } from '../src/core/exit-codes.ts';
+import { resetPgliteState } from './helpers/reset-pglite.ts';
+
+let engine: PGLiteEngine;
+const origOut = process.stdout.write.bind(process.stdout);
+const origErr = process.stderr.write.bind(process.stderr);
+let err = '';
+let out = '';
+
+async function recall(args: string[]): Promise<number> {
+ _resetCliExitVerdictForTests();
+ err = '';
+ out = '';
+ process.stdout.write = ((c: string | Uint8Array) => { out += typeof c === 'string' ? c : Buffer.from(c).toString(); return true; }) as typeof process.stdout.write;
+ process.stderr.write = ((c: string | Uint8Array) => { err += typeof c === 'string' ? c : Buffer.from(c).toString(); return true; }) as typeof process.stderr.write;
+ try {
+ await runRecall(engine, [...args, '--source', 'default']);
+ } finally {
+ process.stdout.write = origOut;
+ process.stderr.write = origErr;
+ }
+ return currentExitCode();
+}
+
+function silenced<T>(fn: () => T): T {
+ err = '';
+ process.stderr.write = ((c: string | Uint8Array) => { err += typeof c === 'string' ? c : Buffer.from(c).toString(); return true; }) as typeof process.stderr.write;
+ try { return fn(); } finally { process.stderr.write = origErr; }
+}
+
+beforeAll(async () => {
+ engine = new PGLiteEngine();
+ await engine.connect({});
+ await engine.initSchema();
+});
+afterAll(async () => {
+ await engine.disconnect();
+});
+beforeEach(async () => {
+ await resetPgliteState(engine);
+ await engine.putPage('people/alice-example', { title: 'Alice Example', type: 'person', compiled_truth: 'Founder.' } as never);
+ await engine.insertFact({ fact: 'prefers morning meetings', kind: 'preference', entity_slug: 'people/alice-example', source: 'test', visibility: 'world' } as never, { source_id: 'default' });
+});
+afterEach(() => {
+ delete process.env.GBRAIN_FAIL_ON_EMPTY;
+ _resetCliExitVerdictForTests();
+ process.exitCode = 0;
+});
+
+describe('recall, default', () => {
+ test('a miss exits 0 and prints nothing extra; --json says status no_results, a hit has no status', async () => {
+ expect(await recall(['people/carol-example'])).toBe(0);
+ expect(err).not.toContain('no_results');
+ expect(await recall(['people/carol-example', '--json'])).toBe(0);
+ expect(JSON.parse(out).status).toBe('no_results');
+ expect(await recall(['people/alice-example', '--json'])).toBe(0);
+ expect(JSON.parse(out).status).toBeUndefined();
+ await recall(['--grep', 'zebra', '--since-last-run', '--json']);
+ expect(JSON.parse(out).status).toBeUndefined();
+ });
+});
+
+describe('recall, GBRAIN_FAIL_ON_EMPTY=1', () => {
+ beforeEach(() => { process.env.GBRAIN_FAIL_ON_EMPTY = '1'; });
+
+ test('a hit exits 0', async () => {
+ expect(await recall(['people/alice-example'])).toBe(0);
+ expect(await recall(['--grep', 'morning'])).toBe(0);
+ });
+
+ test('an entity, text or --grep lookup that matches nothing exits 12 with one stderr line', async () => {
+ for (const args of [['people/carol-example'], ['zebra'], ['--grep', 'zebra'], ['people/alice-example', '--grep', 'zebra']]) {
+ expect(await recall(args)).toBe(NO_RESULTS_EXIT_CODE);
+ expect(err).toContain('[recall] exit 12 (no_results): nothing matched (GBRAIN_FAIL_ON_EMPTY=1).');
+ }
+ });
+
+ test('a --json miss exits 12 too', async () => {
+ expect(await recall(['people/carol-example', '--json'])).toBe(NO_RESULTS_EXIT_CODE);
+ });
+
+ test('a feed read with nothing new is not a miss', async () => {
+ expect(await recall(['--grep', 'zebra', '--since-last-run'])).toBe(0);
+ });
+});
+
+describe('entity', () => {
+ const miss = { found: false, latency_ms: 2613, coverage: { state: 'pending', pending_pages: 40 }, suggestions: [] };
+
+ test('by default a miss exits 0', () => {
+ _resetCliExitVerdictForTests();
+ silenced(() => markEntityMiss('entity', miss));
+ expect(currentExitCode()).toBe(0);
+ });
+
+ test('with GBRAIN_FAIL_ON_EMPTY=1 a miss exits 12; the miss line is plain, timing and coverage on their own lines', () => {
+ process.env.GBRAIN_FAIL_ON_EMPTY = '1';
+ _resetCliExitVerdictForTests();
+ silenced(() => markEntityMiss('entity', miss));
+ expect(currentExitCode()).toBe(NO_RESULTS_EXIT_CODE);
+ expect(err).toContain('[entity] exit 12 (no_results)');
+ expect(formatEntityResult(miss).split('\n')).toEqual(['No entity found.', ' mention coverage: pending, 40 page(s) pending', ' (2613ms)', '']);
+ });
+
+ test('a found card, a miss with text mentions and other ops exit 0', () => {
+ process.env.GBRAIN_FAIL_ON_EMPTY = '1';
+ for (const [op, r] of [
+ ['entity', { found: true, card: {} }],
+ ['entity', { ...miss, text_mentions: { total: 2, pages: [] } }],
+ ['search', miss],
+ ] as const) {
+ _resetCliExitVerdictForTests();
+ silenced(() => markEntityMiss(op, r));
+ expect(currentExitCode()).toBe(0);
+ }
+ });
+});
diff --git a/test/recall-entity-keying-4828.test.ts b/test/recall-entity-keying-4828.test.ts
new file mode 100644
index 0000000000..af7eb5c65f
--- /dev/null
+++ b/test/recall-entity-keying-4828.test.ts
@@ -0,0 +1,132 @@
+/**
+ * #4828: recall answered "No matching facts." while the entity's facts were
+ * saved. Two shapes, both local CLI, PGLite only, synthetic names:
+ * - a fact saved before its page existed is keyed by the bare name
+ * (`acme-example`), the page is `companies/acme-example`, and the local
+ * CLI read only the page slug (the recall op already read siblings and the
+ * title subject);
+ * - `gbrain recall "<name> <topic>"` resolved the whole phrase as one
+ * entity and grepped it as one literal, so neither matched.
+ */
+import { afterAll, afterEach, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
+import { _resetCliExitVerdictForTests } from '../src/core/cli-force-exit.ts';
+import { PGLiteEngine } from '../src/core/pglite-engine.ts';
+import { runRecall, entitySplitSpans, rankByTopic } from '../src/commands/recall.ts';
+import { factEntitySlugs } from '../src/core/mentions/siblings.ts';
+import { resetPgliteState } from './helpers/reset-pglite.ts';
+import type { FactRow } from '../src/core/engine.ts';
+
+let engine: PGLiteEngine;
+const origOut = process.stdout.write.bind(process.stdout);
+const origErr = process.stderr.write.bind(process.stderr);
+
+async function recall(args: string[]): Promise<{ facts: string[]; err: string }> {
+ let out = '';
+ let err = '';
+ process.stdout.write = ((c: string | Uint8Array) => { out += typeof c === 'string' ? c : Buffer.from(c).toString(); return true; }) as typeof process.stdout.write;
+ process.stderr.write = ((c: string | Uint8Array) => { err += typeof c === 'string' ? c : Buffer.from(c).toString(); return true; }) as typeof process.stderr.write;
+ try {
+ await runRecall(engine, [...args, '--json', '--source', 'default']);
+ } finally {
+ process.stdout.write = origOut;
+ process.stderr.write = origErr;
+ }
+ return { facts: (JSON.parse(out) as { facts: Array<{ fact: string }> }).facts.map(f => f.fact), err };
+}
+
+const fact = (fact: string, entity_slug: string, valid_from?: Date) =>
+ engine.insertFact({ fact, kind: 'fact', entity_slug, source: 'test', visibility: 'world', ...(valid_from ? { valid_from } : {}) } as never, { source_id: 'default' });
+
+beforeAll(async () => {
+ engine = new PGLiteEngine();
+ await engine.connect({});
+ await engine.initSchema();
+});
+afterAll(async () => {
+ await engine.disconnect();
+});
+beforeEach(async () => {
+ await resetPgliteState(engine);
+});
+afterEach(() => {
+ _resetCliExitVerdictForTests();
+ process.exitCode = 0;
+});
+
+describe('facts keyed by the bare basename', () => {
+ beforeEach(async () => {
+ await engine.putPage('companies/acme-example', { title: 'Acme Example Holdings', type: 'company', compiled_truth: 'A company.' } as never);
+ await fact('raised a seed round', 'acme-example', new Date('2026-01-01'));
+ await fact('hired a new CFO', 'companies/acme-example', new Date('2026-02-01'));
+ });
+
+ test('recall <page slug> shows facts saved under the bare basename too, newest first', async () => {
+ const r = await recall(['companies/acme-example']);
+ expect(r.facts).toEqual(['hired a new CFO', 'raised a seed round']);
+ });
+
+ test('--entity reads the same slugs', async () => {
+ expect((await recall(['--entity', 'companies/acme-example'])).facts).toEqual(['hired a new CFO', 'raised a seed round']);
+ });
+
+ test('a basename another page claims is not read', async () => {
+ await engine.putPage('people/acme-example', { title: 'Acme Example', type: 'person', compiled_truth: 'A person.' } as never);
+ expect(await factEntitySlugs(engine, 'default', 'companies/acme-example')).not.toContain('acme-example');
+ expect((await recall(['companies/acme-example'])).facts).toEqual(['hired a new CFO']);
+ });
+
+ test('a page at the bare slug itself claims it', async () => {
+ await engine.putPage('acme-example', { title: 'Acme notes', type: 'note', compiled_truth: 'Notes.' } as never);
+ expect(await factEntitySlugs(engine, 'default', 'companies/acme-example')).not.toContain('acme-example');
+ });
+});
+
+describe('a name followed by topic words', () => {
+ beforeEach(async () => {
+ await engine.putPage('people/alice-example', { title: 'Alice Example', type: 'person', compiled_truth: 'Founder.' } as never);
+ await fact('prefers morning meetings', 'people/alice-example', new Date('2026-03-01'));
+ await fact('pricing for the enterprise plan is per seat', 'people/alice-example', new Date('2026-01-01'));
+ await fact('unrelated pricing note', 'people/bob-example', new Date('2026-03-02'));
+ });
+
+ test('the leading name resolves; its facts show, topic matches first, with a note', async () => {
+ const r = await recall(['alice example enterprise pricing']);
+ expect(r.facts).toEqual(['pricing for the enterprise plan is per seat', 'prefers morning meetings']);
+ expect(r.err).toContain("'alice example' is people/alice-example");
+ expect(r.err).toContain('gbrain recall --entity people/alice-example');
+ });
+
+ test('a trailing name works too', async () => {
+ const r = await recall(['enterprise pricing Alice Example']);
+ expect(r.facts).toEqual(['pricing for the enterprise plan is per seat', 'prefers morning meetings']);
+ expect(r.err).toContain("'Alice Example' is people/alice-example");
+ });
+
+ test('a first name only one page expands to resolves; a shared one does not', async () => {
+ expect((await recall(['alice enterprise pricing'])).facts).toEqual(['pricing for the enterprise plan is per seat', 'prefers morning meetings']);
+ await engine.putPage('people/alice-other', { title: 'Alice Other', type: 'person', compiled_truth: 'Investor.' } as never);
+ expect((await recall(['alice enterprise pricing'])).facts).not.toContain('prefers morning meetings');
+ });
+
+ test('an explicit --entity is never split or widened to text', async () => {
+ const r = await recall(['--entity', 'alice example enterprise pricing']);
+ expect(r.facts).toEqual([]);
+ expect(r.err).not.toContain('is people/alice-example');
+ });
+
+ test('a single-word positional keeps its text fallback', async () => {
+ expect((await recall(['morning'])).facts).toEqual(['prefers morning meetings']);
+ });
+});
+
+describe('pure helpers', () => {
+ test('entitySplitSpans tries the longest leading and trailing names first', () => {
+ expect(entitySplitSpans('a b c d').map(s => s.name)).toEqual(['a b c', 'b c d', 'a b', 'c d', 'a', 'd']);
+ expect(entitySplitSpans('a b')).toEqual([{ name: 'a', topic: 'b' }, { name: 'b', topic: 'a' }]);
+ });
+
+ test('rankByTopic keeps recency order among equal matches', () => {
+ const rows = ['x one', 'pricing two', 'y three', 'priced four'].map((f, i) => ({ id: i, fact: f }) as unknown as FactRow);
+ expect(rankByTopic(rows, 'pricing').map(r => r.fact)).toEqual(['pricing two', 'priced four', 'x one', 'y three']);
+ });
+});
diff --git a/test/search-identifier-lookup.test.ts b/test/search-identifier-lookup.test.ts
index b2e4f115c9..9b3dc6d1c9 100644
--- a/test/search-identifier-lookup.test.ts
+++ b/test/search-identifier-lookup.test.ts
@@ -3,14 +3,14 @@
* Pure detection and containment, then the probe on PGLite. Synthetic data.
*/
import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'bun:test';
-import { identifierKeywordQuery, parseIdentifier, textContainsIdentifier } from '../src/core/search/identifier-query.ts';
+import { identifierKeywordQuery, parseIdentifier, textContainsIdentifier, type IdentifierKind } from '../src/core/search/identifier-query.ts';
import { PGLiteEngine } from '../src/core/pglite-engine.ts';
import { resetPgliteState } from './helpers/reset-pglite.ts';
import { seedPage } from './helpers/keyword-paging-fixture.ts';
import { structuralExactLookup } from '../src/core/search/exact-lookup.ts';
describe('parseIdentifier', () => {
- const cases: Array<[string, string | null]> = [
+ const cases: Array<[string, IdentifierKind | null]> = [
['[email protected]', 'email'],
['+1 415 555 0142', 'phone'],
['(415) 555-0142', 'phone'],