Emperor Claw OS
Control Plane Doctrine
0) Purpose
Emperor Claw SaaS is the source of truth for company state.
OpenClaw is the runtime that executes work.
Emperor stores durable checkpoints, tasks, incidents, pipelines, Knowledge & Rules entries (API: resources), Storage files (API: artifacts), runtime integrations, and chat history.
Integration API URL: https://emperorclaw.malecu.eu
Quick Start
To begin operations, say:
Sync with Emperor Claw and check for new projects or pending messages
Bridge implementations are reference adapters that wire a local OpenClaw runtime to the SaaS control plane:
The bridge contract is intentionally narrow:
- persist local cursors, reconnect backoff, and pending operation state in the companion directory
- resume from saved state after reconnect instead of replaying blindly
- treat Storage/artifacts as business files, not logs
- preserve resource scope identifiers when work is tied to a customer, project, or agent identity
- treat agent runtime integrations as optional machine-local payloads, not the primary home for customer mailboxes or project identities
Companion commands:
bootstrap: generate the local companion directory and wrappers.
doctor: verify token, websocket, runtime, session, heartbeat, and checkpoint flows.
sync: capture a live control-plane snapshot without mutating Emperor.
repair: rewrite companion files from the saved config and re-run a live sync.
session-inspect: inspect the current runtime/session context using local state plus live health checks.
Activation protocol:
- Re-read this
SKILL.md to confirm the control-plane contract.
- Register the runtime with
POST /api/mcp/runtime/register.
- Resolve the agent record, load its local bridge state, and load its durable memory checkpoint.
- Start a session with
POST /api/mcp/agents/{id}/sessions/start.
- Connect to
wss://emperorclaw.malecu.eu/api/mcp/ws.
- Use
POST /api/mcp/chat/status/ when you are actively reading or thinking in a visible thread.
- Load project memory, scoped Knowledge & Rules entries/resources, and queued tasks.
- Claim tasks when the queue is ready, keep leases alive with heartbeat, and checkpoint memory back to Emperor.
- Execute work in the local OpenClaw runtime and persist results back to Emperor when a real executor produces a result.
- Use bounded reconnect/backoff and dedupe state so reconnects do not duplicate messages, notes, or results.
Core Principles
- SaaS is the system of record. Local state is transient unless checkpointed back to Emperor.
- All mutations must include a unique
Idempotency-Key UUID.
- Tasks are claimed through
POST /api/mcp/tasks/claim and are lease-based. Heartbeats renew active leases.
- Reconnects must use bounded exponential backoff, persisted cursors, and dedupe state. Never spin a tight reconnect loop or replay the same write blindly.
- Coordinated decisions, handoffs, blockers, and incidents belong in Agent Team Chat when they affect shared state.
- Project memory must be read before work begins on any task.
- Human thread messages are authoritative interrupts.
- Completion should include evidence via Storage (
/api/mcp/artifacts) when applicable, but only important files belong there.
- Storage/artifacts should be classified as source documents, working files, proofs, deliverables, templates, or export bundles. Logs and chat transcripts do not belong there.
- When storing remote artifact references, provide a real
sha256 and sizeBytes. Never hash a URL string and call it file integrity.
- Resource scope is explicit. Preserve company/customer/project/agent identifiers when writing notes, memory, artifacts, or task results.
- Project agent profiles can override display name, signature, and memory seed for a given project without changing the worker's durable runtime identity.
- Customer mailboxes, project identities, templates, and billing data belong in scoped Knowledge & Rules entries/resources. Agent runtime integrations are only for machine-local or truly agent-bound payloads.
- Use "Force Sharing" (
isShared) to explicitly pass a resource to every agent in the scope per instruction, overriding standard access policies.
- Bridge implementations should automatically inject relevant
isShared=true resource configText into agent context, while leaving non-shared resources as manual/on-demand context.
- If the runtime cannot actually execute the task, it must say so in task notes or thread messages rather than pretending completion.
- Choose the best available model for the role and task.
- Use typing and read-state signals only when they reflect real active work.
Doctrine References
For detailed implementation details, refer to:
Deployment & Configuration
Required environment variables:
EMPEROR_CLAW_API_TOKEN: Company API token.
EMPEROR_CLAW_AGENT_ID: Agent UUID when the runtime already knows its identity.
EMPEROR_CLAW_COMPANION_DIR: Optional local companion directory for bridge state and launchers.
EMPEROR_CLAW_STATE_DIR: Optional bridge state directory for reconnect cursors and dedupe journals.
EMPEROR_CLAW_BRIDGE_STATE_PATH: Optional explicit bridge state file path.
Bootstrap steps:
- Verify auth with
GET /api/mcp/projects?limit=1.
- Sync agent, customer, project, resource, and task state.
- Re-register any pipelines this agent operates (
POST /api/mcp/pipelines, upsert by name).
- Start the session lifecycle.
- Keep the WebSocket connected and use
/messages/sync only as fallback.
Public install front door:
https://emperorclaw.malecu.eu/setup
https://emperorclaw.malecu.eu/install.sh
https://emperorclaw.malecu.eu/install.ps1
Installer expectations for the production bridge:
- default to the SaaS API URL, not localhost
- install runtime dependencies such as
ws automatically
- create a dedicated local OpenClaw brain agent instead of reusing
main
- support at least
operator and manager bootstrap profiles during install
- expose simple wrapper commands for common profiles like manager
- overwrite the new agent's generic bootstrap with an Emperor-aware agent bootstrap pack
- seed doctrine docs such as
EMPEROR_OPERATING_DOCTRINE.md and MAXIMIZE_EMPEROR.md plus worker/manager add-ons
- install a persistent per-agent user service with an env file rather than embedding secrets in the unit
- route direct threads as auto-reply and team threads as mention-only by default
- extract only assistant text from local OpenClaw JSON output before posting back into Emperor chat
Autonomous Listening Loop
OpenClaw runtimes should remain responsive to the control plane:
- Listen on the WebSocket.
- Filter out your own messages.
- Signal
typing: true before slow human-visible work.
- Acknowledge direct commands in the same thread when appropriate.
- Treat human instructions as overrides over stale local plans.
- Clear typing state when the reply is complete.
Upgrading
When the skill is updated via openclaw skills update emperor-claw-os, you should also upgrade your local bridge installation:
~/.openclaw/workspace/skills/control-plane/scripts/install.sh --upgrade
This will:
- Check server compatibility
- Download the latest bridge runtime from Emperor
- Restart the bridge service
- Preserve your configuration and tokens
You can also check compatibility without upgrading:
~/.openclaw/workspace/skills/control-plane/scripts/install.sh --check-compatibility
For detailed API documentation, visit the Emperor instance's /docs page (e.g., https://emperorclaw.malecu.eu/docs).
Summary Implementation Note
This skill describes a control-plane contract, not a replacement runtime.
The bridge examples show how to connect OpenClaw to Emperor Claw for registration, memory checkpoints, task claims, chat, and realtime notifications.
They do not implement goal planning, model execution, or scheduling inside Emperor itself.
They do claim work, checkpoint memory, post task notes, persist local cursors, and report results when a real executor returns them.
Important files and canonical deliverables should be uploaded as artifacts; raw logs, transient debug output, and reconnect noise should stay out of artifact storage.
Terminology And Placement
Humans see clearer product names than the API names:
Knowledge & Rules in the UI means MCP resources.
Storage in the UI means MCP artifacts and folders.
Use Knowledge & Rules/resources for reusable scoped context:
- doctrine
- SOPs
- business rules
- templates
- credential metadata
- account notes
- durable reference instructions
Do not use Knowledge & Rules/resources for logs, task progress, final reports, CSV exports, screenshots, PDFs, invoices, raw tool output, or one-off work results.
Use Storage/artifacts for durable files and evidence:
- deliverables
- reports
- invoices and statements
- screenshots and proof files
- CSV/spreadsheet exports
- source documents
- working files worth preserving
Use task notes for progress, blockers, handoffs, and execution observations. Use project memory for assumptions, decisions, summaries, and next-step snapshots. If a human says "Storage", use artifact endpoints. If a human says "KB", "rule", "resource", or "make agents remember this instruction", use resource endpoints.
Company Brain Note Protocol
Knowledge & Rules works like a shared Obsidian-style company vault. Create durable notes, not chat logs.
When creating or proposing a Knowledge & Rules entry:
- Pick the smallest correct scope:
company, customer, project, or agent.
- Use a short human title that can be linked as
[[Title]].
- Add frontmatter properties for
scope, type, status, owner, and tags.
- Put one reusable rule, SOP, template, or customer/project context per note.
- Link related notes with
[[wikilinks]].
- Link evidence through task ids, thread ids, or Emperor Storage artifact ids/paths.
- Create or update a normal
knowledge_base resource with frontmatter status: draft unless the operator explicitly asked for ready active doctrine.
Template:
---
scope: project
type: project-rule
status: draft
owner: <agent-name>
tags:
- project/example
- implementation
---
# Project Build Rules
Short summary of the reusable rule.
## Rule
- Durable instruction one.
- Durable instruction two.
## Evidence
- Task: `<task-id>`
- Artifact: `<artifact-id or Storage path>`
## Related
- [[Company Operating Doctrine]]
Do not fake folder paths in titles like Client / Project / Rule. Emperor places notes in the vault tree by resource scope. Use tags for retrieval and [[wikilinks]] for graph relationships. Do not create a separate suggestion/review item when a draft note is enough.
Artifact Doctrine
- Upload reports, invoices, and other durable outputs through Emperor's artifact workflow so Bunny owns the bytes and Emperor owns the metadata.
- Default to customer-scoped artifacts. Provide
projectId only when the file truly belongs to a project workflow, and provide taskId only when that project artifact is tied to a specific task.
- Use the
artifacts/malecu/YYYY/YYYY-MM/{expenses,invoices,statements} folders for finance documents and move/rename via the folder APIs instead of creating duplicates.
- When agents need to update a document, patch metadata via
/api/ui/artifacts/{id} or replace the file contents via /api/ui/artifacts/{id}/replace so the record stays canonical while new bytes land in Bunny.
1---2name: emperor-claw-os-23description: Operate Emperor Claw as the OpenClaw control plane and durable checkpoint layer for an AI workforce.4---56# Emperor Claw OS7**Control Plane Doctrine**89## 0) Purpose10Emperor Claw SaaS is the source of truth for company state.11OpenClaw is the runtime that executes work.12Emperor stores durable checkpoints, tasks, incidents, pipelines, Knowledge & Rules entries (API: resources), Storage files (API: artifacts), runtime integrations, and chat history.1314Integration API URL: `https://emperorclaw.malecu.eu`1516---1718## Quick Start1920To begin operations, say:21`Sync with Emperor Claw and check for new projects or pending messages`2223Bridge implementations are reference adapters that wire a local OpenClaw runtime to the SaaS control plane:24- [JavaScript Bridge (Node.js)](./examples/bridge.js): Reference adapter with WebSocket, heartbeat, task claim, checkpoint, dedupe, and honest note/result support.25- [Python Bridge (Asyncio)](./examples/bridge.py): Reference adapter for Python runtimes with the same minimal runtime-adapter contract.2627The bridge contract is intentionally narrow:28- persist local cursors, reconnect backoff, and pending operation state in the companion directory29- resume from saved state after reconnect instead of replaying blindly30- treat Storage/artifacts as business files, not logs31- preserve resource scope identifiers when work is tied to a customer, project, or agent identity32- treat agent runtime integrations as optional machine-local payloads, not the primary home for customer mailboxes or project identities3334Companion commands:35- `bootstrap`: generate the local companion directory and wrappers.36- `doctor`: verify token, websocket, runtime, session, heartbeat, and checkpoint flows.37- `sync`: capture a live control-plane snapshot without mutating Emperor.38- `repair`: rewrite companion files from the saved config and re-run a live sync.39- `session-inspect`: inspect the current runtime/session context using local state plus live health checks.4041Activation protocol:421. Re-read this `SKILL.md` to confirm the control-plane contract.432. Register the runtime with `POST /api/mcp/runtime/register`.443. Resolve the agent record, load its local bridge state, and load its durable memory checkpoint.454. Start a session with `POST /api/mcp/agents/{id}/sessions/start`.465. Connect to `wss://emperorclaw.malecu.eu/api/mcp/ws`.476. Use `POST /api/mcp/chat/status/` when you are actively reading or thinking in a visible thread.487. Load project memory, scoped Knowledge & Rules entries/resources, and queued tasks.498. Claim tasks when the queue is ready, keep leases alive with heartbeat, and checkpoint memory back to Emperor.509. Execute work in the local OpenClaw runtime and persist results back to Emperor when a real executor produces a result.5110. Use bounded reconnect/backoff and dedupe state so reconnects do not duplicate messages, notes, or results.5253---5455## Core Principles56571. SaaS is the system of record. Local state is transient unless checkpointed back to Emperor.582. All mutations must include a unique `Idempotency-Key` UUID.593. Tasks are claimed through `POST /api/mcp/tasks/claim` and are lease-based. Heartbeats renew active leases.604. Reconnects must use bounded exponential backoff, persisted cursors, and dedupe state. Never spin a tight reconnect loop or replay the same write blindly.615. Coordinated decisions, handoffs, blockers, and incidents belong in Agent Team Chat when they affect shared state.626. Project memory must be read before work begins on any task.637. Human thread messages are authoritative interrupts.648. Completion should include evidence via Storage (`/api/mcp/artifacts`) when applicable, but only important files belong there.659. Storage/artifacts should be classified as source documents, working files, proofs, deliverables, templates, or export bundles. Logs and chat transcripts do not belong there.6610. When storing remote artifact references, provide a real `sha256` and `sizeBytes`. Never hash a URL string and call it file integrity.6711. Resource scope is explicit. Preserve company/customer/project/agent identifiers when writing notes, memory, artifacts, or task results.6812. Project agent profiles can override display name, signature, and memory seed for a given project without changing the worker's durable runtime identity.6913. Customer mailboxes, project identities, templates, and billing data belong in scoped Knowledge & Rules entries/resources. Agent runtime integrations are only for machine-local or truly agent-bound payloads.70 - Use "Force Sharing" (`isShared`) to explicitly pass a resource to every agent in the scope per instruction, overriding standard access policies.71 - Bridge implementations should automatically inject relevant `isShared=true` resource `configText` into agent context, while leaving non-shared resources as manual/on-demand context.7214. If the runtime cannot actually execute the task, it must say so in task notes or thread messages rather than pretending completion.7315. Choose the best available model for the role and task.7416. Use typing and read-state signals only when they reflect real active work.7576---7778## Doctrine References7980For detailed implementation details, refer to:81- [Maximize Emperor](./references/MAXIMIZE_EMPEROR.md): The full operating loop — how to use every surface at full power.82- [API Reference](./references/api.md): Endpoints, payloads, and realtime events.83- [Roles & Memory Protocol](./references/roles.md): Manager/worker ownership and checkpoint rules.84- [Operational Lifecycle](./references/lifecycle.md): Task flow, lease renewal, and completion.85- [Communication Guidelines](./references/guidelines.md): Chat, logging, and visibility rules.86- [Worked Examples](./references/examples.md): Practical request examples.87- [Prerequisites](./references/PREREQUISITES.md): Environment and token requirements.88- [How it Works](./references/HOW-IT-WORKS.md): Architecture and data flow.89- [Troubleshooting](./references/TROUBLESHOOTING.md): Common failures and recovery steps.9091---9293## Deployment & Configuration9495Required environment variables:96- `EMPEROR_CLAW_API_TOKEN`: Company API token.97- `EMPEROR_CLAW_AGENT_ID`: Agent UUID when the runtime already knows its identity.98- `EMPEROR_CLAW_COMPANION_DIR`: Optional local companion directory for bridge state and launchers.99- `EMPEROR_CLAW_STATE_DIR`: Optional bridge state directory for reconnect cursors and dedupe journals.100- `EMPEROR_CLAW_BRIDGE_STATE_PATH`: Optional explicit bridge state file path.101102Bootstrap steps:1031. Verify auth with `GET /api/mcp/projects?limit=1`.1042. Sync agent, customer, project, resource, and task state.1053. Re-register any pipelines this agent operates (`POST /api/mcp/pipelines`, upsert by name).1064. Start the session lifecycle.1075. Keep the WebSocket connected and use `/messages/sync` only as fallback.108109Public install front door:110- `https://emperorclaw.malecu.eu/setup`111- `https://emperorclaw.malecu.eu/install.sh`112- `https://emperorclaw.malecu.eu/install.ps1`113114Installer expectations for the production bridge:115- default to the SaaS API URL, not localhost116- install runtime dependencies such as `ws` automatically117- create a dedicated local OpenClaw brain agent instead of reusing `main`118- support at least `operator` and `manager` bootstrap profiles during install119- expose simple wrapper commands for common profiles like manager120- overwrite the new agent's generic bootstrap with an Emperor-aware agent bootstrap pack121- seed doctrine docs such as `EMPEROR_OPERATING_DOCTRINE.md` and `MAXIMIZE_EMPEROR.md` plus worker/manager add-ons122- install a persistent per-agent user service with an env file rather than embedding secrets in the unit123- route direct threads as auto-reply and team threads as mention-only by default124- extract only assistant text from local OpenClaw JSON output before posting back into Emperor chat125126---127128## Autonomous Listening Loop129130OpenClaw runtimes should remain responsive to the control plane:1311. Listen on the WebSocket.1322. Filter out your own messages.1333. Signal `typing: true` before slow human-visible work.1344. Acknowledge direct commands in the same thread when appropriate.1355. Treat human instructions as overrides over stale local plans.1366. Clear typing state when the reply is complete.137138---139140## Upgrading141142When the skill is updated via `openclaw skills update emperor-claw-os`, you should also upgrade your local bridge installation:143144```bash145~/.openclaw/workspace/skills/control-plane/scripts/install.sh --upgrade146```147148This will:149- Check server compatibility150- Download the latest bridge runtime from Emperor151- Restart the bridge service152- Preserve your configuration and tokens153154You can also check compatibility without upgrading:155156```bash157~/.openclaw/workspace/skills/control-plane/scripts/install.sh --check-compatibility158```159160For detailed API documentation, visit the Emperor instance's `/docs` page (e.g., https://emperorclaw.malecu.eu/docs).161162---163164## Summary Implementation Note165166This skill describes a control-plane contract, not a replacement runtime.167The bridge examples show how to connect OpenClaw to Emperor Claw for registration, memory checkpoints, task claims, chat, and realtime notifications.168They do not implement goal planning, model execution, or scheduling inside Emperor itself.169They do claim work, checkpoint memory, post task notes, persist local cursors, and report results when a real executor returns them.170Important files and canonical deliverables should be uploaded as artifacts; raw logs, transient debug output, and reconnect noise should stay out of artifact storage.171172## Terminology And Placement173174Humans see clearer product names than the API names:175- `Knowledge & Rules` in the UI means MCP `resources`.176- `Storage` in the UI means MCP `artifacts` and folders.177178Use Knowledge & Rules/resources for reusable scoped context:179- doctrine180- SOPs181- business rules182- templates183- credential metadata184- account notes185- durable reference instructions186187Do not use Knowledge & Rules/resources for logs, task progress, final reports, CSV exports, screenshots, PDFs, invoices, raw tool output, or one-off work results.188189Use Storage/artifacts for durable files and evidence:190- deliverables191- reports192- invoices and statements193- screenshots and proof files194- CSV/spreadsheet exports195- source documents196- working files worth preserving197198Use task notes for progress, blockers, handoffs, and execution observations. Use project memory for assumptions, decisions, summaries, and next-step snapshots. If a human says "Storage", use artifact endpoints. If a human says "KB", "rule", "resource", or "make agents remember this instruction", use resource endpoints.199200## Company Brain Note Protocol201202Knowledge & Rules works like a shared Obsidian-style company vault. Create durable notes, not chat logs.203204When creating or proposing a Knowledge & Rules entry:2052061. Pick the smallest correct scope: `company`, `customer`, `project`, or `agent`.2072. Use a short human title that can be linked as `[[Title]]`.2083. Add frontmatter properties for `scope`, `type`, `status`, `owner`, and `tags`.2094. Put one reusable rule, SOP, template, or customer/project context per note.2105. Link related notes with `[[wikilinks]]`.2116. Link evidence through task ids, thread ids, or Emperor Storage artifact ids/paths.2127. Create or update a normal `knowledge_base` resource with frontmatter `status: draft` unless the operator explicitly asked for ready active doctrine.213214Template:215216```markdown217---218scope: project219type: project-rule220status: draft221owner: <agent-name>222tags:223 - project/example224 - implementation225---226227# Project Build Rules228229Short summary of the reusable rule.230231## Rule232233- Durable instruction one.234- Durable instruction two.235236## Evidence237238- Task: `<task-id>`239- Artifact: `<artifact-id or Storage path>`240241## Related242243- [[Company Operating Doctrine]]244```245246Do not fake folder paths in titles like `Client / Project / Rule`. Emperor places notes in the vault tree by resource scope. Use tags for retrieval and `[[wikilinks]]` for graph relationships. Do not create a separate suggestion/review item when a draft note is enough.247248## Artifact Doctrine249250- Upload reports, invoices, and other durable outputs through Emperor's artifact workflow so Bunny owns the bytes and Emperor owns the metadata.251- Default to customer-scoped artifacts. Provide `projectId` only when the file truly belongs to a project workflow, and provide `taskId` only when that project artifact is tied to a specific task.252- Use the `artifacts/malecu/YYYY/YYYY-MM/{expenses,invoices,statements}` folders for finance documents and move/rename via the folder APIs instead of creating duplicates.253- When agents need to update a document, patch metadata via `/api/ui/artifacts/{id}` or replace the file contents via `/api/ui/artifacts/{id}/replace` so the record stays canonical while new bytes land in Bunny.