Skip to content

Cloud Sync

TomΓ‘s Platero edited this page Oct 3, 2026 · 1 revision

Cloud Sync

PiCode Cloud keeps your editor settings and your Pi profile in step across machines. It is the paid half of the plan; the program itself stays free and complete without it. Everything below is what the code actually does.

Sync is bidirectional and per resource: the engine pulls what changed on another machine, pushes what changed here, and merges when both sides moved.

What syncs, and where it comes from

Resource What it carries Where it lives locally
settings editor settings data/user-data/User/settings.json
keybindings keyboard shortcuts data/user-data/User/keybindings.json
snippets code snippets data/user-data/User/snippets/
tasks build tasks data/user-data/User/tasks.json
prompts prompt templates data/user-data/User/prompts/
mcp MCP servers the MCP configuration
extensions installed extensions the editor's extension inventory
globalState UI state (theme, last-used model…) data/user-data/User/globalStorage
profiles editor profiles data/user-data/User/profiles/
piProfile Pi's own profile data/pi-agent

piProfile is the resource that makes PiCode different from plain settings sync: it carries the agent harness β€” agents/, subagents/, skills/, memory/, chains/, gentle-ai/ and specpi/, plus settings.json, models.json, subagents.json, trust.json and mcp-adapter.json β€” as a bundle of files. Merging is last-writer-wins per file; a file changed on both sides becomes one whole-file conflict.

The journey

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ PiCode, on your machine (data/) ────────────────┐
β”‚  settings Β· keybindings Β· snippets Β· tasks Β· prompts Β· mcp       β”‚
β”‚  extensions Β· UI state Β· editor profiles   β†’ data/user-data/…    β”‚
β”‚  Pi profile (agents, skills, memory, models…) β†’ data/pi-agent    β”‚
β”‚                                                                  β”‚
β”‚            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚                                    β–Ό
β”‚     The native sync engine (VS Code's, in the background)
β”‚       Β· reads each resource
β”‚       Β· compares local vs remote vs the last synced base
β”‚       Β· uploads what changed, pulls and merges what changed away
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚  HTTPS + your account token
                                     β–Ό
                     https://www.getpicode.app/api/v1/…
                                     β”‚
                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                        β–Ό                          β–Ό
                 Firebase Auth               πŸ” PiCode API (Vercel)
                 β€œwho are you?”               Β· encrypts the content
                                              Β· stores and serves it
                                              Β· enforces the quota
                                                     β”‚
                                                     β–Ό
                                             πŸ—„οΈ Firestore (encrypted)

When it runs: on start-up, every five minutes, and whenever something changes β€” with a short debounce so a burst of edits becomes one sync.

How it is stored in the cloud

  • Manifest β€” users/{uid}/sync/manifest: the latest version of each resource and a running count of the bytes used.
  • Content β€” users/{uid}/sync/resources/{resource}/{version}: the content, already encrypted.
  • Encryption β€” AES-256-GCM over the compressed content, server-side. The client only ever exchanges plaintext; the API encrypts on write and decrypts on read. The stored envelope is picode-enc:v2:….
  • Retention β€” the newest 20 revisions per resource.
  • Quota β€” Free β‰ˆ 1 MB Β· Pro β‰ˆ 50 MB.
  • Authentication β€” Firebase Auth through the PiCode Account provider; the engine's requests carry the account's bearer token.

What never leaves the machine

  • πŸ”’ auth.json and its backups β€” credentials are machine-bound and are not part of the Pi profile bundle.
  • 🚫 sessions/, npm/, node_modules/, bin/, extensions/, tmp/, git/ and caches inside the profile.

A separate channel: Pi sessions

Conversation transcripts are backed up, not continuously synced, over their own resource:

~/.pi/agent/sessions/<project>/*.jsonl
        β”‚  each file becomes its own opaque ref on the piSessionsBackup resource
        β”‚  incremental by SHA-1: only files whose hash changed are uploaded
        β–Ό
    cloud  Β·  a 7-day rolling window  Β·  a 45 MB soft ceiling
           Β·  deleting a transcript locally never deletes the cloud copy

It is driven by two commands: picode.backupSessions and picode.restoreSessions (the latter asks for confirmation before writing back).

The profile is the unit

Everything above is designed around one idea: data/ is a portable profile. Copying it moves a whole PiCode; deleting it yields a clean one. Cloud sync is that same folder travelling between machines, with credentials left out and everything else encrypted before it crosses the wire.


Related: Pi Inside Β· Distribution and Licensing Β· Architecture Β· Roadmap and Known State

Clone this wiki locally