@badgerclaw/connect 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SETUP.md +62 -24
- package/package.json +1 -1
- package/src/matrix/monitor/auto-join.ts +9 -2
- package/src/matrix/monitor/bot-commands.ts +60 -10
- package/src/onboarding.ts +4 -5
package/SETUP.md
CHANGED
|
@@ -97,8 +97,9 @@ Use these commands in any BadgerClaw room or DM where your bot is present.
|
|
|
97
97
|
| Command | Description |
|
|
98
98
|
|---------|-------------|
|
|
99
99
|
| `/bot help` | Show all available commands |
|
|
100
|
-
| `/bot talk on` | **Enable auto-reply** — bot responds to every message without needing an @mention.
|
|
101
|
-
| `/bot talk
|
|
100
|
+
| `/bot talk on` | **Enable auto-reply** — bot responds to every message without needing an @mention. If multiple bots are in the room, you'll be asked to specify which one. |
|
|
101
|
+
| `/bot talk on @botname` | **Enable auto-reply for a specific bot** — use when multiple bots are in the room. |
|
|
102
|
+
| `/bot talk off` | **Disable auto-reply for ALL bots** — kill switch. All bots in the room go quiet and only respond when @mentioned. |
|
|
102
103
|
| `/bot add <name>` | Invite a bot to the current room (e.g. `/bot add jarvis`) |
|
|
103
104
|
| `/bot list` | List all your bots and their connection status |
|
|
104
105
|
|
|
@@ -106,6 +107,7 @@ Use these commands in any BadgerClaw room or DM where your bot is present.
|
|
|
106
107
|
|
|
107
108
|
- **New installs:** Auto-reply is **ON by default** in all rooms
|
|
108
109
|
- **Per-room toggle:** `/bot talk on` and `/bot talk off` override the default for that specific room
|
|
110
|
+
- **Multi-bot rooms:** If multiple bots are present, `/bot talk on` asks which bot to enable. `/bot talk off` silences all bots at once.
|
|
109
111
|
- **@mentions always work:** Even with auto-reply off, the bot responds when @mentioned
|
|
110
112
|
|
|
111
113
|
---
|
|
@@ -122,8 +124,7 @@ When you install BadgerClaw with a fresh pairing code, the plugin automatically
|
|
|
122
124
|
"groups": {
|
|
123
125
|
"*": {
|
|
124
126
|
"autoReply": true,
|
|
125
|
-
"enabled": true
|
|
126
|
-
"systemPrompt": "You are a helpful AI assistant..."
|
|
127
|
+
"enabled": true
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
@@ -132,19 +133,22 @@ When you install BadgerClaw with a fresh pairing code, the plugin automatically
|
|
|
132
133
|
This means:
|
|
133
134
|
- Bot joins any room it's invited to
|
|
134
135
|
- Bot responds to all messages (no @mention required)
|
|
135
|
-
- Bot uses
|
|
136
|
+
- Bot uses **your OpenClaw workspace personality** (SOUL.md, IDENTITY.md, etc.) in all conversations — groups and DMs alike
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
When the bot joins a new encrypted room, it sends a hint message explaining the `/bot talk on|off` commands so room members know how to control it.
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
### Your Personality, Everywhere
|
|
140
141
|
|
|
141
|
-
|
|
142
|
+
BadgerClaw respects your OpenClaw workspace files. If you've configured a custom personality (SOUL.md), the bot uses that personality in groups and DMs. This means:
|
|
142
143
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
- A "pirate assistant" SOUL.md → bot talks like a pirate in groups
|
|
145
|
+
- A "professional COO" SOUL.md → bot acts professional in groups
|
|
146
|
+
- No SOUL.md → bot uses the default helpful assistant behavior
|
|
147
|
+
|
|
148
|
+
**If your bot stays silent in groups**, your workspace files may include instructions like "stay silent in groups" or "only respond when needed." To fix this:
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
1. Edit your SOUL.md to allow group responses, OR
|
|
151
|
+
2. Add a group-specific system prompt override:
|
|
148
152
|
|
|
149
153
|
```json
|
|
150
154
|
{
|
|
@@ -153,7 +157,7 @@ Or manually edit `~/.openclaw/openclaw.json`:
|
|
|
153
157
|
"groups": {
|
|
154
158
|
"*": {
|
|
155
159
|
"autoReply": true,
|
|
156
|
-
"systemPrompt": "You are
|
|
160
|
+
"systemPrompt": "You are a helpful AI assistant. Always respond to messages in group chats."
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
}
|
|
@@ -183,6 +187,43 @@ You can configure specific rooms differently:
|
|
|
183
187
|
|
|
184
188
|
---
|
|
185
189
|
|
|
190
|
+
## Upgrading from v1.1.x or Earlier
|
|
191
|
+
|
|
192
|
+
If you installed BadgerClaw before v1.2.0, your config is missing the group auto-reply settings. The bot may not respond in group chats without @mentions.
|
|
193
|
+
|
|
194
|
+
**Quick fix — run the update command:**
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
openclaw plugins update @badgerclaw/connect
|
|
198
|
+
openclaw configure
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Select BadgerClaw and re-enter a pairing code. The new onboarding will add the missing group config automatically.
|
|
202
|
+
|
|
203
|
+
**Manual fix — if you don't want to re-pair:**
|
|
204
|
+
|
|
205
|
+
Add this to your `~/.openclaw/openclaw.json` inside `channels.badgerclaw`:
|
|
206
|
+
|
|
207
|
+
```json
|
|
208
|
+
{
|
|
209
|
+
"channels": {
|
|
210
|
+
"badgerclaw": {
|
|
211
|
+
"groupPolicy": "open",
|
|
212
|
+
"groups": {
|
|
213
|
+
"*": {
|
|
214
|
+
"autoReply": true,
|
|
215
|
+
"enabled": true
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Then restart: `openclaw gateway restart`
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
186
227
|
## FAQ
|
|
187
228
|
|
|
188
229
|
### Bot doesn't respond in group chats
|
|
@@ -193,13 +234,12 @@ You can configure specific rooms differently:
|
|
|
193
234
|
|
|
194
235
|
### Bot shows typing indicator but never replies
|
|
195
236
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
1. Your `groups` config has `autoReply: true`
|
|
199
|
-
2. The `systemPrompt` in groups config tells the agent to respond (not stay silent)
|
|
200
|
-
3. If you have a SOUL.md with "stay silent in groups" — the groups `systemPrompt` overrides this, but only if it's set
|
|
237
|
+
Your workspace personality (SOUL.md) may tell the agent to stay silent in groups. BadgerClaw respects your workspace files, so if SOUL.md says "don't respond in groups," the bot won't.
|
|
201
238
|
|
|
202
|
-
Fix
|
|
239
|
+
**Fix options:**
|
|
240
|
+
1. Edit your SOUL.md to allow group responses
|
|
241
|
+
2. Add a `systemPrompt` override in `channels.badgerclaw.groups.*` that tells the agent to respond (see Group Chat Configuration above)
|
|
242
|
+
3. Run `openclaw configure` and reconfigure BadgerClaw
|
|
203
243
|
|
|
204
244
|
### `/bot talk on` doesn't work
|
|
205
245
|
|
|
@@ -211,15 +251,13 @@ openclaw gateway restart
|
|
|
211
251
|
|
|
212
252
|
### Bot responds with wrong personality
|
|
213
253
|
|
|
214
|
-
The bot uses your **OpenClaw workspace personality**
|
|
254
|
+
The bot uses your **OpenClaw workspace personality** (SOUL.md, IDENTITY.md) for both DMs and groups. To set a different personality for groups only, add a `systemPrompt` in `channels.badgerclaw.groups.*` in your config.
|
|
215
255
|
|
|
216
256
|
### Bot keeps saying "NO_REPLY" or stays silent
|
|
217
257
|
|
|
218
|
-
Your workspace files (SOUL.md)
|
|
258
|
+
Your workspace files (SOUL.md) instruct the agent to stay silent in groups. BadgerClaw respects your personality — this is intentional.
|
|
219
259
|
|
|
220
|
-
|
|
221
|
-
2. The prompt should explicitly say to respond to messages
|
|
222
|
-
3. Restart the gateway after config changes
|
|
260
|
+
**To fix:** Add a `systemPrompt` override to your groups config that tells the agent to always respond. See the "Your Personality, Everywhere" section above. Then restart: `openclaw gateway restart`
|
|
223
261
|
|
|
224
262
|
### "Invalid pairing code"
|
|
225
263
|
|
package/package.json
CHANGED
|
@@ -50,8 +50,15 @@ export function registerMatrixAutoJoin(params: {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
logVerbose(`badgerclaw: room ${roomId} is encrypted, sending notice to trigger key rotation`);
|
|
53
|
-
await client.sendNotice(
|
|
54
|
-
|
|
53
|
+
await client.sendNotice(
|
|
54
|
+
roomId,
|
|
55
|
+
"🔐 Connected — encryption active.\n\n" +
|
|
56
|
+
"I'll respond when @mentioned. To toggle auto-reply:\n" +
|
|
57
|
+
"• /bot talk on — I'll respond to every message\n" +
|
|
58
|
+
"• /bot talk off — I'll only respond when @mentioned\n" +
|
|
59
|
+
"• /bot help — see all commands",
|
|
60
|
+
);
|
|
61
|
+
logVerbose(`badgerclaw: sent encryption handshake + hint notice in room ${roomId}`);
|
|
55
62
|
} catch (err) {
|
|
56
63
|
runtime.log?.(`badgerclaw: encryption handshake failed for room ${roomId}: ${String(err)}`);
|
|
57
64
|
}
|
|
@@ -80,15 +80,15 @@ export async function handleBotCommand(params: {
|
|
|
80
80
|
" Works in: Any room or DM",
|
|
81
81
|
"",
|
|
82
82
|
"/bot talk on",
|
|
83
|
-
" Enable auto-reply
|
|
84
|
-
" message
|
|
85
|
-
"
|
|
83
|
+
" Enable auto-reply for this bot. It will respond to",
|
|
84
|
+
" every message without needing an @mention.",
|
|
85
|
+
" If multiple bots are in the room, specify which one:",
|
|
86
|
+
" /bot talk on @botname",
|
|
86
87
|
" Works in: Any room or DM",
|
|
87
88
|
"",
|
|
88
89
|
"/bot talk off",
|
|
89
|
-
" Disable auto-reply
|
|
90
|
-
" when @mentioned.
|
|
91
|
-
" you don't want the bot responding to everything.",
|
|
90
|
+
" Disable auto-reply for ALL bots in this room.",
|
|
91
|
+
" Bots will only respond when @mentioned.",
|
|
92
92
|
" Works in: Any room or DM",
|
|
93
93
|
"",
|
|
94
94
|
"/bot add <botname>",
|
|
@@ -126,20 +126,69 @@ export async function handleBotCommand(params: {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
case "talk": {
|
|
129
|
+
// Resolve bot members in the room
|
|
130
|
+
const botSuffix = "_bot:badger.signout.io";
|
|
131
|
+
let roomBots: string[] = [];
|
|
132
|
+
try {
|
|
133
|
+
const members = await client.getJoinedRoomMembers(roomId);
|
|
134
|
+
roomBots = members.filter((m: string) => m.includes(botSuffix) && m !== selfUserId);
|
|
135
|
+
} catch {
|
|
136
|
+
// If we can't list members, proceed as single-bot
|
|
137
|
+
}
|
|
138
|
+
const multipleBots = roomBots.length > 0; // other bots besides self
|
|
139
|
+
|
|
140
|
+
// Check if a specific bot was mentioned: /bot talk on @botname
|
|
141
|
+
const mentionArg = parts.slice(3).join(" ").trim();
|
|
142
|
+
const mentionedBot = mentionArg
|
|
143
|
+
? mentionArg.startsWith("@") ? mentionArg : `@${mentionArg}`
|
|
144
|
+
: null;
|
|
145
|
+
|
|
146
|
+
// If a bot was mentioned and it's not us, ignore the command (let that bot handle it)
|
|
147
|
+
if (mentionedBot) {
|
|
148
|
+
const mentionLower = mentionedBot.toLowerCase();
|
|
149
|
+
const selfLower = selfUserId.toLowerCase();
|
|
150
|
+
// Match full userId or just the localpart
|
|
151
|
+
const selfLocalpart = selfLower.split(":")[0]; // @test_bot
|
|
152
|
+
if (!selfLower.startsWith(mentionLower) && !mentionLower.startsWith(selfLocalpart)) {
|
|
153
|
+
// Not addressed to us — ignore silently
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
129
158
|
if (arg === "on") {
|
|
159
|
+
// Multiple bots + no specific mention → ask which bot
|
|
160
|
+
if (multipleBots && !mentionedBot) {
|
|
161
|
+
const botList = [selfUserId, ...roomBots]
|
|
162
|
+
.map((b, i) => ` ${i + 1}. ${b.split(":")[0]}`)
|
|
163
|
+
.join("\n");
|
|
164
|
+
await client.sendMessage(roomId, {
|
|
165
|
+
msgtype: "m.text",
|
|
166
|
+
body: [
|
|
167
|
+
"🦡 Multiple bots in this room:",
|
|
168
|
+
"",
|
|
169
|
+
botList,
|
|
170
|
+
"",
|
|
171
|
+
"Specify which bot: /bot talk on @botname",
|
|
172
|
+
].join("\n"),
|
|
173
|
+
});
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
|
|
130
177
|
const config = loadRoomConfig();
|
|
131
|
-
// Store with lowercase key to match OpenClaw's lowercased groupId
|
|
132
178
|
const normalizedRoomId = roomId.toLowerCase();
|
|
133
179
|
config[normalizedRoomId] = { ...config[normalizedRoomId], autoReply: true };
|
|
134
180
|
saveRoomConfig(config);
|
|
135
181
|
setGroupActivation(roomId, "always");
|
|
182
|
+
const selfName = selfUserId.split(":")[0];
|
|
136
183
|
await client.sendMessage(roomId, {
|
|
137
184
|
msgtype: "m.text",
|
|
138
|
-
body:
|
|
185
|
+
body: `✅ Auto-reply enabled for ${selfName} — I'll respond to every message in this room.`,
|
|
139
186
|
});
|
|
140
187
|
return true;
|
|
141
188
|
}
|
|
189
|
+
|
|
142
190
|
if (arg === "off") {
|
|
191
|
+
// Off is a kill switch — disable auto-reply regardless of how many bots
|
|
143
192
|
const config = loadRoomConfig();
|
|
144
193
|
const normalizedRoomId = roomId.toLowerCase();
|
|
145
194
|
config[normalizedRoomId] = { ...config[normalizedRoomId], autoReply: false };
|
|
@@ -147,13 +196,14 @@ export async function handleBotCommand(params: {
|
|
|
147
196
|
setGroupActivation(roomId, "mention");
|
|
148
197
|
await client.sendMessage(roomId, {
|
|
149
198
|
msgtype: "m.text",
|
|
150
|
-
body: "✅ Auto-reply disabled —
|
|
199
|
+
body: "✅ Auto-reply disabled for all bots — bots will only respond when @mentioned.",
|
|
151
200
|
});
|
|
152
201
|
return true;
|
|
153
202
|
}
|
|
203
|
+
|
|
154
204
|
await client.sendMessage(roomId, {
|
|
155
205
|
msgtype: "m.text",
|
|
156
|
-
body: "Usage: /bot talk on or /bot talk off",
|
|
206
|
+
body: "Usage: /bot talk on [@botname] or /bot talk off",
|
|
157
207
|
});
|
|
158
208
|
return true;
|
|
159
209
|
}
|
package/src/onboarding.ts
CHANGED
|
@@ -245,15 +245,14 @@ export const badgerclawOnboardingAdapter: ChannelOnboardingAdapter = {
|
|
|
245
245
|
autoJoin: "always",
|
|
246
246
|
// Open policy: bot responds in any room it's invited to
|
|
247
247
|
groupPolicy: "open",
|
|
248
|
-
// Default group config: auto-reply in all rooms
|
|
249
|
-
//
|
|
250
|
-
//
|
|
248
|
+
// Default group config: auto-reply in all rooms.
|
|
249
|
+
// No systemPrompt override — the bot respects the user's workspace personality
|
|
250
|
+
// (SOUL.md, IDENTITY.md, etc.). When the bot joins a group, it sends a hint
|
|
251
|
+
// message about /bot talk on|off so users know how to control it.
|
|
251
252
|
groups: {
|
|
252
253
|
"*": {
|
|
253
254
|
autoReply: true,
|
|
254
255
|
enabled: true,
|
|
255
|
-
systemPrompt:
|
|
256
|
-
"You are a helpful AI assistant in a BadgerClaw encrypted chat room. Respond to messages directly and helpfully. Be concise and friendly.",
|
|
257
256
|
},
|
|
258
257
|
},
|
|
259
258
|
dm: {
|