Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
Merge remote-tracking branch 'origin/capy/memory-trust-writes' into l1a-taint-dream
garrytanfd6012b9b4d7
diff --cc src/core/cycle/patterns.tsindex 6ef5d78c27,53691db85f..5593570039--- a/src/core/cycle/patterns.ts+++ b/src/core/cycle/patterns.ts@@@ -757,9 -724,7 +757,9 @@@ export async function groundPatternPageelse if (await publishOrHold(publish)) heldSlugs.add(slug);} else {const [{ importFromContent }, { isAvailable }] = await Promise.all([import('../import-file.ts'), import('../ai/gateway.ts')]);- const write = (tx: BrainEngine) => importFromContent(tx, slug, content, { noEmbed: !isAvailable('embedding'), sourceId });- await importFromContent(engine, slug, content, { noEmbed: !isAvailable('embedding'), sourceId, preserveGateMarkers: true });++ const write = (tx: BrainEngine) => importFromContent(tx, slug, content, { noEmbed: !isAvailable('embedding'), sourceId, preserveGateMarkers: true });+ if (!derived) await write(engine);+ else await derivedMaintenanceTransaction(engine, derived, async tx => ({ result: await write(tx), rows: [{ table: 'pages' as const, id: snapshot.page.id, sourceId }] }));}}return stats;diff --cc src/core/cycle/synthesize-verify.tsindex 1e30805962,c2ecb6bcf7..1dce9c3bd4--- a/src/core/cycle/synthesize-verify.ts+++ b/src/core/cycle/synthesize-verify.ts@@@ -1428,13 -1424,10 +1428,13 @@@ export async function verifyAndRepairDrconst links = await isAutoLinkEnabled(engine) ? await prepareAutomaticLinks(engine, ref.slug, parsed, ref.source_id) : undefined;// noEmbed: the phase-end embed sweep backfills. Provenance fields// null → engine COALESCE keeps the first-write record intact.- await importFromContent(engine, ref.slug, md, {+ // #5575 I2: the repaired page and its re-projected rows are written at+ // the tier of the transcripts it was synthesized from, with its edges.+ const derivation = await transcriptsDerivation(engine, ref.paths.map(path => ({ filePath: path, content: transcriptsByPath.get(path)!.content })), opts.meetingTranscriptsDir);+ await derivedMaintenanceTransaction(engine, derivation, async tx => ({ result: await importFromContent(tx, ref.slug, md, {- noEmbed: true, remote: false, sourceId: ref.source_id,+ noEmbed: true, remote: false, preserveGateMarkers: true, sourceId: ref.source_id,- beforeCommit: async tx => { await project(tx); await links?.apply(tx); },- });+ beforeCommit: async inner => { await project(inner); await links?.apply(inner); },+ }), rows: [{ table: 'pages' as const, id: page.id, sourceId: ref.source_id }] }));stats.pages_repaired++;}} catch (e) {