Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/wcoreing/WWorkbenchnpx agentmods add rules/wcoreing/wworkbench/compat-uiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/wcoreing/wworkbench/compat-ui)<a href="https://agentmods.dev/rules/wcoreing/wworkbench/compat-ui"><img src="https://agentmods.dev/badge/rules/wcoreing/wworkbench/compat-ui/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/wcoreing/wworkbench/compat-ui"><img src="https://agentmods.dev/badge/rules/wcoreing/wworkbench/compat-ui.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00718 |
| Opus 5.5 | $0.00000 | $0.00287 |
| Sonnet 5.5 | $0.00000 | $0.00144 |
| Haiku 4.5 | $0.00000 | $0.00072 |
Grade A, and why
compat-ui scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
Compat 交互层
Compat 修 Wails/WebView 兼容性,不是视觉 UI 框架。长相可继续用 wn-* 或套 Ant / shadcn。
进口
import { pressProps, Select, ModalPortal, installFocusGate, chromeProps, focusHogProps } from '../components/compat'
旧路径 utils/press、components/Select、components/ModalPortal 仅为兼容 re-export,新代码不要再用。
硬契约
- 命令控件(Tab、工具条、弹窗取消/保存、右键菜单项、树节点命令)→ 必须
pressProps,禁止裸onClick做切换与提交。 - 业务下拉 → 必须用
Select,或自绘弹出并接useOutsideDismiss;禁止原生<select>(系统层会吞第一次外点)。 - 弹层 → 用
ModalPortal挂到document.body;弹窗内容区对 backdrop 做onPointerDownstopPropagation。 - 菜单/下拉的外点关闭 → 必须听
pointerdown(见useDismissOnPointerDown),禁止click/mousedown。pressProps会preventDefault(pointerdown)从而取消后续 mouse 事件;用click关菜单会导致「产品轨要点两次」。 - 切产品线 →
setActiveProduct会dismissOverlays();Select/菜单须useDismissOverlays订阅,避免隐藏页 portal 挡住产品轨。 - 焦点域(FocusGate):
- 抢焦内容(xterm / Monaco)→
data-ww-focus-hog或focusHogProps()/registerFocusHog - 命令壳(产品轨、顶栏)→
data-ww-chrome或chromeProps()(浮层盖住时坐标转发) AppShell已installFocusGate():内容区持焦时点到 任意命令控件(button/.wn-select-trigger/ 产品轨等)先 blur,首击必达- 查询栏 Select、工具条、Tab 都靠这条,不必再逐个标 chrome
- 不要再为产品轨单独写坐标 capture hack
- 抢焦内容(xterm / Monaco)→
套其他 UI 框架
// 外观用第三方,交互走 Compat
<AntButton {...pressProps(onSave)}>保存</AntButton>
<Select className="your-skin" value={v} options={opts} onChange={setV} />
不要做
- 为每个业务再写一套 Select / press
- 用全局事件 hack 去「修复」原生 select
- 把颜色、布局、Form 引擎塞进 Compat
- 在业务里重复实现「从终端失焦再点轨」逻辑(应走 FocusGate)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 48 lines · 0 tokens per session scan A bbcec69327a0
compat-ui is a cursor rule published in the GitHub repository wcoreing/WWorkbench (30 stars, last pushed 4d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 718 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other cursor rules, from other repositories
git-commits
Git commit safety — commits are human-only; AI suggests, never executes.
adapter-features
Database-specific features must be implemented in the specialized adapter only. Base adapters (postgres, mysql, etc.) must remain database-agnostic.
unit-tests-tdd
TDD required for behavior changes; ≥80% package coverage on touched packages; unit-test conventions.
token-optimization
Agent-mode tool-call efficiency. Cuts the largest hidden cost in modern AI IDEs — wasted tool calls and oversized context windows.
planning-and-delegation
Plan every task first, parallelise independent work, and staff each task with the cheapest model that can do it well.
integration-tests
Human-readable integration test requests; helpers vs httptest; suites/ vs per-DB placement.