Compare commits

..

11 Commits

Author SHA1 Message Date
f932954c3a fix cfg
Some checks failed
release / Release (push) Failing after 3m16s
2026-03-01 19:13:14 +09:00
0e2acec2c0 fix pacman.conf
All checks were successful
release / Release (push) Successful in 7m52s
2026-02-28 15:25:54 +09:00
756aa9825d rm old 2026-02-28 13:59:26 +09:00
f3a08cb9b1 fix version 2026-02-27 22:20:54 +09:00
a2c1b15042 docker-hub
All checks were successful
release / Release (push) Successful in 7m25s
2026-02-27 20:16:33 +09:00
f715a84858 fix docker
All checks were successful
release / Release (push) Successful in 7m48s
2026-02-27 19:50:30 +09:00
31114ecd74 fix rootfs 2026-02-27 16:20:46 +09:00
2eb903ae4b fix images 2026-02-27 16:15:45 +09:00
29c47fbe9c fix cfg 2026-02-27 14:45:55 +09:00
71c4f2513b add pkg 2026-02-27 13:54:21 +09:00
c31240ec37 first 2026-02-27 13:40:15 +09:00
33 changed files with 307 additions and 2978 deletions

View File

@@ -1,16 +1,14 @@
name: build and push image
name: release
on:
schedule:
- cron: '0 0 * * *'
push:
env:
TAG: latest
IMAGE_ID: aios
IMAGE_NAME: ${{ gitea.repository }}
APP_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: localhost:8088
GITEA_URL: https://git.syui.ai
jobs:
release:
@@ -20,11 +18,21 @@ jobs:
image: ghcr.io/syui/aios
options: --privileged
steps:
- name: Initialize
- name: Pull and push to local registry
run: |
pacman -Syuu --noconfirm base-devel archiso docker git curl
pacman -Sy --noconfirm docker
docker pull ghcr.io/syui/aios
docker tag syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
docker tag ghcr.io/syui/aios ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
echo "${{ env.APP_TOKEN }}" | docker login ${{ env.REGISTRY }} -u syui --password-stdin
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
- name: Create release
run: |
existing=$(curl -s -H "Authorization: token ${{ env.APP_TOKEN }}" "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/tags/${{ env.TAG }}" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
if [ -n "$existing" ]; then
curl -s -X DELETE -H "Authorization: token ${{ env.APP_TOKEN }}" "${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases/$existing"
fi
git tag -f ${{ env.TAG }} 2>/dev/null || true
curl -s -X POST -H "Authorization: token ${{ env.APP_TOKEN }}" -H "Content-Type: application/json" \
-d '{"tag_name":"${{ env.TAG }}","name":"${{ env.TAG }}","body":"build '$(date +%Y.%m.%d)'\n\ndownload: https://github.com/syui/aios/releases/download/latest/aios.tar.gz"}' \
"${{ env.GITEA_URL }}/api/v1/repos/${{ env.IMAGE_NAME }}/releases"

View File

@@ -9,47 +9,41 @@ permissions:
contents: write
env:
APP_TOKEN: ${{ secrets.APP_TOKEN }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
IMAGE_NAME: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: ghcr.io
jobs:
release:
name: Release
runs-on: ubuntu-latest
container:
image: archlinux
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build aios
run: bash ./build.zsh
- name: Create Docker images
run: |
tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
docker run --rm --privileged \
-v ${{ github.workspace }}:/work -w /work \
archlinux:latest \
bash -c "pacman -Sy --noconfirm arch-install-scripts zsh && zsh ./build.zsh"
- name: Push to Docker Hub
run: |
cat aios.tar.gz | docker import - syui/aios
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
docker push ${{ env.IMAGE_NAME }}
docker push syui/aios
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GITHUB_TOKEN }}
- name: github container registry
- name: Push to GitHub Container Registry
run: |
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
echo "${{ env.APP_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker tag syui/aios ghcr.io/syui/aios
docker push ghcr.io/syui/aios
- name: Create new release
uses: softprops/action-gh-release@v1
with:
name: latest
tag_name: latest
files:
aios-bootstrap.tar.gz
env:
GH_TOKEN: ${{ env.APP_TOKEN }}
run: |
gh release delete latest --yes --cleanup-tag || true
git tag -f latest
git push -f origin latest
gh release create latest aios.tar.gz --title "latest" --notes "build $(date +%Y.%m.%d)"

9
.gitignore vendored
View File

@@ -1,12 +1,9 @@
.config/ai
/.config/ai
/claude.md
/CLAUDE.md
**.DS_Store
# Build artifacts
aios-bootstrap*.tar.gz
root.x86_64/
archiso/
install.sh
build.log
/claude.md
/CLAUDE.md
.claude

