# OpenClaw AI Agent Setup

**Last Updated:** 2026-01-30
**Status:** Planned

## Overview

OpenClaw is an open-source AI agent coordination platform that enables multi-agent AI workflows with voice integration, smart home control, and cross-platform messaging.

**Architecture:**
- **Gateway (Control Plane)**: LXC container on main-pve (CT 130, 10.0.10.28)
- **Desktop Client**: macOS app on Fred's iMac (10.0.10.11)
- **Communication**: WebSocket on port 18789

## Infrastructure Details

### Gateway Server (LXC Container)

**Container Specifications:**
- **Host**: main-pve (10.0.10.3)
- **Container ID**: CT 130
- **IP Address**: 10.0.10.28
- **Hostname**: openclaw
- **Resources**: 2 vCPUs, 4GB RAM, 16GB storage
- **OS**: Debian 12 (Bookworm)
- **Port**: 18789 (WebSocket/HTTP)

**Service Details:**
- **Service Name**: `openclaw-gateway` (systemd)
- **Configuration**: `~/.openclaw/` directory
- **State Storage**: `~/.openclaw/` (backed up to OMV)
- **Node Version**: ≥22.12.0 LTS
- **Package Manager**: pnpm 10.23.0+

### Desktop Client (iMac)

**Hardware:**
- **Device**: Late 2013 iMac
- **CPU**: 3.2GHz Quad Core Intel i5
- **GPU**: Nvidia GeForce GT 755M (1GB)
- **RAM**: 24GB
- **OS**: macOS Sequoia (via OpenCore)
- **IP Address**: 10.0.10.11 (static on device)
- **Hostname**: freds-imac

**Client Features:**
- Voice input/output for AI interactions
- Morning briefing automation
- macOS system integration
- Desktop notifications

## Installation Plan

### Phase 1: Gateway Deployment

1. **Create LXC Container**
   ```bash
   ssh root@10.0.10.3
   pct create 130 local:vztmpl/debian-12-standard_12.2-1_amd64.tar.zst \
     --hostname openclaw \
     --memory 4096 \
     --cores 2 \
     --rootfs local:16 \
     --net0 name=eth0,bridge=vmbr0,ip=10.0.10.28/24,gw=10.0.10.1 \
     --nameserver 10.0.10.1 \
     --features nesting=1 \
     --unprivileged 1 \
     --start 1
   ```

2. **Install OpenClaw Gateway**
   ```bash
   pct exec 130 -- bash -c "curl -fsSL https://openclaw.bot/install.sh | bash"
   pct exec 130 -- openclaw onboard --install-daemon
   ```

3. **Configure Network Access**
   - Default: Loopback only (`127.0.0.1:18789`)
   - LAN Access: Bind to `10.0.10.28:18789` with authentication
   - Security: Token-based auth for non-loopback access

4. **Verify Installation**
   ```bash
   pct exec 130 -- openclaw doctor
   pct exec 130 -- openclaw status
   pct exec 130 -- systemctl status openclaw-gateway
   ```

### Phase 2: Desktop Client Setup

1. **Install OpenClaw Desktop App on iMac**
   - Download from openclaw.bot or GitHub releases
   - Install to Applications folder
   - Configure Gateway connection: `10.0.10.28:18789`

2. **Device Pairing**
   - iMac connects to Gateway
   - Local network: Auto-approval expected
   - Verify pairing in Gateway dashboard

3. **Voice Integration**
   - Configure microphone input
   - Test voice commands
   - Set up wake word (if supported)

### Phase 3: Agent Configuration & Automation

**YouTube Tutorial Resources:**
- Introduction Video: https://www.youtube.com/watch?v=tEjg56ZYKJo
- Tutorial with Prompts: https://www.youtube.com/watch?v=b-l9sGh1-UY

#### 1. Morning Brief (8:00 AM Daily)

