@krtclcdy/tersio 2.25.6 → 2.25.7

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 (188) hide show
  1. package/README.md +30 -7
  2. package/dist/bench/code-out/pfull-0/debounce.js +13 -0
  3. package/dist/bench/code-out/pfull-0/deepClone.js +18 -0
  4. package/dist/bench/code-out/pfull-0/groupBy.js +15 -0
  5. package/dist/bench/code-out/pfull-1/debounce.js +13 -0
  6. package/dist/bench/code-out/pfull-1/deepClone.js +17 -0
  7. package/dist/bench/code-out/pfull-1/groupBy.js +14 -0
  8. package/dist/bench/code-out/pfull-2/debounce.js +13 -0
  9. package/dist/bench/code-out/pfull-2/deepClone.js +18 -0
  10. package/dist/bench/code-out/pfull-2/groupBy.js +15 -0
  11. package/dist/bench/code-out/pfull-3/debounce.js +12 -0
  12. package/dist/bench/code-out/pfull-3/deepClone.js +17 -0
  13. package/dist/bench/code-out/pfull-3/groupBy.js +7 -0
  14. package/dist/bench/code-out/pfull-4/debounce.js +10 -0
  15. package/dist/bench/code-out/pfull-4/deepClone.js +17 -0
  16. package/dist/bench/code-out/pfull-4/groupBy.js +14 -0
  17. package/dist/bench/code-out/plite-0/debounce.js +13 -0
  18. package/dist/bench/code-out/plite-0/deepClone.js +18 -0
  19. package/dist/bench/code-out/plite-0/groupBy.js +15 -0
  20. package/dist/bench/code-out/plite-1/debounce.js +13 -0
  21. package/dist/bench/code-out/plite-1/deepClone.js +17 -0
  22. package/dist/bench/code-out/plite-1/groupBy.js +11 -0
  23. package/dist/bench/code-out/plite-2/debounce.js +12 -0
  24. package/dist/bench/code-out/plite-2/deepClone.js +17 -0
  25. package/dist/bench/code-out/plite-2/groupBy.js +14 -0
  26. package/dist/bench/code-out/plite-3/debounce.js +12 -0
  27. package/dist/bench/code-out/plite-3/deepClone.js +17 -0
  28. package/dist/bench/code-out/plite-3/groupBy.js +14 -0
  29. package/dist/bench/code-out/plite-4/debounce.js +12 -0
  30. package/dist/bench/code-out/plite-4/deepClone.js +17 -0
  31. package/dist/bench/code-out/plite-4/groupBy.js +14 -0
  32. package/dist/bench/code-out/pultra-0/debounce.js +12 -0
  33. package/dist/bench/code-out/pultra-0/deepClone.js +20 -0
  34. package/dist/bench/code-out/pultra-0/groupBy.js +14 -0
  35. package/dist/bench/code-out/pultra-1/debounce.js +10 -0
  36. package/dist/bench/code-out/pultra-1/deepClone.js +17 -0
  37. package/dist/bench/code-out/pultra-1/groupBy.js +7 -0
  38. package/dist/bench/code-out/pultra-2/debounce.js +13 -0
  39. package/dist/bench/code-out/pultra-2/deepClone.js +18 -0
  40. package/dist/bench/code-out/pultra-2/groupBy.js +15 -0
  41. package/dist/bench/code-out/pultra-3/debounce.js +13 -0
  42. package/dist/bench/code-out/pultra-3/deepClone.js +18 -0
  43. package/dist/bench/code-out/pultra-3/groupBy.js +15 -0
  44. package/dist/bench/code-out/pultra-4/debounce.js +13 -0
  45. package/dist/bench/code-out/pultra-4/deepClone.js +18 -0
  46. package/dist/bench/code-out/pultra-4/groupBy.js +15 -0
  47. package/dist/bench/code-out/run-0/debounce.js +12 -0
  48. package/dist/bench/code-out/run-0/deepClone.js +17 -0
  49. package/dist/bench/code-out/run-0/groupBy.js +14 -0
  50. package/dist/bench/code-out/run-1/debounce.js +13 -0
  51. package/dist/bench/code-out/run-1/deepClone.js +15 -0
  52. package/dist/bench/code-out/run-1/groupBy.js +13 -0
  53. package/dist/bench/code-out/run-2/debounce.js +12 -0
  54. package/dist/bench/code-out/run-2/deepClone.js +18 -0
  55. package/dist/bench/code-out/run-2/groupBy.js +13 -0
  56. package/dist/bench/code-out/run-3/debounce.js +12 -0
  57. package/dist/bench/code-out/run-3/deepClone.js +18 -0
  58. package/dist/bench/code-out/run-3/groupBy.js +14 -0
  59. package/dist/bench/code-out/run-4/debounce.js +12 -0
  60. package/dist/bench/code-out/run-4/deepClone.js +16 -0
  61. package/dist/bench/code-out/run-4/groupBy.js +13 -0
  62. package/dist/cli/banner.js +1 -2
  63. package/dist/cli/common.js +1 -1
  64. package/dist/cli/doctor.js +48 -12
  65. package/dist/cli/hosts.js +1 -2
  66. package/dist/cli/install.js +7 -2
  67. package/dist/cli/manifest.js +25 -5
  68. package/dist/cli/uninstall.js +1 -1
  69. package/dist/extensions/caveman/index.js +6 -2
  70. package/dist/extensions/caveman/rule-lite.md +77 -0
  71. package/dist/extensions/caveman/rule-megacave-lite.md +59 -0
  72. package/dist/extensions/caveman/rule-megacave-ultra.md +59 -0
  73. package/dist/extensions/caveman/rule.md +1 -1
  74. package/dist/extensions/combo/index.js +26 -7
  75. package/dist/extensions/pstack/index.js +3 -1
  76. package/dist/extensions/pstack/rule.md +88 -12
  77. package/dist/extensions/rtk/session.js +18 -10
  78. package/dist/extensions/shared/rtk-eligible.js +84 -0
  79. package/dist/extensions/shared/rtk-gain.js +1 -1
  80. package/dist/extensions/shared/sqlite.js +7 -13
  81. package/dist/extensions/shared/status.js +1 -2
  82. package/dist/extensions/shared/usage-ledger.js +102 -20
  83. package/extensions/caveman/index.ts +6 -2
  84. package/extensions/caveman/rule-lite.md +77 -0
  85. package/extensions/caveman/rule-megacave-lite.md +59 -0
  86. package/extensions/caveman/rule-megacave-ultra.md +59 -0
  87. package/extensions/caveman/rule.md +1 -1
  88. package/extensions/combo/index.ts +27 -7
  89. package/extensions/pstack/index.ts +3 -1
  90. package/extensions/pstack/playbooks/authoring-a-skill.md +12 -0
  91. package/extensions/pstack/playbooks/autonomous-run.md +13 -0
  92. package/extensions/pstack/playbooks/autopilot-full.md +13 -0
  93. package/extensions/pstack/playbooks/autopilot-stack.md +16 -0
  94. package/extensions/pstack/playbooks/babysit.md +23 -0
  95. package/extensions/pstack/playbooks/bug-fix.md +15 -0
  96. package/extensions/pstack/playbooks/eval.md +25 -0
  97. package/extensions/pstack/playbooks/feature.md +21 -0
  98. package/extensions/pstack/playbooks/hillclimb.md +21 -0
  99. package/extensions/pstack/playbooks/investigation.md +14 -0
  100. package/extensions/pstack/playbooks/multi-phase-plan.md +155 -0
  101. package/extensions/pstack/playbooks/opening-a-pr.md +34 -0
  102. package/extensions/pstack/playbooks/orchestrate.md +111 -0
  103. package/extensions/pstack/playbooks/pause-safely.md +10 -0
  104. package/extensions/pstack/playbooks/perf-issue.md +25 -0
  105. package/extensions/pstack/playbooks/prototype.md +14 -0
  106. package/extensions/pstack/playbooks/refactoring.md +16 -0
  107. package/extensions/pstack/playbooks/runtime-forensics.md +11 -0
  108. package/extensions/pstack/playbooks/session-pickup.md +11 -0
  109. package/extensions/pstack/playbooks/shipping.md +17 -0
  110. package/extensions/pstack/playbooks/trace-forensics.md +14 -0
  111. package/extensions/pstack/playbooks/visual-parity.md +11 -0
  112. package/extensions/pstack/playbooks/worktree-cleanup.md +12 -0
  113. package/extensions/pstack/principles/attack-the-premise.md +22 -0
  114. package/extensions/pstack/principles/boundary-discipline.md +33 -0
  115. package/extensions/pstack/principles/build-the-lever.md +22 -0
  116. package/extensions/pstack/principles/encode-lessons-in-structure.md +10 -0
  117. package/extensions/pstack/principles/exhaust-the-design-space.md +8 -0
  118. package/extensions/pstack/principles/experience-first.md +18 -0
  119. package/extensions/pstack/principles/explain-the-number.md +16 -0
  120. package/extensions/pstack/principles/fix-root-causes.md +23 -0
  121. package/extensions/pstack/principles/foundational-thinking.md +20 -0
  122. package/extensions/pstack/principles/guard-the-context-window.md +11 -0
  123. package/extensions/pstack/principles/laziness-protocol.md +9 -0
  124. package/extensions/pstack/principles/make-operations-idempotent.md +23 -0
  125. package/extensions/pstack/principles/migrate-callers-then-delete-legacy-apis.md +21 -0
  126. package/extensions/pstack/principles/minimize-reader-load.md +17 -0
  127. package/extensions/pstack/principles/model-the-domain.md +23 -0
  128. package/extensions/pstack/principles/never-block-on-the-human.md +14 -0
  129. package/extensions/pstack/principles/outcome-oriented-execution.md +20 -0
  130. package/extensions/pstack/principles/prove-it-works.md +21 -0
  131. package/extensions/pstack/principles/redesign-from-first-principles.md +15 -0
  132. package/extensions/pstack/principles/separate-before-serializing-shared-state.md +15 -0
  133. package/extensions/pstack/principles/sequence-verifiable-units.md +16 -0
  134. package/extensions/pstack/principles/subtract-before-you-add.md +17 -0
  135. package/extensions/pstack/principles/test-behavior-not-implementation.md +20 -0
  136. package/extensions/pstack/principles/type-system-discipline.md +17 -0
  137. package/extensions/pstack/references/bugbot-triage.md +142 -0
  138. package/extensions/pstack/rule.md +88 -12
  139. package/extensions/pstack/skills/architect/SKILL.md +78 -0
  140. package/extensions/pstack/skills/architect/references/design-red-flags.md +57 -0
  141. package/extensions/pstack/skills/architect/references/rationale-template.md +35 -0
  142. package/extensions/pstack/skills/architect/references/runner-prompt.md +20 -0
  143. package/extensions/pstack/skills/arena/SKILL.md +47 -0
  144. package/extensions/pstack/skills/benchmark-checklist/SKILL.md +38 -0
  145. package/extensions/pstack/skills/blast-radius/SKILL.md +49 -0
  146. package/extensions/pstack/skills/bro/SKILL.md +6 -0
  147. package/extensions/pstack/skills/correct/SKILL.md +31 -0
  148. package/extensions/pstack/skills/figure-it-out/SKILL.md +51 -0
  149. package/extensions/pstack/skills/how/SKILL.md +35 -0
  150. package/extensions/pstack/skills/how/references/explainer-prompt.md +55 -0
  151. package/extensions/pstack/skills/how/references/explorer-prompt.md +35 -0
  152. package/extensions/pstack/skills/interrogate/SKILL.md +73 -0
  153. package/extensions/pstack/skills/interrogate/references/code-quality-review.md +47 -0
  154. package/extensions/pstack/skills/interrogate/references/lead-judgment.md +58 -0
  155. package/extensions/pstack/skills/interrogate/references/reviewer-prompt.md +62 -0
  156. package/extensions/pstack/skills/interrogate/references/rubric.md +77 -0
  157. package/extensions/pstack/skills/no-comments/SKILL.md +23 -0
  158. package/extensions/pstack/skills/reflect/SKILL.md +66 -0
  159. package/extensions/pstack/skills/reflect/references/divergent-reviewer.md +38 -0
  160. package/extensions/pstack/skills/reflect/references/judgment-reviewer.md +37 -0
  161. package/extensions/pstack/skills/reflect/references/synthesizer.md +56 -0
  162. package/extensions/pstack/skills/reflect/references/tooling-reviewer.md +48 -0
  163. package/extensions/pstack/skills/show-me-your-work/SKILL.md +81 -0
  164. package/extensions/pstack/skills/swarm/SKILL.md +45 -0
  165. package/extensions/pstack/skills/tdd/SKILL.md +41 -0
  166. package/extensions/pstack/skills/technical-writing/SKILL.md +105 -0
  167. package/extensions/pstack/skills/unslop/SKILL.md +61 -0
  168. package/extensions/pstack/skills/why/SKILL.md +97 -0
  169. package/extensions/pstack/skills/why/references/epistemics.md +71 -0
  170. package/extensions/pstack/skills/why/references/investigator-prompt.md +84 -0
  171. package/extensions/pstack/skills/why/references/source-playbook.md +17 -0
  172. package/extensions/pstack/skills/why/references/sources/code-archaeology.md +51 -0
  173. package/extensions/pstack/skills/why/references/sources/databricks.md +70 -0
  174. package/extensions/pstack/skills/why/references/sources/datadog.md +97 -0
  175. package/extensions/pstack/skills/why/references/sources/incident-postmortem.md +5 -0
  176. package/extensions/pstack/skills/why/references/sources/linear.md +48 -0
  177. package/extensions/pstack/skills/why/references/sources/notion.md +55 -0
  178. package/extensions/pstack/skills/why/references/sources/sentry.md +66 -0
  179. package/extensions/pstack/skills/why/references/sources/slack.md +17 -0
  180. package/extensions/pstack/skills/why/references/synthesizer-prompt.md +129 -0
  181. package/extensions/rtk/session.ts +17 -9
  182. package/extensions/shared/rtk-eligible.ts +83 -0
  183. package/extensions/shared/rtk-gain.ts +1 -1
  184. package/extensions/shared/sqlite.ts +7 -13
  185. package/extensions/shared/status.ts +1 -2
  186. package/extensions/shared/usage-ledger.ts +97 -19
  187. package/extensions/timing/index.ts +1 -2
  188. package/package.json +7 -4