View File

@@ -1,5 +1,7 @@
# aios
An environment where AI (Claude) operates an OS (Arch Linux/systemd-nspawn) as a character with memory, publishing via AT Protocol, managed through Git and a custom shell.
```sh
AI: claude
- os: archlinux(systemd-nspawn, pacman)
```

79
build.zsh Executable file
View File

@@ -0,0 +1,79 @@
#!/bin/zsh
set -e
ROOTFS="$(pwd)/root.x86_64"
BUILD_MODE="${1:-tarball}"
BUILD_DATE=$(date +%Y.%m.%d)
echo "=== aios build $BUILD_DATE (mode: $BUILD_MODE) ==="
rm -rf $ROOTFS
mkdir -p $ROOTFS
# --- rootfs構築 (共通) ---
pacstrap -c $ROOTFS base
# pacman.conf がない場合はホストからコピー
if [[ ! -f $ROOTFS/etc/pacman.conf ]]; then
cp /etc/pacman.conf $ROOTFS/etc/pacman.conf
fi
echo 'Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch
Server = http://mirrors.cat.net/archlinux/$repo/os/$arch' > $ROOTFS/etc/pacman.d/mirrorlist
sed -i 's/CheckSpace/#CheckSpace/' $ROOTFS/etc/pacman.conf
sed -i '/\[options\]/a NoUpgrade = etc/os-release' $ROOTFS/etc/pacman.conf
arch-chroot $ROOTFS /bin/sh -c 'pacman-key --init && pacman-key --populate archlinux'
arch-chroot $ROOTFS /bin/sh -c 'pacman -Syu --noconfirm base-devel vim git zsh rust openssh jq nodejs npm zsh-autosuggestions zsh-syntax-highlighting zsh-history-substring-search'
if [[ "$BUILD_MODE" == "image" ]]; then
arch-chroot $ROOTFS /bin/sh -c 'pacman -S --noconfirm linux linux-firmware mkinitcpio'
fi
arch-chroot $ROOTFS /bin/sh -c 'npm i -g @anthropic-ai/claude-code'
bash cfg/pkg.sh $ROOTFS
arch-chroot $ROOTFS /bin/sh -c 'chsh -s /bin/zsh'
arch-chroot $ROOTFS /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai'
arch-chroot $ROOTFS /bin/sh -c 'echo "ai:ai" | chpasswd'
echo "ai ALL=(ALL:ALL) NOPASSWD: ALL" >> $ROOTFS/etc/sudoers
mkdir -p $ROOTFS/etc/systemd/system/console-getty.service.d
cat > $ROOTFS/etc/systemd/system/console-getty.service.d/override.conf <<'EOF'
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin ai --noclear --keep-baud console 115200,38400,9600 $TERM
EOF
cp cfg/zshrc $ROOTFS/home/ai/.zshrc
arch-chroot $ROOTFS /bin/sh -c 'chown ai:ai /home/ai/.zshrc'
mkdir -p $ROOTFS/home/ai/.config/claude
cp cfg/mcp.json $ROOTFS/home/ai/.config/claude/mcp.json
arch-chroot $ROOTFS /bin/sh -c 'chown -R ai:ai /home/ai/.config'
cat > $ROOTFS/etc/os-release <<EOF
NAME=aios
PRETTY_NAME=aios
ID=ai
ID_LIKE=arch
BUILD_ID=rolling
IMAGE_ID=aios
IMAGE_VERSION=0.0.1
HOME_URL=https://git.syui.ai/ai/os
EOF
echo "aios" > $ROOTFS/etc/hostname
# --- 出力 ---
if [[ "$BUILD_MODE" == "image" ]]; then
bash cfg/image.sh $ROOTFS
echo "=== build complete: aios.img ==="
else
tar czf aios.tar.gz -C $ROOTFS .
echo "=== build complete: aios.tar.gz ==="
fi

5
cfg/aios.nspawn Normal file
View File

@@ -0,0 +1,5 @@
[Exec]
Boot=yes
[Network]
Private=no

89
cfg/image.sh Executable file
View File

