Doctor Auto-Heal and Scoring Improvements
Summary
Themodusbrain doctor health score system has several false-positive patterns and missing auto-heal capabilities. After the crash classification fix (shipped in this PR), these are the remaining improvements ranked by impact.
1. Frontmatter severity levels
Problem
NESTED_QUOTES warnings dominate the frontmatter check (6,900+ of ~7,100 total issues). These are cosmetic YAML style issues — values like title: "foo" where the quotes are technically unnecessary. They don’t affect sync, search, embedding, or any functionality.
By counting them the same as YAML_PARSE (actual parse failures) or MISSING_OPEN (missing frontmatter delimiters), the frontmatter check is perpetually WARN and the real issues are lost.
Evidence
Proposed Fix
- Introduce severity levels:
error(YAML_PARSE, MISSING_OPEN) vsinfo(NESTED_QUOTES) - Doctor WARN/FAIL only on error-level issues
- Report info-level in the message text but don’t affect check status
- Optional
--pedanticflag includes info-level in status
Test Cases
2. Temporal contradiction awareness
Problem
The contradiction probe flags temporal evolutions as contradictions. Example:- Page A (April): “Considering option X”
- Page B (May): “Decided on option Y”
Evidence
From a probe run on 50 queries with top-k=15:- 120 contradictions detected (112 high, 8 medium)
- After manual review: ~60% were temporal evolutions, not real conflicts
- Pages have
effective_dateorcreatedtimestamps that could disambiguate
Proposed Fix
- Pass
effective_date/createdto the judge prompt - Add verdict:
temporal_supersession(later claim supersedes earlier) - When both pages have dates and claims overlap, bias toward temporal interpretation
- Already designed in PR #993
Test Cases
3. Multi-source drift baseline
Problem
4,791 pages show “multi-source drift” due to a pre-v0.30.3putPage routing bug. These pages exist at the default source but should be at a named source. The sources rehome command to fix this hasn’t shipped yet.
Every doctor run shows WARN for ~4,800 pages nobody can fix.
Proposed Fix
Allowdoctor.baselines config to acknowledge known-unfixable counts:
.modusbrain/doctor-baselines.json so it works without config too:
Test Cases
4. Image assets acknowledgment
Problem
When image files are missing from disk (stored externally, purged from git), the check permanently warns. No way to say “these are intentionally external.”Proposed Fix
doctor --acknowledge image_assetsmarks current missing count as accepted- Stored in
.modusbrain/doctor-baselines.json - WARN only for NEW missing images beyond acknowledged count
- Optional
image_assets.external_storage: trueconfig to skip disk check entirely
5. Auto-heal mode
Problem
Many doctor warnings have known fixes that are safe to auto-apply:Proposed Fix
doctor --auto-heal mode:
- Run all checks
- For fixable WARNs: submit fix as a job (not inline — via job queue)
- Report what was fixed vs needs manual attention
- Idempotent: check queue first, don’t submit duplicates
- Safety gate: never auto-heals FAILs, only WARNs
Test Cases
6. Score delta tracking
Problem
No history — eachdoctor run is a snapshot. Can’t tell if score is improving or degrading.
Proposed Fix
- Write each run to
.modusbrain/doctor-history.jsonl: doctor --trendshows last N scores with deltasdoctor --jsonincludesprevious_scoreanddeltafields
7. Weighted scoring
Problem
Going from 99% → 100% embed coverage weighs the same as 50% → 51%. But the last percent is the hardest (oversized pages, rate limits).Proposed Fix
Threshold-based scoring:- 100% = full points
- ≥95% = 90% of points
- ≥80% = 70% of points
- < 80% = proportional
Priority Order
- Frontmatter severity levels (highest noise reduction)
- Temporal contradiction awareness (highest false positive reduction, already designed)
- Auto-heal mode (biggest long-term value)
- Score delta tracking (enables monitoring)
- Multi-source drift baseline (quality of life)
- Image assets acknowledgment (quality of life)
- Weighted scoring (nice to have)