Last modified 5 years ago Last modified on 01/16/14 21:17:45

CLIPS Plugin

This plugin integrates CLIPS into Fawkes and provides CLIPS environments for other plugins and some basic features. CLIPS is a rule-based production system which can be used to implement reasoning or monitoring components, for example.


CLIPS Environment
The CLIPS environment is the interface between the CLIPS code and the outer C++ code.
CLIPS Feature
A feature is a functionality that can be provided by a plugin and requested from within CLIPS code. A feature can be a library consisting of C++ and/or CLIPS functions, or certain operations performed on an environment once the feature is requested, for example specifying certain rules. Each feature has a name which must be unique among all features.
Environment name
Each environment has a unique name by which it can be referenced.


BlackBoard Interfaces

No particular interface is required, but all that exist can be opened for reading.

Config Values

/clips/clips-dirstringPath where to look for standard CLIPS filesSRCDIR/clips


BlackBoard Interfaces



This aspect is used to create a basic CLIPS environment for a plugin. It will create a member variable clips, which is a locked shared pointer to a CLIPS::Environment.


Use this aspect to provide a CLIPS feature. You must provide a sub-class instance of CLIPSFeature. It requires to implement two methods. One is called when a CLIPS environment requested the provided feature, and the other one is called when an environment is destroyed that had requested the desired feature.


This aspect provides access to the CLIPS environment manager. It allows to list context, create new and destroy existing ones, and manage features. Improper use can easily lead to undesired behavior. There are two use cases for this aspect: one is to create more than a single CLIPS environment in a single thread (and properly destroying them on finalization), the other is to introspect existing environment, which is demonstrated in the clips-webview? plugin.

Compilation and Runtime Requirements

  • clipsmm 0.3.3 or newer

CLIPS Features

The plugin provides certain basic features which are useful to various plugins and which are based on existing core aspects of the Fawkes framework. Details are on the CLIPS Features? page.

Usage Instructions

Running the plugin

Running the plugin is fairly easy, just load it. The plugin does not do anything by itself, but is also a pre-requisite for other plugins like the clips-agent.

Writing a CLIPS plugin

Providing CLIPS Features

Using CLIPS Features

Using CLIPS features requires special considerations. The reason is that features may provide functions, rules, or deftemplates, which are consequently not available before a feature has been requested in the code. Therefore features require a multi-stage/multi-file loading procedure.

As each available feature is indicated with an (ff-feature F) fact (where F is replaced with the feature name), you can easily construct a rule to request a feature once it is available. Note that this might only be the case after another plugin (providing this feature) has been loaded. A rule might look like this (as an example for using the blackboard):

(defrule enable-blackboard
  (ff-feature blackboard)
  (printout t "Requesting blackboard feature" crlf)
  (ff-feature-request "blackboard")
  (path-load "blackboard-init.clp")

Note the load instruction for the blackboard initialization code. It contains code that relies on functions provided by the blackboard feature. The blackboard feature is a special case, in that it requires three stages, and that means three files, to complete the initialization. The first stage contains the rule presented above, requesting the feature. The second stage, in the file blackboard-init.clp in our example, contains the following:

(defrule use-blackboard
  (ff-feature blackboard)
  (blackboard-open "SpeechSynthInterface" "Flite")
  (path-load "blackboard-processing.clp")

This rule will fire as soon as the file is loaded (as it is loaded when the antecedent already hold). Here, we do three things. First we enable read-on-time, which will create a blackboad-read rule which causes all changed blackboard interfaces to be read whenever a (time) fact is asserted. Then we open an interface. The flite plugin's speech synthesis interface in this case. This will implicitly create a deftemplate SpeechSynthInterface mimicing the blackboard data structure, and a SpeechSynthInterface-cleanup rule, which will retract SpeechSynthInterfaces? with a low salience (i.e. cleanup after a cycle). Therefore it is necessary you copy the data as necessary. But the deftemplate is only available after the interface has been opened. Therefore code relying on it must be moved to a third stage, in our case this is specified in the blackboard-processing.clp file.