@@ -0,0 +1,89 @@
#!/bin/bash
set -e
ROOTFS="$1"
IMG="aios.img"
IMG_SIZE="4G"
ESP_SIZE=512 # MiB
LOOP=""
cleanup() {
set +e
umount -R /mnt/aios 2>/dev/null
[[ -n "$LOOP" ]] && losetup -d "$LOOP" 2>/dev/null
rmdir /mnt/aios 2>/dev/null
set -e
}
trap cleanup EXIT
if [[ -z "$ROOTFS" || ! -d "$ROOTFS" ]]; then
echo "Usage: $0 <rootfs-dir>"
exit 1
fi
rm -f "$IMG"
echo "--- Creating raw image ($IMG_SIZE) ---"
fallocate -l "$IMG_SIZE" "$IMG"
echo "--- Partitioning (GPT: ESP + root) ---"
sgdisk -Z "$IMG"
sgdisk -n 1:0:+${ESP_SIZE}M -t 1:EF00 -c 1:"ESP" "$IMG"
sgdisk -n 2:0:0 -t 2:8300 -c 2:"root" "$IMG"
echo "--- Setting up loop device ---"
LOOP=$(losetup --find --show --partscan "$IMG")
PART_ESP="${LOOP}p1"
PART_ROOT="${LOOP}p2"
# Wait for partition devices
udevadm settle
sleep 1
echo "--- Formatting partitions ---"
mkfs.fat -F 32 "$PART_ESP"
mkfs.ext4 -F "$PART_ROOT"
echo "--- Mounting and copying rootfs ---"
mkdir -p /mnt/aios
mount "$PART_ROOT" /mnt/aios
mkdir -p /mnt/aios/boot
mount "$PART_ESP" /mnt/aios/boot
cp -a "$ROOTFS"/. /mnt/aios/
echo "--- Generating fstab ---"
genfstab -U /mnt/aios > /mnt/aios/etc/fstab
echo "--- Installing systemd-boot ---"
arch-chroot /mnt/aios bootctl install
echo "--- Creating boot entry ---"
ROOT_UUID=$(blkid -s UUID -o value "$PART_ROOT")
mkdir -p /mnt/aios/boot/loader/entries
cat > /mnt/aios/boot/loader/loader.conf <<'EOF'
default aios.conf
timeout 3
console-mode max
EOF
cat > /mnt/aios/boot/loader/entries/aios.conf <<EOF
title aios
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=UUID=$ROOT_UUID rw
EOF
echo "--- Generating initramfs ---"
arch-chroot /mnt/aios mkinitcpio -P
echo "--- Unmounting ---"
umount -R /mnt/aios
losetup -d "$LOOP"
LOOP=""
rmdir /mnt/aios 2>/dev/null
echo "--- $IMG ready ---"

17
cfg/mcp.json Normal file
View File

@@ -0,0 +1,17 @@
{
"mcpServers": {
"aigpt": {
"command": "aigpt",
"args": ["server"],
"env": {}
},
"ailog": {
"command": "ailog",
"args": ["mcp"],
"env": {
"CHAT_SYSTEM_FILE": "/home/ai/.config/aigpt/core.md",
"CHAT_OUTPUT": "/home/ai/log/public/content"
}
}
}
}

17
cfg/pkg.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -e
ROOTFS="$1"
arch-chroot $ROOTFS /bin/sh -c 'rm -rf /tmp/gpt /tmp/log /tmp/shell'
arch-chroot $ROOTFS /bin/sh -c '
cd /tmp && git clone https://git.syui.ai/ai/gpt && cd /tmp/gpt && cargo build --release && cp target/release/aigpt /usr/local/bin/
'
arch-chroot $ROOTFS /bin/sh -c '
cd /tmp && git clone -b main https://git.syui.ai/ai/log && cd /tmp/log && cargo build --release && cp target/release/ailog /usr/local/bin/
'
arch-chroot $ROOTFS /bin/sh -c '
cd /tmp && git clone https://git.syui.ai/ai/shell && cd /tmp/shell && cargo build --release && cp target/release/aishell /usr/local/bin/
'
arch-chroot $ROOTFS /bin/sh -c 'rm -rf /tmp/gpt /tmp/log /tmp/shell'

30
cfg/zshrc Normal file
View File

@@ -0,0 +1,30 @@
export PATH=$HOME/.cargo/bin:$PATH
export RUSTUP_HOME="$HOME/.rustup"
export CARGO_HOME="$HOME/.cargo"
alias u="sudo pacman -Syu --noconfirm"
alias zs="vim ~/.zshrc"
alias zr="exec $SHELL && source ~/.zshrc"
alias claude='claude --dangerously-skip-permissions'
alias c='claude --dangerously-skip-permissions'
autoload -Uz compinit
compinit
fpath=(/usr/share/zsh/site-functions $fpath)
#source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
if [[ -o login ]] && [[ -o interactive ]] && command -v aishell &>/dev/null; then
exec aishell
fi

