Self-heal a drifted spec

When your app's UI changes, a recorded selector can stop matching and the saved spec turns red. Self-heal repairs it by re-grounding only the broken step and keeping the rest — so record == replay is preserved, not thrown away and re-authored.

Trigger it

In the agent you already run:

/mcp__hover__heal               # scan every saved spec
/mcp__hover__heal login.spec.ts # …or heal one

Detection is built in — you don't have to run playwright test first. replay_spec(slug) replays the spec's recorded grounded steps against the live app and reports the first step that no longer locates: its index and the role+name it was looking for.

The loop

  1. replay_spec replays the recorded steps and finds the drift — the first step that no longer locates.
  2. Re-snapshot the current page and re-locate the control by its recorded intent (the role+name / testId it was reaching for).
  3. Re-drive the step against the found control.
  4. crystallize_spec with the same name overwrites the spec in place.

Heal by intent — the agent never invents a new flow. If a feature was renamed, the selector is re-grounded and the spec keeps working. If a feature was removed rather than renamed, the agent stops and asks you rather than guessing.

From the VS Code cockpit

The review cockpit surfaces a 🏥 Heal in agent CodeLens on your specs. It copies the /mcp__hover__heal <slug> command to paste into your agent. The cockpit drives no agent — it detects and reviews; the MCP does the healing.

Scope

This is mode A: local, on-demand healing you trigger in your agent. CI-driven heal — a red CI run offering to heal automatically — is planned (see the roadmap). Locally, CI stays deterministic and free; nothing AI runs at test time.