Why Sync
@Claude Code reads a CLAUDE.md file at ~/.claude/CLAUDE.md at the start of every session. It contains workflow instructions, task management rules, and core principles that shape how Claude collaborates with you — the foundation of your @Augmentation Stack. See: @CLAUDE.md as Infrastructure.
The problem: this file is local to each device. If you use Claude Code on multiple machines — a desktop, a laptop, a server — your instructions drift apart. Edits on one machine don't propagate.
The solution: store your CLAUDE.md as a @MythOS memo and sync it down to every device automatically. MythOS becomes the single source of truth. Edit from anywhere — your phone, another computer, the web — and all devices pick up the change on the next sync cycle. This is @Collaborative Augmentation infrastructure: corrections encoded once propagate everywhere.
How It Works
A shell script fetches your CLAUDE.md memo from the MythOS API, strips the structural headers (Objective/Subjective/Contexts), and writes the clean markdown content to ~/.claude/CLAUDE.md. A launchd job runs this script every 6 hours and at login. The write is atomic (temp file + mv) so Claude Code never reads a partial file.
Setup
1. Create Your Memo
Create a MythOS memo to hold your CLAUDE.md content. Tag it #mythos-mcp-context if you want it loaded into Claude Code sessions via the @MythOS MCP server as well. Set the visibility to whatever you're comfortable with — private works fine since the API key authenticates the fetch.
Structure the memo content inside the ## Objective section using standard markdown. The sync script strips the Objective/Subjective/Contexts headers and writes everything else to the local file.
Note your memo ID (visible in the URL: mythos.one/me/username/memo-id).
2. Store Your API Key
The script reads your MythOS API key from macOS Keychain:
security add-generic-password -a mythos -s mythos-api-key -w "YOUR_API_KEY"
You can find your API key in MythOS at Settings → Developer.
3. Create the Sync Script
Save this as sync-claude-md.sh (or wherever you keep scripts):
#!/bin/bash
set -euo pipefail
MEMO_ID="${CLAUDE_MD_MEMO_ID:-YOUR_MEMO_ID_HERE}"
OUTPUT_PATH="${CLAUDE_MD_OUTPUT:-$HOME/.claude/CLAUDE.md}"
API_KEY="$(security find-generic-password -a mythos -s mythos-api-key -w 2>/dev/null)" || {
echo "Error: No API key in Keychain." >&2; exit 2
}
HTTP_RESPONSE="$(curl -s -w "\n%{http_code}" -L \
-H "x-mythos-key: ${API_KEY}" \
"https://www.mythos.one/api/internal/memos?id=${MEMO_ID}")"
HTTP_BODY="$(echo "$HTTP_RESPONSE" | sed '$d')"
HTTP_CODE="$(echo "$HTTP_RESPONSE" | tail -1)"
[[ "$HTTP_CODE" -eq 200 ]] || { echo "API error: HTTP ${HTTP_CODE}" >&2; exit 1; }
CONTENT="$(echo "$HTTP_BODY" | jq -r '.content // empty')"
[[ -n "$CONTENT" ]] || { echo "Empty memo content." >&2; exit 1; }
CLEANED="$(echo "$CONTENT" | awk '
BEGIN { printing = 0; skip = 0 }
/^## Objective$/ { printing = 1; next }
/^## Subjective$/ { skip = 1; next }
/^## Contexts$/ { skip = 1; next }
skip && /^## / { skip = 0 }
skip { next }
printing { print }
')"
CLEANED="$(echo "$CLEANED" | sed '/./,$!d' | sed -e :a -e '/^\n*$/{$d;N;ba' -e '}')"
TEMP="$(mktemp "${OUTPUT_PATH}.XXXXXX")"
echo "$CLEANED" > "$TEMP"
mv "$TEMP" "$OUTPUT_PATH"
echo "Synced → ${OUTPUT_PATH} ($(wc -c < "$OUTPUT_PATH" | tr -d ' ') bytes)" >&2
Make it executable: chmod +x sync-claude-md.sh
4. Test It
# Dry run — just print what would be written
CLAUDE_MD_MEMO_ID=your-memo-id bash sync-claude-md.sh --dry-run
# Live run
bash sync-claude-md.sh
5. Schedule It (macOS)
Create a launchd plist at ~/Library/LaunchAgents/com.yourname.sync-claude-md.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.yourname.sync-claude-md</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/path/to/sync-claude-md.sh</string>
</array>
<key>StartInterval</key>
<integer>21600</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/sync-claude-md.log</string>
<key>StandardErrorPath</key>
<string>/tmp/sync-claude-md.log</string>
</dict>
</plist>
Load it:
launchctl load ~/Library/LaunchAgents/com.yourname.sync-claude-md.plist
The script will run immediately (RunAtLoad) and then every 6 hours (21600 seconds). Adjust StartInterval to your preference.
6. Schedule It (Linux)
Add a cron entry:
crontab -e
# Add this line (every 6 hours):
0 */6 * * * /path/to/sync-claude-md.sh >> /tmp/sync-claude-md.log 2>&1
On Linux, replace the security find-generic-password call with however you store secrets (e.g., pass, environment variable, file with restricted permissions).
How to Update
Edit your CLAUDE.md memo in MythOS from any device — web, mobile, another computer. The next sync cycle picks up the change automatically. No git commits, no manual copying, no drift. If you need an immediate sync, run the script manually:
bash /path/to/sync-claude-md.sh
Architecture
MythOS Memo (source of truth)
↓ API fetch (every 6h + at login)
~/.claude/CLAUDE.md (Device A)
~/.claude/CLAUDE.md (Device B)
~/.claude/CLAUDE.md (Device N)
Each device runs its own sync job. All read from the same memo. One-way sync: MythOS → local. Edits go into MythOS, never into the local file directly (it gets overwritten on next sync). This is the piece that eliminated CLAUDE.md drift across my machines. Before the sync, my Mac Mini had corrections my laptop didn't, and my laptop had workflow updates the Mac Mini hadn't seen. Now I edit the MythOS memo from wherever I am — phone, web, another terminal — and every device picks it up. The correction I encode once propagates everywhere. That's @human-AI augmentation at the infrastructure level.
Contexts
- #agentic-augmentation
- #claude-code
- #collaborating-with-claude
- #mythos-feature