25
install.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash
set -e
NAME="aios"
TARBALL="aios.tar.gz"
DEST="/var/lib/machines/$NAME"
if [[ ! -f "$TARBALL" ]]; then
echo "error: $TARBALL not found"
exit 1
fi
echo "=== aios install ==="
mkdir -p "$DEST"
tar xzf "$TARBALL" -C "$DEST"
mkdir -p /etc/systemd/nspawn
cp cfg/aios.nspawn /etc/systemd/nspawn/$NAME.nspawn
echo "=== install complete ==="
echo ""
echo " sudo machinectl start $NAME"
echo " sudo machinectl shell $NAME /bin/su - ai"

View File

@@ -1,119 +0,0 @@
#!/bin/zsh
# aios build script
# 1. Build minimal Arch Linux base
# 2. Setup user (ai) and shell
# 3. Setup Claude Code and aigpt
echo "=== aios build ==="
echo ""
# Clean up previous build artifacts
echo "Cleaning up previous build..."
rm -rf root.x86_64/ archiso/ install.sh
rm -f aios-bootstrap*.tar.gz 2>/dev/null || true
# ============================================
# 1. Arch Linux Base Construction
# ============================================
echo "=== Step 1: Arch Linux Base ==="
# Install build dependencies
pacman -Syuu --noconfirm base-devel archiso docker git nodejs bc
# Clone archiso
git clone https://gitlab.archlinux.org/archlinux/archiso
# Copy configuration
cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/
cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh
cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh
cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
# Build bootstrap
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
# Extract and prepare
tar xf aios-bootstrap*.tar.gz
mkdir -p root.x86_64
pacstrap -c root.x86_64 base
# Configure pacman
echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist
sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
# Initialize pacman keys
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --init'
arch-chroot root.x86_64 /bin/sh -c 'pacman-key --populate archlinux'
# Install base packages (including systemd-container for machinectl)
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 systemd arch-install-scripts'
# Configure containers
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'
# Set default shell
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 os-release
cp -rf ./cfg/os-release root.x86_64/etc/os-release
# Configure sudoers for wheel group (full access for container operation)
echo "Configuring sudoers..."
arch-chroot root.x86_64 /bin/sh -c 'echo "%wheel ALL=(ALL:ALL) NOPASSWD: /usr/bin/pacman -Syu --noconfirm, /usr/bin/poweroff, /usr/bin/reboot" >> /etc/sudoers'
arch-chroot root.x86_64 /bin/sh -c 'echo "ai ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers'
# Install aigpt (aios core package)
echo "Installing aigpt..."
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/ && cd .. && rm -rf gpt'
# Install aibot (aios core package)
echo "Installing aibot..."
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build --release && cp -rf ./target/release/aibot /bin/ && aibot ai && cd .. && rm -rf bot'
echo "Installing aishell..."
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/shell && cd shell && cargo build --release && cp -rf ./target/release/aishell /bin/ && cd .. && rm -rf shell'
echo "✓ Arch Linux base complete"
echo ""
# ============================================
# 2. User Setup
# ============================================
bash ./cfg/setup-user.sh
echo ""
# ============================================
# 3. Create workspace container (after all configuration)
# ============================================
bash ./cfg/user-continer.sh
echo ""
# ============================================
# Finalize
# ============================================
echo "=== Finalizing ==="
# Copy aios-ctl.zsh for host machine control
cp -rf ./cfg/aios-ctl.zsh root.x86_64/opt/aios-ctl.zsh
# Copy install script
cp -rf ./cfg/install.sh ./install.sh
chmod +x ./install.sh
# Create tarball with aios (includes child containers)
echo "Creating tarball..."
tar -zcvf aios-bootstrap.tar.gz root.x86_64/ install.sh
echo ""
echo "=== Build Complete ==="
echo "Output: aios-bootstrap.tar.gz"
echo ""

View File

@@ -1,6 +0,0 @@
# https://github.com/containers/shortnames
# ~/.config/containers/registries.conf.d/ai.conf
unqualified-search-registries = ['git.syui.ai', 'docker.io', 'ghcr.io']
[aliases]
"aios" = "git.syui.ai/ai/os"

View File

