[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116212":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":15,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":31,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":15,"lastSyncTime":35,"discoverSource":36},116212,"keepsync","progrium\u002Fkeepsync","progrium","syncthing and perkeep had a baby","",null,"Go",62,3,52,2,0,7,8,50.01,"MIT License",false,"main",true,[25,26,27,28,29,30],"archiving","go","p2p","perkeep","synchronization","syncthing","2026-11-21 01:03:49","2026-11-23 07:42:14","\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Fimages\u002Flogo-dark.svg\">\n    \u003Cimg src=\"docs\u002Fimages\u002Flogo.svg\" alt=\"keepsync logo: a castle keep circled by a ring of synced nodes\" width=\"160\">\n  \u003C\u002Fpicture>\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">keepsync\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\u003Cb>Sync your folders everywhere. Keep every version forever.\u003C\u002Fb>\u003C\u002Fp>\n\nkeepsync keeps a set of folders synced across your machines and archives them permanently. It is one Go binary that embeds Syncthing for sync and Perkeep for the archive, stores the archive in any S3-compatible bucket through ZeroFS, and connects everything over tailcat, so nothing needs a public IP, open ports, or DNS.\n\nA synced folder can hold just recent files (say the last 30 days) while the archive keeps every version forever. Files only leave sync once they are safely in the bucket, and you can restore any of them, as they are now or as they were at an earlier time.\n\nFor an overview of the pieces and why they were chosen, see the [architecture](docs\u002Farchitecture.md). For how it works in detail, see the [spec](docs\u002Fspec.md).\n\n> [!NOTE]\n> **Feedback wanted: should cloud replication be optional?** Today the server needs an S3-compatible bucket. We're considering letting it run without one, with the option to add a bucket later. If you'd use keepsync without a bucket, or have concerns, please weigh in on [issue #8](https:\u002F\u002Fgithub.com\u002Fprogrium\u002Fkeepsync\u002Fissues\u002F8).\n\n## Getting started\n\n### How it fits together\n\nYou run one **server** and any number of **nodes**. Every machine that syncs folders is a node. The server holds the Perkeep archive, ZeroFS, and the list of approved nodes, and it is the only machine that talks to the bucket. One machine can be both a server and a node.\n\nNodes sync directly with each other, so sync keeps working while the server is down. Only archiving, expiry, and membership changes wait for it.\n\n### Prerequisites\n\n- **Go 1.27.2** or newer, to build keepsync.\n- **An S3-compatible bucket** for the archive, such as Cloudflare R2, AWS S3, or MinIO, with an access key that can read and write it.\n\n### Build\n\nkeepsync vendors a patched Syncthing through a `replace` directive, so `go install …@version` won't work. Clone and build instead:\n\n```sh\ngit clone https:\u002F\u002Fgithub.com\u002Fprogrium\u002Fkeepsync\ncd keepsync\ngo build -o keepsync .\u002Fcmd\u002Fkeepsync\n```\n\nPut the `keepsync` binary on your `PATH` on the server and on every node.\n\nEach machine keeps its state under a base directory: `--dir`, else `$KEEPSYNC_DIR`, else `$XDG_DATA_HOME\u002Fkeepsync`, else `~\u002F.local\u002Fshare\u002Fkeepsync`. The server uses `\u003Cbase>\u002Fserver` and the node uses `\u003Cbase>\u002Fnode`.\n\n### 1. Set up the server\n\nCreate the server, pointing it at your bucket. The bucket URL is `s3:\u002F\u002F\u003Cbucket>\u002F\u003Cprefix>`. For anything other than AWS, also give the endpoint. Credentials default to `$AWS_ACCESS_KEY_ID` and `$AWS_SECRET_ACCESS_KEY`.\n\n```sh\n# Cloudflare R2\nexport AWS_ACCESS_KEY_ID=...\nexport AWS_SECRET_ACCESS_KEY=...\nkeepsync server init \\\n  --bucket s3:\u002F\u002Fmy-bucket\u002Fkeepsync \\\n  --endpoint https:\u002F\u002F\u003Caccount-id>.r2.cloudflarestorage.com \\\n  --region auto\n```\n\nFor AWS S3, drop `--endpoint` and pass your `--region`. For a local MinIO over plain HTTP, add `--allow-http`. To try keepsync without a bucket, `--bucket file:\u002F\u002F\u002Fpath\u002Fto\u002Fdir` keeps the archive in a local directory instead.\n\n`server init` checks the bucket before it writes anything, by writing, reading, and deleting one small object under the prefix, so a missing bucket or keys that can't write fail init rather than the first `server run`. Pass `--no-bucket-check` to skip it, say when the bucket isn't reachable from where you run init.\n\n`server init` takes `--mode store` (the default) or `--mode cache`. A **store** server keeps every archived blob on its own disk and copies it to the bucket; reads are local. A **cache** server keeps no blob store on disk: Perkeep writes straight to the bucket through ZeroFS, and local disk holds only the index and ZeroFS's cache, which you size with `--cache-size \u003CGB>` (default 10, minimum 2). Use cache mode when the archive is bigger than the server's disk; reading old files then fetches them from the bucket. The mode can't change after init, but a recovery can pick either (see [Recover a lost server](#recover-a-lost-server)).\n\n`server init` creates the server's tailcat key, its Perkeep identity, and the ZeroFS config, finds or downloads ZeroFS, and writes the **recovery kit** to `.\u002Fkeepsync-recovery.zip.age` (or `--kit \u003Cpath>`). It prints:\n\n- the server's address (`tc…`), which nodes need to join;\n- the kit's passphrase, **shown only this once**.\n\nStore the kit and the passphrase separately and offline, and never in the bucket. Together they can read all your data and impersonate the server. See [Recovery kit](#recovery-kit).\n\nThen start the server and leave it running (under systemd, launchd, or similar):\n\n```sh\nkeepsync server run\n```\n\nIt starts ZeroFS, starts Perkeep and the registry, and flushes to the bucket every minute. Stopping it with Ctrl-C, SIGTERM, or SIGHUP drains and flushes everything to the bucket first; a second Ctrl-C quits at once. ZeroFS never outlives the server: on Linux it stops when keepsync dies for any reason, and on any platform `server run` stops a ZeroFS left running by an earlier run before starting its own.\n\nCheck on it with:\n\n```sh\nkeepsync server status   # address, last flush (or why flushing fails), mode, disk and bucket use, nodes\n```\n\n### 2. Join a node\n\nOn each machine that will sync, create the node with the server's address:\n\n```sh\nkeepsync node init --server tc... --name laptop\n```\n\n`--name` defaults to the hostname. `--server` also accepts a DNS name whose TXT record holds the address, bare or as `keepsync=tc…`. It is looked up once and saved. Publishing the address is safe, because the server only lets in nodes you approve.\n\n`node init` works offline. It prints the node's key and the exact command to approve it. Run that on the server:\n\n```sh\nkeepsync server add nodekey:... --name laptop\n```\n\nThen start the node and leave it running:\n\n```sh\nkeepsync node run\n```\n\nCheck it with `keepsync status`, which shows the server connection with a short server summary (healthy or not, last flush, disk and bucket use, nodes online), then peers and folders:\n\n```\nPEER   DEVICE   PATH                  TRAFFIC\nh9dev  X3NOEHO  direct 54.149.165.58  ↓ 20 B\u002Fs  ↑ 3.3 MB\u002Fs\n\nFOLDER  SIZE      FILES   SYNC                      KEEP\ndemo    4.2 GB    1,234   syncing 63%, 1.5 GB left  -\nphotos  812.0 MB  20,511  up to date                kept, keeper\n```\n\nPATH says whether traffic to a peer goes direct or through a DERP relay, so you can tell when sync is stuck on a rate-limited relay (only one node of each pair dials, so a pair shares one tunnel, and keepsync keeps pinging a relayed tunnel so it can upgrade to direct). TRAFFIC is the rate each way, averaged over the last 10 seconds. If the node hasn't been approved yet, `status` prints the `server add` command again. `keepsync server nodes` on the server lists every node and whether it is online.\n\nRepeat for every machine. The approved nodes find and connect to each other on their own.\n\n### 3. Add folders\n\nFolders have a name that is the same on every node and a path that is local to each node. The path is created if it doesn't exist.\n\nOn the first node, create the folder:\n\n```sh\nkeepsync folder add docs ~\u002FDocuments\n```\n\nOn every other node that should sync it, join it:\n\n```sh\nkeepsync folder join docs ~\u002FDocuments\n```\n\n`folder join` refuses a directory that already has files, because they would sync into every node's copy of the folder. To do that on purpose, add `--merge`:\n\n```sh\nkeepsync folder join docs ~\u002FDocuments --merge\n```\n\n`keepsync folder ls` lists folders, their members, and their sync state. `keepsync folder status docs` shows one folder in detail: its state, what this node still needs, and each peer's completion, path, and traffic. Add `-v` to list the files still needed, the ones being pulled first. `keepsync folder rm docs` stops syncing a folder on this node. The files stay on disk. If the server can't be reached, the node stops syncing anyway and tells the server later.\n\nAt this point the folder syncs between nodes but isn't archived yet.\n\n### 4. Keep a folder\n\nKeeping a folder archives it in Perkeep, and in the bucket. Run this once, on any node that has the folder:\n\n```sh\nkeepsync keep docs --grace 48h --max-defer 7d --expire 30d\n```\n\n| Flag | Default | Meaning |\n| --- | --- | --- |\n| `--grace` | `48h` | A file must be unmodified this long before it is kept. Edits and deletes inside this window never reach the archive. |\n| `--max-defer` | `7d` | Files that never settle are kept anyway after this long, and again each time they hit it. |\n| `--expire` | never | Once a file is unmodified this long and durable in the bucket, it is removed from sync on every node. It stays in the archive. Leave it out (or pass `0`) to never expire anything. |\n\nDurations take Go syntax plus a `d` suffix. Grace must be shorter than max-defer, and max-defer shorter than expire.\n\n`keep` creates the folder's archive root and writes a `.keepsync` file into the folder, which syncs to every node. Up to two connected nodes are picked as the folder's keepers. They upload files past grace every 5 minutes. A deleted file is never deleted from the archive; it is marked as deleted (or expired, if expiry removed it), so a plain restore can skip it.\n\nEach kept version records Syncthing's version of the file, so the archive knows which edit came after which, whatever the mtimes say. A file copied in with an old mtime (`cp -p`, an unzip) is still kept as the newest version, and a node that was offline and is behind never rolls the archive back.\n\nExpiry only removes a file after the server confirms the file, and everything needed to find it by name, is durable in the bucket. If the server can't answer, expiry waits and the folder simply grows.\n\nTo leave files out of the archive, list them in `.stignore` (which also stops them syncing) or in `.keepignore` (which only stops keeping them). Syncthing's temp files, `.stfolder`, `.stversions`, and `.keepsync` are always left out.\n\nSee where each file stands:\n\n```sh\nkeepsync keep status docs      # counts: in grace, kept, lagging, expirable\nkeepsync keep status docs -v   # every file, with when it will be kept or expire\n```\n\n#### Unkeep\n\n```sh\nkeepsync unkeep docs\n```\n\nThis stops keeping the folder on every node: no more uploads and no more expiry. The archive and `.keepsync` stay, so `restore` still works, and running `keep docs` again continues the same archive.\n\n### 5. Restore files\n\n`restore` reads kept files back from the server, including ones that have expired from sync:\n\n```sh\nkeepsync restore docs                         # the whole folder\nkeepsync restore docs reports\u002F2026            # one file or directory\nkeepsync restore docs --to \u002Ftmp\u002Fdocs-copy     # somewhere other than the folder\nkeepsync restore docs reports\u002Fq3.txt --force  # overwrite a local file that differs\n```\n\nFiles keep their relative paths and permissions. A local file with the same size and mtime as the kept version is left alone, and one that differs is skipped unless you pass `--force`.\n\nFiles that were deleted in sync on purpose (including old names of renamed files and conflict copies a hook resolved) are skipped and counted, so a full restore brings back what expired, not what you deleted. To get those back too, add `--deleted`:\n\n```sh\nkeepsync restore docs --deleted\n```\n\nTo restore the archive as it was at an earlier time, use `--at`:\n\n```sh\nkeepsync restore docs --at 3d --to \u002Ftmp\u002Fdocs-3-days-ago\nkeepsync restore docs --at \"2026-11-01 09:00\" --to \u002Ftmp\u002Fdocs-nov-1\nkeepsync restore docs --at 2026-11-01T09:00:00Z\n```\n\n`--at` takes an RFC 3339 time, `YYYY-MM-DD[ HH:MM]` in local time, or an age such as `3d` or `12h`. It means when the server kept a version, not the file's mtime, so a file kept two days after its last edit shows up at the time it was kept.\n\nIf a restored file is already past the folder's expire window, `restore` says so, because the next keeper pass removes it from sync again. Use `--to` to restore outside the folder in that case.\n\n### 6. Browse the archive with Perkeep tools\n\nEvery node serves a read-only Perkeep gateway on `127.0.0.1:3179` that tunnels to the server, so stock Perkeep tools (`pk-get`, `pk-mount`, the web UI) work against the archive with no extra ports.\n\nPoint Perkeep's tools at the gateway:\n\n```sh\nkeepsync gateway config\n```\n\nThis writes a server named `keepsync`, with the gateway's local token, into Perkeep's own `client-config.json` (or the file given with `--path`). If another server is already your default there, pass `-server=keepsync` to Perkeep tools.\n\nBy default a node can only fetch blobs by ref. To allow search, the web UI, `pk-get`, and `pk-mount`, grant it `read` on the server:\n\n```sh\nkeepsync server grant laptop read    # and `blobs` to take it back\n```\n\nKept folders show up as ordinary directories, for example under `pk-mount`'s `roots\u002F`, with older states under `at\u002F`. No scope can sign or delete, so the gateway can't change the archive.\n\nTo move or turn off the gateway, set `listen` under `[gateway]` in the node's `node.toml` (an empty string disables it) and restart the node.\n\n### 7. Resolve conflicts with a hook\n\nWhen two nodes edit the same file, Syncthing keeps one version and saves the other as a `.sync-conflict-…` copy next to it. keepsync keeps conflict copies like any other file, so a losing version is never lost.\n\nYou can have a script resolve conflicts, whether a merge tool or an LLM. Set it in the node's `node.toml` (`\u003Cbase>\u002Fnode\u002Fnode.toml`) and restart the node:\n\n```toml\nconflict_hook = \"\u002Fhome\u002Fme\u002Fbin\u002Fmerge-conflict\"\nconflict_hook_timeout = \"5m\"\n\n[[folder]]\nname = \"docs\"\n# ...\nconflict_hook = \"\u002Fhome\u002Fme\u002Fbin\u002Fmerge-docs\"   # overrides the default for this folder\n```\n\nOnly one node runs the hook per folder: the first keeper on a kept folder, or the first member on an unkept one. If several nodes make identical copies of the same conflict, the hook runs once and the duplicates are removed. Set the hook on every node so it runs wherever that role lands. Before it runs on a kept folder, both versions are kept right away, so anything the hook does can be undone with `restore`.\n\nThe script runs in the folder root with:\n\n| Variable | Value |\n| --- | --- |\n| `KEEPSYNC_FOLDER` | Folder name |\n| `KEEPSYNC_ORIGINAL` | Absolute path of the current file |\n| `KEEPSYNC_CONFLICT` | Absolute path of the conflict copy |\n| `KEEPSYNC_CONFLICT_NODE` | Name of the node whose change lost, else its short device ID |\n| `KEEPSYNC_BASE` | A temp file with the common ancestor of both versions, for a three-way merge, or empty if there is none (as when the file was never kept) |\n| `KEEPSYNC_BASE_EXACT` | `1` if the base is known to be the common ancestor; `0` if it is only the last kept version, a guess (never one identical to either side) |\n\nTo resolve, write the result to `$KEEPSYNC_ORIGINAL`, delete `$KEEPSYNC_CONFLICT`, and exit 0. A non-zero exit, a timeout, or a copy left in place leaves the conflict for you.\n\nA minimal hook that uses `git merge-file`:\n\n```sh\n#!\u002Fbin\u002Fsh\nset -e\n[ \"$KEEPSYNC_BASE_EXACT\" = 1 ] || exit 1   # no reliable base: leave it for a human\ngit merge-file \"$KEEPSYNC_ORIGINAL\" \"$KEEPSYNC_BASE\" \"$KEEPSYNC_CONFLICT\"\nrm \"$KEEPSYNC_CONFLICT\"\n```\n\n`git merge-file` exits non-zero when the merge has conflicts, so the copy stays for you to look at.\n\n```sh\nkeepsync conflicts                                    # conflict copies and hook state\nkeepsync conflicts resolve ~\u002FDocuments\u002Fnotes.sync-conflict-20261115-101500-ABCDEFG.md\n                                                      # run the hook now, on this node\n```\n\n### Recovery kit\n\nThe bucket holds the archive, and the recovery kit holds everything else needed to rebuild the server: the Perkeep identity, the server's tailcat key (so it comes back at the same address), the bucket credentials, the ZeroFS password, the config, the registry, and the `keepsync` and `zerofs` binaries. It is an age-encrypted zip.\n\n`server init` writes the first kit. Regenerate it after changing the server's config, and keep the latest one:\n\n```sh\nkeepsync server kit --out \u002Fsafe\u002Fplace\u002Fkeepsync-recovery.zip.age\n```\n\n#### Recover a lost server\n\nOn a new machine, with the kit and its passphrase:\n\n```sh\nkeepsync recover keepsync-recovery.zip.age\nkeepsync server run\n```\n\n`recover` starts ZeroFS on the bucket and rebuilds the Perkeep index from it, then installs the key, config, and registry. A store-mode server also gets every archived blob copied back to local disk; a cache-mode one reads them from the bucket as needed. `--mode store|cache` recovers into a different mode from the one the kit was made with. The passphrase comes from `--passphrase-file`, `$KEEPSYNC_KIT_PASSPHRASE`, or a prompt. Nodes reconnect on their own, because the address is the same.\n\nZeroFS allows only one writer, so **never recover while the old server could still be running against the bucket.**\n\n#### Drill a recovery\n\nCheck that recovery works without touching the live server:\n\n```sh\n# on the live server\nkeepsync server baseline baseline.json\n\n# copy the bucket (on R2 or S3, rclone copies server-side with no egress)\nrclone copy r2:my-bucket r2:my-bucket-drill\n\n# anywhere, in its own process\nkeepsync recover keepsync-recovery.zip.age --drill --bucket s3:\u002F\u002Fmy-bucket-drill\u002Fkeepsync --baseline baseline.json\n```\n\nThe drill restores the copy without taking over the server's identity, then checks that every blob and kept file reads back with the right hash, that the index finds every kept file, and where the registry would come from. It also reports restore time and throughput.\n\n### Mount modes\n\nThe server always talks to ZeroFS over 9P. By default it is the 9P client itself and mounts nothing, so it needs no FUSE or root. Pick another way with `server init --mount`:\n\n| Mode | How | Needs |\n| --- | --- | --- |\n| `9p` (default) | keepsync talks 9P to ZeroFS directly; no mount | Nothing extra |\n| `fuse` | ZeroFS's own 9P client through FUSE, as your user | Linux, `\u002Fdev\u002Ffuse`, `fusermount3` |\n| `v9fs` | The Linux kernel's 9P client | Linux, root, the `9p` and `9pnet_fd` modules |\n| `external` | Nothing. You mount the 9P export at `--mount-dir` yourself | Any platform |\n\nWith `9p`, blobs are stored one file per blob, which writes far faster than the `diskpacked` packs the mount modes use for a new bucket (see [Testing](docs\u002Fspec.md#testing)). A bucket keeps the layout it was created with, and one written as `diskpacked` needs a mount mode. Servers set up before `9p` keep `fuse`.\n\nStick with `9p` unless you want to look at the server's files with ordinary tools while it runs, or have a `diskpacked` bucket. To switch later, set `mount` under `[zerofs]` in `server.toml` and restart the server. If ZeroFS exits or stops answering, the server restarts and reconnects it on its own, retrying for 5 minutes; `server status` shows `zerofs: RECONNECTING` meanwhile. If it stays down past that, `server status` and every node's status show `zerofs: DOWN`, and you have to restart `keepsync server run`.\n\n### Command reference\n\nRun `keepsync help` for the full list. The [spec](docs\u002Fspec.md#cli-reference) has a table of every command and flag.\n\n## License\n\nMIT. ZeroFS, which keepsync runs as a separate program, is AGPL-3.0. See [Licensing](docs\u002Fspec.md#licensing).\n","keepsync 是一个面向个人与小团队的端到端文件同步与永久归档工具。它整合 Syncthing 实现去中心化 P2P 文件夹实时同步，同时基于 Perkeep 构建不可变、版本化、内容寻址的长期归档系统，并通过 ZeroFS 将归档安全落盘至任意 S3 兼容对象存储（如 Cloudflare R2、MinIO）。其核心特点是节点间直连同步（无需公网 IP 或端口映射）、服务器离线时同步不中断、同步与归档职责分离（同步保留近期文件，归档保存所有历史版本），适用于多设备协同办公、数字资产长期保存及隐私敏感场景下的本地优先数据管理。","2026-11-24 04:53:11","CREATED_QUERY"]