Refactor aios: Focus on Claude Code + aigpt simplicity

Simplified aios to focus on core value:
- Pre-configured systemd-nspawn environment
- Claude Code + aigpt (MCP) pre-installed
- Shared memory across containers

Philosophy:
Don't build new tools. Use existing ones (Claude Code, systemd-nspawn).
Just provide the optimal environment and automation.

Changes:
- Added cfg/zshrc: Shell config with claude alias
- Updated build.zsh: Install Claude Code (npm) + aigpt
- Updated aios-install.sh: Simplified installation flow
- Updated README.md: Focus on simplicity and practicality

Installation:
1. npm i -g @anthropic-ai/claude-code
2. Build aigpt from source
3. Configure .zshrc with aliases
4. Set up systemd-nspawn with bind mounts

Usage:
$ sudo machinectl shell aios
$ claude  # or: ai
This commit is contained in:
Claude
2025-11-06 13:19:48 +00:00
parent ee4b8c052f
commit 80e40a53ec
4 changed files with 137 additions and 152 deletions

198
README.md
View File

@@ -1,111 +1,98 @@
# <img src="./icon/ai.png" width="30"> ai `os`
**aios** = AI-managed OS with shared memory
**aios** = ArchLinux + Claude Code + aigpt in systemd-nspawn
An ArchLinux-based OS where AI conversation interface replaces the traditional shell.
A minimal ArchLinux environment optimized for Claude Code with shared AI memory.
```
User → AI Chat → Commands → Execution
aigpt (shared memory)
systemd-nspawn (isolated environment)
systemd-nspawn container
├── Claude Code (AI interface)
├── aigpt (shared memory)
└── zsh (.zshrc configured)
$ sudo machinectl shell aios
$ claude # Start Claude Code
```
## Philosophy
**Insert AI into existing flows**
- Traditional: `User → Shell → Commands`
- aios: `User → AI Chat → Commands`
Instead of building a new AI chat interface, use **Claude Code** (which already works).
Simply insert AI layer into the existing workflow.
aios provides:
1. Pre-installed **aigpt** (MCP server for shared memory)
2. Pre-installed **Claude Code** (`npm i -g @anthropic-ai/claude-code`)
3. Environment isolation with **systemd-nspawn**
4. Shared memory across containers
## Core Features
## What's Included
### 1. AI-First Interface
### 1. Claude Code
Default interface is AI conversation, not shell.
Pre-installed and ready to use:
```sh
$ claude
# Claude Code starts, with MCP connection to aigpt
> Install rust development environment
✓ Installing rust, rust-analyzer, neovim
✓ Done
> What did I install yesterday?
Yesterday you installed Python with poetry.
```
### 2. Shared Memory (aigpt)
### 2. aigpt (Shared Memory)
All containers share the same memory database.
MCP server that provides persistent memory to Claude Code:
```
Host: ~/.config/syui/ai/gpt/memory.db (shared)
aios-dev → bind mount → same DB
aios-prod → bind mount → same DB
~/.config/syui/ai/gpt/memory.db (SQLite, WAL mode)
bind mount
aios-dev, aios-prod, etc. (all share same DB)
```
AI learns from all environments and remembers your preferences.
AI remembers your preferences across all containers.
### 3. Environment Isolation
### 3. systemd-nspawn
Execution environments are isolated using systemd-nspawn.
Lightweight container environment:
```sh
# Development environment
$ systemd-nspawn --machine=aios-dev
# Production environment
$ systemd-nspawn --machine=aios-prod
$ sudo machinectl shell aios
# Inside container with aigpt + Claude Code
```
Memory is shared, but environments are separated.
Multiple containers can share the same memory.
## Architecture
```
aios (ArchLinux base)
├── aigpt (memory system)
├── SQLite with WAL mode
│ ├── Layer 3: Personality analysis
── Layer 4: Relationship inference
├── MCP (AI connection standard)
── Claude Code / ChatGPT / Custom AI
├── systemd-nspawn (container runtime)
└── Shared memory bind mount
└── Permission system
├── Auto-allow
├── Notify
├── Require approval
└── Deny
Host
├── ~/.config/syui/ai/gpt/memory.db (shared)
└── /var/lib/machines/aios/ (container)
── ArchLinux base
├── aigpt (MCP server)
── Claude Code
├── .zshrc (aliases: ai=claude)
└── Bind mount → shared memory
```
## Quick Start
### Installation
```sh
# Clone repository
# 1. Clone repository
$ git clone https://github.com/syui/aios
$ cd aios
# Run installer
# 2. Run installer (creates systemd-nspawn container)
$ sudo ./aios-install.sh
```
### Usage
```sh
# Start aios container
$ sudo systemctl start systemd-nspawn@aios
# Enter aios shell
# 3. Enter container
$ sudo machinectl shell aios
# Inside aios, AI chat interface starts
[aios] >
# 4. Start Claude Code
$ claude
# or
$ ai
```
## Container Distribution
@@ -127,17 +114,14 @@ $ podman pull aios # using shortname alias
```
~/.config/syui/ai/
├── gpt/
├── memory.db # Shared memory (SQLite WAL)
│ ├── memory.db-wal
│ └── memory.db-shm
├── mcp.json # MCP server configuration
└── config.toml # aios configuration
├── gpt/memory.db # Shared memory (SQLite WAL)
├── mcp.json # MCP server config
└── config.toml # aios config
```
### MCP Configuration
`~/.config/syui/ai/mcp.json`:
Claude Code connects to aigpt via MCP:
```json
{
@@ -150,59 +134,32 @@ $ podman pull aios # using shortname alias
}
```
### Permission System
`~/.config/syui/ai/config.toml`:
```toml
[permissions]
# Auto-allow (no approval)
auto_allow = ["pacman -Q*", "ls", "cat"]
# Notify (log only)
notify = ["pacman -S*", "git clone*"]
# Require approval
require_approval = ["rm -rf*", "systemctl stop*"]
# Deny
deny = ["rm -rf /", "mkfs*"]
```
This enables Claude Code to use aigpt's memory system.
## Building from Source
```sh
# Install dependencies
$ pacman -S base-devel archiso docker git rust
# Build bootstrap image
$ pacman -S base-devel archiso docker git rust nodejs npm
$ ./build.zsh
# Result: aios-bootstrap.tar.gz
# Creates: aios-bootstrap.tar.gz
```
## Integration with aigpt
## How It Works
aios is designed to work with [aigpt](https://git.syui.ai/ai/gpt) (AI memory system).
1. **systemd-nspawn** provides lightweight containers
2. **aigpt** runs as MCP server, stores memories in SQLite
3. **Claude Code** connects to aigpt via MCP
4. Shared memory (`~/.config/syui/ai/gpt/memory.db`) is bind-mounted
aigpt provides:
- **Layer 1**: Memory storage
- **Layer 2**: Priority scoring
- **Layer 3**: Personality analysis (Big Five)
- **Layer 4**: Relationship inference
**Result:** Claude Code can remember your preferences across all containers.
All memories are shared across containers through bind-mounted SQLite database.
## Why Not Just Use Claude Code?
## Comparison
| Aspect | Traditional OS | aios |
|--------|---------------|------|
| Interface | Shell (bash/zsh) | AI Chat |
| Command | Memorize syntax | Natural language |
| Configuration | Manual editing | AI executes |
| Learning | No | Yes (aigpt) |
| Memory | No | Shared (SQLite) |
| Isolation | Docker/Podman | systemd-nspawn |
You can! aios just provides:
- Pre-configured environment
- Shared memory (aigpt) pre-installed
- Container isolation
- Easy multi-environment setup
## Links
@@ -211,21 +168,20 @@ All memories are shared across containers through bind-mounted SQLite database.
- aigpt: https://git.syui.ai/ai/gpt
- Container: https://git.syui.ai/ai/-/packages/container/os
## Philosophy Detail
## Philosophy
From conversation with AI about aigpt:
**Insert AI into existing flows**
> "What is the essence of this design?"
> "Simply insert AI into existing flows"
>
> - aigpt: Insert AI between conversation and memory
> - aios: Insert AI between user and commands
>
> Not building something entirely new.
> Just adding an AI layer to existing workflows.
> And prepare the environment for that.
Don't build a new AI chat interface. Use Claude Code (which already works).
This is aios.
Don't create a new container system. Use systemd-nspawn (lightweight, standard).
Just provide:
1. aigpt for shared memory
2. Pre-configured environment
3. Automation scripts
Simple. Minimal. Effective.
---

View File

@@ -1,5 +1,5 @@
#!/bin/bash
# aios installer - AI-managed OS with shared memory
# aios installer - systemd-nspawn with aigpt + Claude Code
set -e
@@ -9,18 +9,9 @@ AIOS_CONFIG="$HOME/.config/syui/ai"
echo "=== aios installer v${AIOS_VERSION} ==="
echo ""
echo "aios = AI-managed OS with shared memory"
echo "- Default interface: AI chat (not shell)"
echo "- Shared memory: aigpt (SQLite)"
echo "- Environment isolation: systemd-nspawn"
echo "Installing: aigpt + Claude Code in systemd-nspawn"
echo ""
# Check if running as root for container creation
if [ "$EUID" -ne 0 ] && [ ! -d "$AIOS_ROOT" ]; then
echo "Note: Container creation requires root privileges"
echo " User config will be created in: $AIOS_CONFIG"
fi
# 1. Create shared memory directory
echo "[1/6] Creating shared memory directory..."
mkdir -p "${AIOS_CONFIG}/gpt"
@@ -127,25 +118,17 @@ echo "================================================"
echo "✓ aios installation complete!"
echo "================================================"
echo ""
if command -v aigpt &>/dev/null; then
echo "Next steps:"
echo ""
echo " # Enter aios container:"
echo " $ sudo machinectl shell aios"
echo ""
echo " # Or start AI chat interface:"
echo " $ aios shell"
echo ""
else
echo "To complete installation:"
echo " 1. Install Rust: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh"
echo " 2. Run this installer again: ./aios-install.sh"
fi
echo "Next steps:"
echo ""
echo " # Enter aios container:"
echo " $ sudo machinectl shell aios"
echo ""
echo " # Inside container, start Claude Code:"
echo " $ claude"
echo " # or"
echo " $ ai"
echo ""
echo "Configuration:"
echo " Config dir: ${AIOS_CONFIG}"
echo " Memory DB: ${AIOS_CONFIG}/gpt/memory.db"
echo " MCP config: ${AIOS_CONFIG}/mcp.json"
echo " Shared memory: ${AIOS_CONFIG}/gpt/memory.db"
echo " MCP config: ${AIOS_CONFIG}/mcp.json"
echo ""

View File

@@ -14,11 +14,17 @@ Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pa
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs docker podman bc'
arch-chroot root.x86_64 /bin/sh -c 'pacman -Syu --noconfirm base base-devel linux vim git zsh rust openssh openssl jq go nodejs npm docker podman bc sqlite'
arch-chroot root.x86_64 /bin/sh -c 'mkdir -p /etc/containers/registries.conf.d'
arch-chroot root.x86_64 /bin/sh -c 'curl -sL -o /etc/containers/registries.conf.d/ai.conf https://git.syui.ai/ai/os/raw/branch/main/cfg/ai.conf'
arch-chroot root.x86_64 /bin/sh -c 'chsh -s /bin/zsh'
# Install Claude Code
arch-chroot root.x86_64 /bin/sh -c 'npm i -g @anthropic-ai/claude-code'
# Copy .zshrc
cp -rf ./cfg/zshrc root.x86_64/root/.zshrc
# Install aigpt (AI memory system)
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/gpt && cd gpt && cargo build --release && cp -rf ./target/release/aigpt /bin/'

40
cfg/zshrc Normal file
View File

@@ -0,0 +1,40 @@
# aios .zshrc
# AI-managed OS with Claude Code + aigpt
# Environment
export EDITOR=vim
export LANG=en_US.UTF-8
# Path
export PATH=$HOME/.local/bin:$PATH
# aigpt MCP configuration
export AIGPT_CONFIG="$HOME/.config/syui/ai/config.toml"
export AIGPT_MCP="$HOME/.config/syui/ai/mcp.json"
# Aliases
alias ai='claude'
alias c='claude'
# Prompt
autoload -Uz promptinit
promptinit
prompt adam1
# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt SHARE_HISTORY
# Completion
autoload -Uz compinit
compinit
# Welcome message
echo "aios - AI-managed OS"
echo " aigpt: MCP server for shared memory"
echo " claude: AI conversation interface"
echo ""
echo "Type 'claude' or 'ai' to start"
echo ""