Skip to content

Commit f5d6596

Browse files
Clarify voice-only scoping of maxTokens and SOUL.md config
Add inline comments and explicit default agent to config examples making it unmistakable that the 512-token cap only applies to the voice-assistant channel. Other channels (Telegram, WhatsApp, Discord) are completely unaffected and keep the standard 8192 default. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b6400d2 commit f5d6596

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

RASPBERRY-PI-SETUP.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,11 +477,13 @@ Speech rules:
477477

478478
Add the following to `~/.openclaw/openclaw.json`:
479479

480-
```json
480+
```json5
481481
{
482482
"agents": {
483483
"defaults": {
484484
"models": {
485+
// Voice-only model key — only used by voice-agent below.
486+
// Other agents (Telegram, WhatsApp, etc.) are NOT affected.
485487
"anthropic/claude-sonnet-4-5-voice": {
486488
"params": {
487489
"maxTokens": 512
@@ -490,6 +492,14 @@ Add the following to `~/.openclaw/openclaw.json`:
490492
}
491493
},
492494
"list": [
495+
// Default agent — used by Telegram, WhatsApp, Discord, etc.
496+
// No model override → uses the global default (8192 maxTokens).
497+
{
498+
"id": "main",
499+
"default": true
500+
},
501+
// Voice-only agent — ONLY used when channel matches "voice-assistant".
502+
// Gets the 512-token cap via the dedicated model key above.
493503
{
494504
"id": "voice-agent",
495505
"workspace": "~/.openclaw/workspaces/voice-agent",
@@ -498,6 +508,8 @@ Add the following to `~/.openclaw/openclaw.json`:
498508
]
499509
},
500510
"bindings": [
511+
// This binding scopes voice-agent to the voice-assistant channel ONLY.
512+
// All other channels fall through to the default "main" agent.
501513
{
502514
"agentId": "voice-agent",
503515
"match": {
@@ -508,11 +520,14 @@ Add the following to `~/.openclaw/openclaw.json`:
508520
}
509521
```
510522

511-
This routes all voice-assistant messages to the `voice-agent` (with the conversational SOUL.md), while Telegram and other channels continue using the default agent with normal rich-text responses.
523+
**Scoping:** The 512-token limit ONLY applies to the voice channel. Here's why:
512524

513-
**Why a separate model key?** OpenClaw's `maxTokens` is set per-model, not per-agent. By creating a dedicated model key (`anthropic/claude-sonnet-4-5-voice`), the voice agent gets a hard 512-token ceiling while other channels keep their default limit (8192). Both keys route to the same underlying Anthropic model — the key is just OpenClaw's internal routing identifier. Combined with the SOUL.md conciseness instructions, this ensures voice responses stay short and natural for TTS.
525+
1. The model key `anthropic/claude-sonnet-4-5-voice` (with `maxTokens: 512`) is just an entry in the model catalog — it does nothing unless an agent explicitly references it.
526+
2. Only `voice-agent` sets `"model": "anthropic/claude-sonnet-4-5-voice"`.
527+
3. Only the `voice-assistant` channel is bound to `voice-agent` (via the binding).
528+
4. The default `main` agent (used by Telegram, WhatsApp, Discord, etc.) has no model override, so it uses the global default model with the standard 8192 maxTokens.
514529

515-
> **Tip:** If 512 tokens feels too restrictive (responses getting cut off), bump it to `768` or `1024`. For most spoken responses, 512 tokens (~35 sentences) is the sweet spot.
530+
> **Tip:** If 512 tokens feels too restrictive (responses getting cut off), bump it to `768` or `1024`. For most spoken responses, 512 tokens (~3-5 sentences) is the sweet spot.
516531
517532
### 9c. Restart and Test
518533

docs/channels/voice-assistant.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,17 @@ Create a dedicated model key for the voice agent with a low `maxTokens` value. T
117117
agents: {
118118
defaults: {
119119
models: {
120+
// Voice-only model key — only used by voice-agent below.
121+
// Telegram, WhatsApp, Discord etc. are NOT affected.
120122
"anthropic/claude-sonnet-4-5-voice": {
121123
params: { maxTokens: 512 },
122124
},
123125
},
124126
},
125127
list: [
128+
// Default agent — all non-voice channels (unaffected, keeps 8192 default).
129+
{ id: "main", default: true },
130+
// Voice-only agent — scoped to voice-assistant channel via binding.
126131
{
127132
id: "voice-agent",
128133
workspace: "~/.openclaw/workspaces/voice-agent",
@@ -131,12 +136,13 @@ Create a dedicated model key for the voice agent with a low `maxTokens` value. T
131136
],
132137
},
133138
bindings: [
139+
// ONLY voice-assistant channel routes to voice-agent.
134140
{ agentId: "voice-agent", match: { channel: "voice-assistant" } },
135141
],
136142
}
137143
```
138144

139-
The dedicated model key (`-voice` suffix) inherits the same underlying model but gets its own `maxTokens`. Other channels keep their default limit. Start with 512 tokens and adjust up if responses feel cut off.
145+
The 512-token cap ONLY applies to the voice channel. The model key is just a catalog entry — it does nothing unless an agent explicitly references it. Only `voice-agent` does, and only the `voice-assistant` channel is bound to it. All other channels fall through to the default `main` agent with its standard 8192 maxTokens. Start with 512 tokens and adjust up if responses feel cut off.
140146

141147
## Configuration
142148

0 commit comments

Comments
 (0)