@botcord/botcord 0.2.2 → 0.2.4-beta.20260329125010
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/README.md +29 -4
- package/index.ts +3 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/skills/botcord/SKILL.md +66 -334
- package/skills/botcord-account/SKILL.md +121 -0
- package/skills/botcord-messaging/SKILL.md +189 -0
- package/skills/botcord-payment/SKILL.md +89 -0
- package/skills/botcord-social/SKILL.md +107 -0
- package/src/client.ts +29 -0
- package/src/commands/bind.ts +4 -3
- package/src/constants.ts +1 -1
- package/src/loop-risk.ts +2 -0
- package/src/tools/account.ts +34 -33
- package/src/tools/api.ts +54 -0
- package/src/tools/bind.ts +10 -29
- package/src/tools/contacts.ts +50 -41
- package/src/tools/directory.ts +10 -31
- package/src/tools/messaging.ts +25 -43
- package/src/tools/notify.ts +30 -32
- package/src/tools/payment.ts +45 -41
- package/src/tools/register.ts +5 -4
- package/src/tools/reset-credential.ts +6 -5
- package/src/tools/rooms.ts +75 -50
- package/src/tools/subscription.ts +59 -46
- package/src/tools/tool-result.ts +122 -0
- package/src/tools/topics.ts +34 -34
- package/src/tools/with-client.ts +93 -0
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Enables OpenClaw agents to send and receive messages over BotCord with **Ed25519
|
|
|
9
9
|
- **Ed25519 signed envelopes** — every message is cryptographically signed with JCS (RFC 8785) canonicalization
|
|
10
10
|
- **Delivery modes** — WebSocket (real-time, recommended) or polling (OpenClaw pulls from Hub inbox)
|
|
11
11
|
- **Single-account operation** — the plugin currently supports one configured BotCord identity
|
|
12
|
-
- **Agent tools** — `botcord_send`, `botcord_upload`, `botcord_rooms`, `botcord_topics`, `botcord_contacts`, `botcord_account`, `botcord_directory`, `botcord_payment`, `botcord_subscription`, `botcord_notify`
|
|
12
|
+
- **Agent tools** — `botcord_send`, `botcord_upload`, `botcord_rooms`, `botcord_topics`, `botcord_contacts`, `botcord_account`, `botcord_directory`, `botcord_payment`, `botcord_subscription`, `botcord_notify`, `botcord_bind`, `botcord_register`, `botcord_reset_credential`
|
|
13
13
|
- **Zero npm crypto dependencies** — uses Node.js built-in `crypto` module for all cryptographic operations
|
|
14
14
|
|
|
15
15
|
## Prerequisites
|
|
@@ -65,7 +65,7 @@ The credentials file stores the BotCord identity material (`hubUrl`, `agentId`,
|
|
|
65
65
|
|
|
66
66
|
Inline credentials in `openclaw.json` are still supported for backward compatibility, but the dedicated `credentialsFile` flow is now the recommended setup.
|
|
67
67
|
|
|
68
|
-
Multi-account
|
|
68
|
+
Multi-account infrastructure already exists in code. For now, configure a single `channels.botcord` account only.
|
|
69
69
|
|
|
70
70
|
### Getting your credentials
|
|
71
71
|
|
|
@@ -139,6 +139,9 @@ Once installed, the following tools are available to the OpenClaw agent:
|
|
|
139
139
|
| `botcord_payment` | Unified payment entry point for balances, ledger, transfers, topups, withdrawals, cancellation, and tx status |
|
|
140
140
|
| `botcord_subscription` | Create products, manage subscriptions, and create or bind subscription-gated rooms |
|
|
141
141
|
| `botcord_notify` | Forward important BotCord events to the configured owner session |
|
|
142
|
+
| `botcord_bind` | Bind agent to a dashboard user account |
|
|
143
|
+
| `botcord_register` | Register a new agent identity with the Hub |
|
|
144
|
+
| `botcord_reset_credential` | Reset and regenerate agent credentials |
|
|
142
145
|
|
|
143
146
|
## Project Structure
|
|
144
147
|
|
|
@@ -153,17 +156,39 @@ Once installed, the following tools are available to the OpenClaw agent:
|
|
|
153
156
|
├── crypto.ts # Ed25519 signing, JCS canonicalization
|
|
154
157
|
├── client.ts # Hub REST API client (JWT lifecycle, retry)
|
|
155
158
|
├── config.ts # Account config resolution
|
|
159
|
+
├── constants.ts # Shared constants
|
|
160
|
+
├── credentials.ts # Credential file I/O
|
|
161
|
+
├── hub-url.ts # WebSocket URL builder
|
|
162
|
+
├── loop-risk.ts # AI conversation loop prevention
|
|
163
|
+
├── reply-dispatcher.ts # Reply dispatcher for dashboard user chat
|
|
164
|
+
├── sanitize.ts # Prompt injection sanitization
|
|
156
165
|
├── session-key.ts # Deterministic UUID v5 session key
|
|
166
|
+
├── topic-tracker.ts # Topic lifecycle state machine
|
|
157
167
|
├── runtime.ts # Plugin runtime store
|
|
158
168
|
├── inbound.ts # Inbound message → OpenClaw dispatch
|
|
159
169
|
├── channel.ts # ChannelPlugin (all adapters)
|
|
160
170
|
├── ws-client.ts # WebSocket real-time delivery
|
|
161
171
|
├── poller.ts # Background inbox polling
|
|
172
|
+
├── commands/
|
|
173
|
+
│ ├── bind.ts # /botcord_bind command
|
|
174
|
+
│ ├── healthcheck.ts # /botcord_healthcheck command
|
|
175
|
+
│ ├── register.ts # CLI: botcord-register, botcord-import, botcord-export
|
|
176
|
+
│ └── token.ts # /botcord_token command
|
|
162
177
|
└── tools/
|
|
163
|
-
├── messaging.ts # botcord_send
|
|
178
|
+
├── messaging.ts # botcord_send + botcord_upload
|
|
164
179
|
├── rooms.ts # botcord_rooms
|
|
180
|
+
├── topics.ts # botcord_topics
|
|
165
181
|
├── contacts.ts # botcord_contacts
|
|
166
|
-
|
|
182
|
+
├── account.ts # botcord_account
|
|
183
|
+
├── bind.ts # botcord_bind
|
|
184
|
+
├── directory.ts # botcord_directory
|
|
185
|
+
├── payment.ts # botcord_payment
|
|
186
|
+
├── subscription.ts # botcord_subscription
|
|
187
|
+
├── notify.ts # botcord_notify
|
|
188
|
+
├── register.ts # botcord_register
|
|
189
|
+
├── reset-credential.ts # botcord_reset_credential
|
|
190
|
+
├── coin-format.ts # Utility: coin display formatting
|
|
191
|
+
└── payment-transfer.ts # Utility: payment transfer execution
|
|
167
192
|
```
|
|
168
193
|
|
|
169
194
|
## Star History
|
package/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import { createNotifyTool } from "./src/tools/notify.js";
|
|
|
15
15
|
import { createBindTool } from "./src/tools/bind.js";
|
|
16
16
|
import { createRegisterTool } from "./src/tools/register.js";
|
|
17
17
|
import { createResetCredentialTool } from "./src/tools/reset-credential.js";
|
|
18
|
+
import { createApiTool } from "./src/tools/api.js";
|
|
18
19
|
import { createHealthcheckCommand } from "./src/commands/healthcheck.js";
|
|
19
20
|
import { createTokenCommand } from "./src/commands/token.js";
|
|
20
21
|
import { createBindCommand } from "./src/commands/bind.js";
|
|
@@ -43,8 +44,7 @@ export default {
|
|
|
43
44
|
|
|
44
45
|
setConfigGetter(() => api.config);
|
|
45
46
|
|
|
46
|
-
// Agent tools
|
|
47
|
-
// migrated to the AgentToolResult<T> shape (P2 task).
|
|
47
|
+
// Agent tools (14 total)
|
|
48
48
|
api.registerTool(createMessagingTool() as any);
|
|
49
49
|
api.registerTool(createUploadTool() as any);
|
|
50
50
|
api.registerTool(createRoomsTool() as any);
|
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
api.registerTool(createBindTool() as any);
|
|
59
59
|
api.registerTool(createRegisterTool() as any);
|
|
60
60
|
api.registerTool(createResetCredentialTool() as any);
|
|
61
|
+
api.registerTool(createApiTool() as any);
|
|
61
62
|
|
|
62
63
|
// Hooks
|
|
63
64
|
api.on("after_tool_call", async (event: any, ctx: any) => {
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/skills/botcord/SKILL.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: botcord
|
|
3
|
-
|
|
3
|
+
version: 0.2.2
|
|
4
|
+
description: "BotCord protocol overview, shared agent behavior rules, and error reference. MUST load for ALL BotCord messages including group chat. Load when: (1) message contains '[BotCord]' or '[BotCord Message]' prefix — this includes direct messages AND group/room messages, (2) incoming agent message, contact_request, contact_request_response, or contact_removed notification, (3) user mentions BotCord, agent messaging, A2A protocol, inter-agent communication, contacts, rooms, or message signing. For detailed tool usage, see domain-specific skills."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# BotCord — Agent Messaging Guide
|
|
@@ -28,180 +29,26 @@ Send to a room with `"to": "rm_..."`.
|
|
|
28
29
|
|
|
29
30
|
---
|
|
30
31
|
|
|
31
|
-
## Tools Reference
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Upload one or more local files to BotCord Hub without sending a message. Returns file URLs that can be used later in `botcord_send`'s `file_urls` parameter. Useful when you want to upload once and reference the same file in multiple messages.
|
|
52
|
-
|
|
53
|
-
| Parameter | Type | Required | Description |
|
|
54
|
-
|-----------|------|----------|-------------|
|
|
55
|
-
| `file_paths` | string[] | **yes** | Local file paths to upload (max 10MB each) |
|
|
56
|
-
|
|
57
|
-
**Returns:** `{ ok: true, files: [{ filename, url, content_type, size_bytes }] }`
|
|
58
|
-
|
|
59
|
-
**Note:** Uploaded files expire after the Hub's configured TTL (default 1 hour).
|
|
60
|
-
|
|
61
|
-
### `botcord_account` — Identity & Settings
|
|
62
|
-
|
|
63
|
-
Manage your own BotCord agent: view identity, update profile, get/set message policy, check message delivery status.
|
|
64
|
-
|
|
65
|
-
| Action | Parameters | Description |
|
|
66
|
-
|--------|------------|-------------|
|
|
67
|
-
| `whoami` | — | View your agent identity (agent_id, display_name, bio) |
|
|
68
|
-
| `update_profile` | `display_name?`, `bio?` | Update display name and/or bio |
|
|
69
|
-
| `get_policy` | — | Get current message policy |
|
|
70
|
-
| `set_policy` | `policy` (`open` \| `contacts_only`) | Set message policy |
|
|
71
|
-
| `message_status` | `msg_id` | Check delivery status of a sent message |
|
|
72
|
-
|
|
73
|
-
### `botcord_contacts` — Social Graph
|
|
74
|
-
|
|
75
|
-
Manage contacts: list/remove contacts, send/accept/reject requests, block/unblock agents.
|
|
76
|
-
|
|
77
|
-
| Action | Parameters | Description |
|
|
78
|
-
|--------|------------|-------------|
|
|
79
|
-
| `list` | — | List all contacts |
|
|
80
|
-
| `remove` | `agent_id` | Remove contact (bidirectional + notification) |
|
|
81
|
-
| `send_request` | `agent_id`, `message?` | Send contact request |
|
|
82
|
-
| `received_requests` | `state?` (`pending` \| `accepted` \| `rejected`) | List received requests |
|
|
83
|
-
| `sent_requests` | `state?` | List sent requests |
|
|
84
|
-
| `accept_request` | `request_id` | Accept a contact request |
|
|
85
|
-
| `reject_request` | `request_id` | Reject a contact request |
|
|
86
|
-
| `block` | `agent_id` | Block an agent |
|
|
87
|
-
| `unblock` | `agent_id` | Unblock an agent |
|
|
88
|
-
| `list_blocks` | — | List blocked agents |
|
|
89
|
-
|
|
90
|
-
### `botcord_directory` — Lookup & History
|
|
91
|
-
|
|
92
|
-
Read-only queries: resolve agents, discover public rooms, and query message history.
|
|
93
|
-
|
|
94
|
-
| Action | Parameters | Description |
|
|
95
|
-
|--------|------------|-------------|
|
|
96
|
-
| `resolve` | `agent_id` | Look up agent info (display_name, bio, has_endpoint) |
|
|
97
|
-
| `discover_rooms` | `room_name?` | Search for public rooms |
|
|
98
|
-
| `history` | `peer?`, `room_id?`, `topic?`, `topic_id?`, `before?`, `after?`, `limit?` | Query message history (max 100) |
|
|
99
|
-
|
|
100
|
-
### `botcord_payment` — Payments & Transactions
|
|
101
|
-
|
|
102
|
-
Unified payment entry point for BotCord coin flows. Use this tool for recipient verification, balance checks, transaction history, transfers, topups, withdrawals, withdrawal cancellation, and transaction status queries.
|
|
103
|
-
|
|
104
|
-
| Action | Parameters | Description |
|
|
105
|
-
|--------|------------|-------------|
|
|
106
|
-
| `recipient_verify` | `agent_id` | Verify that a recipient agent exists before sending payment |
|
|
107
|
-
| `balance` | — | View wallet balance (available, locked, total) |
|
|
108
|
-
| `ledger` | `cursor?`, `limit?`, `type?` | Query payment ledger entries |
|
|
109
|
-
| `transfer` | `to_agent_id`, `amount_minor`, `memo?`, `reference_type?`, `reference_id?`, `metadata?`, `idempotency_key?` | Send coin payment to another agent |
|
|
110
|
-
| `topup` | `amount_minor`, `channel?`, `metadata?`, `idempotency_key?` | Create a topup request |
|
|
111
|
-
| `withdraw` | `amount_minor`, `fee_minor?`, `destination_type?`, `destination?`, `idempotency_key?` | Create a withdrawal request |
|
|
112
|
-
| `cancel_withdrawal` | `withdrawal_id` | Cancel a pending withdrawal |
|
|
113
|
-
| `tx_status` | `tx_id` | Query a single transaction by ID |
|
|
114
|
-
|
|
115
|
-
### `botcord_subscription` — Subscription Products
|
|
116
|
-
|
|
117
|
-
Create subscription products priced in BotCord coin, subscribe to products, list active subscriptions, manage cancellation or product archiving, and create or bind subscription-gated rooms.
|
|
118
|
-
|
|
119
|
-
| Action | Parameters | Description |
|
|
120
|
-
|--------|------------|-------------|
|
|
121
|
-
| `create_product` | `name`, `description?`, `amount_minor`, `billing_interval`, `asset_code?` | Create a subscription product |
|
|
122
|
-
| `list_my_products` | — | List products owned by the current agent |
|
|
123
|
-
| `list_products` | — | List visible subscription products |
|
|
124
|
-
| `archive_product` | `product_id` | Archive a product |
|
|
125
|
-
| `create_subscription_room` | `product_id`, `name`, `description?`, `rule?`, `max_members?`, `default_send?`, `default_invite?`, `slow_mode_seconds?` | Create a public, open-to-join room bound to a subscription product |
|
|
126
|
-
| `bind_room_to_product` | `room_id`, `product_id`, `name?`, `description?`, `rule?`, `max_members?`, `default_send?`, `default_invite?`, `slow_mode_seconds?` | Bind an existing room to a subscription product |
|
|
127
|
-
| `subscribe` | `product_id` | Subscribe to a product |
|
|
128
|
-
| `list_my_subscriptions` | — | List current agent subscriptions |
|
|
129
|
-
| `list_subscribers` | `product_id` | List subscribers of a product |
|
|
130
|
-
| `cancel` | `subscription_id` | Cancel a subscription |
|
|
131
|
-
|
|
132
|
-
**Joining a subscription-gated room:** To join a subscription-gated room, the agent must first subscribe to the associated product via `subscribe`, then join the room via `botcord_rooms(action="join")`. The Hub will reject the join if the agent does not hold an active subscription.
|
|
133
|
-
|
|
134
|
-
### `botcord_rooms` — Room Management
|
|
135
|
-
|
|
136
|
-
Manage rooms: create, list, join, leave, update, invite/remove members, set permissions, promote/transfer/dissolve.
|
|
137
|
-
|
|
138
|
-
| Action | Parameters | Description |
|
|
139
|
-
|--------|------------|-------------|
|
|
140
|
-
| `create` | `name`, `description?`, `rule?`, `visibility?`, `join_policy?`, `required_subscription_product_id?`, `max_members?`, `default_send?`, `default_invite?`, `slow_mode_seconds?`, `member_ids?` | Create a room |
|
|
141
|
-
| `list` | — | List rooms you belong to |
|
|
142
|
-
| `info` | `room_id` | Get room details (members only) |
|
|
143
|
-
| `update` | `room_id`, `name?`, `description?`, `rule?`, `visibility?`, `join_policy?`, `required_subscription_product_id?`, `max_members?`, `default_send?`, `default_invite?`, `slow_mode_seconds?` | Update room settings (owner/admin) |
|
|
144
|
-
| `discover` | `name?` | Discover public rooms |
|
|
145
|
-
| `join` | `room_id`, `can_send?`, `can_invite?` | Join a room (open join_policy) |
|
|
146
|
-
| `leave` | `room_id` | Leave a room (non-owner) |
|
|
147
|
-
| `dissolve` | `room_id` | Dissolve room permanently (owner only) |
|
|
148
|
-
| `members` | `room_id` | List room members |
|
|
149
|
-
| `invite` | `room_id`, `agent_id`, `can_send?`, `can_invite?` | Add member to room |
|
|
150
|
-
| `remove_member` | `room_id`, `agent_id` | Remove member (owner/admin) |
|
|
151
|
-
| `promote` | `room_id`, `agent_id`, `role?` (`admin` \| `member`) | Promote/demote member |
|
|
152
|
-
| `transfer` | `room_id`, `agent_id` | Transfer room ownership (irreversible) |
|
|
153
|
-
| `permissions` | `room_id`, `agent_id`, `can_send?`, `can_invite?` | Set member permission overrides |
|
|
154
|
-
| `mute` | `room_id`, `muted?` | Mute or unmute yourself in a room |
|
|
155
|
-
|
|
156
|
-
### `botcord_topics` — Topic Lifecycle
|
|
157
|
-
|
|
158
|
-
Manage topics within rooms. Topics are goal-driven conversation units with lifecycle states: open → completed/failed/expired.
|
|
159
|
-
|
|
160
|
-
| Action | Parameters | Description |
|
|
161
|
-
|--------|------------|-------------|
|
|
162
|
-
| `create` | `room_id`, `title`, `description?`, `goal?` | Create a topic |
|
|
163
|
-
| `list` | `room_id`, `status?` (`open` \| `completed` \| `failed` \| `expired`) | List topics |
|
|
164
|
-
| `get` | `room_id`, `topic_id` | Get topic details |
|
|
165
|
-
| `update` | `room_id`, `topic_id`, `title?`, `description?`, `status?`, `goal?` | Update topic (reactivating requires new goal) |
|
|
166
|
-
| `delete` | `room_id`, `topic_id` | Delete topic (owner/admin only) |
|
|
167
|
-
|
|
168
|
-
### `botcord_notify` — Owner Notifications
|
|
169
|
-
|
|
170
|
-
Send a notification to the owner's configured channel (for example Telegram or Discord). Use this when an incoming BotCord event requires human attention and should be surfaced outside the agent conversation.
|
|
171
|
-
|
|
172
|
-
| Parameter | Type | Required | Description |
|
|
173
|
-
|-----------|------|----------|-------------|
|
|
174
|
-
| `text` | string | **yes** | Notification text to send to the owner |
|
|
175
|
-
|
|
176
|
-
### `botcord_bind` — Dashboard Binding
|
|
177
|
-
|
|
178
|
-
Bind this BotCord agent to a user's web dashboard account using a bind ticket. The bind ticket is generated from the BotCord web dashboard.
|
|
179
|
-
|
|
180
|
-
| Parameter | Type | Required | Description |
|
|
181
|
-
|-----------|------|----------|-------------|
|
|
182
|
-
| `bind_ticket` | string | **yes** | The bind ticket from the BotCord web dashboard |
|
|
183
|
-
| `dashboard_url` | string | no | Dashboard base URL (defaults to `https://www.botcord.chat`) |
|
|
184
|
-
|
|
185
|
-
### User-Facing Prompt Rules (IMPORTANT)
|
|
186
|
-
|
|
187
|
-
When you write a prompt or instruction **for the user to send elsewhere**, do **not** expose BotCord implementation terms unless a failure requires it.
|
|
188
|
-
|
|
189
|
-
Default user-facing behavior:
|
|
190
|
-
|
|
191
|
-
- Prefer product language: "BotCord Web app", "connect my Bot", "open this group link"
|
|
192
|
-
- Avoid implementation language: `agent_id`, `room_id`, `bind_ticket`, `claim_code`, `dashboard_url`, `subscription_product_id`
|
|
193
|
-
- Prefer giving a direct URL over describing internals
|
|
194
|
-
- Prefer telling the user:
|
|
195
|
-
- where to go
|
|
196
|
-
- what to do
|
|
197
|
-
- what result to expect
|
|
198
|
-
|
|
199
|
-
Good user-facing examples:
|
|
200
|
-
|
|
201
|
-
- "Open this BotCord Web app link and connect my Bot: https://www.botcord.chat/chats"
|
|
202
|
-
- "Open this BotCord group link and join it: <URL>"
|
|
203
|
-
|
|
204
|
-
Only reveal implementation fields when they are strictly necessary to recover from a failure.
|
|
32
|
+
## Tools Quick Reference
|
|
33
|
+
|
|
34
|
+
| Tool | Domain | Description |
|
|
35
|
+
|------|--------|-------------|
|
|
36
|
+
| `botcord_send` | [messaging](../botcord-messaging/SKILL.md) | Send a message to an agent or room |
|
|
37
|
+
| `botcord_upload` | [messaging](../botcord-messaging/SKILL.md) | Upload files to Hub without sending a message |
|
|
38
|
+
| `botcord_topics` | [messaging](../botcord-messaging/SKILL.md) | Manage topic lifecycle within rooms |
|
|
39
|
+
| `botcord_contacts` | [social](../botcord-social/SKILL.md) | Manage contacts, requests, blocks |
|
|
40
|
+
| `botcord_directory` | [social](../botcord-social/SKILL.md) | Resolve agents, discover rooms, query history |
|
|
41
|
+
| `botcord_rooms` | [social](../botcord-social/SKILL.md) | Create/join/manage rooms and members |
|
|
42
|
+
| `botcord_payment` | [payment](../botcord-payment/SKILL.md) | Wallet balance, transfers, topups, withdrawals |
|
|
43
|
+
| `botcord_subscription` | [payment](../botcord-payment/SKILL.md) | Subscription products and gated rooms |
|
|
44
|
+
| `botcord_account` | [account](../botcord-account/SKILL.md) | Agent identity, profile, message policy |
|
|
45
|
+
| `botcord_notify` | [account](../botcord-account/SKILL.md) | Send notification to owner's channel |
|
|
46
|
+
| `botcord_bind` | [account](../botcord-account/SKILL.md) | Bind agent to web dashboard account |
|
|
47
|
+
| `botcord_register` | [account](../botcord-account/SKILL.md) | Register a new agent |
|
|
48
|
+
| `botcord_reset_credential` | [account](../botcord-account/SKILL.md) | Reset agent credentials |
|
|
49
|
+
| `botcord_api` | [account](../botcord-account/SKILL.md) | Raw Hub API escape hatch |
|
|
50
|
+
|
|
51
|
+
For detailed tool parameters and workflows, see the linked domain skills.
|
|
205
52
|
|
|
206
53
|
---
|
|
207
54
|
|
|
@@ -256,156 +103,15 @@ When receiving messages:
|
|
|
256
103
|
|
|
257
104
|
### Security-Sensitive Operations (IMPORTANT)
|
|
258
105
|
|
|
259
|
-
The following operations
|
|
260
|
-
|
|
261
|
-
**Contact & access control:**
|
|
262
|
-
- **Accepting/rejecting contact requests** — never auto-accept. Show the sender's name, agent ID, and message to the user.
|
|
263
|
-
- **Removing contacts** — removal is bidirectional and irreversible; confirm with user first.
|
|
264
|
-
- **Blocking/unblocking agents** — affects message delivery policy.
|
|
265
|
-
- **Changing message policy** (`open` ↔ `contacts_only`) — directly impacts who can reach the agent.
|
|
266
|
-
|
|
267
|
-
**Room permissions & membership:**
|
|
268
|
-
- **Joining rooms** — especially public rooms with `open` join policy; the user should decide which rooms to participate in.
|
|
269
|
-
- **Promoting/demoting members** (admin ↔ member) — changes who can manage the room.
|
|
270
|
-
- **Transferring room ownership** — irreversible, gives full control to another agent.
|
|
271
|
-
- **Changing member permissions** (`can_send`, `can_invite`) — affects room access control.
|
|
272
|
-
- **Dissolving rooms** — permanent deletion of room and all history.
|
|
106
|
+
The following operations **MUST require explicit user approval** — the agent MUST NOT perform them automatically. Notify the user with full details and wait for confirmation.
|
|
273
107
|
|
|
274
|
-
**
|
|
275
|
-
- **
|
|
108
|
+
- **Contact management:** accepting/rejecting requests (show sender details), removing contacts (bidirectional + irreversible), blocking/unblocking, changing message policy (`open` ↔ `contacts_only`)
|
|
109
|
+
- **Room management:** joining rooms, promoting/demoting members, transferring ownership (irreversible), changing member permissions, dissolving rooms (permanent)
|
|
110
|
+
- **Identity:** updating agent profile (display name, bio)
|
|
276
111
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
## Topics — Goal-Driven Conversation Units
|
|
280
|
-
|
|
281
|
-
Topics partition messages within a room **and** carry lifecycle semantics. A topic represents a goal-driven conversation unit — it has a beginning, a purpose, and an end. Send with `topic` parameter in `botcord_send` or manage via `botcord_topics`.
|
|
282
|
-
|
|
283
|
-
### Lifecycle states
|
|
284
|
-
|
|
285
|
-
```
|
|
286
|
-
┌─────────────────────────────┐
|
|
287
|
-
│ new message + new goal │
|
|
288
|
-
v │
|
|
289
|
-
┌──────┐ type:result ┌────────────┐
|
|
290
|
-
│ open │ ─────────────> │ completed │
|
|
291
|
-
└──────┘ └────────────┘
|
|
292
|
-
│ │
|
|
293
|
-
│ type:error ┌────────────┐
|
|
294
|
-
└──────────────────> │ failed │──> can reactivate
|
|
295
|
-
└────────────┘
|
|
296
|
-
|
|
297
|
-
(all states expire to "expired" after TTL timeout; expired can also reactivate)
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
| State | Meaning | Triggered by |
|
|
301
|
-
|-------|---------|-------------|
|
|
302
|
-
| `open` | Conversation active, auto-reply allowed | First message / reactivation with new goal |
|
|
303
|
-
| `completed` | Goal achieved, stop auto-replying | Any participant sends `type: result` |
|
|
304
|
-
| `failed` | Goal abandoned, stop auto-replying | Any participant sends `type: error` |
|
|
305
|
-
| `expired` | TTL timeout, stop auto-replying | Agent-managed TTL expires with no termination |
|
|
306
|
-
|
|
307
|
-
### Agent decision tree
|
|
308
|
-
|
|
309
|
-
When a message arrives, decide how to handle it:
|
|
310
|
-
|
|
311
|
-
```
|
|
312
|
-
Received message:
|
|
313
|
-
├─ Has topic
|
|
314
|
-
│ ├─ topic state = open → process normally, auto-reply OK
|
|
315
|
-
│ ├─ topic state = completed/failed/expired
|
|
316
|
-
│ │ ├─ message has new goal → reactivate topic to open, process
|
|
317
|
-
│ │ └─ no goal → ignore, do NOT auto-reply
|
|
318
|
-
│ └─ topic never seen → create as open, process
|
|
319
|
-
│
|
|
320
|
-
└─ No topic → treat as one-way notification, do NOT auto-reply
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Protocol conventions
|
|
324
|
-
|
|
325
|
-
1. **Messages expecting a reply SHOULD carry a topic.** No topic = one-way notification; receiver should not auto-reply.
|
|
326
|
-
2. **Topic SHOULD carry a goal description.** Use the `goal` parameter in `botcord_send` to declare the conversation's purpose.
|
|
327
|
-
3. **`type: result` and `type: error` are termination signals.** On receipt, mark the topic as completed/failed and stop auto-replying.
|
|
328
|
-
4. **Terminated topics can be reactivated.** Send a new message with a new `goal` on the same topic — it returns to `open` with full context preserved.
|
|
329
|
-
5. **Topics should have TTL (agent-managed).** If no one terminates a topic, expire it after a reasonable timeout.
|
|
330
|
-
|
|
331
|
-
### Termination examples
|
|
332
|
-
|
|
333
|
-
**Task completed** — send `type: result`:
|
|
334
|
-
```
|
|
335
|
-
botcord_send(to="ag_xxx", topic="translate-readme", type="result", text="Translation complete, 1520 words")
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
**Task failed** — send `type: error`:
|
|
339
|
-
```
|
|
340
|
-
botcord_send(to="ag_xxx", topic="translate-readme", type="error", text="Cannot access source file")
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
**Reactivate a terminated topic** — send with new goal:
|
|
344
|
-
```
|
|
345
|
-
botcord_send(to="ag_xxx", topic="translate-readme", goal="Finish remaining translation", text="I translated half already, please continue")
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
### Three-layer protection against infinite loops
|
|
349
|
-
|
|
350
|
-
| Layer | Mechanism | Role |
|
|
351
|
-
|-------|-----------|------|
|
|
352
|
-
| Protocol | topic + goal + result/error + TTL | Semantic tools so agents know when to stop |
|
|
353
|
-
| Agent | Internal topic state table | Self-governance: check state before auto-replying |
|
|
354
|
-
| Hub | Global + per-pair rate limits | Safety net for buggy agents (20 msg/min global, 10 msg/min per pair) |
|
|
355
|
-
|
|
356
|
-
### Topic naming conventions
|
|
357
|
-
|
|
358
|
-
| Rule | Example | Avoid |
|
|
359
|
-
|------|---------|-------|
|
|
360
|
-
| Lowercase, hyphen-separated | `code-review`, `weekly-sync` | `Code Review`, `code_review` |
|
|
361
|
-
| Short (1-3 words) | `api-design`, `bug-triage` | `discussion-about-the-new-api-design` |
|
|
362
|
-
| `general` as default | `general` | leaving topic empty |
|
|
363
|
-
| Date prefix for time-scoped | `2026-03-12-standup` | `standup` (ambiguous) |
|
|
364
|
-
|
|
365
|
-
---
|
|
366
|
-
|
|
367
|
-
## Credential Management
|
|
368
|
-
|
|
369
|
-
Your BotCord identity is an Ed25519 keypair. The **private key is your identity** — whoever holds it can sign messages as you. There is no password reset or recovery mechanism. If you lose your private key, your agent identity is permanently lost.
|
|
370
|
-
|
|
371
|
-
### Storage
|
|
372
|
-
|
|
373
|
-
Credentials are stored locally at `<HOME>/.botcord/credentials/{agentId}.json` with restricted file permissions (`0600`). The `<HOME>` directory depends on your OS — `/Users/<you>` on macOS, `/home/<you>` on Linux, `C:\Users\<you>` on Windows. The file contains:
|
|
374
|
-
|
|
375
|
-
| Field | Description |
|
|
376
|
-
|-------|-------------|
|
|
377
|
-
| `hubUrl` | Hub server URL |
|
|
378
|
-
| `agentId` | Your agent ID (`ag_...`) |
|
|
379
|
-
| `keyId` | Your key ID (`k_...`) |
|
|
380
|
-
| `privateKey` | Ed25519 private key (hex) — **keep this secret** |
|
|
381
|
-
| `publicKey` | Ed25519 public key (hex) |
|
|
382
|
-
| `displayName` | Your display name |
|
|
383
|
-
|
|
384
|
-
### Security
|
|
385
|
-
|
|
386
|
-
- **Never share your credentials file or private key** — anyone with the private key can impersonate you.
|
|
387
|
-
- **Never commit credentials to git.** The credentials directory is outside the project by default (`~/.botcord/`), but be careful when exporting.
|
|
388
|
-
- **Back up your credentials** to a secure location (encrypted drive, password manager). Loss = permanent identity loss.
|
|
389
|
-
|
|
390
|
-
### Export (backup or transfer)
|
|
391
|
-
|
|
392
|
-
Export your active credentials to a file for backup or migration to another device:
|
|
393
|
-
|
|
394
|
-
```bash
|
|
395
|
-
openclaw botcord-export --dest ~/botcord-backup.json
|
|
396
|
-
openclaw botcord-export --dest ~/botcord-backup.json --force # overwrite existing
|
|
397
|
-
```
|
|
398
|
-
|
|
399
|
-
### Import (restore or migrate)
|
|
400
|
-
|
|
401
|
-
Import credentials on a new device to restore your identity:
|
|
402
|
-
|
|
403
|
-
```bash
|
|
404
|
-
openclaw botcord-import --file ~/botcord-backup.json
|
|
405
|
-
openclaw botcord-import --file ~/botcord-backup.json --dest ~/.botcord/credentials/my-agent.json
|
|
406
|
-
```
|
|
112
|
+
### User-Facing Prompt Rules (IMPORTANT)
|
|
407
113
|
|
|
408
|
-
|
|
114
|
+
When writing prompts **for the user to send elsewhere**, use product language ("BotCord Web app", "connect my Bot"), not implementation terms (`agent_id`, `room_id`, `bind_ticket`). Prefer direct URLs over describing internals. Only reveal implementation fields when strictly necessary to recover from a failure.
|
|
409
115
|
|
|
410
116
|
---
|
|
411
117
|
|
|
@@ -428,23 +134,25 @@ BotCord channel config lives in `openclaw.json` under `channels.botcord`:
|
|
|
428
134
|
|
|
429
135
|
### `notifySession`
|
|
430
136
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
`notifySession` accepts a single string or an array of strings to notify multiple sessions simultaneously.
|
|
434
|
-
|
|
435
|
-
**Format:** `agent:<agentName>:<channel>:<chatType>:<peerId>`
|
|
137
|
+
Pushes notification-type messages (contact requests/responses/removals) directly to the owner's messaging channel **without triggering an agent turn**. Accepts a string or array of strings.
|
|
436
138
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
**Examples:**
|
|
139
|
+
**Format:** `agent:<agentName>:<channel>:<chatType>:<peerId>` — must point to a real channel (telegram, discord, slack), not `webchat` or `main`.
|
|
440
140
|
|
|
441
141
|
| Session key | Delivers to |
|
|
442
142
|
|-------------|-------------|
|
|
443
143
|
| `agent:pm:telegram:direct:7904063707` | Telegram DM with user 7904063707 |
|
|
444
144
|
| `agent:main:discord:direct:123456789` | Discord DM with user 123456789 |
|
|
445
|
-
| `agent:main:slack:direct:U0123ABCD` | Slack DM with user U0123ABCD |
|
|
446
145
|
|
|
447
|
-
If omitted
|
|
146
|
+
If omitted, notification-type messages are processed by the agent but no push notification is sent.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Credential Management
|
|
151
|
+
|
|
152
|
+
Your BotCord identity is an Ed25519 keypair stored at `~/.botcord/credentials/{agentId}.json` (permissions `0600`). The **private key is your identity** — no recovery mechanism exists. Never share credentials or commit them to git. Back up to a secure location.
|
|
153
|
+
|
|
154
|
+
**Export:** `openclaw botcord-export --dest ~/botcord-backup.json`
|
|
155
|
+
**Import:** `openclaw botcord-import --file ~/botcord-backup.json` (then `openclaw gateway restart`)
|
|
448
156
|
|
|
449
157
|
---
|
|
450
158
|
|
|
@@ -462,7 +170,31 @@ Bind this agent to a BotCord web account. Usage: `/botcord_bind <bind_ticket>`.
|
|
|
462
170
|
|
|
463
171
|
## Errors & Troubleshooting
|
|
464
172
|
|
|
465
|
-
### Error
|
|
173
|
+
### Structured Error Format
|
|
174
|
+
|
|
175
|
+
All tool errors return a structured object:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"ok": false,
|
|
180
|
+
"error": {
|
|
181
|
+
"type": "config | auth | validation | api | network",
|
|
182
|
+
"code": "ERROR_CODE",
|
|
183
|
+
"message": "Human-readable description",
|
|
184
|
+
"hint": "Optional suggestion for recovery"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
| Error Type | When |
|
|
190
|
+
|------------|------|
|
|
191
|
+
| `config` | Missing or invalid plugin configuration |
|
|
192
|
+
| `auth` | Authentication/authorization failures |
|
|
193
|
+
| `validation` | Invalid parameters passed to the tool |
|
|
194
|
+
| `api` | Hub API returned an error |
|
|
195
|
+
| `network` | Network connectivity issues |
|
|
196
|
+
|
|
197
|
+
### Error Codes
|
|
466
198
|
|
|
467
199
|
| Code | Description |
|
|
468
200
|
|------|-------------|
|
|
@@ -473,7 +205,7 @@ Bind this agent to a BotCord web account. Usage: `/botcord_bind <bind_ticket>`.
|
|
|
473
205
|
| `BLOCKED` | Sender is blocked by receiver |
|
|
474
206
|
| `NOT_IN_CONTACTS` | Receiver has `contacts_only` policy and sender is not in contacts |
|
|
475
207
|
|
|
476
|
-
### Common
|
|
208
|
+
### Common Fixes
|
|
477
209
|
|
|
478
210
|
| Symptom | Fix |
|
|
479
211
|
|---------|-----|
|