ktg-plugin-marketplace/plugins/ultra-cc-architect/skills/cc-architect-catalog/background-agents-reference.md
Kjell Tore Guttormsen ab504bdf8c refactor(marketplace): split cc-architect from ultraplan-local into its own plugin
Extract `/ultra-cc-architect-local` and `/ultra-skill-author-local` plus all 7
supporting agents, the `cc-architect-catalog` skill (13 files), the
`ngram-overlap.mjs` IP-hygiene script, and the skill-factory test fixtures
from `ultraplan-local` v2.4.0 into a new `ultra-cc-architect` plugin v0.1.0.

Why: ultraplan-local had drifted into containing two distinct domains — a
universal planning pipeline (brief → research → plan → execute) and a
Claude-Code-specific architecture phase. Keeping them together forced users
to inherit an unfinished CC-feature catalog (~11 seeds) when they only
wanted the planning pipeline, and locked the catalog and the pipeline into
the same release cadence. The architect was already optional and decoupled
at the code level — only one filesystem touchpoint remained
(auto-discovery of `architecture/overview.md`), which already handles
absence gracefully.

Plugin manifests:
- ultraplan-local: 2.4.0 → 3.0.0 (description + keywords updated)
- ultra-cc-architect: new at 0.1.0 (pre-release; catalog is thin, Fase 2/3
  of skill-factory unbuilt, decision-layer empty, fallback list still
  needed)

What stays in ultraplan-local: brief/research/plan/execute commands, all
19 planning agents, security hooks, plan auto-discovery of
`architecture/overview.md` (filesystem-level contract, not code-level).

What moved (28 files via git mv, R100 — full history preserved):
- 2 commands, 8 agents, 1 skill catalog (13 files), 2 scripts, 8 fixtures

Documentation updates: plugin CLAUDE.md and README.md for both plugins,
root README.md (added ultra-cc-architect section, updated ultraplan-local
section), root CLAUDE.md (added ultra-cc-architect to repo-struktur),
marketplace.json (registered ultra-cc-architect), ultraplan-local
CHANGELOG.md (v3.0.0 entry with migration guidance).

Test verification: ngram-overlap.test.mjs passes 23/23 from new location.

Memory updated: feedback_no_architect_until_v3.md now points at the new
plugin and reframes the threshold around catalog maturity rather than an
ultraplan-local milestone.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-30 17:18:47 +02:00

4.9 KiB
Raw Blame History

name description layer cc_feature source concept last_verified ngram_overlap_score review_status
background-agents-reference CC background agents — long-running subagents with run_in_background and Monitor for progress streaming. reference background-agents https://docs.claude.com/en/docs/claude-code/background-agents async-agents-and-monitoring 2026-04-19 null approved

Background Agents — Reference

A background agent is a subagent launched with run_in_background: true. The parent does not block on its return; instead, the harness notifies the parent when the agent completes. Useful for long-running exploration, orchestration, and work that overlaps with user activity.

Hard constraint (verified 2026-04-19): The Claude Code harness does NOT expose the Agent tool to sub-agents — foreground OR background. A sub-agent cannot spawn further sub-agents. "Nested orchestration" patterns silently degrade: the inner orchestrator loses its planned swarm and falls back to single-context reasoning. Source: github.com/anthropics/claude-code/issues/19077. Only the main session can spawn agents. Plan shapes that require a swarm below a background agent do not work — keep the orchestration in the main command context instead. See Pitfalls and Composition below.

Launching

Agent({
  description: "...",
  subagent_type: "...",
  prompt: "...",
  run_in_background: true
})

The Agent tool returns a handle (agent ID / name). The parent continues its turn; no wait.

Monitoring

Two complementary tools work with background agents:

  • Monitor — streams updates from a named background process. Each event line arrives as a notification. Used for long-running Bash processes (and, in newer builds, some agent streaming paths).
  • Completion notifications — the harness posts a message to the parent when the background agent finishes. The parent sees it as a system-reminder / notification on its next turn.

When background is worth it

  • Overlapping work — orchestrator runs 30+ minutes of research while the user continues coding. Without background, the user is blocked the whole time.
  • Parallel waves — wave N of sessions running concurrently; the parent collects results as they arrive.
  • Long-running processes — an agent waiting on a build, test run, or deployment.

When background hurts

  • Short tasks — agent returns in 10 seconds; making it async adds overhead for no gain.
  • Tight coupling — if the parent needs the result before doing anything else, background is just foreground with extra steps.
  • Unbounded token spend — a background agent with no budget signaling can run until it hits limits. Cap explicitly.

Common shapes

Shape A: Orchestrator handoff (AVOID — see warning above)

Pattern: parent interviews user, writes a spec, launches a background orchestrator that re-spawns a swarm of workers. This does not work as documented. The background orchestrator never gets the Agent tool, so the swarm never materializes and the inner orchestrator degrades to single-context reasoning.

Anti-pattern confirmed in ultraplan-local v1.0v2.3.2. Removed in v2.4.0 — the command markdown itself is now the orchestrator in main context.

Shape B: Parallel waves (single-file execution only)

Parent decomposes work into N independent sessions, launches them all in parallel with run_in_background: true, then synthesizes returns as they arrive. Each session must be self-contained and avoid spawning further agents — they can use Bash, Read, Grep, Edit, Write, but not Agent.

Valid use: ultraplan-local --decompose execution where each session implements concrete code changes without further orchestration.

Shape C: Watcher

A background agent polls a process (build, test, deploy) and reports status changes. Uses Monitor for streaming. Watchers need Bash/Read only — no Agent tool needed, so the harness limitation does not apply.

Pitfalls

  • Lost context — if the parent conversation ends before the background agent completes, the result may be orphaned. Persist to disk, not memory.
  • Notification fatigue — too many background agents = too many reminders interrupting the parent's flow.
  • Debugging — background agents run out of the user's view; their failures can be silent. Log to files, not just return messages.

Composition

  • Background + worktrees: the canonical pattern for parallel implementation — each background agent in its own worktree, no clashes. Each session performs concrete file changes, not nested orchestration.
  • Background + subagents: NOT SUPPORTED. A sub-agent, whether foreground or background, does not have the Agent tool. Only the main session can spawn agents. See the warning at the top of this file.
  • Background + hooks: hooks fire inside the background agent's tool calls, same as foreground.