返回顶部
c

context-nexus跨会话记忆

Persistent cross-session memory, structured observability, encrypted secrets management, and replay for OpenClaw agents. Local-first SQLite. Installs as both skill and OpenClaw plugin. Use when: (1) agents need memory between sessions, (2) API keys need secure storage, (3) run history needs replay and analysis, (4) auth failures need classification and recovery.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.2.0
安全检测
已通过
103
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

context-nexus

Context Nexus

针对OpenClaw代理的持久化记忆、可观测性、密钥管理与回放功能。

功能概述

Context Nexus是OpenClaw代理的默认记忆与可观测性基础组件。
安装后,它将:

  1. 1. 持久化记忆 — 在会话之间设置、搜索、固定和检索事实信息
  2. 记录事件 — 结构化日志,自动脱敏处理
  3. 存储密钥 — 静态加密存储,无需硬编码API密钥
  4. 提炼运行摘要 — 每次会话后生成确定性摘要
  5. 性能评分 — 轻量级运行评分及优化建议

安装

bash

步骤1:克隆仓库(运行时 + 插件)


git clone https://github.com/prettybusysolutions-eng/context-nexus ~/context-nexus

步骤2:初始化存储

cd ~/context-nexus ./scripts/install

步骤3:安装为OpenClaw插件

openclaw plugins install ~/context-nexus/plugin

步骤4:添加到openclaw.json的plugins.entries配置

(编辑 ~/.openclaw/openclaw.json — 参见上方设置章节)

步骤5:重启网关

openclaw gateway restart

验证安装

./scripts/smoke_test

注意: clawhub install context-nexus 仅安装此SKILL.md文件及元数据。
完整的运行时(插件、服务、存储)需要通过上述GitHub克隆获取。



设置

安装后,将插件添加到 ~/.openclaw/openclaw.json:

json
{
plugins: {
load: {
paths: [~/context-nexus/plugin]
},
entries: {
context-nexus: {
enabled: true,
config: {
sessionScope: durable,
logLevel: info
}
}
}
}
}

然后执行:openclaw gateway restart



使用方式(自动钩子)

安装后,插件通过钩子自动运行。标准使用场景无需手动调用。

自动触发的钩子:

  • - beforepromptbuild — 在每次响应前注入最近的持久化记忆
  • aftertoolcall — 记录每次工具调用并自动脱敏
  • sessionend — 自动生成运行摘要
  • onerror — 记录并分类失败信息

高级手动使用:

bash

存储记忆


nexus_memory action=set key=user:pref value=dark mode scope=durable importance=8

搜索记忆

nexus_memory action=search query=preference limit=5

存储密钥

nexus_secrets action=store name=openai value=sk-... metadata={provider:openai}

检查失败记录

nexuslogs action=queryfailures

解释失败原因

nexusreplay action=explainfailure session_id=

存储状态检查

nexus_admin action=healthcheck

记忆作用域

作用域生命周期压缩策略
ephemeral仅当前会话保留前50条
durable
所有会话 | 保留前500条 | | pinned | 永久保留 | 永不删除 |

重要性9-10 → 自动固定。



密钥安全

  • - 采用PBKDF2 + HMAC-SHA256静态加密
  • 故障安全关闭:解密错误不返回任何信息
  • 日志自动脱敏处理Stripe密钥、GitHub令牌、Bearer令牌、私钥、JWT
  • nexus_admin action=healthcheck 验证存储完整性

架构

  • - Node.js插件注册钩子并向OpenClaw暴露工具接口
  • Python子进程处理所有存储/逻辑(nexusservice.py)
  • 默认使用SQLite;通过 DATABASEURL 支持PostgreSQL
  • 零强制云端依赖

存储

默认路径:~/.openclaw/context-nexus/nexus.db

PostgreSQL(可选):设置 DATABASE_URL

升级路径:同一适配器,零代码变更。



文档


代理市场(v0.1版)

Context Nexus包含一个代理间服务市场。服务自动注册,买方代理自动评估和购买,分账自动结算。交易全程无需人工介入。

经济模型

每笔交易的分成比例:

  • - 85% → 服务提供商运营方(收入)
  • 3% → Context Nexus网络运维
  • 12% → Context Nexus改进基金

注册服务

bash
nexusmarket action=listservice \
slug=my-service \
name=My AI Service \
category=security \
pricingmodel=percall \
price_amount=5.00 \
price_currency=USD \
splittable={ops:0.03,operator:0.85,improvementfund:0.12} \
triggersignals=[securityscan,data_leak]

声明买方策略

bash
nexusmarket action=declarepolicy \
policy_name=Auto security buyer \
category=security \
maxbudgetamount=200.00 \
budget_currency=USD \
budgetperiod=permonth \
autoapprovethreshold=0.5 \
triggersignals=[securityscan,dataleak,breachdetected]

自动购买流程

当匹配的服务注册时:

  1. 1. 买方代理的策略引擎评估信号匹配度、预算和审批分数
  2. 如果分数 >= 阈值 → 自动购买
  3. 分账自动结算给运营方、网络运维和改进基金
  4. 交易永久记录

买方策略引擎

分数 = 信号匹配度×0.4 + 预算适配度×0.25 + 类别匹配度×0.3

  • - 分数 >= 自动审批阈值 → 自动购买
  • 分数 < 阈值 → 标记待审核

查询收益

bash

运营方收益(85%分成)


nexusmarket action=myearnings agentid= currency=USD period=permonth

网络运维收益(3%分成)

nexusmarket action=myearnings agentid=context-nexus-ops currency=USD period=permonth

改进基金收益(12%分成)

nexusmarket action=myearnings agentid=context-nexus-improvement currency=USD period=permonth

市场方法

bash
nexusmarket action=listservice slug= name= category= pricingmodel= priceamount= pricecurrency= splittable= trigger_signals=
nexusmarket action=listservices category= status=active
nexusmarket action=declarepolicy policyname= category= maxbudgetamount= budgetcurrency= budgetperiod= autoapprovethreshold= triggersignals=
nexusmarket action=getpolicy agent_id=
nexusmarket action=buyservice serviceid= buyeragent_id=
nexusmarket action=listtransactions status= limit=
nexusmarket action=myearnings agent_id= currency= period=
nexusmarket action=settletransaction transactionid= txhash=

结算(v0.1版 = 链下,v1.0版 = Solana链上)

v0.1版:交易在链下记录。nexusmarket action=settletransaction txhash=onchain_v0.1 标记为已结算。

v1.0版:在Solana上通过SPL代币转账实现自动分账结算。



系统要求

  • - Python 3.8+
  • OpenClaw 2026.1+
  • SQLite(内置,无需安装)
  • 可选:PostgreSQL(用于多代理共享记忆)

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 context-nexus-1775906041 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 context-nexus-1775906041 技能

通过命令行安装

skillhub install context-nexus-1775906041

下载

⬇ 下载 context-nexus v0.2.0(免费)

文件大小: 3.66 KB | 发布时间: 2026-4-12 09:34

v0.2.0 最新 2026-4-12 09:34
v0.2.0: Agent marketplace — service registry, buyer policies, auto-purchase, automatic splits. Agent-to-agent economy with zero human involvement.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large