"Before I built a wall I'd ask to know
What I was walling in or walling out,'

Actually those two lines don't make much sense. The walls were built primarily to get rid of stones. They seldom kept anything either in or out.

Dear Bean: The glaciers cleared Canada of stones, and dumped them on New England. To be able to plow, the stones had to be gotten out of the way. It was not nice to dump them on your neighbor's property, so the most efficient way of disposing of them was to put them at the very edge of the property, where only after many years did they become a wall, seldom of any use to keep animals in. Unless you were lucky enough to get a lot of flat ones. The wall in the poem was obviously built astride the property line, of round ones that were hard to make stay put, when the frost heaved things. That's why the walls had to be worked on each spring when there was little else that could profitably be done. And both neighbors had to be present to avoid squabbles about the property line being shifted. That's what the curmudgeon neighbor was hinting at.