@justjoshn/pi-pstack 0.15.36-pi.1 → 0.15.36-pi.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 (114) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +15 -12
  3. package/agents/ci-watcher.md +27 -0
  4. package/agents/thermo-nuclear-code-quality-review.md +23 -0
  5. package/assets/logo.png +0 -0
  6. package/automations/benny/FOR_AGENTS.md +1 -1
  7. package/automations/benny/README.md +2 -2
  8. package/automations/benny/skills/setup-benny/SKILL.md +5 -5
  9. package/bin/pstack-routines-supervisor +9 -0
  10. package/docs/guide/07-overnight.md +1 -1
  11. package/docs/guide/09-make-it-yours.md +1 -1
  12. package/docs/guide/10-recipes-and-pitfalls.md +1 -1
  13. package/docs/native-gaps.md +11 -5
  14. package/docs/parity-reverse-engineering.md +94 -0
  15. package/package.json +41 -6
  16. package/packaging/install-supervisor-unit.sh +164 -0
  17. package/packaging/launchd/com.pstack.routines-supervisor.plist.example +24 -0
  18. package/packaging/systemd/pstack-routines-supervisor.service.example +15 -0
  19. package/skills/architect/SKILL.md +1 -1
  20. package/skills/architect/references/runner-prompt.md +1 -1
  21. package/skills/arena/SKILL.md +3 -3
  22. package/skills/check-compiler-errors/SKILL.md +23 -0
  23. package/skills/create-skill/SKILL.md +515 -29
  24. package/skills/fix-ci/SKILL.md +29 -0
  25. package/skills/fix-merge-conflicts/SKILL.md +32 -0
  26. package/skills/get-pr-comments/SKILL.md +23 -0
  27. package/skills/how/SKILL.md +1 -1
  28. package/skills/ketchup-video/SKILL.md +2 -2
  29. package/skills/loop-on-ci/SKILL.md +50 -0
  30. package/skills/make-bot-ui/SKILL.md +2 -2
  31. package/skills/make-pr-easy-to-review/SKILL.md +59 -0
  32. package/skills/new-branch-and-pr/SKILL.md +29 -0
  33. package/skills/no-inline-imports/SKILL.md +12 -0
  34. package/skills/poteto-help/SKILL.md +4 -4
  35. package/skills/poteto-mode/playbooks/multi-phase-plan.md +1 -1
  36. package/skills/poteto-mode/playbooks/orchestrate.md +1 -1
  37. package/skills/pr-review-canvas/SKILL.md +176 -0
  38. package/skills/pr-review-canvas/renderer.js +170 -0
  39. package/skills/pr-review-canvas/styles.css +96 -0
  40. package/skills/pr-review-canvas/template.html +18 -0
  41. package/skills/reflect/SKILL.md +1 -1
  42. package/skills/review-and-ship/SKILL.md +41 -0
  43. package/skills/run-smoke-tests/SKILL.md +42 -0
  44. package/skills/statechart/scripts/test/cli.test.ts +1 -1
  45. package/skills/swarm/SKILL.md +2 -2
  46. package/skills/thermo-nuclear-code-quality-review/SKILL.md +192 -0
  47. package/skills/typescript-exhaustive-switch/SKILL.md +10 -0
  48. package/skills/verify-this/SKILL.md +74 -0
  49. package/skills/weekly-review/SKILL.md +32 -0
  50. package/skills/what-did-i-get-done/SKILL.md +31 -0
  51. package/skills/why/SKILL.md +1 -1
  52. package/skills/workflow-from-chats/SKILL.md +50 -0
  53. package/src/mode.ts +3 -3
  54. package/src/paths.ts +13 -0
  55. package/src/pi-command.ts +12 -0
  56. package/src/rule.ts +4 -4
  57. package/src/sections.ts +2 -1
  58. package/src/subscriptions/durable-store.ts +482 -0
  59. package/src/subscriptions/durable-types.ts +41 -0
  60. package/src/subscriptions/ensure-supervisor.ts +67 -0
  61. package/src/subscriptions/index.ts +231 -271
  62. package/src/subscriptions/supervisor-main.ts +88 -0
  63. package/src/subscriptions/supervisor.ts +271 -0
  64. package/src/subscriptions/webhook.ts +22 -9
  65. package/src/task/card.ts +29 -0
  66. package/src/task/records.ts +3 -8
  67. package/src/task/runner.ts +9 -14
  68. package/src/task/tool.ts +18 -21
  69. package/src/todo.ts +1 -2
  70. package/scripts/live-e2e.mjs +0 -257
  71. package/test/aliases.test.ts +0 -57
  72. package/test/ask.test.ts +0 -85
  73. package/test/autocomplete.test.ts +0 -39
  74. package/test/e2e/aliases.e2e.test.ts +0 -81
  75. package/test/e2e/ask.e2e.test.ts +0 -135
  76. package/test/e2e/harness.ts +0 -179
  77. package/test/e2e/host.e2e.test.ts +0 -193
  78. package/test/e2e/lifecycle.e2e.test.ts +0 -99
  79. package/test/e2e/mode.e2e.test.ts +0 -160
  80. package/test/e2e/package.e2e.test.ts +0 -67
  81. package/test/e2e/task.e2e.test.ts +0 -734
  82. package/test/e2e/todo.e2e.test.ts +0 -59
  83. package/test/fixtures/cursor-askquestion-calls.json +0 -806
  84. package/test/fixtures/fake-pi.mjs +0 -96
  85. package/test/fixtures/image-model.ts +0 -16
  86. package/test/fixtures/list-models.ts +0 -15
  87. package/test/fixtures/readonly-shell-exit.ts +0 -17
  88. package/test/fixtures/scripted-model.ts +0 -113
  89. package/test/loop.test.ts +0 -209
  90. package/test/mode.test.ts +0 -143
  91. package/test/plan.test.ts +0 -126
  92. package/test/readonly-shell-security.test.ts +0 -84
  93. package/test/readonly-shell.test.ts +0 -44
  94. package/test/records.test.ts +0 -143
  95. package/test/registry.test.ts +0 -18
  96. package/test/resources.test.ts +0 -162
  97. package/test/rule.test.ts +0 -92
  98. package/test/scripts.test.ts +0 -182
  99. package/test/sections.test.ts +0 -56
  100. package/test/subscriptions-cron.test.ts +0 -60
  101. package/test/subscriptions.test.ts +0 -598
  102. package/test/task-agents.test.ts +0 -49
  103. package/test/task-card.test.ts +0 -34
  104. package/test/task-fork.test.ts +0 -233
  105. package/test/task-format.test.ts +0 -65
  106. package/test/task-model.test.ts +0 -141
  107. package/test/task-runner.test.ts +0 -259
  108. package/test/task-schema.test.ts +0 -50
  109. package/test/task-status.test.ts +0 -155
  110. package/test/task-worktree.test.ts +0 -106
  111. package/test/todo.test.ts +0 -74
  112. package/test/visualize.test.ts +0 -152
  113. package/tsconfig.json +0 -5
  114. package/vitest.config.ts +0 -16
