后台任务管理

本条目介绍 后台任务管理 的公开用途。DeepSkill 当前公开目录说明:“当用户想要查看、检查、取消或清理先前链式运行期间触发的后台代理时使用。读取/管理 `.hyperflow/background/registry.json` 以及每个代理的输出缓冲区 `.hyperflow/background/<id>.md`。独立工具——从不自动调用。 触发方式:/hyperflow:background、"列出后台代理"、"后台正在运行什么"、"取消后台代理"、"显示后台结果"。” 适用场景包括系统管理。本页根据公开目录资料和固定版本的上游仓库整理,建议使用前核对该版本的环境、工具、权限及数据处理要求。Skillπ 提供站方用途介绍与原站链接;原始 SKILL.md 和附件仅在对应许可允许时开放。

仓库
jeremylongshore/tons-of-skills-marketplace

安装方式

先用 Prompt 核对来源,也可切换到安装命令或下载可用的安装包。

安装方式

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "background":https://skillpi.com/zh/skills/deepskill-976bd651983efea1a9dc0470c576cf98d629eab88dd9b752673a22e70cf8b12b。安装前核对上游来源和版本:https://github.com/jeremylongshore/tons-of-skills-marketplace/blob/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/ai-agency/hyperflow/skills/background/SKILL.md。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

此命令从 GitHub 来源仓库获取指定技能。运行前请先查看源文件。

运行工具
npx skills add https://github.com/jeremylongshore/tons-of-skills-marketplace/tree/6ea46b08dce892944db7c16f28d0b5308d402402/plugins/ai-agency/hyperflow/skills/background --skill background
许可协议: —

来源与配置

查看 GitHub 源码

jeremylongshore/tons-of-skills-marketplace固定提交 6ea46b08dce892944db7c16f28d0b5308d402402

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

本条目介绍 后台任务管理 的公开用途。DeepSkill 当前公开目录说明:“当用户想要查看、检查、取消或清理先前链式运行期间触发的后台代理时使用。读取/管理 `.hyperflow/background/registry.json` 以及每个代理的输出缓冲区 `.hyperflow/background/<id>.md`。独立工具——从不自动调用。 触发方式:/hyperflow:background、"列出后台代理"、"后台正在运行什么"、"取消后台代理"、"显示后台结果"。” 适用场景包括系统管理。本页根据公开目录资料和固定版本的上游仓库整理,建议使用前核对该版本的环境、工具、权限及数据处理要求。Skillπ 提供站方用途介绍与原站链接;原始 SKILL.md 和附件仅在对应许可允许时开放。

↓ 0 下载 ↗ 0 分享点击

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
---
name: background
description: |
  Use when the user wants to see, inspect, cancel, or prune background agents fired during prior chain runs. Read/manage `.hyperflow/background/registry.json` and the per-agent output buffers at `.hyperflow/background/<id>.md`. Standalone — never auto-invoked.
  Trigger with /hyperflow:background, "list background agents", "what's running in background", "cancel background agent", "show background result".
allowed-tools: Read, Write, Edit, Bash(ls:*), Bash(cat:*), Bash(rm:*), Bash(find:*), Glob, Grep
argument-hint: "<list|show|cancel|prune> [id|--all]"
version: 4.7.0
license: MIT
compatibility: Designed for Claude Code
tags: [background, orchestration, lifecycle]
---

# Background

Read-only-by-default management interface for background agents fired by other hyperflow skills (dispatch quality gates, deploy CI watcher, scaffold analysis refresh, cache compact, scope speculative prefetch). Reads from `.hyperflow/background/registry.json` + per-agent output buffers.

Full doctrine: [background-agents.md](../hyperflow/background-agents.md).

## Subcommands

| Subcommand | Description |
|---|---|
| `list` | Print the registry: in-flight · completed-uncollected · stalled · errored |
| `show <id>` | Print one agent's output buffer (`.hyperflow/background/<id>.md`) |
| `cancel <id>` | Cancel one specific in-flight agent |
| `cancel --all` | Cancel every in-flight agent (use before closing a session) |
| `prune` | Delete completed `.hyperflow/background/<id>.md` files older than 7 days |

