From aaa866be754f259437ec9bc67db6b54a9bca3ade Mon Sep 17 00:00:00 2001 From: Justin Carlson <40642470+justcarlson@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:44:48 -0500 Subject: [PATCH 1/2] feat(skills): settle T3 threads after full send and epic, bump to 0.2.0 Closes #12 --- .claude-plugin/marketplace.json | 2 +- .claude-plugin/plugin.json | 2 +- .codex-plugin/plugin.json | 2 +- UPSTREAM.md | 1 + patches/09-t3-thread-settle.patch | 61 +++++++++++++++++++++++++++++++ size-budget.json | 4 +- skills/bug/SKILL.md | 6 ++- skills/epic/SKILL.md | 31 ++++++++-------- skills/full-send/SKILL.md | 20 +++++----- skills/full-stop/SKILL.md | 3 +- tests/test_validate_skills.py | 2 +- 11 files changed, 98 insertions(+), 36 deletions(-) create mode 100644 patches/09-t3-thread-settle.patch diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 74f3515..78d347b 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -9,7 +9,7 @@ "name": "jstack", "source": "./", "description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.", - "version": "0.1.0", + "version": "0.2.0", "author": { "name": "justcarlson" }, diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index 58d58ca..c12cdef 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "jstack", "displayName": "jstack", - "version": "0.1.0", + "version": "0.2.0", "description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.", "author": { "name": "justcarlson" diff --git a/.codex-plugin/plugin.json b/.codex-plugin/plugin.json index 85f483d..aa1647e 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jstack", - "version": "0.1.0", + "version": "0.2.0", "description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.", "author": { "name": "justcarlson" diff --git a/UPSTREAM.md b/UPSTREAM.md index 1e31fe0..eb9cab1 100644 --- a/UPSTREAM.md +++ b/UPSTREAM.md @@ -15,3 +15,4 @@ 2. When `t3dotgg/tstack` merges an upstream PR that a patch carries, drop the corresponding file from `patches/`, bump the pinned SHA above, and verify all skill tests and CI checks pass. 3. Preserve `Co-authored-by:` commit trailers and [NOTICE.md](NOTICE.md) rows for every redistributed community contribution. 4. Keep personal model rosters, fleet hostnames, and private URLs out of `skills/`; users put those in `AGENTS.md`, `CLAUDE.md`, or `~/.config/hindsight/sources.json`. +5. Local `jstack` patches with no upstream PR stay in `patches/` until upstream adopts equivalent behavior. diff --git a/patches/09-t3-thread-settle.patch b/patches/09-t3-thread-settle.patch new file mode 100644 index 0000000..28d4822 --- /dev/null +++ b/patches/09-t3-thread-settle.patch @@ -0,0 +1,61 @@ +Local jstack patch: T3 thread settle rules for full-send and full-stop. +Applies on top of 01..08; no upstream PR. + +diff --git a/skills/full-send/SKILL.md b/skills/full-send/SKILL.md +index cfee388..c31d454 100644 +--- a/skills/full-send/SKILL.md ++++ b/skills/full-send/SKILL.md +@@ -56,11 +56,12 @@ one appears. + 7. **Report** in your final message: the PR link, the merge commit, your proof, + and each decision you made for the user. + +-Stay active from step 1 to step 7. If you end your turn while checks or bots are +-pending, the work stops, because nobody will prompt you again. Wait with the +-watcher from `babysit-pr`, so something wakes you when the PR changes. In T3 +-Code that is `watch_pull_request`. If you stop before the merge, call +-`unwatch_pull_request` first. ++Stay active from step 1 to step 7. Ending a turn without a watcher stops the ++work. Wait with the watcher from `babysit-pr` (`watch_pull_request` in T3 Code). ++In T3 Code, once every owned PR merges with no open PR, blocker, question, or ++user pin left, settle this thread last (`t3_thread_organize`, `action: "settle"`, ++no `threadId`). Delegated children never settle. Before merge, call ++`unwatch_pull_request` and stay active. + + ## Proof + +@@ -107,8 +108,7 @@ it is waiting: `AskUserQuestion` in Claude Code, `request_user_input` in Codex, + or the question tool your harness has. Put all the context in the question: + the PR link, what blocks you, and the options with your recommendation first. + +-The user said "full send" because they do not want to be stopped. Every +-question breaks that. Ask only for these 4 cases, and nothing else: ++Every question breaks a full send. Ask only for these 4 cases: + + 1. Deleting data that cannot be regenerated. (Build output, caches and + targets can be regenerated: delete them yourself.) +@@ -130,10 +130,8 @@ Everything else has a default. Do it, and list it in the report: + - Finding outside this change: make it the next PR, not a question. + - One path is broken and another works: use the one that works. + +-Before you call the question tool, check: is it one of the 4 cases? If not, +-do not call it. Never send the same question twice. When one of the 4 cases +-comes up, ask early, all at once in one question, and keep working on +-everything else while you wait. ++Never call the question tool outside those 4 cases or send the same question ++twice. Ask early, all at once in one question, and keep working while you wait. + + If no question tool is available, or the tool returns no answer, take the safe + path: leave the PR open and unmerged, and start your final message with the +diff --git a/skills/full-stop/SKILL.md b/skills/full-stop/SKILL.md +index 9ea7737..20ce309 100644 +--- a/skills/full-stop/SKILL.md ++++ b/skills/full-stop/SKILL.md +@@ -42,6 +42,7 @@ without the user. If someone else merged it, report that instead. + - **Blocked:** explain what prevents readiness, what you tried, and what is + needed. Follow full-send's rules for asking the user. + +-In T3 Code, call `unwatch_pull_request` before the handoff or a question. ++In T3 Code, call `unwatch_pull_request` before the handoff or a question, and ++do not settle this thread: the user merges from it. + Report the PR link, final head, verdict, proof, reviewer outcome, and remaining + risks. State whether the PR is still open and unmerged. diff --git a/size-budget.json b/size-budget.json index 0dc6761..664004f 100644 --- a/size-budget.json +++ b/size-budget.json @@ -6,10 +6,10 @@ }, "grandfathered": { "epic": { - "body_bytes": 8588 + "body_bytes": 8475 }, "full-send": { - "body_bytes": 6459 + "body_bytes": 6376 }, "omarchy-dev": { "description_bytes": 380, diff --git a/skills/bug/SKILL.md b/skills/bug/SKILL.md index 3fa67d2..05cdeaf 100644 --- a/skills/bug/SKILL.md +++ b/skills/bug/SKILL.md @@ -97,5 +97,7 @@ The maintainer fix #37392 sets the bar for a PR we send upstream: - `gh` may be logged out inside an offline sandbox. - Outside a sandbox, `$TMPDIR` can point somewhere else. Use absolute paths for files that `gh` must read. -- Starting a real thread to test a workaround creates a thread and a - worktree. Archive the thread when you are done. +- Starting a real thread to test a workaround creates a separate thread and + worktree. Once its test turn finishes, archive that test thread by its + `threadId` (`t3_thread_organize`, `action: "archive"`). Never archive your + own thread. diff --git a/skills/epic/SKILL.md b/skills/epic/SKILL.md index 786f517..1230e96 100644 --- a/skills/epic/SKILL.md +++ b/skills/epic/SKILL.md @@ -81,14 +81,11 @@ Once confirmed: 1. The parent thread acts as **pure orchestrator**: launch waves, track worker state, resolve blockers, and own merge order. Keep direct feature edits out of the coordinator checkout during parallel fan-out. -2. When `ship epic` starts, read this thread's own id with `t3_thread_read` - (or check `t3_thread_list` if unknown) to see whether it is already pinned. - If it is not, pin it with `t3_thread_organize` (`action: "pin"`, omitting - `threadId`) so T3 does not auto-settle it while waves, post-merge checks, or - delegates are still running. Follow T3's PR linking and watching rules for - any PR the orchestrator creates, takes over, pushes to, or watches for - merge; do not link unrelated worker PRs that a standalone `t3_thread_launch` - thread owns and watches itself. +2. When `ship epic` starts, check `t3_thread_list` (`currentThreadId`, + `pinned`). If unpinned, pin it (`t3_thread_organize`, `action: "pin"`, no + `threadId`) so no T3 sweep settles it between waves or post-merge proof. + Follow T3's PR linking and watching rules for PRs the orchestrator owns; do + not link PRs a `t3_thread_launch` worker owns. 3. Run each non-overlapping issue in its own isolated worktree (using `delegate_task` with `isolation: "worktree"`, or `t3_thread_launch` per `t3-launch-worktrees` when top-level issue threads are requested). Use the @@ -134,9 +131,11 @@ Once confirmed: 1. Update the original **plan in place** with shipped status, PR links, production deploy URLs, live proof, decisions made, and any remaining manual step for the user. -2. If the epic added the pin in Stage 4, unpin this thread with - `t3_thread_organize` (`action: "unpin"`) once the epic ends (Stage 6 - completion, a hard blocker stop, or user abort). +2. On clean Stage 6 completion with no open PRs or user steps left, if Stage 4 + added the pin (keep any user pin), settle this thread last + (`t3_thread_organize`, `action: "settle"`, no `threadId`; it also unpins). + On a blocker, abort, or user step, do not settle; `unpin` only if Stage 4 + added the pin. 3. Send a brief, scannable report: lead with any blocker, link the updated plan and key PRs or deploys, confirm zero open PRs or issues remain (or list what stayed open and why), and end with one or two plain sentences on @@ -146,11 +145,11 @@ Once confirmed: - Do not treat `full send` as the epic confirmation trigger; `full-send` belongs to each deliverable PR. -- Do not run `ship epic` unpinned: T3's settle-on-merge sweep (once linked PRs - merge or close) and inactivity sweep auto-settle an unpinned thread, clearing - watches and cutting off post-merge proof or later waves (MCP does not yet - expose T3's per-thread auto-settle toggle, so pinning is the guard). On any - early stop or abort, unpin if the epic added the pin. +- Do not run `ship epic` unpinned: T3's merge, close, and inactivity sweeps + settle unpinned threads (closed PRs settle even with + `sidebarAutoSettleOnMerge: false`), clearing watches and cutting off waves. +- Settle only this thread (no `threadId`). Settling another thread acts at once, + even mid-run, clearing its pin, watches, and pending questions. - Do not merge overlapping PRs together; serialize merges across shared files and live deployments to preserve zero downtime. - Do not stop at "PR opened" while CI, deploys, or later waves are still active. diff --git a/skills/full-send/SKILL.md b/skills/full-send/SKILL.md index cfee388..c31d454 100644 --- a/skills/full-send/SKILL.md +++ b/skills/full-send/SKILL.md @@ -56,11 +56,12 @@ one appears. 7. **Report** in your final message: the PR link, the merge commit, your proof, and each decision you made for the user. -Stay active from step 1 to step 7. If you end your turn while checks or bots are -pending, the work stops, because nobody will prompt you again. Wait with the -watcher from `babysit-pr`, so something wakes you when the PR changes. In T3 -Code that is `watch_pull_request`. If you stop before the merge, call -`unwatch_pull_request` first. +Stay active from step 1 to step 7. Ending a turn without a watcher stops the +work. Wait with the watcher from `babysit-pr` (`watch_pull_request` in T3 Code). +In T3 Code, once every owned PR merges with no open PR, blocker, question, or +user pin left, settle this thread last (`t3_thread_organize`, `action: "settle"`, +no `threadId`). Delegated children never settle. Before merge, call +`unwatch_pull_request` and stay active. ## Proof @@ -107,8 +108,7 @@ it is waiting: `AskUserQuestion` in Claude Code, `request_user_input` in Codex, or the question tool your harness has. Put all the context in the question: the PR link, what blocks you, and the options with your recommendation first. -The user said "full send" because they do not want to be stopped. Every -question breaks that. Ask only for these 4 cases, and nothing else: +Every question breaks a full send. Ask only for these 4 cases: 1. Deleting data that cannot be regenerated. (Build output, caches and targets can be regenerated: delete them yourself.) @@ -130,10 +130,8 @@ Everything else has a default. Do it, and list it in the report: - Finding outside this change: make it the next PR, not a question. - One path is broken and another works: use the one that works. -Before you call the question tool, check: is it one of the 4 cases? If not, -do not call it. Never send the same question twice. When one of the 4 cases -comes up, ask early, all at once in one question, and keep working on -everything else while you wait. +Never call the question tool outside those 4 cases or send the same question +twice. Ask early, all at once in one question, and keep working while you wait. If no question tool is available, or the tool returns no answer, take the safe path: leave the PR open and unmerged, and start your final message with the diff --git a/skills/full-stop/SKILL.md b/skills/full-stop/SKILL.md index 9ea7737..20ce309 100644 --- a/skills/full-stop/SKILL.md +++ b/skills/full-stop/SKILL.md @@ -42,6 +42,7 @@ without the user. If someone else merged it, report that instead. - **Blocked:** explain what prevents readiness, what you tried, and what is needed. Follow full-send's rules for asking the user. -In T3 Code, call `unwatch_pull_request` before the handoff or a question. +In T3 Code, call `unwatch_pull_request` before the handoff or a question, and +do not settle this thread: the user merges from it. Report the PR link, final head, verdict, proof, reviewer outcome, and remaining risks. State whether the PR is still open and unmerged. diff --git a/tests/test_validate_skills.py b/tests/test_validate_skills.py index 4309a62..5912001 100644 --- a/tests/test_validate_skills.py +++ b/tests/test_validate_skills.py @@ -159,7 +159,7 @@ def test_manifest_version_mismatch(repo: Path): def test_manifests_share_version(): - assert set(vs.manifest_versions(ROOT).values()) == {"0.1.0"} + assert set(vs.manifest_versions(ROOT).values()) == {"0.2.0"} def test_pr_body_workflow_must_match(repo: Path): From 39826684729805f027623e41428a14228fe06280 Mon Sep 17 00:00:00 2001 From: Justin Carlson <40642470+justcarlson@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:49:15 -0500 Subject: [PATCH 2/2] fix(full-send): clarify pre-merge unwatch guard and pinned check --- patches/09-t3-thread-settle.patch | 31 ++++++++++++++++--------------- size-budget.json | 2 +- skills/full-send/SKILL.md | 7 ++++--- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/patches/09-t3-thread-settle.patch b/patches/09-t3-thread-settle.patch index 28d4822..c9fd9ac 100644 --- a/patches/09-t3-thread-settle.patch +++ b/patches/09-t3-thread-settle.patch @@ -1,11 +1,11 @@ -Local jstack patch: T3 thread settle rules for full-send and full-stop. -Applies on top of 01..08; no upstream PR. +Add explicit T3 Code thread-settle rules to full-send and full-stop +(local jstack patch, applies on top of patches/01..08; no upstream PR). -diff --git a/skills/full-send/SKILL.md b/skills/full-send/SKILL.md -index cfee388..c31d454 100644 ---- a/skills/full-send/SKILL.md -+++ b/skills/full-send/SKILL.md -@@ -56,11 +56,12 @@ one appears. +diff --git c/skills/full-send/SKILL.md w/skills/full-send/SKILL.md +index cfee388..341d102 100644 +--- c/skills/full-send/SKILL.md ++++ w/skills/full-send/SKILL.md +@@ -56,11 +56,13 @@ one appears. 7. **Report** in your final message: the PR link, the merge commit, your proof, and each decision you made for the user. @@ -17,13 +17,14 @@ index cfee388..c31d454 100644 +Stay active from step 1 to step 7. Ending a turn without a watcher stops the +work. Wait with the watcher from `babysit-pr` (`watch_pull_request` in T3 Code). +In T3 Code, once every owned PR merges with no open PR, blocker, question, or -+user pin left, settle this thread last (`t3_thread_organize`, `action: "settle"`, -+no `threadId`). Delegated children never settle. Before merge, call -+`unwatch_pull_request` and stay active. ++user pin left (check `t3_thread_list` for `pinned`), settle this thread last ++(`t3_thread_organize`, `action: "settle"`, no `threadId`). Delegated children ++never settle. If you stop before merge, call `unwatch_pull_request` and do not ++settle. ## Proof -@@ -107,8 +108,7 @@ it is waiting: `AskUserQuestion` in Claude Code, `request_user_input` in Codex, +@@ -107,8 +109,7 @@ it is waiting: `AskUserQuestion` in Claude Code, `request_user_input` in Codex, or the question tool your harness has. Put all the context in the question: the PR link, what blocks you, and the options with your recommendation first. @@ -33,7 +34,7 @@ index cfee388..c31d454 100644 1. Deleting data that cannot be regenerated. (Build output, caches and targets can be regenerated: delete them yourself.) -@@ -130,10 +130,8 @@ Everything else has a default. Do it, and list it in the report: +@@ -130,10 +131,8 @@ Everything else has a default. Do it, and list it in the report: - Finding outside this change: make it the next PR, not a question. - One path is broken and another works: use the one that works. @@ -46,10 +47,10 @@ index cfee388..c31d454 100644 If no question tool is available, or the tool returns no answer, take the safe path: leave the PR open and unmerged, and start your final message with the -diff --git a/skills/full-stop/SKILL.md b/skills/full-stop/SKILL.md +diff --git c/skills/full-stop/SKILL.md w/skills/full-stop/SKILL.md index 9ea7737..20ce309 100644 ---- a/skills/full-stop/SKILL.md -+++ b/skills/full-stop/SKILL.md +--- c/skills/full-stop/SKILL.md ++++ w/skills/full-stop/SKILL.md @@ -42,6 +42,7 @@ without the user. If someone else merged it, report that instead. - **Blocked:** explain what prevents readiness, what you tried, and what is needed. Follow full-send's rules for asking the user. diff --git a/size-budget.json b/size-budget.json index 664004f..b653016 100644 --- a/size-budget.json +++ b/size-budget.json @@ -9,7 +9,7 @@ "body_bytes": 8475 }, "full-send": { - "body_bytes": 6376 + "body_bytes": 6428 }, "omarchy-dev": { "description_bytes": 380, diff --git a/skills/full-send/SKILL.md b/skills/full-send/SKILL.md index c31d454..341d102 100644 --- a/skills/full-send/SKILL.md +++ b/skills/full-send/SKILL.md @@ -59,9 +59,10 @@ one appears. Stay active from step 1 to step 7. Ending a turn without a watcher stops the work. Wait with the watcher from `babysit-pr` (`watch_pull_request` in T3 Code). In T3 Code, once every owned PR merges with no open PR, blocker, question, or -user pin left, settle this thread last (`t3_thread_organize`, `action: "settle"`, -no `threadId`). Delegated children never settle. Before merge, call -`unwatch_pull_request` and stay active. +user pin left (check `t3_thread_list` for `pinned`), settle this thread last +(`t3_thread_organize`, `action: "settle"`, no `threadId`). Delegated children +never settle. If you stop before merge, call `unwatch_pull_request` and do not +settle. ## Proof