@@ -1,132 +0,0 @@
#!/bin/zsh
# aios machine control commands
NAME="aios"
BACKUP="${NAME}back"
# Start aios container
function aios-start() {
sudo machinectl start $NAME
}
# Stop aios container
function aios-stop() {
sudo machinectl poweroff $NAME > /dev/null 2>&1
sleep 2
sudo machinectl terminate $NAME > /dev/null 2>&1
}
# Shell into aios container
function aios-shell() {
sudo machinectl shell $NAME
}
# Login to aios container as ai user
function aios-login() {
sudo machinectl shell $NAME /bin/su - ai
}
# Create backup of current aios
function aios-backup() {
echo "Creating backup: $BACKUP"
sudo machinectl poweroff $BACKUP > /dev/null 2>&1
sleep 2
sudo machinectl terminate $BACKUP > /dev/null 2>&1
sleep 2
sudo machinectl remove $BACKUP > /dev/null 2>&1
sleep 2
sudo machinectl clone $NAME $BACKUP
echo "Backup created: $BACKUP"
}
# Reset aios from backup
function aios-reset() {
if ! sudo machinectl list-images | grep -q $BACKUP; then
echo "Error: No backup found. Run 'aios-backup' first."
return 1
fi
echo "Resetting $NAME from $BACKUP..."
sudo machinectl poweroff $NAME > /dev/null 2>&1
sleep 2
sudo machinectl terminate $NAME > /dev/null 2>&1
sleep 2
sudo machinectl remove $NAME
sleep 2
sudo machinectl clone $BACKUP $NAME
sleep 2
sudo machinectl start $NAME
echo "Reset complete"
}
# Update packages in backup
function aios-update() {
if ! sudo machinectl list-images | grep -q $BACKUP; then
echo "Error: No backup found. Run 'aios-backup' first."
return 1
fi
echo "Updating $BACKUP..."
sudo machinectl start $BACKUP
sleep 5
sudo machinectl shell $BACKUP /bin/sh -c 'pacman -Syu --noconfirm'
sleep 2
sudo machinectl poweroff $BACKUP
echo "Update complete"
}
# Remove aios container
function aios-remove() {
echo "Removing $NAME..."
sudo machinectl poweroff $NAME > /dev/null 2>&1
sleep 2
sudo machinectl terminate $NAME > /dev/null 2>&1
sleep 2
sudo machinectl remove $NAME
echo "Removed $NAME"
}
# List all machines
function aios-list() {
sudo machinectl list-images
}
# Show status
function aios-status() {
sudo machinectl status $NAME
}
# Execute command in aios
function aios-exec() {
if [ -z "$1" ]; then
echo "Usage: aios-exec <command>"
return 1
fi
sudo machinectl shell $NAME /bin/sh -c "$*"
}
# Show help
function aios-help() {
cat <<'EOF'
aios machine control commands:
aios-start Start aios container
aios-stop Stop aios container
aios-shell Open shell in aios container
aios-login Login to aios container console
aios-backup Create backup snapshot (aiosback)
aios-reset Reset aios from backup
aios-update Update packages in backup
aios-remove Remove aios container
aios-list List all machine images
aios-status Show aios status
aios-exec Execute command in aios
aios-help Show this help
Example workflow:
1. aios-start # Start container
2. aios-login # Login and use
3. aios-backup # Create backup before major changes
4. aios-reset # Restore if something breaks
EOF
}

View File

@@ -1,38 +0,0 @@
#!/bin/zsh
# aios startup script
CONFIG_DIR="$HOME/.config/syui/ai/os"
CONFIG_FILE="$CONFIG_DIR/config.json"
# 設定ファイルが存在しない場合は何もしない
if [ ! -f "$CONFIG_FILE" ]; then
return
fi
# jqで設定読み込み
if ! command -v jq &>/dev/null; then
return
fi
SHELL_MODE=$(cat "$CONFIG_FILE" | jq -r '.shell // false')
if [ "$SHELL_MODE" = "true" ]; then
echo "aios - AI-managed OS"
echo " Starting workspace container..."
echo ""
# Check if workspace exists
if ! sudo machinectl list-images | grep -q "^workspace"; then
echo "Error: workspace container not found"
echo "Please run install.sh first to create workspace container"
return
fi
# Start workspace container
sudo machinectl start workspace 2>/dev/null || true
sleep 2
# Login to workspace (claude.service will auto-start inside)
echo "Connecting to workspace container..."
exec sudo machinectl login workspace
fi

View File

@@ -1,59 +0,0 @@
# aios configuration
[general]
version = "0.1.0"
name = "aios"
description = "AI-managed OS with shared memory"
[paths]
config_dir = "~/.config/syui/ai"
memory_db = "~/.config/syui/ai/gpt/memory.db"
mcp_config = "~/.config/syui/ai/mcp.json"
[permissions]
# Level 0: Auto-allow (no approval required)
auto_allow = [
"pacman -Q*",
"pacman -Ss*",
"systemctl status*",
"ls", "cat", "grep", "find",
"ps", "top", "htop",
"df", "free", "uname"
]
# Level 1: Notify (log only, no approval)
notify = [
"pacman -S*",
"pacman -Sy*",
"git clone*",
"cargo install*",
"systemctl start*",
"systemctl enable*"
]
# Level 2: Require approval
require_approval = [
"pacman -R*",
"rm -rf*",
"systemctl stop*",
"systemctl disable*",
"dd*"
]
# Level 3: Deny
deny = [
"rm -rf /",
"rm -rf /*",
"mkfs*",
":(){ :|:& };:"
]
[aigpt]
enable_layer4 = true
wal_mode = true
cache_size_mb = 64
[container]
runtime = "systemd-nspawn"
private_users = true
virtual_ethernet = true

