Refactor into Agent/Plugin structure