Skip to content

feat(hermes): support an existing Basic Memory HTTP daemon - #1397

Open
scarabone wants to merge 2 commits into
basicmachines-co:mainfrom
scarabone:feat/hermes-http-provider
Open

feat(hermes): support an existing Basic Memory HTTP daemon#1397
scarabone wants to merge 2 commits into
basicmachines-co:mainfrom
scarabone:feat/hermes-http-provider

Conversation

@scarabone

Copy link
Copy Markdown

Summary

  • add an explicit server_url mode to the Hermes provider using the MCP SDK's streamable HTTP transport
  • preserve the existing local stdio and cloud behavior when server_url is absent
  • require an explicit project for URL mode and keep provider prefetch, tools, per-turn capture, session summaries, and slash-command routing
  • resolve the active Hermes home/profile when discovering provider configuration

Why

Hermes users may already have one long-running Basic Memory daemon serving a shared vault. The current local provider mode always starts its own bm mcp child, so it cannot safely attach to that daemon and use provider-managed recall/capture without introducing a second process.

With this change, a provider can use:

{
  "server_url": "http://127.0.0.1:8766/mcp",
  "project": "main"
}

URL mode does not look up/install bm, create or register projects, mutate Basic Memory configuration, or spawn a subprocess.

Reliability and safety

  • validates HTTP(S) URLs and rejects credentials, queries, and fragments
  • requires HTTPS for non-loopback hosts
  • reconnects once after HTTP transport failures
  • retries only read/idempotent operations; ambiguous mutations reconnect for the next call but are never replayed
  • closes the MCP session before the HTTP transport and fails closed on invalid reconfiguration
  • supports both two-item and three-item stream tuples returned by MCP SDK versions in the supported range

Verification

  • 295 passed, 17 skipped
  • targeted Ruff checks pass
  • read-only integration suite against a running streamable HTTP daemon: 3 passed, 2 explicitly gated fixtures skipped
@CLAassistant

CLAassistant commented Aug 31, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Signed-off-by: Brett Grane <24548810+scarabone@users.noreply.github.com>
Signed-off-by: Brett Grane <24548810+scarabone@users.noreply.github.com>
@scarabone
scarabone force-pushed the feat/hermes-http-provider branch from 66f1c9c to 187cf61 Compare August 31, 2026 00:54

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66f1c9cc05

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

"basic-memory: auto-install via uv failed. Run "
"`uv tool install basic-memory --prerelease=allow` manually to debug. "
"Provider will not initialize."
if not self._server_url:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Stop the previous HTTP actor before local setup

When a provider is already initialized with server_url, and configuration is changed to local/cloud mode while bm and uv are unavailable—or the requested local project fails validation—this block returns before the transport-mismatch cleanup below. The provider therefore remains _initialized with the old HTTP actor but the newly loaded mode and project, so subsequent reads and writes silently continue against the old remote daemon and may target the wrong backend. Detach or invalidate the existing actor before performing the new mode's preflight checks.

AGENTS.md reference: AGENTS.md:L132-L133

Useful? React with 👍 / 👎.

Comment on lines +1369 to +1370
if tool_name not in _HTTP_RETRYABLE_TOOLS:
raise original_failure

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reconcile ambiguous transcript creation before the next turn

If HTTP disconnects after the server commits the first automatic write_note, this branch raises without setting _session_note_id; the next captured turn therefore issues another write_note with the same deterministic title. With default conflict handling, the returned NOTE_ALREADY_EXISTS JSON is treated as success and the second turn is never appended; on a daemon configured to overwrite, the second write instead replaces the first turn's canonical content. Preserve an explicit ambiguous-create state and reconcile the existing transcript before accepting the next capture.

AGENTS.md reference: AGENTS.md:L156-L160

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants