Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
feat(doctor): day-zero and keyless honesty — info severity for capabilities off by choice (E2, E7)
garrytanef548e7f5aaf
diff --git a/src/commands/doctor/check-fix.ts b/src/commands/doctor/check-fix.tsindex 9bc3d0eaed..844233ab45 100644--- a/src/commands/doctor/check-fix.ts+++ b/src/commands/doctor/check-fix.ts@@ -10,7 +10,8 @@* report's transport (CLI `gbrain doctor --json`, MCP `run_doctor`).*/import { cliRenderContext, renderAction, type Action, type RenderContext, type RenderedAction } from '../../core/agent-output.ts';-import type { ReadinessEntry, ReadinessState } from '../../core/readiness.ts';+import { embeddingEnablement, type ReadinessEntry, type ReadinessState } from '../../core/readiness.ts';+import { loadConfig } from '../../core/config.ts';import { classifyPgAccessError } from '../../core/pg-access-classify.ts';import type { Check } from '../doctor.ts';@@ -62,6 +63,20 @@ export function infoCheck(name: string, message: string, state: ReadinessState,};}+/**+ * The one embedding-enable command (A7 `embeddingEnablement`: resolved+ * datastore, a keyed provider, pages and facts kept) for doctor checks on a+ * keyless brain. Undefined when there is no readable config.+ */+export function keylessEnablementFix(): Action | undefined {+ try {+ const cfg = loadConfig();+ return cfg ? embeddingEnablement(cfg) : undefined;+ } catch {+ return undefined;+ }+}+/** A readiness entry rendered as a doctor info check (keeps its why and enable fix). */export function readinessInfoCheck(name: string, entry: ReadinessEntry, message?: string): Check {return infoCheck(name, message ?? entry.why, entry.state, entry.fix);diff --git a/src/commands/doctor/checks/backup-coverage.ts b/src/commands/doctor/checks/backup-coverage.tsindex f212aee19d..7950ef6a5e 100644--- a/src/commands/doctor/checks/backup-coverage.ts+++ b/src/commands/doctor/checks/backup-coverage.ts@@ -9,7 +9,13 @@import type { BrainEngine } from '../../../core/engine.ts';import type { Check } from '../../doctor.ts';import { getBackupStatus } from '../../../core/backup/coverage.ts';+import type { Action } from '../../../core/agent-output.ts';+import { checkError, doctorVerify, infoCheck } from '../check-fix.ts';import {+ BACKUP_COACH_MIN_AGE_DAYS,+ BACKUP_COACH_MIN_ITEMS,+ assetBlocksRecovery,+ backupCoachingDue,blockingAssetReasons,backupCacheAge,backupCheckDisabled,@@ -35,6 +41,54 @@ function warnLead(assetClause: string | null, caveats: string[]): string {const LISTED_ASSET_CAP = 5;+/** Remote surface: the per-asset detail and fixes live on the brain host. */+function hostBackupCheck(): Action {+ return { argv: ['gbrain', 'backup', 'status'], consent: [], actor: 'host_admin', requires_exclusive: false,+ why: 'Lists each knowledge asset without verified recovery and its fix command; only the brain host can read it.',+ user_message: 'Please run `gbrain backup status` on the machine that hosts your brain to see which parts are not backed up.' };+}++/**+ * E7 per-asset wording: what each blocking asset's evidence can and cannot+ * restore. Repo evidence never covers DB-only pages, facts, config or credentials.+ */+function assetCoverageWording(s: BackupStatus): string {+ const kinds = new Set(s.assets.filter(assetBlocksRecovery).map((a) => a.kind));+ const parts: string[] = [];+ if (kinds.has('source_repo') || kinds.has('bootstrap_workspace')) {+ parts.push('A source repo with a pushed git remote restores its Markdown files only, never DB-only pages, facts, config or credentials.');+ }+ if (kinds.has('db_only') || kinds.has('db_content')) {+ parts.push('DB-only pages and facts live only in the database: an export or database backup is their only copy.');+ }+ return parts.length ? parts.join(' ') : 'Git evidence covers committed repository files only, not the full database.';+}++/**+ * The first blocking asset's fix as an Action. `not_a_git_repo` sources (for+ * example gbrain's own content directory) have no git remote to add, so their+ * fix is an export to a directory the user picks; db_only/db_content assets use+ * their own fix argv. `bootstrap repo` and pushes carry {credentials, egress}.+ */+function backupAssetFix(s: BackupStatus): Action | undefined {+ for (const a of s.assets.filter(assetBlocksRecovery)) {+ const argv = a.fix_argv ?? (a.kind === 'source_repo' && a.detail === 'not_a_git_repo'+ ? ['gbrain', 'export', '--source', a.id, '--dir', `<BACKUP_DIR>/${a.id}`] : null);+ if (!argv) continue;+ const filled = argv.map((x) => x.replace(/^BACKUP_DIR\//, '<BACKUP_DIR>/'));+ const egress = argv[1] === 'bootstrap' || (argv[1] === 'sources' && argv[2] === 'push');+ return {+ argv: filled, consent: egress ? ['credentials', 'egress'] : [], actor: 'agent', requires_exclusive: false,+ why: egress+ ? 'Creates a private GitHub repository for the brain and pushes to it (needs the user\'s GitHub credentials; content leaves this machine).'+ : `Writes a Markdown copy of '${a.id}' (pages and facts) to a directory outside the brain so it survives losing the database.`,+ ...(filled.some((x) => x.includes('<BACKUP_DIR>')) ? { inputs: [{ name: 'BACKUP_DIR', how: 'Ask the user where backups should live (a directory outside the brain, ideally synced or on another disk).' }] } : {}),+ verify: doctorVerify('backup_coverage'), docs: 'docs/operations/backup-check.md',+ };+ }+ return undefined;+}+function toCheck(s: BackupStatus, now?: number): Check {const details = {totals: s.totals,@@ -49,13 +103,22 @@ function toCheck(s: BackupStatus, now?: number): Check {const listed = unverified.slice(0, LISTED_ASSET_CAP).map((a) => `${a.id} (${a.reason})`).join(', ');const more = unverified.length > LISTED_ASSET_CAP ? `, and ${unverified.length - LISTED_ASSET_CAP} more` : '';const assetClause = unverified.length > 0 ? `${unverified.length} knowledge asset(s) lack verified recovery: ${listed}${more}.` : null;+ const fix = backupAssetFix(s);+ const message =+ `${warnLead(assetClause, verdictCaveats(s, now))} ${assetCoverageWording(s)} ` ++ 'Run `gbrain backup status` for each asset\'s fix command.';+ if (!backupCoachingDue(s, now)) {+ const m = s.maturity!;+ return infoCheck('backup_coverage',+ `Not urgent yet: the brain holds ${m.items} page(s)+fact(s) and is under ${BACKUP_COACH_MIN_AGE_DAYS} days old (backup coaching starts at ${BACKUP_COACH_MIN_ITEMS} items or ${BACKUP_COACH_MIN_AGE_DAYS} days). ${message}`,+ 'degraded', fix, details);+ }return {name: 'backup_coverage',status: 'warn',- message:- `${warnLead(assetClause, verdictCaveats(s, now))} Current recovery is not verified for all repositories. ` +- 'Run `gbrain backup status` for fix commands (`gbrain bootstrap repo` / `git remote add origin <url>` / `gbrain sources harden <id>`).',+ message,details,+ ...(fix ? { fix } : { fix_unavailable_reason: 'operator_judgement' as const }),};}return {@@ -88,6 +151,7 @@ export async function checkBackupCoverage(name: 'backup_coverage',status: 'warn',message: 'not checked from this surface — run `gbrain backup check` on the brain host',+ fix: hostBackupCheck(),};}const cached = currentBackupEvidence(raw, opts.now?.getTime());@@ -107,8 +171,14 @@ export async function checkBackupCoverage(const assetClause = unverifiedCount > 0? `${unverifiedCount} of ${cached.totals.assets} knowledge asset(s) lack verified recovery (${reasons}).`: null;+ if (cached.overall === 'warn' && !backupCoachingDue(cached, opts.now?.getTime())) {+ return infoCheck('backup_coverage',+ `Not urgent yet: the brain is under ${BACKUP_COACH_MIN_AGE_DAYS} days old with fewer than ${BACKUP_COACH_MIN_ITEMS} pages+facts. ${assetClause ?? ''}`.trim(),+ 'degraded', hostBackupCheck(), details);+ }return cached.overall === 'warn'? {+ fix: hostBackupCheck(),name: 'backup_coverage',status: 'warn',message:@@ -131,7 +201,7 @@ export async function checkBackupCoverage(...(opts.now ? { now: opts.now } : {}),});return toCheck(s, opts.now?.getTime());- } catch {- return { name: 'backup_coverage', status: 'warn', message: 'backup coverage unreadable' };+ } catch (e) {+ return checkError('backup_coverage', 'read backup coverage', e);}}diff --git a/src/commands/doctor/checks/consolidation-cycle.ts b/src/commands/doctor/checks/consolidation-cycle.tsindex e0b3d1d6f1..36da2b4e34 100644--- a/src/commands/doctor/checks/consolidation-cycle.ts+++ b/src/commands/doctor/checks/consolidation-cycle.ts@@ -7,6 +7,8 @@import type { BrainEngine } from '../../../core/engine.ts';import { resolveHoursEnv } from '../../../core/env-number.ts';import type { Check } from '../../doctor.ts';+import type { Action } from '../../../core/agent-output.ts';+import { agentFix, checkError, infoCheck } from '../check-fix.ts';/** Local alias; the shared warn-once memo lives in core so it can't fork per module. */const _resolveSyncFreshnessHours = resolveHoursEnv;@@ -164,12 +166,19 @@ export async function checkCycleFreshness(const issues: string[] = [];let hasWarnings = false;let hasFailures = false;+ const young = await youngOrEmptySources(engine, sources.map((s) => s.id), now);+ const waiting: string[] = [];+ let firstStale: string | null = null;for (const source of sources) {const display = source.name && source.name !== source.id? `'${source.id}' (${source.name})`: `'${source.id}'`;const raw = source.config?.last_full_cycle_at;+ if (typeof raw !== 'string' && young.has(source.id)) {+ waiting.push(display);+ continue;+ }if (typeof raw !== 'string') {// #2540: WARN, not FAIL. This check iterates EVERY local_path source,// so on a multi-source install where only some vaults are cycled@@ -182,6 +191,7 @@ export async function checkCycleFreshness(// through the warn/fail age thresholds below — that is the// regression signal this check exists for.issues.push(`Source ${display} has never completed a full cycle`);+ firstStale ??= source.id;hasWarnings = true;continue;}@@ -200,18 +210,22 @@ export async function checkCycleFreshness(const ageHours = Math.floor(ageMs / (1000 * 60 * 60));if (ageMs > failMs) {issues.push(`Source ${display} last cycled ${ageHours}h ago`);+ firstStale ??= source.id;hasFailures = true;} else if (ageMs > warnMs) {issues.push(`Source ${display} last cycled ${ageHours}h ago`);+ firstStale ??= source.id;hasWarnings = true;}}+ const fix = firstStale ? cycleFix(firstStale) : undefined;if (hasFailures) {return {name: 'cycle_freshness',status: 'fail',message: `${issues.join('; ')}. Run \`gbrain dream --source <id>\` for each stale source, or start \`gbrain autopilot\`.`,+ ...(fix ? { fix } : {}),};}if (hasWarnings) {@@ -219,19 +233,43 @@ export async function checkCycleFreshness(name: 'cycle_freshness',status: 'warn',message: `${issues.join('; ')}. Run \`gbrain dream --source <id>\` to cycle a source, or start \`gbrain autopilot\`.`,+ ...(fix ? { fix } : {}),};}+ if (waiting.length === sources.length) {+ return infoCheck('cycle_freshness',+ `No full cycle yet for ${waiting.join(', ')}: ${waiting.length > 1 ? 'they hold' : 'it holds'} no pages or only pages from the last 24h, so there is nothing to consolidate yet.`,+ 'not_applicable');+ }return {name: 'cycle_freshness',status: 'ok',message: `All ${sources.length} federated source(s) cycled recently`,};} catch (e) {- return {- name: 'cycle_freshness',- status: 'warn',- message: `Could not check cycle freshness: ${e instanceof Error ? e.message : String(e)}`,- };+ return checkError('cycle_freshness', 'check cycle freshness', e);}}+/**+ * E2: sources that have never cycled but hold no live pages, or only pages+ * created in the last 24h. Nothing is stale there yet, so doctor reports+ * them as information instead of a warning.+ */+async function youngOrEmptySources(engine: BrainEngine, ids: string[], now: number): Promise<Set<string>> {+ const out = new Set(ids);+ const rows = await engine.executeRaw<{ source_id: string; oldest: string | Date | null }>(+ `SELECT source_id, MIN(created_at) AS oldest FROM pages WHERE deleted_at IS NULL GROUP BY source_id`,+ );+ for (const r of rows) {+ const oldest = r.oldest ? new Date(r.oldest).getTime() : NaN;+ if (!Number.isFinite(oldest) || now - oldest >= 24 * 60 * 60 * 1000) out.delete(r.source_id);+ }+ return out;+}++function cycleFix(sourceId: string): Action {+ return agentFix(['gbrain', 'dream', '--source', sourceId], `Runs one full maintenance cycle for source '${sourceId}' (sync, extract, consolidate). Phases that call a chat model spend provider credits when keys are configured; \`gbrain autopilot --install\` keeps every source cycled.`, 'cycle_freshness',+ { consent: ['paid'], requires_exclusive: true });+}+diff --git a/src/commands/doctor/checks/embedding-health.ts b/src/commands/doctor/checks/embedding-health.tsindex 68d3ae959d..c292bb9232 100644--- a/src/commands/doctor/checks/embedding-health.ts+++ b/src/commands/doctor/checks/embedding-health.ts@@ -15,6 +15,8 @@ import { providerKeyShadows, providerKeySource } from '../../../core/ai/providerimport { credentialEnvName, keyShadowWarning } from '../../../core/ai/key-warnings.ts';import { getRecipe } from '../../../core/ai/recipes/index.ts';import type { Check } from '../../doctor.ts';+import { embeddingsDisabled } from '../../../core/embedding-disabled.ts';+import { infoCheck, keylessEnablementFix } from '../check-fix.ts';import { connectedEngine, type DoctorContext, type DoctorEntry } from '../context.ts';async function runEmbeddingProvider(ctx: DoctorContext): Promise<Check[]> {@@ -25,6 +27,10 @@ async function runEmbeddingProvider(ctx: DoctorContext): Promise<Check[]> {// 8b. Embedding provider eval — live smoke test of the configured provider.// Verifies: correct model, API key works, dimensions match config, DB column matches.progress.heartbeat('embedding_provider');+ if (await embeddingsDisabled(engine)) {+ checks.push(infoCheck('embedding_provider', 'Not probed: embeddings are disabled on this brain by choice (keyword search keeps working).', 'disabled_by_choice', keylessEnablementFix()));+ return checks;+ }try {const {getEmbeddingModel,diff --git a/src/commands/doctor/checks/schema-health.ts b/src/commands/doctor/checks/schema-health.tsindex 951cd48c20..e71648ed60 100644--- a/src/commands/doctor/checks/schema-health.ts+++ b/src/commands/doctor/checks/schema-health.ts@@ -20,6 +20,8 @@ import { checkPostgresCancellationDriver } from './postgres-cancellation.ts';import { checkProjectionReadiness } from './projection-readiness.ts';import type { Check } from '../../doctor.ts';import { connectedEngine, type DoctorContext, type DoctorEntry } from '../context.ts';+import { embeddingsDisabled } from '../../../core/embedding-disabled.ts';+import { infoCheck, keylessEnablementFix } from '../check-fix.ts';async function runPgvector(ctx: DoctorContext): Promise<Check[]> {const { progress } = ctx;@@ -331,8 +333,8 @@ async function runEmbeddings(ctx: DoctorContext): Promise<Check[]> {try {// A keyless brain has no embedding backlog to drain: recommending a paid// catch-up there would send the agent into a refusal.- if (loadConfig()?.embedding_disabled === true || await engine.getConfig('embedding_disabled') === 'true') {- checks.push({ name: 'embeddings', status: 'ok', message: 'Not applicable: embeddings are disabled on this brain (keyword search keeps working).' });+ if (await embeddingsDisabled(engine)) {+ checks.push(infoCheck('embeddings', 'Not applicable: embeddings are disabled on this brain (keyword search keeps working).', 'disabled_by_choice', keylessEnablementFix()));return checks;}const health = await engine.getHealth();diff --git a/src/commands/doctor/checks/vector-coverage.ts b/src/commands/doctor/checks/vector-coverage.tsindex b8ed8374c6..6d0a1c56e3 100644--- a/src/commands/doctor/checks/vector-coverage.ts+++ b/src/commands/doctor/checks/vector-coverage.ts@@ -13,6 +13,7 @@ import { AUDIT_ROW_SOURCES } from '../../../core/facts/audit-sources.ts';import { eligibleFactEmbedding, staleFactEmbedding } from '../../../core/facts/embedding-identity.ts';import { takesAutoEmbedEnabled } from '../../../core/embed-takes.ts';import type { Check } from '../../doctor.ts';+import { agentFix } from '../check-fix.ts';import { connectedEngine, type DoctorContext, type DoctorEntry } from '../context.ts';export const VECTOR_COVERAGE_DOCS = 'docs/GBRAIN_VERIFY.md#5a-fact-and-take-vectors';@@ -25,14 +26,15 @@ async function runFactTakeVectors(ctx: DoctorContext): Promise<Check[]> {ctx.progress.heartbeat('fact_take_vectors');if (loadConfig()?.embedding_disabled === true || await engine.getConfig('embedding_disabled') === 'true') {checks.push({ name: 'fact_take_vectors', status: 'ok', message: 'Not applicable: embeddings are disabled on this brain (keyword search keeps working).',- details: { applicable: false } });+ details: { applicable: false }, severity: 'info', readiness_state: 'disabled_by_choice' });return checks;}const model = await engine.getConfig('embedding_model');const dims = Number(await engine.getConfig('embedding_dimensions'));if (!model || !Number.isInteger(dims) || dims <= 0) {checks.push({ name: 'fact_take_vectors', status: 'warn', message: 'Fact and take vectors were not verified: the brain records no embedding model and width. Fix: gbrain migrate embeddings --status',- details: { code: 'vectors_not_verified', applicable: true, fix: 'gbrain migrate embeddings --status', docs: VECTOR_COVERAGE_DOCS } });+ details: { code: 'vectors_not_verified', applicable: true, fix: 'gbrain migrate embeddings --status', docs: VECTOR_COVERAGE_DOCS },+ fix: agentFix(['gbrain', 'migrate', 'embeddings', '--status'], 'Shows which embedding model and width this brain was built with, read-only.', 'fact_take_vectors', { docs: VECTOR_COVERAGE_DOCS }) });return checks;}try {@@ -74,11 +76,16 @@ async function runFactTakeVectors(ctx: DoctorContext): Promise<Check[]> {`Vector dedup, consolidation and semantic take search skip them. Fix: ${fix.join('; ')}`,details: { code: 'stale_vectors', applicable: true, model, dims, facts, takes, by_source: bySource,cause: 'facts and takes without a current-model vector', fix, docs: VECTOR_COVERAGE_DOCS },+ fix: factSources.length+ ? agentFix(['gbrain', 'embed', '--facts', '--stale', '--source', factSources[0], '--dry-run', '--json'],+ `Previews the fact re-embed for source '${factSources[0]}' (count and cost) without calling the provider; run it without --dry-run once the user approves the spend.`, 'fact_take_vectors', { docs: VECTOR_COVERAGE_DOCS })+ : agentFix(takesFix.split(' '), 'Embeds the takes that have no current-model vector; this calls the embedding provider.', 'fact_take_vectors', { consent: ['paid'], docs: VECTOR_COVERAGE_DOCS }),});} catch (err) {checks.push({ name: 'fact_take_vectors', status: 'warn',message: `Fact and take vectors were not verified: ${err instanceof Error ? err.message : String(err)}. Fix: gbrain migrate embeddings --status`,- details: { code: 'vectors_not_verified', applicable: true, fix: 'gbrain migrate embeddings --status', docs: VECTOR_COVERAGE_DOCS } });+ details: { code: 'vectors_not_verified', applicable: true, fix: 'gbrain migrate embeddings --status', docs: VECTOR_COVERAGE_DOCS },+ fix: agentFix(['gbrain', 'migrate', 'embeddings', '--status'], 'Shows which embedding model and width this brain was built with, read-only.', 'fact_take_vectors', { docs: VECTOR_COVERAGE_DOCS }) });}return checks;}diff --git a/src/commands/doctor/checks/verbs-reflex.ts b/src/commands/doctor/checks/verbs-reflex.tsindex fb8ab8493b..c090a2e648 100644--- a/src/commands/doctor/checks/verbs-reflex.ts+++ b/src/commands/doctor/checks/verbs-reflex.ts@@ -10,6 +10,8 @@ import { gbrainPath, loadConfig } from '../../../core/config.ts';import { reflexEnabled } from '../../../core/context/reflex.ts';import { resolveSocketPath } from '../../../core/context/resolve-ipc.ts';import type { Check } from '../../doctor.ts';+import { configReadiness } from '../../../core/readiness.ts';+import { checkError } from '../check-fix.ts';/*** Retrieval Reflex health (#1981). Read-only, fail-open. The deterministic@@ -65,6 +67,16 @@ export async function buildMemoryVerbsCheck(): Promise<Check> {}}+/**+ * E2: no `gbrain serve` running is the normal state before an agent harness is+ * wired, not a fault. Info, with the harness-wiring fix (which is what starts+ * a serve) when one applies.+ */+function noServeInfo(cfg: ReturnType<typeof loadConfig>): Pick<Check, 'severity' | 'readiness_state' | 'fix'> {+ const wiring = cfg ? configReadiness(cfg, { transport: 'cli' }).entries.find((e) => e.capability === 'harness_wiring') : undefined;+ return { severity: 'info', readiness_state: 'not_applicable', ...(wiring?.fix ? { fix: wiring.fix } : {}) };+}+export function buildRetrievalReflexCheck(skillsDir: string | null): Check {const name = 'retrieval_reflex_health';try {@@ -123,10 +135,12 @@ export function buildRetrievalReflexCheck(skillsDir: string | null): Check {const skillHint = skillInstalled? '': ' — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`';+ const noServe = status === 'warn' && engineKind === 'pglite';return {name,- status,+ status: noServe ? 'ok' : status,message: `${pathDesc}; ${runtimeMsg}${skillHint}`,+ ...(noServe ? noServeInfo(cfg) : {}),details: {enabled: true,engine: engineKind,@@ -137,7 +151,7 @@ export function buildRetrievalReflexCheck(skillsDir: string | null): Check {},};} catch (e) {- return { name, status: 'warn', message: `could not check: ${(e as Error).message}` };+ return checkError(name, 'check the retrieval reflex', e);}}diff --git a/src/commands/doctor/skill-checks.ts b/src/commands/doctor/skill-checks.tsindex 7e1c3f58e6..1dbcbf4f97 100644--- a/src/commands/doctor/skill-checks.ts+++ b/src/commands/doctor/skill-checks.ts@@ -29,6 +29,7 @@ import {appendAuditEventsForTransitions,} from '../../core/audit-skill-brain-first.ts';import type { Check } from '../doctor.ts';+import { infoCheck } from './check-fix.ts';/** Quick skill conformance check — frontmatter + required sections */export function skillConformanceCheck(skillsDir: string): Check {@@ -291,9 +292,15 @@ export async function skillPreconditionsCheck(if (unmet.length === 0) {return { name, status: 'ok', message: `${installed.length} skill(s) with preconditions, all met` };}+ if (await ctx.countPages() === 0) {+ return infoCheck(name,+ `${unmet.length} skill precondition(s) wait for content: the brain has no pages yet, so skills that need a corpus stay idle until the first import or sync.`,+ 'not_applicable', undefined, { unmet: unmet.slice(0, 8) });+ }return {name,status: 'warn',+ fix_unavailable_reason: 'operator_judgement',message:`${unmet.length} unmet skill precondition(s):\n ` +unmet.slice(0, 8).join('\n ') +diff --git a/src/commands/features.ts b/src/commands/features.tsindex 4c65d2fc7c..084a55ce07 100644--- a/src/commands/features.ts+++ b/src/commands/features.ts@@ -10,6 +10,7 @@ import { join } from 'path';import type { BrainEngine } from '../core/engine.ts';import { heartbeatPath } from './integrations.ts';import { VERSION } from '../version.ts';+import { embeddingsDisabled } from '../core/embedding-disabled.ts';// --- Types ---@@ -116,9 +117,10 @@ export async function scanFeatures(engine: BrainEngine): Promise<FeatureScanResuconst stats = await engine.getStats();const health = await engine.getHealth();const recommendations: FeatureRecommendation[] = [];+ const keyless = await embeddingsDisabled(engine);- // P1: Missing embeddings- if (health.missing_embeddings > 0) {+ // P1: Missing embeddings (never on a keyless-by-choice brain: E2)+ if (health.missing_embeddings > 0 && !keyless) {recommendations.push({id: 'missing-embeddings', priority: 1,title: 'Fix Missing Embeddings',@@ -164,7 +166,7 @@ export async function scanFeatures(engine: BrainEngine): Promise<FeatureScanResu}// Low embed coverage- if (health.embed_coverage < 0.9 && health.embed_coverage > 0) {+ if (health.embed_coverage < 0.9 && health.embed_coverage > 0 && !keyless) {const pct = (health.embed_coverage * 100).toFixed(0);recommendations.push({id: 'low-coverage', priority: 2,@@ -344,7 +346,7 @@ export async function featuresTeaserForDoctor(engine: BrainEngine): Promise<stritry {const health = await engine.getHealth();const parts: string[] = [];- if (health.missing_embeddings > 0) parts.push(`${health.missing_embeddings} missing embeddings`);+ if (health.missing_embeddings > 0 && !await embeddingsDisabled(engine)) parts.push(`${health.missing_embeddings} missing embeddings`);if (health.dead_links > 0) parts.push(`${health.dead_links} dead links`);if (parts.length === 0) return null;return `Tip: ${parts.join(', ')}. Run 'gbrain features' to fix.`;diff --git a/src/core/backup/coverage.ts b/src/core/backup/coverage.tsindex e5db14d2c4..0880d10b86 100644--- a/src/core/backup/coverage.ts+++ b/src/core/backup/coverage.ts@@ -37,6 +37,7 @@ import {saveBackupStatus,currentBackupEvidence,isVerifiedRecoverable,+ assetBlocksRecovery,BACKUP_VERIFICATION_MAX_AGE_MS,BACKUP_RECOVERY_SCOPE,type BackupAssetVerdict,@@ -102,6 +103,23 @@ function yieldLoop(): Promise<void> {}/** null = the count could not be established (engine down / schema quirk). */+/** E7: live pages + active facts, and the brain's first source/page timestamp. Null when unreadable. */+async function brainMaturity(engine: BrainEngine): Promise<BackupStatus['maturity'] | undefined> {+ try {+ const [row] = await engine.executeRaw<{ pages: number; facts: number; since: string | Date | null }>(+ `SELECT (SELECT COUNT(*)::int FROM pages WHERE deleted_at IS NULL) AS pages,+ (SELECT COUNT(*)::int FROM facts WHERE expired_at IS NULL) AS facts,+ LEAST((SELECT MIN(created_at) FROM sources), (SELECT MIN(created_at) FROM pages)) AS since`,+ );+ const items = Number(row?.pages) + Number(row?.facts);+ if (!row || !Number.isFinite(items)) return undefined;+ const sinceMs = row.since ? new Date(row.since).getTime() : NaN;+ return { items, since: Number.isFinite(sinceMs) ? new Date(sinceMs).toISOString() : null };+ } catch {+ return undefined;+ }+}+async function countLivePages(engine: BrainEngine): Promise<number | null> {try {const rows = await engine.executeRaw<{ n: number }>(@@ -372,6 +390,7 @@ export async function computeBackupCoverage(recoverable_repos: assets.filter(isVerifiedRecoverable).length,pages_at_risk: pagesAtRisk,};+ const maturity = assets.some(assetBlocksRecovery) ? await brainMaturity(engine) : undefined;return currentBackupEvidence({schema_version: BACKUP_STATUS_SCHEMA_VERSION,@@ -385,6 +404,7 @@ export async function computeBackupCoverage(...(degraded ? { degraded: true } : {}),...(remoteBudget ? { remote_check_at: now.toISOString() } : {}),recovery_scope: BACKUP_RECOVERY_SCOPE,+ ...(maturity ? { maturity } : {}),}, now.getTime());}diff --git a/src/core/backup/status-file.ts b/src/core/backup/status-file.tsindex d1a9d33135..f18582ed70 100644--- a/src/core/backup/status-file.ts+++ b/src/core/backup/status-file.ts@@ -109,6 +109,26 @@ export interface BackupStatus {degraded?: boolean;remote_check_at?: string;recovery_scope?: string;+ /**+ * E7: how much the brain holds and since when, measured with the verdict.+ * Backup coaching (doctor warn, MCP notice, CLI rail) waits until the brain+ * holds >= BACKUP_COACH_MIN_ITEMS pages+facts or is >= BACKUP_COACH_MIN_AGE_DAYS+ * old; before that doctor reports `severity: 'info'`. Absent on old caches+ * (treated as mature, the pre-E7 behaviour).+ */+ maturity?: { items: number; since: string | null };+}++export const BACKUP_COACH_MIN_ITEMS = 25;+export const BACKUP_COACH_MIN_AGE_DAYS = 7;++/** E7: is the brain old or full enough that a missing backup is worth coaching about? */+export function backupCoachingDue(s: Pick<BackupStatus, 'maturity'>, now: number = Date.now()): boolean {+ const m = s.maturity;+ if (!m) return true;+ if (m.items >= BACKUP_COACH_MIN_ITEMS) return true;+ const since = m.since ? Date.parse(m.since) : NaN;+ return Number.isFinite(since) && now - since >= BACKUP_COACH_MIN_AGE_DAYS * 24 * 60 * 60 * 1000;}export const BACKUP_VERIFICATION_MAX_AGE_MS = 60 * 60 * 1000;@@ -471,7 +491,7 @@ const NOOP_DECISION: BackupNagDecision = { show: false, record: () => {} };*/export function backupNagGate(channel: string, s: BackupStatus, now: number = Date.now()): BackupNagDecision {try {- if (s.overall !== 'warn' || backupCheckDisabled()) return NOOP_DECISION;+ if (s.overall !== 'warn' || backupCheckDisabled() || !backupCoachingDue(s, now)) return NOOP_DECISION;const state = loadBackupNagState();const nowIso = new Date(now).toISOString();const month = monthBucket(nowIso);diff --git a/src/core/brain-score-recommendations.ts b/src/core/brain-score-recommendations.tsindex fe84a5b0ad..42076c4cf4 100644--- a/src/core/brain-score-recommendations.ts+++ b/src/core/brain-score-recommendations.ts@@ -154,6 +154,12 @@ export interface RecommendationContext {* needed. Compute via `embeddingProviderConfigured()`.*/embeddingProviderConfigured?: boolean;+ /**+ * E2: embeddings are off by choice (`init --no-embedding`). No embed step is+ * planned and `missing_embeddings` classifies as `human_only` with the+ * enable reason, never as a remediable or blocked gap.+ */+ embeddingsDisabled?: boolean;/** Configured chat / synthesis model id. */chatModel?: string;/** Whether the chat provider has a usable API key. */@@ -224,7 +230,7 @@ export function computeRecommendations(// wrong in) vector search.// ---------------------------------------------------------------------const nullSigCohort = ctx.nullSignatureCohort ?? 0;- if ((health.missing_embeddings > 0 || nullSigCohort > 0) && ctx.embeddingProviderConfigured !== false) {+ if ((health.missing_embeddings > 0 || nullSigCohort > 0) && ctx.embeddingProviderConfigured !== false && !ctx.embeddingsDisabled) {const params = {stale: true,sourceId: ctx.sourceId,@@ -355,6 +361,9 @@ function classifyOne(check: Check, ctx: RecommendationContext): CheckClassificat}return { check: check.name, status: 'remediable' };case 'missing_embeddings':+ if (ctx.embeddingsDisabled) {+ return { check: check.name, status: 'human_only', reason: 'embeddings disabled by choice (keyless brain); enabling them is the user\'s decision' };+ }if (ctx.embeddingProviderConfigured === false) {return { check: check.name, status: 'blocked', reason: 'embedding provider not configured' };}diff --git a/src/core/embedding-disabled.ts b/src/core/embedding-disabled.tsnew file mode 100644index 0000000000..65ca22088c--- /dev/null+++ b/src/core/embedding-disabled.ts@@ -0,0 +1,19 @@+/**+ * Is this brain keyless by choice (`init --no-embedding`)? One predicate for+ * every consumer that must stop recommending embedding work on such a brain+ * (doctor, onboard, features, jobs): the file-plane `embedding_disabled`+ * sentinel, or the DB-plane row init also writes. Never throws.+ */+import { loadConfig } from './config.ts';++export async function embeddingsDisabled(engine?: { getConfig(key: string): Promise<string | null> } | null): Promise<boolean> {+ try {+ if (loadConfig()?.embedding_disabled === true) return true;+ } catch { /* unreadable config: fall through to the DB plane */ }+ if (!engine) return false;+ try {+ return (await engine.getConfig('embedding_disabled')) === 'true';+ } catch {+ return false;+ }+}diff --git a/src/core/onboard/checks.ts b/src/core/onboard/checks.tsindex 014bb6fafe..04ed6e3182 100644--- a/src/core/onboard/checks.ts+++ b/src/core/onboard/checks.ts@@ -20,6 +20,10 @@ import type { BrainEngine } from '../engine.ts';import type { RemediationStep } from '../remediation-step.ts';import { makeRemediationStep } from '../remediation-step.ts';import { QUARANTINE_FILTER_FRAGMENT } from '../quarantine.ts';+import type { Action } from '../agent-output.ts';+import { embeddingEnablement, type ReadinessState } from '../readiness.ts';+import { embeddingsDisabled } from '../embedding-disabled.ts';+import { loadConfig } from '../config.ts';/** Shared shape returned by all four checks. */export interface OnboardCheckResult {@@ -28,6 +32,10 @@ export interface OnboardCheckResult {status: 'ok' | 'warn' | 'fail';message: string;details?: Record<string, unknown>;+ /** Agent contract v1 (doctor E1/E2): see src/commands/doctor/check-fix.ts. */+ fix?: Action;+ severity?: 'info';+ readiness_state?: ReadinessState;};remediations: RemediationStep[];}@@ -130,6 +138,17 @@ function coverageWithConfidence(sample: EntityCoverageSample): { coverage: numbeexport async function checkEmbedStaleness(engine: BrainEngine,): Promise<OnboardCheckResult> {+ if (await embeddingsDisabled(engine)) {+ const cfg = loadConfig();+ return {+ check: {+ name: 'embed_staleness', status: 'ok', severity: 'info', readiness_state: 'disabled_by_choice',+ message: 'Not applicable: embeddings are disabled on this brain by choice, so chunks have no vectors by design (keyword search keeps working).',+ ...(cfg ? { fix: embeddingEnablement(cfg) } : {}),+ },+ remediations: [],+ };+ }let staleCount: number;try {staleCount = await engine.countStaleChunks();@@ -443,7 +462,19 @@ export async function checkTakesCount(status: 'remediable',}));} else {- message = '0 takes (takes.bootstrap_enabled is false; opt in to enable)';+ return {+ check: {+ name: 'takes_count', status: 'ok', severity: 'info', readiness_state: 'disabled_by_choice',+ message: '0 takes (takes.bootstrap_enabled is false; opt in to enable)',+ fix: {+ argv: ['gbrain', 'config', 'set', 'takes.bootstrap_enabled', 'true'], consent: ['paid'], actor: 'agent', requires_exclusive: false,+ why: 'Takes (typed claims) are opt-in. Enabling the bootstrap lets maintenance extract them from existing pages with a chat model (about $5 on a typical brain), which feeds calibration.',+ user_message: 'gbrain can extract typed claims ("takes") from your pages so it can track calibration over time. It uses a paid chat model (roughly $5 once). Turn it on?',+ verify: { argv: ['gbrain', 'doctor', '--only', 'takes_count', '--json'] },+ },+ },+ remediations,+ };}} else {message = `${takesCount} takes (calibration usable; >100 ideal)`;diff --git a/src/core/remediation/context.ts b/src/core/remediation/context.tsindex 7198b67408..ec94702a90 100644--- a/src/core/remediation/context.ts+++ b/src/core/remediation/context.ts@@ -8,6 +8,7 @@import type { BrainEngine } from '../engine.ts';import type { RecommendationContext } from '../brain-score-recommendations.ts';+import { embeddingsDisabled } from '../embedding-disabled.ts';// Re-export so consumers can `import { RecommendationContext } from '../remediation'`// — the canonical RecommendationContext type still lives in@@ -32,6 +33,23 @@ export async function staleExtractionBlocked(engine: BrainEngine, sourceId?: strreturn undefined;}+/**+ * E3: the repo the plan can act on when `sync.repo_path` is unset — the+ * `default` source's local path, else the first non-archived source with one+ * (multi-source brains record paths per source, not in `sync.repo_path`).+ */+export async function firstSourceLocalPath(engine: BrainEngine): Promise<string | null> {+ try {+ const rows = await engine.executeRaw<{ local_path: string }>(+ `SELECT local_path FROM sources WHERE NOT archived AND local_path IS NOT NULL AND local_path <> ''+ ORDER BY (id = 'default') DESC, id LIMIT 1`,+ );+ return rows[0]?.local_path ?? null;+ } catch {+ return null;+ }+}+/*** Build RecommendationContext from engine + config. Pure read; no* side effects. Used by computeRemediationPlan, runRemediation, and@@ -40,7 +58,7 @@ export async function staleExtractionBlocked(engine: BrainEngine, sourceId?: strexport async function loadRecommendationContext(engine: BrainEngine,): Promise<RecommendationContext> {- const repoPath = await engine.getConfig('sync.repo_path');+ const repoPath = (await engine.getConfig('sync.repo_path')) ?? await firstSourceLocalPath(engine);let embeddingModel: string | undefined;let embeddingDimensions: number | undefined;try {@@ -87,6 +105,7 @@ export async function loadRecommendationContext(embeddingModel,embeddingDimensions,embeddingProviderConfigured: embeddingConfigured,+ embeddingsDisabled: await embeddingsDisabled(engine),// #3944: shared env+file-plane probe (same helper as autopilot's// dispatch loop, so the two planners can never disagree on this).hasChatApiKey: chatApiKeyConfigured(fileCfg),diff --git a/test/doctor-backup-coverage.serial.test.ts b/test/doctor-backup-coverage.serial.test.tsindex cebb7a9a5e..61cd24ab82 100644--- a/test/doctor-backup-coverage.serial.test.ts+++ b/test/doctor-backup-coverage.serial.test.ts@@ -365,10 +365,13 @@ describe('checkBackupCoverage — localOnly catch branch', () => {now: new Date('not-a-date'),});+ // E1: the generic unreadable warn goes through checkError — the error+ // detail is kept and the check says why it carries no fix.expect(check).toEqual({name: 'backup_coverage',status: 'warn',- message: 'backup coverage unreadable',+ message: 'Could not read backup coverage: Invalid Date',+ fix_unavailable_reason: 'check_errored',});// The failed compute never persisted anything (no clobber, no cache).expect(existsSync(statusFile)).toBe(false);diff --git a/test/doctor-cycle-freshness.test.ts b/test/doctor-cycle-freshness.test.tsindex de6813fd10..54dd70de80 100644--- a/test/doctor-cycle-freshness.test.ts+++ b/test/doctor-cycle-freshness.test.ts@@ -29,7 +29,12 @@ beforeEach(async () => {const NOW = Date.parse('2026-05-22T12:00:00.000Z');const agoH = (h: number) => new Date(NOW - h * 3600_000).toISOString();-async function seed(id: string, lastFullCycleAt?: string, opts: { local_path?: string | null; syncEnabled?: boolean } = {}): Promise<void> {+/**+ * A source row. Never-cycled sources get one page created 30 days before NOW+ * (content that should have been cycled) unless `pageAgeH` says otherwise+ * (`null` = no pages: an empty source, which E2 reports as information).+ */+async function seed(id: string, lastFullCycleAt?: string, opts: { local_path?: string | null; syncEnabled?: boolean; pageAgeH?: number | null } = {}): Promise<void> {const config = JSON.stringify({ last_full_cycle_at: lastFullCycleAt, syncEnabled: opts.syncEnabled });const localPath = opts.local_path === undefined ? `/tmp/${id}` : opts.local_path;await engine.executeRaw(@@ -38,6 +43,13 @@ async function seed(id: string, lastFullCycleAt?: string, opts: { local_path?: sON CONFLICT (id) DO UPDATE SET local_path = EXCLUDED.local_path, config = EXCLUDED.config`,[id, id, localPath, config],);+ const pageAgeH = opts.pageAgeH === undefined ? (lastFullCycleAt === undefined ? 24 * 30 : null) : opts.pageAgeH;+ if (pageAgeH !== null) {+ await engine.executeRaw(+ `INSERT INTO pages (source_id, slug, type, title, created_at) VALUES ($1, $2, 'note', $2, $3::timestamptz)`,+ [id, `${id}-page`, agoH(pageAgeH)],+ );+ }}describe('doctor checkCycleFreshness', () => {@@ -91,6 +103,32 @@ describe('doctor checkCycleFreshness', () => {expect(result.message).toMatch(/gbrain dream --source/);});+ test('E2: a never-cycled source with no pages is information, not a warning', async () => {+ await engine.executeRaw(`UPDATE sources SET local_path = NULL WHERE id = 'default'`);+ await seed('empty-vault', undefined, { pageAgeH: null });+ const result = await checkCycleFreshness(engine, { nowMs: NOW });+ expect(result.status).toBe('ok');+ expect(result.severity).toBe('info');+ expect(result.readiness_state).toBe('not_applicable');+ expect(result.message).toMatch(/empty-vault/);+ });++ test('E2: a never-cycled source whose pages are all under 24h old is information', async () => {+ await engine.executeRaw(`UPDATE sources SET local_path = NULL WHERE id = 'default'`);+ await seed('new-vault', undefined, { pageAgeH: 2 });+ const result = await checkCycleFreshness(engine, { nowMs: NOW });+ expect(result.status).toBe('ok');+ expect(result.severity).toBe('info');+ });++ test('E2: a never-cycled source with old pages still warns, with a dream fix that asks first', async () => {+ await engine.executeRaw(`UPDATE sources SET local_path = NULL WHERE id = 'default'`);+ await seed('old-vault');+ const result = await checkCycleFreshness(engine, { nowMs: NOW });+ expect(result.status).toBe('warn');+ expect(result.fix).toMatchObject({ argv: ['gbrain', 'dream', '--source', 'old-vault'], consent: ['paid'], actor: 'agent' });+ });+test('reporter case (#2540): one cycled vault + never-cycled siblings is warn, not permanent fail', async () => {await engine.executeRaw(`UPDATE sources SET local_path = NULL WHERE id = 'default'`);await seed('nightly-vault', agoH(2)); // the one vault dreamt via --dirdiff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex cc83e005d6..1568cdc9fd 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -8,12 +8,12 @@],"exit_code": 0,"report": {- "brain_checks_score": 80,+ "brain_checks_score": 90,"category_scores": {- "brain": 80,+ "brain": 90,"meta": 100,- "ops": 95,- "skill": 90+ "ops": 100,+ "skill": 95},"checks": [{@@ -32,10 +32,22 @@"path": "pglite — serve IPC socket not present","policy_skill_installed": false},- "fix_unavailable_reason": "unstructured",+ "fix": {+ "actor": "user",+ "consent": [+ "persistent_install"+ ],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/protocol/MEMORY_VERBS_v1.md#install-the-4-command-quickstart",+ "next": "report",+ "requires_exclusive": false,+ "user_message": "Which agent app should get gbrain memory? The install guide has a one-line command for each.",+ "why": "Register `<absolute path to gbrain> serve --surface verbs` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw)."+ },"message": "pglite — serve IPC socket not present; enabled but NO resolve path exists right now: the IPC socket is only bound by a running `gbrain serve` (stdio or --http) — until one is up, hooks/reflex degrade to no_serve on this brain (host capability may still supply pointers; policy skill carries otherwise) — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`","name": "retrieval_reflex_health",- "status": "warn"+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"},{"category": "skill",@@ -1047,10 +1059,43 @@"unpushed": 0}},- "fix_unavailable_reason": "unstructured",- "message": "1 knowledge asset(s) lack verified recovery: default (not_a_git_repo). Current recovery is not verified for all repositories. Run `gbrain backup status` for fix commands (`gbrain bootstrap repo` / `git remote add origin <url>` / `gbrain sources harden <id>`).",+ "fix": {+ "actor": "agent",+ "argv": [+ "gbrain",+ "export",+ "--source",+ "default",+ "--dir",+ "<BACKUP_DIR>/default"+ ],+ "command": "gbrain export --source default --dir '<BACKUP_DIR>/default'",+ "consent": [],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/operations/backup-check.md",+ "inputs": [+ {+ "how": "Ask the user where backups should live (a directory outside the brain, ideally synced or on another disk).",+ "name": "BACKUP_DIR"+ }+ ],+ "next": "run",+ "requires_exclusive": false,+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "backup_coverage",+ "--json"+ ]+ },+ "why": "Writes a Markdown copy of 'default' (pages and facts) to a directory outside the brain so it survives losing the database."+ },+ "message": "Not urgent yet: the brain holds 0 page(s)+fact(s) and is under 7 days old (backup coaching starts at 25 items or 7 days). 1 knowledge asset(s) lack verified recovery: default (not_a_git_repo). A source repo with a pushed git remote restores its Markdown files only, never DB-only pages, facts, config or credentials. Run `gbrain backup status` for each asset's fix command.","name": "backup_coverage",- "status": "warn"+ "readiness_state": "degraded",+ "severity": "info",+ "status": "ok"},{"category": "ops",@@ -1066,10 +1111,11 @@},{"category": "brain",- "fix_unavailable_reason": "unstructured",- "message": "Source 'default' has never completed a full cycle. Run `gbrain dream --source <id>` to cycle a source, or start `gbrain autopilot`.",+ "message": "No full cycle yet for 'default': it holds no pages or only pages from the last 24h, so there is nothing to consolidate yet.","name": "cycle_freshness",- "status": "warn"+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"},{"category": "brain",@@ -1367,10 +1413,38 @@},{"category": "brain",- "fix_unavailable_reason": "unstructured",+ "fix": {+ "actor": "agent",+ "argv": [+ "gbrain",+ "config",+ "set",+ "takes.bootstrap_enabled",+ "true"+ ],+ "command": "gbrain config set takes.bootstrap_enabled true",+ "consent": [+ "paid"+ ],+ "next": "ask_user",+ "requires_exclusive": false,+ "user_message": "gbrain can extract typed claims (\"takes\") from your pages so it can track calibration over time. It uses a paid chat model (roughly $5 once). Turn it on?",+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "takes_count",+ "--json"+ ]+ },+ "why": "Takes (typed claims) are opt-in. Enabling the bootstrap lets maintenance extract them from existing pages with a chat model (about $5 on a typical brain), which feeds calibration."+ },"message": "0 takes (takes.bootstrap_enabled is false; opt in to enable)","name": "takes_count",- "status": "warn"+ "readiness_state": "disabled_by_choice",+ "severity": "info",+ "status": "ok"},{"category": "meta",@@ -1393,22 +1467,10 @@],"db_url_source": null,"engine": "pglite",- "health_score": 65,+ "health_score": 85,"schema_version": 2,"status": "warnings","top_issues": [- {- "fix": "1 knowledge asset(s) lack verified recovery: default (not_a_git_repo). Current recovery is not verified for all repositories. Run `gbrain backup status` for fix commands (`gbrain bootstrap repo` / `git remote add origin <url>` / `gbrain sources harden <id>`).",- "name": "backup_coverage",- "status": "warn",- "tier": "symptom"- },- {- "fix": "Source 'default' has never completed a full cycle. Run `gbrain dream --source <id>` to cycle a source, or start `gbrain autopilot`.",- "name": "cycle_freshness",- "status": "warn",- "tier": "symptom"- },{"fix": "embedding: declared dims=3072 but actual is vector(1024). Fix one side: update config OR ALTER TABLE content_chunks ALTER COLUMN embedding TYPE vector(3072);","name": "embedding_column_registry",@@ -1421,23 +1483,11 @@"status": "warn","tier": "symptom"},- {- "fix": "pglite — serve IPC socket not present; enabled but NO resolve path exists right now: the IPC socket is only bound by a running `gbrain serve` (stdio or --http) — until one is up, hooks/reflex degrade to no_serve on this brain (host capability may still supply pointers; policy skill carries otherwise) — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`",- "name": "retrieval_reflex_health",- "status": "warn",- "tier": "symptom"- },{"fix": "64 new built-in skill(s) available that this workspace hasn't installed: academic-verify, archive-crawler, article-enrichment, ask-user, blog-ingest, book-mirror, brain-ingest-gate, brain-link-discipline, … +56 more. Add them with `gbrain skillpack sync`.","name": "skill_currency","status": "warn","tier": "symptom"- },- {- "fix": "0 takes (takes.bootstrap_enabled is false; opt in to enable)",- "name": "takes_count",- "status": "warn",- "tier": "symptom"}]},diff --git a/test/fixtures/goldens/doctor/json-pglite-fast.json b/test/fixtures/goldens/doctor/json-pglite-fast.jsonindex c38816b62b..2b8004080e 100644--- a/test/fixtures/goldens/doctor/json-pglite-fast.json+++ b/test/fixtures/goldens/doctor/json-pglite-fast.json@@ -14,7 +14,7 @@"brain": 100,"meta": 100,"ops": 95,- "skill": 90+ "skill": 95},"checks": [{@@ -33,10 +33,22 @@"path": "pglite — serve IPC socket not present","policy_skill_installed": false},- "fix_unavailable_reason": "unstructured",+ "fix": {+ "actor": "user",+ "consent": [+ "persistent_install"+ ],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/protocol/MEMORY_VERBS_v1.md#install-the-4-command-quickstart",+ "next": "report",+ "requires_exclusive": false,+ "user_message": "Which agent app should get gbrain memory? The install guide has a one-line command for each.",+ "why": "Register `<absolute path to gbrain> serve --surface verbs` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw)."+ },"message": "pglite — serve IPC socket not present; enabled but NO resolve path exists right now: the IPC socket is only bound by a running `gbrain serve` (stdio or --http) — until one is up, hooks/reflex degrade to no_serve on this brain (host capability may still supply pointers; policy skill carries otherwise) — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`","name": "retrieval_reflex_health",- "status": "warn"+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"},{"category": "skill",@@ -265,7 +277,7 @@}],"db_url_source": "config-file-path",- "health_score": 85,+ "health_score": 90,"schema_version": 2,"status": "warnings","top_issues": [@@ -275,12 +287,6 @@"status": "warn","tier": "root"},- {- "fix": "pglite — serve IPC socket not present; enabled but NO resolve path exists right now: the IPC socket is only bound by a running `gbrain serve` (stdio or --http) — until one is up, hooks/reflex degrade to no_serve on this brain (host capability may still supply pointers; policy skill carries otherwise) — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`",- "name": "retrieval_reflex_health",- "status": "warn",- "tier": "symptom"- },{"fix": "64 new built-in skill(s) available that this workspace hasn't installed: academic-verify, archive-crawler, article-enrichment, ask-user, blog-ingest, book-mirror, brain-ingest-gate, brain-link-discipline, … +56 more. Add them with `gbrain skillpack sync`.","name": "skill_currency",diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex df74171387..60480c5c5a 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -8,12 +8,15 @@],"exit_code": 0,"report": {- "brain_checks_score": 85,+ "brain_checks_score": 100,+ "capped_by": [+ "embeddings_disabled"+ ],"category_scores": {- "brain": 85,+ "brain": 100,"meta": 100,- "ops": 95,- "skill": 90+ "ops": 100,+ "skill": 95},"checks": [{@@ -32,10 +35,22 @@"path": "pglite — serve IPC socket not present","policy_skill_installed": false},- "fix_unavailable_reason": "unstructured",+ "fix": {+ "actor": "user",+ "consent": [+ "persistent_install"+ ],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/protocol/MEMORY_VERBS_v1.md#install-the-4-command-quickstart",+ "next": "report",+ "requires_exclusive": false,+ "user_message": "Which agent app should get gbrain memory? The install guide has a one-line command for each.",+ "why": "Register `<absolute path to gbrain> serve --surface verbs` as a stdio MCP server in your agent host; the install section lists the exact command per harness (Claude Code, Codex, Grok Build, opencode, OpenClaw)."+ },"message": "pglite — serve IPC socket not present; enabled but NO resolve path exists right now: the IPC socket is only bound by a running `gbrain serve` (stdio or --http) — until one is up, hooks/reflex degrade to no_serve on this brain (host capability may still supply pointers; policy skill carries otherwise) — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`","name": "retrieval_reflex_health",- "status": "warn"+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"},{"category": "skill",@@ -448,16 +463,97 @@},{"category": "brain",+ "fix": {+ "actor": "user",+ "argv": [+ "gbrain",+ "init",+ "--force",+ "--embedding-model",+ "voyage:voyage-4",+ "--embedding-dimensions",+ "1024",+ "--path",+ "<home>/.gbrain/brain.pglite"+ ],+ "command": "gbrain init --force --embedding-model voyage:voyage-4 --embedding-dimensions 1024 --path <home>/.gbrain/brain.pglite",+ "consent": [+ "credentials",+ "paid"+ ],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/search-modes.md",+ "inputs": [+ {+ "how": "Ask the user for an API key for Voyage AI; store it with `gbrain config set voyage_api_key <key>` (every gbrain process reads it), or export VOYAGE_API_KEY in the environment of every gbrain process. Then run the command.",+ "name": "VOYAGE_API_KEY"+ }+ ],+ "next": "tell_user_to_run",+ "requires_exclusive": true,+ "user_message": "Semantic search needs an embedding API key. Voyage AI works with this brain; if you add a key (VOYAGE_API_KEY), I can turn it on. Embedding costs a little per page; your notes and facts stay as they are.",+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "embeddings",+ "--json"+ ]+ },+ "why": "Embeddings are off, so search is keyword-only, and no configured embedding key fits this brain. Once the key is set this turns on voyage:voyage-4 (1024d) for the PGLite brain at <home>/.gbrain/brain.pglite. Pages, facts and keyword search are kept; existing chunks and facts are queued for vectors, which `gbrain embed --stale` (or the next maintenance cycle) fills."+ },"message": "Not applicable: embeddings are disabled on this brain (keyword search keeps working).","name": "embeddings",+ "readiness_state": "disabled_by_choice",+ "severity": "info","status": "ok"},{"category": "brain",- "fix_unavailable_reason": "unstructured",- "message": "Embedding provider probe failed: This brain has no explicit embedding model. Its stored vectors must not be interpreted using a new default. Run gbrain migrate embeddings --status and preview an explicit migration with --dry-run.",+ "fix": {+ "actor": "user",+ "argv": [+ "gbrain",+ "init",+ "--force",+ "--embedding-model",+ "voyage:voyage-4",+ "--embedding-dimensions",+ "1024",+ "--path",+ "<home>/.gbrain/brain.pglite"+ ],+ "command": "gbrain init --force --embedding-model voyage:voyage-4 --embedding-dimensions 1024 --path <home>/.gbrain/brain.pglite",+ "consent": [+ "credentials",+ "paid"+ ],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/search-modes.md",+ "inputs": [+ {+ "how": "Ask the user for an API key for Voyage AI; store it with `gbrain config set voyage_api_key <key>` (every gbrain process reads it), or export VOYAGE_API_KEY in the environment of every gbrain process. Then run the command.",+ "name": "VOYAGE_API_KEY"+ }+ ],+ "next": "tell_user_to_run",+ "requires_exclusive": true,+ "user_message": "Semantic search needs an embedding API key. Voyage AI works with this brain; if you add a key (VOYAGE_API_KEY), I can turn it on. Embedding costs a little per page; your notes and facts stay as they are.",+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "embeddings",+ "--json"+ ]+ },+ "why": "Embeddings are off, so search is keyword-only, and no configured embedding key fits this brain. Once the key is set this turns on voyage:voyage-4 (1024d) for the PGLite brain at <home>/.gbrain/brain.pglite. Pages, facts and keyword search are kept; existing chunks and facts are queued for vectors, which `gbrain embed --stale` (or the next maintenance cycle) fills."+ },+ "message": "Not probed: embeddings are disabled on this brain by choice (keyword search keeps working).","name": "embedding_provider",- "status": "warn"+ "readiness_state": "disabled_by_choice",+ "severity": "info",+ "status": "ok"},{"category": "brain",@@ -1047,10 +1143,43 @@"unpushed": 0}},- "fix_unavailable_reason": "unstructured",- "message": "1 knowledge asset(s) lack verified recovery: default (not_a_git_repo). Current recovery is not verified for all repositories. Run `gbrain backup status` for fix commands (`gbrain bootstrap repo` / `git remote add origin <url>` / `gbrain sources harden <id>`).",+ "fix": {+ "actor": "agent",+ "argv": [+ "gbrain",+ "export",+ "--source",+ "default",+ "--dir",+ "<BACKUP_DIR>/default"+ ],+ "command": "gbrain export --source default --dir '<BACKUP_DIR>/default'",+ "consent": [],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/operations/backup-check.md",+ "inputs": [+ {+ "how": "Ask the user where backups should live (a directory outside the brain, ideally synced or on another disk).",+ "name": "BACKUP_DIR"+ }+ ],+ "next": "run",+ "requires_exclusive": false,+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "backup_coverage",+ "--json"+ ]+ },+ "why": "Writes a Markdown copy of 'default' (pages and facts) to a directory outside the brain so it survives losing the database."+ },+ "message": "Not urgent yet: the brain holds 0 page(s)+fact(s) and is under 7 days old (backup coaching starts at 25 items or 7 days). 1 knowledge asset(s) lack verified recovery: default (not_a_git_repo). A source repo with a pushed git remote restores its Markdown files only, never DB-only pages, facts, config or credentials. Run `gbrain backup status` for each asset's fix command.","name": "backup_coverage",- "status": "warn"+ "readiness_state": "degraded",+ "severity": "info",+ "status": "ok"},{"category": "ops",@@ -1066,10 +1195,11 @@},{"category": "brain",- "fix_unavailable_reason": "unstructured",- "message": "Source 'default' has never completed a full cycle. Run `gbrain dream --source <id>` to cycle a source, or start `gbrain autopilot`.",+ "message": "No full cycle yet for 'default': it holds no pages or only pages from the last 24h, so there is nothing to consolidate yet.","name": "cycle_freshness",- "status": "warn"+ "readiness_state": "not_applicable",+ "severity": "info",+ "status": "ok"},{"category": "brain",@@ -1145,6 +1275,8 @@},"message": "Not applicable: embeddings are disabled on this brain (keyword search keeps working).","name": "fact_take_vectors",+ "readiness_state": "disabled_by_choice",+ "severity": "info","status": "ok"},{@@ -1335,8 +1467,49 @@},{"category": "brain",- "message": "No stale chunks",+ "fix": {+ "actor": "user",+ "argv": [+ "gbrain",+ "init",+ "--force",+ "--embedding-model",+ "voyage:voyage-4",+ "--embedding-dimensions",+ "1024",+ "--path",+ "<home>/.gbrain/brain.pglite"+ ],+ "command": "gbrain init --force --embedding-model voyage:voyage-4 --embedding-dimensions 1024 --path <home>/.gbrain/brain.pglite",+ "consent": [+ "credentials",+ "paid"+ ],+ "docs": "https://github.com/garrytan/gbrain/blob/master/docs/guides/search-modes.md",+ "inputs": [+ {+ "how": "Ask the user for an API key for Voyage AI; store it with `gbrain config set voyage_api_key <key>` (every gbrain process reads it), or export VOYAGE_API_KEY in the environment of every gbrain process. Then run the command.",+ "name": "VOYAGE_API_KEY"+ }+ ],+ "next": "tell_user_to_run",+ "requires_exclusive": true,+ "user_message": "Semantic search needs an embedding API key. Voyage AI works with this brain; if you add a key (VOYAGE_API_KEY), I can turn it on. Embedding costs a little per page; your notes and facts stay as they are.",+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "embeddings",+ "--json"+ ]+ },+ "why": "Embeddings are off, so search is keyword-only, and no configured embedding key fits this brain. Once the key is set this turns on voyage:voyage-4 (1024d) for the PGLite brain at <home>/.gbrain/brain.pglite. Pages, facts and keyword search are kept; existing chunks and facts are queued for vectors, which `gbrain embed --stale` (or the next maintenance cycle) fills."+ },+ "message": "Not applicable: embeddings are disabled on this brain by choice, so chunks have no vectors by design (keyword search keeps working).","name": "embed_staleness",+ "readiness_state": "disabled_by_choice",+ "severity": "info","status": "ok"},{@@ -1353,10 +1526,38 @@},{"category": "brain",- "fix_unavailable_reason": "unstructured",+ "fix": {+ "actor": "agent",+ "argv": [+ "gbrain",+ "config",+ "set",+ "takes.bootstrap_enabled",+ "true"+ ],+ "command": "gbrain config set takes.bootstrap_enabled true",+ "consent": [+ "paid"+ ],+ "next": "ask_user",+ "requires_exclusive": false,+ "user_message": "gbrain can extract typed claims (\"takes\") from your pages so it can track calibration over time. It uses a paid chat model (roughly $5 once). Turn it on?",+ "verify": {+ "argv": [+ "gbrain",+ "doctor",+ "--only",+ "takes_count",+ "--json"+ ]+ },+ "why": "Takes (typed claims) are opt-in. Enabling the bootstrap lets maintenance extract them from existing pages with a chat model (about $5 on a typical brain), which feeds calibration."+ },"message": "0 takes (takes.bootstrap_enabled is false; opt in to enable)","name": "takes_count",- "status": "warn"+ "readiness_state": "disabled_by_choice",+ "severity": "info",+ "status": "ok"},{"category": "meta",@@ -1379,45 +1580,15 @@],"db_url_source": null,"engine": "pglite",- "health_score": 70,+ "health_score": 95,"schema_version": 2,"status": "warnings","top_issues": [- {- "fix": "1 knowledge asset(s) lack verified recovery: default (not_a_git_repo). Current recovery is not verified for all repositories. Run `gbrain backup status` for fix commands (`gbrain bootstrap repo` / `git remote add origin <url>` / `gbrain sources harden <id>`).",- "name": "backup_coverage",- "status": "warn",- "tier": "symptom"- },- {- "fix": "Source 'default' has never completed a full cycle. Run `gbrain dream --source <id>` to cycle a source, or start `gbrain autopilot`.",- "name": "cycle_freshness",- "status": "warn",- "tier": "symptom"- },- {- "fix": "Embedding provider probe failed: This brain has no explicit embedding model. Its stored vectors must not be interpreted using a new default. Run gbrain migrate embeddings --status and preview an explicit migration with --dry-run.",- "name": "embedding_provider",- "status": "warn",- "tier": "symptom"- },- {- "fix": "pglite — serve IPC socket not present; enabled but NO resolve path exists right now: the IPC socket is only bound by a running `gbrain serve` (stdio or --http) — until one is up, hooks/reflex degrade to no_serve on this brain (host capability may still supply pointers; policy skill carries otherwise) — policy skill not installed; run `gbrain integrations install retrieval-reflex --target <host-repo>`",- "name": "retrieval_reflex_health",- "status": "warn",- "tier": "symptom"- },{"fix": "64 new built-in skill(s) available that this workspace hasn't installed: academic-verify, archive-crawler, article-enrichment, ask-user, blog-ingest, book-mirror, brain-ingest-gate, brain-link-discipline, … +56 more. Add them with `gbrain skillpack sync`.","name": "skill_currency","status": "warn","tier": "symptom"- },- {- "fix": "0 takes (takes.bootstrap_enabled is false; opt in to enable)",- "name": "takes_count",- "status": "warn",- "tier": "symptom"}]},