Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Persist unified resource timeline changes

rcourtmanf0520bc5e3f1
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
new file mode 100644
index 0000000000..6caec5e197
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -0,0 +1,999 @@
+# Agent Lifecycle Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "agent-lifecycle",
+ "lane": "L16",
+ "contract_file": "docs/release-control/v6/internal/subsystems/agent-lifecycle.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": [
+ "api-contracts"
+ ]
+}
+```
+
+## Purpose
+
+Own unified agent installation, registration, update continuity, profile
+management, and fleet control surfaces.
+
+## Canonical Files
+
+1. `internal/api/agent_install_command_shared.go`
+2. `internal/api/config_setup_handlers.go`
+3. `internal/api/unified_agent.go`
+4. `internal/agentupdate/update.go`
+5. `internal/hostagent/agent.go`
+6. `scripts/install.sh`
+7. `scripts/install.ps1`
+8. `frontend-modern/src/api/agentProfiles.ts`
+9. `frontend-modern/src/components/Settings/AgentProfilesPanel.tsx`
+10. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`
+11. `frontend-modern/src/components/Settings/UnifiedAgents.tsx`
+12. `frontend-modern/src/components/Settings/NodeModal.tsx`
+13. `frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx`
+14. `frontend-modern/src/components/Infrastructure/deploy/ResultsStep.tsx`
+15. `frontend-modern/src/utils/agentProfilesPresentation.ts`
+16. `frontend-modern/src/utils/agentInstallCommand.ts`
+17. `frontend-modern/src/api/nodes.ts`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/api/agentProfiles.ts` shared with `api-contracts`: the agent profiles frontend client is both an agent lifecycle control surface and a canonical API payload contract boundary.
+2. `frontend-modern/src/api/nodes.ts` shared with `api-contracts`: the shared Proxmox node client is both an agent lifecycle setup/install control surface and a canonical API payload contract boundary.
+3. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx` shared with `api-contracts`: the infrastructure operations controller is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
+4. `frontend-modern/src/components/Settings/UnifiedAgents.tsx` shared with `api-contracts`: the UnifiedAgents module is a compatibility shim for the canonical infrastructure operations controller and remains on the same shared agent lifecycle and API contract boundary while the old module path exists.
+5. `frontend-modern/src/utils/agentInstallCommand.ts` shared with `api-contracts`: the shared frontend install-command helper is both an agent lifecycle control surface and a canonical API/install transport contract boundary.
+6. `internal/api/agent_install_command_shared.go` shared with `api-contracts`: agent install command assembly is both an agent lifecycle control surface and a canonical API payload contract boundary.
+7. `internal/api/config_setup_handlers.go` shared with `api-contracts`: auto-register and setup handlers are both an agent lifecycle control surface and a canonical API payload contract boundary.
+8. `internal/api/unified_agent.go` shared with `api-contracts`: unified agent download and installer handlers are both an agent lifecycle control surface and a canonical API payload contract boundary.
+9. `scripts/install.ps1` shared with `deployment-installability`: the Windows installer is both a deployment installability entry point and a canonical agent lifecycle runtime continuity boundary.
+10. `scripts/install.sh` shared with `deployment-installability`: the shell installer is both a deployment installability entry point and a canonical agent lifecycle runtime continuity boundary.
+
+## Extension Points
+
+1. Add or change install-command generation, canonical /api/auto-register behavior, or installer download behavior through the owned `internal/api/` files above.
+2. Add or change update continuity and persisted-version handoff through `internal/agentupdate/`.
+3. Add or change runtime-side Unified Agent startup, first-report assembly, and enroll/runtime continuity through `internal/hostagent/`.
+4. Keep legacy Unified Agent compatibility names explicitly secondary when touching shared `internal/api/` runtime helpers: the legacy host-route family and `host-agent:*` scope names may remain as ingress or migration aliases, but they must not retake primary ownership in router state, live runtime scope checks, handler commentary, or operator-facing guidance.
+5. Add or change installer flags, persisted service arguments, or upgrade-safe re-entry behavior through `scripts/install.sh` and `scripts/install.ps1`.
+6. Add or change profile management, shared frontend install-command assembly, Proxmox setup/install API transport, setup-completion install handoff transport, deploy-fallback manual install transport, and fleet-control presentation through `frontend-modern/src/api/agentProfiles.ts`, `frontend-modern/src/api/nodes.ts`, `frontend-modern/src/components/Settings/AgentProfilesPanel.tsx`, `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`, `frontend-modern/src/components/Settings/NodeModal.tsx`, `frontend-modern/src/components/SetupWizard/SetupCompletionPanel.tsx`, `frontend-modern/src/components/Infrastructure/deploy/ResultsStep.tsx`, and `frontend-modern/src/utils/agentInstallCommand.ts`.
+
+## Forbidden Paths
+
+1. New install or update continuity behavior hidden only inside broad monitoring ownership.
+2. Agent profile or fleet-control behavior implemented outside the canonical agent settings/profile surfaces.
+3. Installer or update flows that depend on branch-tip, dev-only, or non-release asset behavior for supported RC/stable paths.
+
+## Completion Obligations
+
+1. Update this contract when agent lifecycle ownership changes.
+2. Keep shared API proof routing aligned whenever install, register, or profile payloads change.
+3. Update runtime and settings tests in the same slice when lifecycle behavior changes.
+4. Preserve canonical /api/auto-register node identity continuity when canonical hosts shift between hostname and IP forms for the same node.
+
+## Current State
+
+This subsystem now sits under the dedicated agent lifecycle and fleet
+operations lane so install, registration, update continuity, profile
+management, and fleet safety stop hiding inside architecture, migration, or
+monitoring work.
+
+Agent lifecycle owns the install/register/update continuity surfaces, but it
+does not own unified-resource history or control-plane timeline persistence.
+Those runtime changes now travel through the shared API and unified-resource
+contracts, which keeps fleet bootstrap and identity continuity separate from
+resource-change recording and historical inspection.
+
+The owned backend API surfaces must preserve the exact-release installer
+fallback, canonical /api/auto-register behavior, and hosted org install-command
+contracts instead of leaving those guarantees implied by generic API ownership.
+That canonical /api/auto-register behavior now also includes hostname/IP continuity:
+reruns that arrive through a different canonical host form must reuse the same
+Pulse-managed node record and token instead of forking duplicate fleet entries.
+That same canonical behavior also includes one auth transport for Proxmox
+completion: runtime-side Unified Agent and script callers must send `/api/auto-register`
+authentication through a one-time setup token in the request-body
+`authToken` field instead of keeping either a header-auth compatibility path
+or a long-lived admin-token completion path alive.
+That same first-session lifecycle boundary also owns bootstrap-token
+recovery: the supported operator path is `pulse bootstrap-token`, and the
+runtime may not keep `.bootstrap_token` as an unstructured plaintext secret
+file after startup. Canonical persistence must encrypt the bootstrap token at
+rest and rewrite any legacy plaintext bootstrap-token file immediately into
+the encrypted canonical format on load.
+That same shared `internal/api/` lifecycle boundary also assumes tenant-scoped
+resource helpers stay on canonical unified-resource seeds: adjacent fleet and
+install surfaces may not revive raw tenant `StateSnapshot` fallback through
+shared API resource wiring once `UnifiedResourceSnapshotForTenant` exists.
+That same shared `internal/api/` boundary now also assumes tenant AI services
+stay on canonical Patrol runtime wiring: adjacent fleet and install surfaces
+must not revive tenant snapshot-provider bridges through shared AI handler
+setup once Patrol can initialize from tenant `ReadState` and unified-resource
+providers directly.
+That same canonical /api/auto-register response must stay on one completion
+truth: caller-supplied Proxmox credentials complete registration with a
+direct-use action, and the runtime no longer preserves a dead pending-secret
+placeholder state. That same response
+must also stay truthful
+about lifecycle state: it may not claim the node is already registered
+successfully while local token creation is still outstanding.
+That same first-hop lifecycle boundary must validate that response shape
+instead of trusting HTTP success alone: runtime-side Unified Agent and installer callers must
+require the canonical `status="success"` plus `action="use_token"` response
+contract before treating registration as complete.
+That same canonical response contract must also carry the runtime-owned
+identity truth back to those callers: `type`, `source`, normalized `host`, and
+matching `nodeId`/`nodeName` must describe the resolved stored node record, and
+installer/runtime-side Unified Agent success reporting must use that returned canonical node
+identity instead of the caller's pre-registration `serverName`.
+The canonical /api/auto-register response must preserve canonical
+node identity: `nodeId` must carry the resolved stored node name rather than
+the raw host URL or requested `serverName`, so every live registration caller
+stays aligned with saved fleet state.
+That same /api/auto-register boundary must also preserve canonical
+live-event identity: the `node_auto_registered` WebSocket payload must emit the
+normalized stored host plus the resolved stored node name in `name`, `nodeId`,
+and `nodeName`, rather than broadcasting raw request fields that can drift
+from the saved node record.
+That same runtime-side Unified Agent boundary also owns one canonical ingest
+name through `internal/api/agent_ingest.go` and `internal/api/router*.go`:
+the primary runtime surface is the Unified Agent report/config boundary, while
+the `/api/agents/host/*` routes remain compatibility aliases only and may not
+re-emerge as the primary lifecycle concept in router state, handlers, or
+proofs.
+That same canonical /api/auto-register path must also complete the live
+post-registration contract after persistence: it must trigger discovery refresh
+and emit the canonical `node_auto_registered` WebSocket payload instead of
+stopping at a backend-only save/response path.
+That same post-registration discovery update must keep structured error
+ownership in discovery runtime state: lifecycle handlers may broadcast the
+deprecated string `errors` list only as a compatibility field derived from
+canonical `structured_errors`, not as a second live discovery owner path.
+That same canonical /api/auto-register path must also accept caller-supplied Proxmox token
+completion for confirmed runtime-side Unified Agent or script flows, so live registration
+surfaces stay on one governed completion contract instead of inventing a
+second explicit-token endpoint outside /api/auto-register.
+On the PVE side, only tokens that previously came back through a completed
+`source="agent"` or `source="script"` auto-register flow count as reusable
+confirmed credentials, so interrupted runs cannot harden a false `use_token`
+state from any non-canonical token placeholder.
+The canonical setup-script path must stamp that same `source="script"` marker
+on /api/auto-register payloads, and canonical registration callers must send
+that source explicitly, so confirmed script-created tokens stay distinguishable
+from agent-created tokens across later canonical reruns.
+That same canonical request contract must also reject any non-canonical source
+marker: `/api/auto-register` accepts only `source="agent"` and
+`source="script"` so v6 does not preserve arbitrary caller labels as a hidden
+compatibility surface.
+That same canonical request contract must also reject any non-canonical node
+type: `/api/auto-register` accepts only `type="pve"` and `type="pbs"` so
+unsupported runtime labels cannot slip through as fake successful fleet
+registrations.
+That same canonical request contract must also reject non-canonical token
+identities: `/api/auto-register` accepts only Pulse-managed
+`pulse-monitor@{pve|pbs}!pulse-...` token ids, so v6 does not preserve
+arbitrary, cross-type, or non-Pulse-managed token labels as successful
+registration state.
+That same canonical token identity must also stay deterministic across live
+callers: `install.sh`, generated setup scripts, and runtime-side Unified Agent-driven Proxmox
+registration must all create the same Pulse-managed `pulse-<canonical-scope-slug>`
+token name for a given Pulse endpoint instead of letting one caller drift into
+timestamp-suffixed or rerun-local token identities.
+The corresponding `NodeModal.tsx` install/setup surface is presentation only
+for those API-managed Proxmox, PBS, and PMG connections. Lifecycle guidance in
+that modal may explain monitored-system caps, but commercial enforcement still
+belongs to the canonical add-node and `/api/auto-register` boundaries instead
+of becoming a second modal-local exemption rule.
+That same deterministic token-identity contract also applies to backend-owned
+turnkey Proxmox token creation: generated setup scripts and the password-based
+PBS add-node path must derive Pulse-managed token names from the canonical
+Pulse endpoint itself rather than request-local `Host` fallbacks, so loopback
+or proxy-facing admin requests cannot fork monitor-token identity for the same
+Pulse instance.
+That same generated setup-script path must now complete registration through
+the canonical /api/auto-register contract itself: locally created Proxmox tokens must
+be submitted directly on the canonical contract instead of diverging into a
+second registration shape.
+That same setup bootstrap surface must also keep canonical request handling
+aligned across `/api/setup-script-url` and `/api/setup-script`: unsupported
+node types may not drift into implicit PBS script generation, and the direct
+setup-script route must normalize the supplied host before emitting script text
+or rerun URLs so the bootstrap artifact and downloaded script stay on the same
+node identity.
+That same setup bootstrap surface must also stay owned by one backend bootstrap
+artifact builder: `/api/setup-script-url` response fields, setup-token hinting,
+download URLs, script filenames, and the generated script's rerun command must
+all derive from the same canonical bootstrap contract instead of being rebuilt
+as separate handler-local shell snippets.
+That same canonical request contract must also keep one-time setup-token auth
+on a single field: `/api/auto-register` accepts `authToken` as the governed
+request payload key and may not preserve a parallel `setupCode` alias.
+That same governed runtime path must also keep its active auth terminology on
+setup tokens instead of setup-code residue: `config_setup_handlers.go`,
+`config_handlers.go`, and their direct proofs must model the one-time
+credential as a setup token in runtime names, logs, and auth failure text.
+That same auth failure contract must also fail specifically on the canonical
+setup-token requirement: missing `authToken` input on `/api/auto-register` may
+not collapse back to a generic authentication message once the route is
+governed as setup-token-only.
+That same canonical request contract must also keep field-validation failures
+specific: mismatched `tokenId`/`tokenValue` input may not collapse into
+generic missing-field output, and other missing canonical fields must return
+explicit `Missing required canonical auto-register fields: ...` guidance.
+That same owned setup and auto-register boundary now also participates in the
+canonical monitored-system commercial cap. A new `/api/auto-register`
+completion may proceed only when it either dedupes onto an already-counted
+top-level monitored system or fits within the deduped monitored-system limit;
+the lifecycle surface may not preserve a special exemption that keeps API-
+backed monitored systems outside the self-hosted commercial cap.
+That same validation contract must stay coherent across the public
+`/api/auto-register` route and the direct canonical handler path used by the
+same runtime surface, so Unified Agent/setup entry points do not inherit divergent
+messages for the same missing-field or token-pair failures.
+That same canonical caller contract must also require explicit node identity
+input from live callers: `/api/auto-register` may not synthesize `serverName`
+from `host` once installer, setup-script, and runtime-side Unified Agent callers all send the
+canonical field directly.
+That same canonical runtime path must also keep overlap and rerun continuity
+wording on the canonical `/api/auto-register` contract itself: active runtime
+messages and helpers may not preserve the deleted "secure auto-register" split
+when describing host-identity, DHCP-continuity, or in-place token-update
+matches.
+That same canonical runtime path must keep token-completion validation wording
+on the canonical contract too: incomplete `tokenId`/`tokenValue` payloads may
+not preserve deleted "secure token completion" wording in live handler
+messages.
+That same migration rule also applies to `scripts/install.sh`: installer-owned
+Proxmox auto-registration must keep local token creation in the installer, but
+submit the resulting token completion through the canonical /api/auto-register
+contract directly as the one supported completion path.
+That same shared `scripts/install.sh` boundary must also keep one canonical
+runtime-argument builder for the service and wrapper launch flags it persists.
+Token-bearing installs, token-file systemd installs, and wrapper-script
+launches may not each rebuild their own shell fragment for `--url`, `--token`,
+feature toggles, identity flags, or disk-exclude transport; they must all
+derive from the same installer-owned argument item list so lifecycle state does
+not drift by install path.
+That same install/setup boundary must also keep setup bootstrap metadata on one
+backend-owned artifact model. Proxmox setup-script downloads, rerun guidance,
+and `/api/setup-script-url` responses may not each carry mirrored local struct
+definitions for the same bootstrap fields.
+That same lifecycle shell transport must also keep one shared render owner for
+generated PVE and PBS setup scripts: the handler may validate inputs and choose
+the artifact, but the shell body itself must come from shared backend render
+helpers rather than an inline handler-local template engine.
+Those install and setup-command paths now also preserve the configured
+canonical `PublicURL` end to end when the admin session originates from the
+local frontend loopback, including the configured HTTPS scheme and path, so
+generated commands do not silently downgrade agent reachability to `http://`.
+That same backend install-command boundary must also normalize trailing slashes
+on canonical base URLs before composing installer asset paths or response
+snippets, so `/api/agent-install-command` and the container-runtime migration
+token path cannot drift onto `//install.sh` or slash-suffixed `PULSE_URL`
+values when `PublicURL` or `AgentConnectURL` is configured with a trailing `/`.
+That shared frontend install-command helper must also stay under explicit proof
+routing on both sides instead of relying only on downstream consumer coverage:
+changes in `frontend-modern/src/utils/agentInstallCommand.ts` must continue to
+carry the direct `frontend-install-command-helper` lifecycle proof together
+with the API-contract helper proof.
+That same shared diagnostics dependency must also preserve canonical
+fallback-reason continuity at the API boundary: when
+`internal/api/diagnostics.go` serializes monitoring memory-source breakdowns
+for lifecycle-adjacent diagnostics surfaces, legacy aliases and empty
+fallback-reason fields must still normalize onto the governed canonical reason
+contract instead of depending on monitor-owned snapshot accessors to have run
+first.
+That same shared `internal/api/` dependency now also assumes auth persistence
+compatibility is handled as an explicit migration/import boundary: legacy
+raw-token `sessions.json` and `csrf_tokens.json` files may load for upgrade
+continuity, but `session_store.go` and `csrf_store.go` must immediately
+rewrite hashed canonical persistence during load instead of leaving raw-token
+files on the primary runtime path until a later save side effect happens to
+run.
+That same shared `internal/api/` dependency also assumes session-carried OIDC
+refresh tokens stay fail-closed at rest: `session_store.go` may only persist
+or recover those tokens through encrypted-at-rest session payloads, and any
+missing-crypto or invalid-ciphertext path must drop the refresh token instead
+of leaving plaintext-at-rest session state on the lifecycle runtime path.
+That same shared `internal/api/` dependency also assumes notification test
+handlers stay decode-and-delegate only: `internal/api/notifications.go` may
+surface adjacent operator test actions, but service-template selection and
+generic webhook-test payload fallback must remain notifications-owned instead
+of becoming a second API-layer owner under the shared helper surface.
+That same shared API boundary also assumes legacy service-specific webhook
+aliases are rewritten at ingress only: `internal/api/notifications.go` may
+accept compatibility keys like Pushover `app_token` / `user_token`, but it
+must return and forward only canonical `token` / `user` fields so agent-
+adjacent shared `internal/api/` surfaces do not inherit a second live alias
+contract.
+That same shared `internal/api/` dependency now also assumes recovery-token
+persistence follows the same rule: raw recovery secrets may be minted for
+immediate operator use, but `recovery_tokens.go` must persist only token hashes
+and treat any legacy plaintext-token file as a one-time migration input that
+is rewritten immediately into hashed canonical persistence on load.
+That same shared `internal/api/` dependency now also assumes those auth stores
+stay owned by the configured router data path: session, CSRF, and
+recovery-token runtime state may not silently bind themselves to hidden
+`/etc/pulse` fallback initialization or retain old-path state after a
+reconfiguration.
+That same path-ownership rule also applies to bootstrap-token recovery and
+adjacent hosted billing side effects that share the `internal/api/` boundary:
+CLI/bootstrap retrieval, webhook dedupe state, and customer-index persistence
+must all route through the shared runtime data-dir helper instead of carrying
+private `/etc/pulse` fallbacks in neighboring entry points.
+That same shared `internal/api/` boundary also assumes manual auth env writes
+and first-session status reads resolve the `.env` path through the shared
+auth-path helper, so lifecycle-adjacent setup and password flows do not each
+reconstruct their own `/etc/pulse/.env` fallback logic.
+Those same lifecycle-adjacent setup and password flows must now also route
+`.env` writes through the shared writable auth-env helper instead of
+re-implementing config-path writes plus data-path fallback ordering inline.
+The same agent-lifecycle boundary now also fails closed on profile assignment:
+assigning an agent to a non-existent profile must return a not-found contract
+instead of persisting an orphan profile reference through the API.
+That same missing-profile assignment contract must survive the shared frontend
+control surface: `frontend-modern/src/api/agentProfiles.ts` must preserve the
+canonical missing-profile message for assignment 404s, and
+`AgentProfilesPanel.tsx` and `InfrastructureOperationsController.tsx` must resync profile state after
+that rejection instead of flattening it into a generic assignment failure while
+leaving stale profile options visible.
+That same shared profile-management boundary must also fail closed on malformed
+list payloads: `frontend-modern/src/api/agentProfiles.ts` may not silently
+reinterpret non-array profile or assignment responses as an empty state, and
+`AgentProfilesPanel.tsx` / `InfrastructureOperationsController.tsx` must surface that load failure
+instead of pretending no profiles exist.
+That same shared profile-management boundary must also fail closed on malformed
+profile-object, suggestion, schema, and validation payloads: the shared
+`agentProfiles` client may not trust partial profile objects, malformed schema
+definitions, or malformed validation/suggestion bodies, and the profile editor
+plus suggestion modal must surface those canonical contract failures instead of
+flattening them into generic save/delete/schema/validation fallback copy.
+Canonical Proxmox auto-register must also preserve the legacy DHCP continuity
+contract: when a node reruns registration from a new IP but presents the
+same canonical node name and deterministic Pulse-managed token identity, Pulse
+must update the existing node in place instead of duplicating it as a second
+inventory record.
+That same profile-management UI boundary must also stay on the direct
+`agent-profiles-surface` proof path, rather than relying only on the shared
+API client coverage to catch lifecycle drift in `AgentProfilesPanel.tsx`.
+That same profile-management presentation helper must also stay on that direct
+`agent-profiles-surface` proof path, rather than relying only on panel-level
+tests to catch lifecycle drift in
+`frontend-modern/src/utils/agentProfilesPresentation.ts`.
+Shared `internal/api/` recovery transport helpers now also preserve normalized
+filter coherence across rollup, point-history, series, and facet views so
+agent-adjacent protected-resource drill-downs do not fork between protected
+items and history slices under the same active recovery filter set.
+
+The updater/runtime surfaces must preserve the one-shot `updated_from`
+continuity handoff and the non-TLS continuity path for supported self-hosted
+installs, so upgrade-safe agent behavior does not drift between install,
+restart, and reconnect paths.
+That same runtime continuity must stay on direct lifecycle proof routes too:
+changes under `internal/hostagent/` must continue to carry the explicit
+`unified-agent-runtime` proof, and changes under `internal/agentupdate/` must
+continue to carry the explicit `agent-update-runtime` proof, instead of
+relying on broad owned-prefix coverage to catch lifecycle regressions in the
+Unified Agent runtime and updater boundaries.
+
+The settings/profile surfaces must keep unified v6 agent identity and profile
+assignment behavior canonical, rather than falling back to host-era or
+module-local assumptions. That includes copied shell install and upgrade
+commands in the unified settings surface: privilege-escalation wrappers must
+preserve the full installer argument list exactly, so selecting target profile,
+token, and command-execution flags cannot be dropped at the last clipboard hop.
+That same target-profile continuity must hold for PowerShell transport as well:
+when the selected profile enables Proxmox mode, copied Windows install commands
+must preserve both `PULSE_ENABLE_PROXMOX` and `PULSE_PROXMOX_TYPE`, and
+`scripts/install.ps1` must persist those flags into the managed service
+arguments instead of silently collapsing back to generic host monitoring.
+The same lifecycle ownership now also covers manual node setup command
+presentation in `NodeModal`: the copied PVE permission snippet must stay
+aligned with the canonical backend setup script, including comma-joined
+privilege transport and non-destructive `PulseMonitor` role updates, instead
+of shipping a stale local fork.
+That same `NodeModal` boundary must also route Proxmox agent-install command
+generation through the canonical `NodesAPI.getAgentInstallCommand` client for
+both PVE and PBS, instead of mixing client-mediated and ad hoc raw POST
+transport for the same backend lifecycle command surface. That same settings
+surface must consume the shared validated response uniformly for both node
+types, surfacing canonical install-command errors inline instead of collapsing
+one pane back to generic notification-only failure.
+That same `NodeModal` boundary must also route Proxmox quick-setup command
+generation and manual setup-script download through canonical `NodesAPI`
+helpers for both PVE and PBS, preserving the shared setup-token and expiry
+contract instead of letting one node type drift onto a raw fetch-only path.
+That same `NodeModal` boundary must also stay on the direct
+`node-setup-settings-surface` proof path, rather than relying only on broad
+lane ownership or downstream command tests to catch lifecycle drift in the
+settings surface.
+That same Proxmox lifecycle transport now explicitly includes the shared
+`frontend-modern/src/api/nodes.ts` client boundary itself: changes to setup
+command or install-command request transport must carry both lifecycle proof
+and the shared API contract instead of staying implicit behind downstream
+consumer tests alone.
+That same lifecycle ownership also covers the setup completion preview's copied Unix
+install handoff in `SetupCompletionPanel`: the first-session install snippet must use the
+same shell-safe URL/token quoting, `curl -fsSL` failure behavior, and
+root-or-sudo privilege wrapper contract as the governed unified install
+surface instead of carrying a stale inline transport variant.
+That same setup-completion install transport must also preserve the canonical
+plain-HTTP continuity rule: when the configured Pulse URL is `http://`, the
+copied Unix install command must carry `--insecure` through the shared host
+install command builder instead of bypassing the lifecycle transport contract
+with local inline shell assembly.
+That same Unix install-command contract also governs backend-generated Proxmox
+install transport in `internal/api/agent_install_command_shared.go`: the
+canonical `/api/agent-install-command` and hosted Proxmox install-command
+surfaces must emit the same root-or-sudo privilege wrapper already required by
+the shared frontend Unix builder, instead of returning a raw `| bash -s --`
+pipeline that drifts from the lane's governed install shape.
+The same lifecycle shell-transport contract also applies to the diagnostics
+container-runtime migration install command in `internal/api/router.go`: that
+response must emit the canonical `--enable-host=false` flag and the governed
+root-or-sudo wrapper, rather than falling back to the stale `--disable-host`
+alias or a raw `curl | sudo bash` pipe that drifts from the managed install
+surface.
+That same diagnostics migration command must stay on the shared backend
+install-command helper path in `internal/api/agent_install_command_shared.go`,
+rather than rebuilding a local shell formatter in `router.go`, so optional
+token omission, plain-HTTP `--insecure`, trailing-slash normalization, and the
+governed privilege wrapper stay aligned with the rest of the lifecycle install
+surface.
+That same lifecycle shell transport also governs the quick setup command
+returned by `/api/setup-script-url`: `config_setup_handlers.go` must emit a
+shell-quoted `curl -fsSL` fetch for the generated setup script, and the
+token-bearing and tokenless variants must come through a shared helper instead
+of open-coding a stale `curl -sSL` pipeline in the handler.
+That same bootstrap route must also stay on one canonical request shape:
+`/api/setup-script-url` accepts a single JSON object with only the supported
+request fields, and the handler must fail closed on unknown fields or trailing
+JSON instead of tolerating typo-compatible or concatenated payloads.
+That same request contract also keeps backup-permission semantics explicit:
+`backup_perms` / `backupPerms` is a PVE-only bootstrap option, and both
+`/api/setup-script` and `/api/setup-script-url` must reject it for PBS instead
+of quietly carrying a no-op flag through the canonical setup surface.
+That same bootstrap request boundary must stay canonical on host identity too:
+`/api/setup-script` no longer generates placeholder-host scripts for later
+repair, and both setup routes must reject missing `host` input instead of
+minting artifacts that can only fail closed after download.
+That same request boundary must stay canonical on Pulse identity too:
+`/api/setup-script` no longer reconstructs `pulse_url` from the request-local
+origin, and both setup routes must require the explicit canonical Pulse URL
+that the rest of the bootstrap envelope already carries through `url`,
+`command*`, and downstream auto-register state.
+That same bootstrap boundary must now also stay canonical on identity: the
+request must carry a supported `type` and non-empty `host`, the backend must
+normalize that host before minting the one-time setup token, and both
+installer-owned and runtime-side Unified Agent callers must validate the returned
+bootstrap `type`, normalized `host`, and live `expires` metadata before they
+trust the returned `setupToken`. That consumer-side validation must fail closed
+on already-expired bootstrap responses rather than treating any non-empty
+`expires` field as usable. That same `/api/setup-script-url` request boundary
+must also stay truthful about auth: setup tokens only bootstrap the later
+`/api/setup-script` and `/api/auto-register` flows, while the setup-script-url
+request itself remains a normal authenticated request once Pulse auth exists.
+Those same installer-owned and runtime-side Unified Agent callers must also require the
+full canonical bootstrap artifact, including token-bearing `downloadURL` and
+masked `tokenHint`, so they do not keep accepting an older reduced setup-token
+response shape after the runtime and shared settings client have moved to the
+full envelope.
+The shared settings/frontend consumer in `frontend-modern/src/api/nodes.ts`
+must stay on that same canonical bootstrap contract too, normalizing and
+validating the returned setup-script-url identity fields instead of exposing a
+raw JSON passthrough to `NodeModal` and related quick-setup surfaces. That
+shared frontend consumer must also reject already-expired setup-script-url
+responses instead of treating any positive `expires` value as sufficient, and
+it must validate the returned `setupToken` without retaining that raw secret
+beyond the shared client boundary.
+`NodeModal.tsx` must then consume that canonicalized response directly,
+including copying the token-bearing `commandWithEnv` field while rendering the
+non-secret `commandWithoutEnv` preview instead of re-interpreting the
+bootstrap payload through local nullable fallbacks.
+Operator-facing quick-setup display must also stay on the runtime-owned token
+boundary: the shared frontend client must require masked `tokenHint`, and
+`NodeModal.tsx` must render that hint rather than the full returned
+`setupToken` once the bootstrap artifact itself already carries the live
+secret. That non-secret preview contract applies to both the PVE and PBS
+quick-setup panes; the settings surface may not let one path keep rendering
+the token-bearing command after the other has switched to the governed
+`commandWithoutEnv` preview. Operator guidance on those panes must stay
+truthful too: once the visible UI only shows a masked hint, copy-success text
+may not instruct the operator to paste a token "shown below" and must instead
+state that the copied command already embeds the one-time setup token. The same settings quick-setup surface must also trim and validate the Endpoint URL
+before manual setup-script download, so download and copy paths stay on the
+same canonical host-input contract. That same manual download path must also
+stay on one shell-script artifact contract: `/api/setup-script` responses must
+ship with canonical `text/x-shellscript` attachment headers and deterministic
+`pulse-setup-*.sh` filenames, while `frontend-modern/src/api/nodes.ts` and
+`NodeModal.tsx` must validate and use the returned content type and filename
+instead of inventing local text/plain download metadata.
+Manual download must also stay non-interactive without re-exposing raw setup
+tokens in UI state: `/api/setup-script-url` must return a dedicated
+token-bearing `downloadURL`, and the shared frontend client plus `NodeModal`
+must use that runtime-owned download artifact instead of fetching the plain
+script `url` and then relying on a separately displayed token value.
+That same settings quick-setup surface must also treat `/api/setup-script-url`
+as one canonical bootstrap artifact per active host/type/mode: copy and manual
+download must reuse the returned `url`, `downloadURL`, `scriptFileName`,
+`commandWithEnv`, `tokenHint`, and `expires` until the artifact expires or the
+operator changes the endpoint, instead of re-fetching and rebuilding a second
+local download path or caching the raw setup token past the shared frontend
+client.
+That same public/operator guidance must also describe that canonical bootstrap
+artifact truthfully: API docs and Proxmox/PBS setup guides may not fall back to
+stale raw `curl -sSL ... | bash` examples or omit the returned bootstrap
+artifact fields once the runtime and settings surfaces are contractually using
+`url`, `scriptFileName`, `command*`, `setupToken`, and `expires`.
+That same bootstrap response boundary must also own the setup-script filename
+before download happens: `/api/setup-script-url` must return the canonical
+`scriptFileName`, and the settings quick-setup surface must use that runtime
+metadata for operator guidance instead of hardcoded PVE/PBS script names that
+can drift from the downloaded artifact.
+That same setup-token bootstrap response must also stay coherent for the
+non-frontend consumers: the runtime-side Unified Agent and installer Proxmox registration must
+reject missing or mismatched canonical `url`, `scriptFileName`, `command`,
+`commandWithEnv`, and `commandWithoutEnv` fields instead of consuming
+`/api/setup-script-url` as a token-only response.
+That same quick-setup transport must also preserve the governed root-or-sudo
+continuity used by the install surface: `/api/setup-script-url` commands must
+execute `bash` directly when already root and fall back to `sudo` otherwise,
+including preserving `PULSE_SETUP_TOKEN` through the sudo path instead of
+assuming operators are already in a root shell.
+That same transport rule also applies to the generated PVE and PBS setup
+scripts themselves: operator-facing retry and off-host rerun guidance printed
+by `HandleSetupScript` must advertise the same fail-fast `curl -fsSL` fetch
+shape instead of drifting back to stale `curl -sSL` examples inside the script
+body.
+That embedded guidance must preserve the same root-or-sudo continuity too, so
+the script body does not hand operators a direct-root-only retry command after
+the API response itself already supports both execution paths.
+That same retry guidance must also preserve `PULSE_SETUP_TOKEN` continuity
+through both the direct-root and sudo paths, so reruns from the generated PVE
+and PBS setup scripts stay on the same non-interactive setup-token contract
+instead of silently falling back to an interactive prompt.
+That same rerun-token contract must also hydrate `PULSE_SETUP_TOKEN` from any
+embedded setup token before the script prints rerun guidance, so generated
+PVE/PBS scripts issued with canonical `setup_token` transport do not drop back
+to prompt mode on the next hop.
+That same setup-script bootstrap boundary must keep one token name end to end:
+`/api/setup-script` accepts only the canonical `setup_token` query when a token
+is embedded into the script payload, and the rendered PVE/PBS script body uses
+only `PULSE_SETUP_TOKEN` instead of lane-local alias variables.
+The same generated PVE setup-script boundary must also preserve cleanup
+continuity for discovered legacy tokens: when the script offers to remove old
+Pulse tokens from the same server scope, it must iterate the actual discovered
+`pve` and `pam` token lists instead of falling through an undefined placeholder
+loop variable that turns cleanup into a no-op. That discovery path must also
+reuse the canonical Pulse-managed token prefix for the active Pulse URL, while
+still matching legacy timestamp-suffixed variants, instead of rebuilding a
+lane-local IP-pattern guess that drifts from `buildPulseMonitorTokenName`.
+The generated PBS setup-script boundary must preserve that same cleanup
+discovery contract instead of keeping a separate IP-pattern matcher for old
+token cleanup.
+That same generated setup-script boundary must also use exact token-name
+matching when it decides whether to rotate an existing Pulse-managed token, so
+reruns do not treat partial-name collisions as the canonical managed token.
+The generated PBS setup-script branch must also keep token-copy guidance
+truthful: it may only print the one-time token-copy banner after token creation
+has actually succeeded, not ahead of a failure path that produced no token.
+That same generated PBS setup-script branch must also keep auto-register
+attempt guidance truthful: it may only print the attempt banner on the real
+request path, after token-availability and setup-token gating are resolved,
+rather than before a skip branch that never sends a registration request.
+That same rerun path must also preserve the backend-owned encoded setup-script
+request URL: embedded `SETUP_SCRIPT_URL` values in generated setup scripts must
+keep the canonical `host`, `pulse_url`, and `backup_perms` query contract
+instead of rebuilding a lossy raw query string inside the shell.
+That same off-host fallback path must not invent a second manual token-creation
+workflow either: when the script is run outside a Proxmox host, it must direct
+the operator back to rerun on the host through the canonical generated command
+instead of teaching a separate `pveum` + Pulse Settings flow that can drift
+from the backend-owned lifecycle contract.
+That same runtime boundary must also preserve canonical privilege guidance when
+the script is launched directly: generated setup scripts may not fall back to
+the stale "Please run this script as root" wording, and must instead use the
+same root requirement language already carried by the governed retry wrapper.
+That same manual-follow-up surface must also preserve one canonical token
+placeholder contract across its adjacent branches: generated PVE and PBS setup
+scripts may not drift between "[See above]", "Check the output above...", and
+other local variants when the token value is only available in prior output.
+That same completion boundary must also preserve one canonical success message
+across generated PVE and PBS setup scripts, so identical successful
+auto-register outcomes do not surface different node-type-specific wording for
+the same finished lifecycle state.
+That same auto-register boundary must also fail closed when token extraction
+fails after token creation: generated PVE and PBS setup scripts may not
+continue into prompt or request assembly with an empty token value, and must
+instead stop on the canonical "token value unavailable" branch before any
+registration attempt is formed.
+That same PBS auto-register path must also report skipped states truthfully:
+when setup-token input is absent or token extraction never produced a usable
+secret, the script may not relabel that skip as a failed request before
+success confirmation.
+The generated PVE and PBS setup scripts must also fail closed on
+auto-register success detection: their runtime branch may only treat a
+response as successful when it contains an explicit `success:true` signal,
+rather than any broad `success` substring match that could misclassify
+`success:false` payloads as a completed registration.
+That same auto-register path must also fail closed on HTTP and transport
+errors: the generated scripts must use fail-fast `curl -fsS` transport and
+gate success parsing on a successful curl exit code instead of interpreting
+arbitrary error output as a registrable response body.
+That same generated setup-script boundary must also preserve setup-token
+messaging continuity: when auto-register authentication fails, operator
+guidance must point back to the one-time Pulse setup token flow rather than
+telling the user to provide or validate an API token that this script path no
+longer uses.
+That same auth-failure guidance must also stay truthful once the generated
+setup script has already sent a registration request: it may not branch back
+into a missing-token explanation after the request path proves a setup token
+was present, and must instead direct the operator to mint a fresh setup token
+from Pulse Settings → Nodes and rerun. That same auth-failure state must also
+block the later manual-details footer, so the script does not immediately
+contradict itself by offering manual completion with the current token details.
+That same completion boundary must also preserve outcome truth: generated PVE
+and PBS setup scripts may only claim successful Pulse registration when
+auto-register actually succeeded, and must otherwise present the result as
+token setup plus manual registration follow-up instead of announcing a false
+successful onboarding state.
+That same manual-follow-up path must also stay on the canonical node-add
+contract: generated setup scripts may not redirect operators onto a stale
+secondary registration-token rerun flow, and must instead point them to finish
+registration with the emitted token details in Pulse Settings → Nodes.
+That same manual-follow-up path must also keep its failure summary on that
+canonical node-add contract: generated setup scripts may not fall back to
+vague "manual configuration may be needed" copy when the emitted token details
+already define the exact Pulse Settings → Nodes completion path.
+That same manual-follow-up path must also preserve the canonical node host
+identity already in scope for the script, rather than falling back to a stale
+placeholder host string that forces the operator to reconstruct the node
+address by hand.
+That same host continuity rule applies to PBS as well: generated setup scripts
+may not replace the requested canonical PBS host with runtime-local interface
+discovery in the manual-add footer, because DHCP or multi-NIC nodes can make
+that fallback diverge from the host the operator actually intended to register.
+That same PBS host continuity must survive auth-skip and token-skip fallback
+branches too: the generated script must bind the canonical PBS host before any
+auto-register gating that can short-circuit into manual completion, so the
+manual footer never emits a blank or lost host URL when setup-token input is
+missing.
+That same fail-closed host rule must also apply when the script never received
+any canonical host at all: generated PVE and PBS scripts may not fall back to
+placeholder host values in manual completion and must instead direct the
+operator to regenerate the script with a valid host URL.
+That same PBS host binding must exist before token-creation failure fallback as
+well, so the final manual footer still preserves the canonical requested host
+even when the script cannot mint a usable PBS token and never reaches the
+auto-register branch at all.
+Generated PVE and PBS setup scripts must also fail closed on token-creation
+failure truth: if Proxmox token minting fails, the script may not continue into
+fake manual token details or claim token setup completed. It must skip
+auto-register, surface the token-creation failure explicitly, and direct the
+operator to rerun after fixing the node-local token error.
+That same failure-truth contract also applies to token extraction errors after
+creation output is returned: generated setup scripts may not tell operators
+that manual registration might still work from that broken output. They must
+keep the flow on rerun-after-fix guidance until a usable token value actually
+exists, and the final completion footer/manual-details branch must key off that
+usable-token state rather than raw token-create success.
+That same manual-follow-up path must also preserve canonical Settings-surface
+language across both PVE and PBS setup scripts, so the operator is always
+directed back to Pulse Settings → Nodes with the emitted token details instead
+of drifting onto lane-local wording for one node type.
+That same canonical path must also hold inside the immediate auto-register
+failure branch itself, so generated scripts do not fall back to a shorter
+"Pulse Settings" variant before the final manual-completion footer repeats the
+correct Settings → Nodes destination or diverge into a separate numbered
+manual-setup detour instead of reusing the same "use the token details below"
+completion contract. That includes transport/request failures before the
+backend ever returns a response body, not just explicit error payloads.
+That same `SetupCompletionPanel` transport must also preserve the governed self-signed
+and private-CA continuity controls used by the shared lifecycle command
+surface: the first-session setup-completion install handoff must pass explicit
+`--insecure` and `--cacert` choices through the shared Unix install builder so
+the very first installer fetch and the installer runtime stay aligned with the
+same transport contract as `InfrastructureOperationsController.tsx`. In explicit insecure mode, that
+means the outer `curl` fetch must widen to `-kfsSL` instead of preserving
+strict TLS until `install.sh` starts.
+That same first-session install surface must also preserve canonical
+agent-to-Pulse addressing, not just browser-local origin: `SetupCompletionPanel` must
+default to the governed security status `agentUrl` when available and allow an
+operator override for agent connectivity, so setup-completion commands do not
+silently hand out loopback or wrong-origin install transport.
+That same first-session surface must also preserve Windows install parity:
+`SetupCompletionPanel` may not stop at Unix-only shell transport while claiming Windows
+coverage. Its PowerShell install command must route through the shared
+transport helper so URL, token, insecure-TLS, and custom-CA behavior stay
+aligned with `InfrastructureOperationsController.tsx`.
+That same first-session setup-completion surface also owns the operator's v6
+mental model for Unified Agent onboarding: `SetupCompletionPanel` must teach that one
+Unified Agent install creates one canonical Pulse system resource first, then
+layers workload discovery and API-linked platform context onto that same
+inventory. It may not present Docker, Kubernetes, Proxmox, or TrueNAS as
+competing primary onboarding paths, nor fall back to logo-led feature
+brochure copy that obscures the unified-resource contract the wizard is
+supposed to introduce.
+That same first-session setup-completion surface must also honor the lane's
+optional-auth install contract: when Pulse does not require API tokens, the
+wizard may switch to tokenless install commands only after an explicit operator
+confirmation, but it must preserve the generated token by default and keep that
+explicit token path available instead of collapsing onboarding into tokenless-only
+transport. Once the operator has explicitly chosen tokenless mode, repeated
+wizard copies must preserve that tokenless choice instead of silently rotating
+back onto token-auth transport after the first clipboard action. That same
+tokenless choice must also survive the wizard's background "agent connected"
+token-rotation path: new agent arrivals may not regenerate a token or flip the
+surface back to token-auth mode while explicit tokenless onboarding remains the
+active contract.
+That same wizard boundary must also keep its credentials drawer and exported
+credentials file aligned with the current rotated install token, rather than
+continuing to display or download the stale bootstrap token after the install
+command surface has already moved on. It must do that without erasing the
+stable bootstrap admin API credential: the wizard needs to preserve both the
+admin token and the current rotated install token as separate operator-visible
+surfaces instead of collapsing them into one mutable credential slot. The saved
+credentials handoff must also preserve the current agent-install URL and the
+matching install command shape for both Unix and Windows onboarding, so
+exported first-session material cannot drift back to browser-local login
+context or Unix-only transport while the live wizard command surface is using
+a governed or operator-overridden agent endpoint. When the operator explicitly
+confirms tokenless optional-auth mode, those same credential surfaces must stop
+claiming a current install token and instead present tokenless install mode as
+the active onboarding contract. The primary install guidance text in the wizard
+must switch with that mode as well: tokenless onboarding may not keep
+advertising automatic token rotation after each copy once the active transport
+is explicitly tokenless.
+That same `SetupCompletionPanel` boundary must also stay on the direct
+`setup-completion-install-surface` proof path, rather than relying only on shared
+helper coverage or downstream install tests to catch lifecycle drift in the
+setup completion surface.
+The same ownership also covers manual install fallback in the infrastructure
+settings surface: active and ignored Connected infrastructure rows must now
+come from the backend-owned `connectedInfrastructure` projection instead of a
+frontend-local merge of raw unified-resource facets and removed runtime arrays,
+and v6 clients no longer treat those removed runtime arrays as a parallel
+settings contract, so lifecycle scope and reconnect behavior stay canonical
+across host, Docker, and Kubernetes reporting.
+deploy results surface: `ResultsStep` must request the canonical backend
+install command from `/api/agent-install-command` for failed deploy targets
+instead of rebuilding a local shell snippet that can drift from the governed
+installer contract. That fallback surface must consume the shared validated
+`NodesAPI.getAgentInstallCommand` response, so malformed backend payloads fail
+closed and the raw backend install token stays inside the shared client
+boundary rather than leaking into deploy UI state.
+That same `ResultsStep` boundary must also stay on the direct
+`deploy-fallback-install-surface` proof path, rather than relying only on the
+shared install helper or downstream deploy tests to catch lifecycle drift in
+the infrastructure fallback surface.
+The same Windows install, upgrade, and uninstall copies must also preserve
+operator-selected transport and capability toggles: if the settings surface
+enables insecure TLS mode or Pulse command execution, the PowerShell path must
+carry `PULSE_INSECURE_SKIP_VERIFY` and `PULSE_ENABLE_COMMANDS` through to the
+installer where those settings apply, so Windows agents do not diverge from the
+governed shell transport.
+That same copied install transport must also normalize canonical base URLs
+before composing installer asset paths: when operators enter a trailing-slash
+Pulse URL, shell and PowerShell install commands must trim it before appending
+`/install.sh` or `/install.ps1` so lifecycle transport does not drift onto
+double-slash asset paths.
+That same shared install-command transport must also fail closed on blank local
+overrides: whitespace-only custom Pulse endpoint input in `InfrastructureOperationsController.tsx`
+or `SetupCompletionPanel.tsx` may not override the canonical backend-governed
+endpoint, and shared command builders must reject blank endpoint URLs instead
+of composing `/install.sh` or `/install.ps1` from an empty base.
+That same copied upgrade boundary must preserve canonical runtime identity when
+inventory already knows it: shell upgrade payloads must carry `--agent-id` and
+`--hostname`, and PowerShell upgrade payloads must carry `PULSE_AGENT_ID` and
+`PULSE_HOSTNAME`, so rerunning an upgrade does not silently collapse back to
+local-machine identity.
+Copied per-agent uninstall commands must also preserve the selected agent's
+canonical identity instead of relying on local fallback discovery alone: when
+inventory already knows the agent ID for the chosen row, the shell and
+PowerShell uninstall payloads must carry that ID through to the installer so
+managed removal deregisters the intended agent record even if local state or
+hostname lookup is stale.
+That same uninstall continuity must preserve canonical hostname fallback too:
+copied shell uninstall payloads must carry `--hostname`, copied PowerShell
+uninstall payloads must carry `PULSE_HOSTNAME`, and both installer runtimes
+must prefer that explicit hostname during lookup fallback before querying local
+machine identity.
+That governed hostname lookup fallback must also normalize query transport:
+both installer runtimes must percent-encode the resolved hostname before
+calling `/api/agents/agent/lookup`, so canonical identity recovery does not
+drift on hostnames that contain spaces or other query-significant characters.
+That same copied uninstall transport must also fail closed under required auth:
+when Pulse requires API tokens, shell and PowerShell uninstall commands must
+carry the same resolved token contract as install and upgrade instead of
+silently degrading to tokenless deregistration transport.
+That same copied Unix lifecycle transport must also preserve shell-safe
+canonical identity: shell uninstall and upgrade commands must quote the
+selected URL, token, agent ID, and hostname as command arguments instead of
+interpolating raw inventory values into the shell line.
+That same copied Windows lifecycle transport must also preserve
+PowerShell-safe canonical identity: uninstall and upgrade commands must escape
+selected URL, token, agent ID, and hostname values before placing them into
+PowerShell env assignments or command text.
+The same transport rule applies to copied install commands: shell install
+payloads must quote canonical URL/token transport, and PowerShell install
+payloads must escape URL/token values before they enter env assignments or
+`irm` command text. The same Windows upgrade boundary must quote the resolved
+PowerShell script URL as well, so canonical URLs with spaces or other
+PowerShell-significant characters do not break copied upgrade transport after
+the env assignments have already been escaped.
+That same copied lifecycle transport must also preserve explicit custom CA
+trust whenever the operator provides it: shell install, upgrade, and uninstall
+commands must pass `--cacert` to both the outer installer download and the
+installer runtime, while Windows install, upgrade, and uninstall commands must
+emit `PULSE_CACERT` and fetch `install.ps1` through a transport-aware
+PowerShell bootstrap that honors insecure-TLS or custom-CA settings on the
+first script download instead of only after the installer has already started.
+That bootstrap parity must match the installer's accepted trust formats too:
+Windows copied commands must treat `PULSE_CACERT` as the same PEM/CRT/CER
+certificate input that `scripts/install.ps1` accepts, rather than narrowing
+the first-hop bootstrap to constructor-only certificate formats.
+That same unified settings shell install and upgrade transport must also
+preserve plain-HTTP continuity automatically: when the selected Pulse URL uses
+`http://`, copied Unix commands must append `--insecure` even without the
+manual TLS-skip toggle, while only the explicit TLS-skip toggle may widen curl
+itself to `-k`.
+That same unified settings installer surface must not drift between preview and
+clipboard transport: the rendered Linux/macOS/BSD and Windows install snippets
+must already include the active token choice, custom-CA trust, insecure/plain-
+HTTP handling, install-profile flags, and command-execution mode instead of
+displaying one command and mutating it only during copy.
+That same Windows install boundary must preserve the canonical server URL even
+for the interactive PowerShell snippet: copied commands that still prompt for a
+token must export `PULSE_URL` before invoking `install.ps1`, so the selected
+agent-to-Pulse address cannot drift back to a default prompt target.
+When the operator has already generated or selected a token, that same
+interactive Windows install snippet must preserve the selected token in copied
+transport as well, rather than silently dropping back to a second manual token
+prompt while every other lifecycle command stays bound to the chosen credential.
+The inverse must also hold: token-required instances without a selected token
+must keep that interactive Windows snippet prompt-driven instead of exporting a
+placeholder `PULSE_TOKEN` value into copied transport.
+That same rule applies to copied Windows uninstall transport: after `PULSE_URL`
+is escaped into env assignments, the uninstall path must still quote the
+resolved `install.ps1` URL so canonical URLs with spaces remain valid
+PowerShell transport during deregistration and removal.
+For the shell installer, that continuity must also survive beyond the original
+clipboard command: when install or upgrade runs with explicit `--agent-id` or
+`--hostname`, `scripts/install.sh` must persist those values into its saved
+connection state and recover them during later offline uninstall instead of
+dropping back to ambient local discovery.
+That same lifecycle-owned `connection.env` contract must also stay on one
+installer-owned helper path: `scripts/install.sh` may not write the state file
+one way and then recover it through a separate field-by-field inline parser,
+because lifecycle ownership requires one canonical reader/writer for persisted
+install identity and trust metadata.
+That same lifecycle ownership must cover service control too: the installer may
+still choose different platform adapters, but stop/restart semantics for the
+managed agent must route through shared installer helpers instead of being
+re-authored in each upgrade, systemd, OpenRC, SysV, or FreeBSD branch.
+That same rule applies to teardown: uninstall and reinstall cleanup may not
+rebuild disable/remove flows inline per platform. Shared installer helpers
+must own service stop/disable/remove semantics for systemd, OpenRC, SysV, and
+service-command runtimes so lifecycle cleanup stays canonical.
+The same lifecycle rule applies to TrueNAS bootstrap too: boot-time recovery
+for SCALE and CORE may only vary at the service-manager adapter, while binary
+sync, service-link recreation, and startup sequencing stay on one
+installer-owned renderer instead of drifting across separate embedded scripts.
+That same lifecycle ownership must also cover service definition rendering:
+systemd and FreeBSD rc.d files may not preserve parallel heredoc definitions
+for the same agent runtime contract. Shared installer renderers must own the
+common service shape, with platform branches only choosing the correct runtime
+path, dependency targets, and logging adapter.
+That same lifecycle rule also applies to installer completion: success,
+unhealthy, and upgrade result handling may not drift by platform branch.
+Shared installer helpers must own the save-state handoff, health verification,
+canonical completion `json_event` output, and uninstall guidance instead of
+letting each service-manager branch narrate those outcomes separately.
+The same lifecycle rule applies to FreeBSD enablement too: direct rc.d install
+and TrueNAS CORE boot recovery may not mutate `pulse_agent_enable` through
+separate inline snippets. A shared installer-owned rc.conf enablement helper
+must own that contract so lifecycle recovery and direct installs do not drift,
+and that helper must execute the shared snippet in-process instead of defining
+it in a discarded subshell.
+The same rule applies to SysV registration: direct install may not keep its own
+inline `update-rc.d` / `chkconfig` / manual symlink block while teardown owns a
+separate canonical removal path. Shared installer helpers must own SysV
+enablement and disablement semantics as one lifecycle contract.
+The same durability rule applies to `scripts/install.ps1`: when Windows install
+or upgrade runs with explicit agent or hostname identity, the installer must
+persist that connection state under ProgramData and recover it during later
+uninstall before falling back to machine-local discovery.
+That Windows installer-owned continuity state is only valid for the currently
+installed agent. After a successful uninstall, `scripts/install.ps1` must clear
+its ProgramData state so later reruns cannot inherit stale identity or transport
+context from a removed node.
+That persisted installer-owned state must also retain self-signed transport
+intent: when install or upgrade ran in insecure TLS mode, later offline
+uninstall must recover that mode from saved state instead of silently
+reverting to strict certificate validation.
+For the shell installer, the same offline transport continuity also applies to
+custom CA trust: when install or upgrade ran with `--cacert`, later offline
+uninstall must recover that saved CA bundle path before reaching for governed
+lookup or deregistration transport.
+The Windows installer must now preserve the same installer-owned custom CA
+transport continuity for its own network calls: when install or upgrade ran
+with `PULSE_CACERT`, later offline uninstall must recover that saved CA
+certificate path before governed lookup or deregistration falls back to
+strict default trust.
+That same Windows custom-CA continuity must also reach the long-lived unified
+agent runtime: `scripts/install.ps1` must persist `--cacert` into the managed
+service arguments, and `pulse-agent` must apply that bundle to updater,
+remote-config, Unified Agent report, and command-channel HTTPS transport instead
+of limiting `PULSE_CACERT` to installer-owned download and uninstall traffic.
+That saved shell uninstall recovery must not depend only on a missing URL or
+token. When the operator reruns uninstall with only partial CLI context, the
+installer must still reload any missing persisted agent, hostname, insecure-TLS,
+or custom-CA continuity before governed lookup or deregistration falls back to
+ambient local state.
+That same insecure-TLS continuity must hold during the Windows installer's own
+network traffic, not only in the persisted service args: when the operator
+selects insecure mode, `scripts/install.ps1` must also relax certificate
+validation for its binary download and uninstall deregistration requests so
+PowerShell transport can reach self-signed Pulse instances end to end.
+The same copied install and upgrade commands must also fail closed on
+token-optional Pulse instances: when the server does not require API tokens,
+the command builder must omit token arguments entirely instead of serializing a
+fake sentinel token value into shell or PowerShell install transport.
+That token-optional settings path must still preserve explicit governed token
+selection when the operator generates one anyway: optional auth widens the
+contract to allow tokenless transport, but it must not erase or suppress a real
+selected token and force copied install commands back to tokenless-only mode.
+The installer scripts themselves must honor that same optional-auth contract:
+`scripts/install.sh` and `scripts/install.ps1` must accept a missing token and
+persist service arguments without `--token` on token-optional Pulse instances,
+instead of advertising a no-token flow in settings while the installer still
+fails validation at runtime.
+That same optional-auth install contract also applies to backend-generated
+Proxmox install commands in `internal/api/config_setup_handlers.go` and
+`internal/api/agent_install_command_shared.go`: when Pulse auth is not
+configured, the canonical agent-install-command API must return tokenless
+install transport and must not persist a new API token record just because an
+operator opened a backend-driven install surface.
+The same optional-auth continuity must hold after install as well: Unified Agent
+runtime startup may not reject a blank token unless enrollment is explicitly
+enabled, agent report transport must omit auth headers when no token is
+configured, and Proxmox auto-register flows must still complete without
+serializing an empty token header on token-optional Pulse instances.
+That same runtime-side reporting boundary must keep its product terminology
+canonical in active comments and operator-facing logs: `internal/hostagent/`
+may remain a package-location fact, but successful and failed report transport
+must describe the runtime as the Unified Agent rather than reintroducing
+"host agent" wording into v6 operator guidance.
+That same post-install optional-auth contract must also hold during managed
+removal: uninstall and deregistration flows must still notify Pulse with the
+canonical agent-uninstall payload when URL and agent identity are known, and
+must only attach API-token headers when a real token exists instead of
+silently skipping deregistration on token-optional installs.
+The same settings/profile boundary must also preserve assigned-profile
+continuity when a referenced profile is no longer present in the fetched
+profile list: assignment controls must keep the missing profile visible as the
+current state instead of collapsing the agent back to a false default-looking
+selection.
+That same uninstall-command boundary must also preserve platform-canonical
+transport in copied utility actions: Windows agents must receive the
+PowerShell uninstall flow, and copied uninstall payloads must never substitute
+an API token record ID where the runtime expects the real token secret for
+server-side deregistration.
+The same rule applies to Unix shell uninstall commands in the shared fleet
+settings surface: copied uninstall payloads may include only a real token
+secret when one is available, and must never fall back to token record IDs or
+other settings-only identifiers that the installer runtime cannot authenticate.
+Token-optional Windows uninstall commands must also preserve the canonical
+server URL in `PULSE_URL`; otherwise the PowerShell installer can remove the
+service locally while losing the deregistration path back to Pulse.
+
+Shared `internal/api/` resource helpers now also expose governed
+policy-aware resource metadata. Agent lifecycle and fleet-control surfaces may
+consume canonical `policy` and `aiSafeSummary` fields from unified resource
+payloads when they need resource context, but they must not fork their own
+sensitivity-classification or local-vs-cloud routing heuristics on the same
+runtime boundary.
diff --git a/docs/release-control/v6/internal/subsystems/ai-runtime.md b/docs/release-control/v6/internal/subsystems/ai-runtime.md
new file mode 100644
index 0000000000..7c9ea1bf42
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/ai-runtime.md
@@ -0,0 +1,128 @@
+# AI Runtime Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "ai-runtime",
+ "lane": "L6",
+ "contract_file": "docs/release-control/v6/internal/subsystems/ai-runtime.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own Pulse Assistant and Patrol backend runtime behavior, AI orchestration,
+runtime cost control, and shared AI transport surfaces.
+
+## Canonical Files
+
+1. `internal/ai/`
+2. `internal/api/ai_handler.go`
+3. `internal/api/ai_handlers.go`
+4. `internal/api/ai_intelligence_handlers.go`
+5. `frontend-modern/src/api/ai.ts`
+6. `frontend-modern/src/api/patrol.ts`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/api/ai.ts` shared with `api-contracts`: the AI frontend client is both an AI runtime control surface and a canonical API payload contract boundary.
+2. `frontend-modern/src/api/patrol.ts` shared with `api-contracts`: the Patrol frontend client is both an AI runtime control surface and a canonical API payload contract boundary.
+3. `internal/api/ai_handler.go` shared with `api-contracts`: Pulse Assistant handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+4. `internal/api/ai_handlers.go` shared with `api-contracts`: AI settings and remediation handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+5. `internal/api/ai_intelligence_handlers.go` shared with `api-contracts`: AI intelligence handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+
+## Extension Points
+
+1. Add or change chat runtime, Patrol orchestration, findings generation, or remediation behavior through `internal/ai/`
+2. Add or change Pulse Assistant request flow through `internal/api/ai_handler.go` and `frontend-modern/src/api/ai.ts`
+3. Add or change Patrol, alert-analysis, or remediation transport through `internal/api/ai_handlers.go`, `internal/api/ai_intelligence_handlers.go`, and `frontend-modern/src/api/patrol.ts`
+
+## Forbidden Paths
+
+1. Leaving new `internal/ai/` runtime entry points unowned under broad architecture or generic API ownership
+2. Duplicating AI orchestration, Patrol runtime, or cost-tracking logic outside `internal/ai/`
+3. Treating AI transport files as payload-only boundaries when they also define live runtime control behavior
+
+## Completion Obligations
+
+1. Update this contract when canonical AI runtime or transport entry points move
+2. Keep AI runtime and shared API proof routing aligned in `registry.json`
+3. Preserve explicit coverage for chat, Patrol, remediation, and cost-control behavior when AI runtime changes
+
+## Current State
+
+This subsystem now makes Pulse Assistant and Patrol backend runtime ownership
+explicit inside the current architecture lane instead of leaving those
+surfaces implicit inside broad architecture or generic API ownership. A later
+lane split can still promote this area into its own product lane once the
+governed floor is ready.
+
+`internal/ai/` is the live backend AI engine. It owns chat execution, Patrol
+orchestration, findings generation, investigation support, quickstart and
+provider selection, remediation flow, and cost persistence.
+
+The AI transport files are shared with `api-contracts`, not delegated away to
+it. `frontend-modern/src/api/ai.ts`,
+`frontend-modern/src/api/patrol.ts`,
+`internal/api/ai_handler.go`,
+`internal/api/ai_handlers.go`, and
+`internal/api/ai_intelligence_handlers.go` are runtime control surfaces for
+the AI product while also remaining canonical payload contract boundaries.
+The same ownership includes the Pulse query tool schema under
+`internal/ai/tools/`: topology-query input names must stay canonical inside
+the AI runtime itself, so new tool arguments such as `max_proxmox_nodes`
+cannot reintroduce parallel legacy aliases once the backend query contract is
+renamed.
+Tenant-scoped AI services must now also follow canonical runtime ownership:
+Patrol may initialize and operate from tenant `ReadState` and unified-resource
+providers without requiring a tenant snapshot-provider bridge, and
+`internal/api/ai_handlers.go` must not mint tenant-local `StateSnapshot`
+adapters purely to satisfy Patrol when canonical tenant read-state is already
+available.
+That same AI ownership also extends to persisted runtime state under
+`internal/config/persistence.go`: AI findings, usage history, patrol run
+history, and chat sessions must not keep legacy plaintext files on the runtime
+primary path once the process can read them. Plaintext AI persistence files may
+only serve as migration input and must be rewritten immediately into
+encrypted-at-rest storage on load.
+The same migration-only rule applies to guest knowledge under
+`internal/ai/knowledge/`: legacy `.json` knowledge files and plaintext `.enc`
+knowledge files may only serve as migration input, and the knowledge store
+must rewrite canonical encrypted-at-rest storage immediately on load instead
+of leaving guest knowledge plaintext on disk until a future note update.
+That trust boundary also applies when the store is constructed: if the
+knowledge store cannot initialize encryption, construction must fail closed
+instead of silently creating a plaintext-at-rest runtime store.
+
+Unified-resource-backed AI context now also consumes the canonical
+policy-aware metadata contract. The AI runtime may summarize governed resource
+policy counts for context, and it must switch to `aiSafeSummary` when a
+resource is marked `local-only` instead of leaking raw resource names or local
+identifiers for restricted resources through ad hoc context formatting.
+That same policy boundary now applies to chat structured-mention prefetch and
+resource-summary formatting: mention resolution must consume canonical
+unified-resource policy metadata, skip discovery fan-out when governed
+redaction already blocks cloud-safe raw context, and withhold routing
+coordinates, bind-mount paths, hostnames, and discovery file paths whenever
+resource policy marks those identifiers as redacted.
+The same governed-context rule also applies to the main unified AI resource
+overview: infrastructure, workload, alert-label, and top-consumer summaries
+must not leak raw resource names, cluster labels, IP addresses, or unresolved
+topology identifiers once canonical resource policy marks aliases, hostnames,
+platform IDs, or addresses as redacted. Sensitive resources should remain
+useful through `aiSafeSummary` and explicit redaction markers rather than
+falling back to raw local identifiers in list or summary sections.
+That same governed policy boundary now extends through AI tool payloads and
+chat-memory extraction. Resource-bearing `pulse_query` results must carry the
+canonical `policy` and `ai_safe_summary` fields derived from unified resources,
+and deterministic knowledge extraction must prefer those governed summaries
+when policy redaction covers aliases, hostnames, or platform IDs instead of
+persisting raw resource labels into cached AI facts.
+That same requirement includes `pulse_query action=config`: guest-config
+payloads must carry canonical resource policy metadata, and config-fact
+extraction must not persist raw guest hostnames when governed redaction covers
+hostname or platform identity fields.
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
new file mode 100644
index 0000000000..be7127012d
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -0,0 +1,112 @@
+# Alerts Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "alerts",
+ "lane": "L6",
+ "contract_file": "docs/release-control/v6/internal/subsystems/alerts.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own alert identity, alert specs, evaluation, persistence semantics, and
+operator-facing alert routing behavior for live runtime alerts.
+
+## Canonical Files
+
+1. `internal/alerts/specs/types.go`
+2. `internal/alerts/specs/evaluator.go`
+3. `internal/alerts/canonical_metric.go`
+4. `internal/alerts/canonical_lifecycle.go`
+5. `internal/alerts/unified_incidents.go`
+
+## Shared Boundaries
+
+1. None.
+
+## Extension Points
+
+1. Add new alert rule kinds in `internal/alerts/specs/`
+2. Add typed collector/builders in `internal/alerts/alerts.go`
+3. Add identity/persistence updates through canonical alert helpers only
+
+## Forbidden Paths
+
+1. New ad hoc `Check*`-local evaluator logic
+2. Reintroducing runtime legacy alert-ID contracts
+3. Reintroducing per-family threshold/override merge logic outside the shared path
+
+## Completion Obligations
+
+1. Update alert spec/evaluator tests when a new rule kind is added
+2. Update this contract if alert truth or identity rules change
+3. Route runtime changes through the explicit alert proof policies in `registry.json`; default fallback proof routing is not allowed
+4. Tighten or add guardrails when an old alert path is removed
+
+## Current State
+
+Canonical alert identity and evaluation are the live runtime model. Remaining
+legacy references should exist only in explicit migration or negative test
+boundaries.
+
+Notification transport, provider delivery, queue safety, and notification API
+transport now live under the explicit `notifications` subsystem inside the
+current architecture lane. The alerts surface still owns operator-facing alert
+pages and routing UX, but it does not implicitly own the delivery engine.
+That includes the webhook settings editor: alert UI may present provider setup,
+but canonical service-field ownership such as Pushover `token` / `user`
+normalization belongs to `internal/notifications/` and persistence boundaries,
+not to alert-surface runtime delivery code.
+
+Frontend alert surfaces and backend alert-support files now require explicit
+registry path-policy coverage, so new alert-owned runtime files must be mapped
+to a concrete proof route instead of silently inheriting subsystem-default
+verification.
+
+The alerts schedule surface now also routes quiet-hour suppress-category card
+styling through `frontend-modern/src/utils/alertSchedulePresentation.ts`
+instead of leaving that selectable-card presentation inline in
+`frontend-modern/src/pages/Alerts.tsx`.
+
+Incident-event filter chip and filter-action styling now routes through
+`frontend-modern/src/utils/alertIncidentPresentation.ts` for both
+`frontend-modern/src/pages/Alerts.tsx` and
+`frontend-modern/src/features/alerts/OverviewTab.tsx` instead of allowing
+those alert timeline surfaces to fork their own filter presentation.
+
+Alert incident acknowledged badges, timeline event cards, and note-editor
+presentation now also route through
+`frontend-modern/src/utils/alertIncidentPresentation.ts` instead of remaining
+duplicated inline across the alerts page and overview timeline surfaces.
+
+Alert incident event meta rows and detail text treatments now also route
+through `frontend-modern/src/utils/alertIncidentPresentation.ts` instead of
+keeping duplicate summary/detail typography inline in the alerts page and
+overview timelines.
+
+Resource incident panel cards, summary rows, and toggle-button presentation
+now also route through `frontend-modern/src/utils/alertIncidentPresentation.ts`
+instead of remaining inline inside `frontend-modern/src/pages/Alerts.tsx`.
+
+Active alert card state, acknowledged badge, and primary/secondary action
+button presentation now route through
+`frontend-modern/src/utils/alertOverviewPresentation.ts` instead of remaining
+inline in `frontend-modern/src/features/alerts/OverviewTab.tsx`.
+
+Alert threshold and schedule surfaces must now also treat
+`discoveryTarget` as optional frontend input and keep grouping-card state on
+the canonical `node` group-header contract. Frontend alert pages may not
+assume discovery metadata is always present when deriving override IDs or
+toggle styling.
+
+Alert filter metadata and grouped header consumers must also preserve the
+canonical `agent` and `node` header boundary when reusing shared filter
+primitives. Frontend alert tables may not drift back to ad hoc host-key
+grouping or narrow filter key predicates that drop optional hostname values
+before alert group metadata is derived.
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
new file mode 100644
index 0000000000..23c2fc0c90
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -0,0 +1,1275 @@
+# API Contracts
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "api-contracts",
+ "lane": "L6",
+ "contract_file": "docs/release-control/v6/internal/subsystems/api-contracts.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own canonical runtime payload shapes between backend and frontend.
+
+## Canonical Files
+
+1. `internal/api/contract_test.go`
+2. `internal/api/resources.go`
+3. `internal/api/alerts.go`
+4. `frontend-modern/src/types/api.ts`
+5. `frontend-modern/src/api/responseUtils.ts`
+6. `frontend-modern/src/components/Settings/APITokenManager.tsx`
+7. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`
+8. `frontend-modern/src/components/Settings/UnifiedAgents.tsx`
+9. `frontend-modern/src/utils/agentInstallCommand.ts`
+10. `frontend-modern/src/api/nodes.ts`
+11. `frontend-modern/src/api/license.ts`
+12. `frontend-modern/src/api/monitoredSystemLedger.ts`
+13. `internal/api/monitored_system_ledger.go`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/api/agentProfiles.ts` shared with `agent-lifecycle`: the agent profiles frontend client is both an agent lifecycle control surface and a canonical API payload contract boundary.
+2. `frontend-modern/src/api/ai.ts` shared with `ai-runtime`: the AI frontend client is both an AI runtime control surface and a canonical API payload contract boundary.
+3. `frontend-modern/src/api/nodes.ts` shared with `agent-lifecycle`: the shared Proxmox node client is both an agent lifecycle setup/install control surface and a canonical API payload contract boundary.
+4. `frontend-modern/src/api/notifications.ts` shared with `notifications`: the notifications frontend client is both a notification delivery control surface and a canonical API payload contract boundary.
+5. `frontend-modern/src/api/patrol.ts` shared with `ai-runtime`: the Patrol frontend client is both an AI runtime control surface and a canonical API payload contract boundary.
+6. `frontend-modern/src/api/security.ts` shared with `security-privacy`: the security frontend client is both a security/privacy control surface and a canonical API payload contract boundary.
+7. `frontend-modern/src/api/updates.ts` shared with `deployment-installability`: the updates frontend client is both a deployment-installability control surface and a canonical API payload contract boundary.
+8. `frontend-modern/src/components/Settings/APITokenManager.tsx` shared with `security-privacy`: the API token settings surface is both a security/privacy control surface and a canonical API payload contract boundary.
+9. `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx` shared with `agent-lifecycle`: the infrastructure operations controller is both an agent fleet lifecycle control surface and an API token, lookup, assignment, and reporting/install contract boundary.
+10. `frontend-modern/src/components/Settings/UnifiedAgents.tsx` shared with `agent-lifecycle`: the UnifiedAgents module is a compatibility shim for the canonical infrastructure operations controller and remains on the same shared agent lifecycle and API contract boundary while the old module path exists.
+11. `frontend-modern/src/utils/agentInstallCommand.ts` shared with `agent-lifecycle`: the shared frontend install-command helper is both an agent lifecycle control surface and a canonical API/install transport contract boundary.
+12. `internal/api/agent_install_command_shared.go` shared with `agent-lifecycle`: agent install command assembly is both an agent lifecycle control surface and a canonical API payload contract boundary.
+13. `internal/api/ai_handler.go` shared with `ai-runtime`: Pulse Assistant handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+14. `internal/api/ai_handlers.go` shared with `ai-runtime`: AI settings and remediation handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+15. `internal/api/ai_intelligence_handlers.go` shared with `ai-runtime`: AI intelligence handlers are both an AI runtime control surface and a canonical API payload contract boundary.
+16. `internal/api/config_setup_handlers.go` shared with `agent-lifecycle`: auto-register and setup handlers are both an agent lifecycle control surface and a canonical API payload contract boundary.
+17. `internal/api/licensing_bridge.go` shared with `cloud-paid`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
+18. `internal/api/licensing_handlers.go` shared with `cloud-paid`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
+19. `internal/api/notifications.go` shared with `notifications`: notification handlers are both a notification delivery control surface and a canonical API payload contract boundary.
+20. `internal/api/payments_webhook_handlers.go` shared with `cloud-paid`: commercial payment webhook handlers carry both API payload contract and cloud-paid billing boundary ownership.
+21. `internal/api/public_signup_handlers.go` shared with `cloud-paid`: hosted signup handlers carry both API payload contract and cloud-paid hosted provisioning boundary ownership.
+22. `internal/api/resources.go` shared with `unified-resources`: the unified resource endpoint is both a backend payload contract surface and a unified-resource runtime boundary.
+23. `internal/api/security.go` shared with `security-privacy`: the security handlers are both a security/privacy control surface and a canonical API payload contract boundary.
+24. `internal/api/security_tokens.go` shared with `security-privacy`: the security token handlers are both a security/privacy control surface and a canonical API payload contract boundary.
+25. `internal/api/slo.go` shared with `performance-and-scalability`: the SLO endpoint is both an API contract surface and a protected performance hot-path boundary.
+26. `internal/api/system_settings.go` shared with `security-privacy`: the system settings telemetry and auth controls are both a security/privacy control surface and a canonical API payload contract boundary.
+27. `internal/api/unified_agent.go` shared with `agent-lifecycle`: unified agent download and installer handlers are both an agent lifecycle control surface and a canonical API payload contract boundary.
+28. `internal/api/updates.go` shared with `deployment-installability`: update handlers are both a deployment-installability control surface and a canonical API payload contract boundary.
+## Extension Points
+
+1. Add or change payload fields through handler + contract tests together
+2. Update frontend API types in lockstep with backend contract changes
+3. Add dedicated contract tests for new stable payloads
+4. Route unified resource sensitivity, routing, and `aiSafeSummary` payload changes through `internal/api/resources.go`, `internal/api/contract_test.go`, and the canonical frontend resource consumer proofs together; resource governance metadata must not ship as an API-only or frontend-only heuristic
+5. Route frontend API-client parsed error propagation, API-error-status fallback handling, allowed-status handling, custom status-specific error handling, command-trigger success envelope handling, shared response parsing pipelines, missing-resource lookup handling, metadata CRUD routing, stream event consumption, response status, collection normalization, scalar payload coercion, and structured error normalization through canonical shared helpers under `frontend-modern/src/api/`
+6. Add or change API token scope, assignment, and revocation presentation through `frontend-modern/src/components/Settings/APITokenManager.tsx`
+7. Add or change infrastructure operations token generation, lookup, assignment, and reporting/install presentation through `frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx`
+8. Keep `internal/api/session_store.go` on a fail-closed auth-persistence boundary: persisted OIDC refresh tokens may only round-trip through encrypted-at-rest session payloads, and any missing-crypto or invalid-ciphertext path must drop the token instead of preserving plaintext-at-rest session state.
+9. Keep tenant AI handler wiring on canonical provider ownership: `internal/api/ai_handlers.go` may wire tenant `ReadState` and tenant-scoped unified-resource providers into AI services, but it must not revive tenant snapshot-provider bridges once Patrol can initialize and verify from those canonical providers directly.
+
+## Forbidden Paths
+
+1. Handler-local payload shape drift without a contract test
+2. Untracked compatibility aliases becoming permanent runtime contracts
+3. Frontend-only payload assumptions that are not owned in backend contracts
+4. Frontend API clients inferring canonical HTTP status from `Error.message` text
+5. Frontend API clients branching on raw `response.status` checks for governed status handling instead of the shared response-status helpers
+6. Frontend API clients parsing governed success or stream payloads with raw `response.json()`, ad hoc `response.text()` + `JSON.parse(...)`, or per-module `JSON.parse(...)` stream decoding instead of the shared response parsing helpers
+7. Frontend API clients normalizing nullable or legacy collection payloads with module-local `|| []`, `?? []`, or ad hoc `Array.isArray(...)` fallbacks instead of shared collection helpers
+8. Frontend API clients swallowing non-not-found API failures behind broad `catch { return null; }` fallbacks instead of routing only canonical `404` cases through explicit status checks
+9. Frontend API clients coercing governed backend payload fields through module-local scalar helper stacks instead of shared scalar coercion helpers
+10. Frontend API clients normalizing governed structured error payloads through module-local helper functions instead of shared error normalization helpers
+11. Frontend API clients open-coding parsed non-OK response throwing with `throw new Error(await readAPIErrorMessage(...))` instead of the shared response assertion helper
+12. Frontend API clients open-coding governed `assertAPIResponseOK(...); parseRequiredJSON(...)` or `parseOptionalJSON(...)` tandems instead of shared response pipeline helpers
+13. Frontend API clients open-coding governed `404 => null` response branches for resource lookups instead of shared missing-resource response helpers
+14. Agent and guest metadata clients duplicating the same CRUD transport logic instead of using one shared metadata client
+15. AI stream clients duplicating SSE reader, timeout, chunk-splitting, and JSON event parsing loops instead of using one shared stream consumer
+16. Monitoring delete and idempotent mutate clients open-coding `404`/`204` allowed-status branches instead of using canonical shared allowed-status helpers
+17. Governed frontend API clients open-coding `if (!response.ok) { if (isAPIResponseStatus(...)) throw new Error(...) }` status-to-user-message branches instead of using canonical shared custom-status error helpers
+18. Monitoring command-trigger clients open-coding `parseOptionalAPIResponse(response, { success: true }, ...)` success-envelope fallbacks instead of using a canonical shared success-envelope helper
+19. Governed frontend API clients open-coding `try/catch` wrappers around `apiFetchJSON(...)` just to map `402` or `404` into `[]`, `{ plans: [] }`, or `null` instead of using canonical shared API-error-status fallback helpers
+
+## Completion Obligations
+
+1. Update contract tests when payloads change
+2. Update frontend API types in the same slice
+3. Route runtime changes through the explicit API-contract proof policies in `registry.json`; default fallback proof routing is not allowed
+4. Update this contract when canonical payload ownership changes
+5. Keep `/api/resources` policy metadata aligned across backend payload tests and canonical frontend resource consumers whenever sensitivity or routing fields change
+
+## Current State
+
+The API layer already uses contract tests in many places, but every major live
+contract should continue moving toward canonical-only runtime shapes.
+The unified resource API payload now carries the richer domain facets directly
+through the owned backend response: resource objects can expose canonical
+`capabilities`, `relationships`, and `recentChanges` in addition to policy and
+identity metadata, so the backend payload contract stays aligned with the
+timeline and control-plane model instead of flattening those fields away.
+The tenant-scoped unified resource API now also stays on canonical
+unified-resource seeds end to end: `internal/api/resources.go`,
+`internal/api/router_helpers.go`, and `internal/api/state_provider.go` no
+longer treat raw tenant `StateSnapshot` data as a live registry-seeding owner
+once `UnifiedResourceSnapshotForTenant` is available.
+The unified agent settings surface now also follows an explicit shared
+boundary with agent-lifecycle. Changes to
+`frontend-modern/src/components/Settings/InfrastructureOperationsController.tsx` must carry this
+contract together with the shared agent-lifecycle contract and the dedicated API
+proof files for token generation, agent lookup, and profile assignment, rather
+than remaining an unowned consumer of those contract surfaces.
+That shared `InfrastructureOperationsController.tsx` boundary must also stay under explicit proof
+routing on both sides instead of relying only on generic owned-file coverage on
+the API-contract side: token generation, agent lookup, and profile assignment
+transport changes must continue to carry the direct
+`unified-agent-settings-surface` proof path together with the lifecycle-side
+surface proof.
+The same shared-boundary rule now applies to `frontend-modern/src/api/agentProfiles.ts`,
+`frontend-modern/src/api/nodes.ts`,
+`frontend-modern/src/utils/agentInstallCommand.ts`,
+`internal/api/agent_install_command_shared.go`,
+`internal/api/config_setup_handlers.go`, and `internal/api/unified_agent.go`:
+agent install/register/profile control changes must preserve canonical API
+payload behavior instead of drifting into subsystem-local transport rules.
+That shared `frontend-modern/src/api/agentProfiles.ts` boundary must also stay
+under explicit proof routing on both sides instead of remaining a generic
+frontend-client match on the API-contract side: assignment, delete, unassign,
+and suggestion transport changes must carry the direct profile-client proof
+together with the lifecycle-side profile proof.
+That shared `frontend-modern/src/api/nodes.ts` boundary must also stay under
+explicit proof routing on both sides instead of remaining a generic
+frontend-client match on the API-contract side: Proxmox setup-script and
+agent-install command transport changes must carry the direct lifecycle/client
+proof together with a direct API-contract client proof.
+That same rule also applies to the shared update transport surface:
+`frontend-modern/src/api/updates.ts` and `internal/api/updates.go` must carry a
+direct API-contract proof path instead of relying only on the generic frontend
+client or backend payload fallback coverage.
+That same rule also applies to the shared security transport surface:
+`frontend-modern/src/api/security.ts`, `internal/api/security.go`,
+`internal/api/security_tokens.go`, and `internal/api/system_settings.go` must
+carry a direct API-contract proof path instead of relying only on the generic
+frontend client or backend payload fallback coverage.
+That same rule now applies to the shared backend lifecycle install/register
+surface as well: `internal/api/agent_install_command_shared.go`,
+`internal/api/config_setup_handlers.go`, and `internal/api/unified_agent.go`
+must carry a direct API-contract proof path instead of relying only on the
+generic `internal/api/` backend payload prefix.
+That shared frontend install-command helper must also stay under explicit proof
+routing instead of remaining an orphan utility: changes in
+`frontend-modern/src/utils/agentInstallCommand.ts` must carry the direct
+helper proof path, not rely only on downstream consumer tests to catch
+transport drift.
+That same backend install-command contract must also normalize trailing slashes
+on canonical base URLs before composing installer asset paths or response
+payloads, so `/api/agent-install-command` and the governed container-runtime
+token response cannot emit `//install.sh` or slash-suffixed `pulseURL`
+transport when `PublicURL` or `AgentConnectURL` already ends with `/`.
+That same governed container-runtime migration response must also preserve the
+canonical lifecycle shell payload shape: `installCommand` in the diagnostics
+docker prepare-token response may not emit the stale `--disable-host` alias or
+an ad hoc `curl | sudo bash` pipeline, and must instead match the canonical
+root-or-sudo wrapped install transport with `--enable-host=false`.
+That diagnostics install-command payload must also be assembled through the
+shared backend install-command helper in `internal/api/agent_install_command_shared.go`
+instead of a handler-local shell formatter, so token omission, plain-HTTP
+`--insecure`, and trailing-slash normalization stay under one canonical API
+contract surface.
+That same diagnostics boundary must also consume the canonical monitoring
+memory-source catalog instead of maintaining a second local trust/fallback
+classifier. Node, VM, and LXC memory-source aliases must normalize to the same
+governed labels and fallback-reason contract before diagnostics memory-source
+breakdowns are serialized.
+That same diagnostics boundary must also backfill canonical fallback reasons
+when a raw snapshot reaches the API layer without one, so
+`buildMemorySourceDiagnostics` stays self-consistent even if a caller bypasses
+`GetDiagnosticSnapshots()` and hands diagnostics a legacy alias directly.
+That shared `InfrastructureOperationsController.tsx` boundary now also preserves copied shell
+command payload continuity: any privilege-escalation wrapper applied at the
+settings surface must keep the full canonical installer argument list intact
+instead of dropping token, profile, or command-execution flags between display
+and clipboard transport.
+That same shared `InfrastructureOperationsController.tsx` boundary now also consumes the canonical
+`connectedInfrastructure` projection from the backend state contract instead of
+reconstructing reporting rows by merging raw unified-resource facets and
+removed-* arrays in the browser. v6 clients no longer receive those removed-*
+arrays at all for this surface; Connected infrastructure row
+identity, reporting-surface labels, and ignore/reconnect scope must be owned
+by the backend payload contract, with frontend rendering limited to
+presentation and operator actions.
+That same install-command payload continuity now also applies when auth is
+optional: copied install and upgrade commands must omit token arguments
+entirely on token-optional Pulse instances rather than serializing a fake
+sentinel token into the governed shell or PowerShell payload.
+That same shared installer boundary must also stay on one runtime-argument
+contract after the command is copied: `scripts/install.sh` may not rebuild
+separate service-flag strings for token-bearing and token-file install paths,
+and must instead derive persisted `--url`, optional `--token`, feature
+toggles, identity flags, and disk-exclude transport from one canonical
+installer-owned argument item list.
+That same optional-auth contract now extends through the first governed
+runtime transport boundary: post-install Unified Agent report requests and
+Proxmox auto-register requests must use the canonical `authToken` request
+field for one-time setup-token auth instead of any API-token auth header path,
+so the canonical API surface does not preserve parallel auth transports or a
+second auth meaning for the same field.
+The self-hosted commercial entitlement payload now also uses one canonical
+counted-unit contract: `max_monitored_systems` is the live runtime and
+frontend term, and older `max_agents` or `max_nodes` aliases may be decoded
+only at explicit legacy import boundaries. Limit `current` values, add-node
+enforcement, auto-register enforcement, deploy-slot enforcement, the
+monitored-system ledger endpoint, and TrueNAS/API-backed registration must all
+reflect deduped top-level monitored systems rather than agent-only
+installation count, and `legacy_connections` / `has_migration_gap` may not
+imply that API-backed monitoring sits outside the commercial cap.
+That same configured-path contract now also has an explicit shared owner for
+manual auth env files: `internal/api/auth_env_path.go` must remain the only
+place that derives `.env` from configured runtime paths, and neighboring
+handlers like `router.go`, `router_routes_auth_security.go`, and
+`security_setup_fix.go` may not reconstruct their own `/etc/pulse/.env`
+fallbacks once runtime path authority has been centralized.
+That same shared API boundary rule now also applies to notification test
+handlers: `internal/api/notifications.go` may decode webhook-test requests and
+return the governed response envelope, but notifications-owned service-template
+selection, safe header copying, and generic webhook-test payload fallback must
+stay in `internal/notifications/` rather than becoming a second API-layer owner
+for the same transport contract.
+That same notifications boundary must also canonicalize legacy service-specific
+input aliases at ingress instead of leaving them as a live runtime contract:
+Pushover `app_token` / `user_token` may be accepted only at config/API/UI input
+boundaries, and API responses plus live notification runtime state must carry
+only canonical `token` / `user` fields.
+That same shared owner now also governs writable auth env target order:
+setup, password-change, and auth-status flows must route `.env` writes through
+the shared helper instead of open-coding config-path writes plus ad hoc
+data-path fallback branches in each handler.
+Those shared profile-assignment settings surfaces must also preserve canonical
+assignment visibility when an assignment references a profile ID that no longer
+resolves in the fetched profile collection: the current payload state must stay
+visible to the operator instead of collapsing into an empty/default select
+value that misstates the backend assignment.
+That same shared install-command boundary must preserve selected Proxmox target
+profiles across PowerShell transport: `InfrastructureOperationsController.tsx` must emit
+`PULSE_ENABLE_PROXMOX` and `PULSE_PROXMOX_TYPE` when the operator copies a
+Windows install command for a Proxmox-targeted flow, and `scripts/install.ps1`
+must convert those env vars back into canonical `pulse-agent` service args so
+the copied payload does not drift from the governed shell command contract.
+That same shared PowerShell install transport must also preserve
+operator-selected insecure TLS and command-execution settings: copied Windows
+install and upgrade payloads must emit `PULSE_INSECURE_SKIP_VERIFY` and
+`PULSE_ENABLE_COMMANDS` when enabled, and copied Windows uninstall payloads
+must still emit `PULSE_INSECURE_SKIP_VERIFY` when enabled, so
+`scripts/install.ps1` does not silently drop self-signed transport intent on
+the Windows path.
+That same shared lifecycle transport must also preserve explicit custom CA
+selection end to end: copied shell install, upgrade, and uninstall payloads
+must pass `--cacert` to both the outer installer download and the governed
+installer runtime, while copied Windows install, upgrade, and uninstall
+payloads must emit `PULSE_CACERT` and use a PowerShell bootstrap that applies
+custom-CA or insecure-TLS certificate handling before `install.ps1` is fetched,
+not only after the installer starts executing. That bootstrap must accept the
+same PEM/CRT/CER trust input that `scripts/install.ps1` itself accepts, so the
+shared command contract does not narrow custom-CA behavior on the first fetch.
+That same shell transport contract also applies to the governed setup-completion
+install handoff in `SetupCompletionPanel`: when the operator supplies a custom CA path
+or opts into insecure/self-signed transport, the shared Unix install builder
+must carry those choices through both the outer `curl` fetch and the installer
+runtime instead of leaving the first-session onboarding path behind the shared
+lifecycle/API contract. For explicit insecure/self-signed mode, that first-hop
+fetch must widen to `curl -kfsSL`; preserving `--insecure` only on the later
+installer runtime is not sufficient.
+That same shared lifecycle/API boundary must also keep setup-script bootstrap
+transport under one owned backend shape: `/api/setup-script-url` response
+payloads and `/api/setup-script` rerun guidance must derive URL, download URL,
+file name, token hint, and env/non-env command variants from one canonical
+bootstrap artifact builder instead of duplicating those fields in separate
+handler-local payload assembly paths.
+That same owned setup-script contract now also covers the rendered shell body:
+PVE and PBS script text must come from shared backend render helpers instead of
+remaining duplicated inside the setup handler, so the API boundary owns one
+artifact contract plus one render path rather than a route-local script engine.
+That owned backend shape must itself stay singular: the shared setup artifact
+model is the API contract, and handler-local response structs may not mirror
+or remap the same `url`, `downloadURL`, `scriptFileName`, command, expiry, and
+token metadata in parallel.
+That same setup-completion contract must also preserve the canonical agent-connect
+URL boundary: first-session install commands must prefer the backend-governed
+security status `agentUrl` and only fall back to browser origin when no
+canonical agent endpoint exists, while still allowing a local override for
+bootstrap cases where the operator needs a different agent-to-Pulse address.
+That same shared first-session install contract also applies to Windows
+transport: `SetupCompletionPanel` must expose a governed PowerShell install command and
+route it through the shared lifecycle helper, so `PULSE_URL`, optional
+`PULSE_TOKEN`, insecure/self-signed TLS handling, and `PULSE_CACERT` stay
+identical to the Windows install payload contract already enforced in
+`InfrastructureOperationsController.tsx`.
+That same first-session install boundary must also preserve the shared
+optional-auth command contract: the Unix install builder must support omitted
+`--token` transport, and `SetupCompletionPanel` may only omit that argument after an
+explicit "without token" confirmation when auth is optional, while preserving
+the generated token path by default so onboarding does not drift from the
+governed settings behavior. After that explicit tokenless confirmation,
+repeated wizard copy actions must keep emitting tokenless payloads instead of
+silently rotating back to `PULSE_TOKEN` or `--token` transport on the next
+rendered command. The same rule applies to wizard-owned background token
+rotation: agent-connection polling may not regenerate a token or restore
+token-auth payloads while explicit tokenless onboarding is still the active
+contract.
+That same first-session token contract must also stay coherent across the
+setup-completion credential surfaces: once `SetupCompletionPanel` rotates the active install
+token, the displayed credential token and downloaded credentials payload must
+emit that same current token instead of exporting the stale bootstrap token
+while the copied install command already uses a different one. At the same
+time, the stable bootstrap admin API token must remain separately visible and
+copyable; the setup wizard may not replace the admin credential with the
+rotating install token and call that payload contract complete. That same
+exported credentials payload must also carry the current agent-install URL and
+matching install command contract for both Unix and Windows transport,
+including any operator override, instead of serializing only browser-local
+login context or Unix-only onboarding while the live setup-completion install
+surface has already switched to a different governed endpoint. When explicit
+tokenless optional-auth mode is active, the same payload and drawer contract
+must report tokenless install mode instead of serializing a misleading current
+install token that is no longer part of the active command transport, and the
+operator guidance text on the install surface must stop claiming automatic
+token rotation after each copy while tokenless transport is active.
+That same insecure-TLS contract also applies to installer-owned HTTP traffic:
+when `PULSE_INSECURE_SKIP_VERIFY` is set, `scripts/install.ps1` must use the
+same relaxed certificate policy for the governed binary download and uninstall
+API callback requests instead of preserving `--insecure` only for the later
+agent runtime.
+That same shared `InfrastructureOperationsController.tsx` boundary must also preserve
+platform-canonical uninstall command payloads: copied utility actions for
+Windows agents must emit the PowerShell uninstall transport, and uninstall
+payloads must only carry real API token secrets rather than token record IDs
+when server-side deregistration is requested.
+That same uninstall payload rule now also applies to copied Unix shell flows:
+`InfrastructureOperationsController.tsx` must never serialize a token record ID into the governed
+`--token` argument when building uninstall transport, because the backend
+runtime only accepts the raw token secret or no token at all.
+The same shared uninstall transport must preserve `PULSE_URL` for token-optional
+Windows flows, because `install.ps1` reads its canonical server endpoint from
+that environment variable when composing the governed uninstall request.
+That same copied uninstall boundary must also preserve the selected agent's
+canonical identity when inventory already has it: shell uninstall payloads must
+carry `--agent-id`, and PowerShell uninstall payloads must carry
+`PULSE_AGENT_ID`, so deregistration targets the intended governed agent record
+instead of depending on local fallback files or hostname lookup.
+The same identity-preservation contract applies to copied upgrade transport:
+shell upgrade payloads must carry `--agent-id` and `--hostname`, and
+PowerShell upgrade payloads must carry `PULSE_AGENT_ID` and `PULSE_HOSTNAME`,
+so upgrade reruns stay bound to the selected governed inventory record.
+That same Unix transport boundary must also preserve shell-safe argument
+encoding: copied shell uninstall and upgrade payloads must quote canonical URL,
+token, agent ID, and hostname arguments so governed lifecycle commands do not
+break or reinterpret inventory values with shell-significant characters.
+The same Windows transport boundary must also preserve PowerShell-safe argument
+encoding: copied PowerShell uninstall and upgrade payloads must escape
+canonical URL, token, agent ID, and hostname values before they enter env
+assignments or `irm` command text, and the copied Windows upgrade payload must
+quote the resolved script URL so canonical URLs containing spaces remain a
+valid PowerShell transport. The same Windows uninstall payload must quote its
+resolved script URL too; escaping `PULSE_URL` into env assignments is not
+sufficient if the later `install.ps1` invocation can still be split by
+PowerShell parsing.
+That same install-command boundary must use the identical escaping rules:
+copied shell install payloads must quote canonical URL/token arguments, and
+copied PowerShell install payloads must escape canonical URL/token values
+before they enter env assignments or `irm` transport. The same interactive
+Windows install snippet must also export `PULSE_URL` explicitly when copying a
+selected canonical agent address, not just the fully qualified `install.ps1`
+download URL.
+That same shared install payload contract must also normalize trailing slashes
+on canonical Pulse URLs before composing installer asset paths, so copied shell
+and PowerShell install transport cannot drift onto `//install.sh` or
+`//install.ps1` when operators paste a base URL that already ends with `/`.
+When a governed token is already selected, that same interactive Windows
+install payload must carry `PULSE_TOKEN` too; the copied command may not discard
+the chosen credential and regress to a second manual prompt while other
+install/uninstall/upgrade payloads stay token-bound.
+When no real token has been selected yet, that same interactive Windows payload
+must not serialize a placeholder token into `PULSE_TOKEN`; the contract remains
+prompt-driven until a governed credential actually exists.
+That optional-auth install contract must also remain bidirectional: when Pulse
+allows tokenless transport, the settings surface may omit `PULSE_TOKEN` after a
+real "without token" confirmation, but it must still preserve a real generated
+token if the operator chooses one instead of collapsing optional auth into a
+tokenless-only command builder.
+That same optional-auth payload rule now also covers backend-generated Proxmox
+install responses: when auth is not configured, the canonical
+agent-install-command API must omit `token` and `--token` from its payload
+instead of implicitly persisting a new API token record and mutating the
+server's auth-configured state just to render a backend-driven install
+command.
+The same uninstall contract applies to hostname fallback identity: shell
+payloads must carry `--hostname`, PowerShell payloads must carry
+`PULSE_HOSTNAME`, and the uninstall scripts must prefer that explicit hostname
+when performing governed `/api/agents/agent/lookup` fallback.
+That lookup fallback transport must be canonicalized on both installer paths:
+shell and PowerShell uninstall flows must percent-encode the selected hostname
+before issuing `/api/agents/agent/lookup`, so API-owned identity recovery does
+not depend on raw query interpolation.
+The same shell uninstall contract also applies to persisted connection state:
+when `scripts/install.sh` receives explicit `--agent-id` or `--hostname`, it
+must store those values alongside URL/token in `connection.env` and recover
+them before invoking governed uninstall fallback.
+The same persisted-identity contract applies to `scripts/install.ps1`: Windows
+install and upgrade must store URL, token, agent ID, and hostname continuity in
+installer-owned state and reload those values during governed uninstall before
+using local fallback files or hostname discovery.
+That ProgramData continuity state is scoped to the live installation only:
+after governed uninstall succeeds, `scripts/install.ps1` must remove the saved
+state so stale agent identity or transport metadata cannot leak into later
+removal or reinstall flows.
+The same persisted-state contract applies to self-signed transport continuity:
+canonical installer-owned uninstall state must retain insecure TLS intent and
+reload it during governed offline uninstall, so self-signed Pulse instances do
+not lose deregistration reachability after the original clipboard command.
+That same persisted shell uninstall state must retain `--cacert` continuity:
+`scripts/install.sh` must store and recover the custom CA bundle path from
+`connection.env` so governed lookup and uninstall calls continue to trust the
+intended Pulse certificate chain offline.
+That shell `connection.env` recovery contract is keyed to partial uninstall
+context, not only an entirely missing URL/token pair: if any governed uninstall
+identity or transport field is absent on the command line, the script must
+reload the missing persisted continuity before using API-owned lookup fallback.
+Those register/install control surfaces now also carry a canonical host
+identity continuity contract: `/api/auto-register` and token reuse must treat
+hostname-form and IP-form URLs for the same node as one API-owned identity so
+reruns do not fork duplicate runtime records or shadow token payloads.
+That canonical `/api/auto-register` payload must also preserve token-action
+truth: canonical completion now requires caller-supplied `tokenId` and
+`tokenValue`, and the response must stay on the direct-use
+`action="use_token"` contract as the only supported completion path.
+That same contract must be enforced by first-hop callers too: install and
+runtime-side Unified Agent registration clients may not treat a bare 2xx response or a loose
+`status` field as success; they must validate the canonical `status`,
+`action`, and token/identity response shape.
+That same canonical `/api/auto-register` contract must also accept caller-supplied
+Proxmox token completion directly on that contract: when a runtime-side Unified Agent or
+generated flow already created the canonical token locally, the request may
+carry `tokenId` and `tokenValue`, and the response must stay on the direct-use
+`action="use_token"` contract as the only supported completion path.
+That same runtime transport contract also governs the agent-ingest boundary in
+`internal/api/agent_ingest.go` and `internal/api/router*.go`: the primary
+request/response surface is the Pulse Unified Agent route family, while
+`/api/agents/host/*` stays a compatibility alias and must not leak back into
+handler naming, router-owned state, or proof labels as if it were a second
+product-facing API surface.
+That confirmation marker must survive the legacy setup-script transport too:
+script-generated `/api/auto-register` payloads must send `source="script"`,
+and canonical callers must send that source explicitly, so later canonical
+reruns can distinguish real confirmed credentials from agent-created tokens.
+That same `/api/auto-register` request contract must also reject non-canonical
+source values outright: only `source="agent"` and `source="script"` are valid,
+so the backend does not preserve arbitrary caller labels as accidental API
+surface.
+That same `/api/auto-register` request contract must also reject non-canonical
+node types outright: only `type="pve"` and `type="pbs"` are valid, so the
+backend does not complete unsupported runtime labels as fake successful
+registrations.
+That same `/api/auto-register` request contract must also reject non-canonical
+token identities outright: `tokenId` must be a Pulse-managed canonical
+identifier in the form `pulse-monitor@{pve|pbs}!pulse-<canonical-scope-slug>`
+matching the requested node type, so the backend does not preserve arbitrary,
+cross-type, or non-Pulse-managed token IDs as accidental API surface.
+That same caller-supplied token contract must also stay deterministic across
+the live registration clients: installer, setup-script, and runtime-side Unified Agent Proxmox
+flows must converge on the same Pulse-managed `pulse-<canonical-scope-slug>`
+token name for the same Pulse endpoint instead of serializing caller-local
+timestamp variants into the canonical `/api/auto-register` payload.
+That same deterministic token-name contract also governs backend turnkey
+credential setup: the password-based PBS add-node flow and generated
+setup-script payloads must derive Pulse-managed token names from the canonical
+Pulse endpoint itself rather than request-local `Host` fallbacks, so loopback
+or proxy-facing admin requests cannot fork the token scope for the same Pulse
+instance.
+That same generated setup-script payload must now also opt into the canonical
+registration contract explicitly: locally created Proxmox token completions
+must send `tokenId` and `tokenValue` as the canonical request shape.
+That same request contract must also accept one-time setup-token auth through
+`authToken` only, so `/api/auto-register` does not keep a duplicate
+`setupCode` payload alias alongside the canonical field.
+That same shared discovery transport surface must also keep structured error
+ownership in the runtime model: `pkg/discovery` and `internal/discovery` own
+`structured_errors`, while `internal/api/config_discovery_handlers.go`,
+`internal/api/config_setup_handlers.go`, and `internal/api/config_node_handlers.go`
+may derive the deprecated `errors` string list only as a compatibility field
+at the API and WebSocket boundary.
+That same WebSocket state boundary must also stay tenant-aware by construction:
+`internal/websocket` may not keep a separate default-org state getter beside the
+tenant-aware state path, and default-org snapshots must flow through the same
+`org_id="default"` contract used for non-default organizations.
+That same canonical auth contract must also keep its runtime and user-facing
+terminology on setup tokens: active `/api/auto-register` auth failures and the
+owning handler/proof names may not drift back to setup-code wording after the
+payload contract has been canonicalized.
+That same first-session security boundary also governs bootstrap-token
+persistence and retrieval: the one-time setup secret may remain recoverable
+through the supported `pulse bootstrap-token` command, but `.bootstrap_token`
+may not remain a raw plaintext secret file on disk. Canonical runtime
+persistence must encrypt that token at rest and rewrite any legacy plaintext
+bootstrap-token file immediately into the encrypted canonical format on load.
+That same setup-token-only contract must also keep missing-token failures
+specific: `/api/auto-register` may not answer a missing `authToken` request
+with a generic authentication error after the route has been narrowed to the
+setup-token flow.
+That same canonical request contract must also keep field-validation failures
+specific: mismatched `tokenId`/`tokenValue` input may not collapse into
+generic missing-field output, and other missing canonical fields must return
+explicit `Missing required canonical auto-register fields: ...` guidance.
+That same request/validation contract must stay coherent across both entry
+points on the canonical runtime surface: the public `/api/auto-register`
+handler and the direct canonical handler path may not drift onto different
+messages for the same missing-field or token-pair failures.
+That same canonical request contract must also require an explicit
+`serverName` field from live callers rather than synthesizing node identity
+from `host` inside the backend.
+That same canonical backend contract must also keep overlap-continuity runtime
+messages on canonical `/api/auto-register` wording: the helper/log surface for
+resolved-host matches, DHCP continuity matches, and in-place token updates may
+not preserve the deleted "secure auto-register" split.
+That same canonical runtime path must keep token-completion validation wording
+on the canonical contract too: incomplete `tokenId`/`tokenValue` payloads may
+not preserve deleted "secure token completion" wording in live handler
+messages.
+That same canonical request contract also governs runtime-side Unified Agent-initiated
+Proxmox completion: callers must fetch and use a one-time setup token in
+`authToken` instead of carrying long-lived admin authentication directly on
+`/api/auto-register`.
+That same canonical caller-supplied completion request shape also governs `scripts/install.sh`:
+installer-owned Proxmox auto-registration must submit local token creation
+results with `tokenId` and `tokenValue` on the canonical `/api/auto-register` contract instead
+of emitting any alternate payload shape.
+The unified-agent uninstall command contract must also fail closed on
+token-required Pulse instances: copied shell and PowerShell uninstall payloads
+must use the same resolved token source as install and upgrade, so required
+auth cannot silently collapse into tokenless deregistration transport.
+Agent profile assignment payloads now also fail closed on missing profiles:
+`POST /api/admin/profiles/assignments` must reject unknown `profile_id`
+references with the canonical not-found response instead of writing orphan
+assignment rows that no governed UI can represent.
+That same not-found assignment contract must propagate through the shared
+frontend client path: `frontend-modern/src/api/agentProfiles.ts` must surface
+the canonical missing-profile message for 404 assignment responses, and the
+settings profile surfaces in `AgentProfilesPanel.tsx` and `InfrastructureOperationsController.tsx`
+must treat that message as a resync trigger so stale profile options do not
+survive after the backend has already rejected them.
+That same shared response contract must also fail closed on malformed list
+payloads: the profile-management client may not treat non-array profile or
+assignment responses as empty collections, and `AgentProfilesPanel.tsx` /
+`InfrastructureOperationsController.tsx` must surface the resulting load failure instead of
+flattening it into a fake zero-profile state.
+That same shared response contract must also fail closed on malformed
+profile-object, suggestion, schema, and validation payloads: the
+profile-management client may not accept partial profile objects, malformed
+schema definitions, or malformed validation/suggestion bodies as successful
+contract responses, and the profile editor plus suggestion modal must surface
+those canonical response failures instead of collapsing them into generic
+save/delete/schema/validation fallback messaging.
+The canonical Proxmox auto-register contract must also preserve legacy DHCP
+continuity semantics: when `/api/auto-register` receives the same
+canonical node name together with the deterministic Pulse-managed token ID for
+that node, it must update the existing PVE or PBS entry in place even if the
+host IP has changed, rather than duplicating the node under a second endpoint.
+The unified-agent install endpoints now also carry an exact-release fallback
+contract: when `/install.sh` or `/install.ps1` cannot be served locally, the
+backend must proxy the install script asset from the exact GitHub release that
+matches `serverVersion` and must fail closed for dev or unreleased builds
+rather than serving branch-tip installer logic.
+The `/api/updates/plan` contract must also fail closed without becoming a
+transport error on supported non-auto-update deployments: `manual`,
+`development`, and `source` runtimes must return an explicit manual update
+plan payload instead of `404 No updater for deployment type`, so first-session
+and settings surfaces do not treat valid deployment modes as broken update
+transport.
+Those same install-command payloads now also carry a non-TLS continuity
+contract: when Pulse returns a plain `http://` base URL for a generated agent
+install command, the command must include `--insecure` so the installed agent
+keeps its update path alive on lab or self-hosted targets instead of silently
+skipping updater checks after the first install.
+The same plain-HTTP continuity rule applies to governed frontend-generated
+host install transport too: shared Unix install command builders must append
+`--insecure` for `http://` Pulse URLs so setup-completion copies cannot drift from
+the lifecycle contract already enforced in the unified settings surface.
+That same frontend install-command contract must also fail closed on blank
+local overrides: whitespace-only custom Pulse endpoint input in
+`InfrastructureOperationsController.tsx` or `SetupCompletionPanel.tsx` may not override the canonical
+backend-governed endpoint, and the shared install-command helper must reject
+blank base URLs instead of composing installer script paths from an empty
+transport root.
+That same install-command payload contract also covers backend-generated
+Proxmox install responses in `internal/api/agent_install_command_shared.go`:
+the `/api/agent-install-command` payload and hosted tenant Proxmox install
+payload must emit the same root-or-sudo Unix wrapper contract as the governed
+frontend builder, rather than exposing a stale raw `| bash -s --` transport
+shape through the API surface.
+That same rule applies to the unified settings shell lifecycle copies:
+frontend-generated Unix install and upgrade commands must append `--insecure`
+for `http://` Pulse URLs automatically, while only the explicit insecure-TLS
+toggle may widen curl transport itself to `-k`.
+That same unified settings install boundary must also preserve preview/copy
+parity: the rendered Linux/macOS/BSD and Windows install snippets in
+`InfrastructureOperationsController.tsx` must already reflect the active token contract, custom-CA
+transport, insecure/plain-HTTP behavior, install-profile env/flags, and
+command-execution mode, rather than showing a stale base command that is only
+rewritten at copy time.
+The loopback-originated install and setup payloads now also preserve the full
+configured `PublicURL` when that URL is the canonical external route, instead
+of rewriting only the host and inheriting an `http://` request-local scheme
+that would drift the generated command away from the governed public endpoint.
+The canonical frontend client contract for Proxmox setup transport now also
+applies to `/api/setup-script-url` and `/api/setup-script`: governed settings
+surfaces must request quick-setup commands and manual setup-script downloads
+through shared `frontend-modern/src/api/nodes.ts` helpers for both `type:"pve"`
+and `type:"pbs"`, preserving the runtime-owned bootstrap artifact metadata
+instead of open-coding one node type onto raw fetch branches.
+That same `/api/setup-script-url` response contract must now also preserve the
+canonical bootstrap identity explicitly through returned `type` and normalized
+`host`, and the handler must reject missing or unsupported `type`/`host`
+input instead of minting open-ended setup tokens with caller-local host
+formatting.
+That same setup-script-url boundary must keep a strict request shape too: the
+handler accepts one canonical JSON object only, and unknown fields or trailing
+JSON must fail closed as invalid request shape instead of being ignored as
+forward-compatible extras.
+That same bootstrap request boundary must also keep `backupPerms` truthful:
+the flag is part of the canonical PVE setup contract only, so `/api/setup-script`
+and `/api/setup-script-url` must reject it for `type:"pbs"` instead of
+silently accepting a transport-level no-op.
+That same setup bootstrap contract also keeps host identity explicit across
+both routes: `/api/setup-script` and `/api/setup-script-url` must reject
+missing `host` input instead of issuing placeholder-host artifacts that only
+fail later during execution.
+That same request boundary must also keep canonical type and host handling
+aligned across both setup routes: `/api/setup-script` may not treat unknown
+`type` values as implicit PBS requests, and it must normalize the supplied
+host before rendering script text so returned artifacts and rerun URLs preserve
+the same canonical node identity as `/api/setup-script-url`.
+That same setup bootstrap contract also keeps Pulse identity explicit across
+both routes: `/api/setup-script` may not derive `pulse_url` from the request
+origin once `/api/setup-script-url` is already returning canonical Pulse URL
+metadata, and missing `pulse_url` input must fail closed instead of silently
+forking the bootstrap surface onto request-local origin state.
+That same canonical bootstrap response shape must also stay enforced by the
+shared frontend setup client in `frontend-modern/src/api/nodes.ts`, so
+settings-owned quick-setup flows fail closed on malformed `type`, `host`,
+`url`, `downloadURL`, `command`, `setupToken`, `tokenHint`, or `expires`
+fields instead of passing raw backend JSON deeper into lane-local UI state. That shared client
+must validate the returned `setupToken` but may not expose or retain it once
+the operator-facing surface only needs the runtime-owned bootstrap artifact
+plus masked `tokenHint`.
+That frontend bootstrap consumer must also treat `expires` as a live-expiry
+field, not merely a positive number, so expired setup-script-url responses are
+rejected before quick-setup UI state or copy actions trust the returned setup
+token.
+That same settings quick-setup surface must consume the canonicalized response
+directly: `NodeModal.tsx` must copy the governed token-bearing
+`commandWithEnv` field but render `commandWithoutEnv` as the visible preview,
+using the guaranteed `expires` value without reintroducing module-local
+nullable fallbacks. The same shared surface must
+also treat `setupToken` as bootstrap transport data and `tokenHint` as the
+operator-facing display field, so the UI does not re-expose the full one-time
+token once the copied/downloaded artifact already carries it. That preview
+secrecy rule must stay symmetric across both supported Proxmox types, so the
+PBS quick-setup branch may not preserve the token-bearing preview after the
+PVE branch has moved to the governed `commandWithoutEnv` display contract.
+That same quick-setup guidance must also stay truthful after the preview is
+masked: copy-success messaging may not tell the operator to paste a token
+"shown below" once only `tokenHint` remains visible, and stale raw-token
+cleanup paths may not survive in one Proxmox branch after the shared UI state
+has moved to hint-only handling.
+That same shared frontend setup surface must also trim and validate the
+canonical `host` input before invoking `/api/setup-script` downloads, and the
+shared `frontend-modern/src/api/nodes.ts` helper must reject empty `host` or
+`pulseUrl` inputs instead of serializing whitespace-corrupted query params.
+That same `/api/setup-script` payload contract must also stay explicit at the
+artifact boundary: successful responses are shell-script downloads with
+canonical `text/x-shellscript` content type plus an attachment filename, and
+the shared `frontend-modern/src/api/nodes.ts` client must reject malformed
+download headers instead of flattening script delivery into an untyped text
+blob.
+That same setup bootstrap contract must also keep manual download
+non-interactive without depending on a separately rendered secret: the
+setup-script-url payload must return a token-bearing `downloadURL`, and the
+shared frontend client must fetch setup scripts through that field instead of
+reusing the plain script `url` that omits the setup token.
+That same shared frontend setup surface must also treat
+`/api/setup-script-url` as the canonical bootstrap artifact source for the
+current host/type/mode: quick-setup copy and manual script download must reuse
+the returned `url`, `downloadURL`, `scriptFileName`, `commandWithEnv`,
+`tokenHint`, and `expires` until that artifact expires or the operator changes
+the endpoint, instead of rebuilding a second download request from lane-local
+form state or retaining the raw setup token inside frontend cache state.
+That same bootstrap artifact contract must also stay coherent in public-facing
+guidance: `docs/API.md` and operator setup guides may not describe
+`/api/setup-script-url` as if it only returned a token plus bare URL, and they
+may not publish stale `curl -sSL ... | bash` setup examples after the runtime
+and settings surfaces have standardized on the returned canonical `command*`
+fields.
+That same setup-script-url payload contract must also return the canonical
+setup-script filename as `scriptFileName`, and the shared settings/bootstrap
+consumer may not hardcode separate script names for PVE or PBS once the
+runtime-owned filename is available.
+That same setup-script-url payload must remain a coherent bootstrap artifact
+envelope for all live consumers, not only the frontend: `url`,
+`downloadURL`, `scriptFileName`, `command`, `commandWithEnv`,
+`commandWithoutEnv`, and masked `tokenHint` are part of the canonical response
+shape, and runtime-side Unified Agent/installer consumers must fail closed when those fields
+are missing or mismatched instead of silently treating the response as
+setup-token-only.
+That same consumer contract must also treat `expires` as a live-expiry field,
+not merely a populated one: installer and runtime-side Unified Agent callers must reject
+bootstrap responses whose returned expiry timestamp is already in the past.
+That same setup-script-url auth boundary must stay explicit too: returned
+`setupToken` values bootstrap `/api/setup-script` and `/api/auto-register`,
+but they do not authenticate the `/api/setup-script-url` request itself once
+Pulse auth is configured.
+That same setup-script-url payload contract now also fixes the shell transport
+it returns: the `command`, `commandWithEnv`, and `commandWithoutEnv` fields
+must use shell-quoted `curl -fsSL` fetches assembled through a shared backend
+helper rather than a handler-local `curl -sSL` pipeline.
+Those returned setup-script command fields must also preserve the governed
+root-or-sudo execution contract, including carrying `PULSE_SETUP_TOKEN`
+through the sudo path when present instead of assuming direct-root execution.
+That same setup-script contract now also covers the generated script text:
+operator guidance embedded in `/api/setup-script` responses must keep the same
+fail-fast `curl -fsSL` fetch wording for retry and missing-host examples
+instead of returning stale `curl -sSL` transport in the script payload.
+That embedded guidance must also advertise the same root-or-sudo execution
+shape as the API-returned quick-setup command instead of drifting onto a
+direct-root-only `| bash` retry path inside the script payload.
+That same script-payload guidance must preserve `PULSE_SETUP_TOKEN` across
+those retry examples too, so the generated script text does not drop the
+non-interactive setup-token contract even when it preserves the shell wrapper.
+That same generated-script payload must also hydrate `PULSE_SETUP_TOKEN` from
+an embedded setup token before those rerun examples are shown, so canonical
+`setup_token`-issued scripts keep the same non-interactive contract on the
+next hop instead of silently reverting to a prompt.
+That same `/api/setup-script` boundary must keep one token name too: embedded
+bootstrap uses only the `setup_token` query, and the rendered setup script body
+uses only `PULSE_SETUP_TOKEN` rather than keeping `AUTH_TOKEN` or
+`SETUP_AUTH_TOKEN` compatibility aliases alive.
+That same generated-script payload must also remove discovered legacy tokens
+from the concrete `pve` and `pam` token lists it already enumerated, rather
+than iterating an undefined shell variable and silently turning operator-chosen
+cleanup into a no-op.
+That same generated-script payload must also preserve the canonical encoded
+rerun URL contract: embedded `SETUP_SCRIPT_URL` values must carry the exact
+selected `host`, `pulse_url`, and `backup_perms` query state instead of
+reconstructing a raw query string inside the shell.
+That same off-host branch may not advertise a second manual `pveum` token
+creation contract either; when the runtime lacks Proxmox host tooling, the
+payload must direct operators back to rerun on the host through the canonical
+generated command instead of inventing a separate Pulse Settings token-entry
+workflow.
+That same script payload must also preserve canonical privilege-error wording
+for direct execution: the generated runtime may not regress to the stale
+"Please run this script as root" string and must instead use the same root
+requirement language as the governed retry examples.
+That same manual-add payload must also preserve one canonical token placeholder
+string when the script cannot echo the secret again from process state, rather
+than drifting across neighboring branches with lane-local variants like
+"[See above]" or "Check the output above...".
+That same payload must also preserve one canonical success-message contract
+across generated PVE and PBS scripts, rather than returning node-type-specific
+phrasing for the same successful auto-register result.
+That same setup-script payload must also discover legacy cleanup candidates
+through the canonical Pulse-managed token prefix for the active Pulse URL,
+while still matching legacy timestamp-suffixed variants, instead of rebuilding
+an IP-derived regex that can drift from `buildPulseMonitorTokenName`.
+That same cleanup-discovery contract applies to both generated PVE and PBS
+setup-script payloads; node type may not fork onto different legacy token-name
+matching rules for the same Pulse-managed token surface.
+That same payload must also use exact token-name matching for rerun rotation
+detection, rather than broad substring checks over token-list output, so the
+canonical managed token contract does not collide with unrelated partial-name
+matches.
+That same payload must also keep PBS token-copy guidance truthful: the
+one-time token banner may only be emitted from the successful token-create
+branch, not before the creation result is known.
+That same payload must also keep PBS auto-register attempt guidance truthful:
+the generated script may only print its attempt banner on the branch that is
+actually about to send the registration request, not before token-unavailable
+or missing-auth skip handling.
+That same payload must also fail closed when token creation output does not
+yield a usable token value: the generated script may not continue into prompt
+or request assembly with an empty token secret, and must instead stop on the
+canonical token-value-unavailable branch before any registration POST is built.
+That same setup-script payload must also fail closed on auto-register success
+parsing: the generated script may not treat any bare `success` substring as a
+successful response, and must instead require an explicit `success:true`
+signal before claiming registration succeeded.
+That same payload contract must also fail closed on auto-register transport:
+the generated script must use fail-fast `curl -fsS` request transport and only
+evaluate the response payload after a successful curl exit status, rather than
+parsing ambiguous stderr or HTTP-failure output as a valid registration body.
+That same setup-script payload must also preserve the canonical auth guidance:
+authentication failures in the generated script text must reference the active
+Pulse setup-token flow, not stale API-token setup instructions, because the
+payload now authenticates auto-register through one-time setup tokens.
+That same auth-failure payload must also stay truthful after a request attempt:
+once the generated script has already entered the registration-request path,
+it may not fall back to a missing-token explanation and must instead report
+that the provided setup token was invalid or expired, directing the operator
+to fetch a fresh setup token from Pulse Settings → Nodes and rerun. The final
+completion/footer path must honor that same auth-failure state instead of
+reopening manual completion with the emitted token details.
+That same payload must also preserve truthful completion messaging: generated
+setup-script text may only announce successful Pulse registration when the
+payload's auto-register branch succeeded, and must otherwise describe the
+result as manual follow-up using the emitted token details.
+That same manual-follow-up payload may not advertise a stale `PULSE_REG_TOKEN`
+rerun contract: when auto-register falls back to manual completion, the script
+text must direct the operator to Pulse Settings → Nodes with the emitted token
+details rather than inventing a second registration-token flow.
+That same manual-follow-up payload must also keep its failure-summary text on
+that same canonical completion path: the generated script may not fall back to
+vague "manual configuration may be needed" wording when it already knows the
+operator should finish registration through Pulse Settings → Nodes with the
+emitted token details.
+That same immediate failure path may not fork into a separate numbered manual
+setup list either; it must point directly at the same token-details-below
+Settings → Nodes completion contract used by the final manual footer, including
+the branch where the registration POST itself fails before a response payload
+can be parsed.
+That same manual-follow-up payload must also preserve the canonical host value
+already carried by the script payload, instead of reverting to a placeholder
+host string in the rendered manual-add instructions.
+That same host-continuity contract also applies to generated PBS scripts: the
+manual-add footer must preserve the canonical `host` payload value instead of
+replacing it with a runtime-discovered local IP that may not match the API
+contract the caller requested.
+That same PBS payload contract must also bind the canonical `host` before any
+setup-token gating that can skip auto-registration, so manual fallback output
+cannot lose the host URL when the operator does not provide a setup token.
+That same host binding must also precede token-creation failure fallback, so
+the rendered manual footer still carries the canonical `host` payload even
+when the script fails before any auto-register request can be assembled.
+If the caller never supplied a canonical `host` at all, the rendered script
+must fail closed instead of surfacing placeholder host values as manual
+registration targets; it must direct the caller to regenerate the setup script
+with a valid host URL.
+That same payload must also preserve token-creation failure truth: when
+Proxmox token minting fails, the rendered script may not emit placeholder token
+details or report token setup completed. It must keep the host binding, skip
+auto-register assembly, and tell the caller to rerun after the token-creation
+error is fixed.
+That same payload must also preserve token-extraction failure truth: if the
+returned token output does not yield a usable token secret, the script may not
+advertise manual registration as a fallback path from that broken payload and
+must instead direct the caller to rerun after the token output issue is fixed.
+Rendered completion and manual-detail payload branches must treat only an
+extractable token secret as ready; token-create success alone is not enough.
+That same rendered PBS payload must also distinguish skipped auto-register
+states from attempted request failures, so missing setup-token input or missing
+usable token secret cannot surface the generic request-failed-before-success
+banner.
+That same payload must also preserve canonical manual-completion phrasing
+across generated PVE and PBS scripts: both must use the Settings → Nodes
+manual-add language instead of diverging onto node-type-specific fallback
+headings that imply different completion paths.
+That same generated payload may not shorten the earlier auto-register failure
+branch back to plain "Pulse Settings" wording either; both the immediate
+failure guidance and the final manual footer must preserve the same Settings →
+Nodes completion destination.
+`/api/charts/workloads-summary` now also has a canonical hot-path invariant:
+aggregate workload charts must preserve stable guest counts while batching
+store-backed metric reads across workload types, with no payload shape change.
+That endpoint now also carries an explicit API p95 budget under the same
+store-backed mixed-workload fixture used to verify the batched hot path.
+Frontend AI API clients now also normalize `402 Payment Required` responses for
+optional paywalled collections into explicit empty states, so Pulse Pro gating
+does not become a transport error path during page bootstrap.
+That frontend status handling must now route through the shared
+`frontend-modern/src/api/responseUtils.ts` status helpers rather than through
+message-text heuristics in individual API modules.
+Optional not-found response handling in frontend API clients must now also use
+those shared response-status helpers rather than open-coded `response.status`
+branches in each module.
+The same rule now applies to no-content and service-unavailable handling in
+governed frontend API clients.
+Governed frontend API clients must now also route required and safe success
+payload parsing through the shared response parsing helpers rather than through
+open-coded `response.json()` calls in each module.
+The same rule now applies to optional success payload parsing, including lookup
+responses that may legitimately return an empty body but must not use ad hoc
+`response.text()` plus `JSON.parse(...)` branches in individual modules.
+Investigation and AI chat SSE event payload parsing must now also route through
+the shared text-to-JSON helper in `frontend-modern/src/api/responseUtils.ts`
+rather than through per-module `JSON.parse(...)` stream decoding.
+Nullable or legacy collection payloads in governed frontend API clients must
+now also route through shared collection-normalization helpers in
+`frontend-modern/src/api/responseUtils.ts` rather than through module-local
+`|| []`, `?? []`, or `Array.isArray(...)` fallback branches.
+That rule now also covers patrol run history responses so malformed or legacy
+run collections collapse through the shared helper instead of per-module
+fallback lists.
+The `/api/ai/patrol/runs` frontend history clients must now also route their
+shared fetch plus run-normalization pipeline through one canonical local helper
+in `frontend-modern/src/api/patrol.ts` rather than duplicating the same
+endpoint-specific stack across each history variant.
+That patrol run-history contract now also treats non-positive or malformed
+`limit` query values as defaulted input and caps oversized requests to the
+backend maximum, rather than letting invalid caller input widen the history
+payload unexpectedly.
+The frontend Patrol history clients in `frontend-modern/src/api/patrol.ts`
+must mirror that normalization before sending the request: invalid and
+non-positive caller input collapses back to the client default of `30`, and
+oversized requests clamp to the backend maximum of `100`.
+Patrol run detail access for selected-history UX must now resolve a canonical
+single-run contract at `/api/ai/patrol/runs/{id}` instead of probing bounded
+history pages and hoping the target run is still inside a recent window; the
+tool-call trace UI must fetch the selected run by ID, with
+`?include=tool_calls` carrying the full trace only when explicitly requested.
+Frontend investigation rendering for unified Patrol findings must also key off
+finding-level investigation metadata, not only `investigation_session_id`:
+the investigation detail endpoint is addressed by finding ID, so findings with
+canonical `investigation_status`, `investigation_outcome`, or non-zero
+`investigation_attempts` must still surface investigation UI even when the
+session ID field is absent or blank.
+That same Patrol findings UI contract must keep `fix_queued` approval recovery
+actions visible even when no live pending approval remains and
+`/api/ai/findings/{id}/investigation` resolves to `null` or omits
+`proposed_fix`: queued remediation state cannot collapse into a dead badge with
+no user action path.
+Patrol run-history serialization and persistence must also preserve full field
+parity across API responses and restart boundaries, including
+`pmg_checked`, `rejected_findings`, `triage_flags`, `triage_skipped_llm`, and
+explicit empty `finding_ids` or `effective_scope_resource_ids` arrays when a
+run represents an empty snapshot or an intentionally empty effective scope.
+The same patrol run-history contract now also treats
+`effective_scope_resource_ids` as the canonical analyzed-resource scope when
+present, including when it is an explicit empty array, and frontend snapshot
+selection must treat an explicit empty `finding_ids` array as an empty snapshot
+rather than falling back to unrelated current findings; a missing
+`finding_ids` field must retain its "no snapshot filter available" meaning
+rather than being collapsed into an empty snapshot.
+That same frontend run-history path must also preserve and expose
+`triage_flags` and `triage_skipped_llm` from canonical patrol run records so
+deterministic triage-only runs do not collapse into generic "no analysis"
+history entries.
+Patrol status payloads now also treat quickstart credit state as canonical API
+contract data: `/api/ai/patrol/status` must surface
+`quickstart_credits_remaining`, `quickstart_credits_total`, and
+`using_quickstart` directly from backend runtime state so the frontend can
+render Patrol quickstart availability without local heuristics or shadow
+derived state.
+Patrol mutate endpoints that depend on the background service must also fail
+closed with `503 Service Unavailable` when AI service initialization is absent
+rather than dereferencing a nil service and crashing before a contract response
+is written.
+The `/api/recovery/rollups` transport now also carries the same normalized
+filter contract as `/api/recovery/points`, `/api/recovery/series`, and
+`/api/recovery/facets`: cluster, node, namespace, workload scope,
+verification, and free-text query filters must remain coherent across all four
+recovery endpoints so the recovery UI cannot render mismatched protected-item
+and history views for the same active filter set.
+The same rule now also covers optional nested node cluster endpoint collections
+so `frontend-modern/src/api/nodes.ts` does not own its own
+`Array.isArray(node.clusterEndpoints)` response-shape branch.
+Canonical alert incident and bulk-acknowledge result payloads must now also
+flow through frontend API clients without no-op per-module wrapper
+normalization when the backend shape is already canonical.
+Legacy `alert_identifier` compatibility promotion in unified finding and patrol
+run payloads must now also route through one shared helper in
+`frontend-modern/src/api/responseUtils.ts` rather than duplicated per-module
+record wrappers.
+AI frontend clients must now also call canonical status helpers and direct
+URL-segment encoding behavior without module-local alias wrappers when those
+wrappers add no contract value.
+The discovery frontend client must now also centralize typed and agent route
+construction through dedicated path builders rather than repeating route
+templates or trivial collection-path aliases across each endpoint.
+Notifications email config parsing and node cluster endpoint normalization must
+now also route through shared scalar coercion helpers in
+`frontend-modern/src/api/responseUtils.ts` rather than through per-module
+string/boolean/number helper stacks.
+The same shared scalar coercion rule now also applies to monitoring agent
+lookup timestamps so `lastSeen` normalization does not live as a module-local
+`typeof`/`Date.parse(...)` branch in `frontend-modern/src/api/monitoring.ts`.
+The same scalar-coercion contract now also covers optional Proxmox
+`clusterEndpoints` collections in `frontend-modern/src/api/nodes.ts`:
+frontend consumers may normalize endpoint fields, but they must not fork the
+canonical collection-shape guard or reintroduce legacy `alert_identifier`
+field access once camelCase `alertIdentifier` has been promoted by the shared
+response helpers.
+The same frontend API contract now also governs Proxmox agent-install command
+transport in `frontend-modern/src/api/nodes.ts`: the canonical client request
+shape for `/api/agent-install-command` must support both `type:"pve"` and
+`type:"pbs"` with the same explicit `enableProxmox` flag, so install-command
+surfaces do not fork into ad hoc raw POST payloads for different Proxmox node
+types. That same shared client boundary must also validate a non-empty
+`command` response and keep the raw backend `token` field inside
+`frontend-modern/src/api/nodes.ts` rather than leaking it into downstream UI
+state. Downstream Proxmox install-command consumers like `NodeModal.tsx` must
+then surface those canonical validation errors directly rather than collapsing
+one node-type pane back to generic copy-generation failure.
+Hosted organization-route gating now also falls under this API payload
+boundary: when hosted tenants hit organization membership or billing surfaces
+through `internal/api/org_handlers.go` and `internal/api/router.go`, inactive
+subscriptions must fail with the canonical hosted `402 subscription_required`
+payload instead of reusing the self-hosted `multi_tenant_disabled` contract or
+falling through to an untyped transport error.
+Hosted signup and magic-link error payload normalization must now also route
+through shared structured error normalization helpers in
+`frontend-modern/src/api/responseUtils.ts` rather than through module-local
+error-shape parsing functions.
+Governed frontend API clients must now also route canonical non-OK response
+throwing through the shared response assertion helper in
+`frontend-modern/src/api/responseUtils.ts` rather than open-coding
+`throw new Error(await readAPIErrorMessage(...))` in each module.
+The same governed modules must now also route assert-then-parse response
+pipelines through shared required/optional response helpers in
+`frontend-modern/src/api/responseUtils.ts` rather than repeating
+`assertAPIResponseOK(...); parseRequiredJSON(...)` or `parseOptionalJSON(...)`
+sequences in each client.
+Hosted cloud-handoff and billing-admin payloads are canonical API contracts as
+well. The handoff exchange must normalize the verified operator email before
+it is written into the browser session and before it is returned in the JSON
+success payload so session identity, org membership, and handoff payloads
+cannot drift on email casing. Hosted billing-admin reads for non-default orgs
+must also project the effective default-org hosted lease when the tenant-local
+billing file has not been materialized yet, so admin billing-state payloads
+stay coherent with the tenant's active entitlement payload instead of briefly
+regressing to local trial/default state.
+Canonical missing-resource lookups in governed frontend API clients must now
+also route `404 => null` response handling through shared response helpers in
+`frontend-modern/src/api/responseUtils.ts` rather than open-coding local
+status branches in discovery and monitoring clients.
+Agent and guest metadata CRUD clients must now also route through one shared
+metadata client in `frontend-modern/src/api/metadataClient.ts` rather than
+duplicating the same `get/update/delete/list` transport logic in two files.
+AI investigation and chat stream clients must now also route through one shared
+SSE JSON event consumer in `frontend-modern/src/api/streaming.ts` rather than
+duplicating reader lifecycle, timeout, chunk parsing, and event decoding logic
+in each module.
+Monitoring delete and idempotent mutate clients must now also route `404`/`204`
+success cases through shared allowed-status helpers in
+`frontend-modern/src/api/responseUtils.ts` instead of open-coding local
+status-branch stacks in each method.
+The docker-runtime and kubernetes-cluster managed-resource clients in
+`frontend-modern/src/api/monitoring.ts` must now also route shared delete,
+allowed-missing mutation, and display-name transport mechanics through
+canonical local helpers in that file rather than duplicating the same
+fetch-and-assert stacks across runtime and cluster variants.
+The same monitoring managed-resource clients must now also route shared
+no-body `POST` actions and success-envelope command triggers through canonical
+local helpers in `frontend-modern/src/api/monitoring.ts` rather than
+duplicating identical `POST` transport logic across reenroll and runtime
+command endpoints.
+Those monitoring command helpers must also preserve the canonical frontend
+fetch-options contract: governed callers pass string-keyed headers only, and
+empty-body success responses normalize through the shared success-envelope
+parsing path rather than local `response.ok` branches.
+Legacy persisted Unified Agent scope aliases from v5 and early v6 installs
+must also canonicalize to the current `agent:*` scope identifiers at the
+backend contract boundary, so existing installed agents continue to satisfy
+`agent:report`, `agent:config:read`, `agent:manage`, and `agent:enroll`
+requirements without manual token replacement after upgrade. That
+canonicalization may live only at request-ingress and persistence/migration
+boundaries; live token records, runtime scope checks, and API payloads may not
+preserve or re-emit `host-agent:*` aliases.
+Agent profile delete and unassign clients must now also route canonical `204`
+success handling through shared allowed-status helpers in
+`frontend-modern/src/api/responseUtils.ts` instead of open-coding local
+`if (!isAPIResponseStatus(response, 204))` branches.
+Agent profile suggestion and monitoring display-name mutations must now also
+route custom `503` and `404` user-facing error promotion through shared
+custom-status error helpers in `frontend-modern/src/api/responseUtils.ts`
+instead of open-coding local `if (!response.ok) { if (isAPIResponseStatus(...))
+throw new Error(...) }` stacks.
+Monitoring command-trigger clients must now also route empty-body
+`{ success: true }` fallback behavior through a shared success-envelope helper
+in `frontend-modern/src/api/responseUtils.ts` instead of open-coding
+`parseOptionalAPIResponse(response, { success: true }, ...)` in each method.
+AI chat SSE now also treats interactive `question` events as a canonical API
+contract surface: backend and frontend must preserve `session_id`,
+`question_id`, and the structured `questions` array without handler-local
+rewrites or alternate payload aliases.
+That same chat SSE contract must remain request-bound. If the HTTP request
+context is canceled or the client disconnects, backend assistant execution
+must cancel with the request rather than continuing on a detached background
+context until an unrelated timeout expires.
+Config-registration API contracts at `/api/auto-register` and
+`/api/config/nodes` now also require deterministic automated proof: backend
+verification must stub TLS fingerprint capture and Proxmox cluster-detection
+probes rather than depending on live network reachability, so canonical
+request/response verification reflects contract behavior instead of ambient
+lab state.
+That same canonical `/api/auto-register` response contract must preserve
+node identity on success: `nodeId` must carry the resolved stored node name,
+not the raw host URL or requested `serverName`, so registration payloads stay
+aligned with fleet-control payload consumers.
+That same response contract must also return the rest of the backend-owned
+completion identity coherently: `type`, `source`, normalized `host`, and
+matching `nodeName` must align with the saved node record so installer and
+runtime-side Unified Agent callers do not keep separate local success identities after Pulse has
+already canonicalized the node.
+That same `/api/auto-register` contract also governs the
+`node_auto_registered` WebSocket payload: it must emit the normalized stored
+host plus the resolved stored node identity in `name`, `nodeId`, and
+`nodeName`, rather than leaking raw request fields that can diverge from the
+saved node record, together with the effective token id that was reused or
+issued.
+AI and agent-profile collection/detail clients must now also route `apiFetchJSON`
+`402`/`404` fallback behavior through shared API-error-status fallback helpers in
+`frontend-modern/src/api/responseUtils.ts` instead of open-coding local
+`try/catch` wrappers that map those statuses to `[]`, `{ plans: [] }`, or
+`null`.
+Paywalled Patrol remediation-intelligence responses must also scrub derived
+metadata together with the collection itself: when remediation history is
+license-locked, `remediations`, `count`, and `stats` must all collapse to an
+explicit empty state rather than leaking paid history totals through a partial
+payload.
+Hosted billing-state payloads now also treat Stripe webhook-backed commercial
+state as canonical API contract data: when checkout and subscription webhooks
+persist paid state, `plan_version`, `stripe_price_id`, and `limits.max_monitored_systems`
+must stay aligned instead of emitting paid-state payloads with an empty limits
+map or stale canceled-state carryover.
+That same hosted billing API boundary also owns runtime base-path resolution:
+`internal/api/payments_webhook_handlers.go` must derive webhook dedupe and
+customer-index storage from the shared runtime data-dir helper in
+`internal/config/config.go` instead of carrying its own `/etc/pulse` fallback,
+so hosted billing API side effects stay aligned with the same configured data
+directory used by the rest of the product.
+Not-found detail lookups in governed frontend API clients must now also route
+through explicit status-based `404` handling rather than through broad
+catch-all `null` fallbacks that hide real backend failures.
+Session and CSRF persistence compatibility under `internal/api/session_store.go`
+and `internal/api/csrf_store.go` now also has an explicit governed migration
+proof route: legacy raw-token `sessions.json` and `csrf_tokens.json` files must
+load through explicit migration helpers, rewrite immediately into hashed
+canonical persistence, and stay covered by
+`internal/api/session_store_test.go`, `internal/api/csrf_store_test.go`, plus
+`tests/migration/v5_session_db_test.go`, rather than borrowing the generic
+backend payload contract proof path.
+That same governed auth persistence boundary must also stay owned by the
+configured runtime data path instead of hidden package-singleton fallbacks:
+session, CSRF, and recovery-token stores may not silently self-initialize on
+`/etc/pulse` from first access or lock onto the first caller forever through
+`sync.Once`; the configured router data path must remain the canonical owner of
+those persistence stores, and reinitializing that data path must replace the
+old runtime store rather than leaking prior-path state forward.
+That same configured-path rule also applies to runtime auth/config reloads:
+`internal/config/watcher.go` may use `PULSE_AUTH_CONFIG_DIR` only as an
+explicit override, but otherwise it must watch the resolved runtime
+`ConfigPath` / `DataPath` owner. The watcher may not probe `/etc/pulse` or
+`/data` and silently override the configured path authority for `.env` and
+`api_tokens.json` reloads.
+That same configured-path rule also applies to manual auth env writes and
+status reads under `internal/api/router.go`,
+`internal/api/router_routes_auth_security.go`, and
+`internal/api/security_setup_fix.go`: those handlers must resolve `.env`
+through the shared auth-path helper instead of rebuilding `/etc/pulse/.env`
+fallback logic inline.
+That same governed auth persistence rule now also covers recovery-token state
+under `internal/api/recovery_tokens.go`: raw recovery secrets may be minted for
+one-time operator use, but `recovery_tokens.json` must persist only token
+hashes and treat any legacy plaintext-token file as an explicit migration input
+that is rewritten immediately into hashed canonical persistence on load instead
+of leaving raw recovery secrets on the primary runtime disk path.
+That same governed persistence rule also covers `internal/config/persistence.go`
+API token metadata handling: `api_tokens.json` may hold only hashed token
+records, but a legacy plaintext metadata file may only be migration input.
+Canonical runtime persistence must rewrite plaintext API token metadata
+immediately into encrypted-at-rest storage on load instead of treating the
+unencrypted file as a normal primary path.
+That same fail-closed persistence rule also applies to persisted OIDC refresh
+tokens in `internal/api/session_store.go`: refresh tokens may only be loaded
+from or saved to encrypted-at-rest session payloads, and the runtime must drop
+them whenever session-store crypto is unavailable or the stored ciphertext is
+not canonically decryptable instead of preserving plaintext-at-rest session
+state.
+Hosted signup handler payload flow now also follows an explicit shared
+boundary: `internal/api/public_signup_handlers.go` owns request/response and
+magic-link payload semantics, while `internal/hosted/provisioner.go` owns the
+shared org bootstrap and rollback mechanics that the hosted signup handler
+invokes.
+The API token settings surface now also follows the same explicit ownership
+rule. Changes to `frontend-modern/src/components/Settings/APITokenManager.tsx`
+must carry this contract and the dedicated API-token management proof file
+instead of remaining an unowned consumer of token scope labels, token
+assignment visibility, and revoke-state presentation.
+That shared `APITokenManager.tsx` boundary must also stay under explicit proof
+routing on both sides instead of relying only on broad settings-surface
+coverage on the security side: token settings changes must continue to carry
+the direct `api-token-management-surface` API-contract proof together with the
+security-side surface proof.
+That same token surface, together with `frontend-modern/src/api/security.ts`,
+`internal/api/security.go`, `internal/api/security_tokens.go`, and
+`internal/api/system_settings.go`, now also follows an explicit shared
+boundary with `security-privacy` so auth posture, token authority, and
+telemetry/privacy control semantics stop borrowing their governance only from
+the broader API lane.
+The `/api/security/tokens` payload contract now also carries explicit owner
+binding: token create/list responses must preserve the originating
+`ownerUserId` together with org scope so long-lived automation credentials
+cannot appear detached from their intended human identity.
+That same governed token contract must fail closed on mutation. Limited-scope
+API tokens may only create, rotate, or delete tokens whose effective scopes
+are a subset of the caller's own scopes; token-management routes must not let a
+settings-capable but narrower token revoke or replace a broader credential.
+Those owner-bound credentials now also define the effective authenticated
+principal on governed API routes: when token metadata carries `ownerUserId`,
+RBAC and audit-facing auth resolution must use that bound user identity rather
+than a detached synthetic `token:<id>` subject, while still preserving token
+scope and org enforcement.
+The onboarding QR payload flow now also carries explicit token-bound auth
+semantics: when the frontend requests `/api/onboarding/qr` with a pairing
+token, the API client must send that token explicitly so the returned payload
+and deep link represent the exact minted pairing credential rather than the
+ambient browser session, and the mobile-facing `relay.url`/`relay_url` fields
+must normalize the stored relay instance endpoint to the app endpoint
+(`/ws/app`) so mobile pairing never receives the instance-only `/ws/instance`
+route.
+Incoming organization-share payloads now also preserve requested access-role
+semantics at the API boundary: `/api/orgs/{id}/shares/incoming` must hide
+shares whose `accessRole` exceeds the caller's effective role in the target
+organization instead of leaking share metadata that the caller cannot
+legitimately accept or use.
+Organization membership and authorization payloads now also follow an explicit
+live-role contract: `/api/orgs` must list only organizations the caller
+currently belongs to, and org-management endpoints must reflect member
+promotion or demotion immediately rather than continuing to authorize from
+stale owner/admin assumptions after the role change has already been
+persisted.
+System settings API payloads now also carry an explicit v6 channel contract:
+`updateChannel` resolves to `stable` or `rc` with `stable` as the default, and
+`autoUpdateEnabled` must serialize as `false` whenever the effective channel is
+`rc`, even if stale persisted state or omitted request fields would otherwise
+leave unattended updates enabled.
+Update API channel selection now also follows that same contract: `/api/updates`
+surfaces accept only `stable` or `rc`, reject unsupported channel values at the
+HTTP boundary, and must not allow a `stable` installation path to apply a
+prerelease tarball even when a caller posts a direct GitHub release URL.
+The `/api/resources` and `/api/resources/stats` handlers now also carry a
+single-snapshot aggregation invariant: canonical `aggregations.byType` must be
+derived from the same registry list snapshot used for that request's response
+path, so the contract stays deterministic without paying for duplicate
+registry-clone work on the hot path. That same governed resource contract now
+also includes backend-derived `policy` and `aiSafeSummary` fields, and list,
+detail, and child payloads must source those values from canonical unified
+resource metadata rather than from frontend- or AI-local heuristics.
+That same resource-handler seed contract must also stay on canonical unified
+resource ownership for tenant-scoped requests: once a tenant state provider
+implements `UnifiedResourceSnapshotForTenant`, `/api/resources` may not fall
+back to raw tenant `StateSnapshot` seeding when that unified seed is empty.
+Tenant AI service wiring now follows that same canonical ownership rule:
+`internal/api/ai_handlers.go` may provide tenant `ReadState` and
+tenant-scoped unified-resource providers, but it must not mint tenant snapshot
+provider bridges purely to satisfy Patrol once the Patrol runtime can operate
+from those canonical tenant providers directly.
+Hosted licensing handlers now also carry a tenant-scoped fallback contract:
+when hosted auth handoff preserves a non-default tenant org like `t-...`,
+`/api/license/status` and `/api/license/entitlements` must still evaluate the
+instance-level hosted billing lease from `default` if that tenant org has no
+org-local billing state of its own, rather than failing closed into
+`subscription_required` on first entry.
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
new file mode 100644
index 0000000000..9a7e336d22
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -0,0 +1,391 @@
+# Cloud Paid Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "cloud-paid",
+ "lane": "L3",
+ "contract_file": "docs/release-control/v6/internal/subsystems/cloud-paid.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own cloud plan/version semantics, entitlement limits, hosted billing/runtime
+agreement, and cloud-specific enforcement rules.
+
+## Canonical Files
+
+1. `pkg/licensing/features.go`
+2. `pkg/licensing/billing_state_normalization.go`
+3. `pkg/licensing/database_source.go`
+4. `pkg/licensing/evaluator.go`
+5. `pkg/licensing/models.go`
+6. `pkg/licensing/activation_types.go`
+7. `pkg/licensing/token_source.go`
+8. `pkg/licensing/entitlement_payload.go`
+9. `pkg/licensing/hosted_subscription.go`
+10. `pkg/licensing/service.go`
+11. `pkg/licensing/grant_refresh.go`
+12. `pkg/licensing/revocation_poll.go`
+13. `pkg/licensing/license_server_client.go`
+14. `pkg/licensing/persistence.go`
+15. `pkg/licensing/activation_store.go`
+16. `pkg/licensing/trial_activation.go`
+17. `pkg/licensing/stripe_subscription.go`
+18. `pkg/licensing/monitored_system_limit.go`
+19. `internal/cloudcp/entitlements/service.go`
+20. `internal/cloudcp/registry/registry.go`
+21. `internal/cloudcp/account/tenant_handlers.go`
+22. `internal/cloudcp/stripe/provisioner.go`
+23. `internal/hosted/provisioner.go`
+24. `frontend-modern/src/App.tsx`
+25. `frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx`
+26. `frontend-modern/src/components/Settings/BillingAdminPanel.tsx`
+27. `frontend-modern/src/components/Settings/OrganizationBillingPanel.tsx`
+28. `frontend-modern/src/components/Settings/ProLicensePanel.tsx`
+29. `frontend-modern/src/components/Settings/CommercialBillingSections.tsx`
+30. `frontend-modern/src/components/Settings/SelfHostedCommercialActivationSection.tsx`
+31. `frontend-modern/src/components/Settings/RelaySettingsPanel.tsx`
+32. `frontend-modern/src/pages/CloudPricing.tsx`
+33. `frontend-modern/src/utils/apiClient.ts`
+34. `frontend-modern/src/utils/commercialBillingModel.ts`
+
+## Shared Boundaries
+
+1. `internal/api/licensing_bridge.go` shared with `api-contracts`: commercial licensing bridge handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
+2. `internal/api/licensing_handlers.go` shared with `api-contracts`: commercial licensing handlers carry both API payload contract and cloud-paid entitlement boundary ownership.
+3. `internal/api/payments_webhook_handlers.go` shared with `api-contracts`: commercial payment webhook handlers carry both API payload contract and cloud-paid billing boundary ownership.
+4. `internal/api/public_signup_handlers.go` shared with `api-contracts`: hosted signup handlers carry both API payload contract and cloud-paid hosted provisioning boundary ownership.
+
+## Extension Points
+
+1. Add or change limits through `pkg/licensing/`
+2. Add or change hosted entitlement issuance through `internal/cloudcp/entitlements/service.go`
+3. Add or change control-plane plan storage through `internal/cloudcp/registry/registry.go`
+4. Add or change MSP account-scoped workspace provisioning entry handlers through `internal/cloudcp/account/tenant_handlers.go`
+5. Add or change Stripe provisioning plan resolution through `internal/cloudcp/stripe/provisioner.go`
+6. Add or change activation/grant lifecycle through `pkg/licensing/service.go`, `pkg/licensing/grant_refresh.go`, and `pkg/licensing/revocation_poll.go`
+7. Add or change license-server transport through `pkg/licensing/license_server_client.go`
+8. Add or change encrypted activation persistence through `pkg/licensing/persistence.go` and `pkg/licensing/activation_store.go`
+9. Add or change hosted trial token semantics through `pkg/licensing/trial_activation.go`
+10. Add or change hosted signup provisioning through `internal/hosted/provisioner.go`
+11. Add or change hosted billing-admin presentation through `frontend-modern/src/components/Settings/BillingAdminPanel.tsx`
+12. Add or change shared commercial plan/usage presentation through `frontend-modern/src/components/Settings/CommercialBillingSections.tsx` and `frontend-modern/src/utils/commercialBillingModel.ts`
+13. Add or change organization billing and usage presentation through `frontend-modern/src/components/Settings/OrganizationBillingPanel.tsx`
+14. Add or change self-hosted Pro activation, trial, and entitlement actions through `frontend-modern/src/components/Settings/ProLicensePanel.tsx` and `frontend-modern/src/components/Settings/SelfHostedCommercialActivationSection.tsx`
+15. Add or change paid relay settings and onboarding presentation through `frontend-modern/src/components/Settings/RelaySettingsPanel.tsx` and `frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx`
+16. Add or change cloud plan presentation through `frontend-modern/src/pages/CloudPricing.tsx`
+17. Add contract tests where runtime and pricing need to stay aligned
+18. Add or change hosted browser org-context bootstrap through `frontend-modern/src/App.tsx` and `frontend-modern/src/utils/apiClient.ts`
+
+## Forbidden Paths
+
+1. New ad hoc plan names in runtime or UI
+2. Silent aliases between old and new limit keys in live runtime paths
+3. Pricing/UI claims that are not enforced by runtime entitlements
+
+## Completion Obligations
+
+1. Update this contract when cloud plan semantics change
+2. Update runtime and frontend tests together when plan/limit rules move
+3. Add or tighten drift tests when a pricing/runtime mismatch is fixed
+
+## Current State
+
+Cloud paid readiness is materially behind architecture work. The main concern is
+contract coherence between pricing, entitlements, and runtime enforcement.
+Legacy Cloud plan aliases are now expected to canonicalize to the `cloud_*`
+contract not only when Stripe metadata is parsed, but also when persisted plan
+versions are consumed at hosted entitlement and workspace-limit enforcement
+boundaries.
+Persisted billing state is now also part of that canonical boundary: when a
+recognized Cloud/MSP plan version is loaded or saved, the stored `plan_version`
+must canonicalize and `limits.max_monitored_systems` must reconcile to the authoritative
+per-plan contract rather than preserving stale ad hoc values.
+That same persisted billing boundary now also applies to hosted entitlement
+lease secrets: `internal/config/billing_state.go` may keep `EntitlementJWT`
+and `EntitlementRefreshToken` in runtime billing state, but `billing.json` may
+not persist either value raw. Canonical persistence must keep the hosted lease
+JWT and refresh token encrypted at rest, rewrite legacy plaintext billing files
+on load, and drop those secrets instead of preserving plaintext-at-rest billing
+state if encryption cannot be established. Empty/no-secret billing state may
+not auto-create new crypto state just to add integrity metadata; no-key
+graceful degradation remains canonical until a real billing secret or real
+encryption key exists.
+That same hosted billing boundary also owns base-path resolution:
+`internal/config/billing_state.go` and
+`internal/api/payments_webhook_handlers.go` must derive their base data
+directory from the shared runtime data-dir helper in
+`internal/config/config.go` instead of each carrying a private `/etc/pulse`
+fallback. Hosted billing leases, webhook dedupe state, and customer indexes
+must therefore follow the same configured runtime data-dir authority as the
+rest of the product.
+The same secret-at-rest rule also applies to activation state persistence:
+`pkg/licensing/activation_store.go` may keep `InstallationToken` and
+`GrantJWT` in runtime activation state, but `activation.enc` may accept
+plaintext only as migration input. Once a legacy plaintext activation file can
+be read, canonical persistence must rewrite encrypted storage immediately on
+load instead of treating plaintext as a steady-state runtime path.
+That same rule also applies to the canonical local license state in
+`pkg/licensing/persistence.go`: `license.enc` may carry the commercial license
+key and grace-period metadata in runtime state, but a legacy plaintext
+`license.enc` may only serve as migration input. Once it can be read,
+canonical persistence must rewrite encrypted storage immediately on load
+instead of treating plaintext licensing state as a valid steady-state path.
+Hosted entitlement-source loading follows the same rule: `DatabaseSource` must
+normalize persisted Cloud/MSP plan aliases and legacy limit keys before runtime
+evaluation, but it must not fabricate a canonical `plan_version` from bare
+subscription lifecycle state when the stored plan label is absent.
+Stripe control-plane fallback paths are also part of the boundary: when
+subscription or workspace provisioning logic reuses an already stored
+`plan_version`, it must canonicalize that value before persisting tenant,
+Stripe-account, or billing-state updates.
+Signed hosted entitlement leases are part of the same boundary: lease signing
+and verification must canonicalize recognized Cloud plan aliases and reconcile
+lease `limits.max_monitored_systems` to the authoritative per-plan contract instead of
+trusting stale embedded values. They also must not fabricate `plan_version`
+from bare `subscription_state` when the signed lease claim label is absent.
+The control-plane registry is also canonical: tenant and Stripe-account
+`plan_version` rows must canonicalize recognized Cloud aliases on read and
+write so stored legacy values cannot re-enter provisioning, entitlement, or
+limit-enforcement fallbacks.
+JWT-backed entitlement claims are also canonical: when runtime evaluation uses
+claim `plan_version` and `limits`, recognized Cloud plan aliases must
+canonicalize and `max_monitored_systems` must reconcile to the authoritative per-plan
+contract instead of trusting stale embedded claim values. When a Cloud/MSP
+claim arrives without a recognized plan label, runtime must preserve the
+missing/unknown `plan_version` metadata but still fail closed on `max_monitored_systems`
+instead of drifting to an unlimited tier default.
+Activation-grant translation is part of the same boundary: when relay/license
+server grants enter the local claims model, Cloud plan keys and lifecycle state
+must still resolve through the canonical entitlement claim accessors rather
+than becoming a parallel truth path.
+The legacy-license exchange transport is part of that same activation boundary:
+`pkg/licensing/activation_types.go` and `pkg/licensing/license_server_client.go`
+must treat `legacy_license_token` as the canonical v6 request field for
+`POST /v1/licenses/exchange`, while accepting `legacy_license_key` only as a
+backward-compatible decode alias for older local stubs and historical test
+fixtures. Future exchange-path changes must not reintroduce a split contract
+where the shared Pulse runtime and the real `pulse-pro/license-server` disagree
+on the activation payload shape.
+The self-hosted commercial counted unit is now also locked to monitored
+systems rather than agent installs. `max_monitored_systems` is the live
+runtime and UI contract, while legacy `max_agents` / `max_nodes` aliases are
+decode-only compatibility inputs at the storage or grant boundary. Runtime
+enforcement, entitlement payload `current` usage, checkout/activation flows,
+and upgrade messaging must all treat the cap as deduped top-level monitored
+systems across agent, API, and Kubernetes views.
+Frontend billing/admin surfaces must not synthesize `plan_version` from
+subscription lifecycle state. When a hosted billing record lacks a plan label,
+the UI must preserve that absence instead of fabricating values like `active`
+or `suspended` into the canonical plan field.
+The hosted billing-admin settings surface is now part of the explicit
+cloud-paid ownership model as well. Changes to
+`frontend-modern/src/components/Settings/BillingAdminPanel.tsx` must carry this
+contract and the dedicated billing-admin proof file instead of remaining an
+unowned consumer of hosted billing state.
+The organization billing settings surface now follows the same rule. Changes
+to `frontend-modern/src/components/Settings/OrganizationBillingPanel.tsx` must
+carry this contract and the dedicated organization-billing proof file instead
+of remaining an unowned consumer of plan tier, entitlement limits, and
+usage-versus-cap presentation.
+The self-hosted and hosted billing surfaces now also share a canonical
+commercial page shell and plan/usage model. `ProLicensePanel.tsx` and
+`OrganizationBillingPanel.tsx` may still differ in deployment-specific actions
+and context, but `CommercialBillingSections.tsx` and
+`frontend-modern/src/utils/commercialBillingModel.ts` now own the shared
+commercial information architecture. Future billing work must extend that
+shared shell/model first instead of letting self-hosted Pulse Pro and hosted
+organization billing drift back into parallel local layouts or vocabularies.
+Hosted tenant browser bootstrap is part of that same cloud-paid boundary as
+well. After control-plane or magic-link handoff, the browser client must
+preserve the tenant-scoped `pulse_org_id` context that the server issued
+instead of clearing it on first page load or collapsing back to `default`
+simply because hosted tenants do not expose self-hosted multi-tenant admin
+capabilities. Hosted runtime entry must therefore treat tenant org context as
+infrastructure state, not a paid UI toggle that can be discarded during app
+bootstrap.
+The Pro license settings surface now follows the same rule as well. Changes to
+`frontend-modern/src/components/Settings/ProLicensePanel.tsx` must carry this
+contract and the dedicated Pro-license proof file instead of remaining an
+unowned consumer of activation, trial eligibility, entitlement capability, and
+plan-term presentation.
+That owned presentation boundary includes the settings shell itself: the
+top-level Pulse Pro surface must keep its page-shell title and leading
+SettingsPanel title aligned so commercial activation, trial, and pricing state
+do not present as one surface in navigation and a differently named surface in
+the actual paid settings UI.
+Paid Pulse Pro v5 grandfathering is now part of that same canonical boundary:
+when a recurring v5 customer migrates into v6, billing persistence,
+entitlement evaluation, renewal handling, and Pro-license presentation must
+preserve the customer's existing recurring price identity instead of silently
+rewriting them onto current v6 retail pricing.
+That continuity rule cannot depend on webhook metadata being perfect. The
+canonical Stripe price-to-plan lookup in `pkg/licensing/features.go` and
+`pkg/licensing/stripe_subscription.go` must recognize the still-renewing
+grandfathered recurring v5 and legacy v1 Stripe price IDs directly, so a real
+`customer.subscription.updated` event that omits `metadata.plan_version` still
+resolves to `v5_pro_monthly_grandfathered` or
+`v5_pro_annual_grandfathered` instead of falling back to an opaque
+`stripe_price:*` marker.
+That Pro-license presentation rule is explicit UX, not only hidden metadata:
+when a migrated recurring v5 plan is active or in grace, the settings surface
+must render plan terms and a continuity notice that makes it clear the
+existing recurring price remains in force until cancellation.
+The self-hosted commercial presentation on that same surface is now locked to
+the monitored-system model as well. `ProLicensePanel.tsx`,
+`CommercialBillingSections.tsx`, and
+`frontend-modern/src/utils/commercialBillingModel.ts` must present current v6
+retail capacity as monitored systems rather than agents for Community, Relay,
+Pro, and Pro+, while leaving Cloud/MSP pricing semantics unchanged and
+preserving grandfathered v5 continuity copy as an explicit boundary policy.
+That contract applies to both plan summary labels and upgrade/paywall copy:
+current v6 self-hosted pricing may not drift back to the older `$49/yr Relay`,
+`$99/yr Pro`, or monitored-system-count marketing drift that contradicts the
+locked Community / Relay / Pro / Pro+ model.
+Cancellation is the explicit boundary for that policy. Once a grandfathered v5
+recurring subscription is canceled, any later return must resolve through the
+current v6 pricing contract rather than reviving the legacy recurring rate.
+The canonical cross-repo manual drill for that boundary is
+`docs/release-control/v6/COMMERCIAL_CANCELLATION_REACTIVATION_E2E_TEST_PLAN.md`.
+The paid relay settings and onboarding surfaces are now part of that same
+ownership model. Changes to
+`frontend-modern/src/components/Settings/RelaySettingsPanel.tsx` and
+`frontend-modern/src/components/Dashboard/RelayOnboardingCard.tsx` must carry
+this contract and the dedicated relay frontend proof files instead of
+remaining unowned consumers of relay licensing and onboarding state.
+That relay pairing boundary now also includes ephemeral device-token lifecycle:
+when the settings surface generates a mobile pairing QR, it must mint a fresh
+scoped API token for that pairing attempt, fetch the onboarding payload through
+that token context, and tear down superseded or failed pairing tokens instead
+of accumulating long-lived hidden credentials.
+That same pairing fetch path must stay token-bound instead of ambient-session
+bound: the onboarding QR request must carry the freshly minted relay pairing
+token explicitly so the returned payload reflects the exact credential that the
+mobile device will bootstrap with, not whichever browser session happened to
+open the settings page.
+The same flow must fail closed if the pairing payload omits the authenticated
+relay token state needed by the mobile deep link; pairing UI cannot silently
+render a QR that bypasses governed auth ownership.
+Relay pairing token presentation is part of that same contract as well: the
+settings surface must label those transient credentials distinctly from
+long-lived automation tokens so operators can identify and revoke stale mobile
+pairing attempts without guessing which credential was created for device
+bootstrap.
+Relay pairing refresh behavior is part of that lifecycle contract too: a
+successful QR refresh must revoke the superseded pairing token once the new
+token-backed payload is ready, while a failed refresh must revoke only the new
+failed token and keep the previously valid QR visible instead of collapsing the
+operator back to an empty pairing state.
+Hosted signup provisioning now follows the same rule. Changes to
+`internal/api/public_signup_handlers.go` and `internal/hosted/provisioner.go`
+must carry this contract and the dedicated hosted-signup provisioning proof
+files instead of remaining a split boundary between API handlers and an
+unowned hosted runtime helper.
+That hosted signup boundary is now also canonical in shape: the public signup
+handler owns request validation, trial billing initialization, and magic-link
+issuance, while `internal/hosted/provisioner.go` owns the shared org
+bootstrap/admin-role assignment and rollback path for hosted signup failures.
+Hosted billing-state normalization now follows the same rule: a missing
+`plan_version` must remain missing instead of being synthesized from
+`subscription_state`, while explicit trial defaults remain explicit.
+Hosted release builds must also accept the trial-activation public key from
+runtime environment when `PULSE_HOSTED_MODE=true`, because hosted tenants
+receive that verification key from control-plane deployment rather than from
+the embedded self-hosted release asset. Otherwise a hosted tenant can mount a
+valid lease and still fail its first hosted trial-activation verification path
+solely because the release binary refuses the deployed public-key source.
+Legacy MSP plan aliases are input-only compatibility shims. Live runtime
+defaults, fallback provisioning, entitlement issuance, and limit/workspace
+lookups must resolve to canonical `msp_starter` rather than preserving
+`msp_hosted_v1` as an active first-class plan name.
+Hosted control-plane plan resolution is now part of the enforced ownership
+model: changes to hosted entitlement issuance, control-plane registry
+canonicalization, or Stripe provisioning plan resolution must carry this
+contract and the path-specific proof files that verify those boundaries.
+Hosted tenant container bootstrap is part of that same boundary as well: the
+control plane may bind-mount billing and handoff files into `/etc/pulse` as
+read-only inputs, but runtime startup ownership repair must treat those paths
+as immutable and skip `chown` attempts against them instead of aborting tenant
+provisioning.
+That same immutable-file boundary now also owns write-time runtime ownership:
+control-plane provisioning and later billing-state rewrites must leave
+`billing.json`, `secrets/handoff.key`, and `.cloud_handoff_key` readable by
+the tenant Pulse runtime user at the moment they are written. Fixing startup
+`chown` behavior alone is not enough if the mounted files stay `root:root`
+after provisioning, because hosted auth handoff and hosted lease reads will
+then fail closed inside an otherwise healthy tenant.
+Hosted tenant org bootstrap is part of that same runtime boundary. Cloud and
+MSP tenant provisioning must seed a canonical tenant-scoped `org.json` under
+`orgs/<tenant-id>/` and leave both the directory tree and file readable by the
+hosted runtime user; otherwise hosted magic-link handoff can preserve the
+correct tenant org cookie while the tenant API still fails closed with
+`invalid_org` because no tenant organization metadata exists on disk.
+Hosted tenant runtime env is part of the same contract too: provisioned
+containers must carry hosted-safe tenant context such as
+`PULSE_TENANT_ID=<tenant-id>`, `PULSE_MULTI_TENANT_ENABLED=true`, and an explicit
+`PULSE_PUBLIC_URL=https://<tenant-id>.<base-domain>` so the tenant-scoped org
+surface is actually enabled after handoff instead of failing closed under a
+paid hosted session.
+Hosted MSP workspace org seeding is part of that same boundary too:
+`internal/cloudcp/account/tenant_handlers.go` owns the authenticated
+account-scoped workspace-create entry path, and
+`internal/cloudcp/stripe/provisioner.go` owns the underlying workspace/org
+bootstrap. When the control plane provisions a new workspace under an existing
+account, that boundary must seed `org.OwnerUserID` from the authenticated
+creator email when that actor is known on the request path instead of
+inferring a canonical owner from membership query order. If the creator is not
+available, fallback owner selection must still be deterministic rather than
+depending on newest-row ordering in the registry.
+Hosted tenant entitlement evaluation is part of that same boundary too: when a
+hosted tenant lands in a tenant-scoped org like `t-...`, the runtime must
+still honor the instance-level hosted billing lease in `default` until or
+unless an org-local billing state exists, rather than collapsing a freshly
+provisioned paid tenant into `subscription_required` on first entry.
+JWT-backed entitlement claim evaluation and activation-grant translation now
+follow the same explicit proof model instead of relying only on the broad cloud
+runtime catch-all policy.
+Persisted billing-state normalization, hosted database-source loading, Stripe
+plan derivation, and the cloud plan/limit tables now follow the same ratchet:
+they are expected to move behind path-specific proof routes rather than staying
+indistinguishable inside the generic cloud runtime policy.
+The runtime entitlement surface now follows the same rule: evaluator/token
+source accessors, hosted-subscription validity rules, and frontend entitlement
+payload construction should move behind explicit proof routes rather than being
+implicitly trusted as part of the catch-all cloud runtime layer.
+Cloud/MSP live price IDs are no longer an open fill-in task either. The audit
+record `docs/release-control/v6/records/cloud-msp-price-audit-2026-03-13.md`
+verified that the 13 canonical Cloud/MSP v6 `price_*` IDs are present in the
+governed `pulse-pro` operational docs and license-server env template, and that
+each ID resolves to an active live recurring Stripe price object.
+Activation service runtime, license-server transport, encrypted activation
+persistence, and hosted trial activation now follow the same ratchet. Changes
+to `pkg/licensing/service.go`, `pkg/licensing/grant_refresh.go`,
+`pkg/licensing/revocation_poll.go`, `pkg/licensing/license_server_client.go`,
+`pkg/licensing/persistence.go`, `pkg/licensing/activation_store.go`, and
+`pkg/licensing/trial_activation.go` should carry their dedicated proof files
+instead of relying only on the generic cloud runtime policy.
+The remaining cloud-paid runtime families now follow the same rule as well:
+feature/limit primitives, billing and entitlement type shapes, commercial
+migration and trial flow, conversion telemetry, host lifecycle tracking, and
+public-key/build-mode boundaries should all resolve through explicit proof
+routes rather than a package-wide `pkg/licensing/` fallback.
+Stripe checkout and subscription webhook persistence now also follows the
+canonical Cloud/MSP limit rule: when paid state is granted, billing-state
+writes must persist authoritative `limits.max_monitored_systems` derived from canonical
+plan resolution, and when paid state is revoked they must clear those stored
+limits instead of preserving stale paid capacity.
+That same monitored-system entitlement boundary also owns the shared operator
+warning copy: the limit banner and migration guidance must present the counted
+surface as monitored systems, not drift back into agent-install language while
+describing non-counted legacy/API-connected resources.
+That same webhook boundary now also owns request-lifetime decoupling for
+checkout provisioning: long-running `checkout.session.completed` tenant
+provisioning must complete under an explicit background timeout instead of
+depending on the inbound Stripe request context surviving long enough for first
+boot and health polling.
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
new file mode 100644
index 0000000000..42b032e15b
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -0,0 +1,352 @@
+# Deployment Installability Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "deployment-installability",
+ "lane": "L1",
+ "contract_file": "docs/release-control/v6/internal/subsystems/deployment-installability.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own server installation, deployment bootstrap behavior, update planning, and
+server-side update execution surfaces.
+
+## Canonical Files
+
+1. `internal/updates/`
+2. `internal/api/updates.go`
+3. `frontend-modern/src/api/updates.ts`
+4. `scripts/build-release.sh`
+5. `scripts/release_ldflags.sh`
+6. `scripts/install.ps1`
+7. `scripts/install.sh`
+8. `scripts/install-container-agent.sh`
+9. `scripts/pulse-auto-update.sh`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/api/updates.ts` shared with `api-contracts`: the updates frontend client is both a deployment-installability control surface and a canonical API payload contract boundary.
+2. `internal/api/updates.go` shared with `api-contracts`: update handlers are both a deployment-installability control surface and a canonical API payload contract boundary.
+3. `scripts/install.ps1` shared with `agent-lifecycle`: the Windows installer is both a deployment installability entry point and a canonical agent lifecycle runtime continuity boundary.
+4. `scripts/install.sh` shared with `agent-lifecycle`: the shell installer is both a deployment installability entry point and a canonical agent lifecycle runtime continuity boundary.
+
+## Extension Points
+
+1. Add or change deployment-type detection, update planning, or apply behavior through `internal/updates/`
+2. Add or change release-build metadata injection, release artifact assembly, or governed promotion metadata resolution through `scripts/build-release.sh`, `scripts/release_ldflags.sh`, and `scripts/release_control/resolve_release_promotion.py`, plus the container Dockerfile and governed release workflows that consume those same contracts
+3. Add or change shell installer, Windows installer, container-agent installer, or auto-update script behavior through `scripts/install.sh`, `scripts/install.ps1`, `scripts/install-container-agent.sh`, and `scripts/pulse-auto-update.sh`
+4. Add or change server update transport through `internal/api/updates.go` and `frontend-modern/src/api/updates.ts`
+
+## Forbidden Paths
+
+1. Leaving deployment bootstrap, installer, or update-runtime files unowned under broad monitoring or generic API ownership
+2. Duplicating deployment-type update planning, installer release resolution, or updater handoff behavior outside the canonical update engine and installer scripts
+3. Treating update transport as payload-only contract work when it also defines live deployment and upgrade behavior
+
+## Completion Obligations
+
+1. Update this contract when canonical deployment or installer entry points move
+2. Keep deployment runtime and shared API proof routing aligned in `registry.json`
+3. Preserve explicit coverage for installer parity, update planning, and deployment bootstrap behavior when these surfaces change
+
+## Current State
+
+This subsystem now makes deployment planning, updater orchestration, and the
+non-shell installer/update scripts explicit inside the current self-hosted
+release-confidence lane instead of leaving them as implied behavior around the
+core runtime.
+
+`internal/updates/` is the live deployment and upgrade planner. It owns
+deployment-type detection, update-plan generation, adapter selection, server
+update sequencing, and rollback-aware update state for supported Pulse
+deployments.
+That same boundary also owns the canonical running-version contract for
+release binaries: `internal/updates/version.go` must prefer the build-injected
+version string provided by the runtime entrypoint over git or working-tree
+fallbacks, so shipped release builds report the exact promoted version even
+when the install path has no `.git` metadata or a stale `VERSION` file nearby.
+Runtime bootstrap must seed that build version before the server starts rather
+than leaving version detection to deployment-local filesystem guesses.
+That release-build metadata path is now explicit too: `scripts/release_ldflags.sh`
+is the canonical owner for server and agent build ldflags, and release artifact
+assembly must route through it instead of hand-writing overlapping `main.Version`,
+`internal/updates.BuildVersion`, `internal/dockeragent.Version`, or license-key
+injection fragments across `scripts/build-release.sh`, `Dockerfile`, and the
+demo-deploy workflow. Shipped binaries, installable container images, and
+governed deployment-build workflows must all carry the same build metadata
+contract rather than depending on whichever local ldflags string happened to be
+updated last.
+The same governed promotion path must now stay explicit too:
+`scripts/release_control/resolve_release_promotion.py` is the canonical owner
+for stable-versus-RC metadata validation shared by `.github/workflows/release-dry-run.yml`
+and `.github/workflows/create-release.yml`. Promotion rollback targets, promoted
+RC lineage, soak checks, and GA/v5 notice metadata may not drift between those
+two workflows through duplicated inline shell validation.
+That same `internal/updates/` boundary now also owns runtime data-dir
+authority for temp, backup, and cleanup behavior: `manager.go` must resolve
+its working directories through the shared runtime data-dir helper instead of
+rebuilding `PULSE_DATA_DIR` plus `/etc/pulse` fallback logic inside each
+update stage.
+That same boundary also governs install.sh rollback restore targets:
+`adapter_installsh.go` may not hardcode `/etc/pulse` for rollback safety
+backups or config restore, and must derive the rollback config directory
+through that same shared runtime data-dir helper.
+That same runtime env contract also governs `pulse mock`: the CLI may not keep
+writing a separate `mock.env` sidecar when supported runtime installs already
+carry mock-mode ownership through `.env`. Mock enable/disable/status must use
+the canonical runtime `.env` path, with any install-dir `.env` probe treated as
+compatibility only.
+That same rule applies to live runtime behavior too: config loading and reload
+watching may not treat `mock.env` as a parallel primary-path control surface.
+Supported mock-mode runtime state must come from the canonical `.env` contract,
+and `.env` reload handling must own `PULSE_MOCK_*` updates and monitor reload
+triggers directly.
+
+The shell installer, Windows installer, container-agent installer, and
+unattended auto-update scripts are part of the same runtime boundary, not just
+release artifacts. `scripts/install.sh`, `scripts/install.ps1`,
+`scripts/install-container-agent.sh`, and `scripts/pulse-auto-update.sh`
+define supported deployment entry points and update behavior, even when the
+shell and Windows installers also sit on the shared agent-lifecycle boundary.
+That shared `scripts/install.sh` boundary must also keep one canonical service
+argument builder for the runtime flags it persists. Token-bearing install
+paths, token-file systemd paths, wrapper-script launches, and later service
+materialization must all derive their flag set from the same installer-owned
+argument item list instead of rebuilding overlapping `--url`, `--token`,
+feature toggles, identity flags, and disk-exclude transport in separate shell
+blocks.
+That shared `scripts/install.sh` boundary must also stay aligned with the
+canonical auto-register contract: when the installer performs Proxmox
+auto-registration after creating a local token, it must submit that token
+completion on the canonical /api/auto-register contract using the canonical
+`tokenId`/`tokenValue` payload shape and the explicit `source="script"`
+marker, that marker must stay exactly `script` rather than a lane-local alias,
+the node `type` must stay on the supported `pve` or `pbs` set,
+the `tokenId` must stay on the canonical Pulse-managed
+`pulse-monitor@{pve|pbs}!pulse-<canonical-scope-slug>` identity matching the
+selected node type, and the locally created Proxmox token name must stay on the same
+deterministic Pulse-managed `pulse-<canonical-scope-slug>` contract used by the
+other v6 registration callers instead of appending timestamp or rerun-local
+entropy,
+and it must fail closed unless the response comes back on the canonical
+`status="success"` plus `action="use_token"` completion shape. That same
+installer response handling must also use the returned canonical
+`nodeId`/`nodeName` identity instead of continuing to report the caller's local
+hostname after Pulse stores a disambiguated node record.
+That same installer-owned bootstrap step against `/api/setup-script-url` must
+also validate the returned canonical `type`, normalized `host`, and live
+`expires` metadata before using the one-time setup token, so install-time
+registration cannot drift onto a stale or mismatched bootstrap response. A
+non-empty `expires` field alone is not sufficient; the installer must reject
+bootstrap responses whose expiry is already in the past. That same bootstrap
+consumer must also fail closed unless the runtime-owned setup metadata is
+present and coherent: installer-side Proxmox auto-register must reject missing
+or mismatched `url`, `scriptFileName`, `command`, `commandWithEnv`, or
+`commandWithoutEnv` fields instead of treating `/api/setup-script-url` as a
+setup-token-only side channel. It must also require the canonical
+token-bearing `downloadURL` and masked `tokenHint` fields, so the installer is
+validating the same full bootstrap artifact contract as the governed settings
+surface instead of accepting an older reduced response shape. Those installer
+checks must also validate command transport coherence, not just field presence:
+the returned token-bearing commands must reference the canonical setup-script
+URL and carry the setup token through the governed root-or-sudo wrapper, while
+the preview `commandWithoutEnv` transport must stay on the same canonical URL
+without leaking the setup token back into the non-secret path. That bootstrap
+request itself must stay on the real setup-script-url auth boundary too:
+install-time Proxmox auto-register must not model `/api/setup-script-url` as a
+setup-token-authenticated endpoint or depend on scraping a plaintext
+`.bootstrap_token` file just to call it. The supported operator retrieval path
+for first-session bootstrap is `pulse bootstrap-token`, and runtime bootstrap
+token persistence must stay encrypted at rest.
+That same bootstrap artifact contract must now be backend-owned as one
+canonical install artifact model rather than a handler-local bootstrap struct
+plus a second response envelope. Shell downloads, setup-script-url responses,
+and rerun guidance must all read from that same backend artifact shape.
+Generated PVE and PBS setup-script bodies must also render through shared
+backend install helpers instead of a handler-local shell template engine in
+`config_setup_handlers.go`, so installability ownership stays at the shared
+artifact/render boundary rather than inside one route handler.
+That same post-install discovery refresh path must treat discovery string
+errors as compatibility-only output derived from canonical structured runtime
+errors, so setup/install handlers do not become a second owner of legacy
+discovery payload state.
+That shared `scripts/install.ps1` boundary must also stay under explicit proof
+routing on both sides instead of relying only on broad installer-script
+coverage: Windows installer changes must continue to carry the direct
+`windows-agent-installer-runtime` lifecycle proof together with the direct
+`deployment-script-runtime` installability proof.
+That same installability proof rule also applies to
+`scripts/install-container-agent.sh`: changes to the container-agent installer
+must stay on the direct `deployment-script-runtime` proof path instead of
+relying only on broad script ownership.
+That same rule also applies to `scripts/pulse-auto-update.sh`: changes to the
+unattended auto-update script must stay on the direct
+`deployment-script-runtime` proof path instead of relying only on broad script
+ownership.
+That Windows installer boundary must also stay aligned with token-optional
+Pulse deployments: when the server does not require API tokens, the installer
+must accept a missing token and persist service arguments without `--token`
+instead of advertising an optional-auth install path that still fails local
+parameter validation.
+The same Windows installer boundary must also preserve profile-target parity
+with the governed settings surface: when PowerShell install transport sets
+`PULSE_ENABLE_PROXMOX` and `PULSE_PROXMOX_TYPE`, `scripts/install.ps1` must
+validate and persist those Proxmox flags into the service command line rather
+than discarding the selected profile at install time.
+That same Windows installer boundary must also preserve governed transport and
+runtime toggles from the settings surface: when PowerShell install transport
+sets `PULSE_INSECURE_SKIP_VERIFY` or `PULSE_ENABLE_COMMANDS`,
+`scripts/install.ps1` must persist those settings into the service command line
+instead of dropping TLS-mode or command-execution intent on Windows installs.
+The same insecure-TLS boundary must also affect installer-owned network calls:
+when `PULSE_INSECURE_SKIP_VERIFY` is enabled, `scripts/install.ps1` must use
+that relaxed certificate policy for its own agent download and uninstall
+deregistration requests so self-signed deployments do not fail before the
+persisted Windows service ever starts.
+Copied PowerShell uninstall commands must preserve that same
+`PULSE_INSECURE_SKIP_VERIFY` setting so the governed deregistration request can
+still reach self-signed Pulse deployments during removal.
+Copied per-agent uninstall commands must also preserve the canonical agent
+identity when the settings surface already knows it, so `scripts/install.sh`
+and `scripts/install.ps1` do not have to fall back to local state-file recovery
+or hostname lookup just to deregister the selected agent.
+Those copied uninstall commands must also preserve the canonical hostname as
+the fallback identity and the installer runtimes must honor it first during
+lookup recovery, so removal stays bound to the selected Pulse inventory row
+instead of drifting to the local machine name.
+That same identity continuity must persist across later shell-managed removal:
+the saved `connection.env` state must retain explicit agent and hostname
+identity when install or upgrade supplied them, so offline uninstall does not
+lose the selected node identity just because the runtime state file is absent.
+That same saved shell artifact must now stay installer-owned as one canonical
+writer/reader path: `scripts/install.sh` may not keep a heredoc writer plus a
+second inline field parser for the same `connection.env` contract, because
+offline uninstall must consume the same persisted install-state artifact the
+installer wrote instead of reconstructing it ad hoc.
+That same installer ownership now also applies to service lifecycle control:
+upgrade, reinstall, and platform-specific start/restart flows may not each
+carry their own stop/start command sequence for the same agent runtime.
+`scripts/install.sh` must route systemd, OpenRC, SysV, and service-command
+control through explicit installer-owned helpers so service behavior does not
+drift by platform block.
+The same canonical ownership must cover teardown and removal too: uninstall,
+reinstall cleanup, and platform-specific disable/remove flows may not each
+re-author stop, disable, remove, and daemon-reload sequences inline.
+`scripts/install.sh` must route service teardown through shared installer
+helpers so removal semantics stay consistent across systemd, OpenRC, SysV,
+and service-command runtimes.
+TrueNAS boot recovery must follow the same rule: SCALE and CORE bootstrap
+scripts may differ only in their service-manager adapter, while binary sync,
+service-link recreation, and boot-time start flow stay on one installer-owned
+renderer instead of two separate heredocs.
+That same ownership rule applies to persisted service definitions: DSM, Linux,
+TrueNAS, and FreeBSD service/unit files may not keep re-authoring the same
+runtime contract in separate heredocs. `scripts/install.sh` must route shared
+systemd and FreeBSD rc.d rendering through canonical installer-owned helpers,
+with platform branches only supplying the adapter-specific inputs.
+That same installer ownership must also cover completion reporting: platform
+branches may not each rebuild their own health-verification result handling,
+`json_event` completion payloads, or uninstall guidance. `scripts/install.sh`
+must route final save-state, healthy/unhealthy status output, and completion
+event emission through one canonical installer-owned helper.
+FreeBSD enablement must follow the same rule: direct rc.d installs and
+TrueNAS CORE bootstrap may not keep separate inline `pulse_agent_enable`
+mutation logic. `scripts/install.sh` must own one canonical rc.conf enablement
+snippet/helper and reuse it across runtime and boot-recovery paths. That helper
+must execute the shared snippet in-process before applying it, rather than
+defining the function in a throwaway subshell that leaves the enable step
+silently undone.
+SysV enable-on-boot registration must follow the same rule: install-time
+`update-rc.d`, `chkconfig`, and manual rc.d symlink fallback may not live as a
+separate inline block when teardown already has a canonical owner. The
+installer must route SysV registration through one shared helper so service
+registration semantics do not drift between install and removal paths.
+Windows installability must follow the same rule: installer-owned state under
+ProgramData must retain explicit connection identity from install or upgrade so
+later PowerShell uninstall can still deregister the intended agent record when
+runtime-local state is missing or stale.
+The same uninstall lookup transport rule applies across both canonical
+installers: when fallback identity recovery calls `/api/agents/agent/lookup`,
+the resolved hostname must be percent-encoded before it is placed in the query
+string.
+The same copied uninstall commands must also fail closed on token-required
+deployments: when auth is required, command builders must preserve the required
+token contract instead of silently emitting tokenless removal transport.
+The same copied Unix lifecycle commands must also preserve shell-safe argument
+transport, so canonical URL, token, agent ID, and hostname values survive copy
+and paste without being re-tokenized by the local shell.
+The same copied Windows lifecycle commands must preserve PowerShell-safe
+argument transport, so canonical URL, token, agent ID, and hostname values do
+not get reinterpreted by PowerShell during uninstall or upgrade. That same
+Windows upgrade transport must also quote the resolved `install.ps1` URL, so
+custom canonical URLs with spaces still survive copied PowerShell reruns.
+The same uninstall transport must quote that resolved script URL as well, so
+Windows removal on custom canonical URLs does not regress back to unquoted
+PowerShell invocation.
+The same copied install commands must preserve shell-safe and PowerShell-safe
+transport for canonical URL/token values, so copy-paste install flows do not
+reinterpret those inputs before the installer even starts.
+That same Windows interactive install transport must preserve the selected
+canonical server URL in `PULSE_URL`, so a copied PowerShell install command
+cannot drift back to a different prompted target after downloading the script.
+When the settings surface already has a selected token, that same interactive
+Windows install transport must preserve it in `PULSE_TOKEN` as well, so copied
+PowerShell installs do not regress to a second credential prompt after the user
+already generated the governed token.
+Before a real token exists, the same interactive Windows transport must stay
+prompt-based instead of exporting a placeholder token value into `PULSE_TOKEN`.
+On token-optional Pulse instances, that same governed install surface must
+support both valid paths: no-token transport after explicit confirmation, and
+credentialed transport when the operator still generates a real token. Optional
+auth may not silently downgrade the settings surface to tokenless-only mode.
+That Windows installer-owned state must also be cleared after successful
+PowerShell uninstall, so a removed installation does not leave stale ProgramData
+identity or transport continuity behind for later lifecycle commands.
+The same saved uninstall state must preserve insecure/self-signed transport
+mode for both canonical installers, so an offline uninstall on a self-signed
+Pulse deployment does not regress from the original operator-approved transport
+policy back to strict TLS.
+For the shell installer, saved uninstall state must also preserve custom CA
+bundle transport so offline removal can still reach Pulse when trust depends on
+an explicit `--cacert` path instead of insecure mode.
+The Windows installer must preserve the same installer-owned custom CA
+transport continuity: when install or upgrade ran with `PULSE_CACERT`,
+`scripts/install.ps1` must validate that certificate file, use it for its own
+download and uninstall-time API transport, and persist the path so later
+offline uninstall can recover governed trust without falling back to insecure
+mode or strict default trust.
+That same installer-owned custom-CA continuity must also reach the Windows
+service it provisions: `scripts/install.ps1` must persist `--cacert` into the
+created `pulse-agent` service command line so the installed agent keeps using
+the same governed trust chain for runtime update, remote-config, and reporting
+transport instead of narrowing `PULSE_CACERT` to installer-only HTTPS.
+That offline shell uninstall recovery must trigger on partial operator-supplied
+context, not only when URL or token are absent, so persisted identity and
+transport continuity still reload when a later uninstall command provides only
+part of the canonical connection tuple.
+The same copied-upgrade path must preserve canonical agent and hostname
+identity when the settings surface already knows them, so rerunning the
+installer for an outdated node does not reset service/runtime identity back to
+ambient local machine defaults.
+The same Windows installer boundary must keep uninstall deregistration aligned
+with token-optional deployments: when URL and agent identity are known, the
+PowerShell uninstall path must still call the canonical agent-uninstall API
+without requiring an API token, adding `X-API-Token` only when a real token is
+available.
+
+`internal/api/updates.go` and `frontend-modern/src/api/updates.ts` are shared
+boundaries with `api-contracts`: they are the product-facing update transport
+surface while canonical payload-shape governance remains explicit in the API
+contract boundary.
+That shared update transport boundary must also stay under explicit proof
+routing on both sides instead of relying only on generic API fallback
+coverage: update transport changes must continue to carry the direct
+`updates-api-surface` installability proof together with a direct
+API-contract proof path.
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
new file mode 100644
index 0000000000..ec25e26640
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -0,0 +1,236 @@
+# Frontend Primitives Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "frontend-primitives",
+ "lane": "L8",
+ "contract_file": "docs/release-control/v6/internal/subsystems/frontend-primitives.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own reusable frontend primitives and canonical page-shell patterns so feature
+work extends shared components instead of creating new local variants.
+
+## Canonical Files
+
+1. `frontend-modern/src/components/shared/`
+2. `frontend-modern/src/components/Settings/Settings.tsx`
+3. `frontend-modern/src/components/Settings/SettingsPageShell.tsx`
+4. `frontend-modern/src/components/Settings/settingsPanelRegistry.ts`
+5. `frontend-modern/src/components/Settings/APIAccessPanel.tsx`
+6. `frontend-modern/src/components/Settings/AISettings.tsx`
+7. `frontend-modern/src/components/Settings/AuditLogPanel.tsx`
+8. `frontend-modern/src/components/Settings/AuditWebhookPanel.tsx`
+9. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`
+10. `frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx`
+11. `frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx`
+12. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx`
+13. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx`
+14. `frontend-modern/src/components/Settings/settingsHeaderMeta.ts`
+15. `frontend-modern/src/components/Settings/SettingsPageShell.tsx`
+16. `frontend-modern/src/components/Settings/settingsPanelRegistry.ts`
+17. `frontend-modern/src/components/Settings/SSOProvidersPanel.tsx`
+18. `frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx`
+19. `frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts`
+20. `tests/integration/tests/15-settings-shell-consistency.spec.ts`
+21. `frontend-modern/src/components/shared/PageControls.guardrails.test.ts`
+22. `frontend-modern/src/components/shared/TypeColumn.guardrails.test.ts`
+23. `frontend-modern/src/features/`
+24. `frontend-modern/src/components/SetupWizard/SetupWizard.tsx`
+25. `frontend-modern/src/components/SetupWizard/SetupCompletionPreview.tsx`
+26. `frontend-modern/src/components/SetupWizard/__tests__/SetupWizard.test.tsx`
+27. `frontend-modern/src/components/SetupWizard/__tests__/SetupCompletionPreview.test.tsx`
+28. `frontend-modern/src/components/shared/MonitoredSystemLimitWarningBanner.tsx`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx` shared with `security-privacy`: the general settings privacy panel is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+2. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx` shared with `security-privacy`: the authentication settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+3. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` shared with `security-privacy`: the security overview settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+
+## Extension Points
+
+1. Add shared primitives in `frontend-modern/src/components/shared/`
+2. Route new top-level settings surfaces through the canonical settings shell
+ instead of introducing page-local framing
+3. Add feature-specific presentation only when no shared primitive should own it
+4. Add guardrail tests when a new shared pattern is introduced
+
+## Forbidden Paths
+
+1. Reinventing table/filter/toggle primitives when a shared version exists
+2. Feature-local styling forks of canonical shared components without explicit justification
+3. Direct imports that bypass shared presentation helpers where guardrails exist
+4. Top-level settings panels introducing bespoke page-level headers or outer
+ framing instead of the canonical settings shell and `SettingsPanel`
+ contract
+
+## Completion Obligations
+
+1. Update guardrail tests when new shared primitives are added
+2. Keep top-level settings surfaces routed through the canonical settings shell
+ and maintain both `frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts`
+ plus `tests/integration/tests/15-settings-shell-consistency.spec.ts`
+3. Update this contract when a new canonical UI pattern is adopted
+4. Remove local forks after the shared primitive is introduced
+
+## Current State
+
+The frontend already has several guardrail tests. The next step is to keep
+turning repeated local patterns into explicit shared primitives with hard usage
+bounds.
+
+The subsystem registry now also requires explicit proof-policy coverage for all
+shared runtime files, and shared-component guardrails fail if raw table
+composition is reintroduced in new shared components outside the canonical
+allowlist.
+
+General settings segmented selectors for theme preference and temperature unit
+must now also route through the shared `FilterButtonGroup` primitive instead of
+maintaining local button-group styling forks inside
+`frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`.
+
+Reporting time-range/export selectors and General settings Proxmox VE polling
+presets must now also route through the shared `FilterButtonGroup` prominent
+variant instead of maintaining local blue segmented-control styling forks in
+feature components.
+That same shared `FilterButtonGroup` primitive must stay CSP-safe: touch-scroll
+overflow behavior must come from canonical CSS classes rather than inline
+`style` attributes so settings and reporting selectors do not reintroduce
+browser console CSP violations under the release build policy.
+
+Selectable settings cards for compact provider pickers and detail choice panels
+must now route through the shared `SelectionCardGroup` primitive instead of
+duplicating border-2 active-card styling in feature components.
+
+Settings informational callouts with icon-plus-copy layouts must now route
+through the shared `CalloutCard` primitive instead of maintaining feature-local
+blue bordered wrappers.
+
+Alert incident-event filter containers, labels, and chips must now route
+through the shared presentation helpers in
+`frontend-modern/src/utils/alertIncidentPresentation.ts` instead of allowing
+`frontend-modern/src/pages/Alerts.tsx` and
+`frontend-modern/src/features/alerts/OverviewTab.tsx` to fork their own filter
+button styling.
+
+Alert incident acknowledged badges, event cards, and note-editor controls must
+also route through `frontend-modern/src/utils/alertIncidentPresentation.ts`
+instead of letting the alerts page and overview timeline maintain duplicate
+inline incident-detail styling.
+
+Alert incident meta-row and detail-text presentation must also route through
+`frontend-modern/src/utils/alertIncidentPresentation.ts` instead of letting
+the alerts page and overview timeline maintain duplicated inline incident
+typography rules.
+
+Resource incident panel card and summary-row presentation must also route
+through `frontend-modern/src/utils/alertIncidentPresentation.ts` instead of
+maintaining page-local incident panel styling inside
+`frontend-modern/src/pages/Alerts.tsx`.
+
+Shared primitive consumers that split status-dot tone and status-text tone
+must now keep both values routed through the same exported presentation helper.
+Feature cards such as RAID status may not call shadow local aliases that drift
+from the canonical shared class/variant helpers.
+
+Active alert card state and action-button presentation must also route through
+`frontend-modern/src/utils/alertOverviewPresentation.ts` instead of leaving
+feature-local alert card styling inside
+`frontend-modern/src/features/alerts/OverviewTab.tsx`.
+
+Shared search inputs must now keep their forwarded keyboard, blur, and clear
+handlers as explicit callable functions instead of relying on loose Solid
+event-handler unions. Shared search primitives still need to accept the real
+input/button event targets, but direct invocation inside the primitive must
+stay type-safe so consumers do not reintroduce union-call regressions while
+adding history, shortcut, or trailing-control behavior.
+
+Shared shared-shell primitives that expose semantic `title` or value-level
+`onChange` props must now explicitly omit the conflicting DOM attribute names
+from their inherited HTML props. `CalloutCard`, `FilterSegmentedControl`, and
+`Subtabs` may still forward ordinary div attributes, but their canonical API
+must preserve JSX element titles and value-callback handlers instead of
+widening back to raw DOM attribute unions.
+
+Shared entitlement/migration warning banners that live under
+`frontend-modern/src/components/shared/` must also keep their counted fleet
+surface on the Pulse Unified Agent term. Shared primitive copy may describe
+legacy/API-connected resources separately, but it may not regress the primary
+banner label or CTA text back to host-agent product language.
+The self-hosted commercial paywall copy on those shared warning surfaces is
+now also explicitly locked to monitored systems rather than agents. When a
+shared banner or shared settings shell is explaining self-hosted plan caps,
+the operator-facing commercial term must follow the monitored-system model even
+if explicit legacy-v5 compatibility helpers still decode older alias fields at
+import boundaries.
+That banner boundary now also owns the canonical monitored-system naming
+surface directly: the shared warning component path and exported symbol are
+`MonitoredSystemLimitWarningBanner`, and future work may not reintroduce an
+agent-era banner filename or component name as the primary primitive.
+First-session educational surfaces must also stay brief, flat, and model-led.
+When Pulse needs to teach a user how a flow works, the primary on-screen
+guidance should collapse to a few short descriptions of the real product
+mental model instead of a logo wall, feature brochure, or verbose internal
+mechanics dump. The runtime wizard itself now stays on the two-step
+`Welcome -> Security` path, while the separate setup-completion preview owns
+the brief three-step explanation: install the Unified Agent, get the first
+Pulse resource, then layer on additional context.
+
+The settings shell is now also a governed frontend primitive boundary.
+Top-level settings surfaces must route through `Settings.tsx`,
+`SettingsPageShell.tsx`, and
+`frontend-modern/src/components/shared/SettingsPanel.tsx` instead of
+reintroducing bespoke outer page headers or one-off top-level panel framing.
+The shell metadata driving those surfaces is part of the same boundary as
+well: `frontend-modern/src/components/Settings/settingsHeaderMeta.ts` and
+representative top-level panels such as
+`frontend-modern/src/components/Settings/APIAccessPanel.tsx`,
+`frontend-modern/src/components/Settings/AISettings.tsx`,
+`frontend-modern/src/components/Settings/AuditLogPanel.tsx`,
+`frontend-modern/src/components/Settings/AuditWebhookPanel.tsx`,
+`frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`,
+`frontend-modern/src/components/Settings/NetworkSettingsPanel.tsx` must keep
+`frontend-modern/src/components/Settings/SecurityAuthPanel.tsx` must keep
+`frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx`,
+`frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx`,
+`frontend-modern/src/components/Settings/SSOProvidersPanel.tsx`, and
+`frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx` must keep
+page-shell titles, descriptions, and lead panel framing aligned instead of
+letting navigation/header labels drift away from the actual settings surface.
+First-session runtime framing is now part of that same owned primitive story.
+`frontend-modern/src/components/SetupWizard/SetupWizard.tsx` must stay on the
+real two-step runtime shape (`Welcome`, then `Security`) and hand successful
+setup directly into the canonical Infrastructure Operations install route
+instead of regrowing a second setup-only completion step. The standalone
+preview surface in
+`frontend-modern/src/components/SetupWizard/SetupCompletionPreview.tsx` may
+still exist for guarded preview coverage, but it must remain explicitly
+separate from the runtime wizard so first-session UX does not split into two
+competing product flows again.
+The release-ready shell proof now also includes a representative desktop
+Playwright rehearsal in
+`tests/integration/tests/15-settings-shell-consistency.spec.ts` so general,
+organization, billing, relay, security, AI, updates, and recovery panels are
+all exercised through the built app shell under a seeded multi-tenant runtime.
+The security-facing settings panels within that shell now also follow an
+explicit shared boundary with `security-privacy` so shell framing stays here
+while auth posture, token controls, and privacy semantics remain governed as a
+trust surface instead of generic UX copy.
+
+Single-surface settings pages that only render one canonical `SettingsPanel`
+must stay rooted directly at that panel instead of wrapping it in an extra
+page-level `space-y-*` container. `frontend-modern/src/components/Settings/UpdatesSettingsPanel.tsx`
+`frontend-modern/src/components/Settings/RecoverySettingsPanel.tsx`, and
+`frontend-modern/src/components/Settings/AuditLogPanel.tsx` are the current
+reference cases, and
+`frontend-modern/src/components/Settings/__tests__/settingsArchitecture.test.ts`
+locks that direct-root contract so single-surface pages do not quietly regain
+redundant outer spacing chrome.
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.md
new file mode 100644
index 0000000000..43bdc4f0c4
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/monitoring.md
@@ -0,0 +1,171 @@
+# Monitoring Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "monitoring",
+ "lane": "L13",
+ "contract_file": "docs/release-control/v6/internal/subsystems/monitoring.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": [
+ "unified-resources"
+ ]
+}
+```
+
+## Purpose
+
+Own polling, typed collection, runtime state assembly, and canonical monitoring
+truth for live infrastructure data.
+
+## Canonical Files
+
+1. `internal/monitoring/monitor.go`
+2. `internal/monitoring/poll_providers.go`
+3. `internal/monitoring/monitor_discovery_helpers.go`
+4. `internal/monitoring/metrics.go`
+5. `internal/monitoring/metrics_history.go`
+6. `internal/unifiedresources/read_state.go`
+7. `internal/unifiedresources/monitor_adapter.go`
+8. `internal/unifiedresources/views.go`
+9. `docker-entrypoint.sh`
+
+## Shared Boundaries
+
+1. None.
+
+## Extension Points
+
+1. Add pollers/providers and discovery-provider coordination through `internal/monitoring/poll_providers.go` and `internal/monitoring/monitor_discovery_helpers.go`
+2. Add metrics capture or history-retention behavior through `internal/monitoring/metrics.go` and `internal/monitoring/metrics_history.go`
+3. Add typed read access through `internal/unifiedresources/views.go`
+4. Add unified supplemental ingest through `internal/monitoring/poll_providers.go`
+5. Add or change container startup ownership/bootstrap behavior for hosted or managed Pulse runtime mounts through `docker-entrypoint.sh`
+
+## Forbidden Paths
+
+1. New consumer logic built directly on `Monitor.GetState()`
+2. New runtime truth living only in `models.StateSnapshot`
+3. Snapshot-backed helper paths used where `ReadState` should be authoritative
+
+## Completion Obligations
+
+1. Update this contract when monitoring truth ownership changes
+2. Tighten guardrails when `GetState()`-centric paths are removed
+3. Keep discovery-provider, metrics-history, and container bootstrap proof routes explicit in `registry.json`
+4. Update related read-state or monitor tests when new collector paths land
+
+## Current State
+
+This subsystem now sits under the dedicated core monitoring runtime lane so
+discovery, metrics-history correctness, and platform-specific runtime coverage
+can be governed as first-class product work instead of staying diluted inside
+architecture coherence.
+
+The monitor adapter now also acts as the canonical bridge from live registry
+rebuilds and supplemental ingest into the unified-resource timeline. That means
+monitoring no longer just materializes state snapshots for consumers; it also
+emits durable `ResourceChange` history through the shared resource store so
+live monitoring updates and historical inspection stay aligned.
+
+The registry proof map now treats provider discovery and metrics history as
+their own governed runtime surfaces instead of leaving them folded into a
+generic monitoring catch-all. Changes to provider wiring, discovery helpers,
+or metrics history retention must stay attached to those explicit proof routes.
+
+Consumer packages already use `ReadState`, but the monitoring core still has
+dual truth between unified resources and `StateSnapshot`. This is the main
+remaining architecture-coherence lane.
+The container entrypoint in `docker-entrypoint.sh` now also lives under this
+boundary. Hosted or managed tenant bootstrap changes must preserve safe startup
+when immutable read-only mounts are layered into `/etc/pulse`; the entrypoint
+may not reintroduce ownership mutation against those read-only files during
+container boot.
+
+Storage export is now derived from canonical `ReadState.StoragePools()`
+instead of `GetState().Storage`; `models.Storage` is treated as a boundary
+artifact for that path.
+
+Node export is now derived from canonical `ReadState.Nodes()` instead of
+`GetState().Nodes`; `models.Node` is treated as a boundary artifact for that
+path.
+
+Host export is now derived from canonical `ReadState.Hosts()` instead of
+`GetState().Hosts`; `models.Host` is treated as a boundary artifact for that
+path.
+
+Docker host export is now derived from canonical `ReadState.DockerHosts()`
+instead of `GetState().DockerHosts`; `models.DockerHost` is treated as a
+boundary artifact for that path.
+
+VM and container export are now derived from canonical `ReadState.VMs()` and
+`ReadState.Containers()` instead of `GetState().VMs`/`GetState().Containers`;
+`models.VM` and `models.Container` are treated as boundary artifacts for those
+paths.
+
+PBS instance export is now derived from canonical `ReadState.PBSInstances()`
+instead of `GetState().PBSInstances`; `models.PBSInstance` is treated as a
+boundary artifact for that path.
+
+Backup-alert guest lookup assembly now derives VM/container identity from
+canonical `ReadState` workload views instead of from snapshot-owned guest
+arrays, so backup alert resolution follows unified runtime truth when a live
+resource registry exists.
+
+Physical-disk refresh/merge logic now derives physical disks, nodes, and linked
+host-agent context from canonical `ReadState` before applying NVMe temperature
+and SMART merges, so skipped or background disk refresh no longer treats the
+snapshot as internal truth for that path.
+
+Backup polling and recovery guest identity assembly now derive workload node,
+name, and type context from canonical `ReadState` instead of from
+snapshot-owned VM/container arrays, so storage backup polling, guest snapshot
+polling, timeout sizing, PBS recovery candidate assembly, and Proxmox recovery
+ingest all follow unified runtime truth when a live resource registry exists.
+Typed unified-resource views also need to present canonical monitoring truth,
+not raw ingest formatting. Linked topology accessors exposed through
+`internal/unifiedresources/views.go` must trim outer whitespace before
+returning linked agent, node, VM, or container IDs so downstream consumers do
+not observe `" node-99 "` style drift when the canonical linkage is `node-99`.
+Source-owned IDs exposed through those same typed views must also trim outer
+whitespace before they reach monitoring consumers, so a docker host, VM, node,
+or storage view cannot appear to carry a different source identity just
+because the ingest payload wrapped the source ID in spaces.
+The same applies to proxmox topology coordinates exposed through typed views:
+node, cluster, and instance accessors must return canonical trimmed values so
+monitoring consumers do not fork topology grouping or labeling on `" pve-a "`
+versus `pve-a`.
+
+Storage-backup preservation now also derives node-to-storage membership from
+canonical `ReadState.StoragePools()` instead of from snapshot-owned storage
+arrays, leaving only persisted backup/cache payloads in this path on direct
+snapshot state.
+
+Canonical monitoring guardrails now also fail if resource-array access is
+reintroduced through `GetState().VMs`/`Containers`/`Nodes`/`Hosts`/`Storage`/
+`DockerHosts`/`PBSInstances` helpers, and the subsystem registry now requires
+explicit proof-policy coverage for all owned runtime files.
+Memory-source classification now also routes through one canonical runtime
+catalog and extracted node resolver under `internal/monitoring/`. Node, VM,
+LXC, diagnostics, and
+diagnostic-snapshot consumers must normalize aliases such as `avail-field`,
+`meminfo-available`, `meminfo-derived`, `meminfo-total-minus-used`, and
+`listing-mem` onto the governed canonical labels `available-field`,
+`derived-free-buffers-cached`, `derived-total-minus-used`, and
+`cluster-resources` before trust or fallback reporting is emitted.
+That same catalog owns fallback-reason defaults for governed fallback sources,
+so monitoring producers and downstream diagnostics must not fork fallback
+classification or reason text through lane-local switch statements.
+That same canonicalization boundary must also run when snapshots are recorded,
+not only at source selection time: node and guest diagnostic snapshots must
+normalize memory-source aliases and backfill default fallback reasons before
+logging or persistence, so later diagnostics/reporting cannot diverge just
+because one poll path still emitted a compatibility label.
+That compatibility boundary also applies to historical snapshot labels that may
+still exist in tests, live in-memory state, or pre-canonical diagnostic paths:
+legacy aliases such as `rrd-available`, `rrd-data`, `node-status-available`,
+`calculated`, and `listing` must normalize onto the governed canonical labels
+before snapshots are returned to diagnostics consumers, not only when new
+snapshots are first recorded.
diff --git a/docs/release-control/v6/internal/subsystems/notifications.md b/docs/release-control/v6/internal/subsystems/notifications.md
new file mode 100644
index 0000000000..7fed75358d
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/notifications.md
@@ -0,0 +1,104 @@
+# Notifications Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "notifications",
+ "lane": "L6",
+ "contract_file": "docs/release-control/v6/internal/subsystems/notifications.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own notification delivery transport, provider configuration, queueing, and
+notification-management API surfaces.
+
+## Canonical Files
+
+1. `internal/notifications/notifications.go`
+2. `internal/notifications/queue.go`
+3. `internal/notifications/email_enhanced.go`
+4. `internal/notifications/webhook_enhanced.go`
+5. `internal/api/notifications.go`
+6. `frontend-modern/src/api/notifications.ts`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/api/notifications.ts` shared with `api-contracts`: the notifications frontend client is both a notification delivery control surface and a canonical API payload contract boundary.
+2. `internal/api/notifications.go` shared with `api-contracts`: notification handlers are both a notification delivery control surface and a canonical API payload contract boundary.
+
+## Extension Points
+
+1. Add or change provider delivery, queue processing, or retry behavior through `internal/notifications/`
+2. Add or change notification-management request or response handling through `internal/api/notifications.go`
+3. Add or change notification-management frontend transport through `frontend-modern/src/api/notifications.ts`
+
+## Forbidden Paths
+
+1. Reintroducing notification delivery behavior as implicit side effects under `alerts` or generic monitoring ownership
+2. Duplicating webhook or email delivery safety checks outside `internal/notifications/`
+3. Letting notification queue, DLQ, or provider test paths drift away from the explicit proof routes in `registry.json`
+
+## Completion Obligations
+
+1. Update this contract when canonical notification entry points move
+2. Keep notification API transport and backend delivery proofs aligned in `registry.json`
+3. Preserve explicit queue, webhook-security, and provider-delivery coverage when notification behavior changes
+
+## Current State
+
+This subsystem now makes email, webhook, Apprise, queueing, and delivery
+safety explicit inside the current architecture lane instead of leaving them
+implied by the broader alerts surface. A later lane split can still promote
+alerts and notification delivery into their own product lane once the governed
+floor is ready.
+
+`internal/notifications/` is the live delivery engine. It owns provider
+selection, secure webhook transport, Apprise delivery, queue persistence, DLQ
+handling, retry policy, and delivery observability for alert-driven
+notifications. Queue dequeue, direct-delivery fallback, and enqueue-failure
+recovery now run through one owned notification-delivery executor instead of
+keeping separate primary send paths. Single-alert, grouped, and resolved
+webhook delivery now also share one owned rendering path for URL rendering,
+service-specific enrichment, and template selection. When persistent queue
+bootstrap fails, the runtime now falls back to an in-memory queue owner
+instead of dropping into a separate nil-queue direct-send mode. Service-specific
+webhook compatibility like Pushover `app_token` / `user_token` legacy fields is
+now canonicalized at webhook-config ownership boundaries, so runtime delivery
+only handles canonical `token` / `user` fields instead of injecting aliases
+mid-flight. That boundary includes config persistence plus API/UI ingress for
+create, update, and ad hoc test requests; `internal/notifications/` may not
+silently rewrite those legacy keys once webhook state is already live in the
+runtime.
+Email single-alert, grouped, resolved, and HTML send paths must follow that
+same ownership rule: they may expose different calling surfaces, but they must
+all route through one canonical enhanced email executor instead of rebuilding
+separate manager/config setup paths.
+Notification test APIs must follow that same truthfulness rule: test email and
+webhook paths may keep dedicated top-level entry points, but they must route
+through canonical error-returning single-delivery executors instead of
+fire-and-forget wrappers that can report false success.
+Webhook test service/template synthesis must also stay inside
+`internal/notifications/`: API handlers may decode the request and delegate,
+but service-template selection, safe header copying, and generic test-template
+fallback may not live as a parallel owner path under `internal/api/`.
+Saved-webhook test actions, generic webhook test actions, and ad hoc webhook
+test actions must also share the same enhanced webhook test executor so
+service-template ownership, header normalization, and validation cannot drift
+by entry point.
+Enhanced webhook test/live delivery must follow that same ownership model:
+`webhook_enhanced.go` may expose a richer config shape, but it must bridge back
+into the canonical webhook render and transport path instead of maintaining a
+parallel URL-rendering, enrichment, Telegram URL sanitization, or single-send
+HTTP stack.
+
+`internal/api/notifications.go` and
+`frontend-modern/src/api/notifications.ts` are shared boundaries with
+`api-contracts`: they are the product-facing control surface for
+notification-management transport, while canonical payload-shape governance
+still remains explicit in the shared API contract boundary.
diff --git a/docs/release-control/v6/internal/subsystems/organization-settings.md b/docs/release-control/v6/internal/subsystems/organization-settings.md
new file mode 100644
index 0000000000..c8d8f2887c
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/organization-settings.md
@@ -0,0 +1,101 @@
+# Organization Settings Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "organization-settings",
+ "lane": "L14",
+ "contract_file": "docs/release-control/v6/internal/subsystems/organization-settings.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": [
+ "api-contracts"
+ ]
+}
+```
+
+## Purpose
+
+Own organization role/share semantics and the canonical settings surfaces that
+let users review organization metadata, manage membership, assign roles, and
+create cross-organization shares.
+
+## Canonical Files
+
+1. `internal/models/organization.go`
+2. `frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx`
+3. `frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx`
+4. `frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx`
+5. `frontend-modern/src/components/Settings/RolesPanel.tsx`
+6. `frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx`
+7. `frontend-modern/src/utils/orgUtils.ts`
+8. `frontend-modern/src/utils/organizationRolePresentation.ts`
+9. `frontend-modern/src/utils/organizationSettingsPresentation.ts`
+
+## Shared Boundaries
+
+1. None.
+
+## Extension Points
+
+1. Add or change organization role and share semantics through `internal/models/organization.go`
+2. Add or change organization access, overview, sharing, role-management, or user-assignment presentation through `frontend-modern/src/components/Settings/OrganizationAccessPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationOverviewPanel.tsx`, `frontend-modern/src/components/Settings/OrganizationSharingPanel.tsx`, `frontend-modern/src/components/Settings/RolesPanel.tsx`, and `frontend-modern/src/components/Settings/UserAssignmentsPanel.tsx`
+3. Route organization transport changes through `frontend-modern/src/api/orgs.ts` and `frontend-modern/src/api/rbac.ts`
+4. Keep backend organization and RBAC handler changes aligned through `internal/api/org_handlers.go`, `internal/api/org_lifecycle_handlers.go`, and `internal/api/enterprise_extension_rbac_admin.go`
+
+## Forbidden Paths
+
+1. Duplicating organization role normalization or badge styling outside the canonical organization presentation helpers
+2. Reintroducing organization settings copy, validation, or empty-state strings directly inside feature panels instead of the shared organization presentation helpers
+3. Letting share-role, RBAC role-assignment, or membership semantics drift between `internal/models/organization.go` and the governed organization settings surfaces
+
+## Completion Obligations
+
+1. Update the organization model, settings surfaces, and proof files together when role/share semantics move
+2. Keep organization settings copy and validation inside the canonical organization presentation helpers
+3. Update this contract whenever a new organization settings, role-management, or organization-domain helper entry point becomes canonical runtime surface area
+
+## Current State
+
+This subsystem now sits under the dedicated security, identity, and privacy
+lane so role boundaries, organization membership semantics, and cross-org
+sharing behavior stay governed as a first-class trust surface.
+
+Organization overview, access, sharing, roles, and user-assignment surfaces had
+been sitting outside the governed subsystem map even though they define real
+runtime expectations around membership management, least-privilege role
+assignment, and cross-organization resource sharing. This contract now makes
+that boundary explicit while leaving transport payload ownership in
+`api-contracts`.
+Canonical organization role ordering is now part of that owned model as well:
+`owner` outranks `admin`, which outranks `editor`, which outranks `viewer`, and
+runtime checks must resolve that ordering through shared organization-role
+comparison helpers rather than ad hoc equality checks scattered across model
+and handler code.
+That same hierarchy governs inbound share visibility and organization
+management gates: a user may only see or accept a share when their effective
+membership role satisfies the share's requested access role, and admin-capable
+operations must continue to derive from the canonical role comparator instead
+of duplicating owner/admin special cases.
+The comparator itself is now part of the owned runtime boundary: helpers such
+as `CanUserManage` and any share-filtering logic must route through the shared
+organization-role ordering function so viewer/editor/admin/owner semantics stay
+identical across model checks, handler authorization, and settings-surface
+presentation.
+That same canonical comparator now governs live membership transitions too:
+promoting or demoting a member must immediately change whether that user can
+manage organization settings, and organization listing must not leak non-member
+tenants just because another org with the same user exists in the system.
+Incoming share visibility is part of that same boundary as well: a recipient
+must only see inbound shares whose requested `accessRole` is satisfied by the
+user's effective membership role in the target organization, using the shared
+role comparator instead of handler-local owner/admin shortcuts.
+Hosted organization membership and billing routes now also follow this owned
+semantics boundary: for hosted tenant orgs, `internal/api/org_handlers.go`
+must authorize organization operations from the seeded org membership and the
+hosted subscription state rather than requiring the self-hosted
+`multi_tenant` feature flag. Provisioned hosted workspaces must therefore keep
+`org.OwnerUserID` aligned with the authenticated creator when that actor is
+known, so organization-owner checks stay consistent across runtime auth and the
+settings surfaces.
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
new file mode 100644
index 0000000000..ab90bcea3c
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -0,0 +1,72 @@
+# Patrol Intelligence Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "patrol-intelligence",
+ "lane": "L6",
+ "contract_file": "docs/release-control/v6/internal/subsystems/patrol-intelligence.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own the Patrol intelligence page, its local state orchestration, findings and
+approval presentation, run-history rendering, and Patrol-specific presentation
+helpers.
+
+## Canonical Files
+
+1. `frontend-modern/src/pages/AIIntelligence.tsx`
+2. `frontend-modern/src/stores/aiIntelligence.ts`
+3. `frontend-modern/src/types/aiIntelligence.ts`
+4. `frontend-modern/src/components/AI/FindingsPanel.tsx`
+5. `frontend-modern/src/components/Brand/PulsePatrolLogo.tsx`
+6. `frontend-modern/src/components/patrol/`
+7. `frontend-modern/src/utils/aiFindingPresentation.ts`
+8. `frontend-modern/src/utils/approvalRiskPresentation.ts`
+9. `frontend-modern/src/utils/findingAlertIdentity.ts`
+10. `frontend-modern/src/utils/patrolEmptyStatePresentation.ts`
+11. `frontend-modern/src/utils/patrolFormat.ts`
+12. `frontend-modern/src/utils/patrolRunPresentation.ts`
+13. `frontend-modern/src/utils/patrolSummaryPresentation.ts`
+
+## Shared Boundaries
+
+1. None.
+
+## Extension Points
+
+1. Add or change Patrol page orchestration through `frontend-modern/src/pages/AIIntelligence.tsx` and `frontend-modern/src/stores/aiIntelligence.ts`
+2. Add or change Patrol findings, approvals, investigation, or run-history presentation through `frontend-modern/src/components/AI/FindingsPanel.tsx` and `frontend-modern/src/components/patrol/`
+3. Keep Patrol transport and payload changes aligned through the governed AI runtime and API contract transport surfaces
+
+## Forbidden Paths
+
+1. Reintroducing Patrol finding, investigation, approval, or run-history copy directly inside page components when canonical Patrol presentation helpers already own it
+2. Duplicating Patrol finding severity, lifecycle, alert-identity, or approval-risk derivation outside the governed Patrol presentation helpers
+3. Letting the Patrol page, local store, and findings UI drift into separate shadow truths for the same Patrol status or finding lifecycle state
+
+## Completion Obligations
+
+1. Update Patrol page, state, presentation helpers, and proof files together when Patrol UX semantics change
+2. Keep Patrol-specific copy and badge logic inside the governed Patrol presentation helpers instead of page-local branches
+3. Update this contract whenever a new Patrol-specific page, store, helper, or presentation component becomes canonical runtime surface area
+
+## Current State
+
+The Patrol page, store, findings UI, and run-history presentation had been
+outside the governed subsystem map even though they are the top-level runtime
+surface for Patrol intelligence. This contract now owns that orchestration and
+presentation boundary while leaving shared transport and payload-shape
+ownership in the governed AI runtime and API contract surfaces.
+
+Patrol finding state must now also consume the canonical camelCase
+`alertIdentifier` field and pending-approval expiry metadata end to end.
+Frontend Patrol helpers may not keep shadow `alert_identifier` fallbacks or
+drop `expiresAt` when deciding whether queued investigation fixes still need
+operator attention.
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
new file mode 100644
index 0000000000..f26bb69cf7
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -0,0 +1,118 @@
+# Performance And Scalability Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "performance-and-scalability",
+ "lane": "L10",
+ "contract_file": "docs/release-control/v6/internal/subsystems/performance-and-scalability.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own measurable performance budgets, query-plan guarantees, and hot-path
+regression protection.
+
+## Canonical Files
+
+1. `pkg/metrics/store.go`
+2. `pkg/metrics/store_query_plan_test.go`
+3. `pkg/metrics/store_slo_test.go`
+4. `internal/api/slo.go`
+5. `internal/api/slo_bench_test.go`
+6. `frontend-modern/src/components/Dashboard/Dashboard.tsx`
+7. `frontend-modern/src/components/Dashboard/workloadSelectors.ts`
+8. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx`
+9. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`
+10. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts`
+11. `frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx`
+12. `frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts` shared with `unified-resources`: the infrastructure selector pipeline is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
+2. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts` shared with `unified-resources`: resource detail mappers are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
+3. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx` shared with `unified-resources`: the unified resource table is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
+4. `internal/api/slo.go` shared with `api-contracts`: the SLO endpoint is both an API contract surface and a protected performance hot-path boundary.
+
+## Extension Points
+
+1. Add performance budgets through SLO or contract tests
+2. Add query-plan guardrails for DB-backed hot paths
+3. Optimize hot paths only when backed by benchmarks or proven query issues
+4. Extend dashboard hot-path selectors through `frontend-modern/src/components/Dashboard/workloadSelectors.ts` rather than duplicating filtering/grouping logic in `frontend-modern/src/components/Dashboard/Dashboard.tsx`
+
+## Forbidden Paths
+
+1. Speculative micro-optimizations without evidence
+2. New N+1 data loading paths on dashboard/resource views
+3. Hot-path query changes without updating plan or SLO guardrails
+
+## Completion Obligations
+
+1. Update benchmarks, SLOs, or query-plan tests when hot-path behavior changes
+2. Update this contract when a new protected hot path is adopted
+3. Route runtime changes through the explicit performance proof policies in `registry.json`; default fallback proof routing is not allowed
+4. Record the evidence source for any claimed performance improvement
+
+## Current State
+
+This lane already has strong evidence and guardrails, but it still trails on
+score because critical hot paths need more complete protection and verification.
+
+All governed performance-owned runtime files now require explicit registry
+path-policy coverage, so new protected hot paths must be mapped to a concrete
+proof route instead of falling back to subsystem-default verification.
+
+The dashboard workload selector path and the dashboard runtime that consumes it
+are now part of the protected performance surface rather than proof-only
+context. Future hot-path filter/group/sort/windowing changes must route through
+the explicit dashboard performance proof policy in the subsystem registry.
+
+The unified resource table hot path is now also governed as explicit
+performance-owned runtime, with shared ownership against the unified-resource
+consumer boundary. The remaining performance work is no longer top-level
+ownership ambiguity on the main dashboard or infrastructure tables.
+That hot-path contract now includes policy badge rendering on resource rows.
+Governance metadata such as sensitivity and routing scope may be visible in
+the table, but it must remain on the same bounded row-windowing and mounted-row
+budget proved by `UnifiedResourceTable.performance.contract.test.tsx` rather
+than creating a separate unbounded rendering path for policy-rich fleets.
+The aggregate `/api/charts/workloads-summary` endpoint now also has its own
+explicit API p95 budget constant, aligned with the per-workload charts budget,
+and `internal/api/slo_bench_test.go` must fail if that aggregate budget or its
+store-backed mixed-workload benchmark coverage drifts.
+
+Infrastructure selector status ordering must now tolerate arbitrary filter-set
+strings without widening the canonical hot-path order tuple. Unknown statuses
+must sort after the governed status order instead of forcing the selector path
+to abandon the typed canonical order used by the infrastructure table and its
+performance proof surface.
+
+GitHub-hosted runner proof for the API performance surface now intentionally
+uses a looser budget envelope than local/staging benchmark runs for the
+mixed-endpoint load test and the infrastructure/workload chart p95 checks.
+Those CI targets remain regression guardrails, but they are calibrated to the
+observed contention and CPU variability of the public release workflow rather
+than to workstation-class latency.
+
+The metrics store write boundary now fails closed on malformed samples. Empty
+resource identifiers, empty metric names, unsupported tiers, and legacy
+resource-type writes must be dropped before they reach SQLite so the governed
+hot-path query surface cannot silently accumulate unqueryable garbage rows that
+inflate store size and distort downstream performance evidence.
+Canonical metrics resource types now also normalize case at the store boundary.
+`agent`, `vm`, and other governed resource-type keys must not drift into
+uppercase or mixed-case variants that write successfully but fragment the
+metrics hot path into effectively separate query spaces.
+The query boundary must use the same canonicalization rules. Resource
+identifiers and metric names passed back into `Query`, `QueryAll`, and
+`QueryAllBatch` must be normalized the same way writes are, so whitespace- or
+case-polluted callers cannot manufacture false "missing metrics" results,
+split one governed metric stream into mixed-case query buckets, or trigger
+redundant batch work against otherwise valid stored samples.
diff --git a/docs/release-control/v6/internal/subsystems/relay-runtime.md b/docs/release-control/v6/internal/subsystems/relay-runtime.md
new file mode 100644
index 0000000000..7a6722090a
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/relay-runtime.md
@@ -0,0 +1,81 @@
+# Relay Runtime Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "relay-runtime",
+ "lane": "L7",
+ "contract_file": "docs/release-control/v6/internal/subsystems/relay-runtime.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own the desktop relay runtime, its persisted client configuration, and the
+canonical reconnect, encryption, and relay-trust behavior for Pulse instance
+bridging.
+
+## Canonical Files
+
+1. `internal/relay/client.go`
+2. `internal/config/persistence_relay.go`
+
+## Shared Boundaries
+
+1. None.
+
+## Extension Points
+
+1. Add or change desktop relay reconnect, registration, drain, proxy-stream, or encrypted channel behavior through `internal/relay/`
+2. Add or change persisted relay enablement, server URL, or reconnect-safe default loading through `internal/config/persistence_relay.go`
+3. Keep desktop relay changes aligned with the governed mobile and server relay surfaces represented by the L7 lane evidence
+
+## Forbidden Paths
+
+1. Reintroducing relay client trust or TLS handling through ad hoc dialer configuration outside the canonical relay client
+2. Letting encrypted DATA frames race ahead of nonce-order guarantees by deferring inbound decrypt work to background goroutines
+3. Treating a missing persisted relay config file as a hard failure instead of falling back to the canonical disabled default
+
+## Completion Obligations
+
+1. Update this contract when new desktop relay runtime or persistence entry points become canonical
+2. Keep relay client changes tied to explicit runtime proof in `internal/relay/client_test.go`
+3. Keep persisted relay config loading tied to explicit proof in `internal/config/persistence_relay_test.go`
+
+## Current State
+
+The desktop relay client had been carrying real runtime behavior without any
+explicit subsystem ownership even though L7 already treats relay readiness as a
+governed release lane. This contract makes that desktop boundary explicit.
+The canonical relay runtime now includes local CA-bundle trust via
+`SSL_CERT_FILE`, so self-hosted relay deployments can use a private CA without
+forking the dial path or disabling TLS verification globally.
+Inbound DATA handling is also part of this boundary: encrypted relay frames
+must be decrypted before they are handed to background stream handlers so the
+channel nonce guard stays monotonic and relay arrival order cannot trip false
+replay failures under concurrency.
+Relay status truthfulness is part of the same contract. If the client is in a
+governed reconnect or license-pause window, `ClientStatus.reconnect_in` must
+reflect that delay instead of silently presenting a disconnected state with no
+retry timing.
+The relay HTTP proxy boundary is also part of this owned surface. Relay DATA
+requests must normalize outer method/path whitespace before building the local
+Pulse API request so trivial spacing drift does not cause a valid proxied
+operation to fail at the desktop boundary. The same normalization rule applies
+to allowlisted proxy header names, so safe headers like `Content-Type` are not
+silently stripped just because the upstream frame wrapped them in outer
+whitespace.
+Persisted relay config loading is part of the same owned surface. A missing
+`relay.enc` file must fall back cleanly to the canonical disabled default so a
+fresh v6 install or a partially migrated instance does not fail closed just
+because relay settings have never been saved.
+That same persistence boundary also owns relay client secrets at rest:
+`relay.enc` may only accept plaintext relay config as migration input. Once
+the runtime can read legacy plaintext relay settings, it must rewrite
+canonical encrypted storage immediately on load instead of leaving
+`instance_secret` or the relay identity private key on disk as a normal
+runtime path.
diff --git a/docs/release-control/v6/internal/subsystems/security-privacy.md b/docs/release-control/v6/internal/subsystems/security-privacy.md
new file mode 100644
index 0000000000..4569df7272
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/security-privacy.md
@@ -0,0 +1,218 @@
+# Security Privacy Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "security-privacy",
+ "lane": "L14",
+ "contract_file": "docs/release-control/v6/internal/subsystems/security-privacy.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own Pulse's canonical privacy disclosures, anonymous telemetry boundary, and
+the security-facing settings surfaces that expose authentication posture,
+token-management visibility, and privacy controls to operators.
+
+## Canonical Files
+
+1. `SECURITY.md`
+2. `docs/PRIVACY.md`
+3. `frontend-modern/src/api/security.ts`
+4. `frontend-modern/src/components/Settings/APITokenManager.tsx`
+5. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`
+6. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx`
+7. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx`
+8. `frontend-modern/src/components/Settings/useSystemSettingsState.ts`
+9. `internal/api/security.go`
+10. `internal/api/security_tokens.go`
+11. `internal/api/system_settings.go`
+12. `internal/telemetry/telemetry.go`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/api/security.ts` shared with `api-contracts`: the security frontend client is both a security/privacy control surface and a canonical API payload contract boundary.
+2. `frontend-modern/src/components/Settings/APITokenManager.tsx` shared with `api-contracts`: the API token settings surface is both a security/privacy control surface and a canonical API payload contract boundary.
+3. `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx` shared with `frontend-primitives`: the general settings privacy panel is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+4. `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx` shared with `frontend-primitives`: the authentication settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+5. `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` shared with `frontend-primitives`: the security overview settings surface is both a security/privacy control surface and a canonical settings-shell presentation boundary.
+6. `internal/api/security.go` shared with `api-contracts`: the security handlers are both a security/privacy control surface and a canonical API payload contract boundary.
+7. `internal/api/security_tokens.go` shared with `api-contracts`: the security token handlers are both a security/privacy control surface and a canonical API payload contract boundary.
+8. `internal/api/system_settings.go` shared with `api-contracts`: the system settings telemetry and auth controls are both a security/privacy control surface and a canonical API payload contract boundary.
+
+## Extension Points
+
+1. Change privacy disclosures or outbound-data guarantees through `docs/PRIVACY.md` and `internal/telemetry/telemetry.go` together.
+2. Change security policy, hardening guidance, or supported auth boundaries through `SECURITY.md`.
+3. Change telemetry/privacy settings state handling through `frontend-modern/src/components/Settings/useSystemSettingsState.ts`.
+4. Change security/auth/token transport behavior through the shared `frontend-modern/src/api/security.ts`, `frontend-modern/src/components/Settings/APITokenManager.tsx`, `internal/api/security.go`, `internal/api/security_tokens.go`, and `internal/api/system_settings.go` boundary.
+5. Change security/privacy settings presentation through the shared `frontend-modern/src/components/Settings/GeneralSettingsPanel.tsx`, `frontend-modern/src/components/Settings/SecurityAuthPanel.tsx`, and `frontend-modern/src/components/Settings/SecurityOverviewPanel.tsx` boundary.
+
+## Forbidden Paths
+
+1. Changing telemetry payload semantics without updating the canonical privacy disclosure.
+2. Letting security-facing settings copy or privacy guarantees drift between runtime behavior and the governed docs.
+3. Treating API token management, auth posture, or telemetry controls as generic settings-shell polish instead of explicit trust-surface behavior.
+
+## Completion Obligations
+
+1. Update privacy/security docs and the telemetry runtime together when outbound-data behavior changes.
+2. Keep shared API-contract proof routing aligned whenever auth, token, or telemetry settings payloads change.
+3. Keep shared frontend settings proof routing aligned whenever security/privacy presentation changes.
+4. Update this contract whenever a new canonical security, token, auth, or privacy surface becomes part of the governed trust boundary.
+
+## Current State
+
+This subsystem now gives `L14` an explicit governed home for privacy guidance
+and telemetry disclosures instead of leaving those trust surfaces as lane-level
+evidence with no subsystem ownership.
+
+Security-facing settings remain intentionally shared with `frontend-primitives`
+because shell framing and presentation consistency still belong there, but the
+meaning of those surfaces now lives here so auth posture, token controls, and
+privacy toggles stop borrowing their governance only from adjacent lanes.
+
+The security transport surfaces remain intentionally shared with
+`api-contracts`: token, auth, and telemetry settings payloads are still API
+contracts, but they now also count as first-class security/privacy runtime
+behavior that `L14` must govern directly.
+That same shared security transport boundary must stay under explicit proof
+routing on both sides: `frontend-modern/src/api/security.ts`,
+`internal/api/security.go`, `internal/api/security_tokens.go`, and
+`internal/api/system_settings.go` must continue to carry the direct
+`security-api-surface` proof path together with a direct API-contract proof
+path instead of borrowing coverage only from broader API fallback rules.
+That same shared trust boundary now also owns canonical recovery-token
+persistence: `recovery_tokens.go` may mint raw recovery secrets for immediate
+operator use, but persisted `recovery_tokens.json` state must store only token
+hashes and treat any legacy plaintext-token file as a one-time migration input
+that is rewritten immediately into hashed canonical persistence on load.
+That same persistence rule also governs API token metadata: even though
+`api_tokens.json` stores hashed records rather than raw token secrets, a
+legacy plaintext metadata file may only serve as migration input. Canonical
+runtime persistence must rewrite plaintext API token metadata immediately into
+encrypted-at-rest storage on load instead of continuing to run against the
+unencrypted file as a normal primary path.
+That same trust boundary also governs API token scope identity: legacy
+`host-agent:*` scopes may be accepted only at request-ingress or persistence/
+migration boundaries, where they must be rewritten immediately into canonical
+`agent:*` scopes. Live token records and runtime scope checks may not keep the
+legacy scope names as an active second contract.
+That same trust rule also applies to AI-owned persisted state under
+`internal/config/persistence.go`: findings, usage history, patrol run history,
+and chat sessions may use plaintext files only as migration input. Once those
+AI persistence owners can read the data, they must rewrite it immediately into
+encrypted-at-rest storage instead of keeping plaintext history on the runtime
+primary path.
+That same persistence rule also applies to shared encrypted-slice config
+owners under `internal/config/persistence.go`: TrueNAS instances, agent
+profiles, assignments, profile versions, deployment status, change logs, and
+other `loadSlice()`-backed data may use plaintext files only as migration
+input. The shared loader must rewrite those slices immediately into
+encrypted-at-rest storage on load instead of letting plaintext files remain the
+runtime primary path.
+The same migration-only rule applies to single-object encrypted config owners
+in that package as well: email, Apprise, webhook, SSO, and AI config payloads
+may accept plaintext files only as upgrade input, and the owning loader must
+rewrite canonical encrypted-at-rest storage immediately on load rather than
+deferring encryption until some later save path.
+That same rule extends to AI guest knowledge under `internal/ai/knowledge/`:
+legacy `.json` knowledge files and plaintext `.enc` knowledge files may only
+serve as migration input, and the knowledge store must rewrite canonical
+encrypted-at-rest storage immediately on load instead of leaving guest
+knowledge plaintext on disk until a future note update.
+That same trust boundary also applies at store construction time: the AI
+knowledge store and the service discovery store may not fail open into
+plaintext-at-rest mode when crypto initialization fails. If encryption cannot
+be established for those stores, construction must fail closed instead of
+quietly persisting runtime state unencrypted.
+That same rule also applies to persisted service-discovery records after store
+construction: `internal/servicediscovery/store.go` may only accept plaintext
+`.enc` discovery files as migration input. Once a discovery record can be
+read, canonical persistence must rewrite encrypted-at-rest storage immediately
+on load/list/id-scan instead of leaving plaintext discovery metadata or user
+secrets on the steady-state runtime path.
+That same trust boundary also covers audit-signing key persistence:
+`pkg/audit/signer.go` may keep the 32-byte HMAC signing key in runtime memory,
+but `.audit-signing.key` may only accept plaintext key material as migration
+input. Once a legacy plaintext signing-key file can be read, canonical
+persistence must rewrite encrypted-at-rest storage immediately on load instead
+of leaving the audit signing root in plaintext on the runtime primary path.
+That same fail-closed rule also applies to persisted OIDC refresh tokens in
+the session store: if session-store crypto is unavailable or a stored refresh
+token cannot be decrypted canonically, the runtime must drop that token
+instead of accepting or writing plaintext-at-rest refresh-token state.
+That same rule also applies to hosted entitlement lease secrets in
+`internal/config/billing_state.go`: `billing.json` may not keep
+`entitlement_jwt` or `entitlement_refresh_token` as plaintext-at-rest billing
+state. Canonical billing persistence must encrypt both values at rest, rewrite
+legacy plaintext billing files on load, and drop those secrets instead of
+preserving raw lease state if billing encryption cannot be established.
+Billing persistence also may not auto-create a new crypto/key footprint just
+to add integrity metadata for empty no-secret billing state; no-key graceful
+degradation remains the canonical behavior until a real secret or real key is
+present.
+That same trust boundary also owns runtime store initialization: session, CSRF,
+and recovery-token persistence may not silently self-initialize on a hidden
+`/etc/pulse` fallback or remain locked to the first caller through package
+`sync.Once` state. The configured router data path must stay the canonical
+owner, and reinitializing it must replace the prior runtime store instead of
+leaking old-path auth state into the active process.
+That same path-ownership rule also governs the shared runtime data-dir helper
+under `internal/config/config.go` together with `internal/config/watcher.go`:
+`PULSE_AUTH_CONFIG_DIR` may remain an explicit watcher-only override, but the
+canonical runtime owner for auth, token, billing, and bootstrap-adjacent disk
+state must otherwise come from the resolved `ConfigPath` / `DataPath` owner or
+the shared `PULSE_DATA_DIR` fallback. These surfaces may not probe `/etc/pulse`
+or `/data` independently and silently override the configured path authority
+just because those directories exist on the host.
+That same rule also governs the auth `.env` file path itself: `router.go`,
+`router_routes_auth_security.go`, and `security_setup_fix.go` must derive the
+manual-auth env file through the shared auth-path helper instead of
+reconstructing `/etc/pulse/.env` locally when `ConfigPath` is empty.
+That same shared boundary also owns writable auth-env target order: password
+changes and first-session setup may not reintroduce per-handler config-path
+writes with private data-path fallback branches, and must instead write `.env`
+through the shared auth-env helper contract.
+That same first-session trust boundary also owns bootstrap-token persistence:
+the one-time setup secret may remain operator-recoverable through the supported
+`pulse bootstrap-token` command, but `.bootstrap_token` may not remain a raw
+plaintext secret file on disk. Canonical runtime persistence must keep the
+token encrypted at rest, and any legacy plaintext bootstrap-token file must be
+treated only as migration input that is rewritten immediately into the
+encrypted canonical format on load.
+That same trust rule also applies to persisted relay client secrets:
+`internal/config/persistence_relay.go` may only accept plaintext `relay.enc`
+files as migration input. Once relay config can be read, canonical runtime
+persistence must rewrite encrypted-at-rest storage immediately so
+`instance_secret` and relay identity private-key material do not remain on the
+steady-state runtime path.
+That same migration-only rule also applies to `nodes.enc`: the canonical
+infrastructure credential store may carry PVE, PBS, and PMG passwords and
+token values, so `LoadNodesConfig()` may not treat legacy plaintext
+`nodes.enc` as a steady-state runtime path or as silent data-loss corruption.
+If the file still parses as plaintext config, the loader must keep the
+credentials in memory and immediately rewrite encrypted-at-rest storage on
+load.
+That same rule also applies to local commercial activation persistence:
+`pkg/licensing/activation_store.go` may keep `InstallationToken` and
+`GrantJWT` in runtime activation state, but `activation.enc` may only accept
+plaintext as migration input. Once a legacy plaintext activation file can be
+read, canonical persistence must rewrite encrypted-at-rest storage immediately
+on load.
+That same trust boundary also covers the persisted commercial license itself:
+`pkg/licensing/persistence.go` may keep the local license key and grace-period
+metadata in runtime state, but `license.enc` may only accept plaintext as
+migration input. Once a legacy plaintext license file can be read, canonical
+persistence must rewrite encrypted-at-rest storage immediately on load instead
+of allowing plaintext licensing state to remain on the runtime primary path.
+That same shared token-settings boundary must stay under explicit proof routing
+on both sides: `frontend-modern/src/components/Settings/APITokenManager.tsx`
+must continue to carry the direct `security-settings-surfaces` proof path
+together with the API-contract token-management proof instead of borrowing
+coverage only from broader settings-shell or API ownership.
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
new file mode 100644
index 0000000000..7e6b4e4cf5
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -0,0 +1,643 @@
+# Storage Recovery Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "storage-recovery",
+ "lane": "L15",
+ "contract_file": "docs/release-control/v6/internal/subsystems/storage-recovery.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": [
+ "api-contracts",
+ "unified-resources"
+ ]
+}
+```
+
+## Purpose
+
+Own the storage and recovery product surfaces, recovery-point persistence and
+querying, and the operator-facing storage health presentation layer.
+
+## Canonical Files
+
+1. `internal/recovery/index.go`
+2. `internal/recovery/manager/manager.go`
+3. `internal/recovery/store/store.go`
+4. `frontend-modern/src/components/Recovery/Recovery.tsx`
+5. `frontend-modern/src/components/Storage/Storage.tsx`
+6. `frontend-modern/src/features/storageBackups/storageModelCore.ts`
+7. `frontend-modern/src/hooks/useRecoveryPoints.ts`
+8. `frontend-modern/src/hooks/useRecoveryRollups.ts`
+9. `frontend-modern/src/pages/RecoveryRoute.tsx`
+10. `frontend-modern/src/pages/Dashboard.tsx`
+11. `frontend-modern/src/pages/DashboardPanels/dashboardWidgets.ts`
+12. `frontend-modern/src/pages/DashboardPanels/RecoveryStatusPanel.tsx`
+13. `frontend-modern/src/pages/DashboardPanels/StoragePanel.tsx`
+14. `frontend-modern/src/types/recovery.ts`
+
+## Shared Boundaries
+
+1. None.
+
+## Extension Points
+
+1. Add or change recovery-point persistence, rollups, or series derivation through `internal/recovery/`
+2. Add or change recovery page UX through `frontend-modern/src/components/Recovery/`
+3. Add or change storage page UX through `frontend-modern/src/components/Storage/` and `frontend-modern/src/features/storageBackups/`
+4. Route transport changes for storage and recovery endpoints through `internal/api/` and the owning `api-contracts` proof routes
+5. Route canonical storage/recovery resource selection through `frontend-modern/src/hooks/useUnifiedResources.ts` and the owning `unified-resources` contract
+6. Preserve API-owned node identity continuity in shared `internal/api/` helpers so storage and recovery transport attachments do not fork by hostname-versus-IP drift across the same runtime.
+7. Preserve fail-closed API assignment and lookup behavior in shared `internal/api/` helpers so storage and recovery surfaces do not inherit orphaned profile or resource references from unrelated transport mutations.
+8. Preserve canonical configured public endpoint selection in shared `internal/api/` helpers so recovery and storage links do not inherit loopback-local scheme drift from admin-originated setup/install flows.
+9. Preserve trailing-slash normalization in those shared install-command helpers so recovery-adjacent transport and link surfaces do not inherit double-slash installer paths or slash-suffixed public endpoint drift from canonical backend install payloads.
+10. Preserve canonical /api/auto-register token-action truth in shared `internal/api/` helpers so adjacent setup and recovery-adjacent transport flows stay on caller-supplied credential completion instead of reviving deleted alternate completion modes.
+11. Preserve the canonical setup-script `source="script"` marker through those same shared auto-register helpers, and reject non-canonical source labels there, so later canonical reruns can keep treating script-confirmed tokens differently from agent-created tokens without reviving arbitrary caller-label compatibility.
+12. Preserve the canonical auto-register node-type boundary in those same shared helpers so only supported `pve` and `pbs` registrations can complete, and unsupported runtime labels cannot bleed fake node identities into adjacent transport or recovery-adjacent state.
+13. Preserve the canonical auto-register token-identity boundary in those same shared helpers so only Pulse-managed `pulse-monitor@{pve|pbs}!pulse-<canonical-scope-slug>` token IDs matching the requested node type can complete, and arbitrary, cross-type, or non-Pulse-managed token identities cannot bleed into adjacent transport or recovery-adjacent state.
+14. Preserve canonical /api/auto-register DHCP continuity in those shared helpers so a PVE or PBS node that reruns registration from a new IP with the same canonical node name and deterministic Pulse-managed token identity updates in place instead of duplicating the inventory record.
+15. Preserve the governed root-or-sudo Unix wrapper in shared backend install-command helpers so storage- and recovery-adjacent transport surfaces do not inherit a stale raw `| bash -s --` install payload shape from the canonical agent-install-command API and hosted Proxmox install responses.
+16. Preserve optional-auth tokenless behavior in those same shared backend install-command helpers so adjacent transport surfaces do not implicitly persist API tokens and flip auth-configured state when an operator only requested a Proxmox install command on a token-optional Pulse instance.
+
+## Forbidden Paths
+
+1. Reintroducing storage or recovery product logic as ad hoc dashboard-only summaries without a canonical page-surface owner
+2. Duplicating recovery-point normalization or rollup derivation outside `internal/recovery/`
+3. Letting storage health presentation rules drift between `frontend-modern/src/components/Storage/` and `frontend-modern/src/features/storageBackups/`
+4. Treating storage and recovery as implicit leftovers inside broad monitoring or E2E lanes instead of governed product surfaces
+5. Writing internal `NormalizedHealth` values directly to the storage URL status param; the URL must use the canonical option values from `STORAGE_STATUS_FILTER_OPTIONS` (e.g., `available` for the Healthy filter) so that shared links and bookmarks reflect the same values that the filter dropdowns present to operators
+6. Letting whitespace-padded storage route params hydrate non-canonical page state; shared storage URLs must trim and normalize `tab`, `source`, `status`, `node`, `group`, `sort`, `order`, `query`, and deep-link `resource` before the page model consumes them so pasted or hand-edited links resolve to the same canonical state as UI-authored routes without dropping adjacent unmanaged params
+7. Letting storage `source` aliases or case drift survive in canonical route state; shared storage URLs must rewrite pasted values like `PVE`, `pbs`, or `ALL` to the owned source option values (for example `proxmox-pve`) or the canonical unset state so copied links match the same source filter values the storage toolbar presents
+8. Letting explicit storage `all` sentinels survive in canonical route state; shared storage URLs must collapse case- or whitespace-variant `all` values for the managed `node` filter back to the canonical unset state so copied links do not preserve a fake active node filter
+9. Letting whitespace-padded recovery timeline params fall off canonical route state; shared recovery URLs must trim and normalize `day`, `range`, `scope`, `status`, `verification`, `cluster`, `node`, `namespace`, and adjacent history filters before the page model validates them so pasted or hand-edited links resolve to the same canonical timeline and filter state as UI-authored routes
+10. Letting explicit recovery `all` sentinels survive in canonical route state; shared recovery URLs must collapse case- or whitespace-variant `all` values for `cluster`, `node`, and `namespace` back to the canonical unset route state so copied links do not preserve fake active filters
+11. Letting non-canonical recovery provider values survive in route or transport state; shared recovery URLs must collapse unsupported or fake `provider` values back to the canonical unset state, and only owned source-platform provider options or canonical aliases may reach rollups, points, series, and facets transport filters
+12. Letting protected-item recovery outcome filtering fork from the canonical history status filter; the protected inventory status control must drive the same route-backed `status` field and the same rollups, points, series, and facets transport filters as the history surface instead of keeping a protected-only local outcome branch
+13. Letting visible protected-item filters fall out of shared recovery links; the protected `Stale only` toggle must restore from the canonical recovery URL and rewrite to one owned `stale=1` route form instead of disappearing on refresh or copy/paste
+
+## Completion Obligations
+
+1. Update this contract when canonical storage or recovery entry points move
+2. Keep recovery store/runtime changes aligned with the storage and recovery frontend proofs in `registry.json`
+3. Tighten guardrails when legacy storage or recovery presentation paths are removed
+4. Preserve the dependency split: API payload ownership stays in `api-contracts`, settings shell ownership stays in `frontend-primitives`, and canonical resource truth stays in `unified-resources`
+
+## Current State
+
+This subsystem now sits under the dedicated storage and recovery lane so the
+operator-facing storage page, recovery timeline, and recovery-point persistence
+engine stop hiding inside broader monitoring and E2E buckets.
+
+Storage and recovery still consume the shared unified-resource contract, but
+they do not own the timeline store itself. The canonical resource-change
+history now lives in `internal/unifiedresources/store.go` and is surfaced
+through the shared API/resource wiring, which keeps storage and recovery focused
+on presentation and query shape rather than re-implementing change persistence.
+
+The recovery backend is a real product boundary, not just a helper package:
+`internal/recovery/` owns per-tenant SQLite persistence, rollup derivation,
+query filtering, and recovery-point indexing for the `/api/recovery/*`
+surfaces.
+That same shared `internal/api/` dependency now also assumes tenant-scoped
+resource handlers seed registries from canonical unified resources only:
+recovery- and storage-adjacent API helpers may not fall back to raw tenant
+`StateSnapshot` seeding once `UnifiedResourceSnapshotForTenant` is available.
+That same shared `internal/api/` dependency now also assumes tenant AI
+handlers stay on canonical Patrol runtime wiring: recovery- and
+storage-adjacent API helpers must not revive tenant snapshot-provider bridges
+through `internal/api/ai_handlers.go` once Patrol can initialize from tenant
+`ReadState` and unified-resource providers directly.
+
+The frontend storage and recovery surfaces are also first-class runtime entry
+points. `frontend-modern/src/components/Storage/` plus
+`frontend-modern/src/features/storageBackups/` define the operator-facing
+storage health model and presentation, while
+`frontend-modern/src/components/Recovery/` and the recovery hooks define the
+timeline, protected-item, and recovery-summary UX.
+Those transport hooks are direct governed runtime surfaces, not just page
+implementation detail: `frontend-modern/src/hooks/useRecoveryPoints.ts`,
+`frontend-modern/src/hooks/useRecoveryPointsFacets.ts`,
+`frontend-modern/src/hooks/useRecoveryPointsSeries.ts`, and
+`frontend-modern/src/hooks/useRecoveryRollups.ts` must stay on the explicit
+`recovery-product-surface` proof path instead of inheriting release-control
+coverage only through `frontend-modern/src/pages/RecoveryRoute.tsx`.
+That same rule applies to the dashboard recovery entry points too:
+`frontend-modern/src/hooks/useDashboardRecovery.ts`,
+`frontend-modern/src/pages/Dashboard.tsx`,
+`frontend-modern/src/pages/DashboardPanels/dashboardWidgets.ts`,
+`frontend-modern/src/pages/DashboardPanels/RecoveryStatusPanel.tsx`, and
+`frontend-modern/src/utils/dashboardRecoveryPresentation.ts` must stay on
+explicit direct dashboard/recovery proof routing instead of inheriting
+coverage only through the full recovery route or broader dashboard shells.
+The storage dashboard entry point must be treated the same way on the storage
+side: `frontend-modern/src/pages/Dashboard.tsx`,
+`frontend-modern/src/pages/DashboardPanels/dashboardWidgets.ts`, and
+`frontend-modern/src/pages/DashboardPanels/StoragePanel.tsx` must stay on
+explicit direct dashboard/storage proof routing instead of borrowing release-
+control coverage only from the broader storage page and model surfaces.
+The shared recovery type contract must be pinned the same way:
+`frontend-modern/src/types/recovery.ts` must stay on the explicit
+`recovery-product-surface` proof path instead of riding indirectly on route or
+component coverage.
+That same direct proof rule applies to the shared recovery date helper:
+`frontend-modern/src/utils/recoveryDatePresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery status helper:
+`frontend-modern/src/utils/recoveryStatusPresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery summary helper:
+`frontend-modern/src/utils/recoverySummaryPresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery record helper:
+`frontend-modern/src/utils/recoveryRecordPresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery outcome helper:
+`frontend-modern/src/utils/recoveryOutcomePresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery action helper:
+`frontend-modern/src/utils/recoveryActionPresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery artifact mode
+helper: `frontend-modern/src/utils/recoveryArtifactModePresentation.ts` must
+stay on the explicit `recovery-product-surface` proof path instead of
+inheriting coverage only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery empty-state
+helper: `frontend-modern/src/utils/recoveryEmptyStatePresentation.ts` must stay
+on the explicit `recovery-product-surface` proof path instead of inheriting
+coverage only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery filter-chip
+helper: `frontend-modern/src/utils/recoveryFilterChipPresentation.ts` must stay
+on the explicit `recovery-product-surface` proof path instead of inheriting
+coverage only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery issue helper:
+`frontend-modern/src/utils/recoveryIssuePresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery table helper:
+`frontend-modern/src/utils/recoveryTablePresentation.ts` must stay on the
+explicit `recovery-product-surface` proof path instead of inheriting coverage
+only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery timeline-chart
+helper: `frontend-modern/src/utils/recoveryTimelineChartPresentation.ts` must
+stay on the explicit `recovery-product-surface` proof path instead of
+inheriting coverage only through pages or higher-level recovery components.
+That same direct proof rule also applies to the shared recovery timeline
+helper: `frontend-modern/src/utils/recoveryTimelinePresentation.ts` must stay
+on the explicit `recovery-product-surface` proof path instead of inheriting
+coverage only through pages or higher-level recovery components.
+
+Those recovery transport surfaces now also share one normalized filter
+contract: protected-item rollups, point history, facets, and chart series must
+all honor the same provider, cluster, node, namespace, workload-scope,
+verification, and route-backed free-text `q` filter so the protected-items
+list cannot drift from the timeline and facet state under the same active
+recovery view.
+That shared unified-resource dependency now also includes policy-governed
+resource metadata on the frontend decode path: storage and recovery surfaces
+that route through `frontend-modern/src/hooks/useUnifiedResources.ts` must
+preserve canonical `policy` and `aiSafeSummary` fields so storage-bearing
+resources do not silently lose their routing or redaction posture when they
+cross from unified-resource ownership into storage or recovery presentation.
+That same shared `internal/api/` dependency now also assumes canonical install
+payload URLs are slash-normalized before they become response fields or helper
+attachments, so recovery-adjacent links and transport surfaces cannot inherit
+double-slash installer paths from backend public-endpoint configuration.
+That same shared `internal/api/` dependency must also preserve the governed
+agent-lifecycle shell payload shape when adjacent diagnostics responses expose
+install transport: `router.go` may not reintroduce stale lifecycle flag aliases
+or raw sudo-only install pipes in container-runtime migration payloads that
+share the same backend response surface.
+That same shared dependency now also assumes those diagnostics install payloads
+route through the canonical backend install-command helper, so recovery-adjacent
+transport surfaces do not inherit handler-local drift in token omission,
+plain-HTTP `--insecure`, or trailing-slash normalization.
+That same shared `internal/api/` dependency also assumes diagnostics memory
+source breakdowns backfill canonical fallback reasons even when a raw legacy
+snapshot reaches `internal/api/diagnostics.go` without one, so
+recovery-adjacent consumers do not observe alias-normalized sources paired
+with empty or drifted fallback-reason payloads.
+That same shared `internal/api/` dependency now also assumes auth persistence
+compatibility stays on an explicit migration/import boundary: legacy
+raw-token `sessions.json` and `csrf_tokens.json` files may load for upgrade
+continuity, but `session_store.go` and `csrf_store.go` must immediately
+rewrite hashed canonical persistence on load so adjacent storage and recovery
+transport does not keep running against primary-path raw-token files.
+That same shared `internal/api/` dependency now also assumes adjacent
+commercial helper surfaces speak in monitored-system terms: recovery- or
+storage-adjacent API wiring may consume the canonical monitored-system ledger
+and monitored-system cap helpers, but it must not revive deleted agent-era
+helper names or imply that API-backed infrastructure sits outside the counted
+system model.
+That same shared `internal/api/` dependency now also assumes self-hosted
+commercial counting is canonical at the top-level monitored-system boundary:
+shared setup, deploy, entitlement, and API-backed monitoring helpers may not
+preserve an API-only exemption that would let storage- or recovery-adjacent
+systems consume no commercial slot when the same monitored system is visible
+through canonical unified-resource roots.
+That same shared `internal/api/` dependency also assumes session-carried OIDC
+refresh tokens stay fail-closed at rest: `session_store.go` may only persist
+or recover those tokens through encrypted-at-rest session payloads, and any
+missing-crypto or invalid-ciphertext path must drop the refresh token instead
+of preserving plaintext-at-rest session state that storage and recovery
+surfaces might inherit through shared auth runtime helpers.
+That same shared `internal/api/` dependency also assumes notification test
+handlers stay decode-and-delegate only: `internal/api/notifications.go` may
+share the API helper boundary with storage-adjacent routes, but service-template
+selection and generic webhook-test payload fallback must remain
+notifications-owned instead of becoming a second API-layer owner.
+That same shared API boundary also assumes legacy service-specific webhook
+aliases are rewritten at ingress only: `internal/api/notifications.go` may
+accept compatibility keys like Pushover `app_token` / `user_token`, but it
+must return and forward only canonical `token` / `user` fields so storage-
+adjacent shared `internal/api/` helpers do not inherit a second live alias
+contract.
+That same shared `internal/api/` dependency now also assumes recovery-token
+persistence follows the same canonical rule: raw recovery secrets may be minted
+for immediate operator use, but `recovery_tokens.go` must persist only token
+hashes and treat any legacy plaintext-token file as a one-time migration input
+that is rewritten immediately into hashed canonical persistence on load.
+That same storage-adjacent persistence rule also applies to
+`internal/config/persistence.go` API token metadata: `api_tokens.json` may hold
+only hashed token records, but a legacy plaintext metadata file may only be
+migration input and must be rewritten immediately into encrypted-at-rest
+storage on load instead of staying on the runtime primary path.
+That same shared `internal/api/` dependency also assumes those auth stores stay
+owned by the configured router data path: session, CSRF, and recovery-token
+runtime state may not silently bind to hidden `/etc/pulse` fallback
+initialization or leak old-path store contents forward after reconfiguration.
+That same path-ownership rule also governs adjacent hosted billing and
+bootstrap artifacts that share the `internal/api/` boundary: webhook dedupe
+state, customer indexes, and bootstrap-token lookup must resolve their base
+directory through the shared runtime data-dir helper instead of carrying
+neighboring `/etc/pulse` fallback logic of their own.
+That same shared boundary also assumes manual auth env writes and auth-status
+reads resolve `.env` through the shared auth-path helper, so storage-adjacent
+recovery and setup flows do not keep neighboring `/etc/pulse/.env` fallback
+logic alive after the runtime data-dir authority has been centralized.
+That same shared boundary now also owns writable auth-env fallback order, so
+storage-adjacent setup and recovery flows may not keep per-handler config-path
+write branches with private data-path fallback logic once the shared helper
+exists.
+That same shared `internal/api/` dependency also assumes bootstrap-token
+persistence follows the same boundary discipline: the first-session setup
+secret may remain recoverable through the supported `pulse bootstrap-token`
+command, but `.bootstrap_token` may not stay a primary-path plaintext secret
+file. Canonical runtime persistence must encrypt that token at rest, and any
+legacy plaintext bootstrap-token file must be rewritten immediately into the
+encrypted canonical format on load.
+That same shared `internal/api/` dependency now also assumes Proxmox
+setup-command payloads stay on the governed fail-fast shell transport, so
+adjacent setup and recovery-linked flows do not inherit stale `curl -sSL`
+quick-setup commands from handler-local string assembly.
+That same dependency also assumes the generated setup scripts echo the same
+fail-fast guidance back to operators during retry and validation failures, so
+adjacent setup flows do not preserve stale `curl -sSL` examples after the API
+response itself has already moved to the governed transport.
+That same shared dependency now also assumes those quick-setup commands and
+embedded retry examples preserve root-or-sudo continuity, so adjacent setup
+flows do not regress to direct-root-only command guidance on hosts where the
+operator enters through a non-root shell.
+That same dependency also assumes the embedded retry examples preserve the
+active setup token through those root-or-sudo paths, so adjacent setup flows
+do not regress from non-interactive reruns back to prompt-only recovery.
+That same shared dependency also assumes generated setup scripts hydrate
+`PULSE_SETUP_TOKEN` from any embedded setup token before they print rerun
+guidance, so adjacent setup flows do not lose non-interactive continuity just
+because the next hop entered through a generated script body instead of the
+original API command.
+That same shared dependency also assumes `/api/setup-script-url` and the
+generated rerun guidance draw from one canonical bootstrap artifact builder, so
+adjacent setup and recovery-linked transport flows do not drift on download
+URLs, script filenames, token hints, or env-wrapped rerun command shape across
+the setup bootstrap boundary.
+That same shared dependency also assumes generated PVE setup scripts actually
+remove the discovered legacy token sets they enumerate during cleanup, so
+adjacent operator recovery flows do not present a fake cleanup option that
+quietly leaves stale `pve` and `pam` Pulse tokens behind. That same cleanup
+dependency also assumes candidate discovery stays on the canonical
+Pulse-managed token prefix for the active Pulse URL, so adjacent setup flows
+do not drift onto IP-pattern token matching that misses hostname-scoped legacy
+tokens. That dependency applies to both generated PVE and PBS setup scripts,
+so adjacent setup flows do not fork cleanup discovery rules by node type.
+That same shared discovery dependency also assumes runtime discovery state owns
+only structured errors, while adjacent API and WebSocket payloads may derive
+the deprecated string `errors` list only as a compatibility field from those
+canonical structured errors.
+That same dependency also assumes rerun token-rotation detection uses exact
+managed token-name matches, so adjacent setup flows do not collide with
+unrelated partial-name tokens and rotate the wrong state.
+That same dependency also assumes generated PBS setup scripts only print the
+token-copy banner after a successful token-create result, so adjacent setup
+flows do not advertise a non-existent token on failure.
+That same dependency also assumes generated PBS setup scripts only print the
+auto-register attempt banner on the real request path, so adjacent setup flows
+do not claim an in-flight registration attempt on branches that are actually
+skipped before any request is sent.
+That same shared dependency also assumes generated setup scripts preserve the
+canonical encoded rerun URL contract, so adjacent setup flows do not drop the
+selected `host`, `pulse_url`, or `backup_perms` state when operators rerun the
+embedded quick-setup command from the script body.
+That same shared dependency also assumes generated setup scripts fail closed on
+auto-register success parsing, so adjacent setup flows do not misreport
+registration success when a shared backend response still carries a
+`success:false` payload.
+That same dependency also assumes those generated setup scripts fail closed on
+auto-register HTTP and transport failures, so adjacent setup flows do not
+reinterpret shared backend stderr or HTTP-failure output as a successful
+registration payload.
+That same shared dependency also assumes generated setup scripts preserve
+setup-token auth guidance, so adjacent setup flows do not regress back to
+stale API-token instructions after the backend has already standardized on the
+one-time setup-token contract.
+That same dependency also assumes generated setup scripts preserve truthful
+registration-outcome messaging, so adjacent setup flows do not claim a node
+was successfully registered when the shared backend path actually fell back to
+manual completion.
+That same dependency also assumes manual completion stays on the canonical
+node-add path, so adjacent setup flows do not regress back to a stale
+secondary registration-token rerun contract after the backend already emitted
+manual token details for Pulse Settings → Nodes.
+That same dependency also assumes auth-failure messaging stays truthful once a
+shared setup script has already entered the registration-request path, so
+adjacent setup flows do not regress into missing-token copy when the real next
+step is to fetch a fresh setup token from Pulse Settings → Nodes and rerun.
+That same auth-failure state must also suppress the later manual-details
+footer, so adjacent setup flows do not contradict the rerun contract.
+That same dependency also assumes the auto-register failure summary stays on
+that canonical node-add path, so adjacent setup flows do not regress to vague
+"manual configuration may be needed" wording once the backend already emitted
+the exact Pulse Settings → Nodes completion path.
+That same dependency also assumes the immediate failure branch reuses that same
+manual-completion contract instead of drifting into a numbered manual-setup
+list before the final token-details footer, including request-failure branches
+that never receive a parseable backend response.
+That same dependency also assumes those manual-add instructions preserve the
+canonical node host already known to the script, so adjacent setup flows do
+not regress to placeholder host guidance when shared backend continuity is
+otherwise intact.
+That same dependency also assumes the PBS setup script binds that canonical
+host before setup-token gating can skip auto-registration, so adjacent manual
+fallback output does not lose the host URL just because setup-token input was
+omitted.
+That same dependency also assumes the canonical PBS host is already bound
+before token-creation failure fallback, so adjacent manual completion output
+does not drop the host URL just because token minting failed earlier in the
+same shared script.
+That same dependency also assumes token-creation failure stays truthful in
+those generated setup scripts, so adjacent flows do not regress into fake token
+details or a false "token setup completed" state after shared backend token
+minting already failed.
+That same dependency also assumes token-extraction failure stays on the same
+rerun-after-fix path, so adjacent setup flows do not regress into a false
+manual-registration fallback when the shared backend still has not produced a
+usable token secret, and do not enter the shared manual-completion footer until
+that usable secret actually exists.
+That same shared setup dependency also assumes skipped PBS auto-register paths
+stay truthful, so adjacent flows do not regress into a fake request-failure
+banner when the backend intentionally never attempted registration.
+That same shared setup dependency also assumes missing-host script payloads
+stay fail closed, so adjacent flows do not regress into placeholder manual
+registration targets when the backend never received a canonical node URL.
+That same dependency also assumes PBS follows the identical host rule, so
+adjacent setup flows do not regress from the backend-requested canonical PBS
+host to a runtime-local interface address when manual completion is rendered.
+That same dependency also assumes those manual-add instructions preserve
+canonical Settings → Nodes phrasing across node types, so adjacent setup flows
+do not drift into inconsistent manual-completion language for equivalent
+fallback paths.
+That same dependency also assumes the earlier auto-register failure branch uses
+that identical Settings → Nodes destination, so adjacent setup flows do not
+observe one manual-completion path in the immediate error guidance and a
+different one in the final backend-owned footer.
+That same dependency also assumes the off-host PVE fallback stays on the
+canonical rerun-on-host contract, so adjacent setup flows do not regress into
+a separate manual `pveum` plus Pulse Settings token-entry path that the shared
+backend no longer owns.
+That same dependency also assumes direct script launches preserve the canonical
+root requirement wording, so adjacent setup flows do not regress to a stale
+"Please run this script as root" branch while the governed retry transport
+already uses the newer privilege guidance.
+That same dependency also assumes manual-add token placeholder text stays
+canonical across those generated setup branches, so adjacent setup flows do
+not surface conflicting "see above" instructions for the same backend-owned
+token continuity contract.
+That same dependency also assumes successful generated setup flows preserve one
+canonical success message across node types, so adjacent setup surfaces do not
+drift into type-specific completion wording for the same backend-confirmed
+registration state.
+That same dependency also assumes token-extraction failures stop before shared
+registration assembly, so adjacent setup flows do not proceed with an empty
+token secret after the backend already determined the generated token value was
+unavailable.
+That same dependency also assumes canonical PVE auto-register payloads carry
+real caller-supplied token secrets only, so adjacent setup flows do not treat
+placeholder response state as a usable credential or persist dead pending
+branches into shared node state.
+That same shared `internal/api/` dependency also assumes the canonical
+`/api/auto-register` success payload keeps canonical node identity in
+`nodeId` instead of the raw host URL or requested server name, so adjacent
+setup and recovery-linked transport attachments do not fork between stored
+node name and request-form identity.
+That same dependency also assumes the shared `node_auto_registered` event from
+canonical /api/auto-register keeps the normalized stored host and canonical node
+identity in its payload, so adjacent transport surfaces do not fork between
+saved node state and raw request-form event data.
+That same shared dependency also assumes canonical /api/auto-register success
+responses mirror that stored identity and normalized host through `type`,
+`source`, `host`, `nodeId`, and `nodeName`, so installer and runtime-side
+Unified Agent success paths cannot drift into a second local identity after
+registration.
+That same dependency also assumes the setup-token bootstrap response from
+`/api/setup-script-url` carries canonical `type`, normalized `host`, and live
+expiry metadata, so adjacent setup and recovery-linked transport surfaces do
+not consume a mismatched bootstrap token after host normalization.
+That same shared dependency also assumes installer and runtime-side Unified
+Agent callers fail closed on already-expired bootstrap responses instead of
+treating any populated `expires` field as sufficient.
+That same shared dependency also assumes Pulse-managed Proxmox monitor-token
+names stay bound to the canonical Pulse endpoint across setup/bootstrap
+surfaces, so adjacent setup and recovery-linked flows may not derive token
+scope from request-local `Host` fallbacks and accidentally fork monitor-token
+identity for the same Pulse instance.
+That same shared dependency also assumes `/api/setup-script` stays on one
+canonical artifact contract: manual setup downloads must ship as
+`text/x-shellscript` attachments with deterministic `pulse-setup-*.sh`
+filenames, so adjacent setup and recovery-linked transport surfaces do not
+flatten governed script delivery into untyped text blobs.
+That same shared dependency also assumes `/api/setup-script-url` carries that
+canonical setup-script filename as bootstrap metadata, so adjacent setup and
+recovery-linked surfaces do not reintroduce hardcoded local filenames that can
+drift from the downloaded artifact.
+That same shared dependency also assumes settings quick-setup treats
+`/api/setup-script-url` as one canonical bootstrap artifact per active
+endpoint, so adjacent setup and recovery-linked surfaces do not fork copy and
+manual-download behavior onto separate lane-local bootstrap requests.
+That same shared dependency now also assumes that bootstrap artifact is owned
+by one shared backend install-artifact model rather than mirrored local
+bootstrap structs and response envelopes, so adjacent setup and
+recovery-linked surfaces do not inherit drift between downloads, rerun
+guidance, and script rendering. Generated PVE/PBS setup-script bodies must also
+come from the same shared backend render helpers instead of a handler-local
+template engine, so recovery-linked copy and rerun flows do not fork the shell
+transport contract by route implementation.
+guidance, and the setup-script-url payload.
+That same shared dependency also assumes that bootstrap artifact includes a
+dedicated token-bearing `downloadURL`, so manual setup-script downloads remain
+non-interactive without forcing adjacent surfaces to re-expose the raw setup
+token or rebuild a second setup-script request from partial bootstrap state.
+That same shared dependency also assumes runtime-side Unified Agent and
+installer consumers keep the full setup bootstrap envelope coherent: adjacent
+transport surfaces may not silently accept `/api/setup-script-url` responses
+that drop canonical script URL, filename, or command metadata while still
+returning a token.
+That same shared dependency also assumes `/api/setup-script-url` keeps a strict
+canonical request shape: adjacent setup and recovery-linked surfaces may not
+quietly accept unknown request fields or trailing JSON on that bootstrap route,
+because typo-compatible or concatenated payloads would fork the governed setup
+artifact contract from the direct handler proofs.
+That same shared dependency also assumes bootstrap backup permissions stay on
+the canonical PVE-only path: adjacent setup and recovery-linked surfaces may
+not accept `backup_perms` / `backupPerms` for PBS and then silently drift onto
+an unsupported no-op request contract.
+That same shared dependency also assumes both setup routes keep canonical host
+identity explicit: adjacent setup and recovery-linked surfaces may not allow
+`/api/setup-script` to fall back to placeholder host artifacts after
+`/api/setup-script-url` already requires a real normalized `host`.
+That same shared dependency also assumes those setup routes share one canonical
+type and host-normalization boundary: adjacent setup and recovery-linked
+surfaces may not allow `/api/setup-script` to treat unknown `type` values as
+implicit PBS requests or emit unnormalized host state after
+`/api/setup-script-url` has already normalized the bootstrap node identity.
+That same shared dependency also assumes both setup routes keep canonical
+Pulse identity explicit: adjacent setup and recovery-linked surfaces may not
+allow `/api/setup-script` to rebuild `pulse_url` from request-local origin
+state after `/api/setup-script-url` already binds the canonical Pulse URL into
+the returned bootstrap artifact.
+That same shared dependency also assumes `/api/setup-script` now rejects
+missing `pulse_url` input outright, so adjacent setup and recovery-linked
+surfaces may not rely on request-local origin fallback once the bootstrap
+artifact already carries an explicit canonical Pulse URL.
+That same shared dependency also assumes `/api/setup-script` keeps one
+bootstrap token name end to end: embedded setup-script bootstrap uses the
+canonical `setup_token` query and the rendered script body uses only
+`PULSE_SETUP_TOKEN`, so adjacent setup and recovery-linked reruns do not drift
+across alias variables or deleted query naming.
+That same shared `internal/api/` dependency also assumes canonical /api/auto-register
+responses keep `nodeId` on the resolved stored node identity after name
+disambiguation, so adjacent setup and recovery-linked transport attachments do
+not fork between saved node state and raw requested server names.
+That same shared dependency also assumes canonical /api/auto-register triggers the same
+canonical post-registration refresh and live event flow as legacy
+auto-register, so adjacent transport surfaces do not miss discovery refresh or
+canonical node event payloads just because the node entered through the
+path.
+That same shared `internal/api/` dependency also assumes canonical /api/auto-register
+accepts caller-supplied token completion directly on that contract, so
+adjacent lifecycle transport stays on one explicit-token registration contract
+instead of forking a second completion path.
+That same shared `internal/api/` dependency also assumes the primary runtime
+ingest surface is the Pulse Unified Agent boundary in
+`internal/api/agent_ingest.go` and `internal/api/router*.go`, so adjacent
+storage and recovery transport may not depend on `host`-named handler or
+router state as if `/api/agents/host/*` were still a first-class API family
+instead of a compatibility alias.
+That same shared `internal/api/` dependency also assumes the canonical
+Unified Agent route family remains the primary auth/management surface:
+adjacent storage and recovery-linked transport must treat `/api/agents/agent/*`
+as the owned route family, while `/api/agents/host/*` and legacy
+`host-agent:*` scope names remain compatibility aliases only.
+That same shared `internal/api/` dependency also assumes adjacent recovery and
+storage-linked transport continues to describe those legacy names as
+compatibility aliases rather than active product surfaces, so route/auth
+guidance does not drift back into “host-agent” ownership language once the
+canonical `agent:*` and `/api/agents/agent/*` boundary is set.
+That same shared dependency now also assumes generated setup scripts use that
+canonical caller-supplied completion path, so adjacent setup and recovery-linked
+transport stay on the canonical registration payload shape.
+That same shared dependency also assumes /api/auto-register uses one canonical
+caller-supplied completion payload: transport must send `tokenId` and
+`tokenValue` directly, so adjacent surfaces do not preserve a mode-switch
+field or alternate payload gate.
+That same shared dependency also assumes one-time setup-token auth uses the
+canonical `authToken` request field only, so adjacent transport does not keep a
+duplicate `setupCode` payload alias alive after the canonical field is set.
+That same shared dependency also assumes the live runtime keeps that
+terminology canonical after the contract cleanup: auto-register auth failures
+and handler ownership paths must refer to setup tokens rather than preserving
+setup-code residue.
+That same shared dependency also assumes missing-token requests fail with the
+canonical setup-token requirement itself rather than a generic authentication
+message, so adjacent transport and setup-linked recovery proof keep the route
+narrowed to one-time setup-token auth.
+That same shared dependency also assumes canonical field-validation failures
+stay specific on `/api/auto-register`: mismatched `tokenId`/`tokenValue` input
+may not collapse into generic missing-field output, and other missing
+canonical fields must return explicit `Missing required canonical
+auto-register fields: ...` guidance.
+That same shared dependency also assumes the public `/api/auto-register` route
+and the direct canonical handler path keep those validation failures aligned,
+so adjacent shared helpers do not inherit diverging missing-field or token-pair
+messages from two nearby entry points on the same runtime surface.
+That same shared dependency also assumes canonical auto-register callers send
+explicit `serverName` identity, so the backend does not recreate node identity
+from `host` and drift adjacent shared state onto handler-local fallback rules.
+That same shared dependency also assumes overlap and rerun continuity logs stay
+on canonical `/api/auto-register` wording, so adjacent shared helpers do not
+reintroduce a deleted "secure auto-register" split while describing resolved
+host matches, DHCP continuity matches, or in-place token updates.
+That same shared dependency also assumes token-completion validation logs stay
+on canonical `/api/auto-register` wording, so adjacent shared helpers do not
+reintroduce deleted "secure token completion" wording when `tokenId` and
+`tokenValue` drift out of sync.
+That same shared dependency also assumes hostagent-driven canonical
+/api/auto-register requests use that same request-body `authToken` field
+for one-time setup-token auth instead of a header-auth fallback or direct
+admin-token completion, so adjacent transport and recovery-linked proof do not
+preserve parallel authentication paths.
+That same shared `internal/api/` dependency also assumes the canonical helper
+and proof surface describe one /api/auto-register path instead of a fake
+/api/auto-register/secure sibling, so adjacent transport and governed
+evidence do not drift onto a route split that the runtime does not actually
+expose.
+That same filter contract applies to the advanced history facets transport as a
+whole: changing node or namespace filters must narrow the facets request too,
+so node and namespace option sets cannot drift back to the broader chart window
+while the visible history table is already scoped to a smaller recovery slice.
+That same narrowing rule now also applies when a timeline day is selected: the
+facets request must use the same narrowed day window as the points request so
+node and namespace option sets stay coherent with the visible history slice
+instead of showing options from the full chart range while the table is already
+scoped to a single day.
+The recovery timeline drill-down now also treats day selection as a real
+history transport boundary: choosing a day in the "Backups By Date" chart must
+narrow the point-history request window to that selected local day rather than
+only updating local selection chrome while the table remains on the broader
+chart window.
+That selected-day boundary must also be durable route state: the recovery URL
+must preserve the active timeline day so reload, navigation, and shared links
+reconstruct the same point-history window instead of silently widening back to
+the broader chart range.
+That same route continuity rule also applies to the selected chart window
+itself: changing the recovery timeline range to `7d`, `90d`, or `1y` must stay
+in canonical `/recovery` route state so reload, navigation, and shared links
+reconstruct the same rollup and series transport window instead of widening
+back to the default `30d` range.
+
+This lane intentionally depends on other governed boundaries instead of
+overreaching into them. API transport and payload contract ownership remain in
+`api-contracts`, the settings recovery panel remains in `frontend-primitives`,
+and canonical resource identity stays in `unified-resources`.
+
+That same shared `internal/api/` resource boundary now also carries governed
+policy-aware metadata. Storage and recovery consumers that read canonical
+resource payloads must preserve backend-derived `policy` and `aiSafeSummary`
+fields for storage, backup, and data-bearing resources instead of rebuilding
+their own sensitivity or routing guesses in page-local presentation code.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
new file mode 100644
index 0000000000..b76c073f10
--- /dev/null
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -0,0 +1,286 @@
+# Unified Resources Contract
+
+## Contract Metadata
+
+```json
+{
+ "subsystem_id": "unified-resources",
+ "lane": "L13",
+ "contract_file": "docs/release-control/v6/internal/subsystems/unified-resources.md",
+ "status_file": "docs/release-control/v6/internal/status.json",
+ "registry_file": "docs/release-control/v6/internal/subsystems/registry.json",
+ "dependency_subsystem_ids": []
+}
+```
+
+## Purpose
+
+Own canonical resource identity, type normalization, typed views, and
+cross-source deduplication.
+
+## Canonical Files
+
+1. `internal/unifiedresources/types.go`
+2. `internal/unifiedresources/views.go`
+3. `internal/unifiedresources/read_state.go`
+4. `internal/unifiedresources/adapters.go`
+5. `internal/unifiedresources/monitor_adapter.go`
+6. `internal/unifiedresources/canonical_identity.go`
+7. `internal/unifiedresources/metrics.go`
+8. `internal/unifiedresources/metrics_targets.go`
+9. `internal/unifiedresources/registry.go`
+10. `internal/unifiedresources/resolve.go`
+11. `internal/unifiedresources/resolve_context.go`
+12. `internal/unifiedresources/resolved_host_set.go`
+13. `internal/unifiedresources/snapshot_source_filter.go`
+14. `internal/unifiedresources/store.go`
+15. `internal/unifiedresources/kubernetes_capabilities.go`
+16. `internal/unifiedresources/pbs_rollups.go`
+17. `internal/unifiedresources/monitored_systems.go`
+18. `internal/unifiedresources/capabilities.go`
+19. `internal/unifiedresources/changes.go`
+20. `internal/unifiedresources/relationships.go`
+21. `internal/unifiedresources/privacy.go`
+22. `internal/unifiedresources/actions.go`
+
+## Shared Boundaries
+
+1. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts` shared with `performance-and-scalability`: the infrastructure selector pipeline is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
+2. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts` shared with `performance-and-scalability`: resource detail mappers are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
+3. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx` shared with `performance-and-scalability`: the unified resource table is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.
+4. `internal/api/resources.go` shared with `api-contracts`: the unified resource endpoint is both a backend payload contract surface and a unified-resource runtime boundary.
+
+## Extension Points
+
+1. Add new resource types and identity fields in `internal/unifiedresources/types.go`
+2. Add typed accessors and views in `internal/unifiedresources/views.go`
+3. Add source ingestion/adaptation in the adapter layer only
+4. Add metrics-target normalization or synthetic metrics support through `internal/unifiedresources/metrics_targets.go` and `internal/unifiedresources/metrics.go`
+5. Add platform registry, resolution, or host-dedup behavior through `internal/unifiedresources/registry.go`, `internal/unifiedresources/resolve.go`, `internal/unifiedresources/resolved_host_set.go`, `internal/unifiedresources/snapshot_source_filter.go`, `internal/unifiedresources/store.go`, `internal/unifiedresources/kubernetes_capabilities.go`, and `internal/unifiedresources/pbs_rollups.go`
+6. Add canonical governed name-resolution or policy-aware resource lookup behavior through `internal/unifiedresources/resolve.go` and `internal/unifiedresources/resolve_context.go`
+
+## Forbidden Paths
+
+1. New ad hoc resource-type aliases outside unified resource normalization
+2. New duplicate ID normalization logic outside unified resources
+3. Reintroducing legacy runtime resource contracts as live truth
+
+## Completion Obligations
+
+1. Update this contract when canonical resource identity or type rules change
+2. Update contract and guardrail tests when a new resource type is added
+3. Route runtime changes through the explicit unified-resource proof policies in `registry.json`; default fallback proof routing is not allowed
+4. Tighten banned-path tests when a compatibility bridge is removed
+
+## Current State
+
+This subsystem now sits under the dedicated core monitoring runtime lane so
+canonical resource identity, discovery normalization, and platform-runtime
+coverage stay governed as a first-class Pulse product surface.
+
+The unified-resource runtime now also owns the durable change timeline for the
+canonical resource view. `internal/unifiedresources/monitor_adapter.go` feeds
+registry rebuilds and supplemental ingest into `ResourceChange` records, and
+`internal/unifiedresources/store.go` persists those changes so `RecentChanges`
+can round-trip through the SQLite-backed resource store instead of living only
+in memory or adapter-local state.
+
+The unified resource core is strong and canonical, but monitoring and some
+frontend/API consumers are still being tightened around it.
+
+Tenant-scoped API resource seeding now also stays on unified-resource ownership
+end to end: `internal/api/resources.go` consumes
+`UnifiedResourceSnapshotForTenant` as the canonical tenant registry seed, and
+no longer falls back to raw tenant `StateSnapshot` seeding on the live request
+path when that unified seed is empty.
+
+The registry proof map now also breaks out metrics-target normalization and
+platform-runtime registry support as explicit governed proof routes. Changes to
+history-query target shaping, registry resolution, Kubernetes capability
+derivation, store/source-filter state, PBS/PMG rollups, or resolved-host
+fallback behavior must stay attached to those specific proof policies rather
+than disappearing into a generic unified-resource runtime bucket.
+
+Canonical storage metadata now carries runtime `enabled` and `active` flags so
+monitoring and API export paths can derive `models.Storage` from unified views
+without depending on legacy snapshot ownership.
+
+Canonical Proxmox node metadata now carries node-only boundary fields such as
+guest URL, connection health, temperature details, and pending-update metadata
+so monitoring can derive `models.Node` from unified views without depending on
+legacy snapshot ownership.
+
+Canonical host-agent metadata now carries host-only runtime fields such as CPU
+count, load average, machine/report identity, command capability, exclude
+patterns, and host I/O rates so monitoring can derive `models.Host` from
+unified views without depending on legacy snapshot ownership.
+
+Canonical Docker host metadata now carries Docker-host-only runtime fields such
+as display-name identity, CPU/memory sizing, interval/load averages, raw
+container membership, and host I/O rates so monitoring can derive
+`models.DockerHost` from unified views without depending on legacy snapshot
+ownership.
+
+Canonical Proxmox guest metadata now carries workload boundary fields such as
+guest OS identity, guest agent version, guest network interfaces, VM disk
+status reason, and container OCI/Docker-detection metadata so monitoring can
+derive `models.VM` and `models.Container` from unified views without depending
+on legacy snapshot ownership.
+
+Canonical PBS metadata now carries full instance boundary payload such as host
+and guest URLs, full datastore details, and PBS job arrays so monitoring can
+derive `models.PBSInstance` from unified views without depending on legacy
+snapshot ownership.
+
+Canonical physical-disk views now expose the full disk identity and SMART
+metadata needed by monitoring refresh paths, so physical-disk temperature and
+SMART merges can run from unified `ReadState` instead of from snapshot-owned
+disk arrays.
+
+Canonical identity now also treats Proxmox-backed infrastructure parents as
+node-owned resources first: when an agent resource carries canonical Proxmox
+node metadata, `canonicalIdentity.primaryId` must remain stable as
+`node:<proxmox-source-id>` even if agent discovery metadata is also present,
+so merged node-plus-agent views do not drift to transient agent identifiers.
+
+Frontend/API consumers and backend support files now require explicit registry
+path-policy coverage, so new unified-resource-owned runtime files must be added
+to a concrete proof route instead of falling back to subsystem-default
+verification.
+
+The infrastructure table, selector, and detail-mapper frontend consumers are
+now governed as explicit shared boundaries with the performance lane rather
+than implicit downstream usage. That means future fleet-scale table changes
+must preserve both canonical unified-resource semantics and the table
+performance proof route.
+The Connected infrastructure settings surface now also depends on a backend
+owned `connectedInfrastructure` projection derived from unified resources plus
+reporting-ignore state. That projection is now also the only v6 client
+contract for reporting/ignored infrastructure state; future settings-row
+grouping or reporting-surface scope changes must be routed through that backend
+projection instead of teaching the frontend to reinterpret raw resource facets
+or removed-runtime arrays locally.
+Canonical route helpers must also preserve recovery-specific drill-down state
+when they serialize governed resource views. Recovery timeline day selection is
+part of the durable route contract, so `/recovery` links must round-trip the
+selected day instead of dropping it as transient local UI state.
+The same recovery route contract also applies to the selected timeline range:
+canonical `/recovery` links must preserve explicit non-default chart windows
+such as `7d`, `90d`, and `1y` so recovery drill-down transport does not widen
+back to the default `30d` window on reload or shared navigation.
+That same shared recovery route helper contract now also owns canonical
+boolean filter encoding for protected-inventory drill-down state. Visible
+recovery toggles such as `stale` must round-trip through the owned `stale=1`
+query form instead of leaking ad hoc truthy strings or disappearing from
+shared links on reload.
+Shared API consumers now also depend on a single registry-list snapshot per
+request when deriving canonical type aggregations for resource list and stats
+responses. Re-reading `registry.List()` for the same `/api/resources` request
+is forbidden because it adds avoidable clone churn to the hot path and breaks
+the guarantee that aggregations describe the exact resource snapshot used to
+build the response.
+
+Canonical parent lineage is now source-tracked internal state, not sticky
+merged payload state. `parentId`, `parentName`, and `childCount` must be
+re-derived from the live per-source parent map on every ingest/build pass so
+same-source reparenting, orphaning, and parent removal clear old lineage
+instead of leaking stale topology into API and typed-view consumers.
+The registry now also owns the canonical monitored-system projection used by
+commercial entitlement and ledger surfaces. `MonitoredSystems(...)` must keep
+top-level counted-system identity, representative resource selection, and
+agent/API deduplication on unified-resource ownership instead of letting API
+handlers or licensing helpers rebuild their own counted-system grouping logic.
+
+Canonical source-owned identifiers must also normalize surrounding whitespace
+before they become by-source map keys or source-specific hash IDs. The same
+runtime object must not fork into distinct canonical resources just because an
+ingest path supplied `"vm-100"` in one pass and `" vm-100 "` in another.
+
+Canonical target-derived identities must also normalize resource-type aliases
+through the v6 type map before they become `primaryId` or alias entries.
+Mixed-case or compatibility target values such as `HOST` and `docker_host`
+must collapse to canonical v6 prefixes instead of leaking raw source labels
+into merged resource identity.
+
+Canonical metrics targets must also trim source-owned target IDs before they
+become query coordinates. The same resource must not query different history
+series just because one ingest path emitted `" host-1 "` and another emitted
+`"host-1"`.
+If the canonicalized target ID is empty after that normalization, the metrics
+target must fail closed to `nil` instead of emitting an empty query coordinate.
+
+ReadState resource-resolution lookups must also normalize surrounding
+whitespace on the incoming name before matching canonical resources. A valid
+resource must not look missing just because a consumer asked for `" myserver "`
+instead of `"myserver"`.
+The same governed lookup boundary now also owns policy-aware resolved context:
+downstream consumers that need routing plus canonical policy metadata must use
+the unified-resource resolution context instead of rescanning typed views or
+re-deriving AI redaction rules locally.
+
+Typed view accessors for linked topology IDs must also return canonical
+trimmed values. Callers must not observe `" node-99 "` or `" agent-123 "`
+through host/node view accessors when the canonical linkage is `node-99` or
+`agent-123`.
+The same rule applies to source-owned typed-view IDs. VM, container, node,
+storage, and docker host/container source-ID accessors must return canonical
+trimmed identifiers rather than leaking outer whitespace from ingest payloads.
+Proxmox topology coordinates exposed through typed views must also be trimmed
+before they reach consumers. Node, cluster, and instance accessors must not
+present `" pve-a "` or `" lab "` as distinct topology values from `pve-a`
+and `lab`.
+
+Frontend unified-resource consumers must now also normalize legacy discovery
+resource type aliases before storing `discoveryTarget`. Backend `k8s`
+discovery coordinates collapse to the canonical frontend `pod` target, and
+typed PBS/storage facets must be preserved as the explicit frontend resource
+meta interfaces instead of floating as untyped platform-data consumers.
+
+Resolved host deduplication must also fail safe on unfamiliar connector types.
+Unknown source types may contribute identity and source-label evidence, but
+they must not outrank the known canonical primary-type order when a merged host
+contains a governed connector such as `proxmox-pve` or `agent`.
+
+Infrastructure selector consumers must also preserve the canonical
+`KnownSourcePlatform` normalization boundary when collecting source filters and
+status facets. The selector layer may accept arbitrary user-visible filter
+strings, but it must not widen the canonical unified-resource source/status
+contracts that feed the infrastructure table and workload links.
+
+The same source-filter boundary now also applies to infrastructure filter UI
+options: `frontend-modern/src/pages/Infrastructure.tsx` may render friendly
+string keys, but membership checks against available sources must normalize
+through the canonical selector helper before consulting `KnownSourcePlatform`
+sets.
+Canonical monitored-system counting now also depends on this subsystem. The
+counted commercial unit is a deduped top-level monitored system assembled from
+canonical unified-resource roots, so read-state helpers that derive
+commercial-count groups must union agent, Proxmox, Docker, PBS, PMG, TrueNAS,
+and Kubernetes cluster views through canonical identity evidence instead of
+through transport-local counters or child-resource totals.
+
+Canonical unified resources now also own first-class policy metadata for the
+v6 bridge release. Cloned and API-exported resources must carry
+`policy.sensitivity`, `policy.routing`, and `aiSafeSummary` derived from the
+canonical resource model itself, with routing scopes constrained to the owned
+`cloud-summary`, `local-first`, and `local-only` contract plus explicit
+redaction hints for hostname, IP, platform-identity, alias, and path-bearing
+surfaces. Downstream API, AI, and frontend consumers may read those fields,
+but they must not replace them with local sensitivity inference or ad hoc
+privacy heuristics.
+Canonical resources now carry first-class graph-expansion fields: `Capabilities`
+(bounded action definitions with approval levels), `Relationships` (typed
+inter-resource links with direction and confidence), and `RecentChanges` (typed
+change timeline entries with source, confidence, and related-resource
+references). These fields are defined in `capabilities.go`, `relationships.go`,
+`changes.go`, `privacy.go`, and `actions.go`. The store now also owns a
+`resource_changes` persistence table with `RecordChange` and `GetRecentChanges`
+methods so change history is queryable by canonical ID and time window.
+
+That frontend consumer rule now applies on the canonical decode path too:
+`frontend-modern/src/hooks/useUnifiedResources.ts` must preserve backend-owned
+policy metadata and AI-safe summaries as first-class `Resource` fields, and
+shared infrastructure consumers such as the unified resource table and detail
+drawer must present that owned metadata through shared helpers instead of
+reconstructing privacy posture from display names, source types, or other
+incidental runtime hints.
diff --git a/internal/api/contract_test.go b/internal/api/contract_test.go
index 8f6189a656..85e32ab250 100644
--- a/internal/api/contract_test.go
+++ b/internal/api/contract_test.go
@@ -3417,6 +3417,156 @@ func TestContract_ResourceListPolicyMetadata(t *testing.T) {
}
}
+func TestContract_ResourceListCarriesTimelineAndCapabilityContracts(t *testing.T) {
+ now := time.Date(2026, 3, 18, 12, 0, 0, 0, time.UTC)
+ occurredAt := now.Add(-2 * time.Minute)
+
+ payload := ResourcesResponse{
+ Data: []unifiedresources.Resource{
+ {
+ ID: "vm-42",
+ Type: unifiedresources.ResourceTypeVM,
+ Name: "web-42",
+ Status: unifiedresources.StatusOnline,
+ LastSeen: now,
+ Capabilities: []unifiedresources.ResourceCapability{
+ {
+ Name: "restart",
+ Type: unifiedresources.CapabilityTypeCommon,
+ Description: "Restart the VM",
+ MinimumApprovalLevel: unifiedresources.ApprovalAdmin,
+ Params: []unifiedresources.CapabilityParam{
+ {
+ Name: "force",
+ Type: "boolean",
+ Required: false,
+ Description: "Restart without graceful shutdown",
+ },
+ },
+ },
+ },
+ Relationships: []unifiedresources.ResourceRelationship{
+ {
+ SourceID: "vm-42",
+ TargetID: "node-1",
+ Type: unifiedresources.RelRunsOn,
+ Confidence: 1,
+ Active: true,
+ Discoverer: "proxmox_adapter",
+ ObservedAt: now,
+ LastSeenAt: now,
+ Metadata: map[string]any{
+ "source": "live",
+ },
+ },
+ },
+ RecentChanges: []unifiedresources.ResourceChange{
+ {
+ ID: "chg-42",
+ ObservedAt: now,
+ OccurredAt: &occurredAt,
+ ResourceID: "vm-42",
+ Kind: unifiedresources.ChangeStateTransition,
+ From: "offline",
+ To: "online",
+ SourceType: unifiedresources.SourcePlatformEvent,
+ SourceAdapter: unifiedresources.AdapterProxmox,
+ Confidence: unifiedresources.ConfidenceHigh,
+ RelatedResources: []string{"node-1"},
+ Reason: "vm started",
+ Metadata: map[string]any{
+ "source": "snapshot",
+ },
+ },
+ },
+ },
+ },
+ Meta: ResourcesMeta{
+ Page: 1,
+ Limit: 50,
+ Total: 1,
+ TotalPages: 1,
+ },
+ Aggregations: unifiedresources.ResourceStats{
+ Total: 1,
+ ByType: map[unifiedresources.ResourceType]int{unifiedresources.ResourceTypeVM: 1},
+ ByStatus: map[unifiedresources.ResourceStatus]int{unifiedresources.StatusOnline: 1},
+ BySource: map[unifiedresources.DataSource]int{unifiedresources.SourceProxmox: 1},
+ },
+ }
+
+ got, err := json.Marshal(payload)
+ if err != nil {
+ t.Fatalf("marshal resource response: %v", err)
+ }
+
+ const want = `{
+ "data":[
+ {
+ "id":"vm-42",
+ "type":"vm",
+ "name":"web-42",
+ "status":"online",
+ "lastSeen":"2026-03-18T12:00:00Z",
+ "updatedAt":"0001-01-01T00:00:00Z",
+ "sources":null,
+ "identity":{},
+ "capabilities":[
+ {
+ "name":"restart",
+ "type":"common",
+ "description":"Restart the VM",
+ "minimumApprovalLevel":"admin",
+ "params":[
+ {
+ "name":"force",
+ "type":"boolean",
+ "required":false,
+ "isSensitive":false,
+ "description":"Restart without graceful shutdown"
+ }
+ ]
+ }
+ ],
+ "relationships":[
+ {
+ "sourceId":"vm-42",
+ "targetId":"node-1",
+ "type":"runs_on",
+ "confidence":1,
+ "active":true,
+ "discoverer":"proxmox_adapter",
+ "observedAt":"2026-03-18T12:00:00Z",
+ "lastSeenAt":"2026-03-18T12:00:00Z",
+ "metadata":{"source":"live"}
+ }
+ ],
+ "recentChanges":[
+ {
+ "id":"chg-42",
+ "observedAt":"2026-03-18T12:00:00Z",
+ "occurredAt":"2026-03-18T11:58:00Z",
+ "resourceId":"vm-42",
+ "kind":"state_transition",
+ "from":"offline",
+ "to":"online",
+ "sourceType":"platform_event",
+ "sourceAdapter":"proxmox_adapter",
+ "confidence":"high",
+ "relatedResources":["node-1"],
+ "reason":"vm started",
+ "metadata":{"source":"snapshot"}
+ }
+ ]
+ }
+ ],
+ "meta":{"page":1,"limit":50,"total":1,"totalPages":1},
+ "aggregations":{"total":1,"byType":{"vm":1},"byStatus":{"online":1},"bySource":{"proxmox":1}}
+ }`
+
+ assertJSONSnapshot(t, got, want)
+}
+
func mustStreamEvent(t *testing.T, eventType string, data interface{}) chat.StreamEvent {
t.Helper()
diff --git a/internal/api/router.go b/internal/api/router.go
index 7d8b69589e..65faca41a0 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -356,6 +356,11 @@ func (r *Router) setupRoutes() {
r.unifiedAgentHandlers = NewUnifiedAgentHandlers(r.mtMonitor, r.monitor, r.wsHub)
r.kubernetesAgentHandlers.SetRecoveryIngestor(r.recoveryHandlers)
r.resourceHandlers = NewResourceHandlers(r.config)
+ if r.resourceHandlers != nil {
+ if store, err := r.resourceHandlers.getStore("default"); err == nil && store != nil {
+ r.monitorResourceAdapter = unifiedresources.NewMonitorAdapter(unifiedresources.NewRegistry(store))
+ }
+ }
if mock.IsMockEnabled() {
truenas.SetFeatureEnabled(true)
mockTrueNASProvider := truenas.NewDefaultProvider()
@@ -1051,7 +1056,13 @@ func (r *Router) monitorAdapterForMonitor(m *monitoring.Monitor) *unifiedresourc
return existing
}
- adapter := unifiedresources.NewMonitorAdapter(unifiedresources.NewRegistry(nil))
+ store := unifiedresources.ResourceStore(nil)
+ if r.resourceHandlers != nil {
+ if resolved, err := r.resourceHandlers.getStore(orgID); err == nil {
+ store = resolved
+ }
+ }
+ adapter := unifiedresources.NewMonitorAdapter(unifiedresources.NewRegistry(store))
r.monitorResourceAdapters[orgID] = adapter
return adapter
}
diff --git a/internal/api/router_helpers_more_test.go b/internal/api/router_helpers_more_test.go
index 6819f032ed..90f2d84b6e 100644
--- a/internal/api/router_helpers_more_test.go
+++ b/internal/api/router_helpers_more_test.go
@@ -5,6 +5,7 @@ import (
"net/http"
"net/http/httptest"
"testing"
+ "time"
"github.com/rcourtman/pulse-go-rewrite/internal/ai"
"github.com/rcourtman/pulse-go-rewrite/internal/config"
@@ -221,6 +222,50 @@ func TestRouterConfigureMonitorDependencies_UsesTenantSpecificResourceAdapters(t
}
}
+func TestRouterMonitorAdapterForMonitorUsesPersistentStore(t *testing.T) {
+ router := &Router{
+ resourceHandlers: NewResourceHandlers(&config.Config{DataPath: t.TempDir()}),
+ monitorResourceAdapters: make(map[string]*unifiedresources.MonitorAdapter),
+ }
+
+ monitor := &monitoring.Monitor{}
+ monitor.SetOrgID("tenant-1")
+
+ adapter := router.monitorAdapterForMonitor(monitor)
+ if adapter == nil {
+ t.Fatal("expected monitor adapter")
+ }
+
+ adapter.PopulateSupplementalRecords(unifiedresources.SourceDocker, []unifiedresources.IngestRecord{
+ {
+ SourceID: "docker-host-1",
+ Resource: unifiedresources.Resource{
+ Type: unifiedresources.ResourceTypeDockerService,
+ Name: "svc-1",
+ Status: unifiedresources.StatusOnline,
+ },
+ },
+ })
+
+ store, err := router.resourceHandlers.getStore("tenant-1")
+ if err != nil {
+ t.Fatalf("getStore: %v", err)
+ }
+
+ resources := adapter.GetAll()
+ if len(resources) != 1 {
+ t.Fatalf("expected 1 resource from adapter, got %d", len(resources))
+ }
+
+ changes, err := store.GetRecentChanges(resources[0].ID, time.Time{}, 10)
+ if err != nil {
+ t.Fatalf("GetRecentChanges: %v", err)
+ }
+ if len(changes) != 1 {
+ t.Fatalf("expected 1 stored change, got %d", len(changes))
+ }
+}
+
func TestRouterDefaultUnifiedResourceProvider_PrefersMonitorScopedAdapter(t *testing.T) {
defaultAdapter := unifiedresources.NewMonitorAdapter(unifiedresources.NewRegistry(nil))
defaultMonitor := &monitoring.Monitor{}
diff --git a/internal/unifiedresources/change_emission.go b/internal/unifiedresources/change_emission.go
new file mode 100644
index 0000000000..8473b09a96
--- /dev/null
+++ b/internal/unifiedresources/change_emission.go
@@ -0,0 +1,356 @@
+package unifiedresources
+
+import (
+ "fmt"
+ "log"
+ "reflect"
+ "strings"
+ "time"
+
+ "github.com/google/uuid"
+)
+
+func recordRegistryChanges(store ResourceStore, before, after []Resource, observedAt time.Time, occurredAt *time.Time, sourceType ChangeSourceType, sourceAdapterHint ChangeSourceAdapter) {
+ if store == nil {
+ return
+ }
+
+ beforeByID := make(map[string]Resource, len(before))
+ for _, resource := range before {
+ if resource.ID == "" {
+ continue
+ }
+ beforeByID[resource.ID] = resource
+ }
+
+ afterByID := make(map[string]Resource, len(after))
+ for _, resource := range after {
+ if resource.ID == "" {
+ continue
+ }
+ afterByID[resource.ID] = resource
+ }
+
+ seen := make(map[string]struct{}, len(beforeByID)+len(afterByID))
+ for id := range beforeByID {
+ seen[id] = struct{}{}
+ }
+ for id := range afterByID {
+ seen[id] = struct{}{}
+ }
+
+ for id := range seen {
+ beforeResource, beforeOK := beforeByID[id]
+ afterResource, afterOK := afterByID[id]
+ change := buildResourceChange(beforeResource, beforeOK, afterResource, afterOK, observedAt, occurredAt, sourceType, sourceAdapterHint)
+ if change == nil {
+ continue
+ }
+ if err := store.RecordChange(*change); err != nil {
+ log.Printf("unifiedresources: failed to record change for %s: %v", change.ResourceID, err)
+ }
+ }
+}
+
+func buildResourceChange(before Resource, beforeOK bool, after Resource, afterOK bool, observedAt time.Time, occurredAt *time.Time, sourceType ChangeSourceType, sourceAdapterHint ChangeSourceAdapter) *ResourceChange {
+ if !beforeOK && !afterOK {
+ return nil
+ }
+
+ change := &ResourceChange{
+ ID: uuid.NewString(),
+ ObservedAt: observedAt,
+ OccurredAt: cloneTimePtr(occurredAt),
+ Confidence: ConfidenceHigh,
+ SourceType: sourceType,
+ SourceAdapter: sourceAdapterHint,
+ }
+
+ if afterOK {
+ change.ResourceID = after.ID
+ } else {
+ change.ResourceID = before.ID
+ }
+ if change.ResourceID == "" {
+ return nil
+ }
+
+ if !beforeOK {
+ change.Kind = ChangeStateTransition
+ change.From = "absent"
+ change.To = resourceStatusString(after.Status)
+ change.Reason = "resource discovered"
+ change.Metadata = map[string]any{"changeType": "resource_created"}
+ if change.SourceAdapter == "" {
+ change.SourceAdapter = resourceChangeSourceAdapter(&after)
+ }
+ return change
+ }
+
+ if !afterOK {
+ change.Kind = ChangeStateTransition
+ change.From = resourceStatusString(before.Status)
+ change.To = "absent"
+ change.Reason = "resource removed"
+ change.Metadata = map[string]any{"changeType": "resource_removed"}
+ if change.SourceAdapter == "" {
+ change.SourceAdapter = resourceChangeSourceAdapter(&before)
+ }
+ return change
+ }
+
+ changedFields := resourceChangedFields(before, after)
+ if len(changedFields) == 0 {
+ return nil
+ }
+
+ change.Metadata = map[string]any{"changedFields": changedFields}
+
+ switch {
+ case before.Status != after.Status || dockerCommandChanged(before, after) || dockerUpdateStatusChanged(before, after) || proxmoxLifecycleChanged(before, after):
+ change.Kind = ChangeStateTransition
+ change.From = resourceStateSummary(before)
+ change.To = resourceStateSummary(after)
+ change.Reason = "resource state changed"
+ case !equalStringPtr(before.ParentID, after.ParentID) || !reflect.DeepEqual(before.Relationships, after.Relationships):
+ change.Kind = ChangeRelationship
+ change.From = resourceRelationSummary(before)
+ change.To = resourceRelationSummary(after)
+ change.Reason = "resource relationship changed"
+ change.RelatedResources = relatedResourceIDs(before, after)
+ case !reflect.DeepEqual(before.Capabilities, after.Capabilities):
+ change.Kind = ChangeCapability
+ change.From = fmt.Sprintf("%d", len(before.Capabilities))
+ change.To = fmt.Sprintf("%d", len(after.Capabilities))
+ change.Reason = "resource capabilities changed"
+ default:
+ change.Kind = ChangeConfigUpdate
+ change.From = resourceConfigSummary(before)
+ change.To = resourceConfigSummary(after)
+ change.Reason = "resource configuration changed"
+ }
+
+ if change.SourceAdapter == "" {
+ change.SourceAdapter = resourceChangeSourceAdapter(&after)
+ }
+
+ return change
+}
+
+func resourceChangedFields(before, after Resource) []string {
+ var changed []string
+
+ if before.Type != after.Type {
+ changed = append(changed, "type")
+ }
+ if before.Technology != after.Technology {
+ changed = append(changed, "technology")
+ }
+ if before.Name != after.Name {
+ changed = append(changed, "name")
+ }
+ if before.Status != after.Status {
+ changed = append(changed, "status")
+ }
+ if !equalStringPtr(before.ParentID, after.ParentID) {
+ changed = append(changed, "parentId")
+ }
+ if !sameStringSet(before.Tags, after.Tags) {
+ changed = append(changed, "tags")
+ }
+ if before.CustomURL != after.CustomURL {
+ changed = append(changed, "customUrl")
+ }
+ if !reflect.DeepEqual(before.Identity, after.Identity) {
+ changed = append(changed, "identity")
+ }
+ if dockerCommandChanged(before, after) {
+ changed = append(changed, "docker.command")
+ }
+ if dockerUpdateStatusChanged(before, after) {
+ changed = append(changed, "docker.updateStatus")
+ }
+ if proxmoxLifecycleChanged(before, after) {
+ changed = append(changed, "proxmox.lifecycle")
+ }
+
+ return changed
+}
+
+func dockerCommandChanged(before, after Resource) bool {
+ var beforeCommand, afterCommand any
+ if before.Docker != nil {
+ beforeCommand = before.Docker.Command
+ }
+ if after.Docker != nil {
+ afterCommand = after.Docker.Command
+ }
+ return !reflect.DeepEqual(beforeCommand, afterCommand)
+}
+
+func dockerUpdateStatusChanged(before, after Resource) bool {
+ var beforeStatus, afterStatus any
+ if before.Docker != nil {
+ beforeStatus = before.Docker.UpdateStatus
+ }
+ if after.Docker != nil {
+ afterStatus = after.Docker.UpdateStatus
+ }
+ return !reflect.DeepEqual(beforeStatus, afterStatus)
+}
+
+func proxmoxLifecycleChanged(before, after Resource) bool {
+ var beforeProxmox, afterProxmox *struct {
+ ClusterName string
+ LinkedAgentID string
+ Lock string
+ PendingUpdates int
+ }
+ if before.Proxmox != nil {
+ beforeProxmox = &struct {
+ ClusterName string
+ LinkedAgentID string
+ Lock string
+ PendingUpdates int
+ }{
+ ClusterName: before.Proxmox.ClusterName,
+ LinkedAgentID: before.Proxmox.LinkedAgentID,
+ Lock: before.Proxmox.Lock,
+ PendingUpdates: before.Proxmox.PendingUpdates,
+ }
+ }
+ if after.Proxmox != nil {
+ afterProxmox = &struct {
+ ClusterName string
+ LinkedAgentID string
+ Lock string
+ PendingUpdates int
+ }{
+ ClusterName: after.Proxmox.ClusterName,
+ LinkedAgentID: after.Proxmox.LinkedAgentID,
+ Lock: after.Proxmox.Lock,
+ PendingUpdates: after.Proxmox.PendingUpdates,
+ }
+ }
+ return !reflect.DeepEqual(beforeProxmox, afterProxmox)
+}
+
+func resourceStateSummary(resource Resource) string {
+ status := resourceStatusString(resource.Status)
+ if status == "" {
+ status = "unknown"
+ }
+ return status
+}
+
+func resourceRelationSummary(resource Resource) string {
+ parentID := ""
+ if resource.ParentID != nil {
+ parentID = strings.TrimSpace(*resource.ParentID)
+ }
+ if parentID == "" {
+ parentID = "root"
+ }
+ return parentID
+}
+
+func resourceConfigSummary(resource Resource) string {
+ return fmt.Sprintf("%s|%s|%s|%s", resource.Type, resource.Technology, resource.Name, resource.CustomURL)
+}
+
+func resourceStatusString(status ResourceStatus) string {
+ return strings.TrimSpace(string(status))
+}
+
+func relatedResourceIDs(before, after Resource) []string {
+ seen := make(map[string]struct{}, 2)
+ var out []string
+ appendID := func(id string) {
+ id = CanonicalResourceID(id)
+ if id == "" {
+ return
+ }
+ if _, ok := seen[id]; ok {
+ return
+ }
+ seen[id] = struct{}{}
+ out = append(out, id)
+ }
+ if before.ParentID != nil {
+ appendID(*before.ParentID)
+ }
+ if after.ParentID != nil {
+ appendID(*after.ParentID)
+ }
+ return out
+}
+
+func resourceChangeSourceAdapter(resource *Resource) ChangeSourceAdapter {
+ if resource == nil {
+ return ""
+ }
+ switch {
+ case resource.Docker != nil || hasDataSource(resource.Sources, SourceDocker):
+ return AdapterDocker
+ case resource.Proxmox != nil || hasDataSource(resource.Sources, SourceProxmox):
+ return AdapterProxmox
+ case resource.TrueNAS != nil || hasDataSource(resource.Sources, SourceTrueNAS):
+ return AdapterTrueNAS
+ case resource.Agent != nil || hasDataSource(resource.Sources, SourceAgent):
+ return AdapterOpsAgent
+ default:
+ return ""
+ }
+}
+
+func changeSourceAdapterForDataSource(source DataSource) ChangeSourceAdapter {
+ switch source {
+ case SourceDocker:
+ return AdapterDocker
+ case SourceProxmox:
+ return AdapterProxmox
+ case SourceTrueNAS:
+ return AdapterTrueNAS
+ case SourceAgent:
+ return AdapterOpsAgent
+ default:
+ return ""
+ }
+}
+
+func sameStringSet(a, b []string) bool {
+ if len(a) != len(b) {
+ return false
+ }
+ if len(a) == 0 {
+ return true
+ }
+
+ counts := make(map[string]int, len(a))
+ for _, v := range a {
+ counts[v]++
+ }
+ for _, v := range b {
+ counts[v]--
+ if counts[v] < 0 {
+ return false
+ }
+ }
+ for _, count := range counts {
+ if count != 0 {
+ return false
+ }
+ }
+ return true
+}
+
+func equalStringPtr(a, b *string) bool {
+ switch {
+ case a == nil && b == nil:
+ return true
+ case a == nil || b == nil:
+ return false
+ default:
+ return strings.TrimSpace(*a) == strings.TrimSpace(*b)
+ }
+}
diff --git a/internal/unifiedresources/monitor_adapter.go b/internal/unifiedresources/monitor_adapter.go
index 42fd78b0a9..913078cd89 100644
--- a/internal/unifiedresources/monitor_adapter.go
+++ b/internal/unifiedresources/monitor_adapter.go
@@ -47,6 +47,7 @@ func (a *MonitorAdapter) replaceRegistry(snapshot models.StateSnapshot, recordsB
return
}
+ before := registry.List()
rebuilt := NewRegistry(registry.store)
rebuilt.IngestSnapshot(snapshot)
for source, records := range recordsBySource {
@@ -60,6 +61,13 @@ func (a *MonitorAdapter) replaceRegistry(snapshot models.StateSnapshot, recordsB
rebuiltAt = snapshot.LastUpdate
}
+ var occurredAt *time.Time
+ if !snapshot.LastUpdate.IsZero() {
+ occ := snapshot.LastUpdate
+ occurredAt = &occ
+ }
+ recordRegistryChanges(registry.store, before, rebuilt.List(), rebuiltAt, occurredAt, SourcePulseDiff, "")
+
a.mu.Lock()
a.registry = rebuilt
a.activeAlerts = append([]models.Alert(nil), snapshot.ActiveAlerts...)
@@ -235,9 +243,12 @@ func (a *MonitorAdapter) PopulateSupplementalRecords(source DataSource, records
if registry == nil || len(records) == 0 || strings.TrimSpace(string(source)) == "" {
return
}
+ before := registry.List()
registry.IngestRecords(source, records)
+ rebuiltAt := time.Now().UTC()
+ recordRegistryChanges(registry.store, before, registry.List(), rebuiltAt, nil, SourcePlatformEvent, changeSourceAdapterForDataSource(source))
a.mu.Lock()
- a.lastRebuiltAt = time.Now().UTC()
+ a.lastRebuiltAt = rebuiltAt
a.mu.Unlock()
}
diff --git a/internal/unifiedresources/monitor_adapter_read_state_test.go b/internal/unifiedresources/monitor_adapter_read_state_test.go
index ca238fdffe..0f82ce694c 100644
--- a/internal/unifiedresources/monitor_adapter_read_state_test.go
+++ b/internal/unifiedresources/monitor_adapter_read_state_test.go
@@ -149,3 +149,63 @@ func TestMonitorAdapterReadStateReturnsClonedIncidents(t *testing.T) {
t.Fatalf("expected truenas storage risk to be cloned, got %q", got)
}
}
+
+func TestMonitorAdapterRecordsSupplementalChangeTimeline(t *testing.T) {
+ store := NewMemoryStore()
+ adapter := NewMonitorAdapter(NewRegistry(store))
+
+ source := SourceAgent
+ sourceID := "xcp-host-1"
+ firstSeen := time.Date(2026, 3, 8, 11, 0, 0, 0, time.UTC)
+ adapter.PopulateSupplementalRecords(source, []IngestRecord{
+ {
+ SourceID: sourceID,
+ Resource: Resource{
+ Type: ResourceTypeAgent,
+ Name: "xcp-host-1",
+ Status: StatusOnline,
+ LastSeen: firstSeen,
+ },
+ },
+ })
+
+ resources := adapter.GetAll()
+ if len(resources) != 1 {
+ t.Fatalf("expected 1 resource after initial ingest, got %d", len(resources))
+ }
+ resourceID := resources[0].ID
+
+ changes, err := store.GetRecentChanges(resourceID, time.Time{}, 10)
+ if err != nil {
+ t.Fatalf("GetRecentChanges initial: %v", err)
+ }
+ if len(changes) != 1 {
+ t.Fatalf("expected 1 change after initial ingest, got %d", len(changes))
+ }
+ if changes[0].Kind != ChangeStateTransition {
+ t.Fatalf("expected creation to record a state transition, got %q", changes[0].Kind)
+ }
+
+ adapter.PopulateSupplementalRecords(source, []IngestRecord{
+ {
+ SourceID: sourceID,
+ Resource: Resource{
+ Type: ResourceTypeAgent,
+ Name: "xcp-host-1",
+ Status: StatusWarning,
+ LastSeen: firstSeen.Add(time.Minute),
+ },
+ },
+ })
+
+ changes, err = store.GetRecentChanges(resourceID, time.Time{}, 10)
+ if err != nil {
+ t.Fatalf("GetRecentChanges after update: %v", err)
+ }
+ if len(changes) != 2 {
+ t.Fatalf("expected 2 changes after status update, got %d", len(changes))
+ }
+ if changes[0].Kind != ChangeStateTransition {
+ t.Fatalf("expected latest change to be a state transition, got %q", changes[0].Kind)
+ }
+}
diff --git a/internal/unifiedresources/store.go b/internal/unifiedresources/store.go
index f32e9e8c0c..9a1b8dca59 100644
--- a/internal/unifiedresources/store.go
+++ b/internal/unifiedresources/store.go
@@ -504,6 +504,7 @@ type MemoryStore struct {
mu sync.RWMutex
links []ResourceLink
exclusions []ResourceExclusion
+ changes []ResourceChange
}
func NewMemoryStore() *MemoryStore {
@@ -552,15 +553,29 @@ func (m *MemoryStore) Close() error {
func (m *MemoryStore) RecordChange(change ResourceChange) error {
m.mu.Lock()
defer m.mu.Unlock()
- // No-op for now in memory store
+ m.changes = append(m.changes, change)
return nil
}
func (m *MemoryStore) GetRecentChanges(canonicalID string, since time.Time, limit int) ([]ResourceChange, error) {
m.mu.RLock()
defer m.mu.RUnlock()
- // Return empty list for now in memory store
- return []ResourceChange{}, nil
+ canonicalID = CanonicalResourceID(canonicalID)
+ var out []ResourceChange
+ for i := len(m.changes) - 1; i >= 0; i-- {
+ change := m.changes[i]
+ if canonicalID != "" && CanonicalResourceID(change.ResourceID) != canonicalID {
+ continue
+ }
+ if !since.IsZero() && change.ObservedAt.Before(since) {
+ continue
+ }
+ out = append(out, change)
+ if limit > 0 && len(out) >= limit {
+ break
+ }
+ }
+ return out, nil
}
func normalizePair(a, b string) (string, string) {
diff --git a/internal/unifiedresources/store_test.go b/internal/unifiedresources/store_test.go
index 1e9f591472..66f44eb841 100644
--- a/internal/unifiedresources/store_test.go
+++ b/internal/unifiedresources/store_test.go
@@ -2,6 +2,7 @@ package unifiedresources
import (
"database/sql"
+ "fmt"
"os"
"path/filepath"
"strings"
@@ -139,16 +140,26 @@ func newTestStore(t *testing.T) *SQLiteResourceStore {
func TestRecordChange_RoundTrip(t *testing.T) {
store := newTestStore(t)
now := time.Now().UTC().Truncate(time.Second)
+ occurredAt := now.Add(-30 * time.Second)
change := ResourceChange{
- ID: "chg-1",
- ResourceID: "vm:100",
- ObservedAt: now,
- Kind: ChangeStateTransition,
- From: "offline",
- To: "online",
- SourceType: "proxmox",
- Confidence: ConfidenceHigh,
+ ID: "chg-1",
+ ResourceID: "vm:100",
+ ObservedAt: now,
+ OccurredAt: &occurredAt,
+ Kind: ChangeStateTransition,
+ From: "offline",
+ To: "online",
+ SourceType: SourcePlatformEvent,
+ SourceAdapter: AdapterProxmox,
+ Confidence: ConfidenceHigh,
+ Actor: "agent:ops-helper",
+ RelatedResources: []string{"node:1", "storage:2"},
+ Reason: "vm started",
+ Metadata: map[string]any{
+ "source": "snapshot",
+ "retry": 1,
+ },
}
if err := store.RecordChange(change); err != nil {
@@ -175,6 +186,88 @@ func TestRecordChange_RoundTrip(t *testing.T) {
if got.Confidence != change.Confidence {
t.Errorf("Confidence: got %q, want %q", got.Confidence, change.Confidence)
}
+ if got.SourceType != change.SourceType {
+ t.Errorf("SourceType: got %q, want %q", got.SourceType, change.SourceType)
+ }
+ if got.SourceAdapter != change.SourceAdapter {
+ t.Errorf("SourceAdapter: got %q, want %q", got.SourceAdapter, change.SourceAdapter)
+ }
+ if got.Actor != change.Actor {
+ t.Errorf("Actor: got %q, want %q", got.Actor, change.Actor)
+ }
+ if got.Reason != change.Reason {
+ t.Errorf("Reason: got %q, want %q", got.Reason, change.Reason)
+ }
+ if len(got.RelatedResources) != len(change.RelatedResources) {
+ t.Fatalf("RelatedResources length: got %d, want %d", len(got.RelatedResources), len(change.RelatedResources))
+ }
+ for i := range change.RelatedResources {
+ if got.RelatedResources[i] != change.RelatedResources[i] {
+ t.Fatalf("RelatedResources[%d]: got %q, want %q", i, got.RelatedResources[i], change.RelatedResources[i])
+ }
+ }
+ if got.OccurredAt == nil || !got.OccurredAt.Equal(occurredAt) {
+ t.Fatalf("OccurredAt: got %v, want %v", got.OccurredAt, occurredAt)
+ }
+ if got.Metadata["source"] != change.Metadata["source"] {
+ t.Fatalf("Metadata source: got %v, want %v", got.Metadata["source"], change.Metadata["source"])
+ }
+ if fmt.Sprint(got.Metadata["retry"]) != "1" {
+ t.Fatalf("Metadata retry: got %v, want 1", got.Metadata["retry"])
+ }
+}
+
+func TestRecordChange_PreservesTimelineMetadata(t *testing.T) {
+ store := newTestStore(t)
+ now := time.Date(2026, 3, 18, 12, 0, 0, 0, time.UTC)
+ occurredAt := now.Add(-5 * time.Minute)
+
+ change := ResourceChange{
+ ID: "chg-rich-1",
+ ResourceID: "vm:200",
+ ObservedAt: now,
+ OccurredAt: &occurredAt,
+ Kind: ChangeRelationship,
+ SourceType: SourcePulseDiff,
+ SourceAdapter: AdapterDocker,
+ Confidence: ConfidenceMedium,
+ Actor: "pulse:differ",
+ RelatedResources: []string{"node:20", "service:api"},
+ Reason: "dependency graph updated",
+ Metadata: map[string]any{
+ "edgeType": "runs_on",
+ "active": true,
+ },
+ }
+
+ if err := store.RecordChange(change); err != nil {
+ t.Fatalf("RecordChange: %v", err)
+ }
+
+ results, err := store.GetRecentChanges("vm:200", now.Add(-time.Hour), 10)
+ if err != nil {
+ t.Fatalf("GetRecentChanges: %v", err)
+ }
+ if len(results) != 1 {
+ t.Fatalf("expected 1 change, got %d", len(results))
+ }
+
+ got := results[0]
+ if got.Kind != change.Kind || got.SourceType != change.SourceType || got.SourceAdapter != change.SourceAdapter {
+ t.Fatalf("unexpected change headers: %+v", got)
+ }
+ if got.OccurredAt == nil || !got.OccurredAt.Equal(occurredAt) {
+ t.Fatalf("OccurredAt: got %v, want %v", got.OccurredAt, occurredAt)
+ }
+ if len(got.RelatedResources) != 2 || got.RelatedResources[0] != "node:20" || got.RelatedResources[1] != "service:api" {
+ t.Fatalf("RelatedResources round-trip failed: %+v", got.RelatedResources)
+ }
+ if got.Metadata["edgeType"] != "runs_on" {
+ t.Fatalf("Metadata edgeType: got %v, want %v", got.Metadata["edgeType"], "runs_on")
+ }
+ if got.Metadata["active"] != true {
+ t.Fatalf("Metadata active: got %v, want true", got.Metadata["active"])
+ }
}
func TestGetRecentChanges_RespectsTimeFilter(t *testing.T) {