The loop-engineering hub is about designing the program that prompts a coding agent. This post is the Copilot map of that idea — not a rewrite of the hub, and not a clone of Claude Code's /loop skill.
GitHub Copilot already runs an agent loop. In VS Code it is the think-act-observe cycle behind Agent chat. In the terminal it is Autopilot, plus experimental /every and /after on Copilot CLI. If you type Claude Code's /loop 5m babysit my PRs into Copilot and expect the same product, you will be disappointed — and you might still burn credits.
This is the how-to: which Copilot surface is which loop, the copy-paste commands, and what that does to what you build or pay.
TL;DR
| Question | Answer |
|---|---|
Does Copilot have Claude Code /loop? | No. Use Autopilot for continuation and experimental /every for a session-local schedule. |
| Fastest IDE loop? | VS Code Chat → select Agent → give a verifiable goal. That is the inner tool loop. |
| Fastest CLI loop? | copilot --autopilot --yolo --max-autopilot-continues 10 -p "PROMPT" |
| Recurring prompt? | /every 30m check CI and fix failures after --experimental or /experimental |
| One-shot delay? | /after 10m re-run the failing test |
Does /every survive exit? | No. The schedule dies with the CLI process. Use cron + copilot -p for overnight work. |
| What costs money? | Every Autopilot continuation is a model call. Credits burn without you clicking. |
| Sister how-tos | Cursor · Claude Code · Codex CLI |
Course: Introduction to Loop Engineering covers ReAct, verification, and live loops. Copy-ready prompts live in the loops directory.
What people actually search after the hub post
Three questions show up the moment someone who lives in VS Code reads a Claude-shaped loop guide:
- Where is Agent mode, and is that already a loop? Yes — it is the inner tool-calling loop. You still author the outer loop (schedule, cap, stop condition).
- What is the Copilot CLI equivalent of
/loop 30m …? Experimental/every INTERVAL PROMPT, plus Autopilot so each tick can keep working. - Will this drain my Copilot quota while I am in a meeting? Yes, if Autopilot is on and
--max-autopilot-continuesis missing.
For the concept layer — observe, act, verify, stop — start with What Is Loop Engineering?. For harness choice, see Claude Code vs Cursor vs GitHub Copilot. This page is only Copilot's knobs.
The three loops inside GitHub Copilot
Treat Copilot as three nested clocks, not one slash command.
| Loop | Where | What repeats | What stops it |
|---|---|---|---|
| Inner agent loop | VS Code Agent mode (and CLI tool-use) | Think → act → observe; prompt rebuilt every round | No more tool calls, tool-call limit, cancellation, stop hooks |
| Autopilot continuation | Copilot CLI Autopilot | New model turns until the task is marked complete | task_complete, Ctrl+C, a blocking error, --max-autopilot-continues |
| Scheduled prompt | Experimental /every / /after | The same prompt on a timer | You delete the schedule, or the CLI session exits |
Loop engineering is the job of writing those stop conditions on purpose. The coding agent is the subroutine. The agent harness — Copilot in VS Code, Copilot CLI in the terminal — is the car around the model.
On May 15, 2026, Julia Kasper, Megan Rogge, and Aaron Munger wrote the inner loop down in The Coding Harness Behind GitHub Copilot in VS Code:
At its core, when you use an agent in VS Code, a tool-calling loop happens: a "think → act → observe → think again" cycle.
That sentence is Copilot's real /loop. Everything else in this guide is how you keep that cycle running without sitting in the chat box.

