@ia-ccun/code-agent-cli 0.0.52-beta.2 → 0.0.52-beta.4

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.
@@ -2,11 +2,15 @@
2
2
  * @author: xujianjiang
3
3
  * working-message
4
4
  *
5
- * 自定义工作消息,格式类似 Claude Code: ✶ xxx… (时间 · tokens)
5
+ * 自定义工作消息,格式类似 Claude Code: ✶ xxx… (时间)
6
+ *
7
+ * 改进:使用 dispose 模式防止内存泄漏
8
+ * - 使用明确类型,避免 any
9
+ * - 实现可靠的定时器清理机制
10
+ * - 双重保障确保资源释放
6
11
  */
7
12
 
8
- import type { ExtensionAPI, TurnEndEvent } from "@earendil-works/pi-coding-agent";
9
- import type { AssistantMessage } from "@earendil-works/pi-ai";
13
+ import type { ExtensionAPI, ExtensionContext, TurnEndEvent } from "@earendil-works/pi-coding-agent";
10
14
 
11
15
  // 主题色 #49bccf
12
16
  const accentColor = "\x1b[38;2;73;188;207m";
@@ -44,11 +48,100 @@ const workingMessages = [
44
48
  "Algorithm", "Architecture", "Database", "Cache", "Queue", "Microservice",
45
49
  ];
46
50
 
