mirror of
https://github.com/TianyiDataScience/openclaw-control-center.git
synced 2026-08-14 00:47:58 +00:00
21 KiB
21 KiB
Mission Control Runbook
1) Safety defaults
- Keep
READONLY_MODE=trueunless explicitly validating live reads. - Keep
LOCAL_TOKEN_AUTH_REQUIRED=trueby default. - Keep
APPROVAL_ACTIONS_ENABLED=falseby default. - Keep
APPROVAL_ACTIONS_DRY_RUN=trueby default. - Keep
IMPORT_MUTATION_ENABLED=falseby default. - Keep
IMPORT_MUTATION_DRY_RUN=falseby default. - Never modify
~/.openclaw/openclaw.jsonfrom this project.
2) Startup
npm run buildnpm testnpm run validatenpm run dev(smoke monitor run)- Optional UI mode:
UI_MODE=true npm run dev
- In restricted sandboxes,
listen EPERMon127.0.0.1:*is environment-only (socket bind restriction), not a control-center functional regression.
- Optional continuous monitor:
npm run dev:continuous
3) Enable live mode safely
- Confirm baseline safety checks:
READONLY_MODE=trueLOCAL_TOKEN_AUTH_REQUIRED=trueAPPROVAL_ACTIONS_ENABLED=falseAPPROVAL_ACTIONS_DRY_RUN=trueIMPORT_MUTATION_ENABLED=falseIMPORT_MUTATION_DRY_RUN=falsenpm run buildpasses
- Enable live reads only (no approval execution):
- Run with
READONLY_MODE=falseand keep:APPROVAL_ACTIONS_ENABLED=falseAPPROVAL_ACTIONS_DRY_RUN=true
- Validate behavior in UI:
GET /snapshotGET /tasksGET /exceptions
- Only if explicitly required, enable approval execution:
READONLY_MODE=falseAPPROVAL_ACTIONS_ENABLED=trueAPPROVAL_ACTIONS_DRY_RUN=false
- After any live test, return to defaults immediately:
READONLY_MODE=trueLOCAL_TOKEN_AUTH_REQUIRED=trueAPPROVAL_ACTIONS_ENABLED=falseAPPROVAL_ACTIONS_DRY_RUN=trueIMPORT_MUTATION_ENABLED=falseIMPORT_MUTATION_DRY_RUN=false
4) Local token auth gate
LOCAL_API_TOKENis the machine-local token you set in.envyourself. Think of it as the shared secret for protected writes on this control-center instance.- Protected operations require local token auth when
LOCAL_TOKEN_AUTH_REQUIRED=true(default):- all state-changing routes (
POST/PATCHAPIs and form ack route) - task heartbeat execution route (
POST /api/tasks/heartbeat) - import/export routes with side effects (
POST /api/import/dry-run,POST /api/import/live,GET /export/state.json,GET /api/export/state.json) - protected command modes (
command:backup-export,command:import-validate,command:acks-prune,command:task-heartbeat)
- all state-changing routes (
- Configure explicit gate token:
LOCAL_API_TOKEN=<strong-random-token>
- Send token from client:
x-local-token: <LOCAL_API_TOKEN>- or
Authorization: Bearer <LOCAL_API_TOKEN>
- If
LOCAL_API_TOKENis unset while gate is enabled:- protected operations are blocked by design.
5) Approval actions (runtime-gated)
- Endpoints (also require local token auth):
POST /api/approvals/:approvalId/approvePOST /api/approvals/:approvalId/reject(requires JSON body{"reason":"..."})
- Gate logic:
- If
APPROVAL_ACTIONS_ENABLED=false: blocked (no execution) - If
APPROVAL_ACTIONS_DRY_RUN=true: simulated (no execution) - If
READONLY_MODE=true: blocked (no execution) - Real execution only when:
APPROVAL_ACTIONS_ENABLED=trueAPPROVAL_ACTIONS_DRY_RUN=falseREADONLY_MODE=false
- If
- All attempts are written to
runtime/approval-actions.logas JSON lines.
6) Project + Task APIs
GET /projects: project list with optional filters:status=planned|active|blocked|doneowner=<owner>projectId=<projectId>
GET /api/projects: compatibility endpoint with same query filters.POST /api/projects: create project inruntime/projects.json.PATCH /api/projects/:projectId: updatetitle,status,owner.GET /tasks: flattened task list with optional filters:status=todo|in_progress|blocked|doneowner=<owner>project=<projectId>
GET /api/tasks: compatibility endpoint with the same query filters.POST /api/tasks: create task inruntime/tasks.json.PATCH /api/tasks/:taskId/status: status transition.GET /api/tasks/heartbeat: recent heartbeat runs fromruntime/task-heartbeat.log.POST /api/tasks/heartbeat: execute assigned-backlog heartbeat pickup (supportsdryRun+maxTasksPerRunoverride).- Mutation endpoints above require local token auth.
- Validation:
- Strong schema checks for required fields, enums, and bounded field lengths.
- Task create/update validates linked
projectIdagainstruntime/projects.json. - Invalid payloads return 4xx with
issues. - Unknown project/task IDs return 404.
Heartbeat backlog automation
- Monitor cycles now include a task heartbeat pass that checks the board for assigned backlog tasks (
status=todo+ assigned owner). - Default gate posture:
TASK_HEARTBEAT_ENABLED=trueTASK_HEARTBEAT_DRY_RUN=trueTASK_HEARTBEAT_MAX_TASKS_PER_RUN=3
- Live promotion (
todo -> in_progress) requires:- heartbeat dry-run disabled (
TASK_HEARTBEAT_DRY_RUN=falseor request body{"dryRun":false}) - local token configured when
LOCAL_TOKEN_AUTH_REQUIRED=true
- heartbeat dry-run disabled (
- Evidence file:
runtime/task-heartbeat.log(JSONL; includes selected/executed counts and gate mode)
7) Commander exceptions + action queue
- Endpoint:
GET /api/commander/exceptions - Summarizes:
- blocked sessions
- errored sessions
- pending approvals
- over-budget evaluations
- tasks due (
dueAt <= now, excludingdone)
- Routed feed endpoint:
GET /exceptions- Levels:
info,warn,action-required - Routes:
timeline,operator-watch,action-queue
- Levels:
- Notification center endpoint:
GET /api/action-queue- Derived from
GET /exceptionsaction-required route entries - Includes acknowledgement state from
runtime/acks.json - Includes
links[]with relevant session/task/project endpoints for operator jump navigation
- Derived from
- Acknowledge endpoint:
POST /api/action-queue/:itemId/ack- Persists/updates local ack entry in
runtime/acks.json - Optional expiry controls:
ttlMinutes(1..10080) orsnoozeUntil(future ISO timestamp) ttlMinutesandsnoozeUntilare mutually exclusive- UI form uses minimal POST to
/action-queue/ack - Requires local token auth
- Persists/updates local ack entry in
8) Session visibility APIs
GET /sessions/GET /api/sessions- Local readonly view combining session list with latest history snippets per session
- Query filters:
state=idle|running|blocked|waiting_approval|erroragentId=<agentId>q=<search>- pagination:
page,pageSize,historyLimit
GET /sessions/:id- Session detail + usage status + recent history entries (
historyLimitoptional)
- Session detail + usage status + recent history entries (
GET /api/sessions/:id- Explicit API alias for session detail JSON
GET /session/:id- UI drill-down page rendering latest messages and tool events per session
- History content is safely truncated for readonly rendering
9) Audit timeline
GET /auditrenders newest-first runtime timeline view with severity filter.GET /api/auditreturns JSON timeline.- Data sources:
runtime/timeline.logruntime/approval-actions.logruntime/operation-audit.log- current snapshot (
runtime/last-snapshot.json)
- Supported severities:
all,info,warn,action-required,error.
10) Graph + export APIs
GET /graph- Returns project-task-session-agent linkage graph JSON (nodes + edges + counts)
GET /export/state.json- Bundles current sessions/tasks/projects/budgets/exceptions into one portable JSON document
- Requires local token auth
- Writes timestamped copies to:
runtime/export-snapshots/*.json(replay/debug index)runtime/exports/*.json(backup/import target bundles)
11) Commander digest
- Every monitor run writes/refreshes the current day digest files:
runtime/digests/YYYY-MM-DD.jsonruntime/digests/YYYY-MM-DD.md
- Digest summarizes sessions, approvals, projects, tasks, budgets, alerts, and top exceptions.
12) Phase 7 operations
- Pixel adapter:
- endpoint:
GET /view/pixel-state.json - source: snapshot + local project/task/session links
- endpoint:
- Notification policy preview:
- config file:
runtime/notification-policy.json - endpoint:
GET /notifications/preview - optional simulation:
GET /notifications/preview?at=<ISO-8601>
- config file:
- Cron overview:
- endpoint:
GET /cron - reports next run + per-job health + monitor lag summary
- endpoint:
- System health:
- endpoint:
GET /healthz - includes build info + snapshot freshness + monitor lag
- endpoint:
- Digest renderer:
- endpoint:
GET /digest/latest - renders latest markdown digest file as HTML
- endpoint:
13) Phase 8 operations
- Operator dashboard polish:
- compact status strip toggle persisted in
runtime/ui-preferences.json - quick filter chips (
all,attention, task states) - home/dashboard query choices auto-persist as default UI preferences
- compact status strip toggle persisted in
- UI preference APIs:
GET /api/ui/preferencesPATCH /api/ui/preferences
- Search APIs (safe substring + bounded limits):
GET /api/search/tasks?q=&limit=GET /api/search/projects?q=&limit=GET /api/search/sessions?q=&limit=GET /api/search/exceptions?q=&limit=
- Replay/debug index API:
GET /api/replay/index?timelineLimit=&digestLimit=&exportLimit=&from=&to=- Data sources:
runtime/timeline.log,runtime/digests/,runtime/export-snapshots/,runtime/exports/ from/toare optional ISO date-time filters for replay artifact windows- response includes per-source replay filter stats (
total,returned,filteredOut,filteredOutByWindow,filteredOutByLimit,latencyMs,latencyBucketsMs(p50,p95),totalSizeBytes,returnedSizeBytes)
- API docs summary endpoint:
GET /api/docs
- Telemetry correlation:
- every response returns
x-request-idheader - JSON responses include
requestId - error logs include requestId for correlation
- every response returns
14) Phase 9 operations
- Final integration checklist endpoint:
GET /done-checklist(alias:GET /api/done-checklist)- combines docs-aligned checks + runtime capability checks
- includes readiness scoring for:
- observability
- governance
- collaboration
- security
- Commander feed polish:
/exceptionsnow returns items sorted by severity first (action-required>warn>info), then newest by event timestamp.
- Backup/export command mode:
npm run command:backup-export- requires
LOCAL_API_TOKENwhenLOCAL_TOKEN_AUTH_REQUIRED=true - writes timestamped bundle under
runtime/exports/*.json
- Import dry-run validator:
- command:
npm run command:import-validate -- runtime/exports/<file>.json - API:
POST /api/import/dry-run - command/API require local token auth when
LOCAL_TOKEN_AUTH_REQUIRED=true - validation is dry-run only; no state mutation.
- command:
- Ack prune command mode:
- command:
npm run command:acks-prune - optional dry-run:
COMMAND_ARG=--dry-run npm run command:acks-prune - command requires local token auth when
LOCAL_TOKEN_AUTH_REQUIRED=true - prunes expired acknowledgement records from
runtime/acks.json
- command:
- Ack prune preview API:
- API:
GET /api/action-queue/acks/prune-preview - requires local token auth when
LOCAL_TOKEN_AUTH_REQUIRED=true - returns
before/removed/aftercounts only (no write)
- API:
- Optional live import mutation endpoint:
- API:
POST /api/import/live - HIGH RISK and disabled by default (
IMPORT_MUTATION_ENABLED=false) - requires local token auth and
READONLY_MODE=falsefor live apply dryRun=trueforces non-mutating validation path on this endpoint
- API:
- Operation audit:
- import dry-run + import apply + backup export + ack prune actions are appended to
runtime/operation-audit.log.
- import dry-run + import apply + backup export + ack prune actions are appended to
15) UX v2 operator navigation
- Home dashboard now uses section tabs via
/?section=<tab>with six supported values:overviewoffice-spaceprojects-tasksalertsreplay-auditsettings
- Layout intent:
- left rail: major section navigation
- center panel: section content
- right rail: office context + quick shortcuts
- Office-space behavior:
- auto-derives agent roster from sessions, task owners, project owners, and agent budget entries
- maps each agent to a deterministic animal identity from name semantics
- reports zone + workload summary ("busy on what") per agent
- Empty states:
- user-facing empty blocks should render as
Not activated yet - avoid exposing raw zero-heavy debug values when no actionable signal exists
- user-facing empty blocks should render as
16) Usage and cost observability (Phase 22)
- New route surfaces:
GET /usage-cost(redirects to/?section=usage-cost)GET /api/usage-cost(JSON snapshot)
- Dashboard placement:
- card-level pulse on
Overview - dedicated
Usage & Costsection in left sidebar navigation - right-rail usage summary card
- card-level pulse on
- Usage adapter sources:
- live snapshot status data (
sessions + session_status) - OpenClaw session runtime stores (
~/.openclaw/agents/*/sessions/sessions.json+*.jsonl) for real request/tokens/cost windows (today/7d/30d) and per-source breakdown - digest history (
runtime/digests/*.json) as fallback trend source when runtime request events are unavailable - optional model context catalog (
runtime/model-context-catalog.json) for context-window percentages
- live snapshot status data (
- Disconnected metrics policy:
- if source is missing, render
Data source not connected(do not fabricate zero values) - if runtime source is connected but usage is truly zero, render zero values (not placeholders)
- context-window limits prefer live session context metadata and fallback to model catalog only when needed
- if source is missing, render
- Settings connector checklist:
- model context catalog
- digest history continuity (fallback)
- runtime request/event source
- cost budget limit source
- provider attribution refinement
19) Mission Control v3 operations (Phase 25)
- Navigation and IA (UI sections):
overview-> Command Deckusage-cost-> Usage & Billingoffice-space-> Pixel Officeprojects-tasks-> Work Boardalerts-> Decisionsreplay-audit-> Timelinesettings-> Control Room
- Mac parity surfaces panel:
- shown in Command Deck with per-surface status + route links
- covers sessions, approvals, cron, projects/tasks, usage/cost, replay/audit, health/digest, export/import safety, and pixel adapter
- Full office roster behavior:
- best-effort config source:
~/.openclaw/openclaw.json(read-only) - adapter module:
src/runtime/agent-roster.ts - fallback keeps known agents visible even when no active runtime sessions exist
- best-effort config source:
- Subscription usage/remaining behavior:
- adapter module:
src/runtime/usage-cost.ts - source probes (best effort):
runtime/subscription-snapshot.json~/.openclaw/subscription.json~/.openclaw/billing/subscription.json~/.openclaw/billing/usage.json~/.openclaw/usage/subscription.json
- contract states:
connected: consumed/remaining/limit/cycle shownpartial: file detected but fields incompletenot_connected: explicit connect hint shown (no fake zeros)
- adapter module:
17) Runtime artifacts
runtime/last-snapshot.json: latest read model snapshot.runtime/timeline.log: monitor run deltas.runtime/projects.json: local project store.runtime/tasks.json: local task store.runtime/budgets.json: budget policy defaults and per-scope overrides.runtime/notification-policy.json: notification quiet-hours + severity-route policy.runtime/model-context-catalog.json: optional model context-window map (match/contextWindowTokens/provider) for context-usage percentages.runtime/ui-preferences.json: dashboard preference state (compactStatusStrip,quickFilter,taskFilters).runtime/acks.json: notification action-queue acknowledgements.runtime/approval-actions.log: audit trail for approval action attempts.runtime/operation-audit.log: audit trail for import dry-run, import apply, backup export, and ack prune actions.runtime/digests/: daily commander digest JSON + Markdown.runtime/export-snapshots/: timestamped state export snapshots for replay/debug.runtime/exports/: timestamped export bundles for backup + import validation.
18) Rollback steps
- Restore safe runtime mode:
READONLY_MODE=trueLOCAL_TOKEN_AUTH_REQUIRED=trueAPPROVAL_ACTIONS_ENABLED=falseAPPROVAL_ACTIONS_DRY_RUN=true
- Revert only
control-center/code changes (git revert or selective checkout from known-good commit). - Rebuild and smoke test:
npm run buildnpm run dev
- Verify rollback signals:
/projectsand/api/projectsreturn expected payloads/tasksand/api/tasksreturn expected payloads/api/action-queuereturns valid JSON and ack state/exceptionsand/api/commander/exceptionsreturn valid JSON/view/pixel-state.jsonreturns valid adapter JSON/notifications/previewreturns policy evaluation JSON/cronand/healthzreturn health payloads/digest/latestrenders latest digest page/api/docsreturns route/schema summary/api/replay/indexreturns timeline/digest/export index/api/search/*endpoints return bounded matches- UI project board/task board/action queue sections match expected view
- If budget behavior regressed, restore
runtime/budgets.jsonto the last known-good content. - If notification routing behavior regressed, restore
runtime/notification-policy.jsonto last known-good.
19) Troubleshooting
- Build failures:
- Run
npm run buildand fix TypeScript errors first.
- Run
- Validation failures:
- Run
npm run validateand inspect failing assertions.
- Run
- Empty dashboard:
- Confirm
runtime/last-snapshot.jsonexists (created bynpm run dev).
- Confirm
- Health endpoint stale:
- confirm monitor wrote a fresh line in
runtime/timeline.log - rerun
npm run devto regenerate snapshot and timeline tick
- confirm monitor wrote a fresh line in
- UI mode bind fails with
listen EPERM:- classify as environment-only in restricted sandboxes where localhost bind is blocked
- re-run
UI_MODE=true npm run devin unrestricted host runtime for bind +/healthzverification
20) Operational Checklist (Phase 22)
- Safety gates unchanged:
READONLY_MODE=trueLOCAL_TOKEN_AUTH_REQUIRED=trueAPPROVAL_ACTIONS_ENABLED=falseAPPROVAL_ACTIONS_DRY_RUN=trueIMPORT_MUTATION_ENABLED=falseIMPORT_MUTATION_DRY_RUN=falseLOCAL_API_TOKENset explicitly for protected operations.
runtime/notification-policy.jsonexists and is valid JSON.runtime/ui-preferences.jsonexists and is valid JSON.GET /view/pixel-state.jsonreturnsrooms/entities/links.GET /notifications/previewreturns quiet-hours + route preview.GET /cronreturns next-run and health summary.GET /healthzreturns build/snapshot/monitor status fields.GET /digest/latestrenders latest digest markdown.GET /api/ui/preferences+PATCH /api/ui/preferenceswork and persist.GET /api/search/tasks|projects|sessions|exceptionssupportq+ boundedlimit.- Home dashboard search panel is visible and returns scoped results for
tasks|projects|sessions|exceptions. GET /api/replay/indexincludes timeline, digests, export snapshots, and export bundles.GET /api/replay/index?from=&to=applies optional ISO time-window filtering.GET /api/replay/indexincludes replaystatswithtotal/returned/filteredOut(+ window/limit breakdown) and per-source latency/size indicators.- Home dashboard replay/export visibility panel shows counts + latest snapshot/bundle labels.
- Home dashboard shows section navigation for:
- Overview, Usage & Cost, Office Space, Projects/Tasks, Alerts, Replay/Audit, Settings.
- Office Space section renders per-agent cards with:
- semantic animal identity
- status label
- zone placement
- "busy on what" summary.
- Empty lists/cards use
Not activated yetoperator copy (instead of rawnoneplaceholders). GET /api/usage-costreturns:- periods (
today/7d/30d) - context windows
- breakdown by agent/project/model/provider
- budget burn-rate status
- connector TODO list.
- periods (
runtime/model-context-catalog.jsonexists or Settings TODO explicitly shows the missing connector.- Usage & Cost section displays disconnected metrics as
Data source not connectedinstead of fake zeros. GET /api/docsreturns route/schema summary.- Home import/safety guard table shows explicit disabled/enabled badges.
- Guard/checklist doc refs are clickable and resolve via
/docs/*. GET /docsrenders local docs index.GET /docs/runbook|architecture|progress|readmereturn markdown content.GET /done-checklistreturns checklist + readiness scores.POST /api/import/dry-runvalidates bundles with no mutation.POST /api/import/livestays blocked unless explicit env gate + token are enabled.POST /api/action-queue/:itemId/acksupports optionalttlMinutes/snoozeUntiland expired acks re-open queue items.GET /api/action-queue/acks/prune-previewreturns token-gated stale-ack prune counts with no mutation.npm run command:backup-exportwrites a bundle toruntime/exports/.npm run command:acks-pruneremoves expired entries fromruntime/acks.json(or reports no-op in dry-run).- import dry-run + import apply + backup export + ack prune actions write entries in
runtime/operation-audit.log. - responses include
x-request-idand JSONrequestId. npm testpasses.npm run buildpasses.npm run devsmoke passes.