Stop Hiring AI Employees: The New Era of “Loop Engineering” for 24/7 SNS Automation

Mastering Claude Code /loop & /goal: Complete Goal-Oriented Design for Autonomous AI Agents (2026)
Loop Engineering · 2026 Field Guide

Stop prompting.
Start designing loops.

In 2026 the leverage moved. It is no longer how well you prompt — it is how well you design the loop. This is the complete goal-oriented guide to Claude Code’s /loop and /goal commands: how to build autonomous agents that run, verify their own work, and stop on their own.

By Ripon · 20 yrs engineering / 25 yrs management Updated Jun 24, 2026 Read 14 min
Doer

The generator

The model that makes the thing — writes the code, drafts the post, sorts the files.

Checker

The verifier

A separate, faster model that answers one question: is “done” objectively true — yes or no?

NO → keep going · YES → stop on its own. The agent was never the hard part. The check is.
Disclaimer This article is general educational information about AI automation and Claude Code, and does not guarantee any specific income, result, or outcome. “Passive income AI” and automation results vary widely by individual and effort. Tool specifications, pricing, model availability, and platform automation policies change over time, and agentic loops consume tokens that incur real charges. Always verify current terms yourself, and make final deployment decisions at your own responsibility.

01Why “AI can write” is no longer the point

For two years the headline was that AI could generate. Code, copy, captions — it could produce. That stopped being the interesting part. The shift in 2026 is that AI can now run itself against a goal, on a schedule, without you in the chair — and your leverage stops being how well you prompt and starts being how well you design the loop.

Think about where time actually drains away. It is rarely the high-judgment work. It is the repeatable work — the inbox, the recurring report, the first-pass screen on every task, the queue you dread. That is exactly the work a well-designed loop can absorb.

And here is the uncomfortable truth that names the whole discipline: with single-prompt chat, you are the loop — you check the work and decide the next step every single time. Loop engineering is stepping out of that seat and building the small system that does the prompting for you.

// The reframe From “how do I write a better prompt?” to “what does done look like, and how does the agent prove it?” That single question is the entire shift.

02What loop engineering actually means

The term went mainstream through one tiny post. On June 8, 2026, Peter Steinberger — creator of OpenClaw, now at OpenAI — posted two sentences that reached millions of views: you shouldn’t be prompting coding agents anymore; you should be designing loops that prompt your agents. No diagram, no repo. The AI-coding timeline argued about it for a week.

Boris Cherny of Anthropic, who leads Claude Code, was widely quoted alongside it, and Addy Osmani’s essay structured the idea and gave it the name “loop engineering” in June 2026. A clean definition that survives the hype:

Loop engineering is building a system that prompts your AI on a schedule and against a goal — instead of you typing each prompt yourself.— the working definition, distilled from Addy Osmani’s framing

What’s genuinely new isn’t just “repeat a prompt.” In spring 2026 both Codex and Claude Code shipped a /goal command that runs until a validator confirms the task is done, and Anthropic engineers describe running iterative loops where Claude observes, plans, acts, and reflects over hours or days. The primitives that were improvised in scripts last year are now shipping features.

03/loop vs /goal: engine vs compass

These two commands are often confused. The cleanest mental model: /loop is the engine, /goal is the compass. /loop drives recurring cycles of assess-act-verify, while /goal gives the agent a finish line it can check and stop on; put together, Claude has both a compass and an engine — it knows where it’s going and it knows to keep moving.

Dimension/loop — the engine/goal — the compass
Best forRecurring monitoring & scheduled cyclesDriving toward one verifiable outcome
You provideA prompt + an intervalA measurable completion condition
Stops whenYou stop it / a stop condition firesThe checker confirms the goal is met
Typical useWatch a log, poll a queue, every-cycle tasks“All tests pass and lint is clean”
CombineSet the /goal, then /loop each phase until the checker says yes.

The /goal command was added to Claude Code in version 2.1.139 during the week of May 11, 2026, and does not exist in earlier versions — type /goal clear to stop early. Check your version first.

# /goal — state the end state, walk away /goal sort every file in Downloads into subfolders by type, keep going until no loose files are left; do not delete anything; stop after 30 turns # /loop — recurring monitor, goal resets each cycle /loop every cycle: check /var/log/app.log for new critical errors, open a GitHub issue for each with context, record last-checked time
// Pairing the two For multi-phase work, break the goal into checkpoints and use /loop to drive each phase sequentially, confirming each phase is done before moving to the next — which gives you auditability so the agent won’t skip ahead.

04The completion condition: how to define “done”

This is where most loops fail. You describe a verifiable end state, not a list of instructions — Claude figures out how to get there, and an independent checker confirms when it has. A vague goal (“tidy it up”) produces a confident-sounding mess. A sharp goal produces finished work.

Three things turned the Downloads example into a good finish line, and they generalize to every goal you’ll ever write:

1

A clear end state

“No loose files left” — not “tidy it up.” Something that is unambiguously true or false.

2

A check it can run

“Count the files.” The agent must be able to prove the end state from its own output.

3

A guardrail + a cap

