Building an AI agent inside a 7-year-old Rails monolith