Skip to main content

Liaison

Portable, structured context that any AI client can read and write.

Hand a working session from one model to another, because you hit a quota, because the other one is better at this part, or because you closed the laptop, without re-explaining the project.

Claude Code ─┐
Codex CLI   ─┼─ MCP ─→  liaison  ─→  ~/.liaison/<project>/
Cursor      ─┤                       entries.jsonl  (append-only log)
Gemini CLI  ─┘                       context/*.md   (human-readable mirror)

One server. Every client speaks MCP over stdio, so AI-agnosticism is the protocol's problem, not code you maintain per provider.

It saves itself

The context only survives if it actually gets written down, and neither humans nor models reliably do that while busy. In testing, an AI client with the store attached read from it and wrote nothing, unprompted, because recording had been left to its judgement. A photo library that only backed up the photos you remembered to upload would not be a backup.

So capture does not wait to be asked. Coding clients write the conversation to disk as it happens (Cursor and OpenCode keep their conversations in a local database, which Liaison reads read-only); Liaison reads it, takes both sides of the conversation (what you said and the assistant's visible replies, in full -- never its hidden reasoning or tool calls), deduplicates against what it already holds, and files it, triggered by the client's own lifecycle events, or by a scan that covers clients which fire no events at all. Captured turns are always private: publishing stays a deliberate act.

liaison capture --all     # every AI client on this machine, deduplicated
liaison status            # look for the `transcript:` count

Install

Install from PyPI with pip install liaison-sync. (Do not use pip install liaison: that name belongs to an unrelated project.)

SETUP.md has the whole thing, verified step by step, including automatic capture and what to do when a client cannot see the tools. The short version:

python3 -m venv ~/.local/share/liaison/venv
~/.local/share/liaison/venv/bin/pip install -e .
ln -sf ~/.local/share/liaison/venv/bin/liaison{,-mcp} ~/.local/bin/
liaison doctor          # verify before touching any client config

Then liaison setup --apply connects Claude Code and Codex and switches on automatic capture in one step (run liaison setup first to see the plan). ChatGPT and claude.ai keep conversations on their servers, so for those there is liaison import on a data export.

On the first machine, sign up with liaison account signup -e you@example.com. On the next, sign in with liaison account login -e you@example.com, then run liaison sync add on the first and liaison sync join CODE on the new one; or bring it back with liaison account recover and the recovery phrase alone. The account ties the vault to an email, so devices can be listed and revoked (which also replaces the vault key, so a removed device cannot read anything new), and a recovery phrase brings the vault back when no device is left. Prefer a folder you already sync (iCloud, Dropbox, Syncthing)? liaison sync init <folder> on the first and liaison sync join on the next still works with no account and no server. See SETUP.md section 4d.

Works on MCP SDK 1.x and 2.x: 2.0 renamed FastMCP to MCPServer, and server.py carries an import shim rather than pinning you to one major.

Then connect your clients; see clients/README.md for Claude Code, Codex CLI, Cursor and Gemini CLI. Each is three lines of config.

The six tools

Tool When the model calls it
liaison_resume Start of every session, before asking the user anything
liaison_note A decision made, a fact learned, state changed, question left open
liaison_search Instead of asking the user to re-explain something
liaison_supersede Something recorded is now wrong, or a question is answered (status="resolved")
liaison_handoff User hits a limit or switches provider; returns the brief
liaison_status What's in the store

Six is a ceiling, not a starting point. Every extra tool is one more choice the client model has to get right, and a model unsure which tool to call calls none.

One project, many directories

A store is a directory; a project is not. A T3 worktree, a Khuluma item folder and a canonical checkout can all serve the same project, and recording by directory name alone scatters one project's memory across stores no next session opens. Resolution tries these in order, and the first statement wins:

  1. LIAISON_WORKSPACE in the client config.
  2. A path registered with liaison projects path FOLDER WORKSPACE.
  3. A .liaison/workspace (or .liaison-workspace) file naming the project.
  4. For a linked git worktree, the main repository it belongs to.
  5. For ~/.t3/worktrees/<project>/<thread>, <project>.
  6. The nearest project marker's directory name.

Two commands make the estate legible:

liaison report --t3 --khuluma   # usage, stranded notes, resume accuracy
liaison projects migrate        # plan a merge of stranded stores; --apply to copy

liaison projects link ALIAS WORKSPACE registers another name for the same project, so liaison_resume ref: "Site Quality Hill-Climb" finds scamcheck-za. Migration only copies from machine-readable mappings (the T3 thread record, Khuluma item metadata, a marker, an alias), and never deletes the source.

What actually happens when you run out of quota

$ liaison brief | pbcopy

Paste into whatever you can still open. Or, if the other client has the server attached, it calls liaison_resume and gets the same document.

There is deliberately no auto-detection of remaining credits. Consumer subscriptions expose no quota API, and scripting a provider's web UI to find out is against their terms and breaks on every redesign. The trigger is you saying "I'm switching", or a rate-limit error the client surfaces. Building on a quota-scraper would mean building a demo that can't ship.

Design decisions worth knowing

Append-only. Two clients can be writing at once: you switched providers mid-thought and left the old window open. An append never loses the other's work; a mutable blob would.

Nothing is deleted. supersede points a new entry at the one it replaces. Retrieval demotes the old one to 15% score, so it never outranks its replacement but stays findable when you need to know what you used to think.

BM25, not embeddings. An embedding model retrieves marginally better and drags a provider dependency into a tool whose entire premise is not depending on a provider. BM25 is offline, instant, and good enough over a few thousand short entries. The stemmer is forty lines and crude on purpose.

Which project you are in is not a question. The workspace is resolved from the directory the client was launched in, walking up to the nearest project marker (.git, pyproject.toml, package.json, CLAUDE.md, and friends), so repo/tests and repo/src/deep both resolve to repo. This is not a convenience. A client launched one directory down used to open a second, empty store, and the only symptom was a handoff that came up blank at the moment you needed it. A model should never ask the user which project this is, and liaison_resume opens by saying which workspace it resolved and how.

When the launch directory is not inside any project -- $HOME or /, which is where GUI clients routinely start a server -- the workspace is default and the brief says so, rather than inventing a plausible name and quietly mixing every project together.

Autosave, because not getting to save is the failure mode. A tool whose premise is that sessions end abruptly cannot depend on the model calling liaison_handoff on its way out; the session that most needs recording is the one that got cut off mid-turn. So the server keeps a checkpoint of the live session -- one JSON file, rewritten atomically on every tool call and on an interval -- and writes a single boundary entry to the log when the session ends, however it ends: a real handoff, a SIGTERM from the client, stdin closing, or the next session finding the checkpoint orphaned because the process was killed outright.

The checkpoint deliberately does not go into the append-only log. Appending a bookkeeping entry every couple of minutes would grow the store without making a single brief better. It is scratch state; only the session's ending is context.

An autosaved digest is a floor, not a substitute. It can say what the session called and what it searched for -- which is more than nothing, and more than you get today -- but only liaison_note can say what it learned. An explicit handoff note is never overwritten by a generated one.

The brief is addressed to a model, not a human. It opens with instructions, states what is current, and says what not to re-litigate. And it is bounded: you switched providers because you ran out of budget; pasting 60k tokens of history into the fresh one spends the budget you just bought. Each section has a character budget (about 5k tokens in all); a long entry is cut with its id, and liaison_search given that id returns it whole.

Configuration

All optional. Set them per client in the MCP config, so each client is attributed correctly.

Variable Default What it does
LIAISON_AGENT unset Which client this is (claude-code, codex, ...). Makes a brief say "a previous session in codex built this".
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.
LIAISON_HOME ~/.liaison Where stores live.
LIAISON_AUTOSAVE on off disables checkpointing and the automatic end-of-session entry.
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.
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.
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.
LIAISON_DEFAULT_VISIBILITY library What an unmarked entry gets. private to opt out of sharing by default.
LIAISON_AUTHOR / LIAISON_MODEL / LIAISON_SESSION inferred Provenance overrides.

liaison doctor prints the resolved workspace, how it was resolved, and whether autosave is on.

What this is not, yet

The store is still a directory on your disk, and sharing another person's context is still gated by an explicit approval. An optional account now owns the relay vault, enrols devices and holds a recovery phrase, but it does not turn Liaison into a hosted service: there is no network listener in this process. The relay is the only server, and it cannot read what it stores.

The multiplayer half, querying another person's context through an approval gate, is one seam away, and that seam is now built and tested even though nothing crosses it yet. Every entry carries visibility (library | private), and one function, store.visible_to(entries, audience), decides what a given asker may retrieve. liaison_search, liaison_resume and the brief all route through it, so the approval gate is a different argument to a filter that already exists rather than a second retrieval path, and two retrieval paths is how a private entry eventually escapes through the one nobody remembered to filter.

A session that is running right now is visible to other clients: liaison_resume and liaison_status list it, with how long ago it was last confirmed alive and how long ago it last did anything. The log is only as fresh as the last liaison_note, so a brief that stayed silent about this would read as the current state of work that has in fact moved on.

You can already see what it will do:

liaison library                  # exactly what a colleague would be shown
liaison review                   # your shareable entries past their review date
liaison brief --audience library # the same brief, with the private half removed

Unmarked entries default to library, which is not a settled decision: marked by hand and it never happens, marked automatically and it leaks. Nothing is shared yet, so the default costs nothing today, and LIAISON_DEFAULT_VISIBILITY=private flips it while we find out which way real usage falls.

Whether the multiplayer half is a feature of this or a separate product is not settled, and shipping single-player first is how you find out with real usage instead of arguing about it.

Tests

python -m pytest tests/ -q

Metadata

Release files for liaison-sync 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for liaison-sync 0.2.0
File Size Uploaded Provenance Actions
liaison_sync-0.2.0.tar.gz 246.3 kB Without provenance Details for liaison_sync-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for liaison-sync 0.2.0
File Interpreter ABI Platform Actions
liaison_sync-0.2.0-py3-none-any.whl Python 3 none any Details for liaison_sync-0.2.0-py3-none-any.whl

Total release size: 425.0 kB

Release files / liaison_sync-0.2.0.tar.gz

Download URL liaison_sync-0.2.0.tar.gz
Size 246.3 kB
Tags Source
SHA-256 checksum
How to use checksums
759f3ef3f3ecac05ecbd7107f821a0143b9cd85bc159c3749239f65afd948989
BLAKE2b-256 checksum
How to use checksums
f66e2af9bb9e96508e1390f33511affb3288e39ea9c4d957ea4e118d0e0a5f0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / liaison_sync-0.2.0-py3-none-any.whl

Download URL liaison_sync-0.2.0-py3-none-any.whl
Size 178.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34bc92ac186899f2028df40f96589680b86f7eff9d0f7d7c11d3122176d4ddfc
BLAKE2b-256 checksum
How to use checksums
e9baa596b13150650c384b7089de47715dc19a540852011740be8eaa0707bbd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for liaison-sync 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page