Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.17.2",
"version": "0.17.3",
"author": {
"name": "Lauren Tan (pstack), pmwoz (T3 Code port)"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "t3-pstack",
"version": "0.17.2",
"version": "0.17.3",
"private": true,
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion pins.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"t3": {
"repo": "pingdotgg/t3code",
"commit": "59651c1761f6c63e9b6056839067066968e6a406",
"commit": "9f9ebf61fbdb63df16ce6785283af6f0b38d690a",
"paths": [
"apps/server/src/mcp/McpToolExposure.ts",
"apps/server/src/mcp/toolkits/attachment/tools.ts",
Expand Down
2 changes: 1 addition & 1 deletion plugins/pstack/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pstack",
"displayName": "pstack",
"version": "0.17.2",
"version": "0.17.3",
"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)"
Expand Down
2 changes: 1 addition & 1 deletion plugins/pstack/.codex-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pstack",
"version": "0.17.2",
"version": "0.17.3",
"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)"
Expand Down
4 changes: 2 additions & 2 deletions plugins/pstack/skills/poteto-mode/references/t3-adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ T3 has no cloud agents. Every lane is a `delegate_task` child on this machine or
- **PR tools.** T3 lists the `pull_request_*` tools, `ci_logs`, and `ci_rerun` when it can reach the thread's forge, to delegated children too. When they are listed, use them, not `gh` or `origin`, wherever a playbook reads, lists, opens, edits, reviews, replies on, closes, or merges a PR, or reads or re-runs its checks. Without them, the playbooks' forge commands apply. `pull_request_update` cannot change a PR's base, so Shipping's retarget to trunk stays on `gh pr edit --base` or `origin pr edit --base`.
- **Shipping verdicts.** A verifier posts its verdict with `pull_request_review` and `verdict: "comment"`. The `body` holds `PASS`, `PASS+NOTES`, or `FAIL` and the head SHA it ran, and each finding with a file and line goes in `comments`. It never sends `approve` or `request-changes`, because T3 agents act as the user's forge account and a verdict is not a forge approval.
- **Landing (Shipping step 4).** Merge with `pull_request_merge`, `method: "squash"`, and `expectedHeadSha` set to the full head SHA the verdict covers, so T3 refuses a head that moved. When the run is layers of a native GitHub stack (`stack.kind` is `native` in `list_thread_pull_requests`), land it with one call on the ceiling with `stack: true`, in place of one merge per PR. T3 pins each lower layer to its current head, not to its verdict, so run step 3's check on every layer first. A derived stack merges one PR at a time. Arm auto-merge with `auto: true` under step 4's rule, never with `stack`. A result `state` of `open` means auto-merge or a merge queue holds the PR. Read each PR back with `pull_request_read`. A landed PR reads `merged` with trunk as `baseBranch`.
- **Babysit threads and CI.** Read review threads with `pull_request_read` and `sections: ["conversation"]`, and page with `cursor` until `nextCursor` is null. Reply with `pull_request_respond` and the thread's `reviewThreadId`. Set `resolved: true` on a bot's thread once the reply cites the fixing commit or a disproof. Leave escalated threads and human reviewers' threads open. Read a failing check with `ci_logs`, and spend a flake's one fresh build as `ci_rerun` with that `check`.
- **Opening a PR.** `pull_request_create` is the run's PR tool. Push the branch, then call it with `draft: false`, and with `base` for a stacked layer. It opens the PR from the calling thread's pushed branch and links it to that thread. Without it, create the PR with the resolved forge (`gh` or `origin`), ready for review, never draft. The root links every PR, each stack layer included, with `link_pull_request` for one PR or `link_pull_requests` for several in one call. A child that opens a PR returns its URL and head SHA, and the root links it.
- **Babysit threads and CI.** Read review threads with `pull_request_read` and `include: ["threads"]`, and page with `cursor` until `nextCursor` is null. Reply with `pull_request_respond` and the thread's `reviewThreadId`. Set `resolved: true` on a bot's thread once the reply cites the fixing commit or a disproof. Leave escalated threads and human reviewers' threads open. Read a failing check with `ci_logs`, and spend a flake's one fresh build as `ci_rerun` with that `check`.
- **Opening a PR.** `pull_request_create` is the run's PR tool. Call it with `draft: false`, and with `base` for a stacked layer. It pushes the calling thread's branch when the remote lacks commits, opens the PR, and links it to that thread. Without it, create the PR with the resolved forge (`gh` or `origin`), ready for review, never draft. The root links every PR, each stack layer included, with `link_pull_request` for one PR or `link_pull_requests` for several in one call. A child that opens a PR returns its URL and head SHA, and the root links it.
- **Linking issues.** The root links every issue the run works on or files, such as the tracker issue in benny's reproduce automation, with `link_issue`, so T3 shows it beside the thread. A child that works on or files an issue returns its URL, and the root links it.
- **A merged dependency PR can end the run.** T3 settles a thread at a turn end once every PR linked to it has merged. Settling ends the session and kills its background commands, such as a push through a pre-push gate. A run that merges a dependency PR in another repo before it opens its own PR is exposed. Open and link the run's own PR before the dependency PR merges. If the dependency merged first, unlink it before you end a turn that still waits on work. Call `unlink_pull_requests` with `states: ["merged"]`, then `unlink_pull_request` on any merged dependency missing from its `unlinked` list, because the call trusts T3's last known state. Link them again after the run's own PR is linked.
- **Review guides.** When the root hands PRs to the user for review or merge, it reads each with `read_pull_request_guide`. Then it calls `write_pull_request_guides` once for every PR whose guide is missing or `stale`. A run takes minutes, so do not wait for it. The user reads the guide in the PR's Guide tab. Pass each PR as `repository` and `number`, because the `url` form can fail to find the project's checkout. A PR whose outcome is `failed`, for example because guides are off in T3's Source Control settings, gets no guide. Give its `detail` in the reply and go on.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const WorkflowStopTool = Tool.make("t3_workflow_stop", {

const BackgroundWaitTool = Tool.make("t3_background_wait", {
description:
"Keep this thread in Working while background work runs. Pass its task ID once started. Not for work left running (dev server, watcher). `waiting=false` clears. Doesn't stop tasks. Claude/OpenCode only.",
"Keep this thread in Working while background work runs. Pass its task ID once started. Not for work left running (dev server, watcher). `waiting=false` clears. Doesn't stop tasks.",
parameters: Schema.Struct({
taskIds: Schema.Array(TrimmedNonEmptyString).check(
Schema.isMinLength(1),
Expand All @@ -165,7 +165,7 @@ const BackgroundWaitTool = Tool.make("t3_background_wait", {
// Only marks which tasks keep the thread Working; Claude Plan mode blocks tools without this.
.annotate(Tool.Readonly, true)
.annotate(Tool.Destructive, false)
.annotate(McpSchema.EnabledWhen, McpInvocationContext.hiddenFromOutsideClients);
.annotate(McpSchema.EnabledWhen, McpInvocationContext.hiddenWithoutBackgroundWait);

const ScheduleTaskTool = Tool.make("schedule_task", {
description:
Expand Down Expand Up @@ -208,7 +208,7 @@ const DeleteScheduledTaskTool = Tool.make("delete_scheduled_task", {

const RequestSecretTool = Tool.make("request_secret", {
description:
'Ask for one secret per single-line card; never combine values. Open it, don\'t offer it. Returns one-use `secretRef`, or `delivery: "file"` a file read only in its command, e.g. `adb pair <ip:port> "$(cat <file>)"`. Asked how: call now. Sign-in link: `url`. Pasted secret for child/script: `value`. Never from an old thread.',
'Ask for secrets in a private card, one value per single-line input; never combine values in one. Open it, don\'t offer it. Returns one-use `secretRef`, or `delivery: "file"` a file read only in its command, e.g. `adb pair <ip:port> "$(cat <file>)"`. Asked how: call now. Sign-in link: `url`. Pasted secret for child/script: `value`. Never from an old thread.',
parameters: OrchestratorMcpRequestSecretInput,
success: OrchestratorMcpRequestSecretResult,
failure: OrchestratorMcpFailure,
Expand Down
8 changes: 7 additions & 1 deletion t3/contract/apps/server/src/mcp/toolkits/project/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const ProjectCloneTool = Tool.make("t3_project_clone", {
const ThreadLaunchTool = Tool.make("t3_thread_launch", {
...shared,
description:
"Create one new top-level thread, bound to its workspace before the agent starts. Task in `message`. Omit `projectId`, model and modes to inherit yours (outside a thread, pass `projectId` or `scratch`); modes cannot exceed yours. After an error or lost reply, retry with the same `clientRequestId`. Follow it with `t3_thread_read` or `t3_thread_wait`. Mention it with its `link`.",
"Create a top-level thread in its workspace before starting. Task in `message`. Omit `projectId`, model and modes to inherit yours (outside a thread, pass `projectId` or `scratch`); modes cannot exceed yours. On error or lost reply, reuse `clientRequestId`. Follow it with `t3_thread_read` or `t3_thread_wait`. Mention it with its `link`.",
parameters: Schema.Struct({
environmentId: OrchestratorMcpEnvironmentTarget,
projectId: Schema.optional(ProjectId),
Expand All @@ -141,6 +141,7 @@ const ThreadLaunchTool = Tool.make("t3_thread_launch", {
}),
),
title: TrimmedNonEmptyString,
generateTitle: Schema.optional(Schema.Boolean),
modelSelection: Schema.optional(ModelSelection),
runtimeMode: Schema.optional(RuntimeMode),
interactionMode: Schema.optional(ProviderInteractionMode),
Expand All @@ -156,6 +157,11 @@ const ThreadLaunchTool = Tool.make("t3_thread_launch", {
}),
),
attachments: Schema.optional(Schema.Array(McpAttachmentInput).check(Schema.isMaxLength(8))),
outputSchema: Schema.optional(
Schema.Record(Schema.String, Schema.Json).annotate({
description: "As in `t3_thread_send`. Needs `message`.",
}),
),
clientRequestId: Schema.optional(OrchestratorMcpClientRequestId),
/** Set by a linked environment launching its agent's delegated task here; ignored otherwise. */
delegatedFrom: Schema.optional(OrchestrationV2DelegatedFrom),
Expand Down
117 changes: 66 additions & 51 deletions t3/contract/apps/server/src/mcp/toolkits/pullRequests/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export const PullRequestToolError = Schema.Union([
PullRequestListFailedError,
PullRequestWatchService.PullRequestWatchFailedError,
PullRequestUnavailableError,
PullRequestWatchService.PullRequestNotOpenError,
PullRequestWatchService.PullRequestWatchFromSubagentError,
PullRequestProjectNotFoundError,
PullRequestGuideFailedError,
Expand Down Expand Up @@ -258,9 +257,18 @@ export const WatchPullRequestResult = Schema.Struct({
...PullRequestIdentity,
watching: Schema.Boolean,
wasWatching: Schema.Boolean,
state: Schema.optional(
Schema.Literals(["merged", "closed"]).annotate({
description: "The PR already ended, so nothing was watched.",
}),
),
next: Schema.optional(Schema.String),
});
export type WatchPullRequestResult = typeof WatchPullRequestResult.Type;

export const alreadyEndedWatchNext = (state: "merged" | "closed") =>
`This PR is already ${state}, so there is nothing to watch. Report that and end your turn.`;

export const ThreadPullRequestEntry = Schema.Struct({
...PullRequestIdentity,
source: ThreadPullRequestLinkSource,
Expand Down Expand Up @@ -383,14 +391,14 @@ const WatchPullRequestInput = Schema.Struct({
until: Schema.optional(
PullRequestWatchUntil.annotate({
description:
'How long this thread stays working. Omit it to keep the current value; a new watch starts at "checks". "checks": until checks finish, for a PR you hand to the user. "merged": until it merges or closes or you unwatch it, when you will act on it yourself, such as merging after someone else approves.',
'How long this thread stays working. Omit to keep the current value; a new watch starts at "checks". "checks": until checks finish, for a PR you hand to the user. "merged": until it merges, closes or is unwatched, when you act on it yourself, such as merging after approval.',
}),
),
});

const WatchPullRequestTool = Tool.make("watch_pull_request", {
description:
"Watch an open PR for this thread, linking it first if needed. T3 wakes you on failed checks, passed required checks, new comments or reviews, or conflicts. Handle old comments first. Only later ones wake you. After this call, end your turn. The watch stays on after each wake, so do not call this again on a wake. A wake is not a merge decision. Check readiness yourself.",
"Watch an open PR for this thread, linking it if needed. T3 wakes you on failed checks, passed required checks, new comments or reviews, conflicts, and once on merge or close unless you did it via CLI. Handle old comments first; only new ones wake you. After this call, end your turn. The watch stays on: do not call this again on a wake. A wake is not a merge decision. Check readiness yourself.",
parameters: WatchPullRequestInput,
success: WatchPullRequestResult,
failure: PullRequestToolError,
Expand Down Expand Up @@ -490,9 +498,10 @@ export const ThreadPullRequestInput = Schema.Struct({
export type ThreadPullRequestInput = typeof ThreadPullRequestInput.Type;

export const PullRequestReadSection = Schema.Literals([
"summary",
"body",
"checks",
"conversation",
"threads",
"comments",
"diff",
]);
export type PullRequestReadSection = typeof PullRequestReadSection.Type;
Expand All @@ -505,50 +514,56 @@ const ReadComment = Schema.Struct({

export const ReadPullRequestResult = Schema.Struct({
...PullRequestIdentity,
summary: Schema.optional(
Schema.Struct({
title: Schema.String,
body: Schema.String,
state: PullRequestState,
isDraft: Schema.Boolean,
author: Schema.NullOr(Schema.String),
headBranch: Schema.String,
baseBranch: Schema.String,
headSha: Schema.NullOr(Schema.String),
mergeability: PullRequestMergeability,
behindBy: Schema.NullOr(Schema.Int),
autoMergeEnabled: Schema.NullOr(Schema.Boolean),
additions: Schema.Int,
deletions: Schema.Int,
changedFiles: Schema.Int,
labels: Schema.Array(Schema.String),
reviewers: Schema.Array(Schema.String),
title: Schema.String,
state: PullRequestState,
isDraft: Schema.Boolean,
author: Schema.NullOr(Schema.String),
headBranch: Schema.String,
baseBranch: Schema.String,
headSha: Schema.NullOr(Schema.String),
mergeability: PullRequestMergeability,
behindBy: Schema.NullOr(Schema.Int),
autoMergeEnabled: Schema.NullOr(Schema.Boolean),
checks: Schema.Struct({
passed: Schema.Int,
pending: Schema.Int,
failed: Schema.Array(Schema.String),
incomplete: Schema.optional(Schema.Literal(true)).annotate({
description: "The host could not list some checks; checkRuns says which.",
}),
),
checks: Schema.optional(Schema.Array(PullRequestCheck)),
}),
unresolvedThreads: Schema.Int,
unresolvedThreadsTruncated: Schema.optional(Schema.Literal(true)).annotate({
description: "unresolvedThreads is a lower bound.",
}),
body: Schema.optional(Schema.String),
checkRuns: Schema.optional(Schema.Array(PullRequestCheck)),
conversation: Schema.optional(
Schema.Struct({
comments: Schema.Array(
Schema.Struct({
...ReadComment.fields,
id: Schema.String,
kind: PullRequestCommentKind,
path: Schema.NullOr(Schema.String),
reviewState: Schema.NullOr(Schema.String),
}),
reviewThreads: Schema.optional(
Schema.Array(
Schema.Struct({
id: Schema.String,
path: Schema.String,
line: Schema.NullOr(Schema.Int),
isResolved: Schema.Boolean,
isOutdated: Schema.Boolean,
comments: Schema.Array(ReadComment),
moreComments: Schema.Boolean,
}),
),
),
reviewThreads: Schema.Array(
Schema.Struct({
id: Schema.String,
path: Schema.String,
line: Schema.NullOr(Schema.Int),
isResolved: Schema.Boolean,
isOutdated: Schema.Boolean,
comments: Schema.Array(ReadComment),
moreComments: Schema.Boolean,
}),
comments: Schema.optional(
Schema.Array(
Schema.Struct({
...ReadComment.fields,
id: Schema.String,
kind: PullRequestCommentKind,
path: Schema.NullOr(Schema.String),
reviewState: Schema.NullOr(Schema.String),
}),
),
),
hiddenResolvedThreads: Schema.Int,
truncated: Schema.Boolean,
nextCursor: Schema.NullOr(Schema.String),
}),
Expand Down Expand Up @@ -609,12 +624,12 @@ export const MergePullRequestResult = Schema.Struct({
export type MergePullRequestResult = typeof MergePullRequestResult.Type;

const ReadPullRequestTool = Tool.make("pull_request_read", {
description: "Read a PR's state, checks, review comments, or diff. Use instead of gh or cafe.",
description: "Read a PR's state and check counts. `include` adds detail.",
parameters: Schema.Struct({
...ThreadPullRequestInput.fields,
sections: Schema.optional(
include: Schema.optional(
Schema.Array(PullRequestReadSection).annotate({
description: "Default: summary, checks. conversation has review threads.",
description: "threads: unresolved review threads.",
}),
),
includeResolved: Schema.optional(Schema.Boolean),
Expand Down Expand Up @@ -653,7 +668,7 @@ const ListPullRequestsTool = Tool.make("pull_request_list", {
.annotate(McpSchema.EnabledWhen, McpInvocationContext.hiddenWithoutForge);

const CreatePullRequestTool = Tool.make("pull_request_create", {
description: "Open a PR from this thread's pushed branch and link it, or return its open PR.",
description: "Push this thread's branch, then open its PR and link it, or return its open PR.",
parameters: Schema.Struct({
environmentId: OrchestratorMcpEnvironmentTarget,
title: TrimmedNonEmptyString,
Expand Down Expand Up @@ -757,7 +772,8 @@ const ReviewPullRequestTool = Tool.make("pull_request_review", {
.annotate(McpSchema.EnabledWhen, McpInvocationContext.hiddenWithoutForge);

const MergePullRequestTool = Tool.make("pull_request_merge", {
description: "Merge a PR. Refuses if the head moved from expectedHeadSha (summary.headSha).",
description:
"Merge a PR. Refuses if the head moved from expectedHeadSha (headSha in pull_request_read).",
parameters: Schema.Struct({
...ThreadPullRequestInput.fields,
expectedHeadSha: TrimmedNonEmptyString,
Expand Down Expand Up @@ -811,8 +827,7 @@ export const RerunChecksResult = Schema.Struct({
export type RerunChecksResult = typeof RerunChecksResult.Type;

const CheckLogsTool = Tool.make("ci_logs", {
description:
"Read the tail of a PR's failing check logs, or one named check's. Use instead of gh run view.",
description: "Read the tail of a PR's failing check logs, or one named check's.",
parameters: Schema.Struct({
...ThreadPullRequestInput.fields,
check: Schema.optional(TrimmedNonEmptyString),
Expand Down
Loading
Loading