diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 78d347b..c638999 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.2.0", + "version": "0.2.1", "author": { "name": "justcarlson" }, diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index c12cdef..c81e803 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "jstack", "displayName": "jstack", - "version": "0.2.0", + "version": "0.2.1", "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 aa1647e..24146ce 100644 --- a/.codex-plugin/plugin.json +++ b/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "jstack", - "version": "0.2.0", + "version": "0.2.1", "description": "17 agent skills for shipping pull requests: patched t3dotgg/tstack core, the pr body standard, and companions.", "author": { "name": "justcarlson" diff --git a/patches/09-t3-thread-settle.patch b/patches/09-t3-thread-settle.patch index c9fd9ac..a5844fb 100644 --- a/patches/09-t3-thread-settle.patch +++ b/patches/09-t3-thread-settle.patch @@ -1,6 +1,20 @@ -Add explicit T3 Code thread-settle rules to full-send and full-stop +Add explicit T3 Code thread-settle rules to babysit-pr, full-send, and full-stop (local jstack patch, applies on top of patches/01..08; no upstream PR). +diff --git c/skills/babysit-pr/SKILL.md w/skills/babysit-pr/SKILL.md +index be160f1..e06c36f 100644 +--- c/skills/babysit-pr/SKILL.md ++++ w/skills/babysit-pr/SKILL.md +@@ -116,3 +116,9 @@ otherwise report that the PR is ready. Right before a merge, run `git fetch` and + check the PR again. Never merge when it is BEHIND or DIRTY, or when base commits + that landed after the last green run touch this PR's files. Rebase, push, and + wait for green again. ++ ++In T3 Code, once you merge every owned PR and no open PR, blocker, or pin ++remains (check `t3_thread_list` for `pinned`), settle this thread last ++(`t3_thread_organize`, `action: "settle"`, no `threadId`) unless a parent ++workflow such as `epic` owns this thread's settle; delegated children never ++settle. If you stop without merging, leave the thread unsettled. diff --git c/skills/full-send/SKILL.md w/skills/full-send/SKILL.md index cfee388..341d102 100644 --- c/skills/full-send/SKILL.md diff --git a/size-budget.json b/size-budget.json index b653016..12b7635 100644 --- a/size-budget.json +++ b/size-budget.json @@ -6,7 +6,7 @@ }, "grandfathered": { "epic": { - "body_bytes": 8475 + "body_bytes": 8326 }, "full-send": { "body_bytes": 6428 diff --git a/skills/babysit-pr/SKILL.md b/skills/babysit-pr/SKILL.md index be160f1..e06c36f 100644 --- a/skills/babysit-pr/SKILL.md +++ b/skills/babysit-pr/SKILL.md @@ -116,3 +116,9 @@ otherwise report that the PR is ready. Right before a merge, run `git fetch` and check the PR again. Never merge when it is BEHIND or DIRTY, or when base commits that landed after the last green run touch this PR's files. Rebase, push, and wait for green again. + +In T3 Code, once you merge every owned PR and no open PR, blocker, or pin +remains (check `t3_thread_list` for `pinned`), settle this thread last +(`t3_thread_organize`, `action: "settle"`, no `threadId`) unless a parent +workflow such as `epic` owns this thread's settle; delegated children never +settle. If you stop without merging, leave the thread unsettled. diff --git a/skills/epic/SKILL.md b/skills/epic/SKILL.md index 1230e96..35d1abd 100644 --- a/skills/epic/SKILL.md +++ b/skills/epic/SKILL.md @@ -5,76 +5,69 @@ description: Research, plan and ship ambitious multi-issue or multi-repo work en # Epic -Take an ambitious idea from bold research to a verified production rollout across -one or more repositories, with one clean human review stop at the plan. +Take an ambitious idea from bold research to verified production rollout across +one or more repos, with one human review stop at the plan. `epic` composes existing skills (`council`, `sol-loop`, `full-send`, `file-pr`, -`pr`, `babysit-pr`, `t3-launch-worktrees`, and a plan-publishing skill if you -have one) rather than replacing them. Use the models your `AGENTS.md` or -`CLAUDE.md` configures for delegates, with cross-family review and multi-model -`council` as `sol-loop` and `council` define. +`pr`, `babysit-pr`, `t3-launch-worktrees`, and any plan-publishing skill). Use +the models your `AGENTS.md` or `CLAUDE.md` configures, with cross-family review +and multi-model `council` per `sol-loop` and `council`. -"The plan" is a reviewable plan artifact: Tailplan/taildoc, Postplan, a Markdown -document, or a gist. Pick one and update it **in place** across revisions, so -the reader keeps one link. +"The plan" is a reviewable artifact (Tailplan/taildoc, Postplan, Markdown, or a +gist) updated **in place** across revisions so the reader keeps one link. ## Entry points -- **`epic `**: run Stages 1 and 2, publish one decision-ready plan, and - **stop for approval**. Do not file issues, edit repo code, or touch - production before the user confirms. -- **`ship epic`** (or `ship epic ` from a new thread, or a clear - go-ahead reply on an active `epic` plan thread): run Stages 3 to 6 - autonomously to live production and close with an updated plan. +- **`epic `**: run Stages 1–2, publish one decision-ready plan, and + **stop for approval**. Do not file issues, edit code, or touch production + before confirmation. +- **`ship epic`** (or `ship epic `, or a clear go-ahead on an active + `epic` thread): run Stages 3–6 autonomously to production and close with an + updated plan. -Do not use `full send` as the epic confirmation command. `full send` triggers a -single-PR `tstack` workflow; inside an epic, `full-send` runs per deliverable -issue, while `ship epic` starts the multi-issue orchestration. +Do not use `full send` as the epic trigger; `full-send` runs per deliverable +issue, while `ship epic` starts multi-issue orchestration. ## Stage 1: Bold, multi-model discovery Stay read-only. Understand the real system before proposing anything. -1. Audit live state first: current code, upstream repos and releases, prior - agent threads, and telemetry or log history when history matters (for - example, with the `hindsight` or `logs` skills when your repository uses - them). -2. Fan out read-only research or design delegates in parallel, using the models - your `AGENTS.md` or `CLAUDE.md` configures. Use the `council` when comparing - major architectures. Tell each delegate to stay read-only and start no - subagents. -3. Be bold: include high-leverage options not limited by today's wiring alongside - the simplest maintainable design. Stress-test the user's assumptions instead - of agreeing by reflex. +1. Audit live state first: code, upstream repos and releases, prior agent + threads, and telemetry or log history when relevant (e.g. `hindsight` or + `logs`). +2. Fan out read-only research or design delegates in parallel using configured + models. Use `council` to compare major architectures. Tell each delegate to + stay read-only and start no subagents. +3. Be bold: include high-leverage options beyond today's wiring alongside the + simplest maintainable design. Stress-test assumptions rather than agreeing. ## Stage 2: Decision-ready plan (stop here) -1. Publish the proposal as the plan artifact. When another model is driving, - delegate rich layout refinement to the model your instructions name for - design work. Keep a concise top verdict, charts or diagrams over dense - tables, deep technical specs inside collapsible sections, and a 390 px - mobile check. -2. Lead with the recommended design, the core primitives required, and an - explicit **Skip / Not Now** list. +1. Publish the proposal as the plan artifact. Delegate rich layout refinement + to the configured design model when another model drives. Keep a concise top + verdict, charts or diagrams over dense tables, deep specs in collapsible + sections, and a 390 px mobile check. +2. Lead with the recommended design, core primitives, and an explicit + **Skip / Not Now** list. 3. Keep architectural simplicity, zero-downtime cutover, and observability - (metadata-only unless asked) in scope by default. Do not punt them to a vague - later phase without a hard blocker. + (metadata-only unless asked) in scope by default; do not punt without a hard + blocker. 4. Ask only blocking architecture, cost, or account questions upfront, numbered - with recommended defaults so the user can reply with `defaults` or overrides. -5. Update the **same plan link in place** across any revision until the user - replies with `ship epic` (or an explicit go-ahead on the thread). + with recommended defaults so the user can reply `defaults` or override. +5. Update the **same plan link in place** across revisions until the user + replies `ship epic` (or an explicit go-ahead). ## Stage 3: Issue decomposition into waves Once confirmed: -1. File clear GitHub issues across every touched repository before editing code. -2. Group issues into **non-overlapping parallel waves** by repository and file - scope. Explicitly mark shared-file dependencies so dependent waves start - only after their prerequisite merges and deploys cleanly to `main`. -3. Include every cross-repo touchpoint in the wave plan: telemetry or logging - changes, upstream upgrade compatibility, public mirror syncs, rollouts to - each target host or deployment environment, and docs. +1. File clear GitHub issues across every touched repo before editing code. +2. Group issues into **non-overlapping parallel waves** by repo and file scope. + Mark shared-file dependencies so dependent waves start only after their + prerequisite merges and deploys cleanly to `main`. +3. Include every cross-repo touchpoint: telemetry or logging, upstream upgrade + compatibility, public mirror syncs, rollouts to each target host or + environment, and docs. ## Stage 4: Orchestrate isolated `tstack` worktrees @@ -86,14 +79,13 @@ Once confirmed: `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 - default worker model your `AGENTS.md` or `CLAUDE.md` configures, and a - stronger design model when the user asks or the issue is design-heavy. -4. Give each worker an explicit file scope, issue link, proof requirements, and - the rule that the orchestrator owns final merge order when waves depend on - each other. +3. Run each non-overlapping issue in its own worktree: use `delegate_task` + (`isolation: "worktree"`) so workers stay out of the top-level sidebar, or + `t3_thread_launch` (`t3-launch-worktrees`) only when top-level issue threads + are requested. Use the configured default worker model, or a stronger design + model when the user asks or the issue is design-heavy. +4. Give each worker an explicit file scope, issue link, proof bar, and the rule + that the orchestrator owns final merge order when waves depend on each other. 5. Every deliverable PR follows `tstack`: - `full-send` execution per deliverable (implement, prove, review, file PR, babysit CI and bot findings). @@ -113,33 +105,36 @@ Once confirmed: 1. Merge **one PR or non-overlapping wave at a time**, owned by the orchestrator, only after required CI checks, preview deploys, and automated - reviews pass. + reviews pass. After merging a PR from a `t3_thread_launch` worker you + launched, check `t3_thread_read`: if `status` is not `running`/`preparing`/ + `starting`/`queued`, `pinned` is `false`, `openPullRequestCount` and + `pendingRequestCount` are `0`, and `pendingBackgroundTasks` is empty, settle + it (`t3_thread_organize`, `action: "settle"`, `threadId`). 2. Wait for production deploy health before rebasing and launching dependent waves. 3. Protect uptime: additive-first migrations, backwards-compatible cutovers, and rollback or dead-man guards for infra or network changes. Clean up after - merge: prune stale deployment snapshots if storage constrains deploys, remove - temporary worktrees, and fast-forward local `main`. -4. Prove every deliverable live before calling it done: live production health, - real tool or UI execution, telemetry rows arriving when telemetry changed, - screenshots attached to the PR, and drift checks (`--check` or equivalent) - clean across every target host or deployment environment that is online. - Green unit tests or mocks alone do not close an epic. + merge: prune stale deploy snapshots if storage is tight, remove temporary + worktrees, and fast-forward local `main`. +4. Prove every deliverable live before calling it done: production health, real + tool or UI execution, telemetry rows arriving when telemetry changed, PR + screenshots, and clean drift checks (`--check` or equivalent) across online + targets. Green unit tests or mocks alone do not close an epic. ## Stage 6: Close the loop -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. 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 - what is live and what, if anything, still needs the user. +1. Update the original **plan in place** with shipped status, PR links, deploy + URLs, live proof, decisions made, and any remaining manual user step. +2. Settle any remaining `t3_thread_launch` workers you launched whose PRs + merged (passing the Stage 5 `t3_thread_read` check). On clean Stage 6 + completion with no open PRs or user steps left, settle this thread last if + Stage 4 added the pin (keep any user pin; `t3_thread_organize`, + `action: "settle"`, no `threadId`). On a blocker, abort, or user step, do + not settle this thread; `unpin` only if Stage 4 added the pin. +3. Send a brief 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 what is live and + what, if anything, still needs the user. ## Traps @@ -148,12 +143,13 @@ Once confirmed: - 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. +- Never settle another thread blindly: settling by `threadId` acts at once, + even mid-run, clearing pins, watches, and pending questions. Settle only + `t3_thread_launch` workers you launched whose PRs merged, after the Stage 5 + `t3_thread_read` check passes. - Do not merge overlapping PRs together; serialize merges across shared files - and live deployments to preserve zero downtime. + and live deploys to preserve zero downtime. - Do not stop at "PR opened" while CI, deploys, or later waves are still active. -- When running behind a chat bridge (such as `t3-slack`), the chat posts only - the final text of the turn that answers a user message. If orchestration - continues in background turns, state what is running and what finishes next - before ending the turn. +- Behind a chat bridge (such as `t3-slack`), chat posts only the final text of + the turn answering a user message. If background turns continue, state what + is running and what finishes next before ending the turn. diff --git a/skills/t3-launch-worktrees/SKILL.md b/skills/t3-launch-worktrees/SKILL.md index 0a63f1b..7ddfc0b 100644 --- a/skills/t3-launch-worktrees/SKILL.md +++ b/skills/t3-launch-worktrees/SKILL.md @@ -17,3 +17,4 @@ Use current T3 schemas and routing rules. Use `t3_thread_launch` only for a user 4. Launch, then use `t3_thread_read` to verify project, branch, worktree path, and run state. 5. After an error or lost reply, read the known thread or find recent matches with `t3_thread_list` on that server and project. A failed launch may still create a thread. Retry the same launch with the same request ID. If recovery remains uncertain, report the blocker instead of creating another thread. 6. Follow `t3_thread_wait` instructions to the stopping point, then read the result. Obey returned `next`; end the turn when instructed. Report the returned `link` verbatim and verified outcome or blocker. Launch success is not task completion. +7. If this agent launched a worker thread (`createdBy: "agent"`) for orchestrated work — unless the launch request asked it to stay open — and later merges its PR or closes out its handoff with no user step left, check `t3_thread_read`: once `status` is not `running`/`preparing`/`starting`/`queued`, `pinned` is `false`, `openPullRequestCount` and `pendingRequestCount` are `0`, and `pendingBackgroundTasks` is empty, settle it (`t3_thread_organize`, `action: "settle"`, `threadId`). diff --git a/tests/test_validate_skills.py b/tests/test_validate_skills.py index 5912001..0e107e6 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.2.0"} + assert set(vs.manifest_versions(ROOT).values()) == {"0.2.1"} def test_pr_body_workflow_must_match(repo: Path):