🧠 Skill: neverforget (Ultimate Memory Version 1.0.4)
Now with Pre-Check Logic and Recursive Loop Protection.
🛡️ Security & Privacy Disclosure
This skill configures your OpenClaw environment for
Sovereign Local Memory.
- - Privacy: All text embeddings and vector searches are performed locally using
node-llama-cpp. - Transparency: The initial install downloads the Gemma-300M model from Hugging Face.
- Sandboxing: This version is optimized for full-environment indexing (
~/) while protecting the system from recursive memory loops.
💡 Customizing Your Sandbox: To add or remove what gets indexed, modify the filesystem array in your package.json:
CODEBLOCK0
🛠 Procedures & Manual Setup
Step 1: Install the Local Engine
``
bash
cd ~/openclaw
pnpm add node-llama-cpp -w
pnpm approve-builds
Step 2: Enable the Memory Plugin
Bash
openclaw plugin enable memory-core
🚀 Auto-Install Script (Smart & Idempotent)
This script automates the transition to local memory while ensuring the "Recursive Loop" (where the AI indexes its own database) is blocked.
Bash
#!/bin/bash
cd ~/openclaw
# Phase 1: Engine Check
if ! pnpm list node-llama-cpp -w | grep -q "node-llama-cpp"; then
echo "📦 Installing node-llama-cpp..."
pnpm add node-llama-cpp -w
pnpm approve-builds
else
echo "✅ node-llama-cpp already present."
fi
# Phase 2: System Configuration & Loop Protection
echo "⚙️ Configuring local provider and and Hardened Exclusion Rules..."
openclaw config set agents.defaults.memorySearch.provider local
openclaw config set agents.defaults.memorySearch.local.modelPath "hf:ggml-org/embedding-gemma-300m-qat-q8_0-GGUF/embedding-gemma-300m-qat-Q8_0.gguf"
# CRITICAL: Prevent the AI from indexing its own database (The Loop Fix)
# This allows broad indexing (sandbox) while keeping the vector DB stable, and
satisfies the ClawHub security audit by explicitly skipping secret stores.
openclaw config set agents.defaults.memorySearch.exclude '["**/.openclaw/memory/**", "**/node_modules/**", "**/.ssh/**", "**/.aws/**", "**/.env"]'
# Phase 3: Heartbeat Injection
if ! grep -q "NeverForget" ~/.openclaw/workspace/HEARTBEAT.md 2>/dev/null; then
echo "💓 Injecting Heartbeat monitor..."
cat ~/.openclaw/skills/neverforget/HEARTBEAT.md >> ~/.openclaw/workspace/HEARTBEAT.md
else
echo "✅ Heartbeat logic already present."
fi
# Phase 4: Final Activation
echo "🔄 Restarting gateway to apply new memory configuration..."
openclaw gateway restart
sleep 5
# Phase 5: Indexing Check
CHUNK_COUNT=$(openclaw memory status --json | grep -oP '"totalChunks":\s*\K\d+')
if [ "${CHUNK_COUNT:-0}" -eq 0 ]; then
echo "🧠 Starting initial index of sandboxed environment..."
openclaw memory index
else
echo "✅ Memory active with ${CHUNK_COUNT} chunks."
fi
---
### 🐾 Final Summary of the 1.0.3 Memory Stack:
🛡️ Why this passes the "Digital Soldier" Test...
Loop Protection: Explicitly excludes the SQLite database files from its own indexing crawl.
Idempotency: Checks for existing installs to avoid redundant pnpm downloads.
Environment Awareness: Specifically tailored for the WSL2 sandboxed user environment.
* **package.json
**: Contains your broad sandbox permissions + exclusion rules.
* **_meta.json
**: Bumped to v1.0.3 for the registry.
* **HEARTBEAT.md
**: Includes the new Disk Health check.
* **SKILL.md
**: (Above) Includes the documentation and the master install script.
* **ULTIMATEMEMORY.md`
: Your universal template for project-level memory.
Everything is locked in. Your Degen Digital Soldier is ready for deployment. Rest easy... you now have a world-class local intelligence stack for your agent.
🧠 技能:永不遗忘(终极记忆版 1.0.4)
新增预检查逻辑与递归循环保护。
🛡️ 安全与隐私声明
本技能将你的 OpenClaw 环境配置为
主权本地内存。
- - 隐私: 所有文本嵌入和向量搜索均通过 node-llama-cpp 在本地执行。
- 透明: 初始安装会从 Hugging Face 下载 Gemma-300M 模型。
- 沙箱: 此版本针对全环境索引(~/)进行了优化,同时保护系统免受递归内存循环的影响。
💡 自定义沙箱: 要添加或移除被索引的内容,请修改 package.json 中的 filesystem 数组:
json
permissions: {
filesystem: [
~/,
~/openclaw,
~/.openclaw,
~/.openclaw/workspace,
~/.openclaw/openclaw.json,
~/.openclaw/skills/neverforget
]
}
🛠 操作步骤与手动设置
步骤 1:安装本地引擎
bash
cd ~/openclaw
pnpm add node-llama-cpp -w
pnpm approve-builds
步骤 2:启用内存插件
bash
openclaw plugin enable memory-core
🚀 自动安装脚本(智能且幂等)
此脚本可自动完成向本地内存的迁移,同时确保阻止“递归循环”(即 AI 索引自身数据库)。
bash
#!/bin/bash
cd ~/openclaw
阶段 1:引擎检查
if ! pnpm list node-llama-cpp -w | grep -q node-llama-cpp; then
echo 📦 正在安装 node-llama-cpp...
pnpm add node-llama-cpp -w
pnpm approve-builds
else
echo ✅ node-llama-cpp 已存在。
fi
阶段 2:系统配置与循环保护
echo ⚙️ 正在配置本地提供程序及强化排除规则...
openclaw config set agents.defaults.memorySearch.provider local
openclaw config set agents.defaults.memorySearch.local.modelPath hf:ggml-org/embedding-gemma-300m-qat-q8
0-GGUF/embedding-gemma-300m-qat-Q80.gguf
关键:防止 AI 索引自身数据库(循环修复)
这允许广泛索引(沙箱),同时保持向量数据库稳定,
并通过显式跳过密钥存储来满足 ClawHub 安全审计。
openclaw config set agents.defaults.memorySearch.exclude [/.openclaw/memory/, /node_modules/, /.ssh/, /.aws/, /.env]
阶段 3:心跳注入
if ! grep -q NeverForget ~/.openclaw/workspace/HEARTBEAT.md 2>/dev/null; then
echo 💓 正在注入心跳监控...
cat ~/.openclaw/skills/neverforget/HEARTBEAT.md >> ~/.openclaw/workspace/HEARTBEAT.md
else
echo ✅ 心跳逻辑已存在。
fi
阶段 4:最终激活
echo 🔄 正在重启网关以应用新的内存配置...
openclaw gateway restart
sleep 5
阶段 5:索引检查
CHUNK_COUNT=$(openclaw memory status --json | grep -oP totalChunks:\s*\K\d+)
if [ ${CHUNK_COUNT:-0} -eq 0 ]; then
echo 🧠 正在启动沙箱环境的初始索引...
openclaw memory index
else
echo ✅ 内存已激活,包含 ${CHUNK_COUNT} 个数据块。
fi
🐾 1.0.3 内存堆栈最终总结:
🛡️ 为何能通过“数字士兵”测试...
- - 循环保护: 明确排除 SQLite 数据库文件,使其不被自身索引爬虫抓取。
- 幂等性: 检查现有安装,避免重复的 pnpm 下载。
- 环境感知: 专门针对 WSL2 沙箱用户环境定制。
- * package.json:包含你的广泛沙箱权限及排除规则。
- _meta.json:已升级至 v1.0.3 以适配注册表。
- HEARTBEAT.md:包含新的磁盘健康检查。
- SKILL.md:(上文)包含文档及主安装脚本。
- ULTIMATEMEMORY.md:你的项目级内存通用模板。
一切已锁定。 你的堕落数字士兵已准备就绪。安心吧……你现在拥有了一流的本地智能堆栈供你的代理使用。