Cross-machine memory sync agent for MAGI
The Sub-Etha for your Guide — wherever you log in, it already knows.
magi-sync watches local AI agent files (Claude, OpenClaw, Codex) and syncs them to a central MAGI server. Install it on every machine where you use AI agents, and your context follows you everywhere. Switching machines stops being an amnesia event — which is to say: don't panic.
# Download (Linux amd64)
curl -L https://github.com/j33pguy/magi-sync/releases/latest/download/magi-sync-linux-amd64 -o magi-sync
chmod +x magi-sync
sudo mv magi-sync /usr/local/bin/
# Interactive setup
magi-sync initPre-built binaries for every platform:
| Platform | Download |
|---|---|
| Linux amd64 | magi-sync-linux-amd64 |
| Linux arm64 | magi-sync-linux-arm64 |
| macOS Intel | magi-sync-darwin-amd64 |
| macOS Apple Silicon | magi-sync-darwin-arm64 |
| Windows | magi-sync-windows-amd64.exe |
All binaries are pure Go — no CGO, no dependencies. Download, make executable, run.
# brew install j33pguy/tap/magi-syncInvoke-WebRequest -Uri "https://github.com/j33pguy/magi-sync/releases/latest/download/magi-sync-windows-amd64.exe" -OutFile "magi-sync.exe"
.\magi-sync.exe initmagi-sync initThe wizard walks you through:
- Server URL — your MAGI server address (validates via health check)
- Authentication — enroll token or existing machine token
- Machine identity — auto-detects hostname and user
- Agent discovery — scans for installed agents:
- Claude (
~/.claude/) - OpenClaw (
~/.openclaw/) - Codex (
~/.codex/)
- Claude (
- Privacy — allowlist/mixed/denylist mode, secret redaction
- Config write — saves to
~/.config/magi-sync/config.yaml - Optional enrollment — enroll with the server immediately
- Optional dry-run — preview what would sync
Create ~/.config/magi-sync/config.yaml:
server:
url: http://your-magi-server:8302
token: your-machine-token
protocol: http
machine:
id: my-laptop
user: alice
sync:
mode: push
watch: true
interval: 30s
privacy:
mode: allowlist
redact_secrets: true
agents:
- type: claude
enabled: true
paths:
- ~/.claude
include:
- "projects/**/*.jsonl"
- "projects/**/CLAUDE.md"
- "memory/**/*.md"
exclude:
- "**/tmp/**"
- "**/*.bin"
- type: openclaw
enabled: true
paths:
- ~/.openclaw
include:
- "workspace/**/*.md"
- "agents/*/sessions/*.jsonl"
exclude:
- "**/tmp/**"
- "**/cache/**"
- "**/*.bin"| Mode | Command | Description |
|---|---|---|
| init | magi-sync init |
Interactive setup wizard |
| enroll | magi-sync enroll |
Register this machine with the server |
| check | magi-sync check |
Verify config and server connectivity |
| dry-run | magi-sync dry-run |
Preview what would sync (no upload) |
| once | magi-sync once |
Sync once and exit |
| run | magi-sync run |
Sync on interval (default 30s) |
| watch | magi-sync watch |
Sync on file changes (fsnotify) |
# /etc/systemd/system/magi-sync.service
[Unit]
Description=magi-sync agent
After=network-online.target
[Service]
Type=simple
User=your-user
ExecStart=/usr/local/bin/magi-sync watch
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.targetsudo systemctl enable --now magi-sync<!-- ~/Library/LaunchAgents/com.magi-sync.agent.plist -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.magi-sync.agent</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/magi-sync</string>
<string>watch</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
</dict>
</plist>launchctl load ~/Library/LaunchAgents/com.magi-sync.agent.plistschtasks /create /tn "magi-sync" /tr "C:\path\to\magi-sync.exe watch" /sc onlogon /rl highest┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Your Laptop │ │ MAGI Server │ │ Your Desktop │
│ │ │ │ │ │
│ ~/.claude/ │ │ Shared Memory │ │ ~/.claude/ │
│ ~/.openclaw/ │────▶│ Store (SQLite │◀────│ ~/.openclaw/ │
│ ~/.codex/ │ │ / Postgres) │ │ ~/.codex/ │
│ │ │ │ │ │
│ magi-sync │ │ │ │ magi-sync │
│ (watch mode) │ │ │ │ (watch mode) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- magi-sync watches configured agent directories for file changes
- New/modified files are matched against include/exclude patterns
- Content is optionally redacted (secrets, credentials)
- Memories are uploaded to MAGI via the
/sync/memoriesor/rememberendpoint - Repository tags are auto-detected from git remotes and attached to each payload
- Other machines running magi-sync can recall shared context through MAGI
magi-sync automatically detects the git remote for each scanned directory and tags uploaded memories with a compact repo identifier:
| Git Host | Tag Format | Example |
|---|---|---|
| GitHub | ghrepo:<owner>/<repo> |
ghrepo:j33pguy/magi |
| GitLab | glrepo:<owner>/<repo> |
glrepo:org/project |
| Other | repo:<host>/<owner>/<repo> |
repo:git.example.com/team/app |
This enables querying MAGI by repository:
# All memories from a specific repo
curl "http://magi:8302/memories?tags=ghrepo:j33pguy/magi"
# All tracked project/repo registry entries
curl "http://magi:8302/memories?tags=inventory"magi-sync never uploads anything you don't explicitly allow:
- allowlist (default) — only files matching
includepatterns are synced - mixed — include patterns sync, exclude patterns are blocked
- denylist — everything syncs except exclude patterns
- Secret redaction — strips Vault tokens, API keys, bearer tokens before upload
- File size limit — files over 512KB (configurable) are skipped
- A running MAGI server (v0.4.0+)
- No dependencies — single static binary
Don't Panic. Hack the Planet.