Skip to content

Community plugin: gobot-brain — memory, LLM inference, scheduling, watchdog, HITL #1199

@leavesprior

Description

@leavesprior

gobot-brain

I built a plugin package that adds five capabilities missing from GoBot's core: persistent memory, LLM reasoning, proactive scheduling, fleet health monitoring, and human-in-the-loop confirmation flows.

Repo: https://github.com/leavesprior/gobot-brain
License: Apache 2.0
Go module: github.com/leavesprior/gobot-brain

What it does

GoBot gives you great hardware abstraction across 35+ platforms. But when you start building robots that need to remember things across restarts, make decisions with LLMs, run scheduled health checks, or ask a human before doing something risky — you end up building the same plumbing every time. This package provides that plumbing as standard GoBot Adaptors and Drivers.

Architecture

Robot
├── Connection: memory.Adaptor    (namespace key-value store)
└── Devices:
    ├── inference.Driver           (LLM fallback chain)
    ├── scheduler.Driver           (proactive timers + escalation)
    ├── watchdog.Driver            (fleet health monitoring)
    └── hitl.Driver                (human-in-the-loop confirmation)

All components implement the standard GoBot v2 interfaces — gobot.Connection for the memory adaptor, gobot.Device with Eventer + Commander for the four drivers. They plug into gobot.NewRobot() like any other platform.

Components

Memory Adaptor — Namespace key-value store with three pluggable backends (in-memory, file-based JSON, generic HTTP API). Acts as the Connection that all drivers use for state persistence.

Inference Driver — Multi-model LLM fallback chain. Configure multiple providers (Ollama for local models, any OpenAI-compatible API) and it tries each in order. Includes four reasoning framework wrappers (Chain of Thought, Tree of Thought, Adversarial, ReAct).

Scheduler Driver — Periodic task runner with 5-level automatic escalation (Silent → Notify → Urgent → Escalate → Critical). If a task fails N consecutive times, the severity auto-escalates. Supports pause/resume/add/remove at runtime.

Watchdog Driver — Fleet health monitoring. Define checks with intervals and timeouts. Alerts fire only after configurable consecutive failures (debouncing). Auto-publishes recovery events when checks start passing again.

HITL Driver — Human-in-the-loop confirmation. Submit a risky action with a description and callback. The action only executes if explicitly approved. Requests auto-expire after a configurable timeout. Notification delivery is pluggable (webhook, Telegram, whatever you need).

Quick example

mem := memory.NewAdaptor(memory.WithFileStore("./robot-data"))
llm := inference.NewDriver(mem,
    inference.NewOllamaProvider(inference.WithOllamaModel("llama3")),
)

robot := gobot.NewRobot("smart-bot",
    []gobot.Connection{mem},
    []gobot.Device{llm},
    func(r *gobot.Robot) {
        mem.Store("config", "version", "1.0")
        result, _ := llm.Infer("Analyze sensor readings")
        fmt.Println(result)
    },
)
robot.Start()

There's also a NewBrain() convenience constructor that wires all five components together in one call.

Status

  • All 56 unit tests passing
  • go vet clean
  • Each component works independently or together
  • Full test coverage for all backends, fallback chains, escalation logic, debouncing, and expiry flows

Why I'm posting this

Mainly to share it with the community in case it's useful. I'd also be happy to:

  • Add it to the GoBot README/docs as a community plugin if that's welcome
  • Take feedback on the API design
  • Adjust anything to better align with GoBot conventions

Thanks for building GoBot — it's been a solid foundation to build on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions