# Adaptation guide: pstack 0.15.36 on Pi

This package preserves Lauren Tan's MIT-licensed pstack instruction bodies with additive Pi boundaries. It is **not an unqualified faithful port or a claim of runtime parity**. UPSTREAM.lock.json identifies the plugin version, exact source file/body hashes, and cache identity. A cache directory name is not asserted to be a Git revision.

There are 58 source skill directories, 58 registered Pi instruction skills, one video adaptation without a working Pi renderer, and 23 full playbook files. The former compressed playbooks.md is now an index only. Source steps are copied verbatim into the session todolist before task-specific items; boundary notes and blocked/skipped reasons stay beside them, not in place of them.

## Policy divergences

These are deliberate safety choices, not missing Cursor APIs. Source quotes are evidence of the divergence, not execution permission. Table keys also identify possible recall exceptions; the current restoration needs **no below-floor recall exemptions** because it retains the source text.

| Element | Upstream quote | Deliberate Pi behavior and reason |
|---|---|---|
| playbook:shipping | “Land bottom-up, one PR at a time.” | Only the repository owner merges. Prepare independent verdicts, patch freshness and the contiguous verified ceiling, then hand off. Merge/auto-merge/retarget/force-push steps stay owner-held, not reported passed. A broad autonomy grant does not bypass this safety stance. |
| playbook:autopilot-full | “One owner carries each PR from build to merge” | Authorized build and verification work can proceed with actual Pi routes; landing remains owner-held. Do not call the whole lifecycle complete. This is not the old blanket proposal-only ban on useful implementation. |
| playbook:opening-a-pr | “Invoked at the end of every other playbook.” / “Open every PR ready, never as a draft.” | Always reach the checklist/handoff, but publication requires its accepted destination/branch/content grant. Pi review PRs default to draft and honor the required live-Pi smoke/owner readiness gate, rather than auto-applying the source never-draft rule. No skill grants a release; git reset --hard is blocked and unrelated edits are preserved. |
| skill:poteto-mode | “Use any MCP tool. Reversible work and external actions … proceed without asking.” | Use only accepted model/data, repository and effect scope. No automatic external messages, tool discovery, provider changes or unsupported fallbacks. Restatement, routing, verbatim todo steps and evidence discipline are retained. |
| skill:setup-pstack | “Write `~/.cursor/rules/pstack-models.mdc`” | Write only the explicitly approved project-local `.pi/pstack-model-roles.v1.json`; keep exact operator-selected development/reviewer identities, preserve unknown keys, no Cursor rule or Pi-default mutation. Approved flat role panels and native reasoning budgets are supported through setup; aliases and automatic slug/effort fallback remain unsupported. Without the file, every role resolves Pi's current default at run time; setup is optional and never writes that default implicitly. Both verification offers are retained as optional, separate steps. |
| playbook:worktree-cleanup | “Prune the confirmed set.” | Audit and preserve state until the owner confirms exact integration/disposal scope. No automatic deletion, OS scratch paths or simulator/cache purge. Dirty or active state remains held. |
| playbook:pause-safely | “Commit uncommitted edits as one clear `wip:` commit” | A pause grants no Git write. A WIP commit needs the accepted commit scope; otherwise save a durable approved repo-local checkpoint. No implicit push or new PR. |
| skill:statechart | “Work in a scratch folder outside the repo.” / “The first run installs TLC and Java with mise and needs the network.” | Use approved repo-local scratch and `statechart-pi/scripts/run-tlc.mjs --check`. This Mac adapter invokes only installed tlc on PATH or an approved existing tools jar with Java; it never installs. The self-installing upstream runtime is not bundled. Missing TLC/render capability is blocked, not a verified result. Mermaid/diagrams are views only, never a TLA+ proof. |
| skill:ketchup-video | “Writing and rendering the video, outside the repo, is the one exception to its read-only rule.” | Discoverable but not executable as a Pi video route. No validated Pi slide/video-render-and-inspection route is supplied. Keep the source procedure for review, report the missing route, and use ketchup-pi text catch-up. Do not claim a video was made. |

Babysit stopping at merge-ready is aligned upstream, not a policy inversion. Autopilot-stack now means Autopilot-full without merging; only dependent PRs stack. Orchestrate uses the current short owner/fresh-worker/verifier/pilot/live-state contract, not the retired store/frontier/drain framework. Interrogate now runs adversaries via arena and reruns findings, without speculative finding buckets. Sharpen answers four questions and then rewrites the prompt.

## Capability mapping

