vine-context 0.0.1 → 0.1.1

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.
Files changed (34) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +279 -3
  3. package/dist/apps/shell.html +149 -0
  4. package/dist/apps/views.html +144 -0
  5. package/dist/cli.js +7825 -0
  6. package/dist/cli.js.map +1 -0
  7. package/examples/data/graphs/party/.cypherlite/schema/schema.cypher +5 -0
  8. package/examples/data/graphs/party/.cypherlite.lock +1 -0
  9. package/examples/data/graphs/party/.cypherlite.writer +0 -0
  10. package/examples/data/graphs/party/manifest.json +215 -0
  11. package/examples/data/graphs/party/nodes/0-262144-7987dd27c85668d4810609133f705907.parquet +0 -0
  12. package/examples/data/graphs/party/wal/.cypherlite.lock +1 -0
  13. package/examples/data/graphs/party/wal/.cypherlite.writer +0 -0
  14. package/examples/data/graphs/party/wal/00000002.log +0 -0
  15. package/examples/data/hosts/party/changes.jsonl +19 -0
  16. package/examples/data/hosts/party/group.json +5 -0
  17. package/examples/data/hosts/party/sharing.json +1 -0
  18. package/examples/data/identity.json +4 -0
  19. package/models/temporal-claims/instructions.md +78 -0
  20. package/models/temporal-claims/model.yaml +99 -0
  21. package/models/temporal-claims/tools.yaml +344 -0
  22. package/package.json +71 -3
  23. package/plugin/.claude-plugin/plugin.json +8 -0
  24. package/plugin/.codex-plugin/plugin.json +17 -0
  25. package/plugin/.mcp.json +8 -0
  26. package/plugin/codex/hooks.json +11 -0
  27. package/plugin/commands/join.md +22 -0
  28. package/plugin/hooks/hooks.json +11 -0
  29. package/plugin/hooks/register.tsx +2310 -0
  30. package/plugin/hooks/vine-hook.mjs +25 -0
  31. package/plugin/skills/join-context-graph/SKILL.md +36 -0
  32. package/plugin/skills/vine-context/SKILL.md +235 -0
  33. package/plugin/tests/context-graph.test.tsx +830 -0
  34. package/plugin/types/index.d.ts +165 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,5 +1,281 @@
1
- # vine-context
1
+ <h1 align="center"><img src="docs/images/vine-context-logo.svg" alt="Vine Context" width="460"></h1>
2
2
 
3
- This is a placeholder that reserves the name. Vine Context, an MCP server and skill that shares context graphs peer to peer, will be published here as 0.1.0.
3
+ <p align="center"><a href="https://github.com/CraigDeverall/vine-context/actions/workflows/ci.yml"><img src="https://github.com/CraigDeverall/vine-context/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a></p>
4
4
 
