Implementation Task Runtime
Workflow
- Assign every task a stable identity, type, owner, output location, and explicit lifecycle.
- Register starts once per live state generation and preserve UI-held state when a running task is replaced in that same generation; treat process recovery as a separate contract.
- Store output incrementally under bounded, symlink-safe rules and report deltas by byte offset.
- Make concrete task implementations own terminal transitions and notification enqueue attempts while the framework owns polling and safe garbage collection.
- Resolve kill-versus-completion races, release registered resources, and state separately what survives a model call, a session clear, and a process crash.
Read the complete task runtime contract before implementing or auditing this domain. Use the architecture diagram for the ordinary lifecycle and the durability and crash-window diagram to trace live state, output evidence, notification loss, remote-sidecar recovery, and possible duplication.
Boundaries
Own asynchronous work after a tool launches it. Do not merge a task's lifecycle with the initiating tool result or with ephemeral UI progress. Live task state, output files, process-local notification queues, transcripts, and remote sidecars have different recovery guarantees. Remote transport placement may extend a concrete task, but must preserve the same task identity and terminal states.
Completion check
- Preserve all
TR-* contracts in the reference.
- Test start, output growth, background/foreground transitions, live replacement, completion, failure, kill races, missing output, output caps, same-generation notification suppression, crash loss/duplication windows, sidecar corruption, and terminal eviction.
- Confirm no task becomes anonymous and no stale asynchronous patch can resurrect terminal work.
1---2name: implementation-task-runtime3description: Implement asynchronous work and its distinct durability classes, including local shells, local and remote agents, teammates, workflows, monitors, main-session backgrounding, output storage, polling, notifications, cancellation, crash windows, recovery hints, and garbage collection. Use when work must outlive a model call or be resumed, stopped, inspected, or reported later.4---56# Implementation Task Runtime78## Workflow9101. Assign every task a stable identity, type, owner, output location, and explicit lifecycle.112. Register starts once per live state generation and preserve UI-held state when a running task is replaced in that same generation; treat process recovery as a separate contract.123. Store output incrementally under bounded, symlink-safe rules and report deltas by byte offset.134. Make concrete task implementations own terminal transitions and notification enqueue attempts while the framework owns polling and safe garbage collection.145. Resolve kill-versus-completion races, release registered resources, and state separately what survives a model call, a session clear, and a process crash.1516Read [the complete task runtime contract](references/task-runtime-contract.md) before implementing or auditing this domain. Use the [architecture diagram](assets/architecture.drawio) for the ordinary lifecycle and the [durability and crash-window diagram](assets/durability-crash-windows.drawio) to trace live state, output evidence, notification loss, remote-sidecar recovery, and possible duplication.1718## Boundaries1920Own asynchronous work after a tool launches it. Do not merge a task's lifecycle with the initiating tool result or with ephemeral UI progress. Live task state, output files, process-local notification queues, transcripts, and remote sidecars have different recovery guarantees. Remote transport placement may extend a concrete task, but must preserve the same task identity and terminal states.2122## Completion check2324- Preserve all `TR-*` contracts in the reference.25- Test start, output growth, background/foreground transitions, live replacement, completion, failure, kill races, missing output, output caps, same-generation notification suppression, crash loss/duplication windows, sidecar corruption, and terminal eviction.26- Confirm no task becomes anonymous and no stale asynchronous patch can resurrect terminal work.