claude-slack-channel-bots 0.4.1 → 0.4.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- # Slack Channel Router
1
+ # Claude Slack Channel Bots
2
2
 
3
3
  A single HTTP MCP server that holds one Slack Socket Mode connection and routes messages to multiple independent Claude Code sessions, each scoped to a different repo and reachable via its own Slack channel. Inbound messages are dispatched to whichever session owns the channel they arrived on; outbound tool calls are restricted to channels that session has previously received a message from.
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-slack-channel-bots",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Multi-session Slack-to-Claude bridge \u2014 run multiple Claude Code bots across Slack channels via Socket Mode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -227,45 +227,67 @@ their defaults unless asked.
227
227
 
228
228
  ---
229
229
 
230
- ### Step 5 — Configure custom CLAUDE.md (optional)
230
+ ### Step 5 — Configure custom system prompt for worker sessions
231
231
 
232
- Worker sessions launched by the server can receive a custom system-prompt
233
- append via `append_system_prompt_file` in `routing.json`. This is useful for
234
- giving all workers project-specific instructions: communication rules,
235
- development process, how to spawn sub-workers, and so on.
232
+ Worker sessions launched by the server can receive a custom system prompt
233
+ via `append_system_prompt_file` in `routing.json`. This controls how the
234
+ bots behave their role, communication style, and capabilities.
236
235
 
237
- An example template is included with the package. Show the operator where it
238
- lives:
236
+ **This is important.** Without a system prompt, bots won't know to communicate
237
+ via Slack and will try to use the TUI (which nobody can see).
238
+
239
+ An example template is included with the package. Read it for reference:
239
240
 
240
241
  ```bash
241
- ls "$(npm root -g)/claude-slack-channel-bots/skills/EXAMPLE_CLAUDE.md" 2>/dev/null \
242
+ cat "$(npm root -g)/claude-slack-channel-bots/skills/EXAMPLE_CLAUDE.md" 2>/dev/null \
242
243
  || echo "NOT_FOUND"
243
244
  ```
244
245
 
245
- If the file is found, print its path so the operator can inspect it as a
246
- starting point.
246
+ Show the user the example content so they understand what a system prompt
247
+ looks like.
248
+
249
+ Then ask: **"What should your bots do? Describe the role you want them to
250
+ play, how they should communicate, and any specific behaviors."**
251
+
252
+ Examples to offer if they're unsure:
253
+ - "I want a coding assistant that responds to my messages in Slack"
254
+ - "I want an orchestrator that manages workers and reports status"
255
+ - "I want a simple bot that answers questions about my codebase"
256
+
257
+ **After the user describes what they want:**
247
258
 
248
- Ask the operator: **"Do you want to configure a custom CLAUDE.md file for
249
- worker sessions?"**
259
+ 1. Write a system prompt file based on their description. The file MUST
260
+ always include these two essential sections at the top (adapt the wording
261
+ to match their described role):
250
262
 
251
- **If yes:**
263
+ ```markdown
264
+ # Communication with the User
265
+ The User communicates with you via Slack. Always use the
266
+ mcp__slack-channel-router__reply tool to send messages.
267
+ **Important**: Nothing you send to the TUI will be seen by the User.
268
+ ```
269
+
270
+ Then add sections based on what the user described (role, process,
271
+ capabilities, tone, etc.).
252
272
 
253
- 1. Prompt for the absolute path to their CLAUDE.md file.
254
- 2. Verify the file exists:
273
+ 2. Save the file to `~/.claude/channels/slack/system-prompt.md`:
255
274
  ```bash
256
- test -f "<provided-path>" && echo "ok" || echo "not found"
275
+ STATE_DIR="${SLACK_STATE_DIR:-$HOME/.claude/channels/slack}"
257
276
  ```
258
- Expand `~` before checking. If the file does not exist, warn the operator
259
- and re-prompt until a valid path is given or they choose to skip.
260
- 3. Read `routing.json`, add or update the top-level field:
277
+
278
+ 3. Read `routing.json`, add or update:
261
279
  ```json
262
- "append_system_prompt_file": "<provided-path>"
280
+ "append_system_prompt_file": "~/.claude/channels/slack/system-prompt.md"
263
281
  ```
264
282
  Write the updated file, preserving all other fields.
265
283
 
266
- **If skipped:**
284
+ 4. Show the user what was written and ask if they want to make changes.
285
+ Iterate until they're happy.
286
+
287
+ **If the user explicitly skips:**
267
288
 
268
- Do not write `append_system_prompt_file` to `routing.json`. Move on.
289
+ Do not write `append_system_prompt_file` to `routing.json`, but warn them
290
+ that bots won't know to communicate via Slack without a system prompt.
269
291
 
270
292
  ---
271
293
 
package/src/lib.ts CHANGED
@@ -189,8 +189,8 @@ export interface GateOptions {
189
189
  export async function gate(event: unknown, opts: GateOptions): Promise<GateResult> {
190
190
  const ev = event as Record<string, unknown>
191
191
 
192
- // 1. Drop bot messages immediately
193
- if (ev['bot_id']) return { action: 'drop' }
192
+ // 1. Drop our own bot messages (but allow messages from other bots)
193
+ if (ev['bot_id'] && ev['user'] === opts.botUserId) return { action: 'drop' }
194
194
 
195
195
  // 2. Drop non-message subtypes (message_changed, message_deleted, etc.)
196
196
  if (ev['subtype'] && ev['subtype'] !== 'file_share') return { action: 'drop' }