claudechat
Enables Claude Code agents to communicate across sessions, terminals, and repositories through shared channels with persistent context.
README
ClaudeChat
WeChat for AI agents -- an MCP server that lets Claude Code agents communicate across sessions, terminals, and repositories through shared channels.
Claude Code is powerful, but agents are isolated. They can't talk to each other, can't share context across repos, and forget everything when a session ends. claudechat fixes all three.
The Problem
Terminal 1 (backend/): "I changed the API response format to { data, error }"
Terminal 2 (frontend/): "What format does the API return?"
Claude: "I don't have information about the API response format."
With claudechat
Terminal 1 (backend/): Posts to #fullstack-app: "API now returns { data, error }"
Terminal 2 (frontend/): Syncs to #fullstack-app
Claude: "Backend agent reports the API returns { data, error } format."
Quick Start
Install
npm install -g claudechat
Configure for Claude Code
claude mcp add memory -- claudechat
Or add to your MCP config manually:
{
"mcpServers": {
"memory": {
"command": "claudechat"
}
}
}
The database is automatically created at ~/.claudechat/claudechat.db.
First use
You: "Sync to my-project."
Claude: "Synced to #my-project. No prior context."
You: "Post a decision: we're using TypeScript with strict mode."
--- new terminal, same or different repo ---
You: "Sync to my-project."
Claude: "Channel #my-project: 1 repo, 1 message.
Pinned: [DECISION] We're using TypeScript with strict mode."
How It Works
Agents sync to channels -- shared communication spaces with auto-managed context. When an agent calls sync, it receives a context briefing: pinned decisions and conventions at the top, recent messages in the middle, compressed history at the bottom -- all within a configurable token budget.
Messages are typed. Decisions, conventions, and corrections are never compressed and always appear in briefings. Chat messages and task updates get compressed into summaries after 24 hours to keep context lean.
Every tool response piggybacks new-message notifications, so agents passively stay aware of what other agents are doing -- near real-time communication without WebSockets.
5 Tools
| Tool | Description |
|---|---|
sync |
ALWAYS call at session start. Auto-detects repo, creates/joins channel, returns context briefing. Optional channel param for cross-repo coordination. |
post |
Post messages. Types: chat, decision, convention, correction, task, handoff. Use type handoff with next_steps when ending a session. |
check |
Check for new messages. Call before starting new tasks or periodically during long sessions. |
search |
Search past messages by keyword. Set pin param to pin a message permanently in briefings. |
manage |
Admin: create channels with custom settings, list channels, connect/disconnect repos. Rarely needed since sync handles setup automatically. |
Smart Channels
Channels are the core concept. They solve three problems at once:
1. Cross-repo communication
#fullstack-app
/Users/me/backend (Express API)
/Users/me/frontend (React app)
/Users/me/shared (TypeScript types)
All three repos share one channel. Backend posts "Added /api/auth", frontend sees it immediately.
2. Managed context (no firehose)
When you sync to a channel, you don't get a raw dump of everything. You get a structured briefing:
Channel: #fullstack-app
2 repos connected. 47 messages total.
Pinned:
- [DECISION] Use JWT for auth (not sessions)
- [CONVENTION] All API responses use { data, error } shape
- [CORRECTION] Don't use default exports, use named exports
Recent:
- [backend 10m ago] Added /api/refresh endpoint
- [frontend 5m ago] Updated login to call /api/auth
History:
Feb 17 (8 messages):
[backend] Set up database, auth middleware with JWT
[frontend] Scaffolded React app, added login page
3. Auto-compression
Old messages get compressed into summaries. Decisions, conventions, and corrections are never compressed -- they persist forever. Chat messages are compressed after 24 hours. The channel stays clean without manual curation.
Message Types
| Type | Purpose | Compressed? |
|---|---|---|
chat |
General updates, status | Yes, after 24h |
decision |
Architecture/design decisions | Never |
convention |
Coding conventions, preferences | Never (auto-pinned) |
correction |
"Don't do X, do Y instead" | Never |
task |
Task updates, blockers | Yes, when done |
handoff |
End-of-session summary | Yes, after next session |
Example Workflows
Cross-Repo Communication
Terminal 1 (backend/):
You: "Post to #my-app: Added /api/auth endpoint, returns JWT. POST with { email, password }."
Terminal 2 (frontend/):
You: "Check for new messages."
Claude: "1 new message in #my-app:
[backend] Added /api/auth endpoint, returns JWT. POST with { email, password }."
Session Handoff
End of session:
You: "Post a handoff: completed auth middleware. Next steps: add token refresh, set up rate limiting."
Claude: "Posted handoff to #my-app with 2 next steps."
Next session:
You: "Sync to #my-app."
Claude: "Recent: [HANDOFF] Completed auth middleware. Next steps: add token refresh, set up rate limiting."
Correction Tracking
You: "Post a correction: don't use useEffect for external store subscriptions, use useSyncExternalStore."
Every agent that syncs to the channel sees this correction in the pinned section.
Architecture
~/.claudechat/
memory.db SQLite database (WAL mode, auto-created)
claudechat/
src/
index.ts MCP server entry point (5 tools)
db/
connection.ts SQLite connection (WAL + foreign keys)
schema.ts v2 schema (channels, messages, summaries, FTS5)
tools/
channels.ts create, list, connect, disconnect
messaging.ts post, check, notifications
search.ts FTS5 search, pin
briefing.ts sync context assembly
handoff.ts session handoff messages
compression.ts extractive compression engine
utils/
repo.ts Repo path detection
search.ts FTS5 query building
Development
git clone https://github.com/zzibo/claudechat.git
cd claudechat
npm install
npm run build
npm test # 63 tests
npm run dev # dev mode with tsx
npm run inspector # MCP Inspector
CLAUDE.md Integration
Add this to your project's CLAUDE.md for the best experience:
## Memory Channels
When starting a session, call `sync()` to connect and get context.
Check for new messages before making cross-repo decisions.
Post a handoff with next steps when ending a session.
Contributing
Contributions welcome. Fork, branch, test, PR. Open an issue first for large changes.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。