AI Loop Engineering for Beginners

Kingy AI Course

AI Loop Engineering for Beginners

Learn how to use Codex, Claude Code, ChatGPT, and AI agents to plan, execute, test, reflect, and improve real work.

  • Beginner-friendly
  • No coding required to start
  • Codex + Claude Code examples
  • Practical templates
  • Human-review first

A prompt asks once. A loop keeps working until there is evidence that the task is done, blocked, unsafe, too expensive, or ready for human review.

0 of 16 modules complete

GoalWhat should be true when the work is done?
Plan
Act
Check
Improve
Stop
EvidenceTests, links, screenshots, sources, budget, and human approval.
ReviewThe human approves public, paid, private, destructive, or production actions.

Fast definition

Prompt, workflow, loop, agent.

These four words get mixed together. Beginners move faster when they keep the difference simple.

Prompt

Prompt → Output. One request, one response, human decides the next move.

Workflow

Step 1 → Step 2 → Step 3. A repeatable sequence, often still human-driven.

Loop

Plan → Act → Check → Improve. Repeat until done, blocked, unsafe, over budget, or ready for review.

Agent

LLM + tools + context + rules. The model can act inside a loop, not just answer.

Why loops matter now

AI work is moving from chat boxes to agents.

Codex and Claude Code can inspect files, use tools, edit, test, and keep working through multiple steps. ChatGPT, Cursor, browser agents, and no-code builders are moving in the same direction.

The skill shift is not from bad prompts to magic prompts. It is from one-shot prompting to safe loop design: goals, context, tools, validation, limits, and human judgment.

What this course is not

It is not a hype course, not a promise that AI replaces developers, not a no-review automation playbook, not a guide to blind publishing, not a coding prerequisite, and not a video course with empty placeholders.

Search landscape

Most loop content is too narrow for beginners.

Current results are strongest when they explain agent architecture, framework docs, ReAct-style theory, or developer automation. The common weaknesses are practical: too technical, too theoretical, too tool-specific, too developer-only, short on templates, light on safety, and rarely connected to WordPress, SEO, non-technical workflows, or hands-on loop debugging.

Clearer

Plain-English definitions before terms like ReAct, cron, CI, MCP, AGENTS.md, or routines.

More practical

Copyable loops, worksheets, maturity checks, risk checks, and builders for Codex, Claude Code, research, SEO, QA, WordPress, debugging, and launch tracking.

Safer

Human approval rules, max iterations, stop conditions, backups, evidence, rollback thinking, and draft-only beginner defaults from the start.

Course map

16 modules from one-shot prompts to a personal loop operating system.

Open each module, complete the mini exercise, copy the prompt, answer the quick check, and mark it complete. Progress is saved in this browser only.

01

What Is an AI Loop?
An AI loop is a repeatable cycle where an AI system keeps working until a clear condition is met.

What you will learn

Define loops in plain English and spot when a one-shot prompt is too weak.

When to use it

Use a loop when the task needs checking, revision, or evidence.

When not to use it

Do not use a loop for a tiny answer, a high-risk action, or a task you cannot review.

Mini exercise

Rewrite one vague prompt into a loop with a done condition and a stop rule.

Beginner example

A founder asks ChatGPT to improve a launch email once. A loop version asks for a draft, checks it against audience, claim accuracy, CTA clarity, and tone, then revises up to two times.

Try this in Codex

Ask Codex to inspect a page, define a checklist, make one improvement pass, then verify with browser evidence before reporting done.

Try this in Claude Code

Ask Claude Code to gather context first, propose the smallest safe action, verify, and stop if the next action needs permission.

Common mistake

Writing 'keep improving this' without a done condition, evidence rule, or max attempt limit.

Mini-workflow

Goal -> context -> first pass -> checklist -> revise -> evidence -> stop or review.

Copyable module prompt
Turn this one-shot prompt into a safe beginner AI loop. Include goal, context needed, steps, validation, max iterations, stop rules, and human review point: [paste prompt].



02

Prompt vs Workflow vs Loop vs Agent
A prompt asks once, a workflow follows steps, a loop repeats steps, and an agent can use tools inside the loop.

What you will learn

Choose the right pattern before you ask an AI tool to work.

When to use it

Use this distinction when a task feels bigger than a chat answer.

When not to use it

Do not call everything an agent. Most beginner work starts as a prompt or workflow.

Mini exercise

Classify five tasks from your week as prompt, workflow, loop, or agent loop.

Beginner example

Classifying 'write a FAQ' as a prompt is fine. Classifying 'keep this FAQ current every month using sources and link checks' makes it a loop or routine.

Try this in Codex

Use Codex for loop or agent-loop work when files, QA commands, or live page checks are part of the job.

Try this in Claude Code

Use Claude Code for terminal-centered loops such as exploring code, editing, running tests, and summarizing evidence.

Common mistake

Calling a simple workflow an agent, then granting tool permissions it does not need.

Mini-workflow