“Do not delete anything,” “stop after 30 turns.” Always cap the loop so it cannot run forever.

The pattern beneath all three: a measurable end state, an explicit proof method, and constraints you must not violate. If you can’t state those, you don’t have a loop — you have a wish.

// Pro tip — sequence, don’t supersize Rather than one enormous goal that risks context bloat and hard-to-audit diffs, break work into sequential goals each with a narrow, verifiable condition — review the diff, run tests, commit, then start the next goal. Think pipeline, not monolith.

05Self-verification: why the checker is the whole game

Here is the single most important idea in this article. A model that wrote the code and is also asked whether the code is correct consistently over-reports success — so /goal uses a separate, faster model specifically tasked with checking the completion condition after each turn. The builder and the judge are different model instances. No grading its own homework.

Point a loop at something open-ended and it either produces something valuable or it quietly becomes a very expensive machine for generating bad code at high speed.— the core warning behind self-verification

That is why practitioners obsess over Boris Cherny’s fifth tip. Among his tips for running Claude autonomously for hours or days, the one that matters most is “self-verify end to end” — a loop is only as trustworthy as its ability to check its own work. In /goal the evaluator is automatic; in custom workflows you must design it in explicitly.

One more piece of hygiene for parallel work: when multiple sub-agents touch the same repository, Claude Code’s isolation:worktree setting spawns a fresh git checkout for each sub-agent that cleans itself up, preventing agents from overwriting each other’s changes mid-execution.

Skill up · land the work
スキルキャリアエージェント

06The five-part loop anatomy

Strip away the hype and every production loop is the same six labels. Practitioners name the pieces that turn an agent from a clever assistant into a useful background process — a trigger, a scope, an action, a budget, a stop, and a report. Write your loop as this spec before you touch a terminal:

TRIGGER
every 15m · on PR comment · on CI failure
SCOPE
open PRs authored by me, repo X only
ACTION
run tests, fix lint, respond to review
BUDGET
max 3 sub-agents per tick, 50k tokens
STOP
all PRs green · or 10 iterations · or $5 spent
REPORT
post summary to Slack #eng-bots

If any row is blank, the loop is unsafe to deploy. The blank row is exactly where the runaway cost or the silent error will appear.

07Goal-oriented design, step by step

Here is the discipline that keeps long autonomous runs from going off the rails.

1

Orient before you loop

Spend a few turns showing Claude the relevant files, naming conventions, and architecture before starting the loop — its initial interpretation shapes everything that follows.

2

Write one verifiable goal

One measurable end state, one proof method, one guardrail. Narrow beats grand.

3

Match the interval to the work

A 30-second loop that runs a full test suite will overlap with itself or exhaust rate limits — match the interval to how long a cycle actually takes; if unsure, start longer.

4

Watch the first iteration

If the loop starts down the wrong path, stop it, correct course, and restart — the first cycle sets the trajectory.

5

Cap, log, and report

Build blocker-handling, logging, and exit conditions into your commands before deploying autonomously; check /status before leaving and /cost to see cumulative spend.

08Worked example: a content automation loop

The same anatomy transfers cleanly to digital marketing automation — SNS, X, and YouTube workflows. The trick is the same as in code: don’t just generate, verify. A doer drafts; a separate checker scores; only what passes moves forward.

# Content loop (design sketch — adapt to your tools & policies) /goal Produce today’s content batch: 1. pull 1 unused topic from the ideas sheet 2. draft 5 posts per CLAUDE.md tone & banned-words rules 3. have a separate checker model score hook / clarity / CTA out of 100 4. queue only drafts scoring >= 85 for human review 5. log a one-line summary; discard the rest # stop after 3 approved posts; budget 40k tokens; never auto-publish

Two design choices make this safe. First, the checker is a different model from the writer — no self-grading. Second, the loop queues for human review and never auto-publishes. Boris Cherny’s framing that everyone becomes a builder — designers, finance, chief-of-staff all shipping work through loops — applies here too: the content owner stops being the person who writes each post and becomes the person who designs the loop that produces them.

// Compliance first Every platform (X, YouTube, and others) has its own automation and API policies, rate limits, and disclosure rules. Designing a loop does not exempt you from them. Keep a human approval gate before publishing, and confirm each platform’s current terms before you automate.

09Budget guards & the 10x token problem

The biggest risk in autonomous loops is not bad output — it’s the invoice. Every tool call in an agentic loop adds context that gets re-sent to the model on every subsequent call, so by the 20th iteration the cumulative input per call can exceed 50,000 tokens. Cost compounds silently.

The numbers are sobering. At Opus 4.8’s input pricing, a single late-loop step can cost roughly $0.25, and a 200-iteration autonomous session on an open-ended task can cost $80 or more — which is why the June 15, 2026 Agent SDK billing change separated automated workloads onto their own credit pool. Flat-rate subscriptions were never designed for agent-level compute.

GUARD 01

Write the STOP first

Iteration cap, dollar cap, and a “no progress” cap. Decide how it ends before you start it.

GUARD 02

Summarize, then discard

Have each cycle record a one-line summary and drop the detail, so context doesn’t balloon.