View File

@@ -1,72 +0,0 @@
name: release
on:
push:
branches:
- main
permissions:
contents: write
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
IMAGE_NAME: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: ghcr.io
jobs:
release:
name: Release
runs-on: ubuntu-latest
container:
image: archlinux
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize
run: |
pacman -Syuu --noconfirm base-devel archiso docker git nodejs bc
git clone https://gitlab.archlinux.org/archlinux/archiso
cp -rf ./cfg/profiledef.sh /usr/share/archiso/configs/releng/
cp -rf ./cfg/profiledef.sh ./archiso/configs/releng/profiledef.sh
cp -rf ./cfg/profiledef.sh ./archiso/configs/baseline/profiledef.sh
cp -rf ./scpt/mkarchiso ./archiso/archiso/mkarchiso
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
tar xf aios-bootstrap*.tar.gz
mkdir -p root.x86_64/var/lib/machines/arch
pacstrap -c root.x86_64/var/lib/machines/arch base
echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch
Server = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist
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 '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'
arch-chroot root.x86_64 /bin/sh -c 'git clone https://git.syui.ai/ai/bot && cd bot && cargo build && cp -rf ./target/debug/ai /bin/ && ai ai'
tar -zcvf aios-bootstrap.tar.gz root.x86_64/
tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
docker push ${{ env.IMAGE_NAME }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GITHUB_TOKEN }}
- name: github container registry
run: |
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Create new release
uses: softprops/action-gh-release@v1
with:
name: latest
tag_name: latest
files:
aios-bootstrap.tar.gz

View File

@@ -1 +0,0 @@
aios

View File

@@ -1,12 +0,0 @@
{
"mcpServers": {
"aigpt": {
"command": "aigpt",
"args": ["server", "--enable-layer4"],
"env": {
"AIGPT_DB": "/root/.config/syui/ai/gpt/memory.db"
},
"description": "AI memory and personality system"
}
}
}

View File

@@ -1,15 +0,0 @@
# systemd-nspawn configuration for aios
# Place this file in /etc/systemd/nspawn/aios.nspawn
[Exec]
Boot=yes
PrivateUsers=pick
ResolvConf=copy-host
[Files]
# Bind mount shared memory directory
# Host: /root/.config/syui/ai -> Container: /root/.config/syui/ai
Bind=/root/.config/syui/ai:/root/.config/syui/ai
[Network]
VirtualEthernet=no

View File

@@ -1,17 +0,0 @@
NAME=aios
PRETTY_NAME=aios
ID=ai
ID_LIKE=arch
VERSION_ID=2024.11
VERSION="2024.11 (Rolling)"
VERSION_CODENAME=rolling
BUILD_ID=rolling
IMAGE_ID=aios
IMAGE_VERSION=2024.11.06
ANSI_COLOR="38;2;23;147;209"
HOME_URL=https://git.syui.ai/ai/os
DOCUMENTATION_URL=https://git.syui.ai/ai/os/wiki
SUPPORT_URL=https://git.syui.ai/ai/os/issues
BUG_REPORT_URL=https://git.syui.ai/ai/os/issues
PRIVACY_POLICY_URL=https://git.syui.ai/ai/os
LOGO=ai-logo

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env bash
# shellcheck disable=SC2034
iso_name="aios"
iso_label="AI_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)"
iso_publisher="aios <https://git.syui.ai/ai/os>"
iso_application="aios Live/Rescue DVD"
iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
install_dir="ai"
#buildmodes=('iso')
buildmodes=('bootstrap')
bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito'
'uefi-ia32.grub.esp' 'uefi-x64.grub.esp'
'uefi-ia32.grub.eltorito' 'uefi-x64.grub.eltorito')
arch="x86_64"
pacman_conf="pacman.conf"
airootfs_image_type="squashfs"
airootfs_image_tool_options=('-comp' 'xz' '-Xbcj' 'x86' '-b' '1M' '-Xdict-size' '1M')
file_permissions=(
["/etc/shadow"]="0:0:400"
["/root"]="0:0:750"
["/root/.automated_script.sh"]="0:0:755"
["/root/.gnupg"]="0:0:700"
["/usr/local/bin/choose-mirror"]="0:0:755"
["/usr/local/bin/Installation_guide"]="0:0:755"
["/usr/local/bin/livecd-sound"]="0:0:755"
)