Task -> risk -> tools needed -> repeat needed? -> choose prompt, workflow, loop, or agent.

Copyable module prompt
Classify each task below as prompt, workflow, loop, or agent loop. Explain the safest first version and where human review belongs. Tasks: [paste list].



03

The Basic Plan, Act, Check, Improve Loop
The simplest practical loop is Plan, Act, Check, Improve, then repeat only if the check fails.

What you will learn

Create a reusable loop for almost any low-risk task.

When to use it

Use it for drafts, outlines, page improvements, small code edits, and research notes.

When not to use it

Do not let it run forever or keep improving without a clear standard.

Mini exercise

Create a four-step loop for improving a landing page intro.

Beginner example

A WordPress intro can be improved by planning the reader job, editing one section, checking clarity and mobile view, then making one more pass only if the check fails.

Try this in Codex

Prompt Codex to plan before editing and to list the exact validation evidence it will collect.

Try this in Claude Code

Prompt Claude Code to test each change against a named checklist instead of judging by confidence.

Common mistake

Letting the Improve step become endless polishing after the checklist already passes.

Mini-workflow

Plan the standard -> act once -> check evidence -> improve once -> final report.

Copyable module prompt
Use a Plan, Act, Check, Improve loop for this task: [task]. Before acting, write the checklist. After each pass, score the result, list what changed, and stop after [number] iterations or when the checklist passes.



04

The Agent Loop: Thought, Action, Observation
Many agents cycle through deciding what to do, using a tool, observing the result, and deciding the next step.

What you will learn

Understand the ReAct-style pattern without needing research-paper language.

When to use it

Use it when the AI needs to inspect files, search, click, test, or call tools.

When not to use it

Do not expose risky tools before you define permissions, budgets, and review.

Mini exercise

Map a web research task into Thought, Action, Observation checkpoints.

Beginner example

A research agent decides it needs an official doc, opens the source, observes the date and wording, then decides whether the claim is safe to keep.

Try this in Codex

Use this pattern when Codex needs to inspect files, run commands, or use the browser before deciding the next step.

Try this in Claude Code

Use Claude Code's gather-context, take-action, verify-results rhythm as the practical version of this loop.

Common mistake

Letting the model invent the observation instead of reading a tool result or source.

Mini-workflow

Thought -> one action -> observation -> updated thought -> answer or next action.

Copyable module prompt
Run this as an agent-style loop: decide the next action, take only one safe action at a time, report the observation, and continue only if the next step is justified. Task: [task].



05

Human-in-the-Loop Safety
Human-in-the-loop means a person reviews or approves important outputs and actions.

What you will learn

Separate low-risk drafting from actions that need approval.

When to use it

Use it before publishing, sending, deleting, buying, deploying, or touching private data.

When not to use it

Do not hide review behind vague words like supervised. Name the approval point.

Mini exercise

Write forbidden actions for one AI workflow you want to build.

Beginner example

A course page can be drafted by AI, but a human must approve public publishing, source claims, screenshots, and any site-wide changes.

Try this in Codex

Tell Codex exactly where to stop: before publishing, deleting, installing dependencies, deploying, or touching secrets.

Try this in Claude Code

Use Claude Code permissions, checkpoints, and explicit approval gates for file and command actions.

Common mistake

Saying 'supervised' without naming the actions that require approval.

Mini-workflow

Allowed actions -> forbidden actions -> approval gates -> evidence -> rollback plan.

Copyable module prompt
Create a human-in-the-loop safety policy for this AI workflow: [workflow]. Include allowed actions, forbidden actions, approval gates, data rules, logs, rollback, and stop conditions.



06

The PIV Loop: Plan, Implement, Validate
PIV is the Kingy beginner loop for Codex, Claude Code, and AI coding agents.

What you will learn

Ask an agent to plan first, make the smallest useful change, then prove it worked.

When to use it

Use PIV for coding, page edits, debugging, WordPress blocks, and automation drafts.

When not to use it

Do not skip validation because the first output looks confident.

Mini exercise

Turn a small website fix into a PIV prompt.

Beginner example

For a layout bug, the agent plans the likely CSS change, implements only that change, validates in desktop and mobile, then reports screenshots and remaining risk.

Try this in Codex

Use PIV for repo edits: inspect first, patch narrowly, run checks, and avoid unrelated refactors.

Try this in Claude Code

Use PIV when asking Claude Code to fix tests, adjust docs, or update generated artifacts.

Common mistake

Implementing before the plan names what proof will count as success.

Mini-workflow

Plan -> implement smallest useful change -> validate -> repeat only if validation fails.

Copyable module prompt
Use the PIV loop. Plan the change, implement the smallest safe version, validate with [test or review method], and repeat only if validation fails. Stop before risky actions. Task: [task].



07

Codex Loops and /goal Prompts
Codex can work through longer tasks when the goal includes a clear finish line and evidence.

What you will learn

Write /goal prompts that define done, evidence, constraints, blockers, and final reporting.

