KeiSeiKit-1.0/docs/USB-BRAIN-GUIDE-macos.md
Parfii-bot 5993f32146 feat(v0.22): FS warn + battle-test matrix + USB docs platform split (Track C)
1. Filesystem type detection (architect P2 finding)
   _primitives/_rust/keisei/src/fs_type.rs (NEW, 103 LOC)
     - statfs(2)-based detection on unix (libc = '0.2' under
       [target.'cfg(unix)'.dependencies])
     - Recognizes exfat / msdos (FAT32) via f_fstypename on macOS,
       via f_type magic numbers on Linux (0x4d44, 0x2011bab0)
     - Windows stub returns Unknown (GetVolumeInformationW TBD)
     - warn_on_unsafe_fs(root) emits stderr warning on ExFat/Fat32
   brain.rs::load calls warn_on_unsafe_fs after canonicalize+symlink
     checks. Warning NOT fatal — user can opt into single-client use.

2. Battle-test matrix (architect P3 finding)
   tests/battle/Dockerfile.install-test-alpine (NEW)
     - alpine:3.19 + apk rust/cargo/pandoc
     - Exposes musl-vs-glibc issues in aws-sdk-s3, rusqlite, git2
   tests/battle/Dockerfile.install-test-debian (NEW)
     - debian:12 + rustup stable + pandoc
     - Default server distro, different apt structure from Ubuntu
   tests/battle/README.md rewritten — 3-distro matrix with run script

3. USB-BRAIN-GUIDE platform split
   docs/USB-BRAIN-GUIDE.md — restructured as TOC + platform-agnostic
     preamble + exFAT warning + cross-platform troubleshooting
   docs/USB-BRAIN-GUIDE-macos.md (NEW, 97 LOC) — Gatekeeper, diskutil,
     /Volumes, xattr -d com.apple.quarantine
   docs/USB-BRAIN-GUIDE-linux.md (NEW, 98 LOC) — /media/$USER,
     umount, ext4 recommended, systemd-udev auto-mount note
   docs/USB-BRAIN-GUIDE-windows.md (NEW, 115 LOC) — PowerShell
     Dismount-Volume, NTFS, FS-advisory Unknown caveat

REAL VERIFICATION (paste from agent):
  cargo check -p keisei: Finished (clean)
  cargo test -p keisei --release: 32 passed 0 failed (30 existing + 2 new)
  docker buildx outline: both new Dockerfiles parse

Constructor Pattern:
  fs_type.rs 103 LOC, brain.rs 198 LOC (at limit 200, held the line)
  All fns <30 LOC. Each USB guide sub-doc 97-115 LOC.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-22 20:56:42 +08:00

2.8 KiB

USB Exobrain — macOS Walkthrough

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

1. Create the brain directory

BRAIN=/Volumes/EXOBRAIN/my-brain
mkdir -p "$BRAIN"/{bin,memory,artifacts,manifests}

2. Download MCP server binaries

BASE=https://github.com/KeiSei84/KeiSeiKit/releases/download/v0.21.0
cd "$BRAIN/bin"
for n in darwin-arm64 darwin-x64 linux-x64 windows-x64.exe; do
  curl -fL -O "$BASE/kei-mcp-server-$n"
  curl -fL -O "$BASE/kei-mcp-server-$n.sha256"
done
curl -fL -O "$BASE/kei-mcp-server-linux-arm64" 2>/dev/null || echo "skipped linux-arm64"

for f in kei-mcp-server-*.sha256; do shasum -a 256 -c "$f"; done
chmod +x kei-mcp-server-darwin-* kei-mcp-server-linux-* 2>/dev/null || true
xattr -d com.apple.quarantine kei-mcp-server-darwin-* 2>/dev/null || true

macOS Gatekeeper quarantines every downloaded binary; xattr -d clears the attribute. Re-run that line later if Claude Code refuses to spawn the mcp server.

3. Write manifest.toml (schema v2)

cat > "$BRAIN/manifest.toml" <<'EOF'
[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"
EOF

4. Verify + attach

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

Marker lands at ~/.keisei/attached.toml; client settings at ~/.claude/settings.json.

5. Verify in Claude Code

Close + reopen Claude Code, or run /help → MCP servers. Confirm from the shell:

cat ~/.claude/settings.json | jq '.mcpServers["my-brain"]'

6. Multi-client mount

keisei mount "$BRAIN"

Writes to ~/.claude/settings.json, ~/.cursor/mcp.json, ~/.continue/config.json, ~/Library/Application Support/Zed/settings.json.

7. Project-scope

cd ~/path/to/your-repo
keisei attach "$BRAIN" --scope=project    # claude-code + cursor only

8. Detach + eject

keisei detach
diskutil eject /Volumes/EXOBRAIN

macOS-specific troubleshooting

  • Claude Code can't spawn the MCP server — check chmod +x, re-run xattr -d com.apple.quarantine <binary>, and confirm direct-run: .../kei-mcp-server-darwin-arm64 --help.
  • "BrainIsSymlink" on attach$BRAIN is a symlink. Pass the resolved path; keisei refuses symlink roots.
  • USB not at /Volumes/EXOBRAIN — macOS auto-renames on name collision (EXOBRAIN 1). Confirm with diskutil list.