Skip to content

Derived work handoffs

Zdev can publish a small follow-up bundle without asking you to re-approve work you already authorized, provided the work stays directly inside the current task’s area brief, outcome, boundaries, and testing policy. This adds no new task state, lineage metadata, or worker authority over .zdev.

The coordinator owns both the decision and every mutation. A worker may return at most one proposal alongside its result, and never imports tasks, edits the source task, completes work, stages files, or commits.

An AFK task may split when smaller tasks make implementation or verification cleaner, without new approval as long as the outcome, boundaries, and testing stay unchanged. Set unattended children explicitly to afk: true (since TaskDraft defaults to false), and keep human-dependent checks attended and late in the dependency graph. The source task keeps its original done conditions; repeated splitting without implementation progress falls under the skill’s death-loop rules.

A proposal consists of two parts: a header line and one JSON object. Any prefix, suffix, Markdown fence, missing field, unknown field, duplicate JSON key, invalid UTF-8, or second JSON object invalidates it.

PROPOSE zdev-derived <area> <source-task-id>
{
"schema_version": 1,
"proposal": "investigation_follow_up",
"area": "payments",
"source_task": "payments-007",
"source_result": {
"status": "complete",
"summary": "Settled the retry boundary.",
"validation": ["Compared the design with the current retry implementation."]
},
"tasks": [
{
"key": "apply-retry-boundary",
"title": "Apply the settled retry boundary",
"blocked_by": [],
"outcome": "Use the settled boundary in the runtime path.",
"context": "The investigation settled where retries stop.",
"boundaries": ["Do not change the public retry policy."],
"done_when": ["The runtime uses the settled boundary."],
"validation": ["Run the focused retry tests."]
}
]
}

The top-level object rejects unknown fields. schema_version is 1, proposal is investigation_follow_up or implementation_split, and area and source_task must match the selected goal and header line. Strings must be non-empty and single-line wherever the standard task-bundle contract requires it. tasks holds one to five complete drafts in dependency order with no unknown fields, and no draft may nest another proposal or bundle.

source_result also rejects unknown fields. An investigation follow-up requires status: "complete", a completion summary, and the exact validation list to write into the source task. A split requires status: "split", a summary of why the implementation needs to be divided, and an empty validation list; it never adds a Result section or completes its source.

An implementation split must also include split_ownership immediately after source_result (an investigation follow-up forbids it):

"split_ownership": {
"retained_parent_paths": ["src/payments.rs"],
"child_future_paths": [
{
"key": "extract-retry-policy",
"paths": ["src/retry_policy.rs", "tests/retry_policy.rs"]
},
{
"key": "wire-retry-policy",
"paths": ["src/retry_wiring.rs", "tests/retry_wiring.rs"]
}
]
}

split_ownership and each child entry reject unknown fields and duplicate JSON keys. retained_parent_paths must match, as a set, the paths in the coordinator’s captured attributed unstaged parent delta with nothing added or omitted. Automatic apply also requires that delta to be the checkout’s entire unstaged path set and requires an empty index; any other changes stop the handoff for recovery and fresh context. child_future_paths must list every proposed key exactly once with at least one path per child, and no duplicate or overlapping paths between children or with retained_parent_paths.

Every path must be a normalized repository-relative UTF-8 path using / separators: no absolute paths, empty segments, ., .., duplicate separators, directories, or symlinks. Retained paths and existing future paths must be regular files; an absent future path is valid only when its existing parent is a real directory (not a symlink) and the child explicitly creates a regular file there. Deleted or renamed parent paths fail the retained regular-file check.

Staged, overlapping, incomplete, or uncertain path assignments cannot apply automatically: the coordinator reports the failure and stops for recovery and fresh context. Only a corrected proposal can be reconsidered, because user approval cannot make an invalid path assignment valid.

Drafts use the standard TaskDraft fields, including optional complexity and slice (any named slice must already exist; a proposal cannot create one). blocked_by may reference another proposed key or an existing task ID in the same area, but never the source task. Standard bundle and graph validation still reject missing dependencies, cycles, self-blocking tasks, and invalid task bodies.

Source identity, proposal, result, and drafts exist only in the handoff and command input; task files keep their standard schema.