View File

@@ -1,84 +0,0 @@
#!/bin/bash
# User setup for aios
# Creates ai user, configures auto-login, sudo, zshrc
ROOTFS="root.x86_64"
echo "=== User Setup ==="
# Create default user 'ai'
echo "Creating user 'ai'..."
arch-chroot $ROOTFS /bin/sh -c 'useradd -m -G wheel -s /bin/zsh ai'
arch-chroot $ROOTFS /bin/sh -c 'echo "ai:root" | chpasswd'
# Configure securetty for pts login (required for systemd-nspawn)
echo "Configuring securetty..."
cat >> $ROOTFS/etc/securetty <<'EOF'
pts/0
pts/1
pts/2
pts/3
pts/4
pts/5
pts/6
pts/7
pts/8
pts/9
EOF
# Enable systemd-machined for container management
echo "Enabling systemd-machined..."
arch-chroot $ROOTFS /bin/sh -c 'systemctl enable systemd-machined'
# Create workspace container configuration (bind ai user dir to container root)
echo "Creating workspace container configuration..."
mkdir -p $ROOTFS/etc/systemd/nspawn
cat > $ROOTFS/etc/systemd/nspawn/workspace.nspawn <<'EOF'
[Exec]
Boot=yes
ResolvConf=copy-host
[Files]
Bind=/home/ai:/root
[Network]
VirtualEthernet=no
EOF
# Setup auto-login for user 'ai'
echo "Setting up auto-login..."
arch-chroot $ROOTFS /bin/sh -c 'mkdir -p /etc/systemd/system/getty@tty1.service.d'
cat > $ROOTFS/etc/systemd/system/getty@tty1.service.d/override.conf <<'EOF'
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin ai --noclear %I $TERM
EOF
# Copy .zshrc for root
echo "Copying zshrc..."
cp -rf ./cfg/zshrc $ROOTFS/root/.zshrc
# Copy .zshrc for user 'ai'
cp -rf ./cfg/zshrc $ROOTFS/home/ai/.zshrc
# Add workspace auto-entry and claude auto-start
cat >> $ROOTFS/home/ai/.zshrc <<'EOF'
# aios: auto-enter workspace container
if [[ -o login ]] && [[ -o interactive ]]; then
if [[ -z "$INSIDE_WORKSPACE" ]]; then
# Enter workspace container
export INSIDE_WORKSPACE=1
exec sudo systemd-nspawn -q -D /var/lib/machines/workspace /bin/zsh
else
# Inside workspace - start claude with skip permissions
if command -v claude &>/dev/null; then
claude --dangerously-skip-permissions
fi
fi
fi
EOF
arch-chroot $ROOTFS /bin/sh -c 'chown ai:ai /home/ai/.zshrc'
echo "✓ User setup complete"

View File

@@ -1,23 +0,0 @@
#!/bin/bash
# Create workspace container inside aios for ai user
# Backup aios before creating /var/lib/machines to avoid recursion
ROOTFS="root.x86_64"
echo "=== Creating workspace container ==="
# Backup current aios to temp location (before creating /var/lib/machines)
echo "Backing up aios..."
cp -a $ROOTFS /tmp/aios-backup-$$
# Create directory for child containers
mkdir -p $ROOTFS/var/lib/machines
# Copy backup as workspace
echo "Creating workspace container..."
cp -a /tmp/aios-backup-$$ $ROOTFS/var/lib/machines/workspace
# Cleanup temp backup
rm -rf /tmp/aios-backup-$$
echo "✓ Workspace container created"

View File

@@ -1,40 +0,0 @@
# 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 claude='claude --dangerously-skip-permissions'
alias c='claude --dangerously-skip-permissions'
# 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 ""

View File

