quilt kernel P6: tidepool — the helper-thread memory ocean joins the ledger - #6
Closed
SuperInstance wants to merge 1 commit into
Closed
SuperInstance wants to merge 1 commit into
SuperInstance wants to merge 1 commit into
Conversation
…ledger Port of the tidepool v1 bench contract (/tmp/tidepool/README.md is the spec; the README wins wherever bench implementations diverged). - src/tidepool/ocean.ts — markdown ocean + recall index; weighted token scoring (helper/question x2, response/meta x1), tie to most recent, clamp 3..5, deterministic (replay-reproducible, no embeddings) - src/tidepool/stall.ts — threadLengthMonitor as a pure function; absence is the information (P2 negative-ledger pattern) - src/tidepool/projection.ts — projectHelperThread BIND-for-BIND (L1 law: channel + helper endpoints bound before the thread links them); projectQuietThread mirrors .refused; replayThreadIndexFromWal folds WAL-only rows; readWalRowsByMutation/readWalRowsSince for API read-back and tip continuation (tolerant of SqliteD1 sync-all and D1 async-all) - src/tidepool/index.ts — six public entry points; every write is a DUAL-WRITE (ocean markdown + quilt WAL); WAL failures caught and counted (local counter, forward-compatible with PR #5 ops counters) - helper_threads + helper_logs migration 0015 (drizzle-generated with snapshot + journal) - 11 tests: chain verifies with hermit's own verifyChain, L1 link order, single-mutation channel sweep, recall scoring/clamp/determinism, quiet detection + newlyQuietThreads crossing-only, drain negative ledger (helper_threads untouched), WAL-only replay parity, markdown reload parity, tip continuation, WAL-failure posture (memory survives, failure counted), oath audit (append-only, timestamps) Refs openclaw#48
This was referenced Sep 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The tidepool bench (sibling of hermit, same quilt kernel) proves the helper-thread memory ocean: every write is a dual-write — the ocean markdown is the human-readable memory, the quilt WAL is the replayable ledger. The bench contract lives in
/tmp/tidepool/README.md; this PR ports it into hermit as a first-class module.Import, never duplicate: the port consumes
commitProjectionfromsrc/quilt/commit.tsand the hash-chain primitives (verifyChain,WalRow) fromsrc/quilt/projection.ts. The fnv1a chain input is byte-identical to hermit's, so tidepool WAL rows share the samequilt_waltable without collision.What
src/tidepool/ocean.ts—TidepoolOcean: markdown ocean + recall index. Deterministic weighted token scoring (helper/question ×2, response/meta ×1), ties to most recently remembered,limitclamped 3..5.stats()audits the rememberBotAction oaths: never modify (no edit/delete API exists), always append-only (re-remember appends a new section; a memory of a memory stays), always timestamps (every section carriesrememberedAt).src/tidepool/stall.ts—threadLengthMonitoras a pure function:detectQuietThreads(windowed flat-run detection, growth resets, unsorted input) andnewlyQuietThreads(crossing-only delta for a 30-min cron — silence is remembered once; bench extra, pure composition).src/tidepool/projection.ts—projectHelperThreadBIND-for-BIND with the L1 law honored (channel + helper endpoints bound before the thread links them);projectQuietThreadmirrors the P2.refusednegative ledger — a quiet thread is an absence, and the absence is the information.replayThreadIndexFromWalfolds WAL-only rows;.quietstate survives alongside remembered threads.readWalRowsByMutation/readWalRowsSincetolerate both SqliteD1 (sync.all()) and Cloudflare D1 (async{results}) shapes.src/tidepool/index.ts— the six public entry points:rememberHelperThread,rememberChannelThreads(one mutation for N threads),recallHelperContext,rememberBotAction,drainQuietThreads, plusreplayThreadIndexFromWalfrom projection. Every write dual-writes; WAL failures are caught and counted, never thrown into the helper path.Migration
0015—helper_threads+helper_logs(drizzle-generated, snapshot + journal committed; secondgeneraterun confirms "No schema changes"). Per the contract, the WAL is the source of truth — these tables are the materialized view for live reads.Verification
bun run typecheckcleanDeviations from the README (documented per contract)
0014was already taken by the p4quilt_wal_lockmigration on this base.replayThreadIndexFromWalis exported fromprojection.ts, notindex.ts— keeps index.ts to the six write/read entry points; same public surface overall.index.ts(getTidepoolWalFailures) — PR quilt kernel P5-ops: the ledger reports its own health #5's ops counters (recordWalFailure("tidepool_projection")) are a 2-line follow-up once quilt kernel P5-ops: the ledger reports its own health #5 lands; this branch is independent of quilt kernel P5-ops: the ledger reports its own health #5 by design.Merge order
Stacked on
quilt-kernel-p4-review-fixes(same base as PR #5). Independent of PR #5 — they touch disjoint files (P5:src/quilt/ops.ts+ catch sites in data layer; P6: all-newsrc/tidepool/*). Both land after #4.Refs openclaw#48