Skip to content

perf(doctor): delegate 8 schema checks to onebrain doctor --json · rm dead workflows · v3.0.3#187

Merged
kengio merged 2 commits into
mainfrom
chore/doctor-cli-json
May 22, 2026
Merged

perf(doctor): delegate 8 schema checks to onebrain doctor --json · rm dead workflows · v3.0.3#187
kengio merged 2 commits into
mainfrom
chore/doctor-cli-json

Conversation

@kengio
Copy link
Copy Markdown
Collaborator

@kengio kengio commented May 22, 2026

Summary

Two post-trim cleanups bundled:

  1. /doctor skill leverages the Rust CLIonebrain doctor --json replaces 8 schema-validation checks the skill used to implement manually. Skill SKILL.md drops 290 → 205 lines (-29%).
  2. .github/workflows/ deletedci.yml (bun + tsc + biome + bun test) and release.yml (bun-build CLI binary + npm publish) targeted the v2.x TypeScript source removed in v3.0.2 (PR chore: plugin-only trim · CHANGELOG split · README update (v3.0.2) #185). Both would fail on the next CI run.

Files

File Change
.claude/plugins/onebrain/skills/doctor/SKILL.md Trimmed — delegates 8 checks to CLI --json, retains 11 skill-only checks (wikilinks, memory, scheduler, pause, etc.)
.claude/plugins/onebrain/.claude-plugin/plugin.json Bump 3.0.2 → 3.0.3
CHANGELOG.md v3.0.3 entry (4 bullets)
.github/workflows/ci.yml Deleted — dead (targets removed src/)
.github/workflows/release.yml Deleted — dead (built v2.x CLI binary)

/doctor architecture (post-PR)

Check Where
vault.yml · vault.yml-keys · folders · plugin-files · settings-hooks · orphan-checkpoints · qmd-embeddings · claude-settings CLI (onebrain doctor --json)
Broken wikilinks · orphan notes · stale memory/ · MEMORY.md size · inbox backlog · old checkpoints · 07-logs structure · log folder size · scheduler health · pause state · memory health Skill
Fix recipes — CLI side: settings-hooks · plugin-files · vault.yml-keys · claude-settings · qmd CLI (--fix --json)
Fix passes — skill side: wikilink fuzzy-match · MEMORY.md migration · confidence scores Skill (references/autofix-procedures.md)

Why

WebFetch / shell text parsing of onebrain doctor's human format is fragile. --json is the stable v3.x contract (frozen, see CLI CHANGELOG). One subprocess beats N reads + manual schema validation.

GitHub workflows: plugin repo has no test/build surface anymore. CLI release pipeline lives at onebrain-ai/onebrain-cli/.github/workflows/ (full release.yml builds 7 platform binaries).

Test plan

  • onebrain doctor --json on this vault returns expected envelope (8 checks · 0 errors · 1 warning).
  • skill SKILL.md parses; no syntax errors in YAML frontmatter.
  • plugin.json valid JSON · requires.cli >=3.0.0 retained.
  • CHANGELOG entry within 8-bullet cap.
  • No CI workflows left to fail on dead code (now zero workflows; that's intentional).
  • 3-round review
  • Post-merge: /doctor on this vault uses the new flow.

Out of scope (deferred to tomorrow per user)

  • CLI changes (onebrain orphan-scan --list --json flag for /wrapup, onebrain update --check-plugin --json for /update). Today: skill-only optimization.

kengio added 2 commits May 22, 2026 16:48
… dead workflows · v3.0.3

doctor SKILL.md (290 → 205 lines · -29% / -85 lines):
- Step 2a now runs `onebrain doctor --json` (or `--fix --json` with --fix flag)
  and parses the stable JSON envelope: {ok, summary{total/errors/warnings/passing},
  checks[{check, status, message, details, hint, fix?}]}. The 8 built-in CLI
  checks (vault.yml, vault.yml-keys, folders, plugin-files, settings-hooks,
  orphan-checkpoints, qmd-embeddings, claude-settings) are now Rust-native single
  subprocess instead of skill-side reimplementation.
- Step 2b retains skill-only checks the CLI doesn't cover: broken wikilinks,
  orphan notes, stale memory/ files, MEMORY.md size, inbox backlog, log folder
  size, 07-logs structure, scheduler health (errors/drift/one-shot), pause-thread
  state (orphan/missing/idle pointer), memory health checks.
- Step 4 (--fix) delegates CLI fix recipes to `onebrain doctor --fix --json` and
  retains skill fix passes (wikilink fuzzy-match, MEMORY.md migration) via
  references/autofix-procedures.md.
- Two-source architecture explicit in the skill body so future contributors
  know where each check lives.

GitHub workflows cleanup:
- rm .github/workflows/ci.yml (`bun install` + tsc + biome + bun test on deleted
  src/) — would fail on every PR now.
- rm .github/workflows/release.yml (binary build via bun --compile from src/
  + npm publish) — release pipeline moved to onebrain-ai/onebrain-cli in v3.0.0.
- Plugin repo has no test/build surface anymore. CLI release workflows live at
  onebrain-ai/onebrain-cli/.github/workflows/ now.

plugin.json bump 3.0.2 → 3.0.3 (skill update per repo convention).
CHANGELOG v3.0.3 entry: 4 bullets within 8-bullet cap.

Why CLI delegation: WebFetch / shell text parsing of doctor's human format is
fragile. --json is the stable v3.x contract (frozen, declared in CLI CHANGELOG).
Single subprocess call beats N file reads + manual schema validation.

Tested locally: `onebrain doctor --json` returns expected envelope shape
({ok:true, summary:{total:8...}, checks:[...]}) on this vault. 8 checks total,
0 errors, 1 warning (qmd-embeddings: 584 indexed · 4 unembedded — advisory).
Round 1 (broad) findings:
- HIGH: re-add Plugin install path check (cache/ detection) — CLI plugin-files
  only validates skills/agents/INSTRUCTIONS counts, NOT installed_plugins.json
  registry. Verified via live `onebrain doctor --json` on this vault.
- MED: re-add AUTO-SUMMARY.md existence check — same root cause; CLI doesn't
  inspect individual skill reference files. Both checks restored to Step 2b.

Round 2 (dead code) findings:
- IMP: CONTRIBUTING.md lines 12 + 359 — replaced "TypeScript / Bun source
  under src/" / "(src/)" pointers with Rust + onebrain-ai/onebrain-cli link.
- IMP: .claude/settings.json — removed `Bash(bun *)` broad permission;
  scoped `Bash(bun install -g @onebrain-ai/cli*)` retained for CLI bootstrap.

Round 3 (inconsistency) findings:
- HIGH: README.md line 657 license footer — `[MIT](LICENSE)` left over from
  pre-v3.0.1 relicense → corrected to `[AGPL-3.0-only](LICENSE)`.
- HIGH: doctor SKILL.md line 51 brew install command — two-step `brew tap
  + brew install onebrain` diverged from the tap-path one-liner used
  everywhere else (README, CONTRIBUTING, CHANGELOG v3.0.0 entry). Unified
  to `brew install onebrain-ai/onebrain/onebrain`.

Round 4 (edge cases) findings:
- CRITICAL: Step 2a exit-code logic was wrong — old wording would mis-detect
  `exit 1 + valid JSON` (the normal "issues found" path) as "CLI not
  installed" and fall back to skill-only. Rewrote detection logic in 3
  ordered steps: PATH lookup first, then parse JSON regardless of exit code,
  only treat as absent if PATH lookup fails or output doesn't parse.
- IMP: malformed-JSON fallback now inline in Step 2a (was Gotcha-only).
- IMP: defensive handling of optional `details`/`hint`/`fix` fields
  documented inline.
- IMP: Step 3 report omits empty sections entirely (`--vault` flag suppresses
  ⚙️ Config; `--config` suppresses 📁 Vault + 🧠 Memory; sections with 0
  findings drop their header).

CHANGELOG:
- v3.0.3 bullet 4: noted `--vault`/`--config` flag semantics tightened (was
  previously claimed as "no behavior changes" — actually `--vault` now skips
  the CLI subprocess explicitly).

User Windows /update v3.0.2 report:
- Stale PLUGIN-CHANGELOG.md at vault root after rename — surfaces because
  `vault-sync` doesn't delete files renamed-away from upstream. Added a
  skill-side doctor check to flag this until the CLI fix lands (tracked
  for v3.0.x cycle).

Branch protection verified safe: `gh api repos/.../branches/main/protection`
shows `no required_status_checks` — workflows deletion is non-blocking for
future PRs.

SKILL.md size: 290 (origin/main) → 205 (initial trim) → 225 (after re-adds).
Still -22% net vs origin/main with all coverage restored.
@kengio kengio merged commit 2a624a9 into main May 22, 2026
@kengio kengio deleted the chore/doctor-cli-json branch May 22, 2026 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant