Library

Bot template tutorial

Let your bot keep a second brain on GitHub, and back up and restore your bots every night

By Šarūnas Vaitkus · about a 7-minute read

When you run several bots, two things go missing fast. The first is one trusted place for the facts about you and your work, so each bot stops guessing from its own patchy memory. The second is a safety net: if a bot's routines, memory or rules get broken or wiped, you want last night's copy back. Your bot can set up both in one private GitHub repository. One folder holds your second brain, which your bots read. A separate branch holds a nightly backup of every bot, which you can restore from. You send the prompts below, in order.

Fill once

These fields match the blanks in this tutorial only. What you type is used to fill the prompts on this page, and nowhere else. It is not saved, stored, or sent, and it is forgotten when you leave.

Progress0 of 7

What you need

  • A GitHub account.
  • A new, empty private repository that you create yourself on GitHub before you start (see below). Your bot connects to it later, in step 4.
  • Two or more bots, or one bot with routines and memory you'd hate to lose.
  • About 20 minutes, plus one minute on GitHub to make an access token.

How it works

You send a prompt, the bot does the work, and you approve what matters.

Highlighted [brackets] are blanks. The fields above fill the ordinary ones. Anything private stays a bracket until you add it in the chat.

  1. Step 1. Draft the second brain on your bot's computer

    Prompt to send

    I've created an empty private GitHub repository called [second-brain]. You don't have access to it yet; we'll connect it later. For now, on your own computer, set up a brain/ folder with a profile file (who I am and how I work), a topics file (my projects, one short entry each) and a sources folder for raw notes. Fill the first drafts from what you already know about me, mark anything you're unsure of, and show me the files.

    Why you're sending it

    One private repo gives every bot the same facts, with full history of every change. Drafting first means you check the content before anything is pushed.

    What you'll get

    A first draft of your profile and project list, waiting for your check. It goes into the repo in step 4.

  2. Step 2. Name one bot as the owner

    Prompt to send

    Make [bot name] the only bot that writes to brain/. Every other bot reads it and, when they learn something new, tells [bot name] to add it instead of keeping their own copy. Write this rule down so all my bots follow it.

    Why you're sending it

    If every bot writes its own version, you end up with five copies that disagree. One writer keeps one truth.

    What you'll get

    A standing rule: one bot updates the second brain, the rest read it and pass on new facts.

  3. Step 3. Make every bot read it first

    Prompt to send

    From now on, before you answer anything about my projects, my work history or my CV, read the second brain first. Don't copy its contents into your own memory. Keep only a pointer to where it lives, and read it fresh each time.

    Why you're sending it

    Bots that answer from memory drift. Bots that read the source stay right.

    What you'll get

    Answers that match your second brain, not an old guess.

  4. Step 4. Connect the repo: fine-grained token or SSH key

    Prompt to send

    Connect to my private repo [owner/second-brain]. First test whether you can reach GitHub over SSH from your computer. If you can, give me a deploy key to add with write access. If you can't, ask me for a fine-grained token limited to that one repository, with Contents set to Read and write and nothing else, and save it as a private secret, never in chat or in a file you commit. Then push the brain/ drafts from step 1 and show me the commit.

    Why you're sending it

    The safest access is the smallest one: one repo, one permission, saved where only your bot can use it.

    What you'll get

    A tested connection, access that can't touch anything else you own, and your second brain's first commit.

  5. Step 5. Back up every bot, every night

    Prompt to send

    Every night at about 2am, back up all my bots to the same repo, on a separate branch called agent-backups, so it never mixes with brain/. Include each bot's profile and settings, routines, memory, rules and skills, action logs and conversation history, plus my shared skills and any tracking files. Take routines and memory from the app's own lists, not only from files on your computer, because those files can be an old copy. Never include passwords, vault data, cookies or tokens: run a secret scan before every push, and if anything is flagged, don't push it. Only message me if a night fails.

    Why you're sending it

    Routines, memory and rules take weeks to build and seconds to lose. A nightly copy with git history means you can go back to any night.

    What you'll get

    One shared nightly job, a branch that only holds backups, and silence unless something goes wrong.

  6. Step 6. Test a restore before you need one

    Prompt to send

    Do a dry run of a restore from the agent-backups branch, without changing anything on my bots. Pick one bot, one routine and that bot's memory. Copy last night's backup and what the bot has now into a scratch folder and list every difference. Then check the backup is current: compare the newest memory entry and the list of routines with what the app itself shows today, not just with files on your computer. Finally, write down the exact steps a real restore would take, and say which parts can't come back from files alone.

    Why you're sending it

    A backup you've never restored is a guess. A dry run on one small piece shows what's really in it while nothing is on fire.

    What you'll get

    A short report: the differences, how fresh the backup is, and a restore plan in plain steps. Expect it to split into three kinds: - Plain files, like shared skills and tracking files: copied straight back. - Routines, memory and bot settings: recreated through the app from the saved text, because the app, not the files, runs them. - Conversation history, run history and secrets: kept for reference or left out on purpose, so they don't come back. You re-enter tokens and logins yourself.

  7. Step 7. Keep it healthy

    Prompt to send

    Once a month, check the backup branch: did every night run, is the newest memory entry and routine list as fresh as what the app shows, how big is the repo getting, did the secret scan catch anything, and does my token expire soon. Only message me if something needs my action.

    Why you're sending it

    Tokens expire, repos grow, and a job that fails quietly is worse than no job.

    What you'll get

    A monthly check that stays quiet until something needs you.

All in one (optional)

Prefer one prompt? Send this instead.

Prompt to send

I've created an empty private GitHub repo called [owner/second-brain]. Set it up as my second brain and my bots' backup, in this order: a brain/ folder drafted on your computer from what you know about me, one bot named as its only writer, a rule that every bot reads it first, a connection to that one repo (test SSH first; if it's blocked, ask me for a fine-grained token limited to that repo) and the first push, a nightly backup of all my bots to a separate agent-backups branch with secrets scanned out and routines and memory taken from the app itself, a dry-run restore of one bot's routine and memory that also checks the backup is current, and a monthly health check. Pause after each step to show me what you did. Ask me before restoring anything, deleting anything or changing access.

What your bot will always ask you first

  • Creating or changing access tokens or keys.
  • Restoring anything over a bot's current setup.
  • Deleting files, branches or backups.
  • Making the repo public or sharing it.
  • Spending money.

It bundles its questions, so you're not pinged all day.

Start with the first prompt. You'll see the files before anything is committed.

Tap a pumpkin. Hold it to show how strongly.

0 answered