# Migration Guide — CE Agent Workspace
> Hand this doc to the agent on the new server. Follow every step in order.

---

## Overview

This workspace powers Curious Endeavor's AI agent team. It runs on OpenClaw (hosted by the `clawd` user). The primary agent is **Kitt** (CEO/Orchestrator), supported by a team of sub-agents (Anton, Ogilvy, Tatiana, Gerri, Julia, Jessica, Thibault, Kittoro, Unagi, Erica, Sage).

**What's in the zip:**
- `skills/` — 60 agent skills (full SKILL.md files + supporting assets)
- `scripts/` — core operational scripts (heartbeats, memory, session management)
- `agents/` — sub-agent identity files (AGENTS.md, SOUL.md, IDENTITY.md, etc.)
- `docs/` — reference docs (credentials-registry, reference, workflows, specs)
- Root config files: `AGENTS.md`, `SOUL.md`, `IDENTITY.md`, `USER.md`, `HEARTBEAT.md`, `MEMORY.md`, `TOOLS.md`, `LEARNINGS.md`

**Not included (too large / environment-specific):**
- `work/` — 1.4GB of project files. Migrate separately or pull from git.
- `google-auth/` — OAuth tokens. Must be re-authorized on new server.
- `venv/` — Python virtualenvs. Rebuild on new server.
- Actual credential files from `/home/clawd/secrets/`. Re-provision separately.

---

## Step 1 — Install OpenClaw

```bash
npm install -g openclaw
openclaw setup
```

Follow the setup wizard. This creates `~/.openclaw/` and sets up the `clawd` user and agent runtime.

---

## Step 2 — Extract the Workspace

```bash
# Place the zip in the openclaw workspace root
unzip ce-workspace-migration.zip -d ~/.openclaw/workspace/
```

The workspace directory should be: `/root/.openclaw/workspace/` (or wherever OpenClaw sets it — check `openclaw status`).

---

## Step 3 — Install System Dependencies

### Node.js packages
```bash
npm install -g vercel
```

### Python packages (per-agent venvs)
```bash
cd ~/.openclaw/workspace
python3 -m venv venv
source venv/bin/activate
pip install google-auth google-auth-oauthlib google-auth-httplib2 \
            google-api-python-client notion-client requests playwright
playwright install chromium
```

Also set up Thibault's venv:
```bash
cd ~/.openclaw/workspace/agents/thibault
python3 -m venv venv
source venv/bin/activate
pip install google-auth google-auth-oauthlib google-auth-httplib2 \
            google-api-python-client playwright requests
playwright install chromium
```

### Playwright CLI
```bash
npm install -g playwright
playwright install chromium
```

### GitHub CLI
```bash
apt install gh -y
gh auth login  # authenticate as assafdagan20205
```

### xurl (X/Twitter CLI)
```bash
npm install -g xurl
xurl config  # configure with X API keys
```

---

## Step 4 — Configure Secrets

Create the secrets directory structure and populate each file:

```
/home/clawd/secrets/
├── notion/
│   └── api_key          ← Notion integration token
├── figma/
│   └── api_token        ← Figma personal access token
├── openai/
│   └── api_key          ← OpenAI API key
└── github/
    └── danpeg-lobster-pat  ← GitHub PAT
```

### ~/.bashrc additions
```bash
export GEMINI_API_KEY="<your-gemini-key>"
export RECRAFT_API_KEY="<your-recraft-key>"
export OPENAI_API_KEY="$(cat /home/clawd/secrets/openai/api_key)"
```

> ⚠️ All API keys must be re-issued or transferred from the old server.  
> Reference: `docs/credentials-registry.md` for what each key is used for and how to test it.

---

## Step 5 — Google OAuth Re-Authorization

The Google tokens are user-specific and cannot be copied. Re-authorize on the new server:

```bash
cd ~/.openclaw/workspace
source venv/bin/activate

# Kitt workspace account (kitt@curiousendeavor.com)
python3 google-auth/authorize.py  # or equivalent auth script
# Token saves to: google-auth/token.json

# Personal account (assafdagancos@gmail.com)  
# Token saves to: google-auth/token-personal.json
```

OAuth client credentials are in `google-auth/credentials.json` (included in zip).

---

## Step 6 — Discord Bot Configuration

Discord bot tokens are managed by OpenClaw internally. Configure via `openclaw.json` or the OpenClaw dashboard:

- Kitt bot token
- Anton, Gerri, Ogilvy, Tatiana, Julia, Jessica, Thibault, Kittoro bot tokens
- Guild ID: `1467974388581273603`
- Team webhook: configure in OpenClaw channel settings

