# /goal, /loop and Agent view: work that runs without you

Course: Claude Code: Pro Level — https://zero2vibecode.com/learn/claude-code-pro
Canonical URL: https://zero2vibecode.com/learn/claude-code-pro/3-4-goal-loop-agent-view
Verified against: Claude Code v2.1.306 (2026-10-22)
Last updated: 2026-10-22

/goal keeps working until a condition is met, /loop repeats a task on an interval, a cloud scheduled task runs on a schedule, and Agent view keeps several background sessions on one screen. Powerful — and each needs its own boundary.

In earlier lessons you ran Claude without an interface. Now, four ways to keep it **working on its own** while you are not pressing Enter.

## /goal — until the condition is met

```
/goal npm test exits with code 0, a new test in test/links.test.js checks links with ?query, existing tests are not changed, the fix is committed; or stop after 8 turns
```

Claude starts right away. After every turn, **a separate evaluator model** reads the conversation and decides whether the condition is met. If not, Claude keeps going. It stops when the condition is met, judged impossible, an error happens, or you type `/goal clear`.

The evaluator sees **only the conversation**. Hence the rules for a good condition:

- name a check whose result will show up in the output: "`npm test` exits with code 0", not "the code is clean";
- say what must **not** change;
- end with a **turn limit**.

## /loop — on an interval

```
/loop 1m run npm test and append a line to .practice/loop-log.txt with the time and the number of failing tests. Do not change any other files.
```

The task repeats every minute while the session is idle — between your requests, never in the middle of a Claude answer. It stops when you cancel it ("cancel the npm test loop") or when it expires.

## Cloud scheduled task — in the cloud

```
/schedule in 5 minutes run npm test and reply with the number of passing and failing tests. Do not change files, do not commit, do not push.
```

A cloud scheduled task (until recently called a routine) runs **in the cloud** — on a schedule, through the API, or on a GitHub event. It is a full cloud session that does not stop for approvals and acts **in your name**: its commits and pull requests are signed by your GitHub user. To list them — `/schedule list`.

## Agent view — several background sessions

```bash
claude agents --permission-mode manual --model sonnet
```

One screen for background sessions. Each request you type starts a **separate** session, which keeps running after you close the screen. Before its first file edit, a session moves into its own worktree in `.claude/worktrees/`, so parallel tasks do not get in each other's way. Rows are grouped into **Working**, **Needs input** and **Completed**; `Space` peeks at what a session is doing, `→` attaches to it.

**Careful.** 
A loop fires while you are away too, sending the whole session context each time — watch your spending with /usage. A cloud scheduled task by default gets every connection on your claude.ai account, including write access: remove the ones it does not need right after creating it. And a green run status only means the session started and finished without an infrastructure failure — open the run and read what actually happened.

**Practice in the terminal.** Open Agent view with --permission-mode manual and --model sonnet. Then try plain claude agents — the practice terminal will show why the mode is better set explicitly.
