Full Byte Developer.

Claude Code for personal automation: dots, backups, Compose

Automate dots, backups, and Compose with hooks and deny rules so local mistakes stay contained.

Published here , updated · 7 sources

Personal automation with Claude Code needs deny rules before Compose edits. Automate dots, backups, and Compose files with PreToolUse hooks that exit 2 on risky paths, and run docker compose config or --dry-run before apply so local mistakes stay contained. [1] [2]

After this page you can put home automation under one root, draft Compose services then validate before up, script backups with a restore dry-run, and gate local services with hooks. Related: Claude Code deny rules for the permission floor, Tailscale for agent machines when the box is remote, Claude Code for personal scheduling for calendar-side automation. Browse the Claude Code topic.

Put the home automation repo under one root

Keep dotfiles, compose.yaml, backup scripts, and file-organization rules in one git repo Claude opens as the project. Best practices say to tell Claude what it cannot see from code alone: mount paths, which hosts are production for you, and which volumes are sacred. [3]

text
~/src/home-ops/
  compose.yaml
  dots/
  backup/
  CLAUDE.md

You should open claude from that root so relative paths stay inside the repo.

Draft Compose services, then validate before up

Compose documentation covers services, volumes, networks, and the docker compose CLI. Ask Claude to edit compose.yaml, then run docker compose config as the check before any up. [1] [3]

bash
docker compose config
docker compose up -d --dry-run

Refuse down -v in agent sessions that manage backup volumes. Put that refusal in a hook, not only in prose. [1] [2]

You should see a rendered config with no unresolved variables before containers start.

Script backups with a restore dry-run as done

Backup scripts need a restore check. Have Claude write backup.sh and restore-dry-run.sh that list archive contents without writing over live data. Best practices treat a re-runnable check as finished work. [3]

bash
./backup/backup.sh
./backup/restore-dry-run.sh latest

Warning: never point restore at the live home directory from chat. Use a scratch target first. [3]

Organize files with rules Claude can re-apply

Describe inbox folders, naming patterns, and quarantine paths in CLAUDE.md. Ask Claude to move only under those trees and to print a plan before any mv. Pair with deny rules so Bash(rm *) and reads of .env stay blocked. [3] [5]

.claude/settings.json
{
  "permissions": {
    "deny": [
      "Bash(rm *)",
      "Bash(docker compose down *)",
      "Read(./.env)",
      "Edit(/etc/**)"
    ]
  }
}

See Claude Code deny rules for the same floor pattern on other repos. [5]

Gate local services with hooks and optional systemd units

Hooks can block tool calls that match destructive Compose or backup paths (exit 2). For long-running host services, systemd's manuals document unit files if you manage services outside Compose. Keep unit edits in git and install them with a command you run yourself. [2] [4]

bash
systemctl --user cat backup.timer

If the machine is reached over a tailnet, read Tailscale for agent machines before you expose agent ports. For calendar automation, use Claude Code for personal scheduling. [6] [7]

You now have a personal automation loop: one home-ops repo, Compose config check, backup restore dry-run, deny rules, hooks on destructive commands.

Send this to the solo operator who wants Claude editing Compose without wiping backup volumes.

Keep this guide

By Full Byte Developer

Filed under Claude Code, Dev tools

Questions about this guide

Is this the homelab branding page?

No. This slug is claude-code-for-personal-automation. Same class of work (dots, Compose, local services), different URL.

Where do Compose file rules live?

Docker Compose docs cover the Compose file, services, volumes, and networks. Keep compose.yaml as the source Claude edits under review.

How do hooks help on a personal machine?

Claude Code hooks can block rm of backup mounts, writes under /etc, or docker compose down that drops named volumes. Exit 2 refuses the tool call.

Should I allow Claude to edit deny rules away?

No. Keep deny rules in project settings and treat them as the hard floor. See the deny-rules page for the pattern.

Sources

Next in this stack