When to use it

Use /goal for durable work that may take multiple investigation and fix cycles.

When not to use it

Do not use /goal for vague tasks like improve everything or make it better.

Mini exercise

Draft a /goal for a website QA fix with measurable evidence.

Beginner example

A good course-update /goal says which page to upgrade, what must remain unchanged, which checks must pass, and what evidence proves done.

Try this in Codex

Write done criteria that Codex can audit: file generated, JSON-LD parsed, browser QA passed, live URL returns 200.

Try this in Claude Code

Translate the same criteria into a Claude Code task prompt if Claude is doing the implementation loop.

Common mistake

Using /goal for 'make it world class' without concrete acceptance checks.

Mini-workflow

Objective -> constraints -> evidence -> blockers -> final report format.

Copyable module prompt
/goal [objective]. Inspect the current state first. Plan before editing. Keep changes scoped. Validate with [tests/checks]. Done when [evidence]. Stop and ask if [blocker/risky action]. Final report: files changed, checks run, evidence, remaining risks.



08

Claude Code /loop, Scheduled Tasks, and Routines
Claude Code can repeat prompts inside a session with /loop and can also run routines on schedules or triggers.

What you will learn

Understand the difference between quick polling, session loops, and cloud routines.

When to use it

Use /loop for temporary checks like deployment polling or PR babysitting.

When not to use it

Do not create autonomous routines without scoped permissions and explicit success criteria.

Mini exercise

Write a safe deployment polling loop that reports instead of deploying.

Beginner example

A /loop can check deployment status every 10 minutes, but a routine can run a scheduled weekly audit with configured triggers and permissions.

Try this in Codex

Map Claude scheduled work back into Codex language by defining cadence, trigger, permission, and review point.

Try this in Claude Code

Use /loop for session polling; use routines when the task needs saved triggers and separate reviewable sessions.

Common mistake

Scheduling a vague recurring prompt that can take broad actions without limits.

Mini-workflow

Trigger -> prompt -> allowed actions -> stop rule -> report -> human review.

Copyable module prompt
Create a Claude Code loop prompt for this recurring task: [task]. Include interval or trigger, allowed actions, forbidden actions, success condition, stop condition, report format, and human approval rules.



09

Debugging Loops
A debugging loop reproduces the bug, reads the evidence, patches the likely cause, and tests again.

What you will learn

Stop guessing and make the agent prove the bug was fixed.

When to use it

Use it for errors, regressions, failing tests, broken forms, and layout bugs.

When not to use it

Do not patch without reproducing when reproduction is possible.

Mini exercise

Create a bug report with reproduction steps and expected behavior.

Beginner example

A broken copy button should be reproduced, traced to the event handler or browser permission path, patched, and retested in the rendered page.

Try this in Codex

Ask Codex to capture the failing state first and keep a small diff.

Try this in Claude Code

Ask Claude Code to run the failing test or browser flow before editing.

Common mistake

Patching three likely causes without proving which one failed.

Mini-workflow

Reproduce -> isolate -> patch -> retest -> regression note.

Copyable module prompt
Debug this issue in a loop. First reproduce it or explain why it cannot be reproduced. Inspect likely causes, make the smallest fix, run the relevant check, and stop after two failed strategies with a summary. Issue: [details].



10

QA and Testing Loops
A QA loop checks the experience on desktop, mobile, links, forms, schema, speed, and accessibility.

What you will learn

Turn release review into a repeatable checklist.

When to use it

Use it before publishing public pages, tools, forms, or course content.

When not to use it

Do not rely only on source code review for visual or interactive pages.

Mini exercise

Run a five-item QA checklist on one existing page.

Beginner example

Before publishing a course, run desktop, mobile, link, schema, copy button, contrast, console, and source-claim checks.

Try this in Codex

Use Codex with browser verification and static checks for WordPress Custom HTML pages.

Try this in Claude Code

Use Claude Code to run command-line checks, then inspect rendered output if browser access is available.

Common mistake

Checking only the generated source and not the live WordPress-rendered page.

Mini-workflow

Preview -> interact -> inspect console -> verify links/schema -> publish decision.

Copyable module prompt
Run a QA loop for this page or feature: [url or description]. Check desktop, mobile, copy/buttons, links, forms, accessibility basics, schema, and performance risk. Return must-fix, should-fix, and evidence.



11

Research and Source Verification Loops
A research loop searches, selects reliable sources, extracts claims, verifies dates, and cites clearly.

What you will learn

Prevent AI research from becoming polished uncertainty.

When to use it

Use it for product research, launch tracking, explainers, and comparison pages.

When not to use it

Do not publish claims based only on summaries, social posts, or memory.

Mini exercise

Verify three claims from an AI product announcement with official sources.

Beginner example

For 'Claude Code routines,' verify the official docs, record the review date, and avoid claims about plan limits that may change.

Try this in Codex

Ask Codex to browse official docs, cite URLs, and separate facts from inferences.

