pub fn escape_memory_content(content: &str) -> StringExpand description
Escape <agent-memory> and </agent-memory> tags from memory content.
Handles case variations (</AGENT-MEMORY>, </Agent-Memory >) via case-insensitive
regex. Prevents prompt injection: an agent writing the closing tag to MEMORY.md would
otherwise escape the <agent-memory> wrapper and inject arbitrary system prompt text.
Trust model note: MEMORY.md is written by the agent itself, unlike user-written instruction files. Agent-written content requires stricter escaping.