Lightyear LogoLightyear Docs

Local sync

Sync your collections to your local filesystem as Markdown files

Local sync

Local sync brings your collection data down to your machine as Markdown files. Every contact, deal, issue, and document becomes a readable .md file on your filesystem — ready for grep, your editor, or your local AI tools.

Local sync works with collections. Set up a collection first, then sync it locally.

Why local?

Your data lives in the cloud across dozens of SaaS products. That's fine for the web, but it means:

  • Your AI tools can't see it — Local AI assistants (Cursor, Claude Desktop, etc.) can't access your HubSpot contacts or Jira tickets
  • You can't search it offline — No internet means no access
  • You can't version it — No git history of how your data changes over time

Local sync solves all three. Your data lives in Markdown files on your machine, updated continuously, ready for any tool that reads files.

Start syncing

unscrambled sync local --dir ~/data
Syncing 3 collections to ~/data...
✓ contacts/ — 248 files (Markdown)
✓ deals/ — 89 files (Markdown)
✓ issues/ — 412 files (Markdown)

Watching for changes... (Ctrl+C to stop)

This starts a background sync server that:

  1. Does an initial download of all collection data
  2. Converts each record to a Markdown file
  3. Watches for changes and syncs incrementally

File structure

Each collection becomes a directory. Each record becomes a Markdown file:

~/data/
├── contacts/
│   ├── jane-doe-acme.md
│   ├── john-smith-acme.md
│   └── alex-chen-globex.md
├── deals/
│   ├── acme-enterprise-2026.md
│   └── globex-starter-2026.md
└── issues/
    ├── AUTH-123-fix-login-flow.md
    ├── AUTH-124-add-2fa.md
    └── INFRA-89-upgrade-postgres.md

Markdown format

Each file contains YAML frontmatter with structured fields, followed by a readable body:

---
id: contact_abc123
source: hubspot
email: [email protected]
company: Acme Corp
lifecycle_stage: customer
last_synced: 2026-03-19T14:30:00Z
---
 
# Jane Doe
 
**Email:** [email protected] **Company:** Acme Corp **Lifecycle stage:** Customer
**Created:** January 15, 2026
 
## Notes
 
Enterprise customer since Q1 2026. Primary contact for the Acme account.
Interested in API access and automation features.
 
## Activity
 
- Mar 18: Opened pricing email
- Mar 15: Attended webinar
- Mar 10: Demo call with sales team

Configuration

Customize the sync with a config file:

import { defineLocalSync } from "@unscrambled/sdk";
 
export default defineLocalSync({
  directory: "~/data",
 
  collections: {
    contacts: {
      filenameTemplate: "{{firstname}}-{{lastname}}-{{company}}",
      include: ["email", "company", "lifecycle_stage", "notes"],
    },
    deals: {
      filenameTemplate: "{{company}}-{{deal_name}}",
      include: ["amount", "stage", "close_date", "owner"],
    },
    issues: {
      filenameTemplate: "{{key}}-{{title}}",
      include: ["status", "assignee", "priority", "description"],
    },
  },
 
  // How often to check for changes (in seconds)
  pollInterval: 60,
 
  // Keep deleted records as files (moved to .trash/)
  preserveDeleted: true,
});

Running as a daemon

For continuous sync, run the sync server as a background daemon:

# Start the sync daemon
unscrambled sync local --dir ~/data --daemon
 
# Check daemon status
unscrambled sync local --status
 
# Stop the daemon
unscrambled sync local --stop

On macOS, you can also install it as a launch agent so it starts automatically:

unscrambled sync local --install-agent

Use with AI tools

The primary use case for local sync is making your data available to local AI tools:

Cursor / VS Code

Point your editor at the synced directory. Your AI assistant can now reference your contacts, deals, and issues when answering questions:

You: "Which Acme contacts should I follow up with this week?"
AI: (reads ~/data/contacts/jane-doe-acme.md and other Acme files)
    "Based on recent activity, Jane Doe had a demo call on March 10
     and opened a pricing email on March 18. She seems ready for
     a follow-up on enterprise pricing."

Use standard Unix tools to search across all your data:

# Find all contacts at Acme
grep -rl "company: Acme" ~/data/contacts/
 
# Find high-priority issues
grep -rl "priority: High" ~/data/issues/
 
# Full-text search across everything
grep -ri "enterprise pricing" ~/data/

Git versioning

Track changes to your data over time by initializing a git repo:

cd ~/data
git init
git add .
git commit -m "Initial data snapshot"

Set up a cron job to commit changes daily for a full history of how your data evolves.

Conflict handling

Local sync is currently read-only — changes made to local files are not pushed back to the source services. Editing a local file will cause it to be overwritten on the next sync cycle.

Bidirectional local sync (edit locally, push to source) is on the roadmap.

On this page