# Project: mem0-auto-capture hook ## Aim Provide a standalone hook that keeps OpenClaw agents in sync with Mem0 by capturing meaningful turns, recalling personal and knowledge-base memories, and supporting audio transcripts. ## Scope - Auto-capture incoming messages when triggers fire. - Auto-recall both personal memories and a dedicated knowledge-user scope before each response. - Work with local STT for audio, deduplicate rapid captures, and gracefully degrade when Mem0 is unreachable. - Ship as a repository-enable hook that anyone can install in their OpenClaw gateway. ## Code layout - `hook/handler.ts` — business logic. Reads config from `MEM0_*` env vars or `~/.openclaw/mem0.json`. Handles received/preprocessed/transcribed events and rewrites `context.bodyForAgent` with injected memory blocks when appropriate. - `package.json` & `tsconfig.json` — minimal metadata for building and for the OpenClaw hook loader. ## Configuration Defaults are documented in `README.md`. Keep a sample `~/.openclaw/mem0.json` near the gateway so other developers can copy it. ## Deployment 1. `npm install` (growth step, optional). 2. `openclaw hooks install --link /path/to/hook`. 3. `openclaw gateway restart`. 4. `openclaw hooks list` → hook should be `ready`. ## Testing - Use `openclaw hooks simulate message` or create fixtures and hit `handler`. Ensure STT and Mem0 endpoints are mocked. - Run while connected to the actual Mem0 server at `http://192.168.0.200:8420` to validate capture/recall flows. ## Release checklist - Update `package.json` version. - Document new env var defaults in README. - Tag a Git release (e.g., `v1.0.0`). - If releasing publicly, include a license (MIT/Apache/…?). Maintainer: Lukas Goldschmidt / GOLEM assistant (builds, tests, deploys).