ナイア
目次
← 目次に戻る
Common · Account · Billing

22. Cloud Drive Sync

This step-by-step guide explains how to keep your PC Naia workspace (settings, memory, knowledge, and .nct character packages) in sync with mobile browsers and apps using your personal OneDrive or Google Drive.

1. Overview & Sync Layout

Cloud Drive Sync (cloud-drive-sync) creates isolated profile folders inside your personal cloud drive to synchronize data bidirectionally between PC and mobile. No plaintext user data is stored on any central relay server (Zero-Log).

Remote Directory Structure

Apps/Naia/profiles/
├── default/                    # Default profile (when no profile ID is set)
│   ├── naia-settings/          # Personal settings (sensitive keys excluded)
│   ├── memory-personal.json    # Personal memory file
│   ├── work/                   # Working documents and .nct packages
│   ├── knowledge/              # Personal knowledge base
│   └── .backups/               # Automatic snapshots on conflict
│       └── 20261204T043015Z-config.json
├── alpha/                      # Example: dedicated profile
└── work/                       # Example: work profile

Profile ID Rules

  • Allowed characters: lowercase letters (a-z), digits (0-9), hyphen (-), underscore (_), 1–32 characters.
  • Default value: default when left blank.
  • Fail-Closed validation: .., /, \, spaces, uppercase letters, special characters, or IDs longer than 32 characters are rejected immediately to prevent path traversal.

2. Step 1: Configure Your PC Workspace

  1. Open Naia Shell on your PC and finish configuring your general settings (naia-settings/config.json, naia-settings/llm.json), personal memory (memory-personal.json), and workspace files (knowledge/, work/).
  2. Place any .nct character packages inside work/.
  3. Sensitive credentials such as API keys and access tokens remain local to your PC and are excluded automatically.

3. Step 2: Connect OneDrive / Google Drive on PC

  1. Open Cloud Drive Sync from the Naia Shell app bar.
  2. Select OneDrive or Google Drive and complete browser OAuth sign-in (PKCE).
  3. Enter a Profile Name (for example default, alpha, or work).
  4. Choose the folders to sync:
    • Included by default: work/, personal/work/, memory-personal.json
    • Optional: naia-settings/ (personal settings, sensitive keys excluded), knowledge/
    • Check naia-settings/ if you want your PC settings carried over to mobile.
  5. Click Dry-Run Preview to inspect planned uploads, then click Sync Now.

4. Step 3: Continue Seamlessly on Mobile

  1. Open Naia Shell in your mobile browser (Safari / Chrome) or mobile app.
  2. Open Cloud Drive Sync and sign in with the same cloud provider and account used on your PC.
  3. Select the same Profile Name.
  4. Once connected, the auto-sync controller handles updates automatically:
    • Auto Pull on startup: Fetches the latest remote settings, memory, knowledge, and .nct files on launch.
    • Auto Pull on foreground resume: Pulls remote changes when you return to Naia Shell (visibilitychange → visible).
    • Auto Push on local edits (3s debounce): Pushes local edits 3 seconds after the last change.
    • Serialized execution: Concurrent pull/push requests are queued safely without overlap.
  5. Because API keys are never synced, enter your device-local API key once on mobile; all other settings and memory stay in sync automatically.

5. Conflict Resolution & Backup Recovery

When the same file is edited offline on multiple devices, sync applies Last-Write-Wins (LWW):

  1. Local and remote updatedAt timestamps are compared.
  2. The newer version wins, and the overwritten version is preserved automatically under Apps/Naia/profiles/<profileId>/.backups/<UTC-timestamp>-<filename>.
  3. To restore a previous version, open .backups/ in OneDrive or Google Drive, download the snapshot, remove the <timestamp>- prefix, place it back in the profile folder, and run Sync Now.

6. Security & E2EE

  • End-to-End Encryption (E2EE): Supports client-side AES-256-GCM encryption; decryption passphrases never leave your device.
  • Automatic Sensitive File & Key Exclusion (Fail-Closed): Blocks sensitive directories (.keys, secrets, .ssh, orgs, conversations), files (.env, auth.json, credentials.json, tokens.json, *.key, *.pem), and strips apiKey, secret, password, privateKey, and auth token keys from naia-settings/*.json.
  • Mass Delete Guard (MASS_DELETE_GUARD): Automatically blocks sync if more than 20% of tracked files or more than 10 files are queued for deletion.

7. Troubleshooting

SymptomCauseResolution
sync_invalid_profile_idProfile ID contains uppercase, spaces, or invalid charactersUse 1–32 lowercase letters, digits, -, or _
PC settings not visible on mobilenaia-settings/ unchecked or different profile IDUse the same account and profile ID on both devices and enable naia-settings/
AuthExpiredError (401)OAuth access token expiredClick Disconnect and reconnect via OAuth
naia-settings/config.json skippedInvalid JSON syntax blocked by Fail-Closed filterFix the JSON syntax and run sync again