Anwar Bouilouta

Prompts, Loops and Graphs: The Template I Use to Map Mine

Stop babysitting AI one message at a time. Work out which of your jobs needs a prompt, a loop or a graph, then map your own.

A free guide by Anwar Bouilouta 5 min read

Back to all free guides

So in the reel I explained prompts, loops and graphs with a kitchen. This is the template I use to map my own jobs, plus what you need to get one running today.

The three levels, in a kitchen

  • A prompt is ordering one dish. You ask, it comes out, and whether it's any good is down to you.
  • A loop is the chef tasting it. If it's off, they fix it and taste again, and after three goes they come and find you.
  • A graph is the whole kitchen. Every station is a step, and the rules between the stations decide what happens next.

Every station still runs its own prompt and its own taste test, so you're never picking one over the others. A graph is basically a load of little prompts and loops joined up with arrows.

Which one does your job need?

  • A one-off job, prompt it. "Rewrite this email so it's shorter."
  • Something you can mark right or wrong, loop it. "Every invoice line has a price and a VAT rate."
  • The same steps every week, graph it. Your weekly report, your content calendar, chasing new leads.

What every loop needs

  1. One job. One thing goes in, one result comes out. "Write the caption for this reel."
  2. A check that can fail. "Make it good" can't fail, so it isn't a check. "Under 150 characters" can. So can "mentions the product name" and "every number links to where it came from".
  3. The fix. When the check fails, the reason goes back in as the next instruction. "You're at 190 characters, cut 40."
  4. A limit. Two or three goes, then it stops and tells you. Without one it'll go round and round eating your usage.

The four moves on a graph's arrows

Every arrow between two steps says one of these:

  • Next. It passed, so move on.
  • Again. It failed, so send it back with the reason.
  • Stop. It's failed too many times, or there's nothing to do, so end the run and write down why.
  • Ask me. It needs a person. Put one of these before anything that sends, posts, pays or deletes.

Then there's a notepad that travels with the job, which developers call the state: the dates, the numbers, the draft, what passed and what didn't. It's how step four knows what step one found.

A real one: my keyword DMs

If you commented GRAPH to get here, you've just been through this one.

  1. You comment the keyword, and you get a reply and a DM with a button.
  2. You tap it, and it checks whether you follow me.
  3. If you do, you get the link. If you don't, it asks you to, checks again after 8 seconds and again 15 seconds later, and sends the link as soon as the follow shows up.
  4. About 22 hours later, you get one follow-up message.

Every box is a step, every "if" is an arrow, and I don't touch any of it.

The template I use to map mine

Paste this into Claude or ChatGPT. You can talk your answers out loud if that's easier.

Graph mapper prompt
I want to turn one job I keep doing into a graph that an AI can run for me.

Start by asking me to describe the last time I did this job, from the moment it started to the moment it was finished. Ask me one question at a time and wait for each answer.

Then write it up for me:
1. The trigger. What starts the job, and how often it happens.
2. The steps. Between 3 and 8 of them, each one a verb and a thing, like "Pull last week's numbers".
3. For each step, one test that can actually fail: a count, a limit, a match against a source file, or a set format. Only use "I'll look at it" when nothing else works.
4. Where each arrow goes: next, again (with the reason why, 3 tries at most), stop, or ask me.
5. An "ask me" step before anything that sends, posts, pays or deletes.
6. The notepad: everything that has to be carried from one step to the next.
7. The whole job on one line, like this: Trigger > Step 1 > Step 2 > Ask me > Done.

Then ask me if you've got it right. Once I say yes, write the prompt for each step so I can save the lot as a Claude skill or a scheduled task.

Blank template

Prefer to sketch it yourself first? Fill this in, then paste it into the mapper prompt above.

Fill this in
Job:
Starts when:
How often:
The finished result goes to:

Step 1:
  Check:
  If it fails:
Step 2:
  Check:
  If it fails:
Step 3:
  Check:
  If it fails:

Ask me before:
Carry between steps:
Stop when:

Where to run it today

  • No code, the Claude app. On any paid plan, describe the job and how often you want it, then click Schedule. It runs on Anthropic's side, so your laptop can be shut. Save your steps as a skill first, then have the scheduled task run that skill.
  • One loop in Claude Code. Type /goal and what done looks like. A separate model checks it after every turn, so ask Claude to show the proof, and add "or stop after 20 turns".
  • The whole graph in Claude Code. Say "use a workflow" and describe your steps and checks. /workflows shows the run while it works, and once a run does what you wanted, the s key keeps it as a command you can call again. On the Pro plan, switch workflows on in /config first.
  • On a timer in Claude Code. /loop 30m followed by your prompt runs it every 30 minutes while the session's open.

Start with one loop this week. Once you trust it, join a few together, and that's your first graph.

Community now open

My AI Growth Room on Skool is free to join, and the Claude editing skill I use for my reels is in there.

Join free

Where to next

Three ways to get it done

Do it yourself

Free

Every guide points you at one AI tool that's worth your time, with the prompt or checklist to set it up yourself.

See all free guides

Done with you

Community now open

Go from watching AI videos to using AI in your own work every week, with live help and a group doing it alongside you.

Join free

Done for you

With ABAI

For owners of B2B businesses with a bottleneck that's costing them clients. We find it, then build the AI growth system that fixes it, in your own tools and on a fixed fee.

Book a strategy call