Use WinApp CLI first for native Windows work. Before inventing tooling or declaring native inspection impossible, run
winapp --versionandwinapp --cli-schema, then use its UI automation, crash/debug triage, WinUI DevTools, performance recording, API/UI sample discovery and Sandbox runs. Read Use WinApp CLI proactively for limits and runtime authority, and the WinApp guide for recipes.
Read-only requests stay read-only. Permission to implement does not grant permission to commit, push, publish, change GitHub metadata, or alter shared runtimes. Preserve unrelated work and use the current task-owned worktree.
Start with the reported behavior, its production owner, and the existing tests. Use the task routes below rather than reading every background document. Delegate independent work only when it benefits from separate context; keep one writer per worktree and give each task a bounded objective and evidence requirement. A tool's successful exit is not proof that the intended work ran.
Before generating or changing networking, IPC, or cross-process handoff code, use network-handoff, including for retries, deadlines, reconnect, configuration apply, process launch, cancellation, and cleanup. This is mandatory alongside the affected owner's route below, not only for setup or a reported failure. Trace the existing producer contract and installed-version support before adding consumer behavior. Missing producer guarantees require an evidenced upstream proposal, not a local workaround.
Do not create or maintain checked-in CI-failure or unresolved-issue backlogs. Investigate failures, fix their causes, and validate the repairs. Keep temporary tracking in session tooling, not repository files. Report genuine blockers directly; documenting a failure or deleting its record does not resolve it.
| Task | Entry point |
|---|---|
| Generate, change, or review networking, IPC, or handoff behavior | Network and handoff contracts, then the affected owner's guide |
| Write, review, or restructure documentation/instructions | Docs instructions and technical-documentation |
| Write or review a regression test | Test authoring and test-audit |
| Select tests and required proof | Windows testing; use the proof skill for runtime evidence |
| Simplify your own completed change before PR preparation | PR simplification; preserve distinct Windows contracts and reprove the reduced diff |
| Prepare a local PR body and readiness handoff | Windows PR preparation; publication needs separate authority |
| Retrigger CI on a PR with failing checks | retrigger-flaky-ci; rerun only failures unrelated to the PR's changes, otherwise warn |
| Change a WinUI owner or its caller | WinUI instructions and the affected architecture ledger rows |
Debug Companion, setup, Gateway connection, node capabilities, packaging, or system.run |
Windows debugging |
| Use Windows developer tooling for UI, crashes, performance, API discovery, or disposable app runs | WinApp CLI guide: check the installed version/help/schema and use the relevant capability before inventing tooling |
| Choose a clean-machine or warm Sandbox test | WinApp versus sandbox-mcp: use our Sandbox MCP/sbx tooling for dependency/installer audits, WinApp for its package-aware developer loop |
| Drive the app through local MCP | windows-app-mcp; use winnode for the shipped command contract |
| Review code | Shared autoreview; use Hanselman review when adversarial review is requested |
| Run remote native Windows proof | Crabbox, with explicit host/provider authority |
| Test against a source-built native Gateway | native-gateway-from-source |
| Uninstall or clean for a retest | uninstall, with target inventory and destructive confirmation |
| Audit the whole issue/PR landscape | global-repo-triage; do not expand a single-item request into a sweep |
Use agent readiness and workflow checks when changing
this guidance. These are coding-agent instructions, not the product's
end-user Gateway workspace AGENTS.md templates.
Windows developers and coding agents should use WinApp CLI as a first-choice
development and diagnostic tool, not only an optional packaging launcher.
For Windows UI/debugging/testing work, check Get-Command winapp, winapp --version
and the relevant --help; use winapp --cli-schema for exact machine-readable
options. The WinApp guide maps find-api/find-ui, UIA,
crash triage, DevTools, performance recording and Sandbox to our actual workflows.
Prefer these capabilities over guessed APIs, ad hoc automation or unsupported
claims that native inspection is unavailable. Report a missing tool or unsupported
boundary explicitly; install/update only with authority.
Keep build.ps1, existing test harnesses and repository packaging authoritative.
Select a task-owned process/profile and obtain runtime authority before launching,
injecting DevTools, registering packages, recording or preparing Sandbox. Honor
the host's computer-use rules. WinApp Sandbox is not MXC/WSL/Gateway proof, and
--unique-identity is not compatible with Companion's protocol-bearing manifest.
Use sandbox-mcp / sbx for fresh
artifact checks, explicit network-off runs and installer/uninstaller differences.
Do not hide missing runtimes with WinApp's automatic guest provisioning.
Both tools share one Windows Sandbox slot: select one lifecycle owner, inspect
existing state, and never adopt or stop another task's guest without authority.
For Gateway MSIX packaging, use openclaw-windows-packaging.
All agents working in this repository must run validation after each code change before marking work complete.
Required steps:
- Run full repo build:
./build.ps1
- Run shared tests:
dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
- Run tray tests:
dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore
This is the required local closeout subset for agents. CI also builds and runs additional connection, setup, CLI, UI, accessibility, integration, and E2E suites; see docs/TEST_COVERAGE.md for the broader test inventory and .github/workflows/ci.yml for the workflow source of truth.
If a command fails:
- Fix the issue.
- Re-run the failed command.
- Re-run all required validation commands before completion.
Notes:
- Build from a real Git checkout or linked worktree with full history. GitVersion
requires repository metadata even when a test command builds product projects.
Build workflows must use
fetch-depth: 0; a source-only guest sync is not a build-ready checkout. For guest builds, prepare a full-history clone at the intended revision before overlaying task-owned source changes. See #896 (Preflight GitVersion repository history before build). - Keep focused-test and suite results as separate receipts, qualified by head, command/filter, execution host, and pass/fail/skip counts. An isolated pass does not clear a failure in the containing suite or shard. Investigate shared-state or ordering effects in the failing batch, rerun the affected suite or shard, and preserve the original failure alongside later results. If the required lane remains unverified, report that gap rather than calling it green. For a recorded Tray suite failure with an isolated pass, see #2183 (test(ui): prove search focus and keep the reconnect failure receipts).
- If a build/test is blocked by a file lock, stop only a verified task-owned process and rerun. Do not stop another session's app or service; report that lock as a blocker.
- For missing local Windows prerequisites, start with
.\scripts\setup-dev.ps1 -CheckOnly. Install with.\scripts\setup-dev.ps1only when authorized, then rerun validation.-AgentReadinessseparately reports optional agent tooling and unverified runtime-proof capabilities without installing or authenticating. - First-run gotcha:
dotnet test --no-restoresilently no-ops in a fresh worktree where the testbin/doesn't exist yet (reports "Build succeeded in 0.5s" then exits 0 with no tests run). For first-run validation, either omit--no-restoreOR rundotnet buildon the test project first. Subsequent reruns honor--no-restorecorrectly. - In linked git worktrees, set
OPENCLAW_REPO_ROOTto the worktree path before running tests that discover the repository root, for example:$env:OPENCLAW_REPO_ROOT='D:\github\openclaw-windows-node.<worktree-name>'
- Tray tests must isolate
SettingsManagerfrom real user settings. Do not usenew SettingsManager()in tests unless the test intentionally reads%APPDATA%\OpenClawTray\settings.json; pass a temp settings directory or setOPENCLAW_TRAY_DATA_DIRbefore the test process starts. - Prefer isolated worktrees for PR validation. Use
git-wtfor worktree workflows;wt.exemay resolve to WorkTrunk instead of Windows Terminal, so use the full Windows Terminal path when explicitly launching Terminal. - Do not claim completion without reporting validation results.
- For opening a PR, create a feature branch in a personal fork first, then open a PR against main.
Apply these metadata updates only when authorized to update the named issue or PR. Local implementation or a read-only review does not itself grant that authority.
- Apply the
status: 🚢 actively landinglabel when a maintainer or delegated agent takes active ownership of an issue or pull request through implementation, conflict resolution, validation, or merge. - Apply the label only to work that is actively moving. Do not use it for queued, parked, or indefinitely blocked items.
- Remove the label when active work pauses, ownership returns to the author, or the item closes or merges.
- This maintainer-ownership label may coexist with contributor-facing status labels such as
status: 📣 needs proof. - When referring to a pull request, include its title in parentheses after the number, for example
#1312 (improve(setup): install latest stable Gateway from npm).
Run the required validation above for every code change, then add the targeted path that matches the touched subsystem.
When changing MXC sandboxing, system.run, exec approvals, Windows node command execution, gateway setup/connect E2E behavior, or files under src\OpenClaw.Shared\Mxc, run:
.\scripts\validate-mxc-e2e.ps1The script sets OPENCLAW_RUN_E2E and OPENCLAW_RUN_MXC_E2E itself, then runs the real WSL Gateway -> Windows node -> system.run MXC E2E proofs. It fails if the MXC proof skips. Use -AllowSkip only to document that the current host is not MXC-capable; do not report an -AllowSkip run as merge validation for MXC-related work.
- Keep methods focused and reduce nested control flow when it improves readability.
- Prefer existing repository patterns and simple, idiomatic C# over speculative abstractions.
- Document non-obvious ownership, invariants, and public usage. Avoid boilerplate comments that only repeat the code.
- Avoid random literal hardcoded timeouts. Prefer using an explicit constant which can be overriden with an environment variable.
- Use module level constants for repeated literal values. When they are used across modules, centralize the constant in a constants file.
- When creating new modules, add a file header comment explaining what the module does, and provide an intended usage example of the main public functions. Make sure to document the primary type or class in the file and the main public methods expected to be called from other modules.
Use the proof skill when a change touches tray UX, Settings, onboarding, chat/canvas, Command Center, Windows node capabilities, MCP, gateway connection/pairing, permissions, diagnostics, or agent-facing instructions. Match evidence to the changed contract; ordinary documentation changes do not require launching the app.
Keep client presentation and Gateway data ownership distinct:
- Before adding copy, find its existing owner and localization resources. Client-owned presentation belongs in native
.reswresources; shared wording alone does not require a Gateway contract. - For cross-client copy that should track the installed Gateway, prefer an existing supported data contract. When a catalog is justified, generate it from the owner's translation sources at build time, package it with that owner, and serve validated, versioned data through the authenticated connection. Do not generate translations at launch or fetch repository sources at runtime.
- Load shared catalogs asynchronously and cache them at the appropriate connection/package lifetime. Define locale fallback, unsupported-version behavior, and disconnect/update invalidation explicitly. Render strings as data, never executable UI or code.
- Keep Windows labels, welcome guidance, starter prompts, and loading/error/compatibility messages in native
.reswresources. Update all supported languages together. - Use the simplest approach that fits. This is not a requirement to add an RPC or catalog for every string; existing native resources are the right home for native-only copy. Add focused coverage for source-to-catalog consistency and consumer failure/fallback behavior when introducing a shared contract.
Welcome copy is bundled with Companion and works independently of Gateway version. See the native chat visual contract.
Do not use em dashes in user-facing prose, including UI text, error messages, CLI output, notifications, and agent-facing help. Use a period, colon, comma, parentheses, or a simple hyphen instead. A standalone em dash is allowed as an unavailable-value or status placeholder.
Policy:
- Required automated/focused tests are mandatory; do not ask to skip them.
- Prefer computer-use as a batched closeout proof pass before PRs. If UI proof is useful mid-development, first ask whether to run computer-use now or provide manual steps so the developer can capture screenshots/output.
- For UI claims, collect current-head visible proof of the active changed state: computer-use screenshot/video, developer-provided screenshot, copied UI diagnostics, or an explicit blocker.
- If the developer captures UI proof manually, run or point them at the current isolated app, provide exact reproduction/capture steps, and verify any PR screenshot/artifact links after updating the PR body.
- For node/MCP changes, prove discovery and invocation with
winnode --list-toolspluswinnode --command ..., or raw MCP JSON-RPCtools/listplustools/call. - For gateway-mediated behavior, prove the real gateway path when available; otherwise state the blocker and keep MCP proof.
- Run rubber-duck review before PR publication for non-trivial UI, MCP, node-command, setup, pairing, security, permissions, or diagnostics changes.
- PRs should include
## Required proof pools,## Validation, and## Real behavior proof. Select every applicable pool ID fromdocs/PROOF_POOLS.md, or declarenonewith a reason. Proof must directly show the changed behavior from the current PR head. FillNot verified / blockedfor focused proof or unavailable dependencies.
Every new Windows node call must be exposed, documented, and tested through MCP before completion:
- Register the capability/command in the tray node capability registry.
- Add/update
McpToolBridge.CommandDescriptions. - Update
.agents/skills/winnode/SKILL.md. - Add/update capability, MCP bridge,
winnode, and UI/gateway tests as appropriate. - Run required validation plus
dotnet test .\tests\OpenClaw.WinNode.Cli.Tests\OpenClaw.WinNode.Cli.Tests.csproj --no-restorewhenwinnode, MCP output, or command docs change.
Read docs/TELEMETRY.md before adding or changing OpenTelemetry configuration, exporters, instrumentation helpers, span attributes, metric tags, or exported log fields.
- Do not add OpenTelemetry SDK/exporter package references to
OpenClaw.Shared; shared helpers may useSystem.Diagnostics.ActivitySource,Activity, andSystem.Diagnostics.Metricsonly. - Do not export user content, prompts, screenshots, file contents, raw command input/output, credentials, API keys, gateway tokens, device tokens, or arbitrary existing local logs.
- Keep telemetry opt-in: an empty endpoint must mean no OpenTelemetry export, and export must go only to the user-configured endpoint.
- Prefer low-cardinality operational diagnostics: operation names, outcomes, durations, counts, protocol choices, and coarse error categories.
- Add focused tests for new span names, metric names, tag keys, log categories, filtering behavior, and endpoint/protocol behavior.
- For exporter or protocol changes, provide current-head collector proof for every affected signal and protocol, or document the blocker.
Read the guide for the behavior and owner being changed, including callers outside that owner's directory. Follow relevant references when a contract crosses boundaries; unrelated rows are not a mandatory reading list.
| When changing | Required context |
|---|---|
| Any owner named in the living ledger | ARCHITECTURE.md: read its rows; preserve authoritative owners and never re-add closed responsibilities |
| Connection, credentials, migration, pairing, or reconnect | CONNECTION_ARCHITECTURE.md |
| MCP hosting or the node/MCP mode matrix | MCP_MODE.md |
| Windows node capabilities or Gateway invocation | WINDOWS_NODE_TESTING.md |
| First-run/setup-code/bootstrap pairing | ONBOARDING_WIZARD.md |
| Setup pipeline, rollback, context injection, or setup CLI | SETUP_ENGINE_REDESIGN.md |
Multi-line WSL scripts through RunInWslAsync |
WSL_EXE_ARGV_PITFALL.md |
src\OpenClaw.Tray.WinUI\App.xaml.cs and src\OpenClaw.Tray.WinUI\Pages\ConnectionPage.xaml.cs are active god-file reduction targets. When touching either file:
- Read
docs/ARCHITECTURE.mdfirst. It is the living ownership ledger. Before editing any file it lists, check its row(s); do not re-add anything markedclosed. When you extract a responsibility, update the ledger in the same PR (flip/add the new owner toauthoritative, mark the vacated responsibilityclosed) and add a guard test for high-regression closures. A PR that re-adds aclosedresponsibility must be rejected in review. - Prefer completing a real ownership transfer over moving code to partial classes. A new partial file is not progress unless it introduces a narrower owner, pure projection, policy, service, or tested seam.
- Keep
Appas the composition root. Shrink it by delegating cohesive behavior to focused services, but do not relocate startup ordering into another god object. - Keep
ConnectionPage.xaml.csas the WinUI applicator until a pure row/plan/workflow seam exists. Do not move named-control setters into a presenter that just wraps the page. - Add characterization tests before moving startup, credential, pairing, node/MCP, tray action, or direct-connect rollback behavior. Source-text contract tests are acceptable for WinUI-only seams, but prefer pure unit tests for policies and projections.
- Keep PRs small and reviewable: one seam per PR, with a clear invariant protected by tests. Stop and re-plan if a PR moves hundreds of lines without behavior coverage.
- In PR descriptions and handoffs, name the old owner, new owner, preserved invariant, and validation run so future agents do not reintroduce duplicate paths or grow new god objects.
Important current facts:
- Gateway credentials are no longer stored in
SettingsData.Token/SettingsData.BootstrapToken.SettingsManagermay read legacy JSON fields only for one-time migration; new writes must go throughGatewayRegistry. - Active gateway records live in
%APPDATA%\OpenClawTray\gateways.json; per-gateway identity files live under%APPDATA%\OpenClawTray\gateways\<gateway-id>\device-key-ed25519.json. - Credential precedence is device token, then shared gateway token, then bootstrap token. Do not downgrade a paired device from its stored device token back to a bootstrap/shared token.
GatewayConnectionManagerowns operator/node connection state. UI surfaces should observe it or call its reconnect/disconnect APIs instead of constructing parallel gateway clients.- Chat/canvas/tray actions must visibly route users to Connection settings when pairing is incomplete or credentials are missing; avoid silent no-ops.
- MCP-only mode (
EnableMcpServer=true,EnableNodeMode=false) must start localNodeServicewithout requiring a gateway credential.
Use --max-priority P3 with the shared autoreview helper to preserve this
repository's existing P0–P3 review gate. Follow the
shared skill setup before running it.
This repository has a living design system at DESIGN.md. These files are the source of truth for design (tokens, component intent, and principles) and are framework-agnostic. components.jsonc shows design intent for preview; it is not shipping code.
Read it before creating or changing any UI. To ship, port the design into this app's implementation using the port target(s) below. Don't copy components.jsonc verbatim.
DESIGN.md: design tokens and rationale: brand, colors, typography, spacing, radii, shadows, principles..agents/design/components.jsonc: the component patterns to reuse (structure, variants, states).
Generate UI from these tokens and patterns: use token names (e.g. accent, ink, spacing step 4, radius md), not raw hex or ad-hoc px; reuse the documented components instead of inventing new ones; honor the brand voice; and avoid the system's listed anti-references. If you need a value the system doesn't cover, add it to DESIGN.md rather than hard-coding a one-off.
Use the Colophon tool/canvas to inspect, edit, and preview this system when available. Install the optional plugin with copilot plugin install karkarl/colophon. Without the extension, read and edit the files directly; Colophon is not required.
Port targets: how a design becomes shipping code here (design stays the source of truth; these say what each surface ships as and which reference/skill to port it with):
- Default: ships as Native WinUI 3 / C# (Windows Fluent). Port via https://github.com/microsoft/win-dev-skills (helper agent: win-dev-skills)
- area "chat", components ChatBubble, ChatComposer, ChatThread: ships as Reactor (Microsoft.UI.Reactor). Port via https://github.com/microsoft/microsoft-ui-reactor (no helper agent yet)
- Canonical implementation owner: OpenClaw Windows (openclaw/openclaw-windows-node)
- Examples kept aligned via: Tokens are captured by manual inspection of the app's WinUI 3 XAML/C# Fluent resources; re-inspect and update this file when the app's ThemeResource mappings or SystemAccentColor usage change.
Colors in DESIGN.md are preview-only swatches. When a color has a resource (e.g. a WinUI ThemeResource key), bind that resource in code, never hard-code the preview hex, so light, dark, and high-contrast themes stay correct. The shipping implementation is canonical; treat components.jsonc and the token values as derived visual examples, not a parallel upstream source.
Managed by Colophon. Edit DESIGN.md to change the system; this block only points to it.