fleet-memory/hindsight-integrations/openclaw
Nicolò Boschi e4dd654ec5
fix: openclaw tests + split doc-examples CI per language (#503)
* fix: update openclaw tests to use before_prompt_build hook and split doc-examples CI per language

- Update hooks.integration.test.ts: rename describe block and all
  triggerHook calls from 'before_agent_start' to 'before_prompt_build'
  to match the hook registered in index.ts (changed in PR #480)
- Fix 'includes the user message' test: prependContext contains memories
  (bullet list), not the raw user query; update assertion accordingly
- Split test-doc-examples CI job into a matrix over [python, node, cli, go]
  so each language runs in parallel; language-specific setup steps
  (Rust/CLI build, Node.js, Python client, TypeScript client) are
  conditional on matrix.language to avoid unnecessary work

* fix: spy on HindsightClient prototype to intercept all per-bank client instances

getClientForContext creates new HindsightClient instances per bank when
dynamicBankId is true, so vi.spyOn(c, 'recall') on the default client
never captured calls. Spy on HindsightClient.prototype instead so all
dynamically created bank clients are intercepted.
2026-03-06 09:01:56 +01:00
..
src feat(openclaw): v2 recall/retention controls, scalability fixes, and Gemini safety settings (#480) 2026-03-05 16:55:16 +01:00
tests fix: openclaw tests + split doc-examples CI per language (#503) 2026-03-06 09:01:56 +01:00
.gitignore fix: rename openclawd to openclaw (#252) 2026-01-30 13:04:42 +01:00
install.sh fix: openclaw improve config setup (#258) 2026-01-30 17:36:49 +01:00
openclaw.plugin.json feat(openclaw): v2 recall/retention controls, scalability fixes, and Gemini safety settings (#480) 2026-03-05 16:55:16 +01:00
package-lock.json fix: resolve all Dependabot security vulnerabilities (#486) 2026-03-04 13:14:50 +01:00
package.json Release v0.4.16 2026-03-05 17:54:59 +01:00
README.md feat(openclaw): v2 recall/retention controls, scalability fixes, and Gemini safety settings (#480) 2026-03-05 16:55:16 +01:00
tsconfig.json fix: rename openclawd to openclaw (#252) 2026-01-30 13:04:42 +01:00
vitest.config.ts fix: rename openclawd to openclaw (#252) 2026-01-30 13:04:42 +01:00
vitest.integration.config.ts fix: improve openclaw test coverage (#396) 2026-02-18 14:10:33 +01:00

Hindsight Memory Plugin for OpenClaw

Biomimetic long-term memory for OpenClaw using Hindsight. Automatically captures conversations and intelligently recalls relevant context.

Quick Start

# 1. Configure your LLM provider for memory extraction
# Option A: OpenAI
export OPENAI_API_KEY="sk-your-key"

# Option B: Claude Code (no API key needed)
export HINDSIGHT_API_LLM_PROVIDER=claude-code

# Option C: OpenAI Codex (no API key needed)
export HINDSIGHT_API_LLM_PROVIDER=openai-codex

# 2. Install and enable the plugin
openclaw plugins install @vectorize-io/hindsight-openclaw

# 3. Start OpenClaw
openclaw gateway

That's it! The plugin will automatically start capturing and recalling memories.

Features

  • Auto-capture and auto-recall of memories each turn
  • Memory isolation — configurable per agent, channel, user, or provider via dynamicBankGranularity
  • Retention controls — choose which message roles to retain and toggle auto-retain on/off

Configuration

Optional settings in ~/.openclaw/openclaw.json under plugins.entries.hindsight-openclaw.config:

Option Default Description
apiPort 9077 Port for the local Hindsight daemon
daemonIdleTimeout 0 Seconds before daemon shuts down from inactivity (0 = never)
embedPort 0 Port for hindsight-embed server (0 = auto-assign)
embedVersion "latest" hindsight-embed version
embedPackagePath Local path to hindsight-embed package for development
bankMission Agent identity/purpose stored on the memory bank. Helps the engine understand context for better fact extraction. Set once per bank — not a recall prompt.
llmProvider auto-detect LLM provider override for memory extraction (openai, anthropic, gemini, groq, ollama, openai-codex, claude-code)
llmModel provider default LLM model override used with llmProvider
llmApiKeyEnv provider standard env var Custom env var name for the provider API key
dynamicBankId true Enable per-context memory banks
bankIdPrefix Prefix for bank IDs (e.g. "prod")
dynamicBankGranularity ["agent", "channel", "user"] Fields used to derive bank ID. Options: agent, channel, user, provider
excludeProviders [] Message providers to skip for recall/retain (e.g. slack, telegram, discord)
autoRecall true Auto-inject memories before each turn. Set to false when the agent has its own recall tool.
autoRetain true Auto-retain conversations after each turn
retainRoles ["user", "assistant"] Which message roles to retain. Options: user, assistant, system, tool
retainEveryNTurns 1 Retain every Nth turn. 1 = every turn (default). Values > 1 enable chunked retention with a sliding window.
retainOverlapTurns 0 Extra prior turns included when chunked retention fires. Window = retainEveryNTurns + retainOverlapTurns. Only applies when retainEveryNTurns > 1.
recallBudget "mid" Recall effort: low, mid, or high. Higher budgets use more retrieval strategies.
recallMaxTokens 1024 Max tokens for recall response. Controls how much memory context is injected per turn.
recallTypes ["world", "experience"] Memory types to recall. Options: world, experience, observation. Excludes verbose observation entries by default.
recallRoles ["user", "assistant"] Roles included when building prior context for recall query composition. Options: user, assistant, system, tool.
recallTopK Max number of memories to inject per turn. Applied after API response as a hard cap.
recallContextTurns 1 Number of user turns to include when composing recall query context. 1 keeps latest-message-only behavior.
recallMaxQueryChars 800 Maximum character length for the composed recall query before calling recall.
recallPromptPreamble built-in string Prompt text placed above recalled memories in the injected <hindsight_memories> block.
hindsightApiUrl External Hindsight API URL (skips local daemon)
hindsightApiToken Auth token for external API

Documentation

For full documentation, configuration options, troubleshooting, and development guide, see:

OpenClaw Integration Documentation

Development

To test local changes to the Hindsight package before publishing:

  1. Add embedPackagePath to your plugin config in ~/.openclaw/openclaw.json:
{
  "plugins": {
    "entries": {
      "hindsight-openclaw": {
        "enabled": true,
        "config": {
          "embedPackagePath": "/path/to/hindsight-wt3/hindsight-embed"
        }
      }
    }
  }
}
  1. The plugin will use uv run --directory <path> hindsight-embed instead of uvx hindsight-embed@latest

  2. To use a specific profile for testing:

# Check daemon status
uvx hindsight-embed@latest -p openclaw daemon status

# View logs
tail -f ~/.hindsight/profiles/openclaw.log

# List profiles
uvx hindsight-embed@latest profile list

License

MIT