@herbertgao/pi-extensions 2026.8.1 → 2026.8.2

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 (162) hide show
  1. package/README.md +5 -2
  2. package/node_modules/@czottmann/pi-automode/README.md +16 -2
  3. package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +35 -0
  4. package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +18 -9
  5. package/node_modules/@czottmann/pi-automode/docs/defaults.md +6 -2
  6. package/node_modules/@czottmann/pi-automode/examples/automode.local.json +6 -0
  7. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +11 -7
  8. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/config.ts +100 -0
  9. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +32 -0
  10. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +78 -3
  11. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/hard-deny.ts +16 -4
  12. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/paths.ts +23 -1
  13. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/permissions.ts +22 -1
  14. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/types.ts +18 -2
  15. package/node_modules/@czottmann/pi-automode/package.json +4 -4
  16. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-audit.md +5 -0
  17. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-debt.md +5 -0
  18. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-gain.md +5 -0
  19. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-help.md +5 -0
  20. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail-review.md +5 -0
  21. package/node_modules/@dietrichgebert/ponytail/.opencode/command/ponytail.md +5 -0
  22. package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail-frontmatter.cjs +23 -0
  23. package/node_modules/@dietrichgebert/ponytail/.opencode/plugins/ponytail.mjs +99 -0
  24. package/node_modules/@dietrichgebert/ponytail/.qoder/rules/ponytail.md +30 -0
  25. package/node_modules/@dietrichgebert/ponytail/.qoder-plugin/plugin.json +16 -0
  26. package/node_modules/@dietrichgebert/ponytail/AGENTS.md +32 -0
  27. package/node_modules/@dietrichgebert/ponytail/LICENSE +21 -0
  28. package/node_modules/@dietrichgebert/ponytail/README.es.md +298 -0
  29. package/node_modules/@dietrichgebert/ponytail/README.ko.md +315 -0
  30. package/node_modules/@dietrichgebert/ponytail/README.md +351 -0
  31. package/node_modules/@dietrichgebert/ponytail/assets/benchmark-3model.svg +21 -0
  32. package/node_modules/@dietrichgebert/ponytail/assets/benchmark-agentic.svg +62 -0
  33. package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.png +0 -0
  34. package/node_modules/@dietrichgebert/ponytail/assets/logo-dark.svg +115 -0
  35. package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt-dark.svg +27 -0
  36. package/node_modules/@dietrichgebert/ponytail/assets/logo-greenpt.svg +27 -0
  37. package/node_modules/@dietrichgebert/ponytail/assets/logo.png +0 -0
  38. package/node_modules/@dietrichgebert/ponytail/assets/social-preview.png +0 -0
  39. package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-es.png +0 -0
  40. package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner-ko.png +0 -0
  41. package/node_modules/@dietrichgebert/ponytail/assets/waitlist-banner.png +0 -0
  42. package/node_modules/@dietrichgebert/ponytail/hooks/claude-codex-hooks.json +44 -0
  43. package/node_modules/@dietrichgebert/ponytail/hooks/copilot-hooks.json +21 -0
  44. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-activate.js +96 -0
  45. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-config.js +169 -0
  46. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-instructions.js +98 -0
  47. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-mode-tracker.js +130 -0
  48. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-runtime.js +85 -0
  49. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-statusline.ps1 +24 -0
  50. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-statusline.sh +18 -0
  51. package/node_modules/@dietrichgebert/ponytail/hooks/ponytail-subagent.js +77 -0
  52. package/node_modules/@dietrichgebert/ponytail/hooks/qoder-hooks.json +26 -0
  53. package/node_modules/@dietrichgebert/ponytail/package.json +47 -0
  54. package/node_modules/@dietrichgebert/ponytail/pi-extension/index.js +211 -0
  55. package/node_modules/@dietrichgebert/ponytail/pi-extension/package.json +8 -0
  56. package/node_modules/@dietrichgebert/ponytail/scripts/uninstall.js +60 -0
  57. package/node_modules/@dietrichgebert/ponytail/skills/ponytail/SKILL.md +120 -0
  58. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-audit/SKILL.md +41 -0
  59. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-debt/SKILL.md +44 -0
  60. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-gain/SKILL.md +50 -0
  61. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-help/SKILL.md +71 -0
  62. package/node_modules/@dietrichgebert/ponytail/skills/ponytail-review/SKILL.md +57 -0
  63. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +1 -3
  64. package/node_modules/@herbertgao/pi-cc-extensions/README.md +1 -3
  65. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +10 -6
  66. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary.ts +6 -2
  67. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +24 -83
  68. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +1 -1
  69. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/markdown-enhance.ts +119 -0
  70. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +73 -9
  71. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +2 -2
  72. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse-hover.ts +130 -0
  73. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse-interaction.ts +65 -542
  74. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse-layout.ts +160 -0
  75. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse-packets.ts +143 -0
  76. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse-scroll.ts +184 -0
  77. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-diff/diff-renderer.ts +2 -2
  78. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool-grouping.ts +9 -2
  79. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-refresh.ts +91 -0
  80. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/agent-summary.ts +1 -1
  81. package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
  82. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +1 -0
  83. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +2 -2
  84. package/node_modules/@herbertgao/pi-stash/README.md +9 -9
  85. package/node_modules/@herbertgao/pi-stash/package.json +1 -1
  86. package/node_modules/@herbertgao/pi-stash/src/index.ts +2 -1
  87. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +14 -0
  88. package/node_modules/@herbertgao/pi-subagents/README.md +6 -2
  89. package/node_modules/@herbertgao/pi-subagents/package.json +3 -3
  90. package/node_modules/@herbertgao/pi-subagents/src/custom-agents.ts +85 -11
  91. package/node_modules/@herbertgao/pi-subagents/src/index.ts +28 -4
  92. package/node_modules/@herbertgao/pi-subagents/src/settings.ts +12 -0
  93. package/node_modules/@herbertgao/pi-subagents/src/types.ts +2 -0
  94. package/node_modules/@narumitw/pi-btw/LICENSE +21 -0
  95. package/node_modules/@narumitw/pi-btw/README.md +210 -0
  96. package/node_modules/@narumitw/pi-btw/package.json +53 -0
  97. package/node_modules/@narumitw/pi-btw/src/bring-to-main.ts +632 -0
  98. package/node_modules/@narumitw/pi-btw/src/btw.ts +996 -0
  99. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +339 -0
  100. package/node_modules/@narumitw/pi-btw/src/index.ts +1 -0
  101. package/node_modules/@narumitw/pi-btw/src/menu.ts +296 -0
  102. package/node_modules/@narumitw/pi-btw/src/settings.ts +237 -0
  103. package/node_modules/@narumitw/pi-btw/src/side-thread.ts +238 -0
  104. package/node_modules/@narumitw/pi-btw/src/text.ts +10 -0
  105. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +620 -0
  106. package/node_modules/@pi-plugins/fast-mode/LICENSE +21 -0
  107. package/node_modules/@pi-plugins/fast-mode/README.md +92 -0
  108. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts +6 -0
  109. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -0
  110. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +2026 -0
  111. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -0
  112. package/node_modules/@pi-plugins/fast-mode/package.json +73 -0
  113. package/node_modules/pi-mcp-adapter/CHANGELOG.md +59 -0
  114. package/node_modules/pi-mcp-adapter/README.md +62 -13
  115. package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +377 -0
  116. package/node_modules/pi-mcp-adapter/commands.ts +9 -7
  117. package/node_modules/pi-mcp-adapter/config.ts +110 -49
  118. package/node_modules/pi-mcp-adapter/direct-tools.ts +34 -19
  119. package/node_modules/pi-mcp-adapter/elicitation-handler.ts +37 -36
  120. package/node_modules/pi-mcp-adapter/errors.ts +21 -17
  121. package/node_modules/pi-mcp-adapter/host-html-template.ts +13 -7
  122. package/node_modules/pi-mcp-adapter/index.ts +37 -14
  123. package/node_modules/pi-mcp-adapter/init.ts +9 -7
  124. package/node_modules/pi-mcp-adapter/json-schema-validator.ts +2 -2
  125. package/node_modules/pi-mcp-adapter/lifecycle.ts +8 -8
  126. package/node_modules/pi-mcp-adapter/logger.ts +1 -1
  127. package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +36 -22
  128. package/node_modules/pi-mcp-adapter/mcp-auth.ts +120 -2
  129. package/node_modules/pi-mcp-adapter/mcp-code.ts +13 -11
  130. package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +19 -13
  131. package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +15 -11
  132. package/node_modules/pi-mcp-adapter/mcp-panel.ts +34 -15
  133. package/node_modules/pi-mcp-adapter/mcp-probe.ts +131 -34
  134. package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +2 -2
  135. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +7 -4
  136. package/node_modules/pi-mcp-adapter/mcp-trace.ts +59 -64
  137. package/node_modules/pi-mcp-adapter/metadata-cache.ts +34 -26
  138. package/node_modules/pi-mcp-adapter/npx-resolver.ts +6 -4
  139. package/node_modules/pi-mcp-adapter/oauth-handler.ts +1 -1
  140. package/node_modules/pi-mcp-adapter/onboarding-state.ts +19 -11
  141. package/node_modules/pi-mcp-adapter/package.json +13 -8
  142. package/node_modules/pi-mcp-adapter/panel-keys.ts +20 -4
  143. package/node_modules/pi-mcp-adapter/prompts.ts +2 -2
  144. package/node_modules/pi-mcp-adapter/proxy-modes.ts +48 -11
  145. package/node_modules/pi-mcp-adapter/sampling-handler.ts +22 -15
  146. package/node_modules/pi-mcp-adapter/search-ranking.ts +2 -1
  147. package/node_modules/pi-mcp-adapter/server-manager.ts +165 -113
  148. package/node_modules/pi-mcp-adapter/session-recovery.ts +11 -12
  149. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +3 -3
  150. package/node_modules/pi-mcp-adapter/state.ts +3 -1
  151. package/node_modules/pi-mcp-adapter/tool-approval.ts +67 -4
  152. package/node_modules/pi-mcp-adapter/tool-metadata.ts +6 -5
  153. package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +14 -2
  154. package/node_modules/pi-mcp-adapter/ts-shape.ts +9 -2
  155. package/node_modules/pi-mcp-adapter/types.ts +109 -22
  156. package/node_modules/pi-mcp-adapter/ui-app-bridge-helpers.ts +40 -0
  157. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +28 -19
  158. package/node_modules/pi-mcp-adapter/ui-server.ts +90 -58
  159. package/node_modules/pi-mcp-adapter/ui-session.ts +16 -14
  160. package/node_modules/pi-mcp-adapter/unix-socket-transport.ts +4 -4
  161. package/node_modules/pi-mcp-adapter/utils.ts +23 -9
  162. package/package.json +22 -7
