Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
wave18: delete the lane fragment files (applied)
garrytand56c1dc3498e
diff --git a/.wave18-fragments/lane1.md b/.wave18-fragments/lane1.mddeleted file mode 100644index fe05ab1a7d..0000000000--- a/.wave18-fragments/lane1.md+++ /dev/null@@ -1,44 +0,0 @@-# Wave 18 lane 1 fragment rows, S2 (integrator: apply, then delete this file)--Branch `capy/wave18-lane1`. Its `INTEGRATOR-ROW:` commits (`14758692e` FACTS_ABSORB_REASONS, `61909f1df`-regeneration, `d28162a45` upgrade-replay golden, `0cd5f30d6` llms-full.txt) hold the generated output and-registry rows the lane's tests and guards need; the S1 share of them is redone S1-only on `capy/wave18-lane1-s1`.-Drop or redo them at slot time as you prefer. Everything below is what each S2 item needs in integrator-owned files.--## Slot-time steps--This file holds the S2 rows (#6779, #6773, #6778, #6761, #6791, #6753). The S1 rows (#6757, #6782, wave 18a) are in-`lane1-s1.md`, from `capy/wave18-lane1-s1`, which this branch merges.--1. [S2] **Plugin trees and llms (#6753).** `skills/maintain/SKILL.md` changed:- `bun run scripts/generate-plugin-tree.ts --out plugin --variants-out plugin-variants`, then- `bun run build:llms` (llms-full.txt inlines docs/guides/cron-schedule.md). `bun run regen:all --goldens` does both.--## Registry rows--- [S2] **`src/core/facts/absorb-log.ts` `FACTS_ABSORB_REASONS` (#6778):** append- `'write_pending_accepted', 'write_deferred_unadmitted',` after `'write_refused'`, and bump- `test/facts-absorb-log.test.ts` from `length).toBe(17)` to `19` with two `toContain` asserts.- Already in commit "INTEGRATOR-ROW: FACTS_ABSORB_REASONS ..." (typecheck needs it: commit- "fix(facts): facts absorb waits ..." alone does not typecheck).-- [S2] **`src/core/error-registry.ts` `CODES` (#6791), alphabetical position, then `bun run build:error-codes`.** The adapter's- once-per-process stderr notice already names the code and points at `gbrain errors continuation_unproven`:- ```ts- continuation_unproven: { class: 'retryable', summary: "Claude Code continued an answer past its output cap and gbrain could not prove the full text, so the claude-cli call returned no text and no tool calls and finished as length.", why: "Print mode reports only the text after an automatic continuation; parsing or dispatching that tail as a complete answer would act on a fragment. The caller retries or escalates as for any capped answer; the gateway does not resend it to a fallback model.", reasons: ['events_missing', 'no_assistant_events', 'segments_unmatched'], docs: 'docs/ai-providers/claude-cli.md#claude-cli-troubleshooting', fix: { argv: ['gbrain', 'config', 'set', '<KEY>', '<TOKENS>'], inputs: [{ name: 'KEY', how: "The output cap the failing caller's truncation warning names (for example dream.propose_takes.max_tokens, facts.extraction_max_tokens or models.synopsis_max_tokens)." }, { name: 'TOKENS', how: 'A larger whole number of output tokens; ask the user, since a larger cap can cost more per call.' }], consent: [], actor: 'agent', ask_user: true, why: 'A cap the whole answer fits under ends the call before Claude Code continues it, so the full text arrives in one response.', requires_exclusive: false, verify: { argv: ['gbrain', 'config', 'get', '<KEY>'] } } },- ```- Adjust the `fix` envelope to the registry's current consent/ask_user shape if it differs.- The code is provider metadata, not a thrown code, so no contract test requires the row.--## BEHAVIOR_CHANGES rows (`src/core/behavior-change-notice.ts`, `since: '<wave version>'`)--- [S2] **#6778:** "Facts absorb now waits for its write up to the job deadline instead of 5 s. A write still committing is logged `write_pending_accepted` and writer contention before admission `write_deferred_unadmitted`; neither counts toward the doctor's facts_extraction_health threshold, and persistent contention gets its own warning (`gbrain sources writer status --source <id> --json`)."-- [S2] **#6761:** "facts_extraction_health reports its 24 h failure count as history (rolling, with an ages-out time) and separately names facts-absorb jobs still dead, with `gbrain jobs retry <id>` as the fix; it no longer suggests raising `facts.absorb_warn_threshold`, and the thresholds are unchanged."-- [S2] **#6791:** "A `claude-cli` answer that Claude Code continued after hitting its output cap is now rebuilt in full from the call's event stream (the CLI runs with `--verbose`) instead of returning only the text after the continuation as a complete answer. When the full text cannot be proven, the call returns no text and no tool calls, finishes `length` (callers retry or escalate as for any capped answer) and reports `providerMetadata['claude-cli'].code = 'continuation_unproven'` with reason `events_missing`, `no_assistant_events` or `segments_unmatched`, and one stderr line per reason per process naming its remedy (upgrade the claude CLI for the first two, raise the caller's output cap for the third)."-- [S2] **#6773 (optional):** "Generated dream-cycle summaries now carry `created: <summary date>` in their frontmatter, so they pass `gbrain lint`'s temporal check."--## CHANGELOG credit--- #6773 reimplements PR #6773 by @lubosxyz ("Contributed by @lubosxyz", `Supersedes #6773`). The branch- commit's `Co-Authored-By` trailer uses `[email protected]`; GitHub attributes this- account (id 159481718) only through `[email protected]`, so use that- address in the PR body or squash message. The pushed commit was not rewritten (no force-push).diff --git a/.wave18-fragments/lane2.md b/.wave18-fragments/lane2.mddeleted file mode 100644index 82708dcf8d..0000000000--- a/.wave18-fragments/lane2.md+++ /dev/null@@ -1,198 +0,0 @@-# Wave 18 lane 2, S2 fragments (scratch; the integrator applies these rows and deletes this file)--**Every row in this file is S2** (each row is tagged). S2 items: #6743, #6739, #6755, #6717 and the #6729 rename-identity remedy. S1 rows (#6729 core, #6741 A/B/C, #6749) are in `.wave18-fragments/lane2-s1.md`.--## #6743 fragment (integrator-owned rows)--Code commit: `7afd6f96c fix(bootstrap): converge shared-skills cleanup after a cleanup token is revoked (#6743)` (SHA as of format-patch; may change on integration).--Exit code 14 was the next free value on master 933a76779 (used: 0,1,2,3,4,10,11,12,13,69,75,124,130). The constant-`HARNESS_CLEANUP_PENDING_EXIT_CODE = 14` is already in `src/core/exit-codes.ts` (in the commit). **Integrator: check no other-wave lane also claimed 14**; if one did, renumber the constant and every row below together.--### [S2] 1. Error registry row — src/core/error-registry.ts--Insert into `CODES` in alphabetical position (between the `b…` neighbours, e.g. after any `bootstrap_*` code / before `brain_*`):--```ts- bootstrap_cleanup_pending: { class: 'host_only', retryable: false, exit: 14, summary: "`gbrain bootstrap harness` wired and verified the harness, but cleanup of earlier shared-skills enrollments or carried previous token ids is still pending.", why: "A rotation leaves each old enrollment with that enrollment's own credential and then revokes the credential (leave_brain is principal-owned, so a revoked token can never leave). Each carried id is revoked and cleared on its own; an enrollment whose credential is already revoked is inert and finishes locally as credential_revoked. Until every id is cleared the run must not read as success, so --json lists each id's token state and cleanup state.", reasons: ['revoke_pending', 'leave_pending', 'enrollment_retained', 'credential_unreadable'], docs: 'docs/guides/bootstrap.md#cleanup-pending', suggestion: 'Follow the fix in the --json result: when every id can converge it re-runs the same bootstrap command; otherwise relay its user_message (restore the cleanup credential or revoke that token by id, or make the current enrollment ready), then re-run. Never revoke a token whose enrollment has not left unless its cleanup credential is lost.' },-```--Then regenerate: `bun run build:error-codes` (docs/guides/error-codes.md) and `bun run build:llms`.--Optional test once the row lands (test/exit-codes.test.ts, 'registry codes map onto the table'):-```ts- expect(exitCodeForCode('bootstrap_cleanup_pending')).toBe(14);-```-and in 'the published values': `expect(exitCodes.HARNESS_CLEANUP_PENDING_EXIT_CODE).toBe(14);` (and add 14 to the documented-values list once the exit-codes.md row below lands).--### [S2] 2. docs/guides/exit-codes.md — exit table row--Insert after the `| 13 |` row:--```md-| 14 | `bootstrap_cleanup_pending`: `gbrain bootstrap harness` (or `--status`) wired and verified the harness, but earlier shared-skills enrollments or carried token ids are not cleaned up yet | the harness result with `status: "cleanup_pending"`, a per-id `cleanup` list and `fix` | follow `fix.next`: `run` re-runs the same command; `tell_user_to_run` relays the owner's revoke or restore step, then re-run ([cleanup pending](bootstrap.md#cleanup-pending)) |-```--### [S2] 3. docs/protocol/AGENT_OPERATOR_v1.md — exit table row--Insert after the `| 13 |` row (~line 997):--```md-| 14 | `bootstrap_cleanup_pending`: a harness is wired; old shared-skills enrollments or token ids still await cleanup | follow `fix.next` (re-run, or relay the owner's revoke step), then re-run |-```--### [S2] 4. BEHAVIOR_CHANGES row — src/core/behavior-change-notice.ts--Append to `BEHAVIOR_CHANGES` (since = the wave's release version):--```ts-// S2- { since: '<wave version>', text: '`gbrain bootstrap harness` exits 14 (`bootstrap_cleanup_pending`, JSON `status: "cleanup_pending"`) instead of 0 when the harness is wired but earlier shared-skills enrollments or carried previous token ids are not cleaned up yet, and `--status` exits 14 instead of 1 for the same state; the JSON gains a per-id `cleanup` list and a `fix`. Each carried token id is now revoked on its own once no enrollment holds it, and an old enrollment whose token was already revoked finishes its local cleanup and counts as left (`credential_revoked`) instead of blocking every revocation. Doctor `bootstrap_harness_health` names each id as revoked (cleanup pending) or active and recommends leave before revoke.' },-```--### [S2] 5. Module size--No tsv change needed: src/core/bootstrap/harness.ts went 2611 -> 2584 (cap 2615, slack 31 < 50). Optional: lower its ceiling-with a note "-27 #6743: cleanup gate moved to harness-cleanup.ts". New file src/core/bootstrap/harness-cleanup.ts is 283 lines-(new-file cap 1500). src/commands/doctor/bootstrap-checks.ts 548 -> 552 (not listed; under 1500).--### [S2] 6. Docs already in the commit--docs/guides/bootstrap.md (new `#cleanup-pending` anchor), docs/guides/shared-brain-skills.md (revoked-credential sentence),-docs/architecture/key-files/agent-bootstrap.md (harness-cleanup.ts entry). Run `bun run build:llms` if llms-full inlines them.--### [S2] 7. Notes for review--- [S2] "No new id carried when cleanup is known-unresolvable" is met by per-id convergence: a rerun still rotates the current token- into previous_ids, but that id's enrollment leaves and is revoked in the same run, so only the unresolvable ids stay- (pinned: 'a cleanup no rerun can finish ... carries no new ids'). Minting was not suppressed.-- [S2] The follow-approval boundary is unchanged: a working prior enrollment is still kept while the current one is not ready- (`requirements_changed` etc., the @exGeni comment); that state is now reported as `enrollment_retained` with exit 14 and- tell_user_to_run instead of exit 0.-- [S2] A token row that is missing from the brain is NOT treated as inert (conservative: the lookup may be the wrong brain); it- reports leave_pending/converges=false with a check-your-config step.-- [S2] No owner-side membership retirement was added (the issue's "Expected" asks for one); the revoked principal's- shared_skill_members row stays active=true but cannot authenticate.--## #6739 fragment (integrator-owned rows)--### [S2] BEHAVIOR_CHANGES row — src/core/behavior-change-notice.ts--Append to `BEHAVIOR_CHANGES` (since = the wave's release version):--```ts-// S2- { since: '<wave version>', text: 'The first Claude Code `user-prompt` hook in a new working folder now records heartbeat outcome `ok` with prompt-only context instead of `degraded` / `transcript_unreadable`: Claude Code creates `~/.claude/projects/<project>/` only after that prompt, so a transcript whose project folder does not exist yet reads as absent, the same as a not-yet-written transcript (#5465). It applies only when the missing folder is a direct child of an existing folder inside the projects root and the path has no `..` segment; any other missing path still fails closed. A missing transcript at `session-end` is still reported as degraded.' },-```--### [S2] Nothing else--No registry row, exit code, doctor check or generated doc: the change is inside `confineTranscriptPath`-(src/core/transcripts/claude-code-jsonl.ts, 699 -> 712 lines, not in the size tsv) and reuses its existing `absent: true` result.-The issue's second suggestion (session-end `empty_session`) is deferred as instructed.--## #6755 fragment (integrator rows) — lane S2 — supersedes #6769--### [S2] 1. src/core/error-registry.ts — `migrations_pending.suggestion` (CODES block, ~line 377 on cadaf5cd7)--Old text:--```ts- suggestion: 'not_applied: apply them with `gbrain apply-migrations --yes`. still_behind or schema_unreadable: run `gbrain doctor --json` and report it to the user; another --yes repeats the failure. wedged: ask the user, fix the cause in ~/.gbrain/upgrade-errors.jsonl, then `gbrain apply-migrations --force-retry <version>` and `gbrain apply-migrations --yes`.',-```--New text:--```ts- suggestion: 'not_applied: apply them with `gbrain apply-migrations --yes`. still_behind or schema_unreadable: run `gbrain doctor --json` and report it to the user; another --yes repeats the failure. wedged: ask the user, read the migration\'s partial rows in the brain home\'s migrations/completed.jsonl (phases[].detail, if present; apply-migrations prints the resolved path), fix the cause, then `gbrain apply-migrations --force-retry <version>` and `gbrain apply-migrations --yes`.',-```--### [S2] 2. Regeneration--`bun run build:error-codes` (rewrites docs/guides/error-codes.md), then `bun run build:llms` (the key-files edits and the error-codes doc feed the llms bundles).--Optional test the integrator can add once the row lands (test/apply-migrations-wedged-6696.test.ts, inside the "upgrade names the completion ledger" spawn):-```ts-import { CODES } from './src/core/error-registry.ts';-console.log(CODES.migrations_pending.suggestion); // expect: contains 'completed.jsonl' and 'phases[].detail, if present', not 'upgrade-errors.jsonl'-```--### [S2] 3. BEHAVIOR_CHANGES row (src/core/behavior-change-notice.ts)--Suggested row (fill `since` with the wave version):--- [S2] id: `v0_11_0_phase_f_skips_without_repo_path`-- [S2] text: "On a Postgres brain with no sync.repo_path, the v0.11.0 migration no longer runs `gbrain autopilot --install` during an upgrade. Phase F is recorded as skipped (reason no_repo_path) with the exact install command (the default source's path when it has one), the migration completes instead of wedging after three partial runs, and `gbrain doctor` shows a minions_migration line with that command until an autopilot is installed for the brain. A brain already wedged on v0.11.0 by partials that failed only the install phase is cleared automatically on the next apply-migrations run when its sync.repo_path is unset (a 'retry' row with reason phase_f_no_repo_path is appended to migrations/completed.jsonl); with sync.repo_path set the --force-retry advice stands. Phase F ledger entries now carry a reason code (no_repo_path, autopilot_already_installed, install_failed). Separately, a direct `gbrain autopilot --install` with no --repo and no sync.repo_path now installs for the default source's local_path instead of refusing. Wedged-migration advice now names migrations/completed.jsonl (phases[].detail) instead of upgrade-errors.jsonl."--### [S2] 4. Doctor registration--None needed. The new line is emitted under the existing check name `minions_migration` (already in src/core/doctor-categories.ts and the `minionsMigrationEntry` emits list), from `autopilotInstallPendingCheck()` in src/commands/doctor/checks/autopilot-install-pending.ts, wired into `runMinionsMigration` in src/commands/doctor/checks/local-runtime.ts (already committed). The remote report (src/commands/doctor/report-remote.ts) deliberately does not emit it: the remote surface is subprocess-free and the installed-job probe reads crontab.--### [S2] 5. Docs--- [S2] docs/architecture/key-files/commands-1.md updated in the commits (apply-migrations/v0_11_0 entry and the autopilot.ts entry). Run `bun run build:llms` after merge.-- [S2] skills/migrations/v0.11.0.md gained a `type: autopilot-install-needs-repo` section (not part of any plugin tree).--### [S2] 6. CHANGELOG credit line--"Contributed by @lubosxyz (#6769, reimplemented)" — wedged-migration advice pointing at the completion ledger.--### [S2] 7. Notes for the integrator--- [S2] `OrchestratorPhaseResult` (src/commands/migrations/types.ts) gained an optional `reason?: string`; only Phase F sets it so far.-- [S2] Evidence for the old ledger detail: on cadaf5cd7, a Postgres-mocked `apply-migrations --yes --migration 0.11.0` with a PATH shim that prints the refusal to stderr and exits 1 records `phases[].detail = "Command failed: gbrain autopilot --install --yes"` (in production the command is the resolved child CLI, e.g. `Command failed: '/x/bun' '/x/src/cli.ts' autopilot --install --yes`); the refusal text itself is never captured. The auto-clear no longer reads the detail at all.-- [S2] src/commands/autopilot.ts is now exactly at its ratchet (1642/1642); no TSV change made.-- [S2] test/setup.test.ts fails 26/37 on this machine at base cadaf5cd7 too (5 s default timeouts); unrelated to this item.--## #6717 fragment (integrator rows) — lane S2--- [S2] BEHAVIOR_CHANGES: none. This restores the documented behavior of `gbrain sources add --kind google` (--contacts-dir, --future-days, --loops-exclude-labels were accepted and validated but dropped on managed-persistence brains; the legacy path already stored them). No row needed.-- [S2] Registry rows / regeneration: none.-- [S2] CHANGELOG line suggestion: "Managed `sources add --kind google` keeps --contacts-dir, --future-days and --loops-exclude-labels in the source config, matching the unmanaged path (#6717)."-- [S2] Note for existing users: a managed google source added before this fix lacks those keys; re-add it (or set the keys) to apply the tuning. No automatic backfill is done (the flags' values were never stored, so there is nothing to recover).--## Wave 18 lane 2, S2 fragment: #6729 rename-identity remedy (scratch; the integrator applies these rows)--Every row here is **S2**. The remedy is not S1. It sits on top of the S1 rows already in b78dbf210 (doctor registration and categories of `rename_identity_downgrades`, the doctor goldens). Patches apply on b78dbf210 (final S1 head); `check:orphan-modules` passes there and the doctor goldens did not change (PGLite and Postgres golden tests pass unchanged).--### Already in the INTEGRATOR-ROW commit (last in the patch set) — S2--1. **S2** `src/core/repair/core.ts` `REPAIR_KINDS`: append `'rename-identity'` after `'aliases'`.-2. **S2** `src/core/repair/registry.ts`: `import { renameIdentityRepair, RENAME_IDENTITY_CONSENT_TEXT } from './rename-identity.ts';` and the `'rename-identity'` entry (handler `renameIdentityRepair`, `embeds: 'none'`, `checks: ['rename_identity_downgrades']`, `explicit_only: true`, `preview_bound: true`, `consent: 'destructive'`, `consentText: RENAME_IDENTITY_CONSENT_TEXT`, summary stating the managed limitation). `repairRunner().run` options gain `from?: string; close?: boolean` and pass them through.-3. **S2** `src/core/error-registry.ts`: codes `fact_rows_collide` and `managed_remedy_unavailable` (class `caller`, docs `docs/guides/repair.md#rename-identity`); regenerated `docs/guides/error-codes.md` (`bun run build:error-codes`).-4. **S2** Pinned explicit-kind lists gain `rename-identity`: `test/repair-explicit-only.test.ts` (`EXPLICIT`), `test/fix-wave-5-integration.test.ts` (`previews`).--If the integrator applies these rows by hand instead of taking the commit, note that the `feat(repair)` commit does not typecheck alone (`src/commands/repair.ts` compares a `RepairKind` with `'rename-identity'`); it typechecks once row 1 lands.--### BEHAVIOR_CHANGES (`src/core/behavior-change-notice.ts`, since = slot version) — S2--- **S2**- ```ts- { since: '<slot>', text: 'New explicit-only repair kind `gbrain repair rename-identity --source <id>` for an inexact Git rename that sync split into a delete plus an add (#6729). Without `--slug` the preview lists the open pairs with their preview commands. `--slug <new-slug>` (and `--from <old-slug>` when two pairs share it) previews one pair and binds both page ids, both revisions and the disposition into its hash; `--apply --expect <hash> --yes` (destructive consent; without `--yes` a non-interactive run exits 3 with the consent payload) carries the old page id onto the new slug with its version history, timeline, links, facts and aliases, imports the new file onto it as an edit and retires the provisional page (soft-deleted under a purged slug). Facts of both pages survive or the carry refuses `fact_rows_collide` before writing. Carrying identity is classic-only: on a managed source the preview states `managed_remedy_unavailable` and names `--close`, and an apply refuses with that code. `--close` settles the pair and moves nothing, on both kinds of source. Both settle the record (`disposition` remedied or closed), which releases the purge hold. `--all`, the maintenance cycle and the remediation plan never run it.' },- ```-- **S2**- ```ts- { since: '<slot>', text: 'The #6729 sync report, `gbrain sync status --json` (`identity_downgrades[].remedy`) and doctor `rename_identity_downgrades` now name each open pair\'s remedy: the `gbrain repair rename-identity` preview argv, the apply argv bound to the plan hash, `consent: ["destructive"]` and what releases the purge hold. On a managed source the remedy is `--close` (`carry_unavailable: "managed_remedy_unavailable"`), because carrying identity is unavailable there. Doctor\'s fix is the first pair\'s apply (`ask_user`, with `preview_argv` and `plan_hash`); `gbrain restore <old-slug> --source-id <id> --force` stays the named alternative wherever the source admits a restore (`restore_available`, so not on an unbound Postgres source with a checkout); there the remedy is the only fix doctor offers, and `restore_unavailable_sources` lists those sources.' },- ```--### CHANGELOG — S2--- **S2** When sync splits an inexact rename into a delete plus an add, `gbrain repair rename-identity` now finishes the rename on request: preview the pair, and after you agree the old page keeps its history, links and facts under the new name, or close the pair and let the old page go. Every surface that reports the pair names the command. Carrying identity works on classic sources; on a managed source only closing the pair is available this release (`managed_remedy_unavailable`) (#6729). Contributed by @javieraldape (PR #6732, rewritten).--### KEY_FILES (`docs/architecture/key-files/`) — S2--- **S2** new: `src/core/repair/rename-identity.ts`: `gbrain repair rename-identity` (#6729), explicit-only, preview-bound, destructive. `plan` selects one open pair (`--slug`/`--from`), hashes `identityRemedyParts` (brain, pair, both page ids and revisions, disposition) and saves the approved set; with no pair named it lists the open pairs. On a managed brain a carry preview returns no items with `details.code: managed_remedy_unavailable` and the `--close` preview, and an apply refuses with that code. `carryIdentity` (classic only): one maintenance transaction under both page locks re-checks the hash, the open record and `fenceRowChecks`, merges matching fence rows onto the old rows, retires the provisional page under `purgedSlug`, moves the old page to the new slug (`updateSlug` redirect), moves the provisional's page-id rows (`movePageIdReferences`), imports the new file, settles the record `remedied`. `--close` settles `closed`. Refusals: `fact_rows_collide`, `managed_remedy_unavailable`, `changed_since_preview`, `preview_changed`, `invalid_params`.-- **S2** amend the S1 entry for `src/core/sync-identity-downgrades.ts`: also the per-pair remedy (`identityRemedyParts`, `identityRemedy`, `withIdentityRemedies`, `renameIdentityPreviewArgv`, `remedyAction`; on a managed brain the remedy is `--close` with `carry_unavailable: managed_remedy_unavailable`) that every surface prints, and `settleIdentityDowngrade` (sets `completed_keys[0].disposition = { kind: remedied | closed, at }` on an open record).-- **S2** amend the S1 entry for `src/commands/doctor/checks/rename-identity-downgrades.ts`: fix = the first pair's `gbrain repair rename-identity` apply (destructive, `ask_user`, `preview_argv`, `plan_hash`; `--close` on a managed brain); restore is the alternative in its text only where `restore_available !== false`; `restore_unavailable_sources` lists the rest. The fix is the remedy everywhere, so unbound classic Postgres pairs now get an actionable fix. (Replaces the S1 restore fix.)-- **S2** `src/core/persistence/preview-approval.ts`: `PreviewApprovalCommand` gains `'rename-identity'` (in the feat commit, not an integrator file).--### Docs — S2--- **S2** `docs/guides/repair.md`: committed in the docs commit (explicit-only list, kind table row, `#rename-identity` section with the managed limitation).-- **S2** `docs/guides/live-sync.md` "Renaming a page": committed in the docs commit (names the remedy and `--close`, the managed limitation, links `repair.md#rename-identity`).--### Tests that changed for the intended behaviour — S2--- **S2** `test/sync-inexact-rename-6729.test.ts`, the classic crossed-pairs test: doctor's fix is now the remedy (argv, `preview_argv`, `consent: ['destructive']`, `plan_hash`); the test asserts the restore alternative in `fix.why` and still runs the restore and the verify.-- **S2** new `test/repair-rename-identity-6729.test.ts` (9 tests, PGLite and Postgres), including the managed fixture: report, status and doctor name `--close` and `managed_remedy_unavailable` and no other route; the carry preview states the code; `--apply` refuses with it and moves no identity; `--close` settles the pair and the purge then takes the old page; `gbrain restore <old> --source-id <id> --force` works on the managed source, so the restore alternative stays on managed.diff --git a/.wave18-fragments/lane3.md b/.wave18-fragments/lane3.mddeleted file mode 100644index b142c87581..0000000000--- a/.wave18-fragments/lane3.md+++ /dev/null@@ -1,156 +0,0 @@-# Wave 18 lane 3 fragments (integrator: apply, then delete this file)--Lane 3 branch: capy/wave18-lane3. Each section names the target file, the place and the exact text. Version strings use `<WAVE>` for the wave's stamped version.--## [S2] #6740 mention scan masks HTML comments--### src/core/behavior-change-notice.ts (append to BEHAVIOR_CHANGES)--```ts- { since: '<WAVE>', text: 'The entity mention scan no longer reads text inside HTML comments, so the `<!--- gbrain:... -->` fence markers stop producing `mentions` links to a page titled like a marker word (#6740). `MENTION_EXTRACTOR_VERSION` is now 6: the next `gbrain extract --stale` (or maintenance cycle) rescans every inline-body page once and removes the stale plain mention rows; `typed_ner` edges are untouched and segmented pages stay deferred as before. Entity cards and `get_backlinks` show a mention coverage notice (state `pending`) until that rescan finishes.' },-```--### CHANGELOG.md (wave entry, Fixed)--- The mention scan ignores text inside HTML comments, so gbrain's own fence markers no longer link every page to a page titled "gbrain" (#6740). One rescan runs on the next extract or maintenance pass and removes the false mention links. "Discussed in" timeline bullets that the bug already wrote are not removed by this release; delete them once by hand (they no longer come back). A preview-first cleanup is deferred to the next wave.--### Deferred list (PR body)--- #6740: cleanup of stale "Discussed in" timeline bullets already written; preview-first repair, next wave.--## [S2] #6742 question type in gbrain-base-v2 (pack 1.4.0)--### src/core/behavior-change-notice.ts (append to BEHAVIOR_CHANGES)--```ts- { since: '<WAVE>', text: 'The bundled `gbrain-base-v2` schema pack (the `init` default, also inherited by `company-brain`) is now version 1.4.0 and declares the `question` page type the pinned-question writer stamps, so a pinned question no longer makes doctor `schema_pack_consistency` warn `page_type_undeclared` (#6742). Existing question pages keep their type; no data changes. The active pack identity reads `[email protected]+<hash>`.' },-```--### Regenerate (integrator)--- Doctor goldens: the `pack_upgrade_available` message changes from `[email protected]+a50a67b9` to `[email protected]+1c5ba903` in test/fixtures/goldens/doctor/{content-pglite-human,content-pglite-json,hot-checks-pglite-json,hot-checks-postgres-json,json-pglite-degraded,json-pglite-fresh,json-postgres-fresh}.json. Regenerate with the goldens script rather than hand-editing.-- Verified locally on the lane head (9d22a479b): test/doctor-content-golden.test.ts, test/doctor-hot-checks-golden.test.ts and test/doctor-json-golden.test.ts fail (3 tests) and pass on master cadaf5cd7. Bisected: at d2bae380a (#6740 alone) the content golden matches; from 9cc84754c (#6742) on it drifts. The whole drift is (a) #6742: the pack identity `[email protected]+1c5ba903`, "pack gbrain-base-v2 declares 21" (was 20), and the journal byte counters (`used`, `per_day_7d`, `max_day_7d`, `reclaimable_bytes`) that grow with the bigger pack; (b) #6764: `unlinked_facts` details gain `conversation: null`, `window.conversation: 0` and `new_7d.conversation_unresolved: 0`. Regenerate after the merge with `GBRAIN_TEST_UPDATE_GOLDENS=1 bun test <file>` for each of those three files (plus the Postgres captures in the E2E tier), review the fixture diff against this list and name it in the PR body.-- Plugin trees / template repo if they embed the pack (none found by grep for `a50a67b9` outside the doctor goldens).--### CHANGELOG.md (wave entry, Fixed)--- Pinning a question no longer makes doctor warn about an undeclared `question` page type on the default schema pack (#6742). `gbrain-base-v2` is now 1.4.0.--## [S2] #6720 atom pages inherit the source page's content date--### src/core/behavior-change-notice.ts (append to BEHAVIOR_CHANGES)--```ts- { since: '<WAVE>', text: 'A page-derived atom now carries its source page\'s content date as frontmatter `date` (the source\'s stored `effective_date`, else the same precedence import uses), so its `effective_date` is the date of the conversation or note it came from instead of the extraction run (#6720); `extracted_at` stays the processing stamp and transcript-derived atoms are unchanged. Atoms extracted before this release keep their run dates until re-extracted (`gbrain dream --phase extract_atoms` with `--force` re-pays the model); a preview-first backfill repair is planned.' },-```--### CHANGELOG.md (wave entry, Fixed; credit)--- Atoms extracted from a page are dated by that page's content date, not by when extraction ran, so date filters and recency ranking over atoms work (#6720). Existing atoms are not backfilled in this release. Contributed by @javieraldape (idea from #6737).--### PR body--- `Supersedes #6737` (reimplemented: helper peeled into `src/core/cycle/atom-source-date.ts` instead of a module-size ratchet raise; single source-page fetch before inference kept).-- Deferred: #6720 backfill of existing atom dates, a preview-first repair, next wave.--### scripts/module-size-limits.tsv--- No row change: `src/core/cycle/extract-atoms.ts` is 1653 of its 1654 ceiling after this commit.--## [S2] #6731 conversation extractor entity hints--### src/core/behavior-change-notice.ts (append to BEHAVIOR_CHANGES)--```ts- { since: '<WAVE>', text: '`gbrain extract-conversation-facts` (and the `conversation_facts_backfill` cycle phase) now tells the extractor which entities the conversation page itself links (its frontmatter attendees and the entity pages its body links, same source, up to 40 slugs), so facts about those people and companies are stored on their pages instead of a guess from a first name (#6731). A private entity is hinted only when the run writes private facts. The `extract_facts` operation\'s prompt and 5-hint cap are unchanged.' },-```--### CHANGELOG.md (wave entry, Fixed; credit)--- Conversation fact extraction passes the page's own linked entities to the extractor as hints, so more meeting facts link to the right person or company page (#6731). Contributed by @troyhoffman-oss (design from #6736; reimplemented with slug-only hints, a visibility filter and the op prompt left unchanged).--### PR body--- `Supersedes #6736`.--### scripts/module-size-limits.tsv--- `src/commands/extract-conversation-facts.ts` shrinks from 2087 to 2078 in this commit (the two extractor call sites share one input object). Lower its ceiling when the integrator settles the TSV after the later lane 3 commits (the #6764 commit adds a few lines back; see that section).--## [S2] #6764 conversation facts: write-time subject inference and a doctor fix that can act on them--### src/core/behavior-change-notice.ts (append to BEHAVIOR_CHANGES)--```ts- { since: '<WAVE>', text: '`gbrain extract-conversation-facts` (and the `conversation_facts_backfill` cycle phase) now runs the free write-time subject inference on facts the extractor returns without an entity, so a fact naming exactly one entity page in full is stored on that entity (context note `entity inferred from mention`; off with `facts.entity_inference false`) (#6764). Doctor `unlinked_facts` counts the conversation extractor\'s unlinked rows on their own (origin `conversation`, no longer inside fence-owned) and, because `gbrain facts relink` never examines them, its fix is a bounded, source-qualified re-extraction of the pages with the most (`--slugs`, up to 50, `--force --max-cost-usd <N>` with the approved amount as the input `N`, preview `--dry-run`; paid, asks the user first). A `replaces` naming a conversation-derived fact now says to re-extract its page instead of hinting at a fence edit.' },-```--### CHANGELOG.md (wave entry, Fixed)--- Facts extracted from conversations now link to the person or company they name when only one entity page matches, and doctor's `unlinked_facts` gives conversation facts a fix that can act on them (a re-extraction of the named pages capped at the amount the user approves, previewed first) instead of `gbrain facts relink`, which never touched them (#6764).--### scripts/module-size-limits.tsv--- `src/commands/extract-conversation-facts.ts` is 2079 of its 2087 ceiling after this commit (the inference logic lives in the new `src/core/facts/conversation-subject-infer.ts`). The integrator can lower the ceiling to 2079 when settling the TSV.--### Notes--- New exported symbols (no registry rows needed): `CONVERSATION_FIX_SLUGS` (doctor/checks/unlinked-facts.ts), `inferConversationSubjects` (core/facts/conversation-subject-infer.ts). The `replaces_cross_page_derived` suggestion lives in core/persistence/verb-errors.ts beside the existing `replaces_cross_page` text; no error-registry code was added.--## [S2] #6764 free conversation relink as the doctor's primary fix (decision d1b)--### src/core/behavior-change-notice.ts (append to BEHAVIOR_CHANGES)--```ts- { since: '<WAVE>', text: 'New `gbrain facts relink --conversation` links the conversation extractor\'s facts that were stored without an entity, for free: a fact naming exactly one entity page in full is linked (context note `entity relinked from mention`), one write per page (a receipted coordinator request on a managed brain), no model call (#6764). Doctor `unlinked_facts` now prescribes it first for those rows (consent none, the agent runs it, preview `--dry-run`); a fact it cannot resolve is recorded (`fact_relink_attempts` outcome `conversation_unresolved`), and only then does the doctor offer the paid, capped re-extraction of its page.' },-```--### CHANGELOG.md (wave entry, Fixed; same bullet as the #6764 line above, extended)--- `gbrain facts relink --conversation` links existing conversation facts to the people and companies they name, for free; doctor offers it before any paid re-extraction (#6764).--### Notes--- New maintenance intent kind `managed_maintenance_conversation_relink`, dispatched in `src/core/persistence/prepared-maintenance.ts` (one line, not a listed registry). New canonical-writer census row for `src/core/facts/conversation-relink.ts` in `docs/architecture/canonical-writers.tsv` (ceiling 1, boundary coordinator).-- Module sizes: `src/commands/facts.ts` 201 lines, `src/core/facts/conversation-relink.ts` 187 (new), `src/core/persistence/prepared-maintenance.ts` 590; none is listed in the TSV and all are under the new-file cap. No TSV change.--## [S2] Gate follow-ups (all items)--- `src/core/cli-flag-registry.generated.ts`: regenerated with `bun run build:flag-registry` in the separate final commit "INTEGRATOR-ROW: regenerate cli-flag-registry for lane 3" (tests docs-cli-commands, remediation-command-resolution, cli-flag-validation and conversation-facts-type-allowlist-drift need it). Additive only: facts +`--conversation --force --slugs --source-id`, doctor +`--conversation --entity --retry-model`, lint +`--max-cost-usd --slugs`, maintain and sync +`--conversation`. Drop it and rerun the generator after the lanes merge.-- New exemption in `scripts/check-core-guard-coverage.mjs` (conversation-relink.ts: database-only fact rows, page text unchanged) and a write-attribution row in `docs/architecture/system-of-record.md`.-- gstack pregate `literals` reports ~643 test locations "still carrying" MENTION_EXTRACTOR_VERSION 5. Every hit except test/mentions-pass.test.ts (fixed to use the symbol) is an unrelated literal 5 (array indexes, model names, counts); no test pins the mention version as a number. The `lanes` check flags this fragment file, which the integrator deletes.---## [S2] #6764 follow-up (v3 review r2-d1)--- The free path is `gbrain facts relink --conversation` (a flag on the existing verb). It stays a receipted, database-only linkage of the derived row: `entity_slug` plus the `entity relinked from mention` note on the row itself, one maintenance transaction per page (a `managed_maintenance_conversation_relink` request on a managed brain). Conversation ownership, fact id, provenance and trust are kept and no Markdown is edited, so the doctor envelope asks no consent (`[]`, actor agent; `host_admin` on the remote path). Conversation pages have no `## Facts` fence (canonical projection and the extract_facts reconcile skip extractor rows, #1928), so `FACTS_FENCE_COLUMNS` having no entity column does not matter here.-- `extract-conversation-facts --force` keeps the link: `clearConversationFacts` expires relinked rows instead of deleting them and the replacement row of the same claim inherits the entity (new module `src/core/facts/conversation-relink-carry.ts`). Tested unmanaged and managed with write-time inference off, plus the extract_facts reconcile.-- Every derived row the free pass examines is memoized in `fact_relink_attempts` (`linked` or `conversation_unresolved`), so doctor sequences free relink while untried rows exist, then the paid fallback scoped to the memoized pages (at most 50) with `--max-cost-usd <N>` and `inputs: [{ name: 'N' }]`.-- 25% rule: memoized `conversation_unresolved` rows are excluded from the new-fact share like `no_subject` (`details.new_7d.conversation_unresolved`).-- `RELINK_REASONS.fence_owned` text names `gbrain facts relink --conversation` (the guide table in docs/guides/facts-relink.md matches).--### src/core/behavior-change-notice.ts (replace the #6764 rows' paid-fallback wording)--- In both #6764 rows, the paid fallback is "capped at the amount the user approves (`--max-cost-usd <N>`)", not "`--max-cost-usd 1`", and the second row should add: "A re-extraction of the page keeps a relinked fact's entity on the claim's new row. Rows the free pass could not resolve no longer count toward doctor's 25% new-fact warning."--## [S2] #6764 follow-up (final v3 Eng review)--- Paid-fix envelope fixture: test/conversation-reextract-envelope-6764.test.ts runs the free pass, takes doctor's paid fix, runs its preview_argv through the CLI (output names the target page, no model call, facts unchanged), then the real argv with N=1 against a zero-price stubbed provider (pricing.overrides 0/0), and asserts unlinked_facts clears.-- `extract-conversation-facts --dry-run --slugs ...` now prints `Targets: <slugs>` (one line; src/commands/extract-conversation-facts.ts is 2080 of its 2087 ceiling, no TSV change).-- test/trust-write-gate-drift.test.ts gains an EXEMPT row for src/core/facts/conversation-relink.ts (it writes entity_slug and a context note on existing rows, never claim text). The RELINK_REASONS.fence_owned text avoids a hand-built gbrain command (check:agent-contract).-- The free relink is the trusted-local intent `managed_maintenance_conversation_relink` (database-only, no files, no model) on a managed brain; an unmanaged brain has no maintenance coordinator, so it uses the same writeDerivedFacts maintenance transaction as the extractor itself.-- All Lane 3 rows in this file are S2.--## [S2] #6764 follow-up (v4 DX: the free, paid, manual sequence converges)--- The paid attempt is memoized per (source_id, transcript slug, content_hash) in the existing `fact_relink_attempts` table (tier `paid_reextract`, `target_slug` the page, `reason` the hash, keyed on the page's completion outcome row); no schema change and no migration. Every completed extraction of a page writes it (unmanaged `extract-conversation-facts.ts`, managed `conversation-publication.ts` `applyEntry`), so a page already extracted with entity hints and write-time inference on its current content is never offered the paid argv again. New module `src/core/facts/conversation-memo.ts`.-- Doctor `details.conversation.fix` gains `manual`: no envelope `fix` and no paid argv; the message names the hand route (forget it and remember it again with --entity) until the page's content changes, which re-arms `reextract`.-- Free outcomes: only `RELINK_REASONS` memoized:true misses (`ambiguous`, `unverified_match`) stay tried for good; `no_page`, `no_mention` and `withdrawn` misses are re-armed for the free relink by any page created in the source after the attempt.-- `extract-conversation-facts.ts` is 2081 of its 2087 ceiling (one import line). No TSV change.-- `src/core/cli-flag-registry.generated.ts` regenerated again in a separate INTEGRATOR-ROW commit (doctor drops `--retry-model`; maintain and sync gain `--entity`, from the doctor's hand-route text). Drop it and rerun `bun run build:flag-registry` after the lanes merge.-- Doctor golden drift: none new from this follow-up (`details.conversation.fix` gains the value `manual`; no new field).-- Test: test/conversation-memo-6764.test.ts (free, paid at zero price with N=1, then manual and no paid argv; a new entity page re-arms a `no_page` row; a content edit re-arms the paid fallback). Fails 3/3 on 6be0e3410, passes 3/3 after. test/conversation-facts-managed.test.ts gains the managed memo test (pglite here; postgres in the e2e tier).--### src/core/behavior-change-notice.ts (append to the second #6764 row)--- "Once a page was re-extracted on its current content, doctor stops offering the paid re-extraction for it and lists the facts left for linking by hand (`--entity`); editing the page offers it again."diff --git a/.wave18-fragments/lane5.md b/.wave18-fragments/lane5.mddeleted file mode 100644index 7a78ff3209..0000000000--- a/.wave18-fragments/lane5.md+++ /dev/null@@ -1,103 +0,0 @@-# Wave 18 lane 5 fragment (integrator: apply, then delete this file)--Branch capy/wave18-lane5. Rows for integrator-owned files, in the order the-items were committed. "<v>" is this wave's release.--## Already applied in the INTEGRATOR-ROW commit (drop or keep it)--The last commit, "INTEGRATOR-ROW: lane 5 registry row and regenerated docs",-holds what this branch's tests and checks need:--1. src/core/error-registry.ts: the movement_unknown row (#6781), inserted- right before managed_sync_flag_refused. typecheck needs it- (src/commands/sources-writer-movement.ts throws it).-2. docs/guides/error-codes.md regenerated (bun run build:error-codes).-3. llms-full.txt regenerated (bun run build:llms), because lane docs are- inlined there.-4. test/fixtures/goldens/exports/types.json regenerated- (GBRAIN_TEST_UPDATE_GOLDENS=1 bun test test/export-surface-golden.test.ts):- the only change is "movement_unknown" in the error-code union.-5. plugin/ and plugin-variants/ regenerated for skills/maintain/SKILL.md- (#6748): bun run scripts/generate-plugin-tree.ts --out plugin --variants-out plugin-variants-6. The doctor check coordination_lock_location (v3 lock follow-up) is- registered:- - src/commands/doctor/wave-checks.ts, right after the- foreign_ownership_marker entry:-- {- id: 'coordination_lock_location', resolution: 'operator', registration: 'wave',- hostOnly: 'Coordination lock reservations are private files beside the source checkouts on the brain host.',- count: d => Number(d.count ?? 0),- impact: 'GBRAIN_COORDINATION_HOME names another directory than a checkout\'s recorded coordination lock, which stays in use',- instruction: 'Make the recorded lock directory doctor names survive container recreation and unset GBRAIN_COORDINATION_HOME for that checkout if it was meant to move the lock (docs/architecture/topologies.md#coordination-home-ignored); never edit or delete the reservation.',- run: async engine => (await import('./checks/coordination-lock.ts')).checkCoordinationLockLocation(engine),- },-- - src/core/doctor-categories.ts and the list in- src/commands/doctor/checks/graph-health.ts: 'coordination_lock_location'- right after 'foreign_ownership_marker'.- - Doctor goldens regenerated (GBRAIN_TEST_UPDATE_GOLDENS=1 on- test/doctor-json-golden.test.ts, test/doctor-content-golden.test.ts,- test/doctor-hot-checks-golden.test.ts, test/doctor-registry-golden.test.ts):- the only change is the new check (ok on a fresh brain).--## src/core/error-registry.ts: writer_lock_unavailable suggestion (lock cluster, #6765)--Replace the suggestion value of writer_lock_unavailable with:-- suggestion: 'For a queued write, wait for the owner (gbrain sources writer status --json names it) or run the write from a process that can open the lock directory; retrying from the same sandboxed process changes nothing. The lock path and the rule that chose it are in onboarding.sources[].coordination_lock of that status. A claim refused while another process repairs an old reservation whose lock was recorded inside the checkout (old_path_wedge: true) succeeds once that repair finishes: run the claim again; never delete the reservation.'--Then bun run build:error-codes and bun run build:llms.--## Watch--docs/architecture/key-files/tooling-and-tests.md is 59986 bytes after the-stale-lease entry, 14 under the 60000-byte doc-history cap: the next edit-there needs a split.--## Doctor goldens--The #6758/#6759/#6781 details changes are warn-path only; the only golden-change is the new coordination_lock_location row (INTEGRATOR-ROW item 6).--## Process groups: stale guard runs are reported, never reaped--The cross-run auto-reap commit was dropped (r3-d1). The last commit of the-branch, "fix(eval): report a SIGKILLed guard's stale run without killing it-(#6776)", only writes a run lease and reports a stale run on the next start;-nothing is signalled across runs.--## src/core/behavior-change-notice.ts: BEHAVIOR_CHANGES rows (append, since '<v>')-- { since: '<v>', text: 'A managed sync backlog that cannot be read is now movement_state unknown (unknown.reason backlog_read_failed) on sources status, writer status and doctor, never nothing_pending (#6781). Doctor managed_sync_not_moving warns with details.health unknown, and gbrain sources writer movement exits 1 with the new code movement_unknown (--warn-only still exits 0) where it used to exit 0. Rerun the movement command; if the read keeps failing, run gbrain doctor --json.' },- { since: '<v>', text: 'gbrain config set now accepts twelve keys gbrain already reads at runtime but refused as unknown (#6780), including facts.absorb_warn_threshold, think.trajectory_enabled, embedding_image_ocr_max_usd and agent.search_snippet_chars; a source scan guard keeps every getConfig key registered.' },- { since: '<v>', text: 'A terminal write failure with origin owner_exception no longer gets the database-trigger hint (#6719): it says the owner hit an unexpected exception, nothing was committed and the cause is unknown, and points at gbrain write-request <id> --json (error_detail) and the consumer log; an origin that names no database refusal stays unknown instead of being read as a trigger.' },- { since: '<v>', text: 'Every agent-contract event now records the gbrain version that wrote it (#6758). When doctor agent_contract warns, details.builds splits the counted events into this_build, other_builds and unknown_build, details.incident is historical when none came from the running build, and the message names how many another build recorded. The warning and its 7-day window are unchanged.' },- { since: '<v>', text: 'Doctor persistence_counter_drift now names each drifting scope\'s direction (overcharge for a positive delta, a bounded charge with no data lost; undercount for a negative one) and splits the receipts behind it into requests and topology_changes (#6759). The check is still read-only; there is no counter reconcile repair yet.' },- { since: '<v>', text: 'An embedding error from a provider that reports one input over the model\'s context with a 5xx or no HTTP status (llama.cpp "larger than the max context size", Ollama 500 "input length exceeds the context length") is no longer retried as transient (#6772): the bad chunk is isolated, its siblings embed, and the over-length heal splits it. Only explicit token or context-limit wording counts; "input queue is too long", connection-limit and other 5xx errors still retry.' },- { since: '<v>', text: 'Writer coordination lock path fallback (#6765): when a checkout contains GBRAIN_HOME (or is it), its native writer lock no longer lands inside the checkout; a claim places it under GBRAIN_COORDINATION_HOME (absolute, outside the checkout), else ~/.gbrain/persistence, in a directory namespaced by the checkout and host, and refuses with storage_error when even that resolves inside the checkout. Ordinary layouts keep persistenceHome()/locks, and a path a reservation already records always wins. A writer transfer keeps the recorded lock (successor reservation first, then the host binding) instead of recomputing it from the accepting process\'s home. A reservation an older release wedged with its lock inside the checkout ("must live outside the canonical checkout") is repaired by the next claim on the host that reserved it. Who: brains whose source checkout contains GBRAIN_HOME, and container deployments. What to do: in a container, set GBRAIN_COORDINATION_HOME to a mounted directory outside the checkout so the lock survives recreation; re-run the claim on a wedged source; gbrain sources writer status --json shows onboarding.sources[].coordination_lock (path, rule, old_path_wedge, and coordination_home_ignored when GBRAIN_COORDINATION_HOME names another directory than the recorded lock, which wins; doctor coordination_lock_location warns about the same case).' },- { since: '<v>', text: 'A graduation intent marker that recorded a boot id or PID namespace this process cannot read now reads unknown, not alive, so a marker from another host or container is never taken as a live run because a local process shares its pid (#6774).' },-- { since: '<v>', text: '`scripts/eval-spend-guard.sh` runs the guarded command in its own process group and stops the whole group (helpers and grandchildren included) on an interrupt, after the kill grace, and when the command exits leaving processes behind. A terminal stdin is now EOF (the command cannot read the terminal from its own group); pipe or redirect input if it needs any (#6776).' },- { since: '<v>', text: 'While its command runs, `scripts/eval-spend-guard.sh` keeps a run lease in `<ledger>.leases/<run_id>.lease` (run id, guard pid, process group id, host, boot id) and removes it once the run is reconciled. When a guard was SIGKILLed and its process group may still be running, the next guard on that host prints a STALE RUN report on stderr with the lease path, the pgid and the commands to inspect it (ps -o pid,pgid,cmd -g <pgid>) and stop it (kill -TERM -- -<pgid>), appends a cost-0 status "unknown" ledger row (stale_run_id, pgid, lease) and renames the lease to .reported; a later start retires a .reported lease once its group has exited or the host rebooted (or remove it by hand). Nothing is killed automatically, and the stale run\'s reservation stays counted at its estimate (#6776).' },- { since: '<v>', text: '`gbrain claw-test` runs each phase in its own process group: a phase timeout, SIGINT and SIGTERM stop everything the phase started, and SIGINT stops the running phase even when it was not sent from the terminal (a second SIGINT kills it) (#6775).' },--#6719's "checkpoint receipts become historical" row from plan-v2 is not-needed from this lane: master already supersedes failed checkpoint-submit_job receipts by a later committed __managed_sync_checkpoint__ request-(#6834, src/core/persistence/terminal-classify.ts supersessionSql); the-branch adds a pinning test only.--## CHANGELOG credit lines--- Contributed by @lubosxyz: writer coordination lock cluster (supersedes- #6765, #6766, #6767), process identity probes (supersedes #6774),- embedding over-length self-heal (supersedes #6772), process-group cleanup- (supersedes #6776, #6775).-- Ideas from @Kkkkkuro's #6790 (closed by its author): #6719 owner-exception- hint and #6758 build version on agent-contract events.--## Heavy Tests--#6049 changes test/e2e/install-real-opencode.serial.test.ts; dispatch Heavy-Tests on the wave branch and record the run id.diff --git a/docs/.wave18-fragments/lane4.md b/docs/.wave18-fragments/lane4.mddeleted file mode 100644index 9c45610c7d..0000000000--- a/docs/.wave18-fragments/lane4.md+++ /dev/null@@ -1,22 +0,0 @@-# Wave 18 lane 4 fragments (integrator: apply, then delete this file)--Branch `capy/wave18-lane4`. Every `since` below is a placeholder: stamp the wave's version at the merge slot.--## BEHAVIOR_CHANGES rows (`src/core/behavior-change-notice.ts`, append at the end of `BEHAVIOR_CHANGES`)--```ts- // Wave 18 lane 4 (#6725, PR #6745 by @javieraldape). `since` is a placeholder until the merge-slot stamp.- { since: '0.60.267.0', text: '`volunteer_context` and the retrieval reflex now point at one page per name per source: when a meeting, transcript or note page shares an entity page\'s exact title, the pointer goes to the explicit exact slug, then the linkable entity type, then anything else, as `entity` already chose (#6725). The choice runs after the privacy and activation gate, so a private or withheld entity page falls back to the readable page, and same-title pages in different sources are still both volunteered.' },- // Wave 18 lane 4 (#6723). `since` is a placeholder until the merge-slot stamp.- { since: '0.60.267.0', text: '`entity` and `context_pack` now resolve names across every source the caller can read, like `volunteer_context` (#6723): the home source first (the connection\'s source, or its GBRAIN_SOURCE / .gbrain-source binding), then the other readable sources sorted by id. A name only another readable source holds now returns a card instead of `found: false`; a name the home source holds still resolves there. `source_id` pins one source (refusals match `recall`: `scope_denied`, `not_found`, `invalid_params`), `context_pack` takes source-qualified `entity_refs`, and every card, `names` row and suggestion carries `source_id`. A bound connection\'s lookups that its own source misses get a `source_binding_narrowed` notice naming where each name resolved. Sources outside the grant are never read; a remote `__all__` still resolves nothing. Each pack card\'s activation verdict, newer mentions, records, page status and pinned questions now come from its own source: a pinned question joins the pack only when its source and `scope_entity` match a packed card, and a requested name that packs no card no longer pulls in a pin by slug.' },- // Wave 18 lane 4 (#6724). `since` is a placeholder until the merge-slot stamp.- { since: '0.60.267.0', text: '`context_pack` now returns `entity_facts[]`, the packed entities\' own facts (up to 5 per card, newest first, read in the card\'s own source and visibility), each tagged with its card\'s `source_id` and `slug` and carrying `fact_id`, confidence, `attributed_to`, provenance and trust (#6724). `facts[]` is unchanged hot memory. `text` gains a `## Entity facts` section before hot memory, and a fact in both renders once. Under `budget_tokens` entity facts pack after cards and before hot facts; a remote caller still never sees a private fact.' },-```--## Regeneration steps (integrator-owned generated files)--- `bun run build:llms`: `docs/protocol/MEMORY_VERBS_v1.md` gained the "entity source resolution and `source_id`", "context_pack sources" and "context_pack entity_facts" sections, so `llms-full.txt` is stale (`test/build-llms.test.ts` fails until regenerated).-- `src/core/operation-manifest.generated.ts` was regenerated in-branch (`bun run build:operation-manifest`) for the new `entity` / `context_pack` params; rerun it after the merge.-- Plugin trees / MCP tool goldens: rerun their generators after the merge (new `source_id`, `prefer_source_id` and `entity_refs` params).-- `test/fixtures/goldens/cli/tools-json.json`: `GBRAIN_TEST_UPDATE_GOLDENS=1 bun test test/cli-goldens.test.ts`. The diff is intentional and only adds the #6723 params (`entity`: `source_id`, `prefer_source_id`; `context_pack`: `source_id`, `entity_refs`, `prefer_source_id`); `--tools-json` is the full surface, so they show there even though the starter MCP list omits them.-- `bun run regen:all --check` on the lane head lists only `llms.txt + llms-full.txt` as stale; the tools-json golden fails in `test/cli-goldens.test.ts` and is not in regen:all.