Harden search ops and reference handling for agent edit flows

Created by  G8qzBDPkyFWiTEg4ytm8NUw2bhYLjE9mvCJek2frJAVK  on February 19, 2026
F7MUSI5FFYOWTCR4CBL42CT3GE6UL66CQVJANCIISBLAMKRMQQ6AC
Change contents