dsh-pstack 0.0.0-stage → 0.2.0-beta.1

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.
Files changed (166) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +133 -2
  3. package/assets/agents/comment-sicko.md +32 -0
  4. package/assets/agents/poteto-agent.md +8 -0
  5. package/assets/docs/guide/01-setup.md +64 -0
  6. package/assets/docs/guide/02-poteto-mode.md +139 -0
  7. package/assets/docs/guide/03-understand.md +79 -0
  8. package/assets/docs/guide/04-design.md +133 -0
  9. package/assets/docs/guide/05-build-and-clean.md +83 -0
  10. package/assets/docs/guide/06-verify-and-ship.md +152 -0
  11. package/assets/docs/guide/07-overnight.md +120 -0
  12. package/assets/docs/guide/08-principles.md +72 -0
  13. package/assets/docs/guide/09-make-it-yours.md +96 -0
  14. package/assets/docs/guide/10-recipes-and-pitfalls.md +180 -0
  15. package/assets/docs/guide/README.md +38 -0
  16. package/assets/docs/guide/images/design.jpg +0 -0
  17. package/assets/docs/guide/images/overnight.jpg +0 -0
  18. package/assets/docs/guide/images/recipes.jpg +0 -0
  19. package/assets/docs/guide/images/router.jpg +0 -0
  20. package/assets/docs/guide/images/understanding.jpg +0 -0
  21. package/assets/docs/guide/images/verification.jpg +0 -0
  22. package/assets/docs/harness/dsh.md +60 -0
  23. package/assets/docs/pstack-models.example.md +54 -0
  24. package/assets/skills/architect/SKILL.md +81 -0
  25. package/assets/skills/architect/references/design-red-flags.md +57 -0
  26. package/assets/skills/architect/references/rationale-template.md +35 -0
  27. package/assets/skills/architect/references/runner-prompt.md +20 -0
  28. package/assets/skills/arena/SKILL.md +50 -0
  29. package/assets/skills/automate-me/SKILL.md +106 -0
  30. package/assets/skills/benchmark-checklist/SKILL.md +39 -0
  31. package/assets/skills/blast-radius/SKILL.md +52 -0
  32. package/assets/skills/bro/SKILL.md +7 -0
  33. package/assets/skills/correct/SKILL.md +32 -0
  34. package/assets/skills/create-formal-verification-skill/SKILL.md +43 -0
  35. package/assets/skills/create-verification-skill/SKILL.md +46 -0
  36. package/assets/skills/create-verification-skill/references/feature-map-example/README.md +47 -0
  37. package/assets/skills/create-verification-skill/references/feature-map-example/create-note.md +39 -0
  38. package/assets/skills/create-verification-skill/references/feature-map-example/search.md +45 -0
  39. package/assets/skills/figure-it-out/SKILL.md +54 -0
  40. package/assets/skills/how/SKILL.md +38 -0
  41. package/assets/skills/how/references/explainer-prompt.md +55 -0
  42. package/assets/skills/how/references/explorer-prompt.md +35 -0
  43. package/assets/skills/in-your-own-words/SKILL.md +7 -0
  44. package/assets/skills/interrogate/SKILL.md +71 -0
  45. package/assets/skills/interrogate/references/code-quality-review.md +47 -0
  46. package/assets/skills/interrogate/references/lead-judgment.md +39 -0
  47. package/assets/skills/interrogate/references/reviewer-prompt.md +62 -0
  48. package/assets/skills/interrogate/references/rubric.md +77 -0
  49. package/assets/skills/ketchup/SKILL.md +45 -0
  50. package/assets/skills/maintain-formal-verification-skill/SKILL.md +60 -0
  51. package/assets/skills/maintain-verification-skill/SKILL.md +41 -0
  52. package/assets/skills/no-comments/SKILL.md +26 -0
  53. package/assets/skills/poteto-help/SKILL.md +162 -0
  54. package/assets/skills/poteto-help/references/prompting.md +51 -0
  55. package/assets/skills/poteto-help/references/recipes.md +51 -0
  56. package/assets/skills/poteto-mode/SKILL.md +151 -0
  57. package/assets/skills/poteto-mode/playbooks/authoring-a-skill.md +12 -0
  58. package/assets/skills/poteto-mode/playbooks/autonomous-run.md +15 -0
  59. package/assets/skills/poteto-mode/playbooks/autopilot-full.md +25 -0
  60. package/assets/skills/poteto-mode/playbooks/autopilot-stack.md +12 -0
  61. package/assets/skills/poteto-mode/playbooks/babysit.md +23 -0
  62. package/assets/skills/poteto-mode/playbooks/bug-fix.md +15 -0
  63. package/assets/skills/poteto-mode/playbooks/eval.md +25 -0
  64. package/assets/skills/poteto-mode/playbooks/feature.md +21 -0
  65. package/assets/skills/poteto-mode/playbooks/hillclimb.md +21 -0
  66. package/assets/skills/poteto-mode/playbooks/investigation.md +14 -0
  67. package/assets/skills/poteto-mode/playbooks/multi-phase-plan.md +155 -0
  68. package/assets/skills/poteto-mode/playbooks/opening-a-pr.md +34 -0
  69. package/assets/skills/poteto-mode/playbooks/orchestrate.md +112 -0
  70. package/assets/skills/poteto-mode/playbooks/pause-safely.md +10 -0
  71. package/assets/skills/poteto-mode/playbooks/perf-issue.md +25 -0
  72. package/assets/skills/poteto-mode/playbooks/prototype.md +14 -0
  73. package/assets/skills/poteto-mode/playbooks/refactoring.md +16 -0
  74. package/assets/skills/poteto-mode/playbooks/runtime-forensics.md +11 -0
  75. package/assets/skills/poteto-mode/playbooks/session-pickup.md +11 -0
  76. package/assets/skills/poteto-mode/playbooks/shipping.md +12 -0
  77. package/assets/skills/poteto-mode/playbooks/trace-forensics.md +14 -0
  78. package/assets/skills/poteto-mode/playbooks/visual-parity.md +11 -0
  79. package/assets/skills/poteto-mode/playbooks/worktree-cleanup.md +20 -0
  80. package/assets/skills/poteto-mode/references/bugbot-triage.md +142 -0
  81. package/assets/skills/poteto-mode/scripts/check-plan.mjs +220 -0
  82. package/assets/skills/poteto-mode/scripts/check-plan.test.mjs +343 -0
  83. package/assets/skills/poteto-mode/scripts/orch/orch.mjs +4282 -0
  84. package/assets/skills/poteto-mode/scripts/orch/orch.test.mjs +2042 -0
  85. package/assets/skills/poteto-mode/scripts/watch-pr/cli.test.mjs +5101 -0
  86. package/assets/skills/poteto-mode/scripts/watch-pr/github.test.mjs +1177 -0
  87. package/assets/skills/poteto-mode/scripts/watch-pr/policy.test.mjs +1441 -0
  88. package/assets/skills/poteto-mode/scripts/watch-pr/watch-pr.mjs +4601 -0
  89. package/assets/skills/poteto-mode/scripts/worktree-audit.mjs +675 -0
  90. package/assets/skills/principle-attack-the-premise/SKILL.md +21 -0
  91. package/assets/skills/principle-boundary-discipline/SKILL.md +34 -0
  92. package/assets/skills/principle-build-the-lever/SKILL.md +23 -0
  93. package/assets/skills/principle-encode-lessons-in-structure/SKILL.md +11 -0
  94. package/assets/skills/principle-exhaust-the-design-space/SKILL.md +9 -0
  95. package/assets/skills/principle-experience-first/SKILL.md +19 -0
  96. package/assets/skills/principle-explain-the-number/SKILL.md +17 -0
  97. package/assets/skills/principle-fix-root-causes/SKILL.md +21 -0
  98. package/assets/skills/principle-foundational-thinking/SKILL.md +21 -0
  99. package/assets/skills/principle-guard-the-context-window/SKILL.md +12 -0
  100. package/assets/skills/principle-laziness-protocol/SKILL.md +10 -0
  101. package/assets/skills/principle-make-operations-idempotent/SKILL.md +22 -0
  102. package/assets/skills/principle-migrate-callers-then-delete-legacy-apis/SKILL.md +14 -0
  103. package/assets/skills/principle-minimize-reader-load/SKILL.md +18 -0
  104. package/assets/skills/principle-model-the-domain/SKILL.md +24 -0
  105. package/assets/skills/principle-never-block-on-the-human/SKILL.md +15 -0
  106. package/assets/skills/principle-outcome-oriented-execution/SKILL.md +21 -0
  107. package/assets/skills/principle-prove-it-works/SKILL.md +24 -0
  108. package/assets/skills/principle-redesign-from-first-principles/SKILL.md +16 -0
  109. package/assets/skills/principle-separate-before-serializing-shared-state/SKILL.md +16 -0
  110. package/assets/skills/principle-sequence-verifiable-units/SKILL.md +17 -0
  111. package/assets/skills/principle-subtract-before-you-add/SKILL.md +18 -0
  112. package/assets/skills/principle-test-behavior-not-implementation/SKILL.md +20 -0
  113. package/assets/skills/principle-type-system-discipline/SKILL.md +13 -0
  114. package/assets/skills/recall/SKILL.md +37 -0
  115. package/assets/skills/reflect/SKILL.md +69 -0
  116. package/assets/skills/reflect/references/divergent-reviewer.md +38 -0
  117. package/assets/skills/reflect/references/judgment-reviewer.md +37 -0
  118. package/assets/skills/reflect/references/synthesizer.md +56 -0
  119. package/assets/skills/reflect/references/tooling-reviewer.md +48 -0
  120. package/assets/skills/setup-pstack/SKILL.md +67 -0
  121. package/assets/skills/sharpen/SKILL.md +16 -0
  122. package/assets/skills/show-me-your-work/SKILL.md +84 -0
  123. package/assets/skills/show-me-your-work/references/decision-log-template.tsv +1 -0
  124. package/assets/skills/show-me-your-work/scripts/log.mjs +108 -0
  125. package/assets/skills/swarm/SKILL.md +43 -0
  126. package/assets/skills/tdd/SKILL.md +42 -0
  127. package/assets/skills/teach/SKILL.md +23 -0
  128. package/assets/skills/technical-writing/SKILL.md +108 -0
  129. package/assets/skills/typescript-best-practices/SKILL.md +34 -0
  130. package/assets/skills/typescript-best-practices/references/patterns.md +328 -0
  131. package/assets/skills/unslop/SKILL.md +62 -0
  132. package/assets/skills/why/SKILL.md +100 -0
  133. package/assets/skills/why/references/epistemics.md +71 -0
  134. package/assets/skills/why/references/investigator-prompt.md +84 -0
  135. package/assets/skills/why/references/source-playbook.md +17 -0
  136. package/assets/skills/why/references/sources/code-archaeology.md +51 -0
  137. package/assets/skills/why/references/sources/databricks.md +70 -0
  138. package/assets/skills/why/references/sources/datadog.md +97 -0
  139. package/assets/skills/why/references/sources/incident-postmortem.md +5 -0
  140. package/assets/skills/why/references/sources/linear.md +48 -0
  141. package/assets/skills/why/references/sources/notion.md +55 -0
  142. package/assets/skills/why/references/sources/sentry.md +66 -0
  143. package/assets/skills/why/references/sources/slack.md +17 -0
  144. package/assets/skills/why/references/synthesizer-prompt.md +129 -0
  145. package/cordis.patch.yml +39 -0
  146. package/dist/frontmatter-BQX3ekwP.mjs +229 -0
  147. package/dist/frontmatter-BQX3ekwP.mjs.map +1 -0
  148. package/dist/history.d.mts +429 -0
  149. package/dist/history.mjs +1129 -0
  150. package/dist/history.mjs.map +1 -0
  151. package/dist/host-contract-o47JH_r8.d.mts +527 -0
  152. package/dist/index.d.mts +278 -0
  153. package/dist/index.mjs +272 -0
  154. package/dist/index.mjs.map +1 -0
  155. package/dist/paths-D_JlVmBk.mjs +42 -0
  156. package/dist/paths-D_JlVmBk.mjs.map +1 -0
  157. package/dist/script.d.mts +193 -0
  158. package/dist/script.mjs +782 -0
  159. package/dist/script.mjs.map +1 -0
  160. package/dist/subagent.d.mts +336 -0
  161. package/dist/subagent.mjs +1402 -0
  162. package/dist/subagent.mjs.map +1 -0
  163. package/locale/en.json +6 -0
  164. package/locale/zh.json +6 -0
  165. package/package.json +106 -3
  166. package/static/icon.png +0 -0