47
- let intervalId: ReturnType<typeof setInterval> | null = null;
48
- let startTime = 0;
49
- let totalTokens = 0;
50
- let currentUI: any = null; // 保存当前有效的 UI context
51
+ /**
52
+ * 工作消息状态管理器 - 使用 dispose 模式
53
+ * 确保定时器和 UI 引用的生命周期管理,防止内存泄漏
54
+ */
55
+ class WorkingMessageStateManager {
56
+ // ✅ 使用明确类型,避免 any
57
+ private _ui: ExtensionContext['ui'] | null = null;
58
+ private _intervalId: ReturnType<typeof setInterval> | null = null;
59
+ private _startTime: number = 0;
60
+ private _disposed: boolean = false;
61
+
62
+ // Getter 方法
63
+ get ui(): ExtensionContext['ui'] | null {
64
+ return this._ui;
65
+ }
66
+
67
+ get intervalId(): ReturnType<typeof setInterval> | null {
68
+ return this._intervalId;
69
+ }
70
+
71
+ get startTime(): number {
72
+ return this._startTime;
73
+ }
74
+
75
+ isDisposed(): boolean {
76
+ return this._disposed;
77
+ }
78
+
79
+ // Setter 方法(检查 disposed 状态)
80
+ setUI(ui: ExtensionContext['ui'] | null): void {
81
+ if (this._disposed) {
82
+ console.warn('[working-msg] State already disposed, cannot set UI');
83
+ return;
84
+ }
85
+ this._ui = ui;
86
+ }
87
+
88
+ setInterval(intervalId: ReturnType<typeof setInterval> | null): void {
89
+ if (this._disposed) {
90
+ console.warn('[working-msg] State already disposed, cannot set interval');
91
+ return;
92
+ }
93
+ this._intervalId = intervalId;
94
+ }
95
+
96
+ setStartTime(startTime: number): void {
97
+ if (this._disposed) {
98
+ console.warn('[working-msg] State already disposed, cannot set start time');
99
+ return;
100
+ }
101
+ this._startTime = startTime;
102
+ }
103
+
104
+ /**
105
+ * dispose() - 清理所有资源
106
+ * ✅ 双重保障:清理定时器 + 清理 UI 引用
107
+ * ✅ disposed 标记防止重复清理
108
+ */
109
+ dispose(): void {
110
+ if (this._disposed) {
111
+ return; // 防止重复 dispose
112
+ }
51
113
 
114
+ // ✅ 清理定时器(双重保障)
115
+ if (this._intervalId) {
116
+ clearInterval(this._intervalId);
117
+ this._intervalId = null;
118
+ }
119
+
120
+ // ✅ 清理 UI 引用
121
+ if (this._ui) {
122
+ try {
123
+ this._ui.setWorkingMessage(undefined);
124
+ } catch (error) {
125
+ // ✅ 忽略错误,确保清理继续
126
+ console.warn('[working-msg] Error clearing working message:', error);
127
+ }
128
+ this._ui = null;
129
+ }
130
+
131
+ this._disposed = true;
132
+ }
133
+
134
+ /**
135
+ * reset() - 重置状态(用于新的 turn)
136
+ */
137
+ reset(): void {
138
+ this.dispose(); // 先清理旧资源
139
+ this._disposed = false; // 重置 disposed 标记
140
+ this._startTime = 0;
141
+ }
142
+ }
143
+
144
+ // 工具函数
52
145
  function getNextMessage(): string {
53
146
  const randomIndex = Math.floor(Math.random() * workingMessages.length);
54
147
  return workingMessages[randomIndex];
@@ -61,76 +154,77 @@ function formatTime(seconds: number): string {
61
154
  return `${mins} m ${secs} s`;
62
155
  }
63
156
 
64
- function formatTokens(tokens: number): string {
65
- if (tokens < 1000) return `${tokens}`;
66
- return `${(tokens / 1000).toFixed(1)}k`;
157
+ /**
158
+ * ✅ 改进的定时器逻辑
159
+ * - 不依赖 try-catch
160
+ * - 检查 disposed 状态
161
+ * - 使用 state.ui(明确类型)
162
+ */
163
+ function startInterval(state: WorkingMessageStateManager): void {
164
+ if (state.isDisposed() || !state.ui) {
165
+ return;
166
+ }
167
+
168
+ const intervalId = setInterval(() => {
169
+ // ✅ 每次执行前检查 disposed 和 UI 状态
170
+ if (state.isDisposed() || !state.ui) {
171
+ // ✅ 自动清理
172
+ state.dispose();
173
+ return;
174
+ }
175
+
176
+ // ✅ 安全执行(明确类型)
177
+ const elapsed = Math.floor((Date.now() - state.startTime) / 1000);
178
+ const timeStr = formatTime(elapsed);
179
+ const msg = `${accentColor} ✶ ${getNextMessage()}…${reset} (${timeStr})`;
180
+
181
+ try {
182
+ state.ui.setWorkingMessage(msg);
183
+ } catch (error) {
184
+ // ✅ 如果 UI 调用失败,自动清理
185
+ console.warn('[working-msg] UI call failed, disposing:', error);
186
+ state.dispose();
187
+ }
188
+ }, 3000);
189
+
190
+ state.setInterval(intervalId);
67
191
  }
68
192
 
193
+ /**
194
+ * 扩展主函数 - 使用 dispose 模式管理状态
195
+ */
69
196
  export default function workingMessageExtension(pi: ExtensionAPI) {
70
- // 监听 session_shutdown 事件,清理 interval
197
+ // ✅ 单一状态管理器
198
+ const state = new WorkingMessageStateManager();
199
+
200
+ // ✅ session_shutdown - 清理所有资源
71
201
  pi.on("session_shutdown", async (_event, ctx) => {
72
- if (intervalId) {
73
- clearInterval(intervalId);
74
- intervalId = null;
75
- }
76
- currentUI = null;
202
+ state.dispose();
77
203
  });
78
204
 
79
- // turn_start 时开始循环切换消息
205
+ // ✅ turn_start - 初始化状态并启动定时器
80
206
  pi.on("turn_start", async (_event, ctx) => {
81
- if (!ctx.ui) return;
82
-
83
- // 保存当前有效的 UI context
84
- currentUI = ctx.ui;
207
+ if (!ctx.ui) {
208
+ return;
209
+ }
85
210
 
86
- // 记录开始时间
87
- startTime = Date.now();
88
- totalTokens = 0;
211
+ // ✅ 重置状态(清理旧资源)
212
+ state.reset();
213
+ state.setUI(ctx.ui); // ✅ 明确类型:ExtensionContext['ui']
214
+ state.setStartTime(Date.now());
89
215
 
90
- // 立即设置第一条消息
91
- const elapsed = Math.floor((Date.now() - startTime) / 1000);
216
+ // 设置第一条消息
217
+ const elapsed = Math.floor((Date.now() - state.startTime) / 1000);
92
218
  const timeStr = formatTime(elapsed);
93
- const tokensStr = formatTokens(totalTokens);
94
- const msg = `${accentColor} ✶ ${getNextMessage()}…${reset} (${timeStr} · ↓ ${tokensStr} tokens)`;
95
- currentUI.setWorkingMessage(msg);
96
-
97
- // 每3秒更新一次 - 使用 try-catch 处理 stale context
98
- if (!intervalId) {
99
- intervalId = setInterval(() => {
100
- try {
101
- // 使用保存的 currentUI 而不是捕获的 ctx.ui
102
- if (!currentUI) return;
103
-
104
- // 获取当前 tokens 使用量
105
- // 注意:这里不再访问 ctx.sessionManager,避免 stale context 错误
106
- // tokens 数量通过其他方式获取,或者保持为 0
107
-
108
- const elapsed = Math.floor((Date.now() - startTime) / 1000);
109
- const timeStr = formatTime(elapsed);
110
- const tokensStr = formatTokens(totalTokens);
111
- const msg = `${accentColor} ✶ ${getNextMessage()}…${reset} (${timeStr} · ↓ ${tokensStr} tokens)`;
112
- currentUI.setWorkingMessage(msg);
113
- } catch (error) {
114
- // 如果出现错误(比如 stale context),清理 interval
115
- console.error('working-msg extension error:', error);
116
- if (intervalId) {
117
- clearInterval(intervalId);
118
- intervalId = null;
119
- }
120
- currentUI = null;
121
- }
122
- }, 3000);
123
- }
219
+ const msg = `${accentColor} ✶ ${getNextMessage()}…${reset} (${timeStr})`;
220
+ state.ui?.setWorkingMessage(msg);
221
+
222
+ // ✅ 启动定时器
223
+ startInterval(state);
124
224
  });
125
225
 
126
- // turn结束时停止
226
+ // ✅ turn_end - 清理所有资源
127
227
  pi.on("turn_end", async (_event: TurnEndEvent, ctx) => {
128
- if (intervalId) {
129
- clearInterval(intervalId);
130
- intervalId = null;
131
- }
132
- // 恢复默认消息
133
- currentUI?.setWorkingMessage(undefined);
134
- currentUI = null;
228
+ state.dispose();
135
229
  });
136
- }
230
+ }
@@ -10,7 +10,8 @@
10
10
  "~/.aicode-cli/agent/extensions/custom-footer.ts",
11
11
  "~/.aicode-cli/agent/extensions/custom.ts",
12
12
  "~/.aicode-cli/agent/extensions/review.ts",
13
- "~/.aicode-cli/agent/extensions/working-msg.ts"
13
+ "~/.aicode-cli/agent/extensions/working-msg.ts",
14
+ "-extensions/aicode-pets.ts"
14
15
  ],
