Go backward to Adding Input and Output Routines.
Go up to Adding Input and Output Routines.
Go forward to Initialization for I/O.

Overview
--------

Input and output should be viewed from Soar's perspective. An *input
function* adds, alters, or deletes augmentations of the top-level state and
provides Soar with information about some occurrence external to Soar. An
*output function* responds to a top-level state augmentation produced by
production firings and causes some occurrence external to Soar. Input and
output occur through the top-level state exclusively.

As shown in Figure ?, input functions are called *before* the start of every
elaboration cycle.  The working memory elements they produce are added before
the elaboration cycle, possibly altering the set of productions that match
for a particular cycle.  Input functions are always called before quiescence,
so that new input can trigger further production firings and forestall
quiescence.

An output function is called only if a working-memory element is created that
is an *output structure* for that output function.  Output functions are
called *after* the working-memory phase of every elaboration cycle when an
appropriate output structure is created.  Although the output structure may
persist through several elaboration cycles, it will trigger the output
function only at the end of the cycle in which it is created in working
memory.