initial work on the code agent, almost works!