Example Plugins for OpenClaw Hybrid Memory
This directory contains example plugins that demonstrate the plugin API capabilities.
Available Example Plugins
1. Slack Notifications (slack-notifications/)
Sends Slack notifications when important facts are stored.
Features:
- Notifies channel when fact importance > 0.8
- Configurable via environment variable
SLACK_WEBHOOK_URL - Filters by category (preferences, decisions)
Installation:
cp -r examples/slack-notifications ~/.openclaw/memory/plugins/
2. Fact Analytics (fact-analytics/)
Tracks and reports on memory usage patterns.
Features:
- Counts facts by category
- Tracks daily/weekly/monthly growth
- Exports analytics to JSON/CSV
3. Auto-Tagger (auto-tagger/)
Automatically adds tags to facts based on content analysis.
Features:
- Uses keyword extraction
- Suggests relevant tags
- Learns from user corrections
4. Backup Reminder (backup-reminder/)
Reminds users to backup their memory data.
Features:
- Checks backup frequency
- Sends notifications when backup overdue
- Integrates with cron jobs
Creating Your Own Plugin
This document is the plugin development guide; continue below for the basic structure and lifecycle details.
Basic Structure
my-plugin/
├── package.json
├── index.js (or index.ts)
└── README.md
Minimal Plugin Example
import type { MemoryPlugin } from '@openclaw/memory-plugin-api';
export default {
metadata: {
id: 'my-plugin',
name: 'My Plugin',
version: '1.0.0',
description: 'Does something cool',
author: 'Your Name'
},
capabilities: {
canModifyFacts: false,
canInterceptSearch: false
},
hooks: {
afterFactStore: async (fact) => {
console.log('New fact stored:', fact);
}
},
async init(context) {
context.logger.info('Plugin initialized!');
}
} as MemoryPlugin;
Installing Plugins
From npm
hybrid-mem plugin install @openclaw/plugin-slack-notifications --npm
From local directory
hybrid-mem plugin install ./my-plugin --local
List installed plugins
hybrid-mem plugin list
Remove a plugin
hybrid-mem plugin remove my-plugin
Plugin Hooks
Available lifecycle hooks:
beforeFactStore(fact)- Modify fact before storageafterFactStore(fact)- React to fact storagebeforeFactDelete(factId)- Prevent deletion (return false)afterFactDelete(factId)- Cleanup after deletionbeforeSearch(query)- Modify search queryafterSearch(results)- Filter/enhance resultsonMaintenance()- Run during maintenance cyclesonShutdown()- Cleanup on shutdown
Plugin Context
Plugins receive a context object with:
factsDb- Access to facts databasevectorDb- Access to vector database (if enabled)config- Plugin configurationlogger- Logging functionsemit(event, data)- Emit events to other pluginsregisterEndpoint(path, handler)- Add API endpointsregisterCommand(name, handler)- Add CLI commands
Security
Plugins run with full access to the memory system. Only install plugins from trusted sources.
Best practices:
- Review plugin code before installation
- Check plugin reputation/downloads
- Keep plugins updated
- Report security issues to authors
Publishing Your Plugin
- Create npm package
- Prefix with
openclaw-memory-plugin- - Add keywords:
openclaw,memory,plugin - Publish to npm
Example package.json:
{
"name": "openclaw-memory-plugin-my-plugin",
"version": "1.0.0",
"description": "My awesome plugin",
"keywords": ["openclaw", "memory", "plugin"],
"main": "index.js",
"peerDependencies": {
"@openclaw/memory-client": "^1.0.0"
}
}
Plugin Marketplace
Coming soon: Browse and discover plugins at https://openclaw.dev/plugins