KeiSeiKit-1.0/docs/USB-BRAIN-GUIDE-windows.md
KeiSei84 1dd4bad97a fix(install): make fresh install actually complete + ship tamagotchi (#26)
Root causes found by reproducing a clean install from keigit:

1. PROFILE_PRIMS resolved only inside check_prereqs → unbound for
   --no-execute (plan showed 0 prims for every profile) and silently
   empty for --skip-prereqs. Now resolved unconditionally in install.sh
   before any reader (SSoT).

2. Every profile (even minimal, advertised "no Rust compile") fell back
   to a 5-15 min `cargo build --workspace` because no prebuilt release
   binaries exist. Auto-set KEI_SKIP_RUST for profiles with no rust
   primitives → minimal installs in ~18s (assembler only). cargo stays a
   hard prereq because the agent assembler always compiles.

3. The assembler aborted the WHOLE install on any single bad manifest
   (set -e). generate_agents is now tolerant: bad manifests print FAIL
   but hooks/skills/settings still land. Commit-time validate stays strict.

4. Data bugs that broke the assembler:
   - duplicate [taxonomy] table in _roles/{auditor,merger}.toml
   - fal-ai-runner handoff → keimd-expert (not shipped in kit)
   - infra-implementer-cicd forbidden_domain literal `${{ secrets.NAME }}`
     collided with assembler ${{ }} placeholder detection

5. Metadata: KeiSei84 (nonexistent GitHub org) → KeiSeiLab/KeiSeiKit-1.0
   across plugin manifests, bootstrap, README, docs, Cargo/npm metadata.
   .claude-plugin/{plugin,marketplace}.json 0.16.0 → 0.38.0. SECURITY.md
   supported version 0.14.x → 0.38.x.

feat: ship KeiSei tamagotchi statusline into the kit
   - scripts/keisei-pet{,-update}.sh (portable, state under ~/.claude/pet/)
   - install copies them to ~/.claude/scripts/
   - settings-snippet adds statusLine (set-if-absent, never clobbers an
     existing one) + 4 pet-update hooks (prompt/rust_write/github_block/sleep)

Verified: clean minimal install RC=0, zero FAIL, 38 agents + 52 hooks +
68 skills, settings valid, statusLine wired, pet renders, idempotent re-run.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 01:40:50 +08:00

4.1 KiB

USB Exobrain — Windows Walkthrough

Platform-specific companion to USB-BRAIN-GUIDE.md. Read the top-level guide first for prerequisites, warnings, and invariants.

Windows support is best-effort in v0.22 — keisei itself builds cleanly on Windows, but the filesystem-type advisory (fs_type.rs) returns Unknown pending a GetVolumeInformationW implementation. Meaning: the exFAT/FAT32 warning does NOT fire on Windows yet. Format your USB as NTFS manually for multi-client safety.

Shell snippets use PowerShell 7+.

1. Create the brain directory

Plug in the USB; Explorer will show a drive letter (e.g. E:).

$BRAIN = "E:\my-brain"
New-Item -ItemType Directory -Path $BRAIN,"$BRAIN\bin","$BRAIN\memory","$BRAIN\artifacts","$BRAIN\manifests" -Force

2. Download MCP server binaries

$BASE = "https://github.com/KeiSeiLab/KeiSeiKit-1.0/releases/download/v0.21.0"
Push-Location "$BRAIN\bin"

$names = @(
    "darwin-arm64", "darwin-x64",
    "linux-x64", "linux-arm64",
    "windows-x64.exe"
)
foreach ($n in $names) {
    Invoke-WebRequest -Uri "$BASE/kei-mcp-server-$n"        -OutFile "kei-mcp-server-$n"        -ErrorAction SilentlyContinue
    Invoke-WebRequest -Uri "$BASE/kei-mcp-server-$n.sha256" -OutFile "kei-mcp-server-$n.sha256" -ErrorAction SilentlyContinue
}

Get-ChildItem kei-mcp-server-*.sha256 | ForEach-Object {
    $expected = (Get-Content $_).Split(' ')[0]
    $target   = $_.Name -replace '\.sha256$',''
    $actual   = (Get-FileHash $target -Algorithm SHA256).Hash.ToLower()
    if ($actual -ne $expected) { Write-Error "FAIL: $target" }
}
Pop-Location

No chmod +x on Windows — .exe is executable by extension. No xattr concept (Windows does not use HFS-style quarantine).

3. Write manifest.toml (schema v2)

@"
[brain]
schema_version = 2
name = "my-brain"
created = "2026-04-22T00:00:00Z"

[paths]
memory = "memory/"
artifacts = "artifacts/"
manifests = "manifests/"

[paths.mcp_server]
darwin-arm64 = "bin/kei-mcp-server-darwin-arm64"
darwin-x64   = "bin/kei-mcp-server-darwin-x64"
linux-x64    = "bin/kei-mcp-server-linux-x64"
linux-arm64  = "bin/kei-mcp-server-linux-arm64"
windows-x64  = "bin/kei-mcp-server-windows-x64.exe"
"@ | Set-Content -Path "$BRAIN\manifest.toml" -Encoding utf8NoBOM

Note the utf8NoBOM encoding — the toml parser does not handle a UTF-8 BOM gracefully.

4. Verify + attach

keisei list-adapters
keisei status                         # "no brain attached"
keisei attach "$BRAIN" --scope=user

Marker lands at %USERPROFILE%\.keisei\attached.toml. Claude Code settings at %USERPROFILE%\.claude\settings.json.

5. Verify in Claude Code

Get-Content "$HOME\.claude\settings.json" | ConvertFrom-Json | Select-Object -ExpandProperty mcpServers

6. Multi-client mount

keisei mount $BRAIN

7. Project-scope

cd C:\path\to\your-repo
keisei attach $BRAIN --scope=project      # claude-code + cursor only

8. Detach + eject

keisei detach
# Eject via PowerShell:
$vol = Get-Volume -DriveLetter E
$vol | Dismount-Volume -Force

Or use the system tray "Safely Remove Hardware" icon — either path flushes pending writes before the device is physically removed.

Windows-specific troubleshooting

  • FS advisory not firing — v0.22 Windows build returns Unknown from detect_fs_warning. Format the stick as NTFS manually; exFAT is unsafe for keisei mount. A future release will wire GetVolumeInformationW.
  • Long-path failures — the brain root plus any nested manifest path must fit inside Windows' MAX_PATH (260 chars) unless you've opted into long paths via HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled = 1. Keep $BRAIN short.
  • Drive letter reassignment — Windows may hand out a different letter next plug-in. The marker stores an absolute path, so a letter change breaks resolution. Re-attach after the new letter appears.
  • Execution policy — PowerShell will refuse to run helper scripts under default Restricted policy. Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned as a one-time fix.