surgical-patchlisted
Install: claude install-skill iansteitz1-eng/aria-skills
# Surgical Patch — drift-safe live-file editor
The safe way to change a file that you **can't** just rsync over, because the live
copy is ahead of your local one (other lanes' uncommitted edits live in it).
**Why it exists.** On 2026-06-03 the prod `main.py` was ~750 lines ahead of the
Mac checkout. A wholesale rsync would have wiped other lanes' work. The fix:
fetch the live file, build a minimal delta, and apply it with assertions + backup.
This skill is that pattern, made repeatable. Pairs with [[safe-restart]] (guard
the restart) and [[aria-deploy]] (do the restart). Enforces the drift rule in
[[project_local_first_doctrine_2026_06_02]].
## The loop
1. **Find the live anchors.** `ssh <host> "grep -n '<marker>' <path>"` /
`sed -n` the region. Build edits against the LIVE text, never your stale local.
2. **Author an edits spec** (`edits.json`):
```json
{
"sentinel": "runner_provenance",
"verify": "python3 -m py_compile {path}",
"edits": [
{"old": "<exact live block>", "new": "<replacement>", "count": 1}
]
}
```
- `sentinel` (optional) — a string unique to the patched state; if already
present the run is a NO-OP (idempotent re-runs after a partial deploy).
- `verify` (optional) — shell run after writing; `{path}` is substituted; a
nonzero exit **rolls back** to the backup. For Python on the server use
`python3 -m py_compile {path}` or a full `python3 -c "import main"`.
- each edit `old` must match exactly