From 33ea9085ec2c065dfaadb35520f6b50528221cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20M=2E=20Wo=C5=BAniak?= Date: Wed, 28 Oct 2026 10:59:08 +0100 Subject: [PATCH] Run cloud lanes on linked environments and wait on launched threads' delegated work --- .claude-plugin/marketplace.json | 2 +- package.json | 2 +- plugins/pstack/.claude-plugin/plugin.json | 2 +- plugins/pstack/.codex-plugin/plugin.json | 2 +- .../skills/poteto-mode/references/t3-adapter.md | 11 +++++++---- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index bdabff1..92d126f 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "pstack", "source": "./plugins/pstack", "description": "Cursor pstack for T3 Code: poteto-mode, principles, and the verified agent workflows, adapted to T3 orchestration for Claude and Codex.", - "version": "0.13.1", + "version": "0.13.2", "author": { "name": "Lauren Tan (pstack), pmwoz (T3 Code port)" }, diff --git a/package.json b/package.json index 6f18530..c01b830 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "t3-pstack", - "version": "0.13.1", + "version": "0.13.2", "private": true, "type": "module", "scripts": { diff --git a/plugins/pstack/.claude-plugin/plugin.json b/plugins/pstack/.claude-plugin/plugin.json index 5fbf1b8..6557b58 100644 --- a/plugins/pstack/.claude-plugin/plugin.json +++ b/plugins/pstack/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "pstack", "displayName": "pstack", - "version": "0.13.1", + "version": "0.13.2", "description": "Cursor pstack for T3 Code: poteto-mode, principles, and the verified agent workflows, adapted to T3 orchestration for Claude and Codex.", "author": { "name": "Lauren Tan (pstack), pmwoz (T3 Code port)" diff --git a/plugins/pstack/.codex-plugin/plugin.json b/plugins/pstack/.codex-plugin/plugin.json index 5cef6ad..195784a 100644 --- a/plugins/pstack/.codex-plugin/plugin.json +++ b/plugins/pstack/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "pstack", - "version": "0.13.1", + "version": "0.13.2", "description": "Cursor pstack for T3 Code: poteto-mode, principles, and the verified agent workflows, adapted to T3 orchestration for Claude and Codex.", "author": { "name": "Lauren Tan (pstack), pmwoz (T3 Code port)" diff --git a/plugins/pstack/skills/poteto-mode/references/t3-adapter.md b/plugins/pstack/skills/poteto-mode/references/t3-adapter.md index 1ef9d27..b32eab5 100644 --- a/plugins/pstack/skills/poteto-mode/references/t3-adapter.md +++ b/plugins/pstack/skills/poteto-mode/references/t3-adapter.md @@ -41,6 +41,8 @@ Omit `runtimeMode` on every `delegate_task`, so the child inherits yours. A narr `task_status` only finds tasks your own thread delegated. A grandchild's task belongs to its parent. +A task in a linked environment (Worktrees section) returns `childThreadId: null` and a `remoteChild`. Where this file names `childThreadId`, use `remoteChild.threadId` and pass `remoteChild.environmentId` as `environmentId` to the thread tool. + ## Model per role Upstream reads per-role models from "the `/setup-pstack` rule" (`~/.cursor/rules/pstack-models.mdc`) and falls back to slugs written in the skills. Under T3: @@ -61,9 +63,9 @@ Upstream reads per-role models from "the `/setup-pstack` rule" (`~/.cursor/rules ## Worktrees and parallel writers -T3 has no cloud agents. Every lane is a local `delegate_task` child. A child shares the parent's checkout unless the call sets `isolation: "worktree"`. +T3 has no cloud agents. Every lane is a `delegate_task` child on this machine or on a linked one. A local child shares the parent's checkout unless the call sets `isolation: "worktree"`. -- **A lane that writes gets its own worktree.** Commit what the lane builds on, then delegate with `isolation: "worktree"`. T3 creates the worktree from your current local commit, runs project setup, and starts the child there. It does not copy uncommitted edits. The child commits its work and reports its branch and head SHA, so the parent reads the result by ref from its own checkout. The worktree belongs to the child's thread, so do not remove it. This replaces "a cloud agent per worker", `environment: "cloud"`, `cloud_base_branch`, and "each worker its own worktree". Interrogate's adversaries are such lanes, so commit the scope's uncommitted changes in place of copying them into each worktree. +- **A lane that writes gets its own worktree.** Commit what the lane builds on, then delegate with `isolation: "worktree"`. T3 creates the worktree from your current local commit, runs project setup, and starts the child there. It does not copy uncommitted edits. The child commits its work and reports its branch and head SHA, so the parent reads the result by ref from its own checkout. The worktree belongs to the child's thread, so do not remove it. Without a usable linked environment, this replaces "a cloud agent per worker", `environment: "cloud"`, `cloud_base_branch`, and "each worker its own worktree". Interrogate's adversaries are such lanes, so commit the scope's uncommitted changes in place of copying them into each worktree. - **A lane on another ref gets a worktree from the parent.** Isolation always starts from your current commit. For a lane on a PR branch, such as a PR owner's fix round, or on another SHA, run `git worktree add [--detach] ${TMPDIR:-/tmp}/pstack/// ` and delegate without `isolation`. The brief names the path, and the child works only there. Keep the worktree until the last step that reads it is done (verification, merge). Then the parent removes it. - **A before run gets its own worktree too.** Reproduce the old behavior in `git worktree add --detach ${TMPDIR:-/tmp}/pstack///before origin/`, whether the root or a lane runs it. Never copy the default branch's files into the working checkout, because the next commit picks them up. - **Read-only lanes review a frozen SHA.** Before a round of read-only lanes, such as `how` explorers or the arena judge, commit what is under review and run `git worktree add --detach ${TMPDIR:-/tmp}/pstack///review- `. The brief names that path and the SHA, and the round's read-only lanes read only there, because your own worktree keeps changing while they work. Remove it after you synthesize the round. A read-only lane reads code, diffs, and the evidence a writing lane produced. It does not build or run the app unless its brief asks for that. @@ -71,8 +73,9 @@ T3 has no cloud agents. Every lane is a local `delegate_task` child. A child sha - **Evidence outlives worktrees.** Write the decision log, verification output, review prompts, and child reports under `${PSTACK_STORE:-$HOME/.pstack/store}///`, never inside a worktree. That directory is show-me-your-work's "work dir". `git worktree remove` deletes ignored files, and `gh pr merge --delete-branch` removes the worktree that holds the merged branch. A project verification skill that writes evidence inside the checkout (`build/`, `work/`) still applies. Copy this run's evidence from it into the work dir before the reply or the trail cites it. Never copy build outputs such as `DerivedData`, `target/`, or `node_modules/`, or evidence from other runs. - **Cleanup removes only what the root made.** When the user asks to clean up, remove the worktrees the root added with `git worktree add` and its scratch files outside the work dir. Keep each child's worktree, which belongs to the child's thread, and keep the work dir, which holds the evidence the trail and the PR cite. - **The user picks the root's workspace.** The user starts a thread in a worktree from the T3 UI. The root works in the checkout its thread is in and never moves it. If the root sits on `main` and the task writes, it creates a branch there with `git switch -c `. Never call `t3_worktree_handoff`. It detaches the provider session, and the queued continuation can wait for minutes or never start. -- **Upstream's capacity numbers assume cloud VMs.** Cap in-flight writing lanes at what this machine runs. Give each live lane its own ports and data directories per the project's verification skill. If the app cannot run side by side, run those lanes in sequence. A push that runs a pre-push gate waits while a lane drives the shared VM, simulator, or app. -- **Separate top-level threads** come only from an explicit user request for them. Then use `t3_thread_launch` with a `workspaceStrategy`. A launched thread is not a task: follow it with `t3_thread_read` or `t3_thread_wait`, never `task_status`, and it does not wake you when it ends. +- **A linked environment stands in for a cloud VM.** `t3_environment_links` lists the user's other machines, when T3's Labs beta for them is on. Run a lane that upstream sends to the cloud on a link whose `status` is `reachable` and whose `access` is `auto` or `full-access`, because a narrower link makes the user approve the child's tool calls by hand. Never call `t3_environment_link` unless the user names a machine to link, because it asks the user to approve the link. Delegate with `target.environmentId`, and resolve the role's model with `orchestrator_capabilities` given that `environmentId`. The task runs in that machine's checkout of the repository and takes no `isolation` or attachments, so only pushed commits reach it. When `delegate_task` finds no project for the repository there, run the lane here. Push the base first. The brief tells the child to fetch it, run `git worktree add ${TMPDIR:-/tmp}/pstack/// ` there, and work only in that worktree. The child pushes its branch, returns its evidence in its report, and then removes the worktree. A lane that needs this machine, such as a control skill run, a simulator, local transcripts, auth that exists only here, or the work dir, stays local. Name each remote lane's machine in the reply. +- **Upstream's capacity numbers assume cloud VMs.** Cap in-flight writing lanes at what this machine and each linked machine you use can run. Give each live lane its own ports and data directories per the project's verification skill. If the app cannot run side by side, run those lanes in sequence. A push that runs a pre-push gate waits while a lane drives the shared VM, simulator, or app. +- **Separate top-level threads** come only from an explicit user request for them. Then use `t3_thread_launch` with a `workspaceStrategy`. A launched thread is not a task: follow it with `t3_thread_read` or `t3_thread_wait`, never `task_status`, and it does not wake you when it ends. `t3_thread_wait` with `untilDelegatedWorkSettled: true` also waits for the tasks that thread delegated, and its `resultRun` names the run that holds the final answer. - **Listing worktrees.** `t3_worktree_status` reports only your own thread. To audit every worktree, use `t3_worktree_list`, `t3_thread_list`, and `t3_thread_read` per thread for its `worktreePath`. `t3_thread_list` also returns each thread's linked PRs and their state in `pullRequests`, so the audit needs no `list_thread_pull_requests` call per thread. Add `git worktree list` for detached worktrees, which `t3_worktree_list` omits. ## Pull requests, watching, and loops