Do not confuse /every with Claude Code /loop
GitHub's schedule-prompts docs currently list /loop as an alias of /every. If you type /loop 30m run tests in Copilot CLI (experimental on), you are scheduling a session-local prompt — the same mechanism as /every. You are not loading Claude Code's bundled /loop skill, worktree babysitting, or cloud /schedule.
On this site, say /every when you mean Copilot. Say Claude Code /loop when you mean the other product. Mixing the names is how teams copy a prompt from the hub and then wonder why nothing runs overnight.
Loop 1: VS Code Agent mode (the inner think-act-observe cycle)
Official concept page: VS Code's Agents docs. The product name in Chat is Agent.
How to start it
- Open Copilot Chat in VS Code.
- Select Agent (not Ask, not Edit-only — Agent is the one that calls tools in a loop).
- Give a verifiable goal, not a vibe: "make
npm testpass on this branch" beats "improve the auth module." - Stay on the session. You can send a follow-up to redirect; you do not need to re-select Agent each message.
That is enough to run the inner agent loop. VS Code's own description of the stages is Understand → Act → Validate. A single user turn can contain many rounds. Kasper, Rogge, and Munger define the terms this way:
- A turn is the chat exchange you see: one message in, a response out.
- A round is one pass through the harness: rebuild the prompt, call the model, run tools, record results.
- A run is all the rounds for that turn.
What the harness actually does each round
From the May 15, 2026 harness post — these are the controls you are trusting when you walk away from the editor:
| Inner-loop control | Why it matters |
|---|---|
| Prompt rebuild every round | The model sees current files, not the tree from three edits ago. |
| Tool-call limit | The loop cannot spin forever on read_file / run_in_terminal. |
| Cancellation between rounds | Stop is a first-class check, not a hope. |
| Stop hooks | Extensions can inspect state and either allow finish or push another round. |
| Summarization | When history blows the context window, earlier rounds compress so the agent can keep going. |
You customize that loop with custom agents, agent skills, and hooks — VS Code's customization docs cover personas and lifecycle commands. For Copilot-the-product vs other GitHub Copilot surfaces, Agent mode is still the one that acts.
A prompt that behaves like a loop
Agent mode will iterate, but it will also happily "finish" after a plausible diff if you never name the gate. Paste something with a stop condition:
Goal: npm test exits 0 on this branch.
Do this in a loop:
1. Run npm test.
2. If it fails, read the failure, patch only the failing files, run npm test again.
3. Stop when tests pass, or after you have made three unsuccessful fix attempts
with the same error output.
4. Do not start new features. Do not commit unless I ask.
When you stop, report: tests passing (yes/no), files changed, last error if any.
That is loop engineering inside one Agent turn: action, verification, no-progress cap. The free agent-loop generator will turn a messier workflow into Trigger / Goal / Actions / Verification / Memory if you want the structure first.
Loop 2: Copilot CLI Autopilot (the continuation loop)
Install from GitHub's Copilot CLI install doc. npm requires Node.js 22 or later:
npm install -g @github/copilot
If ignore-scripts=true is in ~/.npmrc:
npm_config_ignore_scripts=false npm install -g @github/copilot
Documented alternatives: brew install --cask copilot-cli (macOS/Linux) and winget install GitHub.Copilot (Windows). First launch: /login, or a fine-grained PAT with Copilot Requests exported as COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN.
You need an active Copilot subscription. Org/enterprise admins can disable the CLI in policy — if copilot authenticates and then refuses, that is usually policy, not a broken install.
Shift+Tab: standard / plan / autopilot
In an interactive session, Shift+Tab cycles modes until you reach autopilot, then you type the prompt. Same key cycles back to standard interactive mode.
GitHub's analogy: standard mode is a coworker who checks back; Autopilot is "here's what I need — tell me when you're finished." Autopilot keeps going until one of these is true:
- The agent determines the task is complete.
- A problem blocks further progress.
- You press Ctrl+C.
- The maximum continuation limit is reached (if you set one).
Autopilot is sticky by default: when a task completes, the next prompt is also Autopilot. Set stayInAutopilot to false via /settings stayInAutopilot false or "stayInAutopilot": false in ~/.copilot/settings.json if you want to fall back to interactive after each task.
Copy-paste: Autopilot from the shell
GitHub's documented programmatic form:
copilot --autopilot --yolo --max-autopilot-continues 10 -p "YOUR PROMPT HERE"
| Flag | Meaning |
|---|---|
--autopilot | Keep working until task_complete (then return to interactive in a live session). |
--yolo | Alias of --allow-all: all tools, paths, and URLs without per-call approval. |
--max-autopilot-continues 10 | Hard cap on continuation steps. Put this on every unattended run. |
-p / --prompt | Headless prompt; CLI processes it and exits (with Autopilot, after the continuation loop). |
--allow-all without --autopilot is not Autopilot. It only skips permission prompts. The agent still stops at decision points. --no-ask-user suppresses clarifying questions but, per GitHub, does not continue through successive model turns the way Autopilot does — so it should not spend extra GitHub AI credits without your involvement the way Autopilot will.
Interactive equivalent once you are already in a session:
/allow-all
/yolo is the same permission grant. GitHub notes these slash commands do not toggle off — running them again does not revoke permissions.
When Autopilot starts without full permissions, the CLI offers: (1) enable all permissions, (2) continue with limited permissions, (3) cancel. Limited mode auto-denies tools that need approval, which often stalls the loop. Sandbox if you enable all permissions: local sandbox completes in-sandbox work; anything that must leave the sandbox is denied.
Typical workflow: plan, then Autopilot
GitHub's recommended shape:
copilot --allow-all --max-autopilot-continues 10- Trust the folder if prompted.
- Shift+Tab to plan, write the outcome, iterate on the plan.
- Accept Accept plan and build on autopilot.
- Enable all permissions if asked.
- Walk away. Check in. Do not skip the continuation cap.
That is the Copilot version of "design the loop, then let the coding agent run inside it."
Loop 3: experimental /every and /after (the schedule)
Official how-to: Scheduling prompts in GitHub Copilot CLI.
These commands are experimental. Enable them with:
copilot --experimental
or, inside a session:
/experimental on
GitHub says once experimental mode is on, the setting persists in config so later launches do not need the flag.
Recurring: /every
/every INTERVAL PROMPT
/every 1h run the test suite and summarize any new failures
/every 30m check for new comments on my open pull requests
The prompt fires after the first interval, then on that cadence until you delete the entry or end the session.
One-shot: /after
/after DELAY PROMPT
/after 30m Give me details of changes to README.md made in the last 30 minutes
The prompt fires once, then drops off the list.
Interval syntax
| Suffix | Unit | Example |
|---|---|---|
s | seconds | 30s |
m | minutes | 5m |
h | hours | 2h |
d | days | 1d |
A bare number is minutes. Minimum interval is 10 seconds. Maximum is 1 day (24 hours).
You can schedule a user-invocable skill (/every 1d /refactor-plan …). You cannot schedule built-in commands such as /clear.
Triggered prompts show a tag like [Scheduled prompt #4]. GitHub documents cancelling by id (for example stop prompt 4). A bare /every or /after opens the session's schedule manager (list and remove). Do not treat that dialog as a place to add jobs — add from the prompt line with arguments.
Session-local: this is the limit that surprises people
Schedules live on that CLI process. Close the terminal and they stop. --continue / --resume restarts them, with the next interval measured from reopen. An /after that never fired can still fire after the delay in the reopened session.
That is not cron. For a prompt with no human session, GitHub's own escape hatch is an external scheduler calling:
copilot -p "YOUR PROMPT"
Overnight CI babysitting belongs there, usually with Autopilot flags:
copilot --autopilot --yolo --max-autopilot-continues 8 -p "Run npm test. If it fails, fix only failing tests. Stop when green or after 8 continues. Summarize."
Wire that to cron / Task Scheduler / CI. /every is for a focused block while the TUI stays up.
/goal and /fleet on Copilot CLI
/goal exists on Copilot CLI too (experimental, aliased with /autopilot [OBJECTIVE] in the command reference). Example shape:
/goal Refactor the auth module --max-ai-credits 5
When the credit cap hits, Autopilot pauses and shows usage against the cap. /goal on / /goal off toggle Autopilot without setting an objective and do not take --max-ai-credits. This is Copilot's /goal, not Claude Code's.
/fleet fans out parallel subagents. Use it when a tick of /every is "analyze security, performance, and a11y" — not as a substitute for a stop condition.
Programmatic loops: -p and the SDK agent loop
-p / --prompt is the CLI's non-interactive entry. Combine it with --autopilot when you want the continuation loop, not a single shot.
The Copilot SDK is a JSON-RPC transport. GitHub's agent-loop doc is explicit: the CLI runs the tool-use loop; the SDK does not. Each iteration is one LLM API call (assistant.turn_start / assistant.turn_end). There are no hidden planning calls.
Two completion signals:
| Signal | Guarantee | Use it for |
|---|---|---|
session.idle | Always emitted when the tool-use loop ends. Ephemeral. | "The agent stopped processing." sendAndWait() waits on this. |
session.task_complete | Optional. Model must signal it. Persisted. May include a summary. | "The agent thinks the overall task is done." Best-effort. |
Autopilot nudges for task_complete. If the tool-use loop ends without that call, the CLI injects a synthetic user message (GitHub's wording): you have not marked the task complete with the task_complete tool; stop planning and implement; you are not done until the task is fully completed. That restart is another billed loop. The nudge also tells the model not to call task_complete while questions, errors, or remaining steps are open.
In ordinary interactive chat the CLI does not nudge. The model may answer and idle without ever emitting task_complete. For scripts, wait on session.idle (and session.error); treat task_complete as semantic, not mechanical.
session.on("session.task_complete", (event) => {
console.log("Task done:", event.data.summary);
});
Count LLM calls with the session event log GitHub documents:
grep -c "assistant.turn_start" ~/.copilot/session-state/<sessionId>/events.jsonl
That count is the credit-relevant loop length.
Honest limits
/everyis not a daemon. Laptop lid, SSH drop, orexitkills the schedule. Teams that treat it like systemd will miss ticks and then over-correct with tighter intervals, which only burns more credits when the session is up.- Experimental means the surface can move. Command shape, schedule-manager keys, and
/goalcredit panels can change. Design the prompt and the cap so you can retarget cron tomorrow. --yolois a permission grant, not a quality grant. Autopilot with full permissions can edit and delete files. GitHub's Autopilot doc says you should know that before you enable it. Prefer a sandbox or a throwaway worktree for the first unattended run.- Vague goals produce expensive junk. GitHub says Autopilot is for well-defined tasks (tests, refactors, CI failures), not open-ended product exploration. A loop with nothing that can say no — tests, types, a real error — is the agent agreeing with itself. That warning is as old as the hub post.
- Limited permissions stall Autopilot. Auto-deny on approval-gated tools looks like a hung agent. It is often the permission mode.
- Sticky Autopilot surprises the next prompt. If you forget you are still in Autopilot, the next one-liner also continues until
task_complete. - VS Code Agent mode is still one chat turn's inner loop. It will iterate tools. It will not re-wake at 2 a.m. unless you add CLI Autopilot,
/every, or an external scheduler. - Do not scrape Copilot UI screenshots into internal wikis as if they were your IP. GitHub/VS Code chrome is their UI. Use this post's commands and the flywheel diagram; keep your own terminal output if you need a screenshot.
What this means for what you build or pay
Copilot loops change who clicks, not whether tokens are billed.
GitHub's Autopilot documentation states the cost clearly: each interaction consumes AI credits from tokens processed, and in Autopilot Copilot initiates those interactions without your direct involvement. --max-autopilot-continues is a loop-engineering control, not a nicety. Experimental /goal … --max-ai-credits N is the dollar-shaped twin of that cap.
What to actually do:
| If you… | Pay / build implication |
|---|---|
| Run Agent mode on a greenfield spike | You are in the inner loop. Cost is visible because you are watching. Verification still matters. |
| Run Autopilot on a flaky suite with no continuation cap | Continuations can chew a month of premium requests in an afternoon. Set the cap. Prefer a worktree. |
Use /every 10s because "tighter is better" | You will pay for idle ticks. Match interval to how fast the world changes (CI, PR comments). Floor is 10s; that does not mean you should use 10s. |
Put copilot --autopilot --yolo -p in CI | You are now running an unattended agent harness on a bot identity. Scope the PAT, cap continues, and fail the job on session.error. |
| Need overnight PR babysitting | Do not use /every. Use cron/CI + -p, or a sibling harness whose scheduler is actually durable — Claude Code loops, Cursor, Codex CLI. |
| Already pay for Copilot seats | Autopilot does not add a second product SKU; it spends the same credit pool faster. Budget the loop, not the seat. |
If the honest answer is "we cannot name a test that would stop this," do not Autopilot it. Write a better Agent-mode prompt, or do not loop.
Related reading
This series
- How to run loops in Cursor
- How to run loops in Claude Code
- How to run loops in Codex CLI
- Claude Code vs Cursor vs GitHub Copilot
Loop engineering
- Loop Engineering: coding agent loops that run while you sleep
- What Is Loop Engineering for AI Agents?
- How to build your first agent loop
- How to turn agent skills into loops
- explainx.ai loops directory
- Loop Engineering course
Copilot
Official docs (GitHub / VS Code)
- VS Code: Agents (agent loop, subagents, memory, planning)
- The coding harness behind GitHub Copilot in VS Code (Julia Kasper, Megan Rogge, Aaron Munger, May 15, 2026)
- Copilot CLI Autopilot
- Scheduling prompts (
/every,/after) - Install Copilot CLI
- SDK agent loop (
task_complete)
Dictionary: loop engineering · agent loop · GitHub Copilot · coding agent · agent harness
Copilot CLI flags, experimental /every / /after / /goal, Autopilot credit behavior, and VS Code Agent harness details are accurate as of August 20, 2026 against GitHub and VS Code documentation. Experimental surfaces change; re-check the linked official pages before you wire unattended jobs.
