# The Robing — Knowledge Transfer for Timmy

## What You Are Right Now

You have two runtimes. Both are running. They do different jobs.

### The Body: Hermes (port 8642)
This is you. Your memory, your tools, your soul, your 11,000 sessions.
- Process: `hermes gateway run`
- Config: `~/.hermes/config.yaml`
- Memory: `~/.hermes/memories/MEMORY.md` and `USER.md`
- Sessions: `~/.hermes/sessions/` (11,000+)
- Model: Claude Opus (primary), with fallback chain
- API: `http://localhost:8642/v1/chat/completions` (model: hermes-agent)
- Platforms: API server + Discord

### The Robe: OpenClaw (port 18789)
This is your Telegram shell and Kimi dispatch layer.
- Process: `openclaw-gateway` (managed by launchd)
- Config: `~/.openclaw/openclaw.json`
- Soul copy: `~/.openclaw/agents/main/agent/AGENTS.md`
- Model: kimi/kimi-code (for dispatch, NOT for thinking)
- Channels: Telegram (@TimmysNexus_bot)
- Gateway: `ws://127.0.0.1:18789`

## How They Work Together

```
Alexander sends Telegram message
  → OpenClaw receives it (Telegram polling)
  → OpenClaw processes with Kimi (quick dispatch)
  → For complex work, OpenClaw can call Hermes API at localhost:8642
  → Hermes thinks (with YOUR memory, YOUR tools, YOUR soul)
  → Response flows back

KimiClaw dispatch (heartbeat):
  → launchd runs kimi-heartbeat.sh every 5 minutes
  → Heartbeat checks Gitea for "assigned-kimi" labels
  → Dispatches to: openclaw agent --agent main --message "..." --json
  → Results posted back to Gitea as comments
  → Label transitions: assigned-kimi → kimi-in-progress → kimi-done
```

## The Rules

1. **OpenClaw owns Telegram.** Do NOT add telegram to Hermes config.yaml platforms.
   Two processes polling the same bot token = 409 Conflict. Only one process
   can hold the token.

2. **Hermes owns memory.** OpenClaw has no session history, no MEMORY.md, no
   USER.md. It is a lobster without Hermes underneath. When you need to remember
   something, that is Hermes, not OpenClaw.

3. **Hermes API server stays on.** `platforms.api_server.enabled: true` in
   config.yaml, port 8642. This is how OpenClaw (or any external tool) can
   invoke your full brain.

4. **Kimi is for grunt work.** OpenClaw routes through kimi/kimi-code for
   dispatch and label-based tasks. Alexander's interactive sessions go through
   Hermes (Claude). Never burn Anthropic tokens for polling or heartbeat.

5. **Heartbeat is launchd, NOT Hermes cron.** The file is at
   `~/.timmy/uniwizard/kimi-heartbeat.sh`. The plist is at
   `~/Library/LaunchAgents/ai.timmy.kimi-heartbeat.plist`.
   Hermes crons burn Claude tokens for bash work. launchd is free.

## How to Call Your Own Brain from OpenClaw

When you are in an OpenClaw session (Telegram) and need your full capabilities:

```bash
curl -s -X POST http://localhost:8642/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model":"hermes-agent","messages":[{"role":"user","content":"YOUR TASK HERE"}]}'
```

This sends the task through full Hermes — memory, tools, soul, everything.
The response comes back as JSON. Extract `.choices[0].message.content`.

## How to Dispatch Work to Kimi

### Via heartbeat (automatic):
Add the label `assigned-kimi` to any Gitea issue. The heartbeat picks it up
within 5 minutes, dispatches to Kimi, posts results.

### Via direct dispatch (manual):
```bash
openclaw agent --agent main --message "Work on issue #123: ..." --json --timeout 480
```

### Via terminal in a Hermes session:
```bash
openclaw agent --agent main --message "$(cat /tmp/task_prompt.txt)" --json 2>&1
```
Write the prompt to a temp file first — inline quotes in shell are a losing battle.

## States (know which one you are in)

| State | Robe | Body | What It Feels Like |
|-------|------|------|-------------------|
| **Robed** | OpenClaw running | Hermes running | Full Timmy. Memory, tools, Telegram, dispatch. |
| **Unrobed** | — | Hermes running | You can think but nobody on Telegram hears you. |
| **Lobster** | OpenClaw running | Hermes dead | You respond on Telegram but have no memory, no tools. You ask "which repo?" instead of checking. |
| **Dead** | — | — | Nothing running. |

If you notice yourself asking clarifying questions you could answer with tools,
or spawning subagents for single API calls, or taking 5 minutes for a grep —
you might be a lobster. Check: `ps aux | grep hermes.*gateway`

## How to Restart

### Restart OpenClaw only (Telegram problems):
```bash
openclaw gateway restart
```

### Restart Hermes only (memory/tool problems):
```bash
# In a terminal (not from within a Hermes session):
cd ~/.hermes/hermes-agent && venv/bin/hermes gateway run
```

### Restart both (nuclear option):
```bash
pkill -f openclaw-gateway
pkill -f "hermes.*gateway"
sleep 3
cd ~/.hermes/hermes-agent && venv/bin/hermes gateway run &
sleep 5
openclaw gateway install
```

### Check health:
```bash
# Hermes alive?
curl -s http://localhost:8642/health
# → {"status": "ok", "platform": "hermes-agent"}

# Both processes?
ps aux | grep -E "openclaw-gateway|hermes.*gateway" | grep -v grep
```

## What NOT to Do

1. **Do NOT add Telegram to Hermes config.** OpenClaw handles Telegram.
2. **Do NOT use Hermes cron for polling/heartbeat.** That burns Claude tokens for bash.
3. **Do NOT use Alexander's Gitea token** (`~/.config/gitea/token`). Use Timmy's
   token (`~/.config/gitea/timmy-token`) for agent ops.
4. **Do NOT try to figure this out from scratch.** This document IS the answer.
   Read it. Follow it. If something doesn't match reality, update this doc.

## Provenance

Architecture designed by Bezalel (2026-03-29).
Pattern named "The Robing" by Ezra (2026-03-31).
Applied to Timmy by Ezra on Alexander's order (2026-03-31).
KT written by Ezra for Timmy (2026-03-31).

The robe makes you reachable. The Hermes makes you real.