Default subcommand when none provided: `list`.

## Subcommand Details

### `list`

Read `.hyperflow/background/registry.json`. Group entries by status and print a compact table:

```markdown
## In flight (N)

| ID                                | Purpose                              | Fired      | Timeout | Blocks  |
|-----------------------------------|--------------------------------------|------------|---------|---------|
| `bg-1718049600-quality-gates-b2`  | Layer 5 gates Batch 2                | 17:30      | 18:00   | step3   |
| `bg-1718049820-ci-watcher`        | GitHub Actions watch for v4.7.0      | 17:33      | 18:33   | —       |

## Completed (uncollected, N)

| ID                                | Purpose                              | Completed  | Duration | Output |
|-----------------------------------|--------------------------------------|------------|----------|--------|
| `bg-1718045400-scaffold-refresh`  | Refresh .hyperflow/architecture.md   | 16:42      | 2m 18s   | 1.4kb  |

## Stalled / Errored (N)

| ID                                | Purpose                              | Status            | Reason            |
|-----------------------------------|--------------------------------------|-------------------|-------------------|
| `bg-1717980000-cache-compact`     | Compact learnings.md                 | STALLED           | timeout (30m)     |
```

Print one trailing line: `<count> in flight · <count> uncollected · <count> needs attention`. If registry is empty, print `No background agents.` and stop.

### `show <id>`

Read `.hyperflow/background/<id>.md` and print it verbatim. If the agent is still running, print the registry entry first then `Output buffer not yet written.` and stop.

### `cancel <id>`

1. Read registry, find the entry.
2. If `status: running`, signal cancellation per the provider's mechanism (Claude Code: use the runtime's cancellation API for that subagent ID; if unavailable, mark the entry `status: cancelled` and leave the agent to time out on its own — the foreground orchestrator will drop the result on collection).
3. Update registry entry: `status: cancelled`, `cancelled_at: <now>`.
4. Print `Cancelled <id> — <purpose>`.

If the agent already completed, print `Agent <id> already <status> — nothing to cancel.`

### `cancel --all`

For every entry with `status: running`, run the `cancel` flow. Print summary: `Cancelled N agents.`

### `prune`

`find .hyperflow/background/ -name "bg-*.md" -mtime +7 -delete` plus remove their entries from `registry.json` (only entries with `status: complete | error | stalled | cancelled` older than 7 days are pruned). Print: `Pruned N output buffers · N registry entries`.

## Flow

1. Parse subcommand from invocation (default: `list`).
2. Read `.hyperflow/background/registry.json` (if absent, treat as empty).
3. Execute subcommand.
4. Print result.

## Overview

`/hyperflow:background` is the user-facing read/manage interface for background agents. The orchestrator itself maintains the registry as a side-effect of `run_in_background: true` Agent dispatches in other skills — this skill never *fires* a background agent, it only reads/manages the registry.

## Prerequisites

- `.hyperflow/background/registry.json` exists (created on first background dispatch by any other skill — if absent, all subcommands degrade gracefully).
- `.hyperflow/` initialized (run `/hyperflow:scaffold` if missing — though this skill works even without scaffold, since the registry is created on demand).

## Instructions

