跳到主要內容

How ARC Implements Local-First: From Local Directories to Multi-Device DID Space Sync

Robert Mao
Local-FirstARCAFSDID SpaceArchitecture

Many apps talk about "local-first" while stopping at surface gestures: caching a web page with a service worker, or hiding an export button three menus deep in settings.

The cracks show up quickly in daily use. Your desktop library will not open on your phone, letting an AI agent read one project folder requires handing over raw shell access to your entire machine, and switching hosting providers means rewriting the app. In ARC (Agentic Realm Computer), local-first is an engineering constraint across storage and runtime, built around one goal: let data work locally first, while moving cleanly across devices, edge clouds, and agents.

ARC Multi-Target Runtimes and Unified AFS Path Protocol

Local machines, native mobile apps, and Cloudflare Workers read and write local storage and DID Space through the same AFS path protocol.

Why the data interface decides whether multi-device sync actually works

If every client invents its own storage layer, with web calling one REST API, desktop reading local JSON files, and mobile talking to a separate cloud database, multi-device sync turns into endless glue code.

In ARC, every runtime faces the same AFS (Agentic File System) path interface built on read, write, list, stat, and exec. When you start an application locally with the arc CLI, it mounts a chosen folder at /workspace/... and exposes local SQLite through paths. When the same declarative application runs on Cloudflare Workers, those mounts map to R2 and D1 while the application logic stays intact.

Mounting by path also solves the safety boundary for AI agents. Instead of handing an agent raw shell access to your whole laptop, you mount only the directory relevant to the task. Everything outside that mount simply does not exist to the agent.

DID Space (ArcSpace): Separating durable data from disposable compute

One of ARC's core engineering rules is simple: compute instances are disposable; user data is not.

If an app runs on your laptop and you buy a new machine, what happens to your history? If it runs on Cloudflare Workers and you decide to move to your own server, how does your data follow? DID Space (ArcSpace) is the layer that separates durable state from replaceable compute.

On the server side, DID Space supports dual backends: Cloudflare R2 plus D1 for edge deployments, and pure SQLite for local nodes or self-hosted servers. Writes are addressed by cryptographic CID hashes so integrity holds across renames and backend migrations.

On mobile and Apple desktop, platforms/swift (iOS/macOS) and platforms/kotlin (Android) are full native implementations rather than WebView wrappers. Each includes its own AFS core, native AUP renderer (SwiftUI and Jetpack Compose), and built-in AFSDIDSpace / afs-didspace sync engines backed by local SQLite tree indexes. Offline edits land in local SQLite first and sync incrementally when connected, while keys and secrets stay inside OS-backed encrypted Vault storage such as Android Keystore.

Testing the model in daily life: Aside on iOS

One practical test of this direction is our consumer iOS app, Aside.

Mobile bookmark and note tools usually fail in two ways: they stall when you lose signal on the subway, or they trap years of saves when you want to leave. On iPhone, Aside writes every shared link, quote, and image straight into local SwiftData storage first, syncs automatically via NSPersistentCloudKitContainer with CloudKitSyncMonitor and deduplication services when online, and ships full JSON export and restore with UUID deduplication.

Aside is only one application built on this model. The reusable foundation sits underneath it: ARC for portable runtimes, AFS for bounded path access over local files and spaces, and DID Space to keep the primary copy and sync path in the user's hands. Get those three layers right, and local-first no longer requires users to run their own servers just to own their data.

本頁涉及

產品

  • ARC active

    Blocklet 的執行時。它給開發者一個地方來執行以 Blocklet 描述的應用,連同那個 Blocklet 宣告自己需要的資源。

  • ARC Space active

    與一個 DID 關聯的資料空間。可以建一個個人空間,也可以按某項任務所需的權限和資料模型接入一個應用。

  • Aside active

    收藏吸引你的內容,用合集整理靈感。

術語

  • AFS

    AFS(Agentic File System)把與任務有關的檔案、服務和正在進行的工作組織成可檢視的資源檢視。它不是把一整台機器或一堆 API 交給 agent,而是給任務一塊有名字、有邊界的工作範圍。

  • AUP

    AUP(Agentic UI Protocol)先表達應用要呈現什麼、可以做什麼;runtime 再根據裝置能力呈現合適的部分。重點不是複刻同一張螢幕,而是讓同一項應用保留自己的內容和動作。

  • DID

    DID 是一種數位身分標識。它幫助持有者和驗證方確認某個身分由誰控制,也讓一項聲明有明確的關聯對象。帳戶、登入和授權各自仍有自己的角色。