ClawUI AGENTS.md

Repository instructions for ClawUI, a cross-platform desktop application built with Electron, React, TypeScript, and Vite for OpenClaw. They describe coding, formatting, asset, language, and cleanup rules.

In plain words
What is it for?
Use them when changing ClawUI's interface, renderer assets, asynchronous code, TypeScript, logs, or build configuration.
Why use it?
They keep changes compatible with the project's technology choices and prevent issues such as unhandled errors, leaked event listeners, remote assets failing offline, or edits to OpenClaw itself.

Instructions file for CodexOpenCode

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 instructions/dawangcoding/clawui/agents-md
Clone the repo
git clone --depth 1 https://github.com/dawangcoding/ClawUI

Made for: Codex, OpenCode.

Per session 6,103 This file is loaded in full into every session.
When invoked 6,103 The same file — it is already loaded in full.
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.06103 $0.06103
Opus 5 $0.03052 $0.03052
Sonnet 5 $0.01221 $0.01221
Haiku 4.5 $0.00610 $0.00610

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

Security

Grade A, and why

ClawUI AGENTS.md 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.

AGENTS.md · 410 lines

How it starts

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

ClawUI 开发基本指南

本文档为 ClawUI 项目开发提供基本的规范指南。

项目概述

ClawUI 是一个为 OpenClaw 开发的跨平台桌面应用,基于 Electron、React、TypeScript、Antd、AgentScope Spark Design 和 Vite 构建。

技术栈

分类 技术 版本
桌面运行时 Electron 40.x
前端框架 React 19.x
开发语言 TypeScript 5.9.x
构建工具 Vite 7.x
包管理器 pnpm 10.30.x
UI 组件 @agentscope-ai/chat, @agentscope-ai/design, antd -
WebSocket ws 8.x

编码规范

代码格式化 (Prettier)

printWidth: 100         # 行宽 100
tabWidth: 3             # 缩进宽度 3 空格

TypeScript 配置

  • 目标:ESNext
  • 模块:ESNext (bundler 解析)
  • 严格模式:启用
  • JSX:react-jsx (自动转换)

资产放置

  • 所需要的资产都放到:src/renderer/assets/目录下

注意事项

  1. 错误处理:所有异步操作需要 try-catch 包裹
  2. 日志格式:使用 [ModuleName] 前缀,如 [GatewayClient]
  3. 中文支持:用户界面文本使用中文
  4. 类型安全:避免使用 any,优先使用 unknown + 类型守卫
  5. 清理监听器:组件卸载时清理事件监听器,避免内存泄漏
  6. 不准修改 OpenClaw 代码:ClawUI 是 OpenClaw 的下游应用,所有功能变更都应在 ClawUI 端实现。如果 OpenClaw 行为不符合预期,优先通过纯 ClawUI 端方案解决(如 hook、包装层、事件拦截等),而不是直接修改 OpenClaw 源码

最佳实践

替换第三方包中的远程图标

@agentscope-ai/chatAttachments 组件内部使用 alicdn 远程 URL 作为文件类型图标。Electron 离线环境下这些 URL 不可用,需要替换为本地 SVG。

实现方式: 通过 Vite 插件 src/renderer/plugins/replace-file-icons.ts 在构建时完成替换:

  • 本地图标位置src/renderer/assets/icons/ 目录下的 SVG 文件
  • dev 模式:通过 optimizeDeps.esbuildOptions.plugins 注入 esbuild 插件,在依赖预打包阶段将 alicdn URL 替换为内联 data:image/svg+xml data URL
  • production 构建:通过 Rollup transform 钩子做同样替换

注意事项:

  • 不要使用 optimizeDeps.exclude 排除 @agentscope-ai/chat,其内部依赖(如 rc-util)有 CJS/ESM 兼容问题,会导致白屏
  • 新增文件类型图标时,需同时在 ICON_MAP 中添加 alicdn URL 映射和对应的本地 SVG 文件
  • 如果上游包更新了图标 URL,插件会在控制台输出警告,需同步更新 ICON_MAP

参考文档

  • 如果想知道 OpenClaw Gateway 协议怎么定义的,参考:../openclaw/src/gateway/protocol(或 OpenClaw 仓库的 src/gateway/protocol 目录)
  • 如果想知道怎么连接到 OpenClaw gateway 的,参考 OpenClaw UI 的实现:../openclaw/ui(或 OpenClaw 仓库的 ui 目录)
  • 如果要了解 agentscope-ai 的使用,先参考内容大纲:docs/agentscope-ai/index,然后再参考详细内容:docs/agentscope-ai/all
  • 如果想参考 agentscope-ai 怎么实现的,参考源码:../agentscope-spark-design(需本地克隆该仓库)
  • OpenClaw 项目 github :https://github.com/openclaw/openclaw

Read the full file on GitHub · 410 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 · 410 lines · 6,103 tokens per session scan A 4e42214f905c

Subscribe to this mod's changes

ClawUI AGENTS.md is an instructions file published in the GitHub repository dawangcoding/ClawUI (20 stars, last pushed 5mo ago), licensed MIT. It adds 6,103 tokens to every session, about $0.0305 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.