All plugins

gbrain-retrieval-reflex

pre_llm_call hook plugin, enabled with hermes plugins enable: injects ambient context from a GBrain instance before each turn (volunteer_context, then a hybrid-query fallback). Not a memory.provider. Silent no-op when GBrain is unreachable or no token is set. Disclosure — before each non-trivial turn the last six user and assistant messages (truncated) and the current message are sent with a GBRAIN_TOKEN bearer token to GBRAIN_MCP_URL (default http://127.0.0.1:3131/mcp), and returned brain-page text is injected into the turn.

aean0xMemoryv0.6.1Updated 1 month ago

About

pre_llm_call hook plugin, enabled with hermes plugins enable: injects ambient context from a GBrain instance before each turn (volunteer_context, then a hybrid-query fallback). Not a memory.provider. Silent no-op when GBrain is unreachable or no token is set. Disclosure — before each non-trivial turn the last six user and assistant messages (truncated) and the current message are sent with a GBRAIN_TOKEN bearer token to GBRAIN_MCP_URL (default http://127.0.0.1:3131/mcp), and returned brain-page text is injected into the turn.

gbrain-retrieval-reflex — ambient brain context on every turn

A Hermes Agent plugin that puts the top ranked pages from a GBrain brain in
front of the model before it answers, without the agent deciding to look them
up.

On pre_llm_call it:

  1. Rebuilds a short multi-turn window of the recent conversation (prior
    injected blocks are stripped out, so the plugin never feeds itself).
  2. Calls GBrain's volunteer_context tool over HTTP MCP — this resolves named
    entities, so a turn that mentions a person or project surfaces that page.
  3. Also runs a hybrid topical query, so a turn with no nameable entity still
    gets its subject matter.
  4. Merges, de-duplicates and ranks: entity hits first (precision), then query
    hits by score, capped at GBRAIN_RETRIEVAL_REFLEX_MAX_POINTERS.
  5. Injects ## Brain pages (ambient push) with short previews into the turn's
    context. A text byte cap bounds the injected payload.

If GBrain is down, slow, or has no bearer token, the hook returns None
silently. It never blocks a turn and never raises into the agent loop.

Requirements

  • A GBrain instance reachable over HTTP MCP, with a bearer token.
    There is no bundled brain: this is the client half.
  • Optional: a .gbrain-resolve.sock for the resolve IPC fallback. Both serve
    transports bind it as of GBrain 0.48.2.0 (upstream #4474), so a live sock is
    normal under gbrain serve --http. The HTTP MCP calls stay the primary
    path; IPC is only tried for a turn they returned no pages for.

Install

hermes plugins install <owner>/hermes-gbrain-retrieval-reflex
hermes plugins enable gbrain-retrieval-reflex

Manual install: copy this directory into
~/.hermes/plugins/gbrain-retrieval-reflex and add it to plugins.enabled.

Configuration

Nothing is user-specific in the code: state, tokens and endpoints all come
from the environment.

VariableDefaultMeaning
GBRAIN_MCP_URLhttp://127.0.0.1:3131/mcpHTTP MCP endpoint of the brain.
GBRAIN_TOKEN–Bearer token. Usually injected by Hermes from $HERMES_HOME/.env.
GBRAIN_HOME–GBrain state directory itself (the one holding hermes-mcp.token / brain.pglite). When unset, $HOME/.gbrain and $HERMES_HOME/.gbrain are tried, in that order.
GBRAIN_RESOLVE_SOCKET–Explicit resolve IPC socket path; otherwise derived from the state directories.
GBRAIN_RESOLVE_IPC_TIMEOUT_S0.25Budget for the optional IPC fast path.
GBRAIN_VOLUNTEER_HTTP_TIMEOUT_S8.0Per-call HTTP timeout.
GBRAIN_RETRIEVAL_REFLEX_MAX_POINTERS5Maximum pages injected per turn.
GBRAIN_RETRIEVAL_REFLEX_MIN_CONF0.6Minimum strength for an entity hit to be kept.
GBRAIN_RETRIEVAL_REFLEX_HISTORY_TURNS6Turns of context sent to volunteer_context.
GBRAIN_RETRIEVAL_REFLEX_SYNOPSIS_MAX400Characters of page preview per pointer.
GBRAIN_RETRIEVAL_REFLEX_MAX_CONTEXT_BYTES3200Byte cap for the whole injected block.
GBRAIN_RETRIEVAL_AUDIT–Write one JSON line per retrieval here (diagnostics only).

Design notes

  • Never shells out. No gbrain CLI process, no second writer, no direct
    PGLite access — the plugin is an MCP client and nothing else.
  • Trivial turns are skipped (ok, thanks, …) so a one-word reply does
    not pay for a retrieval round-trip.
  • Soft failure everywhere: connect errors, timeouts, malformed SSE, and
    missing credentials all degrade to "no context injected" — logged at debug
    or info level, never surfaced as an error to the model.
  • Bounded cost: one volunteer call plus one query call per non-trivial
    turn, both with explicit timeouts.

Tests

python -m pytest tests/ -q

Stock CPython — no GBrain, no network, no sockets. The suite covers state-path
resolution (GBRAIN_HOME precedence, de-duplication), the no-baked-in-paths
invariant, message normalization, injected-block stripping, window building,
merge/rank/dedupe and capping, the trivial-message gate, and fail-soft
behaviour when the endpoint errors or the token is absent.

License

MIT — see LICENSE.

README from the reviewed commit 78516ca; it updates when the author re-pins.

More by aean0x

4 plugins by aean0x in the catalog.

aean0xsecret-handoffEphemeral credential paste: request_secret asks through clarify and injects the reply over CDP, never storing it. Disclosure — the reply is typed into the focused field of the page whose origin matches the requested service, over the endpoint from BROWSER_CDP_URL or SECRET_HANDOFF_CDP_URL; the answer is visible in the CLI scrollback or the chat history of the surface that asked, and the value is never written to disk, the tool result, or the session transcript.Communitytools1aean0xgit-hookAuto fetch/pull before reads, and commit + push only the files each turn changed, for every git worktree Hermes touches. Disclosure — after each turn it commits and pushes (push on by default; GIT_HOOK_PUSH=0 keeps commits local) the changed files of git worktrees under GIT_HOOK_ROOTS (default PROJECTS_ROOT, "*" for every repo), pushing to origin HEAD when no upstream is set; it pulls --ff-only before reads. A branch whose direct push the remote refuses on policy grounds (branch protection, a PR-required ruleset) is never committed to again: the hook drops its own unpushed commit, leaves the edit staged and dirty, and reports it once.Communityautomationaean0xmodel-pickerPer-turn cost classifier across three model tiers (Quick / Standard / Expert): rates each user turn from configurable best_for lists and rewrites the outgoing request's model through the llm_request middleware, biased to keep the previous tier unless the turn changes shape, with escalate_model for tool failures. Disclosure — the plugin rewrites the model field of every outgoing request for a classified session, picking between three configured model ids that must all belong to the session's own provider (a foreign-provider tier is refused and the session model stands); it makes one bounded auxiliary classifier call through the host's plugin LLM route on each classified turn (up to about 12,000 characters of recent conversation plus the prompt), reading its model ids from config.json next to the plugin, MODEL_PICKER_CONFIG, or MODEL_PICKER_* env, and falls back to the host's primary model; routing decisions, with the first 120 characters of each classified prompt, are logged to $HERMES_HOME/logs/model-picker.log; a classifier-driven tier change can ask the context engine to compact the transcript before the switch, and escalate_model replaces the next request's context with a model-written handoff summary plus the recent tail; that engine registers only when the host config sets context.engine: model-picker.Communitymodels

Developer Mode

Explore built-in Hermes toolsets and actions.

HermesAgent

Developer?

Create a Hermes extension for Desktop or agent workflows.

Developer Section