Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
test(questions): goldens, phase counts, CLI case counts; receipts use fix; isolation and size ceilings
garrytan6816ffb96aea
diff --git a/docs/architecture/key-files/core-questions.md b/docs/architecture/key-files/core-questions.mdindex 11bf182936..64e3f62360 100644--- a/docs/architecture/key-files/core-questions.md+++ b/docs/architecture/key-files/core-questions.md@@ -16,7 +16,7 @@ User guide: [docs/guides/pinned-questions.md](../../guides/pinned-questions.md).- `src/core/questions/pages.ts` — The question page: question, scope and the owner's notes, never the answer. `syncQuestionPage` creates, archives or restores it through coordinated `put_page` (trusted local callers only). `ownerClaims` turns the body (minus heading and comments) into owner-attributed sentences, pinned to the body's hash.-- `src/core/questions/receipt.ts` — `buildReceipt`: freshness (`fresh|stale|awaiting_refresh|refreshing|archived`), sentence counts, evidence watermark, last refresh, blocked reason (`awaiting_consent`, `no_model_key`, `budget_exhausted`, `refresh_failed`, `no_worker`), `next_action` (an agent-operator `Action` with a read-only `verify`) and the answer for owner-capable readers. `scheduledRefreshAvailable` (a `standing_questions` run in the last two days, or installed unpaused autopilot) decides `no_worker`.+- `src/core/questions/receipt.ts` — `buildReceipt`: freshness (`fresh|stale|awaiting_refresh|refreshing|archived`), sentence counts, evidence watermark, last refresh, blocked reason (`awaiting_consent`, `no_model_key`, `budget_exhausted`, `refresh_failed`, `no_worker`), `fix` (an agent-operator `Action` with a read-only `verify`) and the answer for owner-capable readers. `scheduledRefreshAvailable` (a `standing_questions` run in the last two days, or installed unpaused autopilot) decides `no_worker`.- `src/core/questions/service.ts` — The operations' behavior. `requireOwnerCapable` admits the trusted local CLI and remote grants that read private pages and are neither slug-fenced nor delegated; everyone else gets `question_owner_only` with the CLI equivalent. Consent: CLI pins are active; MCP pins are inactive (`awaiting_consent`) unless a paid preapproval exists; `pin --id` on the host activates. First answer is a bounded wait (`wait_ms`, abort releases the lease). `pinnedAnswersForPack` feeds context_pack's optional `pinned_questions` / `withheld` fields (published, active, entity-scoped pins; fresh sentences only). Emits the `pinned_answer_stale` notice.diff --git a/docs/guides/pinned-questions.md b/docs/guides/pinned-questions.mdindex 27f126ecff..106186374f 100644--- a/docs/guides/pinned-questions.md+++ b/docs/guides/pinned-questions.md@@ -68,7 +68,7 @@ Every pin, list, status and refresh returns the same fields:| `new_evidence_since_watermark` | Pages or facts in scope changed after the answer; the next cycle refreshes it || `last_refresh_at` | The last successful refresh || `blocked_reason` | Why the answer cannot be refreshed right now (below), or null |-| `next_action` | The step that fixes it: `argv`, `mcp`, `consent`, `actor`, `why` and a read-only `verify` |+| `fix` | The step that fixes it: `argv`, `mcp`, `consent`, `actor`, `why` and a read-only `verify` || `verify` | `gbrain questions status <id> --json` / `questions_status {id}` || `blocked_reason` | Meaning | Next action |diff --git a/scripts/function-size-baseline.tsv b/scripts/function-size-baseline.tsvindex 535e811f28..11c0695244 100644--- a/scripts/function-size-baseline.tsv+++ b/scripts/function-size-baseline.tsv@@ -31,7 +31,7 @@ src/core/check-resolvable.ts checkResolvable 419 seed: W5 baseline, refactor wavsrc/core/config.ts loadConfigWithEngine 362 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +2 #5824: search.vector_legacy_guard DB-plane mergesrc/core/context-engine.ts createGBrainContextEngine 520 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +1 #4618: seat sidecar call before the segment spool (helper recordOpenclawSeat)src/core/context/retrieval-reflex.ts resolveEntitiesToPointers 355 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)-src/core/cycle.ts runCycle 1271 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +5 #5809: extract_atoms phase gets a real abort signal; +2 #5809: cycle_already_running names the lock holder; +1 #4578: a lock steal during the last selected phase reports lock_stolen (one phase per runCycle call); +4 GBRA-40 F4b: planner-stats refresh after the freshness phases; +14 #5876: Life Chronicle phase dispatch block; +6 GBRA-40 Lane D: facts_drain phase dispatch; +10 GBRA-49: edge_contradictions phase dispatch block (adapter in cycle/edge-contradictions.ts)+src/core/cycle.ts runCycle 1278 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +5 #5809: extract_atoms phase gets a real abort signal; +2 #5809: cycle_already_running names the lock holder; +1 #4578: a lock steal during the last selected phase reports lock_stolen (one phase per runCycle call); +4 GBRA-40 F4b: planner-stats refresh after the freshness phases; +14 #5876: Life Chronicle phase dispatch block; +6 GBRA-40 Lane D: facts_drain phase dispatch; +10 GBRA-49: edge_contradictions phase dispatch block (adapter in cycle/edge-contradictions.ts); +7 C4: standing_questions phase dispatch block (logic in questions/phase.ts)src/core/cycle/extract-atoms.ts runPhaseExtractAtoms 787 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +12 #5809/#5832: hard/soft stop checks, chat-call signal, abortable pacing, no post-stop writes; +1 #5856: one BudgetTracker per drain attempt (reuse the attempt's tracker)src/core/cycle/extract-atoms.ts runPhaseExtractAtoms>withBudgetTracker(#1) 316 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1); +11 #5809/#5832: per-item and pre-commit abort checks, chat-call signal, abortable pacing, catch-side stopsrc/core/cycle/extract-facts.ts runExtractFacts 505 seed: W5 baseline, refactor wave 1 (decomposition deferred to wave 2, plan D1)diff --git a/scripts/module-size-limits.tsv b/scripts/module-size-limits.tsvindex 12f477448e..5f10fb5a59 100644--- a/scripts/module-size-limits.tsv+++ b/scripts/module-size-limits.tsv@@ -3,7 +3,7 @@# Raising a ceiling is a conscious, reviewer-visible act. Lower ceilings in# the same commit as any peel (the guard fails on >50 lines of stale slack).# Columns: path max_lines policy note-src/cli.ts 3209 ratchet +1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row)+src/cli.ts 3211 ratchet +1 Foundations 2 Lane F: sources refresh pre-connect delegation to a resident PGLite owner (logic in commands/sources-refresh-delegate.ts); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +3 agent operator gate fixes: repair-failed connect wrapper (logic in cli/cli-error.ts exitOnRepairFailed), transcripts recent through a live serve (logic in commands/transcripts.ts), pre-connect status reason (logic in commands/serve-status.ts); +23 merged from the collector (Lanes B/E/F: thin-client token reason, status-only serve hand-off, jobs/sync readiness wiring); +9 agent operator wave D3/D4: curated --help short-circuit (renderer in cli/help/render.ts), curated flag-value validation call (cli/help/validate.ts), table-dispatched SELF_HELP_WITHOUT_ENGINE entries for the selfHelp flips; +5 agent operator wave C10 (merged from the collector): serve --fail-fast in the connect-failure path; +31 #5950 (D6): connectEngine thin-client backstop, engine-free MCP-twin dispatch, recall/advisor/export refusal hints, refusal fix subcommand (lowered to 3131 by D1's renderCliError seam first); +2 agent operator wave A4: observational startup (probe-only connect for startup:observational commands; completeEngineStartup split out of connectEngine, exposed as ctx.completeStartup); +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5232: write-wait import, reporter-owned verdict in the op catch, thin-client writeWaitMs, ctx.writeWaitMs (logic in persistence/write-wait.ts); +1 #4768: serve --access help line; +4 #5433: list_pages TSV cell escaping in formatResult; +2 #lane-h pricing: help line + thin-client refusal hint for `gbrain pricing`; +2 fix wave 5 (#5401): projections drain help line and thin-client hint; +2 (#5137) key-shadow warning seam, logic in ai/key-warnings.ts; +2 System One v1: decide help line + thin-client refusal hint; refactor wave 1 split target (W4 cli); ceiling rationale: docs/architecture/key-files/entrypoints-and-docs.md entry for src/cli.ts; evidence delivery: thin-client return_unit version-skew warning (+3; logic in search/evidence-delivery.ts); put stdin recovery (#5700): stdin hint in the --content requires-a-value error and stdin usage/required text in printOpHelp (+7); logic in persistence/deactivation.ts); +36 #5827: link-command help examples, local --source vs --source-id/--all-sources conflict check, ambient-binding return from applyThinClientSourceScope (logic in cli/source-scope.ts); +4 #5433: list_pages TSV cell escaping in formatResult; +1 #5984: a strict run deadline when no progress window is set; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (3199 measured); +6 engine graduation (GBRA-50 G3): migrate pre-connect route (logic in commands/migrate-graduation.ts), serve start refusal and degraded-reconnect identity gate (logic in persistence/graduation-serve-guard.ts), usage line; +3 engine graduation (GBRA-50 G2a): connect-path graduation check on every engine (logic in persistence/graduation-custody.ts assertGraduationConnectAllowed); GBRA-49: edge-proposals answers --help without a brain (SELF_HELP_WITHOUT_ENGINE row); +2 C4 pinned questions: questions help line + SELF_HELP_WITHOUT_ENGINE row (logic in commands/questions.ts)src/commands/autopilot.ts 1642 ratchet refactor wave 1 split target (W4 autopilot, cut line); ceiling rationale: docs/architecture/key-files/commands-1.md entry for src/commands/autopilot.ts; +2 fix wave 5: nosemgrep justifications on the per-brain job launchctl/systemctl calls (#5195); +2 #5813: boot reconcile names attempted and running versions in log + audit; +2 #5855: Bun floor gate before the swap and the swap-refusal hold (logic in core/bun-floor.ts); +3 agent operator wave E9: --dry-run and the persistent_install consent gate before anything is written (logic in autopilot/install-consent.ts)src/commands/doctor.ts 667 ratchet +1 agent operator gate fixes: --probe consent gate (logic in doctor/probe-consent.ts); refactor wave 1 split target (W4 doctor); ceiling rationale: docs/architecture/key-files/commands-2.md entry for src/commands/doctor.tssrc/commands/embed.ts 2219 ratchet +2 agent operator wave D2: --json failure envelope via writeCliError; lowered v0.46.26.0: embedBatchWithBackoff + retry cluster peeled to core/embed-retry.ts (core/commands layering fix); grown wave-g (#4530): per-model input-limit wiring; wave-k #3622 reimpl: --stale zero-progress failure quarantine; +29 #4668 (#4530): oversize-heal call sites in both --stale drains — kept low by peeling the healed-row remap to core/embed-oversize-heal.ts (shared with embed-stale.ts); +35 #4647 (refs #4599): per-tick timeout+abort on the single-flight lock heartbeat refresh (interval deliberately NOT unref'd); +122 refs #4599: stall-watchdog race around the drain + shared idempotent flushAndRelease + CLI stall exit mapping (watchdog machinery itself lives in core/embed-stall.ts); +12: adversarial-review hardening (healed_splits progress key + heal-tick comment); #5105: guarded derived projection preparation and read seals; #5105: conditional embedding installer wiring; archived eligibility: active-only dispatch with honest stranded-work reporting; explicit archived admission: live-source snapshots and honest refused-installation failures; +2 fw3: embed --stale --images dispatch (sweep lives in core/embed-stale-images.ts); +5 #5289: dry run reports restamp-only chunks apart from chunks to embed (count lives in core/embedding-invalidation.ts); +6 #4616: keep a partially refused batch in embedPageTexts and name the recovery command in failure samples (guard lives in core/ai/embedding-guard.ts); +5 #5226: embed summary counts distinct pages; +3 #5804: null projection snapshot counted as a failure with one batch summary in embed --stale; +18 wave 8 lane D1: #5527 mixed-space warning subtracts current-model chunks (+4), #5885 takes option/result fields and the stale-drain takes call (pass lives in core/embed-takes.ts); +9 Foundations 1 F4d: time-budget stop result fields, stdout verdict and stop recording in embed --stale (logic in core/embed-budget-stop.ts)@@ -13,17 +13,17 @@ src/commands/jobs.ts 660 ratchet refactor wave 1 split target (W4 jobs, cut linesrc/commands/serve-http.ts 924 ratchet refactor wave 1 W4 split into serve-http-<area>.ts modules; ceiling rationale: docs/architecture/key-files/commands-5.md entry for src/commands/serve-http.ts; +2 agent operator wave A6: ServeHttpContext.noticeLedger (import + field; logic in core/notice-ledger.ts); +2 agent contract F1/F2: ServeHttpContext.readinessCache (probed readiness for initialize tails + gbrain://capabilities); +5 Lane D facts drain: serve --http starts the drain scheduler and stops it before the engine disconnect (logic in core/facts/drain-scheduler.ts)src/core/ai/gateway.ts 4407 ratchet +7 fix wave 5 (#5137): provider-key redactor on every upstream error path and the first embedding 401/403 report (logic in ai/key-redact.ts, ai/key-warnings.ts); +20 System One v1: decide() delegating export + transport seam, RerankInput.onMeta/RerankMeta, TypeSafe reranker delegation to ai/decide/rerank-adapter.ts; +3 #5585: reconfigureGatewayWithEngine records expansion/chat model provenance (ai/gateway-model-sources.ts) + clears it with gateway state; lowered #5585: tracker record sites collapsed onto ai/budget-record.ts (recordOnTracker + failedCallUsage) while adding ledger fields (requested model, purpose, failed, estimated, countsAsCall); +20: schema-rejection fallback in chat() (retry once schemaless on a json_schema 4xx, remember the recipe for the process — mirrors expand()); re-summed after merging master v0.50.0.0 with the wave (structured-output + pricing hunks); +48: #4863 ChatOpts.responseSchema → tolerant json_schema Output on the chat() generateText call for openai-compatible recipes that declare structured outputs (facts extraction on Ollama); +74: #3657 post-sunset rerank short-circuit (effective-model check, once-per-process audit row + stderr, injected-clock seam); grown v0.46.26.0 megawave: config-plane probes + halt telemetry (#3387 #4312); +21 lines (OpenAI Responses API reasoning-item echo: ChatBlock 'reasoning' variant, chat()/toModelMessages() round-trip); wave-k absorbs: OCR routing seam (#4107 class), config-snapshot reader block (#3980); +21: #4107 OCR-model routing (getImageOcrModel); +10: keyless OPENAI_BASE_URL embedding override (#4385); wave-k #3622 reimpl: GBRAIN_EMBED_MAX_BATCH_TOKENS env cap for no_batch_cap recipes; +9: DeepSeek judge thinking pin plumbed through chat opts (#4069); +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); ranker wave v0.48.4.0: ChatOpts.temperature threaded to the transport (+15); +24: #4172 recipe-declared thinking headroom on the chat()/toolLoop() default — shared isThinkingModel predicate (Claude-5 regex || recipe thinking_by_default, fail-closed), also consumed by the subagent handler; +20: #4861 claude-cli expansion routed to the schemaless viaText path (the CLI adapter ignores responseFormat, so the native generateObject branch had no fallback); retired provider integration removed; safety wave: migration reranker input ceilings; lowered by fix wave 3 #5680 (embed request planning peeled to ai/embed-batch-plan.ts); +5 #4616: empty inputs skip the provider and every text/multimodal result is screened for zero-norm/NaN/Inf vectors (logic lives in ai/embedding-guard.ts); fix wave 3 integration: #4616 empty-input filtering feeds the shared #5680 batch planner; +3 #5691: embedQuery takes a per-request queryPrefix (no gateway state); +26 fix wave 7 (#5642): embed spend records bank provider-reported usage.tokens (all sub-batches reported → measured; chars-per-token estimate stays the fallback and the failure charge); +2 #5892: import + load-time call of installAiSdkWarningWriter (writer lives in ai/sdk-warnings.ts); +12 #5490: chat() delegation to ai/chat-fallback.ts when chat_fallback_chain is set (attempt loop lives there), ChatOpts.allowFallback + ToolLoopOpts.allowFallback fields and the toolLoop forward; +2 #5490 review: ChatResult.fallbackFrom (the call model a chat_fallback_chain answer replaced)src/commands/sync.ts 510 ratchet refactor wave 1 split target (W4 sync); ceiling rationale: docs/architecture/key-files/commands-6.md entry for src/commands/sync.ts; +2 for the #5751 SyncResult.legacySkips interface field (fix wave 4); +2 fix wave 4 lane B: SyncResult.connectorHolds interface field (held counts for the sync summary); +1 fix wave 5 (#5032): SyncResult.fileRefusals interface field (named per-file Windows colon refusals); +13 #5984: SyncResult.drain / managedCursor and SyncOpts.drain / drainStartedAt interface fields (drain loop lives in persistence/sync-drain.ts); +1 #5984: SyncOpts.noBulk / bulk interface fields; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (510 measured)-src/core/cycle.ts 3250 ratchet +2 System One v1 S9: extract_facts phase tail runs the conflict sweep (ai/decide/sweep.ts) only when the slot is not off; +2 System One v1: purge phase prunes decision receipts (ai/decide/store.ts); grown v0.46.26.0 megawave (#4102 #2608) + master v0.46.26.0 cycle-start orphan recovery; +10 wave G #3974: cycle-sync uncommitted-drift warn; grown wave-g (#4416): synthesize_concepts source threading; grown wave-g (#4416): synthesize_concepts source threading (same fix absorbed as #4417 on wave-k); wave-k: ); +7: #4077 abort threading; +10: #4745 fullImplicitSourceCycle opt-in contract; +3: #4890 extract phase jsonMode/quiet + pages-not-links totals; +1: wave review — extract phase passes quiet:true + jsonMode:false; +1: extract_facts pagesFailed detail; +8 fix wave 3: one cycle date resolved in runCycle and threaded to synthesize/patterns/drift (C-15); +1 #5632: cycle sync resumes an unfinished managed cursor with its stored options; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +1 at the merge; -41 #5809: anyAbortSignal peeled to abort-signals.ts; +5 #5809: extract_atoms phase gets a real abort signal; +4 #5809: cycle_already_running names the lock holder; +7 #5255: cycle sync runs a managed pull request as no-pull and reports upstream_refresh; +1 #4578: a lock steal during the last selected phase reports lock_stolen, not aborted; +3 #5536: keyless embed phase clean-skips when embedding_disabled is set; +5 F4b: planner-stats refresh after the freshness phases (logic in planner-stats.ts); +2 agent operator wave A1: PhaseResult sibling code/fix; +20 #5876: Life Chronicle phase registration (CyclePhase, ALL_PHASES, NEEDS_LOCK) and its runCycle dispatch block; v0.60.46.0 merge: re-summed to the merged line count (3224); +12 Lane D: facts_drain phase registration (CyclePhase, ALL_PHASES, NEEDS_LOCK) and its runCycle dispatch line (logic in cycle/facts-drain.ts); +15 GBRA-49 temporal typed edges: edge_contradictions phase registration + dispatch block + extract-phase relationship sweep call (logic in cycle/edge-contradictions.ts, link-relationships.ts)+src/core/cycle.ts 3260 ratchet +2 System One v1 S9: extract_facts phase tail runs the conflict sweep (ai/decide/sweep.ts) only when the slot is not off; +2 System One v1: purge phase prunes decision receipts (ai/decide/store.ts); grown v0.46.26.0 megawave (#4102 #2608) + master v0.46.26.0 cycle-start orphan recovery; +10 wave G #3974: cycle-sync uncommitted-drift warn; grown wave-g (#4416): synthesize_concepts source threading; grown wave-g (#4416): synthesize_concepts source threading (same fix absorbed as #4417 on wave-k); wave-k: ); +7: #4077 abort threading; +10: #4745 fullImplicitSourceCycle opt-in contract; +3: #4890 extract phase jsonMode/quiet + pages-not-links totals; +1: wave review — extract phase passes quiet:true + jsonMode:false; +1: extract_facts pagesFailed detail; +8 fix wave 3: one cycle date resolved in runCycle and threaded to synthesize/patterns/drift (C-15); +1 #5632: cycle sync resumes an unfinished managed cursor with its stored options; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +1 at the merge; -41 #5809: anyAbortSignal peeled to abort-signals.ts; +5 #5809: extract_atoms phase gets a real abort signal; +4 #5809: cycle_already_running names the lock holder; +7 #5255: cycle sync runs a managed pull request as no-pull and reports upstream_refresh; +1 #4578: a lock steal during the last selected phase reports lock_stolen, not aborted; +3 #5536: keyless embed phase clean-skips when embedding_disabled is set; +5 F4b: planner-stats refresh after the freshness phases (logic in planner-stats.ts); +2 agent operator wave A1: PhaseResult sibling code/fix; +20 #5876: Life Chronicle phase registration (CyclePhase, ALL_PHASES, NEEDS_LOCK) and its runCycle dispatch block; v0.60.46.0 merge: re-summed to the merged line count (3224); +12 Lane D: facts_drain phase registration (CyclePhase, ALL_PHASES, NEEDS_LOCK) and its runCycle dispatch line (logic in cycle/facts-drain.ts); +15 GBRA-49 temporal typed edges: edge_contradictions phase registration + dispatch block + extract-phase relationship sweep call (logic in cycle/edge-contradictions.ts, link-relationships.ts); +10 C4 pinned questions: standing_questions phase registration (CyclePhase, ALL_PHASES, NEEDS_LOCK) and its runCycle dispatch block (logic in questions/phase.ts)src/core/cycle/synthesize.ts 3312 ratchet +26 System One v1 S7/S8: triage and grounding decide delegation (triage-decide.ts, grounding-decide.ts); merged waves; grown v0.46.26.0 megawave + master rolling lease via shared throttled renewer; grown wave-g (#4506): cycle summaries can stay out of the source repo; +18: expired-verdict sweep + DeepSeek judge thinking pin (#4069); +47: #4077 cooperative-abort threading; +110: eval fix wave F6 spend surfacing (withChatPhase wrap, triage/child token telemetry, zero-page counter); +32: F1b quote-verify call site + kill switch; +2: F1a/F3/F4a OUTPUT POLICY rules; +59: F2 verified-segment rescue (gate at report construction, rescue knobs, telemetry); +19: rubric v2 peak-scoring + docblock rescue branch; +50: #4337 summary link-sample cap + dream_created_cycle_date preserve-on-rerun; +5: #4348 resolveCycleDate wiring (local-day summary bucketing); +3 round-3 rebase true-up; +55: #4805 synth-v2 completion skip (findSynthV2Completion + prefix-parameterized loadSuccessfulSynthesisKeys); +10: #4886 mode-aware buildSynthesisPrompt (oneshot children drop tool-use/final-prose guidance); #5105: small legacy writer/refusal and shared revision CAS delegates; +4: merge of #5666 durable synthesis completions with the v0.59.18.0 verify-epoch wiring; +7 #5413/#5471 discovery exclusions (self-capture session ids, dream output directories); +6 fix wave 2 (v0.60.5.0) integration: W7 paid-loop breaker check before submission and released-key daily-cap count on top of the W1b discovery exclusions; +6 v0.60.5.0 master-merge true-up: the wave-2 growth (+13 W1b, +6 W7) re-summed over master v0.59.18.0 at 3222 lines with no slack; +76 fix wave 3: per-run USD gate + fail-closed daily cap (C-13), child first-write ownership for stamp/reverse-write (C-8, #5685), cycle-date prompt hint (C-15), opt-in attribution rule (#5425); fix wave 3 x fix wave 2 (v0.60.5.0) composition: +19 at the merge; +2 #5806 triageNow clock seam forwarded to triage (interface field + call-site option); +4 #5854: a postprocess or summary publish still pending after its wait is deferred (publish_pending warn, no cooldown stamp; helper in synthesize-postprocess.ts); +1 Foundations 2 Lane C: maintenanceTransaction import (attributed summary page); +14 #5490 review: a triage verdict a chat_fallback_chain model gave is used for the run but not cached (TriageResult.answeredBy, judge-client marker, guarded putDreamVerdict)src/core/cycle/extract-atoms.ts 1809 ratchet crossed the 1500 unlisted cap in the atoms/extraction fix wave: +21 embed-aware cost gate (#4878), +65 atoms-array anchor scan (#4913); peel candidate: the parse block (parseAtomsOutcome / parseArrayAtOffset / atomsFromParsedArray) into extract-atoms-parse.ts; +35: #4853 transcript-origin atoms link to their conversation page; +130: #4916 transcript failure-count/tombstone (extract_atoms_transcript_state, TODOS P2(b)); wave composition: #4916 transcript-state skip + #4948 zero-atom prompt + #4943 meetings source-id summed; +3: wave review — a later `[]` is an honest zero-yield, a non-atom-shaped array is a counted failure; +13: wave review — explicit budget keeps the cap over an unpriced embed route ($0-priced); +14: wave review — transcript-state write errors surfaced, missing table warns once; merged reliability/shared-skills source integration; +37 fix wave 3: stable undated atom dates + stale-atom retirement (C-14); +3 #5525: effectiveVisibility stamped on non-managed atoms; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +3 at the merge; +6 fix wave 3 lane A (#5601): accepted-pending atom batches count as progress (helper in persistence/accepted-pending.ts); +4 fix wave 4: #5705 transcript-as-data system prompt lines and its message helper, #5627 response schema import (the atom-type list moved to extract-atoms-schema.ts); +30 #5809/#5832: drain hard/soft stop signals (ExtractAtomsOpts.signal/stopSignal, pre-commit abort checks, no strike or post-stop writes after a hard stop) and the cancellable backlog count; +1 #5812: transcript items are paste-stripped (corpusTextForExtraction import) before the input cut; +1 #5820: extract_atoms discovery passes selfCaptureSessionIds like synthesize; +10 #5856/#5854: drain attempt state (one BudgetTracker + one publish wait across batches) and the opt-in connector email/meeting exclusion (predicate in connector-atoms.ts); +1 Foundations 2 Lane C: maintenanceTransaction import (attributed stale-atom retirement)src/core/engine.ts 2679 ratchet grown v0.46.26.0 megawave: relational/visibility/usage contract surface (#4352 #4218); grown wave-g (#4524 #4527): orphans-mode contract + removeLink deleted count; wave-k: +4 fail-closed TrajectoryOpts.remote contract doc (#3855), +2 FactListOpts.unconsolidatedOnly (#4070), +14 getAllConfig bulk-read contract (#3980); +1: getBacklinkCounts page-id contract doc (#4380); +9: FactListOpts.grep SQL pre-limit contract (#3851); +13: dream-verdict TTL contract (#4069); +33: softDeletePages batch soft-delete contract (#4587); +8: #4592 scoped getStats/getHealth contract doc; +5 read-time TTL validity contract docs (active vs history read semantics); +12: #4280 findOrphanPages type/quarantined metadata contract; +14: traversePathsDetailed row-cap contract (ship-review); +12: resolveSlugWithAliasDetailed owning-source contract (ship-review) | merged v0.48.1.0: master #4788 + wave traversePathsDetailed/resolveSlugWithAliasDetailed; master: | merged v0.48.1.0 true-up; corrective release: read-policy signatures and Chronicle scope; +7: #4882 listFactsSince entitySlug/sessionId composition doc; #5105: canonical page state shared module and transaction/snapshot delegates; #5105: guarded derived projection preparation and read seals; #5105: resident-stop registration and direct transaction contract; #5105: +1 raw preservation contract for legacy engine migration; merged company ingestion/schema routing changes; safety wave: fact embedding model and text identity contract; +5 write-path wave: findDuplicatePage excludeSlug + id-first ranking contract; +2 fw3 A14: addTag tagSource provenance contract; evidence delivery: getChunkWindows interface member + type import (+3); #5761: +4 markPagesAttendanceBlocked member + countStalePagesForExtraction attendance option; +4 #5888: FactListOpts.fingerprint + FactRow.fact_fingerprint contract (hot-memory duplicate collapse); +1 GBRA-49: LinkReadScope temporal opts on the link read contractsrc/core/import-file.ts 2178 ratchet +2: pre-publication withdrawal validation; grown v0.46.26.0 megawave: OCR budget + image import + embed-retry rewire (#3973 #3374); grown wave-g (#4530): per-model chunk-token cap wiring; +24 #4548: row-level visibility-aware fence merge on remote write-back (replaces the #2044 whole-block swap + #4553/#4555 warn-only paths); +7 #4546: merge extended to the timeline-embedded fence; +5 #4107: maybeOcr gates on the OCR model's provider; +3 #3893; +7: #4702 disabled_patterns pass-through to the sanity gate; composition true-up (fix-wave multi-train); +8 #4903: importCodeFile writes source_path so the full-sync reconcile can see code pages; -11: wave review — local fence append replaced by facts-fence.replaceOrInsertFactsFence (#4756 rule); security: durable queued authority and confined filesystem dispatch; master integration: grown v0.46.26.0 megawave: OCR budget + image import + embed-retry rewire (#3973 #3374); grown wave-g (#4530): per-model chunk-token cap wiring; +24 #4548: row-level visibility-aware fence merge on remote write-back (replaces the #2044 whole-block swap + #4553/#4555 warn-only paths); +7 #4546: merge extended to the timeline-embedded fence; +5 #4107: maybeOcr gates on the OCR model's provider; +3 #3893; +7: #4702 disabled_patterns pass-through to the sanity gate; composition true-up (fix-wave multi-train); +8 #4903: importCodeFile writes source_path so the full-sync reconcile can see code pages; -11: wave review — local fence append replaced by facts-fence.replaceOrInsertFactsFence (#4756 rule); harness support: boundary wiring to shared grants, isolated setup, withdrawal and delegated guards; merged v0.49: withdrawal preservation after data-only frontmatter parsing; #5105: small legacy writer/refusal and shared revision CAS delegates; #5105: +8 prepared contextual retrieval policy and retry boundary wiring; upstream integration: preserve independently reviewed master additions with branch facade extraction; #5252 wave: shared provider-free Markdown and code preparation; merged company ingestion/schema routing changes; master retrieval/projection integration with company ingestion; shared content: prepare managed image imports without bypassing canonical publication; +29 write-path wave: identity move/collision wiring (logic in import-identity.ts), deferred embedding on provider failure, image index completeness, file-time date anchor; +22 fw3 A13: markdown re-import reuses unchanged chunk vectors under the seal/wrapper/signature/protected-fence gate; +2 fw3 A12: importFromFile firstCommitAt option; +3 fw3 A14: managed imports keep add-only tags; +4 #5675: record the file origin move inference binds to (logic in import-identity.ts); fw3 integration: A12/A13/A14 (+27) and #5675 (+4) compose; +17 wave-2 W4: safe-chunk re-seal of unchanged legacy markdown/code pages (#5050 #5247) and embedding-input provenance on inline imports (#5553); -1 fix wave 2 (v0.60.5.0) integration: W4 delta re-summed over the merged master line count; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +16 at the merge; +11 #4616: markdown and code imports keep the usable vectors of a partially refused batch and leave refused chunks for embed --stale; lowered to 2230: #5621 contextual-mode resolution peeled to core/import-contextual-mode.ts (shared with gbrain repair contextual-mode); +2 wave 8 lane D1 #5158: key-order fallback equality call (comparison lives in page-state/import-guard.ts); +1 F1c: direct imports run in maintenanceTransaction (write attribution; helper in persistence/attribution.ts); lowered to 2178: #5988 content screen and content-sanity config peeled to core/import-screen.tssrc/core/migrate.ts 602 ratchet schema-migration runner only; migrations live in src/core/schema-migrations/ (W3); +3 #5216: resumable page revision backfill runs after every migration pass while pages.knowledge_revision is nullable-src/core/operations.ts 336 ratchet peel target: containment sprint C4-C7; grown v0.46.26.0 megawave op wiring; +chat-connectors wiring (master merge); +5 v0.47 gmail-loops: loopsOperations spread + OP_AREAS; #5105: receipt operation registry wiring; shared-skills integration on company-ingestion base; +2 security wave: withOutputRedaction applied at op registration; +1 #5616: pageEditOperations import (spread shares the pages line); +1 Foundations 1 F1b: attributionOperations import (spread shares the admin line); +1 agent operator wave A6: ops/notices.ts import (mute_notice); +2 agent operator closeout A1: registerOpRoutes import + call (routing logic in fix-routing.ts)+src/core/operations.ts 338 ratchet peel target: containment sprint C4-C7; grown v0.46.26.0 megawave op wiring; +chat-connectors wiring (master merge); +5 v0.47 gmail-loops: loopsOperations spread + OP_AREAS; #5105: receipt operation registry wiring; shared-skills integration on company-ingestion base; +2 security wave: withOutputRedaction applied at op registration; +1 #5616: pageEditOperations import (spread shares the pages line); +1 Foundations 1 F1b: attributionOperations import (spread shares the admin line); +1 agent operator wave A6: ops/notices.ts import (mute_notice); +2 agent operator closeout A1: registerOpRoutes import + call (routing logic in fix-routing.ts); +2 C4 pinned questions: questionsOperations import + OP_AREAS row (ops in ops/questions.ts)src/core/pglite-engine.ts 2982 ratchet +4 Foundations 2 Lane F: autocommit write statements take the WAL checkpoint guard (classifier writesWal in pglite-engine/checkpoint-guard.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +5 agent operator gate fixes: repair-failed marker gate before the lock and the marker record after a failed auto-repair (logic in pglite-repair.ts, refusal in pglite-repair-consent.ts); +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); E1 bootstrap moved to engine-sql/bootstrap.ts; ceiling rationale: docs/architecture/key-files/engines-1.md entry for src/core/pglite-engine.ts; evidence delivery: getChunkWindows delegate + type import (+3; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +12 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3213 #5824: searchVector SQL moved to search/vector-statement.ts (-166); lowered to 3117 #5889: searchTitles SQL moved to engine-sql/titles.ts (-108); lowered to 2915 F4a: getHealth SQL moved to engine-sql/health.ts (-202); +6 F4b: planner-sensitive reads call beforePlannerRead/plannerRead (logic in planner-stats.ts); +52 engine graduation (GBRA-50 G2a): marker/tombstone checks before and after the kernel lock (logic in persistence/graduation-custody.ts), lock-retaining close and held-lock open (engine lifecycle methods cannot move)src/core/postgres-engine.ts 2919 ratchet +1 System One v1 evals: search arms clamp to searchLimitCap() (import of search/eval-pool-depth.ts; eval-only --eval-pool-depth, production cap unchanged); refactor wave 1 split target (W1 engine-sql); ceiling rationale: docs/architecture/key-files/engines-2.md entry for src/core/postgres-engine.ts; evidence delivery: getChunkWindows scoped-read delegate + type import (+5; SQL in engine-sql/chunks.ts); #5761: +4 markPagesAttendanceBlocked delegate (SQL in engine-sql/pages.ts); +10 eval wave N1-2/N1-3: mergeOntologyFact same-stint noop check + ontology visibility filter in the grandfathered ontology methods; lowered to 3242 #5824: searchVector SQL moved to search/vector-statement.ts, +explainVectorSearch/runVectorAttempt (-156); +6 #5730: onpoisoned wiring on the instance/module/connection-manager pools + poisonedDiscards in getPoolDiagnostics (counter in pool-gauge.ts); +5 #5801: onCheckout observer seam (fires after reserve resolution / transaction-callback entry; listeners in pool-gauge.ts); lowered to 3119 #5889: searchTitles SQL moved to engine-sql/titles.ts (-133); lowered to 2914 F4a: getHealth SQL moved to engine-sql/health.ts (-216); +2 #5984: transactions track held page guards like PGLite (withHeldPageKeys), so repeated guards in one transaction cost no round trips; +1 #5984: traceSqlOptions import for the env-gated GBRAIN_SQL_TRACE bench hook (src/core/sql-trace.ts); v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (2917 measured); +2 engine graduation (GBRA-50 G2a): initSchema sizing parameter (the source embedding layout sizes a fresh target)src/core/search/hybrid.ts 1584 ratchet +2 System One v1: HybridSearchOpts.decide (search/decide-stage.ts); refactor wave 1 split target (W4 hybrid, cut line); ceiling rationale: docs/architecture/key-files/core-search-1.md entry for src/core/search/hybrid.ts; +10 #5691: per-request embedding_query_prefix read once and threaded to the embeds and cache key-src/core/types.ts 2125 ratchet +5 System One v1 retrieval lane: SearchResult injection_p/injection_suspected, HybridSearchMeta answerability, egress_denied degraded reason; +4 System One v1: SearchResult rerank_score_kind/decide_evidence, HybridSearchMeta decide/rerank; +3 wave review: PAGE_SORT_SQL.updated_asc source_id + id tiebreakers (total order under federated scopes); +5 #4881: OntologyReadOpts extends PageReadScope doc; +3 #4857: PAGE_SORT_SQL.slug total-order tiebreaker comment; grown v0.46.26.0 megawave: EvidenceOpts, pacing/usage result fields, PageFilters growth (#4352 #4218); wave-k: +9 SalienceOpts/AnomaliesOpts source scope (#3867); +20 2026-09 adversarial batch 2: keyword_relaxed_carried stage + relaxed_dropped meta field docs; +16 2026-09 fix wave: SearchResult.keyword_relaxed field + full fusion-demotion doc; (#3867); +9: #4648 rerank_passthrough degraded stage + empty_result_set/malformed_shape reasons | merged v0.48.1.0 true-up; +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); corrective release: shared internal PageReadScope and PageReadPolicy; ranker wave v0.48.4.0: HybridSearchMeta relational_rerank_pin / keyword_arm_confidence / metadata_boost_gate + SearchResult.relational_pinned (+48 over master's peel); +12: #4681 Page.updated_at_iso + keyset cursor precision docs; #5105: canonical page state shared module and transaction/snapshot delegates; #5105: public page revision fields; upstream integration: preserve independently reviewed master additions with branch facade extraction; #5252 wave: typed vector pool and readiness metadata; merged company ingestion/schema routing changes; retired provider integration removed; +1 write-path wave: 'created' effective-date source; +3 read-path wave: rerank_failed degraded stage + budget reason (closed vocabularies) and its recall classification note; +8 fw3-search: SearchOpts.source_boosts + keyword_arm_failed/title_arm_failed stages; +2 wave-2 W4: ChunkInput.embedding_input_hash (#5553); fix wave 3 x fix wave 2 (v0.60.5.0) composition: +2 at the merge; evidence delivery: optional SearchResult.delivered (+2; shape in search/evidence-delivery.ts); +2 eval wave N1-3: OntologyReadOpts.visibility (remote world-only ontology reads); +4 #5827: GraphNode.source_id and GraphPath from_source_id/to_source_id; +2 #5824: SearchOpts.vectorLegacyGuard rollback switch; +7 #5154: PageFilters.listColumnsOnly (interface field); +11 Foundations 1 F1b: WriteAttributionView + AttributedPageVersion (get_versions / get_write_attribution read shapes); +1 #5988: SearchResult.stale carries the held-file detail (interface field); +1 GBRA-49: temporal annotation field on link rows+src/core/types.ts 2126 ratchet +5 System One v1 retrieval lane: SearchResult injection_p/injection_suspected, HybridSearchMeta answerability, egress_denied degraded reason; +4 System One v1: SearchResult rerank_score_kind/decide_evidence, HybridSearchMeta decide/rerank; +3 wave review: PAGE_SORT_SQL.updated_asc source_id + id tiebreakers (total order under federated scopes); +5 #4881: OntologyReadOpts extends PageReadScope doc; +3 #4857: PAGE_SORT_SQL.slug total-order tiebreaker comment; grown v0.46.26.0 megawave: EvidenceOpts, pacing/usage result fields, PageFilters growth (#4352 #4218); wave-k: +9 SalienceOpts/AnomaliesOpts source scope (#3867); +20 2026-09 adversarial batch 2: keyword_relaxed_carried stage + relaxed_dropped meta field docs; +16 2026-09 fix wave: SearchResult.keyword_relaxed field + full fusion-demotion doc; (#3867); +9: #4648 rerank_passthrough degraded stage + empty_result_set/malformed_shape reasons | merged v0.48.1.0 true-up; +master v0.48 merge true-up (reranker succession: no_key preflight, reranker_skipped stage, readiness); corrective release: shared internal PageReadScope and PageReadPolicy; ranker wave v0.48.4.0: HybridSearchMeta relational_rerank_pin / keyword_arm_confidence / metadata_boost_gate + SearchResult.relational_pinned (+48 over master's peel); +12: #4681 Page.updated_at_iso + keyset cursor precision docs; #5105: canonical page state shared module and transaction/snapshot delegates; #5105: public page revision fields; upstream integration: preserve independently reviewed master additions with branch facade extraction; #5252 wave: typed vector pool and readiness metadata; merged company ingestion/schema routing changes; retired provider integration removed; +1 write-path wave: 'created' effective-date source; +3 read-path wave: rerank_failed degraded stage + budget reason (closed vocabularies) and its recall classification note; +8 fw3-search: SearchOpts.source_boosts + keyword_arm_failed/title_arm_failed stages; +2 wave-2 W4: ChunkInput.embedding_input_hash (#5553); fix wave 3 x fix wave 2 (v0.60.5.0) composition: +2 at the merge; evidence delivery: optional SearchResult.delivered (+2; shape in search/evidence-delivery.ts); +2 eval wave N1-3: OntologyReadOpts.visibility (remote world-only ontology reads); +4 #5827: GraphNode.source_id and GraphPath from_source_id/to_source_id; +2 #5824: SearchOpts.vectorLegacyGuard rollback switch; +7 #5154: PageFilters.listColumnsOnly (interface field); +11 Foundations 1 F1b: WriteAttributionView + AttributedPageVersion (get_versions / get_write_attribution read shapes); +1 #5988: SearchResult.stale carries the held-file detail (interface field); +1 GBRA-49: temporal annotation field on link rows; +1 C4: question page type rowsrc/core/minions/queue.ts 2523 ratchet grown #4078 + megawave probe-liveness unlatch (#4310) + master private-queue lifecycle: recovery classifier + monotonic lease; security: durable queued authority and confined filesystem dispatch; master integration: grown #4078 + megawave probe-liveness unlatch (#4310) + master private-queue lifecycle: recovery classifier + monotonic lease; harness support: boundary wiring to shared grants, isolated setup, withdrawal and delegated guards; merged v0.49: durable authority and delegated admission both enforced; typed readiness, configuration-blocked lifecycle and bounded release; +9: prune archives completed dream synthesis keys; +18 Lane D: deferJob (a deferral returns a job to delayed with no attempt counted and no stacktrace growth); the ceiling had 17 lines of slacksrc/commands/init.ts 1869 ratchet grown v0.46.x keyless capability notices; grown db-availability loop: initPostgresCore typed-failure extraction + --prefer-postgres ladder hook + pgvector rethrow fix; +1 at megawave/wave-k merge; +master-merge true-up; wave-k: merge; #3753 --force re-init engine-preservation guard; +1 wave-k merge-union brace (--prefer-postgres close); +10 ambient-writeback WP8: runWritebackNudge consent ask in both engine epilogues (logic lives in core/onboard/writeback-nudge.ts); +4: v0.48.2 reranker readiness at init + test seam; +1: v0.48.2 provider normalization; +3: v0.48.2 review fixes; master integration: +2: preserve typed PGLite busy errors in schema-only init; shared-skills integration on company-ingestion base; retired provider integration removed; retain stored-vector identity on re-init; -14: first-run bundle + quickstart registration helpers live in init-first-run.ts (writeback/skills asks folded into the bundle)src/commands/integrations.ts 1739 ratchet grown v0.46.26.0 megawave (#4039 connector compat) + 1 nosemgrep dataflow annotation (path-traversal audit); wave-k: exported heartbeatPath seam (#3900)@@ -36,7 +36,7 @@ src/core/embedding-migration.ts 1569 ratchet new row: crossed 1500 in v0.46.25.0src/core/github-source.ts 1530 ratchet new row: crossed the 1500 unlisted cap in v0.46.23.0 review fix wave (scope-state gating, client hardening, symlink containment); merged reliability/shared-skills source integration; managed sweep lease wrapper; fix wave 3 lane A: config parser peeled to github-source-config.ts (-47), +account pin wiring and pinned-installation refreshsrc/commands/hook.ts 1903 ratchet cathedral-5 heartbeat extraction offsets part of the BrainBench-seam growth; grown v0.46.26.0 megawave hooks-ipc (#4245); +108 monthly backup check: banner + gated session-start note + detached spawn (backup/status-file readers); +28 ship-review egress hardening: per-harness capture dispatch (capture-spec), memorable gate + receipt + relay block, fail-closed unscanned/newest-guess skips; +79 ambient-writeback WP4: hookStop bank step (gate -> bankWritebackTurn -> IPC flush; gate/bank logic live in core/facts + corpus-segments); +41 adversarial fix wave: wide-tail retry when the 128KB window misses the user turn, by-design heartbeat outcome classes, source-in-name banking; +11 #5413 session-end skips claude-cli self-transcripts; +11 #5701: hook lanes pass allowOversize so a long session reaches the bounded tail readsrc/core/chunkers/code.ts 1588 ratchet new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave (decorated-python defs #3821, version-gate + timeout chunker fixes); grown wave-g (#4511): named defs never folded into merged chunks; grown #4669: skip WASM parse for languages without TOP_LEVEL_TYPES; +6 N13-1: CodeChunkMetadata.definesFunction field + merge-guard stamp (predicate lives in def-types.ts)-src/core/config.ts 1843 ratchet +8 #5988: sync.holds/hold_cap/hold_escalate_count/hold_escalate_pct/parser_regression key registration (read by persistence/sync-holds.ts); +3 agent operator wave A4: GBrainConfig.consent file-plane slot + 2 consent.preapprove.* key rows (logic in core/consent.ts); +1 System One v1: decide.* key prefix (validated by ai/decide/config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave (spend-controls hint #3703, config-set validation); +3 wave G #3974: sync.include_working_tree key; grown wave-g (#4540 #4494 #4415): extractor caps + intent-pattern config keys; +1 chat-connectors: connectors. config prefix; wave-k: config-table snapshot serving the DB-plane reads (#3980 + #2119 merge); +8: loadConfig hook for ~/.gbrain/.env, loader lives in gbrain-env-file.ts (#3893); +17: litellm/together key-fold slots (#3904 reimpl: two GBrainConfig fields + KNOWN_CONFIG_KEYS rows); +1: link_resolution.cross_source key (#3908); +4 v0.47 gmail-loops: loops.extraction_enabled key; +1: pricing.overrides key (#4633 adoption); +7 #4667 adoption: sync.exclude key registration; +4: eval fix wave keys (quote_verify + 3 rescue knobs); +memorable file-plane key registration (integrations.memorable.enabled + consent-event doc); +33 ambient-writeback: memory.* + brain.audience key registration + GBrainConfig.memory mirror slot (resolvers live in facts/writeback-config.ts); +38 2026-08 wave: retrieval_reflex_volunteer key + env mapping (volunteer-arm kill switch) + E5a registration of the 10 adaptive_return*/autocut*/crag_* search (incl. adversarial batch isEnvDisabled dedup); ambient-writeback (master merge): facts/writeback-config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave; prior growth: sync/intent/chat-connectors/litellm/pricing/loops key folds; +34: #4702 content_sanity.disabled_patterns (type + DB-plane parse/merge + key registration); composition true-up (fix-wave multi-train) | merged v0.48.1.0: master #4788 writeback keys + wave #4702/#4748 keys; master: | merged v0.48.1.0 true-up; ranker wave v0.48.4.0: +4 KNOWN_CONFIG_KEYS rows (+8); +5 #4895: CWD_DOTENV_FILES gains the per-NODE_ENV .local variants Bun auto-loads; +2 #5003: sync.include_hidden key registration; +57 #4605: search.* registry reconciled to the keys mode.ts reads (+20 knob rows, +4 direct-read singletons) + GBrainConfig.search slot + adaptive_return* DB-plane merge; +2 pre-landing review: fts.reindex_in_progress key registration (#4795 marker escape hatch); +4 #4987: auto_timeline key registration (the documented off switch was rejected as unknown); lowered to 1793: GHSA wave v0.50.5.0 moved CWD_DOTENV_FILES + dotenvValuesForKey into core/env-trust.ts (-49, re-exported); re-summed to the merged line count after merging master v0.50.2.0 (#5122) with the v0.50.5.0 security wave; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +1 at the merge; evidence delivery: 5 registered config keys + comment (+7); +2 #5691: embedding_query_prefix key registration; evidence delivery auto v2: search.return_budget_conversation key row (+1); +1 #5836: facts.entity_inference key row; +6 #5824: search.vector_legacy_guard key row + GBrainConfig.search slot + DB-plane merge; +3 wave 8 lane D1 #5885: takes.auto_embed key row; +3 #5232: GBrainConfig.persistence.write_wait_ms file-plane slot + key row (resolver in persistence/write-wait.ts); +2 F4b: planner.* and import.analyze_every_pages keys; +3 cat40 cost wave C1 (garrytan/gbrain-evals#57 follow-ups): mcp.result_rows GBrainConfig slot + key row (resolver in mcp/result-rows.ts); v0.60.46.0 merge: both waves' +3 compose (1824 + 3 = 1827 measured); +4 #5984: sync.bulk, sync.bulk_size, sync.bulk_max_txn_ms known keys; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (1838 measured); +2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts)+src/core/config.ts 1844 ratchet +8 #5988: sync.holds/hold_cap/hold_escalate_count/hold_escalate_pct/parser_regression key registration (read by persistence/sync-holds.ts); +3 agent operator wave A4: GBrainConfig.consent file-plane slot + 2 consent.preapprove.* key rows (logic in core/consent.ts); +1 System One v1: decide.* key prefix (validated by ai/decide/config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave (spend-controls hint #3703, config-set validation); +3 wave G #3974: sync.include_working_tree key; grown wave-g (#4540 #4494 #4415): extractor caps + intent-pattern config keys; +1 chat-connectors: connectors. config prefix; wave-k: config-table snapshot serving the DB-plane reads (#3980 + #2119 merge); +8: loadConfig hook for ~/.gbrain/.env, loader lives in gbrain-env-file.ts (#3893); +17: litellm/together key-fold slots (#3904 reimpl: two GBrainConfig fields + KNOWN_CONFIG_KEYS rows); +1: link_resolution.cross_source key (#3908); +4 v0.47 gmail-loops: loops.extraction_enabled key; +1: pricing.overrides key (#4633 adoption); +7 #4667 adoption: sync.exclude key registration; +4: eval fix wave keys (quote_verify + 3 rescue knobs); +memorable file-plane key registration (integrations.memorable.enabled + consent-event doc); +33 ambient-writeback: memory.* + brain.audience key registration + GBrainConfig.memory mirror slot (resolvers live in facts/writeback-config.ts); +38 2026-08 wave: retrieval_reflex_volunteer key + env mapping (volunteer-arm kill switch) + E5a registration of the 10 adaptive_return*/autocut*/crag_* search (incl. adversarial batch isEnvDisabled dedup); ambient-writeback (master merge): facts/writeback-config.ts); new row: crossed the 1500 unlisted cap in v0.46.26.0 megawave; prior growth: sync/intent/chat-connectors/litellm/pricing/loops key folds; +34: #4702 content_sanity.disabled_patterns (type + DB-plane parse/merge + key registration); composition true-up (fix-wave multi-train) | merged v0.48.1.0: master #4788 writeback keys + wave #4702/#4748 keys; master: | merged v0.48.1.0 true-up; ranker wave v0.48.4.0: +4 KNOWN_CONFIG_KEYS rows (+8); +5 #4895: CWD_DOTENV_FILES gains the per-NODE_ENV .local variants Bun auto-loads; +2 #5003: sync.include_hidden key registration; +57 #4605: search.* registry reconciled to the keys mode.ts reads (+20 knob rows, +4 direct-read singletons) + GBrainConfig.search slot + adaptive_return* DB-plane merge; +2 pre-landing review: fts.reindex_in_progress key registration (#4795 marker escape hatch); +4 #4987: auto_timeline key registration (the documented off switch was rejected as unknown); lowered to 1793: GHSA wave v0.50.5.0 moved CWD_DOTENV_FILES + dotenvValuesForKey into core/env-trust.ts (-49, re-exported); re-summed to the merged line count after merging master v0.50.2.0 (#5122) with the v0.50.5.0 security wave; fix wave 3 x fix wave 2 (v0.60.5.0) composition: +1 at the merge; evidence delivery: 5 registered config keys + comment (+7); +2 #5691: embedding_query_prefix key registration; evidence delivery auto v2: search.return_budget_conversation key row (+1); +1 #5836: facts.entity_inference key row; +6 #5824: search.vector_legacy_guard key row + GBrainConfig.search slot + DB-plane merge; +3 wave 8 lane D1 #5885: takes.auto_embed key row; +3 #5232: GBrainConfig.persistence.write_wait_ms file-plane slot + key row (resolver in persistence/write-wait.ts); +2 F4b: planner.* and import.analyze_every_pages keys; +3 cat40 cost wave C1 (garrytan/gbrain-evals#57 follow-ups): mcp.result_rows GBrainConfig slot + key row (resolver in mcp/result-rows.ts); v0.60.46.0 merge: both waves' +3 compose (1824 + 3 = 1827 measured); +4 #5984: sync.bulk, sync.bulk_size, sync.bulk_max_txn_ms known keys; v0.60.48.0 merge: #5984 growth re-summed over v0.60.47.0 (1838 measured); +2 Lane D: facts.drain_budget_usd, facts.drain_daily_budget_usd, facts.drain_max_jobs key registration (validated in core/facts/drain.ts); +2 engine graduation (GBRA-50 G3): GBrainConfig.migrate.graduation file-plane opt-out slot + key row (read by commands/migrate-graduation.ts); +1 GBRA-49: graph.* key prefix (graph.edge_validity, read by link-validity.ts); +1 C4: models.standing_questions key rowsrc/core/bootstrap/harness.ts 2711 ratchet +29 live-PGLite-serve lane: LIVE_SERVE refusal ahead of source resolution + unpinned --token hooks (CI e2e fix); +46 wave review: resolveHookSource dep (serve-parity resolver + federated grant), --source shape validation, loud SOURCE_UNRESOLVED instead of a silent 'default'; +10: #4574 parseCodexBlockBearer http_headers shape + legacy bearer_token fallback; +4 at megawave/wave-k merge; +codex hooks lane: step-7 codex hooks.json + config.toml trust pair, removeHarness arm; +234 ambient-writeback WP3: kind:'instructions' targets (plan/apply/converge-off/remove/status probes, OV-A4 override pre-check) — splice/render mechanics live in instructions-block.ts; +59 adversarial fix wave: registrar-mode block suppression, converge-failure receipt tracking, MCP-confirmed guard before block install; +26 round-3 fixes: codex-lane MCP-confirmed guard + smoke-rollback block strip; master: | merged v0.48.1.0 true-up; +41 #4897 resolveImplicitSource dep + defaultResolveImplicitSource: hooks/token/receipt bind to the serve's implicit default source when --source is omitted; +23 #4586 statusHarness live claude-code mcp verdict (URL mismatch or same-scope non-HTTP registration reads failed, receipt untouched); shared-skills integration on company-ingestion base; +18 #5671: logAmbientPostureNotes helper (registrar note moved out of applyHarness + pre-consent warning when an explicit private facts default meets the HTTP harness; text shared with doctor in facts/writeback-config.ts); +24 #5893: rotation grant carry wiring and its rotationCarry/withheldOperationsNote helpers (carry rules live in token-mint.ts carryLegacyGrant); +6 #5878: --refresh-skills flag and status epoch line (refresh logic lives in harness-skills.ts); +7 #4618 seat: HarnessFlags.seat field, --seat/--no-seat parse via hooks.ts parseSeatFlags, GBRAIN_SEAT in the hook envsrc/core/oauth-provider.ts 1236 ratchet new row: crossed the 1500 unlisted cap absorbing #3819 (DCR 400 invalid_client_metadata + scope filtering + custom-scheme redirect_uris + pseudo-scheme guard); merged v0.49: transactional grant enforcement shared with hosted grant policies; +1 #5222 resourceUrl optionsrc/core/ops/pages.ts 663 ratchet crossed the unlisted 1500 cap in the fix wave: pack-vocabulary enforcement on capture (#4721) + get_page alias follow (#4275) landed together; next growth should peel a pages-ops submodule; +3: alias hop reads the canonical in the owning source (ship-review); +5: explicit source_id liveness check in get_page/list_pages (#4620); +3: #4857 total-order slug sort + list_pages source_id parse; +5: #4620 explicit removed-source id fails loudly; master integration: +4: authenticated delegated private-write boundary and auto-link suppression; #5105: canonical page mutations peeled into persistence modules; +2 v0.50.5.0 purge parameter and shared preflight call; preparation composes through the persistence modules; +7: source-qualified deep-research fetch authorization and ambiguity refusal (codec lives in deep-research-id.ts); +1 #5567: remote get_page keeps materialized markers; +1 #5622: trusted local capture file parameter; +5 #5709: get_page include_timeline_entries (rows via get_timeline's read policy); +8 GBRA-36 security wave: required outputRedaction policy on each pages op; +1 #5154: list_pages passes listColumnsOnly; +17 #5641: list_pages exposes the updated_after_slug keyset cursor and updated_at_iso; +8 agent operator wave A2: every op declares mutating + idempotent (tags only); +7 F3b (#5954): list_pages pagination meta + listing_truncated notice for MCP callers (logic in ops/list-pages-pagination.ts); +4 #5988: get_page file_held (one indexed hold lookup; logic in persistence/held-reads.ts)diff --git a/src/cli.ts b/src/cli.tsindex 4b0bed1098..a6b44fcb8c 100755--- a/src/cli.ts+++ b/src/cli.ts@@ -139,8 +139,7 @@ const SELF_HELP_WITHOUT_ENGINE: Record<string, true | (() => Promise<(engine: ne// runLoops / runWaiting answer --help before touching the engine.loops: async () => (await import('./commands/loops.ts')).runLoops as never,'edge-proposals': async () => (await import('./commands/edge-proposals.ts')).runEdgeProposals as never,- // runQuestions answers --help before touching the engine.- questions: async () => (await import('./commands/questions.ts')).runQuestions as never,+ questions: async () => (await import('./commands/questions.ts')).runQuestions as never, // --help before the enginewaiting: async () => (await import('./commands/loops.ts')).runWaiting as never,// runSources's `--help`/`-h`/undefined-subcommand branch calls printHelp()// without ever touching `engine` — safe to dispatch with no braindiff --git a/src/commands/questions.ts b/src/commands/questions.tsindex ac8f7741c5..601909ef1b 100644--- a/src/commands/questions.ts+++ b/src/commands/questions.ts@@ -73,9 +73,9 @@ function renderReceipt(r: QuestionReceipt, withAnswer: boolean): string {}lines.push(` sentences: ${r.sentences.fresh} fresh, ${r.sentences.stale} stale${r.sentences.withheld ? `, ${r.sentences.withheld} withheld` : ''}; last refresh: ${r.last_refresh_at ?? 'never'}`);if (r.blocked_reason) lines.push(` blocked: ${r.blocked_reason}`);- if (r.next_action) {- const cmd = r.next_action.argv ? shellQuote(r.next_action.argv) : r.next_action.mcp?.tool;- lines.push(` next: ${cmd}`, ` ${r.next_action.why}`);+ if (r.fix) {+ const cmd = r.fix.argv ? shellQuote(r.fix.argv) : r.fix.mcp?.tool;+ lines.push(` next: ${cmd}`, ` ${r.fix.why}`);}return lines.join('\n');}diff --git a/src/core/cycle.ts b/src/core/cycle.tsindex 84ab68c799..57bf791bbe 100644--- a/src/core/cycle.ts+++ b/src/core/cycle.ts@@ -81,8 +81,7 @@ export type CyclePhase =// soft-band takes against recent timeline evidence; report-only in v1// (writes reports/drift-<date>; auto_update mutates nothing).| 'drift'- // C4 — pinned questions: refresh active pins under one BudgetMeter (src/core/questions/phase.ts).- | 'standing_questions'+ | 'standing_questions' // C4 pinned questions (src/core/questions/phase.ts)// #5876 — Life Chronicle events from meeting/conversation/calendar pages (default ON).| 'chronicle'// Lane D — runs queued facts-absorb jobs on PGLite (no job worker there); bounded per run and per day.@@ -177,8 +176,7 @@ export const ALL_PHASES: CyclePhase[] = [// the calibration trio (fresh take resolutions) and BEFORE embed so the// drift report page gets embedded same-cycle. Report-only in v1.'drift',- // C4 — pinned questions (global). Refreshes active pins; question pages publish through the coordinator.- 'standing_questions',+ 'standing_questions', // C4 pinned questions (global); BEFORE embed so question pages embed same-cycle.// #5876 — Life Chronicle events (global). BEFORE embed so event pages embed same-cycle.'chronicle',// Lane D — automatic facts drain (PGLite). BEFORE embed so new facts embed same-cycle.@@ -341,8 +339,7 @@ const NEEDS_LOCK_PHASES: ReadonlySet<CyclePhase> = new Set(['calibration_profile',// #2653 — writes the reports/drift-<date> page.'drift',- // C4 — writes pinned answers and question pages.- 'standing_questions',+ 'standing_questions', // C4: writes pinned answers and question pages.'edge_contradictions', // writes proposals and (apply mode) closure lines// #5876 — writes event pages, projections and the chronicle ledger.'chronicle',@@ -2766,16 +2763,10 @@ export async function runCycle(await safeYield(opts.yieldBetweenPhases);}- // C4 pinned questions: refresh active pins under one BudgetMeter and max_per_cycle (src/core/questions/phase.ts).- if (phases.includes('standing_questions')) {+ if (phases.includes('standing_questions')) { // C4 pinned questions (src/core/questions/phase.ts)checkAborted(cycleSignal);if (!engine) phaseResults.push({ phase: 'standing_questions', status: 'skipped', duration_ms: 0, summary: 'no database connected', details: { reason: 'no_database' } });- else {- progress.start('cycle.standing_questions');- const { runPhaseStandingQuestions } = await import('./questions/phase.ts');- const { result, duration_ms } = await timePhase(() => runPhaseStandingQuestions(engine, { dryRun, signal: cycleSignal }), 'standing_questions');- result.duration_ms = duration_ms; phaseResults.push(result); progress.finish();- }+ else { const { result, duration_ms } = await timePhase(async () => (await import('./questions/phase.ts')).runPhaseStandingQuestions(engine, { dryRun, signal: cycleSignal }), 'standing_questions'); phaseResults.push({ ...result, duration_ms }); }await safeYield(opts.yieldBetweenPhases);}diff --git a/src/core/operations.ts b/src/core/operations.tsindex a5a10daaa5..83b509164e 100644--- a/src/core/operations.ts+++ b/src/core/operations.ts@@ -308,9 +308,7 @@ const OP_AREAS: Record<string, string> = {entity_identity_list: 'entities',// v0.47 open-loop engine (google source kind)open_loops: 'loops', loops_close: 'loops', loops_mute: 'loops', loops_unmute: 'loops',- // C4 pinned questions (owner-private, full surface only)- questions_pin: 'questions', questions_list: 'questions', questions_status: 'questions',- questions_refresh: 'questions', questions_unpin: 'questions',+ questions_pin: 'questions', questions_list: 'questions', questions_status: 'questions', questions_refresh: 'questions', questions_unpin: 'questions', // C4// insight / signal readsget_recent_salience: 'insights', find_anomalies: 'insights',find_contradictions: 'insights', find_experts: 'insights',diff --git a/src/core/questions/receipt.ts b/src/core/questions/receipt.tsindex 93de479c21..512c5a878c 100644--- a/src/core/questions/receipt.ts+++ b/src/core/questions/receipt.ts@@ -41,7 +41,7 @@ export interface QuestionReceipt {last_attempt_at: string | null;last_error: string | null;blocked_reason: BlockedReason | null;- next_action: Action | null;+ fix: Action | null;verify: { argv: string[]; mcp: McpCall };spend_usd: number;refresh_attempts: number;@@ -75,7 +75,7 @@ function lastAttemptFailed(pin: PinRow, prefix: string): boolean {return !pin.last_refresh_at || pin.last_attempt_at.getTime() >= pin.last_refresh_at.getTime();}-export function nextActionFor(pin: PinRow, blocked: BlockedReason | null, freshness: Freshness, remote: boolean): Action | null {+export function fixFor(pin: PinRow, blocked: BlockedReason | null, freshness: Freshness, remote: boolean): Action | null {const id = pinId(pin);switch (blocked) {case 'awaiting_consent':@@ -143,7 +143,7 @@ export async function buildReceipt(engine: BrainEngine, pin: PinRow, view: {last_attempt_at: pin.last_attempt_at?.toISOString() ?? null,last_error: pin.last_error,blocked_reason: blocked,- next_action: nextActionFor(pin, blocked, freshness, view.remote),+ fix: fixFor(pin, blocked, freshness, view.remote),verify: verifyStep(id),spend_usd: Number(pin.spend_usd.toFixed(6)),refresh_attempts: pin.refresh_attempts,diff --git a/src/core/questions/service.ts b/src/core/questions/service.tsindex 970289e707..24639d61f0 100644--- a/src/core/questions/service.ts+++ b/src/core/questions/service.ts@@ -101,7 +101,7 @@ async function resolvePin(ctx: OperationContext, access: CallerAccess, rawId: unif (typeof rawId !== 'string' || !rawId.trim()) throw invalidParam(ctx, op, 'id', `${op}: id is required.`, { example: 'default:questions/who-leads-acme-example-1a2b3c4d' });const parsed = parseQuestionId(rawId, defaultSource(ctx));const notFound = () => opError('question_not_found', `${op}: no pinned question ${rawId} in this connection's scope.`,- 'Pass an id from questions_list (source-qualified, e.g. default:questions/<slug>).',+ 'Pass an id from questions_list; ids are source-qualified, like default:questions/who-leads-acme-example-1a2b3c4d.',{ fix: readFix('Lists the pinned questions this connection can read, with their ids.', { argv: ['gbrain', 'questions', 'list', '--json'], mcp: { tool: 'questions_list', arguments: {} } }) });if (!parsed) throw notFound();if (access.readableSources && !access.readableSources.includes(parsed.sourceId)) throw notFound();@@ -143,18 +143,18 @@ async function receiptFor(ctx: OperationContext, access: CallerAccess, sourceId:why: receipt.blocked_reason? `Pinned question ${receipt.id} is ${receipt.freshness} and blocked (${receipt.blocked_reason}); its stale sentences are flagged here and withheld from context_pack.`: `Pinned question ${receipt.id} has ${receipt.sentences.stale} stale sentence(s): their evidence changed or was removed. They are flagged here and withheld from context_pack until a refresh.`,- ...(receipt.next_action ? { fix: receipt.next_action } : {}),+ ...(receipt.fix ? { fix: receipt.fix } : {}),});}return receipt;}export async function pinQuestion(ctx: OperationContext, p: Record<string, unknown>, deps: QuestionsDeps = {}): Promise<{ created: boolean; activated: boolean; receipt: QuestionReceipt }> {- const access = await requireOwnerCapable(ctx, 'questions_pin', ['gbrain', 'questions', 'pin', typeof p.question === 'string' ? p.question : '<question>']);+ const access = await requireOwnerCapable(ctx, 'questions_pin', typeof p.question === 'string' ? ['gbrain', 'questions', 'pin', p.question] : ['gbrain', 'questions', 'list']);const local = ctx.remote === false;if (p.publish !== undefined && !local) {throw hostOnlyError(ctx, 'question_owner_only', 'questions_pin: publish (draft -> published answers) is set by the owner on the brain host.',- ['gbrain', 'questions', 'pin', '--id', typeof p.id === 'string' ? p.id : '<id>', '--publish'], 'Publishing a draft-only pin changes what context_pack serves, so only the owner decides it.');+ typeof p.id === 'string' ? ['gbrain', 'questions', 'pin', '--id', p.id, '--publish'] : ['gbrain', 'questions', 'list'], 'Publishing a draft-only pin changes what context_pack serves, so only the owner decides it.');}const preapproved = readConsentPreapprovals().paid !== undefined;const desired = local || preapproved ? { state: 'active' as const, inactiveReason: null } : { state: 'inactive' as const, inactiveReason: 'awaiting_consent' as const };@@ -218,13 +218,13 @@ export async function listQuestions(ctx: OperationContext, p: Record<string, unk}export async function questionStatus(ctx: OperationContext, p: Record<string, unknown>): Promise<QuestionReceipt> {- const access = await requireOwnerCapable(ctx, 'questions_status', ['gbrain', 'questions', 'status', typeof p.id === 'string' ? p.id : '<id>']);+ const access = await requireOwnerCapable(ctx, 'questions_status', typeof p.id === 'string' ? ['gbrain', 'questions', 'status', p.id] : ['gbrain', 'questions', 'list']);const pin = await resolvePin(ctx, access, p.id, 'questions_status');return receiptFor(ctx, access, pin.source_id, pin.slug, p.include_answer !== false);}export async function refreshQuestion(ctx: OperationContext, p: Record<string, unknown>, deps: QuestionsDeps = {}): Promise<QuestionReceipt> {- const access = await requireOwnerCapable(ctx, 'questions_refresh', ['gbrain', 'questions', 'refresh', typeof p.id === 'string' ? p.id : '<id>']);+ const access = await requireOwnerCapable(ctx, 'questions_refresh', typeof p.id === 'string' ? ['gbrain', 'questions', 'refresh', p.id] : ['gbrain', 'questions', 'list']);let pin = await resolvePin(ctx, access, p.id, 'questions_refresh');if (ctx.remote !== false) assertSourceInCallerWriteScope(ctx, pin.source_id);if (pin.state !== 'archived') await syncQuestionPage(ctx, pin);@@ -236,7 +236,7 @@ export async function refreshQuestion(ctx: OperationContext, p: Record<string, u}export async function unpinQuestion(ctx: OperationContext, p: Record<string, unknown>): Promise<{ unpinned: boolean; receipt: QuestionReceipt }> {- const access = await requireOwnerCapable(ctx, 'questions_unpin', ['gbrain', 'questions', 'unpin', typeof p.id === 'string' ? p.id : '<id>']);+ const access = await requireOwnerCapable(ctx, 'questions_unpin', typeof p.id === 'string' ? ['gbrain', 'questions', 'unpin', p.id] : ['gbrain', 'questions', 'list']);let pin = await resolvePin(ctx, access, p.id, 'questions_unpin');if (ctx.remote !== false) assertSourceInCallerWriteScope(ctx, pin.source_id);const unpinned = pin.state !== 'archived';diff --git a/src/core/types.ts b/src/core/types.tsindex 4aecb2cf48..4b42197a38 100644--- a/src/core/types.ts+++ b/src/core/types.ts@@ -64,10 +64,7 @@ export const ALL_PAGE_TYPES: readonly string[] = [// extractable:false (events are one-line atoms; diary is private interiority// never mined into the facts table). Pack entries in gbrain-base.yaml.'event', 'diary',- // C4 — `question` = a pinned question's page (question + owner notes; the- // answer lives in pinned_questions). Owner-private, never evidence, set- // explicitly via frontmatter (no path prefix). Pack entry in gbrain-base.yaml.- 'question',+ 'question', // C4 pinned-question page (question + owner notes; owner-private, never evidence; src/core/questions/pages.ts)] as const;/**diff --git a/test/cli-dispatch-phase.test.ts b/test/cli-dispatch-phase.test.tsindex 8c130b07ff..82febfb007 100644--- a/test/cli-dispatch-phase.test.ts+++ b/test/cli-dispatch-phase.test.ts@@ -89,7 +89,7 @@ describe('CLI dispatch shape (master AST)', () => {const shape = await expectNormalizerStable(extractCliDispatch, astNormalizer);expect(shape.sets.CLI_ONLY).toEqual([...CLI_ONLY].sort());expect(shape.sets.THIN_CLIENT_REFUSED_COMMANDS).toEqual([...THIN_CLIENT_REFUSED_COMMANDS].sort());- expect(shape.switchCases.length).toBe(64);+ expect(shape.switchCases.length).toBe(65);expect(Object.keys(shape.commands).length).toBeGreaterThanOrEqual(shape.sets.CLI_ONLY.length);});diff --git a/test/cli-thin-client-refusal-matrix.test.ts b/test/cli-thin-client-refusal-matrix.test.tsindex db835460e8..ec2a329fc9 100644--- a/test/cli-thin-client-refusal-matrix.test.ts+++ b/test/cli-thin-client-refusal-matrix.test.ts@@ -12,7 +12,7 @@* against a remote brain), routes a host-bound subcommand, changes a hint or* exit code, or moves a check across the connectEngine terminator.* Why new: test/cli-dispatch-thin-client.test.ts asserts refusal for a- * hand-picked subset by substring; nothing pins all 64 cases or the full+ * hand-picked subset by substring; nothing pins all 65 cases or the full* text. Seam: none.** Nothing leaves the machine: issuer and MCP URLs point at 127.0.0.1:1@@ -104,8 +104,8 @@ describe('A16b thin-client refusal matrix', () => {routing = await run(ROUTING_ROWS);}, 300_000);- test('the matrix covers all 64 handleCliOnly cases', () => {- expect(CASES.length).toBe(64);+ test('the matrix covers all 65 handleCliOnly cases', () => {+ expect(CASES.length).toBe(65);});test('every handleCliOnly case, run bare on a thin client, matches the golden', () => {diff --git a/test/core/cycle.serial.test.ts b/test/core/cycle.serial.test.tsindex 879802dabf..285148cadc 100644--- a/test/core/cycle.serial.test.ts+++ b/test/core/cycle.serial.test.ts@@ -465,7 +465,8 @@ describe('runCycle — yieldBetweenPhases hook', () => {// conversation_facts_backfill). #5876: 24 (added `chronicle` after drift).// GBRA-40 Lane D: 25 (added `facts_drain` after chronicle).// Temporal typed edges: 26 (added `edge_contradictions` after calibration_profile).- expect(hookCalls).toBe(26);+ // C4 pinned questions: 27 (added `standing_questions` after drift).+ expect(hookCalls).toBe(27);});test('hook exceptions do not abort the cycle', async () => {@@ -480,8 +481,8 @@ describe('runCycle — yieldBetweenPhases hook', () => {// v0.39.0.0: 17 phases (T12 schema-suggest phase between orphans and purge).// v0.41.11.0: 20 phases (+extract_atoms, +synthesize_concepts, +conversation_facts_backfill).// v0.41.39 (#1700) + v0.42.0.0: 22 phases (+enrich_thin, +skillopt).- // #2653: 23 phases (+drift). #5876: 24 (+chronicle). GBRA-40 Lane D: 25 (+facts_drain). Temporal typed edges: 26 (+edge_contradictions).- expect(report.phases.length).toBe(26);+ // #2653: 23 phases (+drift). #5876: 24 (+chronicle). GBRA-40 Lane D: 25 (+facts_drain). Temporal typed edges: 26 (+edge_contradictions). C4: 27 (+standing_questions).+ expect(report.phases.length).toBe(27);});});diff --git a/test/e2e/dream-cycle-phase-order-pglite.test.ts b/test/e2e/dream-cycle-phase-order-pglite.test.tsindex 958faba66d..fc76161cb6 100644--- a/test/e2e/dream-cycle-phase-order-pglite.test.ts+++ b/test/e2e/dream-cycle-phase-order-pglite.test.ts@@ -144,6 +144,7 @@ const EXPECTED_PHASES: CyclePhase[] = ['calibration_profile', // v0.36.1.0'edge_contradictions', // temporal typed edges (proposals by default)'drift', // #2653 — drift detection (default OFF, report-only)+ 'standing_questions', // C4 pinned questions (no pins = skipped)'chronicle', // #5876 — Life Chronicle events (default ON)'facts_drain', // GBRA-40 Lane D — automatic facts drain (PGLite)'conversation_facts_backfill', // v0.41.11.0 — opt-in conversation backfilldiff --git a/test/e2e/pinned-questions-postgres.test.ts b/test/e2e/pinned-questions-postgres.test.tsindex ce72ef3e9f..cc831bef5c 100644--- a/test/e2e/pinned-questions-postgres.test.ts+++ b/test/e2e/pinned-questions-postgres.test.ts@@ -7,28 +7,20 @@* Run: DATABASE_URL=... bun test test/e2e/pinned-questions-postgres.test.ts*/import { afterAll, beforeAll, describe } from 'bun:test';-import { mkdtempSync, rmSync } from 'node:fs';-import { tmpdir } from 'node:os';-import { join } from 'node:path';import type { PostgresEngine } from '../../src/core/postgres-engine.ts';import { hasDatabase, setupDB, teardownDB } from './helpers.ts';import { registerPinnedQuestionSuite } from '../helpers/pinned-questions-scenarios.ts';const d = hasDatabase() ? describe : describe.skip;let engine: PostgresEngine;-const home = mkdtempSync(join(tmpdir(), 'pq-e2e-home-'));-const priorHome = process.env.GBRAIN_HOME;d('pinned questions (live Postgres)', () => {beforeAll(async () => {- process.env.GBRAIN_HOME = home;engine = await setupDB();}, 120_000);afterAll(async () => {await teardownDB();- if (priorHome === undefined) delete process.env.GBRAIN_HOME; else process.env.GBRAIN_HOME = priorHome;- rmSync(home, { recursive: true, force: true });});registerPinnedQuestionSuite('postgres', () => engine);diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-default.json b/test/fixtures/goldens/catalog/pglite-engine-init-default.jsonindex 08d4dbb248..987e071ed7 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-default.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-default.json@@ -233,9 +233,12 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)","planner_stats_deltas.planner_stats_deltas_pkey": "p PRIMARY KEY (id)","planner_stats_state.planner_stats_state_pkey": "p PRIMARY KEY (table_name)","query_cache.query_cache_pkey": "p PRIMARY KEY (id)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -592,6 +595,9 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"planner_stats_deltas": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -601,6 +607,9 @@"query_cache": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -962,9 +971,14 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)","planner_stats_deltas_pkey": "CREATE UNIQUE INDEX planner_stats_deltas_pkey ON public.planner_stats_deltas USING btree (id)","planner_stats_state_pkey": "CREATE UNIQUE INDEX planner_stats_state_pkey ON public.planner_stats_state USING btree (table_name)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","search_telemetry_pkey": "CREATE UNIQUE INDEX search_telemetry_pkey ON public.search_telemetry USING btree (date, mode, intent)",@@ -1073,7 +1087,9 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id","planner_stats_deltas_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=planner_stats_deltas.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -2420,6 +2436,42 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"planner_stats_deltas": {"columns": ["1 id bigint/int8 NOT NULL DEFAULT nextval('planner_stats_deltas_id_seq'::regclass)",@@ -2455,6 +2507,24 @@],"flags": "relkind=r rls=false force_rls=false"},+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.jsonindex e09fbe350e..a8c59c4062 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-fts-portuguese.json@@ -233,9 +233,12 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)","planner_stats_deltas.planner_stats_deltas_pkey": "p PRIMARY KEY (id)","planner_stats_state.planner_stats_state_pkey": "p PRIMARY KEY (table_name)","query_cache.query_cache_pkey": "p PRIMARY KEY (id)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -592,6 +595,9 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"planner_stats_deltas": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -601,6 +607,9 @@"query_cache": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -962,9 +971,14 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)","planner_stats_deltas_pkey": "CREATE UNIQUE INDEX planner_stats_deltas_pkey ON public.planner_stats_deltas USING btree (id)","planner_stats_state_pkey": "CREATE UNIQUE INDEX planner_stats_state_pkey ON public.planner_stats_state USING btree (table_name)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","search_telemetry_pkey": "CREATE UNIQUE INDEX search_telemetry_pkey ON public.search_telemetry USING btree (date, mode, intent)",@@ -1073,7 +1087,9 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id","planner_stats_deltas_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=planner_stats_deltas.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -2420,6 +2436,42 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"planner_stats_deltas": {"columns": ["1 id bigint/int8 NOT NULL DEFAULT nextval('planner_stats_deltas_id_seq'::regclass)",@@ -2455,6 +2507,24 @@],"flags": "relkind=r rls=false force_rls=false"},+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.jsonindex 24e561c2f2..6365da27a5 100644--- a/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-engine-init-high-dims.json@@ -233,9 +233,12 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)","planner_stats_deltas.planner_stats_deltas_pkey": "p PRIMARY KEY (id)","planner_stats_state.planner_stats_state_pkey": "p PRIMARY KEY (table_name)","query_cache.query_cache_pkey": "p PRIMARY KEY (id)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -592,6 +595,9 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"planner_stats_deltas": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -601,6 +607,9 @@"query_cache": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -958,9 +967,14 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)","planner_stats_deltas_pkey": "CREATE UNIQUE INDEX planner_stats_deltas_pkey ON public.planner_stats_deltas USING btree (id)","planner_stats_state_pkey": "CREATE UNIQUE INDEX planner_stats_state_pkey ON public.planner_stats_state USING btree (table_name)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","search_telemetry_pkey": "CREATE UNIQUE INDEX search_telemetry_pkey ON public.search_telemetry USING btree (date, mode, intent)",@@ -1069,7 +1083,9 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id","planner_stats_deltas_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=planner_stats_deltas.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -2416,6 +2432,42 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"planner_stats_deltas": {"columns": ["1 id bigint/int8 NOT NULL DEFAULT nextval('planner_stats_deltas_id_seq'::regclass)",@@ -2451,6 +2503,24 @@],"flags": "relkind=r rls=false force_rls=false"},+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json b/test/fixtures/goldens/catalog/pglite-schema-blob-default.jsonindex 3593c70c1c..745dee8161 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-default.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-default.json@@ -182,6 +182,9 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -462,6 +465,12 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -717,6 +726,11 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","session_context_state_pkey": "CREATE UNIQUE INDEX session_context_state_pkey ON public.session_context_state USING btree (source_id, client_id, session_id)",@@ -809,6 +823,8 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -1823,6 +1839,60 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.jsonindex 4772662033..6660cd8c39 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-fts-portuguese.json@@ -182,6 +182,9 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -462,6 +465,12 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -717,6 +726,11 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","session_context_state_pkey": "CREATE UNIQUE INDEX session_context_state_pkey ON public.session_context_state USING btree (source_id, client_id, session_id)",@@ -809,6 +823,8 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -1823,6 +1839,60 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.jsonindex fba01b4be1..a87f463388 100644--- a/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json+++ b/test/fixtures/goldens/catalog/pglite-schema-blob-high-dims.json@@ -182,6 +182,9 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -462,6 +465,12 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -716,6 +725,11 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","session_context_state_pkey": "CREATE UNIQUE INDEX session_context_state_pkey ON public.session_context_state USING btree (source_id, client_id, session_id)",@@ -808,6 +822,8 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -1822,6 +1838,60 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/fixtures/goldens/cli/dispatch-phase.json b/test/fixtures/goldens/cli/dispatch-phase.jsonindex dc9700b4c9..32912bb6f3 100644--- a/test/fixtures/goldens/cli/dispatch-phase.json+++ b/test/fixtures/goldens/cli/dispatch-phase.json@@ -1324,6 +1324,13 @@"list"]},+ "questions": {+ "hasSwitchCase": true,+ "phase": "post-connect",+ "preConnectRules": [],+ "thinClient": "refuse",+ "thinClientRoutedSubcommands": []+ },"recall": {"hasSwitchCase": true,"phase": "post-connect",diff --git a/test/fixtures/goldens/cli/help-and-errors.json b/test/fixtures/goldens/cli/help-and-errors.jsonindex 40a5f714f2..93917fc5a3 100644--- a/test/fixtures/goldens/cli/help-and-errors.json+++ b/test/fixtures/goldens/cli/help-and-errors.json@@ -112,6 +112,7 @@" facts relink [--dry-run] Link facts saved without an entity to the entity they name"," check-resolvable [--json] [--fix] Validate skill tree (reachability/MECE/DRY)"," report --type <name> --content ... Save timestamped report to brain/reports/",+ " questions pin|list|status|refresh|unpin Pinned questions: cited answers kept current (owner-private)","","OPEN LOOPS (Gmail/Calendar/Contacts connector — v0.47)"," google setup [--account <email>] One command: BYO OAuth → source → first sync → first digest",@@ -322,6 +323,7 @@" facts relink [--dry-run] Link facts saved without an entity to the entity they name"," check-resolvable [--json] [--fix] Validate skill tree (reachability/MECE/DRY)"," report --type <name> --content ... Save timestamped report to brain/reports/",+ " questions pin|list|status|refresh|unpin Pinned questions: cited answers kept current (owner-private)","","OPEN LOOPS (Gmail/Calendar/Contacts connector — v0.47)"," google setup [--account <email>] One command: BYO OAuth → source → first sync → first digest",@@ -532,6 +534,7 @@" facts relink [--dry-run] Link facts saved without an entity to the entity they name"," check-resolvable [--json] [--fix] Validate skill tree (reachability/MECE/DRY)"," report --type <name> --content ... Save timestamped report to brain/reports/",+ " questions pin|list|status|refresh|unpin Pinned questions: cited answers kept current (owner-private)","","OPEN LOOPS (Gmail/Calendar/Contacts connector — v0.47)"," google setup [--account <email>] One command: BYO OAuth → source → first sync → first digest",diff --git a/test/fixtures/goldens/cli/literal-imports.json b/test/fixtures/goldens/cli/literal-imports.jsonindex 89c0fd2682..44fe31bfbd 100644--- a/test/fixtures/goldens/cli/literal-imports.json+++ b/test/fixtures/goldens/cli/literal-imports.json@@ -127,6 +127,9 @@"quarantine": ["./commands/quarantine.ts"],+ "questions": [+ "./commands/questions.ts"+ ],"recall": ["./commands/recall.ts"],diff --git a/test/fixtures/goldens/cli/membership-sets.json b/test/fixtures/goldens/cli/membership-sets.jsonindex 345a1403ec..8e3ef839ea 100644--- a/test/fixtures/goldens/cli/membership-sets.json+++ b/test/fixtures/goldens/cli/membership-sets.json@@ -69,6 +69,7 @@"refusedNotInCliOnly": [],"refusedWithoutHint": ["edge-proposals",+ "questions","watch"],"selfHelpNotInCliOnly": [],@@ -166,6 +167,7 @@"providers","publish","quarantine",+ "questions","recall","reconcile-links","reindex",@@ -267,6 +269,7 @@"projections","protocol","providers",+ "questions","reindex","reinit-pglite","remote",@@ -320,6 +323,7 @@"orphans","pages","pricing",+ "questions","repair","retrieval-upgrade","salience",@@ -366,6 +370,7 @@"pages","pricing","projections",+ "questions","repair","repair-jsonb","retrieval-upgrade",diff --git a/test/fixtures/goldens/cli/thin-client-cases.json b/test/fixtures/goldens/cli/thin-client-cases.jsonindex f4dc787522..b32fc3b3bd 100644--- a/test/fixtures/goldens/cli/thin-client-cases.json+++ b/test/fixtures/goldens/cli/thin-client-cases.json@@ -656,6 +656,16 @@],"stdout": []},+ {+ "argv": "questions",+ "exitCode": 1,+ "stderr": [+ "Error [requires_local_engine]: `gbrain questions` requires a local engine. This install is a thin client of http://127.0.0.1:1/mcp.",+ "Fix: gbrain questions",+ "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/cli/tools-json.json b/test/fixtures/goldens/cli/tools-json.jsonindex fb4b430e37..511a136139 100644--- a/test/fixtures/goldens/cli/tools-json.json+++ b/test/fixtures/goldens/cli/tools-json.json@@ -2,8 +2,8 @@"golden": {"exitCode": 0,"stderr": "",- "stdoutBytes": 198595,- "stdoutSha256": "7d2b43ea2fc64cd07907cc2fd1ecb1fae4812fe23091cd76629a7512ff57de98",+ "stdoutBytes": 203906,+ "stdoutSha256": "94e6a802747d78ad206947eaefc53017d3a037d3641be974e03cbaf968958265","toolNames": ["remember","entity",@@ -160,6 +160,11 @@"loops_close","loops_mute","loops_unmute",+ "questions_pin",+ "questions_list",+ "questions_status",+ "questions_refresh",+ "questions_unpin","mute_notice"],"tools": [@@ -6302,6 +6307,183 @@},"scope": "write"},+ {+ "description": "Pin a question: gbrain keeps a cited answer current from your notes and flags sentences whose evidence changed. Idempotent. Pins made over MCP stay inactive (paid refresh) until the owner activates them; returns the first answer when a key and consent exist, else awaiting_refresh with next_action.",+ "idempotent": true,+ "local_only": false,+ "mutating": true,+ "name": "questions_pin",+ "parameters": {+ "defer": "boolean?",+ "id": "string?",+ "publish": "boolean?",+ "question": "string?",+ "scope": "object?",+ "wait_ms": "number?"+ },+ "required_scopes": [],+ "schema": {+ "properties": {+ "defer": {+ "description": "Skip the first answer.",+ "type": "boolean"+ },+ "id": {+ "description": "Existing pin id: re-pin or (owner, on the host) activate it.",+ "type": "string"+ },+ "publish": {+ "description": "Owner only: publish a draft-only pin.",+ "type": "boolean"+ },+ "question": {+ "description": "The question (omit when passing id).",+ "type": "string"+ },+ "scope": {+ "additionalProperties": false,+ "description": "Evidence scope; default: the current source.",+ "properties": {+ "entity": {+ "description": "Entity page slug the question is about.",+ "type": "string"+ },+ "slug_prefix": {+ "description": "Only pages under this prefix, e.g. projects/.",+ "type": "string"+ },+ "source": {+ "description": "Source id.",+ "type": "string"+ }+ },+ "required": [],+ "type": "object"+ },+ "wait_ms": {+ "description": "Max ms to wait for the answer (pin default 30000, refresh 120000; max 300000).",+ "type": "number"+ }+ },+ "required": [],+ "type": "object"+ },+ "scope": "write"+ },+ {+ "description": "List pinned questions with freshness, blocked reason and next action, plus fresh/stale/pending counts. Owner-capable connections only.",+ "idempotent": true,+ "local_only": false,+ "mutating": false,+ "name": "questions_list",+ "parameters": {+ "include_archived": "boolean?",+ "source": "string?"+ },+ "required_scopes": [],+ "schema": {+ "properties": {+ "include_archived": {+ "description": "Include unpinned (archived) questions.",+ "type": "boolean"+ },+ "source": {+ "description": "Only this source.",+ "type": "string"+ }+ },+ "required": [],+ "type": "object"+ },+ "scope": "read"+ },+ {+ "description": "One pinned question: the answer with per-sentence stale flags, evidence watermark, last refresh, blocked reason, next action and verify step. Owner-capable connections only.",+ "idempotent": true,+ "local_only": false,+ "mutating": false,+ "name": "questions_status",+ "parameters": {+ "id": "string",+ "include_answer": "boolean?"+ },+ "required_scopes": [],+ "schema": {+ "properties": {+ "id": {+ "description": "Source-qualified id from questions_list, e.g. default:questions/<slug>.",+ "type": "string"+ },+ "include_answer": {+ "description": "Include answer sentences (default true).",+ "type": "boolean"+ }+ },+ "required": [+ "id"+ ],+ "type": "object"+ },+ "scope": "read"+ },+ {+ "description": "Refresh a pinned answer now (a paid model call): re-retrieves current evidence and edits the answer, or recomputes with full or after deletions. A failed refresh keeps the previous answer with its stale flags.",+ "idempotent": false,+ "local_only": false,+ "mutating": true,+ "name": "questions_refresh",+ "parameters": {+ "full": "boolean?",+ "id": "string",+ "wait_ms": "number?"+ },+ "required_scopes": [],+ "schema": {+ "properties": {+ "full": {+ "description": "Recompute from scratch.",+ "type": "boolean"+ },+ "id": {+ "description": "Source-qualified id from questions_list, e.g. default:questions/<slug>.",+ "type": "string"+ },+ "wait_ms": {+ "description": "Max ms to wait for the answer (pin default 30000, refresh 120000; max 300000).",+ "type": "number"+ }+ },+ "required": [+ "id"+ ],+ "type": "object"+ },+ "scope": "write"+ },+ {+ "description": "Unpin a question: refreshes stop and its page is archived (your notes on it are kept). Idempotent.",+ "idempotent": true,+ "local_only": false,+ "mutating": true,+ "name": "questions_unpin",+ "parameters": {+ "id": "string"+ },+ "required_scopes": [],+ "schema": {+ "properties": {+ "id": {+ "description": "Source-qualified id from questions_list, e.g. default:questions/<slug>.",+ "type": "string"+ }+ },+ "required": [+ "id"+ ],+ "type": "object"+ },+ "scope": "write"+ },{"description": "Stop a coaching or info notice from appearing for this client (or unmute it with muted: false). Safety, degraded and ask notices cannot be muted.","idempotent": true,diff --git a/test/fixtures/goldens/doctor/json-pglite-degraded.json b/test/fixtures/goldens/doctor/json-pglite-degraded.jsonindex 94f7bae7f2..05ba25a6a8 100644--- a/test/fixtures/goldens/doctor/json-pglite-degraded.json+++ b/test/fixtures/goldens/doctor/json-pglite-degraded.json@@ -507,13 +507,13 @@},{"category": "meta",- "message": "Version 204 (latest: 204)",+ "message": "Version 205 (latest: 205)","name": "schema_version","status": "ok"},{"category": "meta",- "message": "901 column(s) verified against live schema",+ "message": "945 column(s) verified against live schema","name": "schema_columns","status": "ok"},@@ -1606,7 +1606,7 @@},{"category": "brain",- "message": "No retrieval-affecting files changed in working tree.",+ "message": "1 retrieval-affecting file(s) changed since HEAD: src/core/operations.ts. Re-run `gbrain eval run-all` after committing these changes.","name": "eval_drift","status": "ok"},@@ -1717,7 +1717,7 @@"category": "meta","details": {"counts": {- "global": 12,+ "global": 13,"mixed": 2,"source": 12},@@ -1745,12 +1745,13 @@"resolve_symbol_edges": "global","schema-suggest": "source","skillopt": "global",+ "standing_questions": "global","sync": "source","synthesize": "mixed","synthesize_concepts": "global"}},- "message": "Phase taxonomy: 12 source-scoped, 12 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ "message": "Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, standing_questions, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].","name": "cycle_phase_scope","status": "ok"},diff --git a/test/fixtures/goldens/doctor/json-pglite-fresh.json b/test/fixtures/goldens/doctor/json-pglite-fresh.jsonindex 06a1d81f94..ff5f615ec1 100644--- a/test/fixtures/goldens/doctor/json-pglite-fresh.json+++ b/test/fixtures/goldens/doctor/json-pglite-fresh.json@@ -510,13 +510,13 @@},{"category": "meta",- "message": "Version 204 (latest: 204)",+ "message": "Version 205 (latest: 205)","name": "schema_version","status": "ok"},{"category": "meta",- "message": "901 column(s) verified against live schema",+ "message": "945 column(s) verified against live schema","name": "schema_columns","status": "ok"},@@ -1683,7 +1683,7 @@},{"category": "brain",- "message": "No retrieval-affecting files changed in working tree.",+ "message": "1 retrieval-affecting file(s) changed since HEAD: src/core/operations.ts. Re-run `gbrain eval run-all` after committing these changes.","name": "eval_drift","status": "ok"},@@ -1793,7 +1793,7 @@"category": "meta","details": {"counts": {- "global": 12,+ "global": 13,"mixed": 2,"source": 12},@@ -1821,12 +1821,13 @@"resolve_symbol_edges": "global","schema-suggest": "source","skillopt": "global",+ "standing_questions": "global","sync": "source","synthesize": "mixed","synthesize_concepts": "global"}},- "message": "Phase taxonomy: 12 source-scoped, 12 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].",+ "message": "Phase taxonomy: 12 source-scoped, 13 brain-global, 2 mixed. Source-safe: [lint, backlinks, sync, extract, extract_facts, extract_atoms, recompute_emotional_weight, consolidate, propose_takes, conversation_facts_backfill, enrich_thin, schema-suggest]. Brain-global: [resolve_symbol_edges, synthesize_concepts, grade_takes, calibration_profile, edge_contradictions, drift, standing_questions, chronicle, facts_drain, skillopt, embed, orphans, purge]. Mixed: [synthesize, patterns].","name": "cycle_phase_scope","status": "ok"},diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex 6f81d1cc01..83e20ebf47 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -1,6 +1,6 @@{"golden": {- "count": 199,+ "count": 200,"gaps": [17,18,@@ -18,6 +18,7 @@"dropInvalidConcurrentIndex": "6864d844b7dfb2fbecdd0fb9c73e06248473376feb794b3fe58f036c70d2d44c","getFtsLanguage": "0d790b4c4af1f67a2a1bbd59470beb13f434917b381931baf8404a41c5d903db","hnswMaxDimsForType": "a187cdcc520f813b7c39da97ce53da58509232ed9f851627ef41abfe1b68bd26",+ "migrateAutoThinkToPins": "acdb45b8a1c474004b119f900ddd4a902d98681d6379edad15708d87dd834bb4","migrateConnectorCheckpoints": "e0403022a56559556c82a9fa1e90d928f36e1d09c7db570e1d788a87d2dc9521","migrateLegacyTokens": "6e4abe3670127e7a495b56ecbf9f5789edd3a7362d45704656c2210a85b27f4c","migrationNotice": "9a6607b26a9719ef1833571b137bc8ebfcd1e16d545e89ff8728cf3ccbcbb409",@@ -29,7 +30,7 @@"slugifyPath": "401dbca23580865d8b168dd8d84db4a6c708c6610d7cb61abafc7d0ee9809063","verifyProjectionStatistics": "59d9ccfea1c53384d8607874a51209a9c2dfd51b2b85a2cb6269fa4120faf1f3"},- "latest": 204,+ "latest": 205,"records": [{"handler": {@@ -3029,6 +3030,25 @@"transaction": "absent","verify": "absent","version": 204+ },+ {+ "handler": {+ "form": "arrow",+ "helpers": [+ "migrateAutoThinkToPins"+ ],+ "sha256": "6538d483dacf5b76e4eb837603082e0c8611c613f6c534007fa2f2b197e1e1ed"+ },+ "idempotent": true,+ "name": "pinned_questions",+ "sql": {+ "length": 2746,+ "sha256": "07ff5ebf8abd16f5edf1bb76318ef541e7a74a3c275a78dac04acb103858e93b"+ },+ "sqlFor": "absent",+ "transaction": "absent",+ "verify": "absent",+ "version": 205}],"versions": [@@ -3230,7 +3250,8 @@201,202,203,- 204+ 204,+ 205]},"normalizer": "migrations-record-v1"diff --git a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.jsonindex bd77ebcadb..ef6bbeb6e3 100644--- a/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json+++ b/test/fixtures/goldens/pglite-upgrade-replay/catalog-after-boot.json@@ -233,9 +233,12 @@"persistence_writer_protocols.persistence_writer_protocols_pkey": "p PRIMARY KEY (worktree_id, host_id)","persistence_writer_protocols.persistence_writer_protocols_protocol_version_check": "c CHECK ((protocol_version = 2))","persistence_writer_protocols.persistence_writer_protocols_worktree_id_fkey": "f FOREIGN KEY (worktree_id) REFERENCES persistence_worktrees(id)",+ "pinned_questions.pinned_questions_pkey": "p PRIMARY KEY (id)",+ "pinned_questions.pinned_questions_source_slug_key": "u UNIQUE (source_id, slug)","planner_stats_deltas.planner_stats_deltas_pkey": "p PRIMARY KEY (id)","planner_stats_state.planner_stats_state_pkey": "p PRIMARY KEY (table_name)","query_cache.query_cache_pkey": "p PRIMARY KEY (id)",+ "question_evidence.question_evidence_pkey": "p PRIMARY KEY (id)","raw_data.raw_data_page_id_fkey": "f FOREIGN KEY (page_id) REFERENCES pages(id) ON DELETE CASCADE","raw_data.raw_data_page_id_source_key": "u UNIQUE (page_id, source)","raw_data.raw_data_pkey": "p PRIMARY KEY (id)",@@ -592,6 +595,9 @@"persistence_writer_protocols": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "pinned_questions": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"planner_stats_deltas": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -601,6 +607,9 @@"query_cache": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],+ "question_evidence": [+ "<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"+ ],"raw_data": ["<current_role> -> <current_role> WITH GRANT OPTION: DELETE,INSERT,REFERENCES,SELECT,TRIGGER,TRUNCATE,UPDATE"],@@ -962,9 +971,14 @@"persistence_worktree_refreshes_pkey": "CREATE UNIQUE INDEX persistence_worktree_refreshes_pkey ON public.persistence_worktree_refreshes USING btree (id)","persistence_worktrees_pkey": "CREATE UNIQUE INDEX persistence_worktrees_pkey ON public.persistence_worktrees USING btree (id)","persistence_writer_protocols_pkey": "CREATE UNIQUE INDEX persistence_writer_protocols_pkey ON public.persistence_writer_protocols USING btree (worktree_id, host_id)",+ "pinned_questions_pkey": "CREATE UNIQUE INDEX pinned_questions_pkey ON public.pinned_questions USING btree (id)",+ "pinned_questions_source_slug_key": "CREATE UNIQUE INDEX pinned_questions_source_slug_key ON public.pinned_questions USING btree (source_id, slug)",+ "pinned_questions_state_idx": "CREATE INDEX pinned_questions_state_idx ON public.pinned_questions USING btree (state, source_id)","planner_stats_deltas_pkey": "CREATE UNIQUE INDEX planner_stats_deltas_pkey ON public.planner_stats_deltas USING btree (id)","planner_stats_state_pkey": "CREATE UNIQUE INDEX planner_stats_state_pkey ON public.planner_stats_state USING btree (table_name)","query_cache_pkey": "CREATE UNIQUE INDEX query_cache_pkey ON public.query_cache USING btree (id)",+ "question_evidence_pkey": "CREATE UNIQUE INDEX question_evidence_pkey ON public.question_evidence USING btree (id)",+ "question_evidence_question_idx": "CREATE INDEX question_evidence_question_idx ON public.question_evidence USING btree (question_id, answer_revision)","raw_data_page_id_source_key": "CREATE UNIQUE INDEX raw_data_page_id_source_key ON public.raw_data USING btree (page_id, source)","raw_data_pkey": "CREATE UNIQUE INDEX raw_data_pkey ON public.raw_data USING btree (id)","search_telemetry_pkey": "CREATE UNIQUE INDEX search_telemetry_pkey ON public.search_telemetry USING btree (date, mode, intent)",@@ -1073,7 +1087,9 @@"pages_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=pages.id","persistence_effects_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_effects.id","persistence_requests_sequence_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=persistence_requests.sequence",+ "pinned_questions_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=pinned_questions.id","planner_stats_deltas_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=planner_stats_deltas.id",+ "question_evidence_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=question_evidence.id","raw_data_id_seq": "integer start=1 min=1 max=2147483647 increment=1 cycle=false cache=1 owned_by=raw_data.id","slug_aliases_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=slug_aliases.id","subagent_messages_id_seq": "bigint start=1 min=1 max=9223372036854775807 increment=1 cycle=false cache=1 owned_by=subagent_messages.id",@@ -2420,6 +2436,42 @@],"flags": "relkind=r rls=true force_rls=false"},+ "pinned_questions": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('pinned_questions_id_seq'::regclass)",+ "2 source_id text/text NOT NULL",+ "3 slug text/text NOT NULL",+ "4 question text/text NOT NULL",+ "5 scope_slug_prefix text/text NULL",+ "6 scope_entity text/text NULL",+ "7 state text/text NOT NULL DEFAULT 'active'::text",+ "8 inactive_reason text/text NULL",+ "9 publish_mode text/text NOT NULL DEFAULT 'publish'::text",+ "10 model text/text NULL",+ "11 cooldown_days real/float4 NULL",+ "12 origin text/text NOT NULL DEFAULT 'pin'::text",+ "13 created_by text/text NOT NULL",+ "14 revision bigint/int8 NOT NULL DEFAULT 1",+ "15 answer_revision integer/int4 NOT NULL DEFAULT 0",+ "16 answer text/text NULL",+ "17 answer_model text/text NULL",+ "18 last_refresh_at timestamp with time zone/timestamptz NULL",+ "19 last_attempt_at timestamp with time zone/timestamptz NULL",+ "20 last_error text/text NULL",+ "21 watermark_generation bigint/int8 NULL",+ "22 watermark_fact_id bigint/int8 NULL",+ "23 watermark_at timestamp with time zone/timestamptz NULL",+ "24 lease_token text/text NULL",+ "25 lease_owner text/text NULL",+ "26 lease_expires_at timestamp with time zone/timestamptz NULL",+ "27 refresh_attempts integer/int4 NOT NULL DEFAULT 0",+ "28 spend_usd double precision/float8 NOT NULL DEFAULT 0",+ "29 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "30 updated_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()",+ "31 archived_at timestamp with time zone/timestamptz NULL"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"planner_stats_deltas": {"columns": ["1 id bigint/int8 NOT NULL DEFAULT nextval('planner_stats_deltas_id_seq'::regclass)",@@ -2455,6 +2507,24 @@],"flags": "relkind=r rls=false force_rls=false"},+ "question_evidence": {+ "columns": [+ "1 id bigint/int8 NOT NULL DEFAULT nextval('question_evidence_id_seq'::regclass)",+ "2 question_id bigint/int8 NOT NULL",+ "3 answer_revision integer/int4 NOT NULL",+ "4 sentence_id text/text NOT NULL",+ "5 kind text/text NOT NULL",+ "6 source_id text/text NOT NULL",+ "7 page_id integer/int4 NULL",+ "8 page_slug text/text NULL",+ "9 page_generation bigint/int8 NULL",+ "10 page_revision text/text NULL",+ "11 item_id bigint/int8 NULL",+ "12 content_hash text/text NULL",+ "13 created_at timestamp with time zone/timestamptz NOT NULL DEFAULT now()"+ ],+ "flags": "relkind=r rls=true force_rls=false"+ },"raw_data": {"columns": ["1 id integer/int4 NOT NULL DEFAULT nextval('raw_data_id_seq'::regclass)",diff --git a/test/helpers/pinned-questions-scenarios.ts b/test/helpers/pinned-questions-scenarios.tsindex d0b21dc524..e7789438b7 100644--- a/test/helpers/pinned-questions-scenarios.ts+++ b/test/helpers/pinned-questions-scenarios.ts@@ -113,7 +113,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiconst { body } = await mcp(engine, 'questions_pin', { question: QUESTION, scope: { entity: ENTITY } }, { scopes: ['read', 'write'], sourceId: s.sourceId });const receipt = (body as unknown as Pinned).receipt;expect(receipt).toMatchObject({ state: 'inactive', inactive_reason: 'awaiting_consent', freshness: 'awaiting_refresh', blocked_reason: 'awaiting_consent', page_materialized: false });- expect(receipt.next_action).toMatchObject({ argv: ['gbrain', 'questions', 'pin', '--id', receipt.id], consent: ['paid'], actor: 'user' });+ expect(receipt.fix).toMatchObject({ argv: ['gbrain', 'questions', 'pin', '--id', receipt.id], consent: ['paid'], actor: 'user' });const refreshed = await mcp(engine, 'questions_refresh', { id: receipt.id }, { scopes: ['read', 'write'], sourceId: s.sourceId });expect(refreshed.body).toMatchObject({ blocked_reason: 'awaiting_consent', refresh: { status: 'blocked', blocked_reason: 'awaiting_consent' } });expect(calls.calls).toBe(0);@@ -132,7 +132,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiconst snap = await engine.readPageSnapshot(slug, { sourceId: s.sourceId });await putPage(engine, s.sourceId, slug, `---\n${Object.entries(snap!.page.frontmatter as Record<string, unknown>).map(([k, v]) => `${k}: ${JSON.stringify(v)}`).join('\n')}\ntitle: ${JSON.stringify(snap!.page.title)}\ntype: question\n---\n${snap!.page.compiled_truth}\nMy own note about acme.\n`, snap!.revision);const out = await unpinQuestion(localCtx(engine, s.sourceId), { id: pinned.receipt.id });- expect(out).toMatchObject({ unpinned: true, receipt: { state: 'archived', freshness: 'archived', blocked_reason: null, next_action: null } });+ expect(out).toMatchObject({ unpinned: true, receipt: { state: 'archived', freshness: 'archived', blocked_reason: null, fix: null } });const [row] = await engine.executeRaw<{ status: string; body: string }>(`SELECT frontmatter->>'status' AS status, compiled_truth AS body FROM pages WHERE source_id = $1 AND slug = $2`, [s.sourceId, slug]);expect(row).toMatchObject({ status: 'archived' });expect(row!.body).toContain('My own note about acme.');@@ -243,7 +243,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiexpect(after.freshness).toBe('stale');expect(notices).toMatchObject([{ code: 'pinned_answer_stale', kind: 'degraded' }]);expect(sentence(after, c.needle)).toMatchObject({ stale: true, reasons: [c.reason] });- expect(after.next_action?.mcp?.tool).toBe('questions_refresh');+ expect(after.fix?.mcp?.tool).toBe('questions_refresh');const pack = await (await import('../../src/core/questions/service.ts')).pinnedAnswersForPack(localCtx(engine, s.sourceId), [ENTITY]);expect(pack?.withheld?.stale_sentences).toBe(after.sentences.stale);expect(JSON.stringify(pack?.pinned_questions ?? [])).not.toContain(before!.text);@@ -335,7 +335,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiexpect(ev!.n).toBeGreaterThan(0);const r = await status(engine, s, pinned.receipt.id);expect(r).toMatchObject({ freshness: 'fresh', blocked_reason: 'refresh_failed' });- expect(r.next_action?.mcp).toEqual({ tool: 'questions_refresh', arguments: { id: pinned.receipt.id, full: true } });+ expect(r.fix?.mcp).toEqual({ tool: 'questions_refresh', arguments: { id: pinned.receipt.id, full: true } });});run("a crashed worker's lease is taken over only after it expires", async (engine) => {@@ -384,7 +384,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiconst slowFn: typeof chat.fn = (req) => Promise.race([chat.fn(req), new Promise<never>((_, rej) => req.signal?.addEventListener('abort', () => rej(new Error('aborted'))))]);const out = await pinQuestion(localCtx(engine, s.sourceId), { question: QUESTION, scope: { entity: ENTITY }, wait_ms: 200 }, { chat: slowFn });expect(out.receipt).toMatchObject({ freshness: 'awaiting_refresh', refresh: { status: 'timeout' } });- expect(out.receipt.next_action?.mcp?.tool).toBe('questions_refresh');+ expect(out.receipt.fix?.mcp?.tool).toBe('questions_refresh');expect((await getPin(engine, s.sourceId, out.receipt.slug))!.lease_token).toBeNull();});});@@ -395,8 +395,8 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiawait withEnv({ ANTHROPIC_API_KEY: undefined, GBRAIN_HOME: mkdtempSync(join(tmpdir(), 'pq-keyless-')) }, async () => {const out = await pinQuestion(localCtx(engine, s.sourceId), { question: QUESTION, scope: { entity: ENTITY } });expect(out.receipt).toMatchObject({ state: 'active', freshness: 'awaiting_refresh', blocked_reason: 'no_model_key', refresh: { status: 'blocked', blocked_reason: 'no_model_key' } });- expect(out.receipt.next_action).toMatchObject({ argv: ['gbrain', 'providers', 'list'], actor: 'user', consent: ['credentials', 'paid'] });- expect(out.receipt.next_action?.verify?.mcp).toEqual({ tool: 'questions_status', arguments: { id: out.receipt.id } });+ expect(out.receipt.fix).toMatchObject({ argv: ['gbrain', 'providers', 'list'], actor: 'user', consent: ['credentials', 'paid'] });+ expect(out.receipt.fix?.verify?.mcp).toEqual({ tool: 'questions_status', arguments: { id: out.receipt.id } });});});@@ -407,7 +407,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiconst chat = stubChat();const out = await pin(engine, s, chat);expect(out.receipt).toMatchObject({ freshness: 'awaiting_refresh', blocked_reason: 'budget_exhausted' });- expect(out.receipt.next_action?.argv).toEqual(['gbrain', 'config', 'set', 'cycle.standing_questions.budget_usd', '<usd>']);+ expect(out.receipt.fix?.argv).toEqual(['gbrain', 'config', 'set', 'cycle.standing_questions.budget_usd', '<usd>']);expect(chat.calls).toHaveLength(0);} finally { await engine.executeRaw("DELETE FROM config WHERE key = 'cycle.standing_questions.budget_usd'"); }});@@ -420,7 +420,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiawait putPage(engine, s.sourceId, 'notes/widget-plan', page('note', 'Widget plan', 'The widget plan ships in August.'), await revisionOf(engine, s.sourceId, 'notes/widget-plan'));const stale = await status(engine, s, pinned.receipt.id);expect(stale).toMatchObject({ freshness: 'stale', blocked_reason: 'no_worker' });- expect(stale.next_action?.why).toContain('autopilot');+ expect(stale.fix?.why).toContain('autopilot');await engine.executeRaw("UPDATE pinned_questions SET cooldown_days = 0 WHERE source_id = $1", [s.sourceId]);const phase = await runPhaseStandingQuestions(engine, { dryRun: false, chat: stubChat().fn });expect((phase.details as { refreshed: number }).refreshed).toBeGreaterThanOrEqual(1);@@ -495,7 +495,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Brai} finally { await setRemotePrivate(engine, false); }});- run('a failed refresh is recovered over MCP by running its next_action', async (engine) => {+ run('a failed refresh is recovered over MCP by running its fix', async (engine) => {const s = await seedBrain(engine);const pinned = await pin(engine, s);await setRemotePrivate(engine, true);@@ -507,7 +507,7 @@ export function registerPinnedQuestionSuite(label: string, getEngine: () => Braiconst failed = (await mcp(engine, 'questions_refresh', { id: pinned.receipt.id }, grant)).body as unknown as QuestionReceipt;expect(failed).toMatchObject({ blocked_reason: 'refresh_failed', freshness: 'stale' });calls.fail = false;- const next = failed.next_action!.mcp!;+ const next = failed.fix!.mcp!;const recovered = (await mcp(engine, next.tool, next.arguments, grant)).body as unknown as QuestionReceipt;expect(recovered).toMatchObject({ freshness: 'fresh', blocked_reason: null, refresh: { status: 'published', mode: 'full' } });} finally {diff --git a/test/phase-scope-coverage.test.ts b/test/phase-scope-coverage.test.tsindex bfeadaedef..44a83d69f6 100644--- a/test/phase-scope-coverage.test.ts+++ b/test/phase-scope-coverage.test.ts@@ -41,7 +41,7 @@ describe('PHASE_SCOPE coverage', () => {expect(invalid).toEqual([]);});- test('all 26 phases covered (regression on accidental omission)', () => {+ test('all 27 phases covered (regression on accidental omission)', () => {// Pin the count so a future PR that adds a phase to ALL_PHASES// without updating PHASE_SCOPE notices here too. The v0.39.1.0// master merge brought in the 17th phase (`schema-suggest`); v0.41@@ -50,9 +50,10 @@ describe('PHASE_SCOPE coverage', () => {// adds 'enrich_thin' and v0.42.0.0 adds 'skillopt' for a total of 22;// #2653 adds 'drift' for 23; #5876 adds 'chronicle' for 24; GBRA-40 Lane D// adds 'facts_drain' for 25.- // Temporal typed edges adds 'edge_contradictions' for 26.- expect(ALL_PHASES.length).toBe(26);- expect(Object.keys(PHASE_SCOPE).length).toBe(26);+ // Temporal typed edges adds 'edge_contradictions' for 26; C4 pinned+ // questions adds 'standing_questions' for 27.+ expect(ALL_PHASES.length).toBe(27);+ expect(Object.keys(PHASE_SCOPE).length).toBe(27);});test('embed remains global (the headline brain-wide phase)', () => {diff --git a/test/pinned-questions-safety.test.ts b/test/pinned-questions-safety.test.tsindex 7fd941edd0..611295311e 100644--- a/test/pinned-questions-safety.test.ts+++ b/test/pinned-questions-safety.test.ts@@ -5,18 +5,12 @@* (test/e2e/pinned-questions-postgres.test.ts). Stub model; no network.*/import { afterAll, beforeAll } from 'bun:test';-import { mkdtempSync, rmSync } from 'node:fs';-import { tmpdir } from 'node:os';-import { join } from 'node:path';import { PGLiteEngine } from '../src/core/pglite-engine.ts';import { registerPinnedQuestionSuite } from './helpers/pinned-questions-scenarios.ts';let engine: PGLiteEngine;-const home = mkdtempSync(join(tmpdir(), 'pq-safety-home-'));-const priorHome = process.env.GBRAIN_HOME;beforeAll(async () => {- process.env.GBRAIN_HOME = home;engine = new PGLiteEngine();await engine.connect({});await engine.initSchema();@@ -24,8 +18,6 @@ beforeAll(async () => {afterAll(async () => {await engine?.disconnect();- if (priorHome === undefined) delete process.env.GBRAIN_HOME; else process.env.GBRAIN_HOME = priorHome;- rmSync(home, { recursive: true, force: true });}, 60_000);registerPinnedQuestionSuite('pglite', () => engine);