← Back to Plugins
Voice

Hindsight Openclaw Pro

mrkhachaturov By mrkhachaturov 👁 49 views ▲ 0 votes

Production-grade Hindsight memory plugin for OpenClaw β€” per-agent config, multi-bank recall, IaC bank management

GitHub

Install

npm install -g

README

# 🧠 Hindsight OpenClaw Pro

> πŸ”Œ Production-grade [Hindsight](https://vectorize.io/hindsight) memory plugin for [OpenClaw](https://openclaw.ai)
>
> Repository: `hindsight-openclaw-pro`

![Plugin](https://img.shields.io/badge/plugin-memory-0f766e)
![OpenClaw](https://img.shields.io/badge/OpenClaw-compatible-1d4ed8)
![Node](https://img.shields.io/badge/node-%3E%3D22-c2410c)
![License](https://img.shields.io/badge/license-MIT-10b981)
![Based on](https://img.shields.io/badge/based%20on-@vectorize--io/hindsight--openclaw-8b5cf6)

> **Based on [`@vectorize-io/hindsight-openclaw`](https://github.com/vectorize-io/hindsight/tree/main/hindsight-integrations/openclaw)** (MIT, Copyright (c) 2025 Vectorize AI, Inc.)
>
> This project is a production-grade rewrite of the original Hindsight OpenClaw plugin by [Vectorize](https://vectorize.io). The upstream plugin provides the foundation β€” two-hook architecture (`before_prompt_build` for recall, `agent_end` for retain), bank ID derivation, daemon lifecycle management, and memory formatting. We extend it with per-agent bank configuration, multi-bank recall, session start context, reflect-on-recall, IaC bank management via CLI, and full Hindsight API coverage.

Per-agent bank configuration via IaC template files, multi-bank recall, session start context injection, reflect-on-recall, and a Terraform-style CLI (`hoppro`) for managing bank configurations.

| | Feature | Description |
|---|---------|-------------|
| πŸ“‹ | Per-agent config | Each agent gets a bank config template file β€” missions, entity labels, directives, dispositions |
| πŸ—οΈ | Infrastructure as Code | `hoppro plan` / `apply` / `import` β€” Terraform-style bank management |
| πŸ”€ | Multi-bank recall | `recallFrom` lets an agent query multiple banks per turn (Yoda pattern) |
| 🧩 | Session start context | Mental models loaded at session start β€” no cold start problem |
| πŸͺž | Reflect on recall | Disposition-aware reasoning via Hindsight reflect API |
| πŸš€ | Bootstrap | First-run auto-apply of bank config to empty banks |
| 🏒 | Multi-server | Per-agent infrastructure overrides β€” private + shared Hindsight servers |

> [!IMPORTANT]
> This plugin replaces `@vectorize-io/hindsight-openclaw`.
> It is the **single memory provider** for the gateway β€” all agents must have a bank config.

---

## πŸ—ΊοΈ Architecture

```mermaid
graph TD
    GW["🌐 OpenClaw Gateway"] --> PLUGIN["🧠 hindsight-openclaw-pro"]

    PLUGIN --> HOOKS["πŸͺ Hooks"]
    PLUGIN --> SYNC["πŸ”„ Sync Engine"]
    PLUGIN --> CLI["⚑ hoppro CLI"]

    HOOKS --> RECALL["πŸ“₯ before_prompt_build<br/>recall / multi-bank / reflect"]
    HOOKS --> RETAIN["πŸ“€ agent_end<br/>retain with tags + context"]
    HOOKS --> SESSION["🎬 session_start<br/>mental models"]

    SYNC --> PLAN["πŸ“‹ plan β€” diff file vs server"]
    SYNC --> APPLY["βœ… apply β€” push changes"]
    SYNC --> IMPORT["πŸ“₯ import β€” pull server state"]
    SYNC --> BOOTSTRAP["πŸš€ bootstrap β€” first run"]

    RECALL --> HS_HOME["🏠 Hindsight (private)"]
    RECALL --> HS_OFFICE["🏒 Hindsight (shared)"]
    RETAIN --> HS_HOME
    RETAIN --> HS_OFFICE

    style PLUGIN fill:#0f766e,color:#fff,stroke:#0f766e
    style HS_HOME fill:#8b5cf6,color:#fff,stroke:#8b5cf6
    style HS_OFFICE fill:#1d4ed8,color:#fff,stroke:#1d4ed8
```

---

## ⚑ Quick Start

### 1️⃣ Install

From npm registry:

```bash
openclaw plugins install hindsight-openclaw-pro
```

Or install globally via npm:

```bash
npm install -g hindsight-openclaw-pro
```

Or from a local build:

```bash
openclaw plugins install /path/to/hindsight-openclaw-pro
```

### 2️⃣ Configure plugin

Add to `openclaw.json`:

```json5
{
  "plugins": {
    "entries": {
      "hindsight-openclaw-pro": {
        "enabled": true,
        "config": {
          "hindsightApiUrl": "https://hindsight.office.local",
          "hindsightApiToken": "...",
          "dynamicBankGranularity": ["agent"],
          "bootstrap": true,

          "agents": {
            "yoda":  { "bankConfig": "./banks/yoda.json5" },
            "r4p17": { "bankConfig": "./banks/r4p17.json5" },
            "bb8":   { "bankConfig": "./banks/default.json5" }
          }
        }
      }
    }
  }
}
```

### 3️⃣ Create bank config

Create `.openclaw/banks/yoda.json5`:

```json5
{
  // Server-side config
  "retain_mission": "Extract strategic decisions, priorities, risks, opportunities.",
  "reflect_mission": "You are the strategic advisor. Challenge assumptions.",
  "disposition_skepticism": 4,
  "disposition_literalism": 2,
  "disposition_empathy": 3,
  "entity_labels": [...],
  "directives": [
    { "name": "cross_department_honesty", "content": "Flag contradictions explicitly." }
  ],

  // Multi-bank recall
  "recallFrom": ["yoda", "r4p17", "bb9e", "bb8"],
  "recallBudget": "high",
  "recallMaxTokens": 2048,

  // Session start context
  "sessionStartModels": [
    { "type": "mental_model", "bankId": "yoda", "modelId": "strategic-position", "label": "Strategic Position" }
  ]
}
```

### 4️⃣ Apply & start

```bash
hoppro plan --all   # preview changes
hoppro apply --all  # apply to Hindsight server
openclaw gateway    # start with memory
```

---

## πŸ›οΈ Configuration

### πŸ“¦ Two-Level Config System

```text
openclaw.json (plugin config)          banks/r4p17.json5 (bank config template)
β”œβ”€β”€ Daemon (global only)               β”œβ”€β”€ Server-side (agent-only)
β”‚   apiPort, embedPort, embedVersion   β”‚   retain_mission, reflect_mission
β”‚   embedPackagePath, daemonIdleTimeoutβ”‚   dispositions, entity_labels, directives
β”‚                                      β”‚
β”œβ”€β”€ Defaults (overridable per-agent)   β”œβ”€β”€ Infrastructure overrides (optional)
β”‚   hindsightApiUrl, hindsightApiToken β”‚   hindsightApiUrl, hindsightApiToken
β”‚   dynamicBankGranularity, bankIdPfx  β”‚   dynamicBankGranularity, bankIdPrefix
β”‚   llmProvider, llmModel              β”‚
β”‚   autoRecall, autoRetain, ...        β”œβ”€β”€ Behavioral overrides (optional)
β”‚                                      β”‚   recallBudget, retainTags, llmModel, ...
β”œβ”€β”€ Bootstrap: true|false              β”‚
β”‚                                      β”œβ”€β”€ Multi-bank: recallFrom [...]
└── Agent mapping                      β”œβ”€β”€ Session start: sessionStartModels [...]
    agents: { id: { bankConfig } }     └── Reflect: reflectOnRecall, reflectBudget
```

Resolution: `pluginDefaults β†’ bankFile` β€” shallow merge, bank file wins.

### πŸ”Œ Plugin Config Reference

| Option | Default | Per-agent | Description |
|--------|---------|-----------|-------------|
| `hindsightApiUrl` | β€” | βœ… | Hindsight API URL |
| `hindsightApiToken` | β€” | βœ… | Bearer token for API auth |
| `apiPort` | `9077` | ❌ | Port for local daemon (embed mode only) |
| `embedVersion` | `"latest"` | ❌ | `hindsight-embed` version |
| `embedPackagePath` | β€” | ❌ | Local `hindsight-embed` path (development) |
| `daemonIdleTimeout` | `0` | ❌ | Daemon idle timeout (0 = never) |
| `dynamicBankId` | `true` | βœ… | Derive bank ID from context |
| `dynamicBankGranularity` | `["agent","channel","user"]` | βœ… | Fields for bank ID derivation |
| `bankIdPrefix` | β€” | βœ… | Prefix for derived bank IDs |
| `autoRecall` | `true` | βœ… | Inject memories before each turn |
| `autoRetain` | `true` | βœ… | Retain conversations after each turn |
| `recallBudget` | `"mid"` | βœ… | Recall effort: `low`, `mid`, `high` |
| `recallMaxTokens` | `1024` | βœ… | Max tokens injected per turn |
| `recallTypes` | `["world","experience"]` | βœ… | Memory types to recall |
| `retainRoles` | `["user","assistant"]` | βœ… | Roles captured for retention |
| `retainEveryNTurns` | `1` | βœ… | Retain every Nth turn |
| `llmProvider` | auto | βœ… | LLM provider for extraction |
| `llmModel` | provider default | βœ… | Model name |
| `bootstrap` | `false` | ❌ | Auto-apply bank configs on first run |
| `agents` | `{}` | ❌ | Per-agent bank config registration |

### πŸ“‹ Bank Config File Reference

| Field | Type | Scope | Description |
|-------|------|-------|-------------|
| `retain_mission` | string | πŸ”§ Server | Guides fact extraction during retain |
| `observations_mission` | string | πŸ”§ Server | Controls observation consolidation |
| `reflect_mission` | string | πŸ”§ Server | Prompt for reflect operations |
| `retain_extraction_mode` | string | πŸ”§ Server | Extraction strategy (`concise`, `verbose`) |
| `disposition_skepticism` | 1–5 | πŸ”§ Server | How skeptical during extraction |
| `disposition_literalism` | 1–5 | πŸ”§ Server | How literally statements are interpreted |
| `disposition_empathy` | 1–5 | πŸ”§ Server | Weight given to emotional content |
| `entity_labels` | EntityLabel[] | πŸ”§ Server | Custom entity types for classification |
| `directives` | `{name,content}[]` | πŸ”§ Server | Standing instructions for the bank |
| `retainTags` | string[] | 🏷️ Tags | Tags added to all retained facts |
| `retainContext` | string | 🏷️ Tags | Source label for retained facts |
| `retainObservationScopes` | string \| string[][] | 🏷️ Tags | Observation consolidation scoping |
| `recallTags` | string[] | 🏷️ Tags | Filter recall results by tags |
| `recallTagsMatch` | `any\|all\|any_strict\|all_strict` | 🏷️ Tags | Tag filter mode |
| `recallFrom` | string[] | πŸ”€ Multi-bank | Banks to query (parallel recall) |
| `sessionStartModels` | SessionStartModelConfig[] | 🧩 Session | Mental models loaded at session start |
| `reflectOnRecall` | boolean | πŸͺž Reflect | Use reflect instead of recall |
| `reflectBudget` | `low\|mid\|high` | πŸͺž Reflect | Reflect effort level |
| `reflectMaxTokens` | number | πŸͺž Reflect | Max tokens for reflect response |

All plugin-level behavioral options can also be overridden per-agent in the bank config file.

---

## 🌐 Multi-Server Support

Per-agent infrastructure overrides enable connecting different agents to different Hindsight servers:

```text
Gateway
β”œβ”€β”€ 🏠 r4p17 (private)  β†’ hindsightApiUrl: "https://hindsight.home.local"
β”œβ”€β”€ 🏠 l337  (health)   β†’ hindsightApiUrl: "https://hindsight.home.local"
β”œβ”€β”€ 🏒 bb8   (company)  β†’ hindsightApiUrl: "https://hindsight.office.local"
β”œβ”€β”€ 🏒 bb9e  (company)  β†’ hindsightAp

... (truncated)
voice

Comments

Sign in to leave a comment

Loading comments...