项目简介
Ponytail 是面向 Claude Code、Codex 等 AI 编程助手的技能插件,贯彻 YAGNI 原则:优先复用现有代码、标准库与平台原生能力,只写能跑通的最少代码。内置决策阶梯引导代理选择最简方案,同时绝不牺牲校验、安全、错误处理与可访问性。基准测试显示代码量平均减少约 54%,成本降低约 20%,速度提升约 27%,且安全性保持 100%。
README 预览
\n \n \n \n \n\n\nPonytail\n\n\n He says nothing. He writes one line. It works.\n\n\n\n \n \n \n \n \n\n\n\n \n \n\n\n\n ~54% less code (up to 94%) · ~20% cheaper · ~27% faster · 100% safe\n Measured on real Claude Code sessions editing a real open-source repo (FastAPI + React), against the same agent with no skill. ~54% is the mean across 12 feature tasks (Haiku 4.5, n=4); it reaches 94% where an agent over-builds (a date picker) and is near zero where the code is already minimal. ponytail keeps every safety guard while a bare "write one-liners" prompt drops one. (The earlier single-shot benchmark reported 80-94% as a flat figure; against a fair agentic baseline that is the per-task ceiling, not the average.) Full writeup · reproduce it.\n\n\n\n Español · 한국어\n\n\n---\n\n\n \n\n\nYou know him. Long ponytail. Oval glasses. Has been at the company longer than the version control. You show him fifty lines; he looks at them, says nothing, and replaces them with one.\n\nPonytail puts him inside your AI agent.\n\n## Before / after\n\nYou ask for a date picker. Your agent installs flatpickr, writes a wrapper component, adds a stylesheet, and starts a discussion about timezones.\n\nWith ponytail:\n\n```html\n\n\n```\n\nMore survivors in [examples/](examples/).\n\n## Numbers\n\nThe honest measurement is a real agent doing real work: a headless Claude Code session editing [tiangolo's full-stack-fastapi-template](https://github.com/fastapi/full-stack-fastapi-template) (a real FastAPI + React repo), scored on the `git diff` it leaves behind. Twelve feature tickets, the same agent with and without the skill, n=4, Haiku 4.5.\n\n\n \n\n\n| vs no-skill baseline | LOC | tokens | cost | time | safe |\n|---|--:|--:|--:|--:|--:|\n| **ponytail** | **-54%** | **-22%** | **-20%** | **-27%** | **100%** |\n| caveman (terse-prose control) | -20% | +7% | +3% | +2% | 100% |\n| "YAGNI + one-liners" prompt | -33% | -14% | -21% | -30% | 95%
常见问题 (4)
故障排除如何修复 Windows 上 Claude Code 中的 "UserPromptSubmit hook timed out after 5s — output discarded" 错误?
这是由 Windows 上的冷启动开销(首次启动 PowerShell/node、杀毒软件扫描)引起的,而非脚本运行缓慢——钩子本身的运行时间仅约 0.15–0.2 秒。修复方法:将 ponytail 插件更新到包含 PR #1165 的版本,该版本提高了钩子的超时时间(例如提高到 15 秒),并直接通过 node -e "require(...)" 运行钩子,而不是使用较慢的 PowerShell commandWindows 包装器。4.8.4 版本的临时解决方案:编辑 hooks/claude-codex-hooks.json(插件缓存和 marketplace 副本中的文件都要修改),将 UserPromptSubmit 的 "timeout": 5 改为 "timeout": 15(也可以选择性修改 SessionStart/SubagentStart)。注意:本地修改会在每次插件更新时被覆盖,因此更新插件才是永久性的修复方法。
故障排除如何修复 Codex VS Code 扩展 composer 中严重的输入延迟问题?
该延迟是由过大的插件 composerIcon 引起的(例如 Ponytail 5.3.2 的 554 KB logo.png),Codex 会将其序列化为约 739 KB 的 Base64 存入 pluginMention.attrs.iconSmall,并在每条提示历史记录中重复复制,导致持久化状态增长至超过 13 MB,并在状态序列化/IPC 期间阻塞主线程。修复方法:1) 将 Ponytail 插件更新到包含 PR #1164 的版本,该版本用小尺寸资源替换了大尺寸的 composer 图标。2) 作为临时解决方案,清除持久化的 Codex 状态:关闭 VS Code,打开配置文件的 state.vscdb 并删除 openai.chatgpt 条目(或使用全新的 VS Code 配置文件)——输入会立即恢复流畅,但如果过大的图标再次填充历史记录,延迟仍会重现。3) 插件作者应将 .codex-plugin/plugin.json 中的 composerIcon 指向极小的文件(例如约 6 KB 的 SVG,如 assets/logo-greenpt.svg,或经过优化的小 PNG),而不是大尺寸的 PNG。
操作指南如何通过 oh-my-pi (omp) 安装和使用此插件?
您可以通过两种方式将其安装为 oh-my-pi 插件:1) 在终端中运行 omp https://github.com/DietrichGebert/ponytail —— ponytail 将自动保存为插件。2) 使用插件市场命令:omp plugin marketplace add DietrichGebert/ponytail,然后运行 omp plugin install ponytail@ponytail,并使用 omp plugin list 进行验证。
故障排除为什么在 Windows 上,Claude Code 的 SessionStart 上下文中缺少 Ponytail 代码库地图?
Ponytail 5.2.0–5.3.2 中的已知 bug:可选的 codebase-map 生成被移入一个子进程,并带有硬性的 1,000 ms 超时限制。在 Windows 上,来自其他 SessionStart hooks(例如 superpowers、OpenWolf、claude-mem)的启动资源争用,或大型仓库(约 2,000 个受跟踪文件)会使子进程超过 1s 限制,导致该映射被静默省略,而强制性规则仍会正常加载。修复方法:升级到包含 PR #1166 的 Ponytail 版本(5.3.2 之后的第一个版本),该版本已解决超时问题。在此之前的临时解决方案:(1) 降级到 Ponytail 5.1.0,该版本在进程内生成映射,无超时限制;(2) 减少并发 SessionStart hooks 的数量,以降低 CPU 争用;(3) 减少仓库中受跟踪/未跟踪文件的数量(例如用 gitignore 忽略大批量的 JSON/数据文件),使映射生成能在 1 秒内完成。