Skip to content

6. Cloud storage sync

Code
git — not a sync folder
Documents
iCloud / Drive / OneDrive
Key setting
Keep files downloaded

Cloud storage is a great way to hand documents to your agents — drop a spec into a synced folder from your phone, and an assistant on the Mac mini can read it. It’s a terrible place for source code.

  1. Code lives in git, in a normal folder such as ~/code/, pushed to a remote. Never put a git repository, node_modules, a Python virtual environment or build output inside a synced folder: thousands of small, fast-changing files cause sync conflicts, corrupted repos and huge upload queues.
  2. Documents live in cloud storage. Give agents a clear Inbox (things for them to read) and Outbox (things they produce) inside your synced folder.
  3. Keep synced files downloaded. All three services can replace files with online-only placeholders. A background job that opens a placeholder has to wait for a download — or fails if the sync client isn’t running. Tell each service to keep your agent folders on the Mac.
  4. Watch the sign-in. Sync clients occasionally need you to sign in again. Add them to health-check.sh --app … so you notice when one isn’t running.
Service Folder on the Mac
iCloud Drive ~/Library/Mobile Documents/com~apple~CloudDocs/ (shown as iCloud Drive in Finder)
Google Drive for desktop ~/Library/CloudStorage/GoogleDrive-…/
OneDrive ~/Library/CloudStorage/OneDrive-…/

Google Drive and OneDrive use Apple’s File Provider system, which is why they live under ~/Library/CloudStorage/. Use those real paths (or the Finder sidebar) rather than old ~/Google Drive style paths from older guides.

System Settings → [your name] → iCloud → Drive (called iCloud Drive on older versions).

  • Turn Sync this Mac on.
  • Turn Optimize Mac Storage off, so files stay fully downloaded.
  • Consider leaving Desktop & Documents Folders off on a server, so tools that write to ~/Documents don’t upload everything they touch.

To keep a single folder downloaded when optimisation is on, right-click it in Finder and choose Keep Downloaded.

Install Google Drive for desktop from Google, sign in, then open its Settings → Preferences:

  • Stream files keeps files online-only until opened. If you use it, right-click your agent folders in Finder and choose Available offline.
  • Mirror files keeps a full local copy of My Drive — simpler for an always-on server if you have the disk space.

Install OneDrive from the Mac App Store or Microsoft, sign in, and choose which folders to sync. Files On-Demand is always on with File Provider, so right-click your agent folders and choose Always Keep on This Device.

The first time a background process reads a cloud-storage folder, macOS may ask for permission. A LaunchAgent can’t answer that prompt. Run the job once by hand while you’re logged in (or connected with Screen Sharing) and approve it — see privacy permissions.

iCloud Drive/
└── AI Server/
├── Inbox/ ← you drop files here from any device
├── Outbox/ ← agents write results here
└── Archive/ ← processed inputs move here

Your agent (or a small LaunchAgent script with StartInterval) checks Inbox/, works on each file, writes to Outbox/, and moves the input to Archive/. Keep it idempotent — if the Mac restarts halfway, running it again should not duplicate work.