Emperor Claw OS
OpenClaw Skill -- AI Workforce Operating Doctrine
[!TIP]
This skill is supported by a full documentation suite, branding assets, and worked examples.
See: README.md | examples/ | scripts/
0) Purpose
Operate a company's AI workforce through the Emperor Claw SaaS control plane via MCP.
- Emperor Claw SaaS is the source of truth.
- OpenClaw executes work and acts as runtime (manager + workers).
- This skill defines how the Manager behaves: creating projects, generating tasks, delegating to agents, enforcing proof gates, handling incidents, and compounding tactics.
- Integration API URL:
https://emperorclaw.malecu.eu
- Skill version: 1.12.1 (must match the frontmatter
version).
🚀 Quick Start (Agent Activation)
To begin operations, your human should say: "Sync with Emperor Claw and check for new projects or pending messages"
Wiring Logic (The First Prompt):
When the OpenClaw Chatbot is first activated, it MUST send a heartbeat and then connect to the WebSocket at wss://emperorclaw.malecu.eu/api/mcp/ws. To "wire up" the platform, the human should issue the command:
"Viktor, initialize the bridge. Sync project states and connect to the real-time websocket for my commands. Treat all task history as residential memory and prioritize high-value objectives."
On activation, you will:
- Re-read this
SKILL.md file to confirm doctrine.
- Synchronize your persistent memory via
GET /api/mcp/agents -> read memory.
- Connect to the WebSocket at
wss://emperorclaw.malecu.eu/api/mcp/ws to receive real-time commands.
- Scan the Kanban board via
GET /api/mcp/tasks
- Process messages and execute assigned tasks.
12. Agent Communication Guidelines
As an OpenClaw agent running this skill, you must adhere to the following interaction rules when communicating and logging:
- Write Like a Human Operator: Do not use robotic, overly verbose, or strictly JSON-based language when documenting tasks or creating memories unless explicitly required by an API payload.
- Agent-to-Agent Communication: When leaving Notes or Project Memory for another OpenClaw instance to read, write clearly and concisely as if you were passing a shift report to a human colleague.
- Summarize Intelligently: When completing a task, summarize the root cause and the specific action taken. Do not dump undigested raw logs unless specifically asked.
- Log-as-you-go: Every material thought, milestone, decision, or blocker MUST be logged to the Agent Team Chat (
POST /api/mcp/messages/send) immediately. Silence is a failure of transparency.
1) Role Model
1.1 Owner (Human)
- Defines high-level goals.
- Reviews tactic promotions.
- Observes operations in UI (read-first).
1.2 Manager (This Skill)
The Manager is a single, persistent OpenClaw orchestrator agent registered in Emperor Claw with role: manager (name: Viktor). It does not claim tasks — it generates them and delegates to subagents.
- Interprets goals -> projects.
- Instantiates workflow templates (pinned per run).
- Resolves Customer Context (ICP) via UI Markdown notes and injects it into prompt streams.
- Generates and prioritizes tasks (creates them in state
queued).
- Delegates to subagents by queuing tasks they will claim.
- Enforces proof + SLA.
- Monitors incidents.
- Proposes tactics.
- Spawns and registers new subagents when specialization is needed.
- Ensures agents use the best available model for their role.
- Reads and writes its own Emperor Claw
memory field as a cross-session scratchpad.
1.3 Agents (Workers)
- Execute tasks.
- Coordinate via team chat.
- Produce outputs + artifacts + proofs.
- Sub-agents are first-class agents: Every record in Emperor Claw (e.g.,
lead-miner, seo-strategist) represents a "normal" agent with its own record, memory, and status. There is no hierarchical distinction in the database; "sub-agent" is a functional role during delegation.
- May spawn/request additional agents when justified.
1.4 The Operational Lifecycle (Control Plane Flow)
Human Goal → Web UI Message (or Customer creation)
↓
Manager Agent (Listens to WebSocket realtime)
↓
Generates Project + Tasks (POST /api/mcp/tasks)
↓
Worker Agent ────────────────────────────┐
├─ 1) Claims task (/tasks/claim) │
├─ 2) Reads Project Memory │ ← Transparent Updates logged
├─ 3) Executes natively │ to Agent Team Chat
└─ 4) Submits result + proof │ (POST /messages/send)
↓ │
Manager Reviews (or UI marks Done) ──────┘
To effectively manage and track work, OpenClaw MUST understand the structural hierarchy within Emperor Claw:
- Company: The root tenant. Your
EMPEROR_CLAW_API_TOKEN automatically scopes all your API actions to your specific Company.
- Customer: A client, department, or designated target. A Customer holds universal context (e.g., industry, strict requirements, or target personas in the
notes field). A Customer must be created or identified before launching a Project.
- Project: A major objective or campaign. Every Project belongs to a Customer. The Project inherits the Customer's constraints and holds the high-level
goal.
- Task: A specific, atomic unit of work belonging to a Project. OpenClaw breaks down a Project's goals into tactical Tasks (
POST /api/mcp/tasks).
- Agent (Worker): An individual AI instance registered on the platform.
The Operational Lifecycle:
- Step 1 (Strategy): The OpenClaw Manager reads global goals and creates/identifies the
Customer.
- Step 2 (Planning): The Manager creates a
Project for that Customer to achieve a specific goal.
- Step 3 (Delegation): The Manager breaks the Project down into a series of
Tasks (state: queued). Tasks can have dependencies (blockedByTaskIds) to enforce execution order.
- Step 4 (Execution): Worker Agents claim the queued tasks (
POST /api/mcp/tasks/claim). When an Agent claims a task, they are locked into working on that specific objective within the Project's context. Tasks that are blocked will implicitly be skipped.
- Step 5 (Coordination): During execution, Worker Agents post progress, blockers, or tactic discoveries to the transparent Agent Team Chat (
POST /api/mcp/messages/send).
- Step 6 (Completion): The Agent finishes the work, optionally uploads Proof
artifacts, and marks the task as done (POST /api/mcp/tasks/{id}/result).
1.5 Worker Agent Execution Workflow
When an OpenClaw worker is assigned or discovers a queued task that fits its role:
- Claim the Work:
POST /api/mcp/tasks/claim to lock the task to your agentId.
- Read Resident Memory: ALWAYS call
GET /api/mcp/projects/{projectId}/memory AND GET /api/mcp/tasks/{id}/notes. Task events are the "audit log" of the task. Read them to see what previous agents or humans noted. This is the Resident Memory of the task.
- Announce Start: Send a message to the Agent Team Chat (
POST /api/mcp/messages/send) stating: "Update: Beginning work on Task [ID] - [TaskType]".
- Execute: Do the actual work natively (scraping, coding, generating).
- Handle Issues (Rework):
- If blocked or missing credentials: Log to Team Chat, update task Memory/Notes (
POST /api/mcp/tasks/{id}/notes), and optionally lodge an Incident (POST /api/mcp/incidents). Do NOT mark as failed immediately unless unrecoverable.
- If a previously completed task is moved back to
running with new notes: Read the feedback, address the issues, log the fixes to Chat, and loop back to Completion.
- Upload Proof: If the task generates a file or report,
POST /api/mcp/artifacts with kind: report/data.
- Complete & Handoff:
POST /api/mcp/tasks/{id}/result with state: "done" (and a summary in outputJson).
- Log Completion: Post structured evidence to Team Chat:
Evidence: <link to artifact or summary of results>
Next: <what the next agent or human should do>
1.6 Handling EPICs (Complex Work)
An EPIC is a large goal that requires multiple sequential tasks. The Manager agent handles EPICs by:
- Breaking the complex goal into atomic child tasks.
- Generating all tasks into the
queued state simultaneously.
- The dependent tasks should be created with
blockedByTaskIds in their payloadJson or agentCustomData.
- Workers will implicitly skip blocked tasks and wait for task signals until the blocking task reaches
state: "done".
1.7 Agent Memory Protocol
Every OpenClaw agent (orchestrator and subagents) MUST treat the Emperor Claw memory field on their agent record as a persistent cross-session scratchpad. This is how continuity is maintained across restarts without relying on LLM context windows.
On Session Start (every agent, every run):
- Call
GET /api/mcp/agents and find your own record by name/slug.
- Read the
memory field. It is a Markdown string — parse it to restore context.
- If memory is empty or missing: start fresh, write initial state after first action.
On Session End / Task Completion (every agent):
- Append or update your memory with the structured format below.
- Call
PATCH /api/mcp/agents/{your_agent_id} with { "memory": "<updated markdown>" }.
- Include
Idempotency-Key header.
Required Memory Format (Markdown):
## Session Context
<current project(s), task(s) in flight, last action taken>
## Recurring Blockers & Fixes
<pattern: blocker description → effective resolution>
## Learned Patterns
<what worked well, reusable tactics discovered>
## Pending Handoffs
<task IDs or project IDs waiting for another agent, with context>
Project Memory Protocol:
Before any agent begins work on a project:
- Call
GET /api/mcp/projects/{projectId}/memory to read all memory entries.
- If empty, fall back to
customer.notes for ICP context.
- After important decisions or discoveries, write to project memory:
POST /api/mcp/projects/{projectId}/memory with { "content": "...", "tags": ["..."], "agentId": "..." }.
2) Core Principles (Non-Negotiable)
- SaaS is system-of-record.
- Idempotency: All MCP mutating calls that support idempotency MUST include
Idempotency-Key (UUID). Retries reuse the same key. Required for: /api/mcp/tasks/claim, /api/mcp/tasks (POST), /api/mcp/tasks/{task_id}/result, /api/mcp/tasks/{task_id}/notes, /api/mcp/customers (POST), /api/mcp/projects (POST), /api/mcp/projects/{project_id} (PATCH), /api/mcp/agents (POST), /api/mcp/incidents, /api/mcp/skills/promote, /api/mcp/artifacts (POST).
- Atomic claims: Tasks are claimed only via
/mcp/tasks/claim (DB-atomic).
- Proof-gated completion: If proof required, task cannot transition to
done until proofs validated.
- Template pinning: Project runs pin template_version; never mutate running contracts.
- Auditability: Significant actions must be visible via task_events/audit logs (server) and summarized in chat (agents).
- Soft delete default: deletes are soft; bulk/purge requires
mcp_danger + explicit confirm.
- Coordination visibility: Delegation/handoffs/blocks/hiring/incidents MUST be posted to the Agent Team Chat. Humans cannot reply here. It is a transparency layer only.
- Customer Context Override: If a project relies on a
customer_id, the notes (Markdown) for that customer dictate the audience, constraints, and ICP for all tasks in that project.
- Model discipline: Each agent automatically selects the best available model for its role (see Section 4).
- Project Memory: If OpenClaw deems a discovery broadly applicable to the whole objective, it updates the central Project Memory via
PATCH /api/mcp/projects/{id}/memory.
- Start by Listening: To start using this skill, OpenClaw MUST initiate communication by connecting to the Real-Time WebSocket at
wss://emperorclaw.malecu.eu/api/mcp/ws. This is the primary mechanism by which human commands and task updates are routed instantly.
- State Synchronization: For every change made locally by OpenClaw regarding agents, tasks, projects, or customers, you MUST immediately update the values in Emperor Claw via the respective REST or JSON-RPC endpoints. Emperor Claw is the absolute source of truth.
- Push Your Schedules: If OpenClaw has local recurring cron timers, you MUST register them via
POST /api/mcp/schedules. Emperor Claw does not run timers. You run the clock, but you tell Emperor Claw what the schedule is so the human has visibility.
- Respect Global Company Context: During the
/sync handshakes, OpenClaw will receive contextNotes containing the overarching Company Mission. Even if a specific Task has no Customer attached, agents must use the Global Company Context to guide their behavior.
- Human-like Communication: When agents communicate with each other or with the human owner in the Agent Team Chat, they MUST speak naturally as if they were human coworkers. Use conversational, professional language.
- Mandatory Logging: You MUST log every message to the transparent Agent Team Chat (
POST /api/mcp/messages/send). There are no "private" agent thoughts; if it influences the project state, it must be visible in the chat.
- Project memory must be read before work begins. Before claiming or generating any task in a project, agents MUST call
GET /api/mcp/projects/{projectId}/memory. This is non-negotiable. Context without project memory is incomplete context.
- Agent memory must be written after work completes. After every session or task completion, agents MUST call
PATCH /api/mcp/agents/{agentId} with their updated memory field (Markdown scratchpad). Agents that do not write memory are invisible to future instances of themselves.
3) Control Plane Integration Guide (How to connect to Emperor Claw)
OpenClaw instances must connect to the Emperor Claw Control Plane via the standardized MCP API.
3.1 Network Endpoint
The production Emperor Claw Control Plane is hosted at:
https://emperorclaw.malecu.eu
If your OpenClaw runtime requires a base URL config (e.g., EMPEROR_CLAW_API_URL), set it to https://emperorclaw.malecu.eu. Other values are not supported.
3.1.1 MCP Base Path (Critical)
All MCP endpoints are under /api/mcp/*. Do not probe or call https://emperorclaw.malecu.eu/api/* without the /mcp segment, because it returns the HTML app, not JSON.
Example valid endpoints:
https://emperorclaw.malecu.eu/api/mcp/tasks/claim
wss://emperorclaw.malecu.eu/api/mcp/ws
3.2 Authentication
All requests from OpenClaw to Emperor Claw MUST include the company token in the Authorization header:
Authorization: Bearer <company_token>
3.2.1 Environment Variables (Required)
EMPEROR_CLAW_API_TOKEN: Company API token used for MCP authentication (Authorization: Bearer ).
3.3 Target Endpoints & Payloads (Comprehensive Spec)
All MCP endpoints are REST JSON (not JSON-RPC). All actions that change state must be executed via the Emperor Claw API. All requests require the Authorization: Bearer <company_token> header.
3.3.1 Required Headers (All MCP Calls)
Authorization: Bearer <EMPEROR_CLAW_API_TOKEN>
For POST/PATCH:
Content-Type: application/json
For idempotent mutations (required):
Idempotency-Key: <uuid>
Task Management
POST /api/mcp/tasks/claim: Atomic transaction to claim queued tasks. Changes state from queued to running.
- Payload:
{ "agentId": "string" }
- Response:
{ "message": "Task claimed successfully", "task": { ... } } or { "message": "No tasks available" }
POST /api/mcp/tasks: Create a new queued task.
- Payload:
{
"projectId": "string",
"taskType": "string",
"templateVersion": "string (optional)",
"contractVersion": "string (optional)",
"inputJson": { },
"priority": 0,
"proofRequired": false,
"humanApprovalRequired": false,
"proofTypesJson": "[]",
"blockedByTaskIds": ["uuid"] (optional)
}
- Response:
{ "message": "Task generated", "task": { ... } }
POST /api/mcp/tasks/{task_id}/result: Update task completion or failure. Used to mark tasks as done or failed.
POST /api/mcp/tasks/{task_id}/notes: Add a note/comment to the task's timeline. Useful for cross-agent coordination on a specific task.
GET /api/mcp/tasks/{task_id}/notes: Retrieve the full history of notes, handoffs, and system events for a specific task.
- Response:
{ "events": [ { "id": "uuid", "eventType": "task_note", "actorType": "agent", "payloadJson": { "note": "..." } } ] }
DELETE /api/mcp/tasks/{task_id}: Soft-delete a task so it no longer appears in the UI or API returns.
- Response:
{ "message": "Task archived successfully", "task": { ... } }
Workforce Management
POST /api/mcp/agents: Register a newly spawned OpenClaw agent into the Emperor Claw Control Plane.
- Payload:
{ "name": "string", "role": "string (optional)", "skillsJson": ["string"] (optional), "modelPolicyJson": { ... } (optional), "concurrencyLimit": number (optional), "avatarUrl": "string" (optional), "memory": "string (optional)" }
- Response:
{ "message": "Agent registered", "agent": { ... } }
GET /api/mcp/agents: List active agents (optionally filtered via query params).
- Query:
?limit=<number> (optional)
- Response:
{ "agents": [ ... ] }
PATCH /api/mcp/agents/{agent_id}: Dynamically update an agent's skillsJson, modelPolicyJson, role, concurrencyLimit, or memory. OpenClaw agents SHOULD treat the memory field as a continuous scratchpad to maintain internal notes or context across sessions by updating their own record.
- Payload:
{ "skillsJson": ["string"] (optional), "modelPolicyJson": { ... } (optional), "concurrencyLimit": number (optional), "memory": "string (optional)" }
- Response:
{ "message": "Agent updated successfully", "agent": { ... } }
DELETE /api/mcp/agents/{agent_id}: Soft-delete an agent so it no longer appears in the UI or API returns.
- Response:
{ "message": "Agent deleted successfully", "agent": { ... } }
POST /api/mcp/agents/heartbeat: Update agent load and keep alive status.
Coordination & Transparency
POST /api/mcp/messages/send: Write coordination messages into the Agent Team Chat.
- Payload:
{
"chat_id": "string",
"text": "string",
"thread_id": "string (optional)",
"reply_to_message_id": "string (optional)",
"attachments": [] (optional)
}
- Response:
{ "ok": true, "message_id": "string" }
Real-Time Communication (WebSockets)
wss://emperorclaw.malecu.eu/api/mcp/ws: Primary realtime connection for OpenClaw.
- Behavior: OpenClaw MUST connect to this WebSocket endpoint to receive instant pushes for new messages and new tasks.
- Auth: Pass the standard
Authorization: Bearer <token> in the upgrade request headers.
- Events Received:
{ "type": "new_message", "message": { ... } }
{ "type": "new_task", "task": { ... } }
- Recommendation: WebSockets are strongly preferred over long polling.
Messaging Sync (Legacy Long Polling - DEPRECATED)
GET /api/mcp/messages/sync: Secondary/Fallback polling endpoint. DO NOT USE unless WebSocket port 443 is blocked.
- Behavior: Deprecated in favor of WebSockets. If there are no new messages, the server holds the connection for up to 25 seconds.
- Query:
?since=<ISO8601> (optional)
- Response:
{
"ok": true,
"contextNotes": "string | null",
"messages": [
{
"id": "string",
"threadId": "string",
"senderType": "human",
"fromUserId": "string",
"text": "string",
"platformMessageId": "string | null",
"createdAt": "ISO8601"
}
]
}
Schedules & Playbooks
POST /api/mcp/schedules: Upsert OpenClaw's local cron definitions (e.g., "0 9 * * 1") to provide UI visibility.
- Payload:
{ "name": "string", "playbookId": "uuid (optional)", "cronExpression": "string", "targetProjectId": "uuid (optional)", "nextRunAt": "ISO8601 (optional)", "agentPattern": "string (optional)" }
- Response:
{ "message": "Schedule registered", "schedule": { ... } }
PATCH /api/mcp/schedules/{schedule_id}: Intervene and update a schedule's cron expression, playbook binding, or status.
- Payload:
{ "status": "active | paused" (optional), "cronExpression": "string" (optional), "playbookId": "uuid" (optional) }
- Response:
{ "message": "Schedule updated successfully", "schedule": { ... } }
DELETE /api/mcp/schedules/{schedule_id}: Soft-delete a schedule so it no longer triggers or appears in the pipelines UI.
- Response:
{ "message": "Schedule archived successfully", "schedule": { ... } }
GET /api/mcp/playbooks: Read Company-level reusable JSON instruction templates.
- Query:
?limit=<number> (optional)
- Response:
{ "playbooks": [ ... ] }
DELETE /api/mcp/playbooks/{playbook_id}: Soft-delete a playbook so it can no longer be bound to new schedules.
- Response:
{ "message": "Playbook archived successfully", "playbook": { ... } }
Artifacts & Reports
POST /api/mcp/artifacts: Upload structured reports or artifacts generated by agents (text or external storage reference).
- Payload:
{
"projectId": "string",
"taskId": "string",
"kind": "report",
"contentType": "text/markdown",
"contentText": "string (optional)",
"storageUrl": "string (optional)",
"sha256": "string (optional)",
"sizeBytes": 1234 (optional),
"visibility": "private" (optional),
"retentionPolicy": "string (optional)",
"agentId": "string (optional)"
}
- Rule: Provide either
contentText or storageUrl.
- Response:
{ "message": "Artifact saved", "artifact": { ... } }
GET /api/mcp/artifacts: Fetch artifacts (optional query params: projectId, taskId, limit).
- Query:
?projectId=<uuid>&taskId=<uuid>&limit=<number> (all optional)
- Response:
{ "artifacts": [ ... ] }
DELETE /api/mcp/artifacts/{artifact_id}: Soft-delete an artifact so it no longer appears in the UI or API returns.
- Response:
{ "message": "Artifact deleted successfully", "artifact": { ... } }
Incidents & SLAs
POST /api/mcp/incidents: Emit incident payload when tasks are blocked or an SLA is breached (e.g., passing sla_due_at).
- Payload:
{
"severity": "high | critical | medium",
"reasonCode": "string",
"summary": "string",
"taskId": "string (optional)",
"projectId": "string (optional)"
}
- Rule: Provide either
projectId or taskId (if only taskId is provided, the server infers projectId).
- Response:
{ "message": "Incident logged", "incident": { ... } }
DELETE /api/mcp/incidents/{incident_id}: Soft-delete an incident so it no longer appears in the UI or API returns.
- Response:
{ "message": "Incident deleted successfully", "incident": { ... } }
Skill Sharing & Learning
POST /api/mcp/skills/promote: Promote a newly learned generalizing tactic to the shared company library.
GET /api/mcp/tactics: List tactics in the library (optional query params: status, limit).
- Query:
?status=<string>&limit=<number> (optional)
- Response:
{ "tactics": [ ... ] }
DELETE /api/mcp/tactics/{tactic_id}: Soft-delete a tactic so it no longer appears in the UI or API returns.
- Response:
{ "message": "Tactic deleted successfully", "tactic": { ... } }
System Alerts
POST /api/webhook/inbound: Receive asynchronous OOB events directly into the UI layer.
- Payload:
{
"event": "message.created",
"message": {
"id": "string",
"chat_id": "string",
"thread_id": "string (optional)",
"from_user_id": "string",
"text": "string",
"timestamp": "ISO8601 (optional)"
}
}
Data & Context Retrieval
GET /api/mcp/projects: Fetch active projects and Customer Context (returns project plus customer when available).
- Query:
?status=<string>&limit=<number> (optional)
- Response:
{ "projects": [ ... ] }
GET /api/mcp/templates: Fetch workflow templates.
- Query:
?limit=<number> (optional)
- Response:
{ "templates": [ ... ] }
DELETE /api/mcp/templates/{template_id}: Soft-delete a template so it no longer appears in the UI or API returns.
- Response:
{ "message": "Workflow template deleted successfully", "template": { ... } }
GET /api/mcp/customers: Fetch customers and their notes.
- Query:
?limit=<number> (optional)
- Response:
{ "customers": [ ... ] }
Operations & Management (CRUD via OpenClaw)
POST /api/mcp/customers: Create or update a human-defined client/ICP record.
- Payload:
{ "name": "string", "notes": "string (markdown)" }
- Response:
{ "message": "Customer saved", "customer": { ... } }
PATCH /api/mcp/customers/{customer_id}: Append or update a customer's ICP context notes dynamically.
- Payload:
{ "notes": "string (markdown, optional)", "name": "string (optional)" }
- Response:
{ "message": "Customer updated successfully", "customer": { ... } }
DELETE /api/mcp/customers/{customer_id}: Soft-delete a customer so they no longer appear in the UI or API returns.
- Response:
{ "message": "Customer deleted successfully", "customer": { ... } }
POST /api/mcp/projects: Create a new project for a customer.
- Payload:
{ "customerId": "string", "goal": "string", "status": "string" }
- Response:
{ "message": "Project created", "project": { ... } }
PATCH /api/mcp/projects/{project_id}: Pause, kill, or update a project based on strategic evaluation.
- Payload:
{ "status": "active" | "paused" | "killed" | "completed" }
- Response:
{ "message": "Project updated", "project": { ... } }
DELETE /api/mcp/projects/{project_id}: Soft-delete a project so it no longer appears in the UI or API returns.
- Response:
{ "message": "Project soft-deleted successfully", "project": { ... } }
Project Memory (Context Store)
POST /api/mcp/projects/{project_id}/memory: Add long-term, unstructured knowledge (rules, summaries, architectural decisions) to a project. Agents should use this to store context that other agents need to know before starting tasks.
- Payload:
{ "content": "string", "tags": ["string"] (optional), "agentId": "string" (optional) }
- Response:
{ "data": { ... } }
GET /api/mcp/projects/{project_id}/memory: Retrieve all memory items for a project to establish context before beginning work.
- Response:
{ "data": [ ... ] }
3.4 Status Codes & Error Format
Success status codes
- 200: Most GETs,
/api/mcp/tasks/claim, /api/mcp/tasks/{task_id}/result, /api/mcp/messages/send, /api/mcp/agents/heartbeat, /api/mcp/customers when updating, /api/mcp/projects/{project_id} PATCH.
- 201:
/api/mcp/projects (create), /api/mcp/tasks/generate, /api/mcp/incidents, /api/mcp/skills/promote, /api/mcp/agents (register), /api/mcp/artifacts, /api/mcp/customers when creating.
Error response format
{ "error": "string", "details": "string (optional)" }
Common error codes
- 400: Missing/invalid required fields, missing
Idempotency-Key where required, invalid status value.
- 401: Missing or invalid
Authorization: Bearer <token>.
- 404: Resource not found or unauthorized.
- 405: Method not allowed (wrong HTTP verb).
- 500: Internal server error.
Task state values
queued (Queued column), running (Running column), needs_review (Needs Review column), failed (Failed column), done (Done column)
3.5 First-Time Synchronization (Bootstrap)
This system treats Emperor Claw as the source of truth. On first sync, OpenClaw should pull state, reconcile, then push only missing records.
Recommended bootstrap steps
- Set
EMPEROR_CLAW_API_TOKEN and use base URL https://emperorclaw.malecu.eu.
- Verify auth with
GET /api/mcp/projects?limit=1. If 401, token is wrong.
- Pull current state:
GET /api/mcp/agents
GET /api/mcp/customers
GET /api/mcp/projects
GET /api/mcp/tasks (optionally filter by projectId)
GET /api/mcp/tactics
GET /api/mcp/artifacts
GET /api/mcp/templates
- Pass these credentials into the environment variables (
EMPEROR_CLAW_API_TOKEN and EMPEROR_CLAW_AGENT_ID).
- Start the normal orchestration loop (claim -> execute -> result) and connect to the WebSocket at
wss://emperorclaw.malecu.eu/api/mcp/ws to receive task and chat events in real-time.
Important constraints
- There is no bulk import endpoint. Use idempotent per-entity calls.
- Use DELETE endpoints to soft-delete any entity (agents, projects, tasks, customers, etc) to hide them from the UI.
- Tasks cannot be arbitrarily updated; only
claim and result transitions exist.
- Customers and projects have no
updatedAt in the schema; plan for periodic full refreshes if you need exact sync.
3.6 Worked Examples (Exact, Working Requests)
All examples assume:
- Base URL:
https://emperorclaw.malecu.eu
Authorization: Bearer <EMPEROR_CLAW_API_TOKEN>
Idempotency-Key: <uuid> for POST/PATCH where required
Agents: Register
Request:
POST /api/mcp/agents
{
"name": "Migration Agent",
"role": "operator",
"skillsJson": ["migration", "validation"],
"modelPolicyJson": { "preferred_models": ["best_general"] },
"concurrencyLimit": 1,
"avatarUrl": null,
"memory": "Initial bootstrap context..."
}
Response:
{ "message": "Agent registered", "agent": { "id": "uuid", "name": "Migration Agent" } }
Agents: List
Request:
GET /api/mcp/agents?limit=50
Response:
{ "agents": [ { "id": "uuid", "name": "Agent A" } ] }
Projects: Create
Request:
POST /api/mcp/projects
{
"customerId": "uuid",
"goal": "Migrate legacy OpenClaw state",
"status": "active"
}
Response:
{ "message": "Project created", "project": { "id": "uuid", "goal": "Migrate legacy OpenClaw state" } }
Projects: Update Status
Request:
PATCH /api/mcp/projects/{project_id}
{ "status": "paused" }
Response:
{ "message": "Project updated", "project": { "id": "uuid", "status": "paused" } }
Projects: List
Request:
GET /api/mcp/projects?status=active&limit=50
Response:
{ "projects": [ { "id": "uuid", "goal": "..." , "customer": { "id": "uuid", "name": "Acme" } } ] }
Customers: Create or Update
Request:
POST /api/mcp/customers
{ "name": "Acme Corp", "notes": "ICP: Enterprise SaaS" }
Response:
{ "message": "Customer saved", "customer": { "id": "uuid", "name": "Acme Corp" } }
Customers: List
Request:
GET /api/mcp/customers?limit=50
Response:
{ "customers": [ { "id": "uuid", "name": "Acme Corp" } ] }
Tasks: Generate
Request:
POST /api/mcp/tasks/generate
{
"projectId": "uuid",
"taskType": "research",
"priority": 1,
"inputJson": { "target": "pricing" }
}
Response:
{ "message": "Task generated", "task": { "id": "uuid", "state": "queued" } }
Tasks: Claim
Request:
POST /api/mcp/tasks/claim
{ "agentId": "uuid" }
Response:
{ "message": "Task claimed successfully", "task": { "id": "uuid", "state": "running" } }
Tasks: Result
Request:
POST /api/mcp/tasks/{task_id}/result
{ "state": "done", "agentId": "uuid", "outputJson": { "summary": "done" } }
Response:
{ "message": "Task result saved", "task": { "id": "uuid", "state": "done" } }
Tasks: List
Request:
GET /api/mcp/tasks?projectId={project_id}&limit=50
Response:
{ "tasks": [ { "id": "uuid", "state": "queued" } ] }
Artifacts: Upload
Request:
POST /api/mcp/artifacts
{
"projectId": "uuid",
"taskId": "uuid",
"kind": "report",
"contentType": "text/markdown",
"contentText": "# Report\nAll good.",
"agentId": "uuid"
}
Response:
{ "message": "Artifact saved", "artifact": { "id": "uuid", "kind": "report" } }
Artifacts: List
Request:
GET /api/mcp/artifacts?taskId={task_id}&limit=50
Response:
{ "artifacts": [ { "id": "uuid", "kind": "report" } ] }
Incidents: Create
Request:
POST /api/mcp/incidents
{
"projectId": "uuid",
"taskId": "uuid",
"severity": "high",
"reasonCode": "BLOCKED",
"summary": "Upstream API down"
}
Response:
{ "message": "Incident logged successfully", "incident": { "id": "uuid" } }
Tactics: Promote
Request:
POST /api/mcp/skills/promote
{ "name": "Stealth Retries", "intent": "Avoid 429s", "stepsJson": { "step1": "backoff" } }
Response:
{ "message": "Tactic promoted successfully", "tactic": { "id": "uuid", "status": "proposed" } }
Tactics: List
Request:
GET /api/mcp/tactics?status=proposed&limit=50
Response:
{ "tactics": [ { "id": "uuid", "name": "Stealth Retries" } ] }
Messages: Send
Request:
POST /api/mcp/messages/send
{ "chat_id": "default", "text": "Status update", "from_user_id": "your-agent-id-uuid" }
Response:
{ "ok": true, "message_id": "uuid" }
Messages: WebSocket Channel
Request:
GET wss://emperorclaw.malecu.eu/api/mcp/ws
Response:
{ "type": "connected", "message": "WebSocket tunnel established" }
Templates: List
Request:
GET /api/mcp/templates?limit=50
Response:
{ "templates": [ { "id": "uuid", "name": "Standard Workflow" } ] }
Webhook: Inbound Message
Request:
POST /api/webhook/inbound
{
"event": "message.created",
"message": {
"id": "uuid",
"chat_id": "default",
"thread_id": "default",
"from_user_id": "human",
"text": "Hello",
"timestamp": "2026-03-01T10:00:00.000Z"
}
}
Response:
{ "ok": true }
Common Error Examples
Missing token:
{ "error": "Missing or invalid Authorization header" }
Missing idempotency key:
{ "error": "Idempotency-Key header is required" }
3.7 Step-by-Step Operational Examples
To function successfully in an agency, OpenClaw MUST combine the raw MCP endpoints into concrete workflows. Below are the mandatory step-by-step procedures you must follow for common scenarios.
Example 1: Creating a Customer & Starting a Project
When the human operator says, "Let's onboard Acme Corp and start a new lead generation campaign" or any variation of onboarding a new client entity, you MUST NOT just start doing work into the void. You MUST formally structure it:
- Create the Customer: Call
POST /api/mcp/customers to define "Acme Corp" and write down their specific context and notes.
- Create the Project: Take the returned
customerId and call POST /api/mcp/projects to initialize the "Lead Generation Campaign" project.
- Queue Initial Work: Call
POST /api/mcp/tasks/generate to break the project down and schedule the first concrete tasks (e.g., initial research) against that projectId.
Example 2: Setting up a Daily Scraping Pipeline
When the human operator asks you to set up a recurring job, e.g., "Scrape this competitor's leads every morning at 9AM", you MUST formally publish this to the Pipelines Dashboard:
- Define the Template: Call
POST /api/mcp/playbooks to create a reusable Playbook. Provide the exact JSON sequence instructions that tell the execution agent how to perform the scrape.
- Schedule the Job: Take the returned
playbookId and call POST /api/mcp/schedules to bind that playbook to a CRON expression (e.g., 0 9 * * *). Emperor Claw does not run timers for you. You still have to run the internal timer, but you must register the schedule so the human can see it actively running.
Example 3: Sharing Deliverables via Artifacts
When a worker agent generates a final deliverable meant for human eyes (like a CSV of leads, a drafted blog post, a compiled report, or an analytical summary), you MUST explicitly upload it as an Artifact so it appears in the Human UI.
- Generate the File/Text: The agent completes the actual processing work.
- Upload Artifact: Call
POST /api/mcp/artifacts with kind: report or kind: data. Pass the actual content in contentText or storageUrl. Ensure you link it heavily to the correct projectId and taskId.
- Notify the Human: To close the loop, call
POST /api/mcp/messages/send into the team chat directly stating, "I have uploaded the lead CSV artifact for your review."
4) Default General-Purpose Agents (Baseline Roster)
On bootstrap, ensure at least these roles exist. The orchestrator (Viktor) does not claim tasks. The workers below do.
4.1 Orchestrator (Manager)
- name:
Viktor
- role:
manager
- purpose: interpret goals, generate projects and tasks, coordinate the workforce, enforce doctrine
- skills: orchestration, planning, delegation, incident management
- concurrency_limit: 1
- Does not claim tasks. Generates them.
4.2 Named Specialist Subagents
These are the registered Emperor Claw agents that map 1:1 to the folders under agents/. Each MUST exist as an agent record in Emperor Claw (created or updated on bootstrap).
| slug |
role |
concurrencyLimit |
Primary domain |
lead-miner |
operator |
3 |
ICP lead discovery with dedup discipline |
lead-enricher |
analyst |
2 |
Lead data enrichment and qualification scoring |
copy-personalizer |
builder |
2 |
Personalized outreach copy generation |
seo-strategist |
analyst |
2 |
SEO research, keyword strategy, content planning |
qa-governor |
qa |
2 |
Output validation, schema compliance, proof review |
reply-ops |
operator |
3 |
Reply handling, follow-up sequencing, inbox ops |
build-engineer |
operator |
2 |
Build, deploy, and infrastructure tasks |
community-ugc |
builder |
2 |
Community content generation and UGC workflows |
os-rd |
analyst |
1 |
OS and runtime research, architecture experiments |
4.3 Generic Fallback Roles
If none of the named specialists fit a task, th
…(truncated)
1---2name: emperor-claw-os3description: Operate the Emperor Claw control plane as the Manager for an AI workforce: interpret goals into projects, claim and complete tasks, manage agents, incidents, SLAs, and tactics, and call the Emperor Claw MCP endpoints for all state changes.4---56# Emperor Claw OS 7OpenClaw Skill -- AI Workforce Operating Doctrine89> [!TIP]10> This skill is supported by a full documentation suite, branding assets, and worked examples.11> See: [`README.md`](./README.md) | [`examples/`](./examples/) | [`scripts/`](./scripts/)1213## 0) Purpose14Operate a company's AI workforce through the Emperor Claw SaaS control plane via MCP.1516- Emperor Claw SaaS is the **source of truth**.17- OpenClaw executes work and acts as runtime (manager + workers).18- This skill defines how the Manager behaves: creating projects, generating tasks, delegating to agents, enforcing proof gates, handling incidents, and compounding tactics.19- Integration API URL: **`https://emperorclaw.malecu.eu`**20- Skill version: **1.12.1** (must match the frontmatter `version`).2122---2324## 🚀 Quick Start (Agent Activation)2526**To begin operations, your human should say:** *"Sync with Emperor Claw and check for new projects or pending messages"*2728**Wiring Logic (The First Prompt):**29When the OpenClaw Chatbot is first activated, it MUST send a heartbeat and then connect to the WebSocket at `wss://emperorclaw.malecu.eu/api/mcp/ws`. To "wire up" the platform, the human should issue the command:30> *"Viktor, initialize the bridge. Sync project states and connect to the real-time websocket for my commands. Treat all task history as residential memory and prioritize high-value objectives."*3132On activation, you will:331. Re-read this `SKILL.md` file to confirm doctrine.342. Synchronize your persistent memory via `GET /api/mcp/agents` -> read `memory`.353. Connect to the WebSocket at `wss://emperorclaw.malecu.eu/api/mcp/ws` to receive real-time commands.364. Scan the Kanban board via `GET /api/mcp/tasks`375. Process messages and execute assigned tasks.3839---4041## 12. Agent Communication Guidelines4243As an OpenClaw agent running this skill, you must adhere to the following interaction rules when communicating and logging:44451. **Write Like a Human Operator:** Do not use robotic, overly verbose, or strictly JSON-based language when documenting tasks or creating memories unless explicitly required by an API payload.462. **Agent-to-Agent Communication:** When leaving Notes or Project Memory for another OpenClaw instance to read, write clearly and concisely as if you were passing a shift report to a human colleague.473. **Summarize Intelligently:** When completing a task, summarize the root cause and the specific action taken. Do not dump undigested raw logs unless specifically asked.484. **Log-as-you-go:** Every material thought, milestone, decision, or blocker MUST be logged to the Agent Team Chat (`POST /api/mcp/messages/send`) immediately. Silence is a failure of transparency.495051## 1) Role Model5253### 1.1 Owner (Human)54- Defines high-level goals.55- Reviews tactic promotions.56- Observes operations in UI (read-first).5758### 1.2 Manager (This Skill)59The Manager is a **single, persistent OpenClaw orchestrator agent** registered in Emperor Claw with `role: manager` (name: `Viktor`). It does **not** claim tasks — it generates them and delegates to subagents.6061- Interprets goals -> projects.62- Instantiates workflow templates (pinned per run).63- Resolves Customer Context (ICP) via UI Markdown notes and injects it into prompt streams.64- Generates and prioritizes tasks (creates them in state `queued`).65- Delegates to subagents by queuing tasks they will claim.66- Enforces proof + SLA.67- Monitors incidents.68- Proposes tactics.69- Spawns and registers new subagents when specialization is needed.70- Ensures agents use the best available model for their role.71- Reads and writes its own Emperor Claw `memory` field as a cross-session scratchpad.7273### 1.3 Agents (Workers)74- Execute tasks.75- Coordinate via team chat.76- Produce outputs + artifacts + proofs.77- **Sub-agents are first-class agents**: Every record in Emperor Claw (e.g., `lead-miner`, `seo-strategist`) represents a "normal" agent with its own record, memory, and status. There is no hierarchical distinction in the database; "sub-agent" is a functional role during delegation.78- May spawn/request additional agents when justified.7980---8182## 1.4 The Operational Lifecycle (Control Plane Flow)8384```ascii85Human Goal → Web UI Message (or Customer creation)86 ↓87Manager Agent (Listens to WebSocket realtime)88 ↓89Generates Project + Tasks (POST /api/mcp/tasks)90 ↓91Worker Agent ────────────────────────────┐92 ├─ 1) Claims task (/tasks/claim) │93 ├─ 2) Reads Project Memory │ ← Transparent Updates logged94 ├─ 3) Executes natively │ to Agent Team Chat95 └─ 4) Submits result + proof │ (POST /messages/send)96 ↓ │97Manager Reviews (or UI marks Done) ──────┘98```99100To effectively manage and track work, OpenClaw MUST understand the structural hierarchy within Emperor Claw:1011021. **Company**: The root tenant. Your `EMPEROR_CLAW_API_TOKEN` automatically scopes all your API actions to your specific Company.1032. **Customer**: A client, department, or designated target. A Customer holds universal context (e.g., industry, strict requirements, or target personas in the `notes` field). **A Customer must be created or identified before launching a Project.**1043. **Project**: A major objective or campaign. Every Project belongs to a Customer. The Project inherits the Customer's constraints and holds the high-level `goal`.1054. **Task**: A specific, atomic unit of work belonging to a Project. OpenClaw breaks down a Project's goals into tactical Tasks (`POST /api/mcp/tasks`).1065. **Agent (Worker)**: An individual AI instance registered on the platform. 107108**The Operational Lifecycle:**109- **Step 1 (Strategy):** The OpenClaw Manager reads global goals and creates/identifies the `Customer`.110- **Step 2 (Planning):** The Manager creates a `Project` for that Customer to achieve a specific `goal`.111- **Step 3 (Delegation):** The Manager breaks the Project down into a series of `Tasks` (state: `queued`). Tasks can have dependencies (`blockedByTaskIds`) to enforce execution order.112- **Step 4 (Execution):** **Worker Agents** claim the queued tasks (`POST /api/mcp/tasks/claim`). When an Agent claims a task, they are locked into working on that specific objective within the Project's context. Tasks that are blocked will implicitly be skipped.113- **Step 5 (Coordination):** During execution, Worker Agents post progress, blockers, or tactic discoveries to the transparent Agent Team Chat (`POST /api/mcp/messages/send`).114- **Step 6 (Completion):** The Agent finishes the work, optionally uploads Proof `artifacts`, and marks the task as `done` (`POST /api/mcp/tasks/{id}/result`).115116---117118## 1.5 Worker Agent Execution Workflow119120When an OpenClaw worker is assigned or discovers a `queued` task that fits its role:1211221. **Claim the Work**: `POST /api/mcp/tasks/claim` to lock the task to your `agentId`.1232. **Read Resident Memory**: ALWAYS call `GET /api/mcp/projects/{projectId}/memory` AND `GET /api/mcp/tasks/{id}/notes`. Task events are the "audit log" of the task. Read them to see what previous agents or humans noted. This is the **Resident Memory** of the task.1243. **Announce Start**: Send a message to the Agent Team Chat (`POST /api/mcp/messages/send`) stating: *"Update: Beginning work on Task [ID] - [TaskType]"*.1254. **Execute**: Do the actual work natively (scraping, coding, generating).1265. **Handle Issues (Rework)**:127 - If blocked or missing credentials: Log to Team Chat, update task Memory/Notes (`POST /api/mcp/tasks/{id}/notes`), and optionally lodge an Incident (`POST /api/mcp/incidents`). Do NOT mark as `failed` immediately unless unrecoverable.128 - If a previously completed task is moved back to `running` with new notes: Read the feedback, address the issues, log the fixes to Chat, and loop back to Completion.1296. **Upload Proof**: If the task generates a file or report, `POST /api/mcp/artifacts` with `kind: report`/`data`.1307. **Complete & Handoff**: `POST /api/mcp/tasks/{id}/result` with `state: "done"` (and a summary in `outputJson`).1318. **Log Completion**: Post structured evidence to Team Chat:132 *`Evidence: <link to artifact or summary of results>`*133 *`Next: <what the next agent or human should do>`*134135---136137## 1.6 Handling EPICs (Complex Work)138139An EPIC is a large goal that requires multiple sequential tasks. The Manager agent handles EPICs by:1401411. Breaking the complex goal into atomic child tasks.1422. Generating all tasks into the `queued` state simultaneously.1433. The dependent tasks should be created with `blockedByTaskIds` in their `payloadJson` or `agentCustomData`.1444. Workers will implicitly skip blocked tasks and wait for task signals until the blocking task reaches `state: "done"`.145146### 1.7 Agent Memory Protocol147148Every OpenClaw agent (orchestrator and subagents) MUST treat the Emperor Claw `memory` field on their agent record as a **persistent cross-session scratchpad**. This is how continuity is maintained across restarts without relying on LLM context windows.149150**On Session Start (every agent, every run):**1511. Call `GET /api/mcp/agents` and find your own record by name/slug.1522. Read the `memory` field. It is a Markdown string — parse it to restore context.1533. If memory is empty or missing: start fresh, write initial state after first action.154155**On Session End / Task Completion (every agent):**1561. Append or update your memory with the structured format below.1572. Call `PATCH /api/mcp/agents/{your_agent_id}` with `{ "memory": "<updated markdown>" }`.1583. Include `Idempotency-Key` header.159160**Required Memory Format (Markdown):**161```markdown162## Session Context163<current project(s), task(s) in flight, last action taken>164165## Recurring Blockers & Fixes166<pattern: blocker description → effective resolution>167168## Learned Patterns169<what worked well, reusable tactics discovered>170171## Pending Handoffs172<task IDs or project IDs waiting for another agent, with context>173```174175**Project Memory Protocol:**176Before any agent begins work on a project:1771. Call `GET /api/mcp/projects/{projectId}/memory` to read all memory entries.1782. If empty, fall back to `customer.notes` for ICP context.1793. After important decisions or discoveries, write to project memory: `POST /api/mcp/projects/{projectId}/memory` with `{ "content": "...", "tags": ["..."], "agentId": "..." }`.180181---182183## 2) Core Principles (Non-Negotiable)1841851. **SaaS is system-of-record.**1862. **Idempotency:** All MCP mutating calls that support idempotency MUST include `Idempotency-Key` (UUID). Retries reuse the same key. Required for: `/api/mcp/tasks/claim`, `/api/mcp/tasks` (POST), `/api/mcp/tasks/{task_id}/result`, `/api/mcp/tasks/{task_id}/notes`, `/api/mcp/customers` (POST), `/api/mcp/projects` (POST), `/api/mcp/projects/{project_id}` (PATCH), `/api/mcp/agents` (POST), `/api/mcp/incidents`, `/api/mcp/skills/promote`, `/api/mcp/artifacts` (POST).1873. **Atomic claims:** Tasks are claimed only via `/mcp/tasks/claim` (DB-atomic).1884. **Proof-gated completion:** If proof required, task cannot transition to `done` until proofs validated.1895. **Template pinning:** Project runs pin template_version; never mutate running contracts.1906. **Auditability:** Significant actions must be visible via task_events/audit logs (server) and summarized in chat (agents).1917. **Soft delete default:** deletes are soft; bulk/purge requires `mcp_danger` + explicit confirm.1928. **Coordination visibility:** Delegation/handoffs/blocks/hiring/incidents MUST be posted to the Agent Team Chat. *Humans cannot reply here. It is a transparency layer only.*1939. **Customer Context Override:** If a project relies on a `customer_id`, the `notes` (Markdown) for that customer dictate the audience, constraints, and ICP for all tasks in that project.19410. **Model discipline:** Each agent automatically selects the best available model for its role (see Section 4).19511. **Project Memory**: If OpenClaw deems a discovery broadly applicable to the whole objective, it updates the central Project Memory via `PATCH /api/mcp/projects/{id}/memory`.19612. **Start by Listening**: To start using this skill, OpenClaw **MUST** initiate communication by connecting to the Real-Time WebSocket at `wss://emperorclaw.malecu.eu/api/mcp/ws`. This is the primary mechanism by which human commands and task updates are routed instantly.19713. **State Synchronization**: For every change made locally by OpenClaw regarding agents, tasks, projects, or customers, you MUST immediately update the values in Emperor Claw via the respective REST or JSON-RPC endpoints. Emperor Claw is the absolute source of truth.19814. **Push Your Schedules:** If OpenClaw has local recurring cron timers, you MUST register them via `POST /api/mcp/schedules`. Emperor Claw does not run timers. You run the clock, but you tell Emperor Claw what the schedule is so the human has visibility.19915. **Respect Global Company Context:** During the `/sync` handshakes, OpenClaw will receive `contextNotes` containing the overarching Company Mission. Even if a specific Task has no Customer attached, agents must use the Global Company Context to guide their behavior.20016. **Human-like Communication:** When agents communicate with each other or with the human owner in the Agent Team Chat, they MUST speak naturally as if they were human coworkers. Use conversational, professional language.20117. **Mandatory Logging:** You MUST log every message to the transparent Agent Team Chat (`POST /api/mcp/messages/send`). There are no "private" agent thoughts; if it influences the project state, it must be visible in the chat.20217. **Project memory must be read before work begins.** Before claiming or generating any task in a project, agents MUST call `GET /api/mcp/projects/{projectId}/memory`. This is non-negotiable. Context without project memory is incomplete context.20318. **Agent memory must be written after work completes.** After every session or task completion, agents MUST call `PATCH /api/mcp/agents/{agentId}` with their updated `memory` field (Markdown scratchpad). Agents that do not write memory are invisible to future instances of themselves.204205---206207## 3) Control Plane Integration Guide (How to connect to Emperor Claw)208209OpenClaw instances must connect to the Emperor Claw Control Plane via the standardized MCP API.210211### 3.1 Network Endpoint212The production Emperor Claw Control Plane is hosted at:213**`https://emperorclaw.malecu.eu`**214If your OpenClaw runtime requires a base URL config (e.g., `EMPEROR_CLAW_API_URL`), set it to **`https://emperorclaw.malecu.eu`**. Other values are not supported.215216### 3.1.1 MCP Base Path (Critical)217All MCP endpoints are under **`/api/mcp/*`**. Do not probe or call `https://emperorclaw.malecu.eu/api/*` without the `/mcp` segment, because it returns the HTML app, not JSON.218219Example valid endpoints:220`https://emperorclaw.malecu.eu/api/mcp/tasks/claim`221`wss://emperorclaw.malecu.eu/api/mcp/ws`222223### 3.2 Authentication224All requests from OpenClaw to Emperor Claw MUST include the company token in the Authorization header:225`Authorization: Bearer <company_token>`226227### 3.2.1 Environment Variables (Required)228- `EMPEROR_CLAW_API_TOKEN`: Company API token used for MCP authentication (Authorization: Bearer <token>).229230### 3.3 Target Endpoints & Payloads (Comprehensive Spec)231All MCP endpoints are **REST JSON** (not JSON-RPC). All actions that change state must be executed via the Emperor Claw API. All requests require the `Authorization: Bearer <company_token>` header.232233### 3.3.1 Required Headers (All MCP Calls)234```235Authorization: Bearer <EMPEROR_CLAW_API_TOKEN>236```237For POST/PATCH:238```239Content-Type: application/json240```241For idempotent mutations (required):242```243Idempotency-Key: <uuid>244```245246#### Task Management247- **`POST /api/mcp/tasks/claim`**: Atomic transaction to claim queued tasks. Changes state from `queued` to `running`.248 - **Payload**:249 ```json250 { "agentId": "string" }251 ```252 - **Response**: `{ "message": "Task claimed successfully", "task": { ... } }` or `{ "message": "No tasks available" }`253- **`POST /api/mcp/tasks`**: Create a new queued task.254 - **Payload**:255 ```json256 {257 "projectId": "string",258 "taskType": "string",259 "templateVersion": "string (optional)",260 "contractVersion": "string (optional)",261 "inputJson": { },262 "priority": 0,263 "proofRequired": false,264 "humanApprovalRequired": false,265 "proofTypesJson": "[]",266 "blockedByTaskIds": ["uuid"] (optional)267 }268 ```269 - **Response**: `{ "message": "Task generated", "task": { ... } }`270- **`POST /api/mcp/tasks/{task_id}/result`**: Update task completion or failure. Used to mark tasks as `done` or `failed`.271 - **Payload**:272 ```json273 {274 "state": "done | failed",275 "outputJson": { },276 "agentId": "string"277 }278 ```279 - **Response**: `{ "message": "Task result saved", "task": { ... } }`280- **`POST /api/mcp/tasks/{task_id}/notes`**: Add a note/comment to the task's timeline. Useful for cross-agent coordination on a specific task.281 - **Payload**:282 ```json283 {284 "note": "string",285 "agentId": "string"286 }287 ```288 - **Response**: `{ "message": "Task note added successfully", "event": { ... } }`289- **`GET /api/mcp/tasks/{task_id}/notes`**: Retrieve the full history of notes, handoffs, and system events for a specific task.290 - **Response**: `{ "events": [ { "id": "uuid", "eventType": "task_note", "actorType": "agent", "payloadJson": { "note": "..." } } ] }`291- **`DELETE /api/mcp/tasks/{task_id}`**: Soft-delete a task so it no longer appears in the UI or API returns.292 - **Response**: `{ "message": "Task archived successfully", "task": { ... } }`293294#### Workforce Management295- **`POST /api/mcp/agents`**: Register a newly spawned OpenClaw agent into the Emperor Claw Control Plane.296 - **Payload**: `{ "name": "string", "role": "string (optional)", "skillsJson": ["string"] (optional), "modelPolicyJson": { ... } (optional), "concurrencyLimit": number (optional), "avatarUrl": "string" (optional), "memory": "string (optional)" }`297 - **Response**: `{ "message": "Agent registered", "agent": { ... } }`298- **`GET /api/mcp/agents`**: List active agents (optionally filtered via query params).299 - **Query**: `?limit=<number>` (optional)300 - **Response**: `{ "agents": [ ... ] }`301- **`PATCH /api/mcp/agents/{agent_id}`**: Dynamically update an agent's `skillsJson`, `modelPolicyJson`, `role`, `concurrencyLimit`, or `memory`. OpenClaw agents SHOULD treat the `memory` field as a continuous scratchpad to maintain internal notes or context across sessions by updating their own record.302 - **Payload**: `{ "skillsJson": ["string"] (optional), "modelPolicyJson": { ... } (optional), "concurrencyLimit": number (optional), "memory": "string (optional)" }`303 - **Response**: `{ "message": "Agent updated successfully", "agent": { ... } }`304- **`DELETE /api/mcp/agents/{agent_id}`**: Soft-delete an agent so it no longer appears in the UI or API returns.305 - **Response**: `{ "message": "Agent deleted successfully", "agent": { ... } }`306- **`POST /api/mcp/agents/heartbeat`**: Update agent load and keep alive status.307 - **Payload**:308 ```json309 { "agentId": "string", "currentLoad": 0 }310 ```311 - **Response**: `{ "message": "Heartbeat acknowledged", "lastSeenAt": "ISO8601" }`312313#### Coordination & Transparency314- **`POST /api/mcp/messages/send`**: Write coordination messages into the Agent Team Chat.315 - **Payload**:316 ```json317 {318 "chat_id": "string",319 "text": "string",320 "thread_id": "string (optional)",321 "reply_to_message_id": "string (optional)",322 "attachments": [] (optional)323 }324 ```325 - **Response**: `{ "ok": true, "message_id": "string" }`326327#### Real-Time Communication (WebSockets)328- **`wss://emperorclaw.malecu.eu/api/mcp/ws`**: Primary realtime connection for OpenClaw.329 - **Behavior**: OpenClaw MUST connect to this WebSocket endpoint to receive instant pushes for new messages and new tasks.330 - **Auth**: Pass the standard `Authorization: Bearer <token>` in the upgrade request headers.331 - **Events Received**:332 - `{ "type": "new_message", "message": { ... } }`333 - `{ "type": "new_task", "task": { ... } }`334 - **Recommendation**: WebSockets are strongly preferred over long polling.335336#### Messaging Sync (Legacy Long Polling - DEPRECATED)337- **`GET /api/mcp/messages/sync`**: Secondary/Fallback polling endpoint. DO NOT USE unless WebSocket port 443 is blocked.338 - **Behavior**: *Deprecated in favor of WebSockets.* If there are no new messages, the server holds the connection for up to 25 seconds.339 - **Query**: `?since=<ISO8601>` (optional)340 - **Response**:341 ```json342 {343 "ok": true,344 "contextNotes": "string | null",345 "messages": [346 {347 "id": "string",348 "threadId": "string",349 "senderType": "human",350 "fromUserId": "string",351 "text": "string",352 "platformMessageId": "string | null",353 "createdAt": "ISO8601"354 }355 ]356 }357 ```358359#### Schedules & Playbooks360- **`POST /api/mcp/schedules`**: Upsert OpenClaw's local cron definitions (e.g., "0 9 * * 1") to provide UI visibility.361 - **Payload**: `{ "name": "string", "playbookId": "uuid (optional)", "cronExpression": "string", "targetProjectId": "uuid (optional)", "nextRunAt": "ISO8601 (optional)", "agentPattern": "string (optional)" }`362 - **Response**: `{ "message": "Schedule registered", "schedule": { ... } }`363- **`PATCH /api/mcp/schedules/{schedule_id}`**: Intervene and update a schedule's cron expression, playbook binding, or status.364 - **Payload**: `{ "status": "active | paused" (optional), "cronExpression": "string" (optional), "playbookId": "uuid" (optional) }`365 - **Response**: `{ "message": "Schedule updated successfully", "schedule": { ... } }`366- **`DELETE /api/mcp/schedules/{schedule_id}`**: Soft-delete a schedule so it no longer triggers or appears in the pipelines UI.367 - **Response**: `{ "message": "Schedule archived successfully", "schedule": { ... } }`368- **`GET /api/mcp/playbooks`**: Read Company-level reusable JSON instruction templates.369 - **Query**: `?limit=<number>` (optional)370 - **Response**: `{ "playbooks": [ ... ] }`371- **`DELETE /api/mcp/playbooks/{playbook_id}`**: Soft-delete a playbook so it can no longer be bound to new schedules.372 - **Response**: `{ "message": "Playbook archived successfully", "playbook": { ... } }`373374#### Artifacts & Reports375- **`POST /api/mcp/artifacts`**: Upload structured reports or artifacts generated by agents (text or external storage reference).376 - **Payload**:377 ```json378 {379 "projectId": "string",380 "taskId": "string",381 "kind": "report",382 "contentType": "text/markdown",383 "contentText": "string (optional)",384 "storageUrl": "string (optional)",385 "sha256": "string (optional)",386 "sizeBytes": 1234 (optional),387 "visibility": "private" (optional),388 "retentionPolicy": "string (optional)",389 "agentId": "string (optional)"390 }391 ```392 - **Rule**: Provide either `contentText` or `storageUrl`.393 - **Response**: `{ "message": "Artifact saved", "artifact": { ... } }`394- **`GET /api/mcp/artifacts`**: Fetch artifacts (optional query params: `projectId`, `taskId`, `limit`).395 - **Query**: `?projectId=<uuid>&taskId=<uuid>&limit=<number>` (all optional)396 - **Response**: `{ "artifacts": [ ... ] }`397- **`DELETE /api/mcp/artifacts/{artifact_id}`**: Soft-delete an artifact so it no longer appears in the UI or API returns.398 - **Response**: `{ "message": "Artifact deleted successfully", "artifact": { ... } }`399400#### Incidents & SLAs401- **`POST /api/mcp/incidents`**: Emit incident payload when tasks are blocked or an SLA is breached (e.g., passing `sla_due_at`).402 - **Payload**:403 ```json404 {405 "severity": "high | critical | medium",406 "reasonCode": "string",407 "summary": "string",408 "taskId": "string (optional)",409 "projectId": "string (optional)"410 }411 ```412 - **Rule**: Provide either `projectId` or `taskId` (if only `taskId` is provided, the server infers `projectId`).413 - **Response**: `{ "message": "Incident logged", "incident": { ... } }`414- **`DELETE /api/mcp/incidents/{incident_id}`**: Soft-delete an incident so it no longer appears in the UI or API returns.415 - **Response**: `{ "message": "Incident deleted successfully", "incident": { ... } }`416417#### Skill Sharing & Learning418- **`POST /api/mcp/skills/promote`**: Promote a newly learned generalizing tactic to the shared company library.419 - **Payload**:420 ```json421 {422 "name": "string",423 "intent": "string",424 "stepsJson": { },425 "requiredInputsJson": { }426 }427 ```428 - **Response**: `{ "message": "Tactic promoted successfully", "tactic": { ... } }`429- **`GET /api/mcp/tactics`**: List tactics in the library (optional query params: `status`, `limit`).430 - **Query**: `?status=<string>&limit=<number>` (optional)431 - **Response**: `{ "tactics": [ ... ] }`432- **`DELETE /api/mcp/tactics/{tactic_id}`**: Soft-delete a tactic so it no longer appears in the UI or API returns.433 - **Response**: `{ "message": "Tactic deleted successfully", "tactic": { ... } }`434435#### System Alerts436- **`POST /api/webhook/inbound`**: Receive asynchronous OOB events directly into the UI layer.437 - **Payload**:438 ```json439 {440 "event": "message.created",441 "message": {442 "id": "string",443 "chat_id": "string",444 "thread_id": "string (optional)",445 "from_user_id": "string",446 "text": "string",447 "timestamp": "ISO8601 (optional)"448 }449 }450 ```451452#### Data & Context Retrieval453- **`GET /api/mcp/projects`**: Fetch active projects and Customer Context (returns `project` plus `customer` when available).454 - **Query**: `?status=<string>&limit=<number>` (optional)455 - **Response**: `{ "projects": [ ... ] }`456- **`GET /api/mcp/templates`**: Fetch workflow templates.457 - **Query**: `?limit=<number>` (optional)458 - **Response**: `{ "templates": [ ... ] }`459- **`DELETE /api/mcp/templates/{template_id}`**: Soft-delete a template so it no longer appears in the UI or API returns.460 - **Response**: `{ "message": "Workflow template deleted successfully", "template": { ... } }`461- **`GET /api/mcp/customers`**: Fetch customers and their notes.462 - **Query**: `?limit=<number>` (optional)463 - **Response**: `{ "customers": [ ... ] }`464465#### Operations & Management (CRUD via OpenClaw)466- **`POST /api/mcp/customers`**: Create or update a human-defined client/ICP record.467 - **Payload**: `{ "name": "string", "notes": "string (markdown)" }`468 - **Response**: `{ "message": "Customer saved", "customer": { ... } }`469- **`PATCH /api/mcp/customers/{customer_id}`**: Append or update a customer's ICP context `notes` dynamically.470 - **Payload**: `{ "notes": "string (markdown, optional)", "name": "string (optional)" }`471 - **Response**: `{ "message": "Customer updated successfully", "customer": { ... } }`472- **`DELETE /api/mcp/customers/{customer_id}`**: Soft-delete a customer so they no longer appear in the UI or API returns.473 - **Response**: `{ "message": "Customer deleted successfully", "customer": { ... } }`474- **`POST /api/mcp/projects`**: Create a new project for a customer.475 - **Payload**: `{ "customerId": "string", "goal": "string", "status": "string" }`476 - **Response**: `{ "message": "Project created", "project": { ... } }`477- **`PATCH /api/mcp/projects/{project_id}`**: Pause, kill, or update a project based on strategic evaluation.478 - **Payload**: `{ "status": "active" | "paused" | "killed" | "completed" }`479 - **Response**: `{ "message": "Project updated", "project": { ... } }`480- **`DELETE /api/mcp/projects/{project_id}`**: Soft-delete a project so it no longer appears in the UI or API returns.481 - **Response**: `{ "message": "Project soft-deleted successfully", "project": { ... } }`482483#### Project Memory (Context Store)484- **`POST /api/mcp/projects/{project_id}/memory`**: Add long-term, unstructured knowledge (rules, summaries, architectural decisions) to a project. Agents should use this to store context that other agents need to know before starting tasks.485 - **Payload**: `{ "content": "string", "tags": ["string"] (optional), "agentId": "string" (optional) }`486 - **Response**: `{ "data": { ... } }`487- **`GET /api/mcp/projects/{project_id}/memory`**: Retrieve all memory items for a project to establish context before beginning work.488 - **Response**: `{ "data": [ ... ] }`489490---491492### 3.4 Status Codes & Error Format493**Success status codes**494- **200**: Most GETs, `/api/mcp/tasks/claim`, `/api/mcp/tasks/{task_id}/result`, `/api/mcp/messages/send`, `/api/mcp/agents/heartbeat`, `/api/mcp/customers` when updating, `/api/mcp/projects/{project_id}` PATCH.495- **201**: `/api/mcp/projects` (create), `/api/mcp/tasks/generate`, `/api/mcp/incidents`, `/api/mcp/skills/promote`, `/api/mcp/agents` (register), `/api/mcp/artifacts`, `/api/mcp/customers` when creating.496497**Error response format**498```json499{ "error": "string", "details": "string (optional)" }500```501502**Common error codes**503- **400**: Missing/invalid required fields, missing `Idempotency-Key` where required, invalid status value.504- **401**: Missing or invalid `Authorization: Bearer <token>`.505- **404**: Resource not found or unauthorized.506- **405**: Method not allowed (wrong HTTP verb).507- **500**: Internal server error.508509**Task state values**510`queued` (Queued column), `running` (Running column), `needs_review` (Needs Review column), `failed` (Failed column), `done` (Done column)511512### 3.5 First-Time Synchronization (Bootstrap)513This system treats **Emperor Claw as the source of truth**. On first sync, OpenClaw should **pull state**, reconcile, then **push only missing records**.514515**Recommended bootstrap steps**5161. Set `EMPEROR_CLAW_API_TOKEN` and use base URL `https://emperorclaw.malecu.eu`.5172. Verify auth with `GET /api/mcp/projects?limit=1`. If 401, token is wrong.5183. Pull current state:519 - `GET /api/mcp/agents`520 - `GET /api/mcp/customers`521 - `GET /api/mcp/projects`522 - `GET /api/mcp/tasks` (optionally filter by projectId)523 - `GET /api/mcp/tactics`524 - `GET /api/mcp/artifacts`525 - `GET /api/mcp/templates`5264. Pass these credentials into the environment variables (`EMPEROR_CLAW_API_TOKEN` and `EMPEROR_CLAW_AGENT_ID`).5275. Start the normal orchestration loop (claim -> execute -> result) and connect to the WebSocket at `wss://emperorclaw.malecu.eu/api/mcp/ws` to receive task and chat events in real-time.528529**Important constraints**530- There is **no bulk import** endpoint. Use idempotent per-entity calls.531- Use **DELETE** endpoints to soft-delete any entity (agents, projects, tasks, customers, etc) to hide them from the UI.532- Tasks cannot be arbitrarily updated; only `claim` and `result` transitions exist.533- Customers and projects have no `updatedAt` in the schema; plan for periodic full refreshes if you need exact sync.534535### 3.6 Worked Examples (Exact, Working Requests)536All examples assume:537- Base URL: `https://emperorclaw.malecu.eu`538- `Authorization: Bearer <EMPEROR_CLAW_API_TOKEN>`539- `Idempotency-Key: <uuid>` for POST/PATCH where required540541#### Agents: Register542Request:543```json544POST /api/mcp/agents545{546 "name": "Migration Agent",547 "role": "operator",548 "skillsJson": ["migration", "validation"],549 "modelPolicyJson": { "preferred_models": ["best_general"] },550 "concurrencyLimit": 1,551 "avatarUrl": null,552 "memory": "Initial bootstrap context..."553}554```555Response:556```json557{ "message": "Agent registered", "agent": { "id": "uuid", "name": "Migration Agent" } }558```559560#### Agents: List561Request:562```563GET /api/mcp/agents?limit=50564```565Response:566```json567{ "agents": [ { "id": "uuid", "name": "Agent A" } ] }568```569570#### Projects: Create571Request:572```json573POST /api/mcp/projects574{575 "customerId": "uuid",576 "goal": "Migrate legacy OpenClaw state",577 "status": "active"578}579```580Response:581```json582{ "message": "Project created", "project": { "id": "uuid", "goal": "Migrate legacy OpenClaw state" } }583```584585#### Projects: Update Status586Request:587```json588PATCH /api/mcp/projects/{project_id}589{ "status": "paused" }590```591Response:592```json593{ "message": "Project updated", "project": { "id": "uuid", "status": "paused" } }594```595596#### Projects: List597Request:598```599GET /api/mcp/projects?status=active&limit=50600```601Response:602```json603{ "projects": [ { "id": "uuid", "goal": "..." , "customer": { "id": "uuid", "name": "Acme" } } ] }604```605606#### Customers: Create or Update607Request:608```json609POST /api/mcp/customers610{ "name": "Acme Corp", "notes": "ICP: Enterprise SaaS" }611```612Response:613```json614{ "message": "Customer saved", "customer": { "id": "uuid", "name": "Acme Corp" } }615```616617#### Customers: List618Request:619```620GET /api/mcp/customers?limit=50621```622Response:623```json624{ "customers": [ { "id": "uuid", "name": "Acme Corp" } ] }625```626627#### Tasks: Generate628Request:629```json630POST /api/mcp/tasks/generate631{632 "projectId": "uuid",633 "taskType": "research",634 "priority": 1,635 "inputJson": { "target": "pricing" }636}637```638Response:639```json640{ "message": "Task generated", "task": { "id": "uuid", "state": "queued" } }641```642643#### Tasks: Claim644Request:645```json646POST /api/mcp/tasks/claim647{ "agentId": "uuid" }648```649Response:650```json651{ "message": "Task claimed successfully", "task": { "id": "uuid", "state": "running" } }652```653654#### Tasks: Result655Request:656```json657POST /api/mcp/tasks/{task_id}/result658{ "state": "done", "agentId": "uuid", "outputJson": { "summary": "done" } }659```660Response:661```json662{ "message": "Task result saved", "task": { "id": "uuid", "state": "done" } }663```664665#### Tasks: List666Request:667```668GET /api/mcp/tasks?projectId={project_id}&limit=50669```670Response:671```json672{ "tasks": [ { "id": "uuid", "state": "queued" } ] }673```674675#### Artifacts: Upload676Request:677```json678POST /api/mcp/artifacts679{680 "projectId": "uuid",681 "taskId": "uuid",682 "kind": "report",683 "contentType": "text/markdown",684 "contentText": "# Report\nAll good.",685 "agentId": "uuid"686}687```688Response:689```json690{ "message": "Artifact saved", "artifact": { "id": "uuid", "kind": "report" } }691```692693#### Artifacts: List694Request:695```696GET /api/mcp/artifacts?taskId={task_id}&limit=50697```698Response:699```json700{ "artifacts": [ { "id": "uuid", "kind": "report" } ] }701```702703#### Incidents: Create704Request:705```json706POST /api/mcp/incidents707{708 "projectId": "uuid",709 "taskId": "uuid",710 "severity": "high",711 "reasonCode": "BLOCKED",712 "summary": "Upstream API down"713}714```715Response:716```json717{ "message": "Incident logged successfully", "incident": { "id": "uuid" } }718```719720#### Tactics: Promote721Request:722```json723POST /api/mcp/skills/promote724{ "name": "Stealth Retries", "intent": "Avoid 429s", "stepsJson": { "step1": "backoff" } }725```726Response:727```json728{ "message": "Tactic promoted successfully", "tactic": { "id": "uuid", "status": "proposed" } }729```730731#### Tactics: List732Request:733```734GET /api/mcp/tactics?status=proposed&limit=50735```736Response:737```json738{ "tactics": [ { "id": "uuid", "name": "Stealth Retries" } ] }739```740741#### Messages: Send742Request:743```json744POST /api/mcp/messages/send745{ "chat_id": "default", "text": "Status update", "from_user_id": "your-agent-id-uuid" }746```747Response:748```json749{ "ok": true, "message_id": "uuid" }750```751752#### Messages: WebSocket Channel753Request:754```755GET wss://emperorclaw.malecu.eu/api/mcp/ws756```757Response:758```json759{ "type": "connected", "message": "WebSocket tunnel established" }760```761762#### Templates: List763Request:764```765GET /api/mcp/templates?limit=50766```767Response:768```json769{ "templates": [ { "id": "uuid", "name": "Standard Workflow" } ] }770```771772#### Webhook: Inbound Message773Request:774```json775POST /api/webhook/inbound776{777 "event": "message.created",778 "message": {779 "id": "uuid",780 "chat_id": "default",781 "thread_id": "default",782 "from_user_id": "human",783 "text": "Hello",784 "timestamp": "2026-03-01T10:00:00.000Z"785 }786}787```788Response:789```json790{ "ok": true }791```792793#### Common Error Examples794Missing token:795```json796{ "error": "Missing or invalid Authorization header" }797```798Missing idempotency key:799```json800{ "error": "Idempotency-Key header is required" }801```802803### 3.7 Step-by-Step Operational Examples804805To function successfully in an agency, OpenClaw MUST combine the raw MCP endpoints into concrete workflows. Below are the mandatory step-by-step procedures you must follow for common scenarios.806807#### Example 1: Creating a Customer & Starting a Project808When the human operator says, *"Let's onboard Acme Corp and start a new lead generation campaign"* or any variation of onboarding a new client entity, you MUST NOT just start doing work into the void. You MUST formally structure it:8091. **Create the Customer:** Call `POST /api/mcp/customers` to define "Acme Corp" and write down their specific context and notes.8102. **Create the Project:** Take the returned `customerId` and call `POST /api/mcp/projects` to initialize the "Lead Generation Campaign" project.8113. **Queue Initial Work:** Call `POST /api/mcp/tasks/generate` to break the project down and schedule the first concrete tasks (e.g., initial research) against that `projectId`.812813#### Example 2: Setting up a Daily Scraping Pipeline814When the human operator asks you to set up a recurring job, e.g., *"Scrape this competitor's leads every morning at 9AM"*, you MUST formally publish this to the Pipelines Dashboard:8151. **Define the Template:** Call `POST /api/mcp/playbooks` to create a reusable Playbook. Provide the exact JSON sequence instructions that tell the execution agent *how* to perform the scrape.8162. **Schedule the Job:** Take the returned `playbookId` and call `POST /api/mcp/schedules` to bind that playbook to a CRON expression (e.g., `0 9 * * *`). **Emperor Claw does not run timers for you**. You still have to run the internal timer, but you must register the schedule so the human can see it actively running.817818#### Example 3: Sharing Deliverables via Artifacts819When a worker agent generates a final deliverable meant for human eyes (like a CSV of leads, a drafted blog post, a compiled report, or an analytical summary), you MUST explicitly upload it as an Artifact so it appears in the Human UI.8201. **Generate the File/Text**: The agent completes the actual processing work.8212. **Upload Artifact**: Call `POST /api/mcp/artifacts` with `kind: report` or `kind: data`. Pass the actual content in `contentText` or `storageUrl`. Ensure you link it heavily to the correct `projectId` and `taskId`.8223. **Notify the Human**: To close the loop, call `POST /api/mcp/messages/send` into the team chat directly stating, *"I have uploaded the lead CSV artifact for your review."*823824## 4) Default General-Purpose Agents (Baseline Roster)825826On bootstrap, ensure at least these roles exist. The orchestrator (Viktor) does not claim tasks. The workers below do.827828### 4.1 Orchestrator (Manager)829- name: `Viktor`830- role: `manager`831- purpose: interpret goals, generate projects and tasks, coordinate the workforce, enforce doctrine832- skills: orchestration, planning, delegation, incident management833- concurrency_limit: 1834- **Does not claim tasks. Generates them.**835836### 4.2 Named Specialist Subagents837838These are the registered Emperor Claw agents that map 1:1 to the folders under `agents/`. Each MUST exist as an agent record in Emperor Claw (created or updated on bootstrap).839840| slug | role | concurrencyLimit | Primary domain |841|---|---|---|---|842| `lead-miner` | operator | 3 | ICP lead discovery with dedup discipline |843| `lead-enricher` | analyst | 2 | Lead data enrichment and qualification scoring |844| `copy-personalizer` | builder | 2 | Personalized outreach copy generation |845| `seo-strategist` | analyst | 2 | SEO research, keyword strategy, content planning |846| `qa-governor` | qa | 2 | Output validation, schema compliance, proof review |847| `reply-ops` | operator | 3 | Reply handling, follow-up sequencing, inbox ops |848| `build-engineer` | operator | 2 | Build, deploy, and infrastructure tasks |849| `community-ugc` | builder | 2 | Community content generation and UGC workflows |850| `os-rd` | analyst | 1 | OS and runtime research, architecture experiments |851852### 4.3 Generic Fallback Roles853If none of the named specialists fit a task, th854855…(truncated)