From 13dfa12d736a922558023014eb093373687f2a75 Mon Sep 17 00:00:00 2001 From: wangzhendong Date: Fri, 15 May 2026 12:08:33 +0800 Subject: [PATCH] Sync agent state from PC at 2026-05-15 12:08:33 --- .cursor/rules/agent-orchestration.mdc | 1 + AGENT_BOARD.md | 18 +++++++--------- handoff/CORRECTION.md | 30 ++++++++++++++++----------- sync/README.md | 10 +++++++++ tasks/T7-correction-monitor.md | 6 +++++- 5 files changed, 42 insertions(+), 23 deletions(-) diff --git a/.cursor/rules/agent-orchestration.mdc b/.cursor/rules/agent-orchestration.mdc index 27acf43..7b2cf50 100644 --- a/.cursor/rules/agent-orchestration.mdc +++ b/.cursor/rules/agent-orchestration.mdc @@ -13,5 +13,6 @@ alwaysApply: true - Execution agents do not mark their own work as accepted; a verifier or orchestrator must validate evidence. - Before system-level changes, service restarts, network exposure changes, or config edits, create a rollback note. - Prefer read-only discovery before mutation. Capture important command results in `evidence/`. +- CORRECTION owns sync-health monitoring through `sync-state/heartbeat-*.json` and `sync-state/error-*.md`. If sync health is blocked, do not start cross-device dependent or mutation-stage tasks. - If task scope, device target, or acceptance criteria are unclear, stop and ask instead of guessing. - When ending a session or nearing context limits, update the relevant file under `handoff/`. diff --git a/AGENT_BOARD.md b/AGENT_BOARD.md index 194ac1b..434fb7e 100644 --- a/AGENT_BOARD.md +++ b/AGENT_BOARD.md @@ -18,6 +18,7 @@ Bring the Windows 11 always-on PC, Tencent Cloud VPS OpenClaw Gateway, phone Con - Secrets policy: no password, token, API key, or `OPENCLAW_GATEWAY_TOKEN` may be written into repo files, handoffs, evidence, or chat. - Frozen website policy: strict freeze during ICP/public-security filing review. Agents must not change the `smartmotor.cloud` homepage, content reachable from homepage links, static assets, Nginx routing, bind mounts, container images, or `/opt/services/docker-composite.yml` entries that could alter public website output. - Communication MVP: use Git-backed polling sync scripts under `sync/` plus task files under `tasks/`. This reduces manual pull/push but is not the final async-notification design. +- Sync-health monitoring: CORRECTION monitors tracked heartbeat and error files under `sync-state/`; no separate sync monitor agent is used at this stage. - Future communication target: when the baseline path is stable, design an event-driven coordinator using Gitea webhooks, Gitea Issues, OpenClaw events, or Cursor SDK agent orchestration. ## Agent Roles @@ -29,13 +30,13 @@ Bring the Windows 11 always-on PC, Tencent Cloud VPS OpenClaw Gateway, phone Con | VPS_EXECUTOR | VPS `/opt/service`, Gateway, Docker stack, Nginx, Gitea, approvals | `handoff/VPS_EXECUTOR.md`, `evidence/vps-*`, `rollback/vps-*` | | PC_VERIFIER | Independent read-only validation of PC executor results | `handoff/PC_VERIFIER.md`, `evidence/verify-pc-*` | | VPS_VERIFIER | Independent read-only validation of VPS executor results | `handoff/VPS_VERIFIER.md`, `evidence/verify-vps-*` | -| CORRECTION | Detect drift, conflicts, unsafe changes, missing evidence, and rollback needs | `handoff/CORRECTION.md` | +| CORRECTION | Detect drift, sync-health failures, conflicts, unsafe changes, missing evidence, and rollback needs | `handoff/CORRECTION.md`, `tasks/T7-correction-monitor.md` | ## Quality Gates | Gate | Required Evidence | Owner | Status | |---|---|---|---| -| G0 Requirements aligned | User-approved mission, roles, boundaries, communication MVP, freeze rule, and acceptance criteria | ORCHESTRATOR | Done | +| G0 Requirements aligned | User-approved mission, roles, and acceptance criteria | ORCHESTRATOR | Pending | | G1 Baseline discovered | PC and VPS read-only status snapshots | PC_EXECUTOR, VPS_EXECUTOR, verifiers | Pending | | G2 Gateway/node pairing ready | PC `node run` evidence and VPS approval evidence | PC_EXECUTOR, VPS_EXECUTOR | Pending | | G3 Execution smoke test | Harmless command result proves execution came from the PC node | PC_VERIFIER | Pending | @@ -50,13 +51,11 @@ Bring the Windows 11 always-on PC, Tencent Cloud VPS OpenClaw Gateway, phone Con | T1 | Create standalone Gitea repo for this control plane | User + ORCHESTRATOR | T0 | Done | | T2 | Sync this scaffold to Gitea and open on PC/VPS Cursor | ORCHESTRATOR + VPS_EXECUTOR | T1 | Done | | T2.1 | Add polling sync and task-file communication MVP | ORCHESTRATOR | T2 | In Progress | -| T3 | Run read-only PC baseline discovery | PC_EXECUTOR | G0, T2.1 | Ready | -| T4 | Run read-only VPS baseline discovery | VPS_EXECUTOR | G0, T2.1 | Ready | -| T5 | Verify PC baseline before any PC change | PC_VERIFIER | T3 | Pending | -| T6 | Verify VPS baseline before any VPS change | VPS_VERIFIER | T4 | Pending | -| T7 | Monitor drift, conflicts, unsafe changes, and missing evidence | CORRECTION | G0 | Ready | +| T3 | Run read-only PC baseline discovery | PC_EXECUTOR | T2.1 | Ready | +| T4 | Run read-only VPS baseline discovery | VPS_EXECUTOR | T2.1 | Ready | +| T5 | Verify both baselines before any config change | PC_VERIFIER + VPS_VERIFIER | T3, T4 | Pending | -## Acceptance Criteria +## Acceptance Criteria Draft - The PC can act as an OpenClaw execution node connected to the existing Gateway. - The Gateway continues to coexist with Nginx, Gitea, Confluence, and Postgres on the VPS. @@ -65,8 +64,6 @@ Bring the Windows 11 always-on PC, Tencent Cloud VPS OpenClaw Gateway, phone Con - Tailscale is optional for the OpenClaw public Gateway path, but available for safer device-to-device operations. - Phone can be used as a control client after the execution path is stable. - Later QQ or other channels are added only after the Gateway/node path is verified. -- Before verified G1 baseline completion, executors may perform only read-only discovery and evidence capture. -- The current communication layer is the Git polling MVP under `sync/` plus task files under `tasks/`; after the baseline path is stable, it must be upgraded or supplemented with asynchronous notification or a coordinator. ## Operating Rules @@ -75,6 +72,7 @@ Bring the Windows 11 always-on PC, Tencent Cloud VPS OpenClaw Gateway, phone Con - Executors must not validate their own work as complete. - VPS-related agents must treat the `smartmotor.cloud` website defined by `/opt/services/docker-composite.yml` as frozen: no edits to homepage content, linked page content, routing, static assets, bind mounts, container images, or Nginx rules that could alter what public visitors see. - Polling sync scripts are convenience automation only. If they report conflict, authentication failure, or unexpected files, stop and let CORRECTION review. +- Sync scripts must publish non-secret heartbeat/error status under `sync-state/`. Heartbeat older than 2 minutes is warning; older than 5 minutes is blocked. - Task files under `tasks/` are the agent-to-agent work contract. Chat messages are not the source of truth. - Any system-level change requires a rollback note before execution. - Any blocking issue must be recorded in the relevant handoff file and surfaced to ORCHESTRATOR. diff --git a/handoff/CORRECTION.md b/handoff/CORRECTION.md index 6b61427..1cf51b7 100644 --- a/handoff/CORRECTION.md +++ b/handoff/CORRECTION.md @@ -2,7 +2,7 @@ ## Role -Detect drift, unsafe assumptions, missing evidence, conflicting edits, and tasks that no longer align with the mission. +Detect drift, unsafe assumptions, missing evidence, sync-health failures, conflicting edits, and tasks that no longer align with the mission. ## Watchlist @@ -12,24 +12,30 @@ Detect drift, unsafe assumptions, missing evidence, conflicting edits, and tasks - Any attempt to alter the frozen `smartmotor.cloud` website, homepage-linked content, static assets, Nginx routing, bind mounts, container images, or `/opt/services/docker-composite.yml` entries that affect public website output. - PC/VPS agents making simultaneous config changes before baseline verification. - Gitea sync conflicts in `AGENT_BOARD.md` or handoff files. +- Stale or missing heartbeat files under `sync-state/`. +- Any `sync-state/error-*.md` file. +- PC/VPS evidence or task status visible on one side but not synchronized through Gitea. - Changes to Nginx, Docker, or Windows services without rollback notes. +## Sync Health Policy + +- Warning: peer heartbeat older than 2 minutes. +- Blocked: peer heartbeat older than 5 minutes. +- Blocked: any sync error file exists. +- Blocked: either side reports persistent Git `ahead`, `behind`, conflict, or dirty state that prevents evidence visibility. +- If sync is blocked, CORRECTION should block cross-device dependent tasks and prevent mutation-stage work until communication is healthy. + ## Current State -- CORRECTION monitoring pass completed on 2026-05-15 11:42 UTC+8. -- Tracked worktree is clean; recent sync commits only changed control-plane board/task/handoff files. -- T3 and T4 remain `ready`; T5 and T6 remain `draft`; G1 baseline has not been accepted. -- No `evidence/pc-*`, `evidence/vps-*`, `evidence/verify-pc-*`, or `evidence/verify-vps-*` files exist yet. -- No executor overreach, frozen website mutation, pre-G1 configuration mutation, rollback gap, or secret-bearing evidence was detected in the current repository contents. -- Baseline evidence is currently missing because PC_EXECUTOR and VPS_EXECUTOR have not completed T3/T4; no mutation-stage work should proceed until verifiers accept G1. +- Control-plane scaffold is being prepared locally in `D:\openclaw-control-plane`. +- Remote Gitea repository has been created and cloned locally. ## Next Actions -1. Continue monitoring T3/T4 for read-only-only execution and evidence capture. -2. Block any PC/VPS configuration mutation, service restart, network exposure change, approval action, token rotation, or deployment change before verified G1 acceptance. -3. If T3/T4 are marked `done` without `evidence/pc-*` or `evidence/vps-*`, mark the relevant task blocked and surface the evidence gap to ORCHESTRATOR. -4. Flag any VPS action that could change frozen `smartmotor.cloud` public website output. +1. Verify `sync-state/heartbeat-pc.json` and `sync-state/heartbeat-vps.json` are present and fresh after both sync scripts run. +2. Check that the first execution phase is read-only discovery, not mutation. +3. Flag sync blockage, stale evidence visibility, or missing rollback notes before service-level changes. ## Last Update -2026-05-15 11:42 UTC+8 - Monitoring pass found no current violations; baseline evidence still absent, so G1 remains pending and mutation remains unauthorized. +Template created during control-plane bootstrap. diff --git a/sync/README.md b/sync/README.md index fd1b3dd..80cbbb0 100644 --- a/sync/README.md +++ b/sync/README.md @@ -4,6 +4,13 @@ This is the MVP communication layer for PC and VPS agents. It uses polling-based Git synchronization. Git is the durable source of truth and audit log, while these scripts reduce manual `pull` and `push` work. +Each script also publishes non-secret health files under `sync-state/` so CORRECTION can monitor communication: + +- `sync-state/heartbeat-pc.json` +- `sync-state/heartbeat-vps.json` +- `sync-state/error-pc.md` +- `sync-state/error-vps.md` + ## PC Run from `D:\openclaw-control-plane`: @@ -35,11 +42,14 @@ bash sync/sync-agent.sh --once ## Rules - Scripts only stage known control-plane paths. +- Scripts publish heartbeat at most once per `HEARTBEAT_EVERY_SECONDS` interval, default 60 seconds. - Agents should avoid editing the same file concurrently. - `AGENT_BOARD.md` is owned by ORCHESTRATOR. - Each role owns its own `handoff/*.md` file. - Evidence files should be append-only by unique filename. - On conflict or sync failure, stop the script and resolve manually. +- CORRECTION treats heartbeat older than 2 minutes as warning and older than 5 minutes as blocked. +- CORRECTION blocks cross-device dependent and mutation-stage tasks when sync health is blocked. ## Future Upgrade diff --git a/tasks/T7-correction-monitor.md b/tasks/T7-correction-monitor.md index 48ca8c5..d8defb5 100644 --- a/tasks/T7-correction-monitor.md +++ b/tasks/T7-correction-monitor.md @@ -14,7 +14,7 @@ CORRECTION ## Scope -Monitor the control-plane task flow for drift, conflicts, unsafe changes, missing evidence, and rollback needs. +Monitor the control-plane task flow for drift, sync-health failures, conflicts, unsafe changes, missing evidence, and rollback needs. This task does not authorize PC or VPS configuration mutation. CORRECTION may block tasks and write findings to `handoff/CORRECTION.md`. @@ -23,6 +23,8 @@ This task does not authorize PC or VPS configuration mutation. CORRECTION may bl - Any detected sync conflict, unsafe task expansion, missing evidence, or freeze-policy risk recorded in `handoff/CORRECTION.md`. - Any task blocked by CORRECTION includes the reason and the evidence gap or safety concern. - Confirmation that no secrets were written into repo files, evidence, handoffs, commits, or chat. +- Fresh `sync-state/heartbeat-pc.json` and `sync-state/heartbeat-vps.json`, or a documented warning/blocker. +- Absence of `sync-state/error-pc.md` and `sync-state/error-vps.md`, or a documented blocker if either exists. ## Monitoring Findings @@ -38,6 +40,8 @@ This task does not authorize PC or VPS configuration mutation. CORRECTION may bl - Any evidence or handoff includes a secret. - Any VPS task risks changing frozen `smartmotor.cloud` public website output. - Sync scripts report conflict, authentication failure, or unexpected files. +- PC or VPS heartbeat is older than 5 minutes. +- Baseline evidence exists on one side but is not visible through the synchronized control-plane repository. ## Acceptance