Verify Refactor — act101 Agent Skill
Verify a refactor preserved behavior — composes contract, side-effect, and CFG-equivalence checks across two versions of a function. Use after editing a function to confirm the change is safe.
verify-refactor
Confirm a function's refactor is behavior-preserving by composing three
Engineer-tier verification ops over a two-version comparison (git working-tree
vs HEAD by default, or an explicit before/after pair).
Scope note: this skill verifies ONE function pair. For a changed SET of
functions with git context, use act gate (see the safe-to-merge skill) — its
verdict vocabulary (MERGE/REVIEW/BLOCK/UNKNOWN) is intentionally distinct from
this skill's per-function SAFE/REVIEW/UNSAFE/UNKNOWN.
Tools
| Step | Tool | What it answers |
|---|---|---|
| 1 | verify_contract_preserved |
Did the public + behavioral contract (signature, effects, control, returns, guards, raises) change? |
| 2 | verify_side_effects |
Which side effects were added/removed? Was a cleanup dropped? |
| 3 | verify_behavioral_equivalence |
Is the control-flow shape equivalent (no new/removed branches, loops, exception paths)? |
All three are Engineer. verify_behavioral_equivalence at scope:"port" is Enterprise.
How to run
- Call
verify_contract_preservedwithtarget+file. If the verdict isbroken, report the broken dimensions and stop — the refactor changed the contract. - Call
verify_side_effects. Surface anydropped_cleanup: trueprominently — a removed write/close while an allocation is kept is a likely leak. - Call
verify_behavioral_equivalence.equivalentconfirms the shape held;changedlists which dimensions;unknownmeans a grammar dimension (e.g. Go exceptions) could not be judged — say so, do not claim safety.
Verdict
- SAFE — contract preserved, no dropped cleanup, behaviorally equivalent.
- REVIEW — contract preserved but effects changed, or CFG
changedin an expected way; summarize what moved. - UNSAFE — contract
broken,dropped_cleanup: true, or behavior changed unexpectedly. - UNKNOWN — any op returned
unknownon a not-modeled dimension; never upgrade UNKNOWN to SAFE.
Summary format
Report: the verdict, the three op results in one line each, and the specific
dimensions/effects that changed. Quote modeled_kinds when a verdict is UNKNOWN.