Compile to Code: The Pattern That Turns Agent Reasoning Into Reusable Institutional Memory