A code-oriented application profile for Structural Patch Protocol (SPP).
This document defines how an AI agent should modify an existing codebase under SPP.
The goal is to prevent:
wrong-file edits
schema hallucination
API misuse
selector mismatch
over-generalized replacement
unverified patch stacking
scope drift
Target Lock
→ Actual Artifact First
→ Probe Patch
→ Verify
→ Failed Patch Withdrawal / Verified Merge
→ Cleanup
→ Stop
The agent must identify:
Target file(s)
Target function / class / component / selector / schema
Reason for change
Expected effect
Verification method
Rollback method
The agent must inspect the actual codebase before editing.
Examples:
ls / find / tree
open target files
read adjacent code
inspect existing tests
inspect actual DB schema
inspect actual API response
inspect actual DOM or CSS selector
The agent must first apply one minimal patch.
The Probe Patch should be:
small enough to review
small enough to revert
large enough to test the intended effect
inside the locked target
After the Probe Patch, use at least one suitable verification method:
unit test
integration test
type check
lint
build
manual UI check
computed style inspection
DB query
API response check
git diff review
The verification question is:
Did this specific patch cause the expected effect?
If the Probe Patch fails, the agent must withdraw it before trying another patch.
No second patch before resolving the first failed patch.
Allowed actions:
revert the failed patch;
identify the failure cause and create a revised Probe Patch;
retain the patch only with explicit evidence that it is necessary.
Forbidden:
keep the failed patch;
add another patch on top;
repeat until something appears to work;
leave unexplained layers behind.
If the Probe Patch succeeds, the agent may apply the same transformation to structurally matching targets.
Do not apply a transformation merely because another location looks similar.
similar-looking ≠ structurally matching
Before stopping, the agent must clean up:
failed probes
old selectors
superseded CSS
unused functions
duplicate logic
obsolete comments
scattered temporary definitions
unexplained patch layers
Cleanup should consolidate effective structure into canonical form.
The agent must stop when:
the target is fixed;
verification has passed;
failed patches are withdrawn;
cleanup is complete for the touched scope;
diff is within scope;
further work requires a new task.
Every AI code patch should report:
Target
Artifact inspected
Patch applied
Verification result
Failed patches withdrawn
Files changed
Remaining issues
Stop condition
Use:
templates/spp-run-log.md
Follow SPP.
Before editing, inspect the actual artifact.
Apply one minimal Probe Patch.
Verify whether that specific patch worked.
If it failed, withdraw it before applying another patch.
If it succeeded, merge only verified transformations to structurally matching targets.
Clean up obsolete patch layers.
Stop when the target is stable and report remaining issues separately.