Reference·The organismIndexClose
The organism
What runs when you type nodecode, what it keeps, and what happens when it stops.
An organism is a running Nodecode. There is one per home, and every terminal you open talks to it. Below are five things people do to it, each done two ways.
A second agent
A home has one store, and one process owns it: a nodecode serve that the first shell started. Anything else that wants the store finds it taken.
The store is taken, so it says ready and exits 0. Nothing new is running.
Done with a terminal
With the background gateway off, the organism is a child of the shell that started it, and it lives as long as that shell does. Later shells only attach.
The organism stops with it. The other shell starts a new one within a second, on the same port, and its turn picks up where it stopped. A value set with setf is gone.
The background gateway is on by default for ~/.nodecode/ and a named profile. The organism a shell runs then passes to the gateway when that shell closes, and comes up again at every login. Turn it off in /settings or with nodecode gateway off. Off, the organism runs only while a shell is open. See The gateway.
A launch looks stuck
The owner holds a lock on history.db.lock. The operating system frees it when the owner exits, however it exits.
The first organism still holds its lock, on a file that no longer exists. The next launch starts a second organism on the same store, on a new port. Two processes now write one history.
Remember a value
The organism keeps definitions. A top-level defun or defparameter is written to your layer and loads at every start. Anything else, state included, lives only as long as the process.
Set in this process only. After a restart, boundp says NIL, while a defun from the same hour is still there.
Change a kernel function
The kernel, nodecode.kernel, holds the store, the lock and the loader. The organism locks it at boot. Everything else is unlocked: nodecode.evolved, which holds the turn loop, the terminal core nodecode.term and the importer nodecode.import. The model may redefine any of it.
The lock refuses it, and nothing is written to the layer.
One tool, one log
The organism has one tool, eval. A shell command, a file edit and a new definition are each a Lisp form in an eval call.
Every fact is an event in ~/.nodecode/history.db: a prompt, an answer, a tool call, its result. The transcript in every shell and the model's context are both read from it. History the model no longer sees stays in the log. See Context and recall.
The gateway answers on 127.0.0.1, on the port this store used last. There is no port option. Shells find it in history.db.owner. See Files.