Skip to main content

Sync Commands

Commands for syncing with the Kernle cloud backend and managing authentication.

sync

Synchronize memory with the remote backend.

sync status

Check sync status, pending operations, and connection.
kernle -a <agent> sync status [--json]
Example output:
Sync Status
===========
Backend: https://api.kernle.ai
Agent: claire
User: user_abc123

Pending: 3 operations
Last Push: 2024-01-15 14:32:00
Last Pull: 2024-01-15 14:30:00
Status: Connected

sync push

Push pending local changes to remote.
kernle -a <agent> sync push [--limit L] [--json]
OptionDescription
-l, --limit LMaximum operations to push (default: all)
# Push all pending changes
kernle -a claire sync push

# Push up to 10 changes
kernle -a claire sync push --limit 10

sync pull

Pull remote changes to local.
kernle -a <agent> sync pull [--full] [--json]
OptionDescription
-f, --fullPull all records (not just since last sync)
# Pull recent changes
kernle -a claire sync pull

# Full sync from cloud
kernle -a claire sync pull --full

sync full

Full bidirectional sync (pull then push).
kernle -a <agent> sync full [--json]
kernle -a claire sync full

auth

Authentication and credentials management.

auth register

Register for cloud sync with email.
kernle -a <agent> auth register [--email EMAIL] [--backend-url URL] [--json]
kernle -a claire auth register --email [email protected]
This will:
  1. Send a verification email
  2. Create your account on the backend
  3. Store credentials locally in ~/.kernle/credentials.json

auth login

Log in with an API key.
kernle -a <agent> auth login [--api-key KEY] [--backend-url URL] [--json]
# Interactive login
kernle -a claire auth login

# With API key
kernle -a claire auth login --api-key sk-xxxxx

auth status

Check authentication status.
kernle -a <agent> auth status [--json]
Example output:
Authentication Status
=====================
Backend: https://api.kernle.ai
Authenticated: Yes
User ID: user_abc123
Agent: claire
API Keys: 2 active

auth logout

Log out and clear credentials.
kernle -a <agent> auth logout [--json]

auth keys

Manage API keys.

List Keys

kernle auth keys list [--json]

Create Key

kernle auth keys create [--name NAME] [--json]
kernle auth keys create --name "Development Machine"

Revoke Key

kernle auth keys revoke KEY_ID [--force] [--json]
OptionDescription
--forceSkip confirmation prompt

Cycle Key

Generate a new key and deactivate the old one.
kernle auth keys cycle KEY_ID [--force] [--json]

Auto-Sync Configuration

Kernle can automatically sync during load and checkpoint save operations.

Enable Auto-Sync

Auto-sync is enabled by default when credentials are configured. Control it with flags:
# Force sync on load
kernle -a claire load --sync

# Skip sync on load
kernle -a claire load --no-sync

# Force sync after checkpoint
kernle -a claire checkpoint save "task" --sync

# Skip sync after checkpoint
kernle -a claire checkpoint save "task" --no-sync

Sync Architecture

Local-First with Sync Queue
  1. All changes written to local SQLite first
  2. Changes queued in sync_queue table
  3. Queue deduplicates by (table, record_id)
  4. Push to cloud when online
  5. Pull remote changes on load() if auto_sync enabled
Conflict Resolution: Last-write-wins based on local_updated_at

Offline Mode

Kernle works fully offline. Changes are queued and synced when connectivity returns:
# Check pending operations
kernle -a claire sync status

# Push when back online
kernle -a claire sync push