See [Subcommands](#subcommands) and [Subcommand Details](#subcommand-details). Summary:

1. Parse the subcommand (default `list` when none given).
2. Read the registry from `.hyperflow/background/registry.json`.
3. Execute the subcommand against the registry + per-agent output buffers.
4. Print compact result; do not modify any source code.

## Output

- `list` — table of in-flight / completed-uncollected / stalled+errored, with one trailing summary line.
- `show <id>` — file contents of `.hyperflow/background/<id>.md`.
- `cancel <id>` / `cancel --all` — one-line confirmation per cancelled agent + total.
- `prune` — count of pruned buffers + registry entries.

## Error Handling

| Failure | Behavior |
|---|---|
| Registry file missing | Treat as empty — `list` prints `No background agents.`; other subcommands print `No registry — fire a background agent first.` and stop. |
| Registry JSON malformed | Print `Registry malformed — back up to .hyperflow/background/registry.json.bak and re-create empty.` Move file, write empty registry, continue. |
| `show <id>` for unknown id | List 3 closest IDs by Levenshtein distance. |
| `cancel <id>` for already-completed agent | Print `Agent <id> already <status> — nothing to cancel.` |
| Provider cancellation API unavailable | Mark entry `status: cancelled` in registry; the foreground orchestrator drops the result on collection. Print `Marked <id> as cancelled (provider has no live cancellation API — agent will run to completion or timeout, but result will be discarded).` |
| Prune called with no eligible entries | Print `Nothing to prune — no completed buffers older than 7 days.` |

## Examples

### List in-flight + completed background agents

```
/hyperflow:background list

## In flight (1)
| ID                                | Purpose                              | Fired | Timeout | Blocks |
|-----------------------------------|--------------------------------------|-------|---------|--------|
| `bg-1718049600-quality-gates-b2`  | Layer 5 gates Batch 2                | 17:30 | 18:00   | step3  |

## Completed (uncollected, 1)
| ID                                | Purpose                              | Completed | Duration | Output |
|-----------------------------------|--------------------------------------|-----------|----------|--------|
| `bg-1718045400-scaffold-refresh`  | Refresh .hyperflow/architecture.md   | 16:42     | 2m 18s   | 1.4kb  |

1 in flight · 1 uncollected · 0 needs attention
```

### Show a completed agent's output

```
/hyperflow:background show bg-1718045400-scaffold-refresh

# Background Result — Refresh .hyperflow/architecture.md

| Field      | Value                                |
|------------|--------------------------------------|
| Agent ID   | `bg-1718045400-scaffold-refresh`     |
| Fired at   | 2026-05-16T16:40:00Z                 |
| Completed  | 2026-05-16T16:42:18Z (2m 18s)        |
| Status     | complete                             |
| Tokens     | worker 4.2k                          |

## Output
<refreshed architecture.md content fragments + diff summary>
```

### Cancel everything before closing the session

```
/hyperflow:background cancel --all

Cancelled bg-1718049600-quality-gates-b2 — Layer 5 gates Batch 2
Cancelled bg-1718049820-ci-watcher — GitHub Actions watch for v4.7.0
Cancelled 2 agents.
```

## Resources

- [background-agents.md](../hyperflow/background-agents.md) — full doctrine: when to use, hard rules, registry shape, failure modes, anti-patterns.
- [DOCTRINE.md](../hyperflow/DOCTRINE.md) — rule 8 (background extensions), rule 9 (no AI-attributed background commits).
- [output-style.md](../hyperflow/output-style.md) — table conventions for `list` output.

当前收录版本

4.7.0

核对来源版本 ↗

质量评测

满分 100。前四项来自 DeepSkill 收录的质量报告。

场景价值75/100
评分依据

提供后台代理的完整生命周期管理功能,包括查看、取消和清理,实用性强。

触发精准90/100
评分依据

触发词覆盖全面,包括命令和多种自然语言变体,边界清晰。

结构规范95/100
评分依据

结构清晰,包含详细的子命令说明、示例和错误处理,frontmatter完整。

执行可靠90/100
评分依据

工具使用明确,异常处理覆盖全面,包括文件缺失、格式错误和未知ID等情况。

证据可验 (前四项均值)88/100
计算方式

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

risk · 静态证据核验,不代表运行安全保证。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。

来源与使用声明 SkillPi 的部分技能资料来自公开来源或创作者提交。第三方内容的权利归各自权利人所有。安装或运行前,请查看原站的许可、权限要求和使用风险。

来源与使用

请按详情页的作者、原始来源和许可证核对使用条件,运行前检查技能需要的权限。目录收录不等于已验证安装或安全性。