Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

fix(ingest): curated --help for ingest, ingest-show and ingest-undo; graduation carries reason_purge_tombstones; train census pins

garrytan1640c0d690ef
diff --git a/src/cli/command-table.ts b/src/cli/command-table.ts
index beb910b41b..a1a52852c2 100644
--- a/src/cli/command-table.ts
+++ b/src/cli/command-table.ts
@@ -398,9 +398,9 @@ export const CLI_COMMANDS: readonly CliCommandRecord[] = [ // Pre-connect: disp
{ name: 'questions', phase: 'post-connect', thinClient: 'refuse', selfHelp: true, routes_source: true, load: () => import('./commands/questions.ts') },
// CLI_ONLY: GBRA-215 ingest a pasted document, read an attempt's report, undo an attempt; trusted-local op dispatch of
// the ingest / ingest_undo ops (thin clients call the MCP tools).
- { name: 'ingest', phase: 'post-connect', thinClient: 'refuse', selfHelp: true, routes_source: true, load: () => import('./commands/ingest.ts') },
- { name: 'ingest-show', phase: 'post-connect', thinClient: 'refuse', selfHelp: true, read_only: true, load: () => import('./commands/ingest-show.ts') },
- { name: 'ingest-undo', phase: 'post-connect', thinClient: 'refuse', selfHelp: true, load: () => import('./commands/ingest-undo.ts') },
+ { name: 'ingest', phase: 'post-connect', thinClient: 'refuse', help: () => import('./help/ingest.ts'), routes_source: true, load: () => import('./commands/ingest.ts') },
+ { name: 'ingest-show', phase: 'post-connect', thinClient: 'refuse', help: () => import('./help/ingest-show.ts'), read_only: true, load: () => import('./commands/ingest-show.ts') },
+ { name: 'ingest-undo', phase: 'post-connect', thinClient: 'refuse', help: () => import('./help/ingest-undo.ts'), load: () => import('./commands/ingest-undo.ts') },
// CLI_ONLY: relationship-contradiction proposals (temporal typed edges); host-local, writes canonical timeline lines.
{ name: 'edge-proposals', phase: 'post-connect', thinClient: 'refuse', selfHelp: true, load: () => import('./commands/edge-proposals.ts') },
// selfHelp: core prints its own usage (commands/core.ts). Always-loaded core memory, docs/guides/core-memory.md.
diff --git a/src/cli/commands/ingest-show.ts b/src/cli/commands/ingest-show.ts
index 0bd5703da9..5f00fdb779 100644
--- a/src/cli/commands/ingest-show.ts
+++ b/src/cli/commands/ingest-show.ts
@@ -1,10 +1,10 @@
/**
* `gbrain ingest-show`: post-connect dispatch, run by handleCliOnly with the engine connectEngine() opened; the record
- * lives in src/cli/command-table.ts and the body in src/commands/ingest.ts.
+ * lives in src/cli/command-table.ts and the body in src/commands/ingest-show.ts.
*/
import type { BrainEngine } from '../../core/engine.ts';
export async function run(engine: BrainEngine, args: string[]): Promise<void> {
- const { runIngestShowCli } = await import('../../commands/ingest.ts');
+ const { runIngestShowCli } = await import('../../commands/ingest-show.ts');
await runIngestShowCli(engine, args);
}
diff --git a/src/cli/commands/ingest-undo.ts b/src/cli/commands/ingest-undo.ts
index 3d52270b3b..12d818ccf9 100644
--- a/src/cli/commands/ingest-undo.ts
+++ b/src/cli/commands/ingest-undo.ts
@@ -1,10 +1,10 @@
/**
* `gbrain ingest-undo`: post-connect dispatch, run by handleCliOnly with the engine connectEngine() opened; the record
- * lives in src/cli/command-table.ts and the body in src/commands/ingest.ts.
+ * lives in src/cli/command-table.ts and the body in src/commands/ingest-undo.ts.
*/
import type { BrainEngine } from '../../core/engine.ts';
export async function run(engine: BrainEngine, args: string[]): Promise<void> {
- const { runIngestUndoCli } = await import('../../commands/ingest.ts');
+ const { runIngestUndoCli } = await import('../../commands/ingest-undo.ts');
await runIngestUndoCli(engine, args);
}
diff --git a/src/cli/help/ingest-show.ts b/src/cli/help/ingest-show.ts
new file mode 100644
index 0000000000..fe8531e92d
--- /dev/null
+++ b/src/cli/help/ingest-show.ts
@@ -0,0 +1,11 @@
+/** D3 curated help for `gbrain ingest-show` (src/commands/ingest-show.ts). Docs: docs/guides/ingest.md. */
+import type { CliHelpSpec } from '../command-table.ts';
+
+export const help: CliHelpSpec = {
+ summary: 'Read an ingest report (read-only, no provider calls).',
+ usage: 'gbrain ingest-show <attempt_id> [--json]',
+ flags: [
+ { name: '--json', type: 'boolean', desc: 'Print the report as JSON.' },
+ ],
+ examples: ['gbrain ingest-show <attempt_id> --json'],
+};
diff --git a/src/cli/help/ingest-undo.ts b/src/cli/help/ingest-undo.ts
new file mode 100644
index 0000000000..2f38d9a300
--- /dev/null
+++ b/src/cli/help/ingest-undo.ts
@@ -0,0 +1,13 @@
+/** D3 curated help for `gbrain ingest-undo` (src/commands/ingest-undo.ts). Docs: docs/guides/ingest.md#undo. */
+import type { CliHelpSpec } from '../command-table.ts';
+
+export const help: CliHelpSpec = {
+ summary: 'Preview (exit 3), then retract what one ingest attempt created; edited, promoted or relied-on pages and claims are kept.',
+ usage: 'gbrain ingest-undo <attempt_id> [--yes --expect <plan_hash>] [--json]',
+ flags: [
+ { name: '--yes', type: 'boolean', desc: 'Apply the undo; requires --expect with the plan_hash the preview printed.' },
+ { name: '--expect', type: 'string', desc: 'The plan_hash of the preview being applied; a changed plan refuses.' },
+ { name: '--json', type: 'boolean', desc: 'Print the preview or result as JSON.' },
+ ],
+ examples: ['gbrain ingest-undo <attempt_id>', 'gbrain ingest-undo <attempt_id> --yes --expect <plan_hash>'],
+};
diff --git a/src/cli/help/ingest.ts b/src/cli/help/ingest.ts
new file mode 100644
index 0000000000..6b2cd275cb
--- /dev/null
+++ b/src/cli/help/ingest.ts
@@ -0,0 +1,30 @@
+/** D3 curated help for `gbrain ingest` (flags read by src/commands/ingest.ts). Docs: docs/guides/ingest.md. */
+import type { CliHelpSpec } from '../command-table.ts';
+
+export const help: CliHelpSpec = {
+ summary: 'Save a pasted document: a source page, proposed entity pages and facts, with one report.',
+ usage: 'gbrain ingest (--file <path> | --stdin) [--type <type>] [--title <title>] [--slug <slug>] [--source <id>] [--valid-from <date>] [--visibility world|private] [--no-facts] [--trusted-extraction] [--max-usd <n>] [--request-id <id>] [--resume --attempt <id>] [--dry-run] [--json]',
+ flags: [
+ { name: '--file', type: 'string', desc: 'The document to read (text, at most 200,000 characters).' },
+ { name: '--stdin', type: 'boolean', desc: 'Read the document from standard input.' },
+ { name: '--type', type: 'string', desc: 'Page type of the source page (default note; the active pack must declare it).' },
+ { name: '--title', type: 'string', desc: 'Title of the source page.' },
+ { name: '--slug', type: 'string', desc: 'Slug of the source page (default inbox/ingest-<hash>).' },
+ { name: '--source', type: 'string', desc: 'Source to write (default: the current source).' },
+ { name: '--valid-from', type: 'string', desc: 'When the document\'s facts became true (ISO date).' },
+ { name: '--visibility', type: 'enum', values: ['world', 'private'], desc: 'Visibility of what the ingest writes (default world).' },
+ { name: '--no-facts', type: 'boolean', desc: 'Save the document and its entity pages without facts.' },
+ { name: '--trusted-extraction', type: 'boolean', desc: 'Create model-typed new entities as real pages instead of proposed (owner only).' },
+ { name: '--max-usd', type: 'number', desc: 'Spend cap for this ingest (default ingest.max_usd, 0.50).' },
+ { name: '--request-id', type: 'string', desc: 'Idempotency key: a repeat with the same key returns the same attempt.' },
+ { name: '--resume', type: 'boolean', desc: 'Continue an incomplete attempt named by --attempt (pass the same document).' },
+ { name: '--attempt', type: 'string', desc: 'The attempt id --resume continues.' },
+ { name: '--dry-run', type: 'boolean', desc: 'Keyless preview: candidate names, windows and estimated cost; no provider call, nothing written.' },
+ { name: '--json', type: 'boolean', desc: 'Print the report as JSON.' },
+ ],
+ examples: [
+ 'gbrain ingest --file notes/meeting.txt --dry-run',
+ 'gbrain ingest --stdin --title "Board memo" < memo.txt',
+ 'gbrain ingest-show <attempt_id>',
+ ],
+};
diff --git a/src/commands/ingest-show.ts b/src/commands/ingest-show.ts
new file mode 100644
index 0000000000..c7ba9629da
--- /dev/null
+++ b/src/commands/ingest-show.ts
@@ -0,0 +1,22 @@
+/** gbrain ingest-show: read an ingest report through the trusted-local op layer (no provider calls). Docs: docs/guides/ingest.md. */
+import type { BrainEngine } from '../core/engine.ts';
+import { handleToolCall } from '../mcp/server.ts';
+import { setCliExitVerdict } from '../core/cli-force-exit.ts';
+import { writeCliError } from '../cli/cli-error.ts';
+import { out, positional } from './ingest.ts';
+
+export async function runIngestShowCli(engine: BrainEngine, args: string[]): Promise<void> {
+ if (!positional(args)) {
+ process.stdout.write('gbrain ingest-show <attempt_id> [--json] — read an ingest report (read-only, no provider calls). Docs: docs/guides/ingest.md\n');
+ setCliExitVerdict(2);
+ return;
+ }
+ const json = args.includes('--json');
+ try {
+ const report = await handleToolCall(engine, 'ingest', { attempt_id: positional(args) }) as Record<string, unknown>;
+ out(json, report);
+ setCliExitVerdict(report.status === 'failed' ? 1 : 0);
+ } catch (error) {
+ setCliExitVerdict(writeCliError(error, 'ingest-show'));
+ }
+}
diff --git a/src/commands/ingest-undo.ts b/src/commands/ingest-undo.ts
new file mode 100644
index 0000000000..148ef06531
--- /dev/null
+++ b/src/commands/ingest-undo.ts
@@ -0,0 +1,27 @@
+/** gbrain ingest-undo: preview (exit 3), then retract what one ingest attempt created, through the trusted-local op layer. Docs: docs/guides/ingest.md#undo. */
+import type { BrainEngine } from '../core/engine.ts';
+import { handleToolCall } from '../mcp/server.ts';
+import { setCliExitVerdict } from '../core/cli-force-exit.ts';
+import { writeCliError } from '../cli/cli-error.ts';
+import { flag, positional } from './ingest.ts';
+
+export async function runIngestUndoCli(engine: BrainEngine, args: string[]): Promise<void> {
+ if (!positional(args)) {
+ process.stdout.write('gbrain ingest-undo <attempt_id> [--yes --expect <plan_hash>] [--json] — preview (exit 3), then retract what one ingest attempt created. Docs: docs/guides/ingest.md#undo\n');
+ setCliExitVerdict(2);
+ return;
+ }
+ const json = args.includes('--json');
+ try {
+ const expect = flag(args, '--expect');
+ const result = await handleToolCall(engine, 'ingest_undo', { attempt_id: positional(args), ...(args.includes('--yes') ? { yes: true } : {}), ...(expect ? { expect } : {}) }) as Record<string, unknown>;
+ if (json) process.stdout.write(JSON.stringify(result, null, 2) + '\n');
+ else {
+ process.stdout.write(String(result.summary) + '\n');
+ if (result.status === 'preview') process.stdout.write('Apply: gbrain ingest-undo ' + result.attempt_id + ' --yes --expect ' + result.plan_hash + '\n');
+ }
+ setCliExitVerdict(result.status === 'preview' ? 3 : 0);
+ } catch (error) {
+ setCliExitVerdict(writeCliError(error, 'ingest-undo'));
+ }
+}
diff --git a/src/commands/ingest.ts b/src/commands/ingest.ts
index aa7a3bdb85..f652fc62f2 100644
--- a/src/commands/ingest.ts
+++ b/src/commands/ingest.ts
@@ -13,38 +13,14 @@ import { opError } from '../core/ops/contract.ts';
import { INGEST_MAX_CHARS } from '../core/ingest/extract.ts';
import { readStdinPayload } from '../core/stdin-read.ts';
-export const INGEST_HELP = [
- 'gbrain ingest — save a pasted document: source page, proposed entity pages and facts, with one report',
- '',
- 'Usage: gbrain ingest (--file <path> | --stdin) [options]',
- ' --file <path> the document to read (text, at most 200,000 characters)',
- ' --stdin read the document from standard input',
- ' --type <type> page type of the source page (default note; the active pack must declare it)',
- ' --title <title> title of the source page',
- ' --slug <slug> slug of the source page (default inbox/ingest-<hash>)',
- ' --source <id> source to write (default: the current source)',
- ' --valid-from <date> when the document\'s facts became true (ISO date)',
- ' --visibility <v> world (default) or private',
- ' --no-facts save the document and its entity pages without facts',
- ' --trusted-extraction create model-typed new entities as real pages instead of proposed (owner only)',
- ' --max-usd <n> spend cap for this ingest (default ingest.max_usd, 0.50)',
- ' --request-id <id> idempotency key: a repeat with the same key returns the same attempt',
- ' --resume --attempt <id> continue an incomplete attempt (pass the same document)',
- ' --dry-run keyless preview: candidate names, windows and estimated cost; no provider call, nothing written',
- ' --json print the report as JSON',
- '',
- 'Read a report: gbrain ingest-show <attempt_id> Undo: gbrain ingest-undo <attempt_id> [--yes --expect <plan_hash>]',
- 'Chat exports and agent session logs: gbrain transcripts ingest. Docs: docs/guides/ingest.md',
-].join('\n');
-
const VALUE_FLAGS = new Set(['--file', '--type', '--title', '--slug', '--source', '--valid-from', '--visibility', '--max-usd', '--request-id', '--attempt', '--expect', '--brain']);
-function flag(args: string[], name: string): string | undefined {
+export function flag(args: string[], name: string): string | undefined {
const i = args.indexOf(name);
return i === -1 ? undefined : args[i + 1];
}
-function positional(args: string[]): string | undefined {
+export function positional(args: string[]): string | undefined {
for (let i = 0; i < args.length; i++) {
if (VALUE_FLAGS.has(args[i]!)) { i++; continue; }
if (args[i] === '--') return args[i + 1];
@@ -97,12 +73,11 @@ function render(report: Record<string, unknown>): string {
return lines.join('\n');
}
-function out(json: boolean, value: Record<string, unknown>): void {
+export function out(json: boolean, value: Record<string, unknown>): void {
process.stdout.write((json ? JSON.stringify(value, null, 2) : render(value)) + '\n');
}
export async function runIngestCli(engine: BrainEngine, args: string[]): Promise<void> {
- if (args.includes('--help') || args.includes('-h')) { process.stdout.write(INGEST_HELP + '\n'); return; }
const json = args.includes('--json');
try {
const attempt = flag(args, '--attempt');
@@ -124,40 +99,3 @@ export async function runIngestCli(engine: BrainEngine, args: string[]): Promise
setCliExitVerdict(writeCliError(error, 'ingest'));
}
}
-
-export async function runIngestShowCli(engine: BrainEngine, args: string[]): Promise<void> {
- if (args.includes('--help') || args.includes('-h') || !positional(args)) {
- process.stdout.write('gbrain ingest-show <attempt_id> [--json] — read an ingest report (read-only, no provider calls). Docs: docs/guides/ingest.md\n');
- if (!positional(args) && !args.includes('--help')) setCliExitVerdict(2);
- return;
- }
- const json = args.includes('--json');
- try {
- const report = await handleToolCall(engine, 'ingest', { attempt_id: positional(args) }) as Record<string, unknown>;
- out(json, report);
- setCliExitVerdict(report.status === 'failed' ? 1 : 0);
- } catch (error) {
- setCliExitVerdict(writeCliError(error, 'ingest-show'));
- }
-}
-
-export async function runIngestUndoCli(engine: BrainEngine, args: string[]): Promise<void> {
- if (args.includes('--help') || args.includes('-h') || !positional(args)) {
- process.stdout.write('gbrain ingest-undo <attempt_id> [--yes --expect <plan_hash>] [--json] — preview (exit 3), then retract what one ingest attempt created. Docs: docs/guides/ingest.md#undo\n');
- if (!positional(args) && !args.includes('--help')) setCliExitVerdict(2);
- return;
- }
- const json = args.includes('--json');
- try {
- const expect = flag(args, '--expect');
- const result = await handleToolCall(engine, 'ingest_undo', { attempt_id: positional(args), ...(args.includes('--yes') ? { yes: true } : {}), ...(expect ? { expect } : {}) }) as Record<string, unknown>;
- if (json) process.stdout.write(JSON.stringify(result, null, 2) + '\n');
- else {
- process.stdout.write(String(result.summary) + '\n');
- if (result.status === 'preview') process.stdout.write('Apply: gbrain ingest-undo ' + result.attempt_id + ' --yes --expect ' + result.plan_hash + '\n');
- }
- setCliExitVerdict(result.status === 'preview' ? 3 : 0);
- } catch (error) {
- setCliExitVerdict(writeCliError(error, 'ingest-undo'));
- }
-}
diff --git a/src/core/cli-flag-registry.generated.ts b/src/core/cli-flag-registry.generated.ts
index c87e32f458..bbc4e60e37 100644
--- a/src/core/cli-flag-registry.generated.ts
+++ b/src/core/cli-flag-registry.generated.ts
@@ -77,9 +77,9 @@ export const CLI_FLAG_REGISTRY: Record<string, readonly string[]> = {
'graph-query': ['--brain', '--depth', '--direction', '--help', '--hop', '--include-foreign', '--json', '--mcp-only', '--request-id', '--source', '--type'],
'hook': ['--allow-unverified-remote', '--auto', '--batch-check', '--brain', '--branch', '--cached', '--count', '--diff-filter', '--enable', '--end-of-options', '--env', '--gbrain-bin', '--get', '--harness', '--help', '--instructions', '--instructions-only', '--jq', '--json', '--limit', '--name-only', '--no-instructions', '--only', '--others', '--pat-file', '--path', '--porcelain', '--print', '--pure', '--quiet', '--remove', '--seat', '--session', '--show-current', '--show-toplevel', '--since', '--source', '--source-ids', '--workspace', '--yes'],
'import': ['--accept-pending', '--access-policy', '--admin-intent', '--allow-empty', '--allow-noncanonical-root', '--apply', '--as', '--background', '--batch-check', '--brain', '--cached', '--confirm-relocated-root', '--diff-filter', '--dim', '--embedding-dimensions', '--embedding-model', '--empty', '--exclude', '--exclude-standard', '--expected-epoch', '--expected-state', '--explain', '--follow', '--force', '--force-rechunk', '--format', '--fresh', '--help', '--include-gitignored', '--is-shallow-repository', '--json', '--literal-pathspecs', '--log-noop', '--manifest', '--name-only', '--no-accept-pending', '--no-embed', '--no-embedding', '--no-gpg-sign', '--no-pull', '--no-renames', '--no-verify', '--only', '--others', '--path', '--probe', '--progress-interval', '--progress-json', '--quiet', '--self-transfer', '--show-toplevel', '--skip-failed', '--slugs', '--source', '--source-id', '--stale', '--status', '--supabase', '--timeout', '--timings', '--to', '--url', '--verify', '--wait', '--workers'],
- 'ingest': ['--attempt', '--brain', '--dry-run', '--expect', '--fail-fast', '--file', '--help', '--json', '--max-usd', '--no-facts', '--request-id', '--resume', '--slug', '--source', '--stdin', '--title', '--tools-json', '--trusted-extraction', '--type', '--valid-from', '--visibility', '--yes'],
- 'ingest-show': ['--attempt', '--brain', '--dry-run', '--expect', '--fail-fast', '--file', '--help', '--json', '--max-usd', '--no-facts', '--request-id', '--resume', '--slug', '--source', '--stdin', '--title', '--tools-json', '--trusted-extraction', '--type', '--valid-from', '--visibility', '--yes'],
- 'ingest-undo': ['--attempt', '--brain', '--dry-run', '--expect', '--fail-fast', '--file', '--help', '--json', '--max-usd', '--no-facts', '--request-id', '--resume', '--slug', '--source', '--stdin', '--title', '--tools-json', '--trusted-extraction', '--type', '--valid-from', '--visibility', '--yes'],
+ 'ingest': ['--attempt', '--brain', '--dry-run', '--expect', '--fail-fast', '--file', '--help', '--json', '--max-usd', '--no-facts', '--request-id', '--resume', '--slug', '--source', '--stdin', '--title', '--tools-json', '--trusted-extraction', '--type', '--valid-from', '--visibility'],
+ 'ingest-show': ['--attempt', '--brain', '--expect', '--fail-fast', '--file', '--help', '--json', '--max-usd', '--no-facts', '--request-id', '--resume', '--slug', '--source', '--stdin', '--title', '--tools-json', '--trusted-extraction', '--type', '--valid-from', '--visibility'],
+ 'ingest-undo': ['--attempt', '--brain', '--expect', '--fail-fast', '--file', '--help', '--json', '--max-usd', '--no-facts', '--request-id', '--resume', '--slug', '--source', '--stdin', '--title', '--tools-json', '--trusted-extraction', '--type', '--valid-from', '--visibility', '--yes'],
'init': ['--accept-all', '--accept-capabilities', '--access', '--access-policy', '--acknowledge-managed', '--adopt', '--advertise', '--after', '--aliases', '--all', '--all-drifted', '--allow-create-db', '--allow-docker', '--allow-outside-source-root', '--applied', '--apply', '--as', '--assign-corpus', '--attest-actor', '--attest-ops', '--audit', '--auto', '--auto-additive', '--background', '--batch', '--bound-slug-prefixes', '--brain', '--branch', '--break-lock', '--budget-ms', '--budget-policy', '--budget-tokens', '--budget-usd', '--by-mention', '--catch-up', '--channel', '--chat-model', '--check', '--class', '--clear', '--clear-never-installed', '--cli-socket', '--client', '--close', '--confirm-quiesced', '--confirm-relocated-root', '--conflicts', '--content-root', '--continue', '--conversation', '--cursor', '--db-only', '--deadline', '--dest', '--detach', '--detail', '--dim', '--disable', '--drain', '--embedding-dimensions', '--embedding-model', '--enable', '--entity', '--exclude', '--expand', '--expansion-model', '--expect', '--expect-local', '--expect-remote', '--expect-upstream', '--explain', '--facts', '--fast', '--federated', '--file', '--fix', '--force', '--force-retry', '--format', '--fresh-token', '--from', '--from-meetings', '--full', '--git', '--grammar', '--grant-types', '--group-by', '--harness', '--held', '--help', '--hold-state', '--holds', '--http', '--id', '--images', '--include-ambiguous', '--include-cross-entity', '--include-frontmatter', '--include-gitignored', '--include-hidden', '--infer-dates', '--input', '--install', '--instructions-only', '--issuer-url', '--job-isolation', '--json', '--keep', '--keep-checkout', '--key', '--kind', '--lanes', '--legacy-lock', '--limit', '--link', '--list', '--local-postgres', '--markdown', '--max-cost-usd', '--max-facts', '--max-requests', '--max-rss', '--max-usd', '--may-act-for', '--mcp-only', '--mcp-url', '--member', '--migrate-only', '--migration', '--min-n', '--mode', '--model', '--no-autopilot-install', '--no-autostash', '--no-delegate', '--no-embed', '--no-embedding', '--no-expand', '--no-extract', '--no-federated', '--no-filters', '--no-git', '--no-hooks', '--no-instructions', '--no-lanes', '--no-llm', '--no-probe', '--no-pull', '--no-renames', '--no-repair', '--no-restart', '--no-schema-pack', '--no-verify', '--non-interactive', '--oauth-client-id', '--oauth-client-secret', '--of', '--older-than', '--once', '--only', '--operation', '--output', '--oversized', '--page', '--params', '--parked-code', '--parked-pushes', '--pat-file', '--path', '--pending', '--pglite', '--phase', '--plan', '--prefer', '--prefer-postgres', '--prefix', '--preview', '--private-pages', '--probe', '--profile', '--provenance', '--providers', '--pull', '--purge', '--push-only', '--qm', '--query', '--question', '--quiet', '--readers', '--rebase', '--rebuild', '--redact-paths', '--reference-date', '--remediate', '--remove', '--repair', '--repair-unknown-markers', '--repo', '--request', '--request-id', '--require-clean', '--reset', '--resolve', '--restart-only', '--resume', '--retire', '--retry-failed', '--retry-parked', '--runtime', '--save', '--schema-pack', '--scope', '--scopes', '--search-mode', '--section', '--segmented', '--self-transfer', '--semantic', '--session', '--session-id', '--shared-skills', '--show-toplevel', '--side', '--since', '--since-last-run', '--skip', '--skip-embed-check', '--skip-failed', '--slug', '--slugs', '--source', '--source-id', '--sources', '--src-subpath', '--stale', '--state', '--status', '--stdin', '--stop-mcp', '--strategy', '--supabase', '--surface', '--swap-only', '--tier', '--timeout', '--to', '--token', '--touchpoint', '--type', '--unsettle', '--url', '--url-env', '--user', '--vacuum', '--verbose', '--version', '--wait', '--warn-only', '--watch', '--working-tree', '--workspace', '--yes'],
'integrations': ['--auto', '--brain', '--dry-run', '--help', '--json', '--overwrite', '--refresh', '--source', '--target'],
'integrity': ['--accept-pending', '--as', '--auto', '--backend', '--background', '--body', '--brain', '--check', '--confidence', '--cost', '--dry-run', '--explain', '--follow', '--fresh', '--help', '--json', '--limit', '--no-accept-pending', '--progress-interval', '--progress-json', '--quiet', '--review-lower', '--skip-bare-tweet', '--skip-urls', '--source', '--timeout', '--timings', '--type', '--wait'],
diff --git a/src/core/persistence/graduation-inventory.ts b/src/core/persistence/graduation-inventory.ts
index a6c4d0f167..4d4eafc68c 100644
--- a/src/core/persistence/graduation-inventory.ts
+++ b/src/core/persistence/graduation-inventory.ts
@@ -169,6 +169,7 @@ export const GRADUATION_INVENTORY: Inventory = {
}),
carry('question_evidence', 'user_data', 'Per-sentence evidence pointers of pinned answers; without them every answer reads stale.'),
carry('raw_data', 'user_data', 'Raw source payloads per page.'),
+ carry('reason_purge_tombstones', 'user_data', 'Text-free (commit, path) pairs a purge found a change reason in; dropping them would let a later sync bring the purged reason back.'),
carry('retrieval_event_links', 'operational', 'Typed edges each recorded answer used; keeps recent answers rateable.'),
carry('retrieval_event_pages', 'operational', 'Pages and revisions each recorded answer used; keeps recent answers rateable.'),
carry('retrieval_events', 'operational', 'Recorded answers (answer_id, client, op) within the retention window.'),
diff --git a/test/access-qm-actor.test.ts b/test/access-qm-actor.test.ts
index dd58088d71..fbce874474 100644
--- a/test/access-qm-actor.test.ts
+++ b/test/access-qm-actor.test.ts
@@ -471,6 +471,7 @@ describe('serverInfo.description (GST-359 item 6)', () => {
expect(MCP_SERVER_DESCRIPTION.length).toBeLessThanOrEqual(120);
expect(MCP_SERVER_DESCRIPTION).toContain('gbrain');
expect(MCP_SERVER_DESCRIPTION).toContain('remember');
- expect(createHash('sha256').update(GBRAIN_MCP_INSTRUCTIONS).digest('hex')).toBe('4b6a1ea876614592681a2e63daf8e68046cbb238bf4b7399425f781311f27cb8');
+ // GBRA-219 (#7795): the memory_conversation_mode switch clause is the only change to the instructions since this pin.
+ expect(createHash('sha256').update(GBRAIN_MCP_INSTRUCTIONS).digest('hex')).toBe('5164ac196ce534a6fd981895b8566fa85c7c1567025096f47ba19678f934bf65');
});
});
diff --git a/test/cli-thin-client-refusal-matrix.test.ts b/test/cli-thin-client-refusal-matrix.test.ts
index e01471df68..960d244231 100644
--- a/test/cli-thin-client-refusal-matrix.test.ts
+++ b/test/cli-thin-client-refusal-matrix.test.ts
@@ -104,8 +104,8 @@ describe('A16b thin-client refusal matrix', () => {
routing = await run(ROUTING_ROWS);
}, 300_000);
- test('the matrix covers all 71 handleCliOnly cases', () => {
- expect(CASES.length).toBe(71);
+ test('the matrix covers all 74 handleCliOnly cases', () => {
+ expect(CASES.length).toBe(74); // GBRA-215: +3, ingest, ingest-show and ingest-undo (thinClient: refuse)
});
test('every handleCliOnly case, run bare on a thin client, matches the golden', () => {
diff --git a/test/fixtures/goldens/cli/thin-client-cases.json b/test/fixtures/goldens/cli/thin-client-cases.json
index 63c2a494ea..4ccfe538e6 100644
--- a/test/fixtures/goldens/cli/thin-client-cases.json
+++ b/test/fixtures/goldens/cli/thin-client-cases.json
@@ -717,6 +717,36 @@
],
"stdout": []
},
+ {
+ "argv": "ingest",
+ "exitCode": 1,
+ "stderr": [
+ "Error [requires_local_engine]: `gbrain ingest` requires a local engine. This install is a thin client of http://127.0.0.1:1/mcp.",
+ "Fix: gbrain ingest",
+ "Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"
+ ],
+ "stdout": []
+ },
+ {
+ "argv": "ingest-show",
+ "exitCode": 1,
+ "stderr": [
+ "Error [requires_local_engine]: `gbrain ingest-show` requires a local engine. This install is a thin client of http://127.0.0.1:1/mcp.",
+ "Fix: gbrain ingest-show",
+ "Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"
+ ],
+ "stdout": []
+ },
+ {
+ "argv": "ingest-undo",
+ "exitCode": 1,
+ "stderr": [
+ "Error [requires_local_engine]: `gbrain ingest-undo` requires a local engine. This install is a thin client of http://127.0.0.1:1/mcp.",
+ "Fix: gbrain ingest-undo",
+ "Docs: https://github.com/garrytan/gbrain/blob/master/docs/guides/error-codes.md#requires_local_engine"
+ ],
+ "stdout": []
+ },
{
"argv": "edge-proposals",
"exitCode": 1,
diff --git a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
index c0d91c3dfa..e40580260e 100644
--- a/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
+++ b/test/fixtures/goldens/doctor/hot-checks-postgres-json.json
@@ -1194,7 +1194,7 @@
{
"category": "ops",
"elapsed_ms": "<volatile>",
- "message": "RLS enabled on 171/171 public tables",
+ "message": "RLS enabled on 172/172 public tables",
"name": "rls",
"status": "ok"
},
@@ -1222,7 +1222,7 @@
{
"category": "meta",
"elapsed_ms": "<volatile>",
- "message": "All 171 table(s) the applied migrations create exist.",
+ "message": "All 172 table(s) the applied migrations create exist.",
"name": "schema_missing_tables",
"status": "ok"
},
@@ -6160,7 +6160,7 @@
{
"category": "ops",
"elapsed_ms": "<volatile>",
- "message": "RLS enabled on 171/171 public tables",
+ "message": "RLS enabled on 172/172 public tables",
"name": "rls",
"status": "ok"
},
@@ -6188,7 +6188,7 @@
{
"category": "meta",
"elapsed_ms": "<volatile>",
- "message": "All 171 table(s) the applied migrations create exist.",
+ "message": "All 172 table(s) the applied migrations create exist.",
"name": "schema_missing_tables",
"status": "ok"
},
diff --git a/test/graduation-inventory.test.ts b/test/graduation-inventory.test.ts
index 57238451b6..8989628686 100644
--- a/test/graduation-inventory.test.ts
+++ b/test/graduation-inventory.test.ts
@@ -60,7 +60,7 @@ describe('graduation inventory', () => {
expect(new Set(names).size).toBe(names.length);
const counts: Record<string, number> = {};
for (const e of GRADUATION_INVENTORY.entries) counts[e.class] = (counts[e.class] ?? 0) + 1;
- expect(counts).toEqual({ carry: 156, rebind: 2, rebuild: 3, discard: 9, schema_owned: 4 });
+ expect(counts).toEqual({ carry: 157, rebind: 2, rebuild: 3, discard: 9, schema_owned: 4 });
for (const e of GRADUATION_INVENTORY.entries) {
expect({ relation: e.relation, reason: e.reason.length > 5, present: e.engines.pglite || e.engines.postgres })
.toEqual({ relation: e.relation, reason: true, present: true });