Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/capy/wave-b-pr4-4a2' into capy/wave-b-pr4-local

garrytan8bd082201623
diff --cc src/core/page-body/schema.ts
index 6ad65c0ada,5c44f57873..10b9dd21b0
--- a/src/core/page-body/schema.ts
+++ b/src/core/page-body/schema.ts
@@@ -181,12 -181,9 +181,13 @@@ const sqlList = (values: readonly strin
* the segment text and the context (`context_hash`: entry state plus the page-level inputs the pipeline reads) it was
* derived from, the pipeline version, the outcome and a bounded per-segment output. A pipeline's work on a page is the
* live occurrences without a settled row whose segment sha, context hash and version match, found from metadata alone.
- * Rows of an occurrence that left the live generation are deleted by their pipeline (retireSegmentDerivations); a page
+ * Rows of an occurrence that left the live generation are deleted by their pipeline (retireSegmentDerivations) or by a
+ * fence rewrite; demotion to inline deletes the page's rows, a fact purge every row holding the claim, and a page
* delete cascades. The output holds link context and window anchors, so the table gets the segment tables' RLS posture.
+ *
+ * PR 4 (Wave B incremental derivation, transcripts): page_derivation_spend is the per-page lifetime spend ledger of each
+ * paid derivation family (`facts`, `atoms`, `synopsis`; page-spend.ts), each capped by `derive.max_usd_per_page` on its own,
+ * apart from the embedding ledger (page_embedding_budget), so derivation spend never starves a page's embeddings.
*/
export const PAGE_SEGMENT_DERIVATIONS_SQL = `CREATE TABLE IF NOT EXISTS page_segment_derivations (
page_id INTEGER NOT NULL REFERENCES pages(id) ON DELETE CASCADE,