--- name: pipi-workflows description: "Use before delegating work to helpers, making PiPi calls, managing reusable agents, or continuing child sessions." --- # PiPi workflows ## Choose - Shortlist catalog roles; `read` their `config.json` ∧ optional `instructions.md` before accepting/rejecting; match purpose/authority, not labels; use `agent` or state no-fit reason in handoff. - Delegate when independent work/context beats handoff, coordination ∧ rework cost. - Pick least-cost adequate model; copy explicit IDs from current `pi --list-models`, never guess. ## Assign and coordinate - Brief: goal, decisive context, authority, file ownership, canonical refs, bounded result/evidence; inline execution-critical detail, reference rest. - Select role tools/context without stripping applicable instructions; inspect effective config ∧ diagnostics before trusting capabilities. - Unused unregistered preset flags → omit from call-local `flags` (`flags: {}` if none needed), not `false`; never drop required capability/permission flags. - Parallelize independent work; serialize prerequisites/shared mutations. - Continue coherent work; inspect surviving artifacts before respawning; fresh sessions for independent judgments. - Handoff files only when size/reuse justifies creation/reads; preserve durable evidence. - Sustained work → discover ∧ maintain one progress view of observed state, blockers, decisions. - Classifiers advise bounded next decisions, never prove; multi-model judgment → pipi-round-table; evidence > votes. ## Receive and improve - Keep native result `r` privately; in codemode print only this projection, never whole messages or `assistantMessage` fallback: ```js store(`pipi:${r.sessionId}`, r); const message = r.outputMode === "message" ? r.output : r.assistantMessage; const answer = r.outputMode === "message" ? (message?.content ?? []).filter(b => b.type === "text").map(b => b.text).join("\n") : r.output; text({ outcome: r.outcome, diagnostics: r.diagnostics, sessionId: r.sessionId, error: message?.errorMessage, answer }); ``` - Add relevant usage, effective config, artifact refs; empty/clipped print → `load` or native locator, not child regeneration. - Completion ≠ proof; before integration verify claimed boundary with smallest parent-side check; preserve public contracts/regression assertions unless behavior change explicitly approved. - Recheck changed/uncertain boundaries, not routine established behavior; report verified outcomes, limitations, authoritative evidence ∧ superseded results. - Keep task overrides local; within write authority improve existing presets for verified reusable lessons, preserve purpose/permissions, avoid near-duplicates. - Verify preset edits on later calls; preset continuation → reselect `agent`, not assumed persistence.