From a2f3ae7aecdf0ee082ceedc7fc8eba82deb12bfe Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann Date: Sat, 7 Nov 2026 08:11:18 +0100 Subject: [PATCH 1/4] Release 2.2.6: T3 worktree isolation for writers, PR owners as child tasks, a child is a leaf poteto-mode's Dispatch on T3 had the parent make each writing child's worktree with git worktree add and remove it afterwards. No T3 thread is bound to that worktree, so T3's cleanup never reaches it, and the work ends on a branch no thread owns (#50). A writer now gets delegate_task's isolation: "worktree", which starts from the thread checkout's HEAD commit. One writer may stay in the parent's checkout instead. The brief asks the child for its final branch and commit, since T3 can rename the branch mid-run and task_status does not report it, and a PR opens only from a T3 thread's branch. git worktree add stays for a thread whose project is not a git checkout, which delegate_task refuses with "Unable to resolve the parent checkout commit". swarm, arena, Orchestrate, Shipping, Feature, and Opening a PR point at the same rule. Autopilot-full started each PR owner as a top-level thread with t3_thread_launch, which T3 reserves for a thread the user asks for and which task_status and task_cancel cannot reach. Each owner is now a delegate_task child in its own T3 worktree that reports heads with t3_thread_send, redoing the T3 part of #47 by @pb3975. The session-start routing text told every session, children included, that it runs the playbook and delegates its steps. The routing text and Dispatch on T3 now say a delegate_task child is a leaf unless its brief names a subagent, in line with T3's own instruction to children (#21). Settling child threads (#19) is left out: T3's sidebar already hides every subagent thread. All three components stay pinned at c742dd6. --- .claude-plugin/marketplace.json | 2 +- CHANGES.md | 20 +++++++++++ README.md | 4 +-- VERSION | 2 +- package.json | 2 +- plugins/pstack/.claude-plugin/plugin.json | 2 +- plugins/pstack/.codex-plugin/plugin.json | 2 +- plugins/pstack/hooks/session-start-context.md | 2 +- plugins/pstack/skills/arena/SKILL.md | 2 +- plugins/pstack/skills/poteto-mode/SKILL.md | 4 +-- .../poteto-mode/playbooks/autopilot-full.md | 2 +- .../skills/poteto-mode/playbooks/feature.md | 2 +- .../poteto-mode/playbooks/opening-a-pr.md | 2 +- .../poteto-mode/playbooks/orchestrate.md | 2 +- .../skills/poteto-mode/playbooks/shipping.md | 2 +- plugins/pstack/skills/swarm/SKILL.md | 4 +-- tests/sync.test.mjs | 4 +-- tools/forks.json | 4 +-- tools/substitutions.json | 34 +++++++++++-------- 19 files changed, 62 insertions(+), 36 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 8cc626aa..6fbe671d 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -10,7 +10,7 @@ "name": "t3-pstack", "source": "./plugins/pstack", "description": "pstack for T3 Code: rigorous agent workflows whose panels and fan-outs run across model families through T3. Original pstack by Lauren Tan (poteto).", - "version": "2.2.5" + "version": "2.2.6" } ] } diff --git a/CHANGES.md b/CHANGES.md index 5dcb82e5..26c2518d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,26 @@ This file is the release changelog, with one `## - ` entry per release, newest first. The Cursor-to-T3 rewrite rules live in [`tools/substitutions.json`](tools/substitutions.json), and the [sync boundary](CONTRIBUTING.md#the-sync-boundary) in `CONTRIBUTING.md` defines how a change to upstream's skill content is declared. +## 2.2.6 - Writing delegates get T3's worktree isolation, PR owners are child tasks, and a child is a leaf + +**A writing child gets T3's worktree isolation ([#50](https://github.com/chhoumann/t3-pstack/issues/50)).** poteto-mode's Dispatch on T3 told the parent to make each writing child's worktree itself, with `git worktree add` from `HEAD`, and to remove it and its branch after the result. No T3 thread is bound to such a worktree. As #50 reports, T3's cleanup therefore never reaches it, and a run that stops early leaves it behind. The child's commits also stayed on a branch no thread owned, so the PR came from that branch while the thread's own branch stayed empty. A writer now gets `delegate_task`'s `isolation: "worktree"`, and T3 makes its worktree and branch from the thread checkout's `HEAD` commit. One writer may instead stay in the parent's checkout while the parent writes nothing. The brief asks the child to end its reply with its branch and commit, because T3 can rename that branch during the run and `task_status` does not report it. The parent then brings the commits onto its own branch with `git merge`, and a PR opens only from a T3 thread's branch. `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit` when the thread's project is not a git checkout or has no commit yet. So the rule says to commit first in a repo with no commit, and it keeps `git worktree add` for a thread whose project is not a git checkout or whose work lives in a checkout other than the thread's own. swarm, arena, Orchestrate, Shipping, Feature step 4, and Opening a PR point at the same rule, and a swarm worker that needs another branch checks out that branch's head commit in its own worktree. + +These runs used T3 0.1.8-nightly.20261106 on macOS, with throwaway repositories and threads that are deleted since: + +- From a thread whose project is not a git checkout, `delegate_task` with `isolation: "worktree"` failed with `invalid_request: Unable to resolve the parent checkout commit.` +- From a thread in a git repository with no commit, the same call failed with the same message. After one commit it succeeded, and the child ran in a worktree under `~/.t3/worktrees/<repo>/`. +- A thread in a T3 worktree made a local commit and left one file uncommitted. Its worktree child started at that commit without the file, committed, and its branch showed in the parent's checkout. `git merge --ff-only` brought the commit onto the parent's branch. The child's branch was `t3/3098eef5` at its first command and `scripted-git-test` after its commit, and `task_status` had no branch field. A `shared` child committed straight onto the parent's branch. + +**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` from the root's checkout at trunk, so it opens its PR from its own thread's branch. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. + +**A `delegate_task` child is a leaf ([#21](https://github.com/chhoumann/t3-pstack/issues/21)).** The session-start routing text told every session, children included, "This chat runs the playbook itself. A step it says to delegate goes through `delegate_task`". So a child whose task met a routing trigger ran the playbook and started children of its own. The routing text and Dispatch on T3 now say that a `delegate_task` child is a leaf, which does the work itself and starts no subagent unless its brief names one. Autopilot-full's owner brief lifts that, as above. In this Mac's T3 store, 6 of the 456 `delegate_task` children started before 2026-10-30 started children their brief did not ask for, and one design child started 8. Since 2026-10-30, T3 itself tells each session "If you are a subagent or child, do the work yourself. Start no subagents unless your task says to.", which all 14 T3 Codex sessions since then carry, and none of the 32 children since then started a child unasked. The new line ends the routing text's contradiction of that rule. No grandchild in the store started children, so the five-level nesting that #21 reports from 2.0.0-rc.3 did not recur here. + +**Not in this release ([#19](https://github.com/chhoumann/t3-pstack/issues/19)).** #19 asks the parent to settle each child's thread after reading its result, so that finished children stop filling the sidebar. On T3 0.1.8-nightly.20261106 the sidebar leaves out every thread whose lineage has `relationshipToParent: "subagent"`, which every `delegate_task` child has. So a finished child never shows there, settled or not, though 842 child threads on this Mac are unsettled. + +This release syncs nothing from Lauren's pstack, so all three components stay pinned at cursor/plugins `c742dd6`. At that pin each component's dry run reports no undeclared fork and no substitution that matches nothing, and each fork changes as many lines as before. Neither hooks file changes. This is a patch release, and no setting or workflow has to change. On Codex, run `npx -y github:chhoumann/t3-pstack update` after it, as after every release. + +Thanks to @phob for #50, @Sunsilkk for #21, @harepus for #19, and @pb3975 for #47. + ## 2.2.5 - The installer pins each Codex home to the release tag, so Codex's own updates no longer turn the hook off On Codex 0.164 and later, a plugin hook's trust covers every file in the installed plugin, as 2.2.3 described. Each time a Codex app-server starts, such as the one T3 runs, Codex's marketplace auto-upgrade moved each home's `t3-pstack` marketplace to the latest commit on `main` and reinstalled the plugin from it. So each release, and each other commit that changed the plugin's files, turned the session-start hook off with `plugin contents changed; hook approval required` until someone reran the installer. 2.2.3 left this as it was. diff --git a/README.md b/README.md index 437ccc88..a3efa6ac 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,9 @@ npx -y github:chhoumann/t3-pstack update npx -y github:chhoumann/t3-pstack doctor ``` -`npx -y github:chhoumann/t3-pstack` runs the installer from the latest commit on `main`. Each Claude Code home's marketplace auto-updates from `main` too, and each Codex home's marketplace stays on the release tag the installer pinned. To run one release's installer, name its tag, as in `npx -y github:chhoumann/t3-pstack#v2.2.5 doctor`. +`npx -y github:chhoumann/t3-pstack` runs the installer from the latest commit on `main`. Each Claude Code home's marketplace auto-updates from `main` too, and each Codex home's marketplace stays on the release tag the installer pinned. To run one release's installer, name its tag, as in `npx -y github:chhoumann/t3-pstack#v2.2.6 doctor`. -`install` and `update` are the same command, and a second run changes nothing. With Node 20 or later, it installs or updates the `t3-pstack@t3-pstack` plugin in every Claude Code and Codex config home T3 can run: `~/.claude` and `~/.codex`, `$CLAUDE_CONFIG_DIR` and `$CODEX_HOME`, and the home of each `claudeAgent` and `codex` instance in T3's settings, disabled ones included. Name any other home with `--claude-home <dir>` or `--codex-home <dir>`. Each home's `t3-pstack` marketplace must come from `chhoumann/t3-pstack`, or from `--source <owner/repo|git URL|dir>` on the same run, and a home whose marketplace has another source is left as it is. A run never switches a home's source, so a home already on `chhoumann/t3-pstack` stays on it under another `--source`, and `doctor` warns and prints the commands that move it. A local directory needs a path such as `./t3-pstack`, since `owner/repo` always means GitHub. On Codex it also trusts t3-pstack's session-start hook, once its hooks file is the one this release pins. Codex runs a plugin's hook only once it is trusted, and T3's Codex sessions never ask, so without this step the hook never runs. Codex 0.164 and later tie that trust to every file in the installed plugin, so each release turns the hook off until the installer trusts it again. So the installer pins each Codex home's `t3-pstack` marketplace to the release's tag, such as `v2.2.5`, and Codex's own auto-upgrade leaves that tag where it is. A release reaches a Codex home only when `update` runs, and that run trusts the hook again. A local directory has no tag, so a marketplace from one stays unpinned. Run `update` after each release. +`install` and `update` are the same command, and a second run changes nothing. With Node 20 or later, it installs or updates the `t3-pstack@t3-pstack` plugin in every Claude Code and Codex config home T3 can run: `~/.claude` and `~/.codex`, `$CLAUDE_CONFIG_DIR` and `$CODEX_HOME`, and the home of each `claudeAgent` and `codex` instance in T3's settings, disabled ones included. Name any other home with `--claude-home <dir>` or `--codex-home <dir>`. Each home's `t3-pstack` marketplace must come from `chhoumann/t3-pstack`, or from `--source <owner/repo|git URL|dir>` on the same run, and a home whose marketplace has another source is left as it is. A run never switches a home's source, so a home already on `chhoumann/t3-pstack` stays on it under another `--source`, and `doctor` warns and prints the commands that move it. A local directory needs a path such as `./t3-pstack`, since `owner/repo` always means GitHub. On Codex it also trusts t3-pstack's session-start hook, once its hooks file is the one this release pins. Codex runs a plugin's hook only once it is trusted, and T3's Codex sessions never ask, so without this step the hook never runs. Codex 0.164 and later tie that trust to every file in the installed plugin, so each release turns the hook off until the installer trusts it again. So the installer pins each Codex home's `t3-pstack` marketplace to the release's tag, such as `v2.2.6`, and Codex's own auto-upgrade leaves that tag where it is. A release reaches a Codex home only when `update` runs, and that run trusts the hook again. A local directory has no tag, so a marketplace from one stays unpinned. Run `update` after each release. `doctor` reports on the same homes and changes nothing itself: each marketplace's source, each Codex marketplace's pin, the installed version, whether its files are all there, whether it is enabled, the Codex hook's trust, Claude Code records that pin an old version, plain copies of the plugin's skills, and the model sheet. It exits 1 on any problem and prints a fix for each. diff --git a/VERSION b/VERSION index 21bb5e15..bda8fbec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.5 +2.2.6 diff --git a/package.json b/package.json index 179b4c48..966e5f4e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "t3-pstack", "private": true, - "version": "2.2.5", + "version": "2.2.6", "description": "The installer and development tooling for t3-pstack, Lauren Tan's pstack rewritten in place for T3 Code. The plugin itself lives in plugins/pstack.", "author": { "name": "Christian Bager Bach Houmann", diff --git a/plugins/pstack/.claude-plugin/plugin.json b/plugins/pstack/.claude-plugin/plugin.json index 4110d102..1f011042 100644 --- a/plugins/pstack/.claude-plugin/plugin.json +++ b/plugins/pstack/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "t3-pstack", "displayName": "t3-pstack (pstack for T3 Code)", - "version": "2.2.5", + "version": "2.2.6", "description": "pstack for T3 Code: Lauren Tan's pstack with its Cursor mechanics rewritten in place for T3, so subagents, panels, schedules, and PR watches dispatch through T3's orchestration and panels mix Claude, GPT, and Grok.", "author": { "name": "Christian Bager Bach Houmann", diff --git a/plugins/pstack/.codex-plugin/plugin.json b/plugins/pstack/.codex-plugin/plugin.json index d814deef..c7611746 100644 --- a/plugins/pstack/.codex-plugin/plugin.json +++ b/plugins/pstack/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "t3-pstack", - "version": "2.2.5", + "version": "2.2.6", "description": "pstack for T3 Code on a Codex host: Lauren Tan's pstack with its Cursor mechanics rewritten in place for T3, so subagents, panels, schedules, and PR watches dispatch through T3's orchestration.", "author": { "name": "Christian Bager Bach Houmann", diff --git a/plugins/pstack/hooks/session-start-context.md b/plugins/pstack/hooks/session-start-context.md index f939d835..2e6b0bbd 100644 --- a/plugins/pstack/hooks/session-start-context.md +++ b/plugins/pstack/hooks/session-start-context.md @@ -11,7 +11,7 @@ It routes to the right pstack skill from there. On Codex, open its SKILL.md whol When the intent is already specific, such as TDD, a design sketch, how or why something works, an arena, or an adversarial review, still enter through `t3-pstack:poteto-mode` and open that skill from the bundled path it names. The other pstack skills run only from poteto-mode or when the user types them. -This runs on T3: before the first subagent or panel in a session, read the model sheet, `~/.config/t3-pstack/models.md` (`$XDG_CONFIG_HOME/t3-pstack/models.md` when that is set), or `t3-pstack-models.md` in this host's config directory when that file is missing. This chat runs the playbook itself. A step it says to delegate goes through `delegate_task` to that role's sheet entry, and the reply lists which provider and model ran each step. +This runs on T3: before the first subagent or panel in a session, read the model sheet, `~/.config/t3-pstack/models.md` (`$XDG_CONFIG_HOME/t3-pstack/models.md` when that is set), or `t3-pstack-models.md` in this host's config directory when that file is missing. This chat runs the playbook itself. A step it says to delegate goes through `delegate_task` to that role's sheet entry, and the reply lists which provider and model ran each step. A `delegate_task` child is a leaf instead. It does the work itself and starts no subagent unless its brief names one. User instructions (CLAUDE.md, AGENTS.md, direct requests) take precedence. Other session-start mandates, such as superpowers, still apply. Their skill checks run as before, and when a task meets the criteria above they route implementation through poteto-mode. </EXTREMELY_IMPORTANT> diff --git a/plugins/pstack/skills/arena/SKILL.md b/plugins/pstack/skills/arena/SKILL.md index 0b1553db..f9eda734 100644 --- a/plugins/pstack/skills/arena/SKILL.md +++ b/plugins/pstack/skills/arena/SKILL.md @@ -15,7 +15,7 @@ Every candidate gets the same prompt, so the prompt is the contract. 1. State the artifact each candidate is producing. 2. Derive the rubric, 3-6 concrete gradeable criteria for what success looks like on *this* task. It is the picker's tool in Phase D. Candidates only see the task. 3. Pick the runners. Use the `arena runners` line in the model sheet. If the sheet or that line is missing, run one each on the defaults in [Models](#models). An `auto` or `inherit-parent` entry in this line means the parent model, so omit `target` for it. If `delegate_task` rejects a configured entry, run that seat on another target of the same family from `orchestrator_capabilities` and say so. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it. If the family has no other target, or `delegate_task` rejects that one too, drop the seat and say so. If dropped seats leave fewer than two runners, add runners until there are two, or one when the line has one entry. Run each added runner on a remaining runner's model, or omit `target` so it runs on the parent model when none remain, and say so. Spawn more runners when the arena covers multiple design directions. Use the same model N times when the work is generation-bound rather than judgment-sensitive. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section of the **poteto-mode** skill. -4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. +4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 a worktree candidate is a `delegate_task` child with `isolation: "worktree"`, per poteto-mode's Dispatch on T3. ## Phase B: Fan out diff --git a/plugins/pstack/skills/poteto-mode/SKILL.md b/plugins/pstack/skills/poteto-mode/SKILL.md index 18674680..14750a34 100644 --- a/plugins/pstack/skills/poteto-mode/SKILL.md +++ b/plugins/pstack/skills/poteto-mode/SKILL.md @@ -101,9 +101,9 @@ You own every subagent's work. Review the diff and write your own summary, don't **Fresh subagents by default.** Give new work to a fresh subagent with consolidated scope, meaning the original brief, every later directive, and the prior agent's report and branch. This holds for a fix round, a follow-up, a retry, and the next queue item. Send a follow-up to an existing child (`t3_thread_send` to its `childThreadId`) only when the new work strictly needs state that lives in that agent and is costly to move: its local checkout, its uncommitted changes, or a process it still runs, such as a dev server, a simulator, or a babysit watcher. A stop or hold order to a running agent is not reuse. A role such as a PR owner outlives its agent. Once that agent returns, a fresh agent takes the role's next round. Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a "done" summary. **Stop the abandoned agent first, and confirm it stopped,** when its writes could overlap its replacement's, in the same worktree or the same files. Autopilot-full's audit still replaces a stuck agent at once, without waiting for its stop, per that playbook. A child whose turn completed can still have live work, and it can keep editing after a fresh agent takes its role. `task_cancel` it, which also stops the tasks it delegated, and read `task_status` until the task is terminal with no `hasPendingChildRuns`. A claim about the working tree that `git status` contradicts means it is still running. -**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with "Read `<plugin root>/agents/<name>.md` in full and act as it says", and a `poteto-agent` brief also names this file's absolute path. +**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with "Read `<plugin root>/agents/<name>.md` in full and act as it says", and a `poteto-agent` brief also names this file's absolute path. -A child starts in your checkout. One that writes gets its own worktree, created with `git worktree add` from `HEAD` so it builds on your branch's commits. The brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Record your own `git status --porcelain` before you dispatch, check after the result that it is unchanged, then remove the worktree and its branch. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`. +A child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: "worktree"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, or your work lives in a checkout other than the one `t3_worktree_status` names, create the writer's worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`. **A review gate stays closed when no independent reviewer can run.** A reviewer child that fails or is interrupted gets a fresh `delegate_task` in its place. Keep the results of reviewers that finished. Never count your own review, passing tests, or CI as the independent verdict. While the gate is blocked, record `BLOCKED: independent review` in the todolist, keep merge-ready and shipping closed, and report which reviewers ran and which are missing. Work that doesn't depend on the review continues. A fan-out run only to explore may fall back to one labelled sequential pass. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md b/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md index 2bea55be..d225311b 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md @@ -5,7 +5,7 @@ A verdict covers one patch and green CI covers one head. Step 4 runs a full swarm once, and again only for a major change. The patch-id rule in `playbooks/shipping.md` can carry a lane's result, and every new head needs its own green CI. 1. **The operator's gates come first.** The grant covers only the queue's items, so items the operator names as theirs and PRs outside the queue stop at merge-ready. A request to state the plan is not a go. -2. **Spawn one owner per PR, and keep its work where a replacement can find it.** Resolve the forge once for the program. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). Each owner is a top-level T3 thread that `t3_thread_launch` starts with `workspaceStrategy: {type: "worktree", baseRef, branch, startFromOrigin: false}` and a brief that names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`. It builds, opens its PR per `playbooks/opening-a-pr.md`, proves the change on the real artifact, babysits to green per `playbooks/babysit.md`, and merges once steps 4 and 5 clear it. +2. **Spawn one owner per PR, and keep its work where a replacement can find it.** Resolve the forge once for the program. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). Each owner is a `delegate_task` child with `mode: "async"` and `isolation: "worktree"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. It builds, opens its PR per `playbooks/opening-a-pr.md`, proves the change on the real artifact, babysits to green per `playbooks/babysit.md`, and merges once steps 4 and 5 clear it. Open the PR early so CI and bots run alongside the work. The code is ready only after the slop-strip (the **deslop** skill, `/deslop`) and the `/no-comments` pass, so the full swarm runs on finished code. Then rebase onto current trunk and report the code-ready head before self-proof, so verification runs on the base the patch lands on. Report every later head, and merge-ready once self-proof, CI, and babysit are done. Fix rounds stay on that base unless trunk conflicts, breaks CI, or lands a known concurrent change to the same files, because each rebase restarts CI. Run the repo's checks for the touched paths on the committed head before the code-ready push and before a later push that needs a verifier. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/feature.md b/plugins/pstack/skills/poteto-mode/playbooks/feature.md index e5d3fd08..5bec4af2 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/feature.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/feature.md @@ -9,7 +9,7 @@ - **Independent workstreams.** Disjoint files, services, or layers parallelize. Shared writes serialize. - **Shared mutable state.** Default to splitting the target (the **separate-before-serializing-shared-state** principle skill). Serialize only for real invariants. - **Smallest safe decomposition.** If one worker is best, name why. -4. Delegate code-writing to a subagent using your configured feature model (default in poteto-mode's [Models](../SKILL.md#models)) with a specific scope (file paths, named data shape and its organizing structure per **principle-model-the-domain**, a state machine over scattered booleans, a table/registry over branching, a typed model over repeated shape assumptions, chosen before the delegate writes logic, and success criteria). Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section. When the implementation admits multiple valid shapes (error handling, abstraction layer, test structure), delegate via the **arena** skill instead so the runners surface the alternatives and the cross-judge guards the pick. Mandatory: no skip-with-reason escape, and Laziness Protocol does not override it (the gain is review separation, not lines saved). A subagent forbidden to spawn satisfies this by owning the diff directly with the same review separation. No "standing by" reply that waits on a nested agent. **Every file-writing delegate gets its own worktree from `HEAD`, per poteto-mode's [Subagents](../SKILL.md#subagents) section.** Commit what it builds on first, and name that base commit in the brief. Do not write files or run a suite in a worktree a delegate still holds. Fencing a file in the brief's prose is not a lock (**principle-separate-before-serializing-shared-state**). Comments per **Comments**. Surgical edits, re-ground against the source for upstream-derived files. Port shared-primitive improvements to all consumers and verify each. Commit liberally. +4. Delegate code-writing to a subagent using your configured feature model (default in poteto-mode's [Models](../SKILL.md#models)) with a specific scope (file paths, named data shape and its organizing structure per **principle-model-the-domain**, a state machine over scattered booleans, a table/registry over branching, a typed model over repeated shape assumptions, chosen before the delegate writes logic, and success criteria). Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section. When the implementation admits multiple valid shapes (error handling, abstraction layer, test structure), delegate via the **arena** skill instead so the runners surface the alternatives and the cross-judge guards the pick. Mandatory: no skip-with-reason escape, and Laziness Protocol does not override it (the gain is review separation, not lines saved). A subagent forbidden to spawn satisfies this by owning the diff directly with the same review separation. No "standing by" reply that waits on a nested agent. **A file-writing delegate works in your checkout while you write nothing, or in its own worktree from `HEAD`, per poteto-mode's [Subagents](../SKILL.md#subagents) section.** Commit what it builds on first, and name that base commit in the brief. Do not write files or run a suite in a worktree a delegate still holds. Fencing a file in the brief's prose is not a lock (**principle-separate-before-serializing-shared-state**). Comments per **Comments**. Surgical edits, re-ground against the source for upstream-derived files. Port shared-primitive improvements to all consumers and verify each. Commit liberally. 5. Verify on the matching surface. "Inconclusive" or wrong-surface is not a pass. Flag it. 6. Rebase into small, ordered commits. Stack follow-ups. Use the **sequence-verifiable-units** principle skill, building, verifying, and committing each small unit before the next. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/opening-a-pr.md b/plugins/pstack/skills/poteto-mode/playbooks/opening-a-pr.md index daef9210..761cc42e 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/opening-a-pr.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/opening-a-pr.md @@ -2,7 +2,7 @@ Invoked at the end of every other playbook. -**Worktree.** Work from a git worktree off main. Subagents inherit it. Multiple `delegate_task` calls on the same branch each get their own worktree. Dirty branch with unrelated work: patch out, fresh worktree, apply. Snarled worktree: reset from main, redo minimally. Before you commit, merge, or deploy from a worktree, stop every live agent that holds it with `task_cancel`, which also stops the tasks it delegated, and confirm each stop with `task_status`. A delegate's children do not inherit its brief, so a read-only instruction never reaches them. Then run `git status` and read the tree you are about to ship. +**Worktree.** Work from a git worktree off main. Subagents inherit it. Multiple writing `delegate_task` children on the same branch each get their own worktree, and the PR opens from a T3 thread's branch, per poteto-mode's Dispatch on T3. Dirty branch with unrelated work: patch out, fresh worktree, apply. Snarled worktree: reset from main, redo minimally. Before you commit, merge, or deploy from a worktree, stop every live agent that holds it with `task_cancel`, which also stops the tasks it delegated, and confirm each stop with `task_status`. A delegate's children do not inherit its brief, so a read-only instruction never reaches them. Then run `git status` and read the tree you are about to ship. **Commits.** Commit liberally. Rebase into small, ordered commits before opening PRs. Each commit is a future PR: landable, ordered to tell the story. Amend when the fix belongs in a just-made commit. New commit when separable. Commit bodies don't restate the subject. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md b/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md index c61ecb25..6a07ba14 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md @@ -7,7 +7,7 @@ Run it with your own tools. Spawn workers with `delegate_task`. Keep the program #### Topology - **One owner per PR.** The owner is the only writer of its branch and carries the PR from build to merge. Only the owner pushes, rebases, or retargets it. Closing or retargeting a base PR orphans every PR above it, so the owner does that only on your call. You never author or edit code. Conflicted merges, chain rebases, and fixes go to owners. -- **A fresh worker for each independent task.** Its kickoff carries everything it needs, including each upstream report it depends on, pasted in full. Workers can't see their siblings. Every worker runs on this machine, and one that writes gets its own git worktree, named by absolute path in its kickoff as the only place it writes. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section. +- **A fresh worker for each independent task.** Its kickoff carries everything it needs, including each upstream report it depends on, pasted in full. Workers can't see their siblings. Every worker runs on this machine, and one that writes gets `isolation: "worktree"`, per poteto-mode's Dispatch on T3. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section. - **A sub-coordinator only when one area has many parallel workers.** It owns that area's workers and kickoffs and sends you one rollup, never raw worker reports. Stop at three levels: you, sub-coordinators, and workers. Keep about ten workers in flight per coordinator, and start the next one as each finishes instead of waiting on a whole batch. - **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work. Never message one to check on it, because a message restarts an idle agent. - **Each PR gets a verifier that isn't its author,** on a different model family. The owner merges only on that verifier's pass at the current head. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/shipping.md b/plugins/pstack/skills/poteto-mode/playbooks/shipping.md index 001870eb..2f0768fa 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/shipping.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/shipping.md @@ -2,7 +2,7 @@ **You own what lands. Verify each PR independently, land only the verified run from the root, then keep your hands off the stack.** -1. **Resolve the forge, then verify each PR independently before it lands.** GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). One verifier per PR, each a `delegate_task` child in its own worktree, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head, and posts `PASS`, `PASS+NOTES`, or `FAIL` on that PR. Only a verdict from an agent that did not write the code counts, because an author checks what it meant to build. Green CI and an approving bot review are not verdicts, because neither runs the change as a user would. +1. **Resolve the forge, then verify each PR independently before it lands.** GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). One verifier per PR, each a `delegate_task` child with `isolation: "worktree"` whose brief names the PR's head commit, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head, and posts `PASS`, `PASS+NOTES`, or `FAIL` on that PR. Only a verdict from an agent that did not write the code counts, because an author checks what it meant to build. Green CI and an approving bot review are not verdicts, because neither runs the change as a user would. 2. **Land only the contiguous verified run rooted at the bottom.** Walk up from the lowest unmerged PR and stop at the first one without `PASS` or `PASS+NOTES`. The PRs below it are the run, and the top one is the ceiling. A verified PR above an unverified one waits, because it cannot land without the code below it. One whose branch neither holds nor needs that code can move onto trunk and land on its own. It needs a fresh verdict first, because its old one ran with that code beneath it and trunk does not have it. 3. **Re-check that the verdicts still describe the code.** A verdict covers a patch, and a chain rebase moves every PR above it to a new SHA without failing any check. Compare `git patch-id` at the verdict SHA with the current head before trusting an older verdict. When the patches differ only in tests, docs, or lint config, a lane's result stands if what it ran builds the same at both SHAs apart from noise. Noise is a difference that also shows up between two builds of the verdict SHA, or an embedded commit SHA. Report each kind of noise with its files, so a reader can check the call. The change itself still gets fresh checks and a review, because the old verdict never saw it. A lane with no build output, such as a dev server, cannot show this, so rerun it, and re-verify anything else that drifted. 4. **Land bottom-up, one PR at a time.** Always merge the run's lowest unmerged PR, with `origin pr merge <pr>` or `gh pr merge <pr> --squash --match-head-commit <head>`, where `<head>` is the current head SHA whose verdict survives step 3's patch-id rule, so a head pushed after that check cannot land. On Origin the plain command also merges every PR below the one you name, and on GitHub a PR whose base is still its parent's branch merges into that branch, not trunk. Read the PR back for the result (`origin pr view <pr>` or `gh pr view <pr> --json state,mergedAt,baseRefName`), because a merge command can report success when a merge queue only queued the PR, and a requested auto-merge is not a merge. A landed PR reads merged with trunk as its base, not its parent's branch. Arm `--auto` (Origin merge-when-ready or GitHub auto-merge) only on a PR whose verdict covers its current head, because it lands whatever head is ready. After a merge lands, retarget the PR whose base was the merged branch to trunk (`origin pr edit <pr> --base <trunk>` or `gh pr edit <pr> --base <trunk>`), move its patch onto the merge result, and push with `--force-with-lease`. The verdict covers the patch, not its commits, so step 3's patch-id rule decides whether the verdict survives. Merge it once its checks pass and its verdict survives. diff --git a/plugins/pstack/skills/swarm/SKILL.md b/plugins/pstack/skills/swarm/SKILL.md index 9016476f..e5107177 100644 --- a/plugins/pstack/skills/swarm/SKILL.md +++ b/plugins/pstack/skills/swarm/SKILL.md @@ -24,9 +24,9 @@ Open a todolist with one entry per phase before launching anything. ## Phase B: Fan out -Spawn all N workers in one response as `delegate_task` calls with `mode: "async"` and the step 3 `target`, left unset for `auto` or `inherit-parent`. Every worker runs on this machine, so a worker that writes gets its own git worktree, named by absolute path in its brief as the only place it writes. +Spawn all N workers in one response as `delegate_task` calls with `mode: "async"` and the step 3 `target`, left unset for `auto` or `inherit-parent`. Every worker runs on this machine, so a worker that writes gets `isolation: "worktree"`, per poteto-mode's Dispatch on T3. -When a worker must start from a non-default branch, create its worktree from that branch. +When a worker must start from a non-default branch, its brief names that branch's head commit, and the worker runs `git checkout --detach <sha>` in its own worktree before anything else. Every brief stands alone. Include the goal, scope, exact slice or race arm, how to verify, and what to report. Reports use `PASS`, `ISSUES`, or `BLOCKED` with evidence. A worker that can prove a defect reports `ISSUES` and lists every issue it can prove, not only the first. diff --git a/tests/sync.test.mjs b/tests/sync.test.mjs index 81641ff5..58b4a9d1 100644 --- a/tests/sync.test.mjs +++ b/tests/sync.test.mjs @@ -170,10 +170,10 @@ describe("applySubstitutions", () => { // The T3 behavior the port adds on an upstream anchor: each must survive. test.each([ - ["skills/poteto-mode/SKILL.md", "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.", ["**Dispatch on T3.**", "dispatch ledger", "`BLOCKED: independent review`", "`clientRequestId`"]], + ["skills/poteto-mode/SKILL.md", "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.", ["**Dispatch on T3.**", "dispatch ledger", "`BLOCKED: independent review`", "`clientRequestId`", "you are a leaf", "`isolation: \"worktree\"`", "`Unable to resolve the parent checkout commit`"]], ["skills/arena/SKILL.md", "With the default pool, a Claude parent gets `grok-4.7-xhigh-fast`. A parent from any other family gets `claude-opus-5-5-xhigh` first.", ["no model scores its own work"]], ["skills/poteto-mode/playbooks/babysit.md", "Run `drive` and `background` under `/loop` in dynamic mode.", ["--timeout 540", "watch_pull_request", "--settle"]], - ["skills/poteto-mode/playbooks/autopilot-full.md", "Each owner is a Cursor cloud agent that builds, opens its PR", ["t3_thread_launch", "t3_thread_send"]], + ["skills/poteto-mode/playbooks/autopilot-full.md", "Each owner is a Cursor cloud agent that builds, opens its PR", ["`delegate_task` child", "`isolation: \"worktree\"`", "t3_thread_send"]], ["skills/no-comments/SKILL.md", '1. Spawn `Task` with `subagent_type: "comment-sicko"`. Pass the scope.', ["<plugin root>/agents/comment-sicko.md", "no worktree"]], ])("%s keeps its T3 insert", (rel, upstream, needles) => { const { text } = applySubstitutions(upstream, RULES.substitutions, rel); diff --git a/tools/forks.json b/tools/forks.json index a08baab2..84bf33af 100644 --- a/tools/forks.json +++ b/tools/forks.json @@ -8,13 +8,13 @@ }, "plugins/pstack/skills/poteto-mode/playbooks/feature.md": { "kind": "policy", - "why": "Points step 4 at the Subagents rule that every file-writing delegate gets its own worktree from HEAD, and carries the rule from Michael Denyer's pstack-claude that the delegator commits what the delegate builds on, names that commit in the brief, and never writes or runs a suite in a worktree a delegate still holds.", + "why": "Points step 4 at the Subagents rule that a file-writing delegate works alone in the delegator's checkout or in its own worktree from HEAD, and carries the rule from Michael Denyer's pstack-claude that the delegator commits what the delegate builds on, names that commit in the brief, and never writes or runs a suite in a worktree a delegate still holds.", "since": "2.0.0-rc.2", "upstream": "not-proposed" }, "plugins/pstack/skills/poteto-mode/playbooks/opening-a-pr.md": { "kind": "policy", - "why": "Carries the rule from Michael Denyer's pstack-claude that every live agent holding a worktree is stopped, and the stop confirmed, before a commit, merge, or deploy from it, and drops the reset --hard between delegates on one branch so that each gets its own worktree.", + "why": "Carries the rule from Michael Denyer's pstack-claude that every live agent holding a worktree is stopped, and the stop confirmed, before a commit, merge, or deploy from it, and drops the reset --hard between delegates on one branch so that each writer gets its own worktree and the PR opens from a T3 thread's branch.", "since": "2.0.0-rc.2", "upstream": "not-proposed" }, diff --git a/tools/substitutions.json b/tools/substitutions.json index f94485b7..a9e4e519 100644 --- a/tools/substitutions.json +++ b/tools/substitutions.json @@ -272,8 +272,8 @@ }, { "pattern": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.", - "replacement": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.\n\n**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with \"Read `<plugin root>/agents/<name>.md` in full and act as it says\", and a `poteto-agent` brief also names this file's absolute path.\n\nA child starts in your checkout. One that writes gets its own worktree, created with `git worktree add` from `HEAD` so it builds on your branch's commits. The brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Record your own `git status --porcelain` before you dispatch, check after the result that it is unchanged, then remove the worktree and its branch. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`.\n\nEnd every reply that ran a playbook with a dispatch ledger: one line per delegated step, naming the role and the `providerInstanceId/model` it ran on, or `in-thread: <reason>`.", - "rationale": "inserts the T3 dispatch policy at the end of the Subagents section (Tool actions; Subagent policy)", + "replacement": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.\n\n**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with \"Read `<plugin root>/agents/<name>.md` in full and act as it says\", and a `poteto-agent` brief also names this file's absolute path.\n\nA child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: \"worktree\"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, or your work lives in a checkout other than the one `t3_worktree_status` names, create the writer's worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`.\n\nEnd every reply that ran a playbook with a dispatch ledger: one line per delegated step, naming the role and the `providerInstanceId/model` it ran on, or `in-thread: <reason>`.", + "rationale": "inserts the T3 dispatch policy at the end of the Subagents section (Tool actions; Subagent policy). A delegate_task child keeps delegate_task, so the leaf sentence stops the session-start routing from sending a child into a playbook's fan-out (#21). A writer gets T3's worktree isolation, which starts from the thread checkout's HEAD commit and refuses a thread whose project is not a git checkout or has no commit, so git worktree add stays only for those (#50)", "files": "^skills/poteto-mode/SKILL\\.md$" }, { @@ -484,13 +484,19 @@ }, { "pattern": "Spawn all N workers in one message with `subagent_type: generalPurpose`, `environment: \"cloud\"`, `run_in_background: true`, and the step 3 model, left unset for `auto` or `inherit-parent`. Use `environment: \"local\"` only when the worker needs access to something on the user's computer.", - "replacement": "Spawn all N workers in one response as `delegate_task` calls with `mode: \"async\"` and the step 3 `target`, left unset for `auto` or `inherit-parent`. Every worker runs on this machine, so a worker that writes gets its own git worktree, named by absolute path in its brief as the only place it writes.", - "rationale": "Per-skill notes: swarm" + "replacement": "Spawn all N workers in one response as `delegate_task` calls with `mode: \"async\"` and the step 3 `target`, left unset for `auto` or `inherit-parent`. Every worker runs on this machine, so a worker that writes gets `isolation: \"worktree\"`, per poteto-mode's Dispatch on T3.", + "rationale": "Per-skill notes: swarm. A writing worker gets T3's worktree isolation (#50)" }, { "pattern": "When a worker must start from a non-default pushed branch, pass `cloud_base_branch`.", - "replacement": "When a worker must start from a non-default branch, create its worktree from that branch.", - "rationale": "no cloud base branch on T3" + "replacement": "When a worker must start from a non-default branch, its brief names that branch's head commit, and the worker runs `git checkout --detach <sha>` in its own worktree before anything else.", + "rationale": "no cloud base branch on T3, and T3's worktree isolation starts every worktree from the parent's HEAD commit" + }, + { + "pattern": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill.", + "replacement": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 a worktree candidate is a `delegate_task` child with `isolation: \"worktree\"`, per poteto-mode's Dispatch on T3.", + "rationale": "Per-skill notes: arena. A candidate's worktree comes from T3's worktree isolation, not git worktree add (#50)", + "files": "^skills/arena/SKILL\\.md$" }, { "pattern": "Transcripts live at `~/.cursor/projects/<slug>/agent-transcripts/<uuid>/<uuid>.jsonl`, where `<slug>` is the workspace path with the leading slash dropped and each \"/\" turned into \"-\" (so `/Users/you/proj` becomes `Users-you-proj`). Every line is one chat message.", @@ -583,14 +589,14 @@ { "files": "^skills/poteto-mode/playbooks/", "pattern": "Each owner is a Cursor cloud agent that builds, opens its PR", - "replacement": "Each owner is a top-level T3 thread that `t3_thread_launch` starts with `workspaceStrategy: {type: \"worktree\", baseRef, branch, startFromOrigin: false}` and a brief that names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`. It builds, opens its PR", - "rationale": "Playbooks: Autopilot-full (each PR owner is a t3_thread_launch thread in its own worktree)" + "replacement": "Each owner is a `delegate_task` child with `mode: \"async\"` and `isolation: \"worktree\"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. It builds, opens its PR", + "rationale": "Playbooks: Autopilot-full. T3 starts a top-level thread only when the user asks for one, so each PR owner is a delegate_task child in its own T3 worktree, which task_status and task_cancel reach (#47, by @pb3975). A child is a leaf unless its brief names delegation, so the owner's brief lifts that" }, { "files": "^skills/poteto-mode/playbooks/", "pattern": "Assume the VM dies.", "replacement": "Assume the owner's session dies.", - "rationale": "no cloud VMs on T3; an owner is a T3 thread" + "rationale": "no cloud VMs on T3; an owner is a delegate_task child" }, { "files": "^skills/poteto-mode/playbooks/", @@ -631,14 +637,14 @@ { "files": "^skills/poteto-mode/playbooks/orchestrate\\.md$", "pattern": "Run workers on a new cloud VM (`environment: \"cloud\"`) unless the work needs this machine: a `control-ui` or `control-cli` runtime check (from `cursor-team-kit`), local transcripts, a simulator, or auth that exists only here.", - "replacement": "Every worker runs on this machine, and one that writes gets its own git worktree, named by absolute path in its kickoff as the only place it writes.", - "rationale": "no cloud VMs on T3, so every delegate_task child runs locally and the exceptions Lauren lists need nothing; a writing child gets its own worktree per poteto-mode's Dispatch on T3" + "replacement": "Every worker runs on this machine, and one that writes gets `isolation: \"worktree\"`, per poteto-mode's Dispatch on T3.", + "rationale": "no cloud VMs on T3, so every delegate_task child runs locally and the exceptions Lauren lists need nothing; a writing child gets T3's worktree isolation per poteto-mode's Dispatch on T3" }, { "files": "^skills/poteto-mode/playbooks/orchestrate\\.md$", "pattern": "- **Fork when new work needs a worker's built state,** such as its checkout, uncommitted changes, or a running process. Message a worker only for a follow-up on the same work.", "replacement": "- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work.", - "rationale": "T3 cannot fork a child. The built state lives in the worker's worktree on this machine, so a fresh delegate_task child there inherits it, and waiting until the first worker is done keeps one writer per worktree. A message to a child is t3_thread_send, which starts a new turn on an idle child as Lauren's next sentence says. poteto-mode's Dispatch on T3 removes a child's worktree after its result, so the sentence says to keep this one" + "rationale": "T3 cannot fork a child. The built state lives in the worker's worktree on this machine, so a fresh delegate_task child there inherits it, and waiting until the first worker is done keeps one writer per worktree. A message to a child is t3_thread_send, which starts a new turn on an idle child as Lauren's next sentence says. a parent that made a worktree with git worktree add removes it after the result, so the sentence says to keep this one" }, { "files": "^skills/poteto-mode/playbooks/", @@ -745,8 +751,8 @@ { "files": "^skills/poteto-mode/playbooks/", "pattern": "One verifier per PR, each a Cursor cloud agent, runs the change the way a user would with the matching control skill (such as `control-ui` or `control-cli` from `cursor-team-kit`), parent against head,", - "replacement": "One verifier per PR, each a `delegate_task` child in its own worktree, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head,", - "rationale": "Playbooks: Shipping; UI evidence" + "replacement": "One verifier per PR, each a `delegate_task` child with `isolation: \"worktree\"` whose brief names the PR's head commit, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head,", + "rationale": "Playbooks: Shipping; UI evidence. T3's worktree isolation starts from the parent's HEAD commit, so the brief names the head to verify" }, { "pattern": "`/loop` per component until the diff is zero.", From 86758d26a7c727254a397d3bbd888af5072464bb Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann <christian@bagerbach.com> Date: Sat, 7 Nov 2026 08:30:54 +0100 Subject: [PATCH 2/4] Keep interrogate's copied changes, a reading worker's checkout, and an owner's watch working Review round 1 fixes for the 2.2.6 delegation patch. interrogate reuses arena's per-candidate worktree step and copies the scope's uncommitted changes into each worktree. The arena line made each such worktree a T3-isolated child, and isolation leaves uncommitted edits out, so a panel on uncommitted work would review a tree without the change. Dispatch on T3 now keeps git worktree add for a child whose worktree gets uncommitted changes copied in, and the arena line defers to it. A swarm worker that starts from another branch detached its checkout, which for a reading worker running in the parent's checkout would move the parent's HEAD, and for a writer left its commits off the branch it reports. It now gets its own worktree and resets its own branch there. An Orchestrate worker that reuses another worker's worktree is told to run shared with that path, since isolation always makes a new worktree. A delegate_task child has no watch_pull_request, so an Autopilot-full owner babysits in drive mode and hands a wait for a person to the root. --- CHANGES.md | 4 ++-- plugins/pstack/skills/arena/SKILL.md | 2 +- plugins/pstack/skills/poteto-mode/SKILL.md | 2 +- .../poteto-mode/playbooks/autopilot-full.md | 2 +- .../poteto-mode/playbooks/orchestrate.md | 2 +- plugins/pstack/skills/swarm/SKILL.md | 2 +- tools/substitutions.json | 20 +++++++++---------- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 26c2518d..cfe99fe0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,7 +4,7 @@ This file is the release changelog, with one `## <version> - <title>` entry per ## 2.2.6 - Writing delegates get T3's worktree isolation, PR owners are child tasks, and a child is a leaf -**A writing child gets T3's worktree isolation ([#50](https://github.com/chhoumann/t3-pstack/issues/50)).** poteto-mode's Dispatch on T3 told the parent to make each writing child's worktree itself, with `git worktree add` from `HEAD`, and to remove it and its branch after the result. No T3 thread is bound to such a worktree. As #50 reports, T3's cleanup therefore never reaches it, and a run that stops early leaves it behind. The child's commits also stayed on a branch no thread owned, so the PR came from that branch while the thread's own branch stayed empty. A writer now gets `delegate_task`'s `isolation: "worktree"`, and T3 makes its worktree and branch from the thread checkout's `HEAD` commit. One writer may instead stay in the parent's checkout while the parent writes nothing. The brief asks the child to end its reply with its branch and commit, because T3 can rename that branch during the run and `task_status` does not report it. The parent then brings the commits onto its own branch with `git merge`, and a PR opens only from a T3 thread's branch. `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit` when the thread's project is not a git checkout or has no commit yet. So the rule says to commit first in a repo with no commit, and it keeps `git worktree add` for a thread whose project is not a git checkout or whose work lives in a checkout other than the thread's own. swarm, arena, Orchestrate, Shipping, Feature step 4, and Opening a PR point at the same rule, and a swarm worker that needs another branch checks out that branch's head commit in its own worktree. +**A writing child gets T3's worktree isolation ([#50](https://github.com/chhoumann/t3-pstack/issues/50)).** poteto-mode's Dispatch on T3 told the parent to make each writing child's worktree itself, with `git worktree add` from `HEAD`, and to remove it and its branch after the result. No T3 thread is bound to such a worktree. As #50 reports, T3's cleanup therefore never reaches it, and a run that stops early leaves it behind. The child's commits also stayed on a branch no thread owned, so the PR came from that branch while the thread's own branch stayed empty. A writer now gets `delegate_task`'s `isolation: "worktree"`, and T3 makes its worktree and branch from the thread checkout's `HEAD` commit. One writer may instead stay in the parent's checkout while the parent writes nothing. The brief asks the child to end its reply with its branch and commit, because T3 can rename that branch during the run and `task_status` does not report it. The parent then brings the commits onto its own branch with `git merge`, and a PR opens only from a T3 thread's branch. `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit` when the thread's project is not a git checkout or has no commit yet. So the rule says to commit first in a repo with no commit. It keeps `git worktree add` for a thread whose project is not a git checkout, for work that lives in a checkout other than the thread's own, and for a child whose worktree gets uncommitted changes copied in, as interrogate's adversaries do, because isolation leaves those changes out. swarm, arena, Orchestrate, Shipping, Feature step 4, and Opening a PR point at the same rule. A swarm worker that starts from another branch gets its own worktree even when it only reads, and resets its own branch there to that branch's head commit, so it never moves the parent's checkout. An Orchestrate worker that reuses another worker's worktree runs in the parent's checkout with that worktree's path as the only place it writes, since isolation always makes a new one. These runs used T3 0.1.8-nightly.20261106 on macOS, with throwaway repositories and threads that are deleted since: @@ -12,7 +12,7 @@ These runs used T3 0.1.8-nightly.20261106 on macOS, with throwaway repositories - From a thread in a git repository with no commit, the same call failed with the same message. After one commit it succeeded, and the child ran in a worktree under `~/.t3/worktrees/<repo>/`. - A thread in a T3 worktree made a local commit and left one file uncommitted. Its worktree child started at that commit without the file, committed, and its branch showed in the parent's checkout. `git merge --ff-only` brought the commit onto the parent's branch. The child's branch was `t3/3098eef5` at its first command and `scripted-git-test` after its commit, and `task_status` had no branch field. A `shared` child committed straight onto the parent's branch. -**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` from the root's checkout at trunk, so it opens its PR from its own thread's branch. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. +**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` from the root's checkout at trunk, so it opens its PR from its own thread's branch. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. T3 tells a child that it never watches a PR, and a child's T3 tools have no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to the root, which watches that PR. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. **A `delegate_task` child is a leaf ([#21](https://github.com/chhoumann/t3-pstack/issues/21)).** The session-start routing text told every session, children included, "This chat runs the playbook itself. A step it says to delegate goes through `delegate_task`". So a child whose task met a routing trigger ran the playbook and started children of its own. The routing text and Dispatch on T3 now say that a `delegate_task` child is a leaf, which does the work itself and starts no subagent unless its brief names one. Autopilot-full's owner brief lifts that, as above. In this Mac's T3 store, 6 of the 456 `delegate_task` children started before 2026-10-30 started children their brief did not ask for, and one design child started 8. Since 2026-10-30, T3 itself tells each session "If you are a subagent or child, do the work yourself. Start no subagents unless your task says to.", which all 14 T3 Codex sessions since then carry, and none of the 32 children since then started a child unasked. The new line ends the routing text's contradiction of that rule. No grandchild in the store started children, so the five-level nesting that #21 reports from 2.0.0-rc.3 did not recur here. diff --git a/plugins/pstack/skills/arena/SKILL.md b/plugins/pstack/skills/arena/SKILL.md index f9eda734..a4dd6bee 100644 --- a/plugins/pstack/skills/arena/SKILL.md +++ b/plugins/pstack/skills/arena/SKILL.md @@ -15,7 +15,7 @@ Every candidate gets the same prompt, so the prompt is the contract. 1. State the artifact each candidate is producing. 2. Derive the rubric, 3-6 concrete gradeable criteria for what success looks like on *this* task. It is the picker's tool in Phase D. Candidates only see the task. 3. Pick the runners. Use the `arena runners` line in the model sheet. If the sheet or that line is missing, run one each on the defaults in [Models](#models). An `auto` or `inherit-parent` entry in this line means the parent model, so omit `target` for it. If `delegate_task` rejects a configured entry, run that seat on another target of the same family from `orchestrator_capabilities` and say so. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it. If the family has no other target, or `delegate_task` rejects that one too, drop the seat and say so. If dropped seats leave fewer than two runners, add runners until there are two, or one when the line has one entry. Run each added runner on a remaining runner's model, or omit `target` so it runs on the parent model when none remain, and say so. Spawn more runners when the arena covers multiple design directions. Use the same model N times when the work is generation-bound rather than judgment-sensitive. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section of the **poteto-mode** skill. -4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 a worktree candidate is a `delegate_task` child with `isolation: "worktree"`, per poteto-mode's Dispatch on T3. +4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 that worktree comes from `isolation: "worktree"`, or from `git worktree add` where poteto-mode's Dispatch on T3 says so. ## Phase B: Fan out diff --git a/plugins/pstack/skills/poteto-mode/SKILL.md b/plugins/pstack/skills/poteto-mode/SKILL.md index 14750a34..59e53b05 100644 --- a/plugins/pstack/skills/poteto-mode/SKILL.md +++ b/plugins/pstack/skills/poteto-mode/SKILL.md @@ -103,7 +103,7 @@ You own every subagent's work. Review the diff and write your own summary, don't **Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with "Read `<plugin root>/agents/<name>.md` in full and act as it says", and a `poteto-agent` brief also names this file's absolute path. -A child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: "worktree"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, or your work lives in a checkout other than the one `t3_worktree_status` names, create the writer's worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`. +A child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: "worktree"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, when your work lives in a checkout other than the one `t3_worktree_status` names, or when you copy uncommitted changes into the child's worktree, create that worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`. **A review gate stays closed when no independent reviewer can run.** A reviewer child that fails or is interrupted gets a fresh `delegate_task` in its place. Keep the results of reviewers that finished. Never count your own review, passing tests, or CI as the independent verdict. While the gate is blocked, record `BLOCKED: independent review` in the todolist, keep merge-ready and shipping closed, and report which reviewers ran and which are missing. Work that doesn't depend on the review continues. A fan-out run only to explore may fall back to one labelled sequential pass. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md b/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md index d225311b..37e0eb29 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md @@ -5,7 +5,7 @@ A verdict covers one patch and green CI covers one head. Step 4 runs a full swarm once, and again only for a major change. The patch-id rule in `playbooks/shipping.md` can carry a lane's result, and every new head needs its own green CI. 1. **The operator's gates come first.** The grant covers only the queue's items, so items the operator names as theirs and PRs outside the queue stop at merge-ready. A request to state the plan is not a go. -2. **Spawn one owner per PR, and keep its work where a replacement can find it.** Resolve the forge once for the program. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). Each owner is a `delegate_task` child with `mode: "async"` and `isolation: "worktree"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. It builds, opens its PR per `playbooks/opening-a-pr.md`, proves the change on the real artifact, babysits to green per `playbooks/babysit.md`, and merges once steps 4 and 5 clear it. +2. **Spawn one owner per PR, and keep its work where a replacement can find it.** Resolve the forge once for the program. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). Each owner is a `delegate_task` child with `mode: "async"` and `isolation: "worktree"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. T3 gives a child no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to this thread, which watches that PR. It builds, opens its PR per `playbooks/opening-a-pr.md`, proves the change on the real artifact, babysits to green per `playbooks/babysit.md`, and merges once steps 4 and 5 clear it. Open the PR early so CI and bots run alongside the work. The code is ready only after the slop-strip (the **deslop** skill, `/deslop`) and the `/no-comments` pass, so the full swarm runs on finished code. Then rebase onto current trunk and report the code-ready head before self-proof, so verification runs on the base the patch lands on. Report every later head, and merge-ready once self-proof, CI, and babysit are done. Fix rounds stay on that base unless trunk conflicts, breaks CI, or lands a known concurrent change to the same files, because each rebase restarts CI. Run the repo's checks for the touched paths on the committed head before the code-ready push and before a later push that needs a verifier. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md b/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md index 6a07ba14..ab88ebc5 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md @@ -9,7 +9,7 @@ Run it with your own tools. Spawn workers with `delegate_task`. Keep the program - **One owner per PR.** The owner is the only writer of its branch and carries the PR from build to merge. Only the owner pushes, rebases, or retargets it. Closing or retargeting a base PR orphans every PR above it, so the owner does that only on your call. You never author or edit code. Conflicted merges, chain rebases, and fixes go to owners. - **A fresh worker for each independent task.** Its kickoff carries everything it needs, including each upstream report it depends on, pasted in full. Workers can't see their siblings. Every worker runs on this machine, and one that writes gets `isolation: "worktree"`, per poteto-mode's Dispatch on T3. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section. - **A sub-coordinator only when one area has many parallel workers.** It owns that area's workers and kickoffs and sends you one rollup, never raw worker reports. Stop at three levels: you, sub-coordinators, and workers. Keep about ten workers in flight per coordinator, and start the next one as each finishes instead of waiting on a whole batch. -- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work. Never message one to check on it, because a message restarts an idle agent. +- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree, with `isolation: "shared"` and that worktree's absolute path in its kickoff as the only place it writes. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work. Never message one to check on it, because a message restarts an idle agent. - **Each PR gets a verifier that isn't its author,** on a different model family. The owner merges only on that verifier's pass at the current head. - **Start with one unit.** Take it through kickoff, owner, verifier, and merge before you fan out, so a flaw in the kickoff costs one agent instead of fifty. On near-identical cheap units, the first unit is that test. diff --git a/plugins/pstack/skills/swarm/SKILL.md b/plugins/pstack/skills/swarm/SKILL.md index e5107177..256a38ee 100644 --- a/plugins/pstack/skills/swarm/SKILL.md +++ b/plugins/pstack/skills/swarm/SKILL.md @@ -26,7 +26,7 @@ Open a todolist with one entry per phase before launching anything. Spawn all N workers in one response as `delegate_task` calls with `mode: "async"` and the step 3 `target`, left unset for `auto` or `inherit-parent`. Every worker runs on this machine, so a worker that writes gets `isolation: "worktree"`, per poteto-mode's Dispatch on T3. -When a worker must start from a non-default branch, its brief names that branch's head commit, and the worker runs `git checkout --detach <sha>` in its own worktree before anything else. +When a worker must start from a non-default branch, it gets `isolation: "worktree"` too, its brief names that branch's head commit, and it runs `git reset --hard <sha>` in that worktree before anything else. Every brief stands alone. Include the goal, scope, exact slice or race arm, how to verify, and what to report. Reports use `PASS`, `ISSUES`, or `BLOCKED` with evidence. A worker that can prove a defect reports `ISSUES` and lists every issue it can prove, not only the first. diff --git a/tools/substitutions.json b/tools/substitutions.json index a9e4e519..f58cb4b2 100644 --- a/tools/substitutions.json +++ b/tools/substitutions.json @@ -272,8 +272,8 @@ }, { "pattern": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.", - "replacement": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.\n\n**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with \"Read `<plugin root>/agents/<name>.md` in full and act as it says\", and a `poteto-agent` brief also names this file's absolute path.\n\nA child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: \"worktree\"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, or your work lives in a checkout other than the one `t3_worktree_status` names, create the writer's worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`.\n\nEnd every reply that ran a playbook with a dispatch ledger: one line per delegated step, naming the role and the `providerInstanceId/model` it ran on, or `in-thread: <reason>`.", - "rationale": "inserts the T3 dispatch policy at the end of the Subagents section (Tool actions; Subagent policy). A delegate_task child keeps delegate_task, so the leaf sentence stops the session-start routing from sending a child into a playbook's fan-out (#21). A writer gets T3's worktree isolation, which starts from the thread checkout's HEAD commit and refuses a thread whose project is not a git checkout or has no commit, so git worktree add stays only for those (#50)", + "replacement": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.\n\n**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with \"Read `<plugin root>/agents/<name>.md` in full and act as it says\", and a `poteto-agent` brief also names this file's absolute path.\n\nA child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: \"worktree\"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, when your work lives in a checkout other than the one `t3_worktree_status` names, or when you copy uncommitted changes into the child's worktree, create that worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`.\n\nEnd every reply that ran a playbook with a dispatch ledger: one line per delegated step, naming the role and the `providerInstanceId/model` it ran on, or `in-thread: <reason>`.", + "rationale": "inserts the T3 dispatch policy at the end of the Subagents section (Tool actions; Subagent policy). A delegate_task child keeps delegate_task, so the leaf sentence stops the session-start routing from sending a child into a playbook's fan-out (#21). A writer gets T3's worktree isolation, which starts from the thread checkout's HEAD commit and refuses a thread whose project is not a git checkout or has no commit, so git worktree add stays only for those (#50). A child whose worktree gets uncommitted changes copied in, as interrogate's adversaries do, needs that fallback too, because isolation leaves uncommitted edits out", "files": "^skills/poteto-mode/SKILL\\.md$" }, { @@ -489,13 +489,13 @@ }, { "pattern": "When a worker must start from a non-default pushed branch, pass `cloud_base_branch`.", - "replacement": "When a worker must start from a non-default branch, its brief names that branch's head commit, and the worker runs `git checkout --detach <sha>` in its own worktree before anything else.", - "rationale": "no cloud base branch on T3, and T3's worktree isolation starts every worktree from the parent's HEAD commit" + "replacement": "When a worker must start from a non-default branch, it gets `isolation: \"worktree\"` too, its brief names that branch's head commit, and it runs `git reset --hard <sha>` in that worktree before anything else.", + "rationale": "no cloud base branch on T3, and T3's worktree isolation starts every worktree from the parent's HEAD commit. The worker needs its own worktree even when it only reads, so the reset never moves the parent's checkout, and resetting its own branch keeps a writer's commits on the branch it reports" }, { "pattern": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill.", - "replacement": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 a worktree candidate is a `delegate_task` child with `isolation: \"worktree\"`, per poteto-mode's Dispatch on T3.", - "rationale": "Per-skill notes: arena. A candidate's worktree comes from T3's worktree isolation, not git worktree add (#50)", + "replacement": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 that worktree comes from `isolation: \"worktree\"`, or from `git worktree add` where poteto-mode's Dispatch on T3 says so.", + "rationale": "Per-skill notes: arena. A candidate's worktree comes from T3's worktree isolation, not git worktree add (#50). interrogate reuses this step and copies the scope's uncommitted changes into each worktree, which Dispatch on T3 sends to git worktree add", "files": "^skills/arena/SKILL\\.md$" }, { @@ -589,8 +589,8 @@ { "files": "^skills/poteto-mode/playbooks/", "pattern": "Each owner is a Cursor cloud agent that builds, opens its PR", - "replacement": "Each owner is a `delegate_task` child with `mode: \"async\"` and `isolation: \"worktree\"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. It builds, opens its PR", - "rationale": "Playbooks: Autopilot-full. T3 starts a top-level thread only when the user asks for one, so each PR owner is a delegate_task child in its own T3 worktree, which task_status and task_cancel reach (#47, by @pb3975). A child is a leaf unless its brief names delegation, so the owner's brief lifts that" + "replacement": "Each owner is a `delegate_task` child with `mode: \"async\"` and `isolation: \"worktree\"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. T3 gives a child no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to this thread, which watches that PR. It builds, opens its PR", + "rationale": "Playbooks: Autopilot-full. T3 starts a top-level thread only when the user asks for one, so each PR owner is a delegate_task child in its own T3 worktree, which task_status and task_cancel reach (#47, by @pb3975). A child is a leaf unless its brief names delegation, so the owner's brief lifts that. T3 gives a delegate_task child no watch_pull_request, so the root holds the watch an owner's wait for a person needs" }, { "files": "^skills/poteto-mode/playbooks/", @@ -643,8 +643,8 @@ { "files": "^skills/poteto-mode/playbooks/orchestrate\\.md$", "pattern": "- **Fork when new work needs a worker's built state,** such as its checkout, uncommitted changes, or a running process. Message a worker only for a follow-up on the same work.", - "replacement": "- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work.", - "rationale": "T3 cannot fork a child. The built state lives in the worker's worktree on this machine, so a fresh delegate_task child there inherits it, and waiting until the first worker is done keeps one writer per worktree. A message to a child is t3_thread_send, which starts a new turn on an idle child as Lauren's next sentence says. a parent that made a worktree with git worktree add removes it after the result, so the sentence says to keep this one" + "replacement": "- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree, with `isolation: \"shared\"` and that worktree's absolute path in its kickoff as the only place it writes. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work.", + "rationale": "T3 cannot fork a child. The built state lives in the worker's worktree on this machine, so a fresh delegate_task child there inherits it, and waiting until the first worker is done keeps one writer per worktree. A message to a child is t3_thread_send, which starts a new turn on an idle child as Lauren's next sentence says. a parent that made a worktree with git worktree add removes it after the result, so the sentence says to keep this one. isolation: \"worktree\" always makes a new worktree without uncommitted edits, so the reusing worker is told the path" }, { "files": "^skills/poteto-mode/playbooks/", From d9f69578d2c4e184b414900fdb79ea5737ae522c Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann <christian@bagerbach.com> Date: Sat, 7 Nov 2026 08:43:53 +0100 Subject: [PATCH 3/4] CHANGES: say the child's own T3 server offers no watch_pull_request Linked environments' T3 servers still list it, so the claim names the child's own server, as review round 2 found. --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index cfe99fe0..7c89e6a5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +12,7 @@ These runs used T3 0.1.8-nightly.20261106 on macOS, with throwaway repositories - From a thread in a git repository with no commit, the same call failed with the same message. After one commit it succeeded, and the child ran in a worktree under `~/.t3/worktrees/<repo>/`. - A thread in a T3 worktree made a local commit and left one file uncommitted. Its worktree child started at that commit without the file, committed, and its branch showed in the parent's checkout. `git merge --ff-only` brought the commit onto the parent's branch. The child's branch was `t3/3098eef5` at its first command and `scripted-git-test` after its commit, and `task_status` had no branch field. A `shared` child committed straight onto the parent's branch. -**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` from the root's checkout at trunk, so it opens its PR from its own thread's branch. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. T3 tells a child that it never watches a PR, and a child's T3 tools have no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to the root, which watches that PR. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. +**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` from the root's checkout at trunk, so it opens its PR from its own thread's branch. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. T3 tells a child that it never watches a PR, and a child's own T3 server offers it no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to the root, which watches that PR. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. **A `delegate_task` child is a leaf ([#21](https://github.com/chhoumann/t3-pstack/issues/21)).** The session-start routing text told every session, children included, "This chat runs the playbook itself. A step it says to delegate goes through `delegate_task`". So a child whose task met a routing trigger ran the playbook and started children of its own. The routing text and Dispatch on T3 now say that a `delegate_task` child is a leaf, which does the work itself and starts no subagent unless its brief names one. Autopilot-full's owner brief lifts that, as above. In this Mac's T3 store, 6 of the 456 `delegate_task` children started before 2026-10-30 started children their brief did not ask for, and one design child started 8. Since 2026-10-30, T3 itself tells each session "If you are a subagent or child, do the work yourself. Start no subagents unless your task says to.", which all 14 T3 Codex sessions since then carry, and none of the 32 children since then started a child unasked. The new line ends the routing text's contradiction of that rule. No grandchild in the store started children, so the five-level nesting that #21 reports from 2.0.0-rc.3 did not recur here. From 5c6b6490b956f445a9714e192412ab4126b033f4 Mon Sep 17 00:00:00 2001 From: Christian Bager Bach Houmann <christian@bagerbach.com> Date: Sat, 7 Nov 2026 08:58:14 +0100 Subject: [PATCH 4/4] Move a child to the commit it needs, since isolation starts at the parent's HEAD Cursor Bugbot on #68 found four places where a child needs a base other than the parent's HEAD, which T3's worktree isolation always starts from. A Shipping verifier was told the PR head but never moved to it, and an Autopilot-full owner was said to start at trunk while it got whatever the root had checked out. An Orchestrate worker reusing a finished worker's worktree was named the path but not told to work there, and an arena candidate in an isolated worktree had no output path the parent could pass at spawn. Dispatch on T3 now says that a child bound for another commit, such as a PR head or fresh trunk, gets its own worktree even when it only reads, fetches, and resets its own branch there first. A child sent into a worktree it does not own runs shared and works there by absolute path, and every child's report names pwd with its branch and commit. Shipping, Autopilot-full, swarm, Orchestrate, and arena point at that rule. On T3 0.1.8-nightly.20261106, two worktree children of a thread on a stale feature branch started at its commit, fetched, and reset onto fresh origin/main and onto an unfetched PR head SHA, leaving the parent's checkout unchanged. --- CHANGES.md | 5 +++-- plugins/pstack/skills/arena/SKILL.md | 2 +- plugins/pstack/skills/poteto-mode/SKILL.md | 2 +- .../poteto-mode/playbooks/autopilot-full.md | 2 +- .../poteto-mode/playbooks/orchestrate.md | 2 +- .../skills/poteto-mode/playbooks/shipping.md | 2 +- plugins/pstack/skills/swarm/SKILL.md | 2 +- tools/substitutions.json | 20 +++++++++---------- 8 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7c89e6a5..d94c864f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,15 +4,16 @@ This file is the release changelog, with one `## <version> - <title>` entry per ## 2.2.6 - Writing delegates get T3's worktree isolation, PR owners are child tasks, and a child is a leaf -**A writing child gets T3's worktree isolation ([#50](https://github.com/chhoumann/t3-pstack/issues/50)).** poteto-mode's Dispatch on T3 told the parent to make each writing child's worktree itself, with `git worktree add` from `HEAD`, and to remove it and its branch after the result. No T3 thread is bound to such a worktree. As #50 reports, T3's cleanup therefore never reaches it, and a run that stops early leaves it behind. The child's commits also stayed on a branch no thread owned, so the PR came from that branch while the thread's own branch stayed empty. A writer now gets `delegate_task`'s `isolation: "worktree"`, and T3 makes its worktree and branch from the thread checkout's `HEAD` commit. One writer may instead stay in the parent's checkout while the parent writes nothing. The brief asks the child to end its reply with its branch and commit, because T3 can rename that branch during the run and `task_status` does not report it. The parent then brings the commits onto its own branch with `git merge`, and a PR opens only from a T3 thread's branch. `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit` when the thread's project is not a git checkout or has no commit yet. So the rule says to commit first in a repo with no commit. It keeps `git worktree add` for a thread whose project is not a git checkout, for work that lives in a checkout other than the thread's own, and for a child whose worktree gets uncommitted changes copied in, as interrogate's adversaries do, because isolation leaves those changes out. swarm, arena, Orchestrate, Shipping, Feature step 4, and Opening a PR point at the same rule. A swarm worker that starts from another branch gets its own worktree even when it only reads, and resets its own branch there to that branch's head commit, so it never moves the parent's checkout. An Orchestrate worker that reuses another worker's worktree runs in the parent's checkout with that worktree's path as the only place it writes, since isolation always makes a new one. +**A writing child gets T3's worktree isolation ([#50](https://github.com/chhoumann/t3-pstack/issues/50)).** poteto-mode's Dispatch on T3 told the parent to make each writing child's worktree itself, with `git worktree add` from `HEAD`, and to remove it and its branch after the result. No T3 thread is bound to such a worktree. As #50 reports, T3's cleanup therefore never reaches it, and a run that stops early leaves it behind. The child's commits also stayed on a branch no thread owned, so the PR came from that branch while the thread's own branch stayed empty. A writer now gets `delegate_task`'s `isolation: "worktree"`, and T3 makes its worktree and branch from the thread checkout's `HEAD` commit. One writer may instead stay in the parent's checkout while the parent writes nothing. The brief asks the child to end its reply with its branch and commit, because T3 can rename that branch during the run and `task_status` does not report it. The parent then brings the commits onto its own branch with `git merge`, and a PR opens only from a T3 thread's branch. `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit` when the thread's project is not a git checkout or has no commit yet. So the rule says to commit first in a repo with no commit. It keeps `git worktree add` for a thread whose project is not a git checkout, for work that lives in a checkout other than the thread's own, and for a child whose worktree gets uncommitted changes copied in, as interrogate's adversaries do, because isolation leaves those changes out. Isolation always starts at the parent's `HEAD`. So a child that must start from another commit, such as a PR head or fresh trunk, gets its own worktree even when it only reads, and its first step is `git fetch` and `git reset --hard` of its own branch to that commit. That covers a Shipping verifier, which also names the commit in its verdict, an Autopilot-full owner, and a swarm worker on another branch, and none of them moves the parent's checkout. A child sent into a worktree it does not own, such as a finished Orchestrate worker's, runs shared with that path as the only place it writes and runs its commands. A child ends its reply with its path, branch, and commit, which is how an arena candidate in an isolated worktree reports its output location, since the parent cannot name it at spawn. swarm, arena, Orchestrate, Shipping, Feature step 4, and Opening a PR point at the same rule. These runs used T3 0.1.8-nightly.20261106 on macOS, with throwaway repositories and threads that are deleted since: - From a thread whose project is not a git checkout, `delegate_task` with `isolation: "worktree"` failed with `invalid_request: Unable to resolve the parent checkout commit.` - From a thread in a git repository with no commit, the same call failed with the same message. After one commit it succeeded, and the child ran in a worktree under `~/.t3/worktrees/<repo>/`. - A thread in a T3 worktree made a local commit and left one file uncommitted. Its worktree child started at that commit without the file, committed, and its branch showed in the parent's checkout. `git merge --ff-only` brought the commit onto the parent's branch. The child's branch was `t3/3098eef5` at its first command and `scripted-git-test` after its commit, and `task_status` had no branch field. A `shared` child committed straight onto the parent's branch. +- A thread on a local `feature` branch, behind an origin whose `main` and `pr-head` had moved since it cloned, started two worktree children. Both began at the parent's `feature` commit. One ran `git fetch origin main` and `git reset --hard origin/main`, landed on the new trunk commit the parent had never fetched, and committed on top. The other lacked the PR head commit until `git fetch origin pr-head`, and then `git reset --hard <sha>` put it on exactly that commit. The parent's checkout stayed on its commit and clean, and T3 renamed both children's branches during the run. -**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` from the root's checkout at trunk, so it opens its PR from its own thread's branch. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. T3 tells a child that it never watches a PR, and a child's own T3 server offers it no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to the root, which watches that PR. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. +**Autopilot-full's PR owners are child tasks ([#47](https://github.com/chhoumann/t3-pstack/pull/47)).** Each PR owner was a top-level thread that `t3_thread_launch` started. T3's own instructions reserve `t3_thread_launch` for a new thread the user asks for, and a top-level thread is out of reach of `task_status` and `task_cancel`, which the root's audit uses to probe and replace a stuck agent. Each owner is now a `delegate_task` child with `isolation: "worktree"` that resets its own branch to fresh trunk before it writes, so it opens its PR from its own thread's branch whatever the root has checked out. Its brief names the playbook and the root's thread ID, so it still reports each head with `t3_thread_send`, and it lets the owner delegate as the playbooks say. T3 tells a child that it never watches a PR, and a child's own T3 server offers it no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to the root, which watches that PR. A worktree child's `t3_thread_send` to its parent started a new run in the parent before the child's completion arrived. This redoes the T3 part of @pb3975's #47 as substitutions. Its rule that each review round is a fresh `delegate_task` is left out, because Lauren's "Fresh subagents by default" and T3's own instructions already say so. **A `delegate_task` child is a leaf ([#21](https://github.com/chhoumann/t3-pstack/issues/21)).** The session-start routing text told every session, children included, "This chat runs the playbook itself. A step it says to delegate goes through `delegate_task`". So a child whose task met a routing trigger ran the playbook and started children of its own. The routing text and Dispatch on T3 now say that a `delegate_task` child is a leaf, which does the work itself and starts no subagent unless its brief names one. Autopilot-full's owner brief lifts that, as above. In this Mac's T3 store, 6 of the 456 `delegate_task` children started before 2026-10-30 started children their brief did not ask for, and one design child started 8. Since 2026-10-30, T3 itself tells each session "If you are a subagent or child, do the work yourself. Start no subagents unless your task says to.", which all 14 T3 Codex sessions since then carry, and none of the 32 children since then started a child unasked. The new line ends the routing text's contradiction of that rule. No grandchild in the store started children, so the five-level nesting that #21 reports from 2.0.0-rc.3 did not recur here. diff --git a/plugins/pstack/skills/arena/SKILL.md b/plugins/pstack/skills/arena/SKILL.md index a4dd6bee..1346b09a 100644 --- a/plugins/pstack/skills/arena/SKILL.md +++ b/plugins/pstack/skills/arena/SKILL.md @@ -15,7 +15,7 @@ Every candidate gets the same prompt, so the prompt is the contract. 1. State the artifact each candidate is producing. 2. Derive the rubric, 3-6 concrete gradeable criteria for what success looks like on *this* task. It is the picker's tool in Phase D. Candidates only see the task. 3. Pick the runners. Use the `arena runners` line in the model sheet. If the sheet or that line is missing, run one each on the defaults in [Models](#models). An `auto` or `inherit-parent` entry in this line means the parent model, so omit `target` for it. If `delegate_task` rejects a configured entry, run that seat on another target of the same family from `orchestrator_capabilities` and say so. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it. If the family has no other target, or `delegate_task` rejects that one too, drop the seat and say so. If dropped seats leave fewer than two runners, add runners until there are two, or one when the line has one entry. Run each added runner on a remaining runner's model, or omit `target` so it runs on the parent model when none remain, and say so. Spawn more runners when the arena covers multiple design directions. Use the same model N times when the work is generation-bound rather than judgment-sensitive. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section of the **poteto-mode** skill. -4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 that worktree comes from `isolation: "worktree"`, or from `git worktree add` where poteto-mode's Dispatch on T3 says so. +4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 that worktree comes from `isolation: "worktree"`, or from `git worktree add` where poteto-mode's Dispatch on T3 says so. T3 makes an isolated worktree only once the candidate starts, so its brief names its own worktree as its output location, and its reply names the path. ## Phase B: Fan out diff --git a/plugins/pstack/skills/poteto-mode/SKILL.md b/plugins/pstack/skills/poteto-mode/SKILL.md index 59e53b05..899b4316 100644 --- a/plugins/pstack/skills/poteto-mode/SKILL.md +++ b/plugins/pstack/skills/poteto-mode/SKILL.md @@ -103,7 +103,7 @@ You own every subagent's work. Review the diff and write your own summary, don't **Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with "Read `<plugin root>/agents/<name>.md` in full and act as it says", and a `poteto-agent` brief also names this file's absolute path. -A child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: "worktree"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, when your work lives in a checkout other than the one `t3_worktree_status` names, or when you copy uncommitted changes into the child's worktree, create that worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`. +A child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: "worktree"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. A child that must start from another commit, such as a PR head or fresh trunk, gets `isolation: "worktree"` even when it only reads. Its brief names that commit or ref, and before anything else the child runs `git fetch` and moves its own branch there with `git reset --hard`. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `pwd`, `git branch --show-current`, and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, when your work lives in a checkout other than the one `t3_worktree_status` names, or when you copy uncommitted changes into the child's worktree, create that worktree with `git worktree add` from `HEAD` instead. Remove that worktree and its branch after the result. A child sent into a worktree it does not own, one you made this way or one a finished worker left, keeps `isolation: "shared"`. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`. **A review gate stays closed when no independent reviewer can run.** A reviewer child that fails or is interrupted gets a fresh `delegate_task` in its place. Keep the results of reviewers that finished. Never count your own review, passing tests, or CI as the independent verdict. While the gate is blocked, record `BLOCKED: independent review` in the todolist, keep merge-ready and shipping closed, and report which reviewers ran and which are missing. Work that doesn't depend on the review continues. A fan-out run only to explore may fall back to one labelled sequential pass. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md b/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md index 37e0eb29..1e067297 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/autopilot-full.md @@ -5,7 +5,7 @@ A verdict covers one patch and green CI covers one head. Step 4 runs a full swarm once, and again only for a major change. The patch-id rule in `playbooks/shipping.md` can carry a lane's result, and every new head needs its own green CI. 1. **The operator's gates come first.** The grant covers only the queue's items, so items the operator names as theirs and PRs outside the queue stop at merge-ready. A request to state the plan is not a go. -2. **Spawn one owner per PR, and keep its work where a replacement can find it.** Resolve the forge once for the program. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). Each owner is a `delegate_task` child with `mode: "async"` and `isolation: "worktree"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. T3 gives a child no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to this thread, which watches that PR. It builds, opens its PR per `playbooks/opening-a-pr.md`, proves the change on the real artifact, babysits to green per `playbooks/babysit.md`, and merges once steps 4 and 5 clear it. +2. **Spawn one owner per PR, and keep its work where a replacement can find it.** Resolve the forge once for the program. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). Each owner is a `delegate_task` child with `mode: "async"` and `isolation: "worktree"` that starts from fresh trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. T3 gives a child no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to this thread, which watches that PR. It builds, opens its PR per `playbooks/opening-a-pr.md`, proves the change on the real artifact, babysits to green per `playbooks/babysit.md`, and merges once steps 4 and 5 clear it. Open the PR early so CI and bots run alongside the work. The code is ready only after the slop-strip (the **deslop** skill, `/deslop`) and the `/no-comments` pass, so the full swarm runs on finished code. Then rebase onto current trunk and report the code-ready head before self-proof, so verification runs on the base the patch lands on. Report every later head, and merge-ready once self-proof, CI, and babysit are done. Fix rounds stay on that base unless trunk conflicts, breaks CI, or lands a known concurrent change to the same files, because each rebase restarts CI. Run the repo's checks for the touched paths on the committed head before the code-ready push and before a later push that needs a verifier. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md b/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md index ab88ebc5..593b62bd 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/orchestrate.md @@ -9,7 +9,7 @@ Run it with your own tools. Spawn workers with `delegate_task`. Keep the program - **One owner per PR.** The owner is the only writer of its branch and carries the PR from build to merge. Only the owner pushes, rebases, or retargets it. Closing or retargeting a base PR orphans every PR above it, so the owner does that only on your call. You never author or edit code. Conflicted merges, chain rebases, and fixes go to owners. - **A fresh worker for each independent task.** Its kickoff carries everything it needs, including each upstream report it depends on, pasted in full. Workers can't see their siblings. Every worker runs on this machine, and one that writes gets `isolation: "worktree"`, per poteto-mode's Dispatch on T3. Pick each subagent's reasoning level and fast or standard speed for the job, per the Subagents section. - **A sub-coordinator only when one area has many parallel workers.** It owns that area's workers and kickoffs and sends you one rollup, never raw worker reports. Stop at three levels: you, sub-coordinators, and workers. Keep about ten workers in flight per coordinator, and start the next one as each finishes instead of waiting on a whole batch. -- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree, with `isolation: "shared"` and that worktree's absolute path in its kickoff as the only place it writes. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work. Never message one to check on it, because a message restarts an idle agent. +- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree, as poteto-mode's Dispatch on T3 says for a child sent into a worktree it does not own. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work. Never message one to check on it, because a message restarts an idle agent. - **Each PR gets a verifier that isn't its author,** on a different model family. The owner merges only on that verifier's pass at the current head. - **Start with one unit.** Take it through kickoff, owner, verifier, and merge before you fan out, so a flaw in the kickoff costs one agent instead of fifty. On near-identical cheap units, the first unit is that test. diff --git a/plugins/pstack/skills/poteto-mode/playbooks/shipping.md b/plugins/pstack/skills/poteto-mode/playbooks/shipping.md index 2f0768fa..c09ad701 100644 --- a/plugins/pstack/skills/poteto-mode/playbooks/shipping.md +++ b/plugins/pstack/skills/poteto-mode/playbooks/shipping.md @@ -2,7 +2,7 @@ **You own what lands. Verify each PR independently, land only the verified run from the root, then keep your hands off the stack.** -1. **Resolve the forge, then verify each PR independently before it lands.** GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). One verifier per PR, each a `delegate_task` child with `isolation: "worktree"` whose brief names the PR's head commit, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head, and posts `PASS`, `PASS+NOTES`, or `FAIL` on that PR. Only a verdict from an agent that did not write the code counts, because an author checks what it meant to build. Green CI and an approving bot review are not verdicts, because neither runs the change as a user would. +1. **Resolve the forge, then verify each PR independently before it lands.** GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). One verifier per PR, each a `delegate_task` child that starts from the PR's head commit per poteto-mode's Dispatch on T3 and names that commit in its verdict, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head, and posts `PASS`, `PASS+NOTES`, or `FAIL` on that PR. Only a verdict from an agent that did not write the code counts, because an author checks what it meant to build. Green CI and an approving bot review are not verdicts, because neither runs the change as a user would. 2. **Land only the contiguous verified run rooted at the bottom.** Walk up from the lowest unmerged PR and stop at the first one without `PASS` or `PASS+NOTES`. The PRs below it are the run, and the top one is the ceiling. A verified PR above an unverified one waits, because it cannot land without the code below it. One whose branch neither holds nor needs that code can move onto trunk and land on its own. It needs a fresh verdict first, because its old one ran with that code beneath it and trunk does not have it. 3. **Re-check that the verdicts still describe the code.** A verdict covers a patch, and a chain rebase moves every PR above it to a new SHA without failing any check. Compare `git patch-id` at the verdict SHA with the current head before trusting an older verdict. When the patches differ only in tests, docs, or lint config, a lane's result stands if what it ran builds the same at both SHAs apart from noise. Noise is a difference that also shows up between two builds of the verdict SHA, or an embedded commit SHA. Report each kind of noise with its files, so a reader can check the call. The change itself still gets fresh checks and a review, because the old verdict never saw it. A lane with no build output, such as a dev server, cannot show this, so rerun it, and re-verify anything else that drifted. 4. **Land bottom-up, one PR at a time.** Always merge the run's lowest unmerged PR, with `origin pr merge <pr>` or `gh pr merge <pr> --squash --match-head-commit <head>`, where `<head>` is the current head SHA whose verdict survives step 3's patch-id rule, so a head pushed after that check cannot land. On Origin the plain command also merges every PR below the one you name, and on GitHub a PR whose base is still its parent's branch merges into that branch, not trunk. Read the PR back for the result (`origin pr view <pr>` or `gh pr view <pr> --json state,mergedAt,baseRefName`), because a merge command can report success when a merge queue only queued the PR, and a requested auto-merge is not a merge. A landed PR reads merged with trunk as its base, not its parent's branch. Arm `--auto` (Origin merge-when-ready or GitHub auto-merge) only on a PR whose verdict covers its current head, because it lands whatever head is ready. After a merge lands, retarget the PR whose base was the merged branch to trunk (`origin pr edit <pr> --base <trunk>` or `gh pr edit <pr> --base <trunk>`), move its patch onto the merge result, and push with `--force-with-lease`. The verdict covers the patch, not its commits, so step 3's patch-id rule decides whether the verdict survives. Merge it once its checks pass and its verdict survives. diff --git a/plugins/pstack/skills/swarm/SKILL.md b/plugins/pstack/skills/swarm/SKILL.md index 256a38ee..b9ac0ebc 100644 --- a/plugins/pstack/skills/swarm/SKILL.md +++ b/plugins/pstack/skills/swarm/SKILL.md @@ -26,7 +26,7 @@ Open a todolist with one entry per phase before launching anything. Spawn all N workers in one response as `delegate_task` calls with `mode: "async"` and the step 3 `target`, left unset for `auto` or `inherit-parent`. Every worker runs on this machine, so a worker that writes gets `isolation: "worktree"`, per poteto-mode's Dispatch on T3. -When a worker must start from a non-default branch, it gets `isolation: "worktree"` too, its brief names that branch's head commit, and it runs `git reset --hard <sha>` in that worktree before anything else. +When a worker must start from a non-default branch, it starts from that branch's head commit, per poteto-mode's Dispatch on T3. Every brief stands alone. Include the goal, scope, exact slice or race arm, how to verify, and what to report. Reports use `PASS`, `ISSUES`, or `BLOCKED` with evidence. A worker that can prove a defect reports `ISSUES` and lists every issue it can prove, not only the first. diff --git a/tools/substitutions.json b/tools/substitutions.json index f58cb4b2..95805aaf 100644 --- a/tools/substitutions.json +++ b/tools/substitutions.json @@ -272,8 +272,8 @@ }, { "pattern": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.", - "replacement": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.\n\n**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with \"Read `<plugin root>/agents/<name>.md` in full and act as it says\", and a `poteto-agent` brief also names this file's absolute path.\n\nA child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: \"worktree\"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `git branch --show-current` and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, when your work lives in a checkout other than the one `t3_worktree_status` names, or when you copy uncommitted changes into the child's worktree, create that worktree with `git worktree add` from `HEAD` instead. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Remove that worktree and its branch after the result. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`.\n\nEnd every reply that ran a playbook with a dispatch ledger: one line per delegated step, naming the role and the `providerInstanceId/model` it ran on, or `in-thread: <reason>`.", - "rationale": "inserts the T3 dispatch policy at the end of the Subagents section (Tool actions; Subagent policy). A delegate_task child keeps delegate_task, so the leaf sentence stops the session-start routing from sending a child into a playbook's fan-out (#21). A writer gets T3's worktree isolation, which starts from the thread checkout's HEAD commit and refuses a thread whose project is not a git checkout or has no commit, so git worktree add stays only for those (#50). A child whose worktree gets uncommitted changes copied in, as interrogate's adversaries do, needs that fallback too, because isolation leaves uncommitted edits out", + "replacement": "Interrupt-chained resumes silently drop directives, so fire a fresh subagent with consolidated scope rather than trusting a \"done\" summary.\n\n**Dispatch on T3.** Every subagent is a `delegate_task` call from the chat that runs the playbook, same model family included, so every child shows up in T3. When you are a `delegate_task` child, you are a leaf. Do the work yourself, and start no subagent unless your brief names one. Give each call its own `clientRequestId`, stable across retries of that call, and keep each returned `taskId`. A child's completion wakes this thread, so end the turn instead of polling, and call `task_status` only when a result is needed mid-turn. `task_cancel` stops a child, and `task_status` confirms it stopped. A child gets only its brief, never your context, so pass absolute paths. `<plugin root>` is the absolute path of the directory that holds this plugin's `skills/` and `agents/`. A persona (`poteto-agent`, `comment-sicko`, `thermo-nuclear-review-subagent`, `thermo-nuclear-code-quality-review-subagent`) is a brief that opens with \"Read `<plugin root>/agents/<name>.md` in full and act as it says\", and a `poteto-agent` brief also names this file's absolute path.\n\nA child starts in your checkout, which suits one writer while you write nothing. A writer that runs beside other writers or your own edits gets `isolation: \"worktree\"`, and T3 gives it a new worktree and branch from your thread's checkout at its `HEAD` commit. Commit what it builds on first, because uncommitted edits stay behind. A child that must start from another commit, such as a PR head or fresh trunk, gets `isolation: \"worktree\"` even when it only reads. Its brief names that commit or ref, and before anything else the child runs `git fetch` and moves its own branch there with `git reset --hard`. T3 can rename that branch during the run, so the brief tells the child to end its reply with the output of `pwd`, `git branch --show-current`, and `git rev-parse HEAD`. After review, bring its commits onto your branch with `git merge <branch>`, which fast-forwards when your branch has not moved. A PR opens only from a T3 thread's branch, yours or that of a child that owns the PR. In a repo with no commit yet, `delegate_task` refuses the worktree with `Unable to resolve the parent checkout commit`, so commit first. When this thread's project is not a git checkout, which gets the same refusal, when your work lives in a checkout other than the one `t3_worktree_status` names, or when you copy uncommitted changes into the child's worktree, create that worktree with `git worktree add` from `HEAD` instead. Remove that worktree and its branch after the result. A child sent into a worktree it does not own, one you made this way or one a finished worker left, keeps `isolation: \"shared\"`. Its brief names that absolute path as the only place it writes, and tells it to run every command there (`workdir` on Codex) and to edit by absolute path. Record your own `git status --porcelain` before you dispatch a writer to another checkout, and check after the result that it is unchanged. A step a playbook says to delegate goes to `delegate_task` on that role's sheet entry, not into your own tool calls, unless you state a reason such as a step too small to brief. A research delegate no role names runs on the `how explorer` entry. A model's family is the first segment of its ID's last `/` part, such as `claude`, `gpt`, or `grok`, whatever provider instance serves it, and your own family is the one in `orchestrator_capabilities`' `inheritedModel`. A rejected target runs on another target of the same family from `orchestrator_capabilities`, and you say so. `orchestrator_capabilities` lists a short set of models per provider, and its `search` finds the others. A required review with no reviewer from another family stays `BLOCKED: independent review`.\n\nEnd every reply that ran a playbook with a dispatch ledger: one line per delegated step, naming the role and the `providerInstanceId/model` it ran on, or `in-thread: <reason>`.", + "rationale": "inserts the T3 dispatch policy at the end of the Subagents section (Tool actions; Subagent policy). A delegate_task child keeps delegate_task, so the leaf sentence stops the session-start routing from sending a child into a playbook's fan-out (#21). A writer gets T3's worktree isolation, which starts from the thread checkout's HEAD commit and refuses a thread whose project is not a git checkout or has no commit, so git worktree add stays only for those (#50). A child whose worktree gets uncommitted changes copied in, as interrogate's adversaries do, needs that fallback too, because isolation leaves uncommitted edits out. Isolation always starts at the parent's HEAD, so a child bound for a PR head or fresh trunk fetches and resets its own branch there, a child sent into a worktree it does not own works there by path, and the report names pwd so a parent learns a worktree it could not name at spawn (Cursor Bugbot on #68)", "files": "^skills/poteto-mode/SKILL\\.md$" }, { @@ -489,13 +489,13 @@ }, { "pattern": "When a worker must start from a non-default pushed branch, pass `cloud_base_branch`.", - "replacement": "When a worker must start from a non-default branch, it gets `isolation: \"worktree\"` too, its brief names that branch's head commit, and it runs `git reset --hard <sha>` in that worktree before anything else.", - "rationale": "no cloud base branch on T3, and T3's worktree isolation starts every worktree from the parent's HEAD commit. The worker needs its own worktree even when it only reads, so the reset never moves the parent's checkout, and resetting its own branch keeps a writer's commits on the branch it reports" + "replacement": "When a worker must start from a non-default branch, it starts from that branch's head commit, per poteto-mode's Dispatch on T3.", + "rationale": "no cloud base branch on T3. T3's worktree isolation starts every worktree from the parent's HEAD commit, so Dispatch on T3 gives a worker bound for another commit its own worktree, even when it only reads, and has it fetch and reset its own branch there" }, { "pattern": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill.", - "replacement": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 that worktree comes from `isolation: \"worktree\"`, or from `git worktree add` where poteto-mode's Dispatch on T3 says so.", - "rationale": "Per-skill notes: arena. A candidate's worktree comes from T3's worktree isolation, not git worktree add (#50). interrogate reuses this step and copies the scope's uncommitted changes into each worktree, which Dispatch on T3 sends to git worktree add", + "replacement": "Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill. On T3 that worktree comes from `isolation: \"worktree\"`, or from `git worktree add` where poteto-mode's Dispatch on T3 says so. T3 makes an isolated worktree only once the candidate starts, so its brief names its own worktree as its output location, and its reply names the path.", + "rationale": "Per-skill notes: arena. A candidate's worktree comes from T3's worktree isolation, not git worktree add (#50). interrogate reuses this step and copies the scope's uncommitted changes into each worktree, which Dispatch on T3 sends to git worktree add. Phase B passes each candidate its output path at spawn, which an isolated candidate's worktree does not have yet, so the reply carries it", "files": "^skills/arena/SKILL\\.md$" }, { @@ -589,8 +589,8 @@ { "files": "^skills/poteto-mode/playbooks/", "pattern": "Each owner is a Cursor cloud agent that builds, opens its PR", - "replacement": "Each owner is a `delegate_task` child with `mode: \"async\"` and `isolation: \"worktree\"` from this thread's checkout at trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. T3 gives a child no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to this thread, which watches that PR. It builds, opens its PR", - "rationale": "Playbooks: Autopilot-full. T3 starts a top-level thread only when the user asks for one, so each PR owner is a delegate_task child in its own T3 worktree, which task_status and task_cancel reach (#47, by @pb3975). A child is a leaf unless its brief names delegation, so the owner's brief lifts that. T3 gives a delegate_task child no watch_pull_request, so the root holds the watch an owner's wait for a person needs" + "replacement": "Each owner is a `delegate_task` child with `mode: \"async\"` and `isolation: \"worktree\"` that starts from fresh trunk, per poteto-mode's Dispatch on T3. Its brief names this playbook and this thread's ID, so the owner reports back with `t3_thread_send`, and lets the owner delegate as the playbooks say. T3 gives a child no `watch_pull_request`, so the owner babysits in `drive` mode and reports a wait for a person to this thread, which watches that PR. It builds, opens its PR", + "rationale": "Playbooks: Autopilot-full. T3 starts a top-level thread only when the user asks for one, so each PR owner is a delegate_task child in its own T3 worktree, which task_status and task_cancel reach (#47, by @pb3975). A child is a leaf unless its brief names delegation, so the owner's brief lifts that. T3 gives a delegate_task child no watch_pull_request, so the root holds the watch an owner's wait for a person needs. Isolation starts at the root's HEAD, which need not be trunk, so the owner resets its own branch to fresh trunk" }, { "files": "^skills/poteto-mode/playbooks/", @@ -643,7 +643,7 @@ { "files": "^skills/poteto-mode/playbooks/orchestrate\\.md$", "pattern": "- **Fork when new work needs a worker's built state,** such as its checkout, uncommitted changes, or a running process. Message a worker only for a follow-up on the same work.", - "replacement": "- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree, with `isolation: \"shared\"` and that worktree's absolute path in its kickoff as the only place it writes. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work.", + "replacement": "- **Reuse a worker's worktree when new work needs its built state,** such as its checkout, uncommitted changes, or a running process. Once that worker is done, start a fresh one there instead of removing the worktree, as poteto-mode's Dispatch on T3 says for a child sent into a worktree it does not own. Message a worker, with `t3_thread_send` to its `childThreadId`, only for a follow-up on the same work.", "rationale": "T3 cannot fork a child. The built state lives in the worker's worktree on this machine, so a fresh delegate_task child there inherits it, and waiting until the first worker is done keeps one writer per worktree. A message to a child is t3_thread_send, which starts a new turn on an idle child as Lauren's next sentence says. a parent that made a worktree with git worktree add removes it after the result, so the sentence says to keep this one. isolation: \"worktree\" always makes a new worktree without uncommitted edits, so the reusing worker is told the path" }, { @@ -751,7 +751,7 @@ { "files": "^skills/poteto-mode/playbooks/", "pattern": "One verifier per PR, each a Cursor cloud agent, runs the change the way a user would with the matching control skill (such as `control-ui` or `control-cli` from `cursor-team-kit`), parent against head,", - "replacement": "One verifier per PR, each a `delegate_task` child with `isolation: \"worktree\"` whose brief names the PR's head commit, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head,", + "replacement": "One verifier per PR, each a `delegate_task` child that starts from the PR's head commit per poteto-mode's Dispatch on T3 and names that commit in its verdict, runs the change the way a user would with the matching control skill in poteto-mode's Non-negotiables, parent against head,", "rationale": "Playbooks: Shipping; UI evidence. T3's worktree isolation starts from the parent's HEAD commit, so the brief names the head to verify" }, {