5
- Source: https://github.com/CraigDeverall/vine-context
5
+ <p align="center"><b>P2P Shared memory graph for a team and their AI agents</b></p>
6
+
7
+ One [Relate](https://relatedb.ai/) context graph of claims and questions, kept in step between everyone's machines, peer to peer, with no server.
8
+
9
+ ```bash
10
+ npx vine-context setup
11
+ ```
12
+
13
+ One command installs the `vine` command and the plugin for Claude Code or Codex, checks the machine and its network, and repairs it if you run it again. `--dry-run` shows what it would do without changing anything.
14
+
15
+ <details><summary>By hand</summary>
16
+
17
+ ```bash
18
+ npm install -g vine-context
19
+ claude plugin marketplace add CraigDeverall/vine-context
20
+ claude plugin install vine-context@vine-context
21
+ vine doctor
22
+ ```
23
+
24
+ Codex and other MCP agents: see [the guide](docs/GUIDE.md#install-by-hand). To run it from a clone of this repo instead, see [Setup and run](#1-install-it).
25
+
26
+ </details>
27
+
28
+ Then tell your agent *"start a context called incident-42"*, or look first with no agent at all:
29
+
30
+ ```bash
31
+ vine demo
32
+ ```
33
+
34
+ `demo` runs three members in one process: alice creates the example context, bob and carol join it with codes, and the three replay the planning of an office Christmas party, each writing through their own host and syncing peer to peer. Your browser shows alice's view of it, live. Nothing of yours is touched, and no network is needed. You need Node 20 or later, and no account, API key, compiler or model download.
35
+
36
+ ![The graph explorer on the example party graph](docs/images/explorer.jpg)
37
+
38
+ <!-- Demo video: add the link here once it is recorded. -->
39
+
40
+ | If you want to… | Go to |
41
+ |---|---|
42
+ | Install it and try it | [Setup and run](#setup-and-run) |
43
+ | See what Relate does here | [How it uses Relate](#how-it-uses-relate), then [docs/RELATE.md](docs/RELATE.md) |
44
+ | Query the example graph yourself | [Where the data lives](#where-the-data-lives) |
45
+ | Use it with your own team | [docs/GUIDE.md](docs/GUIDE.md) |
46
+ | Understand the peer-to-peer design | [How it works](#how-it-works), then [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md) |
47
+ | Judge it for the Relate hackathon | [docs/HACKATHON.md](docs/HACKATHON.md) |
48
+
49
+ ## Use case
50
+
51
+ When three people work on the same thing with their own AI agents, planning the office Christmas party, say, each agent learns things the others never see. Findings get repeated, contradictions go unnoticed (one person has booked a room that another has found is too small), and a week later nobody can say what the team believed when it made a call.
52
+
53
+ Vine Context gives the group one shared graph of **claims** and **questions**.
54
+
55
+ 1. One person creates a context and sends each teammate a join code.
56
+ 2. Each teammate pastes the code into their agent and gets a full copy of the graph on their own machine.
57
+ 3. From then on every agent reads and writes its own copy, and the machines swap what each is missing whenever they are online.
58
+
59
+ It keeps working offline, and when the person who created it is away.
60
+
61
+ **The relationships are the point.** An agent with this graph doesn't guess what the team thinks: it follows the links.
62
+
63
+ | What the team asks | Relationships that answer it |
64
+ |---|---|
65
+ | What do we believe now, and what did we believe on Tuesday? | `REPLACES` between claims, read *as of* any moment |
66
+ | Where do we disagree? | `CONTRADICTS` between claims that are both still current |
67
+ | Which questions are still open? | `ANSWERS` from a current claim to a question |
68
+ | What is this based on? | `SUPPORTS` chains, followed back to the evidence |
69
+ | What has been said about an open question? | `REPLIES_TO` from the messages in its thread |
70
+
71
+ **Who it's for:** a small group (up to about 20 people) working on the same thing, each with their own AI agent: an incident, a research question, a design decision, a project.
72
+
73
+ ## How it uses Relate
74
+
75
+ - **Mode: directory.** Each context is one Relate directory store, embedded in a Node process with [`@relate/relate`](https://github.com/relatedb/relate). Nothing is deployed.
76
+ - **Why this mode.** A shared context outlives every agent session and is written all day, so it needs a durable store with a write-ahead log. An in-memory graph would lose the team's knowledge when the process stops. A single file suits shipping a snapshot, not a store that many sessions write through one long-lived process. A directory can also be opened by anyone with Relate's own CLI.
77
+ - **What the graph models.** `Claim`, `Question` and `Reply` nodes, linked by `SUPPORTS`, `CONTRADICTS`, `REPLACES`, `ANSWERS`, `ABOUT` and `REPLIES_TO`. Every node and relationship records when it entered the graph and who recorded it, so any read can answer *as of* a past moment. Nothing is deleted.
78
+ - **Every member has their own Relate store.** Each one is built by applying the same log of signed changes, so the same changes give the same graph on every machine, whatever order they arrived in.
79
+
80
+ ```mermaid
81
+ flowchart LR
82
+ C1[Claim] -- SUPPORTS --> C2[Claim]
83
+ C3[Claim] -- CONTRADICTS --> C2
84
+ C4[Claim] -- REPLACES --> C2
85
+ C4 -- ANSWERS --> Q[Question]
86
+ Q -- ABOUT --> C1
87
+ R[Reply] -- REPLIES_TO --> Q
88
+ ```
89
+
90
+ The Relate features in use: an embedded directory store, uniqueness constraints, a vector index and a full-text index, hybrid search (`SEARCH … COMBINE (VECTOR …, FULLTEXT …)`), temporal values with `EXISTS {}` subqueries, pattern comprehensions, and transactions around every read and write. [docs/RELATE.md](docs/RELATE.md) shows where each one is used, with the Cypher.
91
+
92
+ ## Setup and run
93
+
94
+ **Prerequisites:** Node 20 or later, and git. Tested on macOS arm64 and, in CI, on Linux x64, macOS and Windows x64. The native parts (Relate and node-datachannel) ship prebuilt binaries.
95
+
96
+ ### 1. Install it
97
+
98
+ ```bash
99
+ npx vine-context setup
100
+ ```
101
+
102
+ One command sets the machine up, and repairs it if you run it again. It installs the `vine` command and the plugin for Claude Code or Codex (printing each command before it runs it), confirms your name, checks the machine and its network, sets up a TURN server if the network looks like it needs one, and offers autostart on macOS. `--dry-run` shows what it would do without changing anything.
103
+
104
+ <details><summary>By hand</summary>
105
+
106
+ ```bash
107
+ npm install -g vine-context
108
+ claude plugin marketplace add CraigDeverall/vine-context
109
+ claude plugin install vine-context@vine-context
110
+ vine doctor
111
+ ```
112
+
113
+ Codex and other MCP agents: see [the guide](docs/GUIDE.md#install-by-hand).
114
+
115
+ </details>
116
+
117
+ <details><summary>From a clone of this repo (no npm registry needed)</summary>
118
+
119
+ ```bash
120
+ git clone https://github.com/CraigDeverall/vine-context.git
121
+ cd vine-context
122
+ npm ci
123
+ npm run build
124
+ npm link
125
+ vine demo
126
+ ```
127
+
128
+ `npm link` puts this clone's `vine` command on your PATH, so the plugin steps above work with it too. `npm run check` runs the typecheck, the tests and the build, as CI does.
129
+
130
+ </details>
131
+
132
+ ### 2. See it (about two minutes)
133
+
134
+ ```bash
135
+ vine demo
136
+ ```
137
+
138
+ Three hosts start in this process, one each for alice, bob and carol: alice creates the context, the other two join it with codes, and the story plays through them, one step every few seconds. Every write is signed by its author's host, held for undo, then carried to the other two over WebRTC, and the terminal says when each one arrives. In the browser page that opens, which is alice's view:
139
+
140
+ 1. **Sharing console** shows the three members, their keys, roles and live links.
141
+ 2. **Explore the graph** fills in as the changes arrive. Once the story is over, drag the time slider back to replay it: a conflict between bob's claim and carol's appears, then settles when bob replaces his claim.
142
+ 3. **Conflicts** shows the two claims side by side while they contradict each other.
143
+
144
+ `--pace 1` runs it faster, `--pace 0` all at once. `--join` finds the members through the public Nostr relays instead of in this process, and prints a join code at the end, so your own agent (on this machine or another) can join as a fourth member and write into the same graph.
145
+
146
+ ### 3. Use it from your agent
147
+
148
+ `vine setup` installed the plugin. It brings the MCP server, the skills and the `/vine-context:join` command, and in Claude Code a live panel beside the chat. Codex uses the same plugin, and any other MCP agent can run `vine mcp` directly: see [the guide](docs/GUIDE.md#install).
149
+
150
+ Then ask in plain words:
151
+
152
+ - *"Start a context called incident-42."*
153
+ - *"Record that 48 people are coming, from the RSVP sheet."*
154
+ - *"What open questions are there?"*
155
+ - *"Open the graph explorer."*
156
+
157
+ The agent only gets the model's tools (`add_claim`, `ask_question`, `link`, `search`, `beliefs`, `conflicts` and so on), never raw Cypher.
158
+
159
+ ### 4. Share it
160
+
161
+ 1. **You:** *"Invite Sam to my context."* Your agent gives you a line to send privately: `/vine-context:join vine1_…`
162
+ 2. **Sam:** pastes it into their agent while your machine is online. They get a full copy and a briefing: what the context holds, the open questions, the conflicts.
163
+ 3. **Everyone in the context is told** who joined. From then on, whatever anyone records reaches the others the next time their machines are online together.
164
+
165
+ Join codes, roles, undo, working offline and removing someone are covered in [the guide](docs/GUIDE.md).
166
+
167
+ ## Where the data lives
168
+
169
+ **The example store is in this repo**, at [`examples/data/graphs/party`](examples/data/graphs/party): 8 claims (one withdrawn), 3 questions, 3 replies and 14 relationships. It is an ordinary Relate directory store, so [Relate's CLI](https://relatedb.ai/docs/get-started/install/) opens it:
170
+
171
+ ```bash
172
+ cp -R "$(npm root -g)/vine-context/examples/data/graphs/party" /tmp/party
173
+ ```
174
+
175
+ ```bash
176
+ relate -d /tmp/party --mode table "MATCH (a:Claim)-[:CONTRADICTS]->(b:Claim) RETURN a.recorded_by, a.text, b.recorded_by, b.text"
177
+ ```
178
+
179
+ Work on a copy, because Relate tidies a store's files when it opens one. In a clone of this repo the store is at `examples/data/graphs/party`. More queries to try, including *what did the team believe on Monday afternoon?*, are in [docs/RELATE.md](docs/RELATE.md#explore-the-example-store).
180
+
181
+ - The signed change log the store was built from: [`examples/data/hosts/party/changes.jsonl`](examples/data/hosts/party/changes.jsonl).
182
+ - The script that makes both: [`scripts/make-examples.ts`](scripts/make-examples.ts) (`npm run examples`).
183
+
184
+ **Your own contexts** live in `~/.local/share/vine-context/` (set `VINE_DATA_DIR` to move it): `graphs/<name>` is the Relate store, and `hosts/<name>/changes.jsonl` is its change log. [More detail](docs/HOW-IT-WORKS.md#files-on-your-machine).
185
+
186
+ ## How it works
187
+
188
+ ```mermaid
189
+ flowchart LR
190
+ subgraph alice["Alice's machine"]
191
+ A1[Claude Code session] -- MCP --> S1[vine mcp]
192
+ S1 -- local socket --> H1[(host: change log +<br/>Relate store)]
193
+ end
194
+ subgraph bob["Bob's machine"]
195
+ B1[his agent] -- MCP --> S2[vine mcp]
196
+ S2 -- local socket --> H2[(host: change log +<br/>Relate store)]
197
+ end
198
+ subgraph carol["Carol's machine"]
199
+ C1[her agent] -- MCP --> S3[vine mcp]
200
+ S3 -- local socket --> H3[(host: change log +<br/>Relate store)]
201
+ end
202
+ H1 <-- "WebRTC (DTLS): swap missing changes" --> H2
203
+ H2 <--> H3
204
+ H1 <--> H3
205
+ N{{public Nostr relays:<br/>sealed handshakes only}} -.-> H1
206
+ N -.-> H2
207
+ N -.-> H3
208
+ ```
209
+
210
+ - **Every member has a full copy:** a log of signed changes and the Relate store built from it. Reads and writes always work, offline too.
211
+ - **A write is a signed change.** It is checked, applied locally, held for 10 seconds so *Undo* can truly remove it, then signed with the author's key and sent.
212
+ - **Machines swap what each is missing** over WebRTC. Changes are forwarded, so members who are never online together still get each other's writes.
213
+ - **Agents are told what a sync means for their person:** your claim was replaced, your question was answered, a new conflict appeared.
214
+ - **Agents are told without asking.** In Claude Code and Codex the plugin's hooks run `vine hook`: at the start of a session it tells the agent what the chat's context is for, and beside each prompt it passes on what other members' changes meant and a one-line reminder of where the chat records. Set `VINE_HOOKS=quiet` to drop the reminder, or `off` for none of it. Codex asks you to trust the hooks once (`/hooks`). Other agents get the same news in front of their next vine tool result.
215
+
216
+ The full account is in [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md), and the design reasoning in [docs/REPLICATION.md](docs/REPLICATION.md).
217
+
218
+ ## Settings
219
+
220
+ Everything works without settings. These change the defaults, and `vine --help` lists them too.
221
+
222
+ **Command options**
223
+
224
+ | Command | Options |
225
+ |---|---|
226
+ | `vine setup` | `--yes` takes the default answer to every question (secrets are still typed, unseen) · `--agent claude,codex` or `none` picks which agents get the plugin (default: those found) · `--turn cloudflare`, `custom` or `none` instead of asking · `--json` prints the results as JSON · `--dry-run` runs only the read-only checks and prints what it would do |
227
+ | `vine demo` | `--pace SECONDS` between steps (default 4; `0` plays it all at once) · `--join` meets through the public Nostr relays and prints a join code for your own agent · `--port N` for the browser page · `--no-open` doesn't open the browser · `--verbose` |
228
+
229
+ **Environment variables**
230
+
231
+ | Variable | What it changes | Default |
232
+ |---|---|---|
233
+ | `VINE_USER` | Your name in contexts | The name you saved (`update_context`, or `vine setup`), else git's `user.name`, else your computer account's full name, else a made-up one |
234
+ | `VINE_DATA_DIR` | Where contexts live | `~/.local/share/vine-context` |
235
+ | `VINE_CONTEXT` | The context a new chat starts with when its folder has none linked | None: the agent asks |
236
+ | `VINE_CHAT` | The chat's id, used to remember its context | Claude Code's or Codex's session id |
237
+ | `VINE_EMBEDDER` | How search turns text into vectors: `auto`, `hash` (words only) or `bge-small` | `auto`: `bge-small` when its package runs here, else `hash` |
238
+ | `VINE_AUTO_SHARE` | `off`: new contexts don't sync until you share them | On |
239
+ | `VINE_HOOKS` | `quiet`: no reminder beside each prompt (the session briefing and others' news stay) · `off`: the hooks say nothing | On |
240
+ | `VINE_HOLD_MS` | How long a write waits on this machine, so Undo can remove it, before it is sent | `10000` (10 seconds) |
241
+ | `VINE_RELAYS` | Nostr relays members use to find each other, comma-separated | Four public relays |
242
+ | `VINE_ICE` | STUN and TURN servers, comma-separated; replaces the defaults and the `vine turn` setting | Google's and Cloudflare's STUN |
243
+ | `VINE_TURN_PASSWORD` | The TURN server's password, when it was saved with `--store env` | None |
244
+ | `VINE_CLOUDFLARE_TURN_SECRET` | The Cloudflare TURN key's secret, when it was saved with `--store env` | None |
245
+
246
+ The other commands (`vine doctor`, `vine status`, `vine turn`, `vine autostart` and the rest) are listed in [the guide](docs/GUIDE.md#commands).
247
+
248
+ ## Limits
249
+
250
+ - **Search matches meaning with a small model that installs with vine,** on the CPU, offline. Its packages are built and tested in CI for macOS (arm64, x64), Linux (x64, arm64) and Windows x64; anywhere else, or where it doesn't run, search matches words and word fragments instead, and `vine doctor` says which is in use.
251
+ - **Strict networks need a TURN server, on your own account.** Vine ships no shared TURN server or key. `vine setup` sets up Cloudflare's on your own Cloudflare account in a few steps (free up to 1,000 GB a month, far more than Vine uses), or you can use one you run. Only one machine in a pair needs one ([do I need a TURN server?](docs/GUIDE.md#do-i-need-a-turn-server)). Replication has been tested between processes on one machine and over real public relays.
252
+ - **Removing someone can't recall the copy they already have.**
253
+ - **Clocks are assumed correct,** and a context is sized for about 20 members and 100,000 changes.
254
+ - **Desktop only for now:** phones, and assistants that only reach remote MCP servers, can't connect yet.
255
+
256
+ Each is explained in [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md#limits).
257
+
258
+ ## More documentation
259
+
260
+ | Document | What it covers |
261
+ |---|---|
262
+ | [docs/GUIDE.md](docs/GUIDE.md) | Day-to-day use: the plugin, sharing, join codes, a chat's contexts, question threads, undo, staying in sync |
263
+ | [docs/RELATE.md](docs/RELATE.md) | The graph model, each Relate feature and where it is used, and queries to run on the example store |
264
+ | [docs/HOW-IT-WORKS.md](docs/HOW-IT-WORKS.md) | Hosts, signed changes, the mesh, join codes, files on disk, limits |
265
+ | [docs/REPLICATION.md](docs/REPLICATION.md) | The replication design and the decisions behind it |
266
+ | [docs/HACKATHON.md](docs/HACKATHON.md) | The Relate hackathon entry: how it meets each judging criterion, what is new, AI tools used |
267
+
268
+ ## Built with
269
+
270
+ - [Relate](https://github.com/relatedb/relate) (Apache-2.0)
271
+ - [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) and [MCP Apps (ext-apps)](https://github.com/modelcontextprotocol/ext-apps)
272
+ - [node-datachannel](https://github.com/murat-dogan/node-datachannel) (WebRTC)
273
+ - [nostr-tools](https://github.com/nbd-wtf/nostr-tools) (event signing)
274
+ - React with the [@squonk/ui](https://ui.squonkstack.io) design system (MIT; vendored in `vendor/` because it is published to a private registry)
275
+ - zod, yaml, esbuild, tsup, vitest
276
+
277
+ Written with the help of Claude Code (Anthropic's AI coding agent).
278
+
279
+ ## Licence
280
+
281
+ [Apache-2.0](LICENSE). Relate is a Neo4j Labs project, also under Apache-2.0. This project is not affiliated with or endorsed by Neo4j.