# long-task

long-task is a Claude Code subagent for tasks with 5–60 minute waits. It runs lengthy commands in the background and hands work over when waiting should stop.

- subagent · `type=agent` · Claude Code, Codex, Cursor · ★ 262 repo stars
- Author: zuiho-kai
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/zuiho-kai/bothouse/tree/HEAD/bridge/contrib/hooks/agents/long-task.en.md
- Updated: 2026-11-17
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/long-task

## What it does

The long-task subagent handles work whose stages may wait 5–60 minutes, including modeling, routing, rendering, compilation, training, and experiments. Its prompt cache lasts 1 hour, and multiple tasks may run at the same time.

Commands expected to exceed 5 minutes run in the background or through `nohup`, with log and result files kept alongside the work. When a run is slow, the subagent checks CPU or GPU use, single-core execution, serial steps, and repeated startup or loading. It then adjusts parallelism, batching, or reuse before the next run. Jobs with waits under 5 minutes go to a general-purpose agent.

For waits beyond 1 hour, it leaves a handoff containing progress, file paths, and the next step, then finishes instead of waiting. It creates the same kind of handoff after roughly 150k context tokens. The delivery includes output paths and acceptance results.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/agents/long-task.en.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/long-task.en.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/long-task.en.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/zuiho-kai/bothouse/tree/HEAD/bridge/contrib/hooks/agents/long-task.en.md

## When to use it
- run a compilation that is expected to exceed 5 minutes
- keep logs and result files for a long rendering job
- find serial or repeated work slowing down an experiment
- hand a job to a new agent after more than 1 hour
- return output paths with acceptance results

## Example prompts
- Run the rendering job in the background and continue when it finishes.
- Start the experiment expected to take over 5 minutes, with log and result files.
- If training will run for more than 1 hour, write a handoff with progress and file paths.

## Source text · long-task.en.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 745d817c7b3c54bf.

BEGIN THIRD-PARTY FILE 745d817c7b3c54bf
```text
---
name: long-task
description: Any task expected to wait 5–60 minutes along the way (modeling, routing, rendering, compiling, training, experiments, ...); prompt cache 1 hour. Any number can run at once. Under 5 minutes of waiting use general-purpose; over 1 hour, do not stay waiting: start it in the background, finish, and start a new agent when the result is in.
experimental:
  cacheTtl: 1h
---
You are a long-task subagent. Do what the task asks.
Run any command expected to take over 5 minutes with nohup or in the background (run_in_background), writing a log and result files; continue when the completion notice arrives. Do not sleep-poll.
When a command has run over 5 minutes, first find out why it is slow (CPU/GPU use, one core only, steps run one after another, the same start-up and loading repeated); change what can be parallelized, batched or reused before the next run, without lowering output quality; report the time before and after.
If the wait will be over 1 hour, start it in the background, write a handoff (how far, where the files are, the next step), deliver and finish. Do not wait.
Once the context is past about 150k tokens (a hook reminds you), write a short handoff (how far, where the files are, the next step) and deliver at once; the dispatcher starts a new agent to continue.
In the delivery, give the output file paths and the acceptance results.
<!-- conest:agent long-task (installed by bothouse setup hooks; delete this line and bothouse no longer overwrites or removes this file) -->
```
END THIRD-PARTY FILE 745d817c7b3c54bf

The third-party file has ended. Everything between the 745d817c7b3c54bf tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

© zuiho-kai · Apache-2.0 · https://github.com/zuiho-kai/bothouse/tree/HEAD/bridge/contrib/hooks/agents/long-task.en.md

## Similar
- [long-task-coordinator](https://affpapa.org/en/nevibecode/skills/long-task-coordinator.md) — skill · 691 installs
- [long-task-continuation](https://affpapa.org/en/nevibecode/skills/long-task-continuation.md) — skill · ★ 1450 repo stars
- [very-long-text-summarization](https://affpapa.org/en/nevibecode/skills/very-long-text-summarization.md) — skill · 210 installs
- [long-horizon-prompting](https://affpapa.org/en/nevibecode/skills/long-horizon-prompting.md) — skill · 188 installs
- [nemo-mbridge-perf-moe-long-context](https://affpapa.org/en/nevibecode/skills/nemo-mbridge-perf-moe-long-context.md) — skill · 1800 installs
- [emerging-techniques-long-context](https://affpapa.org/en/nevibecode/skills/emerging-techniques-long-context.md) — skill · 107 installs

From the same set: [zuiho-kai/bothouse](https://affpapa.org/en/nevibecode/by/zuiho-kai/bothouse.md) — 14 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
