feat: Implement user-dir sharing between ai user and workspace root

Perfect solution for aios concept:
- workspace.nspawn: Bind=/home/ai:/root
- ai user and workspace root share the SAME home directory
- Same .zshrc, .claude.json, .config, all data/settings/history
- INSIDE_WORKSPACE env var prevents infinite loop
- Flow: ai login → enter workspace → claude starts
- All configuration and memory perfectly shared
This commit is contained in:
Claude
2025-11-07 16:45:12 +00:00
parent 100471646e
commit b41052b9a8
2 changed files with 35 additions and 30 deletions

View File

@@ -45,23 +45,6 @@ sleep 2
arch-chroot $ROOTFS /bin/sh -c 'pkill aigpt'
arch-chroot $ROOTFS /bin/sh -c 'if command -v sqlite3 &>/dev/null; then sqlite3 /root/.config/syui/ai/gpt/memory.db "PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;"; fi'
# Add claude auto-start for root user (container concept)
echo "Configuring claude auto-start for root..."
cat >> $ROOTFS/root/.zshrc <<'EOF'
# MCP auto-setup (run once after .claude.json is created)
if [[ -f ~/.claude.json ]] && ! grep -q '"aigpt"' ~/.claude.json 2>/dev/null; then
if command -v claude &>/dev/null && command -v aigpt &>/dev/null; then
claude mcp add aigpt aigpt server &>/dev/null || true
fi
fi
# Auto-start claude in interactive login shell
if [[ -o login ]] && [[ -o interactive ]]; then
if command -v claude &>/dev/null; then
claude
fi
fi
EOF
# Note: claude auto-start is configured in ai user's .zshrc (shared with workspace root via bind mount)
echo "✓ Claude MCP setup complete"