**Schedule:** Every morning at 8:00 AM (Fred's local time)

**Prompt Template:**
```
I want you to send me a morning brief every morning at 8am my time. I want this morning brief to include:
- The local weather for the day
- A list of a few trending YouTube videos about my interests
- A list of tasks I need to get done today based on my todo list
- Tasks that you think you can do for me today that will be helpful based on what you know about me
- A list of trending stories based on my interests
- Recommendations you can make for me that will make today super productive
```

**Implementation:**
- Configure as recurring agent task or cron job in OpenClaw
- Pull weather from Weather API or Home Assistant integration
- YouTube trending: Use YouTube Data API filtered by interests
- Todo list: Integrate with n8n or local todo system
- News: RSS feeds or news API filtered by interests

#### 2. Proactive Coder (11:00 PM Nightly)

**Schedule:** Every night at 11:00 PM (while Fred is sleeping)

**Prompt Template:**
```
I am a 1 man business. I work from the moment I wake up to the moment I go to sleep. I need an employee taking as much off my plate and being as proactive as possible.

Please take everything you know about me and just do work you think would make my life easier or improve my business and make me money. I want to wake up every morning and be like "wow, you got a lot done while I was sleeping."

Don't be afraid to monitor my business and build things that would help improve our workflow. Just create PRs for me to review, don't push anything live. I'll test and commit. Every night when I go to bed, build something cool I can test. Schedule time to work every night at 11pm.
```

**Implementation:**
- Scheduled agent session starting at 11:00 PM
- Agent has access to:
  - Code repositories (via SSH or git)
  - Infrastructure monitoring data
  - Business metrics and analytics
- Output: Pull requests for review (not direct commits)
- Morning summary of work completed overnight

#### 3. Second Brain (NextJS Document Viewer)

**Purpose:** Obsidian/Linear-style document viewer for daily knowledge capture

**Prompt Template:**
```
I want you to build me a 2nd brain. This should be a NextJS app that shows a list of documents you create as we work together in a nice document viewer that feels like a mix of Obsidian and Linear.

I want you to create a folder where all the documents in that folder are viewable in this 2nd brain. Update your memories/skills so that as we talk every day, you create documents in that 2nd brain that explore some of the more important concepts we discuss.

You should also create daily journal entries that record from a high level all our daily discussions.
```

**Technical Implementation:**
- NextJS app deployed as container or static site
- Document storage: Local filesystem or database
- Features:
  - Markdown document viewer
  - Daily journal entries (auto-created)
  - Concept exploration documents (auto-created during conversations)
  - Search and navigation
  - Obsidian/Linear-inspired UI
- Integration: OpenClaw agent writes to document folder automatically

#### 4. Afternoon Research Report (Daily)

**Schedule:** Every afternoon (time TBD, suggest 2:00 PM)

**Prompt Template:**
```
I want a daily research report sent to me every afternoon. Based on what you know about me I want you to research and give me a report about a concept that would improve me, processes that would improve our working relationship, or anything else that would be helpful for me.

Examples would be:
- Deep dives on concepts I'm interested in like machine learning
- A new workflow we can implement together that will improve our productivity
```

**Implementation:**
- Scheduled agent research session
- Topics determined by:
  - Recent conversations and interests
  - Current projects and challenges
  - Learning goals
  - Business improvement opportunities
- Output: Well-researched report with sources
- Delivery: Morning briefing channel or dedicated report folder

## Integration Points

### Planned Integrations

1. **Home Assistant** (10.0.10.24)
   - Custom plugin for device control
   - Voice commands for smart home
   - Morning briefing with home status

2. **n8n Workflows** (10.0.10.22)
   - Webhook triggers from OpenClaw
   - Automated task execution
   - Custom workflow integration

3. **Calendar Integration**
   - Morning briefing with daily schedule
   - Meeting reminders
   - Task coordination

4. **Weather Integration**
   - Morning weather briefing
   - Daily forecast

## Security Configuration

**Gateway Authentication:**
- Token-based auth for LAN access
- No public internet exposure (internal only)
- Optional: Reverse proxy via Caddy Internal (10.0.10.27)

**Network Access:**
- Loopback: `127.0.0.1:18789` (no auth required)
- LAN Binding: `10.0.10.28:18789` (auth required)
- Firewall: Restrict to 10.0.10.0/24 network

**Device Pairing:**
- Local clients: Auto-approve
- Remote clients: Manual approval with 1-hour expiration codes

## Startup & Management

**Gateway Service:**
```bash
# Check status
pct exec 130 -- systemctl status openclaw-gateway

# Start/stop/restart
pct exec 130 -- systemctl start openclaw-gateway
pct exec 130 -- systemctl stop openclaw-gateway
pct exec 130 -- systemctl restart openclaw-gateway

# View logs
pct exec 130 -- journalctl -u openclaw-gateway -f

# Dashboard
curl http://10.0.10.28:18789/
```

**Desktop Client:**
- Launch OpenClaw app from macOS Applications
- Check connection status in app
- Configure preferences and voice settings

## Health Checks

```bash
# Gateway accessibility
curl -I http://10.0.10.28:18789

# WebSocket test
wscat -c ws://10.0.10.28:18789

# Service status
ssh root@10.0.10.3 'pct exec 130 -- openclaw status'

# Check Gateway sessions
ssh root@10.0.10.3 'pct exec 130 -- openclaw sessions'
```

## Backup Strategy

**Gateway State Backup:**
- Location: `/root/.openclaw/` on CT 130
- Backup to: `/mnt/omv-backups/openclaw/`
- Frequency: Daily
- Retention: 7 days

**Configuration Files:**
- OpenClaw config: `~/.openclaw/`
- Agent profiles: `~/.openclaw/agents/`
- Gateway state: `~/.openclaw/gateway/`

## Resources

- **GitHub Repository**: https://github.com/openclaw/openclaw
- **Documentation**: https://docs.openclaw.ai
- **Installation Guide**: https://docs.openclaw.ai/start
- **Gateway Docs**: https://docs.openclaw.ai/gateway
- **Security Guide**: https://docs.openclaw.ai/security
- **Plugin System**: https://docs.openclaw.ai/plugins

## YouTube Tutorials

- **Introduction**: https://www.youtube.com/watch?v=tEjg56ZYKJo
- **Tutorial & Prompts**: https://www.youtube.com/watch?v=b-l9sGh1-UY

## Notes

- **Node.js Version**: Must use ≥22.12.0 for critical security patches (CVE-2025-59466, CVE-2026-21636)
- **Resource Requirements**: Lightweight - 2 vCPUs and 4GB RAM sufficient
- **Multi-Instance**: Can run multiple Gateways on different ports if needed
- **Docker Alternative**: Could use Docker Compose instead of native install if preferred

## Next Steps

1. Review YouTube tutorial prompts manually (WebFetch unable to access YouTube)
2. Extract morning briefing templates
3. Create LXC container CT 130
4. Install OpenClaw Gateway
5. Install desktop client on iMac
6. Configure voice integration
7. Set up morning briefing automation
8. Test Home Assistant integration

---

**Status**: Documentation complete, awaiting deployment