The coordinator may apply a proposal without asking again only when every one of these holds:

  • the area is open and task_work.safe is true, and the branch, goal, source task, HEAD, and three-part Git baseline still match the handoff;
  • an investigation follow-up has a matching independent PASS for the complete result; for a split, any existing delta is either empty or exactly attributed unstaged work of the open source task, and every child names only future path-disjoint work;
  • every draft is necessary to finish the approved objective and stays inside the brief, source task boundaries, and testing decision;
  • the proposal introduces no product choice, compatibility policy, destructive operation, new ownership claim, cross-area dependency, or uncertain scope;
  • all keys are exact, unique within the proposal, and absent from the area; and
  • this worker result contains one proposal object, no nested proposal, and this uninterrupted handoff has not already applied a proposal.

The coordinator checks the proposal against repository evidence rather than trusting filenames, confidence scores, or a worker’s claim that work is in scope.

Any mechanical, identity, current-state, graph, or ownership failure stops for recovery and fresh context. Manual review is reserved for cases where the proposal is safe and mechanically eligible, but it is uncertain whether the work is necessary and semantically inside the approved brief and task. Applying a proposal consumes that handoff’s automatic authority, so a second object, nested proposal, or repeated apply cannot run automatically, and an interrupted handoff loses automatic authority.

A later independently selected execution (such as a derived child or the resumed parent) may emit one new proposal and apply it automatically if it passes all current gates with zero scope expansion. Any wider outcome, product choice, destructive change, or uncertainty blocks automatic apply (safe, mechanically eligible semantic choices go to manual review; unsafe or destructive states stop). Zdev stores no global or cross-session derivation counter and never infers lineage from task text or Git history.

Malformed proposals, unsafe or closed areas, duplicate keys, invalid graphs, ambiguous ownership, destructive work, widened scope, and unresolved product choices all stop before publication. Malformed handoffs are shown as received, and only a corrected envelope can be reconsidered. Reopening an area, changing scope, or settling a product choice remains yours. Duplicate detection checks exact keys only; zdev never guesses semantic equivalence or renames keys.

Investigation follow-up and implementation split

Section titled “Investigation follow-up and implementation split”

An investigation follow-up completes the source task and imports the new tasks in one transaction. The follow-up tasks use their declared dependencies and enter normal numeric order rather than depending on the completed investigation just to record origin.

An implementation split leaves the source task open and adds every new child ID to the source task’s blocked_by list. Children may depend on one another as proposed, but never on the source. The source becomes the final integration and whole-task verification step: it turns ready only after every child is done and completes only after its original done conditions pass independent verification.

An edited checkout does not automatically force manual review. The coordinator may keep an exact captured delta with the open source task when each child names only future work in split_ownership paths absent from that delta and none of the retained delta is staged. For each child, apply appends this canonical ownership note to the rendered task:

- Initial task-owned path allocation: ["src/retry_policy.rs","tests/retry_policy.rs"]. Coordination may extend it only after checking retained parent edits and sibling assignments.

The JSON array lists normalized paths in proposal order, keeping the initial ownership allocation actionable after the transient envelope is gone without adding a TOML field or lineage record. The split transaction commits only the task records and leaves the parent’s unstaged bytes untouched; later child work treats that delta as pre-existing parent-owned state under the normal baseline rules. Coordination may extend a child’s allocation only after checking the retained parent delta and every sibling allocation (older children rendered with Task-owned paths (exact) follow the same rule).

If a child must edit a path already modified by the parent, if any path is staged, if another unstaged path exists, or if attribution is uncertain, the split stops for recovery and fresh context. The coordinator never splits hunks, touches the index, stashes, resets, or guesses partial ownership.

zdev tasks derive review checks mechanical eligibility and stores the exact proposal JSON, rendered Markdown, and internal metadata in linked-worktree-safe Git administrative state. Its compact output returns the review ID and Markdown path without echoing the proposal, Markdown, or fingerprint; the coordinator still verifies scope against the retained handoff context. Run zdev tasks derive review <area> --show to inspect the stored Markdown, and zdev tasks derive apply to publish an accepted proposal.

Proposals that satisfy automatic-approval rules go straight to apply. Only semantic uncertainty (on an otherwise safe, mechanically eligible proposal) routes through manual review: derive review stores the full envelope and returns an opaque review ID, the coordinator checks that mechanically_eligible is true, displays the stored Markdown, and asks for approval. Replacing the stored review invalidates the earlier ID. Manually authored bundles still use zdev tasks review and zdev tasks import --reviewed (direct --from and compatibility --approval input remain supported).

zdev tasks derive apply accepts either the unchanged envelope via --from (the automatic path) or the current stored review via --reviewed <review-id>. Before writing, it acquires the state lock, rereads the area, source task, slices, tasks, branch state, Git operation, worktree, and index, allocates IDs, renders all files, and validates the complete hypothetical graph and index. For a split, it also requires an empty index, recaptures the full unstaged path set to verify exact equality with retained_parent_paths, validates every path and disjoint child assignment, and renders the canonical ownership boundary, repeating that check before committing. Any invalid proposal, drifted state, staged or incomplete ownership, or other mechanical failure stops before publication; a stored review never waives these gates.

For an investigation follow-up, the coordinator stages only the verified task-owned artifact paths first. Because the proposal carries no artifact-path allowlist, the binary treats the pre-existing index as the coordinator-approved artifact set rather than proving semantic attribution itself, so the coordinator must confirm against verifier and baseline evidence that the index matches the verified artifacts exactly. apply then commits those artifacts together with the completed source task, new child task files, and TASKS.md in one stable-change-ID commit, so an investigation never lands a Result without its follow-ups or follow-ups without its Result. A split commits only the updated open source task, new children, and TASKS.md, leaving any retained parent delta in its exact prior worktree and index state.

Any proposal, dependency, graph, check, write, staging, or commit failure rolls back cleanly: zdev deletes every new task, restores the source task and TASKS.md byte for byte, restores the exact prior index, and leaves unrelated worktree or staged changes untouched. If rollback itself fails, the command reports every affected path and stops without claiming acceptance. On success, managed paths are left clean and JSON returns the source result, allocated IDs in proposal order, post-import ready frontier, commit hash, stable change ID, and committed paths.

Success output uses this exact field set, preserving proposal, ready, and committed-path order:

{
"schema_version": 1,
"status": "committed",
"area": "payments",
"source_task": "payments-007",
"proposal": "investigation_follow_up",
"source_result": {
"status": "complete",
"summary": "Settled the retry boundary.",
"validation": ["Compared the design with the current retry implementation."]
},
"tasks": ["payments-008"],
"ready": ["payments-008"],
"commit": "<full-commit-id>",
"change_id": "<stable-change-id>",
"paths": [
"docs/retry-boundary.md",
".zdev/payments/tasks/007-investigate-retry-boundary.md",
".zdev/payments/tasks/008-apply-the-settled-retry-boundary.md",
".zdev/payments/TASKS.md"
]
}

Investigation results forbid split_ownership. Split results use the same fields and order, with source_result.status set to "split" and split_ownership copied unchanged immediately after source_result; paths lists only the updated source task, new child task files, and TASKS.md (never retained or future source paths).

Under a personal record, task files are never committed: apply writes them uncommitted and commits only the staged investigation artifacts without a stable change ID (paths lists only those artifacts). If nothing is staged, apply skips the commit and returns status: "applied" with commit and change_id set to null. Under a shadow record, task files commit in .zdev/.git while artifacts commit in the main repository; see zdev shadow.

After success, the coordinator shows the JSON result unchanged so you can inspect both the proposal and the outcome without another confirmation turn.

Scenario Result
Successful investigation Matching PASS; source completion, one to five children, index, artifact, and commit succeed together.
Investigation with no follow-up No proposal is emitted; use ordinary verified completion and commit.
Safe implementation split Empty delta, or exact unstaged parent-owned delta with path-disjoint future child work; task records commit, retained bytes stay unchanged, and the open source is blocked by every child.
Product-choice split Automatic authority fails; show the exact proposal and ask through manual review; write nothing.
Duplicate proposal An existing or repeated key fails before ID allocation or writing; never rename it automatically.
Invalid dependency Missing, source-task, cyclic, or self dependency fails hypothetical graph validation; write nothing.
Publication or commit failure Restore every managed byte and the prior index; preserve unrelated work and report rollback failure explicitly if restoration is incomplete.
Nested or repeated handoff proposal Reject a nested object or second automatic apply from the same worker result; applying consumes that handoff. A later independently selected execution gets one new proposal only after all current gates pass again.