Keeping agent history in sync across machines

two machines, one person, one history

Two machines, one person, and no way to sync between machines. The fix you worked out on the laptop is on the laptop, and the desktop's agent has never heard of it. Neither has the work laptop you use three days a week.

What moves, and how

deja sync ssh desktop           # push what this machine has learned
deja sync ssh desktop --pull    # take what that one has
deja sync ssh desktop --both    # both directions in one command
deja sync                       # every machine deja already knows, both ways

The transport is your own SSH: deja exports a batch, copies it with scp, and runs deja sync import on the other side, which is why the remote needs deja installed and reachable the way you already reach it. No account, no service, nothing in the middle. The first exchange with a host records it as a peer, so deja sync afterwards knows who to talk to.

Transfers are incremental and append-only: each side keeps a watermark and sends what the other has not seen. --full resends everything, which is the recovery path when a batch was lost — the error message says so at the moment it happens rather than leaving you to guess.

What arrives

Indexed sessions, not the harness's raw files. The receiving machine can search them, and every record in a batch carries its origin, the name of the machine the work happened on (DEJA_MACHINE, else the host name), so a hit says "we fixed this on the laptop in July" as a fact you can see rather than one you have to remember, and deja last --from laptop lists that machine's sessions. A session passed on with sync export --include-imported keeps the name of the machine it started on. Redaction runs three times: when each machine indexes its own transcripts, again on export, and again when the receiving machine imports the batch, so a batch written by an older deja is masked by the receiver's rules too. The receiver's switches hold as well: what DEJA_INDEX_* and DEJA_INCLUDE_SUBAGENTS=0 keep out of a local read, a store DEJA_EXCLUDE_HARNESSES excludes and a project the policy's ignore rule covers stay out of the import, which says how many it left out, and a machine relaying with --include-imported does not pass on the sessions of a store it excludes.

Deciding what synced memory may do

Memory from another machine is not automatically as trusted as memory from this one — a work laptop's history in a personal session, or the reverse, is a real concern. The trust policy at ~/.config/deja/policy.json separates the paths memory can activate on: search, mcp and auto. Synced sessions stay searchable but never inject themselves:

{"activations": {"auto": {"imported": false}}}

A rule can also be narrower than all imports: imported:<group> matches sessions whose project, on the machine they came from, starts with that directory. It cannot name a machine: the origin on each record is the sender's own name for itself, which nothing verifies, so the policy does not key on it. Receipts and deja log --last name the policy that allowed each injection, so what reached the model is inspectable after the fact rather than a matter of trust.

Keeping it current

deja install sync-timer runs the exchange on a schedule, and deja doctor reports each peer with when it last synced — a peer that has quietly stopped is the failure mode worth catching, because everything keeps working and simply stops being shared. The timer runs with the DEJA_* and XDG_* settings of the shell you installed it from, since the service manager does not see your shell; install it again after changing them.

What this is not

It is not a team feature. There is no server, no shared account and no access control beyond the SSH you already have — it moves one person's history between one person's machines. Sharing a single session with somebody else is a different job, and deja share does that one.

Exporting sessions · Privacy and trust scopes · CLI reference

Found this useful? Star deja-vu on GitHub.