> ## Documentation Index
> Fetch the complete documentation index at: https://docs.memorycrystal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenClaw Plugin

> Understand how the OpenClaw plugin captures, recalls, and wires Memory Crystal into the OpenClaw lifecycle.

## Recommended: universal installer

Use the universal installer first. It can configure this target for hosted cloud or local Docker Convex and creates config backups before writing.

### Agent Instructions

Copy and paste this directly into your OpenClaw agent:

```text theme={"system"}
Install Memory Crystal for OpenClaw. Run the official installer command below, follow the auth/backend prompts, and do not manually edit OpenClaw config unless the installer fails and asks for a manual fallback. After installation, verify with `openclaw plugins info crystal-memory` and `openclaw crystal_status`.

curl -fsSL https://memorycrystal.ai/crystal | bash -s -- --targets openclaw
```

<Warning>Native OpenClaw plugin installation is handled by the Bash installer. The PowerShell `openclaw` target writes generic MCP guidance instead.</Warning>

```bash theme={"system"}
curl -fsSL https://memorycrystal.ai/crystal | bash -s -- --targets openclaw
```

For native Windows PowerShell, use:

```powershell theme={"system"}
iwr https://memorycrystal.ai/install.ps1 -OutFile install.ps1
.\install.ps1 -Targets openclaw
```

For local data storage, add `--backend local` in Bash or `-Backend local` in PowerShell. See [Local-First Setup](/configuration/local-first).

The OpenClaw plugin is the automatic version of Memory Crystal.
Instead of waiting for your AI to remember to use tools, the plugin quietly does memory work for you in the background.

## What this means in practice

If you use OpenClaw, this is usually the easiest and most automatic Memory Crystal integration.
It can:

* capture conversations after model output
* recall relevant context before the next model call
* wire tools and memory behavior into the OpenClaw runtime
* preserve peer/client isolation through `agentScopePolicies`, `channel`, and `agentId`
* keep curated knowledge-base lookup separate from broad recall

## Quick install

If you want the fastest public install path, run:

```bash theme={"system"}
curl -fsSL https://memorycrystal.ai/crystal | bash
```

That installer handles the OpenClaw plugin path, asks before modifying config, creates backups, and walks you through Cloud vs Local Docker Convex backend choices.

## How it actually works

Key files:

* `plugin/index.js` — main plugin entry
* `plugin/handler.js` — legacy compatibility entry
* `plugin/capture-hook.js` — capture flow
* `plugin/recall-hook.js` — recall flow
* `plugin/openclaw.plugin.json` — modern plugin manifest
* `plugin/openclaw-hook.json` — legacy hook manifest

Operational scripts:

* `scripts/crystal-enable.sh`
* `scripts/crystal-disable.sh`
* `scripts/crystal-bootstrap.sh`
* `scripts/crystal-doctor.sh`

## Universal installer path

The recommended first install path is the universal installer:

```bash theme={"system"}
curl -fsSL https://memorycrystal.ai/crystal | bash
```

Use it when you want Memory Crystal to detect OpenClaw, ask before changing config, and offer cloud or local-first backend mode. The dedicated commands below remain useful for single-client installs and compatibility.

## Commands / examples

Useful commands:

```bash theme={"system"}
openclaw plugins info crystal-memory
openclaw crystal_status
openclaw crystal_doctor
npm run crystal:bootstrap
npm run crystal:enable
npm run crystal:disable
npm run crystal:doctor
```

`openclaw plugins info crystal-memory` verifies that OpenClaw loaded the plugin and shows its registered capabilities. `openclaw crystal_status` is the quick installed status check with version and backend state. `openclaw crystal_doctor` is the deeper installed health check. The `npm run ...` commands are for source checkouts.

Recall quality checks should exercise:

* `crystal_recall` for blended memory, with the runtime `agentId`/channel in place
* `crystal_query_knowledge_base` for named KBs such as voice guides and canonical references
* `crystal_search_messages` for exact transcript wording
* `crystal_preflight` before config writes, deletes, external messages, or production changes
* admin stale sensory cleanup dry-runs when old OpenClaw `sensory_skip` rows appear in graph/retrieval audits

Safe dry-run checks:

```bash theme={"system"}
npm run crystal:enable -- --dry-run
npm run crystal:disable -- --dry-run
```

## Uninstall

Use the public uninstall script when you want to disconnect Memory Crystal cleanly:

```bash theme={"system"}
curl -fsSL https://memorycrystal.ai/uninstall.sh | bash
```

For rollback details and purge behavior, see the [uninstall guide](/help/uninstall).

## Common mistakes

* editing `~/.openclaw/openclaw.json` directly from a running AI session
* deleting `handler.js` even though older installs may still use it
* assuming the plugin and MCP-only mode are the same thing
* assuming local mode removes hosted account/license checks

## Source of truth

Primary files behind this page:

* `plugin/index.js`
* `plugin/openclaw.plugin.json`
* `plugin/openclaw-hook.json`
* `scripts/crystal-enable.sh`
* `scripts/crystal-doctor.sh`
* `README.md`