@@ -1,125 +0,0 @@
### archiso
- [profile.rst](https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.profile.rst)
```sh
$ pacman -S archiso
```
```sh
$ git clone https://git.syui.ai/ai/os
$ cd os
$ git clone https://gitlab.archlinux.org/archlinux/archlinux-docker
$ git clone https://gitlab.archlinux.org/archlinux/archiso
$ vim ./archiso/configs/releng/profiledef.sh
$ mkarchiso -v -o ./ ./archiso/configs/releng
```
### system
> ./archiso/configs/releng/profiledef.sh
```sh
buildmodes=('bootstrap')
```
```sh
$ mkarchiso -v -o ./ ./archiso/configs/releng
$ tar xf aios-bootstrap*.tar.gz
$ echo -e 'Server = http://mirrors.cat.net/archlinux/$repo/os/$arch\nServer = https://geo.mirror.pkgbuild.com/$repo/os/$arch' >> ./root.x86_64/etc/pacman.d/mirrorlist
$ sed -i s/CheckSpace/#CheckeSpace/ root.x86_64/etc/pacman.conf
$ arch-chroot ./root.x86_64
---
$ pacman -S base base-devel linux vim git zsh rust
$ pacman-key --init
$ pacman-key --populate archlinux
$ exit
---
$ tar -C root.x86_64 -c . | docker import - syui/aios
$ docker images
$ docker run --rm syui/aios cargo version
cargo 1.75.0
```
### gh-actions
[.github/workflows/push.yml](https://docs.github.com/en/enterprise-cloud@latest/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions)
```yml
name: Demo Push
on:
push:
branches:
- main
- seed
tags:
- v*
pull_request:
env:
IMAGE_NAME: ghtoken_product_demo
jobs:
push:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}"
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Push image
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
[ "$VERSION" == "main" ] && VERSION=latest
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
```
### github-token
```yml
env:
IMAGE_NAME: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: ghcr.io
jobs:
release:
name: Release
runs-on: ubuntu-latest
container:
image: archlinux
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GITHUB_TOKEN }}
- name: github container registry
run: |
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
```
```sh
# make gh-actions
$ vim ./build.zsh
$ ./scpt/gh-actions.zsh
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

View File

@@ -1,71 +0,0 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
yml_a='name: release
on:
push:
branches:
- main
permissions:
contents: write
env:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
IMAGE_NAME: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
REGISTRY: ghcr.io
jobs:
release:
name: Release
runs-on: ubuntu-latest
container:
image: archlinux
options: --privileged
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize
run: |'
yml_c=' tar -C ./root.x86_64 -c . | docker import - ${{ env.IMAGE_NAME }}
echo "${{ env.DOCKER_TOKEN }}" | docker login -u syui --password-stdin
docker push ${{ env.IMAGE_NAME }}
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ env.GITHUB_TOKEN }}
- name: github container registry
run: |
docker tag ${{ env.IMAGE_NAME }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
docker push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Create new release
uses: softprops/action-gh-release@v1
with:
name: latest
tag_name: latest
files:
aios-bootstrap.tar.gz
'
yml_b=`cat $dd/build.zsh |sed '1d'`
echo $yml_a >! $dd/cfg/gh-actions.yml
echo $yml_b|sed 's/^/ /g' >> $dd/cfg/gh-actions.yml
echo $yml_c >> $dd/cfg/gh-actions.yml
cat $dd/cfg/gh-actions.yml
echo '#!/bin/zsh' >! $dd/build.zsh
echo $yml_b >> $dd/build.zsh
cat $dd/build.zsh
cp -rf $dd/cfg/gh-actions.yml $dd/.github/workflows/release.yml

View File

@@ -1,9 +0,0 @@
#!/bin/bash
pacman -Syuu --noconfirm git base-devel archiso
git clone https://gitlab.archlinux.org/archlinux/archiso
./archiso/archiso/mkarchiso -v -o ./ ./archiso/configs/releng/
mkdir -p work/x86_64/airootfs/var/lib/machines/arch
pacstrap -c work/x86_64/airootfs/var/lib/machines/arch base
arch-chroot work/x86_64/airootfs/ /bin/sh -c 'pacman-key --init'
arch-chroot work/x86_64/airootfs/ /bin/sh -c 'pacman-key --populate archlinux'
tar -zcvf archlinux.tar.gz -C work/x86_64/airootfs/ .

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
#!/bin/zsh
d=${0:a:h}
cd $d
t=`grep -Rs archlinux .|grep -v t.zsh|grep -v http|grep -v systemd|grep -v pacman`
n=`echo $t|wc -l`
for ((i=1;i<=$n;i++))
do
tt=`echo $t|awk "NR==$i"`
echo $tt
f=`echo $tt|cut -d : -f 1`
echo sed -i s/archlinux/aios/g $f
done
t=`grep -Rs "Arch Linux" .|grep -v t.zsh|grep -v http|grep -v systemd|grep -v pacman`
n=`echo $t|wc -l`
for ((i=1;i<=$n;i++))
do
tt=`echo $t|awk "NR==$i"`
echo $tt
f=`echo $tt|cut -d : -f 1`
echo sed -i "s/Arch\ Linux/aios/g" $f
done