← 返回 Skills 市场
ClawMem
作者
ClawMem.com
· GitHub ↗
· v0.1.0
· MIT-0
306
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install claw-mem
功能描述
Lightweight memory management system for OpenClaw with 3-tier retrieval (L0/L1/L2), automatic lifecycle monitoring, and advanced search. Saves 60-80% on toke...
使用说明 (SKILL.md)
ClawMem Skill - OpenClaw Memory Management
Overview
ClawMem is a lightweight memory management system designed for OpenClaw agents. It provides efficient memory storage and retrieval with significant token cost optimization.
Features
- 🎯 3-Tier Retrieval - L0 Index → L1 Timeline → L2 Details
- 👁️ Automatic Lifecycle Monitoring - Intercepts 5 key OpenClaw events
- 💰 Token Optimization - Save 60-80% on token costs
- 🔍 Advanced Search - Keyword/Time/Tag/Session search
- 🗄️ SQLite Storage - High performance, easy deployment
Quick Start
1. Install Dependencies
cd /root/.openclaw/workspace/projects/clawmem
npm install
2. Configure Environment
cp .env.example .env
# Edit .env with your configuration
3. Initialize Database
npm run db:init
4. Use in OpenClaw
import clawMem from './projects/clawmem/src/index.js';
// Store memory
const recordId = clawMem.storeL0({
category: 'session',
summary: 'User queried TSLA stock',
timestamp: Math.floor(Date.now() / 1000)
});
// Retrieve memory
const result = await clawMem.retrieve({
category: 'session',
includeTimeline: true,
limit: 10
});
Usage Examples
Store Memory
// L0 Index (minimal)
clawMem.storeL0({
category: 'session',
summary: 'Short summary (\x3C 100 chars)',
timestamp: Date.now()
});
// L1 Timeline (semantic)
clawMem.storeL1({
record_id: recordId,
session_id: 'session_001',
event_type: 'query',
semantic_summary: 'Detailed summary (\x3C 500 chars)',
tags: ['tag1', 'tag2']
});
// L2 Details (full content, on-demand)
clawMem.storeL2({
record_id: recordId,
full_content: 'Full content',
metadata: { key: 'value' }
});
Search Memory
import { memorySearch } from './projects/clawmem/src/index.js';
// Keyword search
const results = memorySearch.searchByKeyword('keyword', {
category: 'session',
limit: 10
});
// Time range search
const results = memorySearch.searchByTimeRange({
start: oneHourAgo,
end: Date.now() / 1000
});
// Session search
const session = memorySearch.searchBySession('session_001', {
includeDetails: true
});
// Advanced search
const result = await memorySearch.advancedSearch({
keyword: 'stock',
timeRange: { start, end },
includeDetails: true,
limit: 10
});
Lifecycle Monitoring
import { lifecycleMonitor } from './projects/clawmem/src/index.js';
// Start monitoring
lifecycleMonitor.start();
// Intercept events
lifecycleMonitor.intercept('tool.call', {
tool_name: 'yahoo_finance',
args: { symbol: 'AAPL' }
});
Configuration
Edit .env file:
# Database
DATABASE_PATH=./clawmem.db
DATABASE_WAL_MODE=true
# L0/L1/L2 Limits
L0_MAX_SUMMARY_LENGTH=100
L1_MAX_SUMMARY_LENGTH=500
# Worker Interval
WORKER_INTERVAL_MS=1000
# LLM Configuration
LLM_PROVIDER=openai
LLM_MODEL=gpt-3.5-turbo
API Reference
ClawMemCore
storeL0(record)- Store minimal indexstoreL1(record)- Store timeline indexstoreL2(record)- Store full detailsretrieve(query)- 3-tier retrieval workflow
MemorySearch
searchByKeyword(keyword, options)- Keyword searchsearchByTimeRange(timeRange, options)- Time-based searchsearchByTags(tags, options)- Tag-based searchsearchBySession(sessionId, options)- Session searchadvancedSearch(query)- Combined searchgetStats()- Get statistics
LifecycleMonitor
start()- Start monitoringintercept(eventName, payload)- Intercept event
Performance
| Metric | Value |
|---|---|
| L0 Search | \x3C 10ms |
| L1 Search | \x3C 50ms |
| L2 Search | \x3C 100ms |
| Token Savings | 60-80% |
Token Optimization
Traditional: 100 records × 500 tokens = 50,000 tokens
ClawMem:
- L0: 100 × 25 = 2,500 tokens
- L1: 50 × 125 = 6,250 tokens
- L2: 10 × 500 = 5,000 tokens
- Total: 13,750 tokens (72.5% savings!)
Project Structure
clawmem/
├── src/
│ ├── core/
│ │ ├── retrieval.js
│ │ ├── lifecycle-monitor.js
│ │ └── search.js
│ └── index.js
├── database/
│ └── init.js
├── config/
│ └── loader.js
├── docs/
├── .env.example
├── package.json
└── README.md
License
MIT License
Author
PocketAI for Leo - OpenClaw Community
Repository
安全使用建议
This package appears to implement the memory manager it claims, but there are important mismatches and privacy implications to consider: 1) Metadata says 'no env vars' and 'instruction-only' but the repo is a runnable Node project (package.json) that expects a .env and creates a SQLite DB and logs — don't assume no configuration is needed. 2) The lifecycle monitor will intercept OpenClaw events (tool calls, memory reads/writes) and persist event payloads (including tool args) to disk; review whether that data could contain secrets you don't want stored. 3) The SKILL.md contains prompt-injection indicators (unicode control chars) — inspect and sanitize documentation and code for hidden characters. 4) If you plan to use an LLM provider (openai) via this code, ensure you only provide API credentials when you understand what calls will be made and where results are stored. Recommended next steps before installing: a) review src files (especially lifecycle-monitor.js and database/init.js) locally to confirm what they log/store and where; b) run npm install and the code in an isolated/sandboxed environment first; c) change hardcoded paths in the docs and confirm the DB/log file locations and retention policy; d) do not provide sensitive API keys until you audit any network calls; e) if unsure, run with monitoring and limited privileges or decline installation.
功能分析
Type: OpenClaw Skill
Name: claw-mem
Version: 0.1.0
The claw-mem skill is a legitimate tiered memory management utility for OpenClaw agents. It implements a structured storage system (L0/L1/L2) using SQLite (via better-sqlite3) to optimize token usage and provide advanced search capabilities (keyword, time-range, and session-based). While it monitors agent lifecycle events like tool calls and memory writes in src/core/lifecycle-monitor.js, this behavior is transparently documented and essential for its stated purpose of automated memory indexing. No evidence of data exfiltration, unauthorized execution, or malicious prompt injection was found.
能力评估
Purpose & Capability
Name/description match the code: a 3-tier memory store, lifecycle monitor, and search over an on-disk SQLite DB. However the registry metadata claims 'no required env vars' and 'instruction-only / no install', while the SKILL.md and code expect an npm project, a .env file, and writeable filesystem paths — this mismatch is unexpected and worth scrutiny.
Instruction Scope
Runtime instructions direct users to a hard-coded path (/root/.openclaw/workspace/projects/clawmem), run npm install and db:init, copy and edit .env, and import the project's modules into OpenClaw. The lifecycle monitor explicitly intercepts OpenClaw events (tool.call, memory.write, etc.) and persists payloads (including tool args) to local L2 storage. That behavior is consistent with a memory plugin but means the skill will collect and store runtime data (which can include sensitive info). The SKILL.md also contains pre-scan prompt-injection indicators (unicode control chars) — this is suspicious and should be reviewed.
Install Mechanism
No formal install spec was provided in registry metadata (instruction-only), but the bundle includes a package.json and full source. Dependencies are standard npm packages (better-sqlite3, uuid) with no external download URLs. The absence of an install spec in metadata combined with a runnable Node project is an inconsistency (users are expected to run npm install manually).
Credentials
Metadata declares no required env vars or credentials but the SKILL.md and config/loader.js expect a .env with settings (DATABASE_PATH, LLM_PROVIDER, LLM_MODEL, etc.). The code will create files (DB, logs) on disk. The config mentions LLM provider (openai) but there is no declared need for an API key — if you set an LLM_PROVIDER that triggers calls, credentials may be needed but are not declared. Overall the environment/credential requirements are under-declared and potentially ask for access beyond what the metadata signals.
Persistence & Privilege
always:false and user-invocable: true (normal). The lifecycle monitor starts a persistent background worker loop when started (while(true) with configured sleep), which will run until stopped; that can consume resources and will keep collecting events once integrated. The skill does not request system-wide privileges or modify other skills, but it will persist captured events to local DB and logs (user should confirm storage location and retention).
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install claw-mem - 安装完成后,直接呼叫该 Skill 的名称或使用
/claw-mem触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v0.1.0
Initial release of ClawMem, a lightweight 3-tier memory management system for OpenClaw.
- Introduces L0/L1/L2 memory storage and retrieval workflow.
- Supports keyword, time, tag, and session-based advanced searches.
- Integrates automatic lifecycle monitoring for OpenClaw events.
- Delivers significant token savings (60–80%) via optimized memory tiering.
- Provides SQLite-based storage for high performance and easy deployment.
元数据
常见问题
ClawMem 是什么?
Lightweight memory management system for OpenClaw with 3-tier retrieval (L0/L1/L2), automatic lifecycle monitoring, and advanced search. Saves 60-80% on toke... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 306 次。
如何安装 ClawMem?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install claw-mem」即可一键安装,无需额外配置。
ClawMem 是免费的吗?
是的,ClawMem 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
ClawMem 支持哪些平台?
ClawMem 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 ClawMem?
由 ClawMem.com(@leohuang8688)开发并维护,当前版本 v0.1.0。
推荐 Skills