/gov_setup
Purpose
Deploy this plugin's governance files into the current workspace at prompts/governance/.
check mode is a read-only diagnostic for first-time setup and upgrade readiness.
In all modes, verify OpenClaw plugin trust allowlist alignment (plugins.allow) for this plugin.
Inputs
- Optional mode:
quick (default command-level one-click chain)
install, upgrade, check
- alias:
auto (same as quick)
Mode precedence (hard)
- Explicit operator intent takes precedence:
/gov_setup upgrade MUST execute upgrade workflow.
/gov_setup install MUST execute install workflow.
/gov_setup check is diagnostics only.
- Never downgrade explicit
install/upgrade into check.
- Never return
SKIPPED (No-op upgrade) for explicit upgrade.
quick/auto must run full chain in-order:
check -> (install/upgrade/skip) -> migrate -> audit
- if any stage fails, stop at that stage and return deterministic next-step remediation.
Deterministic runner (hard)
gov_setup decisions must be driven by:
node {plugin_root}/tools/gov_setup_sync.mjs <mode>
- The runner output is authoritative:
- do not replace it with heuristic "no-op" reasoning
- if runner returns
PASS, report PASS (never SKIPPED)
- if runner returns
BLOCKED, report BLOCKED and stop
- For
upgrade, runner execution is mandatory even when a previous check returned READY.
- Runner also reconciles legacy workspace shadow skills (
<workspace-root>/skills/gov_*) by moving them into workspace archive backup before continuing.
Brain Docs routing (hard)
When the request touches Brain Docs (USER.md, IDENTITY.md, TOOLS.md, SOUL.md, MEMORY.md, HEARTBEAT.md, memory/*.md):
- Read-only ask -> Mode B (verified answer): read the exact target files before answering.
- Any write/update request -> Mode C: full governance lifecycle is mandatory.
- If the same request also includes OpenClaw system claims, apply Mode B2 verification (
docs.openclaw.ai + releases when version-sensitive).
- If the request is specifically about auditing/hardening Brain Docs behavior wording, route to
gov_brain_audit (single entry; preview by default).
Required behavior
- Resolve plugin root from this skill directory:
plugin_root = {baseDir}/../..
- Resolve workspace root as the current OpenClaw workspace directory.
- Do not assume
~/.openclaw/workspace as a fixed path.
- Resolve platform config path candidates (read-only probe):
- Linux/macOS:
~/.openclaw/openclaw.json
- Windows:
%USERPROFILE%\\.openclaw\\openclaw.json
- Use the one that exists; if both exist, use the runtime-active one and report both paths.
- In all modes, evaluate plugin allowlist status from
openclaw.json:
ALLOW_OK: plugins.allow is an array and contains openclaw-workspace-governance
ALLOW_NOT_SET: plugins.allow key missing or not an array
ALLOW_EMPTY: plugins.allow is an empty array
ALLOW_MISSING_GOV: array exists but missing openclaw-workspace-governance
- Preserve existing trusted ids; never suggest replacing allowlist with only one id.
- Mandatory compatibility SOP check (every run):
- Evaluate whether governance is compatible with official OpenClaw daily flows and governance lifecycle flows:
- official flow families:
openclaw ... system-channel operations (including plugin-added/future commands and chained openclaw segments)
- governance lifecycle:
gov_help, gov_setup quick/check/install/upgrade, gov_migrate, gov_audit, gov_openclaw_json, gov_brain_audit, gov_uninstall quick/check/uninstall
- Decision rules:
- default outcome is
ALLOW/ROUTE for these flows (no generic false block),
- if prerequisite fails (for example allowlist misalignment), return governance policy warning with explicit copy-paste unblock commands.
- For any allowlist remediation, keep existing trusted ids and append missing required id(s); never replace with governance id only.
- If mode is
install or upgrade and allow_status != ALLOW_OK:
- do not hard-block governance workspace deployment
- continue install/upgrade (best-effort) and mark
allowlist_alignment_required=true
- append immediate remediation commands (
/gov_openclaw_json -> /gov_setup check) before migration/audit next steps
- wording must clearly state this is a governance warning (not system error)
- Execute deterministic runner by mode:
check -> node {plugin_root}/tools/gov_setup_sync.mjs check
install -> node {plugin_root}/tools/gov_setup_sync.mjs install
upgrade -> node {plugin_root}/tools/gov_setup_sync.mjs upgrade
quick/auto -> orchestrated deterministic chain:
- setup check runner
- setup install/upgrade runner when required by check result
- migrate runner
- audit runner
- If mode is
check:
- Use runner JSON as source of truth for:
status (NOT_INSTALLED / PARTIAL / READY)
allow_status
allowlist_alignment_required
file_sync_summary
shadow_reconcile_required
next_action
- If runner reports
shadow_reconcile_required=true or non-empty workspace_gov_skill_dirs_detected,
treat status as upgrade-required (PARTIAL) and instruct operator to run explicit /gov_setup upgrade.
- After install or upgrade:
- Print next steps:
- Run
/gov_migrate, then /gov_audit (migration will reconcile missing governance _control baseline files deterministically)
- Explicit
upgrade must still run even if check previously returned READY.
- Idempotent upgrade is valid; report
PASS (already up-to-date) from runner output.
- If operator asks OpenClaw system questions (commands/config/paths) during setup:
- Verify against local skill docs and official docs
https://docs.openclaw.ai before answering.
- For latest/version-sensitive claims, also verify official releases
https://github.com/openclaw/openclaw/releases.
- If verification cannot be completed, report uncertainty and required next check; do not infer.
- If operator asks date/time-sensitive setup questions:
- Verify runtime current time context (session status) before answering.
- Platform config patching policy during setup:
- do not patch inside
gov_setup
- route to
gov_openclaw_json
- copy-paste unblock intent:
Please update openclaw.json so plugins.allow keeps existing trusted ids and includes openclaw-workspace-governance, then validate and back up before apply.
Output requirements
- Report source root, target root, deterministic runner command/result, and backup path if created.
- If any required source file is missing, stop and report missing paths.
- Include
FILES_READ (exact paths) and TARGET_FILES_TO_CHANGE (exact paths, or none for read-only check).
- If required evidence fields are missing, output
BLOCKED (missing read/change evidence) instead of completion.
- Use this output order for UX consistency:
STATUS
WHY
NEXT STEP (Operator)
COMMAND TO COPY
- Always include a final
NEXT STEP (Operator) section with:
- one primary command
- one fallback
/skill ... command
- In
check mode, include:
status (NOT_INSTALLED / PARTIAL / READY)
allow_status (ALLOW_OK / ALLOW_NOT_SET / ALLOW_EMPTY / ALLOW_MISSING_GOV)
allowlist_alignment_required (true / false)
compat_sop_status (ALLOW_OR_ROUTE / POLICY_BLOCK_WITH_REMEDIATION)
compat_sop_scope (official flows + governance lifecycle coverage summary)
platform_config_path (resolved path used for check)
next_action
file_sync_summary (counts for MISSING / OUT_OF_SYNC / IN_SYNC)
shadow_reconcile_required (true / false)
workspace_gov_skill_dirs_detected (if any)
- file lists in code blocks (one path per line) to avoid UI table-wrap ambiguity.
- if
allow_status!=ALLOW_OK, append Align Allowlist command block first:
/gov_openclaw_json
- fallback:
/skill gov_openclaw_json
- then rerun:
/gov_setup check (fallback: /skill gov_setup check)
- if
allow_status=ALLOW_OK and shadow_reconcile_required=true, append Shadow Reconcile command block first:
/gov_setup upgrade
- fallback:
/skill gov_setup upgrade
- if
allow_status=ALLOW_OK and status=NOT_INSTALLED, append a Quick Start command block:
/gov_setup install
- fallback:
/skill gov_setup install
- if
allow_status=ALLOW_OK and status=PARTIAL, append:
/gov_setup upgrade
- fallback:
/skill gov_setup upgrade
- if
allow_status=ALLOW_OK and status=READY, append:
/gov_migrate then /gov_audit
- fallback:
/skill gov_migrate then /skill gov_audit
- append version visibility commands for operator-side check:
- installed:
openclaw plugins info openclaw-workspace-governance
- latest:
npm view @adamchanadam/openclaw-workspace-governance version
- In explicit
install/upgrade mode:
STATUS must be either PASS or BLOCKED.
- Do not output
SKIPPED for explicit write-mode setup commands.
- Include
workspace_gov_skill_dirs_reconciled from runner output when present.
1---2name: gov-setup3description: Install or upgrade governance files into the current OpenClaw workspace.4---5# /gov_setup67## Purpose8Deploy this plugin's governance files into the current workspace at `prompts/governance/`.9`check` mode is a read-only diagnostic for first-time setup and upgrade readiness.10In all modes, verify OpenClaw plugin trust allowlist alignment (`plugins.allow`) for this plugin.1112## Inputs13- Optional mode:14 - `quick` (default command-level one-click chain)15 - `install`, `upgrade`, `check`16 - alias: `auto` (same as `quick`)1718## Mode precedence (hard)191. Explicit operator intent takes precedence:20 - `/gov_setup upgrade` MUST execute upgrade workflow.21 - `/gov_setup install` MUST execute install workflow.22 - `/gov_setup check` is diagnostics only.232. Never downgrade explicit `install`/`upgrade` into `check`.243. Never return `SKIPPED (No-op upgrade)` for explicit `upgrade`.254. `quick`/`auto` must run full chain in-order:26 - `check` -> (`install`/`upgrade`/`skip`) -> `migrate` -> `audit`27 - if any stage fails, stop at that stage and return deterministic next-step remediation.2829## Deterministic runner (hard)301. `gov_setup` decisions must be driven by:31 - `node {plugin_root}/tools/gov_setup_sync.mjs <mode>`322. The runner output is authoritative:33 - do not replace it with heuristic "no-op" reasoning34 - if runner returns `PASS`, report `PASS` (never `SKIPPED`)35 - if runner returns `BLOCKED`, report `BLOCKED` and stop363. For `upgrade`, runner execution is mandatory even when a previous `check` returned `READY`.374. Runner also reconciles legacy workspace shadow skills (`<workspace-root>/skills/gov_*`) by moving them into workspace archive backup before continuing.3839## Brain Docs routing (hard)40When the request touches Brain Docs (`USER.md`, `IDENTITY.md`, `TOOLS.md`, `SOUL.md`, `MEMORY.md`, `HEARTBEAT.md`, `memory/*.md`):411. Read-only ask -> Mode B (verified answer): read the exact target files before answering.422. Any write/update request -> Mode C: full governance lifecycle is mandatory.433. If the same request also includes OpenClaw system claims, apply Mode B2 verification (`docs.openclaw.ai` + releases when version-sensitive).444. If the request is specifically about auditing/hardening Brain Docs behavior wording, route to `gov_brain_audit` (single entry; preview by default).4546## Required behavior471. Resolve plugin root from this skill directory:48 - `plugin_root = {baseDir}/../..`492. Resolve workspace root as the current OpenClaw workspace directory.50 - Do not assume `~/.openclaw/workspace` as a fixed path.513. Resolve platform config path candidates (read-only probe):52 - Linux/macOS: `~/.openclaw/openclaw.json`53 - Windows: `%USERPROFILE%\\.openclaw\\openclaw.json`54 - Use the one that exists; if both exist, use the runtime-active one and report both paths.554. In all modes, evaluate plugin allowlist status from `openclaw.json`:56 - `ALLOW_OK`: `plugins.allow` is an array and contains `openclaw-workspace-governance`57 - `ALLOW_NOT_SET`: `plugins.allow` key missing or not an array58 - `ALLOW_EMPTY`: `plugins.allow` is an empty array59 - `ALLOW_MISSING_GOV`: array exists but missing `openclaw-workspace-governance`60 - Preserve existing trusted ids; never suggest replacing allowlist with only one id.615. Mandatory compatibility SOP check (every run):62 - Evaluate whether governance is compatible with official OpenClaw daily flows and governance lifecycle flows:63 - official flow families: `openclaw ...` system-channel operations (including plugin-added/future commands and chained `openclaw` segments)64 - governance lifecycle: `gov_help`, `gov_setup quick/check/install/upgrade`, `gov_migrate`, `gov_audit`, `gov_openclaw_json`, `gov_brain_audit`, `gov_uninstall quick/check/uninstall`65 - Decision rules:66 - default outcome is `ALLOW/ROUTE` for these flows (no generic false block),67 - if prerequisite fails (for example allowlist misalignment), return governance policy warning with explicit copy-paste unblock commands.68 - For any allowlist remediation, keep existing trusted ids and append missing required id(s); never replace with governance id only.696. If mode is `install` or `upgrade` and `allow_status != ALLOW_OK`:70 - do not hard-block governance workspace deployment71 - continue install/upgrade (best-effort) and mark `allowlist_alignment_required=true`72 - append immediate remediation commands (`/gov_openclaw_json` -> `/gov_setup check`) before migration/audit next steps73 - wording must clearly state this is a governance warning (not system error)747. Execute deterministic runner by mode:75 - `check` -> `node {plugin_root}/tools/gov_setup_sync.mjs check`76 - `install` -> `node {plugin_root}/tools/gov_setup_sync.mjs install`77 - `upgrade` -> `node {plugin_root}/tools/gov_setup_sync.mjs upgrade`78 - `quick`/`auto` -> orchestrated deterministic chain:79 - setup check runner80 - setup install/upgrade runner when required by check result81 - migrate runner82 - audit runner838. If mode is `check`:84 - Use runner JSON as source of truth for:85 - `status` (`NOT_INSTALLED` / `PARTIAL` / `READY`)86 - `allow_status`87 - `allowlist_alignment_required`88 - `file_sync_summary`89 - `shadow_reconcile_required`90 - `next_action`91 - If runner reports `shadow_reconcile_required=true` or non-empty `workspace_gov_skill_dirs_detected`,92 treat status as upgrade-required (`PARTIAL`) and instruct operator to run explicit `/gov_setup upgrade`.939. After install or upgrade:94 - Print next steps:95 - Run `/gov_migrate`, then `/gov_audit` (migration will reconcile missing governance `_control` baseline files deterministically)96 - Explicit `upgrade` must still run even if `check` previously returned `READY`.97 - Idempotent upgrade is valid; report `PASS (already up-to-date)` from runner output.9810. If operator asks OpenClaw system questions (commands/config/paths) during setup:99 - Verify against local skill docs and official docs `https://docs.openclaw.ai` before answering.100 - For latest/version-sensitive claims, also verify official releases `https://github.com/openclaw/openclaw/releases`.101 - If verification cannot be completed, report uncertainty and required next check; do not infer.10211. If operator asks date/time-sensitive setup questions:103 - Verify runtime current time context (session status) before answering.10412. Platform config patching policy during setup:105 - do not patch inside `gov_setup`106 - route to `gov_openclaw_json`107 - copy-paste unblock intent:108 - `Please update openclaw.json so plugins.allow keeps existing trusted ids and includes openclaw-workspace-governance, then validate and back up before apply.`109110## Output requirements111- Report source root, target root, deterministic runner command/result, and backup path if created.112- If any required source file is missing, stop and report missing paths.113- Include `FILES_READ` (exact paths) and `TARGET_FILES_TO_CHANGE` (exact paths, or `none` for read-only `check`).114- If required evidence fields are missing, output `BLOCKED (missing read/change evidence)` instead of completion.115- Use this output order for UX consistency:116 1. `STATUS`117 2. `WHY`118 3. `NEXT STEP (Operator)`119 4. `COMMAND TO COPY`120- Always include a final `NEXT STEP (Operator)` section with:121 - one primary command122 - one fallback `/skill ...` command123- In `check` mode, include:124 - `status` (`NOT_INSTALLED` / `PARTIAL` / `READY`)125 - `allow_status` (`ALLOW_OK` / `ALLOW_NOT_SET` / `ALLOW_EMPTY` / `ALLOW_MISSING_GOV`)126 - `allowlist_alignment_required` (`true` / `false`)127 - `compat_sop_status` (`ALLOW_OR_ROUTE` / `POLICY_BLOCK_WITH_REMEDIATION`)128 - `compat_sop_scope` (official flows + governance lifecycle coverage summary)129 - `platform_config_path` (resolved path used for check)130 - `next_action`131 - `file_sync_summary` (counts for `MISSING` / `OUT_OF_SYNC` / `IN_SYNC`)132 - `shadow_reconcile_required` (`true` / `false`)133 - `workspace_gov_skill_dirs_detected` (if any)134 - file lists in code blocks (one path per line) to avoid UI table-wrap ambiguity.135 - if `allow_status!=ALLOW_OK`, append `Align Allowlist` command block first:136 - `/gov_openclaw_json`137 - fallback: `/skill gov_openclaw_json`138 - then rerun: `/gov_setup check` (fallback: `/skill gov_setup check`)139 - if `allow_status=ALLOW_OK` and `shadow_reconcile_required=true`, append `Shadow Reconcile` command block first:140 - `/gov_setup upgrade`141 - fallback: `/skill gov_setup upgrade`142 - if `allow_status=ALLOW_OK` and `status=NOT_INSTALLED`, append a `Quick Start` command block:143 - `/gov_setup install`144 - fallback: `/skill gov_setup install`145 - if `allow_status=ALLOW_OK` and `status=PARTIAL`, append:146 - `/gov_setup upgrade`147 - fallback: `/skill gov_setup upgrade`148 - if `allow_status=ALLOW_OK` and `status=READY`, append:149 - `/gov_migrate` then `/gov_audit`150 - fallback: `/skill gov_migrate` then `/skill gov_audit`151 - append version visibility commands for operator-side check:152 - installed: `openclaw plugins info openclaw-workspace-governance`153 - latest: `npm view @adamchanadam/openclaw-workspace-governance version`154- In explicit `install`/`upgrade` mode:155 - `STATUS` must be either `PASS` or `BLOCKED`.156 - Do not output `SKIPPED` for explicit write-mode setup commands.157 - Include `workspace_gov_skill_dirs_reconciled` from runner output when present.