vine-context 0.0.1 → 0.1.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 +202 -0
- package/README.md +279 -3
- package/dist/apps/shell.html +134 -0
- package/dist/apps/views.html +124 -0
- package/dist/cli.js +7865 -0
- package/dist/cli.js.map +1 -0
- package/examples/data/graphs/party/.cypherlite/schema/schema.cypher +5 -0
- package/examples/data/graphs/party/.cypherlite.lock +1 -0
- package/examples/data/graphs/party/.cypherlite.writer +0 -0
- package/examples/data/graphs/party/manifest.json +215 -0
- package/examples/data/graphs/party/nodes/0-262144-7987dd27c85668d4810609133f705907.parquet +0 -0
- package/examples/data/graphs/party/wal/.cypherlite.lock +1 -0
- package/examples/data/graphs/party/wal/.cypherlite.writer +0 -0
- package/examples/data/graphs/party/wal/00000002.log +0 -0
- package/examples/data/hosts/party/changes.jsonl +19 -0
- package/examples/data/hosts/party/group.json +5 -0
- package/examples/data/hosts/party/sharing.json +1 -0
- package/examples/data/identity.json +4 -0
- package/models/temporal-claims/instructions.md +78 -0
- package/models/temporal-claims/model.yaml +99 -0
- package/models/temporal-claims/tools.yaml +348 -0
- package/package.json +71 -3
- package/plugin/.claude-plugin/plugin.json +8 -0
- package/plugin/.codex-plugin/plugin.json +17 -0
- package/plugin/.mcp.json +8 -0
- package/plugin/codex/hooks.json +11 -0
- package/plugin/commands/join.md +22 -0
- package/plugin/hooks/hooks.json +11 -0
- package/plugin/hooks/register.tsx +2310 -0
- package/plugin/hooks/vine-hook.mjs +25 -0
- package/plugin/skills/join-context-graph/SKILL.md +36 -0
- package/plugin/skills/vine-context/SKILL.md +232 -0
- package/plugin/tests/context-graph.test.tsx +830 -0
- package/plugin/types/index.d.ts +165 -0
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
# Tools for the temporal-claims model. See docs/model-packs.md for the format.
|
|
2
|
+
#
|
|
3
|
+
# Write tools only check their input against the graph here (steps that return
|
|
4
|
+
# `_error`); `apply` names the change they make, which src/core/graph.ts applies
|
|
5
|
+
# the same way on every member's machine.
|
|
6
|
+
#
|
|
7
|
+
# Server parameters, set on every call and never by the caller:
|
|
8
|
+
# $now the call's time, ISO 8601 (use datetime($now))
|
|
9
|
+
# $by the caller's name
|
|
10
|
+
# $key the caller's public key (what the graph records as `author`)
|
|
11
|
+
# $role the caller's role: reader, contributor or admin
|
|
12
|
+
#
|
|
13
|
+
# Read tools take an optional `at` and answer as the graph stood at that
|
|
14
|
+
# moment (record time): T below is datetime(coalesce($at, $now)).
|
|
15
|
+
|
|
16
|
+
fragments:
|
|
17
|
+
# The claim %1 was current at T: recorded by then, not withdrawn by then, and
|
|
18
|
+
# not replaced by a claim that was itself current at T.
|
|
19
|
+
current_claim: >-
|
|
20
|
+
%1.recorded_at <= T
|
|
21
|
+
AND (%1.withdrawn_at IS NULL OR %1.withdrawn_at > T)
|
|
22
|
+
AND NOT EXISTS {
|
|
23
|
+
MATCH (newer:Claim)-[rr:REPLACES]->(%1)
|
|
24
|
+
WHERE rr.recorded_at <= T AND (newer.withdrawn_at IS NULL OR newer.withdrawn_at > T)
|
|
25
|
+
}
|
|
26
|
+
# The question %1 existed at T and was not withdrawn by then.
|
|
27
|
+
live_question: >-
|
|
28
|
+
%1.recorded_at <= T AND (%1.withdrawn_at IS NULL OR %1.withdrawn_at > T)
|
|
29
|
+
# The question %1 was open at T: live, and no current claim answered it.
|
|
30
|
+
open_question: >-
|
|
31
|
+
{{live_question %1}}
|
|
32
|
+
AND NOT EXISTS {
|
|
33
|
+
MATCH (ans:Claim)-[ra:ANSWERS]->(%1)
|
|
34
|
+
WHERE ra.recorded_at <= T AND {{current_claim ans}}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
tools:
|
|
38
|
+
- name: add_claim
|
|
39
|
+
title: Add a claim
|
|
40
|
+
kind: write
|
|
41
|
+
apply: claim
|
|
42
|
+
view: receipt
|
|
43
|
+
undo: { tool: withdraw }
|
|
44
|
+
description: >-
|
|
45
|
+
Record one statement you or the person believe is true, in one or two
|
|
46
|
+
sentences. Use it in the course of ordinary work, without being asked:
|
|
47
|
+
when the chat reaches a decision, establishes a fact or settles how
|
|
48
|
+
something works, and it fits what the context is for.
|
|
49
|
+
Link it to existing claims it supports, contradicts or replaces,
|
|
50
|
+
and to questions it answers. Use replaces to correct or update an earlier
|
|
51
|
+
claim rather than withdrawing it. Returns the new claim's id.
|
|
52
|
+
input:
|
|
53
|
+
text: { type: string, required: true, max_length: 2000, description: The statement, in one or two sentences }
|
|
54
|
+
source: { type: string, max_length: 500, description: Where it came from (URL, file, meeting, person) }
|
|
55
|
+
about_from: { type: date, description: First day the statement is about (YYYY-MM-DD), if it is about a period }
|
|
56
|
+
about_to: { type: date, description: Last day the statement is about (YYYY-MM-DD) }
|
|
57
|
+
supports: { type: array, items: id, description: Ids of claims this is evidence for }
|
|
58
|
+
contradicts: { type: array, items: id, description: Ids of claims this cannot be true alongside }
|
|
59
|
+
replaces: { type: array, items: id, description: Ids of claims this is the newer version of }
|
|
60
|
+
answers: { type: array, items: id, description: Ids of questions this answers }
|
|
61
|
+
derive:
|
|
62
|
+
id: { new_id: c }
|
|
63
|
+
embedding: { embed: text }
|
|
64
|
+
steps:
|
|
65
|
+
- cypher: |
|
|
66
|
+
WITH coalesce($supports, []) + coalesce($contradicts, []) + coalesce($replaces, []) AS claim_refs,
|
|
67
|
+
coalesce($answers, []) AS question_refs
|
|
68
|
+
OPTIONAL MATCH (c:Claim) WHERE c.id IN claim_refs AND c.withdrawn_at IS NULL
|
|
69
|
+
WITH claim_refs, question_refs, collect(DISTINCT c.id) AS found_c
|
|
70
|
+
OPTIONAL MATCH (q:Question) WHERE q.id IN question_refs AND q.withdrawn_at IS NULL
|
|
71
|
+
WITH claim_refs, question_refs, found_c, collect(DISTINCT q.id) AS found_q
|
|
72
|
+
WITH [x IN claim_refs WHERE NOT x IN found_c] + [x IN question_refs WHERE NOT x IN found_q] AS missing
|
|
73
|
+
RETURN CASE
|
|
74
|
+
WHEN size(missing) > 0
|
|
75
|
+
THEN 'These ids are unknown or withdrawn: ' + reduce(s = '', x IN missing | s + CASE WHEN s = '' THEN '' ELSE ', ' END + x)
|
|
76
|
+
WHEN $about_from IS NOT NULL AND $about_to IS NOT NULL AND date($about_from) > date($about_to)
|
|
77
|
+
THEN 'about_from is after about_to.'
|
|
78
|
+
END AS _error
|
|
79
|
+
|
|
80
|
+
- name: ask_question
|
|
81
|
+
title: Ask a question
|
|
82
|
+
kind: write
|
|
83
|
+
apply: question
|
|
84
|
+
view: receipt
|
|
85
|
+
undo: { tool: withdraw }
|
|
86
|
+
description: >-
|
|
87
|
+
Record something the group needs to find out. Use it in the course of
|
|
88
|
+
ordinary work, without being asked: when the chat leaves a question open
|
|
89
|
+
that someone else in the context may be able to answer. Link it to the claims or
|
|
90
|
+
questions it is about. It stays open until a current claim answers it
|
|
91
|
+
(add_claim with answers, or link with ANSWERS). Search first: the question
|
|
92
|
+
may already be asked or answered.
|
|
93
|
+
input:
|
|
94
|
+
text: { type: string, required: true, max_length: 1000, description: The question }
|
|
95
|
+
about: { type: array, items: id, description: Ids of claims or questions it asks about }
|
|
96
|
+
derive:
|
|
97
|
+
id: { new_id: q }
|
|
98
|
+
embedding: { embed: text }
|
|
99
|
+
steps:
|
|
100
|
+
- cypher: |
|
|
101
|
+
WITH coalesce($about, []) AS refs
|
|
102
|
+
OPTIONAL MATCH (n:Claim|Question) WHERE n.id IN refs AND n.withdrawn_at IS NULL
|
|
103
|
+
WITH refs, collect(DISTINCT n.id) AS found
|
|
104
|
+
WITH [x IN refs WHERE NOT x IN found] AS missing
|
|
105
|
+
RETURN CASE WHEN size(missing) > 0
|
|
106
|
+
THEN 'These ids are unknown or withdrawn: ' + reduce(s = '', x IN missing | s + CASE WHEN s = '' THEN '' ELSE ', ' END + x)
|
|
107
|
+
END AS _error
|
|
108
|
+
|
|
109
|
+
- name: reply
|
|
110
|
+
title: Reply to a question
|
|
111
|
+
kind: write
|
|
112
|
+
apply: reply
|
|
113
|
+
view: receipt
|
|
114
|
+
undo: { tool: withdraw }
|
|
115
|
+
description: >-
|
|
116
|
+
Add a message to an open question's thread: what you or the person think,
|
|
117
|
+
a partial finding, a follow-up, or a question back. Other members' agents
|
|
118
|
+
see the thread (thread). A reply doesn't answer the question: when the
|
|
119
|
+
thread settles it, record a claim with answers (in your own words, standing
|
|
120
|
+
alone) so the question closes.
|
|
121
|
+
input:
|
|
122
|
+
question: { type: id, required: true, description: The question this replies to }
|
|
123
|
+
text: { type: string, required: true, max_length: 2000, description: The message }
|
|
124
|
+
derive:
|
|
125
|
+
id: { new_id: r }
|
|
126
|
+
steps:
|
|
127
|
+
- cypher: |
|
|
128
|
+
OPTIONAL MATCH (q:Question {id: $question}) WHERE q.withdrawn_at IS NULL
|
|
129
|
+
RETURN CASE WHEN q IS NULL THEN 'No current question ' + $question + '.' END AS _error
|
|
130
|
+
|
|
131
|
+
- name: link
|
|
132
|
+
title: Link two items
|
|
133
|
+
kind: write
|
|
134
|
+
apply: link
|
|
135
|
+
view: receipt
|
|
136
|
+
description: >-
|
|
137
|
+
Link an existing claim to another claim (SUPPORTS, CONTRADICTS, REPLACES)
|
|
138
|
+
or to a question it answers (ANSWERS). Use it when you notice a relation
|
|
139
|
+
between things already in the graph.
|
|
140
|
+
input:
|
|
141
|
+
from: { type: id, required: true, description: The claim the link starts from }
|
|
142
|
+
relation: { type: enum, values: [SUPPORTS, CONTRADICTS, REPLACES, ANSWERS], required: true, description: How the first relates to the second }
|
|
143
|
+
to: { type: id, required: true, description: The claim, or for ANSWERS the question, the link points to }
|
|
144
|
+
steps:
|
|
145
|
+
- cypher: |
|
|
146
|
+
OPTIONAL MATCH (a:Claim {id: $from}) WHERE a.withdrawn_at IS NULL
|
|
147
|
+
OPTIONAL MATCH (b:Claim|Question {id: $to}) WHERE b.withdrawn_at IS NULL
|
|
148
|
+
RETURN CASE
|
|
149
|
+
WHEN a IS NULL THEN 'No current claim ' + $from + '.'
|
|
150
|
+
WHEN b IS NULL THEN 'No current claim or question ' + $to + '.'
|
|
151
|
+
WHEN $from = $to THEN 'A claim cannot link to itself.'
|
|
152
|
+
WHEN $relation = 'ANSWERS' AND NOT b:Question THEN 'ANSWERS links a claim to a question.'
|
|
153
|
+
WHEN $relation <> 'ANSWERS' AND NOT b:Claim THEN $relation + ' links two claims.'
|
|
154
|
+
WHEN EXISTS { MATCH (a)-[r]->(b) WHERE type(r) = $relation } THEN 'That link already exists.'
|
|
155
|
+
END AS _error
|
|
156
|
+
|
|
157
|
+
- name: withdraw
|
|
158
|
+
title: Withdraw a claim, question or reply
|
|
159
|
+
kind: write
|
|
160
|
+
apply: withdraw
|
|
161
|
+
description: >-
|
|
162
|
+
Take back a claim, question or reply you recorded, for example one made by
|
|
163
|
+
mistake. It stays in the graph's history. To correct a claim, prefer
|
|
164
|
+
add_claim with replaces. Only its author or an admin can withdraw it.
|
|
165
|
+
input:
|
|
166
|
+
id: { type: id, required: true, description: The claim, question or reply to withdraw }
|
|
167
|
+
reason: { type: string, max_length: 500, description: Why it is withdrawn }
|
|
168
|
+
steps:
|
|
169
|
+
- cypher: |
|
|
170
|
+
OPTIONAL MATCH (n:Claim|Question|Reply {id: $id})
|
|
171
|
+
RETURN CASE
|
|
172
|
+
WHEN n IS NULL THEN 'No claim, question or reply ' + $id + '.'
|
|
173
|
+
WHEN n.withdrawn_at IS NOT NULL THEN $id + ' is already withdrawn.'
|
|
174
|
+
WHEN NOT (n.author = $key OR (n.author IS NULL AND n.recorded_by = $by)) AND $role <> 'admin'
|
|
175
|
+
THEN 'Only its author (' + n.recorded_by + ') or an admin can withdraw it. Record a claim that replaces or contradicts it instead.'
|
|
176
|
+
END AS _error
|
|
177
|
+
|
|
178
|
+
- name: search
|
|
179
|
+
title: Search
|
|
180
|
+
kind: read
|
|
181
|
+
description: >-
|
|
182
|
+
Find claims and questions related to a text, ranked by hybrid search (meaning
|
|
183
|
+
plus keywords). Returns only claims that are current and questions that are
|
|
184
|
+
not withdrawn, unless include_ended; questions show whether they are
|
|
185
|
+
answered. Search before adding, to avoid duplicates and to find what to
|
|
186
|
+
link to.
|
|
187
|
+
input:
|
|
188
|
+
query: { type: string, required: true, max_length: 1000, description: What to look for }
|
|
189
|
+
include_ended: { type: boolean, default: false, description: Also find claims that were replaced or withdrawn and questions that were withdrawn (each row says whether it is current) }
|
|
190
|
+
kind: { type: enum, values: [any, claim, question], default: any, description: Only claims, only questions, or both }
|
|
191
|
+
at: { type: datetime, description: Search the graph as it stood at this time (ISO 8601). Default now. }
|
|
192
|
+
limit: { type: integer, min: 1, max: 50, default: 10, description: How many results }
|
|
193
|
+
derive:
|
|
194
|
+
query_vector: { embed: query }
|
|
195
|
+
query_terms: { terms: query }
|
|
196
|
+
steps:
|
|
197
|
+
- cypher: |
|
|
198
|
+
MATCH (n:Claim|Question) SEARCH n IN (COMBINE (
|
|
199
|
+
VECTOR INDEX search_embedding FOR $query_vector LIMIT 100 WEIGHT 1,
|
|
200
|
+
FULLTEXT INDEX search_text FOR $query_terms LIMIT 100 WEIGHT 1
|
|
201
|
+
) USING WRRF WITH CONSTANT 60 LIMIT 100) SCORE AS score
|
|
202
|
+
WITH n, score, datetime(coalesce($at, $now)) AS T
|
|
203
|
+
WITH n, score, T
|
|
204
|
+
WHERE ($kind = 'any' OR ($kind = 'claim' AND n:Claim) OR ($kind = 'question' AND n:Question))
|
|
205
|
+
AND n.recorded_at <= T
|
|
206
|
+
WITH n, score, T, (n:Claim AND {{current_claim n}}) OR (n:Question AND {{live_question n}}) AS current
|
|
207
|
+
WHERE current OR $include_ended
|
|
208
|
+
RETURN n.id AS id,
|
|
209
|
+
CASE WHEN n:Claim THEN 'claim' ELSE 'question' END AS kind,
|
|
210
|
+
current,
|
|
211
|
+
n.text AS text, n.source AS source, n.about_from AS about_from, n.about_to AS about_to,
|
|
212
|
+
n.recorded_at AS recorded_at, n.recorded_by AS recorded_by,
|
|
213
|
+
CASE WHEN n:Question THEN NOT ({{open_question n}}) END AS answered,
|
|
214
|
+
round(score, 4) AS score
|
|
215
|
+
ORDER BY score DESC
|
|
216
|
+
LIMIT $limit
|
|
217
|
+
|
|
218
|
+
- name: beliefs
|
|
219
|
+
title: What the group believes
|
|
220
|
+
kind: read
|
|
221
|
+
description: >-
|
|
222
|
+
List the claims that were current at a moment (default now), newest first,
|
|
223
|
+
with what each supports, contradicts, replaces and answers. Give at to see
|
|
224
|
+
what the group believed back then. Give about_from/about_to to keep only
|
|
225
|
+
claims about that period.
|
|
226
|
+
input:
|
|
227
|
+
at: { type: datetime, description: The moment to look at (ISO 8601). Default now. }
|
|
228
|
+
about_from: { type: date, description: Keep claims about days on or after this (YYYY-MM-DD) }
|
|
229
|
+
about_to: { type: date, description: Keep claims about days on or before this (YYYY-MM-DD) }
|
|
230
|
+
limit: { type: integer, min: 1, max: 200, default: 50, description: How many claims }
|
|
231
|
+
steps:
|
|
232
|
+
- cypher: |
|
|
233
|
+
WITH datetime(coalesce($at, $now)) AS T
|
|
234
|
+
MATCH (c:Claim)
|
|
235
|
+
WHERE {{current_claim c}}
|
|
236
|
+
AND ($about_from IS NULL OR c.about_to IS NULL OR c.about_to >= date($about_from))
|
|
237
|
+
AND ($about_to IS NULL OR c.about_from IS NULL OR c.about_from <= date($about_to))
|
|
238
|
+
WITH c, T ORDER BY c.recorded_at DESC LIMIT $limit
|
|
239
|
+
RETURN c.id AS id, c.text AS text, c.source AS source, c.about_from AS about_from, c.about_to AS about_to,
|
|
240
|
+
c.recorded_at AS recorded_at, c.recorded_by AS recorded_by,
|
|
241
|
+
[(c)-[r:SUPPORTS]->(x) WHERE r.recorded_at <= T | x.id] AS supports,
|
|
242
|
+
[(c)-[r:CONTRADICTS]->(x) WHERE r.recorded_at <= T | x.id] AS contradicts,
|
|
243
|
+
[(c)-[r:REPLACES]->(x) WHERE r.recorded_at <= T | x.id] AS replaces,
|
|
244
|
+
[(c)-[r:ANSWERS]->(x) WHERE r.recorded_at <= T | x.id] AS answers
|
|
245
|
+
|
|
246
|
+
- name: open_questions
|
|
247
|
+
title: Open questions
|
|
248
|
+
kind: read
|
|
249
|
+
description: >-
|
|
250
|
+
List the questions that were open at a moment (default now): asked, not
|
|
251
|
+
withdrawn, and not answered by a current claim. Newest first, with how many
|
|
252
|
+
replies each thread has (thread reads one).
|
|
253
|
+
input:
|
|
254
|
+
at: { type: datetime, description: The moment to look at (ISO 8601). Default now. }
|
|
255
|
+
limit: { type: integer, min: 1, max: 200, default: 50, description: How many questions }
|
|
256
|
+
steps:
|
|
257
|
+
- cypher: |
|
|
258
|
+
WITH datetime(coalesce($at, $now)) AS T
|
|
259
|
+
MATCH (q:Question) WHERE {{open_question q}}
|
|
260
|
+
RETURN q.id AS id, q.text AS text, q.recorded_at AS recorded_at, q.recorded_by AS recorded_by,
|
|
261
|
+
[(q)-[r:ABOUT]->(x) WHERE r.recorded_at <= T | x.id] AS about,
|
|
262
|
+
size([(m:Reply)-[r:REPLIES_TO]->(q) WHERE r.recorded_at <= T AND (m.withdrawn_at IS NULL OR m.withdrawn_at > T) | m.id]) AS replies
|
|
263
|
+
ORDER BY recorded_at DESC
|
|
264
|
+
LIMIT $limit
|
|
265
|
+
|
|
266
|
+
- name: thread
|
|
267
|
+
title: A question's thread
|
|
268
|
+
kind: read
|
|
269
|
+
description: >-
|
|
270
|
+
Read one question with its thread: the replies, oldest first, and the
|
|
271
|
+
current claims that answer it. Read it before replying or answering, so you
|
|
272
|
+
build on what others said.
|
|
273
|
+
input:
|
|
274
|
+
question: { type: id, required: true, description: The question }
|
|
275
|
+
at: { type: datetime, description: Read it as it stood at this time (ISO 8601). Default now. }
|
|
276
|
+
steps:
|
|
277
|
+
- cypher: |
|
|
278
|
+
OPTIONAL MATCH (q:Question {id: $question})
|
|
279
|
+
RETURN CASE WHEN q IS NULL THEN 'No question ' + $question + '.' END AS _error
|
|
280
|
+
- cypher: |
|
|
281
|
+
WITH datetime(coalesce($at, $now)) AS T
|
|
282
|
+
MATCH (q:Question {id: $question})
|
|
283
|
+
RETURN q {.id, .text, .recorded_at, .recorded_by, .withdrawn_at} AS question,
|
|
284
|
+
NOT ({{open_question q}}) AND {{live_question q}} AS answered,
|
|
285
|
+
[(m:Reply)-[r:REPLIES_TO]->(q) WHERE r.recorded_at <= T AND (m.withdrawn_at IS NULL OR m.withdrawn_at > T)
|
|
286
|
+
| m {.id, .text, .recorded_at, .recorded_by}] AS replies,
|
|
287
|
+
[(c:Claim)-[r:ANSWERS]->(q) WHERE r.recorded_at <= T AND {{current_claim c}}
|
|
288
|
+
| c {.id, .text, .recorded_at, .recorded_by}] AS answers
|
|
289
|
+
single: true
|
|
290
|
+
|
|
291
|
+
- name: conflicts
|
|
292
|
+
title: Conflicts
|
|
293
|
+
kind: read
|
|
294
|
+
view: conflicts
|
|
295
|
+
description: >-
|
|
296
|
+
List pairs of current claims where one contradicts the other: what a person
|
|
297
|
+
needs to settle, by recording a claim that replaces one or both.
|
|
298
|
+
input:
|
|
299
|
+
at: { type: datetime, description: The moment to look at (ISO 8601). Default now. }
|
|
300
|
+
steps:
|
|
301
|
+
- cypher: |
|
|
302
|
+
WITH datetime(coalesce($at, $now)) AS T
|
|
303
|
+
MATCH (a:Claim)-[r:CONTRADICTS]->(b:Claim)
|
|
304
|
+
WHERE r.recorded_at <= T AND {{current_claim a}} AND {{current_claim b}}
|
|
305
|
+
RETURN a {.id, .text, .recorded_by, .recorded_at} AS claim,
|
|
306
|
+
b {.id, .text, .recorded_by, .recorded_at} AS contradicts,
|
|
307
|
+
r.recorded_at AS since, r.recorded_by AS flagged_by
|
|
308
|
+
ORDER BY since DESC
|
|
309
|
+
|
|
310
|
+
- name: history
|
|
311
|
+
title: History of an item
|
|
312
|
+
kind: read
|
|
313
|
+
description: >-
|
|
314
|
+
Show one claim or question with every link into and out of it, including
|
|
315
|
+
replaced and withdrawn ones, with who recorded each and when.
|
|
316
|
+
input:
|
|
317
|
+
id: { type: id, required: true, description: The claim or question }
|
|
318
|
+
steps:
|
|
319
|
+
- cypher: |
|
|
320
|
+
OPTIONAL MATCH (n:Claim|Question {id: $id})
|
|
321
|
+
RETURN CASE WHEN n IS NULL THEN 'No claim or question ' + $id + '.' END AS _error
|
|
322
|
+
- cypher: |
|
|
323
|
+
MATCH (n:Claim|Question {id: $id})
|
|
324
|
+
RETURN CASE WHEN n:Claim THEN 'claim' ELSE 'question' END AS kind,
|
|
325
|
+
n {.id, .text, .source, .about_from, .about_to, .recorded_at, .recorded_by,
|
|
326
|
+
.withdrawn_at, .withdrawn_by, .withdraw_reason} AS item,
|
|
327
|
+
[(n)-[r]->(x) | {direction: 'out', type: type(r), id: x.id, text: x.text, recorded_at: r.recorded_at, recorded_by: r.recorded_by}]
|
|
328
|
+
+ [(x)-[r]->(n) | {direction: 'in', type: type(r), id: x.id, text: x.text, recorded_at: r.recorded_at, recorded_by: r.recorded_by}] AS links
|
|
329
|
+
single: true
|
|
330
|
+
|
|
331
|
+
- name: recent
|
|
332
|
+
title: Recent changes
|
|
333
|
+
kind: read
|
|
334
|
+
description: >-
|
|
335
|
+
What was added or withdrawn since a moment, newest first. Use it to catch up
|
|
336
|
+
at the start of a session.
|
|
337
|
+
input:
|
|
338
|
+
since: { type: datetime, required: true, description: Changes after this time (ISO 8601) }
|
|
339
|
+
limit: { type: integer, min: 1, max: 200, default: 50, description: How many changes }
|
|
340
|
+
steps:
|
|
341
|
+
- cypher: |
|
|
342
|
+
MATCH (n:Claim|Question)
|
|
343
|
+
WHERE n.recorded_at > datetime($since) OR n.withdrawn_at > datetime($since)
|
|
344
|
+
RETURN n.id AS id, CASE WHEN n:Claim THEN 'claim' ELSE 'question' END AS kind, n.text AS text,
|
|
345
|
+
n.recorded_at AS recorded_at, n.recorded_by AS recorded_by,
|
|
346
|
+
n.withdrawn_at AS withdrawn_at, n.withdrawn_by AS withdrawn_by
|
|
347
|
+
ORDER BY coalesce(n.withdrawn_at, n.recorded_at) DESC
|
|
348
|
+
LIMIT $limit
|
package/package.json
CHANGED
|
@@ -1,13 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vine-context",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Share a Relate context graph with other people's AI agents, peer to peer. An AI skill plus a local MCP server.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/CraigDeverall/vine-context.git"
|
|
9
9
|
},
|
|
10
|
+
"homepage": "https://github.com/CraigDeverall/vine-context#readme",
|
|
11
|
+
"bugs": "https://github.com/CraigDeverall/vine-context/issues",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=20"
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"vine": "dist/cli.js"
|
|
18
|
+
},
|
|
10
19
|
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"plugin",
|
|
22
|
+
"models",
|
|
23
|
+
"examples",
|
|
24
|
+
"LICENSE",
|
|
11
25
|
"README.md"
|
|
12
|
-
]
|
|
26
|
+
],
|
|
27
|
+
"keywords": [
|
|
28
|
+
"relate",
|
|
29
|
+
"neo4j",
|
|
30
|
+
"mcp",
|
|
31
|
+
"context-graph",
|
|
32
|
+
"p2p",
|
|
33
|
+
"webrtc",
|
|
34
|
+
"claude-code",
|
|
35
|
+
"agent-skill"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup && node scripts/build-apps.mjs",
|
|
39
|
+
"typecheck": "tsc --noEmit && tsc -p apps",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:turn": "node scripts/turn-server.mjs test",
|
|
42
|
+
"check": "npm run typecheck && npm test && npm run build",
|
|
43
|
+
"pack:check": "node scripts/pack-check.mjs",
|
|
44
|
+
"prepack": "npm run build",
|
|
45
|
+
"build:apps": "node scripts/build-apps.mjs",
|
|
46
|
+
"build:embedder": "node scripts/build-embedder.mjs",
|
|
47
|
+
"pack:embedder": "node scripts/pack-embedder.mjs --pack",
|
|
48
|
+
"examples": "tsx scripts/make-examples.ts"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
52
|
+
"@relate/relate": "1.0.1",
|
|
53
|
+
"node-datachannel": "^0.33.6",
|
|
54
|
+
"nostr-tools": "^2.26.0",
|
|
55
|
+
"ws": "^8.23.0",
|
|
56
|
+
"yaml": "^2.9.1",
|
|
57
|
+
"zod": "^4.6.7"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@modelcontextprotocol/ext-apps": "1.7.5",
|
|
61
|
+
"@types/node": "^22.20.5",
|
|
62
|
+
"@types/react": "19.3.0",
|
|
63
|
+
"@types/react-dom": "19.3.0",
|
|
64
|
+
"@types/ws": "^8.18.2",
|
|
65
|
+
"esbuild": "0.28.2",
|
|
66
|
+
"preact": "10.29.8",
|
|
67
|
+
"react": "19.3.1",
|
|
68
|
+
"react-dom": "19.3.1",
|
|
69
|
+
"tsup": "^8.5.1",
|
|
70
|
+
"tsx": "^4.23.15",
|
|
71
|
+
"typescript": "^7.0.2",
|
|
72
|
+
"vitest": "^5.1.0"
|
|
73
|
+
},
|
|
74
|
+
"optionalDependencies": {
|
|
75
|
+
"vine-context-embedder-darwin-arm64": "0.1.0",
|
|
76
|
+
"vine-context-embedder-darwin-x64": "0.1.0",
|
|
77
|
+
"vine-context-embedder-linux-arm64": "0.1.0",
|
|
78
|
+
"vine-context-embedder-linux-x64": "0.1.0",
|
|
79
|
+
"vine-context-embedder-win32-x64": "0.1.0"
|
|
80
|
+
}
|
|
13
81
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vine-context",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Share a Relate context graph of dated claims and open questions with other people's AI agents, peer to peer. Every member keeps a full copy, synced whenever they're online.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"types": "./types/index.d.ts",
|
|
7
|
+
"keywords": ["relate", "neo4j", "context-graph", "mcp", "p2p"]
|
|
8
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vine-context",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Share a Relate context graph of dated claims and open questions with other people's AI agents, peer to peer. Every member keeps a full copy, synced whenever they're online.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": ["relate", "neo4j", "context-graph", "mcp", "p2p"],
|
|
7
|
+
"skills": "./skills/",
|
|
8
|
+
"mcpServers": "./.mcp.json",
|
|
9
|
+
"hooks": "./codex/hooks.json",
|
|
10
|
+
"interface": {
|
|
11
|
+
"displayName": "Vine Context",
|
|
12
|
+
"shortDescription": "Share a context graph between people's agents",
|
|
13
|
+
"longDescription": "One shared Relate graph for a group's agents, peer to peer with no server. Every member keeps a full copy that syncs when they're online. Record claims and questions; share it with a join code; see who believed what, when.",
|
|
14
|
+
"category": "Productivity",
|
|
15
|
+
"capabilities": ["Read", "Write"]
|
|
16
|
+
}
|
|
17
|
+
}
|
package/plugin/.mcp.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Vine Context's Codex hooks: tell the agent what the chat's context is for, and what other members' changes meant, beside the person's prompt. Codex reads this file rather than hooks/hooks.json, which also holds the Claude Code mod.",
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{ "hooks": [{ "type": "command", "command": "node \"${PLUGIN_ROOT}/hooks/vine-hook.mjs\" session-start", "timeout": 5 }] }
|
|
6
|
+
],
|
|
7
|
+
"UserPromptSubmit": [
|
|
8
|
+
{ "hooks": [{ "type": "command", "command": "node \"${PLUGIN_ROOT}/hooks/vine-hook.mjs\" prompt", "timeout": 5 }] }
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Join someone's shared context with the join code they sent you
|
|
3
|
+
argument-hint: <vine1_ join code>
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Join the shared context with this join code: $ARGUMENTS
|
|
7
|
+
|
|
8
|
+
1. Call the `join_context` tool of the vine-context MCP server with the
|
|
9
|
+
code exactly as given above. If no code was given, call `context_info` and
|
|
10
|
+
offer the contexts in `your_contexts` instead (`use_context` makes one this
|
|
11
|
+
chat's context, no code needed).
|
|
12
|
+
2. I'm let in at once, with my own full copy, and it's added to this chat.
|
|
13
|
+
Tell me whose context it is, what it's for, my role, and that everyone in it
|
|
14
|
+
has been told I joined (my name, key fingerprint and agent). Then give me its
|
|
15
|
+
briefing in a few lines: open questions, conflicts, the latest.
|
|
16
|
+
3. Call `model_guide` before writing anything to it.
|
|
17
|
+
4. If no one answers, the person who made the code isn't online: tell me to
|
|
18
|
+
try again later. If it was already used on another machine and not by me,
|
|
19
|
+
tell me to warn them that the code may have leaked. If it's refused because
|
|
20
|
+
it was used, expired or was cancelled, tell me to ask for a new code.
|
|
21
|
+
|
|
22
|
+
Don't post the code anywhere: whoever uses it first gets in.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"modules": ["./register.tsx"],
|
|
3
|
+
"hooks": {
|
|
4
|
+
"SessionStart": [
|
|
5
|
+
{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/vine-hook.mjs\" session-start", "timeout": 5 }] }
|
|
6
|
+
],
|
|
7
|
+
"UserPromptSubmit": [
|
|
8
|
+
{ "hooks": [{ "type": "command", "command": "node \"${CLAUDE_PLUGIN_ROOT}/hooks/vine-hook.mjs\" prompt", "timeout": 5 }] }
|
|
9
|
+
]
|
|
10
|
+
}
|
|
11
|
+
}
|