Try this in Claude Code

Ask Claude Code to summarize sources with dates and confidence levels.

Common mistake

Treating model memory as a source for current tool behavior.

Mini-workflow

Question -> source search -> claim table -> conflict check -> keep/soften/remove.

Copyable module prompt
Run a source verification loop for this question: [question]. Prefer official and primary sources. Record dates, separate facts from interpretation, flag conflicts, cite URLs, and omit claims that cannot be verified.



12

SEO and Content Refresh Loops
An SEO loop improves usefulness, structure, internal links, source quality, metadata, and freshness.

What you will learn

Improve pages for readers and search engines without keyword stuffing.

When to use it

Use it for course pages, evergreen guides, launch pages, and comparison content.

When not to use it

Do not chase keywords by adding thin filler or fake authority.

Mini exercise

Draft an SEO refresh checklist for a page you own.

Beginner example

Refreshing a page means improving the reader path, examples, links, headings, and source accuracy, not adding keyword repetitions.

Try this in Codex

Ask Codex to compare the page against search intent and then implement scoped content improvements.

Try this in Claude Code

Ask Claude Code to turn an SEO checklist into edits and a source-backed final summary.

Common mistake

Adding thin sections just because a keyword appears in a search query.

Mini-workflow

Intent -> gaps -> examples -> internal links -> metadata -> source review.

Copyable module prompt
Refresh this content for SEO and usefulness. Check search intent, title, intro, headings, examples, internal links, sources, FAQ, schema, and meta description. Keep claims accurate and avoid keyword stuffing. Page/topic: [details].



13

Reflection Loops and Memory
A reflection loop asks what failed, what changed, and what rule should improve the next attempt.

What you will learn

Use critique and memory notes without pretending the model learned permanently.

When to use it

Use it after drafts, bugs, research passes, and failed agent attempts.

When not to use it

Do not accept vague self-praise as reflection.

Mini exercise

Write a three-line memory note after a task: rule, evidence, next action.

Beginner example

After a failed agent attempt, record the failure pattern, the evidence, and one new instruction that would prevent the next failure.

Try this in Codex

Ask Codex to update a reusable instruction or checklist only when the lesson is supported by evidence.

Try this in Claude Code

Ask Claude Code to write a short retrospective after debugging or refactoring loops.

Common mistake

Letting reflection become vague praise instead of a concrete rule change.

Mini-workflow

Attempt -> evidence -> failure pattern -> reusable rule -> next test.

Copyable module prompt
Reflect on this attempt: [output or transcript]. List what worked, what failed, what evidence supports that judgment, what to change next, and one reusable instruction for future tasks.



14

AGENTS.md, CLAUDE.md, and Reusable Instructions
Instruction files help agents start with project rules instead of rediscovering them every time.

What you will learn

Create durable guidance for tools, tests, style, safety, and reporting.

When to use it

Use them when you repeat similar work in the same repo or workflow.

When not to use it

Do not store secrets or huge irrelevant manuals in instruction files.

Mini exercise

Draft a starter AGENTS.md for a small website project.

Beginner example

A small site project can store test commands, theme constraints, publishing rules, and final-report expectations in AGENTS.md or CLAUDE.md.

Try this in Codex

Ask Codex to draft AGENTS.md with commands, style rules, files to avoid, and approval gates.

Try this in Claude Code

Ask Claude Code to initialize or refine CLAUDE.md so every session starts with the same project norms.

Common mistake

Putting secrets, giant pasted docs, or outdated one-off instructions into persistent guidance.

Mini-workflow

Project norms -> safe commands -> review gates -> reporting format -> update rule.

Copyable module prompt
Draft an AGENTS.md or CLAUDE.md for this project. Include repo overview, safe commands, style rules, test commands, files to avoid, approval rules, and final report expectations. Project: [context].



15

Parallel Agent Loops
Parallel loops split work across roles like researcher, builder, tester, and reviewer.

What you will learn

Use multiple agents carefully without creating conflicting edits or noisy output.

When to use it

Use it for independent research, review, test planning, and comparison.

When not to use it

Do not let multiple agents edit the same files at once without isolation.

Mini exercise

Assign four safe roles for a course page QA pass.

Beginner example

One agent researches sources, one improves content, and one checks links and mobile layout; the human reviews the merged evidence.

Try this in Codex

Use subagents for independent read-only research or review, then reconcile findings before edits.

Try this in Claude Code

Use worktrees or separate sessions when agents may edit, so parallel work does not collide.

Common mistake

Parallelizing edits to the same file without isolation or a merge plan.

Mini-workflow

Split roles -> isolate work -> return evidence -> reconcile -> human decision.

Copyable module prompt
Design a parallel agent workflow for [task]. Split roles into research, build, test, and review. Define isolated work areas, handoff format, conflict rules, and the human decision point.



16

Capstone: Build Your Personal AI Loop Operating System
Your loop operating system is a small set of prompts, checklists, files, and routines you can reuse.