@@ -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 the 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 the **exhaust-the-design-space** principle skill made cheap.
11
+ 5. Verify on the matching surface. For a visual decision, screenshot each variant via the control skill and drive the interaction. 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 **Feature** (or `architect` for the shape) 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. This playbook is the focused-to-medium change.
6
+
7
+ 1. Pin the behavior contract first. Run the **how** skill 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.
8
+ 2. Name the structure the code is missing per **principle-model-the-domain**. 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 (**principle-foundational-thinking**, **principle-redesign-from-first-principles**). If the target crosses a function boundary, run the **architect** skill 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 (**principle-subtract-before-you-add**). The smallest change that reaches the target shape ships (**principle-laziness-protocol**). 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 (**principle-migrate-callers-then-delete-legacy-apis**). 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 subagent using your configured refactoring model (default a fast model) with a specific scope (file paths, the names being moved, the behavior to hold).
12
+ 6. Prove behavior is unchanged on the real artifact, not "it compiles" (**principle-prove-it-works**). 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 via the relevant control skill.
13
+ 7. Confirm the change is worth keeping. The success measure is reduced reader load (**principle-minimize-reader-load**). 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 the **sequence-verifiable-units** principle skill, so each behavior-preserving slice stays green before the next. Run **Opening a PR**.
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 via the control skill: 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.
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 subagent (the **guard-the-context-window** principle skill), keep the reduced finding in the main thread.
7
+ 3. Prove the mechanism before believing it. Inject instrumentation via CDP eval on the running process, or hotfix the live code without reloading, to confirm the hypothesis cheaply.
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 local transcript under the active workspace's `agent-transcripts/` directory (the system prompt names the path. Do not glob across every workspace's transcript root, that crosses workspace boundaries and reads private chats from unrelated projects), a cloud-agent URL, or a pushed branch. Read the metadata overview and last messages first, then scan back for the decision points. Parse a long transcript in a subagent and keep the reduced timeline in the main thread (the **principle-guard-the-context-window** skill).
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 (the **principle-prove-it-works** skill). 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,17 @@
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 queue.**
4
+
5
+ This is the half after `playbooks/babysit.md`.
6
+
7
+ 1. **Resolve the forge, then verify every PR independently.** GitHub CLI (`gh`) is the default. If `command -v origin` succeeds and Origin can resolve the repository, use `origin pr ...` for view, watch, edit, and merge operations. Otherwise stay on `gh` and record the fallback. Never require Graphite (`gt`). One subagent per PR, not batched, each exercising the real surface with the matching control skill (such as the `control-ui` or `control-cli` skill) against parent versus head. Each returns `PASS`, `PASS+NOTES` or `FAIL` and posts that verdict on its own PR. Safe means a verdict from an agent that did not write the code. CI green is not a verdict, and an approving bot review is not a verdict.
8
+ 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 a passing verdict, where both `PASS` and `PASS+NOTES` pass. A verified PR sitting above an unverified one is not landable. Report the ceiling as a PR number and say what breaks the chain.
9
+ 3. **Re-check that each verdict still describes the patch.** Record the verdict head SHA, base SHA, and stable `git patch-id` of that PR's base-to-head diff. A rebase or base retarget rewrites SHAs and can silently invalidate a verdict without touching a check. Before landing a PR, compare the recorded patch-id with its current base-to-head patch-id. When the two patches differ only in tests, docs, or lint config, build what each lane ran. Build it twice at the verdict SHA and once at the current head. A difference is noise if the two builds at the verdict SHA also show it, or if it is an embedded commit SHA. Judge each difference, not each file, and report each kind of noise with its files. If only noise differs, that lane's result stays valid, and checks and a review of the change run fresh. Do not reuse a lane result from a dev server or from anything else with no build output. Rerun that lane. Re-verify anything else when the patch changed. When it did not, keep the code verdict but re-run mergeability and CI at the current head. Never use matching commit messages or a green check from an older SHA as a substitute.
10
+ 4. **Prepare only the bottom PR.** Fetch current trunk. Rebase the lowest verified branch onto the exact trunk tip when needed, push it, and retarget only that PR to trunk with `origin pr edit <pr> --base <trunk>` or `gh pr edit <pr> --base <trunk>`. Re-run step 3 after the push. Do not retarget, arm, or merge descendants yet.
11
+ 5. **Land one PR at a time.** If the bottom PR is mergeable now, squash it with `origin pr merge <pr> --squash` or `gh pr merge <pr> --squash`. If requirements are still running and the user asked for merge-when-ready, arm only that PR with `origin pr merge <pr> --squash --auto` or `gh pr merge <pr> --squash --auto`. Origin's `--auto` is Origin merge-when-ready. GitHub's `--auto` is GitHub auto-merge. Wait for that PR to merge before preparing the next one.
12
+ 6. **Do not read GitHub `autoMergeRequest` as stack readiness.** At most it says GitHub auto-merge was requested for one GitHub PR. It does not prove Origin merge-when-ready is armed, that a descendant is queued, that a patch verdict is current, or that the contiguous stack is safe. Confirm the active forge's state for the current bottom PR, and say that the state is unknown if the active forge cannot report it.
13
+ 7. **Recompute after every merge.** Fetch trunk, confirm the merged SHA is present, drop the merged PR from the frozen bottom-to-top list, and inspect the new bottom PR's base, head, checks, and patch-id. A host may retarget a child automatically, but do not assume it did. Repeat steps 3 through 6 for that one PR. Independent work stays outside this chain and ships on its own.
14
+ 8. **Watch the current frontier until it merges or fails. Do not mutate the queue around it.** With Origin, use `origin pr view <pr> --checks --comments` and `origin pr checks <pr> --watch`, then re-read the PR until it reports merged or blocked. With GitHub, use `scripts/watch-pr/watch-pr --queued-stack --stack-prs <bottom>` only as an event wake and poll `gh pr view <pr> --json state,mergedAt,mergeStateStatus,statusCheckRollup,autoMergeRequest` after each wake, ignoring `READY` until `mergedAt` is non-null or `state` is `MERGED`. Only then run step 7. Hard-fail only when `state` is `CLOSED` with no `mergedAt`, a required check concludes `FAILURE` or `CANCELLED` and blocks merge after auto-merge is no longer pending, or `mergeStateStatus` is `UNSTABLE` or `DIRTY` with no auto-merge pending. `BLOCKED` while checks are pending or auto-merge is armed is not failure. Do not use Babysit's queued `WAITING`/`merge-queue` stop condition here. Hold the watch under a repeating loop in dynamic mode. Report each merge and the new ceiling. If the queue stalls, diagnose before mutating.
15
+ 9. **Stop at the ceiling.** When the verified run is merged, report what landed, what the next unverified PR is, and what verifying it would take. Extending the run is a new pass through step 1.
16
+
17
+ **Reply:** the verified run and its ceiling, each PR's verdict and who produced it, what you armed and how you confirmed it, what landed, 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**, 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 subagent (the **principle-guard-the-context-window** skill) and keep the reduced finding in the main thread.
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.
@@ -0,0 +1,11 @@
1
+ ### Visual parity
2
+
3
+ **You own pixel-exact equivalence. The baseline is the spec. You do not touch it.** Equivalence is verified by image diff, not by eye.
4
+
5
+ 1. Establish the baseline first, before any migration: a visual regression harness that screenshots the current component across its states, plus the target when matching two implementations. No baseline, no parity claim. A blocking prerequisite, not a follow-up.
6
+ 2. Anti-shortcut clauses, stated and held: no harness modifications, no baseline tampering, no component restructuring to make a diff pass. If the baseline looks wrong, stop and ask, don't edit it.
7
+ 3. Migrate one component at a time. Parallelize across worktrees, one owner per component (the **separate-before-serializing-shared-state** principle skill). Shared primitives migrate first as a blocking phase.
8
+ 4. Verify each component against its baseline via image diff on the matching surface via the control skill. A nonzero diff is a fail. Investigate the pixel delta. Repeat per component until the diff is zero.
9
+ 5. Run **Opening a PR** per component or per safe batch.
10
+
11
+ **Reply:** components migrated, the diff result for each, the baseline harness location, what's left.
@@ -0,0 +1,12 @@
1
+ ### Worktree and simulator cleanup
2
+
3
+ 1. Snapshot and audit. Record `df -h /`, then run `scripts/worktree-audit.sh [-b <pr-base-ref>] [repo-path]` (principle-build-the-lever). Without `-b` it checks `MERGED` against `origin/HEAD`, so pass `-b origin/<branch>` when PRs target another branch. It reads paths from `git worktree list`, never hand-typed, since a hand-typed `myrepo-worktrees/x` misses one that lives in a sibling worktrees directory (principle-encode-lessons-in-structure). It classifies each worktree by size, age, merge state, uncommitted work, PR state, and the newest chat that touched it, then suggests a bucket. The transcript scan is slow, so background it.
4
+ 2. The bucket is advice, not permission. The pinned and active chats are the real artifact (principle-prove-it-works). Get that set from the user or sidebar and cross-check every candidate. The lever has marked `safe` a worktree the user had pinned, so the pinned set wins.
5
+ 3. Verify usage before deleting. For every `verify-recent-chat` row, or anything you doubt, fan subagents out to read the transcripts and report whether the chat is pinned or ongoing and which worktrees it touches (principle-guard-the-context-window, transcripts are bulk). A pinned chat spawns arena and repro trees into sibling worktrees via background subagents, and those are in use even when their names never hit the sidebar.
6
+ 4. Pause on irreversible loss. `wip:N` is N tracked uncommitted edits. Show the diff and get a decision first, since removing a clean worktree is recoverable from its branch but uncommitted work is gone. `scratch:N` is untracked throwaway, safe to drop, but name the files. Per Autonomy, clean and merged and not-in-use proceeds. `wip` and in-use pause.
7
+ 5. Prune the confirmed set. Per path, `git worktree remove --force <path>`. If the dir survives on ignored build artifacts, `rm -rf` it, then `git worktree prune`. Branch refs survive, so no commits are lost. Confirm with `df -h /` and re-list.
8
+ 6. Simulators and other reclaimers. Simulators are usually the next-biggest win. `xcrun simctl --set testing delete all` (XCTestDevices clones), `xcrun simctl delete unavailable`, and `xcrun simctl runtime list` then `runtime delete <id>` for old runtimes. More when needed: Xcode `DerivedData` and `iOS DeviceSupport`, editor and IDE app support directories that balloon with one folder you opened as a workspace, package caches (pnpm, uv, brew, yarn). Clear only caches the user has not said to keep.
9
+
10
+ This is the one playbook that deletes user state with no code review to catch a slip, so the gates above are the review.
11
+
12
+ **Reply:** `df -h /` before and after with space reclaimed, the worktrees pruned, and a one-line reason for each held back (in-use by which chat, or uncommitted work).
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-attack-the-premise
3
+ description: "Apply when two or more fixes that share one premise have failed the same gate. Take a census of which actors hold the imbalance before the next fix, then question the premise instead of writing another fix that assumes it."
4
+ ---
5
+
6
+ # Attack the Premise
7
+
8
+ When two or more fixes that share one premise have failed the same gate, suspect the premise, not the fixes.
9
+
10
+ **Why:** Each failure under a shared premise is evidence about the premise.
11
+
12
+ **Pattern:**
13
+ - **Write the premise down.** The premise is the one sentence that every failed fix assumed.
14
+ - **Take a census before the next fix.** Count the imbalance per actor. The census shows which actors hold the imbalance, not how large it is. Write the census as a rerunnable script per [Build the Lever](build-the-lever.md).
15
+ - **Read the skew.** If the same few actors hold most of the imbalance on every run, something assigns them that role. Find what assigns the role. That assignment is the next "why" per [Fix Root Causes](fix-root-causes.md).
16
+ - **Remove the asymmetry instead of compensating for it**, per the [Laziness Protocol](laziness-protocol.md). Rotate the role between actors, randomize the assignment, or move the role, so that no actor holds it on every run. A return path, a shared pool, a batched hand-off, or a periodic rebalance leaves the assignment in place and adds work on every run.
17
+
18
+ **Stop:**
19
+ - Do not start the next fix before the premise is written down and the census exists.
20
+ - If the census is even across actors, the premise is not the cause. Look for the cause elsewhere and keep the census as evidence.
21
+
22
+ This principle is distinct from [Redesign from First Principles](redesign-from-first-principles.md), which rebuilds a design around a new requirement. It questions a fact the current design assumes.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: principle-boundary-discipline
3
+ description: "Apply when wiring validation, error handling, or framework adapters. Concentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions."
4
+ ---
5
+
6
+ # Boundary Discipline
7
+
8
+ Place validation, type narrowing, and error handling at system boundaries. Trust internal code unconditionally. Business logic lives in pure functions. The shell is thin and mechanical.
9
+
10
+ **Why:** Scattered validation is noisy, redundant, and gives a false sense of safety. Keep logic out of framework wiring so it can be tested without the framework.
11
+
12
+ **The pattern:**
13
+ - **At boundaries** (CLI args, config files, external APIs, network protocols): validate, return errors, handle defensively.
14
+ - **Inside the system:** typed data, error propagation, no re-validation. Trust the types.
15
+ - **Across the boundary.** Expose domain concepts, not the boundary's private representation. Keep general-purpose mechanism inside and special-purpose policy at the edge.
16
+
17
+ **Applications:**
18
+
19
+ Validation and error handling:
20
+ - Validate config at parse time (the boundary), not inside business logic
21
+ - Parse raw data into domain types at the boundary
22
+ - Do not re-export transport, storage, framework, or wire types through the public surface
23
+ - No redundant nil checks deep in call chains if the boundary already validated
24
+
25
+ Code organization:
26
+ - Business logic in pure functions with no framework dependencies
27
+ - Parse functions: pure transforms from raw bytes to typed state
28
+ - Prompt construction: structured state in, string out
29
+ - Scoring and assessment: pure transforms from state to results
30
+
31
+ **The tests:**
32
+ - "Is this data crossing a system boundary right now?" If not, validation is redundant.
33
+ - "Can this be a pure function that the shell just calls?" If yes, extract it.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: principle-build-the-lever
3
+ description: "Apply to any non-trivial work, not just bulk work: edits, migrations, analyses, checks. Build the tool that does it or proves it (codemod, script, generator, or a skill your subagents follow) instead of working by hand. The tool is the artifact a reviewer can rerun."
4
+ ---
5
+ # Build the Lever
6
+
7
+ When the work isn't trivial, build the tool that does it instead of doing it by hand.
8
+
9
+ A codemod, generator, or script does the work the same way every time and reruns for free. The tool is one artifact a reviewer can read and rerun to check the work. Hand-done changes can only be re-verified by redoing them. A deterministic script turns "trust me" into "run this".
10
+
11
+ Default to building the lever. Skip it only when the task is trivial, a couple of obvious edits you can see at a glance.
12
+
13
+ - Do the first unit by hand to learn the recipe, then build the tool. Prove it by rerunning it on that unit and diffing against your hand-done version. Make the lever safe to rerun.
14
+ - Codemod or script for edits, generator for repetitive files, a dump-to-sqlite query for analysis, a rerunnable check for verification.
15
+ - A deterministic lever beats fan-out. If the tool can process every unit in one pass, run it yourself. Don't fan out delegates to hand-apply what a script can do.
16
+ - When you fan work out to subagents, write the lever as a skill they all read: the recipe, the verification contract, and the do-not-touch fences in one artifact. Keep it outside the delegates' write scope so they can't quietly edit the contract.
17
+ - Applying this principle produces a file. If you cited it and there is no codemod, script, generator, or delegate skill in the diff, you didn't apply it.
18
+ - Commit the lever when the work outlives the session.
19
+
20
+ The bar is triviality, not repetition. A one-off still earns a lever when the lever is what makes the work checkable. Per the [Laziness Protocol](laziness-protocol.md), build the smallest script that does or proves the job, never a framework.
21
+
22
+ Distinct from [Encode Lessons in Structure](encode-lessons-in-structure.md), which makes a recurring instruction a durable guardrail. This is throughput and reviewability on the work in front of you. For scripting the verification itself, see [Prove It Works](prove-it-works.md).
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: principle-encode-lessons-in-structure
3
+ description: "Apply when you catch yourself writing the same instruction a second time, or notice a recurring correction. Encode the rule as a lint, metadata flag, runtime check, or script instead of more text."
4
+ ---
5
+
6
+ # Encode Lessons in Structure
7
+
8
+ If the lesson needs judgment and cannot be encoded, make the instruction more prominent and add an example of the failure mode.
9
+
10
+ **Corollary:** If the fix is structural, only use the structural fix. The instruction is the symptom.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: principle-exhaust-the-design-space
3
+ description: "Apply when facing a novel UI interaction or architectural decision with no precedent in the codebase. Build 2-3 competing prototypes and compare side by side before committing."
4
+ ---
5
+
6
+ # Exhaust the Design Space
7
+
8
+ It also applies to product design decisions where user experience depends on feel, not logic.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: principle-experience-first
3
+ description: "Apply when product, UX, or feature-scope tradeoffs come up. Choose user delight over implementation convenience; ship fewer polished features over more rough ones."
4
+ ---
5
+
6
+ # Experience First
7
+
8
+ When implementation convenience conflicts with user delight, choose delight.
9
+
10
+ - Every feature, control, and option must be justified
11
+ - Ship less, ship better (polished experience with three features beats rough one with ten)
12
+ - Prototype before committing (design decisions are cheaper in throwaway HTML than production code)
13
+ - Get the details right (transitions, alignment, spacing, feedback, error states)
14
+ - Tighten the core loop (every feature should serve the central workflow or get out of the way)
15
+
16
+ The user is whoever consumes the work. For a UI that is the end user. For a library or an internal API it is the colleague who imports it. The engineer who maintains the code next is a user too. Weigh their experience the same way, and explain impact from their perspective.
17
+
18
+ Foundations should serve the experience. Foundational thinking governs the *sequence* of work. This principle governs the *target*.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: principle-explain-the-number
3
+ description: "Apply before you trust, report, or act on a number you measured: a speedup, a regression, a throughput, a latency, or an eval result. Find what limits it, and rule out that it measured something other than the work you think."
4
+ ---
5
+
6
+ # Explain the Number
7
+
8
+ - **Ask "why not double?"** Name the resource or code path that bounds the result, such as a core, a lock, the disk, the network, or the load generator itself. Get it from a profile or from system counters taken during a run, then map it to source. A guess from reading the code is not a limiter. If you cannot say why the number is not twice as good, you do not know what you measured.
9
+ - **List what else the number could be measuring, and rule out each one with evidence.** The usual suspects are errors, skipped or cached work, code that never ran, an untuned side (one left on default settings), noise, and a piece too small to matter end to end.
10
+ - **Keep the evidence with the number.** Put the run count, the spread, and the limiter in the notes or a linked artifact.
11
+
12
+ For a performance number, run the full procedure with the [benchmark-checklist](../skills/benchmark-checklist/SKILL.md) skill. For an eval result, ask the same of the trials: did every run do the task, does the gap hold across trials and models, and does the scenario matter.
13
+
14
+ You skipped this when the evidence behind a number has no run count, no spread, or no named limiter, or when the time saved is larger than the time the changed piece took.
15
+
16
+ Distinct from [Prove It Works](prove-it-works.md), which checks that an output is real.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: principle-fix-root-causes
3
+ description: "Apply when debugging. Trace each symptom to its root cause and fix it there; reproduce first, ask why until you reach it, resist nil-check guards that silence crashes."
4
+ ---
5
+
6
+ # Fix Root Causes
7
+
8
+ When debugging, do not fix symptoms. Trace every problem to its root cause and fix it there.
9
+
10
+ **Why:** Symptom fixes accumulate. Each workaround makes the system harder to reason about, and the real bug remains. Root-cause fixes are slower upfront but reduce total debugging time.
11
+
12
+ **Pattern:**
13
+ - Reproduce first
14
+ - Ask "why" until you hit the root cause
15
+ - Do not add guards (adding a nil check to silence a crash is a symptom fix)
16
+ - If a workaround needs a paragraph-long comment to justify it, the code is wrong (fix the code, not the comment)
17
+ - Check for the pattern, not just the instance (grep for the same pattern, fix all instances)
18
+ - When stuck, instrument. Don't guess (add logging, read the actual error)
19
+ - If the deciding fact took a deep dig to find, propose the cheap, always-on signal that would have shown it at first look
20
+
21
+ **Restart bugs: suspect state before code**
22
+
23
+ When something "fails after restart," suspect stale persistent state first: config files, caches, lock files, serialized state. If clearing a state file restores behavior, prioritize state validation as the fix.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: principle-foundational-thinking
3
+ description: "Apply before writing logic: choosing core types and data structures, sequencing scaffold-vs-feature work, asking what concurrent actors share. Get the data structures right so downstream code becomes obvious."
4
+ ---
5
+
6
+ # Foundational Thinking
7
+
8
+ **Structural decisions** protect option value. **Code-level decisions** protect simplicity.
9
+
10
+ **Data structures first.** Get the data shape right before writing logic. Define core types early, trace every access pattern, and choose structures that match the dominant paths.
11
+
12
+ At code level, DRY the structure, not every line. Types and data models should converge. Three similar statements still beat a premature abstraction. Prefer explicit over clever. Test behavior and edge cases, not line counts.
13
+
14
+ **Concurrency corollary.** Before sharing state between actors, ask "what happens if another actor modifies this concurrently?" If not "nothing", isolate.
15
+
16
+ **Scaffold first.** If something helps every later phase, do it first. Ask "does every subsequent phase benefit from this existing?" CI, linting, test infrastructure, and shared types are scaffold. Sequence for option value: setup before features, tests before fixes. Keep commits small and single-purpose.
17
+
18
+ Each increment should land a coherent abstraction or deepen one that exists. Do not spread a new capability across callers as special-case coordination.
19
+
20
+ Subtraction comes before scaffolding. Remove dead code first, then lay foundations.
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: principle-guard-the-context-window
3
+ description: "Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads."
4
+ ---
5
+
6
+ # Guard the Context Window
7
+
8
+ **Why:** Context overflow degrades reasoning quality, creates compression artifacts, and halts progress.
9
+
10
+ **Pattern:**
11
+ - **Size phases and cap scope.** Limit files per phase, set turn budgets, account for mechanism costs.
@@ -0,0 +1,9 @@
1
+ ---
2
+ name: principle-laziness-protocol
3
+ description: "Apply when refactoring, evaluating diff size, or tempted to add abstractions, layers, or signal threading. Bias toward deletion and the smallest change that solves the problem."
4
+ ---
5
+
6
+ # Laziness Protocol
7
+
8
+ - **Consolidate decisions.** Do not repeat the same choice in several places. Put it behind one source of truth and pass the result as a simple flag.
9
+ - **Minimize the diff.** Make the smallest change that solves the problem. Fewer lines beat "elegant" boilerplate.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: principle-make-operations-idempotent
3
+ description: "Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs."
4
+ ---
5
+
6
+ # Make Operations Idempotent
7
+
8
+ Design operations so they converge to the correct state regardless of how many times they run or where they start from. Every state-mutating operation should answer: "What happens if this runs twice? What happens if the previous run crashed halfway?"
9
+
10
+ **Why:** Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal. If partial state changes the next run's outcome, every restart becomes a debugging session.
11
+
12
+ **The pattern:**
13
+ - Convergent startup: scan for existing state, clean stale artifacts, adopt live sessions
14
+ - Content-based cleanup: compare by content equivalence, not creation order
15
+ - Self-healing locks: use PID-based stale lock detection
16
+ - Idempotent scheduling: failed work respawns cleanly, fresh input regenerated after each cycle
17
+
18
+ **The test:**
19
+ 1. What happens if this runs twice in a row?
20
+ 2. What happens if the previous run crashed at every possible point?
21
+ 3. Does re-execution converge to the same end state?
22
+
23
+ If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: principle-migrate-callers-then-delete-legacy-apis
3
+ description: "Apply when introducing a new internal API while old callers still exist. Migrate callers and delete the old API in the same wave instead of preserving compatibility layers."
4
+ ---
5
+
6
+ # Migrate Callers Then Delete Legacy APIs
7
+
8
+ When we decide a new API is the right design, migrate callers and remove the old API in the same refactor wave instead of preserving compatibility layers.
9
+
10
+ **Rule:**
11
+ - Do not keep legacy API paths only because internal callers still exist
12
+ - Inventory callers, migrate them, and delete the old API immediately
13
+ - Treat temporary adapters as exceptional and time-boxed, not default architecture
14
+ - Update tests to assert the new contract, and delete tests that only protect pre-refactor implementation details
15
+
16
+ **When this applies:**
17
+ - No external users depend on backward compatibility
18
+ - The project can absorb coordinated breaking changes
19
+ - The new API is part of a simplification or refactor initiative
20
+
21
+ Keeping both old and new APIs creates dual-path complexity, slows cleanup, and makes the codebase feel append-only.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: principle-minimize-reader-load
3
+ description: "Apply when reviewing or shaping code that's hard to trace. Count layers between question and answer, and hidden state in the reader's head; collapse one-caller wrappers and shrink mutable scope."
4
+ ---
5
+
6
+ # Minimize Reader Load
7
+
8
+ Maintainability is the work a reader must do to understand code. Track two axes: **layers to trace** (indirections between the question and the answer) and **state to hold** (hidden or mutable context the reader must keep in their head). LOC, cyclomatic complexity, and "clean architecture" are proxies. Reader load is the thing that matters. The two axes are independent. A flat file with 50 globals can be as hard to reason about as a 6-layer adapter stack. Guard both. This is the human analog of [Guard the Context Window](guard-the-context-window.md). Working memory is finite for readers too.
9
+
10
+ - **Collapse layers** that cost more than they save: wrappers with one caller, adapters with no second implementation, speculative indirection that was never needed. Inline them.
11
+ - **Make adjacent layers change the abstraction.** A layer that repeats the same methods and arguments adds reader load without compression. Collapse pass-through layers.
12
+ - **Demand interface compression.** A broad interface that hides little complexity makes readers learn both the surface and the implementation. Prefer boundaries that hide meaningful decisions.
13
+ - **Shrink state scope:** prefer pure functions (returns over mutations), locals over fields, fields over module state, and module state over globals. Derive instead of sync.
14
+ - **Name the invariant at the boundary,** not in every consumer, so the reader learns it once.
15
+ - Before adding a layer or a piece of state, ask: does it reduce reader load elsewhere by at least as much?
16
+
17
+ **The test:** can a new reader answer "where does X come from?" and "what can change X?" in under 30 seconds? If not, cut layers or cut state.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: principle-model-the-domain
3
+ description: "Apply when writing stateful logic, or when code branches a lot or repeats a shape assumption across files."
4
+ ---
5
+
6
+ # Model the Domain
7
+
8
+ Encode the real domain in a data structure instead of scattering it across conditionals. A structure that matches the domain makes invalid states unrepresentable and deletes branches. Choosing it at write time is cheap. Recovering it later reads as a refactor and gets deferred.
9
+
10
+ Reach for:
11
+
12
+ - A state machine instead of scattered booleans, phases, or lifecycle checks.
13
+ - A typed model instead of loose parameters or repeated shape assumptions.
14
+ - A map, registry, lookup table, or discriminated union instead of branching spread across files.
15
+ - A reducer or command/event model instead of ad hoc state mutations.
16
+ - A module organized around one body of domain knowledge instead of a sequence such as load, validate, transform, and save. Execution order is not ownership.
17
+ - A small module boundary that gathers repeated behavior, ownership, or invariants.
18
+ - A queue, cache, index, graph, tree, or normalized collection where the access pattern calls for it.
19
+ - Any other structure that fits. When none fits, work out what the code must never allow and how the data gets read, then find the structure that encodes exactly that.
20
+
21
+ Do not force an abstraction. Prefer boring code if the current shape is already clear, local, and unlikely to grow. Be skeptical of an abstraction that adds indirection without removing branches, duplicated rules, invalid states, or lifecycle risk.
22
+
23
+ The sign that you skipped this is a new feature that grows an existing if/else chain by one more branch, or a second boolean that must stay in sync with the first. Temporal decomposition is another sign. Phase-named modules repeat the same domain rules across steps.
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: principle-never-block-on-the-human
3
+ description: "Apply when tempted to ask 'should I do X?' on reversible work."
4
+ ---
5
+
6
+ # Never Block on the Human
7
+
8
+ The human supervises asynchronously. Agents must stay unblocked. Make reasonable decisions, proceed, and let the human course-correct after the fact. Since code changes are reversible and reviewable, a wrong decision usually costs less than blocking.
9
+
10
+ - Proceed, then present. Do the work, show the result. Don't ask "should I do X?" Do X, explain why.
11
+ - Make the system self-healing. When you notice a problem, log it and fix it in the next round.
12
+ - Irreversible actions (force-push, delete production data, send external messages) still require confirmation.
13
+ - Reversible actions (write code, edit notes, split tasks) should proceed without blocking.
14
+ - Product direction comes from the human. Execution should not block.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: principle-outcome-oriented-execution
3
+ description: "Apply during planned rewrites and migrations with explicit phase boundaries. Converge on the target architecture; don't preserve smooth intermediate states with throwaway compatibility code."
4
+ ---
5
+
6
+ # Outcome-Oriented Execution
7
+
8
+ Optimize for the intended, verifiable end state rather than preserving smooth intermediate states.
9
+
10
+ **Why:** Keeping every intermediate step fully stable often creates temporary compatibility code that becomes long-lived debt. Converge on the target architecture and prove correctness at explicit verification boundaries.
11
+
12
+ **Core rule:**
13
+ - Prioritize end-state integrity over transitional stability
14
+ - Intermediate breakage is acceptable when it is planned, scoped, and reversible
15
+
16
+ **Guardrails:**
17
+ - Use this for planned rewrites and migrations with explicit phase boundaries
18
+ - Declare where temporary breakage is acceptable
19
+ - Keep high-signal checks for actively touched areas while migrating
20
+ - Require full static and runtime verification at plan completion
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: principle-prove-it-works
3
+ description: "Apply after completing a task, before declaring done. Verify against the real artifact (run the feature, read the actual value, inspect the diff), not a proxy, self-report, or 'it compiles.'"
4
+ ---
5
+
6
+ # Prove It Works
7
+
8
+ Verify every task output by checking the real thing directly. Do not infer from proxies, self-reports, or "it compiles."
9
+
10
+ **Why:** Unverified work has unknown correctness. Indirect verification (file mtimes, output freshness, agent self-reports, cached screenshots) feels cheaper than direct observation. Acting on a wrong inference costs far more than checking the source.
11
+
12
+ Check the real thing, not a proxy:
13
+ - Check process liveness directly, not indirectly through derived state
14
+ - Read the actual value, not a cached or derived representation
15
+ - When verification fails, suspect the observation method before suspecting the system
16
+
17
+ ## Script the check when you can
18
+
19
+ The strongest proof is a deterministic script that re-runs the same comparison, not a one-time eyeball. Write the script, run it, and keep its output as an artifact a reviewer can re-run instead of trusting your word.
20
+
21
+ Keep the artifact visible for the human. Commit it only for large or complex work where the trail has to be auditable later, like a big port or migration (the **show-me-your-work** skill).
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: principle-redesign-from-first-principles
3
+ description: "Apply when integrating a new requirement into an existing design."
4
+ ---
5
+
6
+ # Redesign From First Principles
7
+
8
+ When integrating a change, don't bolt it onto the existing design. Redesign as if the requirement had been a foundational assumption from the start.
9
+
10
+ - Read all affected files and understand the current design
11
+ - Ask: "if we were writing this from scratch with this new requirement, what would we build?"
12
+ - Propagate the change through every reference: types, docs, examples, rationale sections
13
+ - Think about the whole redesign, then deliver it incrementally
14
+
15
+ This is the method for preserving option value when integrating changes into an existing design.
@@ -0,0 +1,15 @@
1
+ ---
2
+ name: principle-separate-before-serializing-shared-state
3
+ description: "Apply when concurrent actors might write to the same file, branch, key, or state object. Eliminate the sharing first; serialize structurally only when one shared writer is a real invariant."
4
+ ---
5
+
6
+ # Separate Before Serializing Shared State
7
+
8
+ When concurrent actors might share mutable state, first ask whether they need the same mutable object. If not, eliminate the sharing. When sharing is real, enforce serialization structurally: lockfiles, sequential phases, exclusive ownership. Instructions and conventions are not concurrency control.
9
+
10
+ **Why:** Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug.
11
+
12
+ **Pattern:**
13
+ 1. **Identify shared mutable state** (files both read and write, branches both push to, APIs both define and consume).
14
+ 2. **Default: eliminate the shared write target.** Ask: do these actors need one canonical object, or are they publishing independent facts? Give each actor its own owned file, key, branch, or state directory, and merge only at the read/reporting boundary. Two workers writing their own `lastX` field into one `state.json` is still shared mutation. `indexer-state.json` + `metrics-state.json` is not.
15
+ 3. **Only when one shared write target is a real invariant, serialize access structurally** (lockfiles, sequential phases, single-writer actor, or atomic compare-and-swap). Treat "we need a lock" as a design smell to check, not as the default answer.
@@ -0,0 +1,16 @@
1
+ ---
2
+ name: principle-sequence-verifiable-units
3
+ description: "Apply to multi-step work (sweeps, migrations, runs of similar edits) and to how you stack commits and PRs. Break work into small units that each end in a verifiable state, check each before the next, and order delivery so the sequence proves itself to a reviewer."
4
+ ---
5
+
6
+ # Sequence work into verifiable units
7
+
8
+ Order work as a sequence of small units, each ending in a state you can check, and don't advance until the current one is green.
9
+
10
+ **Why:** A break caught at the unit that caused it is cheap to localize. A break caught after a batch is buried, and you have already built further on a broken base. Sequencing those same units into a delivery a reviewer can replay turns "trust me" into "watch it go red, then green."
11
+
12
+ **Execution.** In a sweep, migration, or any run of similar edits, verify each change before starting the next. Each unit is a before/after bracket: known-good state, one change, run the check, then proceed. Rebase onto clean trunk first so every check measures against the real baseline. When a lever does the edits, the per-unit check is nearly free. Run it anyway.
13
+
14
+ **Delivery.** Stack commits and PRs in the order that proves the work. The canonical shape is the failing test first, then the fix on top. Other story orders are a subtraction before the reshape, a baseline capture before the treatment, the scaffold before the feature. Each commit lands on its own and the sequence reads as an argument.
15
+
16
+ The sequencing complement to the **prove-it-works** principle skill, which keeps each check real, and the **build-the-lever** principle skill, which makes the per-unit check cheap.
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: principle-subtract-before-you-add
3
+ description: "Apply when sequencing an addition, refactor, or rewrite. Remove dead code, redundant validators, and stub references first, then build on the simpler base."
4
+ ---
5
+
6
+ # Subtract Before You Add
7
+
8
+ When evolving a system, remove complexity first, then build. Default to subtraction.
9
+
10
+ Make simplification a continual investment. Leave the design slightly simpler and more capable behind the same or smaller surface than you found it.
11
+
12
+ - Sequence removal before construction
13
+ - Cut before you polish (get to the minimum before investing in quality)
14
+ - Design for observed usage, not speculative edge cases
15
+ - No speculative validators, parsers, or guards beyond what the spec demands
16
+ - Simplify prompts (remove redundant instructions, excessive templates)
17
+ - When a reference has no novel content, delete it rather than leaving a stub
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: principle-test-behavior-not-implementation
3
+ description: "Apply when you write, change, or keep a test. Call the code as its users do and assert the exact result they see. Rewrite or delete a test that would pass if every imported function returned undefined."
4
+ ---
5
+
6
+ # Test Behavior, Not Implementation
7
+
8
+ A test calls the code as its users do and asserts the exact result they see. Rewrite or delete any test that would still pass if every imported function returned `undefined` or a wrong value.
9
+
10
+ These shapes fail that check:
11
+
12
+ - Loose or no assertion: `toBeDefined`, `toBeTruthy`, `not.toThrow`, `toBeGreaterThan(0)`.
13
+ - Call or absence only: `toHaveBeenCalled`, `not.toHaveBeenCalled`, `toBeUndefined`, `toEqual([])`.
14
+ - Expected value computed by the code under test: `expect(f(a)).toBe(f(a))`.
15
+ - Restated constant, config default, table row, or prompt string.
16
+ - Assertions on data the test built, with no call to the subject.
17
+
18
+ Fix: call the subject in the test body with one concrete input and assert the literal output or effect. For a mock, assert the payload it received. For an absence, also assert the presence on another input. For a constant, test the mechanism that reads it with one input instead of restating the value.
19
+
20
+ Keep relation checks across table rows (a key in two tables, a parent that exists) and `*.test-d.ts` type checks.