ワンクリックで
brain-upgrade
Two-phase brain upgrade — mechanical install via shared core, then LLM-led semantic reconciliation
メニュー
Two-phase brain upgrade — mechanical install via shared core, then LLM-led semantic reconciliation
Run the 7-step Artificial Critical Thinking pass — Materiality → Hypothesise → Alternatives → Disconfirmers → Audit priors → Severity → Commit-with-marker
Challenge what you think is right — alternative hypotheses, missing data, evidence quality, bias detection, falsifiability, and adversarial review
Step-back protocol — restate, generalise, specialise, invert, ask why, pre-mortem, check stakeholders, and audit framings before solving
Build knowledge bases that build software — research before code, teach before execute
Generate consistent visual character references across multiple scenarios using Flux and nano-banana-pro on Replicate
Create professional ultra-wide cinematic banners for GitHub READMEs using modern AI image models with typography
| type | skill |
| lifecycle | stable |
| inheritance | inheritable |
| name | brain-upgrade |
| description | Two-phase brain upgrade — mechanical install via shared core, then LLM-led semantic reconciliation |
| tier | standard |
| applyTo | **/*upgrade*,**/*curat*,**/*backup*,**/*finalize*,**/*brain-upgrade* |
| currency | "2026-04-23T00:00:00.000Z" |
Three executors, one mechanical contract, one LLM-led semantic reconciliation
An Alex brain upgrade is intentionally split into two phases. Phase 1 is mechanical and deterministic — the same contract implemented by three executors. Phase 2 is semantic — driven by the LLM through this skill, using the muscle as a mechanical assistant.
| Executor | File | Scope |
|---|---|---|
| Fleet orchestrator | scripts/upgrade-brain.cjs | Master-only, iterates C:\Development\* |
| VS Code extension | heir/platforms/vscode-extension/src/bootstrap.ts | Cockpit delivers the payload on the open workspace |
| LLM-callable muscle | .github/muscles/brain-upgrade.cjs --mode Upgrade | Single project, invoked by the LLM via this skill |
All three satisfy the same contract. The CJS executors import from:
.github/muscles/shared/brain-upgrade-core.cjs
The extension is TypeScript and mirrors the contract; it cannot import the .cjs module directly but MUST implement identical guarantees.
| Phase | Owner | What it does |
|---|---|---|
| Phase 1 — Mechanical | Shared core (three executors) | Eligibility gate → backup → fresh install → version stamp → auto-preserve → auto-restore → additive settings merge |
| Phase 2 — Semantic | This skill (LLM) + muscle helpers | CI reconciliation → non-standard content review → semantic verification → summarize → ask before cleanup |
The boundary is strict: Phase 1 never makes judgment calls, Phase 2 never performs mechanical bulk moves without LLM decision.
node scripts/upgrade-brain.cjs --mode Upgrade (fleet)node .github/muscles/brain-upgrade.cjs --mode Upgrade --brain-source <path> (LLM-driven single-project).github-backup-* directory exists in a project rootPhase 2 relies on these contract guarantees from whichever executor ran:
.github folder → not an Alex repo → skip.github present but not a recognized Alex brain (v8 brain-version.json with Alex architecture, or legacy CI pattern) → skipupgradeLock, MASTER-ALEX-PROTECTED.json, alex.workspace.protectedMode) → skip before any mutation.github renamed to .github-backup-YYYYMMDD-HHMMSS (never deleted)brain-version.json stamped with the target version, architecture, and lastSync. The legacy .alex-brain-version plain-text stamp is no longer written and is removed on upgrade if encountered (kept in the backup).| Root | Config | Metadata |
|---|---|---|
NORTH-STAR.md | loop-menu.json | brain-version.json → identity |
taglines.json | brain-version.json → upgradeLock | |
cognitive-config.json | brain-version.json → lockReason | |
markdown-light.css |
| Directories | Root files |
|---|---|
workflows/ | PULL_REQUEST_TEMPLATE.md |
ISSUE_TEMPLATE/ | dependabot.yml |
episodic/ | CODEOWNERS |
memory/ | FUNDING.yml |
domain-knowledge/ | MEMORY.md |
.vscode/settings.json merged additively — existing user values win, new essential defaults fill gaps onlycopilot-instructions.md from backup saved as copilot-instructions.backup.md for the LLM to reconcileNORTH-STAR.md from backup saved as NORTH-STAR.backup.md for LLM-led curation (may also need relocation if previously misplaced)EXTERNAL-API-REGISTRY.md from backup saved as EXTERNAL-API-REGISTRY.backup.md so project-specific API sections (e.g., domain pipelines, publishing specs) can be merged into the fresh templateIf any guarantee is missing, stop Phase 2 and report the mechanical gap rather than paper over it.
Phase 1 installs the fresh brain including the fresh trifecta. Phase 2 runs from that freshly-installed trifecta. During Phase 2, these files are protected — never restored from backup:
.github/skills/brain-upgrade/SKILL.md
.github/instructions/brain-upgrade.instructions.md
.github/muscles/brain-upgrade.cjs
.github/muscles/shared/brain-upgrade-core.cjs
An old trifecta silently overwriting a new one is the worst possible failure mode — a self-downgrade of the upgrader. The muscle's AutoRestore mode refuses these paths by list. The LLM must also refuse to copy them during judgment-driven curation, even if the backup content looks "richer."
Phase 2 is a structured LLM pass over what Phase 1 couldn't safely decide mechanically. The LLM drives. The muscle helps.
Phase 2 is semantic, not freeform. LLMs are inconsistent — the defense is a decision table, not judgment.
.backup.md or unknown file, consult the tables below before acting. Don't reason from scratch each time..backup.md in place and surface the ambiguity to the user.node .github/muscles/brain-upgrade.cjs --mode Scan
Read the report. Per project, the scan lists:
ROOT_FILE — root files in backup not auto-restored or auto-preservedUNKNOWN_DIR — directories not in the brain and not in the auto-restore listCI_CUSTOM — copilot-instructions.backup.md exists and needs reconciliationNORTH_STAR_CUSTOM — NORTH-STAR.backup.md exists and needs LLM curationAPI_REGISTRY_CUSTOM — EXTERNAL-API-REGISTRY.backup.md exists and needs LLM mergeOLD_ARTIFACT — known-obsolete files (e.g., pre-v8 hooks.json)copilot-instructions.md semanticallyThe mechanical phase left the old CI at copilot-instructions.backup.md. The fresh template is now the active copilot-instructions.md. Merge project identity into the fresh template — additively.
Diff the two files. Look for project-specific content under these sections:
## Context → Merge into fresh ## Context
## Active Context → Merge if still current, discard if stale
## Coding Standards → Merge into fresh ## Context
## Tech Stack → Merge into fresh ## Context
## Safety Imperatives → Project-specific I5+ items merge in
## User → Project-specific user profile merges in
Rules:
copilot-instructions.backup.md.NORTH-STAR.md semanticallyIf .github/NORTH-STAR.backup.md exists, the LLM decides its fate. NORTH-STAR is a semantic document — unlike config files, it is not auto-preserved mechanically. Apply judgment:
| Situation | Action |
|---|---|
| Old NORTH-STAR is project-specific and still current | Replace the fresh generic NORTH-STAR.md with the old content |
| Old NORTH-STAR is generic template content (matches master fresh copy) | Keep the fresh copy, delete the backup |
| Old NORTH-STAR contains project vision worth merging into the fresh template | Additive merge |
Old NORTH-STAR was at the wrong path (e.g., root of repo instead of .github/) | Move/normalize to .github/NORTH-STAR.md during reconciliation |
| Old NORTH-STAR is stale/abandoned | Archive or discard |
When done, delete NORTH-STAR.backup.md.
EXTERNAL-API-REGISTRY.md semanticallyIf .github/EXTERNAL-API-REGISTRY.backup.md exists, the fresh master template has been installed as the active EXTERNAL-API-REGISTRY.md. Heirs commonly append project-specific API sections (e.g. "Book Publishing Pipeline", "KDP Specs", "Healthcare FHIR Endpoints") to the bottom of the registry. Those must survive the upgrade.
| Situation | Action |
|---|---|
| Backup has project-specific sections appended after the master template content | Append those sections to the fresh EXTERNAL-API-REGISTRY.md (additive) |
| Backup matches the master template verbatim (no custom sections) | Keep the fresh copy, delete the backup |
| Backup diverges from master template in its shared sections | Trust the fresh template for shared sections; only port project-specific additions |
| Backup contains stale API references no longer used | Discard — don't carry forward obsolete APIs |
Rules:
EXTERNAL-API-REGISTRY.backup.md.retro-tag-inheritanceThe .backup.md files (Steps 2 / 2b / 2c) handle three known root-level singletons. The backup directory itself can contain hundreds of other files — custom skills, custom instructions, custom prompts, custom muscles — that the heir authored and that Phase 1 does not touch. The retro-tag-inheritance muscle classifies that surface mechanically so Phase 2 can focus on the custom set.
Run against the backup, NOT against the live brain:
node .github/muscles/retro-tag-inheritance.cjs \
--target .github-backup-<stamp> \
--source .github \
--dry-run
The report classifies every file in the backup:
| Classification | Meaning | Phase 2 action |
|---|---|---|
inheritable already-set / would tag | Path matches a file in the fresh brain | Already in fresh install — skip |
custom already-set / would tag | Path NOT in fresh brain (heir-authored) | Candidate for restoration — LLM judges per file |
master-only would delete | Master-only contamination | Already absent from fresh brain — do not restore |
frontmatter would create | Sub-file with no tag, on canonical artifact path | Backup-only, classify by path |
custom→inheritable conflicts | Heir explicitly forked an inheritable file | Surface to user — either re-fork in v2 or accept fresh master version |
For each custom file, the LLM applies the same Step 3 curation table below. The muscle is read-only when --dry-run is passed (default behavior in Phase 2 — destructive runs are reserved for explicit one-time fleet retagging, not per-upgrade Phase 2).
When done classifying, leave the backup directory in place — only Step 5 (Clean) removes it, with user consent.
For each item the scan reports, apply judgment:
| Category | File / Dir | Default Decision |
|---|---|---|
| Project identity | README.md, REPO-CONFIG.md, repository-metadata.md | Copy forward |
| Domain knowledge at root | DK-*.md | Copy forward |
| Project-specific dirs | templates/, scripts/, docs/, anything unknown | Copy forward |
| Protected trifecta paths | anything in the Trifecta Protection list above | Never restore — always skip |
| Obsolete artifacts | hooks.json (pre-v8) | Skip |
| Already auto-preserved | Anything in the Phase 1 auto-preserve table | Skip — already handled |
| Schema-fragile config | visual-memory.json, session-metrics.json | Keep the fresh version |
| Master-only | MASTER-ALEX-PROTECTED.json | Never copy to heirs |
When unsure, keep it in the backup and flag it for user review.
Execute the safe moves with the muscle:
node .github/muscles/brain-upgrade.cjs --mode AutoRestore --include "ProjectName"
For interactive CI merging:
node .github/muscles/brain-upgrade.cjs --mode Curate --include "ProjectName"
Confirm the resulting heir is correct:
detectAlexBrain() would still return "v8" (brain-version.json intact)NORTH-STAR.md content, loop menu entries, taglines, cognitive config.vscode/settings.json still contains the user's existing customizationscopilot-instructions.md loads cleanly and has project identity merged in.github/muscles/brain-upgrade.cjs + skill + instruction) is the fresh version, not an old oneMechanical sanity check (file counts and version stamp):
# Fleet:
node scripts/upgrade-brain.cjs --mode Verify --include "ProjectName"
# Single project (LLM / heir):
node .github/muscles/brain-upgrade.cjs --mode Verify --brain-source <path>
This is a sanity check, not the verification itself. The real verification is semantic — done by the LLM.
Before touching backups, produce a short report for the user:
Then explicitly ask the user whether to delete the backup:
node .github/muscles/brain-upgrade.cjs --mode Clean --include "ProjectName"
Never run Clean without explicit user consent.
# Eligibility check (is this a recognized Alex brain? locked?)
node .github/muscles/brain-upgrade.cjs --mode Audit [--project-dir <path>]
# Mechanical upgrade (requires a fresh brain source on disk)
node .github/muscles/brain-upgrade.cjs --mode Upgrade \
--brain-source <path-to-fresh-.github> \
[--project-dir <path>] [--brain-version <ver>] [--dry-run]
# Verify installation against a brain source
node .github/muscles/brain-upgrade.cjs --mode Verify \
--brain-source <path> [--project-dir <path>]
# Restore the most recent .github-backup-*
node .github/muscles/brain-upgrade.cjs --mode Rollback [--project-dir <path>] [--dry-run]
node .github/muscles/brain-upgrade.cjs --mode Scan
node .github/muscles/brain-upgrade.cjs --mode AutoRestore [--dry-run]
node .github/muscles/brain-upgrade.cjs --mode Curate --include "ProjectName"
node .github/muscles/brain-upgrade.cjs --mode Clean --include "ProjectName"
# Classify backup contents (custom vs inheritable vs master-only contamination)
node .github/muscles/retro-tag-inheritance.cjs \
--target .github-backup-<stamp> \
--source .github \
--dry-run
Reports counts by classification. Use during Step 2d to scope the custom set the LLM must review. Always --dry-run in Phase 2; destructive mode is reserved for one-time fleet retagging.
.github, not an Alex repo. Never upgrade it.Phase 1 (mechanical, any executor):
Eligibility gate → Backup → Fresh install (incl. trifecta) → Version stamp
Auto-preserve heir files → Auto-restore non-brain content
Additive settings merge
Phase 2 (semantic, LLM-led, runs from fresh trifecta):
1. Scan backup (muscle)
2. Reconcile copilot-instructions.md (LLM)
3. Review non-standard content (LLM → muscle AutoRestore/Curate, protected paths refused)
4. Semantic verification (LLM + mechanical Verify as sanity check)
5. Summarize → ask user → Clean (muscle, with consent)
1. Audit: node scripts/upgrade-brain.cjs --mode Audit
2. Upgrade: node scripts/upgrade-brain.cjs --mode Upgrade (Phase 1 for all eligible)
3. Scan: node .github/muscles/brain-upgrade.cjs --mode Scan
4. Per-project semantic pass (Phase 2) for anything flagged
5. Verify: node scripts/upgrade-brain.cjs --mode Verify (mechanical sanity check)
6. Ask user → Clean per-project as consent is given