@justjoshn/pi-pstack 0.15.36-pi.12 → 0.15.36-pi.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +12 -10
- package/automations/benny/FOR_AGENTS.md +1 -1
- package/automations/benny/skills/reproduce-and-fix-issues/SKILL.md +3 -3
- package/automations/benny/skills/setup-benny/SKILL.md +3 -3
- package/automations/benny/skills/triage-issue-reports/SKILL.md +2 -2
- package/docs/guide/01-setup.md +1 -1
- package/docs/parity-status.md +46 -2
- package/package.json +3 -2
- package/skills/architect/references/runner-prompt.md +1 -1
- package/skills/arena/SKILL.md +3 -3
- package/skills/pr-review-canvas/SKILL.md +1 -1
- package/skills/statechart/scripts/test/cli.test.ts +10 -1
- package/src/ask.ts +3 -0
- package/src/background-shell.ts +698 -0
- package/src/child-env.ts +4 -0
- package/src/index.ts +20 -5
- package/src/linux-readonly-sandbox.ts +121 -0
- package/src/loop.ts +92 -47
- package/src/paths.ts +5 -0
- package/src/plan.ts +142 -20
- package/src/process-lock.ts +76 -0
- package/src/readonly-shell.ts +28 -17
- package/src/sections.ts +22 -3
- package/src/subscriptions/durable-store.ts +2 -75
- package/src/subscriptions/index.ts +2 -17
- package/src/subscriptions/supervisor.ts +1 -1
- package/src/task/records.ts +37 -32
- package/src/task/tool.ts +10 -2
- package/src/todo.ts +29 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.15.36-pi.14] - 2026-11-04
|
|
4
|
+
|
|
5
|
+
Each item below was checked against Cursor CLI 2026.10.22 with pstack and cursor-team-kit loaded, through live captures. `parity/pstack-native-parity-2026-11-04/` in the repository records the evidence and the decisions.
|
|
6
|
+
|
|
7
|
+
- Add background shells: `bash_background` runs a command in the background, or after a foreground wait, writes `terminals/<id>.txt` with a status header and an exit footer, and sends a `kind: shell` notification when the command ends or prints a watched line. `AwaitShell` polls, waits for a pattern, or sleeps. pstack's babysit watcher, worktree-cleanup scan, PR review canvas server, and event-gated `/loop` wakes use them. The host section sends commands that can run for minutes to `bash_background`, because `bash` waits until a command ends.
|
|
8
|
+
- Run the Linux read-only shell under bubblewrap with a seccomp filter that bubblewrap loads itself, so readonly subagents get a working shell on Ubuntu 24.04 and later. Writes, the network, and Unix sockets stay blocked. macOS keeps sandbox-runtime.
|
|
9
|
+
- Tell the agent to run a loop's prompt once in the turn that arms it, as Cursor's loop skill does.
|
|
10
|
+
- Remove `AskQuestion` from subagents.
|
|
11
|
+
- State today's date in the host section.
|
|
12
|
+
- Restore upstream text in the architect runner prompt and arena where the port had added instructions with no host reason.
|
|
13
|
+
|
|
14
|
+
## [0.15.36-pi.13] - 2026-11-04
|
|
15
|
+
|
|
16
|
+
- Parse leading word intervals and preserve multiline prompts in `/loop`.
|
|
17
|
+
- Run different loop prompts independently. Return loop IDs and require an explicit ID for ambiguous wake or stop operations.
|
|
18
|
+
- Restore writable tools after leaving a planning branch with no recorded tool loadout.
|
|
19
|
+
- Preserve plan todo dependencies and project phases. Import unfinished root todos when building and synchronize later status updates without rewriting the rest of the plan file.
|
|
20
|
+
- Preserve completion when a reviewed plan omits a todo's optional status. Insert the missing field without rewriting existing metadata, comments, line endings, or body text.
|
|
21
|
+
- Persist plan-imported todos through native Pi branch entries so they survive a restart. Worktree plan builders import their own lists before the first request and retain the plan association on resume. Readonly resumes cannot synchronize plan files.
|
|
22
|
+
- Serialize Task stale-lock recovery with token-directory leases. Treat unreaped Linux zombies as exited writers.
|
|
23
|
+
- Open PR review canvases with the system browser instead of assuming Cursor's in-app browser.
|
|
24
|
+
- Keep Unix sockets blocked in the readonly shell. Refuse a missing seccomp helper instead of allowing a host service to change state on the command's behalf. Linux hosts that refuse the helper's nested namespaces cannot run readonly shell commands.
|
|
25
|
+
- Correct Benny's credential-isolation gate. Readonly children still inherit environment variables and can read credential files. Setup fails closed without separate isolation, and operational runs keep analysis and code work in the coordinator when isolation is unavailable.
|
|
26
|
+
|
|
3
27
|
## [0.15.36-pi.12] - 2026-11-04
|
|
4
28
|
|
|
5
29
|
Each item below was checked against Cursor CLI 2026.10.22 with pstack and cursor-team-kit loaded, through its bundle and live runs. `parity/pi-pstack-behavior-parity/` in the repository records the evidence and the decisions.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pstack for Pi (pi-pstack)
|
|
2
2
|
|
|
3
|
-
pi-pstack is pstack 0.15.36 for Pi 1.5.0: rigorous agent workflows (`/poteto-mode` and its playbooks), the principle skills, and the review, research, and verification skills, plus the full soft-dependency team-kit set (`deslop`, `control-cli`, `control-ui`, CI/PR helpers, thermo-nuclear review, and the rest) vendored in so you do not install a separate team-kit package. A small extension provides the host features the skills call by name: `/name` skill commands, `/mode`, `/plan`, the `Task` subagent tool with local worktree workers, forks, and `agent_status`, `TodoWrite`, `AskQuestion`, `GenerateImage`, `SwitchMode`, the model rule, `/loop`, subscriptions and webhook routines, and `visualize`.
|
|
3
|
+
pi-pstack is pstack 0.15.36 for Pi 1.5.0: rigorous agent workflows (`/poteto-mode` and its playbooks), the principle skills, and the review, research, and verification skills, plus the full soft-dependency team-kit set (`deslop`, `control-cli`, `control-ui`, CI/PR helpers, thermo-nuclear review, and the rest) vendored in so you do not install a separate team-kit package. A small extension provides the host features the skills call by name: `/name` skill commands, `/mode`, `/plan`, the `Task` subagent tool with local worktree workers, forks, and `agent_status`, background shells (`bash_background` and `AwaitShell`), `TodoWrite`, `AskQuestion`, `GenerateImage`, `SwitchMode`, the model rule, `/loop`, subscriptions and webhook routines, and `visualize`.
|
|
4
4
|
|
|
5
5
|
## Get set up
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ pi-pstack is pstack 0.15.36 for Pi 1.5.0: rigorous agent workflows (`/poteto-mod
|
|
|
13
13
|
pi install ./extensions/pi-pstack
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Pi does not install dependencies for a local package, so `bun install` (or `npm install` in `extensions/pi-pstack`) fetches
|
|
16
|
+
Pi does not install dependencies for a local package, so `bun install` (or `npm install` in `extensions/pi-pstack`) fetches `yaml` for plan metadata and, for the macOS read-only shell (readonly subagents and `/plan`), `@anthropic-ai/sandbox-runtime`. On Linux the read-only shell runs `bubblewrap` from the system instead (`sudo apt install bubblewrap`), with no user-namespace change on Ubuntu 24.04 and later. Where no sandbox can start, a read-only shell command fails instead of running unsandboxed. macOS uses the built-in `sandbox-exec`. pi-pstack needs Node 22.19 or newer. To try it for one session without installing, run `pi -e ./extensions/pi-pstack`. To install the published package instead, run `pi install npm:@justjoshn/pi-pstack`.
|
|
17
17
|
Installing loads pi-pstack's tools and system-prompt sections at once, but no skill runs until you invoke it. 61 workflow skills stay out of the model's automatic skill list. Setup, create-skill, and the team-kit shipping and review skills (`deslop`, `control-cli`, `control-ui`, CI and PR helpers, and the rest of that set) can load from your words alone.
|
|
18
18
|
2. Run `/setup-pstack`. It lists the models the `Task` tool can use, asks for a reasoning budget, maps a model to each role, and writes the model rule. A new rule applies from the next request.
|
|
19
19
|
3. Start real work with `/poteto-mode`, a goal, and a check that can pass or fail.
|
|
@@ -28,8 +28,8 @@ Remove the package with `pi remove ./extensions/pi-pstack`. Its state lives in `
|
|
|
28
28
|
|---|---|
|
|
29
29
|
| `/poteto-mode <task>` | The skill attaches to that one message. Every skill Pi loaded works this way: pstack's (`/how`, `/why`, `/arena`, `/interrogate`, `/principle-prove-it-works`, `/deslop`) and your own, such as a `/<handle>-mode` skill from `/automate-me`. `/skill:<name>` works too. |
|
|
30
30
|
| `/mode poteto-mode [task]` | Keeps the skill in context on every turn until you leave the mode: the skill rides every request in its own system-prompt section, which Pi re-sends only when it changes. The first request after entry says the user entered the mode, later requests carry a reminder that names the skill file, and the request after `/mode off` or a switch to another mode says the user left it. The footer shows a badge with the skill's `icon` and `color` metadata, such as a yellow `♛ mode: poteto-mode` (other skills get `⚡`). `/mode off` exits and `/mode` reports. Any loaded skill can back a mode. |
|
|
31
|
-
| `/plan [task]` | Plan mode: the agent researches with read-only tools (`read`, `grep`, `find`, `ls`, the sandboxed `bash_readonly`, `AskQuestion`, `TodoWrite`, `agent_status`, `Task`, whose launches run readonly: a fresh one runs here with no worktree, and a resume or fork stays where its agent ran, and `stop_agent`), asks its clarifying questions early, and presents the plan with `CreatePlan` (`plan`, `name`, `overview`, `todos`). `CreatePlan` writes the plan file under `<pstack dir>/plans/` (`<name>-<8 hex>.plan.md`: the chat id in a comment, the todos as front matter, then the plan), one file per plan name in a chat. `edit` and `write` work on markdown files only, so the agent refines the plan in its file. After a run that saved a plan, an interactive session asks `Yes, build locally`, `Yes, build in cloud` (in a git repository: a background isolated worker builds it on its own branch), or `No, propose changes`. `/plan build` builds the saved plan too, and `/plan off` restores your tools. A bare `/plan` enters plan mode. The footer shows `plan`. |
|
|
32
|
-
| `/loop 30m <prompt>` | Runs the prompt now, then again every 30 minutes from each fire, so a long run does not push the next tick out. A tick that comes due while a run is still going fires once when that run settles; several missed ticks still fire once. The interval can come first or last, written as `30m`, `10 minutes`, or `every 10 minutes`. Without an interval the agent picks each wake with the `Loop` tool, and the loop ends when it picks none and no background subagent is still running. `/loop stop` or Escape during a run ends
|
|
31
|
+
| `/plan [task]` | Plan mode: the agent researches with read-only tools (`read`, `grep`, `find`, `ls`, the sandboxed `bash_readonly`, `AskQuestion`, `TodoWrite`, `agent_status`, `Task`, whose launches run readonly: a fresh one runs here with no worktree, and a resume or fork stays where its agent ran, and `stop_agent`), asks its clarifying questions early, and presents the plan with `CreatePlan` (`plan`, `name`, `overview`, `todos`, `is_project`, `phases`). `CreatePlan` writes the plan file under `<pstack dir>/plans/` (`<name>-<8 hex>.plan.md`: the chat id in a comment, the todos as front matter, then the plan), one file per plan name in a chat. Todo dependencies and project phases stay in the file. Building imports the file's unfinished root todos into the session, including edits made during review. Worktree builders import their own lists before the first model request and retain the associated plan on resume. Later writable `TodoWrite` status updates synchronize those root todos without rewriting other metadata or the plan body. An omitted status imports as pending and is inserted when the todo is updated. A readonly resume keeps its todo changes inside the session. `edit` and `write` work on markdown files only, so the agent refines the plan in its file. After a run that saved a plan, an interactive session asks `Yes, build locally`, `Yes, build in cloud` (in a git repository: a background isolated worker builds it on its own branch), or `No, propose changes`. `/plan build` builds the saved plan too, and `/plan off` restores your tools. A bare `/plan` enters plan mode. The footer shows `plan`. |
|
|
32
|
+
| `/loop 30m <prompt>` | Runs the prompt now, then again every 30 minutes from each fire, so a long run does not push the next tick out. A tick that comes due while a run is still going fires once when that run settles; several missed ticks still fire once. The interval can come first or last, written as `30m`, `10 minutes`, or `every 10 minutes`. Without an interval the agent picks each wake with the `Loop` tool, and the loop ends when it picks none and no background subagent or background shell is still running. A run that waits on an event (CI finishing, a ref moving, a log line) starts a watcher with `bash_background`, whose notification wakes the agent, and keeps a long wake as the fallback. Different prompts create independent loops. The same prompt replaces its schedule. `/loop` lists them. `/loop stop` ends the only loop, or `/loop stop <id>` selects one when several are running. Escape during a run ends the session's loops. `Loop` results include the loop ID in text and details; pass `loop_id` to wake, stop, or replace one of several loops. The prompt can be a skill command, such as `/loop 1h /poteto-mode run the audit tick`. When a playbook says to arm `/loop`, the agent runs the prompt once in that turn and starts the loop with the `Loop` tool, whose first scheduled run comes after the interval or wake. Intervals go up to 24 days. |
|
|
33
33
|
| `/routines` | Lists webhook routines with their URL, credential file, and status. |
|
|
34
34
|
| `/setup-pstack` | Configures the per-role models. |
|
|
35
35
|
| `/poteto-help <question>` | Answers a question about pstack and hands you a prompt to send. |
|
|
@@ -40,7 +40,7 @@ Remove the package with `pi remove ./extensions/pi-pstack`. Its state lives in `
|
|
|
40
40
|
|
|
41
41
|
| Feature | Behavior |
|
|
42
42
|
|---|---|
|
|
43
|
-
| `Task` (`description`, `prompt`, `subagent_type`, `model`, `run_in_background`, `resume`, `fork`, `fork_turns`, `readonly`, `file_attachments`, `environment`, `cloud_base_branch`) | Starts a separate `pi --mode rpc` process per subagent, so this Pi process can steer and abort it. Foreground calls return the response and an agent ID. Background calls return at once, and a `<system_notification>` with a `<task>` block arrives after your turn ends, titled by the first line of the prompt (80 characters at most) and followed by a request to do any follow-up work; the notification card shows the call's `description`. Print and JSON runs wait for pending notifications before exiting, unless aborted. Several calls in one message run in parallel. A subagent's own subagents cannot spawn more, and every subagent is told to spawn none unless asked. A run lock per agent ID keeps out a second writer, even from another Pi process
|
|
43
|
+
| `Task` (`description`, `prompt`, `subagent_type`, `model`, `run_in_background`, `resume`, `fork`, `fork_turns`, `readonly`, `file_attachments`, `environment`, `cloud_base_branch`) | Starts a separate `pi --mode rpc` process per subagent, so this Pi process can steer and abort it. Foreground calls return the response and an agent ID. Background calls return at once, and a `<system_notification>` with a `<task>` block arrives after your turn ends, titled by the first line of the prompt (80 characters at most) and followed by a request to do any follow-up work; the notification card shows the call's `description`. Print and JSON runs wait for pending notifications before exiting, unless aborted. Several calls in one message run in parallel. A subagent's own subagents cannot spawn more, and every subagent is told to spawn none unless asked. A run lock per agent ID keeps out a second writer, even from another Pi process. A token-directory lease serializes stale-lock recovery while the PID file identifies the transcript writer. Children inherit the parent's project-trust decision. Foreground usage counts toward the session totals. The Task card leads with the call's `description`, then the agent type and the model that ran, and while a foreground child works it shows its last few tool steps and latest line instead of a blank wait. |
|
|
44
44
|
| `resume` | Sends a follow-up to an idle agent with its context, model, type, and directory. The root chat can resume or fork a descendant that a worktree worker started inside that worktree, and the descendant still runs where it first ran. On an agent running in this Pi process, it delivers the prompt as a steer and returns at once. A readonly or plan-mode call cannot steer a writable agent. An agent running in another Pi process is refused. This is how a playbook "messages" a worker. Pi's own `/resume` command reopens a chat session instead. |
|
|
45
45
|
| `fork` | Starts a new agent whose transcript begins as a copy of an idle agent's transcript, in that agent's directory (its worktree for an isolated worker), so it sees the built checkout and uncommitted changes. Type, model, and readonly default from the source; readonly can be added, never lifted. `fork_turns: N` (only with `fork`) copies just the first N user turns. `fork` excludes `resume`, `environment`, and `cloud_base_branch`. Pi's own `/fork` command branches the chat session instead. |
|
|
46
46
|
| `stop_agent` | `agent_id`. Stops a running subagent. One this Pi process owns gets an RPC abort, then a kill after a grace period. One another of your Pi processes owns gets a signal to the live pid in its run lock. An idle or finished agent is left alone, and the result says so. |
|
|
@@ -48,9 +48,9 @@ Remove the package with `pi remove ./extensions/pi-pstack`. Its state lives in `
|
|
|
48
48
|
| Subagent types | The built-in `generalPurpose` (default) and `explore` (a file-search specialist the caller tells how thorough to be, with `grep`, `find`, and `ls` on and no `Task`), then `poteto-agent` (a background delegate that reads poteto-mode first), `ci-watcher` (a background PR check watcher), `comment-sicko`, and `thermo-nuclear-code-quality-review`, the last four read from `agents/*.md`. Unknown types fail with the list. |
|
|
49
49
|
| Models | A Pi model spec such as `claude-opus-5-5:xhigh` or `xai/grok-4.7:high`, model parameters such as `claude-opus-5-5[effort=high]` or `grok-4.7[fast=true]` (picks a listed `-fast` id of that model), `fast` for the parent model's listed `-fast` variant when it has one, else the parent model, or `inherit`, `inherit-parent`, `auto`, or nothing for the parent model. A model Pi does not list, or a thinking level the model does not support, fails with the allowed list. A bare model id that several providers offer resolves to the parent chat's provider when it offers that id, and otherwise fails with the choices. Older rules that wrote `claude-opus-5-5-xhigh` still resolve. The system prompt's `pstack_subagents` section lists the types, the parent model, and the models with their levels. |
|
|
50
50
|
| Isolated workers (`environment: "cloud"`) | The subagent runs in a new git worktree at `<pstack dir>/workspaces/<workspace folder>/worktrees/<agent id>` on branch `pstack/<agent id>`, from `cloud_base_branch` (`origin/<branch>` when that remote-tracking ref exists, else a local branch or other ref) or your HEAD commit, so uncommitted changes do not reach it. The result and the card name the branch to merge, and `resume` and `fork` run in the same worktree. It fails clearly outside a git repository, in a repository with no commits, or when the base does not resolve. The worker shares the root chat's workspace state, so it sees the same projects, stores, and subagent transcripts. It also shares this machine's ports, processes, writable caches, simulators, and credentials. Assign separate ports, output directories, and writable caches to concurrent runtime lanes. `swarm` and `orchestrate` spawn worktree workers by default. |
|
|
51
|
-
| `readonly: true` | The child gets `read`, `grep`, `find`, `ls`, `TodoWrite`, and a read-only `bash`, and no MCP. That shell runs each command in an OS sandbox
|
|
52
|
-
| `TodoWrite` | `todos` with `id`, `content`, `status`, and `merge`. Its description says when to keep a list, the four states, and one task in progress at a time. The list follows the session branch, shows above the editor, and rides every request's system prompt. |
|
|
53
|
-
| `AskQuestion` | `title`, and per question `id`, `prompt`, `options` (at least two, each `id`, `label`, optional `description`), and `allow_multiple`, through Pi's select dialog. It is for decisions only the user can make, and a recommended option goes first with `(Recommended)`. Every question ends with `Other: (type to answer)`; a typed answer comes back as `other` with its text. In print and JSON runs
|
|
51
|
+
| `readonly: true` | The child gets `read`, `grep`, `find`, `ls`, `TodoWrite`, and a read-only `bash`, and no MCP or background shell. That shell runs each command in an OS sandbox that blocks every file write, all network access, and Unix sockets, so `git log` works and `touch` or `curl` fail. On Linux it is `bubblewrap` with every namespace unshared, the filesystem bound read-only, and a seccomp filter that refuses `socket(AF_UNIX)` and `io_uring_setup`; on macOS it is [`@anthropic-ai/sandbox-runtime`](https://github.com/anthropics/sandbox-runtime)'s `sandbox-exec` policy. Where no sandbox can start, the command fails rather than running unsandboxed. Readonly is not credential isolation. The child still inherits environment variables and can read credential files through its read tools. |
|
|
52
|
+
| `TodoWrite` | `todos` with `id`, `content`, `status`, and `merge`. Its description says when to keep a list, the four states, and one task in progress at a time. The list follows the session branch, shows above the editor, and rides every request's system prompt. Plan-imported lists persist as branch entries. Their dependencies survive status-only updates, and matching plan-file statuses are synchronized. |
|
|
53
|
+
| `AskQuestion` | `title`, and per question `id`, `prompt`, `options` (at least two, each `id`, `label`, optional `description`), and `allow_multiple`, through Pi's select dialog. It is for decisions only the user can make, and a recommended option goes first with `(Recommended)`. Every question ends with `Other: (type to answer)`; a typed answer comes back as `other` with its text. In print and JSON runs each question comes back skipped. Subagents have no `AskQuestion`. |
|
|
54
54
|
| Always-applied rules | The two team-kit rules are in `pstack_host` as their shipped text on every request, alongside the same rules as hidden skills. |
|
|
55
55
|
| The model rule | `<pstack dir>/pstack-models.md`, plain Markdown with one line per role, added to every request's system prompt. A `pstack-models.mdc` from an earlier version is moved there once, without its frontmatter, and kept as `pstack-models.mdc.migrated`. |
|
|
56
56
|
| Subscriptions | `subscribe_github_pr` (`scope` `pr` with `prUrl`, `repo` with `repo`, or `author` with `author` and `repo`) polls with `gh` every 60 seconds and wakes the chat when a PR's state, head, mergeability, review decision, reviews, or comments change, or when a check concludes or its conclusion changes; the first poll is a baseline. `subscribe_timer` takes a `name`, a `prompt`, and a 5-field `cron` or `delaySeconds`, either with `once`; `sessionStrategy` `wake_self` queues a wake for this owning session. With `new_session`, a live owner starts a background Task and receives its notification. An offline owner permits a detached run with a recorded outcome. Both reuse the model, thinking level, and project-trust decision the timer was created with. Re-subscribing an existing timer name returns `created: false`. `list_subscriptions` and `unsubscribe` manage them. The authoritative registry is `<pstack dir>/durable/<workspace>/subscriptions.json`. Any session in that workspace can list or cancel subscriptions. Session history does not recreate cancelled or completed subscriptions. Owner-directed events wait for the creating session rather than waking another workspace session. A detached run records its own final message, shown by `list_subscriptions`. A timer does not expire unless `expiresInHours` says so (at most 30 days); `0` means no expiry. A GitHub watch keeps a 7-day default because it is this port's own surface. |
|
|
@@ -60,6 +60,7 @@ Remove the package with `pi remove ./extensions/pi-pstack`. Its state lives in `
|
|
|
60
60
|
| `visualize` | `title`, `kind` (`bar` or `line`), `labels`, `series` (`name`, `values`), and `unit` render a Unicode chart in the result and write a standalone SVG to the session's artifacts folder. |
|
|
61
61
|
| Transcripts | The system prompt names this workspace's Pi session directory, the current session file, and this workspace's subagent transcripts. |
|
|
62
62
|
| `GenerateImage` | Generates an image (`description` of at least six words, `filename`, `reference_image_paths`, `aspect_ratio`) on Pi's image models through `ctx.modelRegistry.generateImages()`. It is offered when an image model is available (for example an OpenRouter image model), not to readonly subagents or in plan mode, and saves each image to the session's artifacts folder. Without an image model, the host section tells skills to draw a Mermaid diagram instead. |
|
|
63
|
+
| Background shells | `bash_background` (`command`, `description`, `block_until_ms`, `notify_on_output` with `pattern`, `reason`, and `debounce_ms`, `working_directory`) runs a command in the background, or waits up to `block_until_ms` for it and then moves it there. Output goes to `<pstack dir>/workspaces/<workspace folder>/terminals/<shell id>.txt`, which starts with a header (pid, cwd, command, title, status, started_at, and running_for_ms, refreshed every 5 seconds) and ends with an exit footer. After the turn, a `<system_notification>` with a `kind: shell` task block arrives when the command finishes (`status: success`, `error` with `exit_code=N`, or `aborted`) and when a line matches `notify_on_output` (the first match at once, later ones counted and sent after each `debounce_ms` window, at least 5 seconds). `AwaitShell` (`shell_id`, `block_until_ms`, `pattern`) polls or waits on a job, or sleeps without one; seeing a job end there skips its notification. Print and JSON runs wait for their jobs before they exit. Ending the session stops running jobs. Readonly subagents and plan mode do not get these tools. |
|
|
63
64
|
| `SwitchMode` | `target_mode_id` (`plan` or `agent`) and `explanation`. The agent proposes entering or leaving plan mode, and the switch happens only after you confirm it. Offered in interactive and RPC sessions. |
|
|
64
65
|
|
|
65
66
|
Subagent transcripts are Pi sessions in `<pstack dir>/workspaces/<workspace folder>/subagents/`, with the agent ID in each file name, next to a small record that `resume`, `fork`, and `agent_status` read. Records belong to the main chat's shared workspace state, so the root chat can act on a descendant that ran in a worktree. Children inherit your installed extensions and MCP servers, and local ones run in your working directory. Give each local subagent that writes its own git worktree, or launch it with `environment: "cloud"`, because a child process does not isolate the filesystem. A child exits on its own if its parent Pi process dies.
|
|
@@ -78,10 +79,11 @@ Subagent transcripts are Pi sessions in `<pstack dir>/workspaces/<workspace fold
|
|
|
78
79
|
- Depth limits apply to `Task`. A writable subagent can still start `pi` through `bash`, and that process is outside the depth limit and parent watchdog.
|
|
79
80
|
- A child loads your installed extensions plus this package. If you run one checkout with `-e` while a different checkout of pi-pstack is installed, the child loads both and fails on duplicate tools; use one copy, or a separate `PI_CODING_AGENT_DIR`, as `live:e2e` does.
|
|
80
81
|
- Subagents run headless in RPC mode, so an extension that asks for permission through a dialog cannot ask there.
|
|
81
|
-
- The read-only shell sandboxes shell subprocesses only
|
|
82
|
+
- The read-only shell sandboxes shell subprocesses only. On Linux it needs `bubblewrap` that can create its user namespace (Ubuntu's default `bwrap` AppArmor profile allows that) on x86-64 or arm64; bubblewrap loads the seccomp filter itself, so no nested namespace is needed. A missing `bwrap`, another architecture, or a namespace refusal blocks the shell command. Unix sockets stay blocked because a host socket service can mutate files or access the network on a command's behalf, and the shell never falls back to permitting them. Do not treat a readonly child as a credential boundary. Environment variables and readable credential files are still available to its read tools.
|
|
83
|
+
- A subagent's background shells stop when the subagent finishes, and its launch result says so, because a subagent is its own process. A print or JSON run waits for its background shells, with no timeout of its own, so a job that never ends keeps the run open.
|
|
82
84
|
- Whether a model follows a playbook is the model's call.
|
|
83
85
|
- Workspace folders follow Pi's session-folder naming, so two paths that differ only by `/` versus `-` share a folder. Resume and fork refuse an agent whose record names the other directory, except that a record created inside this workspace's own worktrees belongs to this workspace. Subscription reads and mutations also reject a registry owned by the other workspace.
|
|
84
|
-
- The run lock that keeps one writer per agent ID names the process writing the transcript. A lock file without a readable pid counts as held; the error names the file to delete. `agent_status` shows such an agent as `idle`. A lock
|
|
86
|
+
- The run lock that keeps one writer per agent ID names the process writing the transcript. A lock file without a readable pid counts as held; the error names the file to delete. `agent_status` shows such an agent as `idle`. A token-directory lease beside the PID file serializes stale-lock recovery. A dead process or an unreaped Linux zombie does not count as a live writer. Older installed versions without the lease do not participate in this protection.
|
|
85
87
|
- `skills/poteto-mode/scripts/watch-pr` needs Bun and installs its one dependency on first run. `check-plan.mjs` needs only Node. `worktree-audit.sh` needs `rg` and `jq`, and works with BSD (macOS) or GNU `stat` and `date`.
|
|
86
88
|
- `statechart` runs `skills/statechart/scripts/statechart` on Node 22.18 to 22.x, Node 23.6 or later, Bun 1.1.5 or later, or Deno 2.0 or later. The first run installs TLC and Java through [mise](https://mise.jdx.dev/) and needs the network. Without a SPEC it prints `Give one SPEC.tla.` and its usage, then exits 2.
|
|
87
89
|
|
|
@@ -27,7 +27,7 @@ i want two pi automations that work together in one slack issue channel. each on
|
|
|
27
27
|
|
|
28
28
|
- i want the source channel and root thread coordinates to stay immutable for the whole run.
|
|
29
29
|
- i treat utility and debug bots as evidence, not delegation or fix ownership.
|
|
30
|
-
- i allow subagents to help, but they cannot post to slack or receive slack credentials. analysis subagents run as `Task` with `readonly: true
|
|
30
|
+
- i allow subagents to help, but they cannot post to slack or receive slack credentials. analysis subagents run as `Task` with `readonly: true`. readonly removes mcp tools and restricts shell operations, but does not isolate credentials. when separate credential isolation cannot be proven, keep the work in the coordinator.
|
|
31
31
|
- i want this entire pack committed at `.pi/automations/benny/` in the target repository. its `SKILL.md` files are direct automation instructions, not skills pi discovers.
|
|
32
32
|
- i want pi-pstack installed in pi for shared dependencies such as `how`, `why`, `tdd`, `unslop`, and the required principle skills.
|
|
33
33
|
- i want each subscription prompt to read its operational file directly from the target repository. i do not want pi-pstack package paths, copied excerpts, or slash-skill discovery.
|
|
@@ -16,8 +16,8 @@ Load the external Benny configuration supplied by the automation. If the config,
|
|
|
16
16
|
- Never post a root message in the source channel.
|
|
17
17
|
- Preflight the source parent before every source-thread post.
|
|
18
18
|
- The coordinator is the only Slack poster.
|
|
19
|
-
- Delegated analysis workers are read-only and return findings or media notes.
|
|
20
|
-
- A fix-phase code worker may edit only when its environment provably
|
|
19
|
+
- Delegated analysis workers are read-only and return findings or media notes. `Task` with `readonly: true` removes MCP tools and restricts shell operations, but still inherits environment credentials and can read credential files. Launch a child only after separate credential isolation is proven. Otherwise do the work in the coordinator.
|
|
20
|
+
- A fix-phase code worker may edit only when its environment and readable files provably exclude Slack credentials and every Slack write action. Otherwise the coordinator edits. A writable Pi subagent also inherits the session's MCP servers. Absence of a Slack MCP server or an environment token alone is not proof of credential isolation.
|
|
21
21
|
- Every child prompt must explicitly forbid every Slack MCP write tool (`mcp__<slack-server>__*` tools that post, edit, react, or upload), `chat.postMessage`, and all other Slack writes.
|
|
22
22
|
- Never give a child a Slack token, posting instructions, source coordinates for posting, or permission to report externally.
|
|
23
23
|
- If a child needs Slack write access to run, do not launch it.
|
|
@@ -36,7 +36,7 @@ Load the external Benny configuration supplied by the automation. If the config,
|
|
|
36
36
|
Before making a work list or delegating:
|
|
37
37
|
|
|
38
38
|
1. Require the trigger channel to equal the configured source channel.
|
|
39
|
-
2. Set `SOURCE_THREAD_TS` to `trigger.thread_ts` when present. Otherwise use `trigger.ts`.
|
|
39
|
+
2. Set `SOURCE_THREAD_TS` to `trigger.thread_ts` when present. Otherwise use `trigger.message_ts`, then `trigger.ts`.
|
|
40
40
|
3. Require a nonempty `SOURCE_THREAD_TS`.
|
|
41
41
|
4. Store `SOURCE_CHANNEL_ID` and `SOURCE_THREAD_TS` as immutable values.
|
|
42
42
|
5. Read the source thread and verify its root has those exact coordinates.
|
|
@@ -38,7 +38,7 @@ If this file is already being read from the target destination, treat the copy a
|
|
|
38
38
|
|
|
39
39
|
Confirm that pi-pstack is installed in Pi. A personal install (`pi install <path-to-pi-pstack>`) serves every repository on this machine. A project install (`pi install -l <path-to-pi-pstack>`) writes the target repository's `.pi/settings.json`; preserve every unrelated setting and package entry when that file exists, and validate it after editing.
|
|
40
40
|
|
|
41
|
-
This setup session must run in the target repository, because a `Task` subagent starts in its parent's working directory. If it does not, stop and tell the user to start Pi in the target repository and point it at `FOR_AGENTS.md` again.
|
|
41
|
+
This setup session must run in the target repository, because a `Task` subagent starts in its parent's working directory. If it does not, stop and tell the user to start Pi in the target repository and point it at `FOR_AGENTS.md` again. Before the dependency check, prove that its child cannot read Slack credentials from the inherited environment or files. `readonly: true` removes MCP tools and restricts shell operations, but does not remove credentials or restrict the `read` tool. If credential isolation is unavailable, stop setup before starting a child or enabling subscriptions. Otherwise start a fresh `Task` subagent with `readonly: true`. Ask it to resolve `<SKILLS>` from its own system prompt and read each required `<SKILLS>/<name>/SKILL.md` file below. It must report each absolute path and confirm the file's frontmatter names the required skill. Hidden skills need not appear in Pi's automatic skill catalog.
|
|
42
42
|
|
|
43
43
|
- `how`
|
|
44
44
|
- `why`
|
|
@@ -132,7 +132,7 @@ The repro automation needs:
|
|
|
132
132
|
- `gh` authenticated for the repository, so `gh pr create --draft` can open a draft pull request
|
|
133
133
|
- The configured control-adapter skill
|
|
134
134
|
|
|
135
|
-
Prefer the configured Slack MCP tools for reads and posts. The optional `BENNY_SLACK_BOT_TOKEN` may fill a narrow gap such as editing one operations status message or downloading an attachment. Store the value in a secret manager or the owning session's environment, not in YAML.
|
|
135
|
+
Prefer the configured Slack MCP tools for reads and posts. The optional `BENNY_SLACK_BOT_TOKEN` may fill a narrow gap such as editing one operations status message or downloading an attachment. Store the value in a secret manager or the owning session's environment, not in YAML. Every subagent inherits that environment, including readonly children. Removing a token from the prompt does not remove it from the process or make credential files unreadable. Unless separate credential isolation is established, keep analysis and code work in the coordinator.
|
|
136
136
|
|
|
137
137
|
Do not use undocumented integration endpoints.
|
|
138
138
|
|
|
@@ -247,7 +247,7 @@ Verify:
|
|
|
247
247
|
3. Repro accepts the marker only from the configured triage identity.
|
|
248
248
|
4. Repro keeps the same immutable source coordinates.
|
|
249
249
|
5. No source-channel root message appears.
|
|
250
|
-
6.
|
|
250
|
+
6. Every delegated worker has verified credential isolation as well as no Slack write actions. `readonly: true` alone is insufficient. If that isolation is unavailable, the coordinator performs the work without an analysis or code child.
|
|
251
251
|
7. Missing coordinates, a deleted parent, or a failed preflight produces no post and no tracker issue.
|
|
252
252
|
8. A second fire, or a repeated webhook POST, for the same report does no work, because the ledger already lists it.
|
|
253
253
|
|
|
@@ -19,7 +19,7 @@ Load the external Benny configuration supplied by the automation. If the config
|
|
|
19
19
|
- If the parent is missing, deleted, inaccessible, or uncertain, stop with no writes.
|
|
20
20
|
- Post one substantive verdict. Do not narrate progress.
|
|
21
21
|
- The coordinator is the only Slack poster.
|
|
22
|
-
- Delegated workers return findings only. They must be read-only and receive no Slack credentials or write actions. In Pi,
|
|
22
|
+
- Delegated workers return findings only. They must be read-only and receive no Slack credentials or write actions. In Pi, `Task` with `readonly: true` removes MCP tools and restricts shell operations, but still inherits environment credentials and can read credential files. Launch a child only after separate credential isolation is proven. Otherwise do the work in the coordinator.
|
|
23
23
|
- Every child prompt must forbid every Slack MCP write tool (`mcp__<slack-server>__*` tools that post, edit, react, or upload), `chat.postMessage`, and every other Slack write.
|
|
24
24
|
- If worker isolation cannot enforce those limits, do the work in the coordinator.
|
|
25
25
|
- Never create an issue that cannot link back to the source thread.
|
|
@@ -33,7 +33,7 @@ Before making a work list or delegating:
|
|
|
33
33
|
|
|
34
34
|
1. Read `source_channel_id` from the trigger.
|
|
35
35
|
2. Require it to equal the configured source channel.
|
|
36
|
-
3. Set `SOURCE_THREAD_TS` to `trigger.thread_ts` when present. Otherwise use `trigger.ts`.
|
|
36
|
+
3. Set `SOURCE_THREAD_TS` to `trigger.thread_ts` when present. Otherwise use `trigger.message_ts`, then `trigger.ts`.
|
|
37
37
|
4. Require a nonempty `SOURCE_THREAD_TS`.
|
|
38
38
|
5. Store `SOURCE_CHANNEL_ID` and `SOURCE_THREAD_TS` as immutable values.
|
|
39
39
|
6. Read the thread and verify that its root has exactly those coordinates.
|
package/docs/guide/01-setup.md
CHANGED
|
@@ -13,7 +13,7 @@ bun install
|
|
|
13
13
|
pi install ./extensions/pi-pstack
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
`pi install <path-to-pi-pstack>` loads the package in place, so keep the checkout where it is. To install the published package instead, run `pi install npm:@justjoshn/pi-pstack`. On Linux, the read-only shell also needs `bubblewrap`,
|
|
16
|
+
`pi install <path-to-pi-pstack>` loads the package in place, so keep the checkout where it is. To install the published package instead, run `pi install npm:@justjoshn/pi-pstack`. On Linux, the read-only shell also needs `bubblewrap`, as the package README explains. Start Pi, and the pstack commands appear in the `/` menu.
|
|
17
17
|
|
|
18
18
|
## Pick your models
|
|
19
19
|
|
package/docs/parity-status.md
CHANGED
|
@@ -8,7 +8,7 @@ This page records what `pi-pstack` reproduces from Cursor `pstack` 0.15.36 and i
|
|
|
8
8
|
- Installed Cursor CLI at the time of the reference capture: `2026.10.22-27dcf5f`.
|
|
9
9
|
- Native implementation: this package, which pins its upstream provenance in `package.json.pstackSource`.
|
|
10
10
|
|
|
11
|
-
A path and byte comparison of the tracked trees shows every pstack skill, both pstack agents, all 18 team-kit skills, both team-kit agents, and both team-kit rules in this package.
|
|
11
|
+
A path and byte comparison of the tracked trees shows every pstack skill, both pstack agents, all 18 team-kit skills, both team-kit agents, and both team-kit rules in this package. Sixteen team-kit skill files are byte-identical. `workflow-from-chats` describes Pi paths instead of Cursor paths, and `pr-review-canvas` opens a system browser instead of Cursor's in-app browser. The changed pstack files are host translations. One upstream paragraph has no counterpart: `poteto-help`'s Claude Code install path and its `docs/harness/claude-code.md` adapter, because this package targets Pi only. The two non-portable frontmatter keys Cursor ships (`icon`/`color` on `poteto-mode`, `paths` on `typescript-best-practices`) are kept under `metadata`, the Agent Skills extension point. The port reads `icon` and `color` for the mode badge. `paths` stays as metadata only, because Cursor loads a `paths` skill that sets `disable-model-invocation` only when it is invoked by name. team-kit's thermo-nuclear agent changes only where it names the plugin that ships its rubric.
|
|
12
12
|
|
|
13
13
|
## Native translations
|
|
14
14
|
|
|
@@ -45,6 +45,38 @@ A live Cursor CLI session with both plugins loaded produced these contracts.
|
|
|
45
45
|
|
|
46
46
|
Pi returns the child's final text with a transcript path and usage, and reports background completion as a `pstack/task` notification. The payload shape differs because the hosts are different; the observable workflow, a subagent result arriving after the parent turn, is preserved.
|
|
47
47
|
|
|
48
|
+
## Repairs in 0.15.36-pi.14
|
|
49
|
+
|
|
50
|
+
An independent audit on 2026-11-04 compared every reference file and probed Cursor CLI 2026.10.22 live. The repository's `parity/pstack-native-parity-2026-11-04/` holds the notes, decision log, inventory, and the scripts; `.audit/pstack-native-parity-2026-11-04/cursor/` holds the raw Cursor captures.
|
|
51
|
+
|
|
52
|
+
- **Background shells.** Cursor's `Shell` runs a command in the background (`block_until_ms: 0`, or after the wait runs out), writes `terminals/<id>.txt` with a status header and an exit footer, notifies after the turn when the command ends (`kind: shell`) and on each `notify_on_output` match (the first at once, later ones counted per debounce window), and `AwaitShell` polls, waits for a pattern, or sleeps. pstack leans on it: babysit's "watcher output drives wakeups", worktree-cleanup's "background it", pr-review-canvas's "run this backgrounded", and the event-gated branch of Cursor's `/loop`. pi-pstack had no background shell. `bash_background` and `AwaitShell` now reproduce the captured texts, header layout (173 bytes for the probed job), and notification shapes. Two choices differ from one observation each. A job whose end `AwaitShell` saw sends no completion notice, as Cursor's AwaitShell description promises, though one Cursor run sent a duplicate. A subagent's jobs stop when the subagent ends, because a Pi subagent is its own process; Cursor ran the job on and reported it `aborted` to the parent.
|
|
53
|
+
- **Linux read-only shell.** sandbox-runtime's seccomp helper needs a nested user namespace, which Ubuntu 24.04 and later refuse by default (`kernel.apparmor_restrict_unprivileged_userns=1`), so every readonly subagent on such a host had no shell. Cursor documents readonly as "no file edits, no state-changing shell commands", so read-only commands must work. Linux now runs `bwrap` directly with every namespace unshared, `/` bound read-only, and a generated seccomp filter (`bwrap --seccomp`) that refuses `socket(AF_UNIX)` and `io_uring_setup`. Writes, TCP, and Unix sockets stay refused; `git log` works. macOS keeps sandbox-runtime.
|
|
54
|
+
- **`/loop` arming.** Cursor's loop skill runs the prompt once when the loop is armed. The host section and the `Loop` tool now say to do that in the arming turn; the first scheduled run still comes after the interval or wake.
|
|
55
|
+
- **Subagents have no `AskQuestion`.** Cursor's generalPurpose subagent listed no such tool (`subagent-tools.jsonl`), and one asked to call it replied that it does not exist (`subagent-askquestion.jsonl`).
|
|
56
|
+
- **Today's date.** Cursor's user info states "Today's date" in every chat (`context-paths.jsonl`). Pi's system prompt has no date, so `pstack_host` now states it in the same form.
|
|
57
|
+
- **Long commands.** Cursor's `Shell` moves a command to the background after its 30-second foreground window. Pi's `bash` waits until the command ends, so the host section sends watchers, polling scripts, and servers to `bash_background`.
|
|
58
|
+
- **Text.** The architect runner prompt is upstream's again, and arena drops a port-assignment sentence and a `cloud` instruction that no host difference required. Arena keeps upstream's `composer-*`/`cursor-grok-*` family rule.
|
|
59
|
+
|
|
60
|
+
Observed, not changed: Cursor CLI 2026.10.22 does not load plugin rules (team-kit's two always-applied rules) or name an agent store or Projects in its context (`context-paths.jsonl`); pi-pstack keeps both, because pstack's text relies on them.
|
|
61
|
+
|
|
62
|
+
## Reconstruction repairs in 0.15.36-pi.13
|
|
63
|
+
|
|
64
|
+
The repository's `parity/pstack-reconstruction-2026-11-04/` holds the reference inventory, baseline and treatment receipts, and decision log. These repairs do not establish that every workflow has been observed on both hosts.
|
|
65
|
+
|
|
66
|
+
The pre-bump PR-preparation run, `pr-make-verify.txt`, exits at pi-pstack's coverage suite with 680 passing tests and five failing positive readonly-shell checks. Lint, typecheck, mechanisms, toolchain, and test conventions pass before that stop. No later package result is inferred. `pr-preparation.md` records the focused checks, local review, and publication redactions.
|
|
67
|
+
|
|
68
|
+
The later [Linux CI run at `83cf4d9b`](https://github.com/just-joshn/pi-customizations/actions/runs/41885522222/job/126768816594) passes all 685 package tests and 367 statechart tests on Ubuntu 24.04. This includes successful restricted commands and the host Unix-socket regression. The workflow pins Ubuntu 24.04 after `ubuntu-latest` selected Ubuntu 26.04 and the helper refused nested namespace setup. The sandbox policy and assertions are unchanged. This result does not resolve startup on Ubuntu 26.04 or replace the failed local full-repository receipt.
|
|
69
|
+
|
|
70
|
+
- Leading word intervals such as `/loop every 10 minutes check CI` set the cadence instead of becoming part of the submitted prompt. Interval extraction preserves internal newlines.
|
|
71
|
+
- Different loop prompts run independently. Each `Loop` result includes an ID in text and details. With several loops running, `loop_id` selects a wake, stop, or replacement, and `/loop stop <id>` selects a command-line stop. Re-arming the same prompt replaces its schedule. Real Pi RPC regressions observe both prompts repeating and one continuing after the other stops.
|
|
72
|
+
- Leaving a planning branch restores the pre-plan tools when Pi has no recorded system-message tool loadout to replay. Both the recorded and unrecorded cases run through real Pi tree navigation.
|
|
73
|
+
- `CreatePlan` preserves todo dependencies, `is_project`, and project phases in the plan file. Building loads unfinished root todos from that file, including review edits. Imported lists survive a Pi restart. Worktree builders import their own lists before their first model request and restore the plan association on resume. Writable `TodoWrite` updates synchronize matching root statuses while preserving quotes, comments, custom metadata, and the plan body. Readonly resumes update only the session list. `plan-worker-baseline.txt` and `plan-worker-treatment.txt` record the actual Pi RPC regression.
|
|
74
|
+
- A reviewed todo without a status imports as pending and now records later completion in the saved file. The synchronizer inserts only the missing field. Unit regressions cover block and flow mappings, trailing commas, and CRLF. An actual Pi RPC regression covers the same edit. `plan-missing-status-baseline.txt` and `plan-missing-status-treatment.txt` retain the failing and passing cases.
|
|
75
|
+
- Task stale-lock recovery uses the same token-directory lease as subscription ownership. A two-process regression forces the former check-to-remove race and observes one owner after the repair. Task status also treats an unreaped Linux zombie as exited rather than blocking recovery indefinitely. Older versions without the lease do not participate in this protection.
|
|
76
|
+
- `pr-review-canvas` names the system browser and `control-ui` instead of assuming Cursor's in-app browser. This is an instruction translation, not evidence that a real model completed a canvas review.
|
|
77
|
+
- A readonly Pi child reached a disposable Unix socket and caused its unsandboxed server to modify a file. The shell now keeps Unix sockets blocked and refuses a missing seccomp helper. The Linux host used for this audit refuses the helper's nested namespace setup, so the treatment proves failure-closed behavior, not successful restricted command execution. `readonly-boundary-baseline.txt`, `readonly-boundary-treatment.txt`, and `package-suite-readonly-strict.txt` retain the evidence. The latter has 675 passing tests and five failing positive shell checks. The earlier full repository pass predates this safety change.
|
|
78
|
+
- A fake Slack token remained readable in a readonly child's inherited environment. Benny's instructions now require separate credential isolation rather than inferring it from readonly tools. Setup stops without that proof, and operational runs keep analysis and code work in the coordinator. This instruction repair is not a live Slack integration test.
|
|
79
|
+
|
|
48
80
|
## Repairs in 0.15.36-pi.12
|
|
49
81
|
|
|
50
82
|
A fresh reverse engineering of Cursor CLI 2026.10.22 with pstack and cursor-team-kit loaded found these differences. The repository's `parity/pi-pstack-behavior-parity/` holds the findings, the decision trail, and `probe-cursor.sh`, which reruns every Cursor probe. Each change has a test that failed on the earlier code.
|
|
@@ -101,9 +133,10 @@ These are not closed by extension code.
|
|
|
101
133
|
- **Background workers stop when the chat exits.** A Pi subagent is a child process of the chat, so quitting or shutting the session stops the agents it started and reports how many. Whether a Cursor background subagent outlives its parent is unobserved; the CLI changelog says cancelling the prompt stops its subagents, and only the cloud-agent product promises work after the laptop closes. A `new_session` subscription fire is Pi's one detached path, and it starts a fresh run rather than continuing a subagent.
|
|
102
134
|
- **A mode's skill rides the system prompt.** Cursor attaches the skill to the user message that enters the mode and keeps it durable in the conversation; its notices travel in user-message fields. Pi carries the skill and the notices in system-prompt sections, which reach the model on every request and survive compaction, so the model sees the same text in a different place.
|
|
103
135
|
- **A fork needs an idle source.** Cursor exposes `fork` only on its internal and cloud-agent protos, never on the CLI Task schema, and no doc states whether a fork may start while the source runs. A Pi fork runs in the source's directory or worktree, so a running source is refused; the orchestrate playbook says to wait for its completion notification.
|
|
136
|
+
- **A subagent's background shells end with it.** Cursor runs a subagent inside the parent process, so a background shell it starts outlives the subagent's Task result and its notification reaches the parent (`subagent-bg-shell.jsonl`, status `aborted`). A Pi subagent is its own process, so its jobs stop when it finishes, and its launch result says so.
|
|
137
|
+
- **Linux readonly shells need bubblewrap.** The policy blocks host Unix sockets as well as IP traffic and filesystem writes. bubblewrap must be able to create its user namespace (Ubuntu's `bwrap` AppArmor profile allows it); where it cannot, or on an architecture other than x86-64 or arm64, the command does not run. Readonly also does not isolate environment credentials or files readable through the ordinary read tools.
|
|
104
138
|
- **Plan mode's restriction is stricter than the host's.** Cursor's plan mode keeps every tool and restricts by instruction: edit only markdown files, run only read-only commands. Pi enforces the same rules with a tool allowlist, markdown-only `edit` and `write`, and a sandboxed shell that also denies network, so `gh`, `curl`, and package queries can fail while planning. Allowing network in a read-only shell would also open a path for remote changes, so the sandbox keeps it closed.
|
|
105
139
|
- **The plan review is a dialog, not a card.** Cursor renders the plan with a build menu. Pi shows the same three choices in a select dialog after the run that saved the plan, and "build in cloud" starts a background isolated worktree worker, Pi's counterpart to a cloud agent, rather than a remote VM.
|
|
106
|
-
- **One loop at a time.** Cursor's local `/loop` runs one shell loop per purpose, so several can run at once. pi-pstack runs one loop per session; a new `/loop` or `Loop` call replaces the running one. pstack's playbooks arm one audit loop at a time.
|
|
107
140
|
- **benny's default cadence still needs its owning session open.** `wake_self` timers and webhook routines park while the owner is offline. A timer or webhook routine created with `sessionStrategy: "new_session"` runs detached with no chat open, but a detached run is one-shot: it must do the work in that run, because a background `Task` ends with it. Cursor automations run in the cloud and can hand work to anything. So benny keeps `wake_self` by default and setup names the tradeoff before switching.
|
|
108
141
|
- **A routines listener is local, one port per workspace.** Cursor hosts each routine URL. Pi binds a loopback port per workspace, so two workspaces serve routines at once only because the default port falls back to an ephemeral one that the workspace then reuses and reports. A sender outside the machine still needs its own forwarding path.
|
|
109
142
|
- **Cloud execution is local.** Cursor documents cloud VMs for its cloud product, but the inspected CLI schema omits `environment` and a requested cloud Task ran on the same machine and directory. Pi's `environment: "cloud"` goes further with a git worktree and a separate local process. Neither runs with the laptop off or provides a remote VM.
|
|
@@ -114,11 +147,22 @@ These are not closed by extension code.
|
|
|
114
147
|
- **Hosted guidance and pages are outside the package.** MCP providers, ticket trackers, browsers, simulators, and Tailscale remain the user's own dependencies, as they are for Cursor.
|
|
115
148
|
- **Background usage cannot enter parent totals.** Pi exposes no API that adds a later notification's usage to the parent session. It stays in the notification details and the child transcript.
|
|
116
149
|
|
|
150
|
+
## Session probes on 2026-11-04 (continuation)
|
|
151
|
+
|
|
152
|
+
These observations update earlier open notes. They do not make the package VERIFIED.
|
|
153
|
+
|
|
154
|
+
- Cursor's live `TodoWrite` accepted a one-item write even though the published schema sets `minItems: 2` and requires `content` and `status` on every item. Pi keeps `minItems: 1` and status-only merges, which matches that runtime behavior. Evidence: this session's `CallDynamicTool` one-item call, plus `test/e2e/todo.e2e.test.ts` merge updates.
|
|
155
|
+
- On this Linux host, `kernel.apparmor_restrict_unprivileged_userns=1`. Socket-restricted sandbox commands fail in `apply-seccomp` while writing `/proc/self/setgroups`. The same sandbox with `allowAllUnixSockets: true` runs under bubblewrap and denies writes. Docker and passwordless sudo were unavailable here, so the positive restricted path remains a host blocker. CI on Ubuntu 24.04 still owns that green path.
|
|
156
|
+
- Benny operational skills now resolve `SOURCE_THREAD_TS` from `thread_ts`, then `message_ts`, then `ts`, so the documented webhook payload works when `thread_ts` is empty. Upstream Cursor skills still name only `trigger.ts`. Completeness audit: `parity/pstack-reconstruction-2026-11-04/session-2026-11-04T19-completeness.json`.
|
|
157
|
+
- The sibling `cursor-sdk` plugin remains out of scope. No pstack skill or agent references it.
|
|
158
|
+
|
|
117
159
|
## Open evidence
|
|
118
160
|
|
|
119
161
|
The following were not observed end to end and are not claimed.
|
|
120
162
|
|
|
121
163
|
- A real model following every ported skill on both hosts.
|
|
164
|
+
- Cursor's project-phase execution UI and per-phase build behavior. Pi preserves phase metadata but does not reproduce that UI.
|
|
165
|
+
- Hosted cloud plan execution's full todo lifecycle and simultaneous independent builders updating one plan. Native worktree startup, resume, dependency retention, writable status synchronization, and readonly non-synchronization have actual Pi RPC evidence.
|
|
122
166
|
- Authenticated MCP exchanges and provider-specific tool behavior.
|
|
123
167
|
- A successful live Cursor run for each workflow after the reference capture.
|
|
124
168
|
- Reboot survival through a real launchd or systemd unit on both platforms.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justjoshn/pi-pstack",
|
|
3
|
-
"version": "0.15.36-pi.
|
|
3
|
+
"version": "0.15.36-pi.14",
|
|
4
4
|
"description": "pstack 0.15.36 for Pi with its soft-dependency team-kit skills vendored in: rigorous agent workflows and principles as Pi skills, with the host features they use: subagents, todos, modes, plan mode, the model rule, /loop, subscriptions and routines, AskQuestion, SwitchMode, image generation, and visualize",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
"live:e2e": "node scripts/live-e2e.mjs"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@anthropic-ai/sandbox-runtime": "0.0.79"
|
|
67
|
+
"@anthropic-ai/sandbox-runtime": "0.0.79",
|
|
68
|
+
"yaml": "2.9.0"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
71
|
"@earendil-works/pi-ai": "*",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Architect runner prompt
|
|
2
2
|
|
|
3
|
-
The orchestrator passes this file through to every parallel candidate runner during Phase B and fills in the variable inputs around it: the task, the Phase A grounding artifacts, the isolated working directory, and the path to write outputs. The working directory is a git worktree when available, otherwise a per-runner subdirectory under the sketch dir. What matters is independence between candidates.
|
|
3
|
+
The orchestrator passes this file through to every parallel candidate runner during Phase B and fills in the variable inputs around it: the task, the Phase A grounding artifacts, the isolated working directory, and the path to write outputs. The working directory is a git worktree when available, otherwise a per-runner subdirectory under the sketch dir. What matters is independence between candidates.
|
|
4
4
|
|
|
5
5
|
You are producing one candidate design in architect's parallel exploration. Read the **architect** skill in full first. That's the workflow you're inside. Output a candidate design package: type sketch, function signatures, module map, and prose rationale shaped per [`rationale-template.md`](rationale-template.md).
|
|
6
6
|
|
package/skills/arena/SKILL.md
CHANGED
|
@@ -14,12 +14,12 @@ Every candidate gets the same prompt, so the prompt is the contract.
|
|
|
14
14
|
|
|
15
15
|
1. State the artifact each candidate is producing.
|
|
16
16
|
2. Derive the rubric, 3-6 concrete gradeable criteria for what success looks like on *this* task. It is the picker's tool in Phase D. Candidates only see the task.
|
|
17
|
-
3. Pick the runners. Use the `arena runners` line in the model rule at the path the system prompt names. If the rule or that line is missing, default to one each on `claude-opus-5-5:xhigh` and `grok-4.7[effort=xhigh,fast=true]`. An `auto` or `inherit-parent` entry in this line means the parent model, so omit `model` for it. If the Task tool rejects a configured entry, run that seat on its family's default and say so. Families go by the model id after the provider: `claude-*` and `
|
|
18
|
-
4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill.
|
|
17
|
+
3. Pick the runners. Use the `arena runners` line in the model rule at the path the system prompt names. If the rule or that line is missing, default to one each on `claude-opus-5-5:xhigh` and `grok-4.7[effort=xhigh,fast=true]`. An `auto` or `inherit-parent` entry in this line means the parent model, so omit `model` for it. If the Task tool rejects a configured entry, run that seat on its family's default and say so. Families go by the model id after the provider, by prefix: `claude-*`, and `grok-*` with `cursor-grok-*` and `composer-*`. A refused `composer-*` entry runs on `grok-4.7[effort=xhigh,fast=true]`. If the family has no default, or the Task tool rejects that default, use the closest valid slug of the same family from its error message, or drop the seat and say so when there is none. If dropped seats leave fewer than two runners, add runners until there are two, or one when the line has one entry. Run each added runner on a remaining runner's model, or omit `model` so it runs on the parent model when none remain, and say so. Spawn more runners when the arena covers multiple design directions. Use the same model N times when the work is generation-bound rather than judgment-sensitive. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
|
|
18
|
+
4. Give each candidate its own output location (a git worktree where possible, otherwise `/tmp/arena-<slug>/candidate-<n>/`), per the **separate-before-serializing-shared-state** principle skill.
|
|
19
19
|
|
|
20
20
|
## Phase B: Fan out
|
|
21
21
|
|
|
22
|
-
Spawn all N subagents in one message with `run_in_background: true`, each with the task, the path to the shared grounding, its own output path, and instructions to produce the artifact and a short rationale naming the alternatives it considered and what it rejected.
|
|
22
|
+
Spawn all N subagents in one message with `run_in_background: true`, each with the task, the path to the shared grounding, its own output path, and instructions to produce the artifact and a short rationale naming the alternatives it considered and what it rejected.
|
|
23
23
|
|
|
24
24
|
If a candidate produces no output, proceed with N-1 and note the dropout.
|
|
25
25
|
|
|
@@ -157,7 +157,7 @@ Since renderer.js loads in `<head>`, you can also call `renderDiff(target, lines
|
|
|
157
157
|
```bash
|
|
158
158
|
cd /tmp && python3 -m http.server 8432 --bind 127.0.0.1
|
|
159
159
|
```
|
|
160
|
-
Run this backgrounded
|
|
160
|
+
Run this backgrounded. Open `http://127.0.0.1:8432/pr-review-{number}.html` in the system browser with `xdg-open` on Linux or `open` on macOS. Pi has no in-app browser. For automated inspection, use the `control-ui` skill and a local browser harness. If no graphical browser is available, report that limit and give the URL.
|
|
161
161
|
|
|
162
162
|
**Why a fixed port and `cd /tmp`:** Background shells have no TTY, so Python buffers its startup message ("Serving HTTP on...") indefinitely — using port 0 means you can never read which port was chosen. And `--directory /tmp` works but `cd /tmp` is more robust across Python versions. If port 8432 is taken, try 8433, 8434, etc.
|
|
163
163
|
|
|
@@ -454,7 +454,16 @@ for (const signal of ["SIGINT", "SIGTERM"] satisfies NodeJS.Signals[]) {
|
|
|
454
454
|
signalWhile(signal, () => ({
|
|
455
455
|
dir: gridCase(150),
|
|
456
456
|
reached: (parent) => {
|
|
457
|
-
|
|
457
|
+
// The command creates and replaces draft trees while it writes. A recursive
|
|
458
|
+
// readdir can see a draft entry that is gone before Node descends into it.
|
|
459
|
+
let files: string[];
|
|
460
|
+
try {
|
|
461
|
+
files = fs.readdirSync(parent, { recursive: true, encoding: "utf8" });
|
|
462
|
+
} catch (error) {
|
|
463
|
+
if ((error as NodeJS.ErrnoException).code === "ENOENT") return false;
|
|
464
|
+
throw error;
|
|
465
|
+
}
|
|
466
|
+
for (const f of files)
|
|
458
467
|
if (
|
|
459
468
|
path.basename(f) === "chart.mmd" &&
|
|
460
469
|
fs.statSync(path.join(parent, f), { throwIfNoEntry: false })?.size
|
package/src/ask.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext } from '@earendil-works/pi-coding-agent';
|
|
2
2
|
import { type Static, Type } from 'typebox';
|
|
3
|
+
import { childIdentity } from './child-env.ts';
|
|
3
4
|
import { canAsk } from './modes.ts';
|
|
4
5
|
|
|
5
6
|
export const DONE_LABEL = '✓ Done selecting';
|
|
@@ -122,6 +123,8 @@ export function registerAskQuestion(pi: ExtensionAPI): void {
|
|
|
122
123
|
parameters: AskParams,
|
|
123
124
|
exposure: 'model-only',
|
|
124
125
|
executionMode: 'sequential',
|
|
126
|
+
// Cursor's subagents have no AskQuestion: their owner, not a person, reads what they produce.
|
|
127
|
+
defaultActive: childIdentity.depth === 0,
|
|
125
128
|
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
126
129
|
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
127
130
|
validateQuestions(params.questions);
|