关于 ov-search-context
通过 `ov` CLI 搜索 OpenViking 中上下文的 Agent Skill,结合语义检索、目录浏览、文本模式和路径搜索,并支持读取及摘要结果。
主要功能
- 01语义上下文搜索
- 02目录列表与树形视图
- 03文本模式与 glob 搜索
- 04读取内容和摘要
- 05范围与结果数量控制
适用场景
- 01查找先前保存的 API 细节
- 02在项目文档中搜索特定文本
- 03读取文件前浏览已存资源
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ volcengine/ openviking --skill ov-search-context安装后在 Claude Code 中输入/ov-search-context确认已加载。
详细介绍
OpenViking(OV)上下文搜索
ov search 命令在 OpenViking 中的所有记忆和资源中执行上下文感知检索——将语义理解与目录递归检索相结合,为任意查询找到最相关的上下文。
目录
- 何时使用
- 搜索子命令
- 列出目录(
ov ls) - 树状视图(
ov tree) - 语义搜索(
ov find) - 内容模式搜索(
ov grep) - 文件 Glob 搜索(
ov glob) - 读取完整内容(
ov read) - 获取概览(
ov overview) - 获取摘要(
ov abstract)
- 列出目录(
- 前置条件
何时使用
- 在已导入的资源或已保存的记忆中查找特定信息
- 检索此前添加的关于主题、API 或模式的上下文
- 跨项目文档、代码和知识沉淀进行搜索
- 当 Agent 需要引用此前存储的知识时
注意:命令行命令可能已过时,遇到错误时请使用
--help获取最新用法
搜索子命令
列出内容(ov ls)
浏览目录结构:
# List root directory
ov ls
# List specific directory
ov ls viking://resources/my-project/docs/
# Simple path output (only uris, no metadata)
ov ls viking://resources --simple
# Show hidden files
ov ls viking://resources --all
# Control output limits (default 256)
ov ls viking://resources --node-limit 50
# Control abstract info length limit for each node (default 256)
ov ls viking://resources --abs-limit 128
树状视图(ov tree)
可视化目录层级:
# Show tree structure
ov tree viking://resources
# Control depth limits (default 3)
ov tree viking://resources --level-limit 2
# Control node limits
ov tree viking://resources --node-limit 100 --abs-limit 128
# Show all files including hidden
ov tree viking://resources --all
语义查找(ov find)
按语义相关性排序的查找方法:
# Basic find across all context
ov find "how to handle API rate limits"
# Find within specific URI scope
ov find "authentication flow" --uri "viking://resources/my-project"
# Limit results and set relevance score threshold
ov find "error handling" --node-limit 5 --threshold 0.3
内容模式搜索(ov grep)
字面模式匹配:
# Find exact text pattern (Note: this is expensive, and suggest within specific small URI scope)
ov grep "viking://resources" "TODO:" --uri "viking://resources/my-project"
# Case-insensitive search
ov grep "viking://resources" "API_KEY" --ignore-case --uri "viking://resources/my-project"
# Limit results and set node limit
ov grep "viking://resources" "API_KEY" --node-limit 5 --uri "viking://resources/my-project"
文件 Glob 搜索(ov glob)
文件路径模式匹配:
# Find all markdown files (Note: this is expensive, and suggest within specific small URI scope)
ov glob "**/*.md" --uri "viking://resources/my-project"
# Limit results and set node limit
ov glob "**/*.md" --uri "viking://resources/my-project" --node-limit 5
读取文件内容(ov read)
检索完整内容(L0-L2 层):
# Read full content
ov read viking://resources/docs/api/api-1.md
# Read first 10 lines of api-2.md
ov read viking://resources/docs/api/api-2.md | head -n 10
# Read abstract (L0 - quick summary)
ov abstract viking://resources/docs/api/
ov read viking://resources/docs/api/.abstract.md
# Read overview (L1 - key points)
ov overview viking://resources/docs/api/
ov read viking://resources/docs/api/.overview.md
组合搜索
使用搜索结果指导后续操作:
ov ls viking://resources/
# Search for relevant files
ov search "authentication" --uri "viking://resources/project-A"
# Get overview for context
ov overview viking://resources/project-A/backend
# Decide to read specific content
ov read viking://resources/project-A/backend/auth.md
前置条件
- 已配置命令行:
~/.openviking/ovcli.conf - 此前已向 OpenViking 添加资源或记忆
评论
支持 Markdown