Skip to content

Conversation

@kn0wn
Copy link

@kn0wn kn0wn commented Jan 31, 2026

Problem

Currently, only /root/.clawdbot/ and /root/clawd/skills/ are synced to R2 for persistence. This means agent workspace files are lost on container restart:

  • memory/ (agent memory/notes)
  • TOOLS.md (local tool configuration)
  • tov/ (tone of voice docs)
  • Any other custom directories the agent creates

This is particularly painful for agents that rely on persistent memory across sessions.

Solution

Add the full workspace (/root/clawd/) to the R2 sync:

sync.ts:

  • Added rsync for /root/clawd/R2/clawd/
  • Excludes .git, node_modules, and temp files

start-moltbot.sh:

  • Added restore logic for workspace from R2/clawd/
  • Workspace restore runs before the legacy skills restore

Backwards Compatibility

The legacy /skills/ path is preserved for backwards compatibility with existing R2 backups that only have the skills directory.

Testing

  1. Deploy with this change
  2. Create files in /root/clawd/ (e.g., memory/test.md)
  3. Wait for sync (5 min cron) or trigger manually
  4. Restart container
  5. Verify files are restored

Fixes agent memory loss on container restart.

Previously, only /root/.clawdbot/ and /root/clawd/skills/ were synced
to R2 for persistence. This meant agent workspace files like memory/,
TOOLS.md, and other custom directories were lost on container restart.

Changes:
- sync.ts: Add rsync for /root/clawd/ -> R2/clawd/
- start-moltbot.sh: Add restore for workspace from R2/clawd/

The legacy /skills/ path is preserved for backwards compatibility
with existing backups.

Fixes agent memory loss on container restart.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant