返回顶部
o

openviking-setupOpenViking设置

Set up OpenViking context database for OpenClaw agents. OpenViking is an open-source context database designed specifically for AI agents with filesystem-based memory management, tiered context loading (L0/L1/L2), and self-evolving memory. Use when asked to set up OpenViking, configure context database for agents, implement persistent memory, or when memory management optimization is needed. Triggers on "install openviking", "setup openviking", "context database", "tiered memory", "L0 L1 L2 cont

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

openviking-setup

OpenViking Setup for OpenClaw

OpenViking 为 AI 智能体提供基于文件系统的内存管理,支持分层上下文加载和自进化记忆。本技能将引导您完成安装和配置。

OpenViking 提供的功能

  • - 文件系统范式:统一上下文管理(记忆、资源、技能)
  • 分层加载(L0/L1/L2):仅加载所需内容,节省 Token
  • 自进化记忆:越用越智能
  • OpenClaw 插件:提供原生集成支持

前置条件

  • - Python 3.10+
  • Go 1.22+(用于 AGFS 组件)
  • GCC 9+ 或 Clang 11+(用于核心扩展)
  • VLM 模型访问权限(用于图像/内容理解)
  • Embedding 模型访问权限(用于向量化)

快速开始

步骤 1:安装 OpenViking

bash

Python 包


pip install openviking --upgrade --force-reinstall

CLI 工具

curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/crates/ov_cli/install.sh | bash

步骤 2:创建配置文件

创建 ~/.openviking/ov.conf:

json
{
storage: {
workspace: /home/your-name/openviking_workspace
},
log: {
level: INFO,
output: stdout
},
embedding: {
dense: {
api_base: https://api.openai.com/v1,
api_key: your-openai-api-key,
provider: openai,
dimension: 1536,
model: text-embedding-3-small
},
max_concurrent: 10
},
vlm: {
api_base: https://api.openai.com/v1,
api_key: your-openai-api-key,
provider: openai,
model: gpt-4o,
max_concurrent: 100
}
}

步骤 3:配置提供商

OpenViking 支持多种 VLM 提供商:

提供商模型示例说明
openaigpt-4o官方 OpenAI API
volcengine
doubao-seed-2-0-pro | 火山引擎豆包 |
| litellm | claude-3-5-sonnet | 统一访问(Anthropic、DeepSeek、Gemini 等) |

对于 LiteLLM(推荐,灵活性更高):

json
{
vlm: {
provider: litellm,
model: claude-3-5-sonnet-20241022,
api_key: your-anthropic-key
}
}

对于 Ollama(本地模型):

json
{
vlm: {
provider: litellm,
model: ollama/llama3.1,
api_base: http://localhost:11434
}
}

OpenClaw 集成

插件安装

OpenViking 提供原生 OpenClaw 插件,实现无缝集成:

bash

安装 OpenClaw 插件


pip install openviking-openclaw

或从源码安装

git clone https://github.com/volcengine/OpenViking cd OpenViking/plugins/openclaw pip install -e .

OpenClaw 配置

添加到您的 OpenClaw 配置中:

yaml

~/.openclaw/config.yaml


memory:
provider: openviking
config:
workspace: ~/.openviking/workspace
tiers:
l0:
max_tokens: 4000
auto_flush: true
l1:
max_tokens: 16000
compression: true
l2:
max_tokens: 100000
archive: true

内存层级说明

层级用途Token 预算行为
L0活跃工作内存4K tokens始终加载,快速访问
L1
频繁访问 | 16K tokens | 压缩,按需加载 | | L2 | 归档/冷存储 | 100K+ tokens | 仅语义搜索 |

层级工作原理

  1. 1. 新上下文进入 L0
  2. L0 填满 → 最旧项目压缩至 L1
  3. L1 填满 → 最旧项目归档至 L2
  4. 检索时搜索所有层级,返回相关上下文

目录结构

~/.openviking/
├── ov.conf # 配置文件
└── workspace/
├── memories/
│ ├── sessions/ # L0:活跃会话记忆
│ ├── compressed/ # L1:压缩记忆
│ └── archive/ # L2:长期存储
├── resources/ # 文件、文档、资源
└── skills/ # 技能特定上下文

使用模式

添加记忆

python
from openviking import MemoryStore

store = MemoryStore()

添加到 L0

store.add_memory( content=用户偏好葡萄牙语回复, metadata={tier: l0, category: preference} )

添加资源

store.add_resource( path=project_spec.md, content=open(project_spec.md).read() )

检索上下文

python

跨所有层级语义搜索


results = store.search(
query=用户偏好,
tiers=[l0, l1, l2],
limit=10
)

基于目录的检索(更精确)

results = store.retrieve( path=memories/sessions/2026-03-16/, recursive=True )

压缩

python

触发手动压缩


store.compact()

查看压缩状态

status = store.status() print(fL0: {status.l0tokens}/{status.l0max}) print(fL1: {status.l1tokens}/{status.l1max})

最佳实践

记忆维护

  1. 1. 分类条目:使用元数据标签以便更好地检索
  2. 定期刷新 L0:让压缩机制运行,不要囤积
  3. 使用目录结构:按项目/主题组织
  4. 定期审查 L2:归档过时记忆

Token 效率

  1. 1. 让 OpenViking 自动管理层级
  2. 对 L2 使用语义搜索(不要加载整个归档)
  3. 在添加到 L1 前压缩冗长内容
  4. 保持 L0 容量低于 50% 以获得最佳性能

OpenClaw 工作流

  1. 1. 会话开始 → OpenViking 加载 L0
  2. 对话进行 → 上下文自动升级至 L1/L2
  3. 长时间间隔 → L2 提供相关历史上下文
  4. 会话累积 → 智能体随时间变得更智能

故障排除

常见问题

No module named openviking

  • - 确保 Python 3.10+ 已激活
  • 尝试 pip install --user openviking

Embedding model not found

  • - 检查 ov.conf 中的提供商和模型是否正确
  • 验证 API 密钥是否有效

L0 overflow

  • - 在配置中减少 l0.max_tokens
  • 手动调用 store.compact()

Slow retrieval from L2

  • - 考虑将频繁访问的资源预加载到 L1
  • 使用基于目录的检索以获得更好的精确度

资源

  • - GitHub:https://github.com/volcengine/OpenViking
  • 文档:https://github.com/volcengine/OpenViking/tree/main/docs
  • OpenClaw 插件:https://github.com/volcengine/OpenViking/tree/main/plugins/openclaw
  • 示例:https://github.com/volcengine/OpenViking/tree/main/examples

效果提升

设置完成后,您的智能体将获得:

  1. 1. 跨会话的持久记忆
  2. 更智能的检索,支持语义 + 目录搜索
  3. Token 效率,通过分层加载实现
  4. 自我改进,随着上下文积累
  5. 可观察的上下文,带有检索轨迹

智能体工作得越多,保留的上下文就越多——而不会出现 Token 膨胀。

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 openviking-setup-1776376022 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 openviking-setup-1776376022 技能

通过命令行安装

skillhub install openviking-setup-1776376022

下载

⬇ 下载 openviking-setup v1.0.0(免费)

文件大小: 9.92 KB | 发布时间: 2026-4-17 15:40

v1.0.0 最新 2026-4-17 15:40
Initial release. Installs and configures OpenViking context database for OpenClaw agents with tiered memory (L0/L1/L2), multi-provider support, and health check utilities.

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

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

p2p_official_large
返回顶部