How do I programatically create a context?
After checking the code used in the context test units for Drupal 6:

ctools_include('export');
$context = ctools_export_new_object('context');
$context-&gt;name = 'testcontext';
$context-&gt;conditions = array('path' =&gt; array('values' =&gt; array('admin')));
$context-&gt;reactions = array('debug' =&gt; array('debug' =&gt; TRUE));
$saved = context_save($context);


You can easily code your reactions or conditions then save the context.

BTW to get all context you can use context_context_list().