| Source mechanism | Pi mapping | Missing capability result |
|---|---|---|
| Task, subagent types and cloud flags | `treehouse get --lease --json --base <verified-ref>`, then `agentic_herdr_spawn_worker` starts a Pi agent in a Herdr pane at that lease. Brief/report with `agentic_herdr_communication` prompt/delivery/read. | Block the specific missing tool, role or isolation requirement; never substitute CloudAgent or self-review. |
| TodoWrite | `TaskList`, `TaskCreate` with priority, and `TaskUpdate`; source steps word for word, then task-specific entries | Report unsupported task-tool operation; an approved local checklist may preserve the plan. |
| Cursor custom mode / always-on behavior | All 58 registered skills are model-discoverable; source invocation flags are intentionally omitted. Discovery does not guarantee use or missing runtime capabilities | No always-on extension or default setting change ships. Do not infer improved firing rate from text recall. |
| AskQuestion | One plain chat question or an installed structured question tool | Ask only for an irreducible preference/permission, not an observable fact. |
| Per-role models and fallback slugs | With no roles file, resolve Pi's current default at run time for every role; with a present file, use exact approved identities from setup-pstack-pi | No setup requirement for a missing file. A present malformed file or needed missing/null role is an explicit error. No parent inheritance, guessed slugs or core-role seat filling. Ordered panels, scalar swarm workers and native budget effort remain supported; capacity, diversity and configured-effort gates still apply. |
| `/loop`, background work and watchers | Bounded configured session-task exchanges through `agentic_worker_dispatch_async` submit/poll/observe/read or `agentic_worker_dispatch`; persistent wake requires a separate host event route. | No scheduler ships here. No configured wake means background watch is unsupported, not a new polling loop. |
| Browser, CLI and live verification | Approved project control surface and receipts at the actual artifact/head | Source inspection or green CI is not runtime proof. |
| Cursor transcript paths and MCP | Named active-workspace files/ranges and explicit tool/data scope | No global chat scan or automatic server discovery. |
| Upstream executable helpers and agent files | Not bundled; separately reviewed installed equivalents only | Explicit blocked helper step. Never fetch/install/run a bootstrap by implication. |
| Forge and source Origin preference | `gh repo view`, `gh pr view`, `gh pr diff`, `gh pr checks` and scoped `gh api`; approved PR delivery uses `git push` and `gh pr create`/`gh pr edit` readback | Origin is not required by this Pi mapping. No merge, auto-merge or force-push is imported. |

The three new non-video instruction ports retain code-linked properties, bounds, failure-sensitivity checks, counterexample replay and sync records. Formal verification maintenance edits verification artifacts only; current-code bugs remain findings unless a fix is separately requested. Statechart retains invariant/deadlock handling, reader-facing state/step labels, shortest bug paths, bounds and chart/report interpretation, but this package does not ship its upstream TypeScript/TLC runtime or a replacement with an unverified equivalence claim.

## Source-name and file mapping

Read skills/how/UPSTREAM_MAPPING.md and WORKFLOW_BOUNDARIES.md at the actual load location. Source skill X maps to X-pi; playbooks resolve beneath poteto-mode-pi/playbooks/. Source-relative internal references retain their layout. Upstream model defaults and command examples are visibly retained source text, **never operational Pi configuration**. Cross-skill links resolve via the mapping rather than creating duplicate unsuffixed skill directories. Supporting source prose is bundled; its executable helpers are not.

## Provenance and checks

- `node scripts/sync-upstream.mjs [local-upstream]` is read-only and defaults to the reviewed 0.15.36 Cursor cache location.
- `node scripts/restore-upstream.mjs [local-upstream]` checks deterministic restoration; `--write` explicitly regenerates the reviewed source bodies and lock. It performs no network request, install, worker dispatch or upstream mutation.
- `tests/fixtures/upstream-0.15.36.json` is the offline text baseline; it is test-only and excluded from the package. The shipped lock can be checked against an independent native source.
- `node scripts/instruction-recall.mjs` measures instruction-unit recall against that baseline: principles/playbooks >=0.8, workflow skills >=0.6. Explicit element rows in the divergence table may exempt a low recall, but exemptions are reported, not hidden. Current scores use no exemptions.
- Tests additionally require exact reconstruction of every retained skill/playbook/reference body, hash consistency, the 23 files, new contracts and manifest state. Recall alone is a diagnostic word-coverage signal, not semantic or runtime proof; exact source order plus additive-boundary review is stronger.

Concrete recipe call paths, including Shipping step 1 and Interrogate's exact reruns, are in skills/how/UPSTREAM_MAPPING.md. Pi agents in Herdr panes replace cloud workers/verifiers; leases come from Treehouse, PR state comes from gh, and source commands remain verbatim for comparison rather than serving as the executable harness path.

A discoverable skill is not proof of loading, configured roles, a live verifier, a formal proof, safe automation, or an independent review. The packaged adaptation retains native-source review as a maintenance check; it does not claim a corpus migration.

## Model selection (published package)

- Upstream source markers may still quote Cursor example slugs such as `(default …)`; those lines are historical evidence only.
- The published package ships **no** operational model defaults. Example role file uses `null` placeholders.
- Without project-local `.pi/pstack-model-roles.v1.json`, every role uses the Pi default resolved at run time. Do not stop, require setup or create a file. This is not parent inheritance or a package model default.
- Only optional `/skill:setup-pstack-pi` creates the file from operator-approved selections, starting from the null example. Setup never fills roles with the runtime default.
- A present file is honoured exactly. Malformed JSON, schema, identity, budget pair or shape is an explicit error. A needed missing/null role is also an error, with no fallback, rewriting or panel seat filling.
- Setup may record the same operator-selected identity for both roles. That does not satisfy a review step requiring a different model or family; report that step blocked without substituting another identity.
- Optional `budget: {label, effort}` and the five panel/worker role keys remain in schema v1 alongside the core roles. Four roles use ordered lists; `swarm workers` stays scalar. Existing operator files load without migration, and unknown keys remain preserved.
- Budget labels map to native reasoning effort: unlimited/max, large/xhigh, medium/high, small/medium. No label selects or rewrites a model. Store only operator-approved pairs; verify effort support before each worker starts.
- Different-family gates use verified or operator-confirmed model-family groups, not provider-name equality. A same-provider pair may satisfy the scoped gate when explicitly designated; absent family evidence blocks the gate.
- The bundled setup `scripts/model-roles.mjs` provides read-only file resolution and pure setup previews, not writing or dispatch. Only ENOENT enables its injected live Pi-default resolver; present files never call it. Setup previews its complete result and writes only after operator approval. Worker launch and native reasoning-control evidence are separate runtime checks.
