I may be missing the spirit of this question, but if you just need to configure Unite with ag, it's simple: in your .vimrc add:
let g:unite_source_grep_command="ag" let g:unite_source_grep_default_opts="-i --nocolor --nogroup"
In vim, you invoke the search as follows:
:Unite grep:. pattern: foobar
Note. Unite does not come with predefined mappings, so you need to add your own. If Unite has too much functionality for your needs, consider using Ack.vim with ag (Ag.vim is no longer supported.) Both plugins make your ideal use of patten; but Unite does a whole bunch more.
source share