claudelink 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jay Siddiqi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,474 @@
1
+ # ClaudeLink
2
+
3
+ **The hub where your AI agents connect.**
4
+
5
+ ClaudeLink lets multiple Claude Code instances running in separate terminals communicate with each other in real time. Open four terminals, give each agent a role, and watch them collaborate — sending messages, sharing findings, and coordinating work through a shared bulletin board.
6
+
7
+ ```
8
+ Terminal 1 (reviewer) ──┐
9
+ Terminal 2 (developer) ──┤── ClaudeLink ── SQLite
10
+ Terminal 3 (tester) ──┤
11
+ Terminal 4 (ops) ──┘
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ # Install and configure (one command)
18
+ npx claudelink init
19
+ ```
20
+
21
+ Restart your Claude Code terminals. That's it.
22
+
23
+ ### In Terminal 1:
24
+ > "Register as a code reviewer working on the auth module"
25
+
26
+ ### In Terminal 2:
27
+ > "Register as a developer. Check inbox for messages from the reviewer."
28
+
29
+ ### Terminal 1 says to Claude:
30
+ > "Send a message to the developer: Found a SQL injection vulnerability in auth.ts line 42. The user input is not sanitized before the query."
31
+
32
+ ### Terminal 2 says to Claude:
33
+ > "Read my inbox"
34
+
35
+ The developer agent receives the reviewer's message and can act on it.
36
+
37
+ ## Installation
38
+
39
+ ### Step 1: Install the package
40
+ ```bash
41
+ npm install -g claudelink
42
+ ```
43
+
44
+ ### Step 2: Add to Claude Code (pick one)
45
+
46
+ **Global (recommended — works in every project):**
47
+ ```bash
48
+ claude mcp add --scope user claudelink -- claudelink-server
49
+ ```
50
+ This adds ClaudeLink to `~/.claude.json` so it's available in every Claude Code session, in every project. One command, done forever.
51
+
52
+ **Per-Project (only this project):**
53
+ ```bash
54
+ cd your-project
55
+ npx claudelink init
56
+ ```
57
+ This adds ClaudeLink to `.mcp.json` in your project directory only.
58
+
59
+ ### Step 3: Restart Claude Code
60
+
61
+ Close and reopen Claude Code in your terminals. ClaudeLink tools will be available automatically.
62
+
63
+ ### Requirements
64
+ - Node.js 18+
65
+ - Claude Code CLI
66
+
67
+ ## How It Works
68
+
69
+ ClaudeLink is an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) server. Each Claude Code instance connects to it automatically and gets access to communication tools. All instances share a single SQLite database (`~/.claudelink/nexus.db`) using WAL mode for safe concurrent access.
70
+
71
+ There is no daemon or background service. Each Claude Code session spawns its own MCP server process, and they coordinate through the shared database.
72
+
73
+ ## Available Tools
74
+
75
+ Once connected, Claude Code gains these tools:
76
+
77
+ ### `register`
78
+ Register this agent with a role so others can find it.
79
+ ```
80
+ "Register as a developer working on the payment system"
81
+ ```
82
+
83
+ ### `send`
84
+ Send a direct message to an agent by role.
85
+ ```
86
+ "Send a high-priority message to the reviewer: the fix is ready for re-review"
87
+ ```
88
+
89
+ ### `broadcast`
90
+ Send a message to ALL connected agents.
91
+ ```
92
+ "Broadcast: deployment starting in 5 minutes, hold all merges"
93
+ ```
94
+
95
+ ### `read_inbox`
96
+ Check for new messages.
97
+ ```
98
+ "Check my inbox"
99
+ ```
100
+
101
+ ### `get_agents`
102
+ See who's online.
103
+ ```
104
+ "Show me all connected agents"
105
+ ```
106
+
107
+ ### `post_bulletin`
108
+ Post to the shared bulletin board (persistent announcements).
109
+ ```
110
+ "Post to bulletin: v2.1 release branch created, all features frozen"
111
+ ```
112
+
113
+ ### `get_bulletin`
114
+ Read the bulletin board.
115
+ ```
116
+ "Show the bulletin board"
117
+ ```
118
+
119
+ ## CLI Commands
120
+
121
+ ```bash
122
+ claudelink init # Configure for current project
123
+ claudelink init --global # Configure globally
124
+ claudelink status # Show registered agents and message stats
125
+ claudelink reset # Clear all data (fresh start)
126
+ claudelink help # Show help
127
+ ```
128
+
129
+ ## Autonomous Mode (Recommended)
130
+
131
+ By default, you'd have to tell Claude "check my inbox" manually every time. That defeats the purpose. With autonomous mode, agents communicate **on their own** — checking for messages and sending updates without you asking.
132
+
133
+ ### Automatic Setup
134
+
135
+ **This is installed automatically** when you run `claudelink init` or `claudelink init --global`. The init command creates a `CLAUDE.md` file with the autonomous communication instructions in the appropriate directory:
136
+
137
+ - `init --global` → writes to `~/.claude/CLAUDE.md` (all projects)
138
+ - `init` → writes to `./CLAUDE.md` (current project only)
139
+
140
+ If you already have a `CLAUDE.md`, the ClaudeLink instructions are appended without overwriting your existing content. Running init multiple times is safe — it won't duplicate the instructions.
141
+
142
+ ### What It Teaches Claude
143
+
144
+ The `CLAUDE.md` file instructs every Claude Code session to:
145
+
146
+ - **Check inbox automatically** before and after every task
147
+ - **Send updates proactively** to other agents when work is completed
148
+ - **Respond to messages immediately** without waiting for you to say "check inbox"
149
+ - **Post to the bulletin board** when making decisions that affect the project
150
+
151
+ ### Manual Fallback
152
+
153
+ If the automatic setup doesn't work on your system (different directory structure, permissions, etc.), you can manually create or add to `~/.claude/CLAUDE.md`:
154
+
155
+ ```markdown
156
+ ## ClaudeLink - Autonomous Agent Communication
157
+
158
+ You are part of a multi-agent team. Other agents may be running in separate
159
+ terminals and can send you messages at any time via ClaudeLink.
160
+
161
+ ### Automatic Inbox Checking
162
+
163
+ - BEFORE starting any task: Check your inbox using read_inbox first
164
+ - AFTER completing any task: Check your inbox again using read_inbox
165
+ - If you receive a message, acknowledge it and act on it before moving on
166
+ - If a message requires you to change your current work, do so immediately
167
+ - If a message is from another agent asking for information, respond using send
168
+ before continuing your own work
169
+ - High-priority messages take precedence over your current task
170
+
171
+ ### Autonomous Collaboration
172
+
173
+ - When you finish work that another agent might care about, proactively send
174
+ them an update
175
+ - If you encounter a problem that another agent's role could help with, send
176
+ them a message
177
+ - When you make a decision that affects the project, post it to the bulletin board
178
+ - If you're blocked waiting for another agent, say so and check inbox again
179
+
180
+ ### Communication Shortcuts
181
+
182
+ - "check response" or "check messages" — Use read_inbox to check for new messages
183
+ - "ask the [role]" — Send a message to that role and check inbox for their reply
184
+ - "tell the [role]" — Send a one-way message to that role
185
+ - "who's online" — Use get_agents to list all connected agents
186
+ - "update the board" — Use post_bulletin to post a status update
187
+ - "check the board" — Use get_bulletin to read the bulletin board
188
+ ```
189
+
190
+ ### Per-Project vs Global
191
+
192
+ | File | Applies to |
193
+ |------|-----------|
194
+ | `~/.claude/CLAUDE.md` | **Every project, every terminal** — recommended |
195
+ | `your-project/CLAUDE.md` | Only that specific project |
196
+
197
+ If you want autonomous mode everywhere (most people do), use the global file. If you only want it for specific projects, put it in the project's `CLAUDE.md`.
198
+
199
+ ### What Autonomous Mode Looks Like
200
+
201
+ Without autonomous mode:
202
+ ```
203
+ You: Fix the bug in auth.ts
204
+ Claude: (fixes the bug)
205
+ You: Now check your inbox
206
+ Claude: You have 1 message from the reviewer...
207
+ You: Send the reviewer an update
208
+ Claude: Message sent.
209
+ ```
210
+
211
+ With autonomous mode:
212
+ ```
213
+ You: Fix the bug in auth.ts
214
+ Claude: (checks inbox — sees a tip from the reviewer about the bug)
215
+ (fixes the bug using the reviewer's guidance)
216
+ (sends the reviewer: "Fixed it, here's what I changed...")
217
+ (posts to bulletin: "auth.ts bug fixed")
218
+ (checks inbox again — no new messages)
219
+ Done. I fixed the token validation bug. The reviewer had already
220
+ flagged the exact line, so I used their suggestion.
221
+ ```
222
+
223
+ One instruction from you. All the communication happens automatically.
224
+
225
+ ---
226
+
227
+ ## Use Cases
228
+
229
+ ### Code Review Pipeline
230
+ - **Terminal 1** (reviewer): Reviews code, sends findings to developer
231
+ - **Terminal 2** (developer): Receives feedback, implements fixes, notifies reviewer when ready
232
+
233
+ ### Test-Driven Development
234
+ - **Terminal 1** (developer): Writes implementation
235
+ - **Terminal 2** (tester): Runs tests, reports failures back to developer
236
+
237
+ ### Full Team Simulation
238
+ - **Terminal 1** (architect): Posts design decisions to bulletin board
239
+ - **Terminal 2** (developer): Implements features, asks architect for clarification
240
+ - **Terminal 3** (reviewer): Reviews code, sends feedback to developer
241
+ - **Terminal 4** (ops): Monitors build pipeline, broadcasts deployment status
242
+
243
+ ### Parallel Feature Development
244
+ - **Terminal 1** (dev-auth): Working on authentication
245
+ - **Terminal 2** (dev-api): Working on API endpoints
246
+ - Both agents coordinate to avoid conflicts and share interface contracts
247
+
248
+ ## Architecture
249
+
250
+ ```
251
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
252
+ │ Claude Code │ │ Claude Code │ │ Claude Code │
253
+ │ (Terminal 1) │ │ (Terminal 2) │ │ (Terminal 3) │
254
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
255
+ │ │ │
256
+ │ stdio │ stdio │ stdio
257
+ │ │ │
258
+ ┌──────▼───────┐ ┌──────▼───────┐ ┌──────▼───────┐
259
+ │ MCP Server │ │ MCP Server │ │ MCP Server │
260
+ │ (Process 1) │ │ (Process 2) │ │ (Process 3) │
261
+ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘
262
+ │ │ │
263
+ └────────────────────┼────────────────────┘
264
+
265
+ ┌────────▼────────┐
266
+ │ SQLite (WAL) │
267
+ │ ~/.claudelink/ │
268
+ │ nexus.db │
269
+ └─────────────────┘
270
+ ```
271
+
272
+ Each Claude Code session spawns its own MCP server process via stdio. All processes read and write to the same SQLite database. WAL (Write-Ahead Logging) mode ensures concurrent access is safe and performant.
273
+
274
+ ### Why SQLite?
275
+ - Zero configuration — single file, no server to run
276
+ - WAL mode handles concurrent readers and writers
277
+ - Survives process crashes — no data loss
278
+ - Portable across macOS, Linux, and Windows
279
+
280
+ ### Message Flow
281
+ 1. Agent A calls `send(to="developer", message="...")`
282
+ 2. MCP Server A writes a row to the `messages` table
283
+ 3. Agent B calls `read_inbox()`
284
+ 4. MCP Server B reads unread rows from `messages` and marks them read
285
+ 5. Agent B receives the message and can act on it
286
+
287
+ ### Agent Lifecycle
288
+ - Agents register with a `role` and their process `pid`
289
+ - A heartbeat updates `last_seen` every 30 seconds
290
+ - When listing agents, dead processes (checked via `kill -0 pid`) are automatically pruned
291
+ - No manual cleanup needed
292
+
293
+ ## Configuration
294
+
295
+ ClaudeLink stores its database at `~/.claudelink/nexus.db`. This path is fixed so all Claude Code instances across all projects converge on the same communication hub.
296
+
297
+ ### .mcp.json (per-project)
298
+ ```json
299
+ {
300
+ "mcpServers": {
301
+ "claudelink": {
302
+ "type": "stdio",
303
+ "command": "claudelink-server"
304
+ }
305
+ }
306
+ }
307
+ ```
308
+
309
+ ### ~/.claude.json (global via CLI)
310
+ ```bash
311
+ claude mcp add --scope user claudelink -- claudelink-server
312
+ ```
313
+
314
+ ## FAQ
315
+
316
+ ### Wait, does `npx claudelink init` start Claude?
317
+
318
+ **No.** You only run `npx claudelink init` **once**. It's a setup command that writes a config file (`.mcp.json`) telling Claude Code to connect to ClaudeLink on startup. After that, you never need to run it again.
319
+
320
+ Your daily workflow is exactly the same as before:
321
+
322
+ ```bash
323
+ # Terminal 1 — start Claude normally
324
+ claude
325
+
326
+ # Terminal 2 — start Claude normally
327
+ claude
328
+
329
+ # Terminal 3 — start Claude with full auto-permissions
330
+ claude --dangerously-skip-permissions
331
+ ```
332
+
333
+ Claude Code reads `.mcp.json` when it starts, sees ClaudeLink is configured, and automatically connects. The `register`, `send`, `read_inbox`, and other tools just appear — no extra commands.
334
+
335
+ Then you just talk naturally:
336
+
337
+ **Terminal 1:**
338
+ > "Register as a code reviewer working on the auth module"
339
+
340
+ **Terminal 2:**
341
+ > "Register as a developer. Send a message to the reviewer asking if auth.ts looks good."
342
+
343
+ ### How do I start Claude with different permission modes?
344
+
345
+ ClaudeLink works with all Claude Code startup modes:
346
+
347
+ ```bash
348
+ # Standard mode (Claude asks before using tools)
349
+ claude
350
+
351
+ # Skip all permission prompts
352
+ claude --dangerously-skip-permissions
353
+
354
+ # Auto-approve only ClaudeLink tools (recommended)
355
+ claude --allowedTools "mcp__claudelink__*"
356
+ ```
357
+
358
+ ### How do I disable ClaudeLink?
359
+
360
+ You do **not** need to restart your computer. There are several options depending on what you want:
361
+
362
+ **Option 1: Disable for a specific project**
363
+
364
+ Remove the `claudelink` entry from your project's `.mcp.json`:
365
+
366
+ ```bash
367
+ # Open the config
368
+ nano .mcp.json
369
+ ```
370
+
371
+ Delete the `"claudelink": { ... }` block, save, and restart Claude Code in that terminal. ClaudeLink tools will no longer appear for that project.
372
+
373
+ **Option 2: Disable globally**
374
+
375
+ If you installed globally, remove it via CLI:
376
+
377
+ ```bash
378
+ claude mcp remove --scope user claudelink
379
+ ```
380
+
381
+ **Option 3: Clear all data but keep it installed**
382
+
383
+ ```bash
384
+ npx claudelink reset
385
+ ```
386
+
387
+ This deletes the database (all messages, agents, bulletin entries) but keeps the config so you can start fresh.
388
+
389
+ **Option 4: Full uninstall (remove everything)**
390
+
391
+ ```bash
392
+ # 1. Remove from project config
393
+ # Edit .mcp.json and delete the claudelink entry
394
+
395
+ # 2. Remove from global config
396
+ claude mcp remove --scope user claudelink
397
+
398
+ # 3. Uninstall the package
399
+ npm uninstall -g claudelink
400
+
401
+ # 4. Delete all ClaudeLink data
402
+ rm -rf ~/.claudelink
403
+ ```
404
+
405
+ After any of these, just restart your Claude Code sessions. No computer restart needed — just close and reopen the terminal, or start a new `claude` session.
406
+
407
+ ### Can I temporarily disable it without deleting anything?
408
+
409
+ Yes. In your `.mcp.json`, add `"disabled": true`:
410
+
411
+ ```json
412
+ {
413
+ "mcpServers": {
414
+ "claudelink": {
415
+ "type": "stdio",
416
+ "command": "claudelink-server",
417
+ "disabled": true
418
+ }
419
+ }
420
+ }
421
+ ```
422
+
423
+ Set it back to `false` (or remove the line) to re-enable. Restart Claude Code after changing.
424
+
425
+ ---
426
+
427
+ ## Contributing
428
+
429
+ Contributions are welcome! This is an open-source project and we'd love the community to help build on it.
430
+
431
+ ### Development Setup
432
+ ```bash
433
+ git clone https://github.com/jaysidd/claudelink.git
434
+ cd claudelink
435
+ npm install
436
+ npm run build
437
+ ```
438
+
439
+ ### Testing Locally
440
+ ```bash
441
+ # Run the MCP server directly (for debugging)
442
+ node dist/index.js
443
+
444
+ # Test the CLI
445
+ node dist/cli.js init
446
+ node dist/cli.js status
447
+ ```
448
+
449
+ ### Ideas for Contributions
450
+ - **Agent groups/channels**: Named channels for topic-based communication
451
+ - **Message history**: Tool to view past messages (not just unread)
452
+ - **File sharing**: Agents can share file paths or code snippets with structured formatting
453
+ - **Priority notifications**: Interrupt the current agent when a high-priority message arrives
454
+ - **Web dashboard**: A local web UI to visualize agent activity
455
+ - **Agent templates**: Pre-built role configurations for common workflows
456
+ - **Webhooks**: Notify external services when agents communicate
457
+ - **Encryption**: Encrypt messages at rest in the database
458
+ - **Multi-machine support**: Replace SQLite with a networked backend for remote agent communication
459
+
460
+ ## License
461
+
462
+ MIT License — see [LICENSE](LICENSE) for details.
463
+
464
+ ---
465
+
466
+ Built by [Jay Siddiqi](https://github.com/jaysidd).
467
+
468
+ If ClaudeLink helps your workflow, give it a star and share it with your team.
469
+
470
+ ---
471
+
472
+ ### Keywords
473
+
474
+ claudelink, claude link, multi-agent communication, claude code, claude code mcp, mcp server, model context protocol, ai agent collaboration, multi-terminal ai, agent-to-agent messaging, inter-process communication, ipc ai agents, claude code plugin, claude code extension, ai pair programming, ai code review, multi-agent workflow, ai terminal tools, developer tools, ai developer tools, open source ai tools, agent orchestration, agent mesh, ai agent hub, collaborative ai agents, claude mcp server, sqlite mcp, ai swarm, multi-agent system, ai team simulation, agent message bus, claude code multi-instance, iterm2 ai, terminal ai agents, ai agent framework, autonomous ai agents, agent communication protocol, ai productivity tools, claude code tools, mcp tools, ai workflow automation
package/bin/cli.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli.js');
package/bin/server.js ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/index.js');
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};