Reliability repair (v0.12.2)
If you ran v0.12.0 on real Postgres or Supabase, two bugs may have corrupted data already in your brain. v0.12.1 fixed the code going forward. v0.12.2 adds detection inmodusbrain doctor and a standalone modusbrain repair-jsonb
command for the mechanically fixable class. PGLite users are not affected.
What got corrupted
JSONB double-encode. Four write sites used${JSON.stringify(x)}::jsonb with postgres.js, which stored a JSONB
string literal instead of an object. frontmatter ->> 'key' returns NULL;
GIN indexes are ineffective. Affected: pages.frontmatter,
raw_data.data, ingest_log.pages_updated, files.metadata.
Markdown body truncation. splitBody() treated --- horizontal rules
as a body/timeline delimiter, dropping everything after the first rule.
Wiki-style pages with multiple ##/### sections lost the bulk of their
content at import time.
Detect
jsonb_integrity— counts double-encoded rows per table and points you atmodusbrain repair-jsonb.markdown_body_completeness— heuristic for pages whosecompiled_truthis suspiciously short compared toraw_data.data ->> 'content'.
Repair
For JSONB (mechanically fixable):UPDATE <table> SET <col> = (<col>#>>'{}')::jsonb WHERE jsonb_typeof(<col>) = 'string'
across every affected column. Idempotent. Second run reports 0 rows. Use
--dry-run to preview, --json for structured output. The v0_12_2
migration runs this automatically on modusbrain upgrade.
For truncated markdown bodies (source-dependent):
modusbrain doctor tells you which pages look short;
you decide whether to re-import from source or accept the truncation.
Verify
jsonb_integrity rows should read zero. markdown_body_completeness
should match your expectations for the corpus.