What you will learn

Combine Codex, research, QA, SEO, reflection, and safety loops into one personal system.

When to use it

Use it when AI becomes part of your weekly work instead of a novelty.

When not to use it

Do not automate more than you can review, explain, and roll back.

Mini exercise

Build one loop manual with your prompts, stop rules, approval gates, and review checklist.

Beginner example

Your operating system might include a weekly SEO refresh loop, a Codex QA loop, a research verification loop, and a safety checklist.

Try this in Codex

Ask Codex to assemble the reusable prompts, files, checklists, and evidence standards into one operator manual.

Try this in Claude Code

Ask Claude Code to turn repeated command-line work into a safe routine or project memory file.

Common mistake

Automating more workflows than you can review, explain, or roll back.

Mini-workflow

Inventory tasks -> choose loops -> write prompts -> define gates -> run a supervised pilot.

Copyable module prompt
Help me build my Personal AI Loop Operating System. Create one Codex loop, one general agent loop, one research loop, one QA loop, one SEO/content loop, one safety checklist, one starter AGENTS.md, one weekly routine, and one final operating manual.



Loop library

16 loop patterns you can use immediately.

Each pattern includes what it is best for, what it is not for, steps, stop condition, review point, and a copyable starter prompt.

Simple improvement loop

Best for
Drafts, emails, summaries, outlines
Not for
High-risk actions
Steps
Review against a checklist after each pass
Stop condition
Checklist passes or max attempts reached
Human review point
Before using the final output
Loop prompt
Improve this in up to three passes. After each pass, compare it to this checklist: [criteria]. Stop when it passes or when no meaningful improvement remains.

Codex build loop

Best for
Small features and page changes
Not for
Unclear product direction
Steps
Inspect, plan, edit, test, summarize
Stop condition
Feature works and checks pass
Human review point
Before merge or publish
Loop prompt
Build [feature]. Inspect the repo first, plan the smallest safe change, implement, run relevant checks, and report files changed plus evidence.

Codex bug-fix loop

Best for
Reproducible bugs
Not for
Bugs with missing reproduction
Steps
Reproduce, inspect, patch, test, review diff
Stop condition
Bug no longer reproduces
Human review point
Before accepting the patch
Loop prompt
Fix [bug]. Reproduce first if possible, add a regression check if feasible, make the smallest change, and stop after two failed approaches with a diagnosis.

Claude Code PR review loop

Best for
Review comments and CI checks
Not for
Unsigned-off risky merges
Steps
Read diff, inspect failures, patch, rerun, summarize
Stop condition
CI passes or human decision needed
Human review point
Before push or merge
Loop prompt
Check PR [number]. Address clear review comments, inspect CI, make scoped fixes, and ask before pushing or changing public behavior.

Research loop

Best for
Briefs and explainers
Not for
Breaking news without sources
Steps
Question, search, source, extract, verify, cite
Stop condition
Claims are source-backed
Human review point
Before publication
Loop prompt
Research [question]. Use primary sources first, record dates, cite URLs, flag conflicts, and separate facts from interpretation.

SEO refresh loop

Best for
Evergreen content updates
Not for
Keyword stuffing
Steps
Intent, outline, content, links, metadata, schema
Stop condition
Page is clearer and source-backed
Human review point
Before publish
Loop prompt
Refresh [page/topic] for search intent and usefulness. Improve structure, examples, links, FAQ, and metadata without unsupported claims.

WordPress page QA loop

Best for
Custom HTML blocks
Not for
Theme-wide changes
Steps
Backup, preview, mobile, links, scripts, accessibility
Stop condition
No must-fix issues remain
Human review point
Before update
Loop prompt
QA this WordPress block/page. Check scoped CSS, mobile layout, buttons, links, schema, console errors, and rollback notes.

AI Launch Radar research loop

Best for
Launch tracking
Not for
Rumors
Steps
Official source, date, category, impact, uncertainty
Stop condition
Record is verified or held
Human review point
Before publishing launch record
Loop prompt
Verify this AI launch. Find official source, exact date, what changed, audience, category, and uncertainty. Hold if evidence is weak.

Prompt improvement loop

Best for
Reusable prompts
Not for
One-off personal tasks
Steps
Run, critique, revise, test, save
Stop condition
Prompt produces reliable output
Human review point
Before sharing
Loop prompt
Improve this prompt for reuse. Make it clearer, safer, testable, and scoped. Add output format, stop rules, and a verification step.

Safety review loop

Best for
Agents with tools
Not for
Pure brainstorming
Steps
Permissions, data, actions, approvals, rollback
Stop condition
All risky actions have gates
Human review point
Before tool access
Loop prompt
Review this AI workflow for safety. Identify risky tools, sensitive data, forbidden actions, approval gates, logs, and rollback plan.

Content outline loop