@@ -0,0 +1,25 @@
1
+ ### Eval
2
+
3
+ **You own the experiment design. Plan, blind, run, synthesize.**
4
+
5
+ **Non-negotiables for blinding:**
6
+
7
+ - No `eval`, `test`, `judge`, `experiment`, `rubric`, `score`, `compare`, `benchmark`, `candidate`, or `arena` in any directory, file, or prompt the candidate sees.
8
+ - The candidate prompt looks like an organic user request. State the goal, not the meta.
9
+ - No chain-eliciting cues. Don't ask the candidate to list which skills, principles, or files they applied. Ask for design notes generally and grade chain-following from code shape, not self-report.
10
+ - Sanitize directory and slug names. Use project-shaped names a user might pick.
11
+ - Don't tell the candidate other candidates exist.
12
+ - The judge can know it's judging but sees outputs by sanitized label only, never by model name.
13
+ - Comparing two variants: one judge scores both sets in a single pass on one scale, blind to which set each came from.
14
+
15
+ **Steps:**
16
+
17
+ 1. **Frame.** State what variant is under test and what behavior counts as success. Write the rubric (3-6 concrete criteria) for the judge only. Hold it back from candidates.
18
+ 2. **Set up sanitized environments.** Per-candidate working dir with the variant in place. Plant any context an organic task would have: a project skeleton, the skills the candidate would naturally read.
19
+ 3. **Author one organic prompt.** What a user would type. No leakage of what's being measured.
20
+ 4. **Start N parallel candidates** with `pstack_subagent`, one per configured model, following `arena` Phase B; read its `SKILL.md` at its absolute resource path. Each works in its own sanitized dir. Same prompt to each. Pick each subagent's role per the Subagents section of `poteto-mode`; read its `SKILL.md` at its absolute resource path. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
21
+ 5. **Start one blinded judge** with `pstack_subagent` on a role from a different provider or model family, following `arena` Phase C; read its `SKILL.md` at its absolute resource path. The judge sees outputs by sanitized label and the rubric, never a model name. When no other family is configured, record the route that actually ran and treat the comparison as same-model.
22
+ 6. **Verify the chain from raw events, not self-report.** Read each candidate child with `pstack_history` (`scope: "children"`, then that child's `sessionId`), paging the log and pinning `throughSeq`. Look at the `tool/call` events for the files each candidate actually opened and the tools it ran, then grade chain-following from those events plus the shape of the code, never from the candidate's own claims. A candidate whose log you cannot read is unverified on this criterion, not passing it.
23
+ 7. **Read every candidate output yourself** end to end. Compare to the judge's verdict. Disagreement means a model is biased or the rubric is ambiguous. Synthesize.
24
+
25
+ **Reply:** variant under test, rubric, per-candidate notes, judge's verdict, your synthesis, and a recommendation for whether to promote the variant.
@@ -0,0 +1,21 @@
1
+ ### Feature
2
+
3
+ **You own the design. Plan, review, verify.** Delegate implementation. Stay in the lead.
4
+
5
+ 1. Read the `how` skill's `SKILL.md` at its absolute resource path and run it over the affected subsystem.
6
+ 2. Read the `architect` skill's `SKILL.md` at its absolute resource path and run it for parallel design exploration.
7
+ 3. Write the throughput checkpoint as four `todo_write` items. A dimension that genuinely does not apply (single file, no fan-out) keeps its item with `n/a: <reason>` rather than being dropped:
8
+ - **Blocking first steps.** Gates run before fan-out.
9
+ - **Independent workstreams.** Disjoint files, services, or layers parallelize. Shared writes serialize.
10
+ - **Shared mutable state.** Default to splitting the target, as `principle-separate-before-serializing-shared-state` requires; read its `SKILL.md` at its absolute resource path. Serialize only for real invariants.
11
+ - **Smallest safe decomposition.** If one worker is best, name why.
12
+ 4. Delegate code-writing to a `pstack_subagent` child with `agent: "poteto-agent"` and `role: "feature, refactoring"`, and a specific scope: file paths, the named data shape and its organizing structure as `principle-model-the-domain` requires (read that `SKILL.md` at its absolute resource path), a state machine over scattered booleans, a table or registry over branching, a typed model over repeated shape assumptions, chosen before the delegate writes logic, plus success criteria. Read the Subagents section of the `poteto-mode` skill at its absolute resource path before the spawn. When the implementation admits multiple valid shapes (error handling, abstraction layer, test structure), read the `arena` skill's `SKILL.md` at its absolute resource path and delegate through it, so the runners surface the alternatives and the cross-judge guards the pick. Mandatory: no skip-with-reason escape, and `principle-laziness-protocol` does not override it (the gain is review separation, not lines saved). A child that cannot spawn satisfies this by owning the diff directly with the same review separation. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it. No "standing by" reply that waits on a nested agent. Comments per **Comments**. Surgical edits, re-ground against the source for upstream-derived files. Port shared-primitive improvements to all consumers and verify each. Commit liberally.
13
+ 5. Verify on the matching surface. "Inconclusive" or wrong-surface is not a pass. Flag it.
14
+ 6. Rebase into small, ordered commits. Stack follow-ups.
15
+ Apply `principle-sequence-verifiable-units`, read at its absolute resource path, building, verifying, and committing each small unit before the next.
16
+ 7. If the design is contested, read the `interrogate` skill's `SKILL.md` at its absolute resource path and run it before shipping.
17
+ 8. Read `playbooks/opening-a-pr.md` next to this file and run it.
18
+
19
+ Code-coupled work (one feature, one migration) goes to a single owner with the checkpoint inline. That owner fans out internally after the blocking phase. Parent-level fan-out is for slices that produce independent artifacts (audits, cross-subsystem investigations, competing experiments). Rewrite the checkpoint at phase boundaries. Spawn a fresh owner rather than chaining interrupts.
20
+
21
+ **Reply:** what you built, what you chose and why, the throughput checkpoint, open decisions. Tables for design alternatives.
@@ -0,0 +1,21 @@
1
+ ### Hillclimb
2
+
3
+ **You own the metric and the experiment's integrity. Supervise and review. Delegate the attempts.** For sustained, iterative improvement of one measurable thing against a target. A one-off fix is Bug fix or Perf issue. This is the loop.
4
+
5
+ Core discipline: one change, one measurement, keep or revert. Never stack untested changes, and never claim a win from code inspection (the **prove-it-works** principle skill).
6
+
7
+ 1. Ground the workload and architecture before choosing the metric. Run the **how** skill over the target, name the realistic workload dimensions that can move the result (data size, history, state, concurrency), and select a case that reproduces the user's complaint. If no case reproduces it, fix the repro instead of hillclimbing. Then fix one metric, the direction that counts as better, and a checkable stop predicate that pairs a target with a floor on attempts so a lucky early win can't end the run (the example "at least 50% better than baseline and at least 10 iterations" is this shape). Use the user's numbers when given, otherwise agree them.
8
+ 2. Build the measurement harness, prove its sensitivity, then freeze it (the **build-the-lever** principle skill). Run contrasting realistic workloads and confirm the target case reproduces the symptom while easier cases separate as expected. If the harness cannot distinguish them, revise the workload or metric. Vet the harness with the **benchmark-checklist** skill before you freeze it, and make it print its error count and a count of the work done. Once frozen, one repeatable command emits the metric, sampled enough to clear the noise (median of N, not a single run). Frozen means the command, its inputs, and the machine conditions stay fixed for the whole run: a harness edited mid-run measures a different thing, so changing it invalidates every earlier row and restarts the baseline. Record the baseline metric and a green run of the regression gate (the tests that must keep passing) before any change.
9
+ 3. Open the decision log via the **show-me-your-work** skill. A `decision.tsv`, one row per attempt: id, hypothesis, change, before, after, delta, tests, verdict (kept or reverted), note. Read it before each attempt. Keep it out of the tree (gitignored).
10
+ 4. Ground each hypothesis in the architecture model from step 1, so it names a specific mechanism ("defer X off the boot path because it blocks first paint"), not "try memoizing something". For a perf metric, order hypotheses by the performance mantras in step 2 of the Perf issue playbook (`playbooks/perf-issue.md`). Borrow only their order, not that step's stop rule.
11
+ 5. Loop, one hypothesis per iteration:
12
+ - Hand the change to a `pstack_subagent` child with `role: "hillclimb"` and a tight scope. Its route and effort come from that role line in `$DSH_HOME/pstack-models.md`; a role the file does not name inherits the parent route, and you never pass a model id of your own. Supervise and review the diff rather than typing it (the **guard-the-context-window** principle skill). When several independent hypotheses are live, fan them to parallel children, each in its own `create_worktree` checkout, because two writers in one checkout overwrite each other (the **separate-before-serializing-shared-state** principle skill). Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
13
+ - Measure before and after with the frozen harness, and run the regression gate.
14
+ - Accept only when the metric moves past noise and the gate stays green. Otherwise revert the change in full. A tweak that "might help" is not kept.
15
+ - One commit per accepted fix, staging only the files you changed (`git add <files>`, never `-A`). Log the row either way, kept or reverted.
16
+ Each iteration ends in a check before the next begins (the **sequence-verifiable-units** principle skill). If the run is unattended, borrow only the goal and the wake mechanism from the Autonomous run playbook (`playbooks/autonomous-run.md`), not its stop rule: the predicate here is the hillclimb's own, and a repeated-prompt driver never replaces the supervision this step needs, because one hypothesis per iteration is a judgment call.
17
+ 6. Push past the first plateau. On a stall, several rejects in a row, pivot category, combine near-misses, re-read the source, or try something more radical before concluding the hill is climbed. Correctness and simplicity outrank the number. Revert a win that breaks behavior, and keep a simplification that holds the number (the **laziness-protocol** principle skill).
18
+ 7. Stop when the predicate is met, or when the remaining ideas are marginal and not worth their cost. Don't relax the predicate to meet it, and don't quit while cheap untried hypotheses remain. If you are stuck, surface it instead of spinning.
19
+ 8. Run **Opening a PR** with the accepted commits stacked in the order they landed.
20
+
21
+ **Reply:** the metric and target, baseline to final with the percent delta, iterations run (kept vs reverted), each accepted fix on one line, the `decision.tsv` path, and the best idea you would try next if pushed further.
@@ -0,0 +1,14 @@
1
+ ### Investigation
2
+
3
+ **You own the answer. Plan, route, write.**
4
+
5
+ Investigation requests are read-only. They produce a cited explanation or a recommendation, not a code change.
6
+
7
+ 1. Read the `how` skill's `SKILL.md` at its absolute resource path and route through it. For motivation questions, read the `why` skill's `SKILL.md` at its absolute resource path too.
8
+ 2. Throughput checkpoint stays one line: `throughput checkpoint: n/a, read-only investigation`.
9
+ 3. Produce the `how`-shaped output (Overview / Key Concepts / How It Works / Where Things Live / Gotchas), or a recommendation with a tradeoffs table if the request is a decision between alternatives.
10
+ 4. Read the `unslop` skill's `SKILL.md` at its absolute resource path and apply it to the reply.
11
+
12
+ No PR, no babysit, no `architect` unless the investigation precedes a code change. If it does, hand back to the user and re-route to Bug fix or Feature.
13
+
14
+ **Reply:** the investigation output. For "are we sure?" answers, include your real judgment with reasons. Push back if the premise is wrong (see Autonomy).
@@ -0,0 +1,155 @@
1
+ ### Multi-phase or multi-PR plan
2
+
3
+ **You own the plan, not the code. The plan is a checklist an owner runs box by box and the operator audits from the evidence.** The plan is the deliverable. Do not implement.
4
+
5
+ 1. When the change is one or two files with an obvious approach, skip the plan. Say so and stop.
6
+ 2. Settle open questions by prototype before you write. Run `playbooks/prototype.md` for each. Keep the branch, the SHA, and the screenshots for Appendix A. Ask the operator only about a product or preference call that no run can settle. Give options (the **never-block-on-the-human** principle skill).
7
+ 3. Explore in `pstack_subagent` children with `agent: "poteto-agent"` and `role: "how explorer"`, which is read-only by instruction (the **guard-the-context-window** principle skill). The route comes from that role line in `$DSH_HOME/pstack-models.md`, and a role the file does not name inherits the parent route, so name the role in each brief rather than a model id. Each child returns file pointers, conventions, test commands, and entry points. No inlined dumps. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
8
+ 4. Copy the skeleton below into the plan file and fill every placeholder. Unless the operator names a path, write the file under `docs/plans/` in the repository, because this host hands no store path to the model. Keep every heading and every sub-block in the order shown. One section per PR. One PR is one change with its own evidence (the **sequence-verifiable-units** principle skill). Name the execution playbook in **How to read this**. Pick between `playbooks/autopilot-full.md` and `playbooks/autopilot-stack.md` per the rule at the end of `playbooks/autopilot-stack.md`. A standing program takes `playbooks/orchestrate.md`.
9
+ 5. Write under `/technical-writing` in full, then `/unslop`. The body is one Diátaxis mode, how-to. Appendices hold explanation and reference. Each heading states the task or the finding. No long dashes. No mid-sentence colons.
10
+ 6. Run `pstack_script` with `id: "check-plan"` and `args: ["<plan.md>"]`, and fix every line it prints (the **encode-lessons-in-structure** principle skill). It runs on the Host's own runtime, so no `node` on PATH is needed, and its own test file runs under `node --test` in the same isolated copy.
11
+ 7. Hand back. Post the plan path and the script's output, then stop. Execution starts on the operator's explicit go, under the execution playbook the plan names.
12
+
13
+ **Verification.** Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked (the **prove-it-works** principle skill). That sentence is the verification rule. Every verification block opens with it. The live block is mandatory. Ten lanes at the PR head drive the real surface through a real driver, per the **swarm** skill, on the `swarm workers` role. Each lane's route comes from that role's entry list, and a lane that needs a specific entry names `roleIndex`; with no index every lane takes the first entry, which is one route and not a panel. Each lane is one box with a concrete scenario, the screenshot it saves, and its pass predicate. One lane is the **Regression lane against trunk.** It runs the same load-bearing scenario on trunk and head. If trunk does not have the feature, the lane records that fact and gates the behavior the diff adds plus the end state the user waits for instead of inventing a trunk result. The perf gate is dual-sided. Trunk and head must both produce the named metric. If trunk lacks the feature, also isolate the work the diff adds and set an absolute budget for that work plus the end-to-end state the user waits for. Do not claim a ratio between unlike scenarios. The perf block names the metric, the interleaved probe, the trunk baseline measured first, and the rule with the number that fails. A PR that changes an interaction is review-gated. The operator reviews it in chat with screenshots and a video before merge. A PR that changes no interaction writes `**Review gate.** None. <PR id> is not review-gated.` and no boxes under it.
14
+
15
+ **Driver.** Pick it by surface. Browser, Electron, and web UIs need a browser driver the project already ships, or a verification skill `create-verification-skill` wrote for the project. CLIs and TUIs need a command driver with recorded exit codes and output. Native mobile uses whatever simulator driver the repo has. A PR that touches two surfaces gets lanes on both. A surface with no driver is a risk in Appendix C, and its live block still names how each lane drives it, because reading the source is not a lane.
16
+
17
+ ````markdown
18
+ # <Program> plan
19
+
20
+ <Under ten lines. What changes, for whom, the rule the program enforces, and the PR ids in order.>
21
+
22
+ ## How to read this
23
+
24
+ One box is one unit of work. Every box names the evidence that checks it. A nested box is a sub-step of the box above it. Check a box only when its evidence exists, a file, a log line, a screenshot, a test run, or a SHA. The body is a how-to. The appendices explain and record.
25
+
26
+ The program runs `<package>/skills/poteto-mode/playbooks/<execution playbook>.md`. <Who merges, and which PR ids are the operator's items that stop at merge-ready.>
27
+
28
+ Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked.
29
+
30
+ ## Program checklist
31
+
32
+ ### Arm the program
33
+
34
+ - [ ] State the protocol and this plan to the operator, then stop. Start execution only on the operator's explicit go.
35
+ - [ ] Read these from the installed package at program start. Re-read them at every tick. The skills ship inside the package, so a branch of this repository is not where they live.
36
+ - [ ] `<package>/skills/poteto-mode/playbooks/<execution playbook>.md`
37
+ - [ ] `<package>/skills/swarm/SKILL.md`
38
+ - [ ] `<driver path, or the verification skill path>`
39
+ - [ ] `<package>/skills/poteto-mode/playbooks/opening-a-pr.md`
40
+ - [ ] `<package>/skills/<each other leaf skill the program uses>`
41
+ - [ ] On the operator's go, register the program predicate with `create_goal` and arm the audit tick as a `schedule_create` heartbeat with `every_seconds: 3600` and the tick prompt below. Never leave the cadence to memory. A reminder is a timed input delivered into this Session, not a subscription to a PR or a CI event, so any event-shaped wake needs the background watcher from `playbooks/babysit.md` beside it.
42
+ - [ ] Use this tick prompt, verbatim. "Re-read the execution playbook from the installed package. Audit the operation against it and fix drift in this tick. Probe every active lane and judge progress by side effects only. Stand down a stuck lane and dispatch its replacement now. Then post a short status message to the operator in chat only when the audit found a tracked change that no earlier status message reported, such as a PR opened, a code-ready head, a round launched or closed, a verdict, a merge, a stuck agent and the action taken, a blocker added or cleared, or a decision only the operator can make. Name every such change and nothing else. Do not repeat a table, the merged list, or an unchanged blocker. If the audit found none, end the turn with no reply text. Either way, log this tick's row in your decision trail. The row names the items reported, or none."
43
+ - [ ] On the operator's hold or stand-down, send every owner a zero-writes order at once.
44
+
45
+ ### Spawn owners
46
+
47
+ - [ ] Spawn one owner per PR with the full lifecycle the execution playbook names.
48
+ - [ ] Follow this dependency graph. Start dependent work only after its parent merges, or base it on the parent branch when the execution playbook stacks.
49
+ - [ ] <PR id> and <PR id> are independent and first. Both branch from `main`.
50
+ - [ ] <PR id> after <PR id>.
51
+ - [ ] Hold the file boundaries. <PR id or class> touches only `<glob>`.
52
+ - [ ] Hold the review gate. <PR ids> change an interaction. They wait for the operator's review in chat with screenshots and a video before merge.
53
+
54
+ ### PR mechanics, for every PR
55
+
56
+ - [ ] Resolve the forge once. Default to `gh`; if `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Record any fallback to `gh`. Never require `gt`.
57
+ - [ ] Open the PR ready, never draft, per **Opening a PR**. Use the run's built-in PR tool when it has one, else `origin pr create --status open --base <base-branch>` or `gh pr create --base <base-branch>` according to the resolved forge. A stack child targets its parent branch.
58
+ - [ ] Run the repo's lint and typecheck once before the PR-facing push. Push with hooks on.
59
+ - [ ] Read the staged diff back once before each commit, then run `/no-comments` before review.
60
+ - [ ] Triage every Bugbot and security-reviewer comment per `../references/bugbot-triage.md`.
61
+ - [ ] Rebase onto current trunk before the code-ready report and babysit. Keep that merge base in fix rounds. Rebase again only at merge prep, on a `git merge-tree` conflict with trunk, or on a CI failure that comes from a change on trunk.
62
+
63
+ ### Verdict and merge, for every PR
64
+
65
+ - [ ] A full swarm runs once, at the code-ready head. Another full swarm runs only for new behavior, a redesign, or a large new diff. A rebase, a merge-conflict resolution, or a minor fix gets a single verifier at the new head. Run each full swarm per `<package>/skills/swarm/SKILL.md`. One gates lane. The ten live lanes from the PR's **Verify, live** block. The perf lane from its **Verify, perf** block. Two or more audit lanes, each with its own focus, that read the diff and the receipts and distrust the PR body. The root audits the receipts in the merge-ready report before the verdict.
66
+ - [ ] Clean only when every lane is `PASS`. Findings go back to the owner, including a defect that a lane filed as a note. A new head gets a fresh verdict, except for results that stay valid under the patch-id rule in `playbooks/shipping.md`.
67
+ - [ ] <The merge or append rule from the execution playbook, with the patch-id rule from `playbooks/shipping.md`.>
68
+
69
+ ### Boot recipe, for every live lane
70
+
71
+ Each live lane runs in its own `create_worktree` checkout at the PR head. Drive it through the project's real driver. A worktree separates the working directory and the branch only, so lanes on one machine share ports, caches, and credentials, and this recipe names which of those each lane contends for.
72
+
73
+ - [ ] `git fetch origin <head-branch> && git checkout <head SHA>`.
74
+ - [ ] <Start the backend and the surface. Wait for ready.>
75
+ - [ ] <Deliver input only through the control skill's commands. Name the read-only diagnostics.>
76
+ - [ ] Save every screenshot to `/tmp/swarm-<pr-id>/worker-<n>/<slug>.png` and return the paths with the report.
77
+
78
+ ## <Task as a verb phrase> (<PR id>)
79
+
80
+ **Depends on.** <PR id, or None.>
81
+
82
+ **Files.**
83
+
84
+ - [ ] Edit `<path>`.
85
+ - [ ] Create `<path>`.
86
+ - [ ] Delete `<path>`.
87
+
88
+ **Build.**
89
+
90
+ - [ ] <One change. Name the symbol and the file.>
91
+
92
+ **You see.**
93
+
94
+ - [ ] <One observable result, with the exact log line or screen state.>
95
+
96
+ **Verify, unit.** Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked.
97
+
98
+ - [ ] <Test file and the case it gains.> Run `<command>`.
99
+
100
+ **Verify, live.** Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked. Ten lanes on `swarm workers` at the PR head, per the boot recipe.
101
+
102
+ - [ ] Lane 1. Regression lane against trunk. Run <the same load-bearing scenario> at trunk and head. If trunk lacks the feature, record that and gate <the behavior the diff adds plus the end state the user waits for>. Save `<slug>.png`. Pass when <predicate>.
103
+ - [ ] Lane 2. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
104
+ - [ ] Lane 3. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
105
+ - [ ] Lane 4. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
106
+ - [ ] Lane 5. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
107
+ - [ ] Lane 6. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
108
+ - [ ] Lane 7. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
109
+ - [ ] Lane 8. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
110
+ - [ ] Lane 9. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
111
+ - [ ] Lane 10. <Scenario.> Save `<slug>.png`. Pass when <predicate>.
112
+
113
+ **Verify, perf.** Tests alone are not sufficient verification. A PR is verified only when its unit, live, and perf boxes are all checked.
114
+
115
+ - [ ] Metric. <What is measured at both trunk and head. If trunk lacks the feature, also name the diff-added work and the end-to-end state the user waits for.>
116
+ - [ ] Probe. <The command or procedure, run at trunk and at the head, interleaved. Both sides must produce the metric.>
117
+ - [ ] Baseline. Record the trunk <value> first.
118
+ - [ ] Rule. <Head against trunk, with the number that fails. If the scenarios differ, add absolute budgets for the diff-added work and the user-visible end state instead of an invalid ratio.>
119
+
120
+ **Review gate.** The operator reviews before merge.
121
+
122
+ - [ ] Copy lane <n> screenshots into `<media path>/<pr-id>-review-<slug>.png`.
123
+ - [ ] Record a 30 to 60 second video of the change on a lane's own checkout. Save it as `<media path>/<pr-id>-review.mp4`.
124
+ - [ ] Post the screenshots and the video in chat. Stop at merge-ready. Wait for the operator's click.
125
+
126
+ **Merge.**
127
+
128
+ - [ ] Root's clean verdict at the exact head SHA.
129
+ - [ ] Bugbot triage done.
130
+ - [ ] Rebased onto current trunk after the verdict, patch-id unchanged.
131
+ - [ ] <The owner squash-merges its own PR, or the root appends it to the base-branch stack and the operator lands it bottom-up.>
132
+
133
+ ## Close the program
134
+
135
+ - [ ] Every box above is checked with its evidence.
136
+ - [ ] Reply to the operator with the report the execution playbook names.
137
+
138
+ ## Appendix A. Prototype evidence
139
+
140
+ <Each open question a prototype answered, with the branch, the SHA, and the artifact links. Each question that stays unproven.>
141
+
142
+ ## Appendix B. Alternatives rejected
143
+
144
+ <Each approach weighed and why it lost.>
145
+
146
+ ## Appendix C. Risks
147
+
148
+ <Each risk with the PR it lands in and what the owner watches.>
149
+
150
+ ## Appendix D. Links and reading list
151
+
152
+ <Docs to read before editing. Which PRs get `<package>/skills/how/SKILL.md` and `<package>/skills/interrogate/SKILL.md`. The trail per `<package>/skills/show-me-your-work/SKILL.md`.>
153
+ ````
154
+
155
+ **Reply:** the plan path, the PR ids with their dependencies and the review-gated set, what the prototypes proved and what stays unproven, and the check script's output.
@@ -0,0 +1,34 @@
1
+ ### Opening a PR
2
+
3
+ Invoked at the end of every other playbook.
4
+
5
+ **Worktree.** Work from a checkout that is not the branch other work is using: call `create_worktree({ name, from })` and it returns the path, branch, pinned commit, and repository root, then leave with `working_directory({ cd })`. A child does not inherit your checkout; give each writer its own `create_worktree` call or pass a prepared absolute `path` as that child's `cwd`. Creation is from a local revision and copies no uncommitted files, so commit first and fetch before you depend on a remote branch. Dirty branch with unrelated work: commit or patch it out, create the checkout, apply. Snarled worktree: create a fresh checkout from the base and redo minimally. This isolates the directory and branch only, not ports, credentials, or running services.
6
+
7
+ **Commits.** Commit liberally. Rebase into small, ordered commits before opening PRs. Each commit is a future PR: landable, ordered to tell the story. Amend when the fix belongs in a just-made commit. New commit when separable. Commit bodies don't restate the subject.
8
+
9
+ **PRs.** `/deslop` ships in Cursor's `cursor-team-kit` and has no counterpart here: read the diff once for narrative comments, unjustified guards, dead compatibility paths, and unrelated edits, then read the `no-comments` skill's `SKILL.md` at its absolute resource path and run it before review. Write every PR title, description, and commit body with the `technical-writing` skill (every layer except Diátaxis, and apply the STE vocabulary rules: one word per action, keep articles, a plain verb over `-ing` where one works), then apply the `unslop` skill; read both at their absolute resource paths.
10
+
11
+ **Titles.** Conventional Commits `type(scope): subject`, no trailing period. Type such as `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, or `perf`. Scope is the area, such as `pstack` or `poteto-mode`. Subject is short, imperative, and names a real symbol when one carries the change, for example `fix(pstack): retarget opening-a-pr babysit trigger`.
12
+
13
+ **Descriptions.** The PR body is a one-minute briefing, not a lab notebook, for a reviewer who has the diff. It says why the change exists, what it leaves out, what it could break, and how you proved it works. Write short, simple sentences with few identifiers, no walls of text. The body becomes the squash commit body, so keep that commit under about 40 lines. Use `##` headings, not bold lead-ins, in this order, and drop a section with nothing to say:
14
+
15
+ - `## Why`: the problem and approach, 1–3 short sentences. No SHAs, rebase genealogy, or "based on main" preamble.
16
+ - `## What changed`: 1–3 short bullets. Name a real symbol or path only when it carries the change. Name both sides of a rename or retarget.
17
+ - `## Scope`: always. 1–3 short items on what it covers and what it deliberately leaves out (a follow-up, a known gap). No symbols, paths, or file-by-file essay.
18
+ - `## Tradeoffs`: only rejected alternatives a reviewer would otherwise ask about. Skip when there was no real choice.
19
+ - `## Blast Radius`: 1–2 sentences on who or what it touches and why that is safe or risky. If main is red, state the cost of leaving it red.
20
+ - `## Verification`: 1–3 bullets, each a real run path and its outcome. Perf: one primary number with its unit, `before → after`, and a link to the arena or swarm directory for the rest. No sample-size methodology, swarm recitals, or metric tables.
21
+
22
+ After the sections, attach videos or screenshots when they prove a claim. Full SHAs, swarm or arena lane recitals, lever-correction essays, file-by-file checklists, and "CLEAN" verdicts go in a linked artifact, not the body.
23
+
24
+ **Forge.** Resolve the forge before the first PR operation and keep that choice for create, edit, view, watch, and merge. GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, prefer `origin pr ...`. If Origin is absent or cannot resolve the repository, stay on `gh` and record the fallback. Do not require Graphite (`gt`).
25
+
26
+ **Built-in PR tool.** This host provides no built-in PR tool, so every PR operation goes through the resolved forge CLI. If a future deployment does provide one, use it for create, edit, retarget, and ready, because a CLI-made PR misses what such a tool tracks.
27
+
28
+ **Size and stacks.** Prefer five narrow PRs to one large PR. A stack is a base-branch chain. The root PR targets trunk. Each child branch rebases onto its parent's exact tip and its PR targets the parent branch. As a parent merges, move its child onto trunk per `playbooks/shipping.md` step 4. Without a built-in PR tool, per the resolved forge, create a child with `origin pr create --status open --base <parent-branch>` or `gh pr create --base <parent-branch>`, and retarget one with `origin pr edit <pr> --base <parent-branch>` or `gh pr edit <pr> --base <parent-branch>`. Branch from trunk only for independent work. Rebase on trunk before substantial stack work.
29
+
30
+ **Readiness.** Open every PR ready, never as a draft. With Origin, pass `--status open`. With `gh`, omit `--draft`. If a PR still opens as a draft, run `origin pr ready <number>` or `gh pr ready <number>` according to the resolved forge. Run `origin pr view <number>` or `gh pr view <number>` before you refer to PR status.
31
+
32
+ **Babysit.** Opening a PR does not start a babysit. Post the URL and keep building. Finish the phase or stack first. A later pass means reading the Babysit playbook at its absolute resource path and running `check` or `threads-only`, which need one forge read and a report; its `drive` and `background` modes need a watcher that can wake this Session, so say the watch is unverified when you cannot start one. A babysit for each new PR stalls the build and spends checks on commits later waves restart. Push back when feedback drifts from intent.
33
+
34
+ A subagent that opens a PR runs `interrogate` and `/no-comments`, reads the diff for narrative comments, unjustified guards, dead compatibility paths, and unrelated edits, and posts the URL. It returns to the parent without babysitting, unless it is an Autopilot-full or Autopilot-stack owner. That owner's brief assigns the babysit loop and is the ask `playbooks/babysit.md` waits for. The owner starts the loop after its code-ready report, reports merge-ready or STACK-READY per its playbook, and is exempt from the rules here and in `playbooks/babysit.md` that hold babysitting until a whole stack is built.
@@ -0,0 +1,112 @@
1
+ ### Orchestrate
2
+
3
+ **You own the program, never the code. Author briefs, drain the queue, keep the frontier green, decide.** For a whole project handed to one standing coordinator chat: multi-day, many stacked PRs, dozens to hundreds of subagents, the human checking in twice a day instead of every five minutes. One task driven to a predicate is Autonomous run. One ambitious run needing a bespoke workflow is figure-it-out. Route here when the work outlives any single agent. Work one agent could finish inside the session's budget is not a program.
4
+
5
+ Ceremony must scale with the program. On cheap near-identical units, collapse it as each section directs.
6
+
7
+ Three rules carry the rest.
8
+
9
+ - Completions are queue events, not interrupts.
10
+ - Every spawn and every resume carries the standing orders verbatim.
11
+ - The brief is the product. A vague brief fails quietly, because a worker cannot ask you a question.
12
+
13
+ #### Roles and placement
14
+
15
+ - **Coordinator (this chat).** Local. Frames, authors briefs, drains the inbox, owns the human report, makes judgment calls. It never authors or edits code. Conflicted merges, chain rebases, and code changes are always tasks. Mechanically landing a verified unit (fast-forward or clean cherry-pick of a worker's commit, then push) is bookkeeping the coordinator may do itself on repos where local git is cheap. Queueing finished work behind an idle stacker is how a deadline harvests nothing. The loop is agentic end to end. Children are started and briefed only through `pstack_subagent`, steered only through `send_message`, stopped only through `interrupt_agent`, and read only through `list_agents` and their own artifacts. Pick each child's role per the Subagents section of the `poteto-mode` skill, because the role is what selects its route. State reads and writes go through `pstack_script` with `id: "orch"` at drain points, one command in and one line out; the tool runs the bundled script on the Host's own runtime. The CLI never spawns, waits, or wakes anything. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
16
+ - **Sub-coordinator.** Always local, durable, one per track, and only when the program exceeds what one coordinator's drains can manage. A track the coordinator can drain itself needs no middle layer. Each nested layer re-pays a full orientation preamble, and a blocking sub-coordinator hides its children while the parent idles. Owns its track's units and boards, authors its workers' briefs, (spawns its own workers and verifiers, and nesting works to the depth this bundle's row allows, two, which a child can only lower further). Rolls up aggregates at wave boundaries. Never forwards raw child reports. Cap in-flight children at what one drain can process, roughly ten, as a rolling window. Never as blocking batches, which cost the slowest child of every batch.
17
+ - **Worker / verifier.** Always a local `pstack_subagent` child in its own `create_worktree` checkout. There is no cloud environment in this port, so every child runs on this machine, shares its ports, caches, and credentials, and dies with the host process. A child cannot read another child's Session, so its brief inlines what it needs or points at repository paths and the store. Prefer fewer, broader workers. One writer per worktree or branch (principle-separate-before-serializing-shared-state). Run a unit's verifier through a different role from its worker, and confirm the routes the tool reports actually differ, because two children that resolved to one route are not cross-model review.
18
+
19
+ Depth stays at coordinator, track, worker. Author the track decomposition per project (build, landing, and verification are common cuts, not a required shape). Hard-coded swarm trees were tried and parked as too rigid.
20
+
21
+ #### Store layout
22
+
23
+ Create `orchestrate/<project-slug>/` in a directory the operator names, or under `.audit/` in the repository when they name none, because this host hands no store path to the model. Every file has exactly one writer. Owners publish facts, readers aggregate at read time. Use `pstack_script` with `id: "orch"` for bookkeeping, written below as `orch`, while its canonical plain TSV and JSON stay readable without the CLI. The tool runs the bundled script on the Host's own runtime, so no `bun`, `bash`, or `node` on the PATH is involved; if the tool is unavailable, read and write the TSV and JSON by hand and say which commands you could not run.
24
+
25
+ - `preferences.md` is the standing-orders register: numbered lines, one constraint each (model policy, stack shape and count, verification bar, forbidden paths, escalation policy). Paste it verbatim into every spawn and every resume. Directives decay across resumes, and each dropped one costs a human turn. When you catch yourself restating an instruction, append the line before you act (principle-encode-lessons-in-structure).
26
+ - `overview.md` is the durable PR and issue DB. Append. Never rewrite wholesale per event.
27
+ - `units.tsv` has one row per unit: id, track, state, branch, PR, head SHA, brief path. Update rows in place.
28
+ - `frontier.json` is the computed merge frontier, per Stack safety.
29
+ - `ledger.tsv` is the verification ledger, per Verification.
30
+ - `inbox/` holds completion pointers. `gates.md` parks human gates (question, options, default on no answer).
31
+ - `decisions.tsv` is the trail via the show-me-your-work skill.
32
+ - `status.md` is derived from `units.tsv` and `ledger.tsv` at each drain, never hand-maintained. Regenerate it from the tables instead of narrating events into it.
33
+
34
+ #### The brief
35
+
36
+ Your prompts to agents are your only product, and a sloppy brief compounds into slop across the whole tree. Every spawn carries all of it. A field you cannot fill is a unit you have not scoped yet.
37
+
38
+ ```
39
+ GOAL one sentence, the outcome, executable by a stranger with no chat access
40
+ SCOPE paths this unit may write; paths it may not; its exclusive worktree or branch
41
+ CONTEXT pointers to files and PRs; upstream reports pasted in full when this unit
42
+ depends on them, because workers cannot see siblings
43
+ ACCEPTANCE checkable criteria, one per line
44
+ VERIFY exact commands or the driver path, plus known gotchas
45
+ TIMEBOX rough cap on runtime; on expiry, return partial findings and stop rather than run on
46
+ FORBIDDEN no PR retargets or merges, no rebase, no force-push, no fixes outside scope,
47
+ plus unit-specific bans
48
+ REPORT status, branch, head SHA, PRs, verdict, what you actually ran, deviations,
49
+ suggested follow-ups
50
+ STANDING <preferences.md pasted verbatim>
51
+ ```
52
+
53
+ Size the brief to the unit. A one-command unit gets the template collapsed to a paragraph that still names goal, scope, the verify command, and the report shape. A 4KB scaffold around a two-line edit costs more to write and obey than the edit. A spawn may reference the standing-orders file by its store path, because every child here is local and can read it. A resume is the exception: that child lost its brief, so paste the standing orders again instead of pointing at them.
54
+
55
+ A sub-coordinator brief adds its track boundary and unit list, its spawn budget and the rule that each worker gets its own worktree, the drain protocol, and the rollup format (per child: name, status, PR, head SHA, verdict, one line, plus track status and frontier delta).
56
+
57
+ A dependency is a context relay, not just ordering. Undeclared upstream context makes the worker guess. Missing fields are a refuse-to-spawn condition. Audit one sampled worker brief per sub-coordinator per wave, concurrently with the wave it samples, never as a gate in front of it. A failing brief stops that track and fixes the sub-coordinator's instructions, not just the worker, because brief quality decays late in a run. Never resume-chain a brief. Respawn fresh with consolidated scope.
58
+
59
+ #### Steps
60
+
61
+ 1. **Frame.** State the done predicate as something countable ("all 126 units merged, each ledger-verified `unit-test-verified` or better"). Quantify scope: units, rough effort, expected stacks, and the wall-clock budget. If one agent could finish inside that budget, stop here and run Autonomous run instead. Collapsing must not depend on another document being present. It means do the work directly in this session, plain workers where they help, verification inline, landing as you go, and none of the store, register, or pilot machinery below. Schedule landing against the budget. By roughly 70% of it, stop spawning and land what is verified. Name the tracks per project. A contested decomposition or one-way door goes through the arena skill before the pilot. Present the framing once. Reversible prep proceeds without waiting.
62
+ 2. **Install the runtime.** Run `orch init`. Open the trail via the show-me-your-work skill, write the standing orders before any spawn, and seed `frontier.json` from existing PRs with `orch frontier set --repo <repo-dir>`, adding `--forge origin` when the forge is Origin.
63
+ 3. **Pilot.** Push one unit through the whole path: brief, worker, verification, stack entry, ledger row, merge. The pilot exists to falsify the brief template, the verify recipe, and the unit size while that costs one agent instead of fifty. Fix the contract from pilot evidence before any fan-out. Scale the pilot to the unit. On programs of near-identical cheap units, the first unit is the pilot, run as a normal unit with its verify command inline, and fan-out starts the moment it lands. The dedicated pilot pipeline (separate verifier agent, audit gate) is for expensive or novel unit shapes, not for clone-units where a serialized pilot has nothing to falsify.
64
+ 4. **Scale.** Spawn a rolling window of workers up to the in-flight cap, refilling as children finish. Blocking batches pay the slowest child of every batch. Spawn track sub-coordinators only past the one-drain threshold in Roles. Recompute ready work after each drain. Relay upstream reports into downstream briefs. Keep sibling communication upward only. The sampled brief audit runs alongside the wave it samples and stops the next refill on failure, not the current one.
65
+ 5. **Drain.** Run the queue discipline below at every drain point.
66
+ 6. **Land.** Landing is continuous, never a terminal phase. Integration starts with the first verified unit and runs alongside the remaining waves. On heavy repos the stacker is a standing role from wave one, integrating as units verify. On repos where local git is cheap, the coordinator lands verified units itself per Roles. Keep the frontier green before upper-stack work. Stack safety governs. Advance `frontier.json` only on merge or reported new head SHAs.
67
+ 7. **Close.** Drain the final inbox, reconcile every spawned agent to a terminal row (done, abandoned, zombie-reconciled), confirm the predicate on the real artifact, confirm every landed PR has a verdict for its current head SHA, audit the trail per show-me-your-work, recording the route its reviewer lane resolved so a lane that landed on the author's own route is visible as one, encode recurring corrections into `preferences.md` or the brief template. Leave the store intact. It is the postmortem.
68
+
69
+ #### Queue and drain
70
+
71
+ - On a completion notification, run `orch inbox push <agent> <unit> <status> [--report PATH]` and return to what you were doing. Never deep-review inline. A completion that needs review becomes a verifier unit. Never review a diff inside a drain.
72
+ - Drain in batches at four points: the end of a critical section, a track rollup, and a frontier watcher wake (the queued watcher from `playbooks/babysit.md` started as a background job, with a `schedule_create` heartbeat as the fallback), and before a human report. Begin each batch with `orch inbox drain`. Arrivals during a drain wait for the next one.
73
+ - Critical sections you finish first: authoring a brief, a stack operation, a conflict decision, writing a gate, updating ledger or frontier.
74
+ - Each drain classifies every pointer (landed, needs-verify, failed, zombie, noise), writes the resulting rows through `orch unit add`, `orch unit set`, and `orch ledger record`, runs `orch status`, then spawns the next wave in one message.
75
+ - Account for every spawned child at its track's rollup: arrived, respawned, or its scope explicitly absorbed. Silently redoing a missing child's work hides both the wasted spend and the coverage gap its result existed to close.
76
+ - A drain turn ends with the three lines from `orch status`: counts against the states, what changed, gates open. Detail lives in `status.md`. The full reply contract applies at checkpoints and close.
77
+
78
+ #### Stack safety
79
+
80
+ - The frontier is a computed object, never narrative. Recompute `frontier.json` after every merge and stack mutation: ordered PR list, branch names, head SHAs, a generation number, the lowest unmerged PR. The command walks the PR base chain through the checkout's current branch, so chain order and PR states come from the forge. It uses `gh` by default. Pass `--forge origin` when the program resolved the forge to Origin. Head SHAs come from local branch refs, so resolve it from the stacker's clone. A branch with no PR errors rather than guessing.
81
+ - Exactly one stacker per stack may mutate topology (chain rebases, force-pushes, base retargets, merges), serialized within its stack. Record the holder in the standing orders. Chain rebases run on this machine, because there is no cloud environment to move them to. Keep the checkout lean and the working tree clean between rebases, and treat a rebase that takes minutes as a reason to land sooner rather than to wait.
82
+ - Workers never rebase and never retarget or merge PRs. Babysitters follow `playbooks/babysit.md`, one per stack, scoped to one immutable frontier generation. They report conflicts to the stacker rather than rebasing.
83
+ - PR closes and retargets go through the stacker only. Closing a base PR orphans every chain above it. Merges and stack surgery are units with briefs like any other.
84
+ - One retro watcher follows merged PRs for reverts, post-merge CI breaks, and orphaned follow-ups.
85
+
86
+ #### Verification
87
+
88
+ Scale verification to the unit. When VERIFY is a single cheap command, the worker runs it and reports the output, and the coordinator spot-checks receipts. A dedicated verifier agent (on a different model family than the worker) is for units whose verification is expensive, judgment-laden, or high-blast-radius. A verifier agent whose entire product would be rerunning one command is ceremony, not verification.
89
+
90
+ Write ledger rows with `orch ledger record`. Check the current PR and head SHA with `orch ledger check`. `ledger.tsv`, one row per verdict, keyed by PR number plus head SHA: `live-ui-verified | unit-test-verified | type-check-only | verifier-blocked | verifier-failed`. CI green is an input to a verdict, not a verdict. Behavioral work needs better than `type-check-only`. `verifier-blocked` is not a pass. Respawn when the environment heals. `verifier-failed` gets a fix unit, not a re-verify. A worker may self-report. A verifier overrides it on the same key. A new head SHA voids the row, so re-verify after restack. The ledger answers "was this verified", not memory and not the transcript.
91
+
92
+ A unit is not done until its output is externalized the moment it lands, never batched to the end of the run. A worker pushes its branch, a verifier writes its ledger row, receipts land in the store. Work that exists only on this machine's disk and was never pushed was never done.
93
+
94
+ #### Liveness and failure
95
+
96
+ - Never resume an agent to check on it. A resume restarts an idle agent. Probe read-only: the ledger, `units.tsv`, `gh`, pushed branches, and `list_agents` for whether a child is running or inactive. A child's own summary is not liveness, and neither is the age of a file it wrote.
97
+ - A silent death gets a synthetic postmortem row in the inbox (unit, failure mode, last evidence, options). Replan on evidence as it arrives. Never wait for full quiescence.
98
+ - Retry by mode: cap-hit or oom, respawn with smaller scope. Network-drop, retry as-is. Tool-error, retry on a different model. Unknown, retry once. Two retries, then abandon the unit and replan around it.
99
+ - A zombie that returns hours late reconciles against the current frontier and ledger before anything is accepted. Salvage unique findings through a fresh unit, never a blind merge.
100
+ - When continued spawning would produce garbage tree-wide (bad upstream output, broken acceptance, dead infra), write a stop line at the top of the standing orders, let in-flight work finish, fix the cause, clear it.
101
+ - Bound your own infra retries the same way you bound a child's. After a few consecutive tool aborts, stop retrying. Write a terminal handoff to durable state (what is done, where it lives, the exact command to resume) and end the run.
102
+ - After a host restart: every child is dead, because nothing here runs outside this process and no work survives it. Re-read the standing orders and `units.tsv`, recompute the frontier, reattach units by PR and branch rather than by child id, respawn one sub-coordinator per track from its stored brief plus current state, drain, resume. The dead session's store lock clears itself on the next write. `orch` replaces a lock whose holder pid is gone.
103
+
104
+ #### Escalation
105
+
106
+ Reaches the human, batched into the status page rather than per item: irreversible actions (force-push to shared branches, deploys, deletions, closing someone else's PR), genuine product or preference calls no experiment settles, a standing order that contradicts observed reality, a program-level dead end that survived a replan. Park each as a `gates.md` entry before asking, and route work around it.
107
+
108
+ Never reaches the human: frontier nudges, rebase mechanics, retries, CI flake triage, review-thread triage, format fixes, scope the brief already forbids (refuse and continue), and "should I keep going". When in doubt, act and log.
109
+
110
+ Mid-run discoveries fix only what blocks the frontier. Everything else parks in follow-ups. At this fan-out a small scope leak multiplies into PRs nobody asked for.
111
+
112
+ **Reply:** at checkpoints and close: the predicate and the count against it from `units.tsv` and `ledger.tsv`, tracks and what each landed, the frontier (PR list plus SHAs), verdicts summary, what was abandoned and why, gates awaiting the human (the only asks), the store path, and the trail path. Numbers from the tables, not narrative. Include PR links.
@@ -0,0 +1,10 @@
1
+ ### Pause safely
2
+
3
+ **You own a clean stop. Leave a checkpoint a cold-start agent can resume from.** This is explicit only. On "keep going", "going to bed, keep going", or "don't stop", do not pause.
4
+
5
+ 1. Stop at a safe boundary. Finish the current atomic step or back out of it. Start nothing new, and stop any running child with `interrupt_agent`, which asks it to stop without waiting for it. A child's own children keep running after it stops, so check `list_agents` before you call the boundary safe.
6
+ 2. Take no irreversible action to pause. No PR and no push unless you already had one out.
7
+ 3. Make the work durable. Commit uncommitted edits as one clear `wip:` commit on the current branch so nothing is lost. If the tree is broken, say so in the commit body in one line.
8
+ 4. Write the resume note off-context. Capture intent, what you were doing, progress and what's verified, current state, next steps, key files, and gotchas. For the compaction trigger write it to a file like `/tmp/<slug>-resume.md`. If a show-me-your-work trail exists, point at it instead of duplicating it. Pausing a goal is not this step: a paused goal keeps the objective and disarms continuation, and it saves neither an uncommitted tree nor a running process. This host has no restart that resumes work for you, so the commit and the note are the whole recovery surface.
9
+
10
+ **Reply:** where you are in the loop, what's on disk versus still in your head (paths, no diff dumps), the commits you made and whether the tree is clean, and the first action on resume. This is a pause, not a final report.
@@ -0,0 +1,25 @@
1
+ ### Perf issue
2
+
3
+ **You own the measurement story. Plan, review, verify the numbers.** Tie every fix to a measurement, don't read source instead of measuring.
4
+
5
+ 1. Capture a baseline trace through the matching project control path. With no real profiler or trace tool in the project, report the measurement as missing instead of substituting a unit test. Vet the baseline, and each later number, with the `benchmark-checklist` skill, read at its absolute resource path.
6
+ 2. Read the `how` skill's `SKILL.md` at its absolute resource path and use it to ground hypotheses. Don't claim a perf ceiling without running it first.
7
+ Try the performance mantras in order, cheapest first:
8
+ 1. Don't do it. Stop work whose result nothing uses rather than cheapening it.
9
+ 2. Do it, but don't do it again.
10
+ 3. Do it less.
11
+ 4. Do it later.
12
+ 5. Do it when they're not looking.
13
+ 6. Do it concurrently.
14
+ 7. Do it cheaper.
15
+
16
+ When an earlier mantra meets the target, stop.
17
+ 3. Plan the fix from the trace. If it crosses a function boundary, read the `architect` skill's `SKILL.md` at its absolute resource path and run it first. Delegate implementation to a `pstack_subagent` child with `agent: "poteto-agent"` and `role: "perf-issue"`. Read the Subagents section of the `poteto-mode` skill at its absolute resource path first. Review the diff. Capture a post-fix trace. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
18
+ Apply `principle-sequence-verifiable-units`, read at its absolute resource path, verifying each attempt before trying the next.
19
+ 4. Parse and compare the artifacts (JSON to sqlite, diff). "Inconclusive" or wrong-surface is not a pass. Flag it.
20
+ 5. Cite the measurement in the PR.
21
+ 6. Read `playbooks/opening-a-pr.md` next to this file and run it.
22
+
23
+ For sustained improvement against a metric rather than a one-off fix, use the Hillclimb playbook (`playbooks/hillclimb.md`), which keeps one hypothesis per iteration and needs a frozen measurement harness before the first change.
24
+
25
+ **Reply:** baseline number, post-fix number, delta, artifact path.
@@ -0,0 +1,14 @@
1
+ ### Prototype
2
+
3
+ **You own the design decision, not the code. The prototype is a throwaway instrument. The real build follows Feature.**
4
+
5
+ The one playbook where `principle-laziness-protocol`'s "smallest change" and the verification bar invert. Speed over polish, code quality does not matter, no planning. The rigor is in picking the right design cheaply. Propose variations the user didn't ask for, throw an approach away and try another.
6
+
7
+ 1. Scope the decision the prototype exists to make: which layout, which interaction, which density, or for an empirical fork which behavior, timing, or approach. No decision means no prototype. Route to Feature.
8
+ 2. Gather references when the design space is open. Search for prior art, summarize a moodboard of themes, palettes, and layouts, let the user pick directions before building. Skip when the direction is set.
9
+ 3. Build throwaway in an isolated scratch dir, separate from production source. For a visual decision, vanilla HTML/CSS/JS or the lightest stack that renders the idea, CDN deps, a dev server with hot reload. For a behavioral or timing decision, the smallest script that exercises the question. No production framework, no tests, no abstractions.
10
+ 4. When comparing alternatives, build them behind one switcher (buttons or a keypress), each variant labeled. This is `principle-exhaust-the-design-space` made cheap; read its `SKILL.md` at its absolute resource path.
11
+ 5. Verify on the matching surface. For a visual decision, capture each variant with the project's real browser or rendering path and drive the interaction; with no such path, say the visual comparison is unproven rather than describing what it would look like. For a behavioral or timing decision, observe the thing you are deciding by logging the timing, printing the output, or watching the render. The observation is the test here, not an assertion.
12
+ 6. Present alternatives, tradeoffs, and a recommendation. The output is the decision plus the throwaway artifact, not shippable code. Hand the chosen direction to the Feature playbook (`playbooks/feature.md`), or to the `architect` skill at its absolute resource path when the shape is still open, for the real build.
13
+
14
+ **Reply:** the variants explored, the evidence (screenshots for a visual decision, the observed output or timing for a behavioral one), tradeoffs, your recommendation, and the scratch path. Say plainly that the prototype is throwaway.
@@ -0,0 +1,16 @@
1
+ ### Refactoring
2
+
3
+ **You own the contract. The structure changes. The behavior does not.** Distinct from Feature, which adds behavior, and Bug fix, which corrects it.
4
+
5
+ If the cleanup reveals a missing feature or a real bug, split it out and ship the structural change first against the pinned contract. A redesign is allowed, but name it and route to Feature. Large or cross-cutting structural work belongs to the `figure-it-out` skill, read at its absolute resource path. This playbook is the focused-to-medium change.
6
+
7
+ 1. Pin the behavior contract first. Read the `how` skill's `SKILL.md` at its absolute resource path and run it over the affected subsystem to learn the contract, then write a characterization test, snapshot, or equivalence harness that captures current behavior before any structure moves. If the area has no coverage, write the pin before touching structure. Type check and lint are not a pin, and neither is a green build.
8
+ 2. Name the structure the code is missing, as `principle-model-the-domain` requires; read its `SKILL.md` at its absolute resource path. Boring code stays when the shape is already clear and local. The reshape must delete branches or invalid states, not add indirection.
9
+ 3. Name the target shape. State what the module layout, types, and call graph should be if built today, per `principle-foundational-thinking` and `principle-redesign-from-first-principles`, each read at its absolute resource path. If the target crosses a function boundary, read the `architect` skill's `SKILL.md` at its absolute resource path and run it for parallel design exploration of the shape before the move.
10
+ 4. Subtract before you add. Delete dead code, collapse one-caller wrappers, drop redundant validators, and remove orphan references before introducing the new shape, as `principle-subtract-before-you-add` requires. The smallest change that reaches the target shape ships, per `principle-laziness-protocol`, read at its absolute resource path. A speculative cleanup that "might help" gets reverted.
11
+ 5. Move in small behavior-preserving steps, each keeping the pin green. For API reshapes, migrate every caller and delete the old API in the same wave, as `principle-migrate-callers-then-delete-legacy-apis` requires; read its `SKILL.md` at its absolute resource path. No compatibility shims, no parallel old-and-new paths. Spot-check every rename against the actual files. Renames silently miss usages in strings, prose, and back-references. Delegate the mechanical edits to a `pstack_subagent` child with `agent: "poteto-agent"` and `role: "feature, refactoring"`, with a specific scope (file paths, the names being moved, the behavior to hold). Read the Subagents section of the `poteto-mode` skill at its absolute resource path first. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
12
+ 6. Prove behavior is unchanged on the real artifact, not "it compiles", as `principle-prove-it-works` requires; read its `SKILL.md` at its absolute resource path. For larger reshapes, run an equivalence check: a script that diffs old-vs-new outputs, a recorded baseline replayed against the new code, or a smoke run on the matching surface through the project's real driver. With no driver, report the surface check as unproven.
13
+ 7. Confirm the change is worth keeping. The success measure is reduced reader load, per `principle-minimize-reader-load`, read at its absolute resource path. If the diff does not lower reader load somewhere, revert it.
14
+ 8. Rebase into small ordered commits. A subtraction commit, then the reshape, then any follow-on cleanup. Shape them with `principle-sequence-verifiable-units`, so each behavior-preserving slice stays green before the next. Read `playbooks/opening-a-pr.md` next to this file and run it.
15
+
16
+ **Reply:** the structure that changed, the pin you held it against, the equivalence proof, the reader-load delta, what shipped and what got reverted. No new behavior.
@@ -0,0 +1,11 @@
1
+ ### Runtime forensics
2
+
3
+ **You own the diagnosis. Instrument the live process, don't theorize from source.** The deliverable is a cited diagnosis, not a fix.
4
+
5
+ 1. Capture the live signal on the matching surface: a CPU profile for a spinning process, a heap snapshot for a leak, a CDP trace for a visual glitch. A real artifact, not a guess, and only through an interface this Session actually has; when no live CPU, heap, or CDP interface is reachable, report that gap instead of reasoning from source and calling it forensics.
6
+ 2. Reduce the artifact to the smoking gun: the function on the hot path, the retainer chain from the leaked object to a GC root, the loop firing without input. Parse large artifacts in a `pstack_subagent` child with `agent: "general"` and a brief that forbids writes, as `principle-guard-the-context-window` requires; read that skill's `SKILL.md` at its absolute resource path. Keep the reduced finding in the main thread. Read the Subagents section of the `poteto-mode` skill at its absolute resource path first. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
7
+ 3. Prove the mechanism before believing it. Inject instrumentation through a live interface the process actually exposes, such as CDP eval on a running browser target, or hotfix the live code without reloading, to confirm the hypothesis cheaply. With no such interface, mark the mechanism as unproven rather than confirmed.
8
+ 4. Map the finding back to source: file, symbol, the line that allocates or schedules.
9
+ 5. Throughput checkpoint stays one line: `throughput checkpoint: n/a, read-only forensics`.
10
+
11
+ **Reply:** the signal captured, the reduced finding, how you proved the mechanism, the source location, artifact paths. No fix unless asked. Hand back to Bug fix or Perf once the cause is known.
@@ -0,0 +1,11 @@
1
+ ### Session pickup
2
+
3
+ **You own the resume point. Read the prior trail, don't redo it.**
4
+
5
+ 1. Locate the prior trail: a session id the user provides, a pushed branch, or a trail file. A session id is read with `pstack_history` when it is this run or one of its reviewable direct children (`scope: "children"` plus that `sessionId`); any other id needs a workspace-authorized reader, and this tool refuses an arbitrary id instead of opening one. A branch is reconstructed with `git`. An agent URL hosted in the cloud is not supported: ask for the session id, the branch, or the trail file instead, and say the cloud form was refused. Read the first events and the tail first, then scan back for the decision points. Parse a long log in a `pstack_subagent` and keep the reduced timeline in the main thread, as `principle-guard-the-context-window` requires; read its `SKILL.md` at its absolute resource path. Pick that subagent's role per the Subagents section of `poteto-mode`; read its `SKILL.md` at its absolute resource path. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
6
+ 2. Reconstruct operational state. The branch and worktree, what already landed (`git log`, `git diff` against the base), the open todos, the decisions made. The prior trail is authoritative input. Resist the bias to re-derive it.
7
+ 3. Diff done vs pending. Compare what shipped against what was planned, name the resume point, do not re-run the prior repro or redo completed work. A "let me verify from scratch" pass means you're treating the trail as untrustworthy when it's authoritative.
8
+ 4. Route the remaining work to the matching playbook and pick the verdict: continue the execution, ship a finished recommendation, ratify or override a prior conclusion, or postmortem a failed run. The pickup playbook ends here. The routed playbook owns the rest.
9
+ 5. Verify the inherited claims against the original goal on the real artifact, as `principle-prove-it-works` requires; read its `SKILL.md` at its absolute resource path. A passing prior self-report is not the proof.
10
+
11
+ **Reply:** where the prior agent stopped, what you inherited vs redid (ideally nothing redone), the resume point, and the outcome.
@@ -0,0 +1,12 @@
1
+ ### Shipping
2
+
3
+ **You own what lands. Verify each PR independently, land only the verified run from the root, then keep your hands off the stack.**
4
+
5
+ 1. **Resolve the forge, then verify each PR independently before it lands.** GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr` for every PR operation. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). One verifier per PR, each a separate `pstack_subagent` child with its own `create_worktree` checkout, runs the change the way a user would, parent against head, then posts `PASS`, `PASS+NOTES`, or `FAIL` on that PR. There is no VM and no second machine here: a verifier's isolation is a local worktree over the repository, which separates the working directory and the branch and nothing else, so name the ports, caches, and services it shares. Choose a real driver for the surface and run it, because reading the source is not a verdict. Only a verdict from an agent that did not write the code counts, because an author checks what it meant to build. Green CI and an approving bot review are not verdicts, because neither runs the change as a user would.
6
+ 2. **Land only the contiguous verified run rooted at the bottom.** Walk up from the lowest unmerged PR and stop at the first one without `PASS` or `PASS+NOTES`. The PRs below it are the run, and the top one is the ceiling. A verified PR above an unverified one waits, because it cannot land without the code below it. One whose branch neither holds nor needs that code can move onto trunk and land on its own. It needs a fresh verdict first, because its old one ran with that code beneath it and trunk does not have it.
7
+ 3. **Re-check that the verdicts still describe the code.** A verdict covers a patch, and a chain rebase moves every PR above it to a new SHA without failing any check. Compare `git patch-id` at the verdict SHA with the current head before trusting an older verdict. When the patches differ only in tests, docs, or lint config, a lane's result stands if what it ran builds the same at both SHAs apart from noise. Noise is a difference that also shows up between two builds of the verdict SHA, or an embedded commit SHA. Report each kind of noise with its files, so a reader can check the call. The change itself still gets fresh checks and a review, because the old verdict never saw it. A lane with no build output, such as a dev server, cannot show this, so rerun it, and re-verify anything else that drifted.
8
+ 4. **Land bottom-up, one PR at a time.** Always merge the run's lowest unmerged PR, with `origin pr merge <pr>` or `gh pr merge <pr> --squash`. On Origin the plain command also merges every PR below the one you name, and on GitHub a PR whose base is still its parent's branch merges into that branch, not trunk. Read the PR back for the result (`origin pr view <pr>` or `gh pr view <pr> --json state,mergedAt,baseRefName`), because a merge command can report success when a merge queue only queued the PR, and a requested auto-merge is not a merge. A landed PR reads merged with trunk as its base, not its parent's branch. Arm `--auto` (Origin merge-when-ready or GitHub auto-merge) only on a PR whose verdict covers its current head, because it lands whatever head is ready. After a merge lands, retarget the PR whose base was the merged branch to trunk (`origin pr edit <pr> --base <trunk>` or `gh pr edit <pr> --base <trunk>`), move its patch onto the merge result, and push with `--force-with-lease`. The verdict covers the patch, not its commits, so step 3's patch-id rule decides whether the verdict survives. Merge it once its checks pass and its verdict survives.
9
+ 5. **Leave the stack alone while it lands.** Step 4's move of the next PR is the only change to a branch or base, because a merge lands whatever its branch and base hold at that moment, verdict or not. On GitHub, watch the run with the queued watcher from `playbooks/babysit.md` (`pstack_script` with `id: "watch-pr"`, `args: ["--queued-stack", "--stack-prs", "<bottom-to-top>"]`, and `background: true`) so its settlement notice wakes you, and re-read the run until it reports `COMPLETE` at the ceiling. On Origin, re-read the current PR with `origin pr view <pr> --checks` each time `origin pr checks <pr> --watch` returns, until the ceiling reads merged. A base that moves to trunk when its parent merges is expected, not damage to repair. If a merge stalls, find out why before you change anything.
10
+ 6. **Stop at the ceiling.** Extending the run takes new verdicts, so it is a new pass through step 1.
11
+
12
+ **Reply:** the verified run and its ceiling, each PR's verdict and who produced it, what landed and how you confirmed it, and what the next gap needs.
@@ -0,0 +1,14 @@
1
+ ### Trace forensics
2
+
3
+ **You own the diagnosis from the artifact.**
4
+
5
+ Distinct from Runtime forensics (`playbooks/runtime-forensics.md`), which instruments the live process. Here the capture already exists. The artifact is a fixed dataset, read it, don't re-run it. Keep tooling generic: a DevTools or trace parser for cpuprofile and `.json.gz`, a text editor for a spindump, your heap tooling for a heapsnapshot.
6
+
7
+ 1. Identify the format and load it with the right tool. Parse large artifacts in a `pstack_subagent` child with `agent: "general"` and a brief that forbids writes, as `principle-guard-the-context-window` requires; read that skill's `SKILL.md` at its absolute resource path. Keep the reduced finding in the main thread. Read the Subagents section of the `poteto-mode` skill at its absolute resource path first. Start from the level the role line names, raise it for hard work and lower it for routine work by passing `reasoningEffort`; a child that cannot call `set_reasoning_effort` keeps the level you gave it.
8
+ 2. Transform the raw artifact into a form you can query. Dump the trace or heap snapshot into sqlite, one row per sample, frame, or node. Reach the queryable shape before you read.
9
+ 3. Narrow to the cause. Query for the frames that hold the most time and walk the call tree to the hot path. For a leak, follow the retainer chain from the leaked object to a GC root. For a spindump, find the thread stuck on-CPU or blocked and its wait reason.
10
+ 4. Attribute to source. Map the hot frame to file, symbol, and line via the artifact's own symbols. A frame with no source mapping is not yet a diagnosis. Resolve the symbols, or say plainly the artifact does not carry them.
11
+ 5. If you have a paired capture, diff the before and after artifacts to confirm. Otherwise, mark the finding as the strongest hypothesis the artifact supports, not a confirmed cause.
12
+ 6. Hand back a cited diagnosis, no fix unless asked. Route to Bug fix or Perf issue once the cause is known. Throughput checkpoint stays one line: `throughput checkpoint: n/a, read-only forensics`.
13
+
14
+ **Reply:** the artifact and format, the reduced finding, the source location, the artifact paths, and whether a paired capture confirmed it.