Opencog Shell for Noobs

From OpenCog
Jump to: navigation, search



This page describes some simple shell commands to give new users a basic understanding of its capabilities.


This page has the following prerequisites:


The OpenCog Shell is a command line interface that allows interaction with the CogServer and the processes that can be running inside it, such as Mind Agents.

See the prerequisites section above for details about starting and connecting to the CogServer.

Once connected to the CogServer, you should have a command prompt as shown below.

Connected to localhost.
Escape character is '^]'.

type "help"<enter> to get a list of commands:

Available commands:
 agents-list:       List running agents
 agents-start:      Start some agents
 agents-start-loop: Start the agent loop
 agents-step:       Run a single cycle of an agent(s)
 agents-stop:       Stop some agents running
 agents-stop-loop:  Stop the agent loop
 data:              loads inline xml data into the atomspace
 exit:              closes connection and exit
 help:              list the available commands or print the help for a specific command
 list:              list the atom currently at the atomtable
 load:              load the contents of a xml file
 loadmodule:        load an opencog module; give the module filename as the argument
 pln:               Run a PLN command
 save:              save the AtomSpace to an XML file
 scm:               Enter the scheme shell
 shutdown:          shut down the cogserver
 sql-close:         Close the SQL database
 sql-load:          Load contents of SQL database
 sql-open:          Open connection to SQL storage
 sql-store:         Save the atomtable on the SQL database
 unloadmodule:      unload an opencog module

To get information about any of the commands, use "help <name of command>".

Next we'll go through each command to describe some of their potential uses.

  • agents-list
  • agents-start
  • agents-start-loop
  • agents-step
  • agents-stop
  • agents-stop-loop
  • data

Allows you to enter data in XML format inline, current functionality unknown.

  • exit

Closes the connection to the CogServer and exits the telnet session.

  • help

Shows the above list of possible commands.

  • list

Lists the atoms currently available in the AtomTable, in bracketed Scheme-like format.

  • load

Loads atom data from an XML file into the AtomSpace. Old, broken, obsolete and no longer supported. This should be removed from the interfaces. Use SCM instead.

  • loadmodule

Loads a module (Mind Agent) into the CogServer and starts it. The correct syntax for this is:

loadmodule examples/modules/

You can control the time allocated to the Mind Agents by changing the default values in the /lib/opencog.conf file (see Understanding the opencog.conf file for details).

  • pln

Run a PLN command. See this page and this page for an introduction into using PLN.

  • save

Saves the contents of the AtomSpace to an xml file. Old, broken, obsolete and no longer supported. Should be removed. Use SCM instead.

  • scm

Starts the Scheme shell within the CogShell. See this page for more details on using the Scheme shell.

  • shutdown

Like it says, shuts down the CogServer. This will also disconnect any running telnet sessions to the CogServer.

  • sql-close

Closes the connection to the MySQL database.

  • sql-load

Loads a previously saved state from the MySQL database into the in-memory AtomTable. This provides an alternative to loading the same (generally static) scheme file of atom definitions every time, and allows the sql-save and sql-load calls to be used to continue work on an AtomTable that has been altered by Mind Agents.

  • sql-open

Opens a connection to the MySQL database so the sql-load and sql-save commands can be used. Details about configuring the login credentials for this will be added here once discovered.

  • sql-store

Dumps the current contents of the in-memory Atom-Table to the underlying SQL database. MySQL has been used up to now, but the current functionality of this interface is unknown.

  • unloadmodule

This command unloads a module, generally a Mind Agent, that has been loaded into the CogServer's process list. By unloading it, the Mind Agent will no longer be given processing cycels to do its work.

Next Steps



Commands are not recognized

I could install and build opencog successfully, but the cogserver does not recognize any commands:

Trying ::1...


Connected to localhost.

Escape character is '^]'.

opencog> help

command "help" not found

What should I do?

I could solve this problem using the local opencog build in opencog/build/opencog/server instead of opencog/server. I used the config from the local build as well in my

cd ./opencog/build/opencog/server/

./cogserver -c ../../lib/opencog.conf