---

## Step 7 — Memory & State

### Initialize QMD
```bash
mkdir -p ~/.openclaw/workspace/memory/qmd
echo '{"tasks":[],"decisions":[],"blockers":[],"entities":{},"next_steps":[]}' \
  > ~/.openclaw/workspace/memory/qmd/current.json
```

### Daily memory files
```bash
mkdir -p ~/.openclaw/workspace/memory
```
Kitt will create `memory/YYYY-MM-DD.md` files automatically as it works.

---

## Step 8 — Verify Skills

```bash
ls ~/.openclaw/workspace/skills/
cat ~/.openclaw/workspace/skills/REGISTRY.md
```

60 skills should be present. Key skills to verify:
- `visual-competitive-analysis/` — used for eToro competitor pages
- `frontend-design/` — UI generation
- `gws-*/` — Google Workspace integrations
- `last30days/` — research/intelligence
- `shutdown/` — end-of-day protocol
- `personal-radar/` — morning briefing

---

## Step 9 — Verify Scripts

```bash
ls ~/.openclaw/workspace/scripts/core/
```

Key scripts:
| Script | Purpose |
|--------|---------|
| `auto-compact-sessions.py` | Compress old session context |
| `check-kitt-email.py` | Pull kitt@ email |
| `qmd-compact.py` | Archive completed QMD tasks |
| `heartbeat-day.sh` | Daytime heartbeat trigger |
| `heartbeat-night.sh` | Nighttime heartbeat |
| `memory-compact-monthly.py` | Monthly memory dedup |

---

## Step 10 — Boot Test

Start an OpenClaw session and send Kitt this message:

```
/status
```

Kitt should:
1. Read `memory/qmd/current.json`
2. Read `LEARNINGS.md`
3. Read `skills/REGISTRY.md`
4. Read today's memory log
5. Report status without errors

If she reports missing credentials or missing files, consult `docs/credentials-registry.md` for what's needed.

---

## Agent Identity Files

Each sub-agent has a folder under `agents/` with these files:

| File | Purpose |
|------|---------|
| `AGENTS.md` | Boot sequence + memory architecture |
| `SOUL.md` | Persona, voice, behavior rules |
| `IDENTITY.md` | Name, role, capabilities, team |
| `HEARTBEAT.md` | Operational rules |
| `TOOLS.md` | Tool access + patterns |
| `USER.md` | Assaf's profile (shared across all agents) |

These are loaded as system context when each agent is spawned.

---

## Key IDs & References (non-sensitive)

| Item | Value |
|------|-------|
| Discord Guild ID | `1467974388581273603` |
| Notion Bot Memory Page | `2f1330c2-8646-81c6-8c7b-e328bc6466eb` |
| CE Google OAuth Project | `clawdbot-permissions` |
| Vercel project | `assafdagan20205/ce-website` |
| CE Website (live) | `ce-website-peach.vercel.app` |
| Public workspace path | `/root/.openclaw/workspace/public/` (separate git repo) |

---

## Active Channel IDs (Discord)

| Channel | ID |
|---------|----|
| #management | *(check guild)* |
| #open-tasks | *(check guild)* |
| #curious-endeavor | `1467975707106738290` |
| #kittoro-comms | `1480887689195819078` |
| #radar | *(check guild)* |

---

## What NOT to Do (from LEARNINGS.md)

- ❌ Never post screenshots or images in Discord channels
- ❌ Never use `browser` tool for screenshots — use `web_fetch`
- ❌ Never send emails without Assaf's explicit approval
- ❌ Never generate "strategic ideas" as heartbeat filler — if nothing to do → `HEARTBEAT_OK`
- ❌ Never do creative work yourself — always delegate through Gerri
- ❌ Never scan channels inactive >2 days (saves tokens)
- ❌ Never claim "done" without checking live output

---

## Migration Checklist

- [ ] OpenClaw installed + configured
- [ ] Workspace zip extracted to correct path
- [ ] Python venvs created + packages installed
- [ ] Playwright installed (chromium)
- [ ] Secrets files populated (`/home/clawd/secrets/`)
- [ ] `~/.bashrc` env vars set (GEMINI, RECRAFT, OPENAI)
- [ ] Google OAuth re-authorized (both accounts)
- [ ] Discord bot tokens configured in OpenClaw
- [ ] QMD initialized (`memory/qmd/current.json`)
- [ ] Boot test passed (`/status` → no errors)
- [ ] Skills verified (60 present)
- [ ] Scripts verified (core/ folder intact)

---

*Generated: 2026-03-16 | Source: /root/.openclaw/workspace/MIGRATION.md*
