This paper presents a programmable logic-based agent control system that interleaves planning, plan execution and perception. In this system, a program is a collection of logical formulae describing the agent’s relationship to its environment. Two such programs for a mobile robot are described — one for navigation and one for map building — that share much of their code. The map building program incorporates a rudimentary approach to the formalisation of epistemic fluents, knowledge goals, and knowledge producing actions.