Skip to main content
Loom includes a first-party OpenClaw plugin (loom-openclaw-plugin/) that integrates Loom as a Context Engine, providing structured long-term memory for OpenClaw.

Quick Start

# 1. Start the Loom backend
cd Loom
pip install -e .
export API_KEY="your-api-key"
export MODEL="google/gemini-2.5-flash"
export BASE_URL="https://openrouter.ai/api/v1"
loom serve

# 2. Install and enable the plugin
openclaw plugins install --link /path/to/Loom/loom-openclaw-plugin

# 3. Start OpenClaw
openclaw gateway
The plugin automatically extracts and recalls structured memories each turn.

Features

  • Auto-extract and auto-recall — extracts information into structured schemas and injects it into the system prompt each turn
  • Schema-based memory — organizes knowledge into typed domains and fields
  • Multi-schema management — create, switch, backup, and restore independent schema files
  • Template system — bootstrap schemas from built-in, shared, or custom templates; full template CRUD via slash commands
  • Agent tools — 5 registered tools for LLM-driven memory management
  • Slash commands — full /loom command suite for manual memory management

Configuration

Configure via environment variables or openclaw.json:
OptionEnv VariableDefaultDescription
loomBaseUrlLOOM_BASE_URLhttp://localhost:8000Loom backend URL
sessionIdLOOM_SESSION_IDdefaultLoom session ID
schemaIdLOOM_SCHEMA_IDdefaultShared schema file ID
schemaTemplateLOOM_SCHEMA_TEMPLATEInitial template
buildEveryNTurnsLOOM_BUILD_EVERY_N_TURNS1Extraction frequency (same as Loom build_every_n_turns)
Example openclaw.json:
{
  "plugins": {
    "entries": {
      "loom-claw": {
        "enabled": true,
        "config": {
          "loomBaseUrl": "http://localhost:8000",
          "sessionId": "default",
          "schemaId": "default",
          "schemaTemplate": "general",
          "buildEveryNTurns": 1
        }
      }
    }
  }
}

Slash Commands

View & Recall
CommandDescription
/loom or /loom statusShow connection status and schema overview
/loom inspectView schema structure with field values
/loom recallRecall all stored memory data
Memory Management
CommandDescription
/loom forget <domain>Delete a specific schema domain
/loom forget --allClear all memory
/loom resetBackup current schema and start fresh
Schema Files
CommandDescription
/loom schemasList all schema files and backups
/loom new [name]Create a new blank schema and switch to it
/loom switch <schema_id>Switch to an existing schema
/loom restore <backup_id>Restore a schema from backup
Template Management
CommandDescription
/loom templatesList all available templates (grouped by source)
/loom templates show <name>Preview template domains and fields
/loom templates use <name>Create a schema from template and switch to it
/loom templates createShow format help for creating custom templates
/loom templates create <definition>Create a custom template (compact text or --json)
/loom templates delete <name>Delete a custom template
/loom templates helpShow template command help
Configuration
CommandDescription
/loom configView current runtime configuration
/loom config buildEveryNTurns <N>Update extraction frequency
/loom helpShow help

Creating Custom Templates via Slash Command

Create templates directly from the chat using the compact text format:
/loom templates create game_character 游戏角色记忆模板
  character: name | 角色名称, class | 职业, level | 等级, skills | 技能列表
  story: main_quest | 当前主线任务, side_quests | 支线任务
  social: friends | 好友列表, guild | 公会, reputation | 声望
Format:
  • First line: template_name description (name allows letters, numbers, _, -)
  • Following lines: domain_name: field1 | description, field2 | description
Or use JSON format: /loom templates create --json {"_meta":{"name":"..."},...}

Agent Tools

Five tools are registered for the OpenClaw agent:
ToolDescription
loom_inspectInspect schema structure and field values
loom_recallRecall all schema memory data
loom_buildManually trigger information extraction
loom_forgetDelete a domain or clear all memory
loom_updateTrigger schema update from chat history

Context Engine Lifecycle

OpenClaw HookPlugin BehaviorLoom API
bootstrapVerify backend, create session, load templatePOST /api/sessions, GET /api/schemas/recall-all
assembleFetch schema data, inject into system promptGET /api/schemas/recall-all
afterTurnFormat messages, extract infoPOST /api/build
compactDelegate to runtime

Data Flow

User message → OpenClaw agent

           [assemble] → GET /api/schemas/recall-all
                 ↓        → schema data injected into system prompt
           Model generates response

           [afterTurn] → POST /api/build
                           → CM Agent extracts information
                           → Updates schema
                           → Available on next assemble

Data Storage

Loom stores data under the OpenClaw Agent Workspace:
~/.openclaw/workspace/loom/
├── schemas/              # Schema files (shared across sessions)
│   ├── default.json
│   └── backups/
│       └── default_20260314_180736.json
└── sessions/
    └── default.json
Configure paths in configs/loom.yaml:
persistence:
  session_dir: "~/.openclaw/workspace/loom/sessions"
  schemas_dir: "~/.openclaw/workspace/loom/schemas"