Set up, audit, repair, or restore a six-hour Azure DevOps workspace backup.
--- name: "dr-agent-backup" description: "Set up, audit, repair, or restore a six-hour Azure DevOps workspace backup." --- # DR. Agent Backup Use when setting up, auditing, repairing, or restoring backup continuity for a Daniel-owned agent. ## Outcome One deterministic, non-LLM systemd user timer is the only process allowed to commit and push workspace backups. Every six hours it stages safe restore-relevant files, commits when needed, and pushes to the approved Azure DevOps remote. A failed run invokes one rate-limited failure notifier. Conversational agents and health checks never run an independent `git push`. ## Required design 1. Use Pattern B1: a manifest-backed runner, not an agent/LLM or OpenClaw cron. 2. Use one `systemd --user` timer with `OnBootSec=5min`, `OnUnitActiveSec=6h`, `AccuracySec=5min`, and `Persistent=true`. 3. Make the runner load its manifest and credential contract at run time, set `GIT_TERMINAL_PROMPT=0`, and use the approved askpass helper. 4. Stage only allowlisted restore-relevant paths. Exclude credentials, env files, auth profiles, databases, logs, caches, media, raw transcripts, dreaming/reflection output, temporary/download/archive files, generated artifacts, and state migrations. 5. Scan staged names and text for high-risk credential patterns before committing. 6. Commit only intentional staged changes, push the approved existing remote and branch, write a local ledger outside Git, and exit non-zero on any credential, staging, commit, remote, or push failure. 7. Wire `OnFailure=` to one deterministic notifier. It sends an immediate concise failure message, suppresses identical repeats for 24 hours, and never sends success messages. 8. Do not run a scheduled health monitor by default. Add one only when its distinct detection value is documented and it cannot push or commit. ## Ownership rule The backup runner exclusively owns routine Git commit/push for the workspace. Agents may edit approved durable files but must leave them for the next runner. Do not use plain `git push` from an agent runtime; it does not inherit the runner's credential contract and creates false backup failures. ## Preflight Before enabling or manually running a new or repaired runner: 1. Confirm the existing approved Azure DevOps remote, branch, credential method, and valid provider target for failure notifications. 2. Inspect `git status --short` and classify each restore-relevant dirty path as intentional durable content, intentional deletion, generated/runtime artifact, or unresolved. 3. Keep raw session exports and state-migration artifacts untracked; do not broadly exclude curated daily memory files. 4. Refuse to arm a runner over unresolved or sensitive content. Correct the manifest, exclusions, or worktree first. 5. Verify the credential file exists with mode `600`, required key names are present without exposing values, and the askpass helper is executable. ## Setup and repair 1. Audit the existing manifest, runner, installed service/timer, failure handler, Git remote/branch, and worktree. 2. Create or repair the manifest, runner, local ledger, service, timer, failure notifier, and focused tests. 3. Validate JSON, Python/shell syntax, unit rendering, and `systemd-analyze --user verify`. 4. Dry-run notification rendering without live delivery. 5. Run one real backup after preflight is clean; verify its commit/push, ledger, and remote alignment. 6. Install and enable the timer; verify it is enabled/active and has a next trigger. 7. Retire duplicate backup timers, health checks, or agent-driven push paths after confirming the new owner is live. ## Default tracked scope Include: `AGENTS.md`, `SOUL.md`, `USER.md`, `TOOLS.md` when present, `MEMORY.md`, comments-only `HEARTBEAT.md`, curated `memory/**/*.md` and intentional durable JSON, `context_pipeline/**`, `automation/**` excluding runtime output, workspace-local `skills/**`, and active `doc_reviews/**/*.md`. ## Approval boundaries Ask Daniel before creating a repo or remote, changing credentials/PATs or access controls, using a new notification target or changing its cooldown, committing sensitive/customer data, deleting history, or rewriting commits. ## Shared release This is a shared fleet skill. Follow the shared-skill source-of-truth rule in `dr-agent-baseline`: after a behavior change, publish a new ClawHub version, verify the registry resolves it, then install/apply that exact release on each in-scope agent. Do not present a local Workshop or workspace revision as canonical. ## Completion evidence Report the runner and timer state, next trigger, real commit/push and remote alignment, notification policy, tracked/excluded scope, validation results, and any limitation. For a skill revision, also report the ClawHub version and verified fleet-application status. This skill does not replace VM snapshots or system backups.
don't have the plugin yet? install it then click "run inline in claude" again.
restructured original as 6-component format with explicit inputs, outputs, and decision branches; added network timeout and auth expiry edge cases; documented azure devops as external connection with credential methods; clarified secret restore flow and audit checklist as formal procedures.
use this skill when setting up, auditing, repairing, or restoring backup continuity for a daniel-owned agent. goal: agent memory and workspace state survive vm loss or migration. restore should be boring: clone/pull the repo, restore secrets separately, verify the agent starts, and reindex memory if needed. treat git as continuity for human-readable source of truth, not a full machine image.
azure devops setup:
workspace environment:
external connections:
edge cases to handle:
confirm azure devops credentials and access
git ls-remote <repo-url> before proceedinginitialize or connect workspace repo
git init && git remote add origin <repo-url>git remote -v.git/ directory present, origin remote configuredadd or update .gitignore
.gitignore file at repo rootrun dry-run status review
git status --short to list all changed and untracked filesmake initial commit
git add <intended-files> (or git add . if all reviewed files are safe)git commit -m "init: agent workspace backup" with clear messagepush to azure devops
git push -u origin main (or appropriate branch)record repo url and restore notes
git status --short to see what changedgit commit -m "<category>: <description>" with recommended style (e.g., "memory: capture gateway restore and embedding fix")git status --shortgit diff --cached --name-only and git diff --cached to review all staged contentgit reset HEAD <secret-file> to unstage itinstall openclaw and baseline packages
clone azure devops repo to workspace path
git clone <repo-url> <workspace-path>restore secrets and auth separately
install plugins and skills
verify gateway service
openclaw service status or check systemd service if linux user servicereindex agent memory
openclaw memory status --indexopenclaw memory index --force if reindex neededverify channels and delivery targets
run end-to-end dm test
document restore-specific notes
if workspace is already a git repo:
git remote set-url origin <correct-url>if azure devops pat is used for auth:
if ssh deploy key is used:
ssh-add <key-path>if network timeout occurs during clone or push:
if secret-bearing file is accidentally staged:
git reset HEAD <secret-file> to unstagegit rm --cached <secret-file> if already in historyif .gitignore is insufficient:
git status --short again to verify patterns workif restore finds uncommitted workspace changes:
git status to see what changed since last pushgit stashif memory reindex fails:
openclaw memory status to diagnoseif agent behavior asks to commit files containing private/customer data:
if agent is asked to create new azure devops repo, add credentials, or change access:
after setup:
.git/ directory present in workspace.gitignore file exists and blocks secrets, caches, databases, logsgit remote -v shows origin pointing to azure devops repogit log --oneline -3 and azure devops ui)after each commit:
git log --onelinegit diff --cached)after restore:
audit status report includes:
setup is complete when:
git remote -v shows origin pointing to azure devopsgit log --oneline shows at least one commitgit pull successfully without errorscommits are working when:
git log --oneline shows new commits after each meaningful changegit status shows clean working tree after pushrestore is complete when:
openclaw service status reports runningopenclaw memory status --index completes without errorsaudit is complete when:
git log -p -- ':!node_modules' | grep -i 'api.key\|token\|password' returns empty