Source note: Adapted from my original write-up on X. You can also grab the packaged prompt-optimizer Skill on Boloop, read the earlier domain-term translation write-up, or browse github.com/TinkCarlos/prompt-optimizer.

The whole thing started with a pretty ordinary question.

I wanted to run a serious self-audit on prompt-optimizer, so I typed one line into the chat:

$prompt-optimizer 这个skill还有什么问题么? ("Does this skill prompt-optimizer still have any issues?")

Instead of reading its own code or listing gaps, the assistant sternly bounced back an "Optimized Prompt" block and politely asked whether I wanted to run the rewritten version.

I stared at the screen for two seconds.

I asked what was wrong with it—and its very first move was to demonstrate a bug on the spot.

Only a day had passed since the previous post about translating plain speech like "wait until I stop typing before searching" into domain terms such as input debounce and optimistic locking. Back then, prompt-optimizer already felt smooth. Once it lived inside my daily terminal and editor workflows, though, edge cases I never would have invented in synthetic tests started lining up at the door.

The three commits below grew directly out of chasing down that single intercepted question.

Fixing Local Filter Misfires Across Three Hook Runtimes

First, that comedy of errors: the hook saw $prompt-optimizer at the start of the message, treated it as an explicit rewrite trigger, and never distinguished "rewrite my task" from "inspect this skill itself."

Tracing that thread revealed how many local filter rules looked reasonable on paper yet misfired constantly in everyday Chinese and English chat:

  • Polite Chinese prefixes swallowed real tasks: A shortcut rule treated any message under 40 characters starting with "好的" (OK), "可以" (sure), or "行" (alright) as a pure confirmation and skipped it. Nobody issues follow-up requests in Chinese as bare commands—messages like "好的,帮我把首页改成暗黑风格" ("OK, switch the homepage to dark mode") or "可以,顺便帮我查一下登录为什么变慢了" ("Sure, also check why login got slow") were silently swallowed without rewriting.
  • Command detection matched plain English prose: Hooks meant to skip one-line terminal commands bypassed anything starting with git, npm, or cat. Writing git workflow is messy, redesign it or cat photo website, make it cute got skipped because the first word collided with a CLI binary.
  • Unanchored bypass prefixes: raw:, 原文:, and 直接: were supposed to bypass one turn, yet without enforcing the trailing colon, "直接 refactor 这个组件" or "原文 帮我翻译成英文" accidentally triggered bypass mode.
  • Multiline regex collisions: Lines like A1: 销售额 inside multiline notes tripped Antigravity's interactive-questionnaire regex and skipped routing.

All four got tightened across all three hook implementations: meta-questions pass straight through, Chinese polite prefixes are stripped before inspecting the real request behind them, CLI detection checks subcommands and flag shapes instead of only the first token, bypass prefixes require a colon, and multiline blocks no longer collide with quiz-answer patterns.

Stopping Ghost Confirmations and Fixing /prompt-optimizer off

A subtler ghost bug hid in confirmation detection.

prompt-optimizer checks the previous assistant message to know whether it is waiting for user approval. Previously, if a normal assistant reply contained ### Done followed by a > Note: quote—or a long doc cited ### Optimized Prompt inside a code block—the hook misclassified the next normal message as a confirmation reply. Worse, in Claude Code, Codex, and Pi, whenever several tool-only or interrupted turns sat in between, history scanning walked backward and resurrected a confirmation prompt from turns ago.

We rewrote code-fence stripping cleanly across triple backticks, quadruple backticks, and tilde fences, removed non-working word-boundary anchors after CJK headings, and stopped the scanner as soon as it hits the previous user message boundary.

/prompt-optimizer off now exits silently too—no wasted history reads and no stray confirmation prompts. Yet if you deliberately force one rewrite with /prompt-optimizer <text> while off and reply "修改" (edit) or "同意" (approve), that explicit chain still completes cleanly.

Creative Ceiling and Hard Entity Fidelity

Shortly after the previous post, real frontend work exposed another issue: when someone asked for bold spatial or 3D visuals, the rewrite played it too safe and flattened the request into timid card-hover tweaks. My first SKILL.md edit overcorrected by naming WebGL and PBR directly. I dialed that back in commit `fbee972` to keep a high creative ceiling (interactive 3D, canvas, spatial motion) without locking in an unmentioned rendering stack.

Hard entity fidelity is now strict as well: file paths, function names, error codes, CLI flags, URLs, $frontend-design-lab references, and @file pointers must stay 100% verbatim—never translated or paraphrased.

Next-Step Prompt Suggestions: Silent by Default

