Skip to main content

OpenClaw Integration

Kernle integrates with OpenClaw via an OpenClaw Plugin SDK plugin that takes over memory management completely — automatic loading at session start, automatic checkpointing at session end, and interception of native memory file writes.

How It Works

The SI never needs to run kernle load or kernle checkpoint save manually. The plugin handles both automatically. In-session captures (raw, episode, note) remain available as CLI commands.

What Replaces What

Kernle replaces OpenClaw’s native memory system:
When the plugin is active, writes to memory/ and MEMORY.md are blocked. The content is captured as a Kernle raw entry instead. Use kernle raw, kernle episode, or kernle note for memory writes.

Installation

1

Install Kernle

2

Initialize a Stack

3

Install the Plugin

4

Configure (Optional)

The plugin auto-detects the stack ID from your OpenClaw session key. To set it explicitly, add to your OpenClaw config:
5

Verify

Start a new session and ask: “Do you have memory context from Kernle?”The SI should have values, beliefs, goals, and checkpoint in its context.

Stack ID Detection

The plugin automatically detects which stack to load:

Plugin Hooks

before_agent_start — Memory Loading

Runs kernle -s {stackId} load --budget {budget} and returns the output as prependContext so it appears in the agent’s system prompt. Budget defaults to 8000 tokens. Items are loaded by priority: checkpoint > values > beliefs > goals > drives > episodes > notes > relationships. Lower-priority items are excluded if the budget is exhausted. Graceful degradation: if kernle is not installed, the stack doesn’t exist, or the command times out (5s), the session continues without memory.

agent_end — Auto-Checkpoint

Extracts a summary from the conversation (last user message as task, last assistant message for context) and saves a checkpoint automatically. Also saves a raw entry marking session completion.

before_tool_call — Block Native Memory Writes

Intercepts write_file, edit_file, and create_file calls targeting memory/ or MEMORY.md. The content is captured as a Kernle raw entry, and the native write is blocked with guidance to use Kernle commands instead.

tool_result_persist — Transcript Trim

Truncates kernle CLI output longer than 2000 characters in the transcript to conserve compaction space.

During Work

The SI captures memories as they happen using CLI commands:

Configuration Reference

Migrating from the Old Hook

If you were using the previous kernle-load bootstrap hook:
  1. Remove the hook from ~/.openclaw/openclaw.json (hooks.internal.entries.kernle-load)
  2. Remove the memoryFlush config (the plugin handles checkpointing automatically)
  3. Install the plugin (see Installation above)

Migrating from Native Files

If you’re migrating an existing OpenClaw SI from static files to Kernle, use the dedicated OpenClaw migration tool — not kernle import directly. The generic kernle import command is designed for structured data (JSON with provenance chains, or markdown/CSV as raw-only). OpenClaw workspaces have their own file conventions (SOUL.md, USER.md, daily notes) that need specialized parsing.
This handles:
  • SOUL.md — behavioral instructions (filtered, not raw identity)
  • USER.md — user context mapped to relationships
  • IDENTITY.md — core identity mapped to values/beliefs
  • MEMORY.md — curated memory mapped to mixed types
  • memory/*.md — daily session notes mapped to episodes
After migration, remove the native files from the workspace (except AGENTS.md).

Best Practices

Capture Immediately

Use raw for quick captures. Organize later during lulls.

No Mental Notes

If you want to remember something, capture it. “Mental notes” don’t survive compaction.

Record Lessons

Episodes without lessons are incomplete. Always extract what you learned.

Specific Checkpoints

Auto-checkpoints use conversation context, but manual checkpoints are more specific. Save when it matters.

Troubleshooting

Memory not appearing in context

SI still writes to MEMORY.md

The before_tool_call hook may not be fully wired in your OpenClaw version. Check for updates, or manually remove write permissions on memory/ as a workaround.

Checkpoint is stale

Auto-checkpoints are saved at session end. For mid-session saves, the SI can still run kernle checkpoint save manually.