Backup to your own server
A nightly script copies your memories, rules and files with a read only backup key.
A plain script (cron, no agent, no tokens spent) copies everything you read in a team to your own server. Run it nightly; after the first run it only fetches what changed.
1. Create a backup key
Team settings, Devices, Create backup key. Copy the key (srx_...), it is shown once. Store it on your
server, readable only by the backup user:
install -m 600 /dev/stdin /etc/axs-mem-backup.key <<< 'srx_...'The key only reads, only the backup routes below. It does not work for agents (MCP, hooks) or the dashboard. It
sees what you read in that team; one key per team. Revoke it under Devices like any device.
2. Fetch
Every call sends Authorization: Bearer srx_.... At most 120 calls per key and hour.
GET https://mem.axs.sh/api/v1/backup answers JSON:
generated_at: send it as?since=next time to get only changes.memories: every memory, retired ones too (withsince: only those changed after it). Each hasid,name,space,type(rule, procedure, fact, ...),scope,description,text,aliases,expires(valid until),status,retired,modified_at,meta(the whole frontmatter) andraw(the full Markdown file).memory_ids: all memory ids now. An id you have that is missing here was deleted.rules: your enforced rules in full, always all.files: files withname,size,sha256anddownload(withsince: only new ones).file_ids: all now.spaces,team: names and descriptions.
GET https://mem.axs.sh/api/v1/backup/files/{id} redirects to the file's bytes (send the key, follow the
redirect).
3. The script
Keeps memories.json, rules.json and files/ in one folder and applies only the changes each night.
#!/bin/sh
# /usr/local/bin/axs-mem-backup
set -eu
KEY=$(cat /etc/axs-mem-backup.key)
DIR=/srv/backup/axs-mem
mkdir -p "$DIR/files"
SINCE=$(cat "$DIR/since" 2>/dev/null || true)
curl -fsS -H "Authorization: Bearer $KEY" \
"https://mem.axs.sh/api/v1/backup${SINCE:+?since=$SINCE}" > "$DIR/new.json"
KEY="$KEY" python3 - "$DIR" <<'EOF'
import json, os, subprocess, sys
d = sys.argv[1]
new = json.load(open(f"{d}/new.json"))
path = f"{d}/memories.json"
mem = json.load(open(path)) if os.path.exists(path) else {}
mem.update({m["id"]: m for m in new["memories"]})
keep = set(new["memory_ids"])
mem = {i: m for i, m in mem.items() if i in keep}
json.dump(mem, open(path, "w"), ensure_ascii=False, indent=1)
json.dump(new["rules"], open(f"{d}/rules.json", "w"), ensure_ascii=False, indent=1)
for f in new["files"]:
out = f"{d}/files/{f['id']}-{f['name'].replace('/', '_')}"
if not os.path.exists(out):
subprocess.run(["curl", "-fsSL", "-H", "Authorization: Bearer " + os.environ["KEY"],
"-o", out, "https://mem.axs.sh" + f["download"]], check=True)
open(f"{d}/since", "w").write(new["generated_at"])
EOFRun it nightly:
chmod +x /usr/local/bin/axs-mem-backup
echo '30 3 * * * root /usr/local/bin/axs-mem-backup' > /etc/cron.d/axs-mem-backupTo start over with a full copy, delete since.
Restore
raw of each memory is the Markdown file axs mem stores. Put them in a folder and ask your agent to import it
(see Import agent notes), or keep them as plain notes.