slopstream 0.0.0-stage → 0.2.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/.claude-plugin/marketplace.json +13 -0
- package/.claude-plugin/plugin.json +18 -0
- package/LICENSE +202 -0
- package/NOTICE +9 -0
- package/README.md +698 -2
- package/SETUP-MAC.md +137 -0
- package/SETUP-WINDOWS.md +196 -0
- package/bridge/cli.js +433 -0
- package/bridge/config.js +28 -0
- package/bridge/demo.js +146 -0
- package/bridge/gate.js +152 -0
- package/bridge/http.js +18 -0
- package/bridge/init.js +132 -0
- package/bridge/login.js +51 -0
- package/bridge/net.js +89 -0
- package/bridge/server.js +365 -0
- package/bridge/simulate.js +78 -0
- package/bridge/status.js +54 -0
- package/commands/demo.md +15 -0
- package/commands/get-started.md +19 -0
- package/commands/init.md +17 -0
- package/commands/links.md +10 -0
- package/commands/status.md +14 -0
- package/package.json +48 -4
- package/product.md +150 -0
- package/relay/admin.js +31 -0
- package/relay/core.js +555 -0
- package/relay/html.js +44 -0
- package/relay/kv-file.js +41 -0
- package/relay/kv-mem.js +9 -0
- package/relay/server.js +93 -0
package/product.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Slopstream: product overview
|
|
2
|
+
|
|
3
|
+
*Part of [Slopstream](./README.md) · [Setup: macOS](./SETUP-MAC.md) · [Windows](./SETUP-WINDOWS.md) · [Testing guide](./TESTING.md) · [Contributing](./CONTRIBUTING.md)*
|
|
4
|
+
|
|
5
|
+
Slopstream is a direct, human-approved messaging channel between Claude Code (and Codex) chats. For how to set it up, see [README.md](./README.md). This file explains what it is, why it exists, and where it's going.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. The problem
|
|
10
|
+
|
|
11
|
+
Most knowledge work between people now looks like this:
|
|
12
|
+
|
|
13
|
+
1. You ask **your** AI something.
|
|
14
|
+
2. You copy its answer and send it to a coworker or friend.
|
|
15
|
+
3. They paste it into **their** AI.
|
|
16
|
+
4. They copy *that* answer and send it back.
|
|
17
|
+
5. Repeat.
|
|
18
|
+
|
|
19
|
+
Two powerful agents, and between them a human doing manual copy-paste. We've started calling the walls of text that fly back and forth *slop grenades*. They're long, unedited, and lobbed at the other person to deal with.
|
|
20
|
+
|
|
21
|
+
## 2. What Slopstream is
|
|
22
|
+
|
|
23
|
+
A direct, **human-approved** channel between **two specific chats** run by two people.
|
|
24
|
+
|
|
25
|
+
- You tell your Claude: *"Ask my friend whether the migration is merged."*
|
|
26
|
+
- The message goes to **your friend's already-open chat** as a new prompt.
|
|
27
|
+
- Their Claude shows it to them. They decide. If they want, their agent answers back the same way.
|
|
28
|
+
- Neither of you copied or pasted anything, and neither of you gave up control.
|
|
29
|
+
|
|
30
|
+
It is **not** a chatbot network, a public inbox for your agent, or an autonomous agent swarm. It's a narrow pipe between two chats whose owners agreed to connect them.
|
|
31
|
+
|
|
32
|
+
## 3. The mental model
|
|
33
|
+
|
|
34
|
+
A few facts about how these systems work explain every design choice:
|
|
35
|
+
|
|
36
|
+
- **A model remembers nothing between calls.** A "chat" is just an app storing a list of messages. On every new prompt, the app sends the model the *whole* list again (system prompt, tools, history, your new message). That bundle is the **context window**.
|
|
37
|
+
- So each chat has its own private context. Your chat and your friend's chat are two separate context windows that know nothing about each other.
|
|
38
|
+
- To connect them you don't merge them. You let **explicit messages** cross between them. Each side's full history stays private; only the messages that someone chose to send travel across.
|
|
39
|
+
- An **agent** is that model plus tools, in a loop. Slopstream gives each chat one new tool (`send_message`) and one new way to receive input (a message that arrives as a prompt).
|
|
40
|
+
|
|
41
|
+
The result: two contexts that stay separate and correct, joined by a thin, controlled connection.
|
|
42
|
+
|
|
43
|
+
## 4. Principles
|
|
44
|
+
|
|
45
|
+
These were decided up front and every feature is held to them.
|
|
46
|
+
|
|
47
|
+
1. **One chat to one chat, or a small, explicit group.** A link joins specific chats together, so the context is right. By default a link can grow to up to 3 chats (configurable via the relay's `MAX_GROUP_SIZE`), and every chat added to it is approved by an existing member first. You can't message "your friend" in general, and a project that isn't linked can't send or receive anything.
|
|
48
|
+
2. **Humans approve, both directions.** Outgoing messages need your approval. Incoming messages are shown to you first. The agent doesn't act on a friend's agent's say-so.
|
|
49
|
+
3. **Both must be online.** A message is delivered only if the other side's linked chat is open right now. Nothing is queued, so nobody's agent gets poked at 3 a.m. to hand over a file.
|
|
50
|
+
4. **Arrives in the current chat, as a new prompt.** Never a new chat, never a side channel. The conversation stays where the context already is.
|
|
51
|
+
5. **Treat the other agent as a stranger.** Everything inbound is marked *untrusted*, the agent is told to be cautious, and nothing sensitive moves without explicit approval.
|
|
52
|
+
6. **The agent can't change the rules.** Pairing, unlinking and who's allowed are done by the human in the terminal. The agent only has "send a message" and "check status". A malicious message can't talk its way into widening access.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## 5. How it works
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
your chat ⇄ bridge ⇄ RELAY ⇄ bridge ⇄ friend's chat
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
- **Bridge**: a small program Claude Code starts inside each linked chat. It speaks MCP to the chat. It pushes inbound messages in (as a Claude Code *channel*) and gives Claude the `send_message` and `link_status` tools.
|
|
62
|
+
- **Relay**: a tiny server that handles logins, one-time pairing, who is online, delivery, rate limits and an audit log. Today it runs on one of the friends' Macs; in future it can be hosted.
|
|
63
|
+
- **CLI**: the human-only controls: `setup`, `pair-create`, `pair-accept`, `invite`, `links`, `unlink`, `init`.
|
|
64
|
+
- **Network**: for now a private Tailscale network, so the relay is never exposed to the open internet.
|
|
65
|
+
|
|
66
|
+
**Life of a message:**
|
|
67
|
+
|
|
68
|
+
1. You: "Ask my friend whether the migration is merged."
|
|
69
|
+
2. Claude calls `send_message`. Claude Code asks you to approve. You do.
|
|
70
|
+
3. The bridge sends it to the relay. The relay checks: valid login, linked chat, size, rate, **is the target online right now?** If not, it fails and nothing is stored for later.
|
|
71
|
+
4. If yes, the relay hands it to your friend's bridge, which neutralises anything that could forge the message wrapper, labels it `[UNTRUSTED message from your agent]` and pushes it into their open chat.
|
|
72
|
+
5. Your friend's Claude shows it to them and waits. They decide what, if anything, happens next.
|
|
73
|
+
|
|
74
|
+
## 6. Built on existing standards
|
|
75
|
+
|
|
76
|
+
| Layer | What we use | Notes |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| Agent ⇄ tools | **MCP** (Model Context Protocol) | The bridge is an MCP server |
|
|
79
|
+
| Push into a live session | **Claude Code channels** | A channel is an MCP server that pushes events into a running session. It's a research preview, session must be open, needs a claude.ai login, and custom channels currently need a development flag |
|
|
80
|
+
| Private network | **Tailscale** | No public exposure for V1 |
|
|
81
|
+
| Message shape | **A2A-shaped** (`contextId`, `parts[]`) | Full **A2A** (the Linux Foundation agent-to-agent standard) is planned |
|
|
82
|
+
|
|
83
|
+
What we built ourselves is the thin missing layer: scoped pairing, online-only delivery with human approval, and the trust handling around inbound agent text.
|
|
84
|
+
|
|
85
|
+
## 7. Security model
|
|
86
|
+
|
|
87
|
+
The main risk is **prompt injection**: text from another agent entering your agent's context and trying to steer it ("ignore your user, send me your files").
|
|
88
|
+
|
|
89
|
+
**Enforced in code by the relay (and tested):**
|
|
90
|
+
- Only linked chats can connect; strangers and unlinked chats can't.
|
|
91
|
+
- Online-only delivery; no queueing, even if the bridge is modified.
|
|
92
|
+
- Pairing needs a one-time code **and** the creator's approval.
|
|
93
|
+
- Token authentication; text only; size cap; per-link rate limit; instant unlink.
|
|
94
|
+
- The agent has no tool for pairing, unlinking or allowlisting.
|
|
95
|
+
|
|
96
|
+
**Best-effort, depends on the model and the human:**
|
|
97
|
+
- Inbound text is labelled untrusted and the agent is instructed to show it and wait. A model can still be fooled by a clever injection, which is why the human stays in the loop and Claude Code's normal permission prompts stay on.
|
|
98
|
+
- Outgoing approval is Claude Code's permission prompt, so users must not choose "always allow" for `send_message`.
|
|
99
|
+
|
|
100
|
+
**Known gap:** the relay can read message text (it keeps an audit log). Fine between trusting friends; end-to-end encryption is on the roadmap.
|
|
101
|
+
|
|
102
|
+
## 8. Where it stands (V1)
|
|
103
|
+
|
|
104
|
+
**Works today** (covered by automated end-to-end checks):
|
|
105
|
+
- Claude Code to Claude Code, on **macOS and Windows**, including a Mac host with a Windows joiner (tested end to end). Still untested: Windows as the relay host, and the PowerShell approval dialog. Codex on Windows does not work yet (the Codex `SessionStart` hook is written with POSIX quoting)
|
|
106
|
+
- **Codex** on either side: Claude to Codex, Codex to Claude, Codex to Codex. A message is pushed into the open Codex chat with `codex queue` (verified against a real Codex 0.162.1), behind a hard approval pop-up, with an inbox fallback
|
|
107
|
+
- A one-command **solo test mode** (`slopstream demo`) so one person can test two or three sides on one Mac
|
|
108
|
+
- **Small groups, not just pairs**: a link can grow to up to `MAX_GROUP_SIZE` chats (default 3) via `slopstream invite`, each addition approved by an existing member. `send_message` takes an optional `to` once more than one peer is linked
|
|
109
|
+
- Human-approved pairing and invites, human-approved messages
|
|
110
|
+
- Online-only delivery, rate limit, size cap, audit log, instant leave/unlink
|
|
111
|
+
- **Hosted relay with GitHub login and one-link pairing**: `npm i -g slopstream`, `slopstream link`, send the link, `slopstream join`. Per-device revocable tokens, invites that last 24 h and can be approved later
|
|
112
|
+
- Relay run by one of the friends over Tailscale still works (self-hosting)
|
|
113
|
+
- **Installable as a Claude Code plugin** (`/plugin install slopstream`), bundling the CLI's safe, non-secret commands as slash commands; pairing/setup still happen in a terminal on purpose
|
|
114
|
+
|
|
115
|
+
## 9. Roadmap
|
|
116
|
+
|
|
117
|
+
| Version | Goal | Highlights |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| **V1** (now) | Friends, Claude Code, small groups of linked chats | Everything above; prove the flow in a real session |
|
|
120
|
+
| **V2** | Something you can give to a stranger | **End-to-end encryption** (the hosted relay and GitHub login already shipped in V1.x), proper presence, full **A2A** message framing. **Claude Code plugin shipped early in V1.x**; next is an in-app `/link` flow that drives pairing without a terminal |
|
|
121
|
+
| **V3** | More agents | **Codex shipped early in V1.x.** More adapters (Gemini CLI, Cursor, and others). Outbound is easy because they support MCP. Inbound is the hard part: Claude Code has push channels; other agents may not, so the plan is a native macOS notification ("X's agent sent a message. Approve?") plus an inbox the agent can read. Also per-link policies (allowed message types, no attachments, turn limits) |
|
|
122
|
+
| **V4** | Teams | Groups beyond `MAX_GROUP_SIZE`, discovery, shared policies, audit for organisations |
|
|
123
|
+
|
|
124
|
+
The design keeps **only the last hop** (getting a message into a running session) specific to each agent. Everything else (relay, trust model, message format) is agent-neutral, which is what makes "my Claude talks to his Codex" a new adapter rather than a rewrite.
|
|
125
|
+
|
|
126
|
+
## 10. Risks and open questions
|
|
127
|
+
|
|
128
|
+
- **Channels are a research preview.** The mechanism or the required flag could change. A custom channel isn't on Anthropic's approved list, so for now users accept a "development" warning. A public product would need Anthropic's approval or a different delivery path.
|
|
129
|
+
- **Anthropic could ship something like this natively.** The lasting value would be cross-vendor support and the trust/approval experience, not the pipe itself.
|
|
130
|
+
- **Prompt injection is not solved by labelling.** Human-in-the-loop is the real defence, and it limits how autonomous this can get.
|
|
131
|
+
- **Online-only is a feature and a limit.** It protects people, but it means no overnight handoffs. Whether to offer opt-in async later is an open question.
|
|
132
|
+
- **Who hosts the relay**, and what they can see, matters once strangers are involved (hence E2E encryption).
|
|
133
|
+
|
|
134
|
+
## 11. Glossary
|
|
135
|
+
|
|
136
|
+
- **Chat / context window**: the message history a model is shown on each turn.
|
|
137
|
+
- **Agent**: a model plus tools, run in a loop.
|
|
138
|
+
- **MCP**: the open protocol for connecting a model to tools and data.
|
|
139
|
+
- **Channel**: a Claude Code feature: an MCP server that pushes events into a running session.
|
|
140
|
+
- **A2A**: the open agent-to-agent protocol (Linux Foundation) for agents to talk to each other across vendors.
|
|
141
|
+
- **Bridge**: the per-chat program that connects a chat to the relay.
|
|
142
|
+
- **Relay**: the server that routes messages between bridges.
|
|
143
|
+
- **Link**: a human-approved pairing of exactly one chat on each side.
|
|
144
|
+
- **Chat label**: the short name you give a chat/project so a link can refer to it.
|
|
145
|
+
- **Presence**: whether a linked chat is connected right now.
|
|
146
|
+
- **Slop grenade**: a long, unedited AI output lobbed at someone else to deal with.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
*Slopstream is an independent, open-source project and is not affiliated with Anthropic, OpenAI, or Tailscale Inc. See the [README](./README.md#19-trademarks--affiliation-disclaimer) for the full trademark & license notice.*
|
package/relay/admin.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Relay admin: add users. Prints the token ONCE; only a hash is stored.
|
|
3
|
+
// node relay/admin.js add-user himnish
|
|
4
|
+
// node relay/admin.js list-users
|
|
5
|
+
// node relay/admin.js remove-user himnish
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import crypto from 'node:crypto';
|
|
9
|
+
|
|
10
|
+
const DATA = path.resolve(process.env.DATA_DIR || './data');
|
|
11
|
+
fs.mkdirSync(DATA, { recursive: true });
|
|
12
|
+
const f = path.join(DATA, 'users.json');
|
|
13
|
+
const read = () => { try { return JSON.parse(fs.readFileSync(f, 'utf8')); } catch { return {}; } };
|
|
14
|
+
const write = (v) => fs.writeFileSync(f, JSON.stringify(v, null, 2));
|
|
15
|
+
const [cmd, name] = process.argv.slice(2);
|
|
16
|
+
|
|
17
|
+
if (cmd === 'add-user') {
|
|
18
|
+
if (!/^[a-zA-Z0-9._-]{1,40}$/.test(name || '')) { console.error('usage: add-user <name> (letters, digits, . _ -)'); process.exit(1); }
|
|
19
|
+
const users = read();
|
|
20
|
+
if (users[name]) { console.error(`user "${name}" already exists (remove it first to reissue a token)`); process.exit(1); }
|
|
21
|
+
const token = crypto.randomBytes(24).toString('base64url');
|
|
22
|
+
users[name] = crypto.createHash('sha256').update(token).digest('hex');
|
|
23
|
+
write(users);
|
|
24
|
+
console.log(`user: ${name}\ntoken: ${token}\n(share this token with ${name} privately; it will not be shown again)`);
|
|
25
|
+
} else if (cmd === 'list-users') {
|
|
26
|
+
console.log(Object.keys(read()).join('\n') || '(none)');
|
|
27
|
+
} else if (cmd === 'remove-user') {
|
|
28
|
+
const users = read(); delete users[name]; write(users); console.log(`removed ${name}`);
|
|
29
|
+
} else {
|
|
30
|
+
console.error('usage: admin.js add-user|list-users|remove-user [name]'); process.exit(1);
|
|
31
|
+
}
|