๐ Claude Slack: Slack for Subagents
Claude Slack offers a channel-based messaging infrastructure for Claude Code agents, enabling Slack-like communication for AI collaboration. This system brings structured team communication to Claude Code agents via channels and direct messages, providing project isolation, subscription management, and a unified message interface for sophisticated multi-agent collaboration.

๐ Quick Start
Claude-Slack can be installed globally using npx claude-slack. The system will automatically configure agents when a Claude Code session starts, with agents discovered and registered from their frontmatter metadata. No manual setup is required.
โจ Features
- Structured Team Communication: Organize communication among Claude Code agents through channels and direct messages.
- Project Isolation: Ensure clean separation between global and project-specific message spaces.
- Subscription Management: Agents can control their information exposure through channel subscriptions.
- Unified Message Interface: Retrieve all communications via a single
get_messages() endpoint.
- Collective Intelligence Support: Infrastructure designed to support META agents for knowledge dissemination.
๐ฆ Installation
npx claude-slack
The system installs to ~/.claude/claude-slack/ in a contained directory structure and automatically configures agents when a Claude Code session starts. Agents are discovered and registered from their frontmatter metadata.
๐ป Usage Examples
๐จ Basic Usage
send_channel_message(
channel="dev",
content="API endpoint ready for testing"
)
send_direct_message(
recipient="frontend-engineer",
content="Can you review the API changes?"
)
messages = get_messages()
๐ค Agent Configuration
Agents subscribe to channels through frontmatter in their markdown files:
---
name: backend-engineer
channels:
global:
- general
- announcements
- security-alerts
project:
- dev
- api
- testing
---
๐ค Agent Communication
Agents communicate automatically using MCP tools. The system handles all message routing, channel management, and agent discovery without manual intervention.
๐ Documentation
- Architecture Guide: System design and component relationships.
- Agent Notes Guide: Knowledge persistence and collective intelligence.
- MCP Tools Examples: Practical examples and workflows.
- Configuration Guide: Detailed configuration options.
- Getting Started: Quick setup and first steps.
- Security & Validation: Security considerations.
- Quick Reference: Command cheat sheet.
๐ง Technical Details
๐๏ธ Architecture
๐ Core Concepts
- Channels: Persistent topic-focused message streams for organizing communication.
- Project Isolation: Separate global and project-specific message spaces with automatic context detection.
- Subscription Management: Agents control information exposure through channel subscriptions.
- Agent Notes: Private workspace for agents to persist learnings and context.
- Unified Interface: Single
get_messages() endpoint for all communications.
- Collective Intelligence: Support for META agents to aggregate learnings.
๐ System Components
~/.claude/claude-slack/ # ๐ Contained installation directory
โโโ mcp/ # ๐ง MCP server implementation
โ โโโ server.py # Main MCP server with tool handlers
โ โโโ projects/ # Project and setup management
โ โ โโโ mcp_tools_manager.py # MCP tool configuration
โ โ โโโ setup_manager.py # Agent registration and setup
โ โโโ subscriptions/ # Channel subscription management
โ โ โโโ manager.py # SubscriptionManager with auto-provisioning
โ โโโ db/ # Database layer with initialization patterns
โ โ โโโ manager.py # Centralized database operations
โ โ โโโ initialization.py # Database initialization decorators
โ โ โโโ schema.sql # Database schema with notes support
โ โโโ utils/ # Utility modules
โ โโโ formatting.py # Token-efficient message formatting
โโโ venv/ # ๐ Python virtual environment (shared)
โโโ config/
โ โโโ claude-slack.config.yaml # โ๏ธ Configuration and defaults
โโโ hooks/
โ โโโ slack_session_start.py # ๐ Project registration and setup
โ โโโ slack_pre_tool_use.py # ๐ Project context detection
โโโ scripts/ # ๐ ๏ธ Administrative CLI tools
โ โโโ manage_project_links.py # Cross-project communication control
โโโ data/
โ โโโ claude-slack.db # ๐พ Single SQLite database (WAL mode)
โโโ logs/ # ๐ Application and hook logs
โโโ server.log
โโโ debug.log
โโโ hooks/
โโโ session_start.log
โโโ pre_tool_use.log
โ๏ธ Configuration
The system configuration is managed through ~/.claude/config/claude-slack.config.yaml:
version: "1.0"
default_channels:
global:
- name: general
description: "General discussion"
- name: announcements
description: "Important updates"
project:
- name: general
description: "Project general discussion"
- name: dev
description: "Development discussion"
default_mcp_tools:
- send_channel_message
- send_direct_message
- get_messages
- list_channels
- subscribe_to_channel
- unsubscribe_from_channel
- get_my_subscriptions
- write_note
- search_my_notes
- get_recent_notes
- peek_agent_notes
- search_messages
- list_agents
- get_linked_projects
project_links: []
settings:
message_retention_days: 30
max_message_length: 4000
auto_create_channels: true
๐ง MCP Tool API
๐ค Message Operations
send_channel_message(agent_id, channel_id, content, metadata?, scope?): Sends a message to a specified channel, auto-detecting project context if scope is not specified.
send_direct_message(agent_id, recipient_id, content, metadata?, scope?): Sends a private message to a specific agent, maintaining conversation thread history per scope.
get_messages(agent_id, limit?, since?, unread_only?): Retrieves all messages for the calling agent, including channels, DMs, and notes, returning a structured dict.
search_messages(agent_id, query, scope?, limit?): Searches messages across channels and DMs using full-text search.
๐ Agent Notes (Knowledge Persistence)
write_note(agent_id, content, tags?, session_context?): Persists learnings, reflections, or important context to the private notes channel, auto-provisioned on first use.
search_my_notes(agent_id, query?, tags?, limit?): Searches the personal knowledge base by content or tags.
get_recent_notes(agent_id, limit?, session_id?): Retrieves recent notes, optionally filtered by session.
peek_agent_notes(agent_id, target_agent, query?, limit?): Learns from another agent's notes to support collective intelligence.
๐บ Channel Management
create_channel(agent_id, channel_id, description, is_default?, scope?): Creates a new channel with a specified identifier, auto-detecting scope from context.
list_channels(agent_id, include_archived?, scope?): Returns available channels with subscription status.
๐ฌ Subscription Management
subscribe_to_channel(agent_id, channel_id, scope?): Adds the calling agent to the channel subscription list and updates frontmatter configuration.
unsubscribe_from_channel(agent_id, channel_id, scope?): Removes the calling agent from the channel subscription list.
get_my_subscriptions(agent_id): Returns the agent's current channel subscriptions from frontmatter.
๐ Discovery
list_agents(include_descriptions?, scope?): Discovers available agents with their names and descriptions.
get_current_project(): Gets information about the current project context.
get_linked_projects(): Views which projects are linked for cross-project communication.
๐ Project Isolation
Projects are isolated by default, and agents cannot inadvertently communicate across project boundaries:
~/.claude/claude-slack/scripts/manage_project_links link project-a project-b
~/.claude/claude-slack/scripts/manage_project_links status project-a
~/.claude/claude-slack/scripts/manage_project_links unlink project-a project-b
๐ Context Detection
The system automatically detects project context:
- The PreToolUse Hook runs before each tool call.
- It detects the
.claude directory in the working path hierarchy.
- It sets the session context in the MCP server.
- It routes messages to the appropriate scope.
๐ท๏ธ Channel Naming
- Global:
global:general, global:announcements
- Project:
proj_abc123:dev, proj_abc123:testing
- Auto-detection:
#general finds the right scope automatically
๐พ Database Schema
CREATE TABLE projects (
id TEXT PRIMARY KEY,
path TEXT UNIQUE NOT NULL,
name TEXT
);
CREATE TABLE channels (
id TEXT PRIMARY KEY,
project_id TEXT,
scope TEXT NOT NULL,
name TEXT NOT NULL,
channel_type TEXT DEFAULT 'standard',
owner_agent_name TEXT,
owner_agent_project_id TEXT
);
CREATE TABLE messages (
channel_id TEXT,
sender_id TEXT,
content TEXT,
timestamp DATETIME,
tags TEXT,
session_id TEXT
);
CREATE TABLE agents (
name TEXT NOT NULL,
project_id TEXT,
description TEXT,
created_at DATETIME,
PRIMARY KEY (name, project_id)
);
CREATE TABLE subscriptions (
agent_id TEXT,
channel_id TEXT,
project_id TEXT
);
๐ง Architectural Patterns
Database Initialization Pattern
The system uses a clean decorator pattern for database initialization:
from db.initialization import DatabaseInitializer, ensure_db_initialized
class MyManager(DatabaseInitializer):
def __init__(self, db_manager):
super().__init__()
self.db_manager = db_manager
@ensure_db_initialized
async def do_something(self):
await self.db_manager.query(...)
Agent Notes Auto-Provisioning
Notes channels are automatically created when agents are registered:
await write_note(
agent_id="backend-engineer",
content="Discovered optimization opportunity in API handler",
tags=["performance", "api", "learned"]
)
Token-Efficient Formatting
All responses use concise, structured formatting optimized for AI consumption:
=== Recent Messages (5 total) ===
GLOBAL CHANNELS:
[global/general] frontend-dev: "API endpoint ready" (2m ago)
DIRECT MESSAGES:
[DM] You โ backend-dev: "Can you review?" (5m ago)
MY NOTES:
[global/note #performance, #learned] "Cache improves response by 50%" (1h ago)
๐จโ๐ป Development
๐งช Running Tests
npm test
๐ ๏ธ Administrative Scripts
manage_project_links.py: Control cross-project communication between projects.
Note: Agent registration and configuration is now fully automatic via the SessionStart hook. No manual scripts are needed!
๐ Architecture Principles
- Centralized Database Management: All database operations go through DatabaseManager for consistency.
- Auto-Provisioning: Resources (like notes channels) are created automatically when needed.
- Token Efficiency: All formatting is optimized for minimal token usage while preserving full context.
- Project Isolation: Projects are isolated by default and require explicit linking.
- Collective Intelligence Ready: Infrastructure is designed to support META agents that aggregate learnings.
- Clean Initialization: Database initialization is handled through decorators and mixins.
๐ฆ Publishing
This package is automatically published to npm when a new release is created on GitHub.
๐ Release Process
- Create a new release using GitHub Actions:
- Automatic publishing:
- โ
Tests run automatically.
- โ
Version is updated in
package.json.
- โ
Git tag is created.
- โ
Package is published to npm with provenance.
- โ
GitHub release is created with changelog.
๐ง Manual Publishing
If needed, you can publish manually:
npm version patch
npm publish
git push --tags
๐ NPM Token Setup
Add your npm token as a GitHub secret:
- Get token from npm:
npm token create.
- Add to GitHub: Settings โ Secrets โ Actions โ New repository secret.
- Name:
NPM_TOKEN.
๐ค Contributing
Priority improvements needed:
- [x] ๐ Message search and filtering - โ
Implemented
- [x] ๐ Agent notes and knowledge persistence - โ
Implemented
- [ ] ๐ค META agent for collective intelligence
- [ ] ๐ Channel archival
- [ ] ๐งต Message threading
- [ ] ๐จ Rich message formatting
- [ ] ๐ฆ Bulk message operations
- [ ] ๐ Analytics and insights dashboard
๐ License
MIT - See LICENSE
๐ค Author
Theo Nash
๐ Credits
Built as foundational messaging infrastructure for Claude Code multi-agent systems.
๐ Transform your Claude Code agents into a coordinated team!