nc://gbrain

v0.1.0Pinned
ThomSharktools/nodecode-gbrain: Puts the top pages of a local GBrain brain in front of the model, every turn or on demand. - a rewrite of aean0x/hermes-gbrain-retrieval-reflex (MIT), credited to aean0x954b7ee· 9 Nov1 commit
test1 filecell.lisp8.4 KBmcp.lisp14.5 KB

nodecode-gbrain

GBrain Retrieval Reflex: the top pages of a GBrain brain, in front of the model before it answers. A Nodecode rewrite of aean0x/hermes-gbrain-retrieval-reflex by aean0x.

A GBrain server holds your own pages — people, projects, notes — behind an HTTP MCP endpoint. This cell is the client half: it asks that endpoint two questions, volunteer_context (which named entities does this conversation mention?) and query (what pages does this subject touch?), merges the two answers, de-duplicates them, ranks them, and puts the top few in front of the model as a short block: title, slug, strength, one-line preview.

The model gets them two ways: as gbrain_recall, a tool it calls when a turn turns on a name or an older decision, and — unless you turn ambient off — pushed into the first request of every turn, so the model reads them without having decided to look. A turn that is only "thanks" pays for no round trip, and a brain that is down, slow or unconfigured costs a turn nothing: the hook stays silent.

Get it

Tell the agent "add the gbrain cell", or run nodecode add nc://gbrain.

Set it up

The cell talks to a GBrain server you run yourself (gbrain serve --http), so the section has one thing to get right — the address and the token:

{
  "gbrain": {
    "url": "http://127.0.0.1:3131/mcp",
    "token_env": "GBRAIN_TOKEN"          // or "token" inline, or "token_file"
  }
}

url already defaults to the local server. The token is whichever of these you fill in: token (an inline secret), token_env (the name of an environment variable holding it, the default name is GBRAIN_TOKEN), or token_file (a file holding just the token — the one gbrain auth mints under its state directory, for instance ~/.gbrain/hermes-mcp.token). The rest of the section has working defaults; /settings shows every member, and config.example.jsonc in this folder lists them.

Use it

Ask the model to recall something — "what do we know about Ada?" — and it calls gbrain_recall. Or ask yourself, from the shell:

/gbrain the migration decision

and from Lisp, through eval:

(gbrain:recall "the migration decision")

That answers one string: the ranking, strongest first, an entity hit above a topical one. The preview is cut short on purpose — a page is a pointer, so the model reads the page itself (a GBrain page read over MCP) before relying on a detail. Every hit names its slug so it can be read.

(help :gbrain) carries the same story to the model while the cell runs.

What it does not do

The rewrite speaks the HTTP MCP endpoint only. The original's optional .gbrain-resolve.sock fast path, its local audit marker and its $HERMES_HOME/.env scraping are gone; the token file setting covers the last one. NOTICE says what that leaves out and why.

Licence

MIT, as the original. See LICENSE.

Add nc://gbrain

  1. 1

    Install Nodecode

    Once per machine.

    $ curl -fsSL https://nodecode.ai/install.sh | sh
  2. 2

    Add the cell

    Pinned at 954b7ee.

    $ nodecode add nc://gbrain

    Or tell the agent add the gbrain cell.