← Back to Plugins
Voice

Mymemory

me515 By me515 👁 58 views ▲ 0 votes

Auto-recall + auto-capture long-term memory plugin for OpenClaw. 100% local, zero config.

GitHub

Install

openclaw plugins install /path/to/openclaw-mymemory

README

# openclaw-mymemory

Built by [Meshari Almejlad](https://github.com/me515).

A long-term memory plugin for [OpenClaw](https://openclaw.ai) that gives your
AI agent persistent memory across sessions β€” with auto-recall before every
reply and auto-capture after every reply. Works 100% locally with no cloud
dependency and no native build requirements.

```
Every conversation turn:

  before_prompt_build hook
  β”‚
  └── Searches active container
      └── Injects top-K relevant memories as prependSystemContext

  [Agent replies]

  llm_output hook
  └── Extracts durable facts via LLM (or keyword heuristics)
      └── Appends to the active container's JSONL file
```

## Features

| Feature | Description |
|---|---|
| **Auto-Recall** | Queries memory and injects relevant facts before every reply |
| **Auto-Capture** | Extracts and stores durable facts after every reply |
| **100% Local** | Works out of the box with zero external dependencies |
| **Container Routing** | Separate memories into `work`, `personal`, or custom containers |
| **Lexical Search** | Built-in bag-of-words similarity β€” no embeddings API needed |
| **Embeddings (Optional)** | Plug in any OpenAI-compatible API for semantic search |
| **LLM Extraction** | Uses `api.runtime.llm.complete` to extract facts |
| **Heuristic Fallback** | Captures explicit cues ("remember that...") if LLM is unavailable |
| **Manual Tools** | `memory_remember`, `memory_recall`, `memory_forget`, `memory_list_containers` |
| **MIT Licensed** | Fully open source |

## Installation

```bash
openclaw plugins install /path/to/openclaw-mymemory
openclaw plugins enable mymemory
openclaw gateway restart
```

See [USAGE.md](./USAGE.md) for how to use the plugin day-to-day.

Or during local development:

```json5
// openclaw.json
{
  plugins: {
    load: { paths: ["~/plugins/openclaw-mymemory"] },
    entries: {
      mymemory: {
        enabled: true,
        config: {
          defaultContainer: "personal",
          containerRouting: {
            "agent:sales-bot": "work",
            "channel:C0123WORKSLACK": "work",
          },
          autoRecall: { enabled: true, topK: 6 },
          autoCapture: { enabled: true, useLLMExtraction: true },
          embeddings: { provider: "none" }, // or "openai-compatible"
        },
      },
    },
  },
}
```

## Comparison

| Feature | Supermemory / Mem0 | **openclaw-mymemory** |
|---|---|---|
| Auto-Recall | βœ… (cloud) | βœ… (local) |
| Auto-Capture | βœ… (cloud) | βœ… (local) |
| Custom Containers | βœ… | βœ… |
| Zero external deps | ❌ | βœ… |
| Works offline | ❌ | βœ… |
| No API key needed | ❌ | βœ… |
| Open source | ❌ | βœ… |
| Lexical search (free) | ❌ | βœ… |
| Semantic search (optional) | βœ… | βœ… (OpenAI-compatible) |

## Current Limitations

- **Search quality without embeddings**: Uses bag-of-words lexical similarity, not true semantic vector search. Enable `embeddings.provider: "openai-compatible"` if you need higher accuracy.
- **Hook field names**: `before_prompt_build` and `llm_output` field names (e.g. `payload.prompt`, `payload.output`) are based on OpenClaw hook documentation. Run `openclaw plugins inspect mymemory --runtime --json` and check logs to verify correct names on your setup; adjust `index.js` if needed.
- **No periodic dreaming**: Unlike OpenClaw's built-in `memory-core`, this plugin does not merge or deduplicate old memories automatically. A future cron job could add this.

## Project Structure

```
openclaw-mymemory/
β”œβ”€β”€ package.json
β”œβ”€β”€ openclaw.plugin.json
β”œβ”€β”€ index.js              # Plugin entry β€” registers hooks + tools
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ store.js         # JSONL storage + lexical search engine
β”‚   β”œβ”€β”€ embed.js         # Optional OpenAI-compatible embeddings
β”‚   β”œβ”€β”€ container.js     # Container routing logic
β”‚   └── extract.js       # LLM fact extraction + heuristic fallback
└── skills/mymemory/SKILL.md  # Skill file explaining tools to the agent
```

## Author

[Meshari Almejlad](https://github.com/me515) β€” `[email protected]`

## Contributing

Issues and pull requests welcome on
[github.com/me515/openclaw-mymemory](https://github.com/me515/openclaw-mymemory).

Ideas for follow-up work: periodic memory merging/dedup, real vector index
option, per-message container override.

## License

MIT β€” see [LICENSE](./LICENSE).
voice

Comments

Sign in to leave a comment

Loading comments...