liaison-sync 0.2.0__tar.gz
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.
- liaison_sync-0.2.0/PKG-INFO +278 -0
- liaison_sync-0.2.0/README.md +255 -0
- liaison_sync-0.2.0/pyproject.toml +49 -0
- liaison_sync-0.2.0/setup.cfg +4 -0
- liaison_sync-0.2.0/src/liaison/__init__.py +3 -0
- liaison_sync-0.2.0/src/liaison/account.py +615 -0
- liaison_sync-0.2.0/src/liaison/account_proto.py +371 -0
- liaison_sync-0.2.0/src/liaison/account_server.py +684 -0
- liaison_sync-0.2.0/src/liaison/account_store.py +86 -0
- liaison_sync-0.2.0/src/liaison/autosave.py +542 -0
- liaison_sync-0.2.0/src/liaison/capture.py +714 -0
- liaison_sync-0.2.0/src/liaison/chatimport.py +204 -0
- liaison_sync-0.2.0/src/liaison/cli.py +1110 -0
- liaison_sync-0.2.0/src/liaison/conversations.py +229 -0
- liaison_sync-0.2.0/src/liaison/cursor.py +265 -0
- liaison_sync-0.2.0/src/liaison/exchange.py +262 -0
- liaison_sync-0.2.0/src/liaison/handoff.py +192 -0
- liaison_sync-0.2.0/src/liaison/identity.py +194 -0
- liaison_sync-0.2.0/src/liaison/locate.py +138 -0
- liaison_sync-0.2.0/src/liaison/mail.py +253 -0
- liaison_sync-0.2.0/src/liaison/migrate.py +223 -0
- liaison_sync-0.2.0/src/liaison/notes.py +124 -0
- liaison_sync-0.2.0/src/liaison/opencode.py +159 -0
- liaison_sync-0.2.0/src/liaison/registry.py +130 -0
- liaison_sync-0.2.0/src/liaison/relay_client.py +238 -0
- liaison_sync-0.2.0/src/liaison/relay_proto.py +285 -0
- liaison_sync-0.2.0/src/liaison/relay_server.py +1228 -0
- liaison_sync-0.2.0/src/liaison/relay_testsupport.py +112 -0
- liaison_sync-0.2.0/src/liaison/relaysync.py +706 -0
- liaison_sync-0.2.0/src/liaison/report.py +307 -0
- liaison_sync-0.2.0/src/liaison/retrieval.py +143 -0
- liaison_sync-0.2.0/src/liaison/rotation.py +333 -0
- liaison_sync-0.2.0/src/liaison/schema.py +224 -0
- liaison_sync-0.2.0/src/liaison/server.py +621 -0
- liaison_sync-0.2.0/src/liaison/setup.py +499 -0
- liaison_sync-0.2.0/src/liaison/store.py +356 -0
- liaison_sync-0.2.0/src/liaison/sync.py +408 -0
- liaison_sync-0.2.0/src/liaison/transport.py +181 -0
- liaison_sync-0.2.0/src/liaison_sync.egg-info/PKG-INFO +278 -0
- liaison_sync-0.2.0/src/liaison_sync.egg-info/SOURCES.txt +55 -0
- liaison_sync-0.2.0/src/liaison_sync.egg-info/dependency_links.txt +1 -0
- liaison_sync-0.2.0/src/liaison_sync.egg-info/entry_points.txt +5 -0
- liaison_sync-0.2.0/src/liaison_sync.egg-info/requires.txt +7 -0
- liaison_sync-0.2.0/src/liaison_sync.egg-info/top_level.txt +1 -0
- liaison_sync-0.2.0/tests/test_accounts.py +818 -0
- liaison_sync-0.2.0/tests/test_battle.py +307 -0
- liaison_sync-0.2.0/tests/test_conversations.py +283 -0
- liaison_sync-0.2.0/tests/test_guide.py +51 -0
- liaison_sync-0.2.0/tests/test_hardening.py +216 -0
- liaison_sync-0.2.0/tests/test_liaison.py +2906 -0
- liaison_sync-0.2.0/tests/test_multidevice_harness.py +106 -0
- liaison_sync-0.2.0/tests/test_notes.py +96 -0
- liaison_sync-0.2.0/tests/test_opencode.py +233 -0
- liaison_sync-0.2.0/tests/test_projects.py +285 -0
- liaison_sync-0.2.0/tests/test_relay.py +619 -0
- liaison_sync-0.2.0/tests/test_rotation.py +690 -0
- liaison_sync-0.2.0/tests/test_verification.py +981 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: liaison-sync
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Portable, structured context that any AI client can read and write. Hand off a working session between models without re-briefing.
|
|
5
|
+
Keywords: mcp,ai,context,memory,handoff,claude,codex
|
|
6
|
+
Classifier: Development Status :: 3 - Alpha
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Topic :: Software Development
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: mcp>=1.23
|
|
18
|
+
Requires-Dist: pydantic>=2.0
|
|
19
|
+
Requires-Dist: cryptography>=41
|
|
20
|
+
Requires-Dist: spake2>=0.8
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
23
|
+
|
|
24
|
+
# Liaison
|
|
25
|
+
|
|
26
|
+
Portable, structured context that any AI client can read and write.
|
|
27
|
+
|
|
28
|
+
Hand a working session from one model to another, because you hit a quota,
|
|
29
|
+
because the other one is better at this part, or because you closed the laptop, without re-explaining the project.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Claude Code ─┐
|
|
33
|
+
Codex CLI ─┼─ MCP ─→ liaison ─→ ~/.liaison/<project>/
|
|
34
|
+
Cursor ─┤ entries.jsonl (append-only log)
|
|
35
|
+
Gemini CLI ─┘ context/*.md (human-readable mirror)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
One server. Every client speaks MCP over stdio, so AI-agnosticism is the
|
|
39
|
+
protocol's problem, not code you maintain per provider.
|
|
40
|
+
|
|
41
|
+
## It saves itself
|
|
42
|
+
|
|
43
|
+
The context only survives if it actually gets written down, and neither humans
|
|
44
|
+
nor models reliably do that while busy. In testing, an AI client with the store
|
|
45
|
+
attached read from it and wrote nothing, unprompted, because recording had
|
|
46
|
+
been left to its judgement. A photo library that only backed up the photos you
|
|
47
|
+
remembered to upload would not be a backup.
|
|
48
|
+
|
|
49
|
+
So capture does not wait to be asked. Coding clients write the conversation to
|
|
50
|
+
disk as it happens (Cursor and OpenCode keep their conversations in a local database, which
|
|
51
|
+
Liaison reads read-only); Liaison reads it, takes both sides of the conversation (what you said and the
|
|
52
|
+
assistant's visible replies, in full -- never its hidden reasoning or tool
|
|
53
|
+
calls), deduplicates against what it already holds, and files it, triggered by the
|
|
54
|
+
client's own lifecycle events, or by a scan that covers clients which fire no
|
|
55
|
+
events at all. Captured turns are always private: publishing stays a
|
|
56
|
+
deliberate act.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
liaison capture --all # every AI client on this machine, deduplicated
|
|
60
|
+
liaison status # look for the `transcript:` count
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Install
|
|
64
|
+
|
|
65
|
+
Install from PyPI with `pip install liaison-sync`. (Do not use `pip install liaison`:
|
|
66
|
+
that name belongs to an unrelated project.)
|
|
67
|
+
|
|
68
|
+
[**SETUP.md**](SETUP.md) has the whole thing, verified step by step, including
|
|
69
|
+
automatic capture and what to do when a client cannot see the tools. The short
|
|
70
|
+
version:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python3 -m venv ~/.local/share/liaison/venv
|
|
74
|
+
~/.local/share/liaison/venv/bin/pip install -e .
|
|
75
|
+
ln -sf ~/.local/share/liaison/venv/bin/liaison{,-mcp} ~/.local/bin/
|
|
76
|
+
liaison doctor # verify before touching any client config
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Then `liaison setup --apply` connects Claude Code and Codex and switches on
|
|
80
|
+
automatic capture in one step (run `liaison setup` first to see the plan).
|
|
81
|
+
ChatGPT and claude.ai keep conversations on their servers, so for those there
|
|
82
|
+
is `liaison import` on a data export.
|
|
83
|
+
|
|
84
|
+
On the first machine, sign up with `liaison account signup -e you@example.com`.
|
|
85
|
+
On the next, sign in with `liaison account login -e you@example.com`, then run
|
|
86
|
+
`liaison sync add` on the first and `liaison sync join CODE` on the new one; or
|
|
87
|
+
bring it back with `liaison account recover` and the recovery phrase alone. The
|
|
88
|
+
account ties the vault to an email, so devices can be listed and revoked (which
|
|
89
|
+
also replaces the vault key, so a removed device cannot read anything new), and a
|
|
90
|
+
recovery phrase brings the vault back when no device is left. Prefer a folder
|
|
91
|
+
you already sync (iCloud, Dropbox, Syncthing)? `liaison sync init <folder>` on
|
|
92
|
+
the first and `liaison sync join` on the next still works with no account and
|
|
93
|
+
no server. See SETUP.md section 4d.
|
|
94
|
+
|
|
95
|
+
Works on MCP SDK 1.x and 2.x: 2.0 renamed `FastMCP` to `MCPServer`, and
|
|
96
|
+
`server.py` carries an import shim rather than pinning you to one major.
|
|
97
|
+
|
|
98
|
+
Then connect your clients; see [`clients/README.md`](clients/README.md) for
|
|
99
|
+
Claude Code, Codex CLI, Cursor and Gemini CLI. Each is three lines of config.
|
|
100
|
+
|
|
101
|
+
## The six tools
|
|
102
|
+
|
|
103
|
+
| Tool | When the model calls it |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `liaison_resume` | Start of every session, before asking the user anything |
|
|
106
|
+
| `liaison_note` | A decision made, a fact learned, state changed, question left open |
|
|
107
|
+
| `liaison_search` | Instead of asking the user to re-explain something |
|
|
108
|
+
| `liaison_supersede` | Something recorded is now wrong, or a question is answered (`status="resolved"`) |
|
|
109
|
+
| `liaison_handoff` | User hits a limit or switches provider; returns the brief |
|
|
110
|
+
| `liaison_status` | What's in the store |
|
|
111
|
+
|
|
112
|
+
Six is a ceiling, not a starting point. Every extra tool is one more choice the
|
|
113
|
+
client model has to get right, and a model unsure which tool to call calls none.
|
|
114
|
+
|
|
115
|
+
## One project, many directories
|
|
116
|
+
|
|
117
|
+
A store is a directory; a project is not. A T3 worktree, a Khuluma item folder
|
|
118
|
+
and a canonical checkout can all serve the same project, and recording by
|
|
119
|
+
directory name alone scatters one project's memory across stores no next
|
|
120
|
+
session opens. Resolution tries these in order, and the first statement wins:
|
|
121
|
+
|
|
122
|
+
1. `LIAISON_WORKSPACE` in the client config.
|
|
123
|
+
2. A path registered with `liaison projects path FOLDER WORKSPACE`.
|
|
124
|
+
3. A `.liaison/workspace` (or `.liaison-workspace`) file naming the project.
|
|
125
|
+
4. For a linked git worktree, the main repository it belongs to.
|
|
126
|
+
5. For `~/.t3/worktrees/<project>/<thread>`, `<project>`.
|
|
127
|
+
6. The nearest project marker's directory name.
|
|
128
|
+
|
|
129
|
+
Two commands make the estate legible:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
liaison report --t3 --khuluma # usage, stranded notes, resume accuracy
|
|
133
|
+
liaison projects migrate # plan a merge of stranded stores; --apply to copy
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`liaison projects link ALIAS WORKSPACE` registers another name for the same
|
|
137
|
+
project, so `liaison_resume ref: "Site Quality Hill-Climb"` finds
|
|
138
|
+
`scamcheck-za`. Migration only copies from machine-readable mappings (the T3
|
|
139
|
+
thread record, Khuluma item metadata, a marker, an alias), and never deletes the
|
|
140
|
+
source.
|
|
141
|
+
|
|
142
|
+
## What actually happens when you run out of quota
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
$ liaison brief | pbcopy
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Paste into whatever you can still open. Or, if the other client has the server
|
|
149
|
+
attached, it calls `liaison_resume` and gets the same document.
|
|
150
|
+
|
|
151
|
+
There is deliberately **no auto-detection of remaining credits**. Consumer
|
|
152
|
+
subscriptions expose no quota API, and scripting a provider's web UI to find
|
|
153
|
+
out is against their terms and breaks on every redesign. The trigger is you
|
|
154
|
+
saying "I'm switching", or a rate-limit error the client surfaces. Building on
|
|
155
|
+
a quota-scraper would mean building a demo that can't ship.
|
|
156
|
+
|
|
157
|
+
## Design decisions worth knowing
|
|
158
|
+
|
|
159
|
+
**Append-only.** Two clients can be writing at once: you switched providers
|
|
160
|
+
mid-thought and left the old window open. An append never loses the other's
|
|
161
|
+
work; a mutable blob would.
|
|
162
|
+
|
|
163
|
+
**Nothing is deleted.** `supersede` points a new entry at the one it replaces.
|
|
164
|
+
Retrieval demotes the old one to 15% score, so it never outranks its
|
|
165
|
+
replacement but stays findable when you need to know what you used to think.
|
|
166
|
+
|
|
167
|
+
**BM25, not embeddings.** An embedding model retrieves marginally better and
|
|
168
|
+
drags a provider dependency into a tool whose entire premise is not depending
|
|
169
|
+
on a provider. BM25 is offline, instant, and good enough over a few thousand
|
|
170
|
+
short entries. The stemmer is forty lines and crude on purpose.
|
|
171
|
+
|
|
172
|
+
**Which project you are in is not a question.** The workspace is resolved from
|
|
173
|
+
the directory the client was launched in, walking up to the nearest project
|
|
174
|
+
marker (`.git`, `pyproject.toml`, `package.json`, `CLAUDE.md`, and friends), so
|
|
175
|
+
`repo/tests` and `repo/src/deep` both resolve to `repo`. This is not a
|
|
176
|
+
convenience. A client launched one directory down used to open a *second*,
|
|
177
|
+
empty store, and the only symptom was a handoff that came up blank at the
|
|
178
|
+
moment you needed it. A model should never ask the user which project this is,
|
|
179
|
+
and `liaison_resume` opens by saying which workspace it resolved and how.
|
|
180
|
+
|
|
181
|
+
When the launch directory is not inside any project -- `$HOME` or `/`, which is
|
|
182
|
+
where GUI clients routinely start a server -- the workspace is `default` and
|
|
183
|
+
the brief says so, rather than inventing a plausible name and quietly mixing
|
|
184
|
+
every project together.
|
|
185
|
+
|
|
186
|
+
**Autosave, because not getting to save is the failure mode.** A tool whose
|
|
187
|
+
premise is that sessions end abruptly cannot depend on the model calling
|
|
188
|
+
`liaison_handoff` on its way out; the session that most needs recording is the
|
|
189
|
+
one that got cut off mid-turn. So the server keeps a checkpoint of the live
|
|
190
|
+
session -- one JSON file, rewritten atomically on every tool call and on an
|
|
191
|
+
interval -- and writes a single `boundary` entry to the log when the session
|
|
192
|
+
ends, however it ends: a real handoff, a SIGTERM from the client, stdin
|
|
193
|
+
closing, or the next session finding the checkpoint orphaned because the
|
|
194
|
+
process was killed outright.
|
|
195
|
+
|
|
196
|
+
The checkpoint deliberately does *not* go into the append-only log. Appending a
|
|
197
|
+
bookkeeping entry every couple of minutes would grow the store without making a
|
|
198
|
+
single brief better. It is scratch state; only the session's ending is context.
|
|
199
|
+
|
|
200
|
+
An autosaved digest is a floor, not a substitute. It can say what the session
|
|
201
|
+
called and what it searched for -- which is more than nothing, and more than
|
|
202
|
+
you get today -- but only `liaison_note` can say what it *learned*. An explicit
|
|
203
|
+
handoff note is never overwritten by a generated one.
|
|
204
|
+
|
|
205
|
+
**The brief is addressed to a model, not a human.** It opens with instructions,
|
|
206
|
+
states what is current, and says what not to re-litigate. And it is bounded:
|
|
207
|
+
you switched providers because you ran out of budget; pasting 60k tokens of
|
|
208
|
+
history into the fresh one spends the budget you just bought. Each section has
|
|
209
|
+
a character budget (about 5k tokens in all); a long entry is cut with its id,
|
|
210
|
+
and `liaison_search` given that id returns it whole.
|
|
211
|
+
|
|
212
|
+
## Configuration
|
|
213
|
+
|
|
214
|
+
All optional. Set them per client in the MCP config, so each client is
|
|
215
|
+
attributed correctly.
|
|
216
|
+
|
|
217
|
+
| Variable | Default | What it does |
|
|
218
|
+
|---|---|---|
|
|
219
|
+
| `LIAISON_AGENT` | unset | Which client this is (`claude-code`, `codex`, ...). Makes a brief say *"a previous session in codex built this"*. |
|
|
220
|
+
| `LIAISON_WORKSPACE` | resolved from the launch directory | Pin the workspace. Use it when one project spans several directories, when two projects share a directory name, or when a client starts in `$HOME`. |
|
|
221
|
+
| `LIAISON_HOME` | `~/.liaison` | Where stores live. |
|
|
222
|
+
| `LIAISON_AUTOSAVE` | `on` | `off` disables checkpointing and the automatic end-of-session entry. |
|
|
223
|
+
| `LIAISON_AUTOSAVE_INTERVAL` | `30` | Seconds between checkpoint heartbeats. Floored at 5. The checkpoint is also written on every tool call; the heartbeat is what tells another client that a quiet session is still alive. |
|
|
224
|
+
| `LIAISON_STALE_DAYS` | `90` | Default review interval. Past it, an entry is flagged to whoever reads it, and listed to you at the start of your next session. Per-entry override with `review_days` on `liaison_note`; superseding resets the clock. |
|
|
225
|
+
| `LIAISON_DEDUPE_SECONDS` | `600` | A note with the same kind, title and body inside this window is treated as a retry and not written twice. `0` disables it. |
|
|
226
|
+
| `LIAISON_DEFAULT_VISIBILITY` | `library` | What an unmarked entry gets. `private` to opt out of sharing by default. |
|
|
227
|
+
| `LIAISON_AUTHOR` / `LIAISON_MODEL` / `LIAISON_SESSION` | inferred | Provenance overrides. |
|
|
228
|
+
|
|
229
|
+
`liaison doctor` prints the resolved workspace, how it was resolved, and
|
|
230
|
+
whether autosave is on.
|
|
231
|
+
|
|
232
|
+
## What this is not, yet
|
|
233
|
+
|
|
234
|
+
The store is still a directory on your disk, and sharing another person's
|
|
235
|
+
context is still gated by an explicit approval. An optional account now owns the
|
|
236
|
+
relay vault, enrols devices and holds a recovery phrase, but it does not turn
|
|
237
|
+
Liaison into a hosted service: there is no network listener in this process.
|
|
238
|
+
The relay is the only server, and it cannot read what it stores.
|
|
239
|
+
|
|
240
|
+
The multiplayer half, querying *another person's* context through an approval
|
|
241
|
+
gate, is one seam away, and that seam is now built and tested even though
|
|
242
|
+
nothing crosses it yet. Every entry carries `visibility` (`library` | `private`),
|
|
243
|
+
and one function, `store.visible_to(entries, audience)`, decides what a given
|
|
244
|
+
asker may retrieve. `liaison_search`, `liaison_resume` and the brief all route
|
|
245
|
+
through it, so the approval gate is a different argument to a filter that
|
|
246
|
+
already exists rather than a second retrieval path, and two retrieval paths is
|
|
247
|
+
how a private entry eventually escapes through the one nobody remembered to
|
|
248
|
+
filter.
|
|
249
|
+
|
|
250
|
+
A session that is running right now is visible to other clients: `liaison_resume` and
|
|
251
|
+
`liaison_status` list it, with how long ago it was last confirmed alive and how
|
|
252
|
+
long ago it last did anything. The log is only as fresh as the last
|
|
253
|
+
`liaison_note`, so a brief that stayed silent about this would read as the current
|
|
254
|
+
state of work that has in fact moved on.
|
|
255
|
+
|
|
256
|
+
You can already see what it will do:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
liaison library # exactly what a colleague would be shown
|
|
260
|
+
liaison review # your shareable entries past their review date
|
|
261
|
+
liaison brief --audience library # the same brief, with the private half removed
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Unmarked entries default to `library`, which is not a settled decision: marked
|
|
265
|
+
by hand and it never happens, marked automatically and it leaks. Nothing is
|
|
266
|
+
shared yet, so the default costs nothing today, and
|
|
267
|
+
`LIAISON_DEFAULT_VISIBILITY=private` flips it while we find out which way real
|
|
268
|
+
usage falls.
|
|
269
|
+
|
|
270
|
+
Whether the multiplayer half is a feature of this or a separate product is not
|
|
271
|
+
settled, and shipping single-player first is how you find out with real usage
|
|
272
|
+
instead of arguing about it.
|
|
273
|
+
|
|
274
|
+
## Tests
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
python -m pytest tests/ -q
|
|
278
|
+
```
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# Liaison
|
|
2
|
+
|
|
3
|
+
Portable, structured context that any AI client can read and write.
|
|
4
|
+
|
|
5
|
+
Hand a working session from one model to another, because you hit a quota,
|
|
6
|
+
because the other one is better at this part, or because you closed the laptop, without re-explaining the project.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
Claude Code ─┐
|
|
10
|
+
Codex CLI ─┼─ MCP ─→ liaison ─→ ~/.liaison/<project>/
|
|
11
|
+
Cursor ─┤ entries.jsonl (append-only log)
|
|
12
|
+
Gemini CLI ─┘ context/*.md (human-readable mirror)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
One server. Every client speaks MCP over stdio, so AI-agnosticism is the
|
|
16
|
+
protocol's problem, not code you maintain per provider.
|
|
17
|
+
|
|
18
|
+
## It saves itself
|
|
19
|
+
|
|
20
|
+
The context only survives if it actually gets written down, and neither humans
|
|
21
|
+
nor models reliably do that while busy. In testing, an AI client with the store
|
|
22
|
+
attached read from it and wrote nothing, unprompted, because recording had
|
|
23
|
+
been left to its judgement. A photo library that only backed up the photos you
|
|
24
|
+
remembered to upload would not be a backup.
|
|
25
|
+
|
|
26
|
+
So capture does not wait to be asked. Coding clients write the conversation to
|
|
27
|
+
disk as it happens (Cursor and OpenCode keep their conversations in a local database, which
|
|
28
|
+
Liaison reads read-only); Liaison reads it, takes both sides of the conversation (what you said and the
|
|
29
|
+
assistant's visible replies, in full -- never its hidden reasoning or tool
|
|
30
|
+
calls), deduplicates against what it already holds, and files it, triggered by the
|
|
31
|
+
client's own lifecycle events, or by a scan that covers clients which fire no
|
|
32
|
+
events at all. Captured turns are always private: publishing stays a
|
|
33
|
+
deliberate act.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
liaison capture --all # every AI client on this machine, deduplicated
|
|
37
|
+
liaison status # look for the `transcript:` count
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
Install from PyPI with `pip install liaison-sync`. (Do not use `pip install liaison`:
|
|
43
|
+
that name belongs to an unrelated project.)
|
|
44
|
+
|
|
45
|
+
[**SETUP.md**](SETUP.md) has the whole thing, verified step by step, including
|
|
46
|
+
automatic capture and what to do when a client cannot see the tools. The short
|
|
47
|
+
version:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 -m venv ~/.local/share/liaison/venv
|
|
51
|
+
~/.local/share/liaison/venv/bin/pip install -e .
|
|
52
|
+
ln -sf ~/.local/share/liaison/venv/bin/liaison{,-mcp} ~/.local/bin/
|
|
53
|
+
liaison doctor # verify before touching any client config
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then `liaison setup --apply` connects Claude Code and Codex and switches on
|
|
57
|
+
automatic capture in one step (run `liaison setup` first to see the plan).
|
|
58
|
+
ChatGPT and claude.ai keep conversations on their servers, so for those there
|
|
59
|
+
is `liaison import` on a data export.
|
|
60
|
+
|
|
61
|
+
On the first machine, sign up with `liaison account signup -e you@example.com`.
|
|
62
|
+
On the next, sign in with `liaison account login -e you@example.com`, then run
|
|
63
|
+
`liaison sync add` on the first and `liaison sync join CODE` on the new one; or
|
|
64
|
+
bring it back with `liaison account recover` and the recovery phrase alone. The
|
|
65
|
+
account ties the vault to an email, so devices can be listed and revoked (which
|
|
66
|
+
also replaces the vault key, so a removed device cannot read anything new), and a
|
|
67
|
+
recovery phrase brings the vault back when no device is left. Prefer a folder
|
|
68
|
+
you already sync (iCloud, Dropbox, Syncthing)? `liaison sync init <folder>` on
|
|
69
|
+
the first and `liaison sync join` on the next still works with no account and
|
|
70
|
+
no server. See SETUP.md section 4d.
|
|
71
|
+
|
|
72
|
+
Works on MCP SDK 1.x and 2.x: 2.0 renamed `FastMCP` to `MCPServer`, and
|
|
73
|
+
`server.py` carries an import shim rather than pinning you to one major.
|
|
74
|
+
|
|
75
|
+
Then connect your clients; see [`clients/README.md`](clients/README.md) for
|
|
76
|
+
Claude Code, Codex CLI, Cursor and Gemini CLI. Each is three lines of config.
|
|
77
|
+
|
|
78
|
+
## The six tools
|
|
79
|
+
|
|
80
|
+
| Tool | When the model calls it |
|
|
81
|
+
|---|---|
|
|
82
|
+
| `liaison_resume` | Start of every session, before asking the user anything |
|
|
83
|
+
| `liaison_note` | A decision made, a fact learned, state changed, question left open |
|
|
84
|
+
| `liaison_search` | Instead of asking the user to re-explain something |
|
|
85
|
+
| `liaison_supersede` | Something recorded is now wrong, or a question is answered (`status="resolved"`) |
|
|
86
|
+
| `liaison_handoff` | User hits a limit or switches provider; returns the brief |
|
|
87
|
+
| `liaison_status` | What's in the store |
|
|
88
|
+
|
|
89
|
+
Six is a ceiling, not a starting point. Every extra tool is one more choice the
|
|
90
|
+
client model has to get right, and a model unsure which tool to call calls none.
|
|
91
|
+
|
|
92
|
+
## One project, many directories
|
|
93
|
+
|
|
94
|
+
A store is a directory; a project is not. A T3 worktree, a Khuluma item folder
|
|
95
|
+
and a canonical checkout can all serve the same project, and recording by
|
|
96
|
+
directory name alone scatters one project's memory across stores no next
|
|
97
|
+
session opens. Resolution tries these in order, and the first statement wins:
|
|
98
|
+
|
|
99
|
+
1. `LIAISON_WORKSPACE` in the client config.
|
|
100
|
+
2. A path registered with `liaison projects path FOLDER WORKSPACE`.
|
|
101
|
+
3. A `.liaison/workspace` (or `.liaison-workspace`) file naming the project.
|
|
102
|
+
4. For a linked git worktree, the main repository it belongs to.
|
|
103
|
+
5. For `~/.t3/worktrees/<project>/<thread>`, `<project>`.
|
|
104
|
+
6. The nearest project marker's directory name.
|
|
105
|
+
|
|
106
|
+
Two commands make the estate legible:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
liaison report --t3 --khuluma # usage, stranded notes, resume accuracy
|
|
110
|
+
liaison projects migrate # plan a merge of stranded stores; --apply to copy
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`liaison projects link ALIAS WORKSPACE` registers another name for the same
|
|
114
|
+
project, so `liaison_resume ref: "Site Quality Hill-Climb"` finds
|
|
115
|
+
`scamcheck-za`. Migration only copies from machine-readable mappings (the T3
|
|
116
|
+
thread record, Khuluma item metadata, a marker, an alias), and never deletes the
|
|
117
|
+
source.
|
|
118
|
+
|
|
119
|
+
## What actually happens when you run out of quota
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
$ liaison brief | pbcopy
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Paste into whatever you can still open. Or, if the other client has the server
|
|
126
|
+
attached, it calls `liaison_resume` and gets the same document.
|
|
127
|
+
|
|
128
|
+
There is deliberately **no auto-detection of remaining credits**. Consumer
|
|
129
|
+
subscriptions expose no quota API, and scripting a provider's web UI to find
|
|
130
|
+
out is against their terms and breaks on every redesign. The trigger is you
|
|
131
|
+
saying "I'm switching", or a rate-limit error the client surfaces. Building on
|
|
132
|
+
a quota-scraper would mean building a demo that can't ship.
|
|
133
|
+
|
|
134
|
+
## Design decisions worth knowing
|
|
135
|
+
|
|
136
|
+
**Append-only.** Two clients can be writing at once: you switched providers
|
|
137
|
+
mid-thought and left the old window open. An append never loses the other's
|
|
138
|
+
work; a mutable blob would.
|
|
139
|
+
|
|
140
|
+
**Nothing is deleted.** `supersede` points a new entry at the one it replaces.
|
|
141
|
+
Retrieval demotes the old one to 15% score, so it never outranks its
|
|
142
|
+
replacement but stays findable when you need to know what you used to think.
|
|
143
|
+
|
|
144
|
+
**BM25, not embeddings.** An embedding model retrieves marginally better and
|
|
145
|
+
drags a provider dependency into a tool whose entire premise is not depending
|
|
146
|
+
on a provider. BM25 is offline, instant, and good enough over a few thousand
|
|
147
|
+
short entries. The stemmer is forty lines and crude on purpose.
|
|
148
|
+
|
|
149
|
+
**Which project you are in is not a question.** The workspace is resolved from
|
|
150
|
+
the directory the client was launched in, walking up to the nearest project
|
|
151
|
+
marker (`.git`, `pyproject.toml`, `package.json`, `CLAUDE.md`, and friends), so
|
|
152
|
+
`repo/tests` and `repo/src/deep` both resolve to `repo`. This is not a
|
|
153
|
+
convenience. A client launched one directory down used to open a *second*,
|
|
154
|
+
empty store, and the only symptom was a handoff that came up blank at the
|
|
155
|
+
moment you needed it. A model should never ask the user which project this is,
|
|
156
|
+
and `liaison_resume` opens by saying which workspace it resolved and how.
|
|
157
|
+
|
|
158
|
+
When the launch directory is not inside any project -- `$HOME` or `/`, which is
|
|
159
|
+
where GUI clients routinely start a server -- the workspace is `default` and
|
|
160
|
+
the brief says so, rather than inventing a plausible name and quietly mixing
|
|
161
|
+
every project together.
|
|
162
|
+
|
|
163
|
+
**Autosave, because not getting to save is the failure mode.** A tool whose
|
|
164
|
+
premise is that sessions end abruptly cannot depend on the model calling
|
|
165
|
+
`liaison_handoff` on its way out; the session that most needs recording is the
|
|
166
|
+
one that got cut off mid-turn. So the server keeps a checkpoint of the live
|
|
167
|
+
session -- one JSON file, rewritten atomically on every tool call and on an
|
|
168
|
+
interval -- and writes a single `boundary` entry to the log when the session
|
|
169
|
+
ends, however it ends: a real handoff, a SIGTERM from the client, stdin
|
|
170
|
+
closing, or the next session finding the checkpoint orphaned because the
|
|
171
|
+
process was killed outright.
|
|
172
|
+
|
|
173
|
+
The checkpoint deliberately does *not* go into the append-only log. Appending a
|
|
174
|
+
bookkeeping entry every couple of minutes would grow the store without making a
|
|
175
|
+
single brief better. It is scratch state; only the session's ending is context.
|
|
176
|
+
|
|
177
|
+
An autosaved digest is a floor, not a substitute. It can say what the session
|
|
178
|
+
called and what it searched for -- which is more than nothing, and more than
|
|
179
|
+
you get today -- but only `liaison_note` can say what it *learned*. An explicit
|
|
180
|
+
handoff note is never overwritten by a generated one.
|
|
181
|
+
|
|
182
|
+
**The brief is addressed to a model, not a human.** It opens with instructions,
|
|
183
|
+
states what is current, and says what not to re-litigate. And it is bounded:
|
|
184
|
+
you switched providers because you ran out of budget; pasting 60k tokens of
|
|
185
|
+
history into the fresh one spends the budget you just bought. Each section has
|
|
186
|
+
a character budget (about 5k tokens in all); a long entry is cut with its id,
|
|
187
|
+
and `liaison_search` given that id returns it whole.
|
|
188
|
+
|
|
189
|
+
## Configuration
|
|
190
|
+
|
|
191
|
+
All optional. Set them per client in the MCP config, so each client is
|
|
192
|
+
attributed correctly.
|
|
193
|
+
|
|
194
|
+
| Variable | Default | What it does |
|
|
195
|
+
|---|---|---|
|
|
196
|
+
| `LIAISON_AGENT` | unset | Which client this is (`claude-code`, `codex`, ...). Makes a brief say *"a previous session in codex built this"*. |
|
|
197
|
+
| `LIAISON_WORKSPACE` | resolved from the launch directory | Pin the workspace. Use it when one project spans several directories, when two projects share a directory name, or when a client starts in `$HOME`. |
|
|
198
|
+
| `LIAISON_HOME` | `~/.liaison` | Where stores live. |
|
|
199
|
+
| `LIAISON_AUTOSAVE` | `on` | `off` disables checkpointing and the automatic end-of-session entry. |
|
|
200
|
+
| `LIAISON_AUTOSAVE_INTERVAL` | `30` | Seconds between checkpoint heartbeats. Floored at 5. The checkpoint is also written on every tool call; the heartbeat is what tells another client that a quiet session is still alive. |
|
|
201
|
+
| `LIAISON_STALE_DAYS` | `90` | Default review interval. Past it, an entry is flagged to whoever reads it, and listed to you at the start of your next session. Per-entry override with `review_days` on `liaison_note`; superseding resets the clock. |
|
|
202
|
+
| `LIAISON_DEDUPE_SECONDS` | `600` | A note with the same kind, title and body inside this window is treated as a retry and not written twice. `0` disables it. |
|
|
203
|
+
| `LIAISON_DEFAULT_VISIBILITY` | `library` | What an unmarked entry gets. `private` to opt out of sharing by default. |
|
|
204
|
+
| `LIAISON_AUTHOR` / `LIAISON_MODEL` / `LIAISON_SESSION` | inferred | Provenance overrides. |
|
|
205
|
+
|
|
206
|
+
`liaison doctor` prints the resolved workspace, how it was resolved, and
|
|
207
|
+
whether autosave is on.
|
|
208
|
+
|
|
209
|
+
## What this is not, yet
|
|
210
|
+
|
|
211
|
+
The store is still a directory on your disk, and sharing another person's
|
|
212
|
+
context is still gated by an explicit approval. An optional account now owns the
|
|
213
|
+
relay vault, enrols devices and holds a recovery phrase, but it does not turn
|
|
214
|
+
Liaison into a hosted service: there is no network listener in this process.
|
|
215
|
+
The relay is the only server, and it cannot read what it stores.
|
|
216
|
+
|
|
217
|
+
The multiplayer half, querying *another person's* context through an approval
|
|
218
|
+
gate, is one seam away, and that seam is now built and tested even though
|
|
219
|
+
nothing crosses it yet. Every entry carries `visibility` (`library` | `private`),
|
|
220
|
+
and one function, `store.visible_to(entries, audience)`, decides what a given
|
|
221
|
+
asker may retrieve. `liaison_search`, `liaison_resume` and the brief all route
|
|
222
|
+
through it, so the approval gate is a different argument to a filter that
|
|
223
|
+
already exists rather than a second retrieval path, and two retrieval paths is
|
|
224
|
+
how a private entry eventually escapes through the one nobody remembered to
|
|
225
|
+
filter.
|
|
226
|
+
|
|
227
|
+
A session that is running right now is visible to other clients: `liaison_resume` and
|
|
228
|
+
`liaison_status` list it, with how long ago it was last confirmed alive and how
|
|
229
|
+
long ago it last did anything. The log is only as fresh as the last
|
|
230
|
+
`liaison_note`, so a brief that stayed silent about this would read as the current
|
|
231
|
+
state of work that has in fact moved on.
|
|
232
|
+
|
|
233
|
+
You can already see what it will do:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
liaison library # exactly what a colleague would be shown
|
|
237
|
+
liaison review # your shareable entries past their review date
|
|
238
|
+
liaison brief --audience library # the same brief, with the private half removed
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Unmarked entries default to `library`, which is not a settled decision: marked
|
|
242
|
+
by hand and it never happens, marked automatically and it leaks. Nothing is
|
|
243
|
+
shared yet, so the default costs nothing today, and
|
|
244
|
+
`LIAISON_DEFAULT_VISIBILITY=private` flips it while we find out which way real
|
|
245
|
+
usage falls.
|
|
246
|
+
|
|
247
|
+
Whether the multiplayer half is a feature of this or a separate product is not
|
|
248
|
+
settled, and shipping single-player first is how you find out with real usage
|
|
249
|
+
instead of arguing about it.
|
|
250
|
+
|
|
251
|
+
## Tests
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
python -m pytest tests/ -q
|
|
255
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "liaison-sync"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Portable, structured context that any AI client can read and write. Hand off a working session between models without re-briefing."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
keywords = ["mcp", "ai", "context", "memory", "handoff", "claude", "codex"]
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 3 - Alpha",
|
|
10
|
+
"Environment :: Console",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.10",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Software Development",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
# 1.x and 2.x both supported (see the import shim in server.py). The floor is the
|
|
21
|
+
# lowest version actually tested: 1.18 and older fail to import against current
|
|
22
|
+
# pydantic, so a lower bound would promise something that does not install.
|
|
23
|
+
"mcp>=1.23",
|
|
24
|
+
"pydantic>=2.0",
|
|
25
|
+
"cryptography>=41", # identity.py, sync.py and the relay import it directly
|
|
26
|
+
"spake2>=0.8", # short pairing codes between devices (relay_client.py)
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.optional-dependencies]
|
|
30
|
+
dev = ["pytest>=7.0"]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
liaison-sync = "liaison.cli:main"
|
|
34
|
+
liaison = "liaison.cli:main" # kept so existing installs keep working
|
|
35
|
+
liaison-mcp = "liaison.server:main"
|
|
36
|
+
liaison-relay = "liaison.relay_server:main"
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["setuptools>=68"]
|
|
40
|
+
build-backend = "setuptools.build_meta"
|
|
41
|
+
|
|
42
|
+
[tool.setuptools.packages.find]
|
|
43
|
+
where = ["src"]
|
|
44
|
+
|
|
45
|
+
[tool.setuptools.package-data]
|
|
46
|
+
# Written at build time by testing/multidevice/build_kit.sh to say which relay a
|
|
47
|
+
# build syncs through by default (see relay_client.default_relay). Absent in a
|
|
48
|
+
# plain checkout, where there is no relay to guess at.
|
|
49
|
+
liaison = ["relay_default.txt"]
|