$npx -y skills add adityahimaone/hermes-agent-rtk-caveman --skill syncthing-setupInstall and configure Syncthing for folder sync between macOS and Android devices. Covers brew install, service setup, web UI automation for folder creation, device ID extraction, and cross-device pairing instructions. Use when user needs to sync folders between Mac and phone/tab
| 1 | # Syncthing Setup |
| 2 | |
| 3 | Install and configure Syncthing to sync folders between macOS and Android devices. Common use case: syncing Obsidian vaults. |
| 4 | |
| 5 | ## When to Use |
| 6 | - User wants to sync a folder from Mac to Android (or vice versa) |
| 7 | - Setting up Obsidian vault sync between devices |
| 8 | - Need real-time, encrypted, no-cloud file sync |
| 9 | - User asks "how to sync files between Mac and phone" |
| 10 | |
| 11 | ## Installation |
| 12 | |
| 13 | ```bash |
| 14 | brew install syncthing |
| 15 | brew services start syncthing |
| 16 | sleep 4 |
| 17 | # Verify running: |
| 18 | curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:8384 |
| 19 | # Should return 200 |
| 20 | ``` |
| 21 | |
| 22 | ## Web UI Access |
| 23 | |
| 24 | Open `http://127.0.0.1:8384` and use browser tools to interact. The REST API has CSRF protection, so browser automation is more reliable than curl-based API calls. |
| 25 | |
| 26 | ## Device ID Extraction |
| 27 | |
| 28 | ```bash |
| 29 | curl -s http://127.0.0.1:8384/rest/system/status 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin).get('myID',''))" |
| 30 | ``` |
| 31 | |
| 32 | This returns the full Device ID like: `TIST2PB-54H2NQC-KHI5B3G-5OLLMZM-IGU7LC2-ARRMEIA-46VI6ST-AZFCPAJ` |
| 33 | |
| 34 | ## Adding a Folder via Browser Automation |
| 35 | |
| 36 | 1. Navigate to `http://127.0.0.1:8384` |
| 37 | 2. Dismiss setup dialogs (click through: Yes for usage reporting, OK for crash reporting, OK for auth warnings) |
| 38 | 3. Click "Add Folder" button |
| 39 | 4. In the modal: |
| 40 | - Set Folder Label (e.g., "CPNS-2026") |
| 41 | - Set Folder ID (e.g., "cpns-2026") — must match on all devices |
| 42 | - Set Folder Path (e.g., `/Users/adityahimawan/Documents/Obsidian/CPNS-2026`) |
| 43 | 5. Click "Save" |
| 44 | |
| 45 | ## Adding a Remote Device |
| 46 | |
| 47 | 1. Click "Add Remote Device" in the Devices section |
| 48 | 2. Enter the remote device's full Device ID (from their Syncthing app) |
| 49 | 3. Give it a friendly name (e.g., "Adit's Android") |
| 50 | 4. Click "Save" |
| 51 | |
| 52 | ## Folder Sharing Setup |
| 53 | |
| 54 | After devices are paired: |
| 55 | 1. Click on the shared folder in the Folders section |
| 56 | 2. Go to the "Sharing" tab |
| 57 | 3. Check the remote device |
| 58 | 4. Click "Save" |
| 59 | |
| 60 | ## Android Setup Instructions (tell the user) |
| 61 | |
| 62 | 1. Install **Syncthing** from Play Store (or **Syncthing-Fork** from F-Droid) |
| 63 | 2. Open app → accept TOS |
| 64 | 3. Note the Device ID (menu → ID & Alamat Jarak Jauh) |
| 65 | 4. Exchange Device IDs between Mac and Android |
| 66 | 5. Accept folder share on Android and set sync path to: |
| 67 | `/storage/emulated/0/Documents/Obsidian/CPNS-2026` |
| 68 | |
| 69 | ## Obsidian Android Setup |
| 70 | |
| 71 | 1. Open Obsidian Android → "Open folder as vault" |
| 72 | 2. Navigate to the Syncthing sync folder |
| 73 | 3. Notes will auto-sync both directions |
| 74 | |
| 75 | ## Multi-Vault Configuration |
| 76 | |
| 77 | When syncing multiple folders (e.g., CPNS-2026 + Notes vaults), you need one `<folder>` element per vault in config.xml. Each folder must have: |
| 78 | - Unique `id` attribute |
| 79 | - Correct `path` attribute |
| 80 | - A `<device>` child with the paired device ID |
| 81 | |
| 82 | Example config structure (2 folders): |
| 83 | ```xml |
| 84 | <folder id="cpns-2026" label="CPNS-2026" path="/Users/adityahimawan/Documents/Obsidian/CPNS-2026" ...> |
| 85 | <device id="DEVICE_ID" introducedBy=""><encryptionPassword /></device> |
| 86 | ... |
| 87 | </folder> |
| 88 | <folder id="notes" label="Notes" path="/Users/adityahimawan/Documents/Obsidian/Notes" ...> |
| 89 | <device id="DEVICE_ID" introducedBy=""><encryptionPassword /></device> |
| 90 | ... |
| 91 | </folder> |
| 92 | ``` |
| 93 | |
| 94 | ## Config Editing Patterns |
| 95 | |
| 96 | **ALWAYS backup before editing:** |
| 97 | ```bash |
| 98 | cp ~/Library/Application\ Support/Syncthing/config.xml ~/Library/Application\ Support/Syncthing/config.xml.bak |
| 99 | ``` |
| 100 | |
| 101 | **Safe Python XML edit pattern** (avoid list.remove errors): |
| 102 | ```python |
| 103 | import xml.etree.ElementTree as ET |
| 104 | tree = ET.parse(config_path) |
| 105 | root = tree.getroot() |
| 106 | # Use list() to make a copy before iterating |
| 107 | for la in list(options.findall('listenAddress')): |
| 108 | options.remove(la) |
| 109 | # Then add new elements |
| 110 | ``` |
| 111 | |
| 112 | **Quick text fix** (when XML editing is overkill): |
| 113 | ```bash |
| 114 | # Stop first |
| 115 | brew services stop syncthing |
| 116 | |
| 117 | # Then use patch or sed |
| 118 | # After edit, restart |
| 119 | brew services start syncthing |
| 120 | |
| 121 | # Verify |
| 122 | lsof -i :22000 |
| 123 | lsof -i :8384 |
| 124 | grep -c "tcp://default" config.xml # Should be 0 |
| 125 | ``` |
| 126 | |
| 127 | ## Renaming a Vault |
| 128 | |
| 129 | When renaming a vault folder on macOS: |
| 130 | 1. Rename the folder on disk: `mv OldName NewName` |
| 131 | 2. Stop syncthing: `brew services stop syncthing` |
| 132 | 3. Update config.xml `path` and `label` attributes to match |
| 133 | 4. **Also update folder `id`** if you want consistency |
| 134 | 5. Restart syncthing: `brew services start syncthing` |
| 135 | 6. **On Android:** delete old folder entry in Syncthing app, add new one with matching folder ID |
| 136 | |
| 137 | The folder ID must match between Mac and Android — if you change it on one side, the other side will reject the sync. |
| 138 | |
| 139 | ## Troubleshooting |
| 140 | |
| 141 | | Problem | Fix | |
| 142 | |---------|-----| |
| 143 | | **Devices "Disconnected (Inactive)" — CRITICAL BUG** |