Best for
Course and article planning
Not for
Final factual claims
Steps
Audience, intent, outline, gaps, examples
Stop condition
Outline covers reader jobs
Human review point
Before drafting
Loop prompt
Create an outline for [topic]. Include audience, search intent, sections, examples, internal links, sources needed, and missing questions.

Source verification loop

Best for
Claims and citations
Not for
Speculation
Steps
Claim, source, date, conflict, confidence
Stop condition
Every important claim has evidence
Human review point
Before final edit
Loop prompt
Verify these claims: [claims]. For each, cite the best source, date checked, confidence, and whether to keep, soften, or remove it.

App testing loop

Best for
Interactive tools
Not for
Production writes
Steps
Open, interact, edge cases, console, mobile
Stop condition
Critical flows pass
Human review point
Before release
Loop prompt
Test this app flow: [flow]. Use desktop and mobile, try edge cases, check console/errors, and return evidence plus fixes.

Cost-control loop

Best for
Repeated agent work
Not for
Tiny tasks
Steps
Max turns, max spend, max time, no-progress stop
Stop condition
Budget respected
Human review point
Before starting loop
Loop prompt
Design a cost-controlled loop for [task]. Set max iterations, max time, max spend, no-progress detection, and escalation rules.

Human approval loop

Best for
Publishing and external actions
Not for
Low-risk drafts
Steps
Draft, review, approve, execute, log
Stop condition
Human approves or rejects
Human review point
Before action
Loop prompt
Prepare [action] for approval. Show draft, risk, evidence, rollback, exact action to execute, and wait for explicit approval.

Retrospective loop

Best for
After tasks
Not for
Live urgent fixes
Steps
What happened, evidence, lessons, rule update
Stop condition
Reusable improvement captured
Human review point
After completion
Loop prompt
Run a retrospective on [task]. List outcomes, evidence, errors, what to change next time, and one reusable instruction.

Interactive builders

Generate safer loop prompts.

Use these tools to turn an idea into a prompt with validation, limits, stop rules, and human approval. They run in your browser with vanilla JavaScript.

1. Loop Builder








2. Codex /goal Prompt Generator










3. Claude Code Loop Prompt Generator






4. Loop Maturity Grader

Score a loop idea before you trust it. A strong loop has clear goals, evidence, limits, and review gates.








5. Task-to-Loop Classifier

Paste a task and get the safest starting pattern: prompt, workflow, loop, agent loop, or scheduled routine.




6. Safety Risk Checker

Use this before giving an agent tools, browser access, or permission to update anything live.






7. Loop Debugging Worksheet

When a loop goes sideways, debug the loop design before blaming the model.




8. Capstone Workspace Generator

Generate a personal loop operating manual you can paste into Codex, Claude Code, or a project note.






Decision tree

Choose the smallest safe pattern.

I need a one-time answer.Use a prompt.
I need a repeatable process.Use a workflow.
I need the AI to test and improve.Use a loop.
I need files, tools, browser actions, or APIs.Use an agent loop with permissions.
I need recurring background work.Use a scheduled loop or routine with strict limits.
I need a high-risk action.Use human-in-the-loop approval or do it manually.

Safety

The Loop Safety Rules

These are the beginner rules. Break them only when you have a stronger review, rollback, logging, and permission system than the one described here.

  • Never let a beginner loop publish without review.
  • Never let a loop delete files without approval.
  • Never let a loop deploy without approval.
  • Never let a loop spend money without approval.
  • Never let a loop email customers without approval.
  • Never let a loop access secrets unless necessary and safe.
  • Always define done.
  • Always define stop.
  • Always define max attempts.
  • Always define what evidence is required.
  • Always ask for a final summary.
  • Always inspect changes before accepting.
  • Use backups, branches, previews, and rollback plans.
Comparison tables

Use these when the task feels blurry.

Prompt vs Workflow vs Loop vs Agent

Pattern What it means Best beginner use
Prompt One request to an AI model. Quick explanation, rewrite, or idea.
Workflow A defined sequence of steps. Repeatable process with human steering.
Loop A workflow that repeats based on checks. Improvement, QA, debugging, research.
Agent A model in a loop with tools and context. File, browser, test, or data tasks with safeguards.

Human-in-the-Loop vs Human-on-the-Loop vs Fully Automated

Mode Human role Beginner rule
Human-in-the-loop Approves important steps before action. Best default for risky work.
Human-on-the-loop Monitors and can interrupt. Use only when rollback is clear.
Fully automated Runs without review. Avoid for public, paid, private, or destructive actions.

Codex Normal Prompt vs Codex /goal

Mode Use when Needs
Normal prompt The task is small or exploratory. Clear instruction and enough context.
/goal The task is durable and may need many steps. Definition of done, evidence, constraints, and blocker rules.

Claude Code /loop vs Claude Code Routines

Feature Best for Safety note
/loop Session-scoped polling or repeated checks. Keep the session open and define stop rules.
Routines Recurring or triggered cloud work. Scope repositories, connectors, permissions, and review.

