Skip to content

fix(doctor): eliminate resolver + symlink false positives (health 80→95)#26

Merged
joedanz merged 1 commit intomasterfrom
fix/doctor-resolver-symlink-false-positives
Apr 17, 2026
Merged

fix(doctor): eliminate resolver + symlink false positives (health 80→95)#26
joedanz merged 1 commit intomasterfrom
fix/doctor-resolver-symlink-false-positives

Conversation

@joedanz
Copy link
Copy Markdown
Owner

@joedanz joedanz commented Apr 17, 2026

Summary

Round 2 of the doctor-cleanup work started in #25. Three more false-positive classes eliminated:

1. skill_symlinks shadowed dump (78-line WARN → 1-line OK)

The symlink scanner classifies any symlink that doesn't resolve into the current repo root as foreign-symlink, so any user with a global install at ~/.pbrain-repo who also has a dev clone sees a massive "shadowed by other plugins: claude:X, cursor:X, windsurf:X" dump for all 26×3 = 78 skill entries on every doctor run — even though the skills are correctly installed and firing.

Added an ours-elsewhere state to scanTargets. When the resolved symlink target has an ancestor package.json with name: "pbrain", it's classified as ours-elsewhere (a valid install pointing at a sibling checkout) rather than foreign-symlink. Detection is deterministic via package.json, not a heuristic.

Doctor message now reads: installed — claude: 26, cursor: 26, windsurf: 26 (symlinks resolve to sibling checkout at /Users/danziger/.pbrain-repo).

2. mece_overlap between maintain and citation-fixer

Both skills declared the trigger "citation audit". Removed it from maintaincitation-fixer is the specialized skill for that phrase and should win the route. maintain still covers citation audits as part of broader health checks via its description.

3. dry_violation on 7 brain-writing skills

ingest, enrich, setup, signal-detector, idea-ingest, media-ingest, meeting-ingestion inlined citation format + Iron-Law rules without referencing skills/conventions/quality.md. Added a single > **Quality rules:** line alongside each skill's existing filing-rule reference. Inline recap stays (useful local guidance); convention file is marked as the source of truth.

Result

Health score on a fresh install: 80 → 95. Only remaining [WARN] is embeddings (real, user-actionable: pbrain embed --stale).

Before:

[WARN] resolver_health: 10 issue(s): 0 error(s), 10 warning(s)
[WARN] skill_symlinks: shadowed by other plugins: claude:daily-task-prep, claude:citation-fixer, ...[78 entries]...

After:

[OK] resolver_health: 26 skills, all reachable
[OK] skill_symlinks: installed — claude: 26, cursor: 26, windsurf: 26 (symlinks resolve to sibling checkout at /Users/danziger/.pbrain-repo)

Test plan

  • bun test test/install-skills.test.ts — 20 pass, 0 fail (2 new tests for ours-elsewhere / foreign tree)
  • Full unit suite: 979 pass, 0 fail (30 E2E failures require Docker Postgres per CLAUDE.md, unaffected)
  • Live pbrain doctor on the real brain: 95/100 health, 7 OK + 1 WARN (embeddings)
  • Live pbrain doctor --fast: resolver_health green, skill_conformance green, skill_symlinks green

…k checks

Three more classes of doctor noise cleared after PR #25:

1. skill_symlinks shadowed dump — the check classifies any symlink that
   doesn't resolve into the current repo as foreign, so users with a global
   install at ~/.pbrain-repo who also have a dev clone elsewhere saw all
   26×3 = 78 skills flagged as "shadowed by other plugins" on every
   doctor run. Added an `ours-elsewhere` state that walks up from the
   resolved symlink target looking for package.json with name: "pbrain" —
   deterministic detection, works for any pbrain checkout location.
   Doctor now reports `installed — claude: 26, cursor: 26, windsurf: 26
   (symlinks resolve to sibling checkout at <path>)` instead.

2. mece_overlap between maintain and citation-fixer on trigger
   "citation audit" — removed from maintain since citation-fixer is the
   specialized skill for that phrase. maintain still handles citation
   audits as part of broader health runs via its description.

3. dry_violation warnings on 7 brain-writing skills (ingest, enrich,
   setup, signal-detector, idea-ingest, media-ingest, meeting-ingestion)
   that inlined citation/Iron-Law rules without referencing the
   canonical skills/conventions/quality.md. Added a single `> **Quality
   rules:**` line next to each skill's existing filing-rule reference.
   The inline recap stays (it's useful local guidance); the convention
   file is marked as the source of truth.

Health score on a fresh install goes from 80 → 95. The only remaining
[WARN] on this brain is `embeddings` (real, user-actionable via
`pbrain embed --stale`).

Test coverage: two new cases for scanTargets — symlink into sibling
pbrain checkout (ours-elsewhere) and symlink into non-pbrain tree
(still foreign-symlink). Full unit suite: 979 pass, 0 fail.
@joedanz joedanz merged commit 1dfb20c into master Apr 17, 2026
3 checks passed
@joedanz joedanz deleted the fix/doctor-resolver-symlink-false-positives branch April 17, 2026 16:05
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