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:
198
README.md
198
README.md
@@ -1,111 +1,98 @@
|
|||||||
# <img src="./icon/ai.png" width="30"> ai `os`
|
# <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
|
systemd-nspawn container
|
||||||
↓
|
├── Claude Code (AI interface)
|
||||||
aigpt (shared memory)
|
├── aigpt (shared memory)
|
||||||
↓
|
└── zsh (.zshrc configured)
|
||||||
systemd-nspawn (isolated environment)
|
|
||||||
|
$ sudo machinectl shell aios
|
||||||
|
$ claude # Start Claude Code
|
||||||
```
|
```
|
||||||
|
|
||||||
## Philosophy
|
## Philosophy
|
||||||
|
|
||||||
**Insert AI into existing flows**
|
**Insert AI into existing flows**
|
||||||
|
|
||||||
- Traditional: `User → Shell → Commands`
|
Instead of building a new AI chat interface, use **Claude Code** (which already works).
|
||||||
- aios: `User → AI Chat → Commands`
|
|
||||||
|
|
||||||
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
|
```sh
|
||||||
|
$ claude
|
||||||
|
# Claude Code starts, with MCP connection to aigpt
|
||||||
> Install rust development environment
|
> Install rust development environment
|
||||||
✓ Installing rust, rust-analyzer, neovim
|
✓ 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)
|
~/.config/syui/ai/gpt/memory.db (SQLite, WAL mode)
|
||||||
↓
|
↓ bind mount
|
||||||
aios-dev → bind mount → same DB
|
aios-dev, aios-prod, etc. (all share same DB)
|
||||||
aios-prod → bind mount → 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
|
```sh
|
||||||
# Development environment
|
$ sudo machinectl shell aios
|
||||||
$ systemd-nspawn --machine=aios-dev
|
# Inside container with aigpt + Claude Code
|
||||||
|
|
||||||
# Production environment
|
|
||||||
$ systemd-nspawn --machine=aios-prod
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Memory is shared, but environments are separated.
|
Multiple containers can share the same memory.
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
```
|
```
|
||||||
aios (ArchLinux base)
|
Host
|
||||||
├── aigpt (memory system)
|
├── ~/.config/syui/ai/gpt/memory.db (shared)
|
||||||
│ ├── SQLite with WAL mode
|
│
|
||||||
│ ├── Layer 3: Personality analysis
|
└── /var/lib/machines/aios/ (container)
|
||||||
│ └── Layer 4: Relationship inference
|
├── ArchLinux base
|
||||||
├── MCP (AI connection standard)
|
├── aigpt (MCP server)
|
||||||
│ └── Claude Code / ChatGPT / Custom AI
|
├── Claude Code
|
||||||
├── systemd-nspawn (container runtime)
|
├── .zshrc (aliases: ai=claude)
|
||||||
│ └── Shared memory bind mount
|
└── Bind mount → shared memory
|
||||||
└── Permission system
|
|
||||||
├── Auto-allow
|
|
||||||
├── Notify
|
|
||||||
├── Require approval
|
|
||||||
└── Deny
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### Installation
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Clone repository
|
# 1. Clone repository
|
||||||
$ git clone https://github.com/syui/aios
|
$ git clone https://github.com/syui/aios
|
||||||
$ cd aios
|
$ cd aios
|
||||||
|
|
||||||
# Run installer
|
# 2. Run installer (creates systemd-nspawn container)
|
||||||
$ sudo ./aios-install.sh
|
$ sudo ./aios-install.sh
|
||||||
```
|
|
||||||
|
|
||||||
### Usage
|
# 3. Enter container
|
||||||
|
|
||||||
```sh
|
|
||||||
# Start aios container
|
|
||||||
$ sudo systemctl start systemd-nspawn@aios
|
|
||||||
|
|
||||||
# Enter aios shell
|
|
||||||
$ sudo machinectl shell aios
|
$ sudo machinectl shell aios
|
||||||
|
|
||||||
# Inside aios, AI chat interface starts
|
# 4. Start Claude Code
|
||||||
[aios] >
|
$ claude
|
||||||
|
# or
|
||||||
|
$ ai
|
||||||
```
|
```
|
||||||
|
|
||||||
## Container Distribution
|
## Container Distribution
|
||||||
@@ -127,17 +114,14 @@ $ podman pull aios # using shortname alias
|
|||||||
|
|
||||||
```
|
```
|
||||||
~/.config/syui/ai/
|
~/.config/syui/ai/
|
||||||
├── gpt/
|
├── gpt/memory.db # Shared memory (SQLite WAL)
|
||||||
│ ├── memory.db # Shared memory (SQLite WAL)
|
├── mcp.json # MCP server config
|
||||||
│ ├── memory.db-wal
|
└── config.toml # aios config
|
||||||
│ └── memory.db-shm
|
|
||||||
├── mcp.json # MCP server configuration
|
|
||||||
└── config.toml # aios configuration
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### MCP Configuration
|
### MCP Configuration
|
||||||
|
|
||||||
`~/.config/syui/ai/mcp.json`:
|
Claude Code connects to aigpt via MCP:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -150,59 +134,32 @@ $ podman pull aios # using shortname alias
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Permission System
|
This enables Claude Code to use aigpt's memory 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*"]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Building from Source
|
## Building from Source
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Install dependencies
|
$ pacman -S base-devel archiso docker git rust nodejs npm
|
||||||
$ pacman -S base-devel archiso docker git rust
|
|
||||||
|
|
||||||
# Build bootstrap image
|
|
||||||
$ ./build.zsh
|
$ ./build.zsh
|
||||||
|
# Creates: aios-bootstrap.tar.gz
|
||||||
# Result: 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:
|
**Result:** Claude Code can remember your preferences across all containers.
|
||||||
- **Layer 1**: Memory storage
|
|
||||||
- **Layer 2**: Priority scoring
|
|
||||||
- **Layer 3**: Personality analysis (Big Five)
|
|
||||||
- **Layer 4**: Relationship inference
|
|
||||||
|
|
||||||
All memories are shared across containers through bind-mounted SQLite database.
|
## Why Not Just Use Claude Code?
|
||||||
|
|
||||||
## Comparison
|
You can! aios just provides:
|
||||||
|
- Pre-configured environment
|
||||||
| Aspect | Traditional OS | aios |
|
- Shared memory (aigpt) pre-installed
|
||||||
|--------|---------------|------|
|
- Container isolation
|
||||||
| Interface | Shell (bash/zsh) | AI Chat |
|
- Easy multi-environment setup
|
||||||
| Command | Memorize syntax | Natural language |
|
|
||||||
| Configuration | Manual editing | AI executes |
|
|
||||||
| Learning | No | Yes (aigpt) |
|
|
||||||
| Memory | No | Shared (SQLite) |
|
|
||||||
| Isolation | Docker/Podman | systemd-nspawn |
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
@@ -211,21 +168,20 @@ All memories are shared across containers through bind-mounted SQLite database.
|
|||||||
- aigpt: https://git.syui.ai/ai/gpt
|
- aigpt: https://git.syui.ai/ai/gpt
|
||||||
- Container: https://git.syui.ai/ai/-/packages/container/os
|
- 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?"
|
Don't build a new AI chat interface. Use Claude Code (which already works).
|
||||||
> "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.
|
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# aios installer - AI-managed OS with shared memory
|
# aios installer - systemd-nspawn with aigpt + Claude Code
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -9,18 +9,9 @@ AIOS_CONFIG="$HOME/.config/syui/ai"
|
|||||||
|
|
||||||
echo "=== aios installer v${AIOS_VERSION} ==="
|
echo "=== aios installer v${AIOS_VERSION} ==="
|
||||||
echo ""
|
echo ""
|
||||||
echo "aios = AI-managed OS with shared memory"
|
echo "Installing: aigpt + Claude Code in systemd-nspawn"
|
||||||
echo "- Default interface: AI chat (not shell)"
|
|
||||||
echo "- Shared memory: aigpt (SQLite)"
|
|
||||||
echo "- Environment isolation: systemd-nspawn"
|
|
||||||
echo ""
|
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
|
# 1. Create shared memory directory
|
||||||
echo "[1/6] Creating shared memory directory..."
|
echo "[1/6] Creating shared memory directory..."
|
||||||
mkdir -p "${AIOS_CONFIG}/gpt"
|
mkdir -p "${AIOS_CONFIG}/gpt"
|
||||||
@@ -127,25 +118,17 @@ echo "================================================"
|
|||||||
echo "✓ aios installation complete!"
|
echo "✓ aios installation complete!"
|
||||||
echo "================================================"
|
echo "================================================"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if command -v aigpt &>/dev/null; then
|
|
||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # Enter aios container:"
|
echo " # Enter aios container:"
|
||||||
echo " $ sudo machinectl shell aios"
|
echo " $ sudo machinectl shell aios"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # Or start AI chat interface:"
|
echo " # Inside container, start Claude Code:"
|
||||||
echo " $ aios shell"
|
echo " $ claude"
|
||||||
echo ""
|
echo " # or"
|
||||||
else
|
echo " $ ai"
|
||||||
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 ""
|
echo ""
|
||||||
echo "Configuration:"
|
echo "Configuration:"
|
||||||
echo " Config dir: ${AIOS_CONFIG}"
|
echo " Shared memory: ${AIOS_CONFIG}/gpt/memory.db"
|
||||||
echo " Memory DB: ${AIOS_CONFIG}/gpt/memory.db"
|
|
||||||
echo " MCP config: ${AIOS_CONFIG}/mcp.json"
|
echo " MCP config: ${AIOS_CONFIG}/mcp.json"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
@@ -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
|
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 --init'
|
||||||
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
|
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 '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 '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'
|
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)
|
# 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/'
|
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
40
cfg/zshrc
Normal 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 ""
|
||||||
Reference in New Issue
Block a user