Agent hay over-build: thêm dependency, wrapper, abstraction cho việc browser hoặc stdlib đã làm sẵn. Ponytail là skill/ruleset mã nguồn mở — “senior đuôi ngựa” — ép agent đi thang YAGNI trước khi gõ thêm dòng.
Why I added Ponytail after SpecKit and CodeGraph
This blog already covers two pieces of the puzzle:
- SpecKit — decide what to build before coding.
- CodeGraph — see where and how the existing code connects.
Agents can still fail in a third way: building too much. A date picker becomes flatpickr, a wrapper, stylesheets, and a timezone debate — when <input type="date"> was enough.
Ponytail (Dietrich Gebert, MIT) does not replace specs or graphs. It shapes how small the solution should be: lazy about lines of code, not lazy about reading the repo or safety guards.
What is Ponytail?
A ruleset + skills package for many agents (Claude Code, Codex, Cursor, OpenCode, Gemini, and more). From the repo: “Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.”
Core ideas:
- Run a decision ladder before writing code (YAGNI).
- Read the codebase first — lazy about the solution, not about understanding.
- Never cut validation, error handling, security, or accessibility.
The README’s classic before/after: without the skill, an agent may scaffold a full date-picker stack; with Ponytail, a native one-liner. More examples live under examples/.
The YAGNI ladder (short version)
Stop at the first rung that works:
1. Does this need to exist? → if no: skip (YAGNI)
2. Already in this codebase? → reuse
3. Stdlib? → use stdlib
4. Native platform feature? → use it
5. Installed dependency? → use it
6. One line enough? → one line
7. Only then: minimum that works
That is why Ponytail differs from a bare “write one-liners” prompt: in the author’s agentic benchmark, a YAGNI + one-liner arm can shrink LOC but lands around 95% safety; Ponytail stays at 100% on the adversarial tier.
Numbers (read them fairly)
Ponytail publishes two measurement styles:
| Layer | Meaning |
|---|---|
| Agentic (preferred) | Headless Claude Code editing a real FastAPI + React repo, 12 tasks, with vs without the skill |
| Single-shot (older) | One prompt, one completion — 80–94% LOC gaps can be inflated by a chatty baseline |
On the agentic run (Haiku 4.5, n=4, mean vs no-skill baseline):
| Metric | Ponytail (approx.) |
|---|---|
| LOC | ~−54% |
| Tokens | ~−22% |
| Cost | ~−20% |
| Time | ~−27% |
| Safety | 100% |
Biggest wins when the agent over-builds (date picker, color picker); near zero when the code is already minimal. Method and tables: benchmarks/results in the repo.
Setup: Claude Code & Cursor
Ponytail is strongest on hosts with the full plugin (hooks inject the ruleset every turn, including subagents). Claude Code is the primary install path in the README; Cursor uses rules / AGENTS.md (instruction-only, no Ponytail hooks).
Claude Code (plugin — recommended if you use Claude)
You need Node on your PATH (small lifecycle hooks; on Nix/nvm, ensure non-interactive shells see node).
Send two separate prompts in Claude Code (CLI or Desktop → Code tab):
/plugin marketplace add DietrichGebert/ponytail
/plugin install ponytail@ponytail
After install: ruleset is always on each session; change intensity with /ponytail lite, full, ultra, or off. Default is usually full — override with PONYTAIL_DEFAULT_MODE or ~/.config/ponytail/config.json.
Remove: /plugin remove ponytail (see uninstall for extra state outside the plugin folder).
Cursor (copy rules)
- Take the file from
.cursor/rules/in the Ponytail repo. - Copy into your project’s
.cursor/rules/(or User Rules for a global setup). - Or mirror the content in root
AGENTS.md— Cursor and many other agents read it.
Cursor does not run Ponytail hooks — no built-in /ponytail ultra switch; the ladder still applies via always-on rules.
Codex & other IDEs (short)
- Codex CLI / VS Code extension:
codex plugin marketplace add DietrichGebert/ponytailthencodex plugin add ponytail@ponytail; trust hooks via/hooks. - Instruction-only: copy
AGENTS.mdor the matching rules file (Windsurf, Cline, Copilot, …) — see the install portability table in the repo.
Slash commands (Claude Code, Codex, OpenCode, …)
| Command | Purpose |
|---|---|
/ponytail [lite|full|ultra|off] | Set intensity or turn off |
/ponytail-review | Review the diff for over-engineering |
/ponytail-audit | Audit the whole repo |
/ponytail-debt | Ledger deferred shortcuts |
/ponytail-gain | Benchmark scoreboard |
On Cursor, use prompts (“review this diff with the ponytail ladder”) instead of slashes; on Claude Code I often run /ponytail-review after implementation.
One workflow: spec + graph + ponytail
SpecKit → WHAT / WHY (spec, plan, tasks)
CodeGraph → WHERE / HOW wired (call paths, blast radius)
Ponytail → HOW LITTLE (fewer lines, fewer deps, still safe)
When to lean on Ponytail (or a review pass):
- Small UI task and the agent wants a new library.
- “Cleanup” refactors that do not change behavior.
- After implementation — Claude Code:
/ponytail-review; Cursor: ask the agent to apply the ponytail ladder to the diff.
When not to force minimalism: large intentional architecture changes already locked in spec — do not golf code when the domain truly needs structure.
Caveman vs Ponytail
Project FAQ: caveman shortens what the agent says; ponytail shortens what it builds. They complement each other.
Wrap-up
Ponytail is not a token-saving gimmick. It is discipline: the smallest solution after you understand the problem and the codebase — a good fit for vibe coding with specs and, when needed, a code graph.
Read more: Ponytail on GitHub · ponytail.dev · CodeGraph post · SpecKit + RabbitSVN
Vì sao tôi thêm Ponytail sau SpecKit và CodeGraph
Chuỗi trên blog này đã có hai mảnh:
Còn một kiểu lỗi rất hay gặp khi agent đã “đúng chỗ”: viết quá nhiều. Date picker → cài flatpickr, bọc component, bàn timezone. Trong khi task chỉ cần <input type="date">.
Ponytail (Dietrich Gebert, MIT) không thay spec hay graph — nó chỉnh độ tối thiểu của giải pháp: lazy về số dòng, không lazy về đọc code hay guard an toàn.
Ponytail là gì?
Một ruleset + skills cho hàng chục host (Claude Code, Codex, Cursor, OpenCode, Gemini, …). Tagline trên repo: “Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.”
Ý chính:
- Thang quyết định trước khi viết (YAGNI ladder).
- Đọc codebase trước — lazy về solution, không phải về understanding.
- Không cắt validation, error handling, security, accessibility.
Ví dụ “before / after” trên README: agent không skill có thể dựng cả stack cho date picker; với Ponytail → native input một dòng. Thêm ví dụ trong examples/.
Thang YAGNI (tóm tắt)
Agent dừng ở bậc đầu tiên đủ dùng:
1. Cần tồn tại không? → không: bỏ (YAGNI)
2. Codebase đã có? → tái sử dụng
3. Stdlib làm được? → dùng stdlib
4. Platform native? → dùng native
5. Dependency đã cài? → dùng dependency
6. Một dòng đủ? → một dòng
7. Chỉ khi đó: minimum viable
Đây là chỗ Ponytail khác prompt “viết one-liner” thuần: benchmark trên repo ghi “YAGNI + one-liners” có thể giảm LOC nhưng safety ~95%; Ponytail giữ 100% trên tier adversarial trong bài đo agentic của tác giả.
Số liệu (đọc cho đúng)
Ponytail công bố hai lớp đo:
| Lớp | Ý nghĩa |
|---|---|
| Agentic (khuyến nghị tin) | Claude Code headless sửa repo thật (FastAPI + React template), 12 task, so có/không skill |
| Single-shot (cũ) | Một prompt, một completion — gap 80–94% LOC có thể bị “baseline hội thoại” làm phình |
Trên bài agentic (Haiku 4.5, n=4, trung bình so baseline không skill):
| Metric | Ponytail (ước lượng) |
|---|---|
| LOC | ~−54% |
| Tokens | ~−22% |
| Cost | ~−20% |
| Time | ~−27% |
| Safety | 100% |
Cắt lớn nhất khi agent over-build (date picker, color picker); gần 0 khi code đã tối thiểu. Chi tiết: benchmarks/results trên repo.
Cài đặt: Claude Code & Cursor
Ponytail mạnh nhất trên host có plugin (hooks inject ruleset mỗi turn + subagent). Claude Code là đường cài chính thức trên README; Cursor dùng rules/AGENTS (instruction-only, không hooks).
Claude Code (plugin — khuyến nghị nếu bạn dùng Claude)
Cần Node trên PATH (hooks lifecycle nhỏ; Nix/nvm: đảm bảo shell non-interactive thấy node).
Gửi hai lệnh riêng trong Claude Code (terminal hoặc Desktop → tab Code):
/plugin marketplace add DietrichGebert/ponytail
/plugin install ponytail@ponytail
Sau cài: ruleset always-on mỗi session; đổi mức với /ponytail lite, full, ultra, hoặc off. Mặc định thường là full — chỉnh qua PONYTAIL_DEFAULT_MODE hoặc ~/.config/ponytail/config.json.
Gỡ plugin: /plugin remove ponytail (xem uninstall nếu cần dọn state ngoài plugin).
Cursor (copy rules)
- Lấy file từ
.cursor/rules/trong repo Ponytail. - Copy vào
.cursor/rules/của project (hoặc User Rules nếu bạn muốn global). - Hoặc đồng bộ nội dung vào
AGENTS.mdở root — Cursor và nhiều agent khác đọc file này.
Không có hooks Ponytail trên Cursor → không có chuyển mode /ponytail ultra tích hợp; ladder vẫn áp qua rules always-on.
Codex & IDE khác (tóm tắt)
- Codex CLI / VS Code extension:
codex plugin marketplace add DietrichGebert/ponytailrồicodex plugin add ponytail@ponytail; tin hooks trong/hooks. - Chỉ instruction: copy
AGENTS.mdhoặc file rules tương ứng (Windsurf, Cline, Copilot, …) — bảng portability trên repo.
Slash commands (Claude Code, Codex, OpenCode, …)
| Lệnh | Việc làm |
|---|---|
/ponytail [lite|full|ultra|off] | Bật mức độ / tắt |
/ponytail-review | Review diff — gợi ý xóa over-engineering |
/ponytail-audit | Audit cả repo |
/ponytail-debt | Ghi “shortcut” để trả sau |
/ponytail-gain | Xem scoreboard benchmark |
Trên Cursor, nhắc agent bằng prompt (“review diff theo ponytail ladder”) thay cho slash; trên Claude Code tôi hay dùng /ponytail-review sau implement.
Ba công cụ trong một workflow
SpecKit → WHAT / WHY (spec, plan, tasks)
CodeGraph → WHERE / HOW wired (call path, blast radius)
Ponytail → HOW LITTLE (ít dòng, ít dependency, vẫn an toàn)
Khi nào nhắc Ponytail (hoặc review):
- Task UI nhỏ, agent đề xuất thư viện mới.
- Refactor “cho đẹp” nhưng không đổi hành vi.
- Sau implement — Claude Code:
/ponytail-review; Cursor: prompt “áp ponytail ladder lên diff này”.
Khi không cần ép tối thiểu: thay đổi bắt buộc kiến trúc lớn, protocol phức tạp đã được spec chốt — đừng golf code lúc domain thật sự cần abstraction.
Caveman vs Ponytail
FAQ trên repo: caveman rút gọn lời nói của agent; ponytail rút gọn code build. Có thể dùng cả hai — không trùng vai.
Kết
Ponytail không phải “viết ít token cho vui”. Nó là discipline: giải pháp nhỏ nhất sau khi đã hiểu bài toán và codebase — phù hợp vibe coding có spec và (tuỳ repo) có graph.
Đọc thêm: Ponytail trên GitHub · ponytail.dev · CodeGraph trên blog · SpecKit + RabbitSVN
