openclaw-office
AGENTS.md647 starsChanged 9 months agoMITView on GitHub
This document provides context and rules for AI coding assistants (Codex, Claude, Cursor Agent, etc.) working on this project. OpenClaw Office is the visual monitoring and management frontend for the OpenClaw Multi-Agent system. It connects to the OpenClaw Gateway via WebSocket to visualize Agent collaboration as a "digital office" and provides a full console management interface. Isometric-style 2D/3D virtual office for real-time Agent status visualization: Bottom-docked chat bar for real-time Agent conversations: Full system management interface:
- Reads credentials
- Installs packages
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository9 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
- openspec-apply-changeSkill
- openspec-archive-changeSkill
- openspec-exploreSkill
- openspec-proposeSkill
The file
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 189
Not managed by i18n: technical identifiers, CSS class names, import paths
- Very specific: line 204
Do not commit .env files, node_modules, or dist
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
OpenClaw Office — Agent Development Guide
中文版
This document provides context and rules for AI coding assistants (Codex, Claude, Cursor Agent, etc.) working on this project.
Project Overview
OpenClaw Office is the visual monitoring and management frontend for the OpenClaw Multi-Agent system. It connects to the OpenClaw Gateway via WebSocket to visualize Agent collaboration as a "digital office" and provides a full console management interface.
Tech Stack
| Category | Technology |
| Language | TypeScript (ESM, strict mode) |
| UI Framework | React 19 |
| Build Tool | Vite 6 |
| State Management | Zustand 5 + Immer |
| Styling | Tailwind CSS 4 |
| 2D Rendering | SVG + CSS Animations |
| Routing | React Router 7 |
| Charts | Recharts |
| i18n | i18next + react-i18next |
| Testing | Vitest + @testing-library/react |
| Real-time | Native WebSocket API |
Feature Modules
Office View (/)
Isometric-style 2D/3D virtual office for real-time Agent status visualization:
- 2D Floor Plan — SVG office scene with desks, furniture (desk/chair/sofa/plant/coffee cup), Agent avatars, and status animations
- Agent Avatars — Deterministically generated SVG avatars from agentId with status indicators (idle/working/speaking/error)
- Collaboration Lines — Visual connections for inter-Agent messaging
- Bubble Panels — Markdown text stream and tool call display
- Side Panels — Agent details, metrics charts (Token line chart/cost pie chart/activity heatmap), SubAgent graphs, event timeline
Chat
Bottom-docked chat bar for real-time Agent conversations:
- Agent selector, streaming message display, Markdown rendering
- Chat history drawer, send/abort controls
Console (/dashboard, /agents, /channels, /skills, /cron, /settings)
Full system management interface:
- Dashboard — Overview stat cards, alert banners, Channel/Skill overview, quick navigation
- Agents — Agent list/create/delete, detail tabs (Overview/Channels/Cron/Skills/Tools/Files)
- Channels — Channel cards, config dialogs, stats, WhatsApp QR binding flow
- Skills — Skill marketplace, install options, skill details
- Cron — Scheduled task management and stats bar
- Settings — Provider management (add/edit/model editor), appearance/Gateway/developer/advanced/about/update
Directory Structure
src/
├── main.tsx / App.tsx # Entry point and routing
├── i18n/ # Internationalization (zh/en)
├── gateway/ # Gateway communication layer
│ ├── ws-client.ts / ws-adapter.ts # WebSocket client + auth + reconnect
│ ├── rpc-client.ts # RPC request wrapper
│ ├── event-parser.ts # Event parsing + state mapping
│ ├── adapter.ts / adapter-provider.ts # Adapter pattern (real/mock switch)
│ └── mock-adapter.ts # Mock mode adapter
├── store/ # Zustand stores
│ ├── office-store.ts # Main store (Agent state, connection, UI)
│ ├── agent-reducer.ts / metrics-reducer.ts / meeting-manager.ts
│ └── console-stores/ # Per-page console stores
├── components/
│ ├── layout/ # AppShell / ConsoleLayout / Sidebar / TopBar
│ ├── office-2d/ # 2D SVG floor plan + furniture components
│ ├── office-3d/ # 3D R3F scene
│ ├── overlays/ # SpeechBubble and other HTML overlays
│ ├── panels/ # Detail/metrics/chart panels
│ ├── chat/ # Chat dock bar components
│ ├── console/ # Console feature page components
│ │ ├── dashboard/ / agents/ / channels/
│ │ ├── skills/ / cron/ / settings/ / shared/
│ │ └── ...
│ ├── pages/ # Console route pages
│ └── shared/ # Shared components (Avatar/LanguageSwitcher etc.)
├── hooks/ # Custom React hooks
├── lib/ # Utility library
└── styles/ # Global stylesDevelopment Commands
pnpm install # Install dependencies
pnpm dev # Start dev server (port 5180)
pnpm build # Production build
pnpm test # Run tests
pnpm test:watch # Test watch mode
pnpm typecheck # TypeScript type check
pnpm lint # Oxlint check
pnpm format # Oxfmt format
pnpm check # lint + format checkCoding Standards
- TypeScript strict mode; no
any - Files must not exceed 500 lines; split when longer
- Components: PascalCase; hooks: useCamelCase
- Oxlint + Oxfmt formatting (consistent with OpenClaw main project)
- Comments only for non-obvious logic
OpenClaw Gateway Integration
Connection & Authentication
The frontend connects to Gateway via WebSocket (default ws://localhost:18789), authenticating as openclaw-control-ui and requesting operator.admin scope.
Prerequisites:
Gateway Token — Write to
.env.local(gitignored):openclaw config get gateway.auth.token # Write token to VITE_GATEWAY_TOKEN in .env.localDevice Auth Bypass — Gateway 2026.2.15+ requires device identity; web clients need bypass:
openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true # Restart Gateway after this- Ensure Gateway is running — This project does not start/stop Gateway
Auth Flow
- WebSocket connect → Gateway sends
connect.challenge(with nonce) - Frontend sends
connect(with client.id, scopes, auth.token) - Gateway validates and returns
hello-ok
Events & RPC
Real-time events: agent (lifecycle/tool/text/error), presence, health, heartbeat
RPC methods: agents.list, sessions.list, usage.status, tools.catalog, chat.send, chat.abort, chat.history
Agent Event Payload
type AgentEventPayload = {
runId: string;
seq: number;
stream: "lifecycle" | "tool" | "assistant" | "error";
ts: number;
data: Record<string, unknown>;
sessionKey?: string;
};Chat Protocol
| Method/Event | Direction | Description |
chat.send | RPC | Send message { sessionKey, message, deliver, idempotencyKey } |
chat.abort | RPC | Abort current run { sessionKey } |
chat.history | RPC | Get history { sessionKey } |
chat | Event | Streaming event, state: delta / final / error / aborted |
Agent State Mapping
| Gateway stream | Key data field | Frontend state | Visual |
lifecycle | phase: "start" | working | Loading animation |
lifecycle | phase: "end" | idle | Idle state |
tool | name: "xxx" | tool_calling | Tool panel popup |
assistant | text: "..." | speaking | Markdown bubble |
error | message: "..." | error | Red exclamation |
Internationalization (i18n)
All user-visible text must go through i18n translation.
- Namespaces:
common,layout,office,panels,chat,console - React components:
useTranslation(ns)+t("key") - Non-React files:
import i18n from "@/i18n"; i18n.t("ns:key") - zh/en JSON files must have identical key structure
- Not managed by i18n: technical identifiers, CSS class names, import paths
Mock Mode
Set VITE_MOCK=true to develop with simulated data without connecting to Gateway.
Testing Requirements
store/andgateway/event-parser.tsmust have unit tests- Components: test key interactions with
@testing-library/react - Critical data flows must be tested
Git Conventions
- Conventional Commits format
- Do not commit
.envfiles,node_modules, ordist
Key Reference Files (OpenClaw Main Repo)
The following files in the OpenClaw main repository contain authoritative Gateway protocol and type definitions:
src/infra/agent-events.ts— AgentEventPayload typessrc/gateway/protocol/schema/frames.ts— WS frame formatsrc/gateway/server/ws-connection.ts— WS auth flowsrc/gateway/server-methods-list.ts— All Gateway events/methodssrc/config/types.agents.ts— Agent config types
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