One Agent vs Multiple Agents

Setup Strength Risk
One agent Simpler context and easier review. May miss blind spots.
Multiple agents Research, test, and review can happen in parallel. Higher cost, coordination, and conflict risk.

Good Loop vs Bad Loop

Good loop Bad loop Why it matters
Specific goal Vague wish The system must know what done means.
Evidence required Looks fine Verification beats confidence.
Max attempts Unlimited retries Budgets protect time and money.
Human approval point Silent external action Trust requires review where risk rises.

Mini quiz

Check the mental model.

A loop should continue forever if the output keeps improving.


No. A good loop needs stop conditions, budgets, and review points.

A prompt asks once; a loop repeats with checks.


Correct. Repetition without checks is not trustworthy loop design.

Human review is most important before publishing, deleting, spending, emailing, or deploying.


Correct. These actions need explicit approval.

For research loops, social posts are always enough evidence.


No. Prefer official, primary, and high-quality sources.

A Codex /goal should include a definition of done.


Correct. Done criteria make the loop measurable.

Validation can include tests, screenshots, source checks, link checks, or human review.


Correct. Validation depends on the task.

Parallel agents are safest when they all edit the same files at once.


No. Isolate work and reconcile outputs carefully.

A reflection loop should produce concrete lessons, not just praise.


Correct. The useful output is the next rule or change.

Beginner glossary

The terms without the fog machine.

Loop
A repeatable cycle that continues until a stop, success, or review condition is met.
Agent
An AI system that can use tools and make step-by-step decisions toward a goal.
LLM
Large language model: the model that reads, writes, reasons, and predicts text or actions.
Tool call
A request from the model to use a capability such as search, file read, edit, test, or browser action.
Context
The information the AI has available: your prompt, files, history, docs, outputs, and constraints.
Memory
Information saved across turns, sessions, files, or systems so the loop does not start cold each time.
Reflection
A review step where the system critiques an attempt and turns lessons into the next action.
ReAct
A pattern that interleaves reasoning and acting so observations can guide the next step.
Reflexion
A research pattern where language feedback helps agents improve later attempts.
Eval
A test or scoring method that checks whether outputs meet a defined standard.
Validation
Evidence that the result actually works or matches the requirement.
Stop condition
A rule that tells the loop when to stop, escalate, or ask for help.
Budget
A limit on time, iterations, token cost, money, or attention.
Token cost
The usage cost of sending and receiving model text, including repeated loop turns.
Human-in-the-loop
A design where a person reviews or approves important outputs and actions.
AGENTS.md
A Codex instruction file that gives project-specific guidance before work starts.
CLAUDE.md
A Claude Code instruction file for project memory, norms, and recurring guidance.
MCP
Model Context Protocol, a way for AI tools to connect with external systems and context.
Cron
A schedule format used to run tasks at specific times or intervals.
Routine
A saved recurring or triggered AI task, often running outside a single chat session.
PR
Pull request: a proposed code change for review before merging.
CI
Continuous integration: automated checks such as tests, lint, and builds.
Repository
A project folder tracked by a version control system such as Git.
Branch
An isolated line of code changes that can be reviewed before merging.
Rollback
A plan to restore the previous working state if a change causes problems.
Capstone

Build your Personal AI Loop Operating System.

Create one Codex loop, one Claude Code or general agent loop, one research loop, one QA loop, one SEO/content loop, one safety checklist, one AGENTS.md starter file, one weekly improvement routine, and one final Loop Operating Manual.

Final proof

Your system is ready when every loop has a goal, inputs, allowed actions, forbidden actions, validation method, done condition, max attempts, stop rules, and human approval point.

Capstone prompt
Help me build my Personal AI Loop Operating System. Interview me briefly if needed, then create one Codex loop, one Claude Code or general agent loop, one research loop, one QA loop, one SEO/content loop, one safety checklist, one AGENTS.md starter file, one weekly improvement routine, and one final Loop Operating Manual. Include stop rules, approval gates, evidence required, and a review checklist.

Continue learning on Kingy AI

Verified internal links.

These links were checked before publication. Placeholder ideas were omitted rather than linked.

Links intentionally omitted

  • No requested internal-link ideas were left unlinked after final live verification. Placeholder links were not added.

FAQ

Common beginner questions.

What are AI loops?

AI loops are repeatable AI workflows that keep planning, acting, checking, and improving until a result is done, blocked, unsafe, too expensive, or ready for human review.

What is an AI agent loop?

An AI agent loop is a cycle where a model uses context and tools, observes the result, then decides the next step until the task is complete or stopped.

What is loop engineering?

Loop engineering is the practical skill of designing goals, context, tools, validation, budgets, stop rules, and review points for AI systems.

What is the difference between a prompt and a loop?

A prompt asks once. A loop repeats a pattern and checks each result against a condition.

What is the difference between a workflow and a loop?

A workflow follows steps. A loop repeats steps based on evidence, failure, progress, or a scheduled condition.