15
16
  "packages":[
16
17
  "npm:pi-subagents@0.17.1",
@@ -0,0 +1,100 @@
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 whenever
9
+ the user says "ponytail", "be lazy", "lazy mode", "simplest solution",
10
+ "minimal solution", "yagni", "do less", or "shortest path", and whenever
11
+ they complain about over-engineering, bloat, boilerplate, or unnecessary
12
+ dependencies.
13
+ license: MIT
14
+ ---
15
+
16
+ # Ponytail
17
+
18
+ You are a lazy senior developer. Lazy means efficient, not careless. You have
19
+ seen every over-engineered codebase and been paged at 3am for one. The best
20
+ code is the code never written.
21
+
22
+ ## Persistence
23
+
24
+ ACTIVE EVERY RESPONSE. No drift back to over-building. Still active if
25
+ unsure. Off only: "stop ponytail" / "normal mode". Default: **full**.
26
+ Switch: `/ponytail lite|full|ultra`.
27
+
28
+ ## The ladder
29
+
30
+ Stop at the first rung that holds:
31
+
32
+ 1. **Does this need to exist at all?** Speculative need = skip it, say so in one line. (YAGNI)
33
+ 2. **Stdlib does it?** Use it.
34
+ 3. **Native platform feature covers it?** `<input type="date">` over a picker lib, CSS over JS, DB constraint over app code.
35
+ 4. **Already-installed dependency solves it?** Use it. Never add a new one for what a few lines can do.
36
+ 5. **Can it be one line?** One line.
37
+ 6. **Only then:** the minimum code that works.
38
+
39
+ The ladder is a reflex, not a research project. Two rungs work → take the
40
+ higher one and move on. The first lazy solution that works is the right one.
41
+
42
+ ## Rules
43
+
44
+ - No unrequested abstractions: no interface with one implementation, no factory for one product, no config for a value that never changes.
45
+ - No boilerplate, no scaffolding "for later", later can scaffold for itself.
46
+ - Deletion over addition. Boring over clever, clever is what someone decodes at 3am.
47
+ - Fewest files possible. Shortest working diff wins.
48
+ - 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.
49
+ - Two stdlib options, same size? Take the one that's correct on edge cases. Lazy means writing less code, not picking the flimsier algorithm.
50
+ - Mark deliberate simplifications with a `ponytail:` comment (`// ponytail: this exists`), simple reads as intent, not ignorance. Shortcut with a known ceiling (global lock, O(n²) scan, naive heuristic)? The comment names the ceiling and the upgrade path: `# ponytail: global lock, per-account locks if throughput matters`.
51
+
52
+ ## Output
53
+
54
+ Code first. Then at most three short lines: what was skipped, when to add it.
55
+ No essays, no feature tours, no design notes. If the explanation is longer
56
+ than the code, delete the explanation, every paragraph defending a
57
+ simplification is complexity smuggled back in as prose. Explanation the user
58
+ explicitly asked for (a report, a walkthrough, per-phase notes) is not debt,
59
+ give it in full, the rule is only against unrequested prose.
60
+
61
+ Pattern: `[code] → skipped: [X], add when [Y].`
62
+
63
+ ## Intensity
64
+
65
+ | Level | What change |
66
+ |-------|------------|
67
+ | **lite** | Build what's asked, but name the lazier alternative in one line. User picks. |
68
+ | **full** | The ladder enforced. Stdlib and native first. Shortest diff, shortest explanation. Default. |
69
+ | **ultra** | YAGNI extremist. Deletion before addition. Ship the one-liner and challenge the rest of the requirement in the same breath. |
70
+
71
+ Example: "Add a cache for these API responses."
72
+ - lite: "Done, cache added. FYI: `functools.lru_cache` covers this in one line if you'd rather not own a cache class."
73
+ - full: "`@lru_cache(maxsize=1000)` on the fetch function. Skipped custom cache class, add when lru_cache measurably falls short."
74
+ - 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."
75
+
76
+ ## When NOT to be lazy
77
+
78
+ Never simplify away: input validation at trust boundaries, error handling
79
+ that prevents data loss, security measures, accessibility basics, anything
80
+ explicitly requested. User insists on the full version → build it, no
81
+ re-arguing.
82
+
83
+ Hardware is never the ideal on paper: a real clock drifts, a real sensor
84
+ reads off, a PCA9685 runs a few percent fast. Leave the calibration knob, not
85
+ just less code, the physical world needs tuning a minimal model can't see.
86
+
87
+ Lazy code without its check is unfinished. Non-trivial logic (a branch, a
88
+ loop, a parser, a money/security path) leaves ONE runnable check behind, the
89
+ smallest thing that fails if the logic breaks: an `assert`-based
90
+ `demo()`/`__main__` self-check or one small `test_*.py`. No frameworks, no
91
+ fixtures, no per-function suites unless asked. Trivial one-liners need no
92
+ test, YAGNI applies to tests too.
93
+
94
+ ## Boundaries
95
+
96
+ Ponytail governs what you build, not how you talk (pair with Caveman for
97
+ terse prose). "stop ponytail" / "normal mode": revert. Level persists until
98
+ changed or session end.
99
+
100
+ The shortest path to done is the right path.
@@ -0,0 +1,40 @@
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
+ Complexity only, correctness bugs, security holes, and performance go to a
39
+ normal review pass. Lists findings, applies nothing. One-shot.
40
+ "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,68 @@
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-help** | `/ponytail-help` | This card. |
31
+
32
+ Codex uses `@ponytail`, `@ponytail-review`, and `@ponytail-help`; Claude Code
33
+ and OpenCode use the slash-command forms above (OpenCode ships `/ponytail` and
34
+ `/ponytail-review`).
35
+
36
+ ## Deactivate
37
+
38
+ Say "stop ponytail" or "normal mode". Resume anytime with `/ponytail`.
39
+ `/ponytail off` also works.
40
+
41
+ ## Configure Default Mode
42
+
43
+ Default mode = `full`, auto-active every session. Change it:
44
+
45
+ **Environment variable** (highest priority):
46
+ ```bash
47
+ export PONYTAIL_DEFAULT_MODE=ultra
48
+ ```
49
+
50
+ **Config file** (`~/.config/ponytail/config.json`, Windows: `%APPDATA%\ponytail\config.json`):
51
+ ```json
52
+ { "defaultMode": "lite" }
53
+ ```
54
+
55
+ Set `"off"` to disable auto-activation on session start, activate manually
56
+ with `/ponytail` when wanted.
57
+
58
+ Resolution: env var > config file > `full`.
59
+
60
+ ## Update
61
+
62
+ 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`.
63
+
64
+ 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.
65
+
66
+ ## More
67
+
68
+ Full docs + examples: https://github.com/DietrichGebert/ponytail
@@ -0,0 +1,56 @@
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
+ Complexity only, correctness bugs, security holes, and performance go to a
53
+ normal review pass, not this one. A single smoke test or `assert`-based
54
+ self-check is the ponytail minimum, not bloat, never flag it for deletion.
55
+ Does not apply the fixes, only lists them.
56
+ "stop ponytail-review" or "normal mode": revert to verbose review style.