Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/master' into capy/mpw-integration
garrytan29894facefc5
diff --cc docs/architecture/KEY_FILES.mdindex 8b7a885f06,a2b6799d06..9554d14b54--- a/docs/architecture/KEY_FILES.md+++ b/docs/architecture/KEY_FILES.md@@@ -46,9 -45,9 +46,9 @@@ boundary and add its link here rather t| [Core Persistence](key-files/core-persistence.md) | `src/core/persistence/` write journal, coordinator, effects, canonical projections and managed sync || [Core Persistence (continued)](key-files/core-persistence-continued.md) | `src/core/persistence/connector-*.ts`, `src/core/connectors/item-holds*.ts`, checkpoint validation, no-op kernel, accepted-pending receipts, verb types/errors, database-write, attribution, purge-deleted and loop-fact retirement || [Core Persistence (engine graduation)](key-files/core-persistence-graduation.md) | `engine-graduation*.ts`, `graduation-*.ts`, `src/commands/migrate-graduation.ts`, the graduation doctor finding |-| [Managed sync and persistence stalls (key files cluster)](key-files/persistence-stalls.md) | `claim-phase.ts`, `pre-activation-release.ts`, `sync-concurrent-write.ts`, `worktree-manifest.ts`, `src/core/hardened-git.ts` |+| [Managed sync and persistence stalls](key-files/persistence-stalls.md) | `claim-phase.ts`, `pre-activation-release.ts`, `sync-concurrent-write.ts`, `worktree-manifest.ts`, `src/core/hardened-git.ts` || [Core Search (1/2)](key-files/core-search-1.md) | `src/core/search/` through `src/core/search/rerank.ts` |- | [Core Search (2/2)](key-files/core-search-2.md) | `src/core/search/return-policy.ts` through `src/core/search/vector-pool.ts`, plus the relational arm and multi-hop chain modules (`relational-recall.ts`, `relational-rerank-pin.ts`, `relational-chain.ts`, `relational-plan.ts`, `hub-dampening.ts`) |+ | [Core Search (2/2)](key-files/core-search-2.md) | `src/core/search/return-policy.ts` through `src/core/search/vector-pool.ts`, the relational arm and multi-hop chain modules, `hub-dampening.ts` || [Core Services (1/3)](key-files/core-services-1.md) | `src/core/advisor/{types,run,render,recommended-set,history,apply,collect-*}.ts` through `src/core/connectors/` || [Core Services (1/3, continued)](key-files/core-services-1-continued.md) | `src/core/context/` through `src/core/context/ipc-path.ts` || [Core Services (2/3)](key-files/core-services-2.md) | `src/core/conversation-parser/` through `src/core/progressive-batch/`, except `src/core/persistence/` |@@@ -72,15 -71,16 +72,16 @@@| [Tooling And Tests](key-files/tooling-and-tests.md) | `.github/workflows/test.yml` through `test/remote-privacy-sweep.test.ts` || [CI Health And Test Guards](key-files/ci-health-and-test-guards.md) | `.github/workflows/nightly-watch.yml` through `scripts/check-image-decoders-embedded.sh`, plus the contributor audit and the fix-wave gate || [BrainBench — in a sibling repo](key-files/brainbench.md) | Cross-file subsystem contract |-| [Hindsight calibration (key files cluster)](key-files/hindsight.md) | Cross-file subsystem contract |-| [Schema packs: mutation surface (key files cluster)](key-files/schema-mutation.md) | Cross-file subsystem contract |+| [Hindsight calibration](key-files/hindsight.md) | Cross-file subsystem contract |+| [Schema packs: mutation surface](key-files/schema-mutation.md) | Cross-file subsystem contract || [Agent bootstrap cluster (the paste-in desktop-agent install)](key-files/agent-bootstrap.md) | Cross-file subsystem contract || [Agent Bootstrap (continued)](key-files/agent-bootstrap-continued.md) | Remaining cross-file entries |-| [Google connector + open-loop engine (key files cluster)](key-files/google-and-loops.md) | Cross-file subsystem contract |+| [Google connector + open-loop engine](key-files/google-and-loops.md) | Cross-file subsystem contract || [Google And Loops (continued)](key-files/google-and-loops-continued.md) | Remaining cross-file entries |-| [Always-loaded core memory (key files cluster)](key-files/core-memory.md) | Core tier, write-path guard and lock order, delivery lanes, pressure notice |-| [Workspace push and backup coverage (key files cluster)](key-files/workspace-push-and-backup.md) | Workspace push, hook push backstops, backup verdicts |-| [Ambient capture consent gate (key files cluster)](key-files/ambient-capture.md) | `memory.auto_writeback` capture lanes |-| [Quarantine (cluster)](key-files/quarantine.md) | Gate-marker strip; quarantined pages in facts, reads, writes |+| [Always-loaded core memory](key-files/core-memory.md) | Core tier, write-path guard and lock order, delivery lanes, pressure notice |+| [Workspace push and backup coverage](key-files/workspace-push-and-backup.md) | Workspace push, hook push backstops, backup verdicts |+| [Ambient capture consent gate](key-files/ambient-capture.md) | `memory.auto_writeback` capture lanes |++| [Quarantine](key-files/quarantine.md) | Gate-marker strip; quarantined pages in facts, reads, writes |## BrainBench — in a sibling repodiff --cc src/core/error-registry.tsindex ad471f06e0,7005abaf87..d876ed9e8f--- a/src/core/error-registry.ts+++ b/src/core/error-registry.ts@@@ -423,8 -420,8 +423,9 @@@ export const NOTICE_CODES =facts_drain_first_run: { kind: 'info', summary: 'The automatic facts drain is about to process its first backlog on this brain: the queued page count, the estimated spend, the caps and the opt-out.' },facts_drain_deferred: { kind: 'degraded', summary: 'The automatic facts drain left queued pages waiting (no key, a spend cap, an unpriced model under a user cap); the fix is the next step.' },relational_chain: { kind: 'degraded', summary: 'A typed relationship chain found no complete answer (start page not visible, no typed edges, an empty hop) or hit a cap; the notice names the hop and the next call.' },+ pinned_answer_stale: { kind: 'degraded', summary: 'A pinned answer has stale sentences (their evidence changed or was removed) or its refresh is blocked; stale sentences are flagged and withheld from context_pack, and the fix is the next step.' },held_files: { kind: 'degraded', summary: 'Sync holds files in the read scope it cannot import: held new files are missing and pages whose newer file is held are stale; the fix is the repair preview on the brain host.' },recovered_frontmatter: { kind: 'coaching', summary: 'Files imported only after quoting unquoted frontmatter values; the generator writing them should quote values (the fix is the repair preview).' },+ page_quarantined: { kind: 'safety', summary: 'The page was quarantined by the content-quality gate (hidden from search; its facts and takes are not extracted). A read says to treat its text as untrusted scraped content and, for an untrusted reader, that its body was withheld (an admin-scoped caller may pass include_quarantined: true); a write says the page was hidden and that the operator clears a false positive with gbrain quarantine clear <slug> --force.' },fence_normalized: { kind: 'coaching', summary: 'A write\'s facts or takes fence was rewritten losslessly (rows and classes named, never values): the stored page differs from what was sent, so re-read it with get_page before editing; remember and takes_add write rows that never need it.' },} as const satisfies Record<string, NoticeEntry>;diff --cc src/core/persistence/page-mutations.tsindex 4a4dbef7df,ec5bd0eaa6..1f9e3ab2a6--- a/src/core/persistence/page-mutations.ts+++ b/src/core/persistence/page-mutations.ts@@@ -162,13 -163,16 +163,16 @@@ function pendingAwareResponse(ctx: Operexport function emitFenceNotice(ctx: Pick<OperationContext, 'emitNotice'>, response: Record<string, unknown>, slug?: string): void {const report = response.fences_normalized as FencesNormalized | undefined;if (report) ctx.emitNotice?.(fenceNormalizedNotice(report, slug));+ // #6259: a write the content-quality gate quarantined says so (`quarantined` plus one safety notice).+ const quarantined = response.quarantined as { reason: string; detail: string } | undefined;+ if (quarantined && slug) ctx.emitNotice?.(pageQuarantinedNotice(slug, quarantined, 'write'));}- /** Owner-internal `put_page` kinds the trusted local file writers (import, frontmatter repair) submit; every other caller is refused them. */- const OWNER_FILE_INTENTS: ReadonlySet<string> = new Set(['managed_file_import', 'managed_file_repair']);+ /** Owner-internal `put_page` kinds the trusted local file writers (import, frontmatter repair, quarantine clear) submit; every other caller is refused them. */+ const OWNER_FILE_INTENTS: ReadonlySet<string> = new Set(['managed_file_import', 'managed_file_repair', 'managed_quarantine_clear']);/** #6007: a `put_pages` child: its batch, its position and the batch size are part of its identity. */-export interface PageBatchMember { id: string; index: number; size: number; requestId: string }+export interface PageBatchMember { id: string; index: number; size: number; requestId: string; repeats?: number[] }export async function submitPageMutation(ctx: OperationContext,input: { operation: string; params: Record<string, unknown>; waitMs?: number; managedFileImport?: true; timelineSection?: TimelineSection }): Promise<Record<string, unknown>> {diff --cc test/fixtures/goldens/cli/tools-json.jsonindex 86bf15421e,67cec7de0e..5174eb1aea--- a/test/fixtures/goldens/cli/tools-json.json+++ b/test/fixtures/goldens/cli/tools-json.json@@@ -2,8 -2,8 +2,8 @@@"golden": {"exitCode": 0,"stderr": "",- "stdoutBytes": 214032,- "stdoutSha256": "3005b82ba126c0d6a30e85010ca9282219a032cdfebd9a5a2fd1ba63adda432c",- "stdoutBytes": 208896,- "stdoutSha256": "1f822b391f056c0446364f5df1da5ae5604f2d28f44047807c3320fbc6caa17d",++ "stdoutBytes": 214278,++ "stdoutSha256": "bd52abbd1fa53faac48fce35105cc75b332bab81f81672b12e7f4933213388a7","toolNames": ["remember","entity",