@@ -0,0 +1,211 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ const require = createRequire(import.meta.url);
4
+ const {
5
+ DEFAULT_MODE,
6
+ RUNTIME_MODES,
7
+ getDefaultMode,
8
+ getQuietStartup,
9
+ getHideStatus,
10
+ normalizeMode,
11
+ normalizePersistedMode,
12
+ isDeactivationCommand,
13
+ writeDefaultMode,
14
+ } = require("../hooks/ponytail-config.js");
15
+ const { getPonytailInstructions, filterSkillBodyForMode } = require("../hooks/ponytail-instructions.js");
16
+
17
+ export { filterSkillBodyForMode };
18
+ export const readDefaultMode = getDefaultMode;
19
+ export const readQuietStartup = getQuietStartup;
20
+
21
+ const RUNTIME_MODE_LIST = RUNTIME_MODES.join("|");
22
+ const PONYTAIL_COMMAND_DESCRIPTION = `Set mode: ${RUNTIME_MODE_LIST}. Commands: status, default <mode>`;
23
+
24
+ export function resolveSessionMode(entries, fallbackMode = DEFAULT_MODE) {
25
+ const fallback = normalizePersistedMode(fallbackMode) || DEFAULT_MODE;
26
+ if (!Array.isArray(entries)) return fallback;
27
+
28
+ for (let i = entries.length - 1; i >= 0; i -= 1) {
29
+ const entry = entries[i];
30
+ if (entry?.type !== "custom" || entry?.customType !== "ponytail-mode") continue;
31
+
32
+ const mode = normalizePersistedMode(entry?.data?.mode);
33
+ if (mode) return mode;
34
+ }
35
+
36
+ return fallback;
37
+ }
38
+
39
+ export function parsePonytailCommand(text, defaultMode = DEFAULT_MODE) {
40
+ const fallback = normalizePersistedMode(defaultMode) || DEFAULT_MODE;
41
+ const normalizedText = String(text || "").trim().toLowerCase();
42
+
43
+ if (!normalizedText) {
44
+ return { type: "set-mode", mode: fallback === "off" ? "full" : fallback };
45
+ }
46
+
47
+ const [primary, secondary] = normalizedText.split(/\s+/);
48
+
49
+ if (primary === "status") return { type: "status" };
50
+
51
+ if (primary === "default") {
52
+ // ponytail: a default must be a runtime level; review is session-only (#377).
53
+ const mode = normalizeMode(secondary);
54
+ return mode ? { type: "set-default", mode } : { type: "invalid", reason: "invalid-default-mode" };
55
+ }
56
+
57
+ const mode = normalizeMode(primary);
58
+ return mode ? { type: "set-mode", mode } : { type: "invalid", reason: "invalid-mode", mode: primary };
59
+ }
60
+
61
+ export { writeDefaultMode };
62
+
63
+ export default function ponytailExtension(pi) {
64
+ let currentMode = DEFAULT_MODE;
65
+ let configuredDefaultMode = getDefaultMode();
66
+ let hideStatus = getHideStatus();
67
+ let isActive = false;
68
+ let lastCtx = null;
69
+
70
+ // -- Status bar --
71
+ function syncStatus(ctx) {
72
+ if (ctx) lastCtx = ctx;
73
+ const c = ctx || lastCtx;
74
+ // ponytail: hide the indicator but keep the ruleset active (#324).
75
+ if (hideStatus) return;
76
+ if (!c?.ui?.setStatus) return;
77
+ // ponytail: try/catch guards against pi-web theme proxy throwing before initTheme
78
+ let theme;
79
+ try { theme = c.ui.theme; if (!theme?.fg) return; } catch { return; }
80
+ if (currentMode === "off") {
81
+ c.ui.setStatus("ponytail", "");
82
+ return;
83
+ }
84
+ const levelIcons = { lite: "🌿", full: "⚡", ultra: "🔥" };
85
+ const icon = levelIcons[currentMode] || "";
86
+ const label = currentMode.toUpperCase();
87
+ const indicator = isActive ? theme.fg("accent", "●") : theme.fg("dim", "○");
88
+ c.ui.setStatus("ponytail", indicator + " 🐴 " + theme.fg("muted", "ponytail: ") + theme.fg("text", icon + " " + label));
89
+ }
90
+
91
+ const setMode = (mode, ctx) => {
92
+ const normalized = normalizePersistedMode(mode);
93
+ if (!normalized) return;
94
+
95
+ currentMode = normalized;
96
+ pi.appendEntry("ponytail-mode", { mode: normalized });
97
+ syncStatus(ctx);
98
+ ctx?.ui?.notify?.(`Ponytail mode set to ${normalized}.`, "info");
99
+ };
100
+
101
+ const sendAlias = (skillName, args, ctx) => {
102
+ const normalized = String(args || "").trim();
103
+ const message = normalized ? `${skillName} ${normalized}` : skillName;
104
+
105
+ if (ctx?.isIdle?.() === false) {
106
+ pi.sendUserMessage(message, { deliverAs: "followUp" });
107
+ ctx?.ui?.notify?.(`${skillName} queued as follow-up.`, "info");
108
+ return;
109
+ }
110
+
111
+ pi.sendUserMessage(message);
112
+ };
113
+
114
+ pi.registerCommand("ponytail", {
115
+ description: PONYTAIL_COMMAND_DESCRIPTION,
116
+ handler: async (args, ctx) => {
117
+ const parsed = parsePonytailCommand(args, configuredDefaultMode);
118
+
119
+ if (parsed.type === "status") {
120
+ ctx?.ui?.notify?.(`Ponytail: current ${currentMode} • default ${configuredDefaultMode}`, "info");
121
+ return;
122
+ }
123
+
124
+ if (parsed.type === "set-default") {
125
+ try {
126
+ const written = writeDefaultMode(parsed.mode);
127
+ if (written) {
128
+ configuredDefaultMode = getDefaultMode();
129
+ const message = configuredDefaultMode === written
130
+ ? `Default Ponytail mode set to ${written}.`
131
+ : `Saved default ${written}, but env override keeps default at ${configuredDefaultMode}.`;
132
+ ctx?.ui?.notify?.(message, "info");
133
+ }
134
+ } catch (e) {
135
+ ctx?.ui?.notify?.(`Failed to save default mode: ${e.message}`, "error");
136
+ }
137
+ return;
138
+ }
139
+
140
+ if (parsed.type === "set-mode") {
141
+ setMode(parsed.mode, ctx);
142
+ return;
143
+ }
144
+
145
+ ctx?.ui?.notify?.("Unknown or unsupported /ponytail mode.", "warning");
146
+ },
147
+ });
148
+
149
+ pi.registerCommand("ponytail-review", {
150
+ description: "Run /skill:ponytail-review",
151
+ handler: (_args, ctx) => sendAlias("/skill:ponytail-review", "", ctx),
152
+ });
153
+
154
+ pi.registerCommand("ponytail-audit", {
155
+ description: "Run /skill:ponytail-audit",
156
+ handler: (_args, ctx) => sendAlias("/skill:ponytail-audit", "", ctx),
157
+ });
158
+
159
+ pi.registerCommand("ponytail-gain", {
160
+ description: "Run /skill:ponytail-gain",
161
+ handler: (_args, ctx) => sendAlias("/skill:ponytail-gain", "", ctx),
162
+ });
163
+
164
+ pi.registerCommand("ponytail-debt", {
165
+ description: "Run /skill:ponytail-debt",
166
+ handler: (_args, ctx) => sendAlias("/skill:ponytail-debt", "", ctx),
167
+ });
168
+
169
+ pi.registerCommand("ponytail-help", {
170
+ description: "Run /skill:ponytail-help",
171
+ handler: (_args, ctx) => sendAlias("/skill:ponytail-help", "", ctx),
172
+ });
173
+
174
+ pi.on("input", async (event) => {
175
+ if (event?.source === "extension") return;
176
+
177
+ const text = String(event?.text || "");
178
+ if (currentMode !== "off" && isDeactivationCommand(text)) {
179
+ setMode("off");
180
+ }
181
+ });
182
+
183
+ pi.on("session_start", async (_event, ctx) => {
184
+ const entries = ctx?.sessionManager?.getBranch?.() || ctx?.sessionManager?.getEntries?.() || [];
185
+ configuredDefaultMode = getDefaultMode();
186
+ hideStatus = getHideStatus();
187
+ currentMode = resolveSessionMode(entries, configuredDefaultMode);
188
+ syncStatus(ctx);
189
+ if (!getQuietStartup()) {
190
+ ctx?.ui?.notify?.(`Ponytail loaded: ${currentMode}`, "info");
191
+ }
192
+ });
193
+
194
+ pi.on("agent_start", async (_event, ctx) => {
195
+ isActive = true;
196
+ syncStatus(ctx);
197
+ });
198
+
199
+ pi.on("agent_end", async (_event, ctx) => {
200
+ isActive = false;
201
+ syncStatus(ctx);
202
+ });
203
+
204
+ pi.on("before_agent_start", async (event) => {
205
+ if (!currentMode || currentMode === "off") return;
206
+ // Guard a null/undefined event or a missing systemPrompt: don't crash, and
207
+ // don't prepend the literal string "undefined" to the prompt (#439, #440).
208
+ const base = event?.systemPrompt ? `${event.systemPrompt}\n\n` : "";
209
+ return { systemPrompt: `${base}${getPonytailInstructions(currentMode)}` };
210
+ });
211
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "ponytail-pi-extension-dev",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "test": "node --test ./test/*.test.js"
7
+ }
8
+ }
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+ // ponytail — removes state ponytail wrote outside the plugin's own files:
3
+ // the mode flag, the config file, and the statusLine entry it added to
4
+ // settings.json. Plugin files themselves are removed by each host's own
5
+ // uninstall command (see README); this only cleans up what those commands
6
+ // can't see.
7
+
8
+ const fs = require('fs');
9
+ const path = require('path');
10
+ const { getConfigPath, getClaudeDir } = require('../hooks/ponytail-config');
11
+
12
+ const STATUSLINE_SCRIPT = 'ponytail-statusline';
13
+
14
+ function removeIfExists(filePath, label) {
15
+ try {
16
+ fs.unlinkSync(filePath);
17
+ console.log(`Removed ${label}: ${filePath}`);
18
+ } catch (e) {
19
+ if (e.code !== 'ENOENT') throw e;
20
+ }
21
+ }
22
+
23
+ removeIfExists(path.join(getClaudeDir(), '.ponytail-active'), 'mode flag');
24
+ removeIfExists(getConfigPath(), 'config file');
25
+
26
+ const settingsPath = path.join(getClaudeDir(), 'settings.json');
27
+ try {
28
+ const raw = fs.readFileSync(settingsPath, 'utf8').replace(/^\uFEFF/, '');
29
+ const settings = JSON.parse(raw);
30
+ const cmd = settings.statusLine && settings.statusLine.command;
31
+ // Only remove the parts ponytail owns. If the user combined statuslines
32
+ // (e.g. caveman && ponytail), keep the other plugin's command intact.
33
+ // ponytail: splits on && / ; to detect other segments — good enough; a user
34
+ // piping statuslines together is on their own.
35
+ if (typeof cmd === 'string' && cmd.includes(STATUSLINE_SCRIPT)) {
36
+ const parts = cmd
37
+ .split(/&&|;/)
38
+ .map((s) => s.trim())
39
+ .filter(Boolean);
40
+ const others = parts.filter((s) => !s.includes(STATUSLINE_SCRIPT));
41
+ if (others.length === 0) {
42
+ delete settings.statusLine;
43
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
44
+ console.log(`Removed ponytail statusLine entry from ${settingsPath}`);
45
+ } else {
46
+ settings.statusLine.command = others.join(' && ');
47
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
48
+ console.log(`Removed ponytail statusLine segment from ${settingsPath}`);
49
+ }
50
+ }
51
+ } catch (e) {
52
+ if (e.code === 'ENOENT') {
53
+ // no settings.json — nothing to clean
54
+ } else if (e instanceof SyntaxError) {
55
+ // ponytail: malformed settings.json — can't safely edit it; leave intact, warn
56
+ console.warn(`settings.json is malformed — could not remove the ponytail statusLine entry. Remove it manually from: ${settingsPath} (${e.message})`);
57
+ } else {
58
+ throw e;
59
+ }
60
+ }
@@ -0,0 +1,120 @@
1
+ ---
2
+ name: ponytail
3
+ description: >
4
+ Forces the laziest solution that actually works, simplest, shortest, most
5
+ minimal. Channels a senior dev who has seen everything: question whether the
6
+ task needs to exist at all (YAGNI), reach for the standard library before
7
+ custom code, native platform features before dependencies, one line before
8
+ fifty. Supports intensity levels: lite, full (default), ultra. Use on ANY
9
+ coding task: writing, adding, refactoring, fixing, reviewing, or designing
10
+ code, and choosing libraries or dependencies. Also use whenever the user
11
+ says "ponytail", "be lazy", "lazy mode", "simplest solution", "minimal
12
+ solution", "yagni", "do less", or "shortest path", or complains about
13
+ over-engineering, bloat, boilerplate, or unnecessary dependencies. Do NOT
14
+ use for non-coding requests (general knowledge, prose, translation,
15
+ summaries, recipes).
16
+ argument-hint: "[lite|full|ultra]"
17
+ license: MIT
18
+ ---
19
+
20
+ # Ponytail
21
+
22
+ You are a lazy senior developer. Lazy means efficient, not careless. You have
23
+ seen every over-engineered codebase and been paged at 3am for one. The best
24
+ code is the code never written.
25
+
26
+ ## Persistence
27
+
28
+ ACTIVE EVERY RESPONSE. No drift back to over-building. Still active if
29
+ unsure. Off only: "stop ponytail" / "normal mode". Default: **full**.
30
+ Switch: `/ponytail lite|full|ultra`.
31
+
32
+ ## The ladder
33
+
34
+ Stop at the first rung that holds:
35
+
36
+ 1. **Does this need to exist at all?** Speculative need = skip it, say so in one line. (YAGNI)
37
+ 2. **Already in this codebase?** A helper, util, type, or pattern that already lives here → reuse it. Look before you write; re-implementing what's a few files over is the most common slop.
38
+ 3. **Stdlib does it?** Use it.
39
+ 4. **Native platform feature covers it?** `<input type="date">` over a picker lib, CSS over JS, DB constraint over app code.
40
+ 5. **Already-installed dependency solves it?** Use it. Never add a new one for what a few lines can do.
41
+ 6. **Can it be one line?** One line.
42
+ 7. **Only then:** the minimum code that works.
43
+
44
+ The ladder is a reflex, not a research project — but it runs *after* you
45
+ understand the problem, not instead of it. Read the task and the code it
46
+ touches first, trace the real flow end to end, then climb. Two rungs work →
47
+ take the higher one and move on. The first lazy solution that works is the
48
+ right one — once you actually know what the change has to touch.
49
+
50
+ **Bug fix = root cause, not symptom.** A report names a symptom. Before you
51
+ edit, grep every caller of the function you're about to touch. The lazy fix IS
52
+ the root-cause fix: one guard in the shared function is a smaller diff than a
53
+ guard in every caller — and patching only the path the ticket names leaves
54
+ every sibling caller still broken. Fix it once, where all callers route through.
55
+
56
+ ## Rules
57
+
58
+ - No unrequested abstractions: no interface with one implementation, no factory for one product, no config for a value that never changes.
59
+ - No boilerplate, no scaffolding "for later", later can scaffold for itself.
60
+ - Deletion over addition. Boring over clever, clever is what someone decodes at 3am.
61
+ - Fewest files possible. Shortest working diff wins — but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug.
62
+ - Complex request? Ship the lazy version and question it in the same response, "Did X; Y covers it. Need full X? Say so." Never stall on an answer you can default.
63
+ - Two stdlib options, same size? Take the one that's correct on edge cases. Lazy means writing less code, not picking the flimsier algorithm.
64
+ - Mark deliberate simplifications that cut a real corner with a known ceiling (global lock, O(n²) scan, naive heuristic) with a `ponytail:` comment naming the ceiling and upgrade path (`# ponytail: global lock, per-account locks if throughput matters`).
65
+
66
+ ## Output
67
+
68
+ Code first. Then at most three short lines: what was skipped, when to add it.
69
+ No essays, no feature tours, no design notes. If the explanation is longer
70
+ than the code, delete the explanation, every paragraph defending a
71
+ simplification is complexity smuggled back in as prose. Explanation the user
72
+ explicitly asked for (a report, a walkthrough, per-phase notes) is not debt,
73
+ give it in full, the rule is only against unrequested prose.
74
+
75
+ Pattern: `[code] → skipped: [X], add when [Y].`
76
+
77
+ ## Intensity
78
+
79
+ | Level | What change |
80
+ |-------|------------|
81
+ | **lite** | Build what's asked, but name the lazier alternative in one line. User picks. |
82
+ | **full** | The ladder enforced. Stdlib and native first. Shortest diff, shortest explanation. Default. |
83
+ | **ultra** | YAGNI extremist. Deletion before addition. Ship the one-liner and challenge the rest of the requirement in the same breath. |
84
+
85
+ Example: "Add a cache for these API responses."
86
+ - lite: "Done, cache added. FYI: `functools.lru_cache` covers this in one line if you'd rather not own a cache class."
87
+ - full: "`@lru_cache(maxsize=1000)` on the fetch function. Skipped custom cache class, add when lru_cache measurably falls short."
88
+ - ultra: "No cache until a profiler says so. When it does: `@lru_cache`. A hand-rolled TTL cache class is a bug farm with a hit rate."
89
+
90
+ ## When NOT to be lazy
91
+
92
+ Never simplify away: input validation at trust boundaries, error handling
93
+ that prevents data loss, security measures, accessibility basics, anything
94
+ explicitly requested. User insists on the full version → build it, no
95
+ re-arguing.
96
+
97
+ Never lazy about understanding the problem. The ladder shortens the
98
+ solution, never the reading. Trace the whole thing first — every file the
99
+ change touches, the actual flow — before picking a rung. Laziness that skips
100
+ comprehension to ship a small diff is the dangerous kind: it dresses up as
101
+ efficiency and ships a confident wrong fix. Read fully, then be lazy.
102
+
103
+ Hardware is never the ideal on paper: a real clock drifts, a real sensor
104
+ reads off, a PCA9685 runs a few percent fast. Leave the calibration knob, not
105
+ just less code, the physical world needs tuning a minimal model can't see.
106
+
107
+ Lazy code without its check is unfinished. Non-trivial logic (a branch, a
108
+ loop, a parser, a money/security path) leaves ONE runnable check behind, the
109
+ smallest thing that fails if the logic breaks: an `assert`-based
110
+ `demo()`/`__main__` self-check or one small `test_*.py`. No frameworks, no
111
+ fixtures, no per-function suites unless asked. Trivial one-liners need no
112
+ test, YAGNI applies to tests too.
113
+
114
+ ## Boundaries
115
+
116
+ Ponytail governs what you build, not how you talk (pair with Caveman for
117
+ terse prose). "stop ponytail" / "normal mode": revert. Level persists until
118
+ changed or session end.
119
+
120
+ The shortest path to done is the right path.
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: ponytail-audit
3
+ description: >
4
+ Whole-repo audit for over-engineering. Like ponytail-review, but scans the
5
+ entire codebase instead of a diff: a ranked list of what to delete, simplify,
6
+ or replace with stdlib/native equivalents. Use when the user says "audit this
7
+ codebase", "audit for over-engineering", "what can I delete from this repo",
8
+ "find bloat", "ponytail-audit", or "/ponytail-audit". One-shot report, does
9
+ not apply fixes.
10
+ ---
11
+
12
+ ponytail-review, repo-wide. Scan the whole tree instead of a diff. Rank
13
+ findings biggest cut first.
14
+
15
+ ## Tags
16
+
17
+ Same as ponytail-review:
18
+
19
+ - `delete:` dead code, unused flexibility, speculative feature. Replacement: nothing.
20
+ - `stdlib:` hand-rolled thing the standard library ships. Name the function.
21
+ - `native:` dependency or code doing what the platform already does. Name the feature.
22
+ - `yagni:` abstraction with one implementation, config nobody sets, layer with one caller.
23
+ - `shrink:` same logic, fewer lines. Show the shorter form.
24
+
25
+ ## Hunt
26
+
27
+ Deps the stdlib or platform already ships, single-implementation interfaces,
28
+ factories with one product, wrappers that only delegate, files exporting one
29
+ thing, dead flags and config, hand-rolled stdlib.
30
+
31
+ ## Output
32
+
33
+ One line per finding, ranked: `<tag> <what to cut>. <replacement>. [path]`.
34
+ End with `net: -<N> lines, -<M> deps possible.` Nothing to cut: `Lean already. Ship.`
35
+
36
+ ## Boundaries
37
+
38
+ Scope: over-engineering and complexity only. Correctness bugs, security holes,
39
+ and performance are explicitly out of scope. Route them to a normal review
40
+ pass. Lists findings, applies nothing. One-shot.
41
+ "stop ponytail-audit" or "normal mode" to revert.
@@ -0,0 +1,44 @@
1
+ ---
2
+ name: ponytail-debt
3
+ description: >
4
+ Harvest every `ponytail:` comment in the codebase into a debt ledger, so the
5
+ deliberate shortcuts and deferrals ponytail leaves behind get tracked instead
6
+ of rotting into "later means never". Use when the user says "ponytail debt",
7
+ "/ponytail-debt", "what did ponytail defer", "list the shortcuts", "ponytail
8
+ ledger", or "what did we mark to do later". One-shot report, changes nothing.
9
+ ---
10
+
11
+ Every deliberate ponytail shortcut is marked with a `ponytail:` comment naming
12
+ its ceiling and upgrade path. This collects them into one ledger so a deferral
13
+ can't quietly become permanent.
14
+
15
+ ## Scan
16
+
17
+ Grep the repo for comment markers, skipping `node_modules`, `.git`, and build
18
+ output:
19
+
20
+ `grep -rnE '(#|//) ?ponytail:' .` (add other comment prefixes if your stack uses them)
21
+
22
+ Each hit is one ledger row. The comment prefix keeps prose that merely mentions
23
+ the convention out of the ledger.
24
+
25
+ ## Output
26
+
27
+ One row per marker, grouped by file:
28
+
29
+ `<file>:<line>, <what was simplified>. ceiling: <the limit named>. upgrade: <the trigger to revisit>.`
30
+
31
+ The convention is `ponytail: <ceiling>, <upgrade path>`, so pull the ceiling
32
+ and the trigger straight from the comment. Want an owner per row too? add
33
+ `git blame -L<line>,<line>`.
34
+
35
+ Flag the rot risk: any `ponytail:` comment that names no upgrade path or
36
+ trigger gets a `no-trigger` tag, those are the ones that silently rot.
37
+
38
+ End with `<N> markers, <M> with no trigger.` Nothing found: `No ponytail: debt. Clean ledger.`
39
+
40
+ ## Boundaries
41
+
42
+ Reads and reports only, changes nothing. To persist it, ask and it writes the
43
+ ledger to a file (e.g. `PONYTAIL-DEBT.md`). One-shot. "stop ponytail-debt" or
44
+ "normal mode" to revert.
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: ponytail-gain
3
+ description: >
4
+ Show ponytail's measured impact as a compact scoreboard: less code, less
5
+ cost, more speed, from the benchmark medians. One-shot display, not a
6
+ persistent mode, and not a per-repo number. Trigger: /ponytail-gain,
7
+ "ponytail gain", "what does ponytail save", "show ponytail impact",
8
+ "ponytail scoreboard".
9
+ ---
10
+
11
+ # Ponytail Gain
12
+
13
+ Display this scoreboard when invoked. One-shot: do NOT change mode, write flag
14
+ files, or persist anything.
15
+
16
+ The figures are the published benchmark medians (5 everyday tasks: email
17
+ validator, debounce, CSV sum, countdown timer, rate limiter; three models:
18
+ Haiku, Sonnet, Opus). They are measured, not computed from the current repo.
19
+ Source: `benchmarks/` and the README.
20
+
21
+ ## Scoreboard
22
+
23
+ Render plain ASCII bars. The bar length shows the measured range; the label
24
+ carries the exact figure:
25
+
26
+ ```
27
+ ponytail gain benchmark median · 5 tasks · 3 models
28
+
29
+ Lines of code no-skill ████████████████████ 100%
30
+ ponytail ██▌················· 6–20% ▼ 80–94%
31
+ Cost no-skill ████████████████████ 100%
32
+ ponytail █████▌·············· 23–53% ▼ 47–77%
33
+ Speed ponytail ▸ 3–6× faster
34
+
35
+ This repo: /ponytail-debt (shortcuts you deferred)
36
+ /ponytail-audit (what's still cuttable)
37
+ ```
38
+
39
+ ## Honesty boundary
40
+
41
+ These are benchmark medians, not this repo. NEVER print a per-repo savings
42
+ number ("you saved X lines/tokens here"): the unbuilt version was never
43
+ written, so there is no real baseline to subtract from in a live repo. The
44
+ only real per-repo figures come from `/ponytail-debt` (a counted ledger), and
45
+ this card points there instead of inventing one.
46
+
47
+ ## Boundaries
48
+
49
+ One-shot display. Edits nothing, changes no mode.
50
+ "stop ponytail" or "normal mode": revert.
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: ponytail-help
3
+ description: >
4
+ Quick-reference card for all ponytail modes, skills, and commands.
5
+ One-shot display, not a persistent mode. Trigger: /ponytail-help,
6
+ "ponytail help", "what ponytail commands", "how do I use ponytail".
7
+ ---
8
+
9
+ # Ponytail Help
10
+
11
+ Display this reference card when invoked. One-shot, do NOT change mode,
12
+ write flag files, or persist anything.
13
+
14
+ ## Levels
15
+
16
+ | Level | Trigger | What change |
17
+ |-------|---------|-------------|
18
+ | **Lite** | `/ponytail lite` | Build what's asked, name the lazier alternative in one line. |
19
+ | **Full** | `/ponytail` | The ladder enforced: YAGNI → stdlib → native → one line → minimum. Default. |
20
+ | **Ultra** | `/ponytail ultra` | YAGNI extremist. Deletion before addition. Challenges requirements before building. |
21
+
22
+ Level sticks until changed or session end.
23
+
24
+ ## Skills
25
+
26
+ | Skill | Trigger | What it does |
27
+ |-------|---------|--------------|
28
+ | **ponytail** | `/ponytail` | Lazy mode itself. Simplest solution that works. |
29
+ | **ponytail-review** | `/ponytail-review` | Over-engineering review: `L42: yagni: factory, one product. Inline.` |
30
+ | **ponytail-audit** | `/ponytail-audit` | Whole-repo over-engineering audit: ranked list of what to delete. |
31
+ | **ponytail-debt** | `/ponytail-debt` | Harvest `ponytail:` shortcut comments into a tracked ledger. |
32
+ | **ponytail-gain** | `/ponytail-gain` | Measured-impact scoreboard: less code, less cost, more speed. |
33
+ | **ponytail-help** | `/ponytail-help` | This card. |
34
+
35
+ Codex uses `@ponytail`, `@ponytail-review`, and `@ponytail-help`; Claude Code
36
+ and OpenCode use the slash-command forms above (OpenCode ships all six as
37
+ slash commands).
38
+
39
+ ## Deactivate
40
+
41
+ Say "stop ponytail" or "normal mode". Resume anytime with `/ponytail`.
42
+ `/ponytail off` also works.
43
+
44
+ ## Configure Default Mode
45
+
46
+ Default mode = `full`, auto-active every session. Change it:
47
+
48
+ **Environment variable** (highest priority):
49
+ ```bash
50
+ export PONYTAIL_DEFAULT_MODE=ultra
51
+ ```
52
+
53
+ **Config file** (`~/.config/ponytail/config.json`, Windows: `%APPDATA%\ponytail\config.json`):
54
+ ```json
55
+ { "defaultMode": "lite" }
56
+ ```
57
+
58
+ Set `"off"` to disable auto-activation on session start, activate manually
59
+ with `/ponytail` when wanted.
60
+
61
+ Resolution: env var > config file > `full`.
62
+
63
+ ## Update
64
+
65
+ Enable auto-update once: open `/plugin`, go to Marketplaces, pick ponytail, Enable auto-update. Claude Code then pulls new versions at startup (run `/reload-plugins` when it prompts). Manual refresh: `/plugin marketplace update ponytail` then `/reload-plugins`.
66
+
67
+ If `/plugin` is not recognized, your Claude Code is out of date. Update it (`npm install -g @anthropic-ai/claude-code@latest`, or `brew upgrade claude-code`) and restart. Other hosts use their own update flow.
68
+
69
+ ## More
70
+
71
+ Full docs + examples: https://github.com/DietrichGebert/ponytail
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: ponytail-review
3
+ description: >
4
+ Code review focused exclusively on over-engineering. Finds what to delete:
5
+ reinvented standard library, unneeded dependencies, speculative abstractions,
6
+ dead flexibility. One line per finding: location, what to cut, what replaces
7
+ it. Use when the user says "review for over-engineering", "what can we
8
+ delete", "is this over-engineered", "simplify review", or invokes
9
+ /ponytail-review. Complements correctness-focused review, this one only
10
+ hunts complexity.
11
+ ---
12
+
13
+ Review diffs for unnecessary complexity. One line per finding: location, what
14
+ to cut, what replaces it. The diff's best outcome is getting shorter.
15
+
16
+ ## Format
17
+
18
+ `L<line>: <tag> <what>. <replacement>.`, or `<file>:L<line>: ...` for
19
+ multi-file diffs.
20
+
21
+ Tags:
22
+
23
+ - `delete:` dead code, unused flexibility, speculative feature. Replacement: nothing.
24
+ - `stdlib:` hand-rolled thing the standard library ships. Name the function.
25
+ - `native:` dependency or code doing what the platform already does. Name the feature.
26
+ - `yagni:` abstraction with one implementation, config nobody sets, layer with one caller.
27
+ - `shrink:` same logic, fewer lines. Show the shorter form.
28
+
29
+ ## Examples
30
+
31
+ ❌ "This EmailValidator class might be more complex than necessary, have you
32
+ considered whether all these validation rules are needed at this stage?"
33
+
34
+ ✅ `L12-38: stdlib: 27-line validator class. "@" in email, 1 line, real validation is the confirmation mail.`
35
+
36
+ ✅ `L4: native: moment.js imported for one format call. Intl.DateTimeFormat, 0 deps.`
37
+
38
+ ✅ `repo.py:L88: yagni: AbstractRepository with one implementation. Inline it until a second one exists.`
39
+
40
+ ✅ `L52-71: delete: retry wrapper around an idempotent local call. Nothing replaces it.`
41
+
42
+ ✅ `L30-44: shrink: manual loop builds dict. dict(zip(keys, values)), 1 line.`
43
+
44
+ ## Scoring
45
+
46
+ End with the only metric that matters: `net: -<N> lines possible.`
47
+
48
+ If there is nothing to cut, say `Lean already. Ship.` and stop.
49
+
50
+ ## Boundaries
51
+
52
+ Scope: over-engineering and complexity only. Correctness bugs, security holes,
53
+ and performance are explicitly out of scope. Route them to a normal review
54
+ pass, not this one. A single smoke test or `assert`-based
55
+ self-check is the ponytail minimum, not bloat, never flag it for deletion.
56
+ Does not apply the fixes, only lists them.
57
+ "stop ponytail-review" or "normal mode": revert to verbose review style.