He was speaking of co-operating with Miranda against Spain not a US invasion. Although Jefferson’s followers did invade Canada a few years later.
He was speaking to the soon-to-be-sacked Secretary of War about using the recently raised army so it wouldn’t go to waste. There’s no dancing around it - Hamilton had his eyes set on Spanish and French territory, and strongly hinted at military acquisition of each.