mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-31 04:07:52 +00:00
takes.embedding had readers (searchTakesVector, think's takes_vec arm, getTakeEmbeddings) and stale-tracking (countStaleTakes/listStaleTakes) but no writer anywhere in src/ — the vector takes arm was structurally dead on every install. - BrainEngine.updateTakeEmbeddings (postgres + pglite, lockstep): writes embedding + embedded_at for active takes; updated_at untouched (embeddings are derived data, not a content change). - embedStaleTakes in src/commands/embed.ts: claim-text backfill wired into the --stale path, so CLI `embed --stale`, the cycle/dream embed phase, and sync auto-embed all populate takes.embedding. Log-and-skip semantics; dry-run counts into would_embed; EmbedResult.takes_embedded reports the count. - Migration v125 (takes_embedding_dim_align): the takes DDL hardcoded VECTOR(1536); brains configured with a different-dim embedder could never take writes. Since the column was writer-less it is all-NULL everywhere, so a guarded DROP/ADD retype to the configured dims (same config source as the facts migration) is lossless and works on PGLite too (which can't ALTER COLUMN TYPE vector(N)). No-op when dims match or data exists. - test/embed-stale-takes.test.ts: fails without the writer (backfill, dry-run, idempotence, searchTakesVector goes live, v125 retype). Fixes #2089 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>