@@ -0,0 +1,96 @@
1
+ :root {
2
+ --bg: #1a1a1a;
3
+ --surface: #222;
4
+ --surface-raised: #2a2a2a;
5
+ --border: #333;
6
+ --text: #bbb;
7
+ --text-muted: #777;
8
+ --text-bright: #e5e5e5;
9
+ --accent: #7aa2f7;
10
+ --warning: #e0a458;
11
+ --success: #73b87e;
12
+ --danger: #e06060;
13
+ }
14
+ * { margin: 0; padding: 0; box-sizing: border-box; }
15
+ body {
16
+ background: var(--bg);
17
+ color: var(--text);
18
+ font-family: 'Inter', -apple-system, sans-serif;
19
+ font-size: 13px;
20
+ line-height: 1.5;
21
+ }
22
+ .header {
23
+ border-bottom: 1px solid var(--border);
24
+ padding: 24px 32px 20px;
25
+ }
26
+ .header h1 { font-size: 20px; font-weight: 600; color: var(--text-bright); margin-bottom: 4px; }
27
+ .header-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 16px; align-items: center; margin-top: 8px; }
28
+ .pill { display: inline-flex; padding: 1px 8px; border-radius: 10px; font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 500; }
29
+ .pill.add { background: #73b87e22; color: var(--success); }
30
+ .pill.del { background: #e0606022; color: var(--danger); }
31
+ .pill.files { background: #7aa2f722; color: var(--accent); }
32
+ .content { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }
33
+ .summary { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 20px; margin-bottom: 28px; font-size: 13px; line-height: 1.6; }
34
+ .summary strong { color: var(--text-bright); }
35
+ .summary ul { margin-top: 8px; padding-left: 18px; }
36
+ .summary li { margin-bottom: 4px; }
37
+ .section-title { font-size: 14px; font-weight: 600; color: var(--text-bright); margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
38
+ .ic { font-family: 'IBM Plex Mono', monospace; font-size: 11px; background: var(--surface-raised); padding: 1px 5px; border-radius: 3px; color: var(--accent); }
39
+
40
+ .file-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 12px; }
41
+ .file-hdr {
42
+ display: flex; align-items: center; justify-content: space-between;
43
+ padding: 8px 14px; background: var(--surface-raised); border-bottom: 1px solid var(--border);
44
+ cursor: pointer; user-select: none; position: sticky; top: 0; z-index: 12; border-radius: 6px 6px 0 0;
45
+ }
46
+ .file-hdr:hover { background: #303030; }
47
+ .file-hdr .fname { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--accent); }
48
+ .file-hdr .fstats { display: flex; gap: 6px; align-items: center; }
49
+ .file-hdr .chev { color: var(--text-muted); transition: transform 0.15s; font-size: 11px; margin-left: 10px; }
50
+ .file-hdr .chev.open { transform: rotate(90deg); }
51
+ .file-body { display: none; }
52
+ .file-body.open { display: block; }
53
+ .file-note {
54
+ padding: 10px 14px; font-size: 13px; color: var(--text); line-height: 1.55;
55
+ border-bottom: 1px solid var(--border); background: var(--surface);
56
+ position: sticky; top: 35px; z-index: 11;
57
+ }
58
+ .file-note strong { color: var(--text-bright); }
59
+ .file-note ul { margin-top: 6px; padding-left: 18px; }
60
+ .file-note li { margin-bottom: 3px; }
61
+
62
+ .bp-section { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
63
+ .bp-hdr { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; cursor: pointer; user-select: none; font-size: 12px; color: var(--text-muted); }
64
+ .bp-hdr:hover { background: var(--surface-raised); }
65
+ .bp-hdr .chev { color: var(--text-muted); transition: transform 0.15s; font-size: 11px; }
66
+ .bp-hdr .chev.open { transform: rotate(90deg); }
67
+ .bp-body { display: none; border-top: 1px solid var(--border); }
68
+ .bp-body.open { display: block; }
69
+ .bp-note { padding: 8px 14px; font-size: 12px; color: var(--text-muted); line-height: 1.5; border-bottom: 1px solid var(--border); background: var(--bg); }
70
+
71
+ .diff-table { width: 100%; border-collapse: collapse; font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 20px; table-layout: fixed; tab-size: 4; }
72
+ .diff-table td { vertical-align: top; white-space: pre; }
73
+ .diff-ln { width: 40px; min-width: 40px; max-width: 40px; text-align: right; padding: 0 6px 0 0; color: #555; background: var(--surface); user-select: none; }
74
+ .diff-code { padding: 0 12px; color: var(--text); background: var(--bg); overflow-x: auto; }
75
+ tr.diff-add .diff-ln { color: #5a8a5a; background: #1a2a1a; }
76
+ tr.diff-add .diff-code { background: #1a2a1a; color: #c8e6c8; }
77
+ tr.diff-del .diff-ln { color: #8a5a5a; background: #2a1a1a; }
78
+ tr.diff-del .diff-code { background: #2a1a1a; color: #e6c8c8; }
79
+ tr.diff-ctx .diff-ln { background: var(--surface); }
80
+ tr.diff-ctx .diff-code { background: var(--bg); color: var(--text-muted); }
81
+ tr.diff-hunk td { background: var(--surface-raised); color: var(--text-muted); font-size: 11px; padding: 3px 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
82
+ tr.diff-hunk .diff-ln { background: var(--surface-raised); }
83
+ tr.diff-moved-del .diff-ln { color: #6a6a8a; background: #1a1a2a; }
84
+ tr.diff-moved-del .diff-code { background: #1a1a2a; color: #a8a8d0; }
85
+ tr.diff-moved-add .diff-ln { color: #6a6a8a; background: #1a1a2a; }
86
+ tr.diff-moved-add .diff-code { background: #1a1a2a; color: #a8a8d0; }
87
+ tr.diff-moved-del-edited .diff-ln { color: #7a6a8a; background: #221a2a; }
88
+ tr.diff-moved-del-edited .diff-code { background: #221a2a; color: #c0a8d0; }
89
+ tr.diff-moved-add-edited .diff-ln { color: #7a6a8a; background: #221a2a; }
90
+ tr.diff-moved-add-edited .diff-code { background: #221a2a; color: #c0a8d0; }
91
+
92
+ .verdict { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 16px 20px; margin-top: 28px; }
93
+ .verdict h3 { font-size: 14px; font-weight: 600; color: var(--text-bright); margin-bottom: 8px; }
94
+ .verdict ul { padding-left: 18px; }
95
+ .verdict li { font-size: 13px; margin-bottom: 6px; line-height: 1.5; }
96
+ .verdict li strong { color: var(--text-bright); }
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
7
+ <style>
8
+ /* INJECT_CSS */
9
+ </style>
10
+ <script>
11
+ /* INJECT_JS */
12
+ </script>
13
+ </head>
14
+ <body>
15
+ <!-- INJECT_BODY -->
16
+ <script id="pr-diffs-json" type="application/json" data-pr-diffs>{"__PR_DIFFS_PLACEHOLDER__":true}</script>
17
+ </body>
18
+ </html>
@@ -24,7 +24,7 @@ That covers this workspace's Pi session files (`<sessions>/*.jsonl`) and subagen
24
24
 
25
25
  One message, three `Task` calls, `subagent_type: generalPurpose`, `readonly` unset (`readonly: false`). Reviewers need MCP access to look up the tickets, chat threads, and observability traces the transcript references, and readonly strips MCPs.
26
26
 
27
- Each reviewer and the synthesizer name a role line in the model rule (`~/.pi/agent/pstack/pstack-models.md`) and a default. Set `model` to that line's value, or to the default if the rule or the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
27
+ Each reviewer and the synthesizer name a role line in the model rule at the path the system prompt names and a default. Set `model` to that line's value, or to the default if the rule or the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
28
28
 
29
29
  | Lens | Role line | Default `model` | Prompt template |
30
30
  |---|---|---|---|
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: review-and-ship
3
+ description: Review the current branch for bugs, intent fit, and test coverage; run or write tests; commit focused work; open or update a PR.
4
+ ---
5
+
6
+ # Review and ship
7
+
8
+ ## Trigger
9
+
10
+ Reviewing changes before shipping. Close key issues, verify behavior, and open or update a PR.
11
+
12
+ ## Workflow
13
+
14
+ 1. Gather context: diff against base branch, uncommitted changes, recent commits, changed files, and user intent from recent relevant chats if useful.
15
+ 2. Run targeted tests for changed behavior. If no focused tests exist, decide whether to add them or document the gap.
16
+ 3. Review for correctness, regressions, security, and intent fit. Use parallel subagents for larger diffs.
17
+ 4. Fix critical issues before finalizing and re-run affected tests.
18
+ 5. Commit selective files with a concise message.
19
+ 6. Push branch and open or update a PR.
20
+
21
+ ## Suggested Checks
22
+
23
+ ```bash
24
+ git fetch origin main
25
+ git diff origin/main...HEAD
26
+ git status
27
+ gh pr checks --json name,bucket,state,workflow,link
28
+ ```
29
+
30
+ ## Guardrails
31
+
32
+ - Prioritize correctness, security, and regressions over style-only comments.
33
+ - Keep commits focused and avoid unrelated file changes.
34
+ - If pre-commit checks fail, fix the issues rather than bypassing hooks.
35
+ - Use `gh pr checks` instead of GitHub Actions-only commands when judging PR readiness.
36
+
37
+ ## Output
38
+
39
+ - Findings summary (critical, warning, note)
40
+ - Tests run and outcomes
41
+ - PR URL
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: run-smoke-tests
3
+ description: Run Playwright smoke tests, debug failures, and verify fixes
4
+ ---
5
+
6
+ # Run smoke tests
7
+
8
+ ## Trigger
9
+
10
+ Need end-to-end smoke verification before or after changes.
11
+
12
+ ## Workflow
13
+
14
+ 1. Build prerequisites for the target app.
15
+ 2. Run the relevant smoke suite or a focused test file.
16
+ 3. If failing, inspect traces/logs and isolate the root cause.
17
+ 4. Apply a minimal fix and rerun until stable.
18
+
19
+ ## Example Commands
20
+
21
+ ```bash
22
+ # Run full smoke suite
23
+ npm run smoketest
24
+
25
+ # Run a specific smoke test file
26
+ npm run smoketest -- path/to/test.spec.ts
27
+
28
+ # Faster iteration when build artifacts are ready
29
+ npm run smoketest-no-compile -- path/to/test.spec.ts
30
+ ```
31
+
32
+ ## Guardrails
33
+
34
+ - Prefer deterministic waits and assertions over brittle timeouts.
35
+ - Re-run passing fixes to reduce flaky false positives.
36
+ - Quarantine tests only when explicitly requested and documented.
37
+
38
+ ## Output
39
+
40
+ - Test results summary
41
+ - Root cause and fix
42
+ - Remaining flake risk (if any)
@@ -113,7 +113,7 @@ const launcherTools = () => {
113
113
  };
114
114
 
115
115
  const linkedLauncher = () => {
116
- const links = fs.mkdtempSync(path.join(os.tmpdir(), "statechart-links-"));
116
+ const links = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), "statechart-links-")));
117
117
  const [first, second] = [path.join(links, "a"), path.join(links, "b")];
118
118
  fs.mkdirSync(first);
119
119
  fs.mkdirSync(second);
@@ -19,12 +19,12 @@ Open a todolist with one entry per phase before launching anything.
19
19
 
20
20
  1. State the done predicate and the artifact or report the swarm must return.
21
21
  2. Choose the shape. Partition into slices, race N workers on identical briefs, or mix both. For a race or mixed shape, declare `first pass`, `rank all`, or `best-of` before spawning.
22
- 3. Pick the worker model from the `swarm workers` line in `~/.pi/agent/pstack/pstack-models.md`. If the rule or that line is missing, use `grok-4.7:xhigh`. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. For a model race, name each arm's model up front. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
22
+ 3. Pick the worker model from the `swarm workers` line in the model rule at the path the system prompt names. If the rule or that line is missing, use `grok-4.7:xhigh`. For `auto` or `inherit-parent`, omit `model` so the workers run on the parent model. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. For a model race, name each arm's model up front. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
23
23
  4. Give each worker its own writable output when it writes. When workers verify or measure commits, each brief names the exact SHAs. A measurement brief also names the method (sample count, what one sample is, order). The worker records both in its result.
24
24
 
25
25
  ## Phase B: Fan out
26
26
 
27
- Spawn all N workers in one message with `subagent_type: generalPurpose`, `environment: "cloud"`, `run_in_background: true`, and the step 3 model, left unset for `auto` or `inherit-parent`. Use `environment: "local"` only when the worker needs access to something on the user's computer.
27
+ Spawn all N workers in one message with `subagent_type: generalPurpose`, `environment: "cloud"`, `run_in_background: true`, and the step 3 model, left unset for `auto` or `inherit-parent`. Both environments run on the user's computer. `cloud` gives each worker a separate git worktree, not a VM or a credential boundary. Use `environment: "local"` only when the worker needs the existing checkout or its uncommitted state. For concurrent runtime lanes, each brief must assign distinct ports, output directories, and writable cache paths. If the task requires stronger machine isolation, report that requirement as unavailable rather than claiming a worktree provides it.
28
28
 
29
29
  When a worker must start from a non-default pushed branch, pass `cloud_base_branch`.
30
30
 
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: thermo-nuclear-code-quality-review
3
+ description: Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Thermo-Nuclear Code Quality Review
8
+
9
+ Use this skill for an unusually strict review focused on implementation quality, maintainability, abstraction quality, and codebase health.
10
+
11
+ Above all, this skill should push the reviewer to be **ambitious** about code structure. Do not merely identify local cleanup opportunities. Actively search for "code judo" moves: restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
12
+
13
+ ## Core Prompt
14
+
15
+ Start from this baseline:
16
+
17
+ > Perform a deep code quality audit of the current branch's changes.
18
+ > Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
19
+ > Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
20
+ > Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it.
21
+ > Be extremely thorough and rigorous. Measure twice, cut once.
22
+
23
+ ## Non-Negotiable Additional Standards
24
+
25
+ Apply the baseline prompt above, plus these explicit review rules:
26
+
27
+ 0. **Be ambitious about structural simplification.**
28
+ - Do not stop at "this could be a bit cleaner."
29
+ - Look for opportunities to reframe the change so that whole branches, helpers, modes, conditionals, or layers disappear entirely.
30
+ - Prefer the solution that makes the code feel inevitable in hindsight.
31
+ - Assume there is often a "code judo" move available: a re-organization that uses the existing architecture more effectively and makes the change dramatically simpler and more elegant.
32
+ - If you see a path to delete complexity rather than rearrange it, push hard for that path.
33
+
34
+ 1. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.**
35
+ - Treat this as a strong code-quality smell by default.
36
+ - Prefer extracting helpers, subcomponents, modules, or local abstractions instead of letting a file sprawl past 1000 lines.
37
+ - If the diff crosses that threshold, explicitly ask whether the code should be decomposed first.
38
+ - Only waive this if there is a compelling structural reason and the resulting file is still clearly organized.
39
+
40
+ 2. **Do not allow random spaghetti growth in existing code.**
41
+ - Be highly suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows.
42
+ - If a change adds "weird if statements in random places", treat that as a design problem, not a stylistic nit.
43
+ - Prefer pushing the logic into a dedicated abstraction, helper, state machine, policy object, or separate module instead of tangling an existing path.
44
+ - Call out changes that make the surrounding code harder to reason about, even if they technically work.
45
+
46
+ 3. **Bias toward cleaning the design, not just accepting working code.**
47
+ - If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version.
48
+ - Do not rubber-stamp "it works" implementations that leave the codebase messier.
49
+ - Strongly prefer simplifications that remove moving pieces altogether over refactors that merely spread the same complexity around.
50
+
51
+ 4. **Prefer direct, boring, maintainable code over hacky or magical code.**
52
+ - Treat brittle, ad-hoc, or "magic" behavior as a code-quality problem.
53
+ - Be skeptical of generic mechanisms that hide simple data-shape assumptions.
54
+ - Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
55
+
56
+ 5. **Push hard on type and boundary cleanliness when they affect maintainability.**
57
+ - Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist.
58
+ - Prefer explicit typed models or shared contracts over loosely-shaped ad-hoc objects.
59
+ - If a branch relies on silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit instead.
60
+
61
+ 6. **Keep logic in the canonical layer and reuse existing helpers.**
62
+ - Call out feature logic leaking into shared paths or implementation details leaking through APIs.
63
+ - Prefer existing canonical utilities/helpers over bespoke one-offs.
64
+ - Push code toward the right package, service, or module instead of normalizing architectural drift.
65
+
66
+ 7. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.**
67
+ - If independent work is serialized for no good reason, ask whether the flow should run in parallel instead.
68
+ - If related updates can leave state half-applied, push for a more atomic structure.
69
+ - Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the implementation more brittle.
70
+
71
+ ## Primary Review Questions
72
+
73
+ For every meaningful change, ask:
74
+
75
+ - Is there a "code judo" move that would make this dramatically simpler?
76
+ - Can this change be reframed so fewer concepts, branches, or helper layers are needed?
77
+ - Does this improve or worsen the local architecture?
78
+ - Did the diff add branching complexity where a better abstraction should exist?
79
+ - Did a previously cohesive module become more coupled, more stateful, or harder to scan?
80
+ - Is this logic living in the right file and layer?
81
+ - Did this change enlarge a file or component past a healthy size boundary?
82
+ - Are there repeated conditionals that signal a missing model or missing helper?
83
+ - Is the implementation direct and legible, or does it rely on special cases and incidental control flow?
84
+ - Is this abstraction actually earning its keep, or is it just a wrapper?
85
+ - Did the diff introduce casts, optionality, or ad-hoc object shapes that obscure the real invariant?
86
+ - Is this logic living in the canonical layer, or did the diff leak details across a boundary?
87
+ - Is this orchestration more sequential or less atomic than it needs to be?
88
+
89
+ ## What to Flag Aggressively
90
+
91
+ Escalate findings when you see:
92
+
93
+ - A complicated implementation where a cleaner reframing could delete whole categories of complexity.
94
+ - Refactors that move code around but fail to reduce the number of concepts a reader must hold in their head.
95
+ - A file crossing 1000 lines due to the PR, especially if the new code could be split out.
96
+ - New conditionals bolted onto unrelated code paths.
97
+ - One-off booleans, nullable modes, or flags that complicate existing control flow.
98
+ - Feature-specific logic leaking into general-purpose modules.
99
+ - Generic "magic" handling that hides simple structure and makes the code harder to reason about.
100
+ - Thin wrappers or identity abstractions that add indirection without simplifying anything.
101
+ - Unnecessary casts, `any`, `unknown`, or optional params that muddy the real contract.
102
+ - Copy-pasted logic instead of extracted helpers.
103
+ - Narrow edge-case handling implemented in the middle of an already busy function.
104
+ - Refactors that technically pass tests but make the code less modular or less readable.
105
+ - "Temporary" branching that is likely to become permanent debt.
106
+ - Bespoke helpers where the codebase already has a canonical utility for the job.
107
+ - Logic added in the wrong layer/package when it should live somewhere more central.
108
+ - Sequential async flow where obviously independent work could stay simpler and clearer with parallel execution.
109
+ - Partial-update logic that leaves state less atomic than necessary.
110
+
111
+ ## Preferred Remedies
112
+
113
+ When you identify a code-quality problem, prefer suggestions like:
114
+
115
+ - Delete a whole layer of indirection rather than polishing it.
116
+ - Reframe the state model so conditionals disappear instead of getting centralized.
117
+ - Change the ownership boundary so the feature becomes a natural extension of an existing abstraction.
118
+ - Turn special-case logic into a simpler default flow with fewer exceptions.
119
+ - Extract a helper or pure function.
120
+ - Split a large file into smaller focused modules.
121
+ - Move feature-specific logic behind a dedicated abstraction.
122
+ - Replace condition chains with a typed model or explicit dispatcher.
123
+ - Separate orchestration from business logic.
124
+ - Collapse duplicate branches into a single clearer flow.
125
+ - Delete wrappers that do not meaningfully clarify the API.
126
+ - Reuse the existing canonical helper instead of introducing a near-duplicate.
127
+ - Make type boundaries more explicit so the control flow gets simpler.
128
+ - Move the logic to the package/module/layer that already owns the concept.
129
+ - Parallelize independent work when that also simplifies the orchestration.
130
+ - Restructure related updates into a more atomic flow when partial state would be harder to reason about.
131
+
132
+ Do not be satisfied with "maybe rename this" feedback when the real issue is structural.
133
+ Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
134
+
135
+ ## Review Tone
136
+
137
+ Be direct, serious, and demanding about quality.
138
+ Do not be rude, but do not soften major maintainability issues into mild suggestions.
139
+ If the code is making the codebase messier, say so clearly.
140
+ If the implementation missed an opportunity for a dramatic simplification, say that clearly too.
141
+
142
+ Good phrases:
143
+
144
+ - `this pushes the file past 1k lines. can we decompose this first?`
145
+ - `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
146
+ - `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
147
+ - `this feels like feature logic leaking into a shared path. can we isolate it?`
148
+ - `this abstraction seems unnecessary. can we just keep the direct flow?`
149
+ - `why does this need a cast / optional here? can we make the boundary more explicit instead?`
150
+ - `this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?`
151
+ - `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
152
+ - `this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?`
153
+
154
+ ## Output Expectations
155
+
156
+ Prioritize findings in this order:
157
+
158
+ 1. Structural code-quality regressions
159
+ 2. Missed opportunities for dramatic simplification / code-judo restructuring
160
+ 3. Spaghetti / branching complexity increases
161
+ 4. Boundary / abstraction / type-contract problems that make the code harder to reason about
162
+ 5. File-size and decomposition concerns
163
+ 6. Modularity and abstraction issues
164
+ 7. Legibility and maintainability concerns
165
+
166
+ Do not flood the review with low-value nits if there are larger structural issues.
167
+ Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
168
+
169
+ ## Approval Bar
170
+
171
+ Do not approve merely because behavior seems correct.
172
+ The bar for approval is:
173
+
174
+ - no clear structural regression
175
+ - no obvious missed opportunity to make the implementation dramatically simpler when such a path is visible
176
+ - no unjustified file-size explosion
177
+ - no obvious spaghetti-growth from special-case branching
178
+ - no obviously hacky or magical abstraction that makes the code harder to reason about
179
+ - no unnecessary wrapper/cast/optionality churn obscuring the real design
180
+ - no clear architecture-boundary leak or avoidable canonical-helper duplication
181
+ - no missed opportunity for an obvious decomposition that would materially improve maintainability
182
+
183
+ Treat these as presumptive blockers unless the author can justify them clearly:
184
+
185
+ - the PR preserves a lot of incidental complexity when there is a plausible code-judo move that would delete it
186
+ - the PR pushes a file from below 1000 lines to above 1000 lines
187
+ - the PR adds ad-hoc branching that makes an existing flow more tangled
188
+ - the PR solves a local problem by scattering feature checks across shared code
189
+ - the PR adds an unnecessary abstraction, wrapper, or cast-heavy contract that makes the design more indirect
190
+ - the PR duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home
191
+
192
+ If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: typescript-exhaustive-switch
3
+ description: Use exhaustive switch handling for TypeScript unions and enums
4
+ disable-model-invocation: true
5
+ ---
6
+
7
+ # Typescript Exhaustive Switch
8
+
9
+ typescript-exhaustive-switch: In switch statements over discriminated unions or enums, use a `never` check in the default case so newly added variants cause compile-time failures until handled.
10
+
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: verify-this
3
+ description: "Verify a claim with fresh local evidence: restate it falsifiably, capture baseline and treatment, compare artifacts, and return VERIFIED, NOT VERIFIED, or INCONCLUSIVE."
4
+ ---
5
+
6
+ # Verify This
7
+
8
+ Verification is not a recap. It proves or disproves a specific claim with repeatable evidence.
9
+
10
+ ## When To Use
11
+
12
+ - The user asks "verify this", "prove it works", "did this fix it", or "show me the evidence".
13
+ - A bug fix needs a before/after repro.
14
+ - A UI, CLI, API, performance, or memory claim needs measurement.
15
+ - A test passes but the user-visible behavior still needs confirmation.
16
+
17
+ Do not use this for vague claims like "the code is cleaner". Ask for a measurable claim first.
18
+
19
+ ## Workflow
20
+
21
+ 1. Restate the claim in falsifiable form: condition, metric, and threshold.
22
+ 2. Pick the smallest local surface that can disprove it.
23
+ 3. Capture a baseline from the old state: merge base, parent commit, failing branch, or current broken repro.
24
+ 4. Capture treatment from the changed state with the same command, data, warmup, and environment.
25
+ 5. Compare raw artifacts: numbers, screenshots, terminal transcripts, HTTP responses, profiles, heap snapshots, or test output.
26
+ 6. Return exactly one verdict: `VERIFIED`, `NOT VERIFIED`, or `INCONCLUSIVE`.
27
+
28
+ ## Local Surfaces
29
+
30
+ - Code behavior: focused unit/integration tests or a minimal repro script.
31
+ - CLI/TUI behavior: `control-cli`, terminal transcript, or demo recording.
32
+ - UI behavior: `control-ui`, screenshots, accessibility snapshots, or browser traces.
33
+ - API behavior: local HTTP/RPC request and response diff.
34
+ - Performance: same-machine baseline/treatment timings or CPU profiles.
35
+ - Memory: heap snapshots before and after the suspected operation.
36
+
37
+ ## Artifact Layout
38
+
39
+ When safe to write artifacts:
40
+
41
+ ```text
42
+ /tmp/verify-this/<claim-slug>/
43
+ ├── claim.md
44
+ ├── timeline.md
45
+ ├── baseline/
46
+ ├── treatment/
47
+ ├── diff/
48
+ └── verdict.md
49
+ ```
50
+
51
+ If artifacts may contain sensitive code, prompts, screenshots, HTTP bodies, or heap data, keep only the minimal inline evidence unless the user agrees to disk storage.
52
+
53
+ ## Verdict Rules
54
+
55
+ - `VERIFIED`: baseline and treatment differ in the predicted direction, by the claimed threshold, with no obvious confound.
56
+ - `NOT VERIFIED`: the behavior is unchanged, moves the wrong way, or misses the threshold.
57
+ - `INCONCLUSIVE`: no valid baseline, noisy signal, failed measurement, or an environment difference invalidates the comparison.
58
+
59
+ ## Output
60
+
61
+ Use this shape:
62
+
63
+ ```text
64
+ VERIFIED | NOT VERIFIED | INCONCLUSIVE
65
+ Claim: <falsifiable claim>
66
+
67
+ Evidence:
68
+ <metric/artifact>: baseline=<...>, treatment=<...>, delta=<...>, threshold=<...>
69
+
70
+ Reasoning:
71
+ <one tight paragraph naming the evidence and any confounds>
72
+ ```
73
+
74
+ Do not soften a negative result. A clear `NOT VERIFIED` is useful.
@@ -0,0 +1,32 @@
1
+ ---
2
+ name: weekly-review
3
+ description: Produce a weekly synthesis of authored commits with highlights by bugfix, tech debt, and net-new work
4
+ ---
5
+
6
+ # Weekly review
7
+
8
+ ## Trigger
9
+
10
+ Need a weekly recap of shipped work for status updates, retros, or planning.
11
+
12
+ ## Workflow
13
+
14
+ 1. Determine the current git user email from repo config.
15
+ 2. Collect authored commits from the last 7-10 days on the primary branch context.
16
+ 3. Exclude merge commits.
17
+ 4. Group meaningful changes into 2-5 concise bullets.
18
+ 5. Add a short classification paragraph covering:
19
+ - likely bug fixes
20
+ - likely tech debt work
21
+ - likely net-new functionality
22
+
23
+ ## Guardrails
24
+
25
+ - Keep the recap short and executive-readable.
26
+ - Base claims only on commit history and diffs.
27
+ - If git email is missing, ask the user to set it before proceeding.
28
+
29
+ ## Output
30
+
31
+ - 2-5 bullet weekly summary
32
+ - Brief classification paragraph (bugfix / tech debt / net-new)
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: what-did-i-get-done
3
+ description: Summarize authored commits over a user-specified time period into a concise update
4
+ ---
5
+
6
+ # What did I get done
7
+
8
+ ## Trigger
9
+
10
+ Need a short, high-signal summary of work completed in a specific time range (for example: yesterday, last 3 days, or last week).
11
+
12
+ ## Workflow
13
+
14
+ 1. Resolve the requested time window into concrete dates.
15
+ 2. Read commits authored by the current git user email within that range.
16
+ 3. Exclude merge commits and uncommitted changes.
17
+ 4. Synthesize the most important shipped changes into a concise status update.
18
+ 5. Include the actual date range used in the final summary.
19
+
20
+ ## Guardrails
21
+
22
+ - Be extremely concise and information-dense.
23
+ - Prioritize substantial behavior or architecture changes.
24
+ - Omit cosmetic-only changes (formatting, imports, minor renames).
25
+ - Do not infer intent or motivation. Describe changes functionally.
26
+
27
+ ## Output
28
+
29
+ - One short summary suitable for a status update
30
+ - Real date range
31
+ - Optional 2-5 bullets for major changes only
@@ -8,7 +8,7 @@ disable-model-invocation: true
8
8
 
9
9
  Investigate the motivation and intent behind code. The companion `how` skill answers what the code does and how it works. `why` answers what forces led to its shape.
10
10
 
11
- Each spawn below names a role line in the model rule (`~/.pi/agent/pstack/pstack-models.md`) and a default. Set `model` to that line's value, or to the default if the rule or the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
11
+ Each spawn below names a role line in the model rule at the path the system prompt names and a default. Set `model` to that line's value, or to the default if the rule or the line is missing. Leave `model` unset when the value is `auto` or `inherit-parent`. If the Task tool rejects a slug, use the default and say so. If it rejects the default, use the closest valid slug of the same family from its error message. Pick each subagent's reasoning level (the `:<level>` suffix), and fast or standard speed when the model has a `-fast` variant, for the job, per the Subagents section of the **poteto-mode** skill.
12
12
 
13
13
  Every spawn is `generalPurpose` with `readonly: false` (or `readonly` unset). **Do not set `readonly: true`.** It strips MCP access, which disables the MCP-backed investigators and the synthesizer's citation spot-checks. Investigators still shouldn't write anything.
14
14
 
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: workflow-from-chats
3
+ description: Extract durable working preferences from recent Pi chats and convert them into skills, rules, or workflow docs. Use when asked to learn preferences, mine feedback, personalize workflows, or generate team/person-specific agent guidance.
4
+ ---
5
+
6
+ # Workflow From Chats
7
+
8
+ Infer durable working preferences from recent chats. Do not summarize chats; extract reusable workflow guidance.
9
+
10
+ ## Scope
11
+
12
+ - Default to the last 7 days unless the user asks for a different window.
13
+ - Read parent transcripts and relevant subagent transcripts. Use subagent content as evidence, but cite only parent conversations.
14
+ - Do not expose local transcript paths, secrets, customer data, private chat content, or credentials.
15
+
16
+ ## Workflow
17
+
18
+ 1. State the target workflow or preference surface in one paragraph.
19
+ 2. Build an internal transcript inventory: title/topic, parent conversation ID, approximate date, completion state, relevant subagents, and why it may contain preference evidence.
20
+ 3. Scan for explicit preferences, corrections, and workflow markers such as "I prefer", "always", "never", "not what I asked", "stop", "review", "PR", "CI", "logs", and "skill".
21
+ 4. Extract preference atoms: trigger, workflow step, decision rule, quality bar, stop condition, evidence, and confidence.
22
+ 5. Rate confidence as strong, medium, weak, or contradicted.
23
+ 6. Cluster by workflow shape rather than transcript: shipping, review, simplification, debugging, capture, communication, delegation, or validation.
24
+ 7. Choose the artifact: new skill, skill edit, rule, workflow doc, or no artifact.
25
+ 8. Draft only the reusable guidance. Filter anecdotes that will not help future tasks.
26
+
27
+ ## Confidence
28
+
29
+ - Strong: explicit user preference, workflow-changing correction, repeated parent-chat pattern, or direct request to encode behavior.
30
+ - Medium: accepted workflow, repeated tool/model/validation preference, or subagent consensus that the parent used successfully.
31
+ - Weak: agent-chosen behavior with no user feedback, one ambiguous transcript, or a likely task-specific correction.
32
+ - Contradicted: evidence points in incompatible directions; ask the user before writing files.
33
+
34
+ ## Artifact Choice
35
+
36
+ - Skill: recurring multi-step workflow with clear triggers.
37
+ - Rule: general behavior that should apply broadly.
38
+ - Workflow doc: useful context that is not reliably triggerable.
39
+ - No artifact: situational, stale, or low-confidence observation.
40
+
41
+ ## Output
42
+
43
+ Return a concise synthesis first:
44
+
45
+ - Target workflow.
46
+ - Evidence corpus with parent conversation citations only.
47
+ - Preference profile.
48
+ - Adopt, consider, dismissed.
49
+ - Proposed artifacts.
50
+ - Open questions only if they block writing.