Setup pstack
Write ~/.zcode/pstack/models.md, a data file that sets pstack's model per role. Skills read it at spawn time; with no file, every role runs on the session model.
Steps
1. Detect available models
Enumerate the model ids you can pin for a subagent, as providerId/modelId. That is the dependable source: query the model catalog tool first, and record each model's reasoning levels when it lists them. When no catalog is available, read the actually-configured providers: ~/.zcode/v2/provider_config.json. Each provider rule with access credentials contributes its personalModelIds plus the builtinModelIds of its templateId's template in ZCode's bundled provider config, resources/config/provider/zcode-builtin.json next to the ZCode install. modelOrder sorts members without adding any. account: provider rules in the bundled file contribute their builtinModelIds when their credentials are present. A model rule marking enabled: false removes a model. Deduplicate by providerId/modelId. When no catalog is available, or it lists no levels for a model, read that model's levels from the rule overlay. The rules fold in the order modelRules, modelApiRules, providerSiteRules, templateModelRules, builtinProviderModelRules, then the personal config's providerModelRules and manualProviderModelRules under config.modelConfigRules. A later matching rule replaces an earlier one's values. The level list's last entry is both the highest and the default. Never read ~/.zcode/v2/model-providers.json or ~/.zcode/v2/config.json: both are legacy files that nothing in current ZCode reads, so they cannot tell you what runs. Never quote an API key, including the nested access.apiKey and options.apiKey fields. When neither source yields models, ask the user to paste the model ids they have access to. Never write a real model id you have not confirmed is available. The alias inherit-parent is always valid even though it is not a detected model.
Tag every detected model with a family, judged from the model id first — one provider can host two families — and from the provider id only when the model id yields none.
2. Load current state
The default role-to-model mapping is the rule shape shown in step 5 below. If ~/.zcode/pstack/models.md already exists, read it and treat its # budget line and its role values as the current choices. Otherwise start from those defaults. A line whose role is not in step 5, such as how explorer or why investigators, is from a retired role. Drop it.
A models file without the # defaults: 2 line comes from an older setup. That setup wrote a line for every role, so some of its values are old defaults, not choices.
- An old model in
feature, refactoring,bug-fix,perf-issue,hillclimb,reflect tooling, orswarm workerstakes the role's step 5 default. - In a panel role (
arena runners,arena cross-judge pool,architect runners,interrogate reviewers), a list of exactly one the session model entry and one old model, in either order, takes the role's step 5 list. In any other list, each old model becomes the session model.
Every other value is the user's choice and stays, including an old model in any other role and every inherit-parent value. Tell the user which values you replaced.
3. Budget, map, and confirm
(a) Ask for a budget. Prefer AskUserQuestion over free text. Offer these four options with these exact labels, and name the current budget when the file records one. With no file, say that large is the default budget.
unlimited — max reasoninglarge — xhigh reasoningmedium — high reasoningsmall — medium reasoning
(b) Apply it. Build the working table from the skill defaults, and on a re-run keep any role you changed by family, list, or alias (inherit-parent, auto). Families are the ones Phase A of the pstack-arena skill defines, so Fable is its own family. Each role has a target effort, which is its default's effort moved by the budget. large keeps it, unlimited raises it one step, medium lowers it one step, and small lowers it two steps, on the ladder max > xhigh > high > medium > low. A target at either end of the ladder stays there. Most defaults are at xhigh, and each budget label names where those land. Set the effort token of every real model in the role, panel entries included, to the role's target. The effort token is the last token, or the one before a trailing fast. If the result is not a detected model, use the same family's detected model with the highest effort at or below the target, else mark the role as needing a choice. inherit-parent and auto do not change. So unlimited turns the session model into the session model and the session model into the session model, and it keeps the session model. Gemini tops out at high, so under unlimited the fallback keeps the session model as it is. small turns the first two into the session model and the session model. Fable 5.2 and Gemini have no a lower reasoning levell, so never write one.
(c) Show the roles and confirm. Show every role with its model, marking any real model not in the detected set as needing a choice. Also list each line step 2 dropped. Ask whether to accept as-is or change specific roles, offering the detected models plus inherit-parent and auto (both mean: this role runs on the parent chat model, which is how Auto users stay on Auto) as the options. Prefer AskUserQuestion 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 pool is also a list, but Arena runs one judge. It tries only values from a vendor other than the parent's, in list order, so order it by preference. Fable and the other Claude models are one vendor. An inherit-parent value never judges. swarm workers is the default model for every worker unless a race or comparison assigns another model per arm.
4. Validate
Every real model id written must be in the detected set. inherit-parent always passes. If a chosen model id is not available, stop and ask again.
5. Write the file and the presets
Write ~/.zcode/pstack/models.md with alwaysApply: true, the # defaults: 2 line, a # budget line with the chosen label and the effort that label names, and one line per role, using the same labels poteto-mode uses. Overwrite the whole file so re-runs stay idempotent. Shape:
---
description: pstack per-role model choices (overrides skill defaults)
alwaysApply: true
---
# pstack model configuration. One line per role. Delete a line to fall back to the skill default.
# `inherit-parent` as a value: the role runs on the parent chat model (omit Task `model`). Alias entries in a panel list still count toward its fan-out.
# defaults: 2
# budget: large (xhigh)
feature, refactoring: inherit-parent
bug-fix: inherit-parent
perf-issue: inherit-parent
hillclimb: inherit-parent
judgment and prose: inherit-parent
hardest tasks: inherit-parent
reflect tooling: inherit-parent
reflect judgment, divergent, synthesizer: inherit-parent
arena runners: inherit-parent
arena cross-judge pool: inherit-parent
swarm workers: inherit-parent
architect runners: inherit-parent
interrogate reviewers: inherit-parent, inherit-parent, inherit-parent
Then generate a preset agent file ~/.zcode/agents/pstack-<role>.md for every role pinned to a real model except the panel roles, whose lists name models directly. The preset name is pstack- plus the role line lowercased, spaces and commas as hyphens (reflect judgment, divergent, synthesizer → pstack-reflect-judgment-divergent-synthesizer). Give it the model in model and, when the model has levels, its level in thoughtLevel, and the body of pstack's agents/poteto-agent.md verbatim with the preset name in name. Delete any preset whose role is no longer pinned. Preset files apply to new sessions.
6. Refresh saved panel workflows
The panel skills save global workflows — ~/.zcode/workflows/pstack-arena.dwf.ts, pstack-swarm.dwf.ts, pstack-interrogate.dwf.ts — and a saved script pins the model table of the run that saved it: the workflow compiler rejects runtime-string model pins, so a models.md change strands the saved copies on the old panel. After writing models.md, detect and refresh them.
Read each of the three files that exists; a name with no file was never saved, and saving stays the user's decision. Detection is grep and a set comparison on the file text — load nothing yet. Each workflow serves rows of the file just written: pstack-arena serves arena runners, arena cross-judge pool, and architect runners (architect re-runs the arena workflow on its own runners line); pstack-swarm serves swarm workers; pstack-interrogate serves interrogate reviewers. Normalize each row entry to the saved literal's spelling: providerId/modelId@<level> becomes providerId/modelId$<level>, inherit-parent stays an alias. A file is fresh when its embedded evidence matches the rows it serves:
- Every served row
inherit-parent— fresh iff the file carries the inherit-only guard (a runtimethrowon any non-inherit-parententry) and nomodel("...")ormodel: "..."literal. - A served row pins a real model — fresh iff the file's set of
model("...")andmodel: "..."literals equals the normalized set of real models in the served rows.
Regenerate each stale file: load the dynamic-workflows skill (SaveWorkflow refuses until it is loaded in the session), rebuild the script per the owning panel skill's save section, and save under the same name, global scope — a same-name save replaces. Each overwrite asks the user, as any save does. If SaveWorkflow is refused with the skill-gate error (a mid-session compaction can close it), reload the dynamic-workflows skill and retry once. A save still refused — headless with no one to confirm — leaves that workflow stale: report it and continue.
7. Confirm
Tell the user the file was written and that skills read it at spawn time, and that new preset agent files apply to new sessions. Re-running this skill updates both. Also name each saved panel workflow as detected fresh, regenerated, or left stale by a refused save.
8. 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 /pstack-create-verification-skill." On yes, invoke /pstack-create-verification-skill (resolves wherever pstack is installed: workspace, user, or plugin). On no, move on without pushing.
9. 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 /pstack-create-formal-verification-skill." On yes, invoke /pstack-create-formal-verification-skill (resolves wherever pstack is installed: workspace, user, or plugin). On no, move on without pushing.