Skip to content

Show the delegated task in the parent transcript on spawn #10

Description

@monneyboi

Problem

When spawn_agent is called, the task is written to a task file and handed to the child via @<taskPath>, but the parent window never shows what was sent. The tool result only reports the subagent id and location:

Spawned subagent in . ...

To see what a subagent is working on, the user has to switch to its tmux window. The parent transcript — the one place that records the whole delegation lifecycle (spawn → report → revise → close) — is missing the most important part: the task itself.

Expected behavior

After a successful spawn, the parent transcript should display the task that was delegated, alongside the id/location info. It should be visible without switching windows, and consistent with how subagent reports are already rendered (fork-result with renderForkMessage, including the collapsed preview for long text).

Fix

In spawn_agent's execute in index.ts, after the spawn succeeds, deliver the task via pi.sendMessage with a new custom type (e.g. fork-spawn), display: true, and no triggerTurn — this is a display-only record, not a new conversation event:

pi.sendMessage(
  {
    customType: SPAWN_TYPE,
    content: `Spawned subagent ${id} in ${location}:\n\n${task}`,
    display: true,
  },
  { triggerTurn: false },
);

Register the type with the existing renderForkMessage renderer so long tasks collapse to the PREVIEW_LINES preview like reports do.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions