Use Pensyve as a persistent memory plugin for OpenClaw/OpenHands agents. The adapter exposes three tools — remember, recall, forget — compatible with any tool-calling agent framework.

Install

pip install pensyve

Copy the adapter into your project from the Pensyve repo:

cp integrations/openclaw/pensyve_openclaw.py your_project/

Or grab just the module:

curl -O https://raw.githubusercontent.com/major7apps/pensyve/main/integrations/openclaw/pensyve_openclaw.py

Initialize

from pensyve_openclaw import PensyvePlugin

plugin = PensyvePlugin(namespace="my-project")
ParameterDefaultDescription
namespace"default"Isolates memories per project/agent
path~/.pensyve/Storage directory
entity_name"openclaw-agent"Name for the default agent entity

Get Tools

tools = plugin.tools  # list of 3 tool dicts

Each tool dict has name, description, parameters, and function keys — ready to pass directly to an OpenClaw/OpenHands agent or any framework that accepts tool definitions.

Tool Reference

pensyve_remember

Store a fact in persistent memory.

ParameterTypeRequiredDescription
factstringYesThe information to store
confidencenumberNoConfidence in [0, 1]. Default: 0.8

pensyve_recall

Search memory for relevant information. Returns memories ranked by relevance.

ParameterTypeRequiredDescription
querystringYesSearch query
limitintegerNoMax results. Default: 5

pensyve_forget

Clear all stored memories for the current agent entity.

ParameterTypeRequiredDescription
hard_deletebooleanNoPermanently delete instead of archiving. Default: false

Direct Usage

You can call the underlying methods directly without going through the tool interface:

from pensyve_openclaw import PensyvePlugin

plugin = PensyvePlugin(namespace="my-project")

# Store a fact
result = plugin._remember("User prefers dark mode", confidence=0.9)
print(result)  # {"status": "ok", "memory_id": "...", "content": "..."}

# Search memories
result = plugin._recall("dark mode", limit=3)
for m in result["memories"]:
    print(f"[{m['memory_type']}] {m['content']} (score={m['score']:.2f})")

# Clear memories (soft delete)
plugin._forget(hard_delete=False)

With OpenClaw Agent

Pass the tools when creating your agent:

from pensyve_openclaw import PensyvePlugin

plugin = PensyvePlugin(namespace="my-project")

# Register tools with your agent
agent = Agent(tools=plugin.tools)

The agent can now call pensyve_remember, pensyve_recall, and pensyve_forget during execution. Memories persist across sessions in the local SQLite database.

Works With Any Tool-Calling Framework

The plugin pattern is framework-agnostic. Each tool is a dict with a standard schema (name, description, parameters, function). Pensyve also ships adapters for LangChain, CrewAI, and AutoGen under integrations/.