OpenViking OpenClaw Memory Plugin: 43% Better Task Completion with 91% Lower Token Cost
The Memory Problem in OpenClaw
I use OpenClaw daily for coding tasks, but its memory system has frustrated me. Every session starts fresh. OpenClaw forgets my preferences, my project context, and the decisions I made yesterday. When I work on a multi-day feature, I have to re-explain everything each time.
The native OpenClaw memory (memory-core) gave me:
- Session-only memory (gone when I close the terminal)
- No structured categories for different types of context
- Limited retrieval when I need past information
I wanted persistent memory that survives across sessions. OpenViking’s memory plugin promised to fix this.
What OpenViking Memory Plugin Does
OpenViking replaces OpenClaw’s native memory with an external context database. Instead of losing context when the session ends, OpenClaw stores memories in OpenViking and retrieves them when needed.
The plugin handles:
- Memory Storage: Conversations stored in OpenViking’s database
- Memory Extraction: Automatic extraction into 6 categories
- Retrieval: Semantic search over past context
- Ranking: Relevance-based memory ranking
Memory Categories
| Category | Owner | What It Stores |
|---|---|---|
| profile | user | User identity |
| preferences | user | Coding style, preferences |
| entities | user | Projects, files, people |
| events | user | Decisions, milestones |
| cases | agent | Solved problems |
| patterns | agent | Reusable patterns |
Performance Results That Convinced Me
I found the benchmark numbers in the OpenViking README. They tested on LoCoMo10 dataset with 1,540 cases:
| System | Task Completion | Input Tokens |
|---|---|---|
| OpenClaw (memory-core) | 35.65% | 24,611,530 |
| OpenClaw + LanceDB | 44.55% | 51,574,530 |
| OpenClaw + OpenViking (-memory-core) | 52.08% | 4,264,396 |
| OpenClaw + OpenViking (+memory-core) | 51.23% | 2,099,622 |
The numbers were clear:
- 43-49% improvement over original OpenClaw
- 83-96% reduction in input token cost
- 17% improvement over LanceDB baseline
These results made me want to try it myself.
Installation: What I Did
I cloned OpenViking and built the plugin:
# Clone OpenVikinggit clone https://github.com/volcengine/OpenVikingcd OpenViking/examples/openclaw-memory-plugin
# Install dependenciesnpm install
# Buildnpm run build
# Copy to OpenClaw plugins directorycp -r dist/ ~/.openclaw/plugins/openviking-memory/The plugin structure looked like this:
openclaw-memory-plugin/├── index.ts # Main plugin entry├── client.ts # OpenViking HTTP client├── memory-ranking.ts # Memory relevance ranking├── process-manager.ts # Async processing├── text-utils.ts # Text processing├── config.ts # Configuration└── skills/ └── install-openviking-memory/ └── SKILL.md # Installation skillConfiguration: First Attempt Failed
I started the OpenViking server with this config:
{ "storage": { "workspace": "/path/to/workspace" }, "vlm": { "provider": "openai", "model": "gpt-4o", "api_key": "your-key" }, "embedding": { "dense": { "provider": "openai", "model": "text-embedding-3-large" } }}Then I started the server:
openviking-serverNext, I configured the OpenClaw plugin:
{ "openvikingUrl": "http://localhost:1933", "apiKey": "your-openviking-api-key"}Issue: Plugin Not Loading
When I started OpenClaw, the plugin didn’t load. I got nothing - no error, no memory, nothing.
The fix was to verify the plugin directory path. OpenClaw expected the plugin at ~/.openclaw/plugins/openviking-memory/ with the compiled JavaScript files (not TypeScript). After rebuilding and copying the dist/ folder contents, it worked.
Issue: Connection Errors
On my second attempt, OpenClaw couldn’t connect to OpenViking. I got connection refused errors.
I checked:
- Was OpenViking server running? Yes, it showed “Server started on port 1933”
- Was the URL correct? Yes,
http://localhost:1933 - Was the API key correct? I had forgotten to set one up
I fixed the API key issue by using the correct key from OpenViking’s configuration. The connection worked after that.
How The Plugin Works Under The Hood
I looked at the plugin code to understand the flow:
// Add memoryawait client.addMemory({ content: "User prefers functional programming", category: "preferences"});
// Search memoriesconst memories = await client.searchMemories("authentication approach");
// Get relevant contextconst context = await client.getContext("fix the login bug");The flow works like this:
OpenClaw Conversation │ ▼┌─────────────────┐│ Memory ││ Extraction │└────────┬────────┘ │ ▼┌─────────────────┐ ┌─────────────────┐│ OpenViking │────▶│ 6 Categories ││ Storage │ │ (profile, │└────────┬────────┘ │ preferences, │ │ │ entities, │ │ │ events, │ │ │ cases, │ │ │ patterns) │ │ └─────────────────┘ ▼┌─────────────────┐│ Semantic ││ Search & ││ Ranking │└─────────────────┘ │ ▼ Relevant Context Returned to OpenClawWhat Changed in My Workflow
Once installed, OpenClaw automatically uses OpenViking for memory. No extra configuration needed.
Now when I start OpenClaw:
openclawOpenClaw remembers:
- My preferences: “I prefer TypeScript over JavaScript”
- Past solutions: How I fixed similar bugs before
- Learned patterns: Code style conventions I’ve established
- Tracked decisions: Architecture choices I made last week
Real Example: Remembering Project Structure
Before the plugin, every new session I had to explain my project structure. Now OpenClaw recalls from the entities category that I use:
/src/components/for React components/src/hooks/for custom hooks/src/utils/for helper functions
When I ask “add a new hook for debounce”, OpenClaw knows to put it in /src/hooks/useDebounce.ts.
Real Example: Remembering Decisions
I told OpenClaw “use Zod for all validation” in a session two weeks ago. That decision got stored in events. Yesterday when I asked about input validation, OpenClaw retrieved that context and suggested Zod schemas automatically.
Two Plugin Modes Explained
The benchmark shows two configurations:
- OpenClaw + OpenViking (-memory-core): Replaces OpenClaw’s native memory entirely
- OpenClaw + OpenViking (+memory-core): Uses both OpenViking and native memory
I chose the first option (-memory-core) because I wanted a single source of truth. The second option might work better if you have specific native memory features you want to keep.
The performance difference between the two is small (52.08% vs 51.23%), but the token usage differs significantly (4.2M vs 2.1M). The hybrid approach uses fewer tokens because it can fall back to native memory for simple cases.
Other Plugins Available
OpenViking provides similar memory plugins for other AI tools:
- Claude Memory Plugin:
examples/claude-memory-plugin/ - OpenCode Memory Plugin:
examples/opencode-memory-plugin/
The architecture is similar across all plugins. If you use multiple AI tools, you could potentially share the same OpenViking instance.
Troubleshooting Tips
Plugin Not Loading
Check these items:
- Plugin directory path is correct (
~/.openclaw/plugins/openviking-memory/) - Plugin config format is valid JSON
- Build completed successfully (
npm run build)
Connection Errors
- Ensure OpenViking server is running (
openviking-server) - Verify URL matches (default:
http://localhost:1933) - Check API key is correct
Memory Not Persisting
- Check OpenViking workspace permissions
- Verify storage configuration in
ov.conf - Look at OpenViking server logs for errors
Summary
In this post, I showed how I integrated OpenViking’s memory plugin with OpenClaw to achieve persistent memory across sessions. The setup required cloning the repository, building the plugin, and configuring both OpenViking server and OpenClaw plugin. The result was 43-49% improvement in task completion rates and 83-96% reduction in input token costs.
The key insight is that external context databases can significantly improve AI agent performance while reducing costs. OpenClaw’s native memory works for single sessions, but OpenViking provides structured, persistent memory that accumulates value over time.
If you use OpenClaw regularly, the OpenViking memory plugin is worth the setup effort. The performance gains and cost savings compound as your memory database grows.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments