Skip to main content

Overview

The lua sync command detects differences (drift) between your server-deployed configuration and local code, helping you keep them in sync.
The sync command helps prevent accidental overwrites when someone updates the agent from the admin dashboard while you’re working locally.

What Gets Synced

How It Works

  1. Compiles code - Ensures manifest is fresh (runs lua compile internally)
  2. Fetches server state - Gets the latest published persona and agent name from the server
  3. Compares with local - Checks your compiled manifest against server state
  4. Shows colored diff - Displays exactly what changed
  5. Prompts for action - Update local from server or keep local
Sync now compiles before checking drift to ensure accurate comparison with the latest local changes.

Usage

Interactive Sync

If drift is detected, you’ll see a colored diff:
Diff colors:
  • πŸ”΄ Red (-) = Line exists on server but not in local code
  • 🟒 Green (+) = Line exists in local code but not on server
  • Gray = Unchanged lines (abbreviated if many)

During Compile

Sync is opt-in during lua compile. By default, drift detection is disabled for faster compilation:
This opt-in behavior is ideal for faster development iterations. Use --sync when you need to ensure alignment with the server.

Options

Sync Command Options

Compile Integration

Non-Interactive Mode

Examples

CI/CD Workflow Example

Common Scenarios

Scenario 1: Someone Updated Persona in Dashboard

You’re developing locally, and a colleague updated the persona from the admin dashboard.

Scenario 2: Forgot to Push Changes

You made changes locally but forgot to push before reverting your code.

Scenario 3: CI/CD Pipeline

In your deployment pipeline, you might want to ensure no drift or push local as source of truth:

Best Practices

Always run lua sync when starting a new session to catch any changes made by teammates or from the dashboard.
When you want to ensure you have the latest server state:
This automatically updates your local code from the server without prompting.
In automated pipelines, compile runs without drift check by default (fast):
Add --sync only if you need to validate against server state first.
After syncing from server, commit the changes to preserve them:

How Server Versions Work

The sync command compares against the latest published persona version, not the currently active one: This means if you roll back to an older version in production, sync will still compare against the most recent push (not the rollback).

Error Handling

Your local code matches the server. No action needed.
If the server is unreachable, sync will silently continue to avoid blocking your workflow.
If no persona has been pushed to the server yet, sync will report no drift.

lua compile

Compile with optional sync check

lua push persona

Push persona to server

lua persona

Manage persona in sandbox/production