feat: persist full workspace to R2, not just skills#88
Open
kn0wn wants to merge 1 commit intocloudflare:mainfrom
Open
feat: persist full workspace to R2, not just skills#88kn0wn wants to merge 1 commit intocloudflare:mainfrom
kn0wn wants to merge 1 commit intocloudflare:mainfrom
Conversation
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.
Author
jorgejhms
added a commit
to jorgejhms/moltworker-jorgejhms
that referenced
this pull request
Feb 1, 2026
Add complete backup of /root/clawd/ workspace (including memory, TOOLS.md, tov, etc) to R2, not just skills. This prevents data loss on container restart. Changes: - Add rsync of /root/clawd/ → R2 /clawd/ in sync.ts - Restore full workspace from R2 in start-moltbot.sh before legacy skills restore - Update tests to verify workspace backup is included - Remove unused mkdir -p /config from sync.ts This implements PR cloudflare#88 from upstream cloudflare/moltworker. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
jorgejhms
added a commit
to jorgejhms/moltworker-jorgejhms
that referenced
this pull request
Feb 1, 2026
Exclude .git and node_modules from /root/clawd/ backup to R2 to avoid syncing large unnecessary files. Aligns with PR cloudflare#88 upstream. - .git can be gigabytes for repos with long history - node_modules is hundreds of MB and easily regenerated Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
meirdick
pushed a commit
to meirdick/moltworker
that referenced
this pull request
Feb 1, 2026
Concrete spec covering: - Phase 1: Workspace persistence fix (Issue cloudflare#102/PR cloudflare#88) and Telegram/Discord DM config crash (Issue cloudflare#57/PR cloudflare#99) - Phase 2: OAuth token + authenticated AI Gateway (PR cloudflare#81) - Phase 3: Setup automation (already implemented) - Phase 4: Future items (openclaw rename, Terraform, etc.) Includes file-by-file change list, implementation order, and success criteria. https://claude.ai/code/session_01Qwm6uH94D7K688Kfcxg4L9
meirdick
pushed a commit
to meirdick/moltworker
that referenced
this pull request
Feb 2, 2026
Phase 1 — Critical bug fixes: - Extend R2 sync to include full /root/clawd/ workspace, not just skills. Fixes Issue cloudflare#102 where agent memory, identity, and workspace templates are lost on container restart. (ref: PR cloudflare#88) - Fix Telegram/Discord DM config crash by removing invalid `dm` sub-object. Uses flat `dmPolicy` property as OpenClaw expects. Adds `allowFrom: ['*']` for open DM policy. (ref: PR cloudflare#99, Issue cloudflare#57) - Clean up stale `dm` objects from configs written by previous versions. Phase 2 — Provider fixes: - Support ANTHROPIC_OAUTH_TOKEN for Claude Pro/Max subscriptions. - Reverse AI Gateway key precedence: direct provider keys now take priority; gateway key is passed as AI_GATEWAY_API_KEY for use in cf-aig-authorization header (BYOK authenticated gateway). (ref: PR cloudflare#81) - Add cf-aig-authorization header to provider configs in start-moltbot.sh. All 66 tests pass, typecheck clean. https://claude.ai/code/session_01Qwm6uH94D7K688Kfcxg4L9
bradoyler
pushed a commit
to bradoyler/openclaw
that referenced
this pull request
Feb 2, 2026
- Add full /root/clawd/ workspace sync to R2 in sync.ts - Exclude .git, node_modules, lock/log/tmp files from workspace sync - Add workspace restore logic in start-moltbot.sh before skills restore - Preserves agent memory, TOOLS.md, custom directories across container restarts - Maintains backwards compatibility with legacy /root/clawd/skills/ path Fixes: Agent memory loss on container restart Cherry-picked from: cloudflare/moltworker#88
sera-plz
added a commit
to unju-ai/unju-swarm
that referenced
this pull request
Feb 2, 2026
## Major Changes ### 1. Upgrade to OpenClaw Latest (v2026.1.30) - Install `openclaw@latest` instead of `clawdbot@2026.1.24-3` - Update all CLI commands to use `openclaw` instead of `clawdbot` - Change config paths from `~/.clawdbot/` to `~/.openclaw/` - Rename startup script: start-moltbot.sh → start-openclaw.sh - Rename config template: moltbot.json.template → openclaw.json.template ### 2. Full Workspace R2 Persistence (inspired by cloudflare#88) - **NEW**: Sync complete `/root/clawd/` workspace to R2 - Preserves SOUL.md, MEMORY.md, IDENTITY.md, USER.md across cold starts - Excludes .git, node_modules, *.lock, *.log files - Maintains backward compatibility with legacy skills-only backup - Prevents agent memory loss during container restarts ### 3. Comprehensive Rename: Moltbot → OpenClaw - TypeScript: `MoltbotEnv` → `OpenClawEnv` - Constants: `MOLTBOT_PORT` → `OPENCLAW_PORT` - Environment variables: `MOLTBOT_GATEWAY_TOKEN` → `OPENCLAW_GATEWAY_TOKEN` - R2 bucket: `moltbot-data` → `openclaw-data` - R2 mount path: `/data/moltbot` → `/data/openclaw` - Package name: `moltbot-sandbox` → `openclaw-sandbox` ## Files Changed (26 total) - Updated all TypeScript source files - Modified Dockerfile to install openclaw@latest - Enhanced R2 sync logic in src/gateway/sync.ts - Updated documentation (README.md, AGENTS.md) - Renamed and updated startup script ## Deployment Notes - Update environment variable: MOLTBOT_GATEWAY_TOKEN → OPENCLAW_GATEWAY_TOKEN - Update R2 bucket binding: MOLTBOT_BUCKET → OPENCLAW_BUCKET - Backward compatibility maintained in startup script Co-authored-by: Claude <noreply@anthropic.com>
sera-plz
added a commit
to unju-ai/unju-swarm
that referenced
this pull request
Feb 2, 2026
## Major Changes ### 1. Upgrade to OpenClaw Latest (v2026.1.30) - Install `openclaw@latest` instead of `clawdbot@2026.1.24-3` - Update all CLI commands to use `openclaw` instead of `clawdbot` - Change config paths from `~/.clawdbot/` to `~/.openclaw/` - Rename startup script: start-moltbot.sh → start-openclaw.sh - Rename config template: moltbot.json.template → openclaw.json.template ### 2. Full Workspace R2 Persistence (inspired by cloudflare#88) - **NEW**: Sync complete `/root/clawd/` workspace to R2 - Preserves SOUL.md, MEMORY.md, IDENTITY.md, USER.md across cold starts - Excludes .git, node_modules, *.lock, *.log files - Maintains backward compatibility with legacy skills-only backup - Prevents agent memory loss during container restarts ### 3. Comprehensive Rename: Moltbot → OpenClaw - TypeScript: `MoltbotEnv` → `OpenClawEnv` - Constants: `MOLTBOT_PORT` → `OPENCLAW_PORT` - Environment variables: `MOLTBOT_GATEWAY_TOKEN` → `OPENCLAW_GATEWAY_TOKEN` - R2 bucket: `moltbot-data` → `openclaw-data` - R2 mount path: `/data/moltbot` → `/data/openclaw` - Package name: `moltbot-sandbox` → `openclaw-sandbox` ## Files Changed (26 total) - Updated all TypeScript source files - Modified Dockerfile to install openclaw@latest - Enhanced R2 sync logic in src/gateway/sync.ts - Updated documentation (README.md, AGENTS.md) - Renamed and updated startup script ## Deployment Notes - Update environment variable: MOLTBOT_GATEWAY_TOKEN → OPENCLAW_GATEWAY_TOKEN - Update R2 bucket binding: MOLTBOT_BUCKET → OPENCLAW_BUCKET - Backward compatibility maintained in startup script Co-Authored-By: Claude <noreply@anthropic.com>
FrikkieSnyman
pushed a commit
to FrikkieSnyman/moltworker
that referenced
this pull request
Feb 2, 2026
Phase 1 — Critical bug fixes: - Extend R2 sync to include full /root/clawd/ workspace, not just skills. Fixes Issue cloudflare#102 where agent memory, identity, and workspace templates are lost on container restart. (ref: PR cloudflare#88) - Fix Telegram/Discord DM config crash by removing invalid `dm` sub-object. Uses flat `dmPolicy` property as OpenClaw expects. Adds `allowFrom: ['*']` for open DM policy. (ref: PR cloudflare#99, Issue cloudflare#57) - Clean up stale `dm` objects from configs written by previous versions. Phase 2 — Provider fixes: - Support ANTHROPIC_OAUTH_TOKEN for Claude Pro/Max subscriptions. - Reverse AI Gateway key precedence: direct provider keys now take priority; gateway key is passed as AI_GATEWAY_API_KEY for use in cf-aig-authorization header (BYOK authenticated gateway). (ref: PR cloudflare#81) - Add cf-aig-authorization header to provider configs in start-moltbot.sh. All 66 tests pass, typecheck clean. https://claude.ai/code/session_01Qwm6uH94D7K688Kfcxg4L9
FrikkieSnyman
added a commit
to FrikkieSnyman/moltworker
that referenced
this pull request
Feb 2, 2026
#1) Phase 1 — Critical bug fixes: - Extend R2 sync to include full /root/clawd/ workspace, not just skills. Fixes Issue cloudflare#102 where agent memory, identity, and workspace templates are lost on container restart. (ref: PR cloudflare#88) - Fix Telegram/Discord DM config crash by removing invalid `dm` sub-object. Uses flat `dmPolicy` property as OpenClaw expects. Adds `allowFrom: ['*']` for open DM policy. (ref: PR cloudflare#99, Issue cloudflare#57) - Clean up stale `dm` objects from configs written by previous versions. Phase 2 — Provider fixes: - Support ANTHROPIC_OAUTH_TOKEN for Claude Pro/Max subscriptions. - Reverse AI Gateway key precedence: direct provider keys now take priority; gateway key is passed as AI_GATEWAY_API_KEY for use in cf-aig-authorization header (BYOK authenticated gateway). (ref: PR cloudflare#81) - Add cf-aig-authorization header to provider configs in start-moltbot.sh. All 66 tests pass, typecheck clean. https://claude.ai/code/session_01Qwm6uH94D7K688Kfcxg4L9 Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)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:
/root/clawd/→R2/clawd/.git,node_modules, and temp filesstart-moltbot.sh:
R2/clawd/Backwards Compatibility
The legacy
/skills/path is preserved for backwards compatibility with existing R2 backups that only have the skills directory.Testing
/root/clawd/(e.g.,memory/test.md)Fixes agent memory loss on container restart.