You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We want PawWork to add the background half of the agent lifecycle now that #283 v1 has shipped through PR #287. The current v1 is intentionally foreground-only: agent blocks until terminal, lifecycle state is persisted through SubagentRun, and the model can inspect owned runs through agent_list and agent_output. This issue scopes the next step: background subagents that can keep running after the parent turn returns, then notify and resume safely when they finish.
What happens today?
PR #287 implemented the foreground lifecycle foundation: explicit running, completed, completed_empty, failed, and canceled_by_user states; a per-parent concurrency cap; agent_list; agent_output; resume validation; and parent-owned lifecycle persistence. The deferred pieces from #283 are still not present: run_in_background, parent-session completion notifications, safe auto-resume, agent_stop, blocking output reads, and restart cleanup for stranded running rows.
What would a good result look like?
agent supports run_in_background?: boolean while preserving the existing foreground default. A background subagent returns quickly with a clear running status and enough identity for later inspection. Terminal background states inject a parent-session notification and trigger safe auto-resume only when the parent can continue without surprising the user. The model can inspect background progress through the existing agent_list / agent_output tools. Any new stop or blocking-read tool surface must be justified by the background lifecycle, not added speculatively.
Scope
Add run_in_background?: boolean to agent, default false.
Reuse the existing SubagentRun lifecycle vocabulary and parent-owned state.
Preserve agent as the spawn entry point; keep agent_list and agent_output as narrow lifecycle query tools.
Add parent-session terminal notification for background completion, failure, cancellation, and empty output.
Define safe auto-resume rules so the parent can react to background completion without continuing blindly.
Decide whether agent_output needs block?: boolean / timeout_ms?: number once background reads exist.
Add agent_stop only if background execution gives the model a real re-entrant point where stopping a child is useful.
Add an abandoned or equivalent startup sweep for persisted running rows left behind by host restart.
Non-goals
Do not replace the current three-tool model with agent({ action: ... }). The current shape matches Claude Code-style best practice: spawn is one tool, lifecycle inspection is handled by narrow companion tools.
Do not add a new task panel, global background-task UI, or full task system.
Do not add nested subagents.
Do not add automatic backgrounding heuristics in this issue.
Claude Code reference direction: Agent is the spawn tool, while task/output/stop/message surfaces remain separate narrow tools rather than one Agent(action=...) envelope.
What task are you trying to do?
We want PawWork to add the background half of the agent lifecycle now that #283 v1 has shipped through PR #287. The current v1 is intentionally foreground-only:
agentblocks until terminal, lifecycle state is persisted throughSubagentRun, and the model can inspect owned runs throughagent_listandagent_output. This issue scopes the next step: background subagents that can keep running after the parent turn returns, then notify and resume safely when they finish.What happens today?
PR #287 implemented the foreground lifecycle foundation: explicit
running,completed,completed_empty,failed, andcanceled_by_userstates; a per-parent concurrency cap;agent_list;agent_output; resume validation; and parent-owned lifecycle persistence. The deferred pieces from #283 are still not present:run_in_background, parent-session completion notifications, safe auto-resume,agent_stop, blocking output reads, and restart cleanup for stranded running rows.What would a good result look like?
agentsupportsrun_in_background?: booleanwhile preserving the existing foreground default. A background subagent returns quickly with a clear running status and enough identity for later inspection. Terminal background states inject a parent-session notification and trigger safe auto-resume only when the parent can continue without surprising the user. The model can inspect background progress through the existingagent_list/agent_outputtools. Any new stop or blocking-read tool surface must be justified by the background lifecycle, not added speculatively.Scope
run_in_background?: booleantoagent, default false.SubagentRunlifecycle vocabulary and parent-owned state.agentas the spawn entry point; keepagent_listandagent_outputas narrow lifecycle query tools.agent_outputneedsblock?: boolean/timeout_ms?: numberonce background reads exist.agent_stoponly if background execution gives the model a real re-entrant point where stopping a child is useful.abandonedor equivalent startup sweep for persistedrunningrows left behind by host restart.Non-goals
agent({ action: ... }). The current shape matches Claude Code-style best practice: spawn is one tool, lifecycle inspection is handled by narrow companion tools.Acceptance criteria
agent({ run_in_background: true })starts a background subagent and returns a clear running result without blocking the parent until terminal.agentbehavior remains the default and stays backward-compatible with PR feat(agent): subagent lifecycle v1 (foreground-only) #287.agent_listincludes running background runs and unread terminal background runs under the existingall_activebehavior.agent_outputcan inspect running background runs without consuming them, and consumes only terminal rows on first read.runningrows looking live forever; the startup sweep marks them with a clear terminal or abandoned state.agent_stopis added, it can stop only subagents owned by the current parent session and returns the same lifecycle vocabulary.References
Agentis the spawn tool, while task/output/stop/message surfaces remain separate narrow tools rather than oneAgent(action=...)envelope.