Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge #7954 head 5782538e (gate-ahead) into capy/gbra188-plugin-turn-hook

garrytan4dc9a82d25ec
diff --cc scripts/module-size-limits.tsv
index aaab9187da,a969d65a72..d033a92051
--- a/scripts/module-size-limits.tsv
+++ b/scripts/module-size-limits.tsv
@@@ -47,4 -47,4 +47,4 @@@ src/commands/doctor/checks/extraction-s
src/core/search/evidence-delivery.ts 1740 ratchet +5 W5: EvidencePlan.rankCut resolved with the plan (logic in search/page-rank-cut.ts); +20 W5 whole_pages: wholeCost prices a block as delivery would emit it whole (needs the private Block/enrichBlock internals) and the cut is wired before allocate (cutWholePages lives in search/page-rank-cut.ts); new row: crossed the 1500 unlisted cap at the #6367 merge (master 1479, its explicit-budget cap) by the C1 date header threaded through every block path, cap included; pagePlanHits (search/page-plan-hits.ts) and the header loader (evidence-date.ts blockDateHeaders) were peeled first; peel candidate: allocateCapped; +8 at the #6396 merge: page evidence text cut through the fence-chunk trust overlay and the caller minTrust floor (re-summed: our 1504 + master +8); +119 Cat 40 next wave F2: the search.long_page_unit policy (withLongPagePolicy, selectLongPages size preflight with page/byte/deadline limits) and the long-page fetch and fallback in deliverEvidence, kept in the shared seam the plan names (gbrain-evals docs/plans/2026-10-11-cat40-next-wave, F2); +17 F2 rework to the frozen-comparison policy: search.long_page_min_chars (rendered-body characters, default 20,000) read in withLongPagePolicy, a character count in the preflight, the rendered-body confirmation in deliverEvidence, and the long-page row exemption in capDeliveredSnippets (re-summed at the 0.60.225.0 merge: master 1537 + F2 136); +39 Wave B PR 2 lane 2b: planSegmentedBlock joins the windows search/segmented-evidence.ts reads around a segmented page's hits into one run-marked document (needs the private Doc/Piece/buildDoc/locateAnchor internals), planBlock's unit cut split into blockFromDoc for both, sections bounded by their run, selectionCost counts a gap between runs, and the fetch skips the whole-body fence overlay for a segmented page; +4 segmented pages read at once before planning (segmentedReads; the read is search/segmented-evidence.ts, the statements page-body/read-range.ts); +17 GBRA-156: tail trim plan flag, DeliverOptions.query, DeliveryMeta.tail_trim, the trim call and the frozen-hit score/query library fields (logic in search/evidence-tail-trim.ts; interface fields cannot move); +7 GBRA-205: EvidencePlan.titleHeader and DeliveryMeta.title_header (interface fields cannot move) and the titles option on the header loader (logic in search/evidence-date.ts; the query budget key lives in search/evidence-packing.ts)
src/commands/config.ts 1524 ratchet new row: crossed the 1500 unlisted cap in wave 15 P7.4 #5461: set-time validation of think.pages_budget_chars / think.excerpt_ceiling_chars (range + parser live in core/think/pages-budget.ts), mirroring the cycle.consolidate.cluster_threshold hook; +1 wave 16 G5.1 (#6495): set-time refusal hook for search.keyword_statement_timeout_ms (check lives in commands/config/keyword-timeout-value.ts); +1 wave 18b lane 5 (#5012 item 6): search.contextual_retrieval prints the existing-pages hint after the write (text lives in commands/config/contextual-mode-hint.ts); +1 #6712 PR 2: retired/rollback sync key dispatch line (logic in core/sync-config-keys.ts handleSyncKeyConfig); +1 #6865: sync.slug_conflicts.auto_remove boolean validation at set time (refusal text in repair/slug-autoheal.ts); +1 #6948: sync.origin_twins.auto_resolve boolean validation at set time (refusal text in repair/origin-twins-heal.ts); +2 #6795: config set chat_model/expansion_model help line and the model-pin import (shadow report and file-pin unset live in commands/config/model-pin-shadow.ts); +1 #6712 PR 4b: sync.admission set-time hook (value logic in commands/config/sync-admission-value.ts); +4 #7130: set-time refusal hook for sync.max_deletes / sync.max_delete_ratio (and .source.<id>) / purge.retention_hours (check lives in core/sync-reconcile.ts deleteSafetyConfigRefusal); +1 GBRA-150: sync.metafile_pages set-time route (body in config/sync-metafile-pages-value.ts); re-summed at the v0.60.330.0 merge (1520 measured); +2 #7242 minions.terminal_hook file-plane key and its set branch (logic in minions/terminal-hook.ts); +1 GBRA-161: generations.* set-time route (refusal in commands/config/generations-values.ts); +1 GBRA-207 #7630: sync.repo_path set-time refusal hook (refusal in core/sync-config-keys.ts syncRepoPathRefusal)
src/commands/mcp-expose.ts 1512 ratchet hosted_option: Session carries the gbrain.io coaching notice on the first-receipt run and Tailscale/service friction exits (copy, refs and gating live in core/onboard/hosted-option.ts)
- src/core/behavior-change-notice.ts 1548 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row
-src/core/behavior-change-notice.ts 1551 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule)
++src/core/behavior-change-notice.ts 1552 ratchet the BEHAVIOR_CHANGES table grows by one row per disclosed change: +4 the #7891 provenance-drift and #7917/#7918 maintenance-lowering rows and their comments (re-summed at the 0.60.495.0 merge: 1547 + 4); +2 GBRA-205 saved_facts_stems row and its comment (re-summed at the #7901 0.60.492.0 merge: 1541 + 2); +2 GBRA-205 search.query_facts_block default-on row and its approval comment (re-summed at the #7610 0.60.490.0 merge: 1539 + 2); +2 the #7900 content checkpoint host-move row (since TBD until the merge slot), +2 the #7897 private-hold sweep row (since TBD until the merge slot), +2 the #7880 ingest_capture and company-brain private-hold row (since TBD until the merge slot), +5 the frozen-source wave comment and four rows (#7868, #7850, #7869/#7870, #7871), +2 the #7848 visibility_noncanonical hold row (since TBD until the merge slot), +2 the #7846 extract_atoms session-source row (re-summed at the 0.60.481.0 merge: master 1524 + 2), +2 the #7805 synthesize session-source and #7841 visibility_not_applied rows (re-summed at the 0.60.480.0 merge: master 1522 + 2), +2 strict door planned-state row (#7705, re-summed at the 0.60.470.0 merge: master 1514 + 2), +2 Bun floor 1.4.4 row (#7644), the GBRA-95 RLS backfill row (+2), +3 rows for #7596 pass_interrupted, #7599 read-only serve and the --access=read-only ceiling, +1 G5 lane C trust_release row, +1 #7619 cli_flag_equals, +3 GBRA-207 #7630 relative-anchor and stalled-write rows, +2 the #7632 function search_path disclosure row and +2 the #7679 orphaned worktree refresh row (re-summed at the 0.60.471.0 merge: master 1516 + 2), +2 the #7814 retired v0.13.1 grandfather row, +2 the #7618 conversion withhold/progress/push row (master 1520 + 2); the behavior-change table split (#7607) retires this row; +4 GBRA-188 #7489: the wave comment and three rows (brain-first instructions, starter surface default, per-turn rule); +1 GBRA-188 plugin_turn_hook_gbra188 row
diff --cc src/core/behavior-change-notice.ts
index 44cde1c734,a91c8421fb..cd3c32b83d
--- a/src/core/behavior-change-notice.ts
+++ b/src/core/behavior-change-notice.ts
@@@ -1349,7 -1349,10 +1349,11 @@@ export const BEHAVIOR_CHANGES: Readonly
{ since: '0.60.495.0', id: 'brain_first_instructions_gbra188', text: 'Harness installs now write a short marked brain-first block into the harness\'s own instruction file by default (Claude Code ~/.claude/CLAUDE.md, Codex AGENTS.md or a non-empty AGENTS.override.md, opencode AGENTS.md, the OpenClaw workspace AGENTS.md, an existing Hermes SOUL.md, a Cursor project rule): `gbrain setup <harness>`, `gbrain connect --install`, `gbrain bootstrap harness` and the thin-client GBRAIN-INSTRUCTIONS.md. Text outside the markers is never touched and a re-run upgrades the block in place. `--no-instructions` or GBRAIN_AGENT_INSTRUCTIONS=0 removes it and is remembered; `--remove` strips it; `gbrain setup <harness> --instructions-only` manages only the block. doctor `harness_wiring` warns when a registered harness\'s block is missing, stale or damaged.' },
{ since: '0.60.495.0', id: 'install_surface_starter_gbra188', text: 'New stdio registrations gbrain writes (`gbrain setup`, `gbrain bootstrap hooks`, the readiness and `gbrain init` registration lines) now pin `--surface starter`, the daily-driver tool list, instead of `--surface full` (Garry, 2026-10-24; gbrain-evals#191: reach and accuracy unchanged, 17-23% fewer input tokens). An existing registration keeps its surface and is never rewritten; the Codex and Claude Code plugins and a bare `gbrain serve` stay on full. `--surface full` is the opt-in for every operation, any parameter the starter list leaves out is still accepted, and `request_tools` returns full schemas or widens the session to a left-out tool. doctor `harness_wiring` notes a full registration as information only.' },
{ since: '0.60.495.0', id: 'brain_first_turn_rule_gbra188', text: 'The brain-first rule now rides every turn, not only the system prompt (Garry, 2026-10-25). The block (v2) opens with "before answering any turn, check GBrain first"; while it is installed, the Claude Code and Codex UserPromptSubmit hook leads each turn with that one-line rule, with or without a context block; `gbrain setup openclaw` writes a hook-only plugin (gbrain-turn-rule, before_prompt_build prependContext) under the OpenClaw state dir and installs it with the openclaw CLI (install --link --accept-capabilities, enable, plugins.entries.gbrain-turn-rule.hooks.allowConversationAccess true), or prints those commands with no openclaw on PATH; and `gbrain setup hermes` adds a marked, self-contained `pre_llm_call` shell hook (`/bin/echo` of the rule) to $HERMES_HOME/config.yaml and approves that command in Hermes\'s shell-hooks-allowlist.json, or prints the entry when config.yaml already has a `hooks:` section. `--no-instructions` or GBRAIN_AGENT_INSTRUCTIONS=0 turns the rule off with the block.' },
+ // #7891 provenance-stamp drift check and repair. `since` is stamped at the merge slot.
+ { since: '0.60.496.0', id: 'provenance_stamp_drift_7891', text: 'New doctor check `provenance_stamp_drift` warns when a page\'s provenance stamps (`source_kind`, `ingested_via`, `ingested_at`) or its lowering `trust_tier` marker were removed or rewritten by a write that is not the owner\'s own (before v0.60.486.0, #7892, made the stamps server-owned), or when a classified page\'s file would re-read above its stored tier. It reads page history and write receipts only and writes nothing. New explicit-only repair `gbrain repair provenance --source <id>` previews each page with its stamps, marker and tier before and after; `--apply --expect <hash> --yes` puts the stamps back, stamps the lower marker, lowers the page to it and files a `lower_page` proposal that `gbrain trust review` confirms or reverts. It only lowers trust, never writes the owner\'s own edits, writes unattributed ones only with `--include-ambiguous`, and never runs from `--all`, the remediation plan or an upgrade.' },
+ // #7917 / #7918 maintenance lowerings and unreadable derivation declarations. `since` is stamped at the merge slot.
+ { since: '0.60.496.0', id: 'maintenance_lowering_7917_7918', text: 'A maintenance publication that lowers a page\'s trust tier (a dream or patterns write over a page the owner wrote, such as a grounding repair outside the output prefix) now files a `lower_page` proposal, so the page shows up in `gbrain trust review`; before, only agent content writes did. A maintenance write whose derivation declaration is present but unreadable now publishes at `unknown` and stamps an `unknown` trust marker into the file, instead of taking the write channel\'s tier and leaving the file unmarked. Both only lower trust. `gbrain trust backfill --repair-unknown-markers` and `gbrain repair provenance` on a classic (unmanaged) checkout now also write the repaired page to its file in the same step, and leave a page whose file holds an edit sync has not imported untouched (run `gbrain sync` first).' },
+ { since: 'TBD', id: 'plugin_turn_hook_gbra188', text: 'The Claude Code and Codex plugins (gbrain, gbrain-coding, gbrain-daily) now declare the UserPromptSubmit hook `gbrain setup` writes, run through the plugin launcher with GBRAIN_HOOK_LANE=plugin (Claude Code `hook user-prompt`, 3 s; Codex `hook user-prompt --harness codex`, 15 s, skipped until trusted in /hooks). While a brain-first block is installed it adds the per-turn rule, and with a serve running the read-context block; it exits without output when setup, bootstrap or a workspace install already wires the event, so a turn gets it once. doctor `harness_wiring` and `gbrain post-upgrade` now name `gbrain setup <harness> --instructions-only` for a plugin-only install with no brain-first block.' },
];
/** The newest disclosed change's release: the notice id moves only when a release adds rows. */