batonpass-cli 0.5.0__py3-none-any.whl

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.
batonpass/sync/wire.py ADDED
@@ -0,0 +1,205 @@
1
+ """The wire format: append-only JSON lines, blobs addressed by their content.
2
+
3
+ Two rules make machine-to-machine safe without any merge algorithm:
4
+
5
+ * a device only ever appends to **its own** file, so there is nothing to lock
6
+ and nothing to reconcile;
7
+ * every payload is addressed by the sha256 of its plaintext, so arriving twice
8
+ is indistinguishable from arriving once. Union of two append-only sets is
9
+ set union — that is the whole conflict story.
10
+
11
+ Blobs travel **zlib**-compressed, not zstd-with-dictionary. The trained
12
+ dictionary is per-device and would make one machine's stream unreadable on the
13
+ other; zlib is in the standard library on both ends, so a machine that has
14
+ installed nothing but batonpass can still read the channel.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import json
20
+ import os
21
+ import zlib
22
+
23
+ from . import crypt
24
+
25
+ from ..store.content import sha256_bytes
26
+
27
+ WIRE_VERSION = 1
28
+ _TIERS = ("t0", "t1", "t2")
29
+
30
+
31
+ def pack(obj: dict) -> str:
32
+ return json.dumps(obj, ensure_ascii=False, sort_keys=True, default=str) + "\n"
33
+
34
+
35
+ def unpack(line: str):
36
+ line = line.strip()
37
+ if not line:
38
+ return None
39
+ try:
40
+ obj = json.loads(line)
41
+ except ValueError:
42
+ return None
43
+ return obj if isinstance(obj, dict) else None
44
+
45
+
46
+ # ── blobs ───────────────────────────────────────────────────────
47
+
48
+ def blob_path(channel: str, sha: str) -> str:
49
+ return os.path.join(channel, "blobs", sha[:2], sha)
50
+
51
+
52
+ def put_blob(channel: str, data: bytes) -> tuple[str, int, bool]:
53
+ """Store a payload once. Returns (sha, bytes_written, was_new).
54
+
55
+ The path is the sha256 of the *plaintext* — that is what makes a re-send
56
+ indistinguishable from a first send. The bytes on disk are zlib, then sealed
57
+ if the channel is encrypted, so the same plaintext always lands on the same
58
+ path whether or not the channel is sealed.
59
+ """
60
+ if isinstance(data, str):
61
+ data = data.encode("utf-8")
62
+ sha = sha256_bytes(data)
63
+ path = blob_path(channel, sha)
64
+ if os.path.exists(path):
65
+ return sha, 0, False
66
+ os.makedirs(os.path.dirname(path), exist_ok=True)
67
+ blob = zlib.compress(data, 9)
68
+ if crypt.enabled(channel):
69
+ blob = crypt.seal(channel, blob)
70
+ tmp = path + ".tmp%d" % os.getpid()
71
+ with open(tmp, "wb") as fh:
72
+ fh.write(blob)
73
+ fh.flush()
74
+ os.fsync(fh.fileno())
75
+ os.replace(tmp, path) # atomic: a reader sees all or nothing
76
+ return sha, len(blob), True
77
+
78
+
79
+ def get_blob(channel: str, sha: str):
80
+ path = blob_path(channel, sha)
81
+ if not sha or not os.path.exists(path):
82
+ return None
83
+ with open(path, "rb") as fh:
84
+ raw = fh.read()
85
+ if crypt.sealed_with(channel, raw):
86
+ # A wrong or missing key must not look like a corrupt archive.
87
+ raw = crypt.open_(channel, raw)
88
+ if raw is None:
89
+ raise RuntimeError(
90
+ "cannot open %s: this channel is encrypted and the key does not "
91
+ "match (check BATONPASS_KEY, or ~/.batonpass/key)" % sha[:12])
92
+ return zlib.decompress(raw)
93
+
94
+
95
+ def has_blob(channel: str, sha: str) -> bool:
96
+ return bool(sha) and os.path.exists(blob_path(channel, sha))
97
+
98
+
99
+ # ── streams ─────────────────────────────────────────────────────
100
+
101
+ def stream_path(channel: str, device: str, tier: str) -> str:
102
+ return os.path.join(channel, "stream", device, "%s.jsonl" % tier)
103
+
104
+
105
+ def append_lines(channel: str, device: str, tier: str, lines) -> int:
106
+ """Append a batch, fsync once. Returns bytes written."""
107
+ path = stream_path(channel, device, tier)
108
+ os.makedirs(os.path.dirname(path), exist_ok=True)
109
+ block = "".join(lines)
110
+ if not block:
111
+ return 0
112
+ with open(path, "a", encoding="utf-8") as fh:
113
+ fh.write(block)
114
+ fh.flush()
115
+ os.fsync(fh.fileno())
116
+ return len(block.encode("utf-8"))
117
+
118
+
119
+ def read_since(channel: str, device: str, tier: str, offset: int = 0):
120
+ """Read new complete lines from `offset`.
121
+
122
+ A line is only accepted if it ends with a newline, so a pull that races a
123
+ push never imports half a record — it simply stops at the last newline and
124
+ picks the rest up next time.
125
+ """
126
+ path = stream_path(channel, device, tier)
127
+ if not os.path.exists(path):
128
+ return [], offset, 0
129
+ with open(path, "rb") as fh:
130
+ fh.seek(offset)
131
+ raw = fh.read()
132
+ cut = raw.rfind(b"\n")
133
+ if cut < 0:
134
+ return [], offset, 0
135
+ usable, rest = raw[: cut + 1], len(raw[: cut + 1])
136
+ rows, bad = [], 0
137
+ for line in usable.decode("utf-8", "replace").splitlines():
138
+ obj = unpack(line)
139
+ if obj is None:
140
+ bad += 1
141
+ else:
142
+ rows.append(obj)
143
+ return rows, offset + rest, bad
144
+
145
+
146
+ def stream_bytes(channel: str, device: str, tier: str) -> int:
147
+ path = stream_path(channel, device, tier)
148
+ try:
149
+ return os.path.getsize(path)
150
+ except OSError:
151
+ return 0
152
+
153
+
154
+ def dedupe_key(tier: str, obj: dict):
155
+ """What makes two stream lines the same fact, newest wins.
156
+
157
+ t0/t1 carry one line per session, so the session id is the key. t2 carries
158
+ per-message and per-part lines, so the key is the position they occupy —
159
+ re-sending a message must not look like a second message.
160
+ """
161
+ if tier in ("t0", "t1"):
162
+ return ("s", obj.get("sid"))
163
+ if obj.get("k") == "p":
164
+ return ("p", obj.get("mid"), obj.get("seq"))
165
+ return ("m", obj.get("sid"), obj.get("seq"))
166
+
167
+
168
+ def compact_stream(channel: str, device: str, tier: str) -> dict:
169
+ """Rewrite one device's own stream as the union of what it says.
170
+
171
+ Append-only means re-sent facts pile up: 713 sessions pushed twenty times
172
+ is twenty copies of the same catalog, and every reader scans all of it.
173
+ A stream is a *set* of facts, so the compact form is one line per key —
174
+ last one wins, because the last one is the newest thing we know. Readers
175
+ key their byte offset on the generation number, so they simply start over.
176
+ """
177
+ path = stream_path(channel, device, tier)
178
+ if not os.path.exists(path):
179
+ return {"tier": tier, "before": 0, "after": 0, "lines_before": 0, "lines_after": 0}
180
+ with open(path, "rb") as fh:
181
+ raw = fh.read()
182
+ before = len(raw)
183
+ kept, bad = {}, 0
184
+ for line in raw.decode("utf-8", "replace").splitlines():
185
+ if not line.strip():
186
+ continue
187
+ obj = unpack(line)
188
+ if obj is None:
189
+ bad += 1
190
+ continue
191
+ kept[dedupe_key(tier, obj)] = obj # dict keeps first position,
192
+ # assignment keeps newest value
193
+ block = "".join(pack(o) for o in kept.values())
194
+ tmp = path + ".compact%d" % os.getpid()
195
+ with open(tmp, "w", encoding="utf-8") as fh:
196
+ fh.write(block)
197
+ fh.flush()
198
+ os.fsync(fh.fileno())
199
+ os.replace(tmp, path) # a reader sees old or new, never half
200
+ return {"tier": tier, "before": before, "after": len(block.encode("utf-8")),
201
+ "lines_before": len(kept) + bad, "lines_after": len(kept), "bad": bad}
202
+
203
+
204
+ def tiers():
205
+ return _TIERS
@@ -0,0 +1,324 @@
1
+ Metadata-Version: 2.4
2
+ Name: batonpass-cli
3
+ Version: 0.5.0
4
+ Summary: Never drop the baton. Read-only archive of the AI history on your machine, portable to the next one.
5
+ Author: lcpkof
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/lcpkof/batonpass
8
+ Project-URL: Issues, https://github.com/lcpkof/batonpass/issues
9
+ Keywords: ai,agent,memory,archive,handoff,sqlite,read-only,continuity
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Database
23
+ Classifier: Topic :: System :: Archiving
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Provides-Extra: zstd
28
+ Requires-Dist: zstandard>=0.21; extra == "zstd"
29
+ Provides-Extra: crypto
30
+ Requires-Dist: cryptography>=3.4; extra == "crypto"
31
+ Dynamic: license-file
32
+
33
+ # batonpass
34
+
35
+ > **Never drop the baton.**
36
+ > Switch machines mid-task — your work picks up exactly where you left it.
37
+
38
+ You are 3 hours into a task on the Mac mini. You open the laptop. Nothing is there.
39
+
40
+ Not the transcript, not the tool output that told you which endpoint 404'd, not the reason
41
+ you rejected the third approach. You remember the *concept* — "the岗位表 thing, I fixed the
42
+ join" — and you spend 20 minutes re-deriving what you already knew.
43
+
44
+ `batonpass` is the thing that hands the baton over: **from one machine to the next, from
45
+ last-week-you to today-you**, without the work touching the ground.
46
+
47
+ ```
48
+ batonpass discover # what AI history is on this machine? (read-only, 2 s)
49
+ batonpass archive # pull it into a portable library (~1 min per GB)
50
+ batonpass export <session> --text # read one conversation back out
51
+ batonpass sync push ~/Dropbox/baton # one file per machine, summaries only (~2 MB)
52
+ batonpass sync pull ~/Dropbox/baton # on the other machine: 713 sessions, zero messages
53
+ batonpass index # local search index, ~17 s per 700 sessions
54
+ batonpass find "岗位表" --at 7d # search it, with time windows
55
+ batonpass tasks # every project, one line each
56
+ batonpass resume # handover card for the directory you are in
57
+ ```
58
+
59
+ ---
60
+
61
+ ## The rule that makes this safe to point at your machine
62
+
63
+ **batonpass never writes to your AI tools' data. Ever.**
64
+
65
+ Your Claude / Codex / Cursor / zcode / dsh / billion databases are opened `mode=ro`.
66
+ No schema migrations, no `ALTER TABLE`, no "helpful" cleanup. If a tool ships a new
67
+ schema tomorrow, batonpass reads what it can, names what it couldn't, and never touches
68
+ the file to find out.
69
+
70
+ This is not a preference, it's the first law, and `discover` is built to prove it: it
71
+ refuses to import a networking module, and it records any source it had to open
72
+ immutably instead of silently proceeding.
73
+
74
+ **Read-only in · you own the copy out.**
75
+
76
+ ---
77
+
78
+ ## Start here: `batonpass discover`
79
+
80
+ Before you trust a tool with your history, look at what's actually there.
81
+
82
+ ```bash
83
+ uvx batonpass-cli discover --report ~/Desktop/batonpass-report.html
84
+ ```
85
+
86
+ One file, standard library only, ~2 seconds, no network, no writes. It produces a
87
+ single self-contained HTML page telling you:
88
+
89
+ - **what it found** — 261,354 messages across 713 conversations in 9 sources, 2.2 GB on my machine
90
+ - **how much it can actually read** — every source gets a coverage verdict, not a vibe
91
+ - **what it is silently failing to read, and why** — a skip ledger: `browser-cache: 14`,
92
+ `backup-copy: 4`, `nested-artifact: 1`. A skip you can see is not a silent skip.
93
+ - **what it refused to guess** — databases it recognised *without* a known adapter, with
94
+ the reason and a repro command, so you can open an issue instead of debugging alone
95
+
96
+ A real run on this machine:
97
+
98
+ ```
99
+ 261,354 messages · 713 conversations · 9 sources recognised · 2.2 GB
100
+ 26 files skipped (browser caches, backups) · 7 dirs still in the queue
101
+ billion 212,433 msg 385 sess 1,489.9 MB degraded: media-by-reference
102
+ zcode 48,078 msg 304 sess 847.8 MB ok
103
+ alma 75 msg 2 sess 11.4 MB ok
104
+ zcode-tasks 203 tasks 10 projects 5 hosts ok (role: index)
105
+ ```
106
+
107
+ Note the third line: 1.4 GB of that source is media stored by reference — the text is
108
+ fine, the images aren't in the DB. `batonpass` says so up front instead of handing you a
109
+ 176 MB archive that turns out to be empty in the middle.
110
+
111
+ ---
112
+
113
+ ## Then: three tiers, pick your cost
114
+
115
+ | Tier | What you get | Time | Cost |
116
+ |---|---|---|---|
117
+ | **A · Look** | The report above. No library, no config, no writes. | 30 s | 0 |
118
+ | **B · Archive one machine** | Full local library, `find` / `resume` over it. | ~5 min setup, 6–13 min first archive | ~250–450 MB from 3.8 GB |
119
+ | **C · Sync machines** | Every machine's history in one place, details on demand. | +2 min | 2 MB of catalog replicated first |
120
+
121
+ Tier C is the interesting one, and it's built on a deliberate split:
122
+
123
+ **2 MB of catalog first, the details only when you ask.**
124
+
125
+ A new machine doesn't download your history. It downloads an index — who, when, which
126
+ task, which file — in about two seconds, and then pulls transcripts *for the task you're
127
+ actually continuing*. Measured on real data: `message.data` gzips 5.43 MB → 0.80 MB and
128
+ zstd-19s to **0.28 MB (19.7×)**. You don't need the other 250 MB to keep working.
129
+
130
+ ## Why a baton, and not a sync
131
+
132
+ When you're mid-task on two machines, the second machine doesn't need a *merge*, it needs
133
+ to know **what you already decided**. So the store is append-only and the conflict rule is
134
+ one line: **fork, never merge**. Two machines can't corrupt each other because neither one
135
+ writes the other's file. Transcripts are immutable facts; the only mutable thing is
136
+ `task.status`, which is itself a stream of appended events.
137
+
138
+ The result: you can work on the Mac mini and the laptop **at the same time**, and
139
+ `batonpass resume` will show you both branches and tell you they diverged — instead of
140
+ picking one silently and losing the other.
141
+
142
+ ---
143
+
144
+ ## Status
145
+
146
+ | verb | state |
147
+ |---|---|
148
+ | `discover` | **shipped** — read-only inventory, ~2 s, one HTML page |
149
+ | `archive` | **shipped** — five adapters, replay-safe (re-run adds 0 rows) |
150
+ | `sync` | **shipped** — append-only channel, tiered push/pull, replay-safe both ways |
151
+ | `identity` | **shipped** — machine-independent project key, artifact refs, handover cards |
152
+ | `index` · `find` | **shipped** — FTS5 trigram over everything you typed, with time windows |
153
+ | `tasks` · `card` · `resume` | **shipped** — the handover packet, from a project name or a directory |
154
+ | `sync compact` | **shipped** — a re-pushed stream collapses back to one line per fact |
155
+ | `doctor` | **shipped** — every "why doesn't it work" turned into one line you can act on |
156
+ | `mcp` | **shipped** — `memory_search` · `memory_add` · `resume` over stdio, for AI tools |
157
+
158
+ `archive`, measured end-to-end on this machine — all five sources, one pass:
159
+
160
+ ```
161
+ 712 sessions · 261,310 messages · 484,573 parts · 52 s
162
+ 2.2 GB of source databases → 466 MB portable library
163
+ 448 MB of plaintext → 179.5 MB stored (2.50×, trained dict + zstd-19)
164
+ ```
165
+
166
+ The number that matters more than the ratio: **running it again adds zero rows.**
167
+ Counts reconcile against the sources exactly — 304/304 sessions, 48,168/48,168
168
+ messages — and parts match once you account for the 72,184 `step-start` /
169
+ `step-finish` rows it skips *by name*. A message with no prose (a tool call, a
170
+ reasoning block) becomes a structured part instead of being thrown away. Nothing is
171
+ dropped silently; anything unaudited is reported as a number you can argue with.
172
+
173
+ `identity` + `find`, measured on that same 713-session library:
174
+
175
+ ```
176
+ 713 sessions → 12 real projects · 558 honestly ungrouped
177
+ 57 sessions folded into `xueji`, 50 into `gp`
178
+ 6,479 deliverables → found in 575 sessions (xlsx, csv, pdf, png, md…)
179
+ 58,508 messages indexed → 16.6 s one-off · 164 MB · 59212 docs
180
+ batonpass find 岗位表 → one hit, with the sentence it appeared in
181
+ batonpass find 妖族 → nothing (it never appears — 妖股 does)
182
+ ```
183
+
184
+ And the round trip, on a machine that has never seen the data — it pulls 356 KB
185
+ of catalog (t0) and can already say what is in flight:
186
+
187
+ ```
188
+ pull t0 → 713 sessions, 713 new, 0.04 s
189
+ batonpass tasks → 12 projects, sizes, devices, stale marks
190
+ batonpass card xueji → the same card, forks and all
191
+ ```
192
+
193
+ The ungrouped 558 are the point. Every one of them had a session title that looked
194
+ like a project name ("这道题我做错了,帮我讲讲"), and promoting those produced 400
195
+ clusters of one — structure that was pure invention. They stay searchable; they are just
196
+ not lied about.
197
+
198
+ `sync`, measured the same way — a real 713-session library, a channel folder, and a
199
+ second library that has never seen any of those apps:
200
+
201
+ ```
202
+ library 528 MB → channel 2.8 MB push 713 sessions in 2.0 s
203
+ t0 catalog 356 KB
204
+ t1 summaries 2.70 MB (incl. the files each session produced)
205
+ fresh machine reads t0 0.04 s → 713 sessions, 0 messages
206
+ then t1 0.05 s → every session has a first ask, its last rounds,
207
+ and the files it produced
208
+ deep-pull one task 0.14 s → 64 messages, 256 parts, 317 blobs
209
+ verify: 64/64 message hashes identical, 0 bodies differ
210
+ ```
211
+
212
+ A channel is just a folder — a shared volume, a synced directory, a git remote, a USB
213
+ stick. Each machine appends only to *its own* file, so there is no lock, no leader and
214
+ no merge step, and pulling never writes into the channel. Everything is addressed by the
215
+ sha256 of its plaintext, which is why the same line arriving twice is indistinguishable
216
+ from it arriving once. The one cost of append-only: a re-pushed summary leaves the old
217
+ line behind, and a reader takes the last one. So a stream gets rewritten once it has
218
+ grown past a floor — `sync compact` (and every push, when it is worth it):
219
+
220
+ ```
221
+ 3 pushes of the same 713 sessions → 1005 KB · 2139 lines
222
+ sync compact → 335 KB · 713 lines (one line per session)
223
+ ```
224
+
225
+ Each rewrite bumps a generation counter in `heads/<device>.<tier>.json`. A reader keys
226
+ its byte offset on the generation, so a rewritten file simply looks new and is read from
227
+ zero — safe precisely because every import is an idempotent `INSERT OR IGNORE`.
228
+
229
+ ### When the channel is a cloud drive
230
+
231
+ A folder on someone else's disk is a folder on someone else's disk. Say so at `init`:
232
+
233
+ ```bash
234
+ export BATONPASS_KEY='the passphrase you will type on every machine'
235
+ batonpass sync init ~/Nutstore/batonpass --encrypt
236
+ ```
237
+
238
+ Every payload is sealed with AES-256-GCM before it lands on the drive, keyed by scrypt
239
+ from that passphrase; blobs already in the channel are re-sealed in place. The key is
240
+ never written into the channel — it comes from `BATONPASS_KEY` or `~/.batonpass/key`.
241
+ Addressing stays on the plaintext sha256, so a re-sent message still lands on exactly the
242
+ same path, and a wrong passphrase produces one sentence (*"this channel is encrypted and
243
+ the key does not match"*) instead of a corrupt-archive mystery.
244
+
245
+ What is **not** sealed: the catalog lines themselves, because dedupe keys live there. So
246
+ the drive's operator can see that you had 713 sessions with these titles on these dates —
247
+ not a word of what was said. That leak is real and small, and stating it is the point.
248
+
249
+ If it ever doesn't work, it says why instead of throwing:
250
+
251
+ ```
252
+ $ batonpass doctor --channel ~/Dropbox/batonpass
253
+ OK python 3.9.6
254
+ OK sqlite 3.54.0, fts5 + trigram
255
+ WARN zstd not installed — archives stay readable, 2.50x becomes 2.04x
256
+ → pip install "batonpass-cli[zstd]"
257
+ OK library 680.6 MB, 713 sessions, 263,256 messages
258
+ OK identity 12 named project key(s), 558 honestly ungrouped
259
+ OK channel id c62264a7f0b4, 1 device(s), 0 B
260
+ ```
261
+
262
+ ### Letting the AI tools call it
263
+
264
+ `batonpass mcp` is an MCP server on stdio — no daemon, no port, nothing left running
265
+ when the client exits. Three tools, because that is the whole vocabulary an agent needs:
266
+ `memory_search` (look something up by a vague phrase), `memory_add` (write down what it
267
+ just learned, before it is forgotten), `resume` (hand the baton over).
268
+
269
+ ```json
270
+ {"mcpServers": {"batonpass": {"command": "uvx", "args": ["batonpass", "mcp"]}}}
271
+ ```
272
+
273
+ The silence contract applies here too: a search that finds nothing returns
274
+ *"not found — do not invent one"*, because a model that hallucinates a file path costs
275
+ you twenty minutes of looking for a file that never existed.
276
+
277
+ If you run it and it *doesn't* recognise a source you use, that is the most useful bug
278
+ report there is — please use the
279
+ [unrecognized source template](.github/ISSUE_TEMPLATE/unrecognized-source.md). It asks
280
+ for a schema fingerprint, not your data.
281
+
282
+ ## Non-goals
283
+
284
+ - **Not a memory layer.** `memory-bridge` and friends remember *conclusions*. This keeps
285
+ the *transcript* — the 40 tool calls that produced the conclusion. Different artifact.
286
+ - **Not bidirectional.** There is no write-back into Claude or Cursor. That's the whole
287
+ reason it's safe.
288
+ - **Not a cloud service.** The data plane is yours: a folder, a git remote, or a machine
289
+ you own. The control plane is disposable by design.
290
+
291
+ ## Install
292
+
293
+ ```bash
294
+ uvx batonpass-cli discover # no install, runs from a temp env
295
+ pipx run batonpass-cli discover
296
+ pip install "batonpass-cli[zstd]" # or install it, with the compressor
297
+ ```
298
+
299
+ The package is `batonpass-cli` on PyPI, because the plain name `batonpass` is
300
+ already spoken for — an unrelated project called `baton-pass` normalizes to the
301
+ same string, and PyPI compares names with the separators removed. The command
302
+ it installs is still `batonpass`.
303
+
304
+ Python 3.9+. Zero required dependencies — `zstandard` is the only extra, and it
305
+ buys the 2.5× storage ratio. Without it, libraries written with zstd still
306
+ refuse gracefully and tell you the one command to run.
307
+
308
+ ## License
309
+
310
+ MIT. See [`Acknowledgments`](#acknowledgments).
311
+
312
+ ### Acknowledgments
313
+
314
+ The design learned from two prior projects — **no source code was copied from either**:
315
+
316
+ - [`jiabaobei/memory-bridge`](https://github.com/jiabaobei/memory-bridge) — per-device own-file
317
+ heartbeat, write-once wiring, content-freeze, handover cards with staleness windows, and
318
+ the one-line session index that made "which file was it" searchable again.
319
+ - [`Nwflower/dsh-chat-import`](https://github.com/Nwflower/dsh-chat-import) — the Interchange
320
+ IR, named degradation policies (`lossless | text-fallback | skip-placeholder`), multi-frame
321
+ zstd decoding, and the `PRAGMA table_info` adaptivity that lets a reader survive schema drift.
322
+
323
+ Both solve a real slice of this problem. Neither ships a machine-to-machine handoff.
324
+ That gap is what batonpass is for.
@@ -0,0 +1,39 @@
1
+ batonpass/__init__.py,sha256=Wq1iHM8_EJFkJj1lhC-LjOxj9QxnPSktHtWnwH1CHnM,175
2
+ batonpass/__main__.py,sha256=k1ocEWawweo1qCJWNFAAvyxz3tcY13dzvCenHszij30,48
3
+ batonpass/cli.py,sha256=kWoBM4_87jGEeWMN0pj7tFcLjhwsFZj03Sc-vyfsA5M,24465
4
+ batonpass/doctor.py,sha256=uARI-n7MUT3evKQrzjqsdZrK13ObsOW29BSU05QYYdg,13158
5
+ batonpass/mcp.py,sha256=dR5IB_MMWq0FeB_Valkq6wmEEDKZjAjpqS-Cf9UF8pw,10798
6
+ batonpass/paths.py,sha256=H31hVH6TXDQAjl1V9TrbzJrrlPc28PdHugGZE5YtAZM,570
7
+ batonpass/archive/__init__.py,sha256=e8RObzFnFzICS-HrUmcvCkk0jnLM-rBt3GJdIu2anKY,174
8
+ batonpass/archive/adapters.py,sha256=7R8xkzEga_UtXfyy0KsC0YCghUd6W3CLfowW1YizVEk,25366
9
+ batonpass/archive/export.py,sha256=UC0dEcjjombl4FQoZy5CG6svAPlMlOCy3Qefxzb1a78,3204
10
+ batonpass/archive/runner.py,sha256=tRdIwNRiEdSgy9p-FsR1x4RbPvt1shOPtb8of7ooNAU,5203
11
+ batonpass/discover/__init__.py,sha256=VdXIoo05Ns2lBqHEQdHeY9WU5XGerutn0SLstxi50Vc,1068
12
+ batonpass/discover/probe.py,sha256=BQ3muhEEo60Ctnw4C65rJ-ydWwOUGLhCgv8Bnw4ZHsg,42394
13
+ batonpass/identity/__init__.py,sha256=plMFya4K_EheNZTRzlNyVgLIz5d4ajd55Zeit8bC6eo,393
14
+ batonpass/identity/artifacts.py,sha256=WmxebTQrIVjESZj19LT1Egi8E13f2r9jUnFiZWR0Us0,11731
15
+ batonpass/identity/project.py,sha256=eIbHjYwzPb86rrnQ3xo6vqAian2LjNpXPOMpRBdTT18,9392
16
+ batonpass/identity/tasks.py,sha256=-thwJv5wfdhcgtJjm5Pa6p7l2R5yAikHSCPiapcVDvA,16971
17
+ batonpass/recall/__init__.py,sha256=5_iVucEvw5s938B2BSxvg7pwfcCIkeUQ1_vxyd3_ftg,1941
18
+ batonpass/recall/index.py,sha256=Hv-XPpkmfwr0QIC408Z5u_e9-Uz_zyuwzOi3RFUVBXM,5706
19
+ batonpass/recall/query.py,sha256=sRT5cgBrQdFyhj7o-EkxY8oSECInZVdHNuRxdigdR_o,7974
20
+ batonpass/store/__init__.py,sha256=p8dE1_J2ghDPd9AIizx3vIKcoIms4Sw_ILwGJGPBiNg,304
21
+ batonpass/store/codecs.py,sha256=0slKymQIqt4NcI7tBFasXOcIivz9hbn2LpdjtoeD25s,1004
22
+ batonpass/store/content.py,sha256=ejq8RicdGB0SyJJiM10inruGRGz1KCWBmgAYEdCumO4,5910
23
+ batonpass/store/db.py,sha256=hBVO_-M4rjYzuD1xHpFcJ54SMfwDPqe0Sax9abCIQ0I,3155
24
+ batonpass/store/schema.py,sha256=1vLvRbuQ3z9z1W9vYseQrsXuyVXddjWgwPLRv_Rv5MM,4576
25
+ batonpass/store/text.py,sha256=9Y_rqbQ_P0VhYCtb-NUAWaGDH44TbqNM54XTs7rBB8o,1933
26
+ batonpass/store/write.py,sha256=W908rIJZ4mAIFqsznUDUuXW9rdp-ztDburVjK93Qf9A,3664
27
+ batonpass/sync/__init__.py,sha256=PupifpTCId5amK3groG5tntYGBCMPmKQ9EHdNaNkssI,549
28
+ batonpass/sync/channel.py,sha256=NSGWx-DyPi-dp0PF4M0AC8Rw6LbpVBbEZziexyxlzXo,7577
29
+ batonpass/sync/crypt.py,sha256=YKetM3Pqol_CEOXyKkNfaWoTWCxtBWDip-HwXvXT-AU,7509
30
+ batonpass/sync/pull.py,sha256=Y3h_jjD6dIwElN_iEq2X1wxn-TLSm2P7iOm-UtrVf-w,7696
31
+ batonpass/sync/push.py,sha256=svZSfUfw06ZdeHltJ0ym7s_6plKQK3uJijU7J0nEtvA,10837
32
+ batonpass/sync/status.py,sha256=L3MisQPhi3JuaTazzmZ88nwNjz9sK9UxTT_16UR21po,2079
33
+ batonpass/sync/wire.py,sha256=eNertXfkQ43qB2xw7gvNzLmO5j4pMKJEn-ipMdFqFTQ,7322
34
+ batonpass_cli-0.5.0.dist-info/licenses/LICENSE,sha256=k2aKbaU-Aik-Q_NcfIeFacbEoduVyv5QNVtAa5LI6YQ,1079
35
+ batonpass_cli-0.5.0.dist-info/METADATA,sha256=0kcuCCAa_s3aGABEsr4KOU93LbKnEheueoVDQZ5ZFb4,15483
36
+ batonpass_cli-0.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
37
+ batonpass_cli-0.5.0.dist-info/entry_points.txt,sha256=UoPu4CoCd-Ffu1-CcfyEFBrZA-CU6l_hgutJDKsBiqY,49
38
+ batonpass_cli-0.5.0.dist-info/top_level.txt,sha256=qBnpHK9IPOnmv4yU50p70zgvsaoXPJrcIcM61hQYnws,10
39
+ batonpass_cli-0.5.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ batonpass = batonpass.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 batonpass contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ batonpass