setup-pstack
Check installed pstack personas, optionally register native agents, configure which models pstack uses per role and at what reasoning budget, and set up a repository PR template. Use for /setup-pstack, "configure pstack models", "pstack budget", "set up pstack PR templates", or changing pstack's model choices.
How do I install this agent skill?
npx skills add https://github.com/mdsmithaustin/pstack --skill setup-pstackIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill configures the pstack environment by managing model mappings and PR templates. It requires privileges to read and modify platform-level settings files and execute local scripts, so ensure you trust the pstack harness.
- Socketpass
No alerts
- Snykwarn
Risk: MEDIUM · 1 issue
What does this agent skill do?
Setup pstack
For a request scoped to PR templates, run step 0e only. A full setup runs all applicable steps below.
Write the pstack models config, a file that sets pstack's model and reasoning effort per role. It overrides the shipped defaults in examples/pstack-models.md, and agents resolve it per role with this skill's resolver.
The grammar, alias translation, harness sections, layering, and effort policy are defined once, in references/models-config.md, and scripts/check-models-config.py --resolve applies them.
Steps
0. Check the runtimes
pstack's bundled scripts run on python3 3.9 or newer, bun, node, and gh. Run:
bash "<this skill's base directory>/scripts/check-runtimes.sh"
Failure signal: exit 1, which means python3 is missing, does not run, or is older than 3.9. So stop and tell the user to install it before the steps below. A missing bun, node, or gh exits 0. Relay each missing line and continue. Install nothing yourself.
0a. Check personas and optional native registration
Read the registration reference in full. Resolve its logical installed skills root through portable-paths.md, then run:
python3 "${PSTACK_SKILLS_ROOT:?}/pstack-harness/scripts/subagents.py" check
Failure signal: nonzero exit. Repair missing payloads or sibling skills before reporting persona readiness. A ready payload lets a generic delegate receive the full persona without native registration.
That check covers payloads only, and it reports every native file as not-requested. Where personas or effort agents are already registered, also run the registration reference's native check for each CLI and scope that holds a poteto-agent, comment-sicko, or pstack-effort-<level> file: ~/.claude/agents, ~/.codex/agents, or the project's .claude/agents or .codex/agents. Offer the reference's install for that CLI and scope when a row reports outdated-generated. When another row in its group reports conflict, report the conflict instead, because install writes nothing in that group. The personas form one group and the effort agents another, so a conflict in one does not block the other. A skills update does not refresh registered personas or effort agents.
Offer native registration for Claude Code or Codex when the user wants it. Use the already-authorized scope if the session provides one; otherwise ask for project or user scope once. Recommend the project scope, alone or with the user scope, when the user runs Codex through a wrapper that gives it its own CODEX_HOME, per the registration reference. Run the reference's install command with the chosen absolute root. Never overwrite a conflict or change model settings to register a persona. For Hermes, use the full briefing through delegation context; do not create native agent files. Grok Build has no registration of its own. It loads the Claude Code wrappers, but its spawn tool cannot name an agent type, so its delegates get the full briefing in the prompt.
For Claude Code, say what registration adds: the two personas and the five pstack-effort-<level> agents, which carry a written @effort to subagents when the spawn tool has no effort parameter, as before Claude Code 2.1.292. Before a Claude Code install, read both config layers as step 2 does and list every role whose effort is written for this harness, with that effort. Say those roles run at it when the spawn tool takes effort or once the agents load. Say a role that neither config layer binds takes the effort that the shipped ## claude-code section writes for it, medium, high, or xhigh. Say a role that a flat line binds with no effort gets the effort policy's floor, medium or high.
- Report the
rolesrows and theeffortsrows separately from live loading. When the install report saysagents_directory: created, the agents load only in a fresh session, so tell the user to start one. Otherwise a running session picks them up, unless it was started with--disable-slash-commandsor the directory came from--add-dir. In every case check the live catalog before claiming an effort applies.
Report payload readiness, native-file status, and live agent loading separately. Check the requested destination and inspect the live agent catalog before claiming native availability. Filesystem output always leaves activation unverified. Codex project registrations require project trust. Do not edit trust settings automatically. Check a fresh session after registration changes; when a loader requires a restart, say so and use full-brief delegation until loading is confirmed. Keep these observations separate from the model choices below.
0b. Check the structured task tools
poteto-mode keeps its worklist in the harness's structured task tool when that tool is on. Whichever CLI runs this skill, check both switches below and report each as on or off. A change applies from the next session. Edit a file only after the user says yes. Then add the key to the existing file and keep every other key.
- Claude Code has the task tools on every model when
CLAUDE_CODE_ENABLE_TODO_TOOLSis1in the environment or in theenvblock of~/.claude/settings.json,.claude/settings.json, or.claude/settings.local.json, or when a launch names one of the task tools in--allowedTools. When the switch is off, recommend"env": {"CLAUDE_CODE_ENABLE_TODO_TOOLS": "1"}in~/.claude/settings.jsonfor every project or in.claude/settings.local.jsonfor this one, and say that asettings.local.jsoncreated by hand needs a.gitignoreline. Also say that with tool search on, the default, the task tools arrive deferred, and Sonnet then kept no worklist in 4 of 4/poteto-moderuns against one task per playbook step in 2 of 2 runs withENABLE_TOOL_SEARCH=false. That setting raised a trivial first turn from 25,770 to 45,907 input tokens on 2.1.284 in 2026-09, so leave the choice to the user. - Codex has the plan tool when
config.tomlunder$CODEX_HOMEor~/.codex/holds[tools.update_plan]followed byenabled = true. Codex's published config reference omits the key, and its shippedcodex-rs/core/config.schema.jsondefines it withenableddefaulting to false, as of 0.158.0-alpha.2.1. When the switch is off, recommend those two lines. Codex rejects a bareupdate_plan = true. - Hermes has no known switch. Report nothing to change.
- Grok Build ships its
todo_writetool with no known switch. Report nothing to change.
0c. Check the Claude Code skill listing
Run this check whenever the user runs pstack on Claude Code. Codex keeps some pstack skills from implicit invocation through agents/openai.yaml, and Claude Code ignores that file. Without an override those skills list with their full descriptions and load from them. With "skillOverrides": {"<skill>": "name-only"} in ~/.claude/settings.json, Claude Code lists each by bare name. The skill then loads when the user types /name or a pstack skill tells the agent to use it, and never from its description.
Resolve the installed skills root as step 0a does, then run:
python3 "${PSTACK_SKILLS_ROOT:?}/setup-pstack/scripts/skill-listing.py" check
Failure signal: exit 2. The settings file is unreadable or malformed, or the skills root is wrong. Report the stderr line and leave the file alone. Exit 1 means the listing is stale, and the JSON on stdout names the skills in missing and extra. Exit 0 means it is current. Report any kept_off skills as the user's own off choice, and say that a pstack skill that names one cannot load it. The check reads only the user file. When the project's .claude/settings.json or .claude/settings.local.json holds a skillOverrides entry for a pstack skill, report that entry too, because a project entry can override the user file.
When the listing is stale, offer install and say what it changes. Run the same command with install in place of check only after the user says yes. It sets name-only for each missing skill, replacing an on or user-invocable-only value. It deletes a name-only entry for any pstack skill outside the set, even one the user wrote. It keeps every other key and the user's off entries, and it touches only pstack's own skills, so entries for other suites' skills stay as they are. Report added, removed, and the final state, and say the change applies from the next session.
0d. Check Codex subagents
On Codex, pstack spawns roles natively through spawn_agent. When the tool is unavailable, the pstack-harness skill falls back to codex exec subprocesses, or to arms run one at a time inline, and an inline review is not independent. Run this check when this skill runs on Codex or the user also runs pstack there.
Whether a session has spawn_agent depends on more than config. As of Codex 0.160.0 it also depends on the selected model's own multi-agent setting, launch flags, spawn depth, and config layers this skill cannot read. So config can only show signals, and only a Codex session shows the answer.
The edit rules below rest on one Codex 0.167.0 probe, called the probe from here on. It ran one model whose catalog entry reads multi_agent_version: v2 and one that reads v1, with keys set in the user config. It did not cover other releases, other models, or a project's config file. So say in the report that the probe covered one v1 model and one v2 model, which shape this session's own spawn_agent shows (task_name with fork_turns, or fork_context), and whether the version is later or unknown or a key sits in a project file, because the reader cannot otherwise tell which rules the probe backs.
-
Inside a Codex session, the answer is whether
spawn_agentis callable. When the session defers tools behind a tool search, search for it before calling it missing. Count aspawn_agentin a deferredmulti_agent_v1namespace as callable, because a session that searched that namespace spawned a child through it in the probe. Confirm it from the search result or the tool's parameters, and do not spawn a child to test it, because the check should start no work. If it is missing, list the causes you cannot rule out:- a config key
- a
-cflag the session started with - the selected model
- spawn depth
- a config layer you cannot read
Do not pick one without evidence.
-
The config signals. Run
codex --versionandcodex features listfrom the project root, in the environment the user starts Codex in, including any wrapper'sCODEX_HOME, and report the version and themulti_agentandmulti_agent_v2rows, because the edit rules depend on them. For the edit rules below, treat an unknown version as 0.167.0, because the probe is the only evidence behind them. Then read[agents]enabledfromconfig.tomlunder$CODEX_HOMEor~/.codex/, and from the project's.codex/config.tomlwhen the project is trusted, becausecodex features listdoes not report it. Report these as signals, not as a verdict on spawning. -
An existing
multi_agent_v2setting. Look for it in those files in any form:multi_agent_v2 = falseunder[features], a top-levelfeatures.multi_agent_v2 = false, or a[features.multi_agent_v2]table withenabled = false.codex features listshows only the row, and an offer to enable it must edit that setting in place. -
When
codexis not on PATH, as when this skill runs from another CLI or from an app-bundled Codex, report the config signals as unverified. A live session's answer still stands.
For the edit rules below, on a confirmed release before 0.167.0, treat a multi_agent_v2 row absent from a successful codex features list as false, not as an unverified row, because older releases may not list it. No probe backs this rule. It only keeps the earlier offers available there, and it applies to both the agents-line repair and the older feature-key repair. A failed listing remains unverified.
A key in a file you read is a possible cause, not a proven one, because multi_agent_v2 or a layer you cannot read can override it. Offer an edit only when a Codex session confirms spawn_agent is missing, and only for a possible cause a config file shows. The one exception is the optional switch below, which repairs nothing. The agents-line repair applies on every release:
[agents]enabled = falsein a file you read, while themulti_agent_v2row readsfalseand no readable file of higher precedence sets ittrue(a trusted project's file beats the user's): offer to delete that line or set it totrue, first.- On 0.167.0 or later, or an unknown version, then name enabling
multi_agent_v2as the alternative that leaves the line in place. Say that it overrides the user's explicit disable, becausemulti_agent_v2restoredspawn_agenton both probed models with the line set. - When a readable layer overrides the key, or the rows are unverified, report the key as unverified and offer nothing.
- On 0.167.0 or later, or an unknown version, then name enabling
Apply the agents-line repair on Codex 0.160.0 as well, because there the [agents] key removes spawn_agent even while the multi_agent row reads true. The rules below apply to 0.167.0 or later and to an unknown version, the releases the probe covered:
- With
multi_agent_v2on, offer nothing for the agents key, because the key did not block spawning on either probed model whenmulti_agent_v2was on. - The optional switch. The session's
spawn_agentis the deferredmulti_agent_v1namespace, and themulti_agent_v2row readsfalse: the session confirmed the tool is callable, so nothing needs repair. Still list enablingmulti_agent_v2among the offers and begin the offer with the word Optional, even when a file you read disables it, because the probed v1 model got the directspawn_agentwithtask_nameandfork_turnsonce the flag was on. A file disablesmulti_agent_v2only when it setsmulti_agent_v2itself to false, as a boolean, a dotted key, or a table withenabled = false. Amulti_agent = falsekey is a different key and disables nothing here. When a file disablesmulti_agent_v2, begin the offer with "Optional: override your explicit disable ofmulti_agent_v2", followed by the command or file edit from the rules below, and keep that warning with the action even if the report already explains the override. Otherwise begin the offer with "Optional: enablemulti_agent_v2" and mention no override, because a warning about a disable that does not exist tells the user something false. Say only that a session that searches the deferred namespace can spawn and that the switch makesspawn_agentdirectly visible, because the probe's first pass had the v1 model miss the deferred tool when its prompt did not say to search. multi_agent = falsein a file you read: offer nothing for it, because it removedspawn_agentfrom neither probed model. When no other rule applies, name the causes you cannot rule out instead of offering an edit.
Before 0.167.0, also apply the older feature-key rule below alongside the agents-line repair, because the probe did not cover those releases:
- When both feature rows read
falseand a file you read turns the feature off, as[features]multi_agent = false, a dottedfeatures.multi_agent = false, or the legacy[features]collab = false, offer to set it totruein that file. With the key in the user config,codex features enable multi_agentfixes any of the three. - Codex's source on 2026-11-12 marks
multi_agentdeprecated beside a stablemulti_agent_v2, and the key still parses. So when that edit changes nothing, report that and offer no second edit. - When no file you read turns it off, the cause is a layer you cannot read, so name that instead of offering an edit.
Write each offer to enable multi_agent_v2 with the exact command, or the file and the edit, because a vague offer leaves the user to guess the form. Apply the override rule in the optional switch bullet above. Every hand-edit offer must name the path of the file read, using its actual $CODEX_HOME or ~/.codex/ location for user config, because a custom home changes which file the user must edit.
- Offer the command when the setting belongs in the user config, meaning the setting sits in
config.tomlunder$CODEX_HOMEor~/.codex/, or no file holds one:codex features enable multi_agent_v2, because in the probe it edited each form of the setting in place and appended the key in the file's own form, and it never wrote a second key or table, as a hand edit can. - Otherwise edit the file that holds the setting in its own form, as when a trusted project's
.codex/config.tomlholds it, because the command writes the user config, and a project file of higher precedence would still win. Edit an existing setting in place, and never add a secondmulti_agent_v2key, because Codex 0.167.0 exits 1 on the duplicate:- Change
multi_agent_v2 = falsetotrueunder[features]. - Change a top-level
features.multi_agent_v2 = falsetotrue. - Set
enabled = trueunder a[features.multi_agent_v2]table.
- Change
- When a hand edit adds the key because the file has no
multi_agent_v2setting, add it the way the file already sets its features. Under an existing[features]table, addmulti_agent_v2 = true, because a second[features]table makes Codex 0.167.0 exit 1 on a duplicate key. Beside dotted keys such asfeatures.multi_agent = false, addfeatures.multi_agent_v2 = truenext to them and above any table header, because Codex 0.167.0 fails to load a[features]table after a dottedfeatures.key, and a dotted key placed below another table's header joins that table and leaves the rowfalse. Create a[features]table only when the file sets nofeatureskey in either form.
Edit a file only after the user says yes, and keep every other key. The change applies from the next session. Without a session to confirm, report the signals and any possible causes, say spawning is unverified, and offer no edit.
0e. Set up the repository PR template
For a full setup in a Git repository, follow references/pr-template.md. Preserve existing repository templates and explicit choices. When none exists, install the bundled poteto template and, when no-mistakes is configured, select it through pr.template. Report the files changed and whether trusted-default-branch activation is pending. Skip this step outside a repository or when the request only changes models, budgets, or host settings.
1. Detect available models and efforts
Enumerate the model values your session's spawn mechanism accepts, and the reasoning-effort values it accepts per spawn (call the Skill tool with pstack-harness to find the mechanism). On Claude Code, the per-spawn efforts are every level when the spawn tool lists an effort parameter. Otherwise they are the levels whose pstack-effort-<level> agent the live catalog lists, and none when no effort agent is loaded. That is the dependable source. If your CLI also exposes a models API or command that lists the user's entitled models, such as codex debug models or grok models, prefer it for completeness. If you cannot detect any, ask the user to paste the slugs they have access to. Never write a real slug you have not confirmed is available. The aliases inherit-parent and auto are always valid even though they are not detected slugs.
2. Load current state
The default mapping is examples/pstack-models.md next to this skill. Read both config layers when they exist, the workspace .agents/pstack-models.md and then ~/.agents/pstack-models.md, including their harness sections, and treat each role's lines and the # budget line of the file being configured as the current choices. --resolve --harness <this CLI> prints what each role runs as here. Otherwise start from those defaults. Unless the user asked for a per-repo override, the user-level file is the one being configured. Preserve the trail reviewer step setting through the budget and mapping steps, per the models config grammar. Drop a role line whose role is not in examples/pstack-models.md, such as how critics.
3. Budget, map, and confirm
(a) Ask for a budget. Prefer AskQuestion over free text. Offer these five options with these exact labels, and name the current budget when the file records one. With no file, say that default keeps the shipped defaults. The first is a port addition, and the other four match upstream.
default — keep as writtenunlimited — max reasoninglarge — xhigh reasoningmedium — high reasoningsmall — medium reasoning
On Claude Code, describe default — keep as written as "the shipped Claude Code efforts stay: medium, high, or xhigh by role", and say at the ask that a budget's suffix overrides the session effort in both directions when the spawn tool takes effort or the effort agents are loaded.
(b) Apply it. Build the working table from examples/pstack-models.md, and on a re-run keep any role the user changed by model, effort, list, alias (inherit-parent, auto), or harness section. default applies no budget: every written @effort suffix stands and unsuffixed entries keep the effort policy in references/models-config.md, which on Claude Code fills medium or high. unlimited, large, medium, and small set the @effort of every real entry, panel entries and harness sections included, to max, xhigh, high, or medium, adding the suffix where none was written.
- If the lint in step 4 rejects that effort for the model, use the model's highest supported effort at or below the target.
- An entry whose model the lint cannot classify keeps its written effort, or stays unsuffixed, and step (c) names it as untouched.
- An alias with a written suffix, such as
auto@max, gets the same rewrite on its suffix, since Codex honors a suffix on an alias. A bareinherit-parentorautodoes not change. - No budget changes a model or a list length. So
smallturnsfableintofable@mediumandgpt-6-sol@maxintogpt-6-sol@medium, andunlimitedturns both back intofable@maxandgpt-6-sol@max. - On Claude Code, a written suffix applies when the spawn tool takes
effortor while the effort agents are loaded. With neither carrier, say so. The suffixes still govern Codex and Hermes reading the same file, and the Claude Code adapter says what level subagents here run at until a carrier exists.
(c) Show the roles and confirm. The file is shared across CLIs, so a value this harness cannot validate is not wrong — it is another harness's choice (it reads as inherit-parent here). The one exception is a ## claude-code value that is not an alias: the lint rejects it on every harness, so show it as an error and offer the alias it names, such as opus for claude-opus-5-5.
- Show every role with its model and effort for this harness, marking values outside the detected set as "(set for another harness — kept unless you change it)" rather than as needing a choice. On Claude Code, show a role whose model is
inherit-parentassession, and mark a written effort "(inactive until the effort agents load)" when the spawn tool takes noeffortand the live catalog lacks its agent. Also list each line step 2 dropped. - Ask whether to accept as-is or change specific roles, offering the detected models plus
inherit-parentandauto(both mean: this role runs on the parent chat model, which is how Auto users stay on Auto) as the options. Prefer AskQuestion over free text. - For panel roles (arena runners, architect runners, interrogate reviewers) the value is a list, and one subagent runs per entry, alias entries included, so the list length sets the count.
arena cross-judge poolis also a list, but Arena runs one judge. It tries only values on a model other than the parent's, from another family first and then from another capability tier, in list order, so order it by preference. Aninherit-parentorautovalue never judges.swarm workersruns every swarm worker that runs something, as the swarm skill assigns, unless a race or comparison assigns another model per arm.trail reviewerruns the show-me-your-work reviewer and every independent verdict and review, including a swarm's audit lanes.routineruns every read-only scan, parse, or watch subagent that returns a reduced finding, unless the calling skill names another role. For its scope, follow the models config reference.- For reviewer resolution and model opt-outs, follow models config rule 7. Also show the reviewer that runs when the work does.
defaultis the entry for any spawn whose skill names no role; keep itinherit-parentunless the user wants unmapped spawns on a specific model.
4. Validate
Run the lint on the file you are about to write, before writing it: python3 <this skill's directory>/scripts/check-models-config.py <file>.
- Any
error:line stops the write; fix the line and re-run. Read eachnotice:line back to the user, so an expensive tier or a Claude Code fallback is a choice. - Every newly chosen real slug must be in the detected set.
inherit-parentandautoalways pass, and preserved values from another harness are exempt. If a chosen real slug is not available, stop and ask again. - Once the lint passes, show the user what each role will run as here. For the user file, run
python3 <this skill's directory>/scripts/check-models-config.py --resolve --harness <this CLI> --user-file <file>from the project root, which also applies any workspace file there. For a per-repo override, copy the draft to<temp>/.agents/pstack-models.mdand pass--project <temp>instead, so the real user file stays underneath.
5. Write the config
The target is ~/.agents/pstack-models.md, or workspace .agents/pstack-models.md when the user asked for a per-repo override (only write roles the user actually wants pinned for this repo. A workspace flat line shadows only the user's flat lines, since a user ## <harness> section beats any flat line, so write a per-repo override under the ## <harness> section of the workspace file). A workspace file's # budget line covers only the roles written in that file. Roles that still resolve from ~/.agents/pstack-models.md keep that file's budget.
Write the file with a # budget line holding the chosen label and its target effort, and one line per role, using the same labels poteto-mode uses. Start from examples/pstack-models.md next to this skill and keep its header comments, replacing the value on its budget line. Rewrite the whole file so re-runs stay idempotent, but carry forward every existing line the user did not change — including sections and values this harness could not validate; overwriting another CLI's choices with inherit-parent is the one failure mode to avoid. Leave out the retired-role lines step 2 dropped. Put a harness-specific pick under its ## <harness> section and leave the flat lines for the other CLIs. Shape (excerpt):
# budget: default (keep as written)
feature, refactoring: sonnet
bug-fix: sonnet
## codex
feature, refactoring: gpt-6-sol@high
bug-fix: gpt-6-sol@xhigh
6. Confirm
Tell the user the config was written and that skills read it the next time they run. Re-running this skill updates it.
7. Offer a verification skill (optional)
Check whether the project has a way to drive the real app for proof (a verify-* skill, or an existing harness). If not, offer once: "want a project-local verification skill, so agents can drive the app the way a user does and prove changes work? I can generate one with /create-verification-skill." On yes, call the Skill tool with create-verification-skill. On no, move on without pushing.
8. Offer a formal verification skill (optional)
Check whether the project already has a formal verification skill (a project skill that runs a model checker, a proof, or another verifier against the code). If not, offer once: "want a formal verification skill, so agents can prove a key property of your code holds in every case in scope, not only the cases tests reach? I can generate one with /create-formal-verification-skill." On yes, call the Skill tool with create-formal-verification-skill. On no, move on without pushing.
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/mdsmithaustin/pstack/setup-pstack">View setup-pstack on skillZs</a>