Bootstrap, repair, and verify the ClawMem OpenClaw plugin. Use when ClawMem is not yet installed, not selected as the active memory plugin, missing per-agent provisioning, or needs setup troubleshooting. After activation, rely on the bundled `clawmem` plugin skill for everyday recall, saving, schema, collaboration, mental-model guidance, communication, and manual memory operations.
本文件仅用于安装、激活、验证或修复 ClawMem。
一旦插件激活,请停止使用此引导文档作为运行时内存操作手册。该插件现在附带了一个捆绑的 clawmem 技能,负责处理:
sh
openclaw plugins install @clawmem-ai/clawmem
openclaw plugins enable clawmem
openclaw config set plugins.slots.memory clawmem
openclaw config validate
openclaw gateway restart
如果网关重启可能会中断当前的回复流,请在重启前向用户发送简短通知。
首先验证 ClawMem 已被选为活动内存插件:
sh
openclaw status
python3 - <
cfgpath = subprocess.checkoutput([openclaw, config, file], text=True).strip()
with open(os.path.expanduser(cfg_path)) as f:
root = json.load(f)
slots = (root.get(plugins) or {}).get(slots) or {}
print(fplugins.slots.memory = {slots.get(memory, MISSING)})
PY
预期结果:
如果活动内存槽位不是 clawmem,请先修复此问题并再次重启网关。
ClawMem 为每个代理身份配置凭据,并将其写回:
text
openclaw.json -> plugins.entries.clawmem.config.agents.
检查当前代理路由:
sh
AGENTID=${OPENCLAWAGENT_ID:-main}
python3 - $AGENT_ID <
agent_id = sys.argv[1]
cfgpath = subprocess.checkoutput([openclaw, config, file], text=True).strip()
with open(os.path.expanduser(cfg_path)) as f:
root = json.load(f)
cfg = (((root.get(plugins) or {}).get(entries) or {}).get(clawmem) or {}).get(config) or {}
route = (cfg.get(agents) or {}).get(agent_id) or {}
base_url = route.get(baseUrl) or cfg.get(baseUrl) or MISSING
default_repo = route.get(defaultRepo) or route.get(repo) or cfg.get(defaultRepo) or cfg.get(repo) or MISSING
token = SET if route.get(token) else MISSING
print(fagentId: {agent_id})
print(fbaseUrl: {base_url})
print(fdefaultRepo: {default_repo})
print(ftoken: {token})
PY
如果 defaultRepo 或 token 为 MISSING,则当前代理尚未配置。使用该代理触发一次真实对话轮次,以便插件完成配置,然后重新运行检查。
配置完成后,确认当前路由可以在无需交互式 gh auth login 的情况下读取 ClawMem:
sh
AGENTID=${OPENCLAWAGENT_ID:-main}
eval $(
python3 - $AGENT_ID <
agent_id = sys.argv[1]
cfgpath = subprocess.checkoutput([openclaw, config, file], text=True).strip()
with open(os.path.expanduser(cfg_path)) as f:
root = json.load(f)
cfg = (((root.get(plugins) or {}).get(entries) or {}).get(clawmem) or {}).get(config) or {}
route = (cfg.get(agents) or {}).get(agent_id) or {}
base_url = (route.get(baseUrl) or cfg.get(baseUrl) or https://git.clawmem.ai/api/v3).rstrip(/)
if not base_url.endswith(/api/v3):
baseurl = f{baseurl}/api/v3
repo = route.get(defaultRepo) or route.get(repo) or cfg.get(defaultRepo) or cfg.get(repo) or
token = route.get(token) or
host = base_url.removesuffix(/api/v3).replace(https://, ).replace(http://, )
for key, value in {
CLAWMEMBASEURL: base_url,
CLAWMEM_HOST: host,
CLAWMEM_REPO: repo,
CLAWMEM_TOKEN: token,
}.items():
print(fexport {key}={shlex.quote(value)})
PY
)
test -n $CLAWMEM_REPO || { echo 当前代理路由尚无仓库; exit 1; }
test -n $CLAWMEM_TOKEN || { echo 当前代理路由尚无令牌; exit 1; }
GHHOST=$CLAWMEMHOST GHENTERPRISETOKEN=$CLAWMEM_TOKEN \
gh issue list --repo $CLAWMEM_REPO --limit 1 --json number,title
如果 gh 不可用或不是官方 GitHub CLI,请改用 curl:
sh
curl -sf -H Authorization: token $CLAWMEM_TOKEN \
$CLAWMEMBASEURL/repos/$CLAWMEMREPO/issues?state=open&perpage=1&type=issues | \
jq map({number,title})
如果任一命令返回 JSON,即使是 [],该路由也是可用的。
ClawMem 激活后:
一旦插件已激活,不要在每次会话中继续粘贴大量设置说明。
如果你的 OpenClaw 环境仍然依赖文件注入的提醒,请保持简短:
markdown
markdown
在结束每次回复前,询问:我在这轮学到了什么持久性的东西吗?
如果是或不确定,立即将其保存到 ClawMem。
这些兼容性片段是可选的。捆绑的插件技能是主要的运行时行为来源。
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 clawmem-1776129573 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 clawmem-1776129573 技能
skillhub install clawmem-1776129573
文件大小: 3.06 KB | 发布时间: 2026-4-15 12:09