# shubhamsaboo/google-memorybank-plugin architecture

> Architecture diagram of the GitHub repository shubhamsaboo/google-memorybank-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubhamsaboo/google-memorybank-plugin
- Repository: https://github.com/shubhamsaboo/google-memorybank-plugin

## Overview

This package provides two integrations with Google Cloud Agent Platform Memory Bank: an OpenClaw plugin and an explicitly invoked Hermes MCP server. OpenClaw can recall memories before turns, capture substantive turns, sync workspace memory files and reasoning-engine configuration, and expose memory tools/CLI commands. Hermes exposes five explicit MCP tools over stdio, without lifecycle auto-recall or auto-capture. Both use the shared memory service; the graph reflects README-documented lifecycle links and sampled source calls, while unsampled implementation details are omitted.

Main entry points: [`memorybank-core.ts`](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts) (Memory operations), [`index.ts`](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts) (Plugin lifecycle and tools), [`hermes-mcp.ts`](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/hermes-mcp.ts) (Stdio MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_openclaw["OpenClaw plugin"]
  node_plugin["Plugin lifecycle and tools<br/>[index.ts]"]
  node_recall["Turn recall<br/>[index.ts]"]
  node_capture["Turn capture<br/>[index.ts]"]
  node_file_sync["Workspace file sync<br/>[index.ts]"]
  node_topic_sync["Reasoning config sync<br/>[index.ts]"]
  node_openclaw_ops["Memory tools and CLI<br/>[index.ts]"]
end

subgraph group_hermes["Hermes MCP"]
  node_mcp_server["Stdio MCP server<br/>[hermes-mcp.ts]"]
end

subgraph group_shared["Shared memory service"]
  node_hermes_config["Environment configuration<br/>[memorybank-core.ts]"]
  node_memory_service["Memory operations<br/>[memorybank-core.ts]"]
  node_scope_guard["Scope validation<br/>[memorybank-core.ts]"]
end

subgraph group_cloud["Google Cloud"]
  node_gcp_api[("Agent Platform Memory Bank")]
end

node_openclaw_runtime(("OpenClaw runtime"))
node_hermes_agent(("Hermes agent"))
node_mcp_client["Hermes MCP client"]

node_openclaw_runtime -->|"runs lifecycle"| node_plugin
node_plugin -->|"triggers before turn"| node_recall
node_plugin -->|"triggers after turn"| node_capture
node_plugin -->|"syncs changed files"| node_file_sync
node_plugin -->|"syncs on startup"| node_topic_sync
node_openclaw_runtime -->|"invokes tools or CLI"| node_openclaw_ops
node_recall -->|"retrieves memories"| node_memory_service
node_capture -->|"generates memories"| node_memory_service
node_file_sync -->|"submits file content"| node_memory_service
node_topic_sync -->|"updates configuration"| node_gcp_api
node_openclaw_ops -->|"performs memory operations"| node_memory_service
node_hermes_agent -->|"invokes explicit tools"| node_mcp_client
node_mcp_client -->|"sends JSON-RPC"| node_mcp_server
node_mcp_server -->|"loads environment settings"| node_hermes_config
node_mcp_server -->|"dispatches tool calls"| node_memory_service
node_memory_service -->|"validates mutations"| node_scope_guard
node_memory_service -->|"reads and writes memories"| node_gcp_api

click node_plugin "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts"
click node_recall "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts"
click node_capture "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts"
click node_file_sync "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts"
click node_topic_sync "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts"
click node_openclaw_ops "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts"
click node_mcp_server "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/hermes-mcp.ts"
click node_hermes_config "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts"
click node_memory_service "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts"
click node_scope_guard "https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_plugin,node_recall,node_capture,node_file_sync,node_topic_sync,node_openclaw_ops,node_mcp_client toneBlue
class node_mcp_server toneAmber
class node_hermes_config,node_memory_service,node_scope_guard toneMint
class node_gcp_api toneRose
class node_openclaw_runtime,node_hermes_agent toneIndigo
```

## Components

### OpenClaw plugin

- [Plugin lifecycle and tools](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts): `index.ts`
- [Turn recall](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts): `index.ts`
- [Turn capture](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts): `index.ts`
- [Workspace file sync](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts): `index.ts`
- [Reasoning config sync](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts): `index.ts`
- [Memory tools and CLI](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/index.ts): `index.ts`

### Hermes MCP

- [Stdio MCP server](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/hermes-mcp.ts): `hermes-mcp.ts`

### Shared memory service

- [Environment configuration](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts): `memorybank-core.ts`
- [Memory operations](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts): `memorybank-core.ts`
- [Scope validation](https://github.com/shubhamsaboo/google-memorybank-plugin/blob/main/memorybank-core.ts): `memorybank-core.ts`

### Google Cloud

- **Agent Platform Memory Bank**

### Other components

- **OpenClaw runtime**
- **Hermes agent**
- **Hermes MCP client**

## Connections

- OpenClaw runtime → Plugin lifecycle and tools: runs lifecycle (evidence: `README.md`)
- Plugin lifecycle and tools → Turn recall: triggers before turn (evidence: `README.md`)
- Plugin lifecycle and tools → Turn capture: triggers after turn (evidence: `README.md`)
- Plugin lifecycle and tools → Workspace file sync: syncs changed files (evidence: `README.md`)
- Plugin lifecycle and tools → Reasoning config sync: syncs on startup (evidence: `README.md`)
- OpenClaw runtime → Memory tools and CLI: invokes tools or CLI (evidence: `README.md`)
- Turn recall → Memory operations: retrieves memories (evidence: `index.ts`)
- Turn capture → Memory operations: generates memories (evidence: `index.ts`)
- Workspace file sync → Memory operations: submits file content (evidence: `README.md`)
- Reasoning config sync → Agent Platform Memory Bank: updates configuration (evidence: `index.ts`)
- Memory tools and CLI → Memory operations: performs memory operations (evidence: `index.ts`)
- Hermes agent → Hermes MCP client: invokes explicit tools (evidence: `README.md`)
- Hermes MCP client → Stdio MCP server: sends JSON-RPC (evidence: `README.md`)
- Stdio MCP server → Environment configuration: loads environment settings (evidence: `hermes-mcp.ts`)
- Stdio MCP server → Memory operations: dispatches tool calls (evidence: `hermes-mcp.ts`)
- Memory operations → Scope validation: validates mutations (evidence: `memorybank-core.ts`)
- Memory operations → Agent Platform Memory Bank: reads and writes memories (evidence: `memorybank-core.ts`)
