Concepts
Subagents and background tasks
How LoopCode delegates work to subagents with their own context, how to write your own, and how to run commands, monitors and subagents in the background.
Subagents
A subagent is a separate agent with its own context window, its own instructions, and only the tools its job needs. The main conversation gets back a short report instead of everything the subagent had to read — which keeps your conversation focused and lets several pieces of work happen at once.
LoopCode decides when to delegate. You can also ask: "use an Explore agent to find every place we parse dates".
| Subagent | Job | Tools |
|---|---|---|
| Explore | Answer a specific question about the code | Read-only: read, search, git, language server |
| Agent | Make a bounded change and run the checks that cover it | The tools you code with |
| Verify | Run tests, builds, typechecks and the app itself, and report what passed and failed | Running and reading, without editing |
A conversation can have up to twelve subagents open at once. LoopCode can send a running subagent a follow-up (keeping everything it has read), wait for several to finish, or close ones it no longer needs. /agents lists the subagents available.
Write your own
A custom subagent is a Markdown file with YAML front matter:
---
name: security-reviewer
description: Reviews a change for security problems. Use after any change to auth, payments or data access.
tools: Read, Grep, Glob, Git
model: opus-5
---
You are a security reviewer. Read the diff and the code around it. Report only real,
exploitable problems: the input that triggers each one, the code it breaks, and a fix.| Field | Required | Meaning |
|---|---|---|
name | Yes | Lowercase letters, digits and hyphens |
description | Yes | When to use it. LoopCode reads this to decide when to delegate |
tools | No | The tools it may use, as a list or comma-separated. Omit for the defaults |
model | No | The model it runs on |
The body is its instructions.
| Location | Scope |
|---|---|
.loopcode/agents/<name>.md | This project — commit it to share with your team |
~/.loopcode/agents/<name>.md | All your projects |
.claude/agents/, ~/.claude/agents/ | Claude Code's subagents, read too |
Each one becomes a tool the model can call. A file with a problem is reported without hiding the others.
Background tasks
Some work should not block the conversation: a dev server, a file watcher, a long build, a subagent doing a big investigation. LoopCode can run these in the background and keep working.
- The agent starts commands in the background itself when they are long-lived, and can monitor something as it changes — tail a log, poll CI or a deploy — reacting when something happens.
- Press ctrl b in the terminal to move a running command or subagent to the background.
/taskslists background commands, monitors and subagents, shows their recent output, and stops them;/stopstops all of them.- In the desktop app, the Tasks and Terminal tabs show them, with a stop button for each.
A task started in one conversation stays tied to it. When you stop a task, the agent is told the next time it works in that conversation.