Claude Context Sync

io.github.ybin4548由 GitHub 账号 ybin4548 发布v0.4.1更新于 Oct 24, 2026

Share context, detect conflicts, and message across parallel Claude Code sessions

发布方自己的服务:Claude Platform Docs

已验证STDIO仅桌面开发者工具沟通与协作

概览

AI 生成的概览

在同一台机器上的多个并行 Claude Code 会话之间共享上下文、检测文件与符号冲突并传递消息。

可以做什么
  • 列出活跃的 Claude Code 会话及其状态、任务摘要和冲突
  • 读取指定会话的结构化摘要,过期时自动重新生成,并按项目筛选汇总各会话的改动文件与决策
  • 向其他会话发送消息或向同一项目广播,并读取会话的消息历史
  • 清除已解决的冲突文件记录
适用场景
适合在同一台机器上并行运行多个 Claude Code 会话时使用,让各会话了解彼此的工作、避免同时修改同一文件或符号,并在终端之间传递提示。
运行要求
本地 stdio 进程,通过 npm 安装(npx 或全局安装后执行 init 命令)。需要 Node.js 20+、Claude Code CLI(claude 命令)用于生成摘要,以及 jq 用于冲突检测钩子。仅支持桌面端;未声明 API 密钥或环境变量。
安装前请注意
它会监视 Claude Code 会话日志,并在用户主目录下写入摘要、冲突数据和消息;生成摘要会调用 Claude CLI,可能消耗用量或产生费用。init 命令会注册钩子,把冲突提醒和未读消息注入会话。说明称会话结束后会清理跟踪数据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Claude Context Sync,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

claude-context-sync

[npm] [License: MIT]

MCP server that automatically summarizes and shares context across parallel Claude Code sessions.

When you run multiple Claude Code sessions on different tasks, each session is unaware of what the others are doing. claude-context-sync watches your session logs, generates structured summaries on demand, and provides real-time file conflict detection and cross-session messaging.

Features

  • Session context sharing — any session can see what others are working on
  • File conflict detection — real-time alerts when multiple sessions edit the same file
  • Symbol-level conflicts — detects shared function/class/interface edits (TypeScript, Python, Swift, Go, Rust)
  • Cross-session messaging — send messages between sessions without switching terminals
  • Lazy evaluation — zero cost when tools aren't called
  • Auto-cleanup — tracked data is removed when sessions end

Installation

bash
npm install -g claude-context-synccontext-sync init

That's it. The next time you open Claude Code, the MCP server starts automatically. The init command also registers a conflict detection hook.

MCP Tools

list_sessions

Returns active Claude Code sessions with their current status, task summary, and any file conflicts.

get_session_context

Returns the full structured summary for a specific session. Automatically re-summarizes if stale. Includes conflict information.

Parameters: sessionId (string)

get_all_changes

Returns changed files and decisions across all sessions, with optional project filtering.

Parameters: project (string, optional)

send_message

Sends a message to another session. Omit targetSessionId to broadcast to all sessions in the same project.

Parameters: fromSessionId (string), message (string), project (string), targetSessionId (string, optional)

get_messages

Returns message history for a session.

Parameters: sessionId (string), unreadOnly (boolean, optional)

resolve_conflicts

Clears resolved files from the conflict tracking list.

Parameters: sessionId (string), files (string[])

How It Works

Context Sharing

[Always running] Watcher: detects .jsonl changes → sets stale flag (zero cost)                    ↓[On tool call]   MCP Tool invoked → summarizes only stale sessions                    ↓                 Extractor → Generator (claude -p) → Store → Response

Conflict Detection

[Always running] Watcher: detects .jsonl changes                    ↓                 FileTracker: parses Write/Edit tool_use events                    ↓                 SymbolResolver: identifies enclosing function/class/type                    ↓                 Writes per-session touched files
[Every message]  Hook (UserPromptSubmit): checks for new conflicts                    ↓                 Alerts Claude once per new conflict → Claude notifies user

Messaging

Session A: send_message → writes to ~/.claude/context-sync/messages/{targetId}/                    ↓Session B: Hook detects unread message → injects into AI context                    ↓           Claude reads and relays to user → marks as read

Architecture

Single MCP server process — no separate daemon. Claude Code launches it automatically via stdio transport.

src/├── mcp/server.ts              # MCP server + 6 tools├── watcher/│   ├── watcher.ts             # File watching (chokidar)│   ├── scheduler.ts           # Hybrid summarization strategy│   ├── file-tracker.ts        # Real-time file edit tracking│   └── symbol-resolver.ts     # Pattern-based symbol detection├── summarizer/│   ├── extractor.ts           # .jsonl parsing + stratified sampling│   └── generator.ts           # claude -p invocation├── messaging/│   └── messenger.ts           # Cross-session message passing├── store/store.ts             # Local summary cache├── cli.ts                     # CLI (init + serve + hook registration)└── types.ts                   # Shared types

Summarization Strategy

  • Incremental: updates existing summary with new messages (default)
  • Full: regenerates from scratch (after 4 incremental updates)
  • Stratified sampling: for large sessions (500+ messages), samples head + middle + tail
  • Cached: returns stored summary if nothing changed (zero cost)

Supported Languages (Symbol Detection)

LanguageDetected Symbols
TypeScript/JavaScriptfunction, class, interface, type, enum, const
Pythondef, class
Swiftfunc, class, struct, protocol, enum, extension
Gofunc, type (struct/interface)
Rustfn, struct, enum, trait, impl

Unsupported file types fall back to file-level conflict detection.

Requirements

  • Node.js 20+
  • Claude Code CLI (claude command available)
  • jq (for conflict detection hook)

Feedback

We'd love to hear from you! If you have feature requests, bug reports, or just want to share how you use claude-context-sync:

Development

bash
git clone https://github.com/ybin4548/claude-context-sync.gitcd claude-context-syncnpm installnpm run buildnpm test

License

MIT

来源:README.md,提交 0f1880c

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分

其他 Claude 集成