Skip to main content

Overview

Sync Folds stores fold states in .obsidian/plugins/sync-folds/data.json, which means any file sync solution that syncs your vault will automatically sync your fold states. No additional configuration is required beyond ensuring the plugin is installed on all devices.
The data.json file is stored in your vault’s plugin directory, so it’s treated like any other vault file by sync solutions.

File Location

Fold states are persisted to:
<YourVault>/.obsidian/plugins/sync-folds/data.json
Example structure:
MyVault/
├── .obsidian/
│   ├── plugins/
│   │   ├── sync-folds/
│   │   │   ├── main.js
│   │   │   ├── manifest.json
│   │   │   └── data.json          ← Fold states stored here
│   │   └── other-plugins/
│   └── workspace.json
├── Notes/
└── Projects/
If your sync solution excludes .obsidian/ or .obsidian/plugins/, fold states will not sync. Ensure these directories are included in your sync configuration.

Sync Solutions

Obsidian Sync

Status: ✅ Fully compatibleObsidian Sync automatically syncs all plugin data files, including data.json.

Setup Steps

1

Install the plugin on all devices

Install and enable Sync Folds from Settings → Community plugins on each device where you use Obsidian.
2

Verify sync settings

Open Settings → Sync → Vault configuration sync and ensure “Plugins” is enabled. This is usually enabled by default.
3

Wait for initial sync

After enabling the plugin on multiple devices, Obsidian Sync will propagate the data.json file. This typically takes a few seconds to minutes depending on sync frequency.
4

Verify fold states sync

Fold some headings on Device A, wait for sync, then open the same file on Device B. The folds should be preserved.
Obsidian Sync’s conflict resolution handles data.json like any other file. If you fold different sections on two devices while offline, the last sync wins. Use the manual commands to merge if needed.

Troubleshooting

  • Check that “Plugins” is enabled in Sync settings
  • Verify the plugin is enabled on both devices
  • Check sync status in the bottom-right corner
  • Try running Export folds from local storage to force a write
If you see sync conflicts for data.json, choose the version from the device with the most complete fold states, or manually merge using the export/import commands.

Enable/Disable Sync

Sync Folds includes an enableSync setting that controls whether the plugin actively syncs fold states.

Settings Interface

export interface SyncFoldSettings {
    enableSync: boolean
    folds: string
}

export const DEFAULT_SETTINGS: SyncFoldSettings = {
    enableSync: true,
    folds: '{}'
}
By default, enableSync is true. When false:
  • localStorage interception is disabled
  • Fold changes are not written to data.json
  • External change detection is not active
  • Manual commands still work (export/import)

When to Disable Sync

Disable sync to prevent the plugin from modifying data.json while you’re testing or debugging other parts of your vault setup.
If you’re experiencing performance issues and suspect the plugin, temporarily disable sync to see if it improves performance.
If you only use Obsidian on one device, you may not need sync. However, keeping it enabled is harmless and provides a backup of fold states.
Disabling sync doesn’t delete existing fold states from data.json or localStorage. It only stops new changes from being synced. Re-enabling sync resumes normal operation.

Sync Performance Tips

Use Local Networks

For peer-to-peer solutions like Syncthing, keep devices on the same WiFi network for fastest sync speeds.

Check Sync Intervals

Some sync solutions have configurable intervals. Set them to sync frequently (every 1-5 minutes) for near-real-time fold state updates.

Monitor File Size

data.json typically stays small (a few KB), but if you have thousands of files with fold states, it can grow. Most sync solutions handle small files very efficiently.

Close Obsidian Before Switching

For non-real-time sync (like rsync or periodic iCloud), close Obsidian on one device before opening on another to ensure changes are synced.

Troubleshooting Common Sync Issues

Checklist:
  • Verify the plugin is installed and enabled on both devices
  • Check that enableSync is true in settings
  • Ensure .obsidian/plugins/sync-folds/ is not excluded by your sync solution
  • Verify data.json exists: .obsidian/plugins/sync-folds/data.json
  • Check sync solution status (cloud icon, web UI, etc.)
  • Try manually running Export folds from local storage on one device and Import folds into local storage on the other
If your sync solution creates conflicted copies of data.json:
  1. Open both versions in a text editor
  2. Compare the folds JSON string to see which has more complete data
  3. Choose one version or manually merge the fold objects
  4. Replace data.json with the resolved version
  5. Delete the conflicted copy
  6. Run Import folds into local storage on all devices
This can happen if:
  • Two devices both export at the same time, and the wrong one wins
  • Your sync solution’s conflict resolution chose the older version
  • The plugin wasn’t running when the file synced, so localStorage wasn’t updated
Solution: Run Export folds from local storage on the device with the correct fold states, ensure it syncs, then run Import folds into local storage on the other device.
If data.json contains {"enableSync":true,"folds":"{}"} but you have fold states:
  1. The plugin may have reset on load because the file was empty
  2. Run Export folds from local storage to rebuild from localStorage
  3. If localStorage is also empty, fold states were lost and cannot be recovered
For most sync issues, the export/import commands are your best diagnostic tools. Export from the device that has correct fold states, sync, then import on other devices.

Build docs developers (and LLMs) love