Skip to content

Commit af78cb4

Browse files
feat(pstack): bundle the native pstack-t3code port (#26)
* build(pstack): sync from the native T3 Code port Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(pstack): vendor pstack-t3code 0.15.32-t3code.1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(pstack): load native skills without a harness adapter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(pstack): describe the native pack and custom skills Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(server): stop bundling the removed pstack adapter Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e9881ce commit af78cb4

114 files changed

Lines changed: 1244 additions & 1776 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/server/scripts/cli.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const buildCmd = Command.make(
9797
const pstackSource = path.join(repoRoot, "packages/pstack");
9898
const pstackTarget = path.join(serverDir, "dist/pstack");
9999
yield* fs.makeDirectory(pstackTarget, { recursive: true });
100-
for (const entry of ["upstream", "t3-code.md", "UPSTREAM.json"]) {
100+
for (const entry of ["upstream", "UPSTREAM.json"]) {
101101
yield* fs.copy(path.join(pstackSource, entry), path.join(pstackTarget, entry));
102102
}
103103
yield* Effect.log("[cli] Bundled pstack into dist/pstack");

‎apps/server/src/pstack/PstackPack.test.ts‎

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import * as PstackPack from "./PstackPack.ts";
1414
import * as ServerSettings from "../serverSettings.ts";
1515
import { ProjectId, ProviderInstanceId, type ServerProvider } from "@t3tools/contracts";
1616
import { claudeProvider, makeFixture } from "./PstackPack.testkit.ts";
17-
import { BUILT_IN_DRIVERS } from "../provider/builtInDrivers.ts";
1817

1918
it.layer(NodeServices.layer)("PstackPack", (it) => {
2019
it.effect("resolves the development source beside the monorepo packages", () =>
@@ -76,6 +75,7 @@ it.layer(NodeServices.layer)("PstackPack", (it) => {
7675
assert.lengthOf(catalog!, 2);
7776
const packDir = `${fixture.stateDir}/pstack/pack`;
7877
assert.isFalse(yield* fs.exists(`${packDir}/.gitignore`));
78+
assert.isFalse(yield* fs.exists(`${packDir}/docs/harness/t3-code.md`));
7979
assert.equal(
8080
yield* fs.readFileString(`${packDir}/skills/poteto-mode/scripts/bun.lock`),
8181
"lockfile\n",
@@ -114,17 +114,25 @@ it.layer(NodeServices.layer)("PstackPack", (it) => {
114114
return `${fixture.stateDir}/pstack/pack`;
115115
}).pipe(Effect.provide(fixture.layer));
116116
assert.equal(first, second);
117-
yield* fs.writeFileString(`${fixture.sourceRoot}/t3-code.md`, "Changed adapter");
117+
yield* fs.makeDirectory(`${first}/docs/harness`, { recursive: true });
118+
yield* fs.writeFileString(`${first}/docs/harness/t3-code.md`, "Legacy adapter");
119+
yield* fs.writeFileString(
120+
`${fixture.sourceRoot}/upstream/scripts/helper.sh`,
121+
"Changed helper",
122+
);
123+
const manifest = yield* fs.readFileString(`${fixture.sourceRoot}/UPSTREAM.json`);
124+
yield* fs.writeFileString(
125+
`${fixture.sourceRoot}/UPSTREAM.json`,
126+
manifest.replace("b".repeat(40), "d".repeat(40)),
127+
);
118128
const changed = yield* Effect.gen(function* () {
119129
yield* (yield* PstackPack.PstackPack).catalog;
120130
return `${fixture.stateDir}/pstack/pack`;
121131
}).pipe(Effect.provide(fixture.layer));
122132
assert.equal(changed, first);
123133
assert.equal(changed, `${fixture.stateDir}/pstack/pack`);
124-
assert.equal(
125-
yield* fs.readFileString(`${changed}/docs/harness/t3-code.md`),
126-
"Changed adapter",
127-
);
134+
assert.equal(yield* fs.readFileString(`${changed}/scripts/helper.sh`), "Changed helper");
135+
assert.isFalse(yield* fs.exists(`${changed}/docs/harness/t3-code.md`));
128136
}),
129137
);
130138
it.effect("materializes archive-backed bytes with manifest executable flags", () =>
@@ -157,7 +165,7 @@ it.layer(NodeServices.layer)("PstackPack", (it) => {
157165
yield* Effect.gen(function* () {
158166
const pack = yield* PstackPack.PstackPack;
159167
const first = yield* pack.catalog;
160-
yield* fs.remove(`${fixture.sourceRoot}/t3-code.md`);
168+
yield* fs.remove(`${fixture.sourceRoot}/UPSTREAM.json`);
161169
assert.deepEqual(yield* pack.catalog, first);
162170
assert.lengthOf((yield* pack.catalog)!, 2);
163171
}).pipe(Effect.provide(fixture.layer));
@@ -307,12 +315,12 @@ it.layer(NodeServices.layer)("PstackPack", (it) => {
307315
Effect.gen(function* () {
308316
const fixture = yield* makeFixture();
309317
const fs = yield* FileSystem.FileSystem;
310-
const adapter = yield* fs.readFileString(`${fixture.sourceRoot}/t3-code.md`);
311-
yield* fs.remove(`${fixture.sourceRoot}/t3-code.md`);
318+
const manifest = yield* fs.readFileString(`${fixture.sourceRoot}/UPSTREAM.json`);
319+
yield* fs.remove(`${fixture.sourceRoot}/UPSTREAM.json`);
312320
yield* Effect.gen(function* () {
313321
const pack = yield* PstackPack.PstackPack;
314322
assert.equal(yield* pack.catalog, undefined);
315-
yield* fs.writeFileString(`${fixture.sourceRoot}/t3-code.md`, adapter);
323+
yield* fs.writeFileString(`${fixture.sourceRoot}/UPSTREAM.json`, manifest);
316324
assert.lengthOf((yield* pack.catalog)!, 2);
317325
}).pipe(Effect.provide(fixture.layer));
318326
}),
@@ -571,16 +579,24 @@ it.layer(NodeServices.layer)("PstackPack", (it) => {
571579
assert.lengthOf((yield* read.pipe(Effect.provide(fixture.layer)))!, 2);
572580
const packDir = `${fixture.stateDir}/pstack/pack`;
573581
const oldStamp = yield* fs.readFileString(`${packDir}/.t3-pstack-hash`);
574-
yield* fs.writeFileString(`${fixture.sourceRoot}/t3-code.md`, "Next version");
582+
yield* fs.writeFileString(
583+
`${fixture.sourceRoot}/upstream/scripts/helper.sh`,
584+
"Next version",
585+
);
586+
const manifest = yield* fs.readFileString(`${fixture.sourceRoot}/UPSTREAM.json`);
587+
yield* fs.writeFileString(
588+
`${fixture.sourceRoot}/UPSTREAM.json`,
589+
manifest.replace("b".repeat(40), "d".repeat(40)),
590+
);
575591
let blocked = true;
576592
const result = yield* Effect.gen(function* () {
577593
const pack = yield* PstackPack.PstackPack;
578594
const stale = yield* pack.catalog;
579595
assert.lengthOf(stale!, 2);
580596
assert.equal(yield* fs.readFileString(`${packDir}/.t3-pstack-hash`), oldStamp);
581597
assert.equal(
582-
yield* fs.readFileString(`${packDir}/docs/harness/t3-code.md`),
583-
"# T3 harness",
598+
yield* fs.readFileString(`${packDir}/scripts/helper.sh`),
599+
"#!/bin/sh\nexit 0\n",
584600
);
585601
blocked = false;
586602
const fresh = yield* pack.catalog;
@@ -614,26 +630,8 @@ it.layer(NodeServices.layer)("PstackPack", (it) => {
614630
yield* fs.readFileString(`${packDir}/.t3-pstack-hash`),
615631
pstackContentHash(fixture.sourceRoot),
616632
);
617-
assert.equal(
618-
yield* fs.readFileString(`${packDir}/docs/harness/t3-code.md`),
619-
"Next version",
620-
);
633+
assert.equal(yield* fs.readFileString(`${packDir}/scripts/helper.sh`), "Next version");
621634
assert.deepEqual(yield* fs.readDirectory(`${fixture.stateDir}/pstack`), ["pack"]);
622635
}),
623636
);
624-
it.effect("adapter Harnesses rows cover every built-in driver kind", () =>
625-
Effect.gen(function* () {
626-
const fs = yield* FileSystem.FileSystem;
627-
const path = yield* Path.Path;
628-
const adapter = path.resolve(
629-
import.meta.dirname,
630-
"../../../..",
631-
"packages/pstack/t3-code.md",
632-
);
633-
const text = yield* fs.readFileString(adapter);
634-
const table = text.split(/^## Harnesses\s*$/m)[1]?.split(/^## /m)[0] ?? "";
635-
const kinds = [...table.matchAll(/^\|\s*`([^`]+)`\s*\|/gm)].map((match) => match[1]).sort();
636-
assert.deepEqual(kinds, BUILT_IN_DRIVERS.map((driver) => driver.driverKind).sort());
637-
}),
638-
);
639637
});

‎apps/server/src/pstack/PstackPack.testkit.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export const makeFixture = Effect.fn("PstackPackTest.makeFixture")(function* (
5757
["scripts/helper.sh", { sha256: "c".repeat(64), executable: true }],
5858
]),
5959
}),
60-
"t3-code.md": "# T3 harness",
6160
"upstream/.gitignore": "node_modules/\n",
6261
"upstream/skills/poteto-mode/scripts/bun.lock": "lockfile\n",
6362
"upstream/skills/architect/SKILL.md":

‎apps/server/src/pstack/pstackModels.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ it.effect("formats the adapter block exactly and omits empty notes", () =>
256256
"pstack skill: architect, arena",
257257
"<pstack>: /pack",
258258
"<models>: /models.md",
259-
"Read <pstack>/docs/harness/t3-code.md once, then <pstack>/skills/architect/SKILL.md, and follow it.",
260-
"Read <pstack>/docs/harness/t3-code.md once, then <pstack>/skills/arena/SKILL.md, and follow it.",
259+
"Read <pstack>/skills/architect/SKILL.md and follow it.",
260+
"Read <pstack>/skills/arena/SKILL.md and follow it.",
261261
"Resolved roles (exact delegate_task targets; they override any model a skill or <models> names):",
262262
"- architect runners: [1] inherit",
263263
"</t3_pstack>",

‎apps/server/src/pstack/pstackModels.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,7 @@ export function formatPstackBlock(input: {
218218
`pstack skill: ${input.skillNames.join(", ")}`,
219219
`<pstack>: ${input.packDir}`,
220220
`<models>: ${input.modelsPath}`,
221-
...input.skillNames.map(
222-
(name) =>
223-
`Read <pstack>/docs/harness/t3-code.md once, then <pstack>/skills/${name}/SKILL.md, and follow it.`,
224-
),
221+
...input.skillNames.map((name) => `Read <pstack>/skills/${name}/SKILL.md and follow it.`),
225222
"Resolved roles (exact delegate_task targets; they override any model a skill or <models> names):",
226223
...input.resolved.roles.map(
227224
({ role, seats }) =>

‎docs/user/pstack.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ provider. Until you run it, pstack uses its own defaults where this environment
2525
Type `$` or `/` in the composer and pick a `pstack:` skill, for example `$pstack:architect design the
2626
cache layer`. Start rigorous work with `$pstack:poteto-mode`; it picks the other skills as it goes.
2727
Helper agents appear under the thread as tasks you can open, follow, or stop.
28+
Use `$pstack:automate-maintainer` or `$pstack:automate-team` to capture a maintainer’s or team’s engineering conventions.
2829

2930
When a role's provider is turned off or no longer offers the model, that helper runs on your thread's
3031
own model instead, and the reply says `Fallback: …`. Turn the provider back on, or run

‎packages/pstack/README.md‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
# pstack for T3 Code
22

3-
Bundled pstack by Lauren Tan, copyright 2026, under the [MIT license](upstream/LICENSE).
4-
`upstream/` is an unmodified snapshot; `t3-code.md` is the T3 Code harness adapter.
3+
T3 Code bundles the [native pstack-t3code port](https://github.com/ScriptedAlchemy/pstack-t3code)
4+
of Lauren Tan's pstack, under the [MIT license](upstream/LICENSE). `upstream/` is an unmodified
5+
snapshot of that repository's `plugins/pstack/`, including `automate-maintainer` and `automate-team`.
6+
The skills use T3 Code tools directly; no harness adapter is needed.
57

6-
From the repository root:
8+
From the repository root, with a clean pstack-t3code checkout:
79

810
```sh
9-
vp run pstack:sync /path/to/cursor/plugins
11+
vp run pstack:sync /path/to/pstack-t3code
1012
vp test run packages/pstack
1113
```
1214

13-
Only the sync command writes `upstream/` and `UPSTREAM.json`. It replaces the snapshot,
14-
records its commit, subtree hash, version, file hashes and executable flags, then reports
15-
every adapter or pack check that needs attention.
15+
Only the sync command writes `upstream/` and `UPSTREAM.json`. It copies tracked pack files,
16+
records the source repository, commit, subtree hash, version, file hashes and executable flags,
17+
then validates native content, skill names, and role defaults. Ignored helper dependencies stay
18+
out of the snapshot. The port's `UPDATING.md` describes how to bring changes from the original
19+
pstack into the native source before syncing it here.

0 commit comments

Comments
 (0)