Skip to main content
Add persistent memory to Claude Desktop using OpenViking’s session-based memory extraction. The plugin automatically captures conversation context and makes it available in future sessions.

How It Works

The plugin uses OpenViking’s session memory system:
  1. Session Start: Creates a new OpenViking session when Claude starts
  2. During Conversation: Accumulates user and assistant messages
  3. Stop Hook: Summarizes each conversation turn and appends to session
  4. Session End: Commits the session to extract long-term memories
  5. Memory Recall: Provides a skill to search memories from viking://user/memories and viking://agent/memories

Architecture

Mode Detection

The plugin auto-detects the backend mode:
  • HTTP mode (preferred): Connects to existing OpenViking server
    • Reads server.host and server.port from ./ov.conf
    • Health checks /health endpoint
  • Local mode (fallback): Starts embedded OpenViking if HTTP unreachable

State Persistence

Plugin state is stored in ./.openviking/memory/session_state.json:

Installation

1

Install OpenViking

2

Create Configuration

In your Claude project root, create ov.conf:
3

Copy Plugin Files

4

Start OpenViking Server (Optional)

If using HTTP mode:
The plugin will auto-start if the server isn’t running, but starting it manually is recommended for production.

Plugin Structure

Hook Behavior

SessionStart

Validates ./ov.conf and auto-detects backend mode (HTTP or local).

UserPromptSubmit

Adds a lightweight hint that memory is available:

Stop (Async)

After each turn:
  1. Parses the transcript for the last user and assistant messages
  2. Summarizes the turn (uses claude -p --model haiku if available, otherwise local summary)
  3. Appends both messages to the OpenViking session
  4. Deduplicates by turn UUID

SessionEnd

Commits the session to extract long-term memories:
Extracted memories are stored in:
  • viking://user/memories/ - User facts, preferences
  • viking://agent/memories/ - Task execution patterns, learnings

Memory Recall Skill

The memory-recall skill searches both user and agent memories:
Example usage in Claude:
The skill returns:

Testing

E2E Test Script

Run a complete end-to-end test:
The script:
  1. Creates Python 3.11 virtual environment
  2. Generates temporary ./ov.conf from source config
  3. Starts OpenViking HTTP server
  4. Runs real claude -p session with plugin
  5. Triggers Stop + SessionEnd
  6. Verifies session_state.json and session archive
Custom test:

Configuration Options

Plugin Manifest (.claude-plugin/plugin.json)

Hook Config (hooks/hooks.json)

Async Hooks: The stop hook runs asynchronously to avoid blocking Claude’s response. Other hooks are synchronous to ensure proper state management.

Troubleshooting

Verify the plugin manifest:
Ensure hooks directory exists:
The plugin requires ./ov.conf in the project root. If missing:
Check server status:
If not running:
Check the session was committed:
Manually commit if needed:

Memory Categories

OpenViking automatically categorizes extracted memories:

Limitations

  • Requires ./ov.conf in project root (strict mode)
  • Plugin state is per-project (in ./.openviking/memory/)
  • Does not modify OpenViking core — uses standard API
  • Summarization uses claude -p --model haiku when available; falls back to simple extraction

See Also