How to Back Up Your Personalized AI Agent to GitHub

The more you use an AI agent, the more valuable it becomes. You customize its personality, add skills, teach it how you work, and build up memory and context. If the machine running it fails, rebuilding all of that from scratch would be painful.

A practical safety net is to back up the files that make your agent personal into a private GitHub repository β€” while carefully keeping secrets, tokens, and credentials out of it.

πŸ—‚οΈ What to back up

The goal is simple: (your personalized agent) βˆ’ (generic install) βˆ’ (secrets). Concretely, that usually means:

βš™οΈ
Configuration files

Model, provider, personality, terminal preferences, and other agent-level settings.

πŸ‘€
Personality / instructions

The role, tone, and rules that define how your agent behaves and responds.

🧠
Memory files

Long-term context and preferences β€” review carefully for personal info first.

⏰
Scheduled tasks

Cron jobs and recurring automations that are easy to forget during a rebuild.

✨
Custom skills

Scripts and workflows you created or modified for your specific needs.

🚫
Never include

Secrets, tokens, credentials β€” these must never go into the repo.

🚫 What never belongs in the repo

.env files
API keys and access tokens
OAuth and authentication files
Private URLs, chat IDs, or other sensitive identifiers

πŸš€ The backup workflow


Create a new repo dedicated to the backup and set visibility to Private. Initialize it empty β€” no README, no .gitignore, no license β€” so the agent can set it up cleanly.

In GitHub, go to Settings β†’ Developer settings β†’ Personal access tokens β†’ Fine-grained tokens. Restrict it to the backup repository only, with Contents: Read and write permission. Set an expiration date if you can β€” a leaked token with an expiry does far less damage.

Copy the token into a password manager. Never paste it into files that will be committed. If it is ever exposed, revoke it in GitHub immediately and generate a replacement.

Add the token through your agent’s configuration so it is stored as a secret, not inside the files you plan to back up. For example:

Ask the agent to commit the configuration, memory, skills, and scheduling files. Then open the repo and review every committed file β€” confirm that no keys, tokens, or private notes slipped in.

Once the first backup is clean, schedule a daily job and a notification after each run. Keep reviewing occasionally: automation is helpful, but it should not be blind.

πŸ’­ Final thoughts

A personalized AI agent becomes hard to replace once it holds your settings, memory, and workflows. A clean private GitHub backup gives you a restore path when hardware fails or you migrate machines β€” without turning GitHub into a secrets manager.

Inspired by a guide from Zawanah about backing up a Hermes agent to GitHub.

Leave a Reply

Your email address will not be published. Required fields are marked *