Our model of the reasoning process process is diagrammed in Figure 1. Ignoring for the moment the role of contextual information, the process initially begins by the agent focusing its attention on a goal (or set of goals) on which to begin work. A means to achieve that goal is then selected. In schema-based reasoning (SBR), all problem-solving knowledge is represented as schemas. The action selected in this kind of reasoner is a particular kind of schema called a procedural schema, or p-schema [\protect\citenameTurner, 1989a], a kind of hierarchical plan. In other kinds of reasoners, the means to achieve goals would be represented by rules, knowledge sources, plans, etc.
After a p-schema or other knowledge structure is selected, it is applied to take the desired action. This process can be either simple and of short duration, as in the case of firing a rule, or complex and extending over a significant period of time, as in the case of interpreting a procedural schemas [\protect\citenameTurner, 1994][\protect\citenameTurner, 1989a].
Any realistic reasoning mechanism must account for and be able to handle unanticipated events occurring while it is achieving its goals. As indicated in the diagram, event handling proceeds in two steps. The agent must first assess the importance of the event. Assessing an event's importance involves estimating the event's impact on the agent's mission, positive, negative, or neutral. It may require diagnosis of the underlying cause of the event. For example, the event ``motion stopped'' may be caused by many things, such as ``caught in net'', ``run aground'', ``thruster failure'', etc. Actions may be required to perform the diagnosis, further complicating the process of event assessment. If the event is unimportant, then it can be ignored, but if it is important, then the agent must decide how to handle it. The agent may handle the event by simply re-focusing attention or it may need to take action in response. A schema-based reasoner does this, for example, by activating a goal, such as ``surface and signal for help''.
Contextual knowledge comes into play in almost all facets of a reasoner's activities, as shown by the shaded arrows in Figure 1. The agent at all times has a representation of what its current context is, based on a priori contextual knowledge augmented by differences it sees in the current situation. The representation is essentially the end result of situation assessment-it is the agent's idea of what the current situation is. This information, which is more fully described below, then helps the reasoner make predictions about the situation, focus its attention, select ways to achieve goals, and handle unanticipated events.
The contextual representation can be thought of as a contextual schema, the
current c-schema. The agent's context manager (CM) is responsible
for maintaining the current c-schema. Depending on the implementation, the
current c-schema may be an actual c-schema that the CM constructs, or it may
be a ``virtual'' c-schema implemented by the CM providing contextual
information to the rest of the agent's reasoning process upon demand. In our
early work on MEDIC, the former approach was used, while we are currently
leaning toward the latter.
The context manager's job is to take several c-schemas that are similar to the current situation, select from among them the most similar and merge them to form the current c-schema. The candidate c-schemas could be found by any memory-retrieval mechanism. In our systems, we favor a content-addressable memory similar to the CYRUS program [\protect\citenameKolodner, 1984], which allows the agent to easily use features of the current situation as indices into memory to find the most similar c-schemas. An important feature of this kind of memory is that it supports organizing c-schemas into generalization-specialization hierarchies, in which c-schemas representing more general contexts organize more specialized versions of themselves. This allows the agent to retrieve the most specific c-schema for the current situation based on what is currently known; it is then easy to specialize that c-schema as new information becomes available. This kind of memory also supports learning as new problem-solving cases are added to the memory [\protect\citenameKolodner, 1984].
Memory retrieval could be done by the context manager either periodically searching memory for c-schemas or it watching the reasoner's representation of the state of the world and searching memory when it changes significantly. However, we favor an approach with a more active and autonomous memory [\protect\citenameTurner, 1994][\protect\citenameTurner, 1989a] that watches the evolving state of the world and automatically provides the CM with up-to-date ``remindings'' [\protect\citenameKolodner, 1984] of similar c-schemas. This provides a cleaner modularization of function between the reasoner's principal components.
It is important to note that our approach to context-sensitive reasoning does not depend on the agent being a schema-based reasoner; only the context manager and its representations need be schema-based. We could just as easily imagine using the CM with a rule-based expert system or a planner, with the current c-schema in this case providing information about appropriate rulesets or operator sets, meta-rules to focus attention in the context, and specific rules that should trigger to assess and handle unanticipated events. Thus this rather generic approach has promise for a wide range of other reasoning styles.