summaryrefslogtreecommitdiff
path: root/Omni/Dev/Beryllium/AVA.md
blob: 620592b263ed3eff4d6e37adb263a12ca7f79b1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Ava Deployment on Beryllium

Ava runs as a systemd service under the `ava` user.

## Architecture

```
/home/ava/                    # Ava's home directory (AVA_DATA_ROOT)
├── omni/                     # Clone of the omni repo
├── skills/                   # Ava's skills directory
│   ├── shared/               # Skills available to all users
│   └── <username>/           # User-specific skills
├── outreach/                 # Outreach approval queue
│   ├── pending/
│   ├── approved/
│   ├── rejected/
│   └── sent/
├── users/                    # Per-user scratch space
│   └── <username>/
└── .local/share/omni/
    └── memory.db             # SQLite memory database
```

## Configuration

The service is configured in `Ava.nix` and requires these environment variables in `/run/secrets/ava.env`:

```bash
TELEGRAM_BOT_TOKEN=xxx
OPENROUTER_API_KEY=xxx
KAGI_API_KEY=xxx                    # optional
ALLOWED_TELEGRAM_USER_IDS=xxx,yyy   # or * for all
```

## Commands

```bash
# View logs
journalctl -u ava -f

# Restart service
sudo systemctl restart ava

# Check status
sudo systemctl status ava

# Stop/Start
sudo systemctl stop ava
sudo systemctl start ava
```

## SSH Access

The Ava private key is at `~/.ssh/ava_ed25519`. Use it to SSH as ava:

```bash
ssh -i ~/.ssh/ava_ed25519 ava@beryl.bensima.com
```

Ben can also access ava's workspace via his own SSH key since ava is in the git group.

## Git Setup

Ava has its own clone of the omni repo at `/home/ava/omni`. To fetch changes from ben:

```bash
# As ava:
cd /home/ava/omni
git fetch origin
git pull origin main
```

Ben can also push directly to ava's repo if needed:

```bash
# From /home/ben/omni:
git remote add ava /home/ava/omni
git push ava main
```

## Redeploy

To redeploy Ava with code changes:

```bash
# 1. Rebuild the NixOS config
push.sh Omni/Dev/Beryllium.nix

# 2. Or just restart the service if only env changes
sudo systemctl restart ava
```

## Migration from tmux

If migrating from the old tmux-based deployment:

1. Deploy the NixOS config with the new ava user
2. Run the migration script: `sudo ./Omni/Dev/Beryllium/migrate-ava.sh`
3. Create `/run/secrets/ava.env` with the required secrets
4. Stop the tmux ava process
5. Start the systemd service: `sudo systemctl start ava`
6. Enable on boot: `sudo systemctl enable ava`

## Environment Variable: AVA_DATA_ROOT

The `AVA_DATA_ROOT` environment variable controls where Ava stores its data:

- **Development** (unset): Uses `_/var/ava/` (relative to repo)
- **Production**: Set to `/home/ava` via the systemd service

This allows the same codebase to run in both environments without changes.