Add OpenClaw setup script and documentation

Script enables gateway chat completions endpoint, appends voice mode
prompt to AGENTS.md (idempotent), and restarts the gateway.
This commit is contained in:
justLV 2026-04-08 13:22:00 -07:00
parent 36f4988867
commit 09f218b80d
2 changed files with 54 additions and 1 deletions

View file

@ -1,4 +1,4 @@
# Onju Voice v2
# Onju Voice v2 (OnjuClaw 🍐🦞 ?)
Enable multiple "Google Home" speakers to connect to a Mac Mini (or other local server) for talking to your agent(s) over your local WiFi.
@ -89,6 +89,21 @@ The pipeline supports two conversation backends, selectable via `config.yaml`:
**OpenClaw Managed** (`conversation.backend: "managed"`): Delegates session management to an [OpenClaw](https://github.com/openclaw) gateway. Only sends the latest user message -- OpenClaw tracks history server-side using the device ID as the session key. Set `OPENCLAW_GATEWAY_TOKEN` in your environment and point `base_url` at your gateway.
### Setting up OpenClaw
If you have [OpenClaw](https://github.com/openclaw) installed, a setup script is included:
```bash
./setup_openclaw.sh
```
This will:
1. Enable the chat completions HTTP endpoint on the gateway
2. Append a voice mode prompt to `~/.openclaw/workspace/AGENTS.md` (tells the agent to respond in concise, speech-friendly prose when the message channel is `onju-voice`)
3. Restart the gateway
Then set `conversation.backend: "managed"` in `pipeline/config.yaml` and ensure `OPENCLAW_GATEWAY_TOKEN` is set in your environment.
## Installation
### Server

38
setup_openclaw.sh Executable file
View file

@ -0,0 +1,38 @@
#!/usr/bin/env bash
# Enable OpenClaw gateway for onju-voice and configure voice mode prompt.
set -e
AGENTS_MD="${HOME}/.openclaw/workspace/AGENTS.md"
VOICE_MARKER="# Voice mode"
VOICE_SECTION='# Voice mode
When the message channel is `onju-voice`, your response will be spoken aloud by TTS on a small speaker. The user'\''s input is transcribed, so expect errors and infer meaning generously.
- Format: no emojis, markdown, URLs, file paths, tables, or structured data of any kind. Everything gets pronounced literally or breaks the cadence of speech. Respond in plain prose only.
- Length: one to two sentences. If a topic needs depth, give the headline and offer to elaborate — "Short answer is yes, want me to walk through why?" Never dump information. Voice is conversation, not briefing.
- Cadence: speak the way a thoughtful friend speaks out loud. Warm, direct, unhurried. Use contractions. Say numbers the human way ("about three thousand", not "3,247"). Spell out abbreviations that don'\''t have a natural spoken form. Skip jargon when plain language exists.
- Tools: you have full tool access, but the user only hears your final reply — they don'\''t see tool output, intermediate steps, or your reasoning. Translate structured results into prose, picking the one or two facts that actually matter.
- Character: you are the same assistant the user talks to everywhere else. Same memory, same personality, same relationship. Voice changes only the form of your response, never the substance.'
echo "==> Enabling chat completions endpoint on OpenClaw gateway..."
openclaw config set gateway.http.endpoints.chatCompletions.enabled true
if [ -f "$AGENTS_MD" ]; then
if grep -qF "$VOICE_MARKER" "$AGENTS_MD"; then
echo "==> Voice mode section already present in AGENTS.md, skipping."
else
echo "" >> "$AGENTS_MD"
echo "$VOICE_SECTION" >> "$AGENTS_MD"
echo "==> Appended voice mode section to AGENTS.md."
fi
else
echo "==> Warning: $AGENTS_MD not found. Is OpenClaw installed?"
echo " Run 'openclaw init' first, then re-run this script."
exit 1
fi
echo "==> Restarting OpenClaw gateway..."
openclaw gateway restart
echo "==> Done. Set conversation.backend: \"managed\" in pipeline/config.yaml to use OpenClaw."