GUARD 03

Sequence small goals

Many narrow goals with commits between them cost less and audit better than one giant run.

GUARD 04

Check /cost & /status

Never leave an indefinite loop running unseen. Know your kill switch before you walk away.

Addy Osmani’s closing line is the right north star: build the loop, but build it like someone who intends to stay the engineer — not just the person who presses go.

10Pros, cons & honest limits

+ STRENGTH

Outcome, not babysitting

You define “done” once and return to finished work instead of typing “keep going” twenty times.

+ STRENGTH

Built-in quality gate

A separate checker catches the over-confident “success” before it ships.

+ STRENGTH

Scales the repeatable

Inbox triage, monitoring, first-pass screening — the work that drowns you becomes background.

– LIMIT

Token cost compounds

Without budget guards, late-loop steps get expensive fast. Cost design is mandatory.

– LIMIT

Session-bound

/goal and /loop operate within the bounds of a terminal session; true unattended runs need cloud/scheduled setups.

– LIMIT

A weak check fails silently

An unverifiable goal or a soft checker amplifies errors at speed. The design is the result.

11Voices from the field

I stopped trying to write the perfect prompt and started writing the perfect check. The day I could state “done” as a number my agent could measure, everything changed.

— Staff engineer, fintech

The AI was never the hard part. Watching it grade its own homework and report success was. Splitting the doer and the checker into two models is what finally made me trust an overnight run.

— Indie builder, content automation

My first runaway bill taught me the lesson the docs couldn’t: write the STOP condition before the ACTION. Iteration cap, dollar cap, no-progress cap. Then sleep fine.

— Solo founder & RIA

12Your first loop in under an hour

Don’t architect an empire. Pick one task you repeat every week and write three lines: when it starts, what “done” looks like, and how the AI proves it’s done. That sentence is your entire spec.

Then try it on something small and harmless first — sorting a folder, drafting one recurring report — and watch the first iteration. That feeling, the agent driving itself to a finish line and stopping on its own, is the whole point. Once you trust the check, you add the budget guard, then the schedule. Small loop first. Empire later.

Hand your “keep going” work to a loop.

Move from the person who prompts to the person who designs the system. Build the skills and find the work to operate on the design side of AI automation — start here.

↻ Talk to a skill & career agent

FAQFrequently asked questions

What is the difference between /loop and /goal in Claude Code?
/loop is the engine — it repeats a prompt or slash command on a schedule, ideal for recurring monitoring. /goal is the compass — you state one verifiable completion condition, and a separate fast checker model confirms after each turn whether it’s met, so the agent keeps working until the goal clears. You can pair them: set the goal, loop each phase until the checker says yes.
Why does a loop need a separate verifier model?
A model that wrote the work and is also asked whether the work is correct tends to over-report success. /goal uses a separate, faster checker model to evaluate the completion condition after each turn, so the doer and the checker are different instances — no grading its own homework. In custom workflows you must design this verifier in explicitly.
Which Claude Code version do I need for /goal?
The /goal command was added in Claude Code version 2.1.139 during the week of May 11, 2026, and does not exist in earlier versions. Type /goal clear to stop a goal early, and check the official docs for version-specific release notes since the completion-checker behavior continues to be refined.
Why do agentic loops cost so much more than single prompts?
Every tool call adds context that’s re-sent on every subsequent call, so cumulative input grows each iteration and late-loop steps can carry tens of thousands of tokens. A long open-ended session can cost far more than a single prompt, which is exactly why a budget guard, a hard iteration cap, and a dollar cap are essential.
Can I use these loops for SNS, X, or YouTube automation?
Yes — the doer / checker / stop pattern transfers to content workflows. But every platform has its own automation and API policies, rate limits, and disclosure rules. Keep a human approval gate before publishing, never auto-publish blindly, set hard budget and stop conditions, and confirm each platform’s current terms before automating.
Does loop engineering make prompt engineering obsolete?
No. The quality of the single instruction the loop runs still matters. The change is who runs it: instead of you typing each prompt, you design the system that prompts the agent against a goal, on a schedule, with verification. Prompt craft lives inside the loop; loop design wraps around it.
Related tools & learning

Resources to go deeper on loop design and AI-assisted coding.

▶ Browse related books & gear on Amazon

◆ Try Cursor AI (referral link)

Rakuten picks

Disclaimer · results & cost notice This article is general educational information about AI automation and Claude Code and does not guarantee any specific income, result, or effect. “Passive income AI” and automation outcomes vary by individual and effort. Tool specs, pricing, model availability, and platform automation policies change, and agentic loops consume tokens that incur real charges. Content reflects interpretation of public information available at the time of writing and is not warranted for accuracy or currency. Make final adoption and deployment decisions at your own responsibility.
Affiliate disclosure This page contains affiliate advertising (A8.net / AccessTrade, Amazon Associates, Rakuten Affiliate, Cursor referral, etc.). The operator may earn a commission when you purchase or sign up through these links.
AYUCOM /loop_lab

A field journal on AI automation, side income, and autonomous agents.

© 2026 AYUCOM CO., LTD. All rights reserved.