Two code-quality fixes after review of dc71e23 (Task 1):
I1 — Dead-branch logic in install.sh:
The plugin-install block sits inside the `elif [ "$mode" = "user" ]` branch,
so `[ "$mode" = "project" ] && plugin_target="consumer"` is unreachable
(`$mode` is always "user" here). Replaced with hardcoded `--install-target=user`
plus clarifying comment about future consumer-mode wiring.
I2 — Filter case missing catch-all in install-plugins.sh:
The two `case "$install_target"` blocks (validation at lines 40-43, filter at
lines 75-82) were physically separate. If a future enum value is added to
validation without updating filter, $filter would be unset → set -u crash.
Added explicit `*)` catch-all with log_error + exit 1.
Plan §Task 1 Step 1.7 contained the same I1 bug as dc71e23 — implementer
followed plan faithfully. This fix corrects the code; plan stays as historical
record. Future plans referencing this pattern should match THIS fix, not the
original plan text.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes тех-долг из routing.md v1.1 §4.1 — install-plugins.sh теперь
фильтрует entries по полю `target` относительно режима install'а.
Added флаг `--install-target=user|consumer` (required, с fallback на 'user'
+ warning для backwards-compat прямых вызовов из тестов). Filter jq-выражение:
user: target ∈ {"user-level", "user-level+consumer"}
consumer: target ∈ {"consumer", "user-level+consumer"}
scripts/install.sh теперь передаёт --install-target автоматически на основе
detected $mode (user|project). Regression: текущие 8 entries → 8 plugins при
--install-target=user, 2 plugins (FD + UPM, target=user-level+consumer) при
--install-target=consumer.
Подготовка под Phase 1: добавление 4 consumer-only entries (target=consumer)
и 1 user-level+consumer entry (context7) в plugins-manifest.json — filter
обеспечит, что в brain user-level попадут только нужные.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Anthropic-verified plugin from claude-plugins-official marketplace (HEAD
00679aef889e). Installed in cache via cp from marketplace. Routing.md
+§2.1 row, +§3.1 row for «hook creation» task class, +§4.2 status update
for #18.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Anthropic-verified plugin from claude-plugins-official marketplace (HEAD
00679aef889e). Installed in cache via cp from marketplace (Path 2,
manual-cp-from-marketplace). Routing.md bumped to v1.1: +§2.1 row, +§3.1
row for «plugin creation» task class, +§4.2 status update for #17.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 atomic tasks (3 commits + 1 verification+push) for installing brain-meta
plugins #17 and #18 per routing.md §5.1, bumping brain to v1.2 with
routing.md v1.1 (new task classes: plugin creation, hook creation).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Atomic bump per D11. Brain-plugin-routing v1.0 released. Also closes
missing .brain-version artifact from v1.0 bootstrap. Updates CHANGELOG,
manifest.json version field, and CLAUDE.md version header.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Close Phase 0 install drift (К3) — brain settings-fragment now reflects
the actual state of ~/.claude/settings.json after Phase 0.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Implements D9 ENUM (user-level/consumer/user-level+consumer) and closes
Phase 0 install drift (К3) by registering skill-creator and claude-code-setup
in brain manifest. Also tags each entry with category from routing.md §4.1.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add short section pointing to new routing document and disabled-in-brain
soft-rule for FD/UPM.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Brainstorming output for resolving 8 sources of ambiguity (К1-К8) when
selecting a plugin while working inside brain repo. Approach A chosen
(separate docs/brain-plugin-routing.md ~275 lines). Decisions D1-D12
locked. Implementation deferred to writing-plans skill.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Foundation step for brain v2 — establish canonical structure for skills
and rules. Adds two new meta-plugins to brain stack:
- skill-creator@claude-plugins-official (Anthropic verified)
- claude-code-setup@claude-plugins-official (Anthropic verified)
Phase 0 deliverables:
- preliminary.md: frontmatter conventions diff (Anthropic vs Obra),
brain v1 inventory (0 custom skills, 17 inherited from 4 plugins),
initial canonical decision before install
- final.md: post-install findings, divergences from preliminary,
recommender output (manually applied on brain repo only — Liderra
scope excluded per user instruction), audit of 17 inherited skills
Key findings:
- Anthropic skill-creator and Obra writing-skills are DIFFERENT
philosophies (scientific vs disciplinarian), not just complementary.
Decision: structure from Anthropic + testing from Obra, scoped by
skill type
- `tools:` frontmatter field is OPTIONAL even in Anthropic canonical
- skill-creator advocates "pushy" descriptions against undertriggering
(opposite to Obra's "Use when only" rule)
- Anthropic explicit anti-pattern: «If you find yourself writing ALWAYS
or NEVER in all caps — yellow flag, reframe and explain reasoning»
- ui-ux-pro-max uses LEGACY skill.json format (others use SKILL.md) —
brain v2 must support both schemas
Recommender external validation added 2 new candidates to shortlist:
plugin-dev (Anthropic) and hookify (Anthropic) — both high-ROI for
brain as plugin distributor.
Install method: Path 2 (manual git clone) — Claude CLI not installed
on machine, VSCode extension doesn't support /plugin install.
Settings.json and installed_plugins.json manually updated outside repo
(in ~/.claude/).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
VSCode Claude Code extension creates .claude/settings.local.json with
local permission overrides — these are user-machine-specific and should
not be tracked in the repo.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Bug 1: merge-mcp.sh fails on Cyrillic brain repo paths (jq fopen UTF-8 issue)
→ use --argjson with $(cat ...) instead of --slurpfile
Bug 2: install.sh stripped only trailing .template, missed middle .template.
→ strip both '.template.' middle and '.template' trailing patterns
Bug 3: manifest.json used brain-repo paths but verify.sh checked target paths
→ restructure manifest.files into {project-mode, user-mode, brain-internal} maps
→ verify.sh now picks map based on detected target mode
Bug 4: make_backup_dir created empty backup dir, no file preservation
→ rsync/cp -r target tree to backup before any modifications
Bug 5: brain's project-files/README.md overwrote consumer's README.md
→ install.sh now skips brain-internal READMEs in project/user copy loops
Phase 9 self-test re-run on c:/tmp/test-consumer-fix: install + verify both PASS.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Plan simplification: dropped the broken middle elif heuristic that had
unbalanced shell expression. Kept clean two-step fallback: .template
suffix first, bare filename second.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Plan correction E: cp -r replaced with find-loop that strips .template
suffix on copy. Without this Test 3 (project mode: CLAUDE.md copied) can't
pass — fixture creates CLAUDE.md.template, target expects CLAUDE.md.
Real intent: brain stores templates as *.template, consumed without suffix.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Uses corrected Claude CLI subcommand shape:
claude plugin marketplace add <repo> (NOT `claude marketplace add`)
claude plugin marketplace list
claude plugin install <name@marketplace>
claude plugin info <name@marketplace> --json
Includes fallback for environments where `claude` CLI is not in PATH
(VSCode-extension install on Windows): logs manual edit instructions
and exits 0 so the parent installer can continue.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>