frontend-preview

An offline preview and screenshot-checking workflow for the desktop interface. It replays saved AI event scenarios in the real interface, so developers can inspect intermediate streaming states without a backend or live AI service.

In plain words
What is it for?
Use it after changing desktop components, styles, layouts, onboarding, manuals, or collaboration graphs. Open the preview, inspect frames, and create filtered screenshots for review.
Why use it?
It makes visual checks repeatable and avoids waiting for real AI runs to reproduce a particular state.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/lawofall/agentcore/frontend-preview
Clone the repo
git clone --depth 1 https://github.com/Lawofall/AgentCore

Made for: Cursor.

Per session 139 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,717 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00139 $0.01717
Opus 5 $0.00069 $0.00859
Sonnet 5 $0.00028 $0.00343
Haiku 4.5 $0.00014 $0.00172

Measured 2d ago against content hash 8422bfc7b6d6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

frontend-preview 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 2d 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.

.cursor/rules/frontend-preview.mdc · 32 lines

How it starts

The opening of the file, as written. The whole thing — 32 lines — stays where its author put it; the contents beside it link to each section on GitHub.

前端离线预览与截图自检

桌面渲染层几乎就是个普通 Vite + React 网页:把仓库里那批 conformance 向量pnpm conformance 同一份)经真实 dispatchSSEEvent 回放进真实组件,即可离线复现每种 AI 态——零后端、零 LLM、零 token、永不 drift。改完前端别再去跑真实 AI 看效果。

本页是 AI 自检渲染。给人录产品演示(真实运行 → 磁带 → 真实桌面壳按原节奏可控重放)是另一套 → demos/README.md

三个入口

怎么进
人·应用内 命令面板(Ctrl/Cmd+K)搜「前端预览」→ #/preview;深链单场景 #/preview?s=<场景名>;工具栏帧滑块拖动看流式中间态(深链 ?k=<n>
人·纯浏览器 pnpm -C apps/desktop dev:web → 开 http://localhost:5199/index.web.html#/preview
AI·截图自检 pnpm -C apps/desktop shoot [场景名过滤] → 逐场景出图到 shoot-out/<name>.pngSHOOT_FRAMES=N 连中间帧,读图核对。同族独立预览:首启体验 #/preview/onboarding + shoot:onboarding(草稿空态两态 + composer 生成中插话态,平台代付无接入门;非 conformance 向量、纯 UI 场景);产品手册 shoot:manual(四章代表场景,含机制真图与辩论室/拍板卡嵌入预览;改手册内容源 pages/toolbox/manual/content/ 或手册渲染器后必跑)
AI·协作图视口探针 pnpm -C apps/desktop shoot:graph-probe -- <场景名> [输出前缀] → 对聊天内联 / 全屏两入口量 emptyTopRatio · fullyInside · 裁切数并出截图/JSON 到 shoot-out-graph-probe/改图宿主/布局/fit/视口后必跑(辩论场景 multi_agent_debatemulti_agent_debate_multibeat
AI·协作图掉帧探针 离线:shoot:graph-perf#/preview,≤9 节点、不触发 ELK)。真实掉帧shoot:graph-perf-live:先 electron-vite dev --remoteDebuggingPort=9222,再 CDP 连运行中应用;报告 shoot-out-graph-perf/live-*.json(实测刷新率;遮挡 1Hz 限流秒剔除)。长任务里跑了什么shoot:graph-perf-trace(同 CDP;Chrome trace 拆 Layout/Style/Paint/GC/JS 并点名函数;相位表证伪「不动也卡」;不依赖 __graphPerf,可测生产构建)→ trace-*.json。不入 CI

纪律

  • 改桌面组件/样式/布局 → pnpm shoot <场景名过滤> → 读 shoot-out/*.png 自检,形成「改→截→看→迭代」紧回路。默认带场景过滤:无过滤的全量(数百张,随向量数增长)约 4 分钟(4 worker),只在发布门禁跑(→ verify-scope.mdc)。
  • 改交互相关代码(发消息 / 审批卡 / 开工·checkpoint resume / 协作图入口 / AuthGate·会话切换等用户操作链路)→ pnpm -C apps/desktop e2e(mock 后端 + webapp 壳 + Playwright;失败留 e2e-results/ 截图与 trace)。与「改渲染 → pnpm shoot」并列,别靠跑真实 AI / 活后端验点击行为。
  • pnpm shoot 是渲染冒烟门禁ci.yml frontend job 在跑;近期风险是 CI 红如 Lint,早失败则 shoot 等后续 skipped):任一场景渲染崩(未捕获报错 / #/preview 挂不上)即红。发布前本地必跑 pnpm shoot / release:gate
  • 滚动条占位类 bug(内容被切一截 / 行「上浮」留白)测不出pnpm shoot 与任何 headless Chromium 用 overlay 滚动条、不占位,必假绿。症状对得上就改用 chromium.launch({ headless: false })(或真实 Electron)复现——全局 globals.css 给每个滚动容器留 10px 槽,固定高的 chrome 行(tab 条)会被切。
  • 新 AI 态补向量:后端 conformance/vectors/ 加场景 → cd apps/server && uv run python -m agentcore.conformance.export 重导 fixture → #/previewpnpm conformance 同步刷新。改 UI 时别忘了向量的 description 也是文本:曾出现 multi_agent_coordination_wait 的 description 还在描述早已删掉的 StatusStrip 分支,测试才是准的那一侧。
  • 「否决手写 mock 态」只管 #/preview 回放面,别推广到组件单测。 components/chat/__tests__/StatusStrip.* 那批手搓 ExecutionPlan + RunFrame 的用例是已定案例外禁止改成 loadFixtures 回放:约半数断言是负向 chrome(「条上不准出现 X」),向量不编码这类事实,改回放后断言照样手写;而 payload 形状已由 TS 类型守住,换来的只是把组件单测耦到数百行向量上、失败定位变差。既有回放先例(debatePreviewMount.fixture.test.ts 等)针对的是「整回合 fold 后的呈现」,不是状态条的负向断言。

Read the full file on GitHub · 32 lines

Changes

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.

  1. 2d ago First seen · 32 lines · 139 tokens per session scan A 8422bfc7b6d6

Subscribe to this mod's changes

frontend-preview is a cursor rule published in the GitHub repository Lawofall/AgentCore (78 stars, last pushed 2d ago), licensed MIT. It adds 139 tokens to every session and 1,717 once invoked, about $0.0007 per session on Opus 5. 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.