cross-platform-frontend

An architecture rule for running one product interface across desktop, narrow screens, and a mobile app shell. A mobile shell is the native wrapper around the shared web interface; narrow screens remove capabilities that cannot work there.

In plain words
What is it for?
Use it when changing chat, files, messaging, settings, login, navigation, themes, or mobile behavior. It guides responsive layouts, capability checks, and the required conformance test.
Why use it?
Building separate business pages for every platform creates duplicated code and inconsistent behavior. This approach keeps one product page structure while adapting the surrounding layout and available capabilities.

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/cross-platform-frontend
Clone the repo
git clone --depth 1 https://github.com/Lawofall/AgentCore

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 701 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.00000 $0.00701
Opus 5 $0.00000 $0.00351
Sonnet 5 $0.00000 $0.00140
Haiku 4.5 $0.00000 $0.00070

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

Security

Grade A, and why

cross-platform-frontend 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/cross-platform-frontend.mdc · 35 lines

What it actually says

前端跨端架构(产品页单树 + 壳自适应)

桌面 + 窄屏 / Capacitor 是同一产品:窄屏 = 桌面 − 物理做不到的能力层。实现策略 = 产品页走桌面 renderer 一棵树,壳随宽度变,能力按 capabilities.ts 减。 权威蓝图 → 前端技术与架构.md §五 客户端架构(桌面 + 手机);原生壳 / 商店余项 → 产品路线图摘要(详细提案不在公开仓 / 维护者本地)。

结构

apps/desktop/   唯一产品页树(对话 / 文件 / IM / 设置 / 登录)+ AppShell 宽/窄
apps/mobile/    Capacitor 壳(webDir = desktop dist-web);旧 SPA / fold 已清
packages/       protocol-conformance + contract-types + design-tokens + protocol-fold-kit

硬规则

  1. 产品页不另写——对话 / 文件 / IM / 设置 / 登录禁止在 apps/mobile 再做一套业务实现。窄屏改 AppShell + 页面响应式,不新建 ChatPage。
  2. 壳自适应、不是缩桌面——宽屏侧栏 + 右坞;窄屏(<768px)底栏 4-tab + ☰ 会话抽屉 + 右坞全屏 sheet。禁把侧栏和 ≥280px 坞原样挤进 390px。禁再养一套长期 TabLayout
  3. 能力减法——禁 if (platform === "mobile") 开产品叉。本机盘 / sidecar / MCP / 热键走 capabilities.ts(与生产 web 同一套)。窄屏不上工具箱 / 白板 / 手册 / 站立任务。
  4. fold 一套——生产 fold 只留桌面。改 fold 必过 pnpm conformance(见 protocol-conformance.mdc)。契约只走后端单一源。
  5. 主题——窄屏 / Capacitor 仅浅色;宽屏可暗色。

分步

产品改动只落桌面树。pnpm conformance 只跑桌面。浏览器窄屏走 app.;独立 m. 站已下线。

否决各端全新建一套业务页 → 前端技术 §五 客户端架构(桌面 + 手机)

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 · 35 lines · 0 tokens per session scan A 63ec6045ed87

Subscribe to this mod's changes

cross-platform-frontend is a cursor rule published in the GitHub repository Lawofall/AgentCore (78 stars, last pushed 3d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 701 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.