istok

Sync between devices

Run your own hub, join your machines to it, and continue the same project on another device.

Istok keeps everything in a local database. To continue the same project on another machine, run a sync hub on a server your devices can reach, such as a VPS or a home server. Each device then syncs with the hub by itself. This page shows how to set it up and what to expect.

All devices and the hub must run the same Istok version. Run istok update on each first.

How it works

  • The hub stores only rows encrypted on your devices. It keeps tasks, runs, context and knowledge without being able to read them.
  • The hub and every device have their own key and check each other’s fingerprint over mutual TLS. You need no domain, certificate authority or reverse proxy, just a HOST:PORT your devices reach.
  • Nothing is written to your repository.

1. Run a hub

With Docker, take docker/hub/compose.yml from the Istok repository and start it on the server, with the address your devices will use:

ISTOK_HUB_ADVERTISE=203.0.113.10:7443 docker compose up -d

The image ghcr.io/vtimame/istok-hub is published with every release for x86-64 and ARM64. It runs unprivileged and keeps its data in the hub-data volume. ISTOK_HUB_PORT changes the published port (7443 by default).

Without Docker, run the hub with the istok binary:

istok hub serve --advertise 203.0.113.10:7443

It listens on :7443 (--listen changes it) and keeps its data in ~/.local/share/istok-hub (--data changes it).

If devices reach the hub differently from different networks, list every address separated by commas, for example a home LAN address and a Tailscale one: ISTOK_HUB_ADVERTISE=192.168.0.12:7443,100.126.4.13:7443. Devices try them all at once and use the first that proves to be your hub.

2. Join the first device

On the hub’s server, create an invitation for the device:

docker compose exec hub istok hub device add laptop
# or, without Docker:
istok hub device add laptop

It prints a one-time code, valid for 15 minutes (--expires changes that). On the laptop:

istok sync join CODE

The first device to join creates the sync key and prints it. Rows are encrypted with this key, and without it the hub’s data cannot be read. Keep it safe, like a password. istok sync key prints it again.

Then, in the folder of a project you want to sync:

istok sync enable

This publishes the project to the hub. Repeat it in each project folder you want to sync.

3. Add another device

Create a new invitation on the hub (istok hub device add desktop). On the new device, join with the key from istok sync key on the first one:

istok sync join CODE --key istok-key-...

Then clone the repository and enable sync inside the clone:

git clone git@github.com:acme/acme-api.git
cd acme-api
istok sync enable

Istok finds the hub project of this repository by its git remote, whatever the folder is called and whether the remote is written as HTTPS or SSH, fetches it and binds the folder. The tasks, history and rules are now on this device too.

  • To fetch a hub project into any folder, pass its ID: istok sync enable --project ID. istok sync projects lists the hub’s projects with their remotes.
  • If this folder is already a separate local project and the hub has another project of the same repository, istok sync enable refuses to publish a duplicate and tells you what to do. --new publishes it anyway as a separate project.

What happens on its own

Once a device has joined a hub, you rarely run istok sync yourself:

  • The MCP server pulls the project before the agent starts a task, so a handoff written on another device is in the brief. It pushes a few seconds after each write and when it exits.
  • The SessionStart hook, and the Stop hook if you installed it with --stop, sync the current project.
  • Reading tasks syncs first: istok task list, task show, task ready and the agent’s task and run lists, unless the project synced within the last 30 seconds. The list’s WORKER column shows which agent works on each task and on which device, for example Claude · macbook.
  • istok sync pulls and pushes all synced projects by hand; --project limits it to one.

Task numbers come from the hub, so tasks created on two devices never share a number.

One device works on a task at a time. Starting a task, or continuing your run of it on another device, first asks the hub. While another device works on the task, the start is refused with that device’s name.

Offline, work goes on locally. If the hub is out of reach, each step waits for it at most a couple of seconds and then continues without it. A task created offline gets a local number; if another device took that number meanwhile, the task moves to a free one on the next sync, with a note in its history. A start made offline is not checked against other devices.

What syncs and what stays

Projects, tasks with their history, runs and their checks, what each agent saw at claim time, and shared context and knowledge are synced. Changes are merged with the same rules as istok import: history is added, and when the same item changed on both sides the version with more changes wins.

These stay on each device: project folders, command output logs, the code index and the code snippets agents received from it, and context and knowledge marked local_only.

Check and stop

istok sync status     # the hub, this device and the projects it syncs, with the last sync time
istok sync projects   # the hub's projects
istok sync disable    # stop syncing the current project on this device

On the hub’s server, istok hub device list shows the devices, istok hub device revoke NAME disconnects one for good, and istok hub backup FILE writes a consistent copy of the hub database. A device that lost its database gets its own rows back from the hub.

Without a hub: export and import

You can still move projects by file, for example to a machine that cannot reach the hub:

istok export -o work.json            # the current project; --project NAME or --all for more
istok import work.json --dry-run     # on the other device: see what would change
istok import work.json

An imported project has no folder on the new device yet. Clone the repository and bind it with istok project rebind acme-api ~/src/acme-api. Importing the same file twice changes nothing. The file contains your task history and project notes; treat it like a private document.