Getting the first prompt right saved plenty of rework, yet half the friction during coding happens in the few seconds right after the assistant finishes a turn.

Say it just edited three files, ran unit tests, or handed back an offline step like taking mobile screenshots on a real phone. You stare at an empty input box knowing what to verify, commit, or attach next—yet typing a vague shortcut risks triggering another rewrite confirmation.

So commit `ee36dc9` added next-step prompt suggestions at the end of a reply, governed by one strict rule: stay silent by default.

Nothing is more irritating than a bot cramming three "You can also ask me..." bullets onto every reply. Simple factual answers, venting, fully finished tasks, or turns blocked on login/CAPTCHA or open-ended design picks must stay completely quiet.

Suggestions appear in only two cases: after substantive work with clear remaining verification, commits, or regressions, or right after handing the user a concrete offline step to return with results. When shown, they are written directly in the user's voice—ready to copy and send (with 2–3 short bullets only at a genuine fork):

附件是你要的 6 张手机端截图,帮我检查有没有需要重拍的,如果没问题就继续提交商店资料。

Because the suggested prompt already specifies targets and checks, pasting it back executes directly without bouncing back into confirmation. Its plain formatting avoids ###, >, and code fences so it never collides with confirmation detection.

Controls are independent: /prompt-optimizer next on|off toggles the current session, and /prompt-optimizer next default on|off sets the default for new sessions. You can even turn rewrites off (/prompt-optimizer off) and keep /prompt-optimizer next on.

Defaults intentionally differ by tool: enabled by default in Antigravity, Claude Code, and Pi, and disabled by default in Codex because Codex's native input box already suggests next steps. To avoid context bloat, I also tightened the existing routing instructions at the same time, keeping the whole injected guidance within a few hundred tokens.

For long sessions in Antigravity—where transcripts accumulate nested tags, background wakeups, and occasional concurrent calls—parsing is now a linear block scan paired with atomic lock files, stale-lock recovery, and 14-day automatic state cleanup.

Unwrapping T3 Code and One-Command Antigravity Setup

Right when I thought everything was done and opened a fresh thread in T3 Code, plain messages triggered nothing at all.

Digging in uncovered two hidden layers:

  1. Wrapper tags: Every prompt T3 Code sends to the underlying assistant is wrapped in <t3_code_instructions>, placing the actual message inside <user_request> followed by <runtime_info>. Hooks reading from the start of the message only saw framework boilerplate—missing /prompt-optimizer off, raw:, or short Chinese confirmations. All three hooks (Antigravity, Claude Code/Codex, and Pi) now unwrap T3 Code blocks before routing and filtering.
  2. Isolated Antigravity config directory: Claude Code, Codex, and Pi threads in T3 Code automatically pick up host hooks, whereas Antigravity threads use an isolated config directory that symlinks skills by default without linking hooks.json.

To avoid hunting through hashed directories manually, commit `aec50e7` added scripts/install-t3.js. It scans T3 Code's Antigravity config directories, merges only the prompt-optimizer hook into hooks.json without touching existing hooks, prefers stable symlinked paths like /opt/homebrew/bin/node so Node upgrades don't break hardcoded version paths, and supports both --dry-run and --uninstall.

Unified Regression Suite & Honest Limits

All four test suites now run through one npm test entry point: Antigravity hook tests (expanded to 35 cases), Claude Code/Codex cross-host tests, Pi extension unit tests, and T3 Code installer tests—all green. The repo also adds tests/eval-cases.json with 9 behavioral regression cases for SKILL.md itself, including the exact prompt that started this audit: $prompt-optimizer 这个skill还有什么问题么?.

Upfront caveats still apply: I still do not have a benchmark proving how much higher final code quality scores after rewriting. Hook tests verify routing accuracy, confirmation isolation, concurrency locking, and T3 Code unwrapping, while the live model still decides on the fly whether to rewrite. Whenever it overreaches, reply "按原话" (use original) or prefix with raw: / 直接:.

To upgrade an existing clone, pull the latest commits and run npm test. If you use Antigravity threads inside T3 Code, preview first with node scripts/install-t3.js --dry-run and then run node scripts/install-t3.js. If trailing next-step suggestions aren't your style, run /prompt-optimizer next default off.

Looking back, the best way to test an everyday tool isn't feeding it flattering examples—it's throwing the exact question it handles worst straight at it.

Related commits: Creative ceiling tuning (`fbee972`), Next-step prompts & 3-host hook hardening (`ee36dc9`), and T3 Code installer & wrapper unwrapping (`aec50e7`).