How do Codex loops work?

Codex works through model, tool, and action steps such as reading files, editing, running commands, and reporting results until the task is complete or canceled.

What is Codex /goal?

Codex /goal sets a durable objective for a thread, so Codex can keep checking the objective and completion criteria across longer work.

How do Claude Code loops work?

Claude Code gathers context, takes action, verifies results, and repeats as needed. It can also use /loop for scheduled prompts inside a session.

What is Claude Code /loop?

Claude Code /loop repeats a prompt at a fixed or dynamic interval within a session, useful for temporary polling or maintenance work.

What are Claude Code Routines?

Routines are saved tasks that can run on schedules, API triggers, or GitHub events with configured repositories, environments, connectors, and permissions.

Do I need to know how to code?

No. This course starts with plain-language loops for research, content, QA, and WordPress. Coding examples are explained gently.

Are AI loops safe?

They can be safer than one-shot prompting when they include evidence, budgets, stop rules, permissions, and human review. They are unsafe when they can act without limits.

When should I not use an AI loop?

Avoid loops for high-risk actions you cannot supervise, tasks with private data you should not share, vague goals, or tiny questions that need only one answer.

What is human-in-the-loop AI?

It means a human is included at important review or approval points, especially before public, financial, customer, data, or production actions.

What is a ReAct loop?

ReAct is a reasoning and acting pattern where a model reasons, acts through a tool or environment, observes the result, and continues.

What is a reflection loop?

A reflection loop critiques an output or attempt, extracts lessons, and uses those lessons to improve the next attempt.

Can AI loops help with SEO?

Yes, when they improve search intent fit, structure, internal links, sources, freshness, metadata, and reader usefulness without keyword stuffing.

Can AI loops help with WordPress?

Yes. WordPress loops are useful for custom HTML QA, content refreshes, link checks, accessibility review, schema checks, and pre-publish review.

Can I use this course without videos?

Yes. This version is a complete written and interactive course with templates, generators, checklists, and a workbook download.

How do I know if my loop is mature enough to run?

Use the maturity checklist: goal, context, allowed tools, evidence, budget, stop rules, review gates, and rollback. Missing any of these is a reason to keep the loop supervised.

What is the safest first loop for a beginner?

Start with a draft-only loop that cannot publish, delete, spend, deploy, email, or access private data. Let it produce a recommendation and evidence for you to review.

Should I use scheduled loops right away?

Usually no. Run the loop manually first, prove the output is useful, then add a schedule only after the prompt, permissions, stop rules, and review path are clear.

What makes this different from a normal AI agents course?

This course focuses on practical loop design for non-technical operators: examples, WordPress QA, SEO refreshes, Codex /goal prompts, Claude Code loops, safety gates, and interactive worksheets.

Can a loop be useful without tool access?

Yes. Many useful beginner loops are draft-only: research planning, outline improvement, prompt testing, source claim review, and reflection checklists.

Sources and accuracy note

Last reviewed: June 9, 2026

AI tools change quickly. Check official OpenAI and Anthropic docs for current commands, plans, limits, permissions, and safety guidance before relying on a live workflow.

  1. OpenAI Codex prompting and Goal modeCodex works through model, tool, and action steps; Goal mode gives a persistent objective and completion criteria.
  2. OpenAI Codex CLI /goal slash commandDocuments setting, viewing, pausing, resuming, and clearing a thread goal.
  3. OpenAI AGENTS.md guidanceExplains durable project instructions that Codex reads before work.
  4. OpenAI Codex skillsDescribes reusable skills as packaged instructions, resources, and optional scripts.
  5. Claude Code agentic loopDescribes gather context, take action, verify results, and repeat.
  6. Claude Code scheduled tasks and /loopDocuments /loop, intervals, session-scoped scheduled tasks, and limitations.
  7. Claude Code routinesDocuments scheduled, API, and GitHub-triggered routines, including reviewable sessions.
  8. Claude Agent SDK agent loopDocuments turn and budget controls such as max turns and max budget.
  9. Hugging Face Agents CourseTeaches Thought, Action, Observation as a beginner agent workflow.
  10. LangGraph prebuilt agents docsDocuments a prebuilt agent graph that calls tools in a loop until a stopping condition is met.
  11. ReAct paperIntroduces interleaved reasoning and acting for language models.
  12. Reflexion paperExplores verbal feedback and reflection for language agents.
  13. Google SEO Starter GuideSearch guidance for useful, organized, people-first pages.
  14. Google Course structured dataCourse schema guidance for name, provider, and description details.
  15. Addy Osmani on loop engineeringFrames loop engineering as designing systems that prompt, check, remember, and dispatch agent work.
  16. Martin Fowler on humans and agents in software loopsExplains nested software delivery loops and the human role in why, how, review, and outcome decisions.
  17. Oracle developer article on the agent loopDescribes the AI agent loop as an LLM repeatedly reasoning, acting through tools, observing, and stopping.