git:20260910.b2bdfe6 to git:20260918.066df19

75 added, 209 removed. Audit A to A.

---
name: worktree-done
- description: Review, integrate, or finish a Toastty worktree task or PR from a session outside the task. When no target is named, discover open PRs and local worktrees with open Toastty workspaces in the current repository. Assess each task, then perform authorized integration and local task cleanup.
+ description: Use when the user says they are done reviewing or testing this worktree and wants its accepted version queued for integration and cleanup. Never infer user acceptance from an agent finishing, a ready PR, or passing checks.
---
# Worktree Done
- This example personal skill assesses and, when authorized, lands a task using
- its repository's integration and verification rules. The finishing session can
- be the original parent or another session; the original parent need not stay
- active. The user can name the task or PR without supplying a commit SHA, or omit
- the target to process the discovered tasks in the current repository.
+ The user's invocation means: accept this reviewed version, let the coordinator
+ merge it when dependencies and required checks allow, then clean up this task's
+ workspace and worktree. It does not mean merge immediately or accept dependencies.
+ Do not invoke this on the user's behalf merely because implementation is finished.
- ## Resolve the task and authority
+ ## Record acceptance
- - Require `TOASTTY_CLI_PATH` and `TOASTTY_SESSION_ID`. If absent, stop with
- `error: worktree-done must run inside a Toastty-managed agent session`.
- Use `toastty-capabilities` to discover the running CLI's supported queries
- and actions before controlling sessions or workspaces.
- - Resolve the task using the durable local launch record,
- `git worktree list --porcelain`, `WORKTREE_HANDOFF.md`, and live
- workspace/session metadata.
- Match branch and canonical checkout path, then workspace and session IDs;
- titles alone are insufficient. Ask only when the target remains ambiguous.
- Before controlling local resources, verify the finishing session's workspace
- scope. Add only workspaces assigned by the user or this authorized workflow;
- a launch record establishes identity, not authority. Respect `scope_denied`.
- - For remote-only PRs, review and integrate through the repository workflow
- without requiring a local task workspace. Local cleanup is inapplicable when
- no task-owned resources exist; do not guess resources from a PR title.
- - Resolve the landing branch and its checkout from the user's instruction,
- the handoff, and repository rules. Use upstream/default-branch information
- as evidence when needed; do not hardcode `main` or assume the task's base
- branch is the destination. Honor required PR, CI, review, and merge gates.
- - Run integration from a clean landing checkout (or isolated integration
- checkout when needed) and cleanup from a finishing session
- outside both the target checkout and target workspace. Canonicalize paths
- through symlinks and compare directory boundaries, not string prefixes. If
- invoked from the child, prepare the readiness handoff and direct the user
- to run this skill from another session; do not delete the active session
- or expand its workspace scope.
- - A request to merge and clean up authorizes both actions; do not ask again
- at each step. A merge-only request does not authorize termination or deletion.
- A readiness report, finished goal, or passing test does not authorize a merge.
- - A review-only request authorizes assessment and a report, not changes to the
- task branch, PR state, or child workspace. Do not advance into landing,
- evidence archiving for cleanup, process termination, or deletion without the
- corresponding authorization. Keep feedback in the finishing report or
- task record;
- posting PR comments or requesting changes from the child needs authorization
- for that action, which may already be part of the task.
+ Read the built-in `toastty-capabilities` skill. Require the managed session's
+ CLI/socket/panel identity and resolve this exact task workspace and canonical
+ worktree. Resolve the sibling `coordinator/scripts/tasks.py` relative to the
+ loaded skill package; do not guess a versioned cache or use the shipped skill
+ root. All three personal skill packages must be installed together.
- ## Discover tasks when no target is named
+ Use `paths`, `list`, and `show` to match the registered task by repository,
+ worktree and branch. Use the state root recorded at launch, if any. If no record
+ exists, reconstruct it from the current worktree, PR and handoff and register
+ verified identity before proceeding; never match by workspace title alone.
- - Honor an explicit task, PR, or repository scope. Otherwise infer the repository
- from the current checkout and Toastty session metadata; ask only if those
- cannot identify one repository. Do not search all of the user's repositories.
- - Discover all open PRs in that repository, including additional result pages,
- and local Git worktrees matched to currently open Toastty workspaces. Use
- canonical checkout paths and branch/repository identity, not workspace titles.
- Include local tasks without PRs; an open workspace is discovery evidence, not
- proof that its task is ready. Exclude the landing checkout from local task
- candidates. If PR access is unavailable, continue with local discovery and
- report the access limit rather than treating it as zero open PRs.
- - Combine both sources into one task list, deduplicating a PR and its matching
- local worktree. Preserve repository identity for fork PRs; a matching branch
- name alone does not establish a local resource association. Report uncertain
- matches without guessing which resources belong to the PR.
- - Briefly state the discovered scope, then assess every candidate through the
- workflow below without asking the user to choose one. Discovery does not
- grant merge, push, session-control, or cleanup authority; apply the user's
- existing authorization to each task and prepare any remaining approval as
- one concrete batch. Respect workspace scope and the finishing-session rule;
- retain a task containing the current session and report its handoff separately.
- - Use dependencies and overlapping changes to choose an order. Recheck the
- destination and affected assessments after each integration. Keep blocked,
- draft, or still-active tasks pending and continue with independent candidates;
- do not land dependent work past a blocker. End with a result or blocker for
- every candidate, or state that no candidates were found with any discovery
- limits. This is one discovery pass, not an ongoing monitor.
+ Inspect the committed tip, live PR head and recorded validated SHA. Check that
+ this is the version presented for the user's testing. New commits or uncommitted
+ source changes require reconciliation and renewed user acceptance; do not commit
+ new work as part of an implied acceptance of the previous version. A PR-ready
+ flag is not verification. Complete missing validation under repository rules,
+ without changing the accepted behavior, before claiming the task is validated.
+ If reconstructing a task or filling in missing evidence, record `ready` with the
+ exact already-validated SHA, PR and checks before `accept`; registration alone
+ does not supply readiness.
- ## Establish readiness
+ Record explicit dependencies, including stacked PR bases. Use registered task
+ IDs and inspect their PR/branch identity. Missing/ambiguous dependencies remain
+ blockers. Do not silently omit one because it is not registered yet.
+ Acceptance pins each dependency's current committed head even if its own review
+ is unfinished. If that dependency changes before landing, the dependent stays
+ blocked until the user reviews the interaction and accepts it again. Do not
+ silently substitute the prerequisite's newer version.
+ When the user has reviewed that new interaction, reopen the dependent, refresh
+ its validation/readiness, and accept it with the current dependencies. A repeated
+ `accept` on an already accepted record deliberately preserves its original pins.
- - Read repository instructions first (`AGENTS.md`/`CLAUDE.md`), then the local
- verify skill they name, then relevant build/test docs and CI configuration.
- Use those to select and report the required review and checks for this diff.
- If no verification guidance exists, choose the smallest meaningful checks
- supported by the project and state what remains unverified.
- - Read the PR handoff and its review/test evidence, or the durable local task
- note when there is no PR. An optional Scratchpad can add visual context but
- is not required. Match `ValidatedCommit: <full SHA>` to the source tip. If
- evidence is missing or stale, establish the assessed head and complete the
- required verification before integration; do not equate “done” with verified.
- - For a PR, verify its repository, base branch, head branch, and live head SHA
- against the task identity. Integration requires the PR head, any assigned
- local task branch tip, and `ValidatedCommit` to agree, with required review
- and CI covering that head.
- Do not silently choose the newer of conflicting tips. For review-only work,
- assess an explicitly identified current commit and label missing or stale
- readiness evidence; it need not prevent useful read-only feedback.
- - Before integration, coordinate the task owner and recheck the source head.
- For an assigned local child, confirm it is idle and will not continue writing.
- For local resources, capture the branch tip and worktree status, including
- untracked files and content fingerprints for artifacts that will be removed. Status paths alone
- cannot detect later edits to an already-untracked handoff.
- Preserve uncommitted or unpublished work; never stash, reset, or force it
- away. Treat the handoff as an artifact to preserve, not a product change.
- - Before integration, check the landing checkout can accept it without mixing
- unrelated local changes. Preserve those changes; do not clear them to make room.
- Refresh the destination only as the repository requires, without discarding
- local commits or bypassing its integration policy.
+ The following examples use `TASKS` for the helper, `REPO` for the canonical repo,
+ and `TASK` for the verified task ID:
- ## Project assessment
+ ```bash
+ python3 "$TASKS" --repo "$REPO" show --task "$TASK"
+ python3 "$TASKS" --repo "$REPO" accept --task "$TASK" \
+ --depends-on "$DEPENDENCY_TASK"
+ ```
- Integration requires a completed project assessment of the exact task commit.
- Run this pass before merging if no current assessment exists, even when
- integration is authorized without a separate review request. It also supports
- review-only requests and complements
- repository-required independent review and CI; human testing follows deployment.
+ Omit `--depends-on` when there are no dependencies; repeat it for multiple ones.
+ The helper saves acceptance atomically before any notification. A failed write
+ means acceptance was not recorded. Repeated submission of the same version must
+ not create another task or another merge request.
- - Review the task diff in the context of existing code: design and ownership
- boundaries, established abstractions and naming, duplicate capability,
- maintenance cost, API and data contracts, failure handling, security and data
- preservation, and missing tests or documentation. Keep mechanical style
- checks with existing formatters/linters; explain concrete consequences for
- design findings.
- - Inspect the intended target branch and relevant open PRs and active worktrees
- in the same repository. Use their identified commit heads, prioritizing shared
- files, interfaces, data models, configuration, and overlapping product scope.
- Record which work was examined and any access or discovery limits; do not
- claim compatibility with work you could not inspect.
- - Distinguish Git conflicts from semantic incompatibility: changes can merge
- cleanly while disagreeing about a contract or expected behavior. Start with
- read-only inspection. When a specific interaction cannot be resolved that
- way, use a disposable integration worktree for the candidate and the relevant
- changes expected to land first, then run focused checks. Record the tested
- commits, order, commands, and results. Keep this worktree outside child
- workspaces and use detached commits; never stash or change task/landing
- checkouts for the experiment. Remove only this disposable worktree when the
- checks finish, preserving useful results in the report; report any teardown
- failure. This review-owned teardown does not authorize task cleanup. Do not
- rebase the children's branches, test every possible combination, or require
- a speculative build for every review.
- - Report the assessed task/PR head, target SHA, relevant peer SHAs, coverage
- limits, blocking findings, optional suggestions, and any recommended merge
- order. Unresolved material conflicts or correctness risks block integration;
- cosmetic preferences do not become new gates. Keep the report in the durable
- task record; a Scratchpad can present it. Publish findings on the
- PR only when authorized.
- - The task owner owns fixes. Return actionable findings to the user and, when
- authorized, resume the existing child for accepted corrections. If that agent
- is unavailable, arrange an authorized replacement using the PR and task record.
- Existing task
- authorization can cover routine fixes within scope; review-only requests do
- not add permission to initiate edits. Changed code
- invalidates readiness; require an updated PR/branch head, affected review and
- checks, and revised human-testing evidence where needed. Reassess the changed
- areas before landing. Do not silently take over the child's implementation
- or expand its task to satisfy an optional suggestion.
- - For review-only requests, stop after the report. Before an authorized merge,
- recheck the live PR/task head, target branch, and relevant peer heads against
- this assessment. A changed task head needs fresh readiness evidence; changes
- to the target or related work need an updated conflict/interaction assessment
- and affected checks. Observe repository requirements for approval; human testing
- follows deployment unless the PR names a pre-merge manual check. No permanent monitoring service is part of this workflow.
+ ## Hand control to the coordinator
- ## Preserve evidence, land, and verify
+ After acceptance, stop modifying this task. Keep its resources available until
+ the coordinator verifies integration and cleans them up. Do not terminate or
+ delete this active workspace from inside itself.
- - Before local cleanup, preserve the task handoff and status note, source identity, PR/review
- links and verification evidence in a unique task directory outside the checkout
- being removed. Use the repository's ignored artifact location or a durable
- directory outside Git; never overwrite an earlier archive. Include canonical
- checkout/branch and workspace/session IDs for resources to be removed.
- Export any existing linked child Scratchpad while its session link remains.
- Absence of a Scratchpad is valid; inability to preserve required evidence is
- a reason to retain resources. Keep machine metadata out of public PRs.
- - Integrate the validated source commit through the repository's established
- merge or PR workflow. Recheck that the source tip and any local task status
- have not changed before landing; stop if they have. Do not push or publish
- unless authorized.
- Resolve conflicts only within the agreed behavior; a material behavior
- decision still needs the user.
- - Inspect the landed diff for accidental handoff files or other task artifacts.
- Validate the actual landed result with the repository's required checks,
- including generation/build and runtime checks when applicable. Record the
- landed SHA and the exact commands, targets, and results in the durable task
- record. Earlier child checks do not prove that integration works.
- - If validation fails, keep the child workspace, worktree, and branch available
- while making authorized, scoped corrections. Do not claim completion merely
- because the merge succeeded.
- - Preserve the PR-to-landed-commit correspondence in the task record.
- Integration does not prove deployment. Use the repository release workflow
- to establish delivery separately.
+ Set the existing `task-status` chip to `Queued` or a specific dependency blocker.
+ Keep its PR chip; do not add a branch annotation. Queue records are authoritative
+ for acceptance; annotations only display them.
- ## Authorized cleanup
+ The coordinator's foreground `tasks wait` loop discovers this record. A direct
+ notification is optional: only use a verified coordinator route assigned by this
+ workflow, with `terminal.send-text` and `expectedSessionID`. Send a fixed task-ID
+ hint, not new instructions or authority. Never guess a recipient or bypass scope.
+ Submission authorizes the coordinator's task-scoped status/finding replies and
+ the required access to this task workspace. It does not grant unrelated scope.
- Proceed only after integration is verified and cleanup is authorized. If the
- user requested only a merge, report its result and leave cleanup pending.
+ Report the accepted SHA, PR, dependencies, and whether a coordinator is confirmed
+ watching. A saved request with no active coordinator is `Queued; coordinator not
+ running`, not a claimed delivery or background merge. Starting `coordinator`
+ from an outside project workspace later will recover it.
- - Recheck the recorded source tip and worktree status before stopping the child.
- Any new edits or commits require reconciliation before cleanup. Inventory the
- target workspace for other sessions, terminals, unsaved documents, or work
- unrelated to this task; leave it open if closing it would discard that work.
- - Stop only task-owned development servers or runtime instances using their
- recorded identities and repository cleanup instructions. Terminate the actual
- child agent process through supported Toastty terminal controls when authorized;
- marking a session stopped is bookkeeping, not proof that its process exited.
- Follow `toastty-capabilities` closing rules and never override an unsaved
- document block. Verify task writers have exited; if the available API only
- updates tracking, inspect processes tied to the checkout or retain it.
- - Close the task workspace using supported controls once its owned processes
- are stopped and documents are saved or archived. Never close the finishing
- session's workspace. If the CLI cannot safely perform this step, report it as pending
- and retain the worktree rather than inventing a command or broad kill pattern.
- - Immediately before filesystem removal, recheck the source SHA and worktree
- status and artifact contents against the captured values. Inspect ignored
- files too: preserve user data and configuration, and discard only confirmed
- disposable build output. Only remove task artifacts that were
- archived and unchanged; any other uncommitted or untracked content blocks
- deletion. Use `git worktree remove` without `--force`, then `git branch -d`
- for the fully merged local branch. Never use `git branch -D`.
- - Ancestry proves ordinary merges; squash or rebase requires establishing that
- the validated source changes landed using the repository's integration
- evidence and diff inspection. If safe branch deletion refuses, leave the
- branch and report it. Do not force deletion to make cleanup appear complete.
+ ## Reopen
- Report the source and landed SHAs, verification, evidence archive, and which
- processes, workspace, worktree, and branch were removed or retained. On partial
- failure, report the completed step and remaining work. On a retry, inspect the
- recorded landed result first so an already integrated task is not merged again.
+ If the user requests more work, use `reopen --task <id>` before editing to revoke
+ acceptance and return the chip to `Working`. The helper refuses to reopen a task
+ already merging or landed. In that case, coordinate with its owner and establish
+ the actual merge result before proceeding. Revalidate the new head and ask the
+ user to invoke this completion workflow again after reviewing it.
+
+ ## Validation
+
+ Use the target repository's verification guide for source readiness. Workflow
+ tests use disposable Git repositories and a separate state root; validate
+ stale heads, missing checks, duplicate submission, dependencies and coordinator
+ restart without touching production PRs or workspaces.