v0.41.20.0 feat: gbrain status + doctor --scope=brain (fix wave 2: items #6 + #7)#1544
Merged
Conversation
…s + drift guard
Categorizes every doctor check name into exactly one of four categories. Exported
constants + categorizeCheck(name) helper are the single source of truth for the
v0.41.20.0 brain_checks_score + category_scores + --scope=brain wave. Drift guard
test parses doctor.ts source for both inline {name: 'foo'} and helper
const name = 'foo' patterns; CI fires if any check name lacks a category.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ip-computation
Extends Check with optional category and DoctorReport with brain_checks_score +
category_scores (additive — schema_version stays at 2; back-compat health_score
math byte-identical). buildChecks gains --scope=brain with explicit early-skip
gates around the SKILL check group (resolver_health + skill_conformance +
skill_brain_first + whoknows_health). Sub-second doctor on a brain with thousands
of skills. computeDoctorReport tags every check via categorizeCheck() at compute
time. Human output leads with the brain figure and renders the weighted
BrainHealth.brain_score alongside.
Test seam fix in test/doctor-home-dir-in-worktree.test.ts: the pre-existing
fragile JSON parser walked back from "checks" to find the envelope's outer
brace; v0.41.20.0's new nested category_scores object broke that heuristic.
Anchored on the canonical {"schema_version" envelope prefix instead.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…get_status_snapshot MCP op NEW gbrain status command (src/commands/status.ts) composes 6 sections: sync (per-source last_sync_at + staleness via buildSyncStatusReport), cycle (TWO rows: last autopilot-cycle + last autopilot-* of any kind — reflects v0.36.4.0 health-aware autopilot's targeted handler routing; totals read from result.report.totals per the canonical handler shape), locks (gbrain_cycle_locks active rows), workers (readSupervisorEvents + summarizeCrashes), queue (LIVE counts NO time-window — old stuck jobs are exactly what status surfaces), autopilot (PID liveness via kill -0). Stable --json envelope (schema_version: 1). Exit codes 0=ok / 1=snapshot failed / 2=usage. --section filter. Thin-client mode routes Sync + Cycle through NEW get_status_snapshot MCP op (admin scope, NOT localOnly; payload deliberately omits Locks / Workers / Queue / Autopilot so feature creep can't quietly widen the admin-scoped data exposure). Local-only sections render "local-only — N/A on remote brain" honestly instead of pretending the local install's empty state is the remote brain's. CLI dispatch: pre-engine-bind branch for thin-client (no PGLite needed) + engine-connected dispatch case for local mode. CLI-only architecture per codex MAJOR-4 (status owns its own thin-client branch inside runStatus, not routed through op dispatch). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tus-doctor-scope # Conflicts: # CHANGELOG.md # VERSION # package.json
… Supavisor wave The drift guard correctly caught a new check introduced by master's v0.41.19.0 Supavisor Retry Cathedral (PR #1537). batch_retry_health surfaces batch-write retry events from the new src/core/audit/batch-retry-audit.ts module — OPS category (infrastructure liveness). This is exactly why the drift guard exists: any future check added to doctor.ts without a category entry fails CI immediately instead of silently degrading to 'meta'. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
garrytan
added a commit
that referenced
this pull request
May 27, 2026
Resolve VERSION, package.json, CHANGELOG conflicts. v0.41.22.0 stays on top (higher than master's v0.41.20.0); master's v0.41.20.0 entry preserved below in CHANGELOG order. Brought in master's gbrain status + doctor --scope=brain (PR #1544) and the v0.41.19.0 Supavisor Retry Cathedral (PR #1537) cleanly via auto-merge. Typecheck clean. bun run verify: 28/28 checks pass.
mgunnin
added a commit
to mgunnin/gbrain
that referenced
this pull request
May 28, 2026
* upstream/master: v0.41.26.1 fix: lock-renewal cathedral — closes ~39 worker crashes/day (supersedes garrytan#1567) (garrytan#1572) v0.41.26.0 fix: dream --source + ingest junk titles + emoji-crash (supersedes garrytan#1559, garrytan#1561) (garrytan#1571) v0.41.25.0 perf(sync): batched deletes + global page-generation clock (supersedes garrytan#1538) (garrytan#1566) v0.41.24.0 fix(conversation-parser): threshold gates + bold-paren-time pattern — 20,167 Circleback messages unblocked (closes garrytan#1533) (garrytan#1543) v0.41.23.0 feat: extract operator surfaces + pack-driven extractables (garrytan#1541) v0.41.22.1 feat: brainstorm/lsd judge fixes (closes garrytan#1540 end-to-end) (garrytan#1562) v0.41.22.0 feat: type-unification cathedral — 94 types → 15 canonical (closes garrytan#1479) (garrytan#1542) v0.41.21.0 feat(ops): 5 daily-driver pains fixed in one wave (garrytan#1545) v0.41.20.0 feat: gbrain status + doctor --scope=brain (fix wave 2: items garrytan#6 + garrytan#7) (garrytan#1544) feat: v0.41.19.0 Supavisor Retry Cathedral (garrytan#1537) v0.41.18.0: gbrain onboard — the activation surface gbrain didn't have before (garrytan#1521) v0.41.17.0 feat: --workers N on every bulk command + facts dim doctor parity (garrytan#1519) v0.41.16.0 feat: conversation parser cathedral + progressive-batch primitive (closes garrytan#1461) (garrytan#1510) v0.41.15.0 feat(sync): --timeout + --max-age + partial status (closes garrytan#1472 RFC) (garrytan#1506)
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.
Summary
Two friction items, both about restoring signal-to-noise for the operator's "is this working?" question.
New
gbrain statuscommand — single-screen brain health dashboard. Per-source sync freshness, last full cycle vs last targeted run (TWO rows per the v0.36.4.0 health-aware autopilot reality), active locks, supervisor health, live queue depth (NO time-window — old stuck jobs are exactly what status surfaces), autopilot daemon liveness. Stable--jsonenvelope (schema_version: 1). Exit codes: 0 = ok, 1 = snapshot failed, 2 = usage error. Thin-client mode routes Sync + Cycle through new admin-scopeget_status_snapshotMCP op; local-only sections render "N/A on remote brain" honestly.Doctor categorization fix —
gbrain doctorno longer says your brain is broken when it's actually your skills folder. Every check gets acategory: brain|skill|ops|metatag from newsrc/core/doctor-categories.ts(76 checks audited including helper-functionconst nameforms).DoctorReportaddsbrain_checks_score+category_scoresadditively (legacyhealth_scorebyte-identical for back-compat).--scope=brainflag SKIPS computation of the SKILL group entirely (resolver walk, skill_conformance, skill_brain_first, whoknows_health) — real skip per D9, not just output filter. Sub-second on brains with thousands of skills.gbrain doctor --remediatedeliberately UNCHANGED — codex's outside-voice review caught my pre-implementation that I was about to "fix" the wrong thing. Remediation already readsengine.getHealth().brain_score(the weighted 35/25/15/15/10 composite). Switching it would have replaced a weighted metric with a coarser category counter.Test Coverage
7 new test files, all passing:
test/doctor-categories.test.ts— drift guard catches both inlinename: 'foo'and helperconst name = 'foo'forms (caughtstub_guard_24h,nightly_quality_probe_health,conversation_facts_backlog, and the post-mergebatch_retry_healthfrom the Supavisor wave).test/doctor-brain-checks-score.test.ts— back-compat byte-identity onhealth_score; new field math; renaming regression (asserts NObrain_health_scorefield ships).test/doctor-scope-filter.test.ts— observable absence of SKILL checks under--scope=brain.test/status-sections.test.ts—parseSectionFlag+ exit-code policy.test/get-status-snapshot-op.test.ts— op shape + admin-scope pins.test/e2e/status-pglite.test.ts— full PGLite E2E with fake minion_jobs + supervisor audit. Dual cycle rows +result.report.totalsread path pinned.test/doctor-home-dir-in-worktree.test.ts— UPDATED to anchor on{"schema_version"envelope prefix (the pre-existing fragile parser broke oncecategory_scoresintroduced a nested object).bun run verifyclean (28/28 checks). Doctor surface: 117 pass / 0 fail across the touched files.Pre-Landing Review
Plan + reviews persisted at
~/.claude/plans/system-instruction-you-are-working-abstract-bengio.md. Walked through/plan-eng-reviewwith 4 architecture decisions (D1-D4) + an outside-voice codex pass that caught 3 BLOCKERS + 5 MAJORS. The codex pass overturned two of my interactive decisions before any code was written:--remediatealready correctly readsBrainHealth.brain_score).brain_health_score→brain_checks_scoreto avoid the two-disagreeing-brain-scores footgun.Plan Completion
All 9 plan tasks DONE. T9 (
gbrain doctor --remediatechange) explicitly reverted per D7 — the right answer, not a missed item.TODOS
TODOS.mdgains 5 new follow-up entries under## v0.41.20.0 status + doctor-categories wave follow-ups (v0.42+):cycle_runstableatoms_inserted/concepts_insertedinCycleReport.totalstop-levelDocumentation
CLAUDE.md not directly edited in this branch (the v0.41.20.0 entries live in CHANGELOG).
llms.txtandllms-full.txtregenerated post-merge.Test plan
bun run verify28/28 greenbun run typecheckcleangbrain statusagainst fresh PGLite tempdir (sync/cycle/locks/workers/queue/autopilot all render;--json+--sectionwork)gbrain doctor --scope=brainagainst same tempdir (skips resolver walk;brain_checks_score+category_scoresin JSON)🤖 Generated with Claude Code