Automation with Claude Code
Everything from the session in one place, end to end: installing the app, keeping API keys safe, what APIs and MCPs are, and how we built a weekly AI agent that keeps an eye on our competitors.
The route through these notes
What you need
Mac or Windows
An Apple Silicon Mac (M1 or later) on macOS 13 or later, or a PC on Windows 10 version 1809 or later. On an Intel Mac, use the Claude desktop app, because Originate Terminal doesn’t have an Intel version.
Pro or above
Claude Code comes with Pro, Max, Ultra, Team and Enterprise plans. The free plan doesn’t include it.
Workers Paid
US$5 a month. The free plan stops a job after 10 milliseconds of computing, which is too short for this one.
You’ll also need accounts with the services your automation uses. For ours, that’s OpenRouter, Apollo and Resend, and 2. API keys we need lists what each one costs.
Ways to use Claude Code
Claude Code runs in several places, all on the same engine, so your work carries across. We use Originate Terminal, and everything in these notes is shown there.
Originate Terminal
Our free, open-source app for working with Claude Code. Each job gets its own project and folder, with a browser beside the conversation.
Install
- Go to the latest release and download the .dmg. It runs on Apple Silicon Macs (M1 and later).
- Open it and drag Originate Terminal into Applications.
- Open it. Apple will block it the first time, because the app isn’t notarised yet. Open the Terminal app, paste this line once, press Return, then open it again.
xattr -cr "/Applications/Originate Terminal.app"Install
- Go to the latest release and download the file ending setup.exe.
- Run it. If SmartScreen appears, click More info, then Run anyway.
Add Claude Code
The first time it opens, the app asks you to choose your code folder, then checks for Claude Code. If it’s missing, open a new tab, paste the line for your computer, press Return and restart the app.
curl -fsSL https://claude.ai/install.sh | bashirm https://claude.ai/install.ps1 | iexAfter this you talk to Claude in plain English, and Claude handles anything technical.
Start a project
- Click + next to Projects, choose New Folder, call it automations and click Open.
- Click + next to automations to add a folder for your job, such as rival-rag, then click it to open a tab.
- Type claude and press Return. The first time, a page opens so you can sign in to your Claude account.
% claude
✻ Welcome to Claude Code
●What would you like to build?
New project from folder
Documents
Code
automations
The code is public at github.com/Originate-Group/originate-terminal, under the MIT licence.
Permissions
Claude Code can read files, change them and run things on your computer. The mode you choose decides how much it does before checking with you.
●I’ll remove the old drafts first.
⎿ Done, and you stayed in charge of each step
New sessions in a terminal start in Auto on current versions of Claude Code, so Claude won’t stop to ask about routine steps. To approve each step yourself, as in our pictures, press Shift and Tab to switch to Manual. The line under the prompt shows which mode you’re in. If you’re asked something you don’t understand, ask Claude to explain it before you answer.
Keeping API keys safe
An API key can spend your money and read your data, so every key gets a home, a limit and a way to be replaced. Claude only needs a key’s name, and it never needs to see the value.
Say no and ask for another way. Anything typed into the chat is kept in the session’s history.
Limit each key
If a key leaks
- Delete it at the service, which stops it working straight away.
- Make a new one and save it in your password manager.
- Replace it on Cloudflare’s secrets page.
- Check the service’s usage page for anything you don’t recognise.
●Delete it at the service now, then make a new one and replace it on Cloudflare. I’ve opened the page.
API keys
Deleted. That key stopped working straight away.
What is automation?
Automation is getting a computer to do a job you’d otherwise do by hand, starting at a set time or when something happens.
What is automation?
Automation is getting a computer to do a job you’d otherwise do by hand, starting at a set time or when something happens.
What is an agent?
An agent is an AI model that can use tools and decide its own next step, working towards a goal until it’s done. Claude Code is an agent.
What is an agent?
An agent is an AI model that can use tools and decide its own next step, working towards a goal until it’s done. Claude Code is an agent.
↻ Repeats until the goal is met
Reads their website and spots a new price
Opens the prices page to check it
Searches the news for more
Done: files the story, with its source
Script and agentic automation
Both run by themselves. A script follows fixed steps, and an agent is given a goal and works out the steps each time. An automation doesn’t have to use AI, and many jobs can be done entirely by script.
Script and agentic automation
An automation doesn’t have to use AI. Many jobs can be done entirely by script.
Script automation
Follows the same steps, in the same order, every time.
“Every Monday, test these websites and email me the slow ones”
Agentic automation
Gets a goal, and decides the steps as it goes.
“Find out what my competitors did this week and what it means for sales”
✻Home page first. What do they sell?
✻They list prices. I’ll open that page.
✻Is there any news? I’ll try their blog.
✻A new article, dated last week. Worth a story.
✻Can I prove it? I’ll quote the page.
✻That one’s covered. Who’s next?
Checks a website’s PHP, WordPress and plugin versions against public lists, then emails a report.
Finds slow websites every Monday. The steps never change, and AI only searches and writes them up.
Gets one goal, then chooses what to read, what to search and when to stop.
Our website scanner is entirely script, with no AI in it. Prospect Scout, our weekly job that finds slow websites, is a fixed script with two AI steps. The Rival Rag is agentic: it gets a goal and chooses each step itself, and OpenRouter is how we bring in the model that does the choosing. Start with a script when the job is the same every time, and use an agent when the job needs judgement.
Claude desktop
You can do some of this in the Claude desktop app, with no code. A scheduled task gives Claude the same instructions each time, so it’s agentic automation.
New session
Scheduled
Customise
Send this invoice to Example Legal
The Xero connector is read only, so I can look at your invoices, but I can’t create or send them.
- In the Code tab, click Scheduled in the sidebar or its More menu, then New task. If a menu opens, choose Set up manually.
- Give it a name, write what Claude should do, pick a folder and choose how often it runs.
- Click Create, then Run now to try it.
You can also just ask: “Set up a task that reads this week’s enquiries every Monday at 8am and drafts a reply to each.”
Connectors are quick to add, and they have limits. The Xero connector in Claude desktop is read only, so Claude can look at your invoices but can’t create or send them. Why we use Claude Code shows the difference.
Why we use Claude Code
The basic integrations are a quick start. Going through Claude Code and the service’s API gives us much more control, and Xero is a good example.
Why we use Claude Code
The basic integrations are a quick start. Going through Claude Code and the service’s API gives us much more control, and Xero is a good example.
A connector can only do what its makers built. With Claude Code and an API, we choose what it can do, and we can have it ask before anything goes out.
Giving Claude more reach means taking more care. Limit each key to what the job needs, and keep Claude asking before anything goes out.
What is an API?
An API is an encrypted way to safely push or pull data from one program to another. It works like a cash machine, where you press a button and get what you asked for without ever going into the vault.
What is an API?
An API is an encrypted way to safely push or pull data from one program to another. It works like a cash machine, where you press a button and get what you asked for without ever going into the vault.
For our job, the program asking is The Rival Rag, and one of the services answering is OpenRouter. Nearly every service you use has an API, including Stripe, Xero and Cloudflare, which is how Claude can connect them together for you.
API keys
An API key is a password for a program. It tells the service who’s asking and what they’re allowed to do.
The right key
Here’s your data
An old key
Refused. Nothing comes back
Most services let you choose what a key can do, so give each one the least it needs for its job. Some services call them tokens, and they work the same way.
Restricted keys and scopes
A scope is one thing a key is allowed to do. A restricted key has only the scopes its job needs, so a leaked key can’t do much harm. It’s like a card that can check your balance but can’t take out cash.
Restricted keys and scopes
A scope is one thing a key is allowed to do. A restricted key has only the scopes its job needs, so a leaked key can’t do much harm. It’s like a card that can check your balance but can’t take out cash.
Services use different names for this, including permissions, restrictions and endpoints. When you make a key, look for that section first and turn on only what the job needs. If the job later gets refused, add the one scope it was missing.
What is an MCP?
An MCP is a plug that connects a service to Claude. Plug one in, sign in once, and you can ask Claude about that service while you chat.
What is an MCP?
An MCP is a plug that connects a service to Claude. Plug one in, sign in once, and you can ask Claude about that service while you chat.
“Who runs this company?”
“Which invoices are overdue?”
“Find last month’s report”
An MCP suits you working with Claude. A job that runs at 7am with nobody signed in uses an API key.
To add one, ask Claude “What can you connect to?” or “Connect Apollo”. You sign in on the service’s own page, so there’s no key to copy.
GitHub and the GitHub CLI
GitHub is where code is kept online, with every version saved. The GitHub CLI is GitHub’s own tool, which lets Claude Code use GitHub for you.
●I’ll use the GitHub CLI. A page will open so you can sign in once.
⎿ Signed in to GitHub
⎿ Saved: rival-rag
⎿ Saved, and the last version is still there if you need it
your-name / rival-rag Private
rival-rag
Every saved version of the job.
Every version
You can go back to any earlier version, and nothing is lost if your laptop dies.
Your choice
Start private. Originate Terminal and the create-automation skill are public, so anyone can use them.
Ask to save
Say “save this to GitHub”. Claude can set up the GitHub CLI, and you sign in once on a web page.
Ask Claude to check it for keys and private details first. The create-automation skill includes a scan that does this.
Scheduled jobs
A scheduled job runs on its own at set times, such as our weekly competitor newspaper. Most systems write the timing as five values, called a cron expression. You won’t need to write one, because Claude does it.
0 7 * * 1 means every Monday at 7am.
Times are in UTC, so 7am UTC is 8am during British Summer Time.
A job doesn’t have to wait for a set time. It can also start the moment something happens, such as an email arriving in your inbox. Cloudflare can do this for addresses on your own domain, using Email Workers, so tell Claude what should set the job off when you plan it.
Cloudflare and Workers
We make a Cloudflare Worker, which is where the job lives. It holds the code and the API keys, and it runs on Cloudflare’s computers, so your laptop can be off.
Worker or container
Worker or container
The Rival Rag
Asks other services to do the work, then passes on the answers.
Podcast clip maker
Cuts a recording into captioned clips, so it needs video software inside the box.
Clips ready, and emailed to you
If the job only calls other services, use a Worker. If it needs its own software in the box, use a container.
Connecting Claude to Cloudflare
The simplest way is to sign in. Claude opens a page, you click Allow, and that’s it.
●I need to sign in to Cloudflare. I’ve opened the page beside us. Please click Allow.
⎿ Signed in to Cloudflare
Allow access to Cloudflare?
Claude Code is asking to work with your Cloudflare account.
Allowed ✓You can close this page and go back to Claude.
You can also make an API token, which lets you choose exactly what Claude can do. Suggested Cloudflare setup shows the permissions and zones to begin with.
Cloudflare permissions
Every permission has three parts: what it applies to (your account, a zone or your user), the area, and a level. Read lets a token look, and Edit lets it make changes. A zone is one domain on Cloudflare, with its DNS records and settings.
●Each one has three parts: what it applies to, the area, and whether it can only look or can also change things.
Permissions
The least each job needs
Zone permissions
Suggested Cloudflare setup
Begin with a token that can run Workers and can only look at one low-stakes domain. You can add more later, one permission at a time.
- Sign in at dash.cloudflare.com, then open My Profile, API Tokens, Create Token.
- Next to Edit Cloudflare Workers, click Use template, then adjust the permissions to match the list above.
- Under Zone Resources, choose Specific zone and your domain. Under Account Resources, choose your account.
- Add an end date under TTL while you’re testing, then click Continue to summary and Create Token.
- Copy it into your password manager, because Cloudflare only shows it once. Then ask Claude how to add it safely, and don’t paste it into the chat.
Which zones to begin with
No zone at all
A Worker on its free workers.dev address needs no zone. The Rival Rag runs this way.
One spare domain
Choose Specific zone and a domain nothing important depends on. Give it Read access first, then DNS Edit when you’re ready to practise.
Your main domain
Add it once you’ve done the job on the spare one. Your email depends on its DNS records, so give DNS Edit an end date.
All zones reaches every domain you can get to, including clients’. The Global API Key on your profile page can do almost anything. Neither is needed here.
Domains and DNS
A domain is your website’s name. DNS is the address book that turns that name into the place your website and email live.
The automation
The Rival Rag is the automation we decided to create. Every Monday an AI agent finds out what our competitors did that week and what it means for our sales, then emails us the news as a tabloid newspaper.
No email selected
THE RIVAL RAG: Counter attack!
The Rival Rag <rag@yourdomain.co.uk>
To Aaron Kennedy · Monday 07:02
Counter attack!
Anytown Kitchens has knocked £200 off fitting and is shouting about it on its home page. The offer runs to the end of the month.
Counter attack!
Anytown Kitchens has knocked £200 off fitting and is shouting about it on its home page. The offer runs to the end of the month, so expect shoppers to wave it at you.
On their site now · Read it at anytownkitchens.example
Hired hands
Sample & Sons is advertising for three fitters, so it’s either busy or growing. Read the advert
The sales desk
1. “Ask what the guarantee covers before you compare prices.”
2. “We can start this month, while others are busy.”
It only reads public pages and never contacts anyone. Every story links to its source and has to show its proof, and the headlines are for fun. This example uses made-up businesses.
The real issue on the slides
The issue we showed in the session is real. We pointed the agent at Wix and told it to stick to AI news. It took 11 steps and 53 seconds, read 8 pages, ran 3 searches and cost 42 US cents. The fact check refused one of its stories, and the agent fixed it and filed it again.
Why it’s agentic
A script needs every step written out in advance. The agent gets the goal and works out the steps, so each competitor gets a different route. In our first full issue it found one rival’s updates page and followed up two launches, saw that another’s newest blog post was from 2025 and moved on, and reported that a third blocked most of its pages instead of guessing.
How it breaks down
We use Claude Code to write it. The rest runs online, like a small newsroom, and OpenRouter is there because it’s agentic.
Opens every Monday at 7am, with our computer off
Search the web, read pages and compare with last week
Competitors’ staff numbers and job adverts
One API for all the AI models, and how we bring in agentic AI. It decides what to chase next
Refuse any story without proof, and stop it at its limits
Last week’s pages and stories
Drops the paper in your inbox
How it all pulls together
This is the design of the automation: what sets it off, the agent choosing its next step, the tools it can pick from, the guardrails, and where the results go.
✓ Ready before you’ve had your coffee, and your computer can stay off
1. Planning
We describe the job in plain English, the way we’d brief a colleague. Claude asks what it needs to know, then writes the plan as a short document for us to approve. Changing a plan takes seconds, so this is where we get the job right.
●Which competitors should I keep an eye on?
●What should it never do?
What we want
Using the create-automation skill, Claude asks these questions for you. Or press Shift and Tab until you see plan mode, then paste this with your own details filled in:
Every Monday at 7am, run an agent that finds out what these competitors did that week and what it means for my sales: [YOUR COMPETITORS]. My business is [WHAT YOU SELL, AND WHO TO].
Give the agent tools to search the web, read public pages, compare a page with last week's copy and look up job adverts on Apollo, and let it choose its own steps. Refuse any story unless a line from the page it cites proves it.
Send me the result as a fun tabloid newspaper through Resend, with a source link on every story and a suggestion for what to say on sales calls. Limit each run to 45 steps and US$1.50. Give me a test page with a practice issue that emails nothing and remembers nothing.
Plan only, no code yet. List every account and API key you need, where I get each one, what it costs and the least access it needs. Never ask me to paste a key into this chat.The plan
✻ Stage 1 of 5: Plan
●Here’s the plan. Nothing gets built until you approve it.
⎿ Plan approved
The Rival Rag plan
Decisions we made
2. API keys we need
Four keys sit at the heart of what we do. This job only adds a password you choose, and yours may need more.
An MCP signs in as you, which suits a session you’re sitting in. A scheduled job runs on Cloudflare with nobody signed in, so it calls each API with a key.
What you can build
With Cloudflare, OpenRouter, Apollo and Resend, you can create more or less anything.
3. How we get them
Each service has a page for making a key. We make one, limit it and save a copy in a password manager, because many services only show a key once.
Create a key
••••••••••••••••••••••CopiedCreate a key
••••••••••••••••••••••CopiedCreate a key
••••••••••••••••••••••CopiedCreate a key
••••••••••••••••••••••Copied4. Adding the keys
You add each key yourself on Cloudflare’s page, so it goes straight to where the job needs it and Claude never sees it. Cloudflare calls these Worker secrets.
✻ Stage 3 of 5: Add keys
●I’ve opened Cloudflare’s secrets page for you. Paste each key there, and I’ll never see it.
⎿ All four added
●Each key is locked away, and even you can’t read it back. Keep a copy in your password manager.
Variables and Secrets
- Claude puts a blank starter live on Cloudflare, so there’s somewhere to keep the keys, and opens the page for you.
- Under Variables and Secrets, click Add and choose Secret.
- Type the name Claude gave you and paste the key. Click Add variable for the next one.
- Click Deploy. Nobody can read a secret back after this, so keep your copy in a password manager.
- On the job’s test page, enter your password and click Check my keys.
When we built this, a stored Apollo key had stopped working, and we only found out when the job ran. Check my keys shows that in seconds.
5. The build
Claude writes the job and puts it live on Cloudflare. We read what it’s doing and answer when it asks.
✻ Stage 4 of 5: Build
●Write(src/agent.ts)
⎿ Wrote 165 lines to src/agent.ts
●Write(src/tools.ts)
⎿ Wrote 352 lines to src/tools.ts
●Write(src/tabloid.ts)
⎿ Wrote 115 lines to src/tabloid.ts
●Write(src/rag.ts)
⎿ Wrote 47 lines to src/rag.ts
●Bash(npx wrangler deploy)
⎿ Deployed rival-rag triggers
schedule: 0 7 * * 1
●It’s live, and it will run every Monday at 7am.
You’ll see the commands Claude runs, and you never need to type them. When Claude asks before a step, say yes if you understand it and ask about it if you don’t. The skill always asks before putting anything live. Claude keeps everything you might change, such as your rivals and limits, in one settings file, so changes are quick.
⎿ Settings updated
●Done. It will use the new list next Monday.
6. Testing
We test in three steps, each one closer to the real thing, using a simple page with buttons. Our first full practice issue took 14 steps and cost 72 US cents. The next took 21 steps, about 2 minutes and US$1.03, because an agent’s route changes each time. A later real issue on one competitor took 11 steps, 53 seconds and 42 US cents.
✻ Stage 5 of 5: Test
●I’ve opened the job’s test page. A practice issue emails nothing and remembers nothing.
●When you’re happy, send one real issue, then leave it to the schedule.
The Rival Rag
Reading anytownkitchens.example
Reading anytownkitchens.example/prices
Searching: Sample & Sons news
Apollo lookup: sampleandsons.example
Filed: Counter attack!
Filed: Hired hands
Practice issue finished. Nothing emailed or remembered.
To change it, pause it or find out what it did, ask Claude.
What went wrong for us
All of these happened during our own build, and each one took a few minutes to fix once we could see it. Tell Claude what you see, and it can usually do the same for you.
●No. Their rules only block a few folders, and my check was reading the wildcards wrongly. I’ll fix it.
⎿ Fixed and put live
●Try a practice issue on the test page, and tell me what you see.
A key was refused
The stored Apollo key had stopped working. Check my keys showed it in seconds. The agent carries on without Apollo and the paper says so at the bottom.
“Reasoning is mandatory”
Our first run stopped straight away, because the model we chose has to think before it answers and we’d told it not to. We let it think and sent its thinking back with each step.
The agent stopped after two steps
It read five home pages, wrote two stories and called it done. We told it to look harder and added one rule: it can’t finish until it has done a minimum number of searches and page reads. The next run took 14 steps.
Three rivals looked off limits
Our code reads each site’s robots file, which says what bots may read. It treated a wildcard rule as blocking the whole site. The sites only blocked a few folders, so we fixed the check.
A logo on the front page
The picture a page sets for sharing is often just its logo. Now only dated articles get a picture.
A price that wasn’t on the page
Checking an issue by hand, we found a £9.99 that didn’t appear on the page the story cited. The code now refuses any story with a number that isn’t on its page.
A “new offer” with nothing to compare
The agent called an offer new when it had no earlier copy of the page. A story can now only be labelled new on the site if the page really has changed since last week.
Some websites refuse to be read
One rival’s server blocked most of its pages. The agent said so in the paper and printed nothing it couldn’t prove, which is what we want.
Public pages, facts and data
The job only reads and only emails you. Most of the rules apply to what you do with the paper next. They’re a starting point, so take advice if you’re unsure.
Public pages only
It reads what any visitor can see, follows each site’s robots file and never logs in. If a site blocks it, the agent leaves that site alone and says so.
Get it right
The paper is for you. If you use a rival’s price in your marketing, UK advertising rules expect the comparison to be accurate and provable, and an untrue claim about a named business can land you in legal trouble.
UK GDPR
A name and work email are personal data. Our agent is told to leave staff and individuals out, and to stick to what the business is doing.
Copyright
A short line and a link are fine for your own use. Don’t copy a rival’s words or pictures into your own marketing.
Anyone can write anything on a web page, including instructions aimed at an AI. Our agent can only read and write a draft for you, and it only ever emails you, so the worst a page can do is skew the paper. That’s why every story has a link for you to check.
The create-automation skill
A skill is a set of instructions Claude loads for a particular job. This one walks you through the same stages for any scheduled automation, and it stops at each one for you to check.
⎿ Installed
✻ Stage 1 of 5: Plan
●What do you do by hand today?
Originate-Group / create-automation
create-automation
A Claude Code skill that takes you through building a scheduled automation, one stage at a time.
To install it, ask Claude:
Install the create-automation skill from github.com/Originate-Group/create-automationThen in a new folder, type /create-automation. The repository holds the instructions, starter code and two worked examples, The Rival Rag and Prospect Scout, with no keys or account details.
create-automation on GitHubgithub.com/Originate-Group/create-automationAutomation ideas
Jobs you could hand over. Some suit a simple script and some need an agent, so ask Claude which fits when you plan yours.
Automation ideas
Things to ask Claude
You don’t need to remember any commands. Copy any of these, or say it your own way.
Troubleshooting
The Mac says the app is damaged or can’t be verified
That’s Apple’s check on apps that aren’t notarised. Open the Terminal app, paste this line once and press Return, then open the app again.
xattr -cr "/Applications/Originate Terminal.app"The app says Claude Code isn’t installed
Follow Add Claude Code, then restart the app.
Claude Code asks me to log in again
Follow the page it opens. A paid Claude plan is needed, and the free plan doesn’t include Claude Code.
Claude asks for permission and I don’t understand
Choose no, and ask it to explain what it wants to do and why.
Check my keys says refused
Make a new key at that service, replace it on Cloudflare’s secrets page and click Deploy, then check again.
The test page says the password isn’t right
It’s the value of RUN_TOKEN on Cloudflare’s secrets page. You can’t read it back, so set a new one if you’ve lost it.
The paper is very short
A quiet week gives a short paper, because the agent won’t print what it can’t prove. Check the rival weather at the bottom to see what it looked at.
No email arrived on Monday
Ask Claude to check the job’s logs on Cloudflare. Remember that schedules run in UTC, and that Resend needs a verified domain.
Glossary
Next steps
Get Originate Terminal
Install it and make a project called automations.
Originate Terminal on GitHubgithub.com/Originate-Group/originate-terminalPlan your own automation
Pick one job you do every week and use the skill to plan it. No keys needed yet.
create-automation on GitHubgithub.com/Originate-Group/create-automationStart small
Run it by hand first, then let the schedule take over once you trust the results.
The slides, these notes, Originate Terminal and the skill are all linked from links.weareoriginate.com.
Questions after the session? Email aaron@weareoriginate.com or visit weareoriginate.com.