Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
docs: reorganize learning paths and unify site navigation (#5583)
Zayn Jarvisdeb82009a5ec
diff --git a/.github/workflows/_docs-deploy.yml b/.github/workflows/_docs-deploy.ymlindex 91a53fb90..738c1e7c0 100644--- a/.github/workflows/_docs-deploy.yml+++ b/.github/workflows/_docs-deploy.yml@@ -35,6 +35,7 @@ jobs:env:DOCS_BASE: /VITE_COUNTER_URL: ${{ vars.VITE_COUNTER_URL }}+ VITE_DOCS_SEARCH_URL: ${{ vars.VITE_DOCS_SEARCH_URL }}- name: Build plugin downloadsrun: bash .github/scripts/build-plugin-downloads.sh docs/.vitepress/dist/dl https://docs.openviking.ai/dldiff --git a/.github/workflows/docs-tos.yml b/.github/workflows/docs-tos.ymlindex b8b31c1c0..a8ec3169a 100644--- a/.github/workflows/docs-tos.yml+++ b/.github/workflows/docs-tos.yml@@ -48,6 +48,7 @@ jobs:working-directory: docsenv:VITE_COUNTER_URL: ${{ vars.VITE_COUNTER_URL }}+ VITE_DOCS_SEARCH_URL: ${{ vars.VITE_DOCS_SEARCH_URL }}- name: Build plugin downloadsrun: bash .github/scripts/build-plugin-downloads.sh docs/.vitepress/dist/dl https://docs.openviking.net/dldiff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.tsindex 899147c00..7f3b0b104 100644--- a/docs/.vitepress/config.ts+++ b/docs/.vitepress/config.ts@@ -1,8 +1,10 @@import fs from 'node:fs'import path from 'node:path'import { fileURLToPath } from 'node:url'-import { defineConfig, type DefaultTheme } from 'vitepress'-import { titleFromMarkdown, sidebarSection, localizedSectionSidebarItems, localizedGroupedSidebarItems, localizedReferenceSidebarItems, localizedAboutSidebarItems } from './docs-navigation'+import { defineConfig } from 'vitepress'+import taskLists from 'markdown-it-task-lists'+import { hasPageLlmsTxt, pageLlmsTxtPath } from './theme/llms-txt'+import { titleFromMarkdown, docPageTitle, documentationNav, documentationSidebars, documentationSections } from './docs-navigation'const docsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')const repo = process.env.GITHUB_REPOSITORY || 'volcengine/OpenViking'@@ -36,42 +38,8 @@ const preferenceBootstrapScript = `;(() => {} catch {}})()`-const navLabels = {- en: {- start: 'Getting Started',- concepts: 'Concepts',- guide: 'Guides',- api: 'API Reference',- faq: 'FAQ',- about: 'About'- },- zh: {- start: '开始使用',- concepts: '核心概念',- guide: '指南',- api: 'API 参考',- faq: '常见问题',- about: '关于'- }-}--const enNav: DefaultTheme.NavItem[] = [- { text: navLabels.en.start, link: '/en/getting-started/01-introduction', activeMatch: '/en/(getting-started|configuration|agent-integrations)/' },- { text: navLabels.en.concepts, link: '/en/concepts/01-architecture', activeMatch: '/en/concepts/' },- { text: navLabels.en.guide, link: '/en/guides/01-configuration', activeMatch: '/en/(guides|context-compilation)/' },- { text: navLabels.en.api, link: '/en/api/01-overview', activeMatch: '/en/api/' },- { text: navLabels.en.faq, link: '/en/faq/faq', activeMatch: '/en/faq/' },- { text: navLabels.en.about, link: '/en/about/01-about-us', activeMatch: '/en/about/' }-]--const zhNav: DefaultTheme.NavItem[] = [- { text: navLabels.zh.start, link: '/zh/getting-started/01-introduction', activeMatch: '/zh/(getting-started|configuration|agent-integrations)/' },- { text: navLabels.zh.concepts, link: '/zh/concepts/01-architecture', activeMatch: '/zh/concepts/' },- { text: navLabels.zh.guide, link: '/zh/guides/01-configuration', activeMatch: '/zh/(guides|context-compilation)/' },- { text: navLabels.zh.api, link: '/zh/api/01-overview', activeMatch: '/zh/api/' },- { text: navLabels.zh.faq, link: '/zh/faq/faq', activeMatch: '/zh/faq/' },- { text: navLabels.zh.about, link: '/zh/about/01-about-us', activeMatch: '/zh/about/' }-]+const enNav = documentationNav('en')+const zhNav = documentationNav('zh')function collectAllMdFiles(srcDir: string,@@ -83,7 +51,7 @@ function collectAllMdFiles(function walk(dir: string) {for (const entry of fs.readdirSync(dir)) {- if (ignored.has(entry) || (dir === srcDir && entry === 'repository')) continue+ if (ignored.has(entry) || (dir === srcDir && ['repository', 'review', 'images'].includes(entry))) continueconst abs = path.join(dir, entry)const stat = fs.statSync(abs)if (stat.isDirectory()) {@@ -161,19 +129,16 @@ function buildLlmsTxt(siteConfig: any) {const outDir = siteConfig.outDirconst allFiles = collectAllMdFiles(srcDir)- const files = allFiles.filter(({ relativePath }) => relativePath.replaceAll(path.sep, '/').startsWith('en/'))-- // The machine-readable index and full corpus use the English documentation.+ const files = documentationSections('en').flatMap(section =>+ section.groups.flatMap(group => group.pages.map(page => ({+ relativePath: `en/${page.path}.md`, absPath: path.join(srcDir, `en/${page.path}.md`)+ })))+ )const sections = new Map<string, { title: string; url: string }[]>()- for (const { relativePath, absPath } of files) {- const parts = relativePath.replace(/\\/g, '/').split('/')- const section = parts.length >= 2 ? parts.slice(0, -1).join('/') : 'misc'- const content = fs.readFileSync(absPath, 'utf-8')- const heading = content.match(/^#\s+(.+)$/m)?.[1]?.trim() ?? path.basename(absPath, '.md')- const urlPath = `/${relativePath.replace(/\\/g, '/').replace(/\.md$/, '')}`- const url = `${siteUrl}${base}${urlPath}`- if (!sections.has(section)) sections.set(section, [])- sections.get(section)!.push({ title: heading, url })+ for (const section of documentationSections('en')) {+ sections.set(section.en, section.groups.flatMap(group => group.pages.map(page => ({+ title: `${group.en} — ${docPageTitle('en', page.path)}`, url: `${siteUrl}${base}/en/${page.path}`+ }))))}const lines: string[] = [@@ -229,11 +194,10 @@ export default defineConfig({description: 'Open-source context database for AI Agents',cleanUrls: true,lastUpdated: true,- // The existing Markdown corpus links to examples, bot docs, and localhost- // snippets that are outside the VitePress page tree.- ignoreDeadLinks: true,- // Repository translations and maintainer guides are browsed on GitHub.- srcExclude: ['repository/**'],+ markdown: { config: md => md.use(taskLists, { label: true }) },+ // Repository guides are read on GitHub; review notes are local artifacts.+ // images/ is the public asset directory, including raw Markdown consumed by other apps.+ srcExclude: ['repository/**', 'review/**', 'images/**'],head: [['link', { rel: 'icon', type: 'image/x-icon', href: `${base}favicon.ico` }],['link', { rel: 'icon', type: 'image/png', sizes: '32x32', href: `${base}favicon-32.png` }],@@ -242,12 +206,17 @@ export default defineConfig({['meta', { property: 'og:image', content: ogImageUrl }],['meta', { property: 'og:image:width', content: '1200' }],['meta', { property: 'og:image:height', content: '630' }],+ ['link', { rel: 'alternate', type: 'text/plain', title: 'LLM documentation index', href: `${base}llms.txt` }],['meta', { name: 'twitter:card', content: 'summary_large_image' }],['meta', { name: 'twitter:image', content: ogImageUrl }],['script', {}, preferenceBootstrapScript],['script', {}, languageBootstrapScript]],transformPageData(pageData, { siteConfig }) {+ if (hasPageLlmsTxt(pageData.relativePath)) {+ const head = pageData.frontmatter.head ??= []+ head.push(['link', { rel: 'alternate', type: 'text/plain', title: 'LLM page content', href: `${base.replace(/\/$/, '')}${pageLlmsTxtPath(pageData.relativePath)}` }])+ }const srcPath = path.join(siteConfig.srcDir, pageData.relativePath)try {// Raw SFC closing tags must not terminate VitePress's generated script block.@@ -261,6 +230,12 @@ export default defineConfig({buildDocsSearchIndex(siteConfig)},vite: {+ resolve: {+ alias: [+ { find: './VPNavBarTitle.vue', replacement: path.join(docsRoot, '.vitepress/theme/components/SiteSwitcher.vue') },+ { find: './VPSidebarGroup.vue', replacement: path.join(docsRoot, '.vitepress/theme/components/SidebarGroups.vue') }+ ]+ },publicDir: 'images',plugins: [{@@ -315,17 +290,7 @@ export default defineConfig({outline: {level: [2, 3]},- sidebar: {- '/en/getting-started/': localizedGroupedSidebarItems('en', ['getting-started', 'configuration', 'agent-integrations']),- '/en/configuration/': localizedGroupedSidebarItems('en', ['getting-started', 'configuration', 'agent-integrations']),- '/en/concepts/': localizedSectionSidebarItems('en', 'concepts'),- '/en/guides/': localizedGroupedSidebarItems('en', ['guides']),- '/en/agent-integrations/': localizedGroupedSidebarItems('en', ['getting-started', 'configuration', 'agent-integrations']),- '/en/context-compilation/': localizedGroupedSidebarItems('en', ['guides']),- '/en/api/': localizedReferenceSidebarItems('en'),- '/en/faq/': [sidebarSection('en/faq', 'FAQ', false)],- '/en/about/': localizedAboutSidebarItems('en')- }+ sidebar: documentationSidebars('en')}},zh: {@@ -337,17 +302,7 @@ export default defineConfig({themeConfig: {logoLink: `${base}zh/`,nav: zhNav,- sidebar: {- '/zh/getting-started/': localizedGroupedSidebarItems('zh', ['getting-started', 'configuration', 'agent-integrations']),- '/zh/configuration/': localizedGroupedSidebarItems('zh', ['getting-started', 'configuration', 'agent-integrations']),- '/zh/concepts/': localizedSectionSidebarItems('zh', 'concepts'),- '/zh/guides/': localizedGroupedSidebarItems('zh', ['guides']),- '/zh/agent-integrations/': localizedGroupedSidebarItems('zh', ['getting-started', 'configuration', 'agent-integrations']),- '/zh/context-compilation/': localizedGroupedSidebarItems('zh', ['guides']),- '/zh/api/': localizedReferenceSidebarItems('zh'),- '/zh/faq/': [sidebarSection('zh/faq', '常见问题', false)],- '/zh/about/': localizedAboutSidebarItems('zh')- },+ sidebar: documentationSidebars('zh'),outline: {label: '页面导航',level: [2, 3]diff --git a/docs/.vitepress/docs-navigation.ts b/docs/.vitepress/docs-navigation.tsindex 088cd0931..831cf4068 100644--- a/docs/.vitepress/docs-navigation.ts+++ b/docs/.vitepress/docs-navigation.ts@@ -2,686 +2,63 @@ import fs from 'node:fs'import path from 'node:path'import { fileURLToPath } from 'node:url'import type { DefaultTheme } from 'vitepress'-const docsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')--const sectionNames: Record<string, string> = {- 'getting-started': 'Getting Started',- configuration: 'Configuration',- concepts: 'Concepts',- guides: 'Guides',- 'agent-integrations': 'Agent Integrations',- 'context-compilation': 'Context Compilation',- api: 'API Reference',- faq: 'FAQ',- about: 'About'-}+import { sections, legacyPages, sectionForPage, type Locale, type DocSection } from './theme/docs-sections.ts'-const zhSectionNames: Record<string, string> = {- 'getting-started': '开始使用',- configuration: '配置',- concepts: '核心概念',- guides: '指南',- 'agent-integrations': 'Agent 集成',- 'context-compilation': '上下文编译',- api: 'API 参考',- faq: '常见问题',- about: '关于'-}+const docsRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')export function titleFromMarkdown(filePath: string): string {const content = fs.readFileSync(filePath, 'utf8')const heading = content.match(/^#\s+(.+)$/m)?.[1]- const fallback = path.basename(filePath, '.md')- return (heading || fallback).replace(/^\d+[-_]/, '').trim()+ return (heading || path.basename(filePath, '.md')).replace(/^\d+[-_]/, '').trim()}-function linkFor(filePath: string): string {- const relativePath = path.relative(docsRoot, filePath).replaceAll(path.sep, '/')- return `/${relativePath.replace(/\.md$/, '')}`+export function docPageTitle(locale: Locale, pagePath: string): string {+ return titleFromMarkdown(path.join(docsRoot, locale, `${pagePath}.md`))}-export function sidebarSection(dir: string, title: string, collapsed = true): DefaultTheme.SidebarItem {- const absoluteDir = path.join(docsRoot, dir)- const items = fs- .readdirSync(absoluteDir)- .filter((file) => file.endsWith('.md'))- .sort((a, b) => a.localeCompare(b, undefined, { numeric: true }))- .map((file) => {- const filePath = path.join(absoluteDir, file)- return {- text: titleFromMarkdown(filePath),- link: linkFor(filePath)- }+export function sectionSidebar(locale: Locale, section: DocSection, includeNextSteps = true): DefaultTheme.SidebarItem[] {+ const groups = [...section.groups, ...(includeNextSteps ? section.nextSteps ?? [] : [])]+ return groups.map(group => ({+ text: group[locale],+ items: group.pages.map(page => {+ const title = docPageTitle(locale, page.path)+ const crossSection = sectionForPage(`${locale}/${page.path}.md`)?.id !== section.id+ const hint = locale === 'zh' ? '跳转到其他章节' : 'Go to another section'+ const icon = `<span class="ov-sidebar-cross-link" role="img" aria-label="${hint}" title="${hint}"><svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M14 3h7v7m0-7L10 14M10 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5"/></svg></span>`+ return { text: title + (crossSection ? icon : ''), link: `/${locale}/${page.path}` }})-- return { text: title, collapsed, items }-}--const gettingStartedSidebar = {- en: [- ['01-introduction.md', 'Introduction'],- ['02-quickstart.md', 'Quick Start'],- ['04-setup-for-agent.md', 'Server Setup for Agent'],- ['05-cli-setup.md', 'OpenViking CLI']- ],- zh: [- ['01-introduction.md', '简介'],- ['02-quickstart.md', '快速开始'],- ['04-setup-for-agent.md', '服务端安装(Agent 版)'],- ['05-cli-setup.md', 'OpenViking CLI']- ]-} as const--const agentIntegrationSidebar = {- en: {- overview: 'Integration Overview',- topItems: [- ['16-capability-reference.md', 'Capability Reference'],- ['18-plugin-development.md', 'Plugin Development']- ],- groups: [- {- text: 'Developer Tools',- items: [- ['02-claude-code.md', 'Claude Code'],- ['04-codex.md', 'Codex'],- ['10-opencode.md', 'OpenCode'],- ['12-cursor.md', 'Cursor'],- ['13-trae.md', 'TRAE / TRAE CN'],- ['17-dsh.md', 'DeepSeek Harness']- ]- },- {- text: 'Agents & Frameworks',- items: [- ['03-openclaw.md', 'OpenClaw'],- ['05-hermes.md', 'Hermes'],- ['07-langchain-langgraph.md', 'LangChain / LangGraph'],- ['11-pi.md', 'pi']- ]- },- {- text: 'General Integration',- items: [- ['14-openviking-helper.md', 'OpenViking Helper'],- ['15-agent-plugins.md', 'Agent Plugins 1.0'],- ['06-mcp-clients.md', 'MCP Clients'],- ['09-log-ingestion.md', 'Local Log Import'],- ['08-community-plugins.md', 'Community Integrations']- ]- }- ]- },- zh: {- overview: '集成概览',- topItems: [- ['16-capability-reference.md', '集成能力参考'],- ['18-plugin-development.md', '插件开发与维护']- ],- groups: [- {- text: '开发工具',- items: [- ['02-claude-code.md', 'Claude Code'],- ['04-codex.md', 'Codex'],- ['10-opencode.md', 'OpenCode'],- ['12-cursor.md', 'Cursor'],- ['13-trae.md', 'TRAE / TRAE CN'],- ['17-dsh.md', 'DeepSeek Harness']- ]- },- {- text: 'Agent 与框架',- items: [- ['03-openclaw.md', 'OpenClaw'],- ['05-hermes.md', 'Hermes'],- ['07-langchain-langgraph.md', 'LangChain / LangGraph'],- ['11-pi.md', 'pi']- ]- },- {- text: '通用接入',- items: [- ['14-openviking-helper.md', 'OpenViking Helper'],- ['15-agent-plugins.md', 'Agent Plugins 1.0'],- ['06-mcp-clients.md', 'MCP 客户端'],- ['09-log-ingestion.md', '本地日志导入'],- ['08-community-plugins.md', '社区集成']- ]- }- ]- }-} as const--const apiReferenceSidebar = {- en: {- overview: 'Overview',- groups: [- {- text: 'Core Data',- items: [- ['02-resources.md', 'Resources'],- ['12-content.md', 'Content'],- ['03-filesystem.md', 'File System'],- ['04-skills.md', 'Skills'],- ['05-sessions.md', 'Sessions'],- ['16-memory.md', 'Memory'],- ['19-agent-evolution.md', 'Agent Evolution']- ]- },- {- text: 'Retrieval',- items: [['06-retrieval.md', 'Retrieval']]- },- {- text: 'Data Lifecycle',- items: [- ['15-watches.md', 'Resource Watches'],- ['11-snapshot.md', 'Snapshots'],- ['14-ovpack.md', 'OVPack']- ]- },- {- text: 'Operations & Observability',- items: [- ['07-system.md', 'System Status'],- ['17-tasks.md', 'Background Tasks'],- ['18-observer.md', 'Runtime Observability'],- ['09-metrics.md', 'Metrics']- ]- },- {- text: 'Identity & Governance',- items: [- ['08-admin.md', 'Multi-Tenancy'],- ['10-privacy.md', 'Privacy']- ]- },- {- text: 'Protocols & Extensions',- items: [- ['22-openviking-assets.md', 'OpenViking Assets'],- ['20-webdav.md', 'WebDAV'],- ['23-agent-runtime.md', 'Agent Runtime API'],- ['24-vikingbot.md', 'VikingBot API']- ]- },- {- text: 'Documentation Maintenance',- items: [['99-api-doc-writing-guide.md', 'API Docs Guide']]- }- ]- },- zh: {- overview: '概览',- groups: [- {- text: '核心数据',- items: [- ['02-resources.md', '资源'],- ['12-content.md', '内容'],- ['03-filesystem.md', '文件系统'],- ['04-skills.md', '技能'],- ['05-sessions.md', '会话'],- ['16-memory.md', '记忆'],- ['19-agent-evolution.md', 'Agent 进化']- ]- },- {- text: '检索',- items: [['06-retrieval.md', '检索']]- },- {- text: '数据生命周期',- items: [- ['15-watches.md', '资源 Watch'],- ['11-snapshot.md', '快照'],- ['14-ovpack.md', 'OVPack']- ]- },- {- text: '运维与观测',- items: [- ['07-system.md', '系统状态'],- ['17-tasks.md', '后台任务'],- ['18-observer.md', '运行观测'],- ['09-metrics.md', '监控指标']- ]- },- {- text: '身份与治理',- items: [- ['08-admin.md', '多租户'],- ['10-privacy.md', '隐私配置']- ]- },- {- text: '协议与扩展',- items: [- ['22-openviking-assets.md', 'OpenViking Assets'],- ['20-webdav.md', 'WebDAV'],- ['23-agent-runtime.md', 'Agent Runtime API'],- ['24-vikingbot.md', 'VikingBot API']- ]- },- {- text: '文档维护',- items: [['99-api-doc-writing-guide.md', 'API 文档规范']]- }- ]- }-} as const--const conceptsSidebar = {- en: {- overview: 'Overview',- groups: [- {- text: 'Core Model',- items: [- ['02-context-types.md', 'Context Types'],- ['03-context-layers.md', 'Context Layers'],- ['04-viking-uri.md', 'Viking URI']- ]- },- {- text: 'Storage & Processing',- items: [- ['05-storage.md', 'Storage'],- ['06-extraction.md', 'Extraction'],- ['07-retrieval.md', 'Retrieval'],- ['08-session.md', 'Sessions']- ]- },- {- text: 'Reliability & Governance',- items: [- ['09-transaction.md', 'Transactions & Recovery'],- ['10-encryption.md', 'Encryption'],- ['11-multi-tenant.md', 'Multi-Tenancy'],- ['12-metrics.md', 'Metrics'],- ['13-privacy.md', 'Privacy'],- ['14-multi-write-storage.md', 'Multi-Write Storage'],- ['16-queue-lifecycle.md', 'Queue State and Completion']- ]- },- {- text: 'Example',- items: [['15-vikingbot.md', 'VikingBot']]- }- ]- },- zh: {- overview: '概览',- groups: [- {- text: '核心模型',- items: [- ['02-context-types.md', '上下文类型'],- ['03-context-layers.md', '上下文层级'],- ['04-viking-uri.md', 'Viking URI']- ]- },- {- text: '存储与处理',- items: [- ['05-storage.md', '存储架构'],- ['06-extraction.md', '上下文提取'],- ['07-retrieval.md', '检索机制'],- ['08-session.md', '会话管理']- ]- },- {- text: '可靠性与治理',- items: [- ['09-transaction.md', '事务与恢复'],- ['10-encryption.md', '数据加密'],- ['11-multi-tenant.md', '多租户'],- ['12-metrics.md', '监控指标'],- ['13-privacy.md', '隐私配置'],- ['14-multi-write-storage.md', '主备存储'],- ['16-queue-lifecycle.md', '任务状态']- ]- },- {- text: '应用案例',- items: [['15-vikingbot.md', 'VikingBot']]- }- ]- }-} as const--const guidesSidebar = {- en: {- groups: [- {- text: 'Configuration & Deployment',- items: [- ['01-configuration.md', 'Configuration'],- ['02-volcengine-purchase-guide.md', 'Model Purchase'],- ['03-deployment.md', 'Server Deployment'],- ['04-authentication.md', 'Authentication'],- ['08-encryption.md', 'Encryption'],- ['11-oauth.md', 'OAuth 2.1'],- ['12-public-access.md', 'Public Access']- ]- },- {- text: 'Integration & Extension',- items: [- ['06-mcp-integration.md', 'MCP Integration'],- ['09-ovpack.md', 'OVPack'],- ['18-openviking-assets.md', 'OpenViking Assets'],- ['10-prompt-guide.md', 'Prompt Customization'],- ['17-vikingbot.md', 'VikingBot']- ]- },- {- text: 'Observability',- items: [- ['05-observability.md', 'Observability & Diagnostics'],- ['07-operation-telemetry.md', 'Operation Telemetry'],- ['11-grafana-prometheus.md', 'Prometheus / Grafana'],- ['12-vikingbot-metrics-validation.md', 'VikingBot Metrics Validation']- ]- },- {- text: 'Storage & Performance',- items: [- ['13-multi-write-storage.md', 'Multi-Write Storage'],- ['14-ragfs-cache.md', 'RAGFS Cache'],- ['15-snapshot.md', 'Snapshots'],- ['16-cuvs.md', 'cuVS Vector Search']- ]- }- ]- },- zh: {- groups: [- {- text: '配置与部署',- items: [- ['01-configuration.md', '基础配置'],- ['02-volcengine-purchase-guide.md', '模型购买'],- ['03-deployment.md', '服务端部署'],- ['04-authentication.md', '身份认证'],- ['08-encryption.md', '数据加密'],- ['11-oauth.md', 'OAuth 2.1'],- ['12-public-access.md', '公网访问']- ]- },- {- text: '集成与扩展',- items: [- ['06-mcp-integration.md', 'MCP 集成'],- ['09-ovpack.md', 'OVPack'],- ['18-openviking-assets.md', 'OpenViking Assets'],- ['10-prompt-guide.md', 'Prompt 自定义'],- ['17-vikingbot.md', 'VikingBot']- ]- },- {- text: '可观测性',- items: [- ['05-observability.md', '可观测性与排障'],- ['07-operation-telemetry.md', '操作遥测'],- ['11-grafana-prometheus.md', 'Prometheus / Grafana'],- ['12-vikingbot-metrics-validation.md', 'VikingBot 指标验证']- ]- },- {- text: '存储与性能',- items: [- ['13-multi-write-storage.md', '主备存储'],- ['14-ragfs-cache.md', 'RAGFS 缓存'],- ['15-snapshot.md', '快照管理'],- ['16-cuvs.md', 'cuVS 向量检索']- ]- }- ]- }-} as const--const privateDeploymentSidebar = {- en: {- text: 'Enterprise Deployment',- items: [- ['19-deployment-checklist.md', 'Deployment Checklist'],- ['20-private-deployment.md', 'Install & Verify'],- ['21-private-operations.md', 'Upgrades & Troubleshooting']- ]- },- zh: {- text: '企业私有化部署',- items: [- ['19-deployment-checklist.md', '部署前检查'],- ['20-private-deployment.md', '安装与验收'],- ['21-private-operations.md', '升级与排障']- ]- }-} as const--type StructuredSidebarCopy = {- readonly overview: string- readonly topItems?: ReadonlyArray<readonly [string, string]>- readonly groups: ReadonlyArray<{- readonly text: string- readonly items: ReadonlyArray<readonly [string, string]>- }>-}--type GroupedSidebarCopy = Pick<StructuredSidebarCopy, 'groups'>--function configuredSidebarItem(- locale: 'en' | 'zh',- section: string,- [file, text]: readonly [string, string]-): DefaultTheme.SidebarItem {- return {- text,- link: linkFor(path.join(docsRoot, locale, section, file))- }-}--function configuredSidebarGroups(- locale: 'en' | 'zh',- section: string,- groups: GroupedSidebarCopy['groups']-): DefaultTheme.SidebarItem[] {- return groups.map((group) => ({- text: group.text,- collapsed: false,- items: group.items.map((item) => configuredSidebarItem(locale, section, item))}))}-function groupedSidebarSection(- locale: 'en' | 'zh',- section: string,- title: string,- copy: GroupedSidebarCopy,- collapsed = true-): DefaultTheme.SidebarItem {- return {- text: title,- collapsed,- items: configuredSidebarGroups(locale, section, copy.groups)- }+export function documentationSections(locale: Locale) {+ return sections.map(section => ({ ...section, text: section[locale], items: sectionSidebar(locale, section, false) }))}-function structuredSidebarSection(- locale: 'en' | 'zh',- section: string,- title: string,- copy: StructuredSidebarCopy,- collapsed = true,- overviewFile = '01-overview.md'-): DefaultTheme.SidebarItem {- return {- text: title,- collapsed,- items: [- configuredSidebarItem(locale, section, [overviewFile, copy.overview]),- ...(copy.topItems ?? []).map((item) => configuredSidebarItem(locale, section, item)),- ...configuredSidebarGroups(locale, section, copy.groups)+export function documentationNav(locale: Locale): DefaultTheme.NavItem[] {+ return sections.map(section => {+ const paths = [+ ...section.groups.flatMap(group => group.pages.map(page => page.path)),+ ...Object.keys(legacyPages).filter(page => legacyPages[page] === section.id)]+ const escaped = paths.map(page => page.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))+ return {+ text: section[locale], link: `/${locale}/${section.entry}`,+ activeMatch: `^/${locale}/(?:${escaped.join('|')})(?:\\.html)?/?$`+ }+ })+}++// Match individual pages: a physical directory can serve several reader tasks.+export function documentationSidebars(locale: Locale): DefaultTheme.SidebarMulti {+ const sidebar: DefaultTheme.SidebarMulti = {}+ for (const section of sections) {+ const items = sectionSidebar(locale, section)+ for (const group of section.groups) {+ for (const page of group.pages) sidebar[`/${locale}/${page.path}`] = items+ }+ for (const [page, owner] of Object.entries(legacyPages)) {+ if (owner === section.id) sidebar[`/${locale}/${page}`] = items+ }}-}--function agentIntegrationSection(- locale: 'en' | 'zh',- title: string,- collapsed = true-): DefaultTheme.SidebarItem {- return structuredSidebarSection(- locale,- 'agent-integrations',- title,- agentIntegrationSidebar[locale],- collapsed- )-}--function gettingStartedSection(- locale: 'en' | 'zh',- title: string,- collapsed = true-): DefaultTheme.SidebarItem {- return {- text: title,- collapsed,- items: gettingStartedSidebar[locale].map((item) =>- configuredSidebarItem(locale, 'getting-started', item)- )- }-}--function apiReferenceSection(- locale: 'en' | 'zh',- title: string,- collapsed = true-): DefaultTheme.SidebarItem {- return structuredSidebarSection(locale, 'api', title, apiReferenceSidebar[locale], collapsed)-}--function conceptsSection(- locale: 'en' | 'zh',- title: string,- collapsed = true-): DefaultTheme.SidebarItem {- return structuredSidebarSection(- locale,- 'concepts',- title,- conceptsSidebar[locale],- collapsed,- '01-architecture.md'- )-}--function guidesSection(- locale: 'en' | 'zh',- title: string,- collapsed = true-): DefaultTheme.SidebarItem {- const section = groupedSidebarSection(locale, 'guides', title, guidesSidebar[locale], collapsed)- const deploymentGroupTitle = locale === 'zh' ? '配置与部署' : 'Configuration & Deployment'- const deploymentGroup = section.items?.find((item) => item.text === deploymentGroupTitle)- if (deploymentGroup?.items) {- const serverIndex = deploymentGroup.items.findIndex((item) =>- item.link === `/${locale}/guides/03-deployment`- )- const copy = privateDeploymentSidebar[locale]- deploymentGroup.items.splice(serverIndex + 1, 0, {- text: copy.text,- collapsed: false,- items: copy.items.map((item) => configuredSidebarItem(locale, 'guides', item))- })- }- // Nest the Context Compilation pages under the "Integration & Extension" group.- const integrationGroupTitle = locale === 'zh' ? '集成与扩展' : 'Integration & Extension'- const integrationGroup = section.items?.find((item) => item.text === integrationGroupTitle)- if (integrationGroup?.items) {- const labels = locale === 'zh' ? zhSectionNames : sectionNames- integrationGroup.items.push(- sidebarSection(`${locale}/context-compilation`, labels['context-compilation'], true)- )- }- return section-}--type LocalizedSidebarSection =- | 'getting-started'- | 'configuration'- | 'concepts'- | 'guides'- | 'agent-integrations'--type LocalizedSidebarSectionBuilder = (- locale: 'en' | 'zh',- title: string,- collapsed?: boolean-) => DefaultTheme.SidebarItem--const localizedSidebarSectionBuilders: Record<- LocalizedSidebarSection,- LocalizedSidebarSectionBuilder-> = {- 'getting-started': gettingStartedSection,- configuration: (locale, title, collapsed = true) =>- sidebarSection(`${locale}/configuration`, title, collapsed),- concepts: conceptsSection,- guides: guidesSection,- 'agent-integrations': agentIntegrationSection-}--function localizedSidebarSection(- locale: 'en' | 'zh',- section: LocalizedSidebarSection,- title: string,- collapsed = true-): DefaultTheme.SidebarItem {- return localizedSidebarSectionBuilders[section](locale, title, collapsed)-}--export function localizedSectionSidebarItems(- locale: 'en' | 'zh',- section: LocalizedSidebarSection-): DefaultTheme.SidebarItem[] {- const labels = locale === 'zh' ? zhSectionNames : sectionNames- return [localizedSidebarSection(locale, section, labels[section], false)]-}--export function localizedGroupedSidebarItems(- locale: 'en' | 'zh',- sections: ReadonlyArray<Exclude<LocalizedSidebarSection, 'concepts'>>-): DefaultTheme.SidebarItem[] {- const labels = locale === 'zh' ? zhSectionNames : sectionNames-- return sections.map((section) =>- localizedSidebarSection(locale, section, labels[section], false)- )-}--export function localizedReferenceSidebarItems(locale: 'en' | 'zh'): DefaultTheme.SidebarItem[] {- const labels = locale === 'zh' ? zhSectionNames : sectionNames- return [apiReferenceSection(locale, labels.api, false)]-}--export function localizedAboutSidebarItems(locale: 'en' | 'zh'): DefaultTheme.SidebarItem[] {- const labels = locale === 'zh' ? zhSectionNames : sectionNames- return [sidebarSection(`${locale}/about`, labels.about, false)]-}--// The homepage map uses the same entries, labels and order as article sidebars.-export function documentationSections(locale: 'en' | 'zh') {- const labels = locale === 'zh' ? zhSectionNames : sectionNames- return [- ...localizedGroupedSidebarItems(locale, ['getting-started', 'configuration', 'agent-integrations']),- ...localizedSectionSidebarItems(locale, 'concepts'),- ...localizedGroupedSidebarItems(locale, ['guides']),- ...localizedReferenceSidebarItems(locale),- sidebarSection(`${locale}/faq`, labels.faq, false),- ...localizedAboutSidebarItems(locale)- ]+ return sidebar}diff --git a/docs/.vitepress/theme/OpenVikingSearch.vue b/docs/.vitepress/theme/OpenVikingSearch.vueindex 165d66c5d..5e56d7937 100644--- a/docs/.vitepress/theme/OpenVikingSearch.vue+++ b/docs/.vitepress/theme/OpenVikingSearch.vue@@ -22,7 +22,7 @@ type RemoteSearchResponse =| { ok: true; results: DocsSearchResult[] }| { ok: false; reason: RemoteSearchFailureReason }-const PRODUCTION_SEARCH_URL = 'https://openviking.net/studio/gateway/docs/search'+const SEARCH_URL = import.meta.env.VITE_DOCS_SEARCH_URL || 'https://openviking.net/studio/gateway/docs/search'const SEARCH_LIMIT = 8const REMOTE_SEARCH_DEBOUNCE_MS = 1000const REMOTE_SEARCH_TIMEOUT_MS = 15000@@ -213,7 +213,7 @@ async function runSearch() {try {const remoteResponse = await fetchRemoteResults(- PRODUCTION_SEARCH_URL,+ SEARCH_URL,currentQuery,mode.value,docsLocale(),@@ -474,19 +474,22 @@ onUnmounted(() => {<buttonref="triggerRef":aria-label="searchCopy.trigger"+ :title="`${searchCopy.trigger} (⌘K / Ctrl K)`"+ :aria-expanded="isOpen"+ aria-haspopup="dialog"+ aria-controls="ov-docs-search-dialog"class="ov-docs-search-trigger"type="button"@click="openSearch">- <span class="ov-docs-search-trigger-label">{{ searchCopy.trigger }}</span>- <span aria-hidden="true" class="ov-docs-search-trigger-compact">{{ searchCopy.compactTrigger }}</span>- <kbd>Ctrl K</kbd>+ <svg width="19" height="19" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" aria-hidden="true"><circle cx="10.8" cy="10.8" r="6.8" /><path d="m16 16 4.5 4.5" /></svg></button><Teleport v-if="isMounted && isOpen" to="body"><div class="ov-docs-search-backdrop" @click.self="closeSearch"><sectionref="dialogRef"+ id="ov-docs-search-dialog":aria-label="searchCopy.dialogLabel"aria-modal="true"class="ov-docs-search-dialog"diff --git a/docs/.vitepress/theme/components/DocBreadcrumb.vue b/docs/.vitepress/theme/components/DocBreadcrumb.vueindex 32bc27c48..60aa80290 100644--- a/docs/.vitepress/theme/components/DocBreadcrumb.vue+++ b/docs/.vitepress/theme/components/DocBreadcrumb.vue@@ -1,13 +1,10 @@<script setup>import { computed } from 'vue'import { useData, withBase } from 'vitepress'-import { sections } from '../docs-sections'+import { sectionForPage } from '../docs-sections'const { page, lang } = useData()const locale = computed(() => lang.value.startsWith('zh') ? 'zh' : 'en')-const section = computed(() => {- const directory = page.value.relativePath.split('/')[1]- return sections.find(item => item.id === (directory === 'context-compilation' ? 'guides' : directory))-})+const section = computed(() => sectionForPage(page.value.relativePath))</script><template><nav class="doc-breadcrumb" :aria-label="locale === 'zh' ? '面包屑导航' : 'Breadcrumb'">diff --git a/docs/.vitepress/theme/components/DocsHome.vue b/docs/.vitepress/theme/components/DocsHome.vueindex 97d956f59..9a7b02f92 100644--- a/docs/.vitepress/theme/components/DocsHome.vue+++ b/docs/.vitepress/theme/components/DocsHome.vue@@ -17,6 +17,8 @@ const copied = ref(false)const copyError = ref(false)let copyTimerfunction openSection(id) {+ const alias = catalog[locale.value].find(section => section.aliases.includes(id.replace(/^section-/, '')))+ if (alias) id = `section-${alias.id}`if (id.startsWith('section-')) expanded.value = new Set([...expanded.value, id.slice(8)])}function openHashSection() { openSection(window.location.hash.slice(1)) }@@ -51,7 +53,7 @@ const shown = computed(() => atlas.value.reduce((n, section) => n + section.pageconst paths = computed(() => [{ label: t('RETRIEVAL', '检索'), icon: '↗', title: t('Run your first retrieval', '完成第一次检索'), description: t('Connect to a service, import a document, and find what matters.', '连接服务,导入文档,找到所需的上下文。'), href: 'getting-started/02-quickstart', action: t('Start building', '开始使用'), primary: true },{ label: 'AGENT', icon: '⌘', title: t('Connect your agent', '接入你的 Agent'), description: t('Add cross-session memory to the tools you already use.', '为正在使用的工具加入跨会话记忆。'), href: 'agent-integrations/01-overview', action: t('Explore integrations', '查看集成') },- { label: 'API', icon: '{}', title: t('Build with the API', '通过 API 构建'), description: t('Work with resources, sessions, and retrieval from your application.', '在应用中管理资源、会话和检索。'), href: 'api/01-overview', action: t('Open API reference', '查看 API') }+ { label: t('BUILD', '开发'), icon: '{}', title: t('Build a context-aware application', '开发使用上下文的应用'), description: t('Choose a workflow for retrieval, memory, skills, or compilation.', '从检索、记忆、技能或上下文编译任务开始。'), href: 'workflows/01-overview', action: t('Choose a workflow', '选择开发任务') }])const agents = [['Claude Code', '02-claude-code'],@@ -75,7 +77,7 @@ const agents = [<p class="hero-description">{{ t('The context database for AI agents.', '面向 AI Agent 的上下文数据库。') }}<br>{{ t('Bring knowledge, memory, and skills into one filesystem. Build the second brain for agent-native teams.', '用一个文件系统组织知识、记忆和技能,做 agent native 团队的第二大脑。') }}</p><div class="hero-actions"><a class="home-button primary" :href="link('getting-started/02-quickstart')">{{ t('Get started', '快速开始') }} <span aria-hidden="true">↗</span></a>- <a class="home-button secondary" href="#explore">{{ t('Explore the docs', '浏览文档') }} <span aria-hidden="true">↓</span></a>+ <a class="home-button secondary" href="#start-here">{{ t('Choose your path', '选择使用路径') }} <span aria-hidden="true">↓</span></a></div></div><div class="context-workspace">@@ -99,7 +101,7 @@ const agents = [</section><div class="home-shell">- <section class="start-section" :aria-label="t('Choose your path', '选择使用路径')">+ <section id="start-here" class="start-section" :aria-label="t('Choose your path', '选择使用路径')"><a v-for="path in paths" :key="path.href" :href="link(path.href)" class="path-card" :class="{ featured: path.primary }"><div class="path-top"><span>{{ path.label }}</span><span class="path-icon" aria-hidden="true">{{ path.icon }}</span></div><h2>{{ path.title }}</h2><p>{{ path.description }}</p>@@ -111,8 +113,13 @@ const agents = [<button @click="copyInstall" :aria-label="t('Copy CLI install command', '复制 CLI 安装命令')"><code><span aria-hidden="true">$ </span>{{ install }}</code><span aria-live="polite">{{ copyError ? t('Select to copy', '请选中复制') : copied ? t('Copied', '已复制') : t('Copy', '复制') }}</span></button></div>+ <section class="integration-strip" :aria-label="t('After the quick start', '首次体验之后')">+ <div><p class="eyebrow">{{ t('YOUR NEXT STEP', '体验之后') }}</p><h2>{{ t('Try it on your own work.', '示例跑通了,换成你的任务。') }}</h2><p>{{ t('Check retrieval, cross-session memory, or a compiled output with sources you know.', '用熟悉的资料,检查检索、跨会话记忆或编译产物。') }}</p></div>+ <div class="agent-links"><a :href="link('getting-started/06-evaluate')">{{ t('Evaluate OpenViking on your tasks', '用你的任务验证效果') }}<span aria-hidden="true">↗</span></a></div>+ </section>+<section class="concept-section" aria-labelledby="concept-title">- <div class="section-intro"><p class="eyebrow">02 — {{ t('THE MENTAL MODEL', '理解工作方式') }}</p><h2 id="concept-title">{{ t('A filesystem you can reason about.', '上下文,像文件一样清楚。') }}</h2><p>{{ t('Browse the structure. Read the summary. Load the detail when you need it.', '先看目录,再读摘要,需要时才加载全文。') }}</p></div>+ <div class="section-intro"><p class="eyebrow">02 — {{ t('THE MENTAL MODEL', '理解工作方式') }}</p><h2 id="concept-title">{{ t('A filesystem you can reason about.', '上下文,像文件一样清楚。') }}</h2><p>{{ t('Browse the structure. Read the summary. Load the detail when you need it.', '先看目录,再读摘要,需要时才加载全文。') }}</p><a :href="link('concepts/00-overview')">{{ t('Concepts and principles', '概念与原理:按学习路径阅读') }} ↗</a></div><div class="layer-grid"><a :href="link('concepts/03-context-layers')" class="layer-item"><div class="layer-art abstract" aria-hidden="true"><span /><span /></div><div class="layer-heading"><code>L0</code><h3>{{ t('The abstract', '摘要') }}</h3></div><p>{{ t('A short description to decide whether a directory is relevant.', '用一段简述判断目录是否相关。') }}</p><span class="layer-file">.abstract.md <span>↗</span></span></a><a :href="link('concepts/03-context-layers')" class="layer-item"><div class="layer-art overview" aria-hidden="true"><span /><span /><span /><span /></div><div class="layer-heading"><code>L1</code><h3>{{ t('The overview', '概览') }}</h3></div><p>{{ t('Structure and key points to plan what to read next.', '了解结构和要点,决定接下来读什么。') }}</p><span class="layer-file">.overview.md <span>↗</span></span></a>@@ -123,7 +130,7 @@ const agents = [<section class="integration-strip" :aria-label="t('Agent integrations', 'Agent 集成')"><div><p class="eyebrow">03 — {{ t('INTEGRATIONS', 'Agent 集成') }}</p><h2>{{ t('Your agent. With memory.', '你的 Agent,有了记忆。') }}</h2><a :href="link('agent-integrations/01-overview')">{{ t('All integrations', '全部集成') }} ↗</a></div><div class="agent-links"><a v-for="agent in agents" :key="agent[0]" :href="link(`agent-integrations/${agent[1]}`)">{{ agent[0] }}<span aria-hidden="true">↗</span></a></div></section><section class="integration-strip" :aria-label="t('Deployment and operations', '部署与运维')">- <div><p class="eyebrow">04 — {{ t('DEPLOYMENT', '部署与运维') }}</p><h2>{{ t('Plan your deployment.', '准备部署。') }}</h2><a :href="link('guides/03-deployment')">{{ t('Deployment options', '选择部署方式') }} ↗</a></div>+ <div><p class="eyebrow">04 — {{ t('DEPLOYMENT', '部署与运维') }}</p><h2>{{ t('Plan your deployment.', '准备部署。') }}</h2><a :href="link('guides/00-overview')">{{ t('Deployment options', '选择部署方式') }} ↗</a></div><div class="agent-links"><a :href="link('guides/01-configuration')">{{ t('Configuration', '基础配置') }}<span aria-hidden="true">↗</span></a><a :href="link('guides/04-authentication')">{{ t('Authentication', '身份认证') }}<span aria-hidden="true">↗</span></a>@@ -133,10 +140,10 @@ const agents = [</section><section id="explore" class="explore-section" aria-labelledby="explore-title">- <div class="section-intro"><p class="eyebrow">05 — {{ t('DOCUMENTATION ATLAS', '文档地图') }}</p><h2 id="explore-title">{{ t('Find your next step.', '下一步。') }}</h2><p>{{ t('From a first connection to the details of a running system.', '寻找每个细节。') }}</p></div>+ <div class="section-intro"><p class="eyebrow">05 — {{ t('DOCUMENTATION ATLAS', '文档地图') }}</p><h2 id="explore-title">{{ t('Find your next step.', '按任务查找文档') }}</h2><p>{{ t('Choose a task, then follow the pages in reading order.', '先选任务,再按组内顺序阅读;接口与字段集中在参考栏目。') }}</p></div><div class="atlas-layout"><aside class="atlas-aside"><label for="doc-filter">{{ t('Find a page', '查找页面') }}</label><div class="atlas-input"><span aria-hidden="true">⌕</span><input id="doc-filter" v-model="filter" type="search" :placeholder="t('Title or filename…', '标题或文件名…')" /></div><p class="atlas-count" role="status">{{ filter ? shown : total }} {{ t('pages', '篇文档') }} <span>/ {{ locale.toUpperCase() }}</span></p><nav :aria-label="t('Documentation sections', '文档章节')"><a v-for="section in atlas" :key="section.id" :href="`#section-${section.id}`" @click="openSection(`section-${section.id}`)">{{ section[locale] }}<span>{{ section.pages.length }} {{ t('pages', '篇') }}</span></a></nav><a class="atlas-machine" :href="withBase('/llms.txt')"><span>↳ llms.txt</span><span>{{ t('For your agent', '给你的 Agent') }} ↗</span></a></aside>- <div class="atlas-tree"><p v-if="!atlas.length" class="atlas-empty">{{ t('No matching pages. Try “memory”, “API”, or a filename.', '没有匹配页面。试试“记忆”“API”或文件名。') }}</p><details v-for="section in atlas" :id="`section-${section.id}`" :key="`${locale}-${section.id}-${!!filter}`" :open="!!filter || expanded.has(section.id)" @toggle="toggleSection(section.id, $event)" class="atlas-group"><summary><span class="folder-glyph" aria-hidden="true">⌑</span><span><strong>{{ section[locale] }}</strong><small>{{ zh ? section.zhNote : section.enNote }}</small></span><span class="section-count">{{ section.pages.length }} {{ t('pages', '篇') }}</span><span class="expand-glyph" aria-hidden="true">+</span></summary><ul><template v-for="(page, index) in section.pages" :key="page.href"><li v-if="page.group && page.group !== section.pages[index - 1]?.group" class="atlas-subgroup">{{ page.group }}</li><li><a :href="withBase(page.href)"><span class="page-branch" aria-hidden="true">↳</span><span>{{ page.title }}</span><span class="page-arrow" aria-hidden="true">↗</span></a></li></template></ul></details></div>+ <div class="atlas-tree"><p v-if="!atlas.length" class="atlas-empty">{{ t('No matching pages. Try “memory”, “API”, or a filename.', '没有匹配页面。试试“记忆”“API”或文件名。') }}</p><details v-for="section in atlas" :id="`section-${section.id}`" :key="`${locale}-${section.id}-${!!filter}`" :open="!!filter || expanded.has(section.id)" @toggle="toggleSection(section.id, $event)" class="atlas-group"><summary><span v-for="alias in section.aliases" :id="`section-${alias}`" :key="alias" /><span class="folder-glyph" aria-hidden="true">⌑</span><span><strong>{{ section[locale] }}</strong><small>{{ zh ? section.zhNote : section.enNote }}</small></span><span class="section-count">{{ section.pages.length }} {{ t('pages', '篇') }}</span><span class="expand-glyph" aria-hidden="true">+</span></summary><ul><template v-for="(page, index) in section.pages" :key="page.href"><li v-if="page.group && page.group !== section.pages[index - 1]?.group" class="atlas-subgroup">{{ page.group }}</li><li><a :href="withBase(page.href)"><span class="page-branch" aria-hidden="true">↳</span><span>{{ page.title }}</span><span class="page-arrow" aria-hidden="true">↗</span></a></li></template></ul></details></div></div></section><section class="home-closing"><div><p class="eyebrow">06 — {{ t('BUILT IN THE OPEN', '一起构建') }}</p><h2>{{ t('Keep exploring.', '继续探索。') }}</h2><p>{{ t('Read the source, ask a question, or help shape what comes next.', '读源码、提问题,或参与下一步的构建。') }}</p></div><div><a href="https://github.com/volcengine/OpenViking">GitHub <span>↗</span></a><a :href="link('about/02-changelog')">{{ t('Changelog', '更新日志') }} <span>↗</span></a><a :href="link('about/01-about-us')">{{ t('Community', '加入社区') }} <span>↗</span></a></div></section>diff --git a/docs/.vitepress/theme/components/LocaleSwitch.vue b/docs/.vitepress/theme/components/LocaleSwitch.vueindex 903e4a57f..25b25d4ac 100644--- a/docs/.vitepress/theme/components/LocaleSwitch.vue+++ b/docs/.vitepress/theme/components/LocaleSwitch.vue@@ -1,4 +1,6 @@<script setup lang="ts">+import { bindLanguageMenu } from '../header-language.js'+import '../header-language.css'import { computed, onMounted, onUnmounted, ref, nextTick } from 'vue'import { useData, useRouter, withBase } from 'vitepress'import type { LanguagePreference } from '../language-preference.js'@@ -12,15 +14,17 @@ const policy = docsLanguagePreferenceconst preference = ref<LanguagePreference>('auto')const menu = ref<HTMLDetailsElement>()const locale = computed(() => lang.value.startsWith('zh') ? 'zh' : 'en')+let unbindMenu: (() => void) | undefinedlet unsubscribe: (() => void) | undefinedonMounted(() => {+ if (menu.value) unbindMenu = bindLanguageMenu(menu.value)preference.value = policy.read()unsubscribe = policy.subscribe(() => { preference.value = policy.read() })})-onUnmounted(() => unsubscribe?.())+onUnmounted(() => { unsubscribe?.(); unbindMenu?.() })async function switchLocale(choice: 'auto' | 'en' | 'zh') {- if (menu.value) menu.value.open = false+ if (menu.value) { menu.value.open = false; menu.value.querySelector('summary')?.focus() }policy.clearQuery()policy.save(choice)preference.value = choice@@ -42,28 +46,16 @@ async function switchLocale(choice: 'auto' | 'en' | 'zh') {</script><template>- <details ref="menu" class="ov-locale-switch"- @keydown.esc="() => { if (menu) { menu.open = false; menu.querySelector('summary')?.focus() } }"- @focusout="event => { if (menu && !menu.contains(event.relatedTarget as Node)) menu.open = false }">- <summary :aria-label="locale === 'zh' ? '语言' : 'Language'">+ <details ref="menu" class="ov-language ov-locale-switch">+ <summary :aria-label="locale === 'zh' ? `语言:简体中文${preference === 'auto' ? '(跟随浏览器)' : ''}` : `Language: English${preference === 'auto' ? ' (following browser)' : ''}`"><svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="M3 5h12M9 3v2m4 0c-1 7-5 10-10 12m2-9c1 4 4 7 8 9m0 4 5-13 5 13m-8-4h6"/></svg>- {{ locale === 'zh' ? '中' : 'EN' }}+ <span>{{ locale === 'zh' ? '中' : 'EN' }}</span>+ <svg class="ov-language-chevron" width="10" height="10" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4"/></svg></summary>- <div class="ov-locale-options">- <button type="button" :aria-pressed="preference === 'auto'" @click="switchLocale('auto')">{{ locale === 'zh' ? '跟随浏览器' : 'Follow browser' }}</button>- <button type="button" lang="en" :aria-pressed="preference === 'en'" @click="switchLocale('en')">English</button>- <button type="button" lang="zh-CN" :aria-pressed="preference === 'zh'" @click="switchLocale('zh')">简体中文</button>+ <div class="ov-language-options">+ <button type="button" :aria-pressed="preference === 'auto'" @click="switchLocale('auto')">{{ locale === 'zh' ? '跟随浏览器' : 'Follow browser' }}<svg width="14" height="14" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 10 4 4 8-8"/></svg></button>+ <button type="button" lang="en" :aria-pressed="preference === 'en'" @click="switchLocale('en')">English<svg width="14" height="14" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 10 4 4 8-8"/></svg></button>+ <button type="button" lang="zh-CN" :aria-pressed="preference === 'zh'" @click="switchLocale('zh')">简体中文<svg width="14" height="14" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 10 4 4 8-8"/></svg></button></div></details></template>--<style scoped>-.ov-locale-switch { position: relative; border: 1px solid var(--vp-c-divider); border-radius: 999px; background: var(--vp-c-bg-alt); }-summary { display: flex; align-items: center; gap: 5px; padding: 5px 8px; font: 11px/1.6 var(--vp-font-family-mono); cursor: pointer; list-style: none; }-summary::-webkit-details-marker { display: none; }-.ov-locale-options { position: absolute; right: 0; top: calc(100% + 6px); z-index: 90; min-width: 170px; padding: 5px; border: 1px solid var(--vp-c-divider); border-radius: 10px; background: var(--vp-c-bg); box-shadow: 0 4px 16px #0002; }-button { display: block; width: 100%; padding: 8px 10px; text-align: left; font-size: 12px; border-radius: 5px; }-button[aria-pressed=true] { font-weight: 700; }-button:hover { background: var(--vp-c-bg-alt); }-button:focus-visible, summary:focus-visible { outline: 2px solid var(--vp-c-brand-1); outline-offset: 3px; }-</style>diff --git a/docs/.vitepress/theme/components/NavScreenFooter.vue b/docs/.vitepress/theme/components/NavScreenFooter.vuenew file mode 100644index 000000000..ef87897b3--- /dev/null+++ b/docs/.vitepress/theme/components/NavScreenFooter.vue@@ -0,0 +1,45 @@+<script setup lang="ts">+import { onMounted, onUnmounted } from 'vue'+import { useData } from 'vitepress'+const { lang } = useData()+let nav: HTMLElement | null+let previouslyInert: [HTMLElement, boolean][] = []+let previousRole: string | null+function hamburger() { return nav?.querySelector<HTMLButtonElement>('.VPNavBarHamburger') }+function keydown(event: KeyboardEvent) {+ if (event.defaultPrevented || !nav?.contains(event.target as Node)) return+ if (event.key === 'Escape') {+ event.preventDefault()+ hamburger()?.click()+ hamburger()?.focus()+ }+ if (event.key !== 'Tab') return+ const items = [...nav.querySelectorAll<HTMLElement>('a[href], button, summary, input')]+ .filter(item => item.getClientRects().length && !item.closest('[inert]') && !item.hasAttribute('disabled') && item.tabIndex >= 0)+ const first = items[0], last = items[items.length - 1]+ if (event.shiftKey && document.activeElement === first) { event.preventDefault(); last?.focus() }+ else if (!event.shiftKey && document.activeElement === last) { event.preventDefault(); first?.focus() }+}+onMounted(() => {+ nav = document.querySelector('.VPNav')+ previousRole = nav?.getAttribute('role') ?? null+ nav?.setAttribute('role', 'dialog')+ nav?.setAttribute('aria-modal', 'true')+ nav?.setAttribute('aria-label', lang.value.startsWith('zh') ? '站点导航' : 'Site navigation')+ previouslyInert = [...document.querySelectorAll<HTMLElement>('.VPContent, .VPSidebar, .VPLocalNav, .VPFooter')].map(item => [item, item.inert])+ previouslyInert.forEach(([item]) => { item.inert = true })+ nav?.querySelector<HTMLAnchorElement>('.VPNavScreenMenu a')?.focus()+ document.addEventListener('keydown', keydown)+})+onUnmounted(() => {+ document.removeEventListener('keydown', keydown)+ previouslyInert.forEach(([item, inert]) => { item.inert = inert })+ if (previousRole) nav?.setAttribute('role', previousRole)+ else nav?.removeAttribute('role')+ nav?.removeAttribute('aria-modal')+ nav?.removeAttribute('aria-label')+})+</script>+<template>+ <a class="ov-drawer-github" href="https://github.com/volcengine/OpenViking" target="_blank" rel="noreferrer">GitHub ↗</a>+</template>diff --git a/docs/.vitepress/theme/components/SidebarFooter.vue b/docs/.vitepress/theme/components/SidebarFooter.vuenew file mode 100644index 000000000..980157820--- /dev/null+++ b/docs/.vitepress/theme/components/SidebarFooter.vue@@ -0,0 +1,12 @@+<script setup lang="ts">+import { useData, withBase } from 'vitepress'+const { lang } = useData()+</script>+<template>+ <div class="sidebar-footer-links">+ <a class="sidebar-github-link" href="https://github.com/volcengine/OpenViking" target="_blank" rel="noreferrer" aria-label="GitHub" title="GitHub">+ <svg aria-hidden="true" width="18" height="18" viewBox="0 0 24 24" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61-.546-1.385-1.335-1.755-1.335-1.755-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 21.795 24 17.295 24 12c0-6.63-5.37-12-12-12z"/></svg>+ </a>+ <a class="sidebar-font-license-link" :href="withBase('/font-licenses.html')">{{ lang.startsWith('zh') ? '字体许可' : 'Font licenses' }}</a>+ </div>+</template>diff --git a/docs/.vitepress/theme/components/SidebarGroups.vue b/docs/.vitepress/theme/components/SidebarGroups.vuenew file mode 100644index 000000000..27d741bae--- /dev/null+++ b/docs/.vitepress/theme/components/SidebarGroups.vue@@ -0,0 +1,76 @@+<script setup lang="ts">+import { useData, withBase } from 'vitepress'+import type { DefaultTheme } from 'vitepress/theme'++// docs-sections owns a flat list of pages within each editorial group.+// Group headings describe the links; they are neither folders nor controls.+defineProps<{ items: DefaultTheme.SidebarItem[] }>()+const { page } = useData()+// Brand assets match the website integrations; keep monochrome marks legible in dark mode.+const brands: Record<string, { file: string; invert?: boolean; dark?: string }> = {+ '02-claude-code': { file: 'claude-code.svg' },+ '04-codex': { file: 'codex.svg', invert: true },+ '12-cursor': { file: 'cursor.svg', invert: true },+ '13-trae': { file: 'trae.svg' },+ '10-opencode': { file: 'opencode.svg', invert: true },+ '17-dsh': { file: 'logos/dsh.svg', dark: 'logos/dsh-dark.svg' },+ '03-openclaw': { file: 'openclaw.jpg' },+ '05-hermes': { file: 'hermes-agent.png' },+ '11-pi': { file: 'pi.svg', invert: true },+ '07-langchain-langgraph': { file: 'langchain.svg' }+}+function brand(link?: string) {+ return brands[link?.split('/').at(-1) ?? '']+}+function normalize(path: string) {+ return path.split(/[?#]/)[0].replace(/^\//, '').replace(/\.(md|html)$/, '').replace(/\/$/, '')+}+function active(link?: string) {+ return !!link && normalize(link) === normalize(page.value.relativePath)+}+</script>++<template>+ <section v-for="group in items" :key="group.text" class="group ov-sidebar-group">+ <h2 v-if="group.text" class="ov-sidebar-heading">{{ group.text }}</h2>+ <ul class="ov-sidebar-pages">+ <li v-for="item in group.items" :key="item.link">+ <a v-if="item.link" class="ov-sidebar-page" :class="{ 'has-brand': group.items?.some(entry => brand(entry.link)) }" :href="withBase(item.link)"+ :aria-current="active(item.link) ? 'page' : undefined" :target="item.target" :rel="item.rel">+ <span v-if="brand(item.link)" class="ov-sidebar-brand" aria-hidden="true">+ <img :src="withBase('/integrations/' + brand(item.link).file)" alt="" width="18" height="18"+ :class="{ 'invert-dark': brand(item.link).invert, 'light-only': brand(item.link).dark }" />+ <img v-if="brand(item.link).dark" :src="withBase('/integrations/' + brand(item.link).dark)"+ alt="" width="18" height="18" class="dark-only" />+ </span>+ <svg v-else-if="group.items?.some(entry => brand(entry.link))" class="ov-sidebar-brand" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2m20 0v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75" /><circle cx="9" cy="7" r="4" />+ </svg>+ <span v-html="item.text" />+ </a>+ </li>+ </ul>+ </section>+</template>++<style scoped>+.ov-sidebar-group { margin-inline: -8px; padding: 20px 0 4px; }+.ov-sidebar-group + .ov-sidebar-group { padding-top: 24px; }+.ov-sidebar-group:last-of-type { padding-bottom: 24px; }+.ov-sidebar-heading { margin: 0 0 8px; padding: 0 10px; color: #6d706b; font-size: 12px; font-weight: 700; line-height: 20px; letter-spacing: .06em; cursor: default; }+.dark .ov-sidebar-heading { color: #a3a59e; }+.ov-sidebar-pages { list-style: none; margin: 0; padding: 0; }+.ov-sidebar-pages li + li { margin-top: 2px; }+.ov-sidebar-page { display: block; padding: 6px 8px; border-left: 2px solid transparent; border-radius: 4px; color: var(--vp-c-text-1); font-size: 14px; font-weight: 400; line-height: 22px; overflow-wrap: anywhere; }+.ov-sidebar-page[aria-current=page] { border-left-color: var(--vp-c-brand-1); background: var(--vp-c-brand-soft); color: var(--vp-c-brand-1); font-weight: 500; }+.ov-sidebar-page:focus-visible { outline: 2px solid var(--vp-c-brand-1); outline-offset: 2px; }+.ov-sidebar-page.has-brand { display: flex; align-items: flex-start; gap: 10px; }+.ov-sidebar-brand { display: block; flex: 0 0 18px; width: 18px; height: 18px; margin-top: 2px; }+.ov-sidebar-brand img { display: block; width: 18px; height: 18px; object-fit: contain; }+.ov-sidebar-brand img[src$="/pi.svg"] { transform: scale(1.6); }+.ov-sidebar-brand .dark-only { display: none; }+.dark .ov-sidebar-brand .invert-dark { filter: invert(1); }+.dark .ov-sidebar-brand .light-only { display: none; }+.dark .ov-sidebar-brand .dark-only { display: block; }+@media (hover: hover) { .ov-sidebar-page:hover { background: var(--vp-c-bg-soft); color: var(--vp-c-text-1); } }+</style>diff --git a/docs/.vitepress/theme/components/SiteSwitcher.vue b/docs/.vitepress/theme/components/SiteSwitcher.vuenew file mode 100644index 000000000..dda4e2148--- /dev/null+++ b/docs/.vitepress/theme/components/SiteSwitcher.vue@@ -0,0 +1,135 @@+<script setup lang="ts">+import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'+import { useData, withBase } from 'vitepress'++const { lang, page } = useData()+const zh = computed(() => lang.value.startsWith('zh'))+const home = computed(() => withBase(zh.value ? '/zh/' : '/en/'))+const root = ref<HTMLElement>()+const trigger = ref<HTMLButtonElement>()+const panel = ref<HTMLElement>()+const open = ref(false)+let hoverOpened = false+let timer: ReturnType<typeof setTimeout> | undefined+const sites = computed(() => [+ { label: zh.value ? '官网' : 'Website', description: zh.value ? '认识 OpenViking' : 'Discover OpenViking', href: 'https://www.openviking.ai/', icon: 'globe' },+ { label: 'Docs', description: zh.value ? '学习、接入与开发' : 'Learn, integrate and build', href: home.value, icon: 'book' },+ { label: 'Blog', description: zh.value ? '产品进展与实践' : 'Updates and field notes', href: 'https://blog.openviking.ai/', icon: 'article' },+ { label: 'GitHub', description: zh.value ? '源码、Issues 与贡献' : 'Source, issues and contributions', href: 'https://github.com/volcengine/OpenViking', icon: 'github' }+])+function clearTimer() { clearTimeout(timer) }+function close(restoreFocus = false) {+ clearTimer()+ open.value = false+ hoverOpened = false+ if (restoreFocus) trigger.value?.focus()+}+function enter(event: PointerEvent) {+ clearTimer()+ if (event.pointerType !== 'mouse' || !matchMedia('(hover: hover)').matches || open.value) return+ timer = setTimeout(() => { hoverOpened = true; open.value = true }, 120)+}+function leave() {+ clearTimer()+ timer = setTimeout(() => {+ if (!root.value?.contains(document.activeElement)) close()+ }, 180)+}+function toggle() {+ clearTimer()+ if (hoverOpened) { hoverOpened = false; return }+ open.value = !open.value+}+async function focusFirst() {+ clearTimer()+ hoverOpened = false+ open.value = true+ await nextTick()+ panel.value?.querySelector('a')?.focus()+}+function onKeydown(event: KeyboardEvent) {+ if (event.key === 'Escape' && open.value) {+ event.preventDefault()+ event.stopPropagation()+ close(true)+ }+ if (!open.value || !['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) return+ const links = Array.from(panel.value?.querySelectorAll<HTMLAnchorElement>('a') ?? [])+ const index = links.indexOf(document.activeElement as HTMLAnchorElement)+ if (index < 0) return+ event.preventDefault()+ const next = event.key === 'Home' ? 0 : event.key === 'End' ? links.length - 1+ : (index + (event.key === 'ArrowDown' ? 1 : -1) + links.length) % links.length+ links[next]?.focus()+}+function outside(event: PointerEvent) {+ if (!root.value?.contains(event.target as Node)) close()+}+function blur(event: FocusEvent) {+ if (!root.value?.contains(event.relatedTarget as Node)) close()+}+watch(() => page.value.relativePath, () => close())+onMounted(() => document.addEventListener('pointerdown', outside))+onUnmounted(() => { clearTimer(); document.removeEventListener('pointerdown', outside) })+</script>++<template>+ <div ref="root" class="ov-site-switcher" @pointerenter="enter" @pointerleave="leave" @focusout="blur" @keydown="onKeydown">+ <a class="ov-brand-link" :href="home" :aria-label="zh ? 'OpenViking 文档首页' : 'OpenViking documentation home'" @click="close()">+ <img class="ov-brand-light" :src="withBase('/brand-lockup-light.svg')" alt="OpenViking" width="136" height="26" />+ <img class="ov-brand-dark" :src="withBase('/brand-lockup-dark.svg')" alt="OpenViking" width="136" height="26" />+ </a>+ <span class="ov-brand-divider" aria-hidden="true">/</span>+ <button ref="trigger" type="button" class="ov-site-trigger" :aria-label="zh ? '切换站点' : 'Switch site'"+ :aria-expanded="open" aria-controls="ov-site-links" @click="toggle" @keydown.down.prevent.stop="focusFirst">+ <span>Docs</span>+ <svg width="12" height="12" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 6 4 4 4-4" /></svg>+ </button>+ <nav v-show="open" id="ov-site-links" ref="panel" class="ov-site-panel" :aria-label="zh ? 'OpenViking 站点' : 'OpenViking sites'">+ <a v-for="site in sites" :key="site.icon" :href="site.href" class="ov-site-option" :class="{ 'is-current': site.icon === 'book' }"+ :aria-current="site.icon === 'book' ? 'true' : undefined" @click="close()">+ <span class="ov-site-icon" aria-hidden="true">+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">+ <template v-if="site.icon === 'globe'"><circle cx="12" cy="12" r="9" /><path d="M3 12h18M12 3c5 5 5 13 0 18-5-5-5-13 0-18Z" /></template>+ <path v-else-if="site.icon === 'book'" d="M12 5c-3-2-6-2-9-1v15c3-1 6-1 9 1 3-2 6-2 9-1V4c-3-1-6-1-9 1Zm0 0v15" />+ <path v-else-if="site.icon === 'github'" fill="currentColor" stroke="none" d="M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61-.546-1.385-1.335-1.755-1.335-1.755-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 21.795 24 17.295 24 12c0-6.63-5.37-12-12-12z" />+ <template v-else><rect x="4" y="3" width="16" height="18" rx="2" /><path d="M8 8h8M8 12h8M8 16h5" /></template>+ </svg>+ </span>+ <span class="ov-site-copy"><span class="ov-site-name">{{ site.label }}</span><span class="ov-site-description">{{ site.description }}</span></span>+ <svg v-if="site.icon === 'book'" class="ov-site-status" width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.5" aria-hidden="true"><path d="m4 10 4 4 8-8" /></svg>+ <span v-else class="ov-site-arrow" aria-hidden="true">↗</span>+ </a>+ </nav>+ </div>+</template>++<style scoped>+.ov-site-switcher { position: relative; display: flex; align-items: center; gap: 10px; height: 64px; white-space: nowrap; }+.ov-brand-link { display: flex; align-items: center; flex-shrink: 0; min-height: 36px; border-radius: 5px; }+.ov-brand-link img { display: block; width: 136px; height: auto; }+.ov-brand-link .ov-brand-dark { display: none; }+:global(.dark .ov-brand-link .ov-brand-light) { display: none; }+:global(.dark .ov-brand-link .ov-brand-dark) { display: block; }+.ov-brand-divider { color: var(--vp-c-divider); font-size: 23px; font-weight: 300; }+.ov-site-trigger { display: flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 4px; border-radius: 6px; font: 400 13px/20px var(--vp-font-family-base); letter-spacing: 0; color: var(--vp-c-text-2); cursor: pointer; }+.ov-site-trigger[aria-expanded=true] { color: var(--vp-c-text-1); background: var(--vp-c-bg-soft); }+.ov-site-trigger svg { transition: transform 160ms ease-out; }+.ov-site-trigger[aria-expanded=true] svg { transform: rotate(180deg); }+.ov-site-panel { position: absolute; top: calc(100% - 3px); left: 0; z-index: 110; width: min(292px, calc(100vw - 32px)); padding: 8px; border: 1px solid var(--vp-c-divider); border-radius: 14px; background: var(--vp-c-bg-elv); box-shadow: 0 12px 36px #00000014, 0 2px 8px #00000008; }+.ov-site-option { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 8px; color: var(--vp-c-text-1); }+.ov-site-option + .ov-site-option { margin-top: 3px; }+.ov-site-option.is-current { background: var(--vp-c-brand-soft); }+.ov-site-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border: 1px solid var(--vp-c-divider); border-radius: 9px; color: var(--vp-c-text-2); }+.is-current .ov-site-icon { color: var(--vp-c-brand-1); border-color: transparent; background: var(--vp-c-bg); }+.ov-site-copy { display: flex; flex: 1; flex-direction: column; gap: 3px; }+.ov-site-name { font-size: 14px; font-weight: 600; line-height: 1.3; }+.ov-site-description { font-size: 12px; line-height: 1.4; color: var(--vp-c-text-2); }+.ov-site-arrow { color: var(--vp-c-text-3); font-size: 16px; }+.ov-site-status { color: var(--vp-c-brand-1); }+a:focus-visible, button:focus-visible { outline: 2px solid var(--vp-c-brand-1); outline-offset: 3px; }+@media (hover: hover) { .ov-site-option:hover, .ov-site-trigger:hover { background: var(--vp-c-bg-soft); } }+@media (prefers-reduced-motion: reduce) { .ov-site-trigger svg { transition: none; } }+@media (max-width: 720px) { .ov-site-switcher { height: 56px; gap: 4px; } .ov-brand-divider, .ov-site-trigger span { display: none; } .ov-site-trigger { padding: 0 2px; width: 16px; } }+@media (max-width: 374px) { .ov-brand-link img { width: 112px; } }+</style>diff --git a/docs/.vitepress/theme/components/ThemeToggle.vue b/docs/.vitepress/theme/components/ThemeToggle.vuenew file mode 100644index 000000000..8498bd815--- /dev/null+++ b/docs/.vitepress/theme/components/ThemeToggle.vue@@ -0,0 +1,16 @@+<script setup lang="ts">+import { computed } from 'vue'+import { useData } from 'vitepress'+const { isDark, lang } = useData()+const label = computed(() => lang.value.startsWith('zh')+ ? (isDark.value ? '切换到浅色模式' : '切换到深色模式')+ : (isDark.value ? 'Switch to light mode' : 'Switch to dark mode'))+</script>+<template>+ <button class="ov-mode-toggle" type="button" :aria-label="label" :title="label" @click="isDark = !isDark">+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">+ <template v-if="isDark"><circle cx="12" cy="12" r="5"/><path d="M12 1v2m0 18v2M4.22 4.22l1.42 1.42m12.72 12.72 1.42 1.42M1 12h2m18 0h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></template>+ <path v-else d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"/>+ </svg>+ </button>+</template>diff --git a/docs/.vitepress/theme/custom.css b/docs/.vitepress/theme/custom.cssindex 7fce1eb54..39457891e 100644--- a/docs/.vitepress/theme/custom.css+++ b/docs/.vitepress/theme/custom.css@@ -6,10 +6,10 @@--vp-c-brand-2: #1d4d42;--vp-c-brand-3: #347361;--vp-c-brand-soft: rgba(52, 115, 97, 0.07);- --vp-c-bg: #fafaf7;- --vp-c-bg-alt: #f2f3ef;- --vp-c-bg-elv: #ffffff;- --vp-c-bg-soft: #eeefeb;+ --vp-c-bg: #f5f4ed;+ --vp-c-bg-alt: #eceae0;+ --vp-c-bg-elv: #f5f4ed;+ --vp-c-bg-soft: #eceae0;--vp-c-text-1: #202723;--vp-c-text-2: #5c665f;--vp-font-family-base: "IBM Plex Sans", "LXGW Neo XiHei Screen Full", sans-serif;@@ -67,10 +67,10 @@--vp-c-brand-2: #c3e6cb;--vp-c-brand-3: #527b61;--vp-c-brand-soft: rgba(179, 213, 187, 0.07);- --vp-c-bg: #101312;- --vp-c-bg-alt: #141816;- --vp-c-bg-elv: #1b201d;- --vp-c-bg-soft: #1d231f;+ --vp-c-bg: #1a1917;+ --vp-c-bg-alt: #242320;+ --vp-c-bg-elv: #242320;+ --vp-c-bg-soft: #242320;--vp-c-text-1: #e9ece7;--vp-c-text-2: #a0aaa2;@@ -89,60 +89,6 @@user-select: none;}-.ov-docs-search {- display: flex;- align-items: center;- margin-right: 12px;-}--.ov-docs-search-trigger {- display: inline-flex;- align-items: center;- gap: 10px;- height: 40px;- min-width: 190px;- max-width: 260px;- padding: 0 10px 0 14px;- border: 1px solid var(--vp-c-divider);- border-radius: 8px;- background: var(--vp-c-bg-alt);- color: var(--vp-c-text-2);- font-size: 14px;- line-height: 1;- cursor: pointer;-}--.ov-docs-search-trigger:hover {- border-color: var(--vp-c-brand-1);- color: var(--vp-c-text-1);-}--.ov-docs-search-trigger-label {- flex: 1;- overflow: hidden;- text-align: left;- text-overflow: ellipsis;- white-space: nowrap;-}--.ov-docs-search-trigger-compact {- display: none;-}--.ov-docs-search-trigger kbd {- flex: 0 0 auto;- min-width: 46px;- padding: 4px 6px;- border: 1px solid var(--vp-c-divider);- border-radius: 6px;- background: var(--vp-c-bg);- color: var(--vp-c-text-3);- font-family: var(--vp-font-family-mono);- font-size: 11px;- font-weight: 600;- text-align: center;-}-.ov-docs-search-backdrop {position: fixed;inset: 0;@@ -323,25 +269,6 @@}@media (max-width: 767px) {- .ov-docs-search-trigger {- min-width: 72px;- width: 72px;- padding: 0 12px;- justify-content: center;- }-- .ov-docs-search-trigger-label,- .ov-docs-search-trigger kbd {- display: none;- }-- .ov-docs-search-trigger-compact {- display: inline;- color: var(--vp-c-text-2);- font-size: 13px;- font-weight: 600;- }-.ov-docs-search-backdrop {padding: 58px 12px 16px;}@@ -359,7 +286,6 @@margin-bottom: 16px;}-.doc-page-actions > .llms-link-wrap,.doc-page-actions > .copy-md-wrap {flex: 0 0 auto;margin-bottom: 0;diff --git a/docs/.vitepress/theme/docs-catalog.data.ts b/docs/.vitepress/theme/docs-catalog.data.tsindex 82de7d79a..bbb0d16ef 100644--- a/docs/.vitepress/theme/docs-catalog.data.ts+++ b/docs/.vitepress/theme/docs-catalog.data.ts@@ -1,7 +1,6 @@import path from 'node:path'import type { DefaultTheme } from 'vitepress'import { documentationSections } from '../docs-navigation.ts'-import { sections } from './docs-sections.ts'type CatalogPage = { title: string; href: string; file: string; group: string }@@ -23,10 +22,8 @@ export default {return Object.fromEntries(['en', 'zh'].map((locale: 'en' | 'zh') => [locale,documentationSections(locale).map(section => {const pages = collectPages(section.items || [])- const id = pages[0]?.href.split('/')[2]- const metadata = sections.find(item => item.id === id)- if (!metadata) throw new Error(`Missing documentation section: ${id}`)- return { ...metadata, [locale]: section.text, pages }+ const { items, text, groups, nextSteps, ...metadata } = section+ return { ...metadata, pages }})]))}diff --git a/docs/.vitepress/theme/docs-catalog.test.ts b/docs/.vitepress/theme/docs-catalog.test.tsindex ab88e6e60..bbdbabbdc 100644--- a/docs/.vitepress/theme/docs-catalog.test.ts+++ b/docs/.vitepress/theme/docs-catalog.test.ts@@ -1,35 +1,103 @@import assert from 'node:assert/strict'-import { existsSync } from 'node:fs'+import { existsSync, readdirSync, readFileSync } from 'node:fs'import { fileURLToPath } from 'node:url'import test from 'node:test'import catalog from './docs-catalog.data.ts'+import { documentationNav, documentationSidebars } from '../docs-navigation.ts'+import { legacyPages, sectionForPage, sections, type Locale } from './docs-sections.ts'const data = catalog.load()-for (const locale of ['en', 'zh']) {- test(`${locale} map links resolve without duplicate or retired entries`, () => {+for (const locale of ['en', 'zh'] as Locale[]) {+ test(`${locale}: every published article has one owner and a working sidebar`, () => {+ const root = fileURLToPath(new URL(`../../${locale}/`, import.meta.url))+ const files = readdirSync(root, { recursive: true }) as string[]+ const expected = files.filter(file => file.endsWith('.md') && file !== 'index.md')+ .map(file => file.slice(0, -3)).filter(file => !(file in legacyPages)).sort()const pages = data[locale].flatMap(section => section.pages)assert.equal(new Set(pages.map(page => page.href)).size, pages.length)+ assert.deepEqual(pages.map(page => page.href.slice(locale.length + 2)).sort(), expected)+ const sidebars = documentationSidebars(locale)+ const nav = documentationNav(locale)for (const page of pages) {assert.ok(existsSync(fileURLToPath(new URL(`../../${page.href.slice(1)}.md`, import.meta.url))), page.href)+ const owner = sectionForPage(`${page.href.slice(1)}.md`)!+ assert.ok(owner, page.href)+ assert.ok(sidebars[page.href], page.href)+ for (const suffix of ['', '.html', '/']) {+ const matches = nav.filter(item => 'activeMatch' in item && new RegExp(item.activeMatch!).test(page.href + suffix))+ assert.equal(matches.length, 1, `${page.href}${suffix}`)+ assert.equal(matches[0].text, owner[locale])+ }}- assert.deepEqual(data[locale][0].pages.map(page => page.file), [- '01-introduction.md', '02-quickstart.md', '04-setup-for-agent.md', '05-cli-setup.md'- ])+ for (const page of Object.keys(legacyPages)) assert.ok(sidebars[`/${locale}/${page}`])})- test(`${locale} map preserves sidebar order and compilation hierarchy`, () => {- const guides = data[locale].find(section => section.id === 'guides')!- const deployment = guides.pages.findIndex(page => page.file === '03-deployment.md')- const enterprise = guides.pages.slice(deployment + 1, deployment + 4)- assert.deepEqual(enterprise.map(page => page.file), [- '19-deployment-checklist.md', '20-private-deployment.md', '21-private-operations.md'- ])- assert.ok(enterprise.every(page => page.group.startsWith(`${guides.pages[deployment].group} / `)))- assert.equal(guides.pages[deployment + 4].file, '04-authentication.md')- assert.equal(guides.pages[deployment].group, guides.pages[deployment + 4].group)- const compilation = guides.pages.filter(page => page.href.includes('/context-compilation/'))- assert.ok(compilation.length > 0)- assert.ok(compilation.every(page => page.group.includes(' / ')))- assert.ok(!data[locale].some(section => section.id === 'context-compilation'))+ test(`${locale}: all concept articles stay together in learning order`, () => {+ const conceptPages = data[locale].find(section => section.id === 'concepts')!.pages+ const files = readdirSync(new URL(`../../${locale}/concepts/`, import.meta.url))+ .filter(file => file.endsWith('.md')).map(file => `/${locale}/concepts/${file.slice(0, -3)}`)+ assert.deepEqual(conceptPages.map(page => page.href).sort(), files.sort())+ for (const href of files) assert.equal(sectionForPage(`${href.slice(1)}.md`)?.id, 'concepts')+ assert.equal(conceptPages[0].href, `/${locale}/concepts/00-overview`)+ })++ test(`${locale}: onboarding exits use article titles without duplicating ownership`, () => {+ const start = sections.find(section => section.id === 'getting-started')!+ const sidebar = documentationSidebars(locale)[`/${locale}/${start.entry}`]+ assert.ok(Array.isArray(sidebar))+ const links = sidebar.flatMap(group => group.items ?? [])+ const owned = data[locale].find(section => section.id === start.id)!.pages+ for (const page of owned) {+ assert.equal(links.find(item => item.link === page.href)?.text, page.title)+ }+ const exits = start.nextSteps!.flatMap(group => group.pages)+ assert.ok(exits.length > 0)+ for (const exit of exits) {+ const href = `/${locale}/${exit.path}`+ const article = data[locale].flatMap(section => section.pages).find(page => page.href === href)+ assert.ok(article, `Exit has no owner: ${href}`)+ assert.notEqual(sectionForPage(`${locale}/${exit.path}.md`)?.id, start.id)+ assert.ok(!owned.some(page => page.href === href), `Exit duplicated in discovery: ${href}`)+ const item = links.find(item => item.link === href)!+ assert.equal(item.text?.split('<span')[0], article.title)+ assert.match(item.text!, /class="ov-sidebar-cross-link"/)+ assert.equal(item.target, undefined)+ }+ })++ test(`${locale}: every article uses its H1 as the sidebar and homepage title`, () => {+ for (const section of data[locale]) {+ for (const page of section.pages) {+ const source = readFileSync(new URL(`../../${page.href.slice(1)}.md`, import.meta.url), 'utf8')+ const heading = source.match(/^#\s+(.+)$/m)?.[1].trim()+ assert.ok(heading, `Missing H1: ${page.href}`)+ assert.equal(page.title, heading, page.href)+ }+ }+ })++ test(`${locale}: navigation uses task groups without excess nesting or retired pages`, () => {+ const sidebars = documentationSidebars(locale)+ for (const section of sections) {+ const sidebar = sidebars[`/${locale}/${section.entry}`]+ assert.ok(Array.isArray(sidebar))+ for (const group of sidebar) {+ assert.ok(group.items?.length)+ assert.ok(group.items.every(item => item.link && !item.items), group.text)+ }+ }+ const pages = data[locale].flatMap(section => section.pages)+ assert.ok(pages.some(page => page.href.endsWith('/api/12-acl')))+ assert.ok(pages.some(page => page.href.endsWith('/concepts/15-acl')))+ assert.ok(!pages.some(page => page.href.includes('/migration/') || page.href.includes('/design/')))+ assert.equal(sectionForPage(`${locale}/guides/20-private-deployment.md`)?.id, 'operate')+ assert.equal(sectionForPage(`${locale}/guides/09-ovpack.md`)?.id, 'build')+ assert.equal(sectionForPage(`${locale}/api/99-api-doc-writing-guide.md`)?.id, 'project')+ assert.equal(sectionForPage(`${locale}/configuration/01-server.md`)?.id, 'reference')})}++test('English and Chinese discovery maps expose the same pages in the same order', () => {+ assert.deepEqual(data.en.map(s => s.pages.map(p => p.href.replace('/en/', '/'))),+ data.zh.map(s => s.pages.map(p => p.href.replace('/zh/', '/'))))+})diff --git a/docs/.vitepress/theme/docs-sections.ts b/docs/.vitepress/theme/docs-sections.tsindex ae8738808..b00b31500 100644--- a/docs/.vitepress/theme/docs-sections.ts+++ b/docs/.vitepress/theme/docs-sections.ts@@ -1,11 +1,249 @@-// Descriptions and breadcrumb targets for the shared documentation navigation.-export const sections = [- { id: 'getting-started', en: 'Getting Started', zh: '开始使用', enNote: 'Install, connect, and run your first retrieval.', zhNote: '安装、连接服务,完成第一次检索。' },- { id: 'configuration', en: 'Configuration', zh: '配置', enNote: 'Server and client settings, field by field.', zhNote: '逐项查看服务端和客户端配置。' },- { id: 'agent-integrations', en: 'Agent Integrations', zh: 'Agent 集成', enNote: 'Give your agent memory across sessions.', zhNote: '让 Agent 在不同会话之间保留记忆。' },- { id: 'concepts', en: 'Concepts', zh: '核心概念', enNote: 'Understand the filesystem behind the context.', zhNote: '理解上下文背后的文件系统。' },- { id: 'guides', en: 'Guides', zh: '指南', enNote: 'Configure, deploy, and observe your service.', zhNote: '配置、部署和监控服务。' },- { id: 'api', en: 'API Reference', zh: 'API 参考', enNote: 'Resources, memory, retrieval, and administration.', zhNote: '资源、记忆、检索和管理接口。' },- { id: 'faq', en: 'FAQ', zh: '常见问题', enNote: 'Find answers when something gets in the way.', zhNote: '查找问题和解决办法。' },- { id: 'about', en: 'About', zh: '关于', enNote: 'Changelog, roadmap, and ways to contribute.', zhNote: '更新日志、路线图和参与方式。' }+// Editorial ownership is independent of file location. Existing URLs stay stable.+// This manifest owns grouping and order; article labels come from Markdown H1.+// Top navigation, sidebars, breadcrumbs, the homepage and llms.txt share this structure.+export type Locale = 'en' | 'zh'+export type DocPage = { path: string }+export type DocGroup = { en: string; zh: string; pages: DocPage[] }+export type DocSection = {+ id: string; en: string; zh: string; enNote: string; zhNote: string+ entry: string; aliases: string[]; groups: DocGroup[]+ nextSteps?: DocGroup[]+}+const p = (path: string): DocPage => ({ path })+const g = (en: string, zh: string, pages: DocPage[]): DocGroup => ({ en, zh, pages })++export const sections: DocSection[] = [+ {+ id: 'getting-started', en: 'Quickstart', zh: '开始使用',+ enNote: 'Get a first result, evaluate it on your tasks, and choose what to connect.', zhNote: '完成首次体验,用自己的任务验证效果,再选择接入路径。',+ entry: 'getting-started/01-introduction', aliases: [],+ groups: [+ g('Get your first result', '先完成一次体验', [+ p('getting-started/01-introduction'),+ p('getting-started/02-quickstart'),+ p('getting-started/05-cli-setup')+ ]),+ g('Evaluate the result', '验证实际效果', [+ p('getting-started/06-evaluate')+ ])+ ],+ // Cross-section exits aid onboarding without changing article ownership.+ nextSteps: [+ g('Use it in your work', '接入你的工作', [+ p('agent-integrations/01-overview'),+ p('workflows/01-overview'),+ p('context-compilation/01-overview'),+ p('guides/17-vikingbot')+ ]),+ g('Learn, deploy and troubleshoot', '深入与排障', [+ p('concepts/00-overview'),+ p('guides/00-overview'),+ p('guides/05-observability')+ ])+ ]+ },+ {+ id: 'concepts', en: 'Concepts', zh: '概念与原理',+ enNote: 'Learn the context model, processing flow, architecture and governance.', zhNote: '从上下文模型到处理机制、系统架构与治理。',+ entry: 'concepts/00-overview', aliases: [],+ groups: [+ g('Context model', '基础模型', [+ p('concepts/00-overview'),+ p('concepts/02-context-types'),+ p('concepts/04-viking-uri'),+ p('concepts/03-context-layers')+ ]),+ g('Processing and memory', '处理与记忆', [+ p('concepts/06-extraction'),+ p('concepts/07-retrieval'),+ p('concepts/08-session')+ ]),+ g('Architecture and reliability', '架构与可靠性', [+ p('concepts/01-architecture'),+ p('concepts/05-storage'),+ p('concepts/16-queue-lifecycle'),+ p('concepts/09-transaction'),+ p('concepts/14-multi-write-storage'),+ p('concepts/12-metrics')+ ]),+ g('Identity and governance', '身份与治理', [+ p('concepts/11-multi-tenant'),+ p('concepts/15-acl'),+ p('concepts/10-encryption'),+ p('concepts/13-privacy')+ ]),+ g('Application example', '应用示例', [+ p('concepts/15-vikingbot')+ ])+ ]+ },+ {+ id: 'agent-integrations', en: 'Agents', zh: '接入 Agent',+ enNote: 'Choose an integration, connect it, and verify memory behavior.', zhNote: '选择集成,完成接入,验证记忆行为。',+ entry: 'agent-integrations/01-overview', aliases: [],+ groups: [+ g('Choose an integration', '选择接入方式', [+ p('agent-integrations/01-overview'),+ p('agent-integrations/16-capability-reference'),+ p('agent-integrations/14-openviking-helper')+ ]),+ g('Coding tools', '编程工具', [+ p('agent-integrations/02-claude-code'),+ p('agent-integrations/04-codex'),+ p('agent-integrations/12-cursor'),+ p('agent-integrations/13-trae'),+ p('agent-integrations/10-opencode'),+ p('agent-integrations/17-dsh')+ ]),+ g('Agents and frameworks', 'Agent 与框架', [+ p('agent-integrations/03-openclaw'),+ p('agent-integrations/05-hermes'),+ p('agent-integrations/11-pi'),+ p('agent-integrations/07-langchain-langgraph'),+ p('agent-integrations/08-community-plugins')+ ]),+ g('Shared setup and tuning', '通用接入与调优', [+ p('agent-integrations/06-mcp-clients'),+ p('agent-integrations/15-agent-plugins'),+ p('agent-integrations/09-log-ingestion'),+ p('agent-integrations/19-recall-tuning'),+ p('agent-integrations/18-plugin-development')+ ]),+ g('VikingBot', 'VikingBot', [+ p('guides/17-vikingbot'),+ p('guides/12-vikingbot-metrics-validation')+ ])+ ]+ },+ {+ id: 'build', en: 'Develop', zh: '开发应用',+ enNote: 'Turn resources and sessions into reusable context and outputs.', zhNote: '把资源和会话用于检索、记忆与内容产出。',+ entry: 'workflows/01-overview', aliases: ['context-compilation'],+ groups: [+ g('Choose a workflow', '选择开发任务', [+ p('workflows/01-overview')+ ]),+ g('Manage context', '组织与维护上下文', [+ p('guides/18-openviking-assets'),+ p('guides/09-ovpack'),+ p('guides/15-snapshot'),+ p('guides/10-prompt-guide')+ ]),+ g('Compile context into outputs', '编译上下文', [+ p('context-compilation/01-overview'),+ p('context-compilation/02-llm-wiki'),+ p('context-compilation/03-knowledge-graph'),+ p('context-compilation/04-daily-report'),+ p('context-compilation/05-knowledge-distillation'),+ p('context-compilation/06-memory-consolidation')+ ])+ ]+ },+ {+ id: 'operate', en: 'Deploy', zh: '部署运维',+ enNote: 'Deploy a service, control access, monitor it, and upgrade it.', zhNote: '部署服务,配置访问控制,监控与升级。',+ entry: 'guides/00-overview', aliases: ['guides', 'faq'],+ groups: [+ g('Deploy a service', '部署服务', [+ p('guides/00-overview'),+ p('guides/03-deployment'),+ p('getting-started/04-setup-for-agent'),+ p('guides/01-configuration'),+ p('guides/02-volcengine-purchase-guide')+ ]),+ g('Enterprise deployment', '企业私有化部署', [+ p('guides/19-deployment-checklist'),+ p('guides/20-private-deployment'),+ p('guides/21-private-operations')+ ]),+ g('Secure access', '访问与安全', [+ p('guides/04-authentication'),+ p('guides/12-public-access'),+ p('guides/11-oauth'),+ p('guides/08-encryption')+ ]),+ g('Observe and troubleshoot', '观测与排障', [+ p('guides/05-observability'),+ p('guides/07-operation-telemetry'),+ p('guides/11-grafana-prometheus'),+ p('faq/faq')+ ]),+ g('Storage and performance', '存储与性能', [+ p('guides/13-multi-write-storage'),+ p('guides/14-ragfs-cache'),+ p('guides/16-cuvs')+ ])+ ]+ },+ {+ id: 'reference', en: 'Reference', zh: '参考',+ enNote: 'Look up API contracts, protocol details and configuration fields.', zhNote: '查接口约定、协议和配置字段。',+ entry: 'reference/01-overview', aliases: ['api', 'configuration'],+ groups: [+ g('Reference and configuration', '参考入口与配置', [+ p('reference/01-overview'),+ p('api/01-overview'),+ p('configuration/01-server'),+ p('configuration/02-client'),+ p('guides/06-mcp-integration')+ ]),+ g('Resources and retrieval APIs', '资源与检索 API', [+ p('api/02-resources'),+ p('api/12-content'),+ p('api/03-filesystem'),+ p('api/06-retrieval'),+ p('api/15-watches')+ ]),+ g('Sessions, memory and skills APIs', '会话、记忆与技能 API', [+ p('api/05-sessions'),+ p('api/16-memory'),+ p('api/04-skills'),+ p('api/19-agent-evolution')+ ]),+ g('Data and extension APIs', '数据与扩展 API', [+ p('api/11-snapshot'),+ p('api/14-ovpack'),+ p('api/22-openviking-assets'),+ p('api/20-webdav'),+ p('api/23-agent-runtime'),+ p('api/24-vikingbot')+ ]),+ g('Administration and operations APIs', '管理与运维 API', [+ p('api/08-admin'),+ p('api/12-acl'),+ p('api/10-privacy'),+ p('api/07-system'),+ p('api/17-tasks'),+ p('api/18-observer'),+ p('api/09-metrics')+ ])++ ]+ },+ {+ id: 'project', en: 'Community', zh: '社区',+ enNote: 'Follow releases and contribute to the project.', zhNote: '了解版本变化,参与项目与文档维护。',+ entry: 'about/01-about-us', aliases: ['about'],+ groups: [+ g('Community and releases', '社区与版本', [+ p('about/01-about-us'),+ p('about/02-changelog'),+ p('about/03-roadmap')+ ]),+ g('Contribute documentation', '参与文档维护', [+ p('api/99-api-doc-writing-guide')+ ])+ ]+ }]++// This retired page is kept for inbound links, but is not a second tutorial.+export const legacyPages: Record<string, string> = {+ 'getting-started/03-quickstart-server': 'getting-started'+}++export function sectionForPage(relativePath: string): DocSection | undefined {+ const path = relativePath.replace(/^(en|zh)\//, '').replace(/\.md$/, '')+ return sections.find(section => section.groups.some(group => group.pages.some(page => page.path === path)))+ || sections.find(section => section.id === legacyPages[path])+}diff --git a/docs/.vitepress/theme/header-language.css b/docs/.vitepress/theme/header-language.cssnew file mode 100644index 000000000..f0fb51176--- /dev/null+++ b/docs/.vitepress/theme/header-language.css@@ -0,0 +1,30 @@+/* Identical language control geometry across Docs and Blog. Theme tokens are adapters. */+.ov-language { position: relative; flex: 0 0 auto; color: var(--ov-header-ink); }+.ov-language > summary { display: flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; list-style: none; font: 400 12px/20px var(--ov-header-font); letter-spacing: .02em; white-space: nowrap; }+.ov-language > summary::-webkit-details-marker { display: none; }+.ov-language > summary::marker { content: ''; }+.ov-language > summary svg { flex-shrink: 0; }+.ov-language .ov-language-chevron { color: var(--ov-header-muted); transition: transform 150ms ease-out; }+.ov-language[open] .ov-language-chevron { transform: rotate(180deg); }+.ov-language[open] > summary { background: var(--ov-header-soft); }+.ov-language-options { position: absolute; right: 0; top: calc(100% + 8px); z-index: 110; width: 192px; padding: 5px; border: 1px solid var(--ov-header-line); border-radius: 8px; background: var(--ov-header-bg); box-shadow: 0 8px 24px #00000014, 0 2px 6px #00000008; }+.ov-language-options::before { content: ''; position: absolute; inset: -9px 0 auto; height: 9px; }+.ov-language-options button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 36px; padding: 8px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--ov-header-ink); font: 400 13px/20px var(--ov-header-font); letter-spacing: 0; text-align: left; cursor: pointer; }+.ov-language-options button[aria-pressed=true] { background: var(--ov-header-soft); }+.ov-language-options button svg { visibility: hidden; flex-shrink: 0; color: var(--ov-header-muted); }+.ov-language-options button[aria-pressed=true] svg { visibility: visible; }+.ov-language-options button:first-child { margin-bottom: 5px; }+.ov-language-options button:first-child::after { content: ''; position: absolute; top: 46px; left: 10px; right: 10px; border-top: 1px solid var(--ov-header-line); }+.ov-language :focus-visible { outline: 2px solid var(--ov-header-focus); outline-offset: 2px; }+@media (hover: hover) and (pointer: fine) {+ .ov-language > summary:hover, .ov-language-options button:hover { background: var(--ov-header-soft); }+}+@media (max-width: 720px) {+ .ov-language > summary { height: 36px; padding-inline: 6px; }+ .ov-language-options button { min-height: 44px; }+ .ov-language-options button:first-child::after { top: 54px; }+}+@media (prefers-reduced-motion: reduce) { .ov-language .ov-language-chevron { transition: none; } }++@media (max-width: 374px) { .ov-language > summary > svg:first-child { display: none; } }+@media (max-width: 374px) { .ov-language > summary { padding-inline: 4px; } }diff --git a/docs/.vitepress/theme/header-language.js b/docs/.vitepress/theme/header-language.jsnew file mode 100644index 000000000..f96a56638--- /dev/null+++ b/docs/.vitepress/theme/header-language.js@@ -0,0 +1,50 @@+// Shared interaction contract for Docs (Vue) and Blog (React).+// Native details remains usable before hydration; fine-pointer hover is additive.+export function bindLanguageMenu(root) {+ const trigger = root.querySelector('summary')+ let timer+ let hoverOpened = false+ const clear = () => clearTimeout(timer)+ const close = () => { clear(); root.open = false; hoverOpened = false }+ const enter = event => {+ clear()+ if (event.pointerType !== 'mouse' || !matchMedia('(hover: hover) and (pointer: fine)').matches || root.open) return+ timer = setTimeout(() => { root.open = true; hoverOpened = true }, 120)+ }+ const leave = () => {+ clear()+ timer = setTimeout(() => { if (!root.contains(document.activeElement)) close() }, 250)+ }+ const click = event => {+ clear()+ if (trigger.contains(event.target) && hoverOpened) { event.preventDefault(); hoverOpened = false }+ }+ const key = event => {+ if (event.key === 'Escape' && root.open) {+ event.preventDefault(); event.stopPropagation(); close(); trigger.focus(); return+ }+ if (!['ArrowDown', 'ArrowUp', 'Home', 'End', 'Enter', ' '].includes(event.key)) return+ if (['Enter', ' '].includes(event.key) && document.activeElement !== trigger) return+ const options = [...root.querySelectorAll('button')]+ const index = options.indexOf(document.activeElement)+ if (document.activeElement !== trigger && index < 0) return+ event.preventDefault(); clear(); root.open = true; hoverOpened = false+ const selected = options.findIndex(item => item.getAttribute('aria-pressed') === 'true')+ const next = ['Enter', ' '].includes(event.key) ? Math.max(0, selected) : event.key === 'Home' ? 0 : event.key === 'End' ? options.length - 1+ : index < 0 ? (event.key === 'ArrowUp' ? options.length - 1 : 0)+ : (index + (event.key === 'ArrowDown' ? 1 : -1) + options.length) % options.length+ options[next]?.focus()+ }+ const blur = event => { if (!root.contains(event.relatedTarget)) close() }+ const outside = event => { if (!root.contains(event.target)) close() }+ const toggle = () => { trigger.setAttribute('aria-expanded', String(root.open)); if (!root.open) hoverOpened = false }+ const events = { pointerenter: enter, pointerleave: leave, click, keydown: key, focusout: blur, toggle }+ for (const [name, fn] of Object.entries(events)) root.addEventListener(name, fn)+ document.addEventListener('pointerdown', outside)+ toggle()+ return () => {+ clear()+ for (const [name, fn] of Object.entries(events)) root.removeEventListener(name, fn)+ document.removeEventListener('pointerdown', outside)+ }+}diff --git a/docs/.vitepress/theme/header.css b/docs/.vitepress/theme/header.cssnew file mode 100644index 000000000..eaa5b4cd2--- /dev/null+++ b/docs/.vitepress/theme/header.css@@ -0,0 +1,54 @@+/* One-row header. Collapse section navigation before translated labels crowd the brand. */+:root { --vp-nav-height: 65px; }+.VPNav { --ov-header-ink: var(--vp-c-text-1); --ov-header-muted: var(--vp-c-text-2); --ov-header-bg: var(--vp-c-bg); --ov-header-soft: var(--vp-c-bg-soft); --ov-header-line: var(--vp-c-divider); --ov-header-focus: var(--vp-c-brand-1); --ov-header-font: var(--vp-font-family-base); }+.VPNav .VPNavBar { background: color-mix(in oklab, var(--vp-c-bg) 92%, transparent) !important; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: none; }+.VPNav .VPNavBar > .wrapper > .container { position: relative; width: 100%; max-width: 1280px; padding: 0 24px; }+.VPNav .VPNavBar > .wrapper > .container > .title, .VPNav .VPNavBar .content-body { height: 64px; }+.VPNav .VPNavBar > .wrapper > .container > .content { padding-left: 16px; }+.VPNav .VPNavBar .content-body { position: static !important; gap: 6px; }+.VPNav .VPNavBarMenu { position: static; order: 0; flex-shrink: 0; height: 64px; gap: 20px; }+.VPNav .VPNavBarMenuLink { padding: 0; height: 64px; line-height: 64px; font-size: 14px; }+.VPNav .VPNavBarMenuLink.active { box-shadow: inset 0 -2px var(--vp-c-brand-1); }+.VPNav .ov-docs-search { order: 2; flex-shrink: 0; margin: 0; }+.VPNav .ov-docs-search-trigger { display: grid; place-items: center; width: 36px; min-width: 36px; height: 36px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--vp-c-text-2); }+.VPNav .ov-docs-search-trigger:hover { background: var(--vp-c-bg-soft); color: var(--vp-c-text-1); }+.VPNav .ov-locale-switch { order: 3; margin: 0; }+.ov-mode-toggle { order: 4; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; background: transparent; border: 0; border-radius: 6px; color: var(--vp-c-text-1); cursor: pointer; transition: background-color .12s; }+.ov-mode-toggle:hover { background: var(--vp-c-bg-soft); }+.ov-mode-toggle:focus-visible, .VPNav .ov-docs-search-trigger:focus-visible, .ov-drawer-github:focus-visible { outline: 2px solid var(--vp-c-brand-1); outline-offset: 3px; }+.VPNav .VPNavBarAppearance, .VPNav .VPNavBarExtra, .VPNav .VPNavScreenAppearance, .VPNav .VPNavScreenSocialLinks { display: none; }+.VPNav .VPNavBarSocialLinks { display: none; }+.VPNav .VPNavBarSocialLinks::before { display: none; }+.VPNav .VPNavScreen { padding-inline: 24px; }+.VPNav .VPNavScreen > .container { max-width: 560px; padding: 16px 0 48px; }+.VPNav .VPNavScreenMenuLink { min-height: 48px; padding: 0 8px; }+.VPNav .VPNavScreenMenuLink.active { border-left: 2px solid var(--vp-c-brand-1); background: var(--vp-c-brand-soft); }+.ov-drawer-github { display: flex; align-items: center; min-height: 48px; padding-inline: 8px; margin-top: 16px; font-size: 13px; color: var(--vp-c-text-2); }+@media (max-width: 1279px) {+ :root { --vp-nav-height: 65px; }+ .VPNav .VPNavBarMenu, .VPNav .VPNavBarSocialLinks { display: none; }+ .VPNav .VPNavBarHamburger { display: flex; order: 5; width: 36px; flex-shrink: 0; }+ .VPNav .VPNavScreen { display: block; }+}+@media (max-width: 720px) {+ :root { --vp-nav-height: 57px; }+ .VPNav .VPNavBar > .wrapper > .container { padding-inline: 16px; }+ .VPNav .VPNavBar > .wrapper > .container > .title, .VPNav .VPNavBar .content-body { height: 56px; }+ .VPNav .VPNavBar > .wrapper > .container > .content { padding-left: 4px; }+ .VPNav .VPNavBar .content-body { gap: 4px; }+ .VPNav .ov-docs-search-trigger { width: 32px; min-width: 32px; }+ .VPNav .ov-mode-toggle { width: 34px; height: 34px; }+ .VPNav .VPNavBarHamburger { width: 32px; }+ .VPNav .VPNavScreen { padding-inline: 16px; }+}+@media (max-width: 374px) { .ov-language > summary > svg:first-child { display: none; } }++/* Blog Kami/Washi header palette; reading-content tokens remain independent. */+.VPNav { --vp-c-bg: #f5f4ed; --vp-c-bg-soft: #eceae0; --vp-c-bg-elv: #f5f4ed; --vp-c-text-1: #1a1a1a; --vp-c-text-2: #8c8578; --vp-c-divider: #d8d4c8; --vp-c-brand-1: #1B365D; --vp-nav-screen-bg-color: #f5f4ed; --vp-font-family-base: 'IBM Plex Sans', 'LXGW Neo XiHei Screen Full', system-ui, sans-serif; --vp-font-family-mono: 'OV Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-family: var(--vp-font-family-base); }+.dark .VPNav { --vp-c-bg: #1a1917; --vp-c-bg-soft: #242320; --vp-c-bg-elv: #1a1917; --vp-c-text-1: #e8e4da; --vp-c-text-2: #8c8578; --vp-c-divider: #3a3834; --vp-c-brand-1: #7b9ec4; --vp-nav-screen-bg-color: #1a1917; }+@media (min-width: 1280px) { .VPNav .ov-docs-search { margin-left: 18px; } }+@media (max-width: 374px) { .VPNav .ov-language > summary { padding-inline: 4px; } }++.VPNav .VPNavBar { z-index: 2; }+.VPNav .VPNavScreen { z-index: 1; }+.VPNav .VPNavScreenMenuLink:focus-visible, .VPNav .VPNavBarHamburger:focus-visible { outline: 2px solid var(--vp-c-brand-1); outline-offset: 2px; border-radius: 4px; }diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.tsindex c15ba64bf..fa734028d 100644--- a/docs/.vitepress/theme/index.ts+++ b/docs/.vitepress/theme/index.ts@@ -9,17 +9,20 @@ import MemoryExtractionDiagram from './components/MemoryExtractionDiagram.vue'import PathLockDiagram from './components/PathLockDiagram.vue'import StorageLayersDiagram from './components/StorageLayersDiagram.vue'import VikingBotOverviewDiagram from './components/VikingBotOverviewDiagram.vue'+import SidebarFooter from './components/SidebarFooter.vue'+import NavScreenFooter from './components/NavScreenFooter.vue'+import ThemeToggle from './components/ThemeToggle.vue'import LocaleSwitch from './components/LocaleSwitch.vue'-import { useData, withBase } from 'vitepress'+import { withBase } from 'vitepress'import type { EnhanceAppContext } from 'vitepress'import CopyMarkdownButton from './CopyMarkdownButton.vue'-import LlmsTxtLink from './LlmsTxtLink.vue'import OpenVikingSearch from './OpenVikingSearch.vue'import ApiExampleTabsEnhancer from './ApiExampleTabsEnhancer.vue'import { initVikingBotWidget, syncVikingBotLocale } from './vikingbot-widget'import { trackPageView } from './track'import './custom.css'import './reading.css'+import './header.css'type OpenVikingPreference = {theme?: 'light' | 'dark'@@ -188,7 +191,7 @@ function watchThemePreference() {})}-function mainSiteUrlWithPreference(href: string) {+function mainSiteUrlWithPreference(href: string, useLocalPreview = true) {const url = new URL(href, window.location.href)const isLocalDocs = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'const isMainSite = MAIN_SITE_HOSTS.has(url.host)@@ -196,7 +199,7 @@ function mainSiteUrlWithPreference(href: string) {if (!isMainSite) return undefinedif (- isLocalDocs &&+ useLocalPreview && isLocalDocs &&['www.openviking.ai', 'openviking.ai', 'www.openviking.net', 'openviking.net'].includes(url.hostname)@@ -218,7 +221,7 @@ function syncPreferenceToMainSiteLinks() {const link = event.target instanceof Element ? event.target.closest('a') : nullif (!link) return- const url = mainSiteUrlWithPreference(link.href)+ const url = mainSiteUrlWithPreference(link.href, !link.closest('.ov-site-switcher'))if (!url) returnconst preference = mergePreferences(readPersistedPreference(), {@@ -254,19 +257,14 @@ if (typeof window !== 'undefined') {export default {extends: DefaultTheme,Layout() {- const { lang } = useData()- const zh = lang.value.startsWith('zh')return h(DefaultTheme.Layout, null, {'doc-before': () => [h(DocBreadcrumb), h('div', { class: 'doc-page-actions' }, [- h(LlmsTxtLink),h(CopyMarkdownButton)])],- 'sidebar-nav-before': () => h('a', { class: 'sidebar-home-link', href: withBase(zh ? '/zh/' : '/en/') }, zh ? '← 文档首页' : '← Documentation home'),- 'sidebar-nav-after': () => h('a', { class: 'sidebar-font-license-link', href: withBase('/font-licenses.html'), target: '_self' }, zh ? '字体许可' : 'Font licenses'),+ 'sidebar-nav-after': () => h(SidebarFooter),'doc-after': () => h(ApiExampleTabsEnhancer),- 'nav-bar-content-before': () => h(OpenVikingSearch),- 'nav-bar-content-after': () => h(LocaleSwitch),- 'nav-screen-content-after': () => h(LocaleSwitch)+ 'nav-bar-content-after': () => [h(OpenVikingSearch), h(LocaleSwitch), h(ThemeToggle)],+ 'nav-screen-content-after': () => h(NavScreenFooter)})},enhanceApp({ app, router }: EnhanceAppContext) {diff --git a/docs/.vitepress/theme/reading.css b/docs/.vitepress/theme/reading.cssindex 7de70a760..26760edf6 100644--- a/docs/.vitepress/theme/reading.css+++ b/docs/.vitepress/theme/reading.css@@ -1,20 +1,18 @@-:root { --vp-c-divider: #20272320; --vp-sidebar-width: 280px; }+:root { --vp-c-divider: #20272320; --vp-sidebar-width: 280px; --vp-sidebar-bg-color: var(--vp-c-bg); }.dark { --vp-c-divider: #e9ece71c; }.VPHome { margin-bottom: 0 !important; }.VPNavBarTitle .title { font-size: 16px; letter-spacing: -.035em; }.VPNavBarTitle .logo { width: 136px; height: auto; aspect-ratio: 500.05 / 92.94; object-fit: contain; margin-right: 0; }.VPNavBarTitle .title::after { content: ' / docs'; font-family: var(--vp-font-family-mono); font-size: 11px; color: var(--vp-c-text-2); margin-left: 10px; letter-spacing: 0; font-weight: 400; }.VPNavBarMenuLink { font-size: 14px !important; }-.ov-docs-search-trigger { border-radius: 5px; height: 34px; min-width: 155px; background: transparent; font-size: 14px; }-.ov-docs-search-trigger kbd { font-size: 10px; min-width: 38px; border: 0; background: var(--vp-c-bg-alt); }.doc-breadcrumb { display: flex; flex-wrap: wrap; align-items: baseline; gap: 9px; margin-bottom: 22px; font-size: 13px; line-height: 1.6; color: var(--vp-c-text-2); }.doc-breadcrumb a:hover { color: var(--vp-c-brand-1); }.doc-breadcrumb [aria-current] { color: var(--vp-c-text-1); }.doc-breadcrumb > span:not([aria-current]) { opacity: .4; }-.sidebar-home-link { display: block; padding: 8px 0 22px; margin-bottom: 5px; font-size: 14px; color: var(--vp-c-text-2); border-bottom: 1px solid var(--vp-c-divider); }-.sidebar-home-link:hover { color: var(--vp-c-brand-1); }-.sidebar-font-license-link { display: block; margin-top: 24px; padding: 12px 0 24px; border-top: 1px solid var(--vp-c-divider); font-size: 12px; line-height: 18px; color: var(--vp-c-text-3); transition: color 0.25s; }-.sidebar-font-license-link:hover { color: var(--vp-c-text-2); }+.sidebar-footer-links { position: sticky; bottom: 0; z-index: 2; display: flex; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; min-height: 64px; padding: 12px 0; background: var(--vp-sidebar-bg-color); border-top: 1px solid var(--vp-c-divider); font-size: 12px; line-height: 18px; }+.sidebar-footer-links a { color: var(--vp-c-text-3); transition: color 0.25s; }+.sidebar-footer-links a:hover { color: var(--vp-c-text-2); }+.sidebar-footer-links a:focus-visible { outline: 2px solid var(--vp-c-brand-1); outline-offset: 3px; }.VPSidebarItem.level-0 > .item .text { font-size: 14px; letter-spacing: 0; }.VPSidebarItem.level-1 > .item .text { font-size: 14px; }.VPSidebarItem.is-active > .item > .link { background: var(--vp-c-brand-soft); border-radius: 4px; padding-inline: 8px; margin-inline: -8px; }@@ -45,7 +43,7 @@.VPFooter { background: var(--vp-c-bg-alt); }.VPFooter .message, .VPFooter .copyright { font-size: 11px; }@media (min-width: 960px) { .VPDoc .content-container { max-width: 760px !important; } }-@media (max-width: 767px) { .VPNavBarTitle .title::after { display: none; } .ov-docs-search-trigger { min-width: 58px; width: 58px; } .vp-doc { font-size: 17px; } .vp-doc h1 { font-size: 31px; } .vp-doc h2 { font-size: 25px; } .doc-breadcrumb { font-size: 12px; } }+@media (max-width: 767px) { .VPNavBarTitle .title::after { display: none; } .vp-doc { font-size: 17px; } .vp-doc h1 { font-size: 31px; } .vp-doc h2 { font-size: 25px; } .doc-breadcrumb { font-size: 12px; } }/* Use identical geometry before hydration and on every route. VitePress adds.has-sidebar after rendering; it must not reposition the header children. */@@ -75,11 +73,6 @@.VPNav .VPNavBarSocialLinks { order: 4; }.VPNav .VPNavBarExtra { order: 5; }.VPNav .VPNavBarHamburger { order: 6; }-@media (max-width: 1279px) and (min-width: 768px) {- .VPNav .ov-docs-search-trigger { min-width: 72px; width: 72px; padding-inline: 10px; }- .VPNav .ov-docs-search-trigger-label, .VPNav .ov-docs-search-trigger kbd { display: none; }- .VPNav .ov-docs-search-trigger-compact { display: inline; }-}@media (max-width: 800px) {.VPNav .VPNavBar > .wrapper > .container { width: calc(100% - 48px); }}@@ -94,7 +87,23 @@.VPNav .VPNavBarTitle .title { font-size: 13px; }.VPNav .VPNavBarTitle .logo { width: 112px; height: auto; margin-right: 0; }.VPNav .VPNavBar .content-body { gap: 5px; }- .VPNav .ov-docs-search-trigger { width: 43px; min-width: 43px; padding: 0 4px; }}.vp-doc a.VPButton { text-decoration: none; }++/* Cross-section exits stay in the current tab; the icon signals a sidebar-context change. */+.ov-sidebar-cross-link { display: inline-flex; vertical-align: -1px; margin-left: 5px; color: var(--vp-c-text-3); }+.ov-sidebar-cross-link svg { flex-shrink: 0; }++/* The sidebar scrolls; its footer remains at the bottom on short and long pages. */+.VPSidebar { padding-bottom: 0 !important; }+.VPSidebar > .nav { display: flex; flex-direction: column; min-height: 100%; }+.VPSidebar > .nav > .group { flex-shrink: 0; }+.sidebar-github-link { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 6px; }+.sidebar-github-link svg { width: 18px; height: 18px; }+.sidebar-github-link:hover { background: var(--vp-c-bg-soft); }+/* GitHub-style Markdown checklists are status indicators, not editable forms. */+.vp-doc .contains-task-list { list-style: none; padding-left: 0; }+.vp-doc .task-list-item { position: relative; padding-left: 26px; }+.vp-doc .task-list-item-checkbox { position: absolute; left: 0; top: .48em; width: 15px; height: 15px; margin: 0; accent-color: var(--vp-c-brand-1); }+.vp-doc .task-list-item > p { margin-block: 0; }diff --git a/docs/en/about/01-about-us.md b/docs/en/about/01-about-us.mdindex 7afc9063d..a92c490ce 100644--- a/docs/en/about/01-about-us.md+++ b/docs/en/about/01-about-us.md@@ -4,6 +4,8 @@OpenViking is an open-source context database for AI agents, initiated and maintained by the Viking team at ByteDance's Volcengine. It organizes resources, memories, and skills as files that agents can browse, search, and read on demand.+[View OpenViking on GitHub](https://github.com/volcengine/OpenViking)+## Team Introduction### Viking Team Backgrounddiff --git a/docs/en/agent-integrations/01-overview.md b/docs/en/agent-integrations/01-overview.mdindex 63f2e0e28..04cbbe8d0 100644--- a/docs/en/agent-integrations/01-overview.md+++ b/docs/en/agent-integrations/01-overview.md@@ -1,4 +1,4 @@-# Agent Integrations Overview+# Choose an agent integrationOpenViking can act as the long-term memory and context backend for many agent runtimes. Pick the integration that matches your agent.@@ -35,41 +35,4 @@ Every integration on this page connects to a running OpenViking server. If you d## Low-latency recall-Query expansion and recall compression add model calls. Disable both when response time takes priority; retrieval, budgets, and cross-turn deduplication remain enabled:--```bash-export OPENVIKING_RECALL_QUERY_EXPANSION=off-export OPENVIKING_RECALL_COMPRESS=off-```--Or configure them in `~/.openviking/ovcli.conf`:--```json-{- "plugin": {- "recallQueryExpansion": "off",- "recallCompress": "off"- }-}-```--### Choose a compression mode--| Value | Behavior |-| --- | --- |-| `off` | Do not compress recall results |-| `server` | Request compression on the OpenViking server |-| `client` | Use a local compressor only; supported by Claude Code and Codex |-| `auto` | Prefer a local compressor when available; otherwise request automatic server processing |--Claude Code and Codex default to `auto`. Their local compressors are `claude -p` and `codex exec`; see [§3.2.5](./16-capability-reference.md#_3-2-5-recall-digest). Other integrations that support cloud compression retain `off` as their default and require explicit opt-in. Server compression is supported by Claude Code, Codex, OpenCode, DSH, pi, Cursor, TRAE, TRAE CN, ZCode, OpenClaw, and Hermes. It requires a server with context-search rewrite support.--These settings control automatic recall. Explicit MCP `search` calls use the arguments supplied in that call. See the [shared plugin documentation](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression) for details and older-server fallback behavior.--Shared plugins read the `plugin` section in `ovcli.conf`; `plugin.<harness>` overrides a setting for one client. Environment variables take precedence; the older `OPENVIKING_RECALL_REWRITE` still works as an alias for `OPENVIKING_RECALL_COMPRESS`. See [Plugin settings](../configuration/02-client.md#plugin-settings). Restart the agent after changing settings so its hooks load the new configuration. These are plugin-client settings; the server's `ov.conf` does not need to change.--### Request timeout--Query expansion, retrieval, and digest compression run in sequence. Query expansion defaults to a 5-second timeout (`retrieval.recall_intent_timeout_s`); digest rewriting defaults to 30 seconds (`retrieval.recall_rewrite_timeout_s`).--`OPENVIKING_RECALL_CONTEXT_TIMEOUT_MS` or `plugin.recallContextTimeoutMs` sets the client's timeout for the entire context request. When unset, the client waits the plugin's ordinary timeout, raised to at least 15 seconds when the request carries a session and query expansion is not `off` and at least 45 seconds when it asks for a digest. An override should exceed the server timeouts the request will spend and stay below the host's hook timeout. Ending the request early discards the entire response.+After verifying the integration, use [Tune recall latency](19-recall-tuning.md) to configure query expansion, result compression and timeouts.diff --git a/docs/en/agent-integrations/02-claude-code.md b/docs/en/agent-integrations/02-claude-code.mdindex b42c2ccf0..30dc3413e 100644--- a/docs/en/agent-integrations/02-claude-code.md+++ b/docs/en/agent-integrations/02-claude-code.md@@ -1,4 +1,4 @@-# Claude Code Memory Plugin+# Claude CodeGive [Claude Code](https://docs.claude.com/en/docs/claude-code/overview) cross-project and cross-session long-term memory. Once installed, every conversation automatically recalls relevant memories and captures new content without requiring the model to make any tool calls.diff --git a/docs/en/agent-integrations/03-openclaw.md b/docs/en/agent-integrations/03-openclaw.mdindex 6ac8c76c4..84393a756 100644--- a/docs/en/agent-integrations/03-openclaw.md+++ b/docs/en/agent-integrations/03-openclaw.md@@ -1,4 +1,4 @@-# OpenClaw Plugin+# OpenClawAdd long-term memory to [OpenClaw](https://github.com/openclaw/openclaw). After installation, OpenClaw automatically remembers important facts from conversations and recalls relevant context before every reply.diff --git a/docs/en/agent-integrations/04-codex.md b/docs/en/agent-integrations/04-codex.mdindex 40e5db45b..b7f3d2fd4 100644--- a/docs/en/agent-integrations/04-codex.md+++ b/docs/en/agent-integrations/04-codex.md@@ -1,4 +1,4 @@-# Codex Memory Plugin+# CodexGive [Codex](https://developers.openai.com/codex) cross-session memory. Hooks handle automatic recall, capture, and session commits; MCP tools let the model search, read, and manage memories.diff --git a/docs/en/agent-integrations/05-hermes.md b/docs/en/agent-integrations/05-hermes.mdindex f646dba04..f915c1440 100644--- a/docs/en/agent-integrations/05-hermes.md+++ b/docs/en/agent-integrations/05-hermes.md@@ -1,4 +1,4 @@-# Hermes Agent+# Hermes[Hermes Agent](https://hermes-agent.nousresearch.com/) by Nous Research has a first-class OpenViking memory provider built in. No plugin to install — just point Hermes at your OpenViking server and it handles memory storage, recall, and extraction natively.diff --git a/docs/en/agent-integrations/07-langchain-langgraph.md b/docs/en/agent-integrations/07-langchain-langgraph.mdindex f67157839..0c22d8cfe 100644--- a/docs/en/agent-integrations/07-langchain-langgraph.md+++ b/docs/en/agent-integrations/07-langchain-langgraph.md@@ -1,4 +1,4 @@-# LangChain and LangGraph+# LangChain / LangGraphWire OpenViking into your LangChain or LangGraph agent as the context backend. Thestandalone integration package provides a retriever, chat history, context wrapper,diff --git a/docs/en/agent-integrations/10-opencode.md b/docs/en/agent-integrations/10-opencode.mdindex 999320c73..dcc55b0ec 100644--- a/docs/en/agent-integrations/10-opencode.md+++ b/docs/en/agent-integrations/10-opencode.md@@ -1,4 +1,4 @@-# OpenCode Plugin+# OpenCodeGive [OpenCode](https://opencode.ai/) cross-project and cross-session long-term memory plus indexed repository context. Once installed, every conversation automatically recalls relevant memories and captures new content through OpenCode plugin hooks, while model-callable tools come from the same OpenViking stdio MCP proxy used by the Claude Code and Codex memory plugins.diff --git a/docs/en/agent-integrations/11-pi.md b/docs/en/agent-integrations/11-pi.mdindex 440837cbd..adadcafd2 100644--- a/docs/en/agent-integrations/11-pi.md+++ b/docs/en/agent-integrations/11-pi.md@@ -1,4 +1,4 @@-# pi Coding Agent Extension+# piGive [pi](https://github.com/earendil-works/pi) cross-session long-term memory and context takeover. Recall, capture, and takeover run on pi's native extension API: recall happens automatically before every prompt, conversation turns are captured after every turn, and OpenViking can replace committed local history with an archive overview in pi's `context` hook. The extension uses the official MCP client and registers the server's MCP tools as native pi tools.diff --git a/docs/en/agent-integrations/12-cursor.md b/docs/en/agent-integrations/12-cursor.mdindex 822535776..574975bc5 100644--- a/docs/en/agent-integrations/12-cursor.md+++ b/docs/en/agent-integrations/12-cursor.md@@ -1,4 +1,4 @@-# Cursor Memory Integration+# CursorGive Cursor long-term memory across projects and sessions. After installation, OpenViking Hooks inject relevant context at session start and before each request, then capture new conversation turns after the response. MCP is available for explicit memory search, reading, and management.diff --git a/docs/en/agent-integrations/13-trae.md b/docs/en/agent-integrations/13-trae.mdindex d2f01199c..1bc7391f3 100644--- a/docs/en/agent-integrations/13-trae.md+++ b/docs/en/agent-integrations/13-trae.md@@ -1,4 +1,4 @@-# TRAE, TRAE CN, and TraeCode CLI 2.0 Memory Integration+# TRAEGive TRAE, TRAE CN, and TraeCode CLI 2.0 long-term memory across projects and sessions. OpenViking Hooks automatically load relevant context, capture each conversation turn, and commit it for memory extraction. MCP remains available for explicit memory search, reading, and management.diff --git a/docs/en/agent-integrations/16-capability-reference.md b/docs/en/agent-integrations/16-capability-reference.mdindex 3ab1f09f7..a24812b22 100644--- a/docs/en/agent-integrations/16-capability-reference.md+++ b/docs/en/agent-integrations/16-capability-reference.md@@ -1,742 +1,729 @@-# Integration Capability Reference+<a id="compare-agent-integration-capabilities"></a>-**Hermes scope:** The Hermes rows describe its [bundled provider](https://github.com/NousResearch/hermes-agent/tree/989798cd5e691230b54b2ea72e5937b68133014c/plugins/memory/openviking),-checked against Hermes main `989798cd5e`. The [OpenViking-maintained external plugin](https://github.com/volcengine/OpenViking/tree/main/examples/hermes-plugin)-has additional commit, recall, and mirroring behavior. The bundled copy takes-precedence while present; use the [normal setup guide](./05-hermes.md) for it.+# Agent integration capabilities-## Reading guide+This page compares what each OpenViking agent integration does after it is installed. Use it to answer three questions before you rely on an integration:-| What you want to know | Where to look |-|---|---|-| Which tools an agent can call autonomously per harness | [§1.1](#_1-1-active-tool-surface-agentic-calls) Active tool surface + [§2.1](#_2-1-server-side-mcp-tool-surface) (MCP surface) + the profile cards |-| How memory archiving behaves under different shutdown methods | **[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) Shutdown path × harness end-state matrix** |-| Whether auto-recall includes `session_id`, and its impact | [§3.2.2](#_3-2-2-decision-matrix) / [§3.2.3](#_3-2-3-profile-opening-injection) |-| How to enable recall digests, and the workload distribution between server and client | [§3.2.5](#_3-2-5-recall-digest) |-| Type boundaries for `forget` and delete operations | [§3.5](#_3-5-type-boundaries-for-writes-and-deletes) |-| Which environment variables apply to specific harnesses | [§3.1.4](#_3-1-4-configuration-layers) Configuration layering + "Config" on each profile card |-| Whether the server provides an automatic commit fallback | [§2.3](#_2-3-server-side-session-and-commit-semantics) |-| The complete `ov` CLI command set | [§5](#_5-ov-cli-command-reference) |-| How to integrate a custom agent with OpenViking | [§6](#_6-custom-agent-integration-guide) |-| Installation, configuration, and troubleshooting for specific integrations | The integration's own page (linked in the first line of each profile card in [§4](#_4-harness-profile-cards)) |-------# 1. Capability overview--## 1.1 Active tool surface (agentic calls)--- **MCP-based harnesses (claude-code, codex/trae-cli, cursor, trae/trae-cn, zcode, kimicode, opencode, dsh, pi) share an identical active tool surface comprising 20 tools.** The server centrally defines these tools. The plugins read `~/.openviking/ovcli.conf` and connect to the server-defined MCP tools. pi uses the official MCP client inside its extension and registers the discovered tools as native pi tools.--- `trae-cli` means TraeCode CLI 2.0 (2.0 only). It is installed via a `codex` plugin alias and maintains format compatibility with `codex`. Therefore, it is consolidated into the `codex` row in the matrices below.--| harness | tool surface | tools (enabled by default) | search memory | search resource | search skill | write memory | write resource | write skill | delete type boundary |-|---|---|---|---|---|---|---|---|---|---|-| claude-code | MCP passthrough | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| codex / trae-cli | MCP passthrough | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| cursor | MCP passthrough | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| trae / trae-cn | MCP passthrough | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| zcode | MCP passthrough | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| kimicode | MCP passthrough | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| opencode | MCP passthrough (host adds an `openviking_` prefix) | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| dsh | MCP passthrough (`@deepseek-ai/dsh-mcp-client` → the shared stdio proxy; host adds an `mcp__openviking__` prefix) | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| pi | MCP mirror (official client; extension adds an `openviking_` prefix) | 20, i.e. whatever `tools/list` returns (registration has preconditions³) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | no type distinction² |-| openclaw | native registration (15 × `memory_*`/`ov_*` and friends) | 15 (14 on by default⁴) | ✅ `memory_recall` | ✅ `ov_search` (both scopes by default) | ✅ `ov_search` | ✅ `memory_store` | off by default⁴ | ✅ `add_skill` | memory-only allowlist + auto-delete only for a single candidate with score≥0.85 |-| hermes | native registration (6 × `viking_*`) | 6 (all on once the provider is active) | ✅ | ✅ | ✅ | ✅ `viking_remember` (dedicated session and asynchronous extraction) | ✅ multi-protocol ingest (HTTP/Git/SSH/local file/directory zip) | ❌ | memory-only + `.md` leaf check |-| ov CLI | CLI commands | ~40 command groups | ✅ `ov find` | ✅ `ov find` | ✅ `ov find` | ✅ `ov add-memory` | ✅ `ov add-resource` | ✅ `ov add-skill` | `ov rm` executes directly (TUI deletion asks for confirmation and blocks root/scope deletes) |--¹ MCP `write` rejects the user's own `skills/` subtree; under `viking://agent/skills` it writes a plain file that skips skill installation (no frontmatter abstract, no privacy extraction), so use `add_skill` there too. Skills are created, installed, and replaced through the MCP `add_skill` tool (inline SKILL.md text, a Git URL, or a signed upload of a local directory or zip), which shares one install implementation with REST `POST /api/v1/skills`.-² MCP `forget` does not differentiate between memory, resource, and skill types. However, the storage layer protects namespace roots: deletion requests for bare `viking://`, `viking://user`, and `viking://agent` are rejected. See [§3.5](#_3-5-type-boundaries-for-writes-and-deletes).-³ The `pi` harness registers a tool only if the session misses `bypassSessionPatterns`, `client.health()` passes, `ensureSession` succeeds, and the `/mcp` handshake returns a tool list (`index.ts:150-205`); the shared `mcpEnabled: false` skips the bridge entirely and is not counted as a failure. A failed handshake costs the session its OpenViking tools and nothing else — recall, session sync and takeover carry on — and `before_agent_start` retries it on a later turn (`index.ts:252-255`), so a server started after pi is picked up without a restart. See [§3.6](#_3-6-degradation-and-fault-tolerance).-⁴ The `add_resource` tool in openclaw requires a double opt-in before activation.--**Skill addition/deletion boundaries**: Skills can be added via the MCP `add_skill` tool, the openclaw `add_skill` tool (enabled by default), the `ov add-skill` CLI command, or the REST API. Deletion operates across four tiers, detailed in [§3.5](#_3-5-type-boundaries-for-writes-and-deletes).--## 1.2 Automatic hook surface (driven by the harness)--| harness | how it plugs in | auto-recall | recall carries session_id | digest (client)* | profile injection | takes over host compaction | offline compensation | statusline |-|---|---|---|---|---|---|---|---|---|-| claude-code | 9 hooks + MCP proxy + slash + statusline + skill | ✅ | ✅ | ✅ local `claude -p` / server-side rewrite (auto by default) | ✅ (10000) + `<available-skills>` (1200) | ❌ (PreCompact only commits) | ✅ | ✅ |-| codex / trae-cli | 6 hooks + MCP proxy + skill | ✅ | ✅ | ✅ local `codex exec` (on by default) | ✅ (10000) + `<available-skills>` (1200) | ❌ | ✅ transcript + cursor | ❌ |-| cursor | 6 hooks + MCP proxy + rule + skill | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200) | ❌ | ✅ | ❌ |-| trae / trae-cn | 4 hooks + MCP proxy | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200) | ❌ | ✅ | ❌ |-| zcode | 4 hooks + MCP proxy | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200) | ❌ | ✅ | ❌ |-| kimicode | 7 native plugin hooks + MCP proxy | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200), first successful prompt load | ❌ (PreCompact only captures/commits) | ✅ | ❌ |-| opencode | dual-stack v1/v2 plugin hooks + MCP proxy | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200) + repo list into the system prompt | ❌ (commit after compaction only) | ✅ | ❌ |-| dsh | native Cordis plugin (same process) + MCP proxy + skill | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200), once per session | ❌ | ✅ | ❌ |-| pi | native extension (9 events) | ✅ | ✅ | ❌ | ✅ (10000) + `<available-skills>` (1200), rebuilt into systemPrompt every turn | ✅ **takeover** (on by default) | ✅ | ✅ |-| openclaw | context-engine plugin (`ownsCompaction:true`) | ✅ | ❌ (goes through `/find`, which has no session_id field) | ❌ | ❌ | ✅ **full ContextEngine takeover** | ❌ failed turns are not replayed | ❌ |-| hermes | native MemoryProvider plugin | ✅ | partial (preferred `search/search` path only; the degraded `/find` path drops it) | ❌ | ✅ (6000-token session-start memory budget) | ❌ | ✅ in-process uploads; durable pending-commit markers | ❌ |-| ov CLI | one-shot commands | ❌ (`ov find/search` are explicit commands) | — (`ov search --session-id` is an explicit argument) | ❌ | ❌ | ❌ | ❌ | ❌ |--\* This column indicates whether the client performs its own local compression of recall results. On the server side, the context retrieval API provides digest capabilities equally to all callers via the `rewrite` parameter (see [§3.2.5](#_3-2-5-recall-digest)).--In the profile injection column, the first number is the default `profileTokenBudget` and the number after `<available-skills>` is the separate `skillCatalogTokenBudget` default ([§3.2.3](#_3-2-3-profile-opening-injection)).--**Current status of `session_id`**: With the exception of openclaw (whose `/find` endpoint lacks this field) and the degraded path in hermes, auto-recall on all harnesses explicitly carries a `session_id`. This behavior is enforced by a cross-plugin regression test (`examples/memory-plugin-shared/recall-session-wiring.test.mjs:16-39`).--## 1.3 Grouping by form--- **Full suite** (hook automation + MCP tool surface + surrounding UX): claude-code and codex (`trae-cli` is installed via an alias and is included here).-- **Thin hook** (sharing `agent-hook-runtime`, meaning core behaviors are essentially identical, with differences limited to host events, transcript decoding, and thresholds): cursor, trae/trae-cn, zcode, and kimicode.-- **Plugin event**: opencode (offers the richest host event surface; `dispose` handles shutdown).-- **Native in-process**: dsh (Cordis), pi (extension + compaction takeover), openclaw (full ContextEngine takeover), and hermes (MemoryProvider).-- **Tool**: ov CLI (all operations are explicit calls; no automatic background actions).-- **Non-coding**: Open WebUI (tool server), LangChain (SDK library), the Agent Plugins portable package (an MCP + skill spec bundle), generic direct MCP, log ingestion, and Helper (desktop).-------# 2. Shared capability core--The individual harness sections (profile cards) focus exclusively on differences and specific implementations. All shared capabilities and universal behaviors are documented once in this section.-## 2.1 Server-side MCP tool surface--Tool definitions come from the server through `tools/list`. The proxy reads connection settings from the local `~/.openviking/ovcli.conf`, then connects to discover tools. After a server update, reconnect or refresh the tool list. Counts on this page describe the current repository implementation; the connected server determines the actual list.--| # | Tool | What it does | Key parameters (definition line) |-|---|---|---|---|-| 1 | `find` | Fast semantic search requiring no session context | `query, target_uri="", limit=10, min_score=0.35, level, context_type, read_content`; `context_type="skill"` on its own routes to `SearchService.find_skills` (package retrieval, `skill_package_retriever.py`): one hit per skill package, the URI rewritten to `<package>/SKILL.md`, the summary read from the package's own abstract, and `read_content` reading that file. Without `target_uri` it searches both `viking://~/skills` and `viking://agent/skills`. Any other `context_type` combination, and a filter-only query with no query text, stay on the generic retrieval path; the URI rewrite and the one-line-per-package collapse still apply when rendering (`:262`) |-| 2 | `search` | Deep search, featuring optional `session_id` integration and intent analysis | The session is only loaded if the server has `retrieval.enable_intent` enabled (defaults to true) (`:315`). Skills are retrieved per item here and only collapsed when rendering, so a package matching in several files spends several `limit` slots and keeps the matching file's summary |-| 3 | `read` | Read the full text of one or more `viking://` files | Uses a concurrency semaphore of 10; a single failure yields `(nothing found at <uri>)` rather than raising an exception (`:643`) |-| 4 | `list` | List a directory (function name `ls`, explicitly registered as `list`) | `recursive=False` (`:784`) |-| 5 | `tree` | Recursive directory tree | `level_limit=3, node_limit=1000, include_abstract=False`; `include_abstract=true` prints each directory's abstract (up to 1024 chars), so `tree(uri="viking://~/skills", level_limit=1, include_abstract=true)` lists every skill with its description (`:862`) |-| 6 | `remember` | Write long-term memory | Internally creates a one-shot session (`mcp-store-<uuid12>`) and immediately calls `commit_async` (`:940`). This is the only commit entry point on the MCP surface, as there is no explicit commit tool. |-| 7 | `write` | Write a `viking://` file | `mode=replace\|append\|create`; `replace` falls back to `create` if not found. New files must use an extension from the allowlist: `.md .txt .json .yaml .yml .toml .py .js .ts`. Writable domains are limited to `resources/user/agent`; directories like `skills/`, `peers/`, `privacy/`, and `sessions/` under the user root are read-only. Existing `.abstract.md` / `.overview.md` sidecars may be body-updated, but public APIs cannot create them. A write under `viking://agent/skills` is not refused but skips skill installation, so use `add_skill` for skills; see [§3.5](#_3-5-type-boundaries-for-writes-and-deletes) (`:965`; `content_write.py:60-81`) |-| 8 | `edit` | Exact string replacement | Supplying an empty `old_string`, finding zero matches, or finding multiple matches without `replace_all` will raise an error and leave the file content unchanged. Editing a file inside a skill package does not re-run skill installation; see [§3.5](#_3-5-type-boundaries-for-writes-and-deletes) (`:1005`) |-| 9 | `add_resource` | Resource ingestion (remote URL / signed upload of a local file / Connector) | `watch_interval` is defined in minutes (0 disables watching). The local-path branch generates a signed upload URL (default TTL of 600s), and ingestion triggers automatically post-upload without requiring a subsequent API call (`:1161`) |-| 10 | `add_skill` | Create, install, or replace skills | `data` (full SKILL.md text) or `path` (Git URL / GitHub tree URL, or a local SKILL.md, directory, or zip — the local branch returns a signed upload URL like `add_resource`); `skills=[...]` selects from a multi-skill source, `list_only=true` previews it; `target_uri="viking://agent/skills"` shares with the account. Same install code as REST `POST /api/v1/skills`. The tool description names it the one entry point for creating and updating a skill, and points deletion at `ov skills remove` or Studio (`:1452`) |-| 11 | `list_watches` | List watch subscriptions; not yet supported on the commercial edition | Returns an error string if the scheduler is not running (`:1621`) |-| 12 | `cancel_watch` | Cancel by `to_uri`; not yet supported on the commercial edition | Deliberately does not expose pause/resume/trigger/update (`:1653`) |-| 13 | `grep` | Regex content search | Multiple patterns run concurrently (semaphore of 10), `node_limit=10` (`:1696`) |-| 14 | `glob` | Filename glob | `node_limit=100` (`:1765`) |-| 15 | `forget` | Permanently deletes a URI (irreversible) | `recursive=False` by default; type boundaries in [§3.5](#_3-5-type-boundaries-for-writes-and-deletes) (`:1791`) |-| 16 | `health` | Health check | No parameters (`:1808`) |-| 17 | `list_users` | List account user IDs; credentials are opt-in, require ADMIN/ROOT, and are unavailable in trusted mode | `query`, `limit`, `page`, `include_credentials` (`mcp_endpoint.py:356`) |-| 18 | `list_groups` | List account group IDs without membership | No user parameters (`mcp_endpoint.py:394`) |-| 19 | `get_acl` | Read a resource ACL; requires manage permission or account ADMIN | `uri` (`mcp_endpoint.py:408`) |-| 20 | `set_acl` | Set a resource ACL; requires manage permission or account ADMIN | `uri`, `acl` (`mcp_endpoint.py:418`) |--Supporting mechanisms:--- **Portable schema rewriting** (`:1149-1218`): At module import time, every tool's `anyOf` / `$ref` is flattened into a plain type to ensure compatibility with clients that only support the OpenAPI 3.0 subset (such as Gemini). Runtime validation still relies on the original Python signature (for instance, `read` advertises an array schema but continues to accept a bare string). All MCP clients receive the exact same server-produced schema; there are no client-specific variants.-- **Identity middleware** (`:149-233`): Shares `resolve_identity` with REST endpoints. Identity depends on the authentication mode: API key mode resolves the account and user from the key, trusted mode accepts identity headers from a trusted gateway, and dev mode accepts account/user headers and defaults missing values to `default`. Actor peer is resolved separately and cannot override authentication. See [Authentication](../guides/04-authentication.md).--## 2.2 The memory-plugin-shared layer--The `examples/memory-plugin-shared/lib/` directory contains 25 `.mjs` modules and serves as the single source of truth for all JS-based harnesses. These are consumed in two ways:--1. **Vendoring (copying)**: The `sync.mjs` script distributes these modules to 7 targets, prefixing every file with `// GENERATED FROM ... DO NOT EDIT.`. Because of this added line, a vendored copy's line number will be exactly one line greater than the library source. There is no hand-kept file list: each target gets the transitive closure of the modules its own code imports. Claude Code, Codex and agent-plugins are installed by pointing a host at a directory in this repository, and OpenClaw's `ov-install` can download the plugin file by file from a git ref, so these four commit their generated copies and a push to main regenerates them. OpenCode and DSH publish as npm packages and pi is tarred by the installer, so those three generate their copies at pack time and keep none in git.-2. **Direct import via relative path (no copying)**: cursor, trae, trae-cn and zcode directly `import "../../memory-plugin-shared/lib/..."`. The installer copies the package alongside the shared modules those hooks transitively import into `~/.openviking/agent-integrations/{<client>,memory-plugin-shared}/`, preserving the relative folder layout. That installed set is closed under imports, including the workspace configuration layer the hook runtime reaches. At runtime, these harnesses share this directory, so reinstalling any one of them overwrites the shared directory wholesale.--Core modules at a glance (detailed further in the per-dimension sections):--| Module | Responsibility | Consumers |+- Which OpenViking tools can the agent call by itself?+- What happens without the agent asking: recall before each prompt, context at session start, capture of the conversation, and the commits that turn it into long-term memory?+- What is kept and what is lost when the agent exits, crashes, compacts its context, or cannot reach the server?++For installation, start with [Choose an integration](./01-overview.md). The comparisons below describe the implementations linked in [Source notes](#source-notes); your server determines the MCP tools available to an integration.++## Two kinds of capability++**Agent-callable tools** are tools the model decides to call, such as `search`, `read`, or `remember`. Nothing happens until the model calls one. A plain MCP connection gives you only these.++**Automatic lifecycle behavior** runs from host events without the model asking. It covers recall before a prompt reaches the model, profile and skill context at session start, capture of each turn into an OpenViking session, and commits. Hooks, plugins, and native extensions provide it.++Long-term memories are extracted from a session only after a **commit**. Captured messages that have not been committed stay in the server session and do not become memories until a later commit. [Capture and commits](#capture-and-commits) explains when each integration commits and what an exit can leave behind.++<a id="reading-guide"></a><a id="_1-capability-overview"></a><a id="_1-2-automatic-hook-surface-driven-by-the-harness"></a><a id="_1-3-grouping-by-form"></a>++## At a glance++### Agent-callable tools++"Server MCP tools" means whatever the server's `tools/list` returns: 20 tools on the current server, listed in [Server MCP tools](#server-mcp-tools).++| Integration | How it connects | Tools the agent can call ||---|---|---|-| `recall-core.mjs` | Handles recall request construction, three-tier degradation, and local fallback ranking/injection | All JS-based harnesses |-| `agent-hook-runtime.mjs` | All-in-one "thin hook" runtime handling configuration resolution through the shared schema, session ID derivation, cross-process locking, fetching, and commits | cc / codex / cursor / trae / trae-cn / zcode |-| `mcp-proxy-core.mjs` | stdio ↔ streamable-HTTP MCP proxy core | MCP integrations and agent-plugins that communicate with a child process; pi uses the official client directly |-| `ov-http.mjs` | The one path from a hook to the OpenViking server: headers, AbortController, envelope | All JS-based + agent-plugins |-| `pending-queue.mjs` | On-disk offline queueing and replay at session start | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `batch-send.mjs` | Executes writes in batches of 100, handles per-message degradation on 404/405 errors, and queues the leading contiguous prefix | cc / codex / opencode + the agent-hook family |-| `profile-inject.mjs` | Injects the profile, the available-memory index, and the `<available-skills>` catalog at session start | 9 harnesses (all but openclaw / hermes) |-| `recall-compress-core.mjs` | Manages the recall compression prompt, URI edit-distance repair, and caching | claude-code |-| `capture-utils.mjs` | Handles message normalization, injection back-flow guarding, and the built-in capture heuristics (acks, slash commands, signal floor) | cc / codex / opencode / dsh / pi / zcode / cursor / trae×2 |-| `input-filters.mjs` | Compiles and applies the operator's own sed-style rules — `s` substitute, `d` drop, `k` keep-only, optionally scoped to one role — over the recall query and every captured turn. A rule that fails to parse is reported and skipped, never thrown ([grammar](https://github.com/volcengine/OpenViking/blob/main/examples/claude-code-memory-plugin/README.md#input-filters)) | All hook plugins; the `recallQueryFilters` / `captureFilters` knobs are supplied by claude-code / codex |-| `credentials.mjs` | Credential resolution chain (see [§3.1.3](#_3-1-3-credential-systems)) | All JS-based |-| `session-model.mjs` | Session ID prefix derivation and bypass globbing | All JS-based |-| `async-writer.mjs` | Detaches the write path (drains stdin → spawn → approve → write → unref). Falls back to synchronous writing if spawn fails | cc / codex / zcode |-| `workspace-peer.mjs` | Resolves the actor peer from `peer.source` — presets, templates, and the pre-git id kept for dual-read ([§3.1.3](#_3-1-3-credential-systems)) | All JS-based |-| `workspace-identity.mjs` | Workspace root + git identity (normalized `origin`, root path, worktree/submodule kind), derived by walking the filesystem with no `git` subprocess and cached per cwd | All JS-based |-| `workspace-config.mjs` | The layered workspace config: reads `<root>/.openviking/config.json` and `config.local.json`, merges layers with provenance, strips connection and credential keys | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `workspace-registry.mjs` | The per-machine registry `~/.openviking/workspaces/<slot>.json` — one file per workspace, hand-created and read-only for the plugins, the layer that outranks any committed file | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `uri-guard.mjs` | Denies a file-tool call whose path argument is a `viking://` URI; lets a shell command that carries one run and attaches a notice for the model. grep's `pattern` is search text, not a path. On a skill URI (`isSkillUri()`), the write and edit hints name `add_skill` instead of `write` / `edit` | Deny: each harness's `PreToolUse` or `tool.execute.before`-style hooks. Notice: `PreToolUse`, or a post-execution hook (`tools/post-execute` on dsh, `tool_result` on pi, `tool.execute.after` on opencode) |-| `config-schema.mjs` | The single declaration of every knob: canonical name, type, default, range, `OPENVIKING_*` variable, accepted aliases, and workspace key. The doctor's known-key set and the workspace file's dotted-key map are projections of it | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `plugin-config.mjs` | Resolves every declared knob through the layers: env → the workspace layers → `ovcli.conf` `plugin.<harness>` → `ovcli.conf` `plugin` → ov.conf's harness section → defaults | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `setup-wizard.mjs` | Interactively writes to `ovcli.conf` | cc, codex, opencode, and pi expose an entry point for this |-| `retryable.mjs` | Handles retryability checks: allows status codes 0, 408, 429, and ≥500, as well as 409 if `error.details.retryable===true`. Standard 4xx errors (including 401/403) are not retried | All JS-based |--## 2.3 Server-side session and commit semantics--- **Implicit session creation**: Plugins generally do not call `POST /sessions` explicitly (with `dsh` being the only exception, as it sends a creation request carrying only `session_id`). Instead, the server creates the session using `auto_create=True` upon receiving the first `POST /sessions/{id}/messages(/batch)` request. On the recall side, calling `_load_session(auto_create=True)` under `mode="context"` also creates a session, meaning the very first recall action will initialize the session on the server.-- **Two-phase commit**: `POST /sessions/{id}/commit` returns only after Phase 1 (archiving) has completed synchronously. Phase 2 (memory extraction) runs as a background task, returning a `task_id`. The server default for `keep_recent_count` is **0** (meaning it archives everything, leaving no live tail).-- **Server-side auto-commit is disabled by default unless an explicit or deployment-default policy enables it**:- - `memory.session_auto_commit.enabled = false` (`memory_config.py`). Auto-commit is disabled for sessions lacking a storage policy (`session_service.py`). Furthermore, the idle scanner isn't even instantiated when `enabled=false` (`core.py`), effectively acting as a double gate.- - The `auto_create` path triggered by `POST /messages` accepts no policy arguments, but it inherits `server.user_config_defaults.auto_commit_policy` when configured. `POST /sessions` and `PATCH /sessions/{id}/config` remain the explicit per-session controls.- - Current memory plugins do not explicitly send an `auto_commit_policy`. Set it through the Python SDK’s `create_session` / `update_session_config`, the HTTP API, or the **ov CLI** (`ov session new --auto-commit-policy-json` / `--no-auto-commit`, `ov session config set`).- - When a policy is explicitly enabled, the server defaults are: `pending_token_threshold=150000` (strictly greater than), `message_count_threshold=100`, `idle_timeout_seconds=86400`, `keep_recent_count=0`, and `min_commit_interval_seconds=0`. Note that this set of server defaults operates independently of the plugin clients' configuration (which is typically 20000/10).-- **Consequence**: Plugins can rely on `server.user_config_defaults.auto_commit_policy` for new-session token/message thresholds; idle-timeout recovery additionally requires `memory.session_auto_commit.enabled=true`. Without that fallback, clients must still arrange their own commit path ([§3.3](#_3-3-session-and-commit-lifecycle)).-- **Externalized tool output**: The server sets `tool_output_externalization.enabled=True` with `threshold_chars=20000` (`server/config.py:257-258`). Clients commonly raise `captureToolMaxChars` to 1000000 purely as a fallback mechanism, since the actual truncation and externalization occur on the server. Externalized results are then referenced via `tool_output_ref` (for context, openclaw provides three dedicated tools specifically for reading these references).-- **Server-side recall timeout fuses**: Configured via `retrieval.recall_intent_timeout_s=5.0` (for query expansion), `recall_rewrite_timeout_s=30.0` (for digests, [§3.2.5](#_3-2-5-recall-digest)), and `enable_intent=true`. Client timeout budgets are derived directly from these two timeout values ([§3.2.4](#_3-2-4-timeout-and-budget-chain)).-------# 3. Dimensions in detail-## 3.1 Integration forms, installation, and configuration--### 3.1.1 Decision matrix--| Harness | Integration Form | Install Channel | Session ID Prefix/Format | Config Source | Standalone Setup Wizard |-|---|---|---|---|---|---|-| claude-code | CC plugin (marketplace): 9 hooks + MCP proxy + slash + statusline + skill | One-line `install.sh --harness claude` (Claude Code 2.0+) / manual marketplace | `cc-<CC session_id verbatim>`; subagents use `…__subagent-<agent_id>` | env + ovcli.conf `plugin.claude_code` + ov.conf `claude_code` | ✅ `scripts/setup.mjs` |-| codex | Codex plugin (marketplace): 6 hooks + MCP proxy + skill | One-line `--harness codex` / `codex plugin marketplace add` (the TOS channel uses dumb-HTTP git to ensure remote updates continue working) | `cx-<safeId>` (deterministically derived, without reading state) | env + ovcli.conf `plugin.codex` + ov.conf `codex` | ✅ |-| trae-cli | **Installed as a codex plugin alias** (TraeCode CLI 2.0, 2.0 only; a Codex-family CLI: uses the `traecli` binary and `~/.trae/traecli.toml` config; its capability surface is identical to codex) | One-line `--harness trae-cli` (reuses the codex install flow; marketplace commands run against the targeted binary, e.g., `traecli plugin marketplace add`) | Same derivation rule as codex | Same as codex (env + ovcli.conf `plugin.codex` + ov.conf) | ✅ (same as codex) |-| cursor | Config-driven (writes `~/.cursor/hooks.json`+`mcp.json`) + rule + skill | One-line `--harness cursor` | `cu-<conversation_id>` | env + ovcli.conf `plugin.cursor` | ❌ (shares the installer TUI) |-| trae / trae-cn | Config-driven (`~/.trae{,-cn}/hooks.json` + platform-specific mcp.json) | One-line `--harness trae,trae-cn` | `tr-` / `trcn-` | env + ovcli.conf `plugin.trae` / `plugin.trae_cn` | ❌ |-| zcode | Config-driven (merged into `~/.zcode/cli/config.json`, forcing `hooks.enabled=true`) | One-line `--harness zcode` | `zc-<sess_…>` | env + ovcli.conf `plugin.zcode` | ❌ |-| kimicode | Native Kimi Code plugin (`kimi.plugin.json`, managed copy + `installed.json`) | One-line `--harness kimicode` | `kc-<session_id>` | env + ovcli.conf `plugin.kimicode` + workspace files | ❌ |-| opencode | npm plugin `@openviking/opencode-plugin` (its config hook dynamically injects the MCP entry) | One-line `--harness opencode` (copies a local file plugin into `~/.config/opencode/plugins/`) / manual npm / from source | `oc-<id>`; subagents use `oc-<parent>__subagent-<child>` | env + ovcli.conf `plugin.opencode` | ✅ |-| dsh | In-process Cordis plugin (`cordis.patch.yml` entry) | Unified installer (profile `web` unless `--dsh-profile` names another), or `dsh plugin --profile web add @openviking/dsh-memory-plugin` | `dsh-<session.id as-is>`; each subagent is assigned its own session | env + ovcli.conf `plugin.dsh` + the cordis patch config, which is the lowest behavior layer (credentials still come from the patch first) | ❌ |-| pi | Native pi extension (loaded from a directory, with TypeScript transpiled on the fly via jiti) | One-line `--harness pi` (copied into the auto-discovery directory, no `pi install` needed) | `pi-<piSessionId>` | env + ovcli.conf `plugin.pi` (credential fields are resolved via the shared credential chain) | ✅ |-| openclaw | context-engine plugin (`ownsCompaction:true`) + 15 tools + 5 slash + 4 hooks + HTTP routes | ClawHub: run `openclaw plugins install clawhub:@openviking/openclaw-plugin` alongside `openclaw openviking setup` / npm installer / TOS offline bundle | A UUID is lowercased as-is, otherwise `sha256(sessionKey)`; `memory_store` temporary sessions use `memory-store-<ts>-<rand>` | `plugins.entries.openviking.config` in `openclaw.json` (strictly validated: unknown keys or invalid values force the plugin into setup-only mode) + a few env vars | ✅ `openclaw openviking setup` (interactive/non-interactive + key role probing + version compatibility check) |-| hermes | Hermes bundled MemoryProvider (ships with Hermes; no plugin installation required) | Run `hermes memory setup openviking` (interactive curses wizard), or manually run `hermes config set memory.provider openviking` + `.env` | Generated by Hermes and used unchanged | `.env` (`OPENVIKING_*`) or linked ovcli.conf (`use_ovcli_config` mode clears the 5 corresponding variables from .env) + config.yaml | ✅ (multi-level menu) |-| ov CLI | Native Rust binary | npm `@openviking/cli` / `uv tool install openviking` / cargo / GitHub Releases | Does not manage its own session (`ov chat` defaults to the machine-uid) | `ovcli.conf` (multiple profiles) + a few env vars | ✅ `ov config` (TUI wizard) |--### 3.1.2 Unified installer--The unified install script (`examples/memory-plugin-shared/install.sh`) supports eleven harness IDs: `claude, codex, cursor, trae, trae-cn, trae-cli, zcode, kimicode, opencode, pi, dsh`. (Note that `openclaw` uses its own distribution channel, while `trae-cli` reuses the `codex` install flow, as detailed in [§3.1.1](#_3-1-1-decision-matrix)). Key highlights:--- **Sources and prompts:** Everything is installed from the downloads the OpenViking documentation site serves; run from a repository checkout, the installer uses that checkout instead (`--source archive|dev`). When executed via `curl … | bash`, it reads input directly from `/dev/tty` to ensure prompts remain interactive.-- **Usage:** In the official documentation, the canonical one-line command omits the `--harness` flag, which launches a TUI multi-select menu. However, the setup-helper forwarding scripts bundled with each plugin append the `--harness` flag automatically.-- **Idempotent merging:** Hooks and MCP entries are identified by the `OPENVIKING_INTEGRATION_ID` marker. This ensures stale entries are pruned and new ones are appended without affecting third-party configurations. Writes are atomic: the script creates a `.bak` backup, writes to a temporary file, and then renames it over the target with `0600` permissions.-- **Credential wizard:** This writes to `~/.openviking/ovcli.conf`. Users can select from three targets (local `http://127.0.0.1:1933` / Volcengine Cloud `https://api.vikingdb.cn-beijing.volces.com/openviking` / custom). If a configuration already exists, the script displays the current values first and asks whether to keep or reconfigure them, masking the API key for security.-- **Uninstallation:** The `--uninstall` flag covers `cursor`, `trae`, `trae-cn`, `zcode`, and `kimicode`, and also cleans up any legacy trae-cli hook config. The other Codex-format and host-managed plugins are removed via their respective host's plugin management systems.-- **Post-installation self-check:** This includes grepping the configuration, running `node --check`, and executing a smoke test with `OPENVIKING_MEMORY_ENABLED=0`.-- **Node.js requirement:** The installer enforces a minimum version of Node 18+.--### 3.1.3 Credential systems--Four parallel credential-resolution systems coexist within the codebase, each utilizing its own environment variable names and authentication headers. When troubleshooting, your first step should be identifying which system is currently in use:--| Family | Consumers | URL Env | Key Env | Identity Env | Auth Header |+| [Claude Code](#claude-code) | Plugin with hooks and an MCP proxy | Server MCP tools |+| [Codex, TraeCode CLI 2.0](#codex-and-traecode-cli-2-0) | Codex plugin with hooks and an MCP proxy | Server MCP tools |+| [Cursor](#cursor) | Hook and MCP configuration, plus a rule | Server MCP tools |+| [TRAE, TRAE CN](#trae-and-trae-cn) | Hook and MCP configuration | Server MCP tools |+| [ZCode](#zcode) | Hook and MCP configuration | Server MCP tools |+| [Kimi Code](#kimi-code) | Kimi Code plugin with hooks and an MCP proxy | Server MCP tools |+| [OpenCode](#opencode) | npm plugin that adds an MCP entry | Server MCP tools, named `openviking_<tool>` |+| [DSH](#dsh) | In-process Cordis plugin plus an MCP proxy | Server MCP tools, named `mcp__openviking__<tool>` |+| [pi](#pi) | Native extension with a built-in MCP client | Server MCP tools, registered as `openviking_<tool>` after the MCP handshake succeeds |+| [OpenClaw](#openclaw) | Context-engine plugin | 15 native tools, 14 enabled by default |+| [Hermes](#hermes) | Hermes memory provider | 6 native `viking_*` tools |+| [MCP clients, Agent Plugins](#other-integrations) | MCP only | Server MCP tools |+| [ov CLI](#ov-cli) | Command-line client | Every operation as an explicit command; no agent involved |++### What runs automatically++| Integration | Recall before each prompt | Session-start context | Commits during a session | Commits at a normal exit | Host compaction ||---|---|---|---|---|---|-| **A. Shared JS core** (`credentials.mjs`) | claude-code / codex (including trae-cli) / cursor / trae×2 / zcode / opencode / pi / dsh / agent-plugins | `OPENVIKING_URL` → `OPENVIKING_BASE_URL` | `OPENVIKING_BEARER_TOKEN` → `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT` / `OPENVIKING_USER` / `OPENVIKING_PEER_ID` | `Authorization: Bearer` alone; no harness in this family sends `X-API-Key`. |-| **B. openclaw** (its own `config.ts`) | openclaw | `OPENVIKING_BASE_URL` → `OPENVIKING_URL` | `OPENVIKING_API_KEY` (supports SecretRef env/file) | `OPENVIKING_ACCOUNT_ID` / `OPENVIKING_USER_ID` (note the `_ID` suffix here) | `X-API-Key`. (When pointing to OV Cloud, note that it actually authenticates using Bearer). |-| **C. hermes** (Python) | hermes | `OPENVIKING_ENDPOINT` | `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT` / `OPENVIKING_USER` / `OPENVIKING_AGENT` (= actor peer) | Sends both `X-API-Key` and `Bearer`. When a key is present, it omits tenant headers by default (if the server rejects the call with a trusted error, it appends them and retries once). |-| **D. ov CLI** (Rust) | ov | Primarily the conf file | conf | `--account/--user/--actor-peer-id` | `X-API-Key`. Toggles between LDAP Basic and OIDC Bearer based on `auth_mode`; an `api_key` containing two or more `.` characters automatically receives a Bearer header as well (JWT fallback). |+| Claude Code | Yes, session-aware | Profile, memory index, skills | At 20,000 pending tokens | Yes | Commits, then the host summarizes |+| Codex | Yes, session-aware | Profile, memory index, skills | At 20,000 pending tokens | Codex 0.145+; otherwise at the next start | Commits, then the host summarizes |+| TraeCode CLI 2.0 | Yes, session-aware | Profile, memory index, skills | At 20,000 pending tokens | Only if the build has `SessionEnd`; otherwise at the next start | Same as Codex |+| Cursor | Yes, session-aware | Profile, memory index, skills | Every 8 captured messages | No | Commits, then the host summarizes |+| TRAE, TRAE CN | Yes, session-aware | Profile, memory index, skills | Every turn | No exit event; turns are already committed | No pre-compaction event |+| ZCode | Yes, session-aware | Profile, memory index, skills | Every turn | No exit event; turns are already committed | No pre-compaction event |+| Kimi Code | Yes, session-aware | Profile, memory index, skills, at the first prompt | Every 8 captured messages | Only when `SessionEnd` captures new messages | Commits newly captured messages |+| OpenCode | Yes, session-aware | Profile, memory index, skills, indexed repositories | At 20,000 pending tokens, when idle | Yes, within the host's cleanup time | Commits around compaction |+| DSH | Yes, session-aware | Profile, memory index, skills, once per session | At 20,000 pending tokens | Yes, with a 3-second budget | Not observed |+| pi | Yes, session-aware | Profile, memory index, skills, every turn | Takeover on: about 30,000 tokens; off: 20,000 | Takeover on: no; off: yes | Takeover replaces pi's summary |+| OpenClaw | Yes, not session-aware | None | At half the token budget (64,000 by default) | No | The plugin owns compaction |+| Hermes (bundled) | Yes, session-aware with a fallback | Profile and memory listings | No; only at session boundaries | Yes, if pending uploads finish within 10 seconds | Commits at fork-style compaction |+| ov CLI | No | No | Only `ov session commit` | Not applicable | Not applicable |-Family A resolves credentials in the following order (refer to individual profile cards for other families):+How to read this table:-1. The resolution mode is controlled by `OPENVIKING_CREDENTIAL_SOURCE` (aliased as `_CREDENTIALS_SOURCE`), accepting values of `env|cli|auto` (defaults to `auto`). Forced to `env`, the connection reads neither file: an unset variable stays empty, and the URL defaults to `http://127.0.0.1:1933`. The `peerId` setting still resolves through its own layers.-2. **`auto` prioritizes environment variables**: If any environment credential field (`URL`, `BASE_URL`, `MCP_URL`, `BEARER_TOKEN`, `API_KEY`, `ACCOUNT`, `USER`, `PEER_ID`) is present, the chain runs from the environment down. Only when all of them are empty, and an `ovcli.conf` file exists with credential fields, is the chain pinned to that file: the environment's credentials are skipped, `apiKey` still falls through to the `plugin` keys and `ov.conf` `<harness>.apiKey` (Claude Code and agent-plugins continue to `server.root_api_key`), and `account` / `user` stop at the `plugin` keys. `OPENVIKING_AUTH_MODE` does not count as a credential field and never unpins the file.-3. **baseUrl**: Resolves via environment variables → `ovcli` `url` → `ov.conf` `server.url` → `http://{server.host|127.0.0.1}:{server.port|1933}` (where `0.0.0.0` normalizes to `127.0.0.1`), with a final fallback to `http://127.0.0.1:1933`.-4. **apiKey**: A value the embedding host passed (dsh's Cordis patch) outranks every layer, as it does for the URL, account, user and auth mode; then `BEARER_TOKEN` → `API_KEY` → `ovcli` `api_key` → `ovcli` `plugin.<harness>.apiKey` → `ovcli` `plugin.apiKey` → `ov.conf` `<harness>.apiKey` → `server.root_api_key`. The `<harness>` block is the one named after the calling harness (snake_case, so `trae_cn`; `claude-code` and `claude_code` reach the same block), and `account` / `user` / `peerId` read that same block at the same position in their own chains.-5. **mcpUrl**: Resolves via `OPENVIKING_MCP_URL` (when outside CLI mode) → `${baseUrl}/mcp`.-6. **Common request headers**: `Authorization: Bearer` + `X-OpenViking-Account/User` (trusted mode only) + `X-OpenViking-Actor-Peer` + `User-Agent: openviking-memory-<harness>/<version>`. An `api_key` server reads the identity out of the key and ignores those two headers, so they are withheld there rather than named to every proxy on the path. The mode resolves via `OPENVIKING_AUTH_MODE` (read in every mode) → `ovcli` `plugin.<harness>.authMode` → `plugin.authMode` → `ov.conf` `<harness>.authMode` → `ov.conf` `server.auth_mode` → trusted whenever an account or user resolved at all.-7. **One connection for hooks and MCP**: everything above is `resolveConnection()` in `credentials.mjs`. The hook loader (`buildPluginConfig()`) and every MCP proxy (through its harness's loader, or `buildProxyConnection()` for agent-plugins) call it, and it never reads the working directory, so a proxy launched from the plugin directory resolves what the hooks resolve. The process boundary is handled in one of two ways: Codex passes its MCP server only the names in `.mcp.json` `env_vars`, which must include `MCP_PROXY_ENV_VARS`; dsh forwards the resolved connection itself, every credential variable written even when empty, with `OPENVIKING_CREDENTIAL_SOURCE=env`, so neither a file nor a variable the child inherits can change it. `mcp-hook-parity.test.mjs` checks that both sides put the same URL, key and identity on the wire.+- **Session-aware recall** sends the session ID so the server can use the conversation to interpret the query. The shared plugins’ context mode also expands the query and tracks recently injected memories to avoid repeating them. Hermes uses list mode, which has no injection ledger; OpenClaw uses `/find`, which has no session field. See [How recall reaches the server](#how-recall-reaches-the-server) for the request paths and fallbacks.+- **Pending tokens** are server-side counts of captured but uncommitted messages. Most thresholds are client settings; [the commit table](#when-each-integration-commits) lists them.+- **Commits at a normal exit** means the integration sends a commit request. Network errors, host exit budgets, or process termination can still interrupt it. [What happens at exit](#what-happens-at-exit) covers Ctrl+C, signals, and crashes.-**Workspace peer** (applies to every Family A harness; the agent-plugins package derives no workspace peer and forwards none — it has no knob layer that could set `recallPeerScope` to `actor`, so its proxy never sends the header): If no explicit `peerId` is provided and `OPENVIKING_WORKSPACE_PEER≠0`, the peer is derived from the workspace and sent as the `X-OpenViking-Actor-Peer` (the server validates this header and returns a `400` error if it contains `/` or `\`). The derivation rule is `peer.source`, which **defaults to `git`**: the normalized `origin` URL first, falling back to the repository root. Outside a repository nothing is sent, and what is remembered there goes to the user-level space `viking://user/<you>/memories` instead. In `/Users/x/Dev/OpenViking/examples/codex-memory-plugin` with an origin of `[email protected]:volcengine/OpenViking.git`, the peer is `github.com-volcengine-openviking` — the same value from any subdirectory, any worktree, any machine, and any clone. `peer.source` is read from the env var `OPENVIKING_PEER_SOURCE`, the ovcli.conf `plugin.peerSource` / `plugin.<harness>.peerSource` keys, and the workspace file's `peer.source`; every Family A harness reads those layers.+<a id="_1-1-active-tool-surface-agentic-calls"></a><a id="_2-shared-capability-core"></a>-| `peer.source` | Expands to | Resulting peer |-|---|---|---|-| `git` (the default) | `["{git_remote}", "{git_root}"]` | The normalized origin, else the repository root. Outside a repository nothing is sent. No preset adds a prefix. |-| `cwd` | `["{cwd}"]` | The previous behavior, byte for byte: every non-alphanumeric character in the path becomes a hyphen (`/Users/x/Dev/OpenViking` → `-Users-x-Dev-OpenViking`). |-| `none` | `[]` | No peer is sent at all. `OPENVIKING_WORKSPACE_PEER=0` still means the same thing. |-| A template (e.g. `"git-{git_remote}"`, `"team-{dir}"`) | Itself | Free-form. A list of templates (e.g. `["team-{dir}", "{cwd}"]`) is tried in order, and a template whose variables are empty falls through to the next one. |+## Tools the agent can call-| Variable | Value | Empty when |+<a id="_2-1-server-side-mcp-tool-surface"></a>++### Server MCP tools++Every MCP-based integration exposes the same server-defined tools and keeps no catalog of its own. A local proxy, or pi's built-in MCP client, reads `~/.openviking/ovcli.conf`, connects to the server's `/mcp` endpoint, and passes through what `tools/list` returns. A server upgrade can add tools without a plugin release; reconnect the client to see them. Parameters for each tool are in [MCP tools and protocol](../guides/06-mcp-integration.md#available-mcp-tools).++| Group | Tools |+|---|---|+| Search and browse | `find`, `search`, `read`, `list`, `tree`, `grep`, `glob` |+| Write | `remember`, `write`, `edit`, `add_resource`, `add_skill` |+| Delete | `forget` |+| Watched resources | `list_watches`, `cancel_watch` (not yet available on the commercial edition) |+| Accounts and access control | `list_users`, `list_groups`, `get_acl`, `set_acl` |+| Status | `health` |++Behavior to know before relying on a tool:++- **`remember`** creates a one-shot session named `mcp-store-<id>`, adds the messages, and commits it at once. It is the only MCP tool that commits. No MCP tool commits the agent's current conversation; that is the job of the automatic hooks.+- **`find` and `search`**: `find` is a fast search without session context. `search` can take a `session_id` and run intent analysis (`retrieval.enable_intent`, on by default). `find` with `context_type="skill"` returns one hit per skill package, pointing at its `SKILL.md`, from both the user's and the account's skills.+- **`write` and `edit`** can write only under `viking://resources`, `viking://user`, and `viking://agent`. A new file must end in `.md`, `.txt`, `.json`, `.yaml`, `.yml`, `.toml`, `.py`, `.js`, or `.ts`. The user's `skills/`, `peers/`, `privacy/`, and `sessions/` directories are read-only. A write under `viking://agent/skills` is accepted but skips skill installation, so use `add_skill` for skills.+- **`add_resource` with a local path** returns a signed upload URL (valid for 600 seconds by default). The model must upload the file to it, for example with a shell command; ingestion then starts on its own. Remote URLs are ingested directly.+- **`forget`** deletes whatever URI it is given, non-recursively by default. It does not check whether the URI is a memory, resource, or skill. See [Write and delete limits](#write-and-delete-limits).+- **Schemas** are flattened at server start so that clients accepting only the OpenAPI 3.0 subset, such as Gemini, can load them. Validation still follows the original signatures; `read`, for example, also accepts a single string. Every client receives the same schema.+- **Identity** is resolved the same way as for REST requests. See [Authentication](../guides/04-authentication.md).++Host differences:++- **OpenCode** prefixes the tools with `openviking_`. **DSH** names them `mcp__openviking__<tool>`.+- **DSH** runs one MCP proxy per DSH profile. Tool calls therefore carry a process-level actor peer, and `remember` is not tied to the DSH session. Recall, capture, and commits still resolve a peer per session.+- **pi** registers the tools only when the session is not bypassed, the health check passes, the OpenViking session exists, and the `/mcp` handshake returns a tool list. If the handshake fails, that session has no OpenViking tools, but recall, sync, and takeover continue, and a later turn retries the handshake. `mcpEnabled: false` turns the bridge off. A root API key is refused on `/mcp` with 403, so a credential chain that ends at `ov.conf`'s `server.root_api_key` produces a session without tools.+- **Codex** passes its MCP server only the environment variables listed in `.mcp.json` `env_vars`.++### OpenClaw tools++OpenClaw registers its own tools instead of passing MCP tools through.++| Group | Tools | Notes ||---|---|---|-| `{git_remote}` | The normalized `origin` URL as `github.com-org-repo`. Host and path are lowercased and `.git` plus any userinfo is dropped, so the ssh and https spellings of one repo agree and an embedded token can never reach the peer id. | Not a git repository, or `origin` is unset |-| `{git_root}` | The repository root path, under the legacy sanitation above | Outside a git repository. A marker file inside a repository still leaves this the repository's own root, so marking a subdirectory does not split the default peer |-| `{cwd}` | The working directory, under the legacy sanitation above | Never — and it is in no default chain, so a bare path becomes a peer only when you ask for one |-| `{dir}` | The workspace root's directory name: the repository root, or the directory holding `.openviking/config.json` | The directory is not a workspace |-| `{harness}` | The name of the agent running, the same one the User-Agent carries | Never — but the MCP proxy takes no part in derivation (its cwd is not a reliable identity), so a read path that goes only through it cannot resolve it |+| Memory | `memory_recall`, `memory_store`, `memory_forget` | `memory_recall` searches memory; `memory_store` commits through a temporary session |+| Resources and skills | `ov_search`, `ov_read`, `ov_multi_read`, `ov_list`, `add_skill`, `add_resource` | `ov_search` covers resources and the user's skills by default. `add_resource` is off by default and also needs `enableAddResourceTool` |+| Session archives | `ov_archive_search`, `ov_archive_expand` | Search and expand archived history |+| Large tool output | `openviking_tool_result_read`, `openviking_tool_result_search`, `openviking_tool_result_list` | Read tool output the server stored separately |+| Diagnostics | `ov_recall_trace` | Shows how automatic recall was built |-To give a directory that is not a repository its own peer, create `.openviking/config.json` there holding `{"version": 1, "peer": {"id": "my-project"}}`, or set an explicit `OPENVIKING_PEER_ID` for it.+### Hermes tools-**Identity semantics**: Every clone of one repository shares one peer, so project memory follows the project rather than the checkout. A fork carries a different `origin` and is therefore a separate peer by default; reviewing an external PR via `gh pr checkout` does not change `origin`, so it does not change identity either. Derivation is pure filesystem work (`workspace-identity.mjs`) with no `git` subprocess, which keeps it inside the tightest hook budget and keeps it working where `git` is absent from `PATH` or would refuse the repo over dubious ownership. Worktrees converge onto the main repository via `commondir`, a submodule keeps its own identity, and `$HOME` and `/` are never treated as workspace roots.+Hermes has six tools: `viking_search`, `viking_read`, `viking_browse`, `viking_remember`, `viking_forget`, and `viking_add_resource`. There is no skill tool. `viking_remember` submits a fact through its own session and returns before extraction finishes; extraction may add, merge, or skip the fact. See [Hermes](#hermes) for the differences between the bundled provider and the external plugin.-**Migration** (no user action required): The pre-git peer id is a pure function of the cwd, so the client can always recompute it locally and recall still reaches memories written under it. Under the default `peer_scope: "all"`, the server's existing cross-peer sweep already covers it at zero cost; under `peer_scope: "actor"`, the plugin asks that peer separately and appends whatever it returns. There is no deadline on this.+<a id="_3-5-type-boundaries-for-writes-and-deletes"></a><a id="_3-5-1-write-boundary"></a><a id="_3-5-2-delete-boundary"></a>-For `openclaw`, the peer is derived from `peer_role`/`peer_prefix` (note that if `peer_role=sender`, sender information must be available, otherwise tool calls will fail; legacy `person` is accepted as an alias). The Hermes assistant peer is optional: `OPENVIKING_AGENT`, a linked OpenViking peer, or YAML `agent`; no peer is set by default.+### Write and delete limits-### 3.1.4 Configuration layers+The server applies the same checks to every delete, whichever tool or command sends it:-| Config Layer | Applies To | Notes |+- The caller needs manage permission on the URI, and a user whose own deletion is in progress is refused.+- `viking://`, `viking://user`, and `viking://agent` cannot be deleted. Deleting `viking://resources` or a whole user root such as `viking://user/<id>` requires the ROOT role. Non-root callers cannot write to the `viking://temp` root.+- URIs hidden by the caller's actor-peer view are refused.++These checks protect namespaces, not content types. Restrictions by type come from the client:++| Entry point | Can delete | Client-side limits ||---|---|---|-| env `OPENVIKING_*` | Per family, see above; behavior knobs are listed on each profile card | The only layer that spans every JS-based integration. |-| Workspace layers: the per-machine registry `~/.openviking/workspaces/<slot>.json` > `<repo-root>/.openviking/config.local.json` (private, gitignored) > `<repo-root>/.openviking/config.json` (committed, shared by the team) | claude-code / codex / cursor / trae / trae-cn / zcode / opencode / dsh / pi | Schema v1; `version: 1` is required and a file declaring another version is skipped with a warning. Keys: `peer.source`, `peer.id`, `recall.{enabled,peer_scope,dedup_turns,max_items,score_threshold}`, `capture.{enabled,commit_token_threshold}`, `bypass.session_patterns`, `labels`. Lists union across layers, and a leading `"!reset"` clears what was inherited; unknown keys are kept and ignored. These files are trusted without a prompt because a hook is non-interactive, so the refusals are structural instead: connection and credential keys (`url`, `api_key`, `account`, `user`, `extra_headers`, …) are stripped with a warning and `${VAR}` is never expanded. Nothing writes the registry today: an entry is created by hand, and `ov-memory-doctor` prints the slot path to put it at. What a committed file switches off is announced in `ov-memory-doctor` rather than blocked. |-| ovcli.conf `plugin` section (shared scalars, overridden by a `plugin.<harness>` object) | claude-code / codex / cursor / trae / trae-cn / zcode / opencode / dsh / pi | A per-harness key takes either spelling — `claude_code` or `claude-code`, `trae_cn` or `trae-cn`. CLI edits and renames preserve extra top-level fields such as `plugin`. Switching uses fields explicitly supplied by the incoming profile and retains omitted extra fields from the active file. |-| ov.conf harness sections (`<harness>.*`, legacy) | Every harness, for the section named after it | Both the credential fields (`apiKey`, `accountId`, `userId`, `peerId`) and the tuning knobs resolve from the calling harness's own section. Either spelling of the name reaches the same block. |-| The harness's own config file | dsh cordis patch (which the `plugin` section outranks), openclaw `openclaw.json`, hermes `config.yaml`+`.env` | |+| MCP `forget` (every MCP integration, including DSH and pi) | Any URI it is given | Non-recursive unless `recursive=true`; no type or score check |+| `ov rm` | Any URI | No confirmation; `-r` deletes recursively |+| `ov tui`, `d` key | Any URI except roots and scope directories | Asks for confirmation |+| OpenClaw `memory_forget` | Memory files only | URI must match a user, peer, or agent memory path. A search-based delete runs only for a single candidate scoring at least 0.85; otherwise the candidates are listed. Always non-recursive |+| Hermes `viking_forget` | One user memory `.md` file | Rejects directories, non-`.md` files, generated `.abstract.md` and `.overview.md` files, and URIs with a query or fragment |+| LangChain `viking_forget` | Any URI | Exposed only with `profile="admin"` or `allow_forget=True`; the model controls `recursive` |+| Open WebUI | Nothing | No delete tool |-**Quick scope reference** (these settings only take effect on the specified harnesses):+Skills follow their own path. Create, install, or replace them with the MCP `add_skill` tool, OpenClaw's `add_skill`, `ov add-skill`, or `POST /api/v1/skills`; `add_resource` refuses skill URIs. Remove a skill with `ov skills remove` or `DELETE /api/v1/skills/{name}`. MCP `forget` and `ov rm` can delete a skill directory, but they leave the skill's privacy configuration behind. See [Skills](../api/04-skills.md).-- `OPENVIKING_COMMIT_TURN_THRESHOLD`: cursor only (`trae`, `trae-cn`, and `zcode` commit on every Stop and ignore this threshold).-- `OPENVIKING_WRITE_PATH_ASYNC`: claude-code / codex / zcode.-- Recall digest: `OPENVIKING_RECALL_COMPRESS=server` is supported across memory integrations; local `client` mode is limited to Claude Code / Codex. See [§3.2.5](#_3-2-5-recall-digest) for modes and defaults.-- `OPENVIKING_RECALL_DEDUP_TURNS`, `OPENVIKING_RECALL_QUERY_EXPANSION`, `OPENVIKING_PEER_SOURCE`, `OPENVIKING_SKILL_CATALOG`, `OPENVIKING_SKILL_CATALOG_TOKEN_BUDGET`, the workspace config files and the ovcli.conf `plugin` section: every harness that resolves through the shared loader — claude-code / codex / cursor / trae / trae-cn / zcode / opencode / dsh / pi. openclaw and hermes have configuration systems of their own.-## 3.2 Automatic recall and injection+<a id="_3-dimensions-in-detail"></a><a id="_3-2-automatic-recall-and-injection"></a>-### 3.2.1 Mechanism foundation: one shared pipeline, two server-side paths+## Automatic recall and session-start context-Recall for the JS-family harnesses is managed through a three-level degradation chain within `recall-core.mjs`:+<a id="_3-2-1-mechanism-foundation-one-shared-pipeline-two-server-side-paths"></a>-1. **Context face**: Calls `POST /api/v1/search/search` with `mode:"context"` and `purpose:"coding"`. Its core design principle is "declare intent only, leave the mechanism to the server." Parameters like `quotas`, `max_tokens`, `query_expansion`, and `rewrite_max_bullets` are transmitted only if explicitly configured by the user (indicated by a sentinel field); otherwise, server defaults are applied.-2. **Legacy `/recall`**: If the context face request returns a 400 or 422 error and the response body contains marker fields like `extra`, `mode`, or `unexpected`, the server is identified as an older version. A 6-hour negative cache is then written locally to `~/.openviking/state/context-face.json`. Because this is a machine-wide shared file, once one harness flags it, every JS-family harness on that machine will bypass the context face stage. The call then degrades to the deprecated `/api/v1/search/recall` endpoint. If `peer_scope` is rejected, it retries once without that parameter.-3. **Raw find fallback**: Concurrently requests `viking://~/memories` and `viking://~/skills` by calling `POST /search/find` twice. (Note: resources are deliberately excluded from automatic recall; resource documents are fetched by the model invoking `search` itself). The client then re-ranks the results locally (using weight rules: leaf +0.12, time intent +0.10, preference intent +0.08, and lexical overlap ≤0.2), deduplicates them, and fills up to the client token budget. The `recallTokenBudget`, `recallMaxContentChars`, and `recallPreferAbstract` configurations take effect *only* at this level. Under the context face, the injection budget is dictated by the server's `max_tokens` (which defaults to 1600).+### How recall reaches the server-On the server side, `session_id` handling diverges into two distinct execution paths:+Every integration except OpenClaw and Hermes uses the shared plugin code, which tries up to three requests:-- **Path A: `mode="context"`** (utilized by the context face and the `/recall` preset). This path manages query expansion and the cross-turn deduplication ledger. Query expansion requires passing three gates: `retrieval.enable_intent` must be enabled (default is true) → the session must be materialized (meaning the `messages.jsonl` file exists) → and either `latest_archive_overview` or `current_messages` must be non-empty. Following expansion, the original query always ranks first, followed by a maximum of 3 appended planned queries. The ledger (`.recall_log.json`) applies a cooldown to URIs whose bodies have already been sent, lasting for `dedup_turns`. If a turn "sent only the URI and not the body," that record bypasses the cooldown. Similarly, nothing is recorded if the digest determines the memory is `no_relevant`.-- **Path B: `mode="list"`** (the default behavior when the mode is omitted). In this path, `IntentAnalyzer` completely replaces `typed_queries` (meaning the original query is not guaranteed to survive), bypassing both the ledger and the original-query baseline. Callers that land in this path include codex's second-level degradation `searchScope`, hermes's `viking_search(mode="deep")`, and the preferred prefetch path. Although they carry a `session_id`, they do not benefit from the context face's query expansion or deduplication features.+1. **Context search.** `POST /api/v1/search/search` with `mode: "context"`, `purpose: "coding"`, and the session ID. Budgets, quotas, query expansion, and digest options are sent only when you configure them; otherwise the server defaults apply, including a 1,600-token injection budget (`max_tokens`).+2. **Legacy recall.** If the server rejects context mode as an older version, the plugin records that in `~/.openviking/state/context-face.json` for six hours and calls `/api/v1/search/recall` instead. The file is shared by every integration on the machine, so one integration's result applies to all of them.+3. **Plain find.** As a last resort the plugin runs `find` on `viking://~/memories` and `viking://~/skills`, ranks the results locally, and fills its own token budget. `recallTokenBudget`, `recallMaxContentChars`, and `recallPreferAbstract` apply only at this step.-**Three key notes on `dedup_turns`:**-① **Server default:** The server default for the context face is **0**. The familiar default of "5" actually originates from the `recall-core.mjs` client fallback and the `/recall` preset (the latter applying only when a `session_id` is present). Therefore, a third-party application hitting the API directly without the shared library must explicitly send `dedup_turns` to enable cross-turn deduplication, even if a `session_id` is provided.-② **Turn counting:** A "turn" counts individual messages, not full conversation rounds (since `_resolve_turn` relies on `total_message_count`). For a harness that pushes user and assistant messages simultaneously, the default of 5 roughly equals 1-2 actual conversation rounds.-③ **Edge cases with auto-settings:** If `autoCapture=0` and `autoRecall=1`, the message count remains at 0, meaning the ledger clock never advances. As a result, URIs whose bodies were previously sent remain cooled down for the entire session. To disable deduplication entirely, use `OPENVIKING_RECALL_DEDUP_TURNS=0`.+The shared-plugin recall pipeline excludes resources; the model searches resource documents by calling `search` itself. Hermes can include resources when its resource-recall option is enabled.-### 3.2.2 Decision matrix+The server handles a session ID in two ways:-The table shows default recall paths. Enabling server compression changes the request path as described in §3.2.5.+- **Context mode** (context search and legacy recall) expands the query from the conversation and keeps a per-session ledger of injected memories. Expansion needs `retrieval.enable_intent` (on by default), a session that already has messages, and either an archive overview or current messages. The original query stays first, followed by up to three planned queries.+- **List mode** (the default when `mode` is omitted) lets intent analysis replace the query, so the original query may not survive, and it skips the ledger. Codex's second fallback, Hermes's `viking_search(mode="deep")`, and Hermes's preferred recall path land here. They send a session ID but do not get expansion or deduplication.-| harness | trigger | query construction | session_id | server path | injection format / location | digest (client)* |-|---|---|---|---|---|---|---|-| claude-code | every `UserPromptSubmit` | prompt verbatim, trimmed | ✅ `cc-` | A (context face) | `<openviking-context>` → `hookSpecificOutput.additionalContext` | ✅ local/server (default auto, [§3.2.5](#_3-2-5-recall-digest)) |-| codex / trae-cli | every `UserPromptSubmit` (hard 120s deadline for the whole hook) | prompt verbatim | ✅ `cx-` (derived deterministically, no state read) | A; second-level degradation searchScope lands in B | `<openviking-context source="auto-recall" format="digest">` | ✅ local `codex exec` ([§3.2.5](#_3-2-5-recall-digest)) |-| cursor | `beforeSubmitPrompt` | prompt verbatim; deduped by event id and a 500ms window, reusing the cached block for the same promptHash | ✅ `cu-` | A | `additional_context` | ❌ |-| trae / trae-cn | `UserPromptSubmit` | prompt with prior injection blocks stripped (reads `input.prompt` only) | ✅ `tr-`/`trcn-` | A | `additionalContext` | ❌ |-| zcode | `UserPromptSubmit` | three kinds of injection block stripped (including `<system-reminder>`) | ✅ `zc-` | A | `additionalContext` (strict JSON) | ❌ |-| opencode | v1: every `chat.message`; v2: every `prompt` | v1 concatenates non-synthetic text parts; v2 reads prompt text directly | ✅ `oc-` | A (timeoutMs=30000) | v1 prepends a synthetic part; v2 stores message metadata and injects before that user message in the context hook | ❌ |-| dsh | `agent/pre-step` waterfall (await next first, then append) | every message in the claimed batch (filtering out its own injected content) | ✅ `dsh-` | A | appended to the end of `decision.messages` via `createUserMessage` (source: plugin/openviking-memory) | ❌ |-| pi | queued during `before_agent_start`; retrieval runs inside the `context` event (this turn's prompt gets this turn's memories) | prompt verbatim | ✅ `pi-` (omitted before the session exists) | A | prepended to the last real user message (idempotency checked via `<openviking-context`) | ❌ |-| openclaw | context-engine transformContext assemble (7 passthrough gates) | plain text of the last user message, cleaned and cut to 4000 characters | ❌ (`/find` has no such field) | `/find` | prepended into the last user message as `<relevant-memories>` + `Source: openviking-auto-recall` | ❌ |-| hermes | `prefetch` runs synchronously before every API call | raw user input, with two layers of skill scaffolding stripped; skipped under 5 characters | partial (only on the preferred `search/search` path, which lands in B; omitted when degrading to `/find`) | B / find | `<memory-context>` fenced block appended to the current user message (request body only, never written back to storage) | ❌ |--\* The digest column describes local compression. All memory integrations can opt into server compression through context-search rewrite; see [§3.2.5](#_3-2-5-recall-digest). The `ov` CLI does not provide automatic recall.--### 3.2.3 Profile / opening injection--- **Implementation**: `profile-inject.mjs` reads the full `viking://user/<space>/memories/profile.md`, alongside a recursive listing of the `preferences/` and `entities/` directories (`abs_limit=512`). The budget estimation logic is CJK-aware: characters ≥U+3000 count as 1.5 tokens per character, while all others are calculated as characters divided by 4. The profile consumes half of the available budget. If the limit is exceeded, the middle section is elided, preserving "the first 8 lines + the tail." If a directory listing exceeds the limit, it drops further entries until a `... +N more` note fits.-- **Who injects, when, and with what budget**:- - **claude-code**: On `SessionStart` (all sources, 10000 budget).- - **codex**: On `SessionStart` (startup/clear/resume, 10000 budget).- - **cursor / trae×2 / zcode**: On `SessionStart` (10000 budget, 2s debounce).- - **opencode**: Once per session on the first `chat.message` (10000 budget, deduplicated by an in-process `Set`, subagent sessions skipped). Note that opening injection is attempted only once per session and does not retry in-process after a failure.- - **dsh**: Posts `profileDelivered` once per session (10000 budget; not re-posted after compaction).- - **pi**: Injected into the `systemPrompt`, re-assembled for every prompt (10000 budget, always resident).- - *Note:* `openclaw` does not perform profile injection. Hermes uses its own session-start reader for the user profile and preferences/entities listings, with a default `profile_token_budget` of 6000.-- **Skill catalog** (`<available-skills>`): `buildProfileBlock()` appends it inside the same `<openviking-context>` envelope, after `<user-profile>` and `<available-memories>`, so each harness using the shared profile loader injects it together with the profile (codex covers trae-cli). One `GET /api/v1/skills?node_limit=200` returns the user's own skills and the account-shared `viking://agent/skills`. Own skills are listed first, and a shared skill whose name the user also owns is omitted. Each description is cut to about 40 tokens by the same CJK-aware estimate, and envelope tags inside a description are escaped.- - **Budget and switch**: `skillCatalogTokenBudget` (default 1200 tokens, range 0-20000, env `OPENVIKING_SKILL_CATALOG_TOKEN_BUDGET`) is the block's own budget and is not taken from `profileTokenBudget`. `skillCatalog` (default true, env `OPENVIKING_SKILL_CATALOG`) turns the block on or off, and a budget of 0 also turns it off. Both are declared in `config-schema.mjs`, so the ovcli.conf `plugin` / `plugin.<harness>` sections set them like any other knob.- - **Degradation**: Every entry is listed with its description when that fits. Otherwise the block lists names only, and if even the names do not all fit, it ends with `... +N more, search OpenViking skills to find the rest`. When not even one name fits, it shrinks to a single line, `<available-skills>N OpenViking skills; search OpenViking skills to find them.</available-skills>`. With no skills, or on a server without `GET /api/v1/skills`, the block is omitted.- - **Size cap**: `sessionStartMaxBytes` (env `OPENVIKING_SESSION_START_MAX_BYTES`) caps the whole session-start context in UTF-8 bytes: 9500 for claude-code and codex, whose hosts save hook context over about 10,000 characters or bytes to a file and show only a preview, 20000 for zcode, which drops stdout over 32 KB, and no cap elsewhere. Under it the budgets shrink; if the block still does not fit, the memory index is dropped first, then the skill catalog. On resume/compact the session archive takes up to half, truncated with a pointer to `viking://~/sessions/<id>/history/`, and on resume claude-code and codex skip a profile block identical to the one the session already received.- - **Example** (claude-code, `source="startup"`):- ```text- <openviking-context source="startup">- <user-profile uri="viking://user/default/memories/profile.md">...</user-profile>- <available-memories>...</available-memories>- <available-skills>- OpenViking skills (stored in OpenViking, not local files). Before following one, read <dir>/<name>/SKILL.md with the OpenViking read tool.- viking://user/default/skills/- - pr-review — Review a pull request against the team checklist.- viking://agent/skills/- - deploy-runbook — Shared deployment runbook for the payments service.- </available-skills>- </openviking-context>- ```-- **Archive injection** (pulls the previous archive summary back upon resume):- - **claude-code**: `source=resume/compact`, `token_budget=32000`.- - **codex**: On resume, when the local `ovSessionId` has already been cleared (32000 budget / truncated to 6000 characters).- - **opencode**: Executed as part B of the opening injection (32000 budget).- - **pi**: Active in non-takeover mode (32000 budget).-- **Repo context injection**: Unique to `opencode`. It inserts the list of indexed repositories into the system prompt via `experimental.chat.system.transform`.--### 3.2.4 Timeout and budget chain--- **Family A client derivation**: With rewrite, the timeout is `max(timeoutMs, 45000)`; with expansion, it is `max(timeoutMs, 15000)`. The corresponding server-side fuses are 5s (expansion) and 30s (rewrite). By design, the client budget accommodates every server stage, reducing premature client timeouts; an outer host deadline can still terminate the hook.-- **Actual timeout values**:- - **claude-code (cc)**: 15s (against a 60s hook budget).- - **codex**: Recall enforces a hard 120s deadline for the entire hook, plus a 110s compression subprocess.- - **cursor / trae×2 / zcode**: 15s (against a 20s host hook budget).- - **opencode**: 30s. **dsh**: 10s configured HTTP default, raised to at least 15s for context expansion (`dsh` blocks the pre-step). **pi**: 15s.- - **openclaw**: Imposes a 5s hard timeout around the entire recall flow (including a 500ms health precheck). Since the default `recallPreferAbstract=false` means every leaf memory costs one extra read, this budget allows at most 1 find + 6 reads + 1 health check.- - **hermes**: 4s total / 3s per request (configurable).-- **Injection budget**: The server's `max_tokens` defaults to 1600 (Family A harnesses do not send this by default, allowing the server to dictate the limit). Both `openclaw` and `hermes` utilize a 4000-character budget, opting to "skip an entry that does not fit" rather than truncating it.--### 3.2.5 Recall digest--**Server implementation (available to all callers)**: The context retrieval face (covering REST `mode="context"` and legacy `/recall`) accepts a `rewrite` parameter—which can be `false`, `true`, or `"auto"` (defaulting to `false`)—alongside `rewrite_max_bullets` (defaulting to 6, with a range of 1-20). When enabled, the server leverages the `query_planner` model to rewrite recall results into a digest with citations. (If `rewrite=true` but `query_planner` is unconfigured, it falls back to the main `vlm`; `"auto"` only takes effect if `query_planner` is explicitly configured). The digest features an `OpenViking memory digest:` header followed by bullet points (`- `). Each bullet must be ≤500 characters and must cite a valid `viking://` URI from the hit set (bullets with missing or out-of-range citations are dropped). If the model determines there are no relevant memories, it emits a sentinel value and clears the injection block, ensuring that turn is not recorded in the deduplication ledger. This model call is protected by a fuse (`retrieval.recall_rewrite_timeout_s=30s`). On timeout, it falls back to providing the un-rewritten, rendered block (`rewrite.py:78-141`, `pipeline.py:122-130`, `search.py:195-196`).--**Client configuration**: Automatic recall uses `OPENVIKING_RECALL_COMPRESS`, corresponding to `recallCompress` in shared configuration (`recallRewrite` remains a compatibility alias).+Cross-turn deduplication (`dedup_turns`):++- The server default in context mode is **0**, which disables it. The shared plugins send 5 (`recallDedupTurns`). A direct API caller must send `dedup_turns` itself, even with a session ID.+- The window counts messages, not conversation rounds. When both user and assistant messages are captured, 5 covers about two rounds.+- With automatic capture off and recall on, the message count never moves, so a memory already injected stays suppressed for the rest of the session. Set `OPENVIKING_RECALL_DEDUP_TURNS=0` to turn deduplication off.++<a id="_3-2-2-decision-matrix"></a>++### Recall by integration++The table shows the default path. Turning on [recall digests](#recall-digest) changes the request.++| Integration | Runs on | Query | Where the context goes |+|---|---|---|---|+| Claude Code | Every `UserPromptSubmit` | The prompt, trimmed | `<openviking-context>` in `additionalContext` |+| Codex, TraeCode CLI 2.0 | Every `UserPromptSubmit`; the whole hook has a 120-second deadline | The prompt | `<openviking-context source="auto-recall">` |+| Cursor | `beforeSubmitPrompt` | The prompt; repeated events within 500 ms reuse the previous result | `additional_context` |+| TRAE, TRAE CN | `UserPromptSubmit` | The prompt, with earlier injected blocks removed | `additionalContext` |+| ZCode | `UserPromptSubmit` | The prompt, with three kinds of injected block removed, including `<system-reminder>` | `additionalContext`, strict JSON |+| Kimi Code | `UserPromptSubmit` | The prompt | Plain context text, not JSON |+| OpenCode | v1: every `chat.message`; v2: every prompt | Text parts of the message | v1 prepends a synthetic part. v2 stores the result in message metadata and injects it before that message at each model step, without a new request |+| DSH | `agent/pre-step` | Every message in the claimed batch, minus its own injected content | Appended as a user message |+| pi | Queued at `before_agent_start`, run in the `context` event | The prompt | Prepended to the last real user message, so this turn's prompt gets this turn's memories |+| OpenClaw | Context assembly | Last user message, cleaned and cut to 4,000 characters | `<relevant-memories>` prepended to the last user message |+| Hermes | Before every model call | User input of 5 characters or more, with skill scaffolding removed | `<memory-context>` appended to the current user message in the request only; never stored |++<a id="_3-2-3-profile-opening-injection"></a>++### Session-start context++Integrations that use the shared plugin code inject one `<openviking-context>` block at session start. It holds the user profile (`viking://user/<space>/memories/profile.md`), an index of the `preferences/` and `entities/` memories, and an `<available-skills>` catalog:++```text+<openviking-context source="startup">+<user-profile uri="viking://user/default/memories/profile.md">...</user-profile>+<available-memories>...</available-memories>+<available-skills>+ OpenViking skills (stored in OpenViking, not local files). Before following one, read <dir>/<name>/SKILL.md with the OpenViking read tool.+ viking://user/default/skills/+ - pr-review — Review a pull request against the team checklist.+ viking://agent/skills/+ - deploy-runbook — Shared deployment runbook for the payments service.+</available-skills>+</openviking-context>+```++When each integration injects it:++| Integration | When |+|---|---|+| Claude Code | `SessionStart`, every source |+| Codex | `SessionStart` on startup, clear, and resume |+| Cursor, TRAE, TRAE CN, ZCode | `SessionStart` |+| Kimi Code | The first prompt; retried on later prompts until it succeeds |+| OpenCode | The first message of each session; not retried after a failure, and skipped for subagent sessions. The list of indexed repositories also goes into the system prompt |+| DSH | Once per session; not sent again after compaction |+| pi | In the system prompt, rebuilt every turn |+| OpenClaw | Not injected |+| Hermes | Its own reader loads the profile and the preferences and entities listings, with a 6,000-token default budget |++Budgets and limits:++- `profileTokenBudget` (default 10,000 tokens) covers the profile and the memory index. The profile gets half. An oversized profile keeps its first 8 lines and its end; an oversized listing ends with `... +N more`. Token estimates count CJK characters as 1.5 tokens and other text as four characters per token.+- `skillCatalogTokenBudget` (default 1,200 tokens, `OPENVIKING_SKILL_CATALOG_TOKEN_BUDGET`) is a separate budget for the skill catalog. `skillCatalog` (`OPENVIKING_SKILL_CATALOG`) or a budget of 0 turns the catalog off.+- The catalog comes from one `GET /api/v1/skills` request. The user's own skills come first, and an account skill with the same name as a user skill is left out. Each description is cut to about 40 tokens. If descriptions do not fit, the catalog lists names only; if names do not fit, it ends with `... +N more`, or shrinks to a one-line count. Servers without that endpoint get no catalog.+- `sessionStartMaxBytes` caps the whole block in UTF-8 bytes: 9,500 for Claude Code and Codex, whose hosts move hook output above about 10,000 characters into a file and show only a preview; 20,000 for ZCode, which drops output above 32 KB; no cap elsewhere. Above the cap, the memory index is dropped first, then the skill catalog.++On resume, some integrations also inject the previous archive summary, with a 32,000-token budget: Claude Code on resume and compact, Codex on resume after its local session was cleared, OpenCode at session start, and pi when takeover is off. Claude Code and Codex skip a profile block identical to the one the session already received.++<a id="_3-2-4-timeout-and-budget-chain"></a>++### Timeouts and budgets++The server stops query expansion after 5 seconds (`retrieval.recall_intent_timeout_s`) and digest rewriting after 30 seconds (`retrieval.recall_rewrite_timeout_s`). The shared plugins raise their context-request timeout to at least 15 seconds when expansion is on and at least 45 seconds when a digest is requested, so the client waits for every server stage. A host deadline can still end the hook first. To change these values, see [Tune recall latency](./19-recall-tuning.md#request-timeout).++| Integration | Recall timeout |+|---|---|+| Claude Code | 15 seconds, inside a 60-second hook limit |+| Codex | A 120-second deadline for the whole hook, including a local compressor of up to 110 seconds |+| Cursor, TRAE, TRAE CN, ZCode | 15 seconds, inside a 20-second host limit |+| OpenCode | 30 seconds |+| DSH | 10 seconds, raised to at least 15 with query expansion. Recall blocks the pre-step |+| pi | 15 seconds |+| OpenClaw | 5 seconds for the whole recall, including a 500 ms health check. With the default `recallPreferAbstract=false`, each memory costs an extra read, which allows at most one find and six reads |+| Hermes | 4 seconds in total and 3 seconds per request; configurable |++OpenClaw and Hermes limit injected recall to 4,000 characters and skip an entry that does not fit instead of cutting it.++<a id="_3-2-5-recall-digest"></a>++### Recall digest++A recall digest asks a model to rewrite recall results into a short list of cited points before they reach the agent.++**On the server.** Context search accepts `rewrite` (`false`, `true`, or `"auto"`; default `false`) and `rewrite_max_bullets` (default 6, range 1–20). The server uses the `query_planner` model; with `rewrite=true` and no `query_planner`, it falls back to the main `vlm`, while `"auto"` runs only when `query_planner` is configured. The digest starts with `OpenViking memory digest:` and has one `- ` bullet per point. Each bullet must be at most 500 characters and cite a `viking://` URI from the results; bullets without a valid citation are dropped. If the model finds nothing relevant, the server returns `stats.rewrite="no_relevant"` and an empty block, and that turn is not recorded in the deduplication ledger. After 30 seconds the server returns the unrewritten block.++**In the plugins.** `OPENVIKING_RECALL_COMPRESS`, or `recallCompress` in the shared settings, picks the mode. `recallRewrite` is still accepted as an alias.| Mode | Behavior || --- | --- |-| `off` | Do not request a digest. |-| `server` | Send `rewrite: true` and prefer the server digest. |-| `client` | Use a local compressor; supported by Claude Code and Codex. |-| `auto` | Claude Code and Codex prefer an available local compressor, otherwise sending `rewrite: "auto"`. Integrations without a local compressor send `rewrite: "auto"` directly. |+| `off` | No digest |+| `server` | Send `rewrite: true` and prefer the server digest |+| `client` | Use a local compressor; Claude Code and Codex only |+| `auto` | Claude Code and Codex use a local compressor when one is available and otherwise send `rewrite: "auto"`. Other integrations send `rewrite: "auto"` |++Claude Code and Codex default to `auto`; the other integrations default to `off`. Server digests are supported by Claude Code, Codex, OpenCode, DSH, pi, Cursor, TRAE, TRAE CN, ZCode, OpenClaw, and the Hermes external plugin, and need a server with context-search rewrite support. The bundled Hermes provider does not support recall digests. The legacy values `1` and `0` mean `auto` and `off`. A `no_relevant` result suppresses injection; the plugin must not fall back to the raw block.++Local compressors:++- **Claude Code** checks for `claude` with `claude --version` (cached for 7 days) and runs `claude -p --model sonnet --effort low --strict-mcp-config`. The subprocess timeout defaults to 110 seconds (`recallCompressTimeoutMs`), but the 60-second prompt hook can end it sooner. Inputs under 1,500 characters are not compressed. Cited URIs are matched back to real result URIs by edit distance, and bullets that cannot be matched are dropped. On failure the plugin injects locally formatted results, or the rendered block.+- **Codex** picks a model from `~/.codex/models_cache.json` (`gpt-5.3-codex-spark` first, then `gpt-5.6-luna` with low effort; cached for 7 days) and runs `codex exec` in a read-only, ephemeral sandbox with a 110-second default timeout. One runtime failure disables local compression until the next `SessionStart`. Output is capped at 4,000 characters; failures fall back as for Claude Code.-Claude Code and Codex default to `auto`; other integrations default to `off`. Claude Code, Codex, OpenCode, DSH, Pi, Cursor, TRAE, TRAE CN, ZCode, OpenClaw, and Hermes can all opt into server compression. Legacy boolean values `1` / `0` mean `auto` / `off`. A `stats.rewrite="no_relevant"` result suppresses injection; it must not fall back to the raw block.+These settings apply to automatic recall only. An explicit MCP `search` call uses the arguments the model passes. For older-server fallbacks and host time budgets, see the [shared plugin documentation](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression) and [Tune recall latency](./19-recall-tuning.md).-Local compressor details:+<a id="_3-2-6-injection-backflow-protection"></a>-- **claude-code**: Probes for a local compressor with `claude --version` (result cached for 7 days). If found, it runs `claude -p --model sonnet --effort low --strict-mcp-config` with a default subprocess timeout of 110s (`recallTimeoutMs - 10s`; the host’s 60s prompt-hook budget can end it earlier), skips inputs under 1500 characters (`recallCompressMinInputChars`), caches per digest, and snaps cited URIs back to valid hit URIs by edit distance, dropping bullets it cannot repair. A failed subprocess falls back to locally formatted recall entries, or the rendered block when no entries are available.-- **codex**: Picks a model from `~/.codex/models_cache.json` (`gpt-5.3-codex-spark` first, then `gpt-5.6-luna` with low effort; cached for 7 days) and runs `codex --sandbox read-only --ask-for-approval never exec --ephemeral --ignore-user-config --skip-git-repo-check --output-last-message <tmp> -`, with a default timeout of `recallTimeoutMs - 10s` (110s). A runtime failure disables local compression for the rest of the session until the next `SessionStart` re-probes. Output is normalized and capped at 4000 characters; when local compression fails, locally formatted recall entries are used, or the rendered block if no entries are available. With compression off, the server digest or rendered block is used directly.+### Keeping injected context out of capture-These settings affect automatic recall. Explicit MCP calls retain their caller-supplied arguments. Cloud compression requires context-search rewrite support on the server. See the [shared plugin documentation](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression) and individual integration pages for older-server fallbacks, compressor discovery, and host time budgets.+Injected context is wrapped in fixed tags such as `<openviking-context>`, and capture removes those blocks before sending a turn, so recalled memories are not stored again as new conversation. The shared capture code also removes digest blocks, metadata fences, and timestamp prefixes. TRAE and ZCode use their own cleaning functions; ZCode's removes three kinds of injected block. OpenClaw removes `<relevant-memories>` both when it captures a turn and when it builds the next recall query. Hermes drops the calls and results of its three read-only tools from the captured batch and keeps write-tool calls.-### 3.2.6 Injection backflow protection+<a id="_3-3-session-and-commit-lifecycle"></a>-To prevent injected content from being captured a second time, the injection process wraps the content in deterministic tags (like `<openviking-context>`), which the capture mechanism then mechanically strips. Specifically, `capture-utils`' `sanitizeCapturedText` function removes injection blocks, digest blocks, metadata fences, and timestamp prefixes.+## Capture and commits-**Per-harness specifics:**-- **trae / zcode**: Utilize their own cleaning functions (zcode's strips three distinct types of injection blocks).-- **openclaw**: Strips `<relevant-memories>` twice—once when writing data back during `afterTurn`, and again when constructing the query for the next turn.-- **hermes**: Goes a step further by entirely dropping the `tool_call` and `result` of all three recall-type tools from the sync batch (while retaining write-type tools).-## 3.3 Session and commit lifecycle+<a id="_2-3-server-side-session-and-commit-semantics"></a><a id="_3-3-1-mechanism-foundations"></a>-### 3.3.1 Mechanism foundations+### How server sessions and commits work-- **Write path**: The JS family routes all writes through `batch-send.mjs` (endpoint `POST /messages/batch`, capped at 100 messages per batch to match the server's `max_length=100` limit; on a 404/405 error, it gracefully degrades to sending one message at a time). Incremental cursors are implemented per integration (e.g., `cc` and `codex` compute a cursor from the transcript turn index; `cursor` uses `sha256(index+role+content)`; `zcode` relies on the rollout `turn_id`; OpenCode v1 uses an event-stream Map while v2 reads context at execution boundaries and advances by message ID; `dsh` uses an event allowlist; `pi` uses the branch entry watermark; and `hermes` slices by the current turn).-- **Commits are client-triggered** (see [§2.3](#_2-3-server-side-session-and-commit-semantics)): The server does not auto-commit by default. Any "threshold/trigger" condition mentioned in the tables below refers strictly to client-side logic.-- **Differences in `keep_recent_count`** (determining how much of a "live tail" a commit leaves for the host): The server default is 0. Here is what each integration passes: `cc`/`codex` pass 10 on threshold commits; `cursor`, `trae×2`, and `zcode` send an empty body `{}`, meaning 0 (every commit acts as a full archive); `opencode` and `dsh` pass 10; `pi` passes 10 outside takeover mode and 3 within it (locally, this means "keep 3 user turns," but the server interprets it as a raw message count, so fewer messages are actually retained); `openclaw` passes 10 on an `afterTurn` threshold trigger and 0 on `compact`/`reset`/`memory_store` operations; `hermes` always passes 0.-- **Write-path detachment** (`async-writer.mjs`, enabled by default for `cc`/`codex`/`zcode` on `Stop`): The execution flow is drain stdin → spawn detached worker → approve → write payload → unref. *(Note: If spawning fails, approval has not yet occurred, ensuring the synchronous fallback executes exactly once).* The detached worker forms its own process group and can continue after the terminal exits. It must already have started; network errors, system termination, or server failures can still leave the write incomplete. **Side effect:** Once detachment is active, `Stop` no longer prints the `appended N turn(s)` notice (to restore this, set `OPENVIKING_WRITE_PATH_ASYNC=0`).+- **Sessions are created implicitly.** The server creates a session when it receives the first message for it, or on the first context-mode recall with that session ID. DSH is the only integration that creates its sessions explicitly.+- **A commit has two phases.** `POST /api/v1/sessions/{id}/commit` returns after phase 1 archives the messages. Its response includes a `task_id` for phase 2, memory extraction, which runs in the background. A successful commit response does not mean extraction has finished.+- **`keep_recent_count`** sets how many recent messages a commit leaves live in the session. The server default is 0, which archives everything. Claude Code, Codex, OpenCode, and DSH send 10 on threshold commits; Cursor, TRAE, TRAE CN, ZCode, and Hermes send 0; pi sends the exact message count of its last 3 user turns in takeover mode and 10 otherwise; OpenClaw sends 10 on its threshold commit and 0 on reset, `memory_store`, and compaction.+- **Server auto-commit is off by default.** `memory.session_auto_commit.enabled` defaults to `false`, and the idle scanner does not start while it is off. A new session can still get a policy from `server.user_config_defaults.auto_commit_policy`, or explicitly through `POST /api/v1/sessions`, `PATCH /api/v1/sessions/{id}/config`, the SDK, or `ov session new --auto-commit-policy-json` and `ov session config set`. A policy's defaults are 150,000 pending tokens (strictly greater than), 100 messages, an 86,400-second idle timeout, `keep_recent_count` 0, and no minimum interval. The idle timeout also needs `memory.session_auto_commit.enabled=true`. The memory plugins send no policy, so without one of these settings the client is the only thing that commits.+- **Writes are batched.** The shared plugins send up to 100 messages per `POST /messages/batch`, matching the server limit, and fall back to one message at a time when the batch endpoint returns 404 or 405.+- **Large tool output is stored separately.** The server moves tool output above 20,000 characters into a separate record and leaves a `tool_output_ref`. Plugins raise their own limit (`captureToolMaxChars`) to 1,000,000 only as a safety net.+- **Some writes run in the background.** Claude Code, Codex, and ZCode hand the `Stop` write to a detached worker by default (`OPENVIKING_WRITE_PATH_ASYNC`), so the host does not wait. The worker survives the terminal closing once it has started, but network errors or process termination can still interrupt it. While this is on, `Stop` no longer prints the `appended N turn(s)` notice.-### 3.3.2 Regular commit triggers+<a id="_3-3-2-regular-commit-triggers"></a>-| harness | turn-level threshold | explicit / boundary trigger | compaction trigger |+### When each integration commits++Thresholds in this table are client-side. They read the server's pending-token count unless noted.++| Integration | During the session | On an explicit action or boundary | Before or after compaction ||---|---|---|---|-| claude-code | Stop: `pending_tokens ≥ 20000` (reads the server value), keep 10 | SessionEnd: unconditional; SubagentStop: unconditional (no threshold); SessionStart: replays pending | PreCompact: unconditional (runs synchronously, no detach) |-| codex / trae-cli | Stop: same as above, 20000 / keep 10 | SessionEnd (Codex ≥ 0.145): unconditional, after catching up the turns Stop missed — the parent hook writes an `.ended` marker and detaches the worker (Codex budgets it at 1s, clamped to 3s); SessionStart(startup\|clear): a fallback sweep committing states that carry an `.ended` marker or have been idle >30min. a trae-cli build without `SessionEnd` falls back to the sweep and relies on the sweep | PreCompact: full commit (sends an empty body `{}`), then sets `ovSessionId=null` |-| cursor | stop: `capturedSinceCommit ≥ 8` (counted in messages, ~4 Q&A turns; purely client-side counting), keep 0 | sessionEnd: registered (but never reached in practice, see [§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)) | preCompact: unconditional |-| trae / trae-cn | Every Stop with content commits (no threshold), keep 0 | — | None (no PreCompact event upstream) |-| zcode | Same as trae (every Stop commits, keep 0; the rollout incremental cursor advances conservatively, so any missed turns are caught up on the next Stop in the same session) | — | None (no PreCompact event upstream) |-| opencode | v1 `session.idle` / v2 execution completion: after flush, `pending_tokens ≥ 20000` triggers commit, keep 10 | `session.deleted` / v1 `session.error`: forced commit; v1 dispose / v2 cleanup: forced commit | v1 fires before compacting and after compacted; v2 fires once after `session.compaction.ended` |-| dsh | `turn/end`: `pending_tokens ≥ 20000` (30s timeout), keep 10 | Teardown (see [§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)) | None (does not listen for compaction events) |-| pi (takeover on by default) | `onTurnSynced`: when the locally estimated `pendingTokens ≥ 30000` and `lastSeenUserTurns > 3`, runs commitAndAdvance (keep 3; the overview polls 15 times at 2s intervals, and if it returns empty, the boundary does not advance, but pendingTokens is zeroed and retried once it has accumulated again) | Run `/viking commit` manually | `session_before_compact` (requires a non-empty `firstKeptEntryId`) |-| pi (takeover off) | After syncBranch runs: server-side `pending_tokens ≥ 20000`, keep 10 | `session_shutdown`: unconditional commit; run `/viking commit` manually | `session_before_compact`: unconditional commit |-| openclaw | afterTurn: `pending_tokens ≥ floor(tokenBudget × 0.5)` (ratio defaults to 0.5, tokenBudget defaults to 128000, making the threshold ~64000), wait=false, keep 10 | `before_reset` (running `/new` `/reset`): wait=true, keep 0; the `memory_store` tool: wait=true, keep 0 | `compact()`: wait=true, keep 0 (Phase2 polls for up to 5 minutes) |-| hermes | No threshold commit — every trigger is a session boundary: `on_session_end` (10s drain; if incomplete, this round aborts the commit), `on_session_switch` (covers `/new`, `/resume`, `/branch`, and compaction forks, async drain budget 65s), gateway cache eviction; `/undo` and in-place compaction do not commit. An idempotency set prevents duplicate commits; keep 0 | atexit fallback | Commits at fork-style compaction boundaries; in-place compaction does not commit |-| ov CLI | None | `ov session commit`; `ov add-memory` always commits in step 3 | — |-| ingest | `pending ≥ 6000` or 5s idle, keep 0; backfill runs `commit_if_needed` at the end of every session | Runs `_flush_all()` on exit | — |-| LangChain | `CommitPolicy.mode` defaults to `never`; the `pending_tokens` mode threshold is 8000; the `always` mode triggers on every record | Up to the caller | — |--### 3.3.3 Shutdown method × harness outcome matrix--Legend: **C** = the exit event attempts to trigger a commit; **C\*** = additional conditions apply; **—** = this event does not trigger a commit; **n/a** = not applicable. A trigger does not guarantee completed archiving or memory extraction: network errors, host exit budgets, or process termination can interrupt the request. Successfully written messages remain in the server’s live area until a later commit. This table assumes server auto-commit is disabled; configured policies add the [server behavior](#_2-3-server-side-session-and-commit-semantics).--| harness | normal exit | Ctrl+C | SIGTERM | SIGHUP / close terminal / close window·tab | kill -9 / crash | recovery path |+| Claude Code | `Stop` at 20,000 pending tokens | `SessionEnd` and `SubagentStop` always commit; `SessionStart` replays queued writes | `PreCompact` always commits, synchronously |+| Codex | `Stop` at 20,000 pending tokens | `SessionEnd` (Codex 0.145+) catches up missed turns, then commits in a detached worker. `SessionStart` on startup or clear commits sessions marked as ended or idle for more than 30 minutes | `PreCompact` catches up and commits everything |+| TraeCode CLI 2.0 | Same as Codex | Same as Codex; without `SessionEnd`, only the start-up sweep | Same as Codex |+| Cursor | `stop` after 8 captured messages since the last commit (`commitTurnThreshold`), counted locally | `sessionEnd` is registered but does not run in practice | `preCompact` always commits |+| TRAE, TRAE CN | Every `Stop` that captured content | None | No pre-compaction event |+| ZCode | Every `Stop`; turns a missed `Stop` skipped are caught up from the rollout file at the next `Stop` | None | No pre-compaction event |+| Kimi Code | `Stop` after 8 captured messages since the last commit | `SessionEnd` and `Interrupt` commit when they capture new messages | `PreCompact` commits when it captures new messages |+| OpenCode | v1 `session.idle`, v2 end of execution: at 20,000 pending tokens | Session deletion, v1 `session.error`, v1 dispose, and v2 cleanup force a commit | v1 before and after compaction; v2 once after compaction ends |+| DSH | `turn/end` at 20,000 pending tokens | Cordis teardown commits each session | None |+| pi, takeover on (default) | Locally estimated 30,000 tokens with more than 3 user turns | `/viking commit` | `session_before_compact` |+| pi, takeover off | 20,000 pending tokens after each sync | `session_shutdown` and `/viking commit` | `session_before_compact` |+| OpenClaw | After a turn, at `tokenBudget × commitTokenThresholdRatio` (128,000 × 0.5 by default) | `/new`, `/reset`, and `memory_store` commit and wait | `compact()` commits and waits up to 5 minutes for extraction |+| Hermes (bundled) | None | Session end, session switch (`/new`, `/resume`, `/branch`, fork-style compaction), gateway cache eviction, and an exit handler; `/undo` and in-place compaction do not commit | At fork-style compaction only |+| ov CLI | None | `ov session commit`; `ov add-memory` creates, fills, and commits its own session | Not applicable |++<a id="_3-3-3-shutdown-method-×-harness-outcome-matrix"></a>++### What happens at exit++"Commits" means the exit path sends a commit request. "Conditional" depends on the note in the last column. Messages that were already written stay in the server session and are archived by the next commit of the same session. The table assumes server auto-commit is off.++| Integration | Normal exit | Ctrl+C | SIGTERM | Terminal or window closed | `kill -9` or crash | How the rest is recovered ||---|---|---|---|---|---|---|-| claude-code | **C** (SessionEnd → a detached child process commits, so the user does not wait) | **C** | **C** | **C** (the detached worker forms its own process group and is unaffected by SIGHUP) | **—** | Next Stop over the threshold / `/compact` / next SessionEnd |-| codex | **C** (SessionEnd → a detached worker commits, so the user does not wait; Codex ≥ 0.145) | **C\*** | **—** | **—** | **—** | C\* precondition: double `Ctrl-C` is a graceful quit and fires SessionEnd; a single one is not. Anything that does not commit is recovered at the next `SessionStart(startup\|clear)`: `ended_retry` when the marker survives, otherwise the 30min idle-TTL sweep |-| trae-cli | **—** (unless the TraeCode CLI build ships `SessionEnd`) | **—** | **—** | **—** | **—** | The 30min idle-TTL sweep at the next `SessionStart(startup\|clear)` |-| cursor | **—** (closing a chat or opening a new chat fires no event) | **—** | **—** | **—** (`sessionEnd` is registered and only fires on window_close, but by then the host has destroyed the shell-exec host, causing the hook to abort before spawn) | **—** | A session ending below the 8-message watermark leaves its tail waiting for later messages in the same session to trigger a commit |-| trae / trae-cn | **—** (no session-end-style event) | **—** | **—** | **—** | **—** | Every Stop has already committed, meaning the most data left to archive equals the last in-flight turn |-| zcode | **—** (no session-end-style event) | **C\*** | **—** | **—** | **—** | C\* precondition: The Stop for that turn had already fired when Ctrl+C arrived (the detached worker finishes writing as usual); every Stop has already committed, and missed turns are recovered by the rollout cursor on the next Stop in the same session |-| opencode | **C\*** (v1 ≥1.15.11 `dispose` or v2 cleanup calls `flushAll({commit:true})`) | **C\*** | **C\*** | **C\*** | **—** | C\* precondition: host cleanup time is finite, so slow requests or serial commits across several sessions may be cut off; v2 cleanup runs after 60 minutes of inactivity, service shutdown, and local-plugin hot reload |-| dsh | **C** (Cordis teardown triggers one 3s-timeout commit per session, no threshold) | **C** (the first one; a second Ctrl+C force-quits → —) | **C** | **—** (no SIGHUP listener) | **—** | The teardown commit and the threshold commit share a serial write chain, meaning it may not fit inside the 5s process grace period if a slow request precedes it; in the web form, closing the browser tab does not trigger a teardown |-| pi (takeover default) | **—** (supported graceful shutdown paths await `session_shutdown`, but the handler persists local takeover state and does not commit) | **—** | **—** | **—** | **—** | The next run accumulating 30000, or a manual `/viking commit` |-| pi (takeover off) | **C** (`await sync.commit()`, failures go to the pending queue) | **C** | **C** | **C** | **—** | — |-| openclaw | **—** (upstream sends an awaited `session_end(reason=shutdown\|restart)`; the handler caches agentId and returns without triggering a commit; `gateway_stop` is not registered; no signal handling) | **—** | **—** | **—** | **—** | Explicit `/new` `/reset` and the ~50% threshold; sessions below the threshold rely on these two paths for archiving |-| hermes | **C\*** (atexit `_run_cleanup` → 10s flush → on_session_end) | **C\*** (both interactive and non-interactive trigger atexit) | **C\*** (`_signal_handler`, grace period defaults to 1.5s → clean exit → atexit) | **C\*** (SIGHUP follows the same path as SIGTERM) | **—** (atexit does not run) | If the drain does not finish, this round aborts the commit (avoiding a half-written commit); the Hermes exit watchdog can interrupt a slow commit |-| ov CLI | n/a (one-shot command) | n/a | n/a | n/a | n/a | No pending queue; just re-run a failed command |-| ingest | **C** (`finally _flush_all`) | **C** (SIGINT → stop) | **C** | **—** (no SIGHUP handler) | **—** | Crash recovery through the cursor store: `needs_commit` is persisted in the cursor store, and the subsequent run's reconciliation completes the commit |-| LangChain / Open WebUI / Agent Plugins / generic MCP | **—** (no session lifecycle hooks; the `DELETE /mcp` sent by an MCP proxy on exit only releases the protocol session and does not trigger memory commits) | — | — | — | — | LangChain relies on the caller's `close()`; the in-process pending-commit set disappears alongside the process |--**Three reading notes**:--1. Five integrations attempt a commit on a normal exit: `claude-code`, `opencode` (≥1.15.11), `dsh`, `pi` (takeover off), and `hermes`. The rest rely on the recovery mechanisms detailed in the "recovery path" column.-2. No integration commits under `kill -9` — messages already submitted remain in the server's live area and are archived the next time the same session triggers a commit. The server offers a per-session idle fallback ([§2.3](#_2-3-server-side-session-and-commit-semantics)), which the current plugins do not utilize by default.-3. `trae×2` and `zcode`, which commit on every turn, offer the simplest shutdown semantics (the maximum data left to archive equals the last round that never reached Stop), at the cost of a full archive and memory extraction on every Stop (keep 0).--### 3.3.4 pending queue / offline compensation comparison--| harness | mechanism | notes |-|---|---|---|-| cc / cursor / trae×2 / zcode / opencode / dsh / pi | On-disk queue `~/.openviking/pending` (0700/0600) | Only retryable failures are queued (4xx errors, including 401/403, are considered non-retryable and are not queued, though they appear in debug logs); replay runs at session start: ≤50 entries per run, ≤3 attempts per entry, TTL 7 days; `.processing` claims entries atomically, with a 10min stale reclaim; an addMessage failure breaks execution immediately to preserve order |-| codex / trae-cli | Transcript + persisted cursor | New captures do not enter the pending queue. The cursor advances only for successfully sent messages; later capture or the SessionStart sweep resends the remaining tail. SessionStart also replays existing shared pending entries. |-| openclaw | No local queue | An addSessionMessage failure is caught, and that turn's messages are not replayed |-| hermes | In-process upload threads; pending-commit markers under `$HERMES_HOME/openviking/pending_sessions/` | On POSIX, startup recovery commits sessions left pending by dead runs. Unsent messages are not replayed from disk. |-| LangChain | In-process `_pending_commit_sessions` set | A failed commit is retried automatically during the next record; nothing is written to disk. On partial success, it raises an `OpenVikingPartialWriteError` (carrying `messages_written`, `input_messages_consumed`, and `context_attached`, allowing the caller to slice by position and retry the suffix) — making this the only protocol across all integrations that reports partial success |-| ingest | SQLite cursor store + single-instance lock | The intent is persisted before appending. After a crash, a reconciliation process checks the server's message count to determine if the batch landed—providing recovery of partially delivered batches |+| Claude Code | Commits | Commits | Commits | Commits | No | `SessionEnd` hands the commit to a detached worker in its own process group, which SIGHUP does not stop. Otherwise the next threshold, `/compact`, or `SessionEnd` |+| Codex | Commits | Conditional | No | No | No | A double Ctrl+C quits cleanly and fires `SessionEnd`; a single one does not. Anything missed is committed at the next `SessionStart` on startup or clear: at once if the end marker survived, otherwise after 30 minutes idle |+| TraeCode CLI 2.0 | No, unless the build has `SessionEnd` | No | No | No | No | The 30-minute idle sweep at the next `SessionStart` |+| Cursor | No | No | No | No | No | Closing or switching a chat fires no event. `sessionEnd` fires only on window close, after the host has already stopped running hook commands. Messages below the 8-message threshold wait for later messages in the same session |+| TRAE, TRAE CN | No | No | No | No | No | Every `Stop` already committed, so at most the turn in progress is lost |+| ZCode | No | Conditional | No | No | No | Ctrl+C after that turn's `Stop` fired lets the detached worker finish. Every `Stop` commits, and missed turns are caught up at the next `Stop` |+| Kimi Code | Conditional | Conditional | Not verified | Not verified | No | `SessionEnd` and `Interrupt` commit only when they capture new messages; a tail already captured by `Stop` waits for the next commit |+| OpenCode | Conditional | Conditional | Conditional | Conditional | No | v1 1.15.11+ `dispose` and v2 cleanup commit every session, but host cleanup time is limited, so slow requests or many sessions can be cut off. v2 cleanup also runs after 60 minutes idle and on plugin hot reload |+| DSH | Commits | Commits | Commits | No | No | Teardown gives each session one 3-second commit, queued behind any slow write, inside a 5-second process grace period. A second Ctrl+C force-quits without it. Closing a browser tab in the web form does not tear down |+| pi, takeover on | No | No | No | No | No | `session_shutdown` saves takeover state but does not commit. The next run that reaches the threshold, or `/viking commit` |+| pi, takeover off | Commits | Commits | Commits | Commits | No | A failed commit goes to the offline queue |+| OpenClaw | No | No | No | No | No | The `session_end` handler does not commit. Archiving relies on `/new`, `/reset`, and the threshold |+| Hermes (bundled) | Conditional | Conditional | Conditional | Conditional | No | The exit handler drains uploads for up to 10 seconds, then commits; if the drain does not finish, it skips the commit instead of committing half a session. SIGTERM and SIGHUP get a 1.5-second grace period by default, and the Hermes exit watchdog can cut a slow commit short |+| LangChain, Open WebUI, Agent Plugins, MCP clients | No | No | No | No | No | No session hooks. The `DELETE /mcp` an MCP proxy sends on exit only closes the protocol session. LangChain relies on the caller's `close()` |++What this means in practice:++- **Commits at a normal exit:** Claude Code, Codex 0.145+, OpenCode, DSH, pi with takeover off, and Hermes. The others rely on the recovery in the last column.+- **No integration commits after `kill -9`.** Written messages stay live until the next commit of that session. A server auto-commit policy with an idle timeout is the only server-side fallback, and the plugins do not configure one.+- **TRAE, TRAE CN, and ZCode** have the simplest exit behavior because every turn commits, at the cost of a full archive and extraction on every `Stop`.++<a id="_3-3-4-pending-queue-offline-compensation-comparison"></a>++### Offline retries++| Integration | What happens when a write fails |+|---|---|+| Claude Code, Cursor, TRAE, TRAE CN, ZCode, Kimi Code, OpenCode, DSH, pi | Retryable failures go to an on-disk queue under `~/.openviking/pending`. It is replayed at session start: up to 50 entries per run and 3 attempts per entry, kept for 7 days. Network errors, 408, 429, and 5xx are retryable; other 4xx responses, including 401 and 403, are not queued. A failed message stops the replay so order is kept |+| Codex, TraeCode CLI 2.0 | New captures are not queued. The transcript cursor moves only past messages the server accepted, so the next capture or start-up sweep resends the rest. `SessionStart` still replays queued entries |+| OpenClaw | No queue. A failed turn is not sent again |+| Hermes (bundled) | Uploads run in in-process threads and are not replayed from disk. Pending-commit markers under `$HERMES_HOME/openviking/pending_sessions/` let a later start commit sessions left by a dead run (POSIX only) |+| LangChain | A failed commit is retried on the next record, in memory only. A partial write raises `OpenVikingPartialWriteError` with counts that let the caller retry the remaining messages |+| Log ingestion | A SQLite cursor store records each batch before sending. After a crash, the next run checks the server's message count to decide whether the batch arrived |-### 3.3.5 subagent session comparison+<a id="_3-3-5-subagent-session-comparison"></a>-| harness | handling |+### Subagents++| Integration | Subagent handling ||---|---|-| claude-code | Separate subagent sessions: SubagentStart derives a separate `cc-<sid>__subagent-<agent_id>` session, and SubagentStop reads the subagent transcript, pushes it, commits unconditionally, and clears the state |-| codex / trae-cli | No separate session: Subagent output (`agent_message` / `sub_agent_activity`) is folded into the main session's assistant/tool components |-| opencode | `oc-<parent>__subagent-<child>` hangs under the parent namespace; session-start injection skips subagents (recall does not); v2 maps `parentID` from `session.created`, then reads context when execution ends |-| dsh | Each subagent operates as a separate `dsh-<id>` session, preserving no parent-child relationship; N subagents = N profile injections + N separate sessions |-| hermes | `delegate_task` passes `skip_memory=True` → the subagent is disconnected from OV (no session, recall, or tool surface); subtask output is not fed back |-| cursor / trae×2 / zcode / pi / openclaw | No specific subagent handling (anything generating its own session ID becomes its own session; otherwise, it mixes into the main session. `openclaw` can mask this behavior using `bypassSessionPatterns`) |-| ingest | The `claude_code` adapter skips `isSidechain` / `isMeta` records, meaning subagent conversations are not ingested |-## 3.4 Compaction takeover--### 3.4.1 Decision matrix--| harness | Stance on host compaction | Before compaction | After compaction |+| Claude Code | Each subagent gets its own session, `cc-<id>__subagent-<agent_id>`. `SubagentStop` sends its transcript and commits |+| Codex, TraeCode CLI 2.0 | Subagent output is folded into the main session |+| OpenCode | Subagents get `oc-<parent>__subagent-<child>` sessions. Session-start context is skipped for them; recall is not |+| DSH | Each subagent is a separate `dsh-<id>` session with no link to its parent, and each gets its own session-start context |+| Hermes | Delegated tasks run with `skip_memory=True`, so the subagent has no OpenViking session, recall, or tools, and its output is not captured |+| Cursor, TRAE, ZCode, Kimi Code, pi, OpenClaw | No special handling. A subagent with its own session ID gets its own session; otherwise its messages join the main session. OpenClaw can exclude sessions with `bypassSessionPatterns` |+| Log ingestion | The Claude Code adapter skips sidechain and meta records, so subagent conversations are not imported |++<a id="_3-4-compaction-takeover"></a><a id="_3-4-1-decision-matrix"></a>++## Host compaction++When the host shortens its context, most integrations make sure the dropped messages are committed and leave the summary to the host. pi and OpenClaw can replace the host's summary with OpenViking's archive.++| Integration | Approach | Before compaction | After compaction ||---|---|---|---|-| claude-code | No takeover | PreCompact commits synchronously. This is the only write path that does not detach, as CC rewrites the transcript immediately afterward. | A SessionStart with `source="compact"` re-injects OV's `latest_archive_overview` plus ≤5 abstracts. |-| codex / trae-cli | No takeover | PreCompact backfills uncaptured turns → full commit → `ovSessionId=null`. If the backfill is incomplete, no commit occurs and it is left for retry. There is no PostCompact wiring; it relies instead on the transcript shrinkage observed at Stop for defensive correction. | Injects the archive digest upon resume. |-| cursor / trae×2 / zcode | No takeover | Cursor: `preCompact` commits unconditionally (Trae×2/Zcode lack this upstream event). | — |-| opencode | No takeover | v1 flushes and commits before compaction; v2 captures the transcript before compaction | v1 commits again on `session.compacted`; v2 commits once on `session.compaction.ended` |-| dsh | Unaware. It does not listen for compaction events; injection rides on a pre-step user message and shrinks alongside the host's compaction. The profile is not re-sent. | — | — |-| pi | **Two-layer takeover** (on by default, [§3.4.2](#_3-4-2-pi-takeover)) | `session_before_compact`: flush → commit → `pollOverview`. On success, it returns a custom compaction summary that overrides Pi's. On failure, it fails open and falls back to Pi's default compaction. | Calls `resetBoundary` upon success. |-| openclaw | **Full takeover**: `ownsCompaction: true`, the host no longer runs its own summary ([§3.4.3](#_3-4-3-openclaw-contextengine)) | `compact()` = `commit(wait=true, keep 0)` → reads the overview back and utilizes it as the summary. | The main `assemble` rebuilds context with `[Session History Summary]`. |-| hermes | No takeover (The `on_pre_compress` interface is reserved but currently plays no role in compaction summaries.) | A fork-style compaction boundary triggers a commit of the old session, whereas in-place compaction does nothing. | — |+| Claude Code | Host summarizes | `PreCompact` commits synchronously; this is the one write that never runs in the background, because the host rewrites the transcript right after | `SessionStart` with `source="compact"` injects the archive overview and up to 5 summaries |+| Codex, TraeCode CLI 2.0 | Host summarizes | `PreCompact` catches up uncaptured turns, commits everything, and starts a new OpenViking session. If the catch-up is incomplete, it does not commit and retries later | The archive summary is injected on resume |+| Cursor | Host summarizes | `preCompact` commits | Nothing |+| TRAE, TRAE CN, ZCode | Host summarizes | No pre-compaction event | Nothing |+| Kimi Code | Host summarizes | `PreCompact` commits newly captured messages | Nothing |+| OpenCode | Host summarizes | v1 flushes and commits; v2 captures the transcript | v1 commits again on `session.compacted`; v2 commits after `session.compaction.ended` |+| DSH | Not observed | Nothing. Injected context is a user message and shrinks with the host's compaction; the profile is not sent again | Nothing |+| pi | Takeover, on by default | Commits and waits for the archive overview | The overview replaces pi's summary; on failure pi compacts as usual |+| OpenClaw | The plugin owns compaction | `compact()` commits and waits | The next context assembly rebuilds history from the server |+| Hermes (bundled) | Host summarizes | Fork-style compaction commits the old session; in-place compaction does nothing | Nothing |++<a id="_3-4-2-pi-takeover"></a>++### pi takeover-### 3.4.2 pi takeover+- **What it changes.** pi's own history is not modified. The extension rewrites the messages sent in each `context` event: everything before a boundary becomes one synthetic user message, `[OpenViking Session Context]`, holding the archive overview cut to 3,000 tokens. Its timestamp is just before the first kept message, so the provider request stays stable and prompt caching keeps working.+- **When it runs.** On token pressure, not on pi's compaction event: about 30,000 tokens with the last 3 user turns kept. The commit sends the exact message count of those 3 turns as `keep_recent_count`.+- **Where the summary comes from.** The overview of the archive that commit produced, polled up to 15 times at 2-second intervals. The boundary is stored in pi's branch as an `ov-takeover` entry, so it survives a restart.+- **When it falls back.** On a fingerprint mismatch, a history shorter than the boundary, or a missing overview, pi gets its full history. If the overview stays empty, the boundary does not move and the pending count resets until it builds up again.+- **pi's own compaction.** When it succeeds, `session_before_compact` returns the OpenViking summary to pi. Without a `firstKeptEntryId`, pi runs its default compaction.-- The takeover surface involves rewriting the messages of the `context` event; Pi's native history storage remains untouched. The trigger is token pressure (30000 tokens + keep 3 turns) rather than Pi's native compaction event.-- The replacement process: first locate the boundary, then replace every preceding message with a single synthetic user message, `[OpenViking Session Context]`. The overview within this message is truncated at 3000 tokens. Its timestamp is set to the first kept message minus 1, which stabilizes the provider payload to ensure prompt cache hits.-- The data source is `latest_archive_overview` fetched via `GET /sessions/{id}/context` (polled 15 times at 2-second intervals). This state is persisted in Pi's own branch via the custom entry `ov-takeover`.-- Failure stance: fail-open, reverting to the full history. This occurs under three fallback conditions: a fingerprint mismatch, a history shorter than the boundary, or an unavailable overview.-- Relationship to Pi's native compaction: upon success, `session_before_compact` returns `{compaction: {summary, firstKeptEntryId, …, details: {source: "openviking"}}}` to override Pi's summary. If `firstKeptEntryId` is missing, it falls through to Pi's default compaction behavior.+<a id="_3-4-3-openclaw-contextengine"></a>-### 3.4.3 openclaw ContextEngine+### OpenClaw context engine-- Implements the host's `ContextEngine` interface. The `assemble()` function splits into two branches: `transformContext` (handling recall pre-injection only, protected by 5 passthrough guards) and main `assemble` (calls `getSessionContext(tokenBudget)` → replaces the host's live history with the server response using a four-tier budget split, protected by 3 passthrough guards and a provider-message sanitization pipeline).-- `compact()` executes `commit(wait=true, keep 0)` (utilizing 500ms polling, with Phase 2 capped at 5 minutes) → `latest_archive_overview` becomes the summary, and the last segment of `archive_uri` serves as `firstKeptEntryId`. Note that `customInstructions` and `compactionTarget` are reserved interfaces that currently play no role in the compaction output.-- `ingest()` and `ingestBatch()` are deliberate no-ops; all writes are routed through `afterTurn`.-- If an archive exists, a 20-line "Session Context Guide" is injected via `systemPromptAddition`. This instructs the model to re-read the summary before claiming it has "no information" and to attempt at least two different keyword sets using `ov_archive_search`.+- OpenClaw registers the plugin as its context engine with `ownsCompaction: true`, so the host no longer writes its own summary.+- Context assembly has two parts. `transformContext` only adds recall, behind five passthrough checks. The main assembly calls `getSessionContext(tokenBudget)` and replaces the host's live history with the server's response, split across four budget tiers, behind three passthrough checks and a message-cleaning step.+- `compact()` commits with `keep_recent_count` 0, polls every 500 ms for up to 5 minutes, and returns the archive overview as the summary.+- `ingest()` and `ingestBatch()` do nothing on purpose; turns are captured after each turn.+- When an archive exists, a short guide is added to the system prompt. It tells the model to reread the summary before saying it has no information, and to try at least two keyword sets with `ov_archive_search`.-### 3.4.4 pi vs. openclaw takeover+<a id="_3-4-4-pi-vs-openclaw-takeover"></a>-| Dimension | pi takeover | openclaw ContextEngine |+### Comparing pi and OpenClaw takeover++| | pi takeover | OpenClaw context engine ||---|---|---|-| Host contract | Rewrites the messages of a single context hook | Registers a `ContextEngine` with `ownsCompaction: true` |-| Source of truth for history | Pi's local branch | OV server-side `getSessionContext` |-| Trigger | Client-side token threshold (30000) + keep 3 turns | Host invocations of `assemble` or `compact` |-| Compaction output | A single synthetic user message (truncated at 3000 tokens) | The fully rebuilt messages array plus a compaction summary |-| Failure stance | Fail-open, reverting to the full history | Passthrough, reverting to the host's live messages |-| Recall and session | The context interface carries `session_id` | `/find` does not (expansion and ledger are excluded) |+| Host contract | Rewrites messages in the `context` event | Context engine with `ownsCompaction: true` |+| Source of history | pi's local branch | The server's session context |+| Trigger | Client token threshold (30,000, last 3 user turns kept) | Each host call to assemble or compact |+| Result | One synthetic user message, up to 3,000 tokens | A rebuilt message list plus a compaction summary |+| On failure | Full history | The host's live messages |+| Recall | Context search with a session ID | `/find` without a session ID, so no expansion or deduplication |++<a id="_3-6-degradation-and-fault-tolerance"></a><a id="_3-6-1-decision-matrix"></a>++## When the server is unavailable-## 3.5 Type boundaries for writes and deletes+Recall errors are handled so the host can continue without injected memories. Requests can still delay a prompt until they finish or reach their deadline; error recovery does not mean there is no waiting.-### 3.5.1 Write boundary+| Integration | Server unreachable | Cached failure | Waiting and error propagation |+|---|---|---|---|+| Claude Code | Every hook catches the error and lets the host continue; session start skips queue replay | Context-search marker for 6 hours, local CLI check for 7 days, health for 5 seconds | Recall waits for its request or deadline before continuing. URI guard denials are intentional and separate from recall failures |+| Codex, TraeCode CLI 2.0 | Every hook catches the error and does nothing | Context-search marker; a failed local compressor stays off until the next start | Recall waits for its request or deadline, then the prompt continues |+| Cursor, TRAE, TRAE CN, ZCode | Request errors are swallowed and nothing is injected. A hook that cannot get its lock within 5 seconds skips silently | Context-search marker only, so every turn waits the full 15-second recall timeout | Up to the recall timeout each turn |+| OpenCode | Recall, capture, and cleanup errors are caught and logged | Context-search marker; health checks are not cached | Recall awaits network requests; cleanup can also wait until its deadline |+| DSH | The plugin swallows errors. Session setup failures are not cached, so each pre-step makes two 5-second health calls | Context-search marker; the user-space lookup is cached for the life of the process | Pre-step runs profile and recall in sequence, and session flush blocks |+| pi | If the health check fails at start, no tools are registered and later prompts retry quietly. A failed MCP handshake alone does not stop recall, sync, or takeover; the status line shows `tools ✗` and `/viking` prints the error | Context-search marker. The MCP handshake is retried once per turn and can use its 5-second budget before recall starts | Recall waits for its request or deadline. `session_shutdown` waits up to 30 seconds without takeover, and a network error at `turn_end` waits 10 seconds per message |+| OpenClaw | Recall is skipped if a 500 ms health check fails | None; one health check per turn | Only `memory_store` errors reach the model; `compact()` can wait up to 5 minutes |+| Hermes (bundled) | A failed connection is not retried for 30 seconds unless its settings change | The failed settings are remembered | Recall waits within its 4-second total budget before continuing without context |+| ov CLI | Most commands exit with status 1; `ov status` in table mode and `ov health` exit 0 even when unhealthy | None | Not applicable |++<a id="_3-6-2-common-timeouts"></a>++### Shared timeouts and locks++The shared plugins use a 15-second HTTP timeout (1-second minimum). MCP proxy requests time out after 15 seconds, and the `DELETE /mcp` sent on exit after 2 seconds. Cross-process locks wait 5 seconds and are considered stale after 60 seconds; queue entries being replayed are reclaimed after 10 minutes. The MCP proxy does not handle SIGHUP, so closing a terminal sends no `DELETE /mcp`; the server runs MCP statelessly, so nothing is left behind.++<a id="_3-1-integration-forms-installation-and-configuration"></a><a id="_3-1-1-decision-matrix"></a>++## Installation, sessions, and settings++The session ID prefix tells you which integration wrote a session on the server.-There are three primary guards on MCP `write` and REST `content/write` (`content_write.py`). First, the writable domain is strictly limited to `viking://resources`, `viking://user`, and `viking://agent`. Second, file extensions for new files must match the whitelist (`.md`, `.txt`, `.json`, `.yaml`, `.yml`, `.toml`, `.py`, `.js`, `.ts`). Third, the four managed subtrees (`skills/`, `peers/`, `privacy/`, `sessions/`) under the user root are designated as read-only (`_USER_MANAGED_SUBTREES`). Existing `.abstract.md` and `.overview.md` sidecars can be body-updated, but public write APIs cannot create them.+| Integration | Installed with | Session ID | Settings read from |+|---|---|---|---|+| Claude Code | Unified installer (`--harness claude`) or the plugin marketplace | `cc-<session id>`; subagents `cc-<id>__subagent-<agent_id>` | Shared settings, `plugin.claude_code` |+| Codex | Unified installer (`--harness codex`) or `codex plugin marketplace add` | `cx-<id>`, derived from the Codex session | Shared settings, `plugin.codex` |+| TraeCode CLI 2.0 | Unified installer (`--harness trae-cli`), which runs the Codex flow against `traecli` | Same as Codex | Same as Codex |+| Cursor | Unified installer; writes `~/.cursor/hooks.json` and `mcp.json` | `cu-<conversation id>` | Shared settings, `plugin.cursor` |+| TRAE, TRAE CN | Unified installer; writes `~/.trae/` or `~/.trae-cn/` hooks and MCP files | `tr-` or `trcn-` | Shared settings, `plugin.trae` or `plugin.trae_cn` |+| ZCode | Unified installer; merges into `~/.zcode/cli/config.json` and turns hooks on | `zc-<id>` | Shared settings, `plugin.zcode` |+| Kimi Code | Unified installer; managed Kimi Code plugin | `kc-<id>` | Shared settings, `plugin.kimicode` |+| OpenCode | Unified installer, npm (`@openviking/opencode-plugin`), or source | `oc-<id>`; subagents `oc-<parent>__subagent-<child>` | Shared settings, `plugin.opencode` |+| DSH | Unified installer or `dsh plugin add @openviking/dsh-memory-plugin` | `dsh-<id>` | Shared settings, `plugin.dsh`, then the Cordis patch |+| pi | Unified installer, into pi's extension directory | `pi-<id>` | Shared settings, `plugin.pi` |+| OpenClaw | ClawHub, npm installer, or offline bundle; then `openclaw openviking setup` | The session UUID, or a SHA-256 of the session key | `openclaw.json` and a few environment variables |+| Hermes (bundled) | Ships with Hermes; `hermes memory setup openviking` | Hermes's own session ID | `.env`, a linked `ovcli.conf`, and Hermes `config.yaml` |+| ov CLI | npm, `uv tool install`, cargo, or GitHub Releases | Not managed | `ovcli.conf` profiles |-### 3.5.2 Delete boundary+"Shared settings" means the layered plugin settings in [Settings and workspace files](#settings-and-workspace-files).-**Tier 1: The universal server-side defense (shared by every delete entry point).** The first statement of `VikingFS.rm`, `_ensure_delete_access` (`_access.py:182-229`), enforces five checks: namespace accessibility; ongoing user deletions (returns `FailedPrecondition`); actor-peer hidden views (returns `PermissionDenied`); namespace root protection (bare `viking://`, along with the `viking://user` and `viking://agent` roots, are unconditionally refused); and restricting deletes in `viking://temp` to ROOT only. This tier defends exclusively at the namespace root level and does not differentiate between memory, resource, or skill types. Those type-level distinctions are enforced on the client side by the subsequent three tiers.+<a id="_3-1-2-unified-installer"></a>-**Tier 2: No client-side additions (the MCP surface — which dsh and pi now reach as well — plus langchain / ov rm).** Here, the differences lie purely in the parameters. MCP `forget` deletes the URI it is handed, with `recursive=False` by default and no score guard of any kind; dsh and pi both dropped the hand-written `viking_forget` that used to pin `recursive` to false and require a match score > 0.8 before deleting by query, so neither adds anything to this tier any more. LangChain's `viking_forget` exposes `recursive` as a model-controllable parameter, although the tool is not exposed by default. The CLI command `ov rm -r` explicitly enables recursion without a confirmation prompt, whereas the TUI's `d` key enforces a y/n confirmation and bans the deletion of root or scope directories.+### Unified installer-**Tier 3: The two memory-only delete surfaces.**+`examples/memory-plugin-shared/install.sh` installs Claude Code, Codex, TraeCode CLI 2.0, Cursor, TRAE, TRAE CN, ZCode, Kimi Code, OpenCode, pi, and DSH. OpenClaw and Hermes have their own channels. Things worth knowing:-- In openclaw's `memory_forget`, three regex whitelists restrict deletions strictly to `viking://user/[…/]memories`, `viking://user/<u>/peers/<p>/memories`, and `viking://agent/[…/]memories`. Explicit URIs failing to match these are refused outright. Search-path candidates must pass this same guard first; automatic deletion only proceeds if a candidate is unique and scores ≥ 0.85. Otherwise, candidates are listed so the agent can explicitly select one. The underlying URL always pins `recursive=false`.-- Hermes `viking_forget` rejects empty inputs, non-`viking://` URIs, query/fragment suffixes, directories, non-`.md` files, and generated `.abstract.md`/`.overview.md` summaries. The bundled validator accepts user-memory layouts, including files directly under `memories/`; `memories/profile.md` is allowed. Use the server-returned URI with an explicit user ID. The external plugin also supports `viking://~/...`, rejects deprecated UID-less layouts, and verifies ownership before sending an explicit-user deletion.+- Without `--harness`, it shows a multi-select menu. The setup helpers bundled with each plugin pass `--harness` for you. When piped from `curl`, it reads answers from `/dev/tty`.+- It downloads from the documentation site, or uses the local checkout when run from one.+- Hook and MCP entries carry an `OPENVIKING_INTEGRATION_ID` marker, so a rerun replaces its own entries and leaves other tools' entries alone. Each changed file is backed up to `.bak` and replaced atomically with mode `0600`.+- The credential step writes `~/.openviking/ovcli.conf` for a local server, OpenViking Service, or a custom URL. Existing values are shown, with the API key masked, before you choose to keep or change them.+- `--uninstall` covers Cursor, TRAE, TRAE CN, ZCode, and Kimi Code. Remove the others through the host's own plugin manager.+- Node.js 18 or later is required.-**Tier 4: No deletion offered by default (LangChain / Open WebUI).** LangChain's `viking_forget` is only exposed as a tool when configured with `profile="admin"` or `allow_forget=True`. Open WebUI does not offer any deletion tools.+<a id="_3-1-3-credential-systems"></a>-**Add/delete boundary for skills:** The entry points for adding skills are the MCP `add_skill` tool, openclaw's `add_skill` (enabled by default), `ov add-skill`, and REST; `add_resource` refuses skill URIs, and MCP `write` refuses the user's own `skills/` subtree (`_USER_MANAGED_SUBTREES`); under `viking://agent/skills`, `write` is not refused yet but bypasses skill installation. The delete surfaces that remain entirely read-only for skills (permitting neither addition nor deletion) are openclaw's `memory_forget` and hermes' `viking_forget`. The MCP `forget` tool, dsh, Pi, and `ov rm` can delete a skill directory because the delete path does not check that constraint, but only `ov skills remove` and the REST `DELETE /api/v1/skills/{name}` also remove the skill's privacy configuration.-## 3.6 Degradation and fault tolerance+### Credential sources-### 3.6.1 Decision matrix+Four credential systems exist, each with its own variable names and headers. When a connection fails, first check which one the integration uses.-| harness | When the server is unreachable | Negative cache | HTTP retry | Failure blocks the host |+| Used by | Server URL | API key | Identity | Auth header ||---|---|---|---|---|-| claude-code | All hooks catch exceptions → approve (never blocks); at session-start, even pending replays are skipped | context-face 6h + host-cli probe 7d + health 5s | None (relies on pending replay); `peer_scope` degrades once; batch falls back to sequential | No (`uri-guard` deny is by design) |-| codex / trae-cli | All hooks catch exceptions → noop | context-face 6h + compressor runtime_failed (until the next startup) | Capture retries use the transcript/cursor; SessionStart also replays existing pending entries | No |-| cursor/trae×2/zcode | Fetch errors are swallowed as `status:0`, and catch returns an empty injection; silently skips if the lock isn't acquired within 5s | context-face 6h (no negative cache for unreachable servers; every turn waits the full 15s) | None | No |-| opencode | Recall, context, after-tool, event-loop, and cleanup failures are caught and logged; intentional URI-guard denials still reach the model | context-face 6h only; `/health` is uncached | No synchronous retry; the MCP proxy retries once each for 401/403 and 400/404 | No (URI-guard denial is intentional) |-| dsh | The client swallows all exceptions; `ensureState` failures are not cached (when the server is unreachable, each pre-step makes two 5s health calls) | context-face 6h + an in-process user-space cache that never expires | None; pending queue replays 3 times across processes | Yes (pre-step runs profile+recall serially; session/flush blocks) |-| pi | On health failure, `start()` returns early and registers no tools; subsequent prompts silently retry the connection. A `/mcp` handshake that fails on its own (401/403, timeout, no `/mcp`) never fails startup: recall, sync and takeover carry on, the status line shows `tools ✗`, and `/viking` prints the full error | context-face 6h; the handshake has none, so a still-failing bridge is retried once per turn and can spend its 5s budget before recall is queued | Hooks: none, pending queue only. A failed MCP transport is discarded and the next invocation reconnects; the failed call is never replayed | Partly (`session_shutdown` is awaited: ~0s with takeover, max 30s without, plus closing the MCP client; on a `turn_end` network error, each message waits 10s) |-| openclaw | Client construction never fails; health checks swallow exceptions; recall is skipped if the 500ms precheck fails | No negative cache (one 500ms health precheck per turn) | None (a single fetch); Phase2 polling in commit/afterTurn | No (except when `memory_store` re-raises; `compact()` blocks for up to 5 minutes) |-| hermes | 30s cooldown for unchanged failed connection settings; changed settings trigger a new probe | `_failed_refresh` tracks the failed settings | Trusted-identity and sync-client retries; dead-run pending commits recovered on startup (POSIX) | No |-| ov CLI | Mostly exits with 1; `ov status` in table mode always exits with 0; `ov health` exits with 0 even when unhealthy | None | Only one retry on a gateway 401 challenge | n/a (no host) |+| Shared plugin code: Claude Code, Codex, Cursor, TRAE, ZCode, Kimi Code, OpenCode, DSH, pi, Agent Plugins | `OPENVIKING_URL`, then `OPENVIKING_BASE_URL` | `OPENVIKING_BEARER_TOKEN`, then `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT`, `OPENVIKING_USER`, `OPENVIKING_PEER_ID` | `Authorization: Bearer` only |+| OpenClaw | `OPENVIKING_BASE_URL`, then `OPENVIKING_URL` | `OPENVIKING_API_KEY`, or a SecretRef | `OPENVIKING_ACCOUNT_ID`, `OPENVIKING_USER_ID` | `X-API-Key` |+| Hermes | `OPENVIKING_ENDPOINT` | `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT`, `OPENVIKING_USER`, `OPENVIKING_AGENT` | Both `X-API-Key` and `Bearer`. With a key, tenant headers are omitted unless the server asks for them, then retried once |+| ov CLI | `ovcli.conf` | `ovcli.conf` | `--account`, `--user`, `--actor-peer-id` | `X-API-Key`; Basic or Bearer depending on `auth_mode`. A key with two or more dots is also sent as Bearer |-### 3.6.2 Common timeouts+For the shared plugin code:-General HTTP timeouts are 15000ms (with a 1000ms floor). MCP proxy requests time out at 15000ms, while DELETE requests are pinned to 2000ms. Cross-process lock waits are 5s, becoming stale at 60s; pending `.processing` entries are reclaimed after 10 minutes. Note that the MCP proxy does not register SIGHUP signals (closing the terminal does not send a `DELETE /mcp` request), but since the server runs with `stateless_http=True`, the impact is minimal.+- `OPENVIKING_CREDENTIAL_SOURCE` (`env`, `cli`, or `auto`, default `auto`) chooses where credentials come from. In `auto`, any credential variable in the environment wins. Only when none is set and `ovcli.conf` has credentials does the plugin use that file instead. `env` reads no file and defaults the URL to `http://127.0.0.1:1933`.+- Hooks and the MCP proxy resolve the connection with the same function and never read the working directory, so a proxy started from the plugin directory reaches the same server with the same identity as the hooks.+- `X-OpenViking-Account` and `X-OpenViking-User` are sent only in trusted mode. With an API key, the server reads the identity from the key.-## 3.7 Additional UX comparison+The full resolution order is in [Client configuration](../configuration/02-client.md#connection-and-authentication) and the [plugin development guide](./18-plugin-development.md#_4-2-credentials-are-not-ordinary-workspace-settings).-| harness | statusline | slash command | rule/skill | setup wizard | other |-|---|---|---|---|---|---|-| claude-code | ✅ A separate process writes to `settings.json` (rich segments, 1-min TTL) | ✅ `/openviking-memory:ov` (server status + identity + injection provenance) | 4 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`, `ov-memory-doctor`) | ✅ Line-based Q&A | `uri-guard` is not gated by the plugin toggle |-| codex / trae-cli | ❌ | ❌ | The same 4 skills as claude-code | ✅ | Live checks in `README.md`'s Testing section |-| cursor | ❌ | ❌ | Rule (`alwaysApply`) + 3 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`) | ❌ (Shares the installer TUI) | Standalone `uri-guard`, independent of the plugin toggle |-| trae/trae-cn | ❌ | ❌ | None | ❌ | — |-| zcode | ❌ | ❌ | None | ❌ | — |-| opencode | ❌ | ❌ | 3 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`), only with the MCP server | ✅ | v1 has toasts; v2 logs only |-| dsh | ❌ | ❌ | 3 skills, `openviking-memory`, `openviking-skills`, and `ov-experience-memory` (own isolated `ctx.skills` provider) | ❌ | `ctx.provide("openvikingMemory")` allows other Cordis plugins to build upon it |-| pi | ✅ `ctx.ui.setStatus` | ✅ `/viking` `/viking commit` | 3 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`), via `resources_discover` | ✅ | `e2e-live.sh` |-| openclaw | ❌ | ✅ 5 commands (`/add-resource`, `/add-skill`, `/ov-search`, `/ov-query-config`, `/ov-recall-trace`) | 3 skills shipped with the plugin | ✅ (Key role detection, version compatibility checks, and a `status` command) | Gateway HTTP routes for visualizing recall traces; feature-gated RPCs; health-check script |-| hermes | ❌ | ❌ | None | ✅ Multi-level curses menus | `hermes memory status` (includes env override lists); `hermes backup` includes the default or env-selected `ovcli.conf` under `$HOME`; back up YAML-linked named files separately |-| ov CLI | ❌ | ❌ (The CLI itself acts as the command) | None | ✅ TUI wizard | Comprehensive help system (63 curated entries); language gating; `ov tui` full-screen file browser (includes in-terminal image previews) |-------# 4. Harness profile cards--Each card serves as a quick-reference entry point. It records only the facts and differences unique to a specific harness, linking back to the dimension chapters for shared mechanisms. All cards follow the same structure: Form / Capability highlights / Behavior notes / Configuration / Dimension index.--## claude-code--- **Integration docs**: [Claude Code Memory Plugin](./02-claude-code.md)-- **Form**: A Claude Code plugin (marketplace) featuring a four-in-one architecture: 9 hooks, an MCP proxy (passing through 20 tools), a slash command, a statusline, and 4 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`, `ov-memory-doctor`). Version 0.6.1.-- **Capability highlights**: The harness with the broadest hook coverage — `SessionStart` (120s) / `UserPromptSubmit` (60s) / `PostToolUse:Read` (5s, the skill-experience hook, off by default) / `PreToolUse:Read|Glob|Grep|Edit|Write|Bash` (5s, `uri-guard`: denies a file tool whose path is a `viking://` URI, pointing a Write/Edit on a skill URI to `add_skill`, and adds a notice to a Bash command that carries one) / `Stop` (45s) / `PreCompact` (30s) / `SessionEnd` (30s) / `SubagentStart` (10s) / `SubagentStop` (45s). Recall digesting is enabled by default (local `claude -p`, falling back to the server-side rewrite automatically when the local CLI is unavailable, [§3.2.5](#_3-2-5-recall-digest)). Provides full sub-session isolation via `SubagentStart`/`Stop` ([§3.3.5](#_3-3-5-subagent-session-comparison)), along with a statusline, slash command, and `uri-guard`. All shutdown paths except `kill -9` trigger a commit ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)).-- **Behavior notes**: The session ID format is `cc-<raw_CC_session_id>`, while subagents use `…__subagent-<agent_id>`. `Stop` commits at a threshold of 20000 (keep 10), and `PreCompact` commits synchronously. Automatic recall excludes resources ([§3.2.1](#_3-2-1-mechanism-foundation-one-shared-pipeline-two-server-side-paths)). The incremental cursor is stored in `/tmp` (if cleared by the system, the entire session is pushed again).-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.claude_code`), and `ov.conf` (`claude_code` as per [§3.1.4](#_3-1-4-configuration-layers)), offering roughly 70 tunable parameters. The compressor defaults to `claude`/`sonnet`/`low`; its timeout comes from `recallCompressTimeoutMs` (110s by default), subject to the host hook budget.-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | compaction [§3.4](#_3-4-compaction-takeover) | degradation [§3.6](#_3-6-degradation-and-fault-tolerance) | UX [§3.7](#_3-7-additional-ux-comparison).--## codex--- **Integration docs**: [Codex Memory Plugin](./04-codex.md)-- **Form**: A Codex plugin (marketplace). Features 6 hooks (`SessionStart` 70s / `UserPromptSubmit` 130s / `Stop` 30s / `SessionEnd` 3s / `PreCompact` 60s / `PreToolUse:Bash` 5s), an MCP proxy, and the same 4 skills as claude-code. Version 0.10.1.-- **Capability highlights**: A local recall-compression pipeline (`codex exec`, [§3.2.5](#_3-2-5-recall-digest)). `SessionEnd` (Codex ≥ 0.145) commits the session on a graceful exit, catching up any turns `Stop` missed, and a `SessionStart` fallback sweep reclaims messages left unarchived by exits that never fired it ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)). `PreToolUse:Bash` (`uri-guard`) lets a shell command that carries a `viking://` URI run and adds a notice suggesting the OpenViking MCP tools. Codex edits files through `apply_patch`, whose input has no path argument, so the guard never denies a call.-- **Behavior notes**: The session ID format is `cx-<safeId>` (derived deterministically without reading state). `SessionEnd` fires only on a graceful exit and only on Codex 0.145+, so signals, crashes, older builds and `codex app-server` deferral fall to the sweep. New captures do not enter the on-disk pending queue (the transcript/cursor owns retries, while SessionStart also replays existing pending entries, [§3.3.4](#_3-3-4-pending-queue-offline-compensation-comparison)). Idle-TTL is 1800000ms, lock wait 120000ms (configured via env). `Stop` and `SessionEnd` detach by default (the `appended N turn(s)` notice is hidden by default); a per-session mkdir lock serializes the Stop worker, PreCompact, the SessionEnd worker and the sweep. A newly registered hook has no Codex trust record, so after an upgrade `/hooks` must approve each hook the upgrade added (`SessionEnd`, `PreToolUse`).-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.codex`), and `ov.conf` (`codex`). Hooks authenticate with `Authorization: Bearer` alone ([§3.1.3](#_3-1-3-credential-systems)).-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | degradation [§3.6](#_3-6-degradation-and-fault-tolerance).--## trae-cli (TraeCode CLI 2.0)--- **Integration docs**: [TRAE Memory Integration](./13-trae.md)-- **Form**: TraeCode CLI 2.0 is a Codex-family CLI (binary `traecli`, user config `~/.trae/traecli.toml`, TUI support for `/plugins`, `/skills`, and `/mcp`). OpenViking integrates via a **codex plugin alias install**: using `--harness trae-cli` reuses the Codex installation flow, redirecting only the install parameters (binary, home, and config paths) to TraeCode CLI.-- **Capability surface**: Same plugin as Codex: 6 registered hooks, an MCP proxy, the same 4 skills, local recall compression, idle-TTL commit reclamation, and resume-archive injection. Refer to the Codex profile card. If the TraeCode CLI build lacks `SessionEnd`, the registration is ignored and every commit at shutdown goes through the idle-TTL sweep.-- **Version support**: TraeCode CLI 2.0 only. 1.0 and 2.0 are not the same CLI — only 2.0 is Codex-family, and only 2.0 can use the codex plugin alias install. The earlier standalone plugin for 1.0 (the `~/.trae/cli/hooks.json` + `[mcp_servers."openviking-memory"]` approach) has been removed from the repository. The installer still accepts `--harness trae-cli --uninstall` to clean up a copy an old install left on disk.-- **Dimension index**: Same as the Codex card.--## cursor+<a id="_3-1-4-configuration-layers"></a>-- **Integration docs**: [Cursor Memory Integration](./12-cursor.md)-- **Form**: Config-driven (modifies `~/.cursor/hooks.json` and `mcp.json`), featuring an MCP proxy, an always-on rule, and 3 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`). Includes 6 hooks: `sessionStart` (30s) / `beforeSubmitPrompt` (20s) / `beforeReadFile` (5s) / `stop` (30s) / `preCompact` (30s) / `sessionEnd` (30s). The shared library is loaded via relative imports (no vendoring). Version 0.5.0.-- **Capability highlights**: Features a `uri-guard` on `beforeReadFile` (independent of the plugin toggle) that denies reading a `viking://` path. Shell commands are not checked, and an upgrade removes the `beforeShellExecution` entry an older install registered. The rule and all three skills are installed alongside it; capture is text-only, so `ov-experience-memory` only retrieves and applies Experience, and its reads are not linked back to the Experience they used.-- **Behavior notes**: The session ID format is `cu-<conversation_id>`. `stop` commits every 8 messages (`commitTurnThreshold=8`, counted in messages, keep 0). `sessionEnd` only fires on `window_close`. By then, the host has already destroyed the shell-exec host, so it practically never runs ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)) — sessions ending below the 8-message watermark leave their tail to be archived by a later message in the same session ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)). If the server is unreachable, every turn waits out the full 15s recall timeout.-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.cursor`), and the workspace files ([§3.1.4](#_3-1-4-configuration-layers)).-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | degradation [§3.6](#_3-6-degradation-and-fault-tolerance).-## trae / trae-cn (IDE editions)+### Settings and workspace files-- **Integration docs**: [TRAE Memory Integration](./13-trae.md)-- **Form**: Config-driven (`~/.trae{,-cn}/hooks.json` + a platform-specific mcp.json) utilizing an MCP proxy. It features 4 hooks: SessionStart(30s) / UserPromptSubmit(20s) / PreToolUse:Read\|Glob\|Grep\|Bash\|RunCommand(5s) / Stop(30s). `PreToolUse` denies Read/Glob/Grep calls whose path is a `viking://` URI, while a Bash/RunCommand command that carries one runs with a notice attached. The shared library is introduced via relative imports, and the MCP server is named `openviking`. Version 0.5.0.-- **Capability highlights**: Features the simplest and most direct behavior of the group. Every Stop that carries content is committed (keep 0). Consequently, upon shutdown, the largest possible backlog is merely the last in-flight turn ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)).-- **Behavior notes**: trae and trae-cn differ only in their session ID prefixes (`tr-` vs. `trcn-`) and installation paths. The same workload lands in two separate sets of sessions across the two clients, and cross-client sharing occurs via the server-side memory space after extraction rather than by reusing sessions. Note that there is no handling for PreCompact, status lines, skills, or subagents.-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.trae` / `plugin.trae_cn`), and the workspace files.-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix).+Integrations built on the shared plugin code read behavior settings from, highest first: `OPENVIKING_*` environment variables, a per-machine workspace registry, the repository's `.openviking/config.local.json` and `.openviking/config.json`, `ovcli.conf` `plugin.<harness>`, `ovcli.conf` `plugin`, and the legacy harness section of `ov.conf`. Workspace files cannot set URLs, keys, or other credentials. See [Plugin settings](../configuration/02-client.md#plugin-settings) and [Workspace configuration](../configuration/02-client.md#workspace-configuration). OpenClaw reads `openclaw.json` and Hermes reads its `.env` and `config.yaml`.-## zcode+**Workspace peer.** By default, these integrations tag memories with a peer derived from the repository's normalized `origin` URL, so every clone of a repository shares one peer. Outside a repository no peer is sent, and memories go to the user's own space. `peer.source` and `.openviking/config.json` change this; see [Workspace peer](../configuration/02-client.md#workspace-peer). OpenClaw derives its peer from `peer_role` and `peer_prefix`; with `peer_role=sender`, tool calls fail when the host provides no sender. Hermes sets no assistant peer unless `OPENVIKING_AGENT`, a linked OpenViking peer, or the YAML `agent` key sets one. Agent Plugins sends no peer.-- **Integration docs**: [Community Integrations → ZCode](./08-community-plugins.md)-- **Form**: Config-driven (merged into `~/.zcode/cli/config.json`, forcing `hooks.enabled=true`) utilizing an MCP proxy. It features 4 hooks: SessionStart(30s) / UserPromptSubmit(20s) / PreToolUse:Read\|Glob\|Grep(5s) / Stop(30s). It vendors nothing: the installer assembles its shared runtime the same way it does for cursor and trae. Version 0.5.0.-- **Capability highlights**: The rollout file `~/.zcode/cli/rollout/model-io-<sid>.jsonl` serves as the source of truth for increments (a `lastTurnId` diff backfills any missed Stop events). Stop detaches by default. An already-started worker can continue after the terminal receives Ctrl+C, but network errors or process termination can still interrupt the write.-- **Behavior notes**: Commits on every Stop (keep 0). The capture path only strips the three types of injection blocks without performing any further text cleanup ([§3.2.6](#_3-2-6-injection-backflow-protection)). The initial capture reads the entire rollout at once, meaning that installing it into a long-running session will produce a single large push.-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.zcode`), and the workspace files; `OPENVIKING_WRITE_PATH_ASYNC` takes effect for zcode.-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix).+Settings that apply only to some integrations:-## kimicode+- `OPENVIKING_COMMIT_TURN_THRESHOLD`: Cursor and Kimi Code. TRAE, TRAE CN, and ZCode commit every turn.+- `OPENVIKING_WRITE_PATH_ASYNC`: Claude Code, Codex, and ZCode.+- `OPENVIKING_RECALL_COMPRESS=client`: Claude Code and Codex. `server` and `auto` work for every integration listed under [Recall digest](#recall-digest).+- The workspace files, the `ovcli.conf` `plugin` section, `OPENVIKING_RECALL_DEDUP_TURNS`, `OPENVIKING_RECALL_QUERY_EXPANSION`, `OPENVIKING_PEER_SOURCE`, and the skill catalog settings: every integration built on the shared plugin code, not OpenClaw or Hermes.-- **Integration docs**: [Community Integrations → Kimi Code](./08-community-plugins.md)-- **Form**: Native managed plugin with 7 hooks and an MCP proxy. The installer assembles one self-contained copy under `$KIMI_CODE_HOME/plugins/managed/openviking-memory`; no shared runtime is committed for Kimi. Version 0.5.0; verified with Kimi Code CLI 0.43.1.-- **Capability highlights**: `wire.jsonl` provides stable incremental turns. Profile injection retries on prompt hooks until successful. Stop, PreCompact, and SessionEnd may detach; Interrupt stays synchronous with one two-second OpenViking request budget.-- **Behavior notes**: UserPromptSubmit emits raw context text, not a JSON string. A turn advances the cursor only after send or durable queueing. Installation preserves unrelated plugin records and does not edit legacy `config.toml` or `mcp.json`.-- **Configuration**: Environment variables, `ovcli.conf` (`plugin.kimicode`), and workspace files.-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | degradation [§3.6](#_3-6-degradation-and-fault-tolerance).+<a id="_3-7-additional-ux-comparison"></a>-## opencode+## Other host features-- **Integration docs**: [OpenCode Plugin](./10-opencode.md)-- **Form**: The npm plugin `@openviking/opencode-plugin` 0.5.0 supports OpenCode v1 ≥1.15.7 and v2 ≥2.0.15 from one entrypoint. v1 retains its existing hooks; v2 uses `setup(ctx)`, prompt/context/tool hooks, and structured lifecycle events. MCP tools keep the `openviking_*` prefix, with v2 explicitly setting `codemode:false`. Ships 3 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`): v1 adds the plugin's `skills/` directory to `skills.paths` in the `config` hook, v2 registers it with `skill.transform`; both only when the plugin registers its OpenViking MCP server (not in hook-only mode or with `mcp.openviking` disabled).-- **Capability highlights**: On v2, the prompt hook recalls once and stores context in user-message metadata; later model steps inject the same stored content, avoiding repeated requests and prompt-cache churn. At execution completion, `session.context()` supplies complete user, assistant, and tool messages for capture. The repository list remains in the system prompt ([§3.2.3](#_3-2-3-profile-opening-injection)).-- **Behavior notes**: `commitTokenThreshold` is 20000 and commit timeout is 30000ms. v2 checks the threshold after every succeeded, failed, or interrupted execution and force-commits on session deletion, completed compaction, and cleanup; a failed or interrupted execution retains state. v2 handles only sessions of its own location and stores its capture cursor in plugin storage. v2 cleanup runs after 60 minutes of inactivity, service shutdown, or local-plugin hot reload. v2 has no toast API and logs notices instead. Opening injection is attempted once per session ([§3.2.3](#_3-2-3-profile-opening-injection)).-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.opencode`), and the workspace files.-- **Dimension index**: tool surface [§2.1](#_2-1-server-side-mcp-tool-surface) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | subagent [§3.3.5](#_3-3-5-subagent-session-comparison).+| Integration | Status line | Commands | Skills shipped | Setup wizard |+|---|---|---|---|---|+| Claude Code | Yes | `/openviking-memory:ov` shows server status, identity, and where injected context came from | `openviking-memory`, `openviking-skills`, `ov-experience-memory`, `ov-memory-doctor` | Yes |+| Codex, TraeCode CLI 2.0 | No | None | Same four as Claude Code | Yes |+| Cursor | No | None | An always-on rule plus `openviking-memory`, `openviking-skills`, `ov-experience-memory` | Installer menu |+| TRAE, TRAE CN, ZCode | No | None | None | Installer menu |+| OpenCode | No | None | The same three as Cursor, only when the plugin registers its MCP server | Yes |+| DSH | No | None | The same three as Cursor | No |+| pi | Yes | `/viking`, `/viking commit` | The same three as Cursor, unless `mcpEnabled` is `false` | Yes |+| OpenClaw | No | `/add-resource`, `/add-skill`, `/ov-search`, `/ov-query-config`, `/ov-recall-trace` | Three plugin skills | Yes; checks the key's role and version compatibility |+| Hermes (bundled) | No | None | None | Yes; `hermes memory status` lists environment overrides |+| ov CLI | No | The CLI itself | None | `ov config` |-## dsh (DeepSeek Harness)+Claude Code, Codex, Cursor, TRAE, ZCode, Kimi Code, DSH, and pi also install a **URI guard**: a file tool whose path is a `viking://` URI is denied with a hint to use the OpenViking tools, and a shell command that contains one runs with a notice attached. Which tools are checked differs by host and is listed in [Notes by integration](#notes-by-integration).-- **Integration docs**: [DSH Plugin](./17-dsh.md)+<a id="_4-harness-profile-cards"></a>-- **Form**: This is the only in-process, native Cordis plugin (`export function apply`). Its tool surface is the server's MCP surface, mounted through `@deepseek-ai/dsh-mcp-client` and the shared stdio proxy (published as `mcp__openviking__*`), while its hooks call REST directly. It features 6 events: agent/session-start (emit) / agent/pre-step (waterfall) / session/event / session/flush / tools/pre-execute / tools/post-execute. Version 0.5.1.-- **Capability highlights**: `ctx.provide("openvikingMemory")` allows other Cordis plugins to build upon it. Pre-step injection is transmitted as a user message, aligning with the `complete:true` rendering mode of the DSH persona.-- **Behavior notes**: The unified installer covers dsh and installs into the `web` profile unless `--dsh-profile` names another; npm is the bundle's only distribution channel, so every mode except `dev` installs the published package; `dev` packs the checkout first, because `dsh plugin` forwards to pnpm and a linked source tree cannot resolve the dsh peers the bundle imports. The teardown commit is allocated 3 seconds with no threshold, and it does not trigger on SIGHUP or a consecutive Ctrl+C ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)). Compaction remains invisible to the plugin: injected content shrinks alongside the host's compaction, and the profile is not re-injected. Each subagent is assigned its own session ([§3.3.5](#_3-3-5-subagent-session-comparison)). The tool surface is the server's own MCP surface, reached through the same stdio proxy the other integrations use and published under `mcp__openviking__*`, so a server upgrade adds tools without a bundle release; the trade-off is that the proxy runs once per profile, so tool calls carry a process-level actor peer and `remember` is not session-scoped (recall, capture, and commit still resolve a peer per session). The bundle also ships the shared `openviking-memory`, `openviking-skills`, and `ov-experience-memory` skills; tool results are captured by default (`captureToolResults: true`) so `ov-experience-memory` runs the full Experience loop; turning it off leaves the skill retrieving and applying Experience only. `uri-guard` lowercases tool names before matching: `tools/pre-execute` denies a file tool whose path is a `viking://` URI (a write or edit on a skill URI is pointed to `mcp__openviking__add_skill`), and `tools/post-execute` adds a notice (`form: "notice"`) when a `bash` command carries one.-- **Configuration**: Configured via environment variables, `ovcli.conf` (`plugin.dsh`), the workspace files, and the cordis patch, which is the lowest layer for behavior knobs. Credentials are the exception: an endpoint, key, account, user, or peer named in the patch overrides the credential chain.-- **Dimension index**: tool surface [§1.1](#_1-1-active-tool-surface-agentic-calls) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | degradation [§3.6](#_3-6-degradation-and-fault-tolerance).+## Notes by integration-## pi (pi Coding Agent Extension)+Each note covers what is specific to one integration. Shared behavior is in the sections above.-- **Integration docs**: [pi Coding Agent Extension](./11-pi.md)-- **Form**: Operates as a native pi extension (loaded from a directory and dynamically transpiled from TS by jiti). The extension uses the official MCP client and republishes every descriptor from the server's `tools/list` as a pi tool named `openviking_<tool>`: 20 today ([§2.1](#_2-1-server-side-mcp-tool-surface)). Nothing in the extension enumerates tools, so a server that gains or drops one changes pi's surface at the next session with no plugin release. Recall, session sync, profile injection and takeover still go over REST. It features 9 events + a `/viking` command; `tool_call` blocks read/grep/find/ls/write/edit calls whose path is a `viking://` URI, and `tool_result` appends a notice to the result of a `bash` command that carries one. Ships 3 skills (`openviking-memory`, `openviking-skills`, `ov-experience-memory`) through `resources_discover`, left out when `mcpEnabled` is `false`. Version 0.4.1.-- **Highlights**: Features takeover compaction (enabled by default, [§3.4.2](#_3-4-2-pi-takeover)). Employs a two-stage recall system: it queues at `before_agent_start` and performs synchronous retrieval during the context event, ensuring the current turn's prompt receives its corresponding memories. It also includes a status line. Supported graceful shutdown paths await `session_shutdown`; forced termination such as `kill -9` cannot run the handler.-- **Behavior**: When takeover is enabled, exiting does not trigger a commit. Instead, the handler persists local state, and archiving waits either for the next resumed run to hit the threshold or for a manual `/viking commit` command ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)). The takeover threshold is set to 30000 tokens while keeping the last 3 turns (keep 3, which the server interprets as a message count). When takeover is disabled, the threshold is 20000 tokens (keep 10), and exiting triggers an unconditional commit. Tool registration requires `health`, `ensureSession` and a `/mcp` handshake ([§1.1](#_1-1-active-tool-surface-agentic-calls)); a root API key is refused on `/mcp` with a 403, so a credential chain ending at `ov.conf`'s `server.root_api_key` produces a session with no tools — before 0.4.0 the REST tools registered and quietly answered "No results found." instead. `openviking_remember` runs on the MCP surface, meaning its own one-shot session committed immediately rather than a write folded into pi's session ([§2.1](#_2-1-server-side-mcp-tool-surface)). `openviking_add_resource` ingests a remote URL directly; for a local path the server returns an upload instruction whose URL the model has to POST the bytes to with `bash`, as on every other MCP harness. `openviking_read` reads file content with line pagination (`offset`/`limit`): a directory URI comes back as `Cannot render …: URI points to a directory`, and the old `level="abstract"/"overview"` tiers have no MCP equivalent — use `openviking_search(mode="context", detail="overview")` or `openviking_tree(include_abstract=true)`, while takeover keeps injecting the archive overview itself over REST. A tool call is bounded by the shared `timeoutMs` (15000ms, `OPENVIKING_TIMEOUT_MS`), which a `write`/`edit` with `wait=true` or a synchronous `add_resource` ingest can outlast; a timeout or ESC fails the call locally only, so the request it already sent runs to completion and a write may have landed anyway. Upgrading from 0.3.x renames every tool with no alias period, so a `--tools` / `--exclude-tools` allowlist that pinned `viking_*` has to be rewritten or the tools silently disappear. If takeover is off, resuming via `pi -c` will re-report the entire branch.-- **Config**: Configured via environment variables, `ovcli.conf` (`plugin.pi`), and the workspace files (credentials always pass through the credential chain, [§3.1.3](#_3-1-3-credential-systems)). Bypass goes through the shared `isBypassed` glob matcher under the key `bypassSessionPatterns`; the older `bypassPatterns` still reads. The shared `mcpEnabled: false` now takes effect here as well: no bridge, no tools, and `/viking` reports that as a setting rather than a fault.-- **Dimension index**: tool surface [§1.1](#_1-1-active-tool-surface-agentic-calls) | recall [§3.2](#_3-2-automatic-recall-and-injection) | takeover [§3.4.2](#_3-4-2-pi-takeover) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix).+### Claude Code-## openclaw+[Claude Code Memory Plugin](./02-claude-code.md). A marketplace plugin with 9 hooks, an MCP proxy, a slash command, a status line, and 4 skills.-- **Integration docs**: [OpenClaw Plugin](./03-openclaw.md)-- **Form**: Represents the only full ContextEngine takeover (`ownsCompaction:true`). Features 15 native tools (14 enabled by default) + 5 slash commands + 4 hooks + Gateway HTTP routes + feature-gate RPC. It operates entirely remotely. Version 2026.6.18.-- **Highlights**: Retrieval is split into two non-overlapping entry points by default: `memory_recall` searches memory, while `ov_search` targets resources and user skills (though either can cross over if explicit parameters are provided). The `add_skill` tool is enabled by default, and `memory_forget` is whitelisted exclusively for memory ([§3.5](#_3-5-type-boundaries-for-writes-and-deletes)). Three tool-result tools read server-side externalized outputs (safeguarded across sessions). It features complete ContextEngine takeover ([§3.4.3](#_3-4-3-openclaw-contextengine)), and the setup wizard actively probes the key's role while verifying version compatibility.-- **Behavior**: Recall invokes `/find` without a session ID. Consequently, there is no expansion or deduplication ledger, meaning the same memory might be repeatedly injected during a long session. Shutdowns do not trigger a commit; archiving relies on an explicit `/new` or `/reset` command alongside an approximate 50% threshold ([§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)). There is no local pending queue, so failed turns are not replayed. The `compact()` function can block for up to 5 minutes. By default, recall issues one additional read per leaf memory (`recallPreferAbstract=false`). Configuration validation is exceptionally strict: any unknown key or invalid value immediately forces the plugin into a setup-only mode.-- **Config**: Configured via `plugins.entries.openviking.config` in `openclaw.json` alongside a few environment variables. Utilizes the `X-API-Key` auth header ([§3.1.3](#_3-1-3-credential-systems)). The commit threshold is controlled by `commitTokenThresholdRatio` (default 0.5), and the recall character budget is 4000.-- **Dimension index**: tool surface [§1.1](#_1-1-active-tool-surface-agentic-calls) | recall [§3.2](#_3-2-automatic-recall-and-injection) | ContextEngine [§3.4.3](#_3-4-3-openclaw-contextengine) | deletion [§3.5](#_3-5-type-boundaries-for-writes-and-deletes) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix).+- It registers more hooks than any other integration: `SessionStart`, `UserPromptSubmit`, `PostToolUse:Read` (the skill-experience hook, off by default), `PreToolUse` on Read, Glob, Grep, Edit, Write, and Bash (the URI guard), `Stop`, `PreCompact`, `SessionEnd`, `SubagentStart`, and `SubagentStop`.+- Recall digests are on by default through a local `claude -p`, with the server digest as the fallback.+- Every exit except `kill -9` sends a commit.+- The capture cursor is kept under `/tmp`. If the system clears it, the whole session is sent again.+- The URI guard runs even when the plugin's own switch is off.-## hermes (Nous Research)+<a id="codex"></a><a id="trae-cli-traecode-cli-2-0"></a>-- **Integration docs**: [Hermes Agent](./05-hermes.md)-- **Form**: A bundled `MemoryProvider` using HTTP, with six `viking_*` tools. OpenViking runs in a separate server environment. The external plugin is maintained separately; see the scope note above.-- **Memory writes**: `viking_remember` submits an unchanged fact through a dedicated session and commits it for asynchronous extraction. It returns `status: submitted`; extraction may add, merge, or skip the fact. The bundled provider mirrors native memory additions only. The external plugin adds mapped replacement and deletion; see its README.-- **Recall**: Synchronous query recall uses session-aware `search/search`, then `/find` as a fallback. `queue_prefetch` is a no-op. Session-start injection reads the user profile and preferences/entities listings (6000-token default). Query recall defaults to 6 results, score threshold 0.15, 4000 characters, and a 4s total / 3s per-request timeout. These values are configurable.-- **Lifecycle**: Commits keep 0 messages. Upload threads are not durable, but pending-commit markers support dead-run recovery on POSIX. Normal exits and signals attempt to drain and commit; network failures or forced termination can interrupt this. Delegated agents with `skip_memory=True` do not load the provider. No status line or provider slash commands are added.-- **Paths and config**: Memory writes use `viking://user/<uid>/memories/...`, or `viking://user/<uid>/peers/<peer>/memories/...` when a peer is configured. No assistant peer is set by default. Connection settings use `OPENVIKING_ENDPOINT`, profile secrets, linked `ovcli.conf`, and Hermes YAML. Linking an OpenViking profile clears the five connection variables from the Hermes `.env`.-- **Dimension index**: tool surface [§1.1](#_1-1-active-tool-surface-agentic-calls) | recall [§3.2](#_3-2-automatic-recall-and-injection) | commit [§3.3.2](#_3-3-2-regular-commit-triggers)/[§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix) | deletion [§3.5](#_3-5-type-boundaries-for-writes-and-deletes).-## ov CLI+### Codex and TraeCode CLI 2.0-- **Integration docs**: [Deployment Guide → CLI](../guides/03-deployment.md#cli)-- **Form**: A native Rust binary that wraps the server's REST API into a command-line interface. It operates without host events, automatic recall, or compaction takeover.-- **Highlights**: Provides command-line entry points for `auto_commit_policy` (`ov session new --auto-commit-policy-json`, `ov session config set`). It also offers multi-profile management, admin tools, privacy controls, snapshot management, and TUI capabilities unavailable in any plugin (see [§5.3](#_5-3-capabilities-only-the-cli-has)).-- **Dimension index**: See [§5](#_5-ov-cli-command-reference) for the comprehensive command reference.+[Codex Memory Plugin](./04-codex.md), [TRAE Memory Integration](./13-trae.md). A marketplace plugin with 6 hooks (`SessionStart`, `UserPromptSubmit`, `PreToolUse:Bash`, `Stop`, `SessionEnd`, `PreCompact`), an MCP proxy, and the same 4 skills as Claude Code.----+- `SessionEnd` fires only on a clean exit and only on Codex 0.145 and later. Signals, crashes, older builds, and `codex app-server` deferral fall to the start-up sweep, which uses a 30-minute idle timeout.+- `Stop` and `SessionEnd` write in a detached worker. A per-session lock orders the `Stop` worker, `PreCompact`, the `SessionEnd` worker, and the sweep.+- Codex edits files with `apply_patch`, which has no path argument, so the URI guard on Bash only adds notices and never denies.+- Codex keeps a trust record per hook. After an upgrade that adds hooks, approve the new ones in `/hooks`.+- TraeCode CLI 2.0 (binary `traecli`, config `~/.trae/traecli.toml`) is a Codex-family CLI and installs this same plugin. Only version 2.0 is supported; the earlier standalone plugin for 1.0 has been removed, and `--harness trae-cli --uninstall` still removes a copy an old install left behind. A build without `SessionEnd` ignores that hook.-# 5. ov CLI Command Reference+### Cursor-`ov` (internally identified as `openviking` in clap) is a Rust-based HTTP client. Most data operations call the server’s REST API. The CLI also packages local uploads, validates configuration, generates keys, renders output, and manages profiles. It is a standalone tool rather than a harness integration—meaning it does not handle host events, automatic recall, or compaction takeover. This chapter details its complete command surface for using OV directly (either manually or via scripts) and highlights additional CLI entry points (such as the TUI, multi-profile management, admin tools, `--sudo`, privacy controls, and snapshots).+[Cursor Memory Integration](./12-cursor.md). Hook and MCP configuration with 6 hooks (`sessionStart`, `beforeSubmitPrompt`, `beforeReadFile`, `stop`, `preCompact`, `sessionEnd`), an always-on rule, and 3 skills.-> Version note: This guide reflects the HEAD source (with the HEAD tag at `[email protected]`); notable differences from older versions, such as 0.4.10, are explicitly mentioned. Please note that `ov doctor` is not included in the native Rust binary. Instead, the Python wrapper installed via pip intercepts `argv[1]=="doctor"` and routes it to `openviking_cli.doctor`, reading the server's `ov.conf` rather than `ovcli.conf`. The pure Rust `ov` binary distributed via npm/cargo does not include this subcommand.+- The URI guard runs on `beforeReadFile` only, independent of the plugin switch. Shell commands are not checked, and an upgrade removes the `beforeShellExecution` entry older installs registered.+- Capture is text-only, so `ov-experience-memory` can find and apply Experience but cannot link its reads back to the Experience used.+- `sessionEnd` fires only on window close, after Cursor has stopped running hook commands, so it does not commit in practice.+- With the server unreachable, every turn waits out the 15-second recall timeout.-## 5.1 Command tree+<a id="trae-trae-cn-ide-editions"></a>-Doc-comment prefixes like `[Data]`, `[Interactive]`, `[Admin]`, or `[Experimental]` only influence the help menu rendering and do not affect runtime behavior. For instance, even `[Experimental]` commands are available by default.+### TRAE and TRAE CN-**Writing data**: `add-resource` (supports local files/directories/URLs/Git/sitemaps/RSS; pick one target from `--to`/`--parent`/`-p`; manifest mode via `-m`; Connector via `--add-type`; note that specifying a local path with watch>0 triggers an error) | `add-skill` | `write` (`--content` and `--from-file` are mutually exclusive) | `mkdir` | `rm` (aliases: del/delete; executes without a confirmation prompt; use `-r` for explicit recursion) | `mv` (alias: rename) | `set-tags` (hidden at the top level; use `attrs set-tags` instead) | `add-memory` (experimental; executes a sequence of three serial steps: create session → bulk add → commit)+[TRAE Memory Integration](./13-trae.md). Hook and MCP configuration with 4 hooks: `SessionStart`, `UserPromptSubmit`, `PreToolUse`, and `Stop`. The MCP server is named `openviking`.-**Reading/retrieval**: `ls` (alias: list) | `tree` (`-L` defaults to 3) | `stat` / `attrs get` | `read` / `abstract` / `overview` (L2/L0/L1 respectively) | `get` (download) | `find` (requires at least one non-empty query or `--image`; `--image` accepts local paths, data URIs, HTTP URLs, and viking:// schemas) | `search` (experimental; adds `--session-id` on top of find capabilities) | `grep` | `glob`+- `PreToolUse` denies Read, Glob, and Grep on `viking://` paths and adds a notice to Bash and RunCommand commands that contain one.+- Every `Stop` with content commits, so an exit loses at most the turn in progress.+- TRAE and TRAE CN differ only in session prefix and install paths. The same work in both clients creates separate sessions; they share memories only after extraction.+- No compaction handling, status line, skills, or subagent handling.-**Skills**: `skills add` (supports local paths, Git, and GitHub tree URLs; use `-s` to select or `*` for all; prompts for interactive confirmation) | `skills list/find/show/update/remove` | `skills validate` (local validation without a server request)+### ZCode-**Sessions/memory**: `session new` (`--auto-commit-policy-json` and `--no-auto-commit` are mutually exclusive; the SDK and HTTP API also support setting the policy) | `session list/get/delete` | `session get-session-context` (`--token-budget` defaults to 128000) | `session get-session-archive` | `session add-message(s)` | `session config set` (modifies mutable configurations) | `session commit`+[Community integrations: ZCode](./08-community-plugins.md#zcode-memory-integration). Hook and MCP configuration with 4 hooks: `SessionStart`, `UserPromptSubmit`, `PreToolUse` on Read, Glob, and Grep, and `Stop`.-**Import/export & snapshots**: `export` / `backup` / `import` / `restore` (.ovpack formats) | `snapshot commit/restore/show/log/diff/ignore-*` (workspace snapshots; rollbacks are achieved by committing forward)+- The rollout file `~/.zcode/cli/rollout/model-io-<sid>.jsonl` is the source of captured turns; turns a missed `Stop` skipped are caught up at the next `Stop`.+- The first capture reads the whole rollout, so installing into a long-running session produces one large upload.+- Capture removes injected blocks but does no other text cleanup.+- `Stop` writes in a detached worker by default.-**Privacy**: `privacy categories/list/get/versions/version/activate/upsert` (offers `--key-<name>` syntactic sugar)+<a id="kimicode"></a>-**Status/observability**: `health` (exits with 0 even when healthy=false) | `status` (table mode always exits with 0) | `observer {queue,vikingdb,models,retrieval,filesystem,system}` | `wait` | `task status/cancel/list` | `task watch {ls,show,rm,pause,resume,update,trigger}` | `version` (probes the server utilizing its own 3-second timeout)+### Kimi Code-**Config/interactive**: `config` (launches a TUI wizard with a 5-item menu, including User Management) | `config show` (always outputs compact JSON) | `config validate` | `config list/switch/add/edit/delete` (Agent-facing; exit codes 2-6 carry semantic meaning) | `config add ov-service` (cloud) / `config add custom` | `language` (alias: lang) | `tui` (provides a full-screen file browser, in-terminal image previews, a vector view, and deletion confirmations) | `chat` (launches VikingBot with a 300-second timeout) | `compile` (organizes material via a Skill; `--wait` enables local polling)+[Community integrations: Kimi Code](./08-community-plugins.md#kimi-code-memory-integration). A managed Kimi Code plugin with 7 hooks (`SessionStart`, `UserPromptSubmit`, `PreToolUse` on Read, Glob, and Grep, `Stop`, `PreCompact`, `SessionEnd`, `Interrupt`) and an MCP proxy. The installer builds one self-contained copy under `$KIMI_CODE_HOME/plugins/managed/openviking-memory`.-**Administration (mostly ROOT/`--sudo`)**: `admin create-account/list-accounts/delete-account/set-role/migrate/register-user/list-users/remove-user/regenerate-key` | `system wait/status/health/consistency` | `system crypto init-key` (generates a 32-byte root key entirely locally with 0600 permissions) | `system backend sync-status/sync-retry` | `reindex` (`--mode` defaults to vectors_only; `--wait` defaults to true, making it the only CLI command with this default behavior) | `doctor` (exclusive to the Python wrapper)+- Captured turns come from `wire.jsonl`. A turn moves the cursor only after it is sent or stored in the offline queue.+- Session-start context is injected at the first prompt and retried on later prompts until it succeeds.+- `Stop`, `PreCompact`, and `SessionEnd` may write in the background. `Interrupt` stays synchronous with a 2-second request budget.+- `UserPromptSubmit` returns plain context text, not JSON.+- Installation keeps other plugin records and does not edit the older `config.toml` or `mcp.json`.-## 5.2 Global options and unique mechanisms+### OpenCode-- `-o/--output table|json` (defaults to `output` in the config file) | `-c/--compact` (defaults to true) | `--account`/`--user`/`--actor-peer-id` | `--sudo` (utilizes the `root_api_key`; permitted only for admin, system, reindex, task status, and task list commands) | `--profile` (hidden).-- **Multi-profile**: The active profile is `~/.openviking/ovcli.conf`; named profiles use `ovcli.conf.<name>`. Edits and renames preserve extra top-level fields such as `plugin`. Switching replaces connection settings. An incoming `plugin` section takes precedence; if it is absent, the active file’s existing `plugin` section is retained.-- **Language gate**: A display language must be configured before executing any commands (if unconfigured in a non-interactive environment, the CLI exits with code 2). As of the HEAD version, `--help` bypasses this gate (unlike version 0.4.10, which lacked this exemption), though `--version` still requires a configured language to run.-- **Three JSON output shapes, categorized by command group**: Under compact mode, standard commands emit `{"ok":true,"result":…}` upon success, a bare payload when `-c false` is passed, and `{"ok":false,"error":…}` upon failure. The configuration command family outputs `{"status":"ok","result":…}`. When a profile is active, `"profile":[…]` is appended to the response. These variations require careful handling when parsing outputs in scripts. Additionally, `echo_command` defaults to true and is not suppressed by `-o json` (meaning the first line of stdout will typically be `cmd: …`).-- **Environment variables**: `OPENVIKING_CLI_CONFIG_FILE`, `OPENVIKING_UPLOAD_MODE` (local/shared), `OPENVIKING_ASSETS_CREDENTIALS_FILE`, `OPENVIKING_LANG`/`LC_*`/`LANG`, along with `VIKINGBOT_ENDPOINT`/`VIKINGBOT_API_KEY`/`OPENVIKING_URL` for chat functionality.+[OpenCode Plugin](./10-opencode.md). The npm plugin `@openviking/opencode-plugin` supports OpenCode v1 (1.15.7 and later) and v2 (2.0.15 and later) from one entry point.-## 5.3 Additional CLI capabilities {#_5-3-capabilities-only-the-cli-has}+- v2 recalls once per prompt and stores the result in the user message's metadata; later model steps reuse it without new requests, which keeps the prompt cache stable. At the end of each execution, v2 reads the complete user, assistant, and tool messages for capture.+- v2 checks the commit threshold after every execution, including failed or interrupted ones, which keep their state. It handles only sessions of its own location and stores its cursor in plugin storage. v2 has no toast API and logs notices instead.+- MCP tools keep the `openviking_` prefix; v2 sets `codemode: false`. The 3 skills are added only when the plugin registers its MCP server, not in hook-only mode or with `mcp.openviking` disabled.+- Commit timeout is 30 seconds.-Compared with memory plugins, the CLI/TUI also provides the following entry points. Server-side operations can also be called through their HTTP APIs or SDK methods: multi-profile switching and the configuration wizard, the complete `admin` account and user management suite, root operations via `--sudo`, `privacy` policy CRUD and versioning, data movement commands (`snapshot`/`backup`/`restore`/`export`/`import`), index rebuilds via `reindex`, root key generation via `system crypto init-key`, interactive browsing with `ov tui`, VikingBot-dependent features like `ov chat` and `ov compile`, and `ov session config set` for explicitly defining the `auto_commit_policy` (the SDK and HTTP API can also set this policy).+<a id="dsh-deepseek-harness"></a>----+### DSH-# 6. Custom agent integration guide+[DSH Plugin](./17-dsh.md). The only in-process Cordis plugin. Hooks call the REST API directly; tools come through `@deepseek-ai/dsh-mcp-client` and the shared stdio proxy.-If your preferred agent or harness is not among the 11 listed previously, you can integrate it using one of three methods, arranged below from lowest to highest implementation effort.+- It listens to `agent/session-start`, `agent/pre-step`, `session/event`, `session/flush`, `tools/pre-execute`, and `tools/post-execute`.+- `ctx.provide("openvikingMemory")` lets other Cordis plugins build on it.+- The installer uses the `web` profile unless `--dsh-profile` names another. Every mode except `dev` installs the published npm package.+- Tool results are captured by default (`captureToolResults: true`), so `ov-experience-memory` runs its full loop; turning capture off leaves it able only to find and apply Experience.+- The URI guard lowercases tool names, denies file tools on `viking://` paths in `tools/pre-execute`, and adds a notice to `bash` commands in `tools/post-execute`.+- Credentials named in the Cordis patch override every other source. For behavior settings the patch is the lowest layer.-## 6.1 Integration path × capabilities you get+<a id="pi-pi-coding-agent-extension"></a>-| Path | Effort | Agent-initiated tool surface | Auto recall/capture hooks | Session/commit | Compaction takeover |-|---|---|---|---|---|---|-| ① [Direct MCP connection](./06-mcp-clients.md) | Minutes: configure endpoint, credentials, and transport | ✅ All 20 tools | ❌ The model calls them itself | Only `remember` creates a temporary session | ❌ |-| ② HTTP API / SDK / [LangChain](./07-langchain-langgraph.md) | Hours: implement calls and lifecycle handling | Flexible (call REST as needed) | Custom implementation | Custom implementation (or use the LangChain middleware) | ❌ |-| ③ Reuse shared-core | Days: adapt and validate host lifecycle events | ✅ 20 tools (through the MCP proxy) | ✅ Full recall/capture/commit/pending set | ✅ | Depends on which events you wire up |-| [Agent Plugins portable package](./15-agent-plugins.md) | Minutes: install MCP and skill configuration | ✅ Server MCP tools | ❌ Model follows the skill and calls tools | Only `remember` creates a temporary session | ❌ |+### pi++[pi Coding Agent Extension](./11-pi.md). A native extension with 9 event handlers and a `/viking` command. Recall, sync, session-start context, and takeover use REST; tools use pi's built-in MCP client.++- Tools are whatever the server's `tools/list` returns, renamed `openviking_<tool>`. A server that adds or drops a tool changes pi's tools at the next session, without an extension release.+- Upgrading from 0.3.x renamed every tool from `viking_*` with no alias period. Update any `--tools` or `--exclude-tools` list, or the tools disappear silently.+- `openviking_read` returns file content with `offset` and `limit`. A directory URI returns an error. The old `level="abstract"` and `"overview"` reads have no MCP equivalent; use `openviking_search(mode="context", detail="overview")` or `openviking_tree(include_abstract=true)`.+- A tool call times out after 15 seconds (`OPENVIKING_TIMEOUT_MS`). A timeout or ESC fails the call only locally; the request already sent keeps running, so a write may still land.+- `tool_call` denies read, grep, find, ls, write, and edit on `viking://` paths; `tool_result` adds a notice to `bash` output that contains one.+- With takeover off, resuming with `pi -c` sends the whole branch again.+- Bypass uses `bypassSessionPatterns`; the older `bypassPatterns` still works.++### OpenClaw-## 6.2 Path ①: Direct MCP connection (recommended starting point)+[OpenClaw Plugin](./03-openclaw.md). A context-engine plugin that owns compaction, with 15 tools, 5 slash commands, lifecycle hooks, Gateway HTTP routes, and feature-gated RPC methods.-MCP clients that support Streamable HTTP can connect to the server’s `/mcp` endpoint. This example is for clients using `mcpServers`, `url`, and `headers`; other clients use different fields and formats, as documented in [MCP Clients](./06-mcp-clients.md). The connection discovers the tools provided by the server ([§2.1](#_2-1-server-side-mcp-tool-surface)).+- `memory_recall` searches memory and `ov_search` searches resources and the user's skills; explicit parameters let either reach the other.+- Recall goes through `/find` without a session ID, so there is no query expansion or deduplication, and the same memory can be injected repeatedly in a long session. By default each recalled memory costs one extra read (`recallPreferAbstract=false`).+- Exits do not commit. Archiving relies on `/new`, `/reset`, and the threshold. There is no offline queue, so a failed turn is not sent again.+- `compact()` can block for up to 5 minutes.+- Configuration is validated strictly: an unknown key or invalid value puts the plugin into setup-only mode.+- The commit threshold is `commitTokenThresholdRatio` (default 0.5) of `tokenBudget` (default 128,000).++<a id="hermes-nous-research"></a>++### Hermes++[Hermes Agent](./05-hermes.md). Two OpenViking memory providers exist for Hermes, and both register under the provider name `openviking`:++- The **bundled provider** ships inside Hermes under `plugins/memory/openviking` and needs no installation; `hermes memory setup openviking` configures it. The Hermes rows on this page describe the bundled provider as of [Hermes commit `989798c`](https://github.com/NousResearch/hermes-agent/tree/989798cd5e691230b54b2ea72e5937b68133014c/plugins/memory/openviking).+- The **external plugin** is maintained in this repository under [`examples/hermes-plugin`](https://github.com/volcengine/OpenViking/tree/main/examples/hermes-plugin) and installed with `hermes plugins install`. According to its README, a Hermes release that still bundles the provider loads the bundled copy, and the external plugin becomes active only after the bundled copy is removed. Configuration and stored data carry over.++The two are separate code bases. Where their behavior differs:++| | Bundled provider (Hermes `989798c`) | External plugin (this repository) |+|---|---|---|+| Commits during a session | None; only at session boundaries | A background commit at 20,000 pending tokens (`commit_token_threshold`) |+| Recall digests | Not supported | Optional server digest (`recall_compress`) |+| Mirroring Hermes's built-in memory | Additions only | Additions, replacements, and removals, tracked in a URI registry |+| `viking_forget` | User memory files with an explicit user ID | Also accepts `viking://~/`, rejects user-ID-less layouts, and checks ownership before deleting |+| Cron, subagent, and flush contexts | Not documented at that commit | Recall works; automatic writes and mirroring are skipped |++Behavior of the bundled provider:++- Recall runs before every model call, through session-aware `search/search`, with `/find` as a fallback. Defaults: 6 results, score threshold 0.15, 4,000 characters, 4 seconds in total and 3 seconds per request.+- `viking_remember` sends the fact unchanged through its own session and commits it; it returns `status: submitted`.+- Commits leave no live messages (`keep_recent_count` 0). Uploads are not durable, but pending-commit markers let a later start commit sessions from a dead run on POSIX.+- Memories are written under `viking://user/<uid>/memories/`, or `viking://user/<uid>/peers/<peer>/memories/` when a peer is set.+- Linking an OpenViking `ovcli.conf` profile clears the five connection variables from the Hermes `.env`. `hermes backup` includes the default or environment-selected `ovcli.conf` under `$HOME`; back up a YAML-linked file separately.++<a id="_5-ov-cli-command-reference"></a><a id="_5-1-command-tree"></a><a id="_5-2-global-options-and-unique-mechanisms"></a><a id="_5-3-capabilities-only-the-cli-has"></a>++### ov CLI++[Install and use the CLI](../getting-started/05-cli-setup.md). `ov` is a Rust client for the REST API. It has no host events, automatic recall, or compaction handling; every action is a command you or a script runs. Run `ov --help` for the command list, and see [CLI output format](../api/01-overview.md#cli-output-format) for JSON output.++What the CLI offers that the plugins do not: multiple `ovcli.conf` profiles, account and user administration (`ov admin`), root operations with `--sudo`, privacy policy management (`ov privacy`), snapshots, backup and restore, export and import, `ov reindex`, local root-key generation (`ov system crypto init-key`), the `ov tui` file browser, and session auto-commit policies (`ov session new --auto-commit-policy-json`, `ov session config set`). Server operations among these are also available through the HTTP API and SDK.++Behavior that matters in scripts:++- `ov rm` deletes without confirmation; `-r` deletes recursively.+- `ov health` exits 0 even when the server reports unhealthy, and `ov status` in table mode always exits 0.+- `find`, `search`, `ls`, `tree`, `grep`, and `glob` print a `cmd: …` line to standard output before the result while `echo_command` is on, which is the default, even with `-o json`.+- Most commands print `{"ok": true, "result": …}` or `{"ok": false, "error": …}` in compact JSON mode; the `ov config` commands print `{"status": "ok", "result": …}`.+- A display language must be configured before commands run; in a non-interactive shell without one, the CLI exits with status 2.+- `ov doctor` exists only in the Python package installed with `uv tool install openviking`, where it checks the server's `ov.conf`. The npm and cargo binaries do not include it.++<a id="_6-custom-agent-integration-guide"></a><a id="_6-1-integration-path-×-capabilities-you-get"></a>++## Build your own integration++If your agent is not listed, choose the least work that gives you the behavior you need:++| Approach | Effort | Tools for the agent | Automatic recall and capture | Commits |+|---|---|---|---|---|+| [Connect over MCP](#connect-over-mcp) | Minutes | Server MCP tools | None; the model calls tools itself | Only `remember`, in its own session |+| [Agent Plugins package](./15-agent-plugins.md) | Minutes | Server MCP tools, plus a skill that teaches their use | None | Only `remember` |+| [HTTP API, SDK, or LangChain](#call-the-http-api-or-sdk) | Hours | Whatever you call | You build it, or use the LangChain middleware | You decide |+| [Reuse the shared plugin code](#reuse-the-shared-plugin-code) | Days | Server MCP tools through the proxy | Recall, capture, commits, and the offline queue | Depends on the host events you connect |++<a id="_6-2-path-1-direct-mcp-connection-recommended-starting-point"></a>++### Connect over MCP++Clients that support Streamable HTTP can connect to the server's `/mcp` endpoint. This example uses the common `mcpServers` format; other clients use other fields, listed in [MCP clients](./06-mcp-clients.md).```json{@@ -751,44 +738,65 @@ MCP clients that support Streamable HTTP can connect to the server’s `/mcp` en}```-Use a user or admin API key; the server resolves the account and user from that key. `X-OpenViking-Account` and `X-OpenViking-User` belong to trusted identity mode and cannot override an ordinary key’s identity. Add `X-OpenViking-Actor-Peer` when workspace peer context is needed; see [Authentication](../guides/04-authentication.md) for visibility rules. For stdio-only clients, use the [Agent Plugins portable proxy](./15-agent-plugins.md) to bridge to Streamable HTTP. Direct MCP connections do not include automatic recall, capture, or session commits. Calling `remember` creates and commits a one-shot session.+Use a user or admin API key; the server reads the account and user from it. `X-OpenViking-Account` and `X-OpenViking-User` apply only in trusted identity mode and cannot override a normal key. Add `X-OpenViking-Actor-Peer` when you need workspace peer context; see [Authentication](../guides/04-authentication.md). Clients that support only stdio can use the [Agent Plugins proxy](./15-agent-plugins.md). A direct MCP connection has no automatic recall, capture, or commits.-## 6.3 Path ②: Programmatic integration+<a id="_6-3-path-2-programmatic-integration"></a>-- **Direct REST**: Trigger recall via `POST /api/v1/search/search` (note that expansion and deduplication require `mode:"context"` alongside a `session_id`, as per [§3.2.1](#_3-2-1-mechanism-foundation-one-shared-pipeline-two-server-side-paths); pass `rewrite` to generate a server-side digest, see [§3.2.5](#_3-2-5-recall-digest)). Write data using `POST /api/v1/sessions/{id}/messages/batch` (supports up to 100 messages per batch with `auto_create`). Finalize sessions via `POST /api/v1/sessions/{id}/commit`, and retrieve content using `GET /api/v1/content/read` and related endpoints. Auto-commit can come from `server.user_config_defaults.auto_commit_policy`, `POST /api/v1/sessions`, or `PATCH /{id}/config` ([§2.3](#_2-3-server-side-session-and-commit-semantics)).-- **LangChain / LangGraph SDK** (`pip install langchain-openviking`): The `OpenVikingContextMiddleware` provides `wrap_model_call` (which injects recalled content into `<openviking_context>`) and `after_agent` (handling capture and commit actions according to the `CommitPolicy`, which defaults to `never`). Within this group, this is the only out-of-the-box automatic recall solution that includes both session management and a token budget. Its fault-tolerance strategy is to retry read-only methods once and never retry writes. Partial successes raise an `OpenVikingPartialWriteError`, allowing you to retry a specific slice based on `input_messages_consumed`. See [§7](#_7-appendix-non-coding-integrations-at-a-glance) B for more details.-- **Open WebUI** (OpenAPI tool server): Running `python -m openviking_openwebui` launches a standalone process. By adding the resulting Tool Server URL to Open WebUI, you gain access to 7 tools (note that deletion and hooks are unsupported). See [§7](#_7-appendix-non-coding-integrations-at-a-glance) A for more details.-## 6.4 Path ③: Reuse a Reference Implementation for Automatic Hooks+### Call the HTTP API or SDK-If you need the full spectrum of automation—recall, capture, commit, and pending state management—there is no need to build it from scratch. Choose the implementation that matches the host. The portable package supplies MCP and skills, without automatic hooks:+- **REST.** Recall with `POST /api/v1/search/search`; query expansion and deduplication need `mode: "context"`, a `session_id`, and `dedup_turns` (see [How recall reaches the server](#how-recall-reaches-the-server)), and `rewrite` requests a [digest](#recall-digest). Write with `POST /api/v1/sessions/{id}/messages/batch` (up to 100 messages; creates the session), commit with `POST /api/v1/sessions/{id}/commit`, and read with `GET /api/v1/content/read`. See [Sessions](../api/05-sessions.md) and [Retrieval](../api/06-retrieval.md). For server-side auto-commit, see [How server sessions and commits work](#how-server-sessions-and-commits-work).+- **LangChain and LangGraph** (`pip install langchain-openviking`). `OpenVikingContextMiddleware` injects recall into `<openviking_context>` before model calls and captures and commits after the agent runs, following `CommitPolicy` (default `never`). Read-only calls are retried once; writes are never retried. A partial write raises `OpenVikingPartialWriteError` with the counts needed to retry the rest. See [LangChain and LangGraph](./07-langchain-langgraph.md).+- **Open WebUI.** `python -m openviking_openwebui` starts a separate OpenAPI tool server with 7 tools and no delete or hooks. See [Other integrations](#other-integrations).-- **`examples/memory-plugin-shared/lib/`** (Node): This provides a complete set of core modules. These include `recall-core` (three-tier degradation recall), `profile-inject`, `capture-utils` (message normalization and injection-echo protection), `pending-queue` (offline replay), `batch-send`, `mcp-proxy-core` (stdio↔HTTP proxy), `session-model` (session ID derivation), and `credentials`. To build a lightweight integration harness, map host lifecycle events to these modules and validate ordering, retries, timeouts, and exit behavior. For example, `agent-hook-runtime.mjs` is a ready-made, all-in-one runtime shared by Cursor, Trae, and zcode. Its stdin event parsing provides a starting point for another host adapter.-- **The Agent Plugins 1.0 Portable Package** (under `agent-plugins/`): This offers a standardized portable format comprising `plugin.json`, the `skills/` directory, and `mcp.json` (stdio→HTTP proxy). It intentionally excludes automatic hooks—instead, recall and persistence rely on a skill that teaches the model to invoke the tools autonomously. This design makes it highly suitable for clients that follow the Agent Plugins specification for direct loading. Additionally, `plugin.test.mjs` defines spec-conformance checks (such as schema URL validation, naming rules, ensuring no secrets in static headers, and preventing `mcp.json` references from escaping the plugin root), which you can use as a linting baseline when packaging your own plugin.+<a id="_6-4-path-3-reuse-a-reference-implementation-for-automatic-hooks"></a><a id="_2-2-the-memory-plugin-shared-layer"></a>-**Three conventions you must follow** (to ensure behavior remains consistent with existing harnesses): ① The recall call site must forward the `session_id`, which enables server-side expansion and cross-turn deduplication (see [§3.2.1](#_3-2-1-mechanism-foundation-one-shared-pipeline-two-server-side-paths)); ② Do not allow the adapter's own timeout to override the deadline dictated by the helper; ③ You must arrange a commit path at shutdown. Otherwise, any remaining conversation tail that falls below the threshold will remain unarchived until a subsequent trigger occurs (see [§3.3.3](#_3-3-3-shutdown-method-×-harness-outcome-matrix)). If the host has no shutdown event, enable `memory.session_auto_commit.enabled` and provide a per-session or deployment-default policy. `recall-session-wiring.test.mjs` checks wiring such as session ID and timeout forwarding. Validate exit events and completed writes in the target host as well.+### Reuse the shared plugin code----+For automatic recall, capture, commits, and offline retries, reuse the existing code instead of writing it again:-# 7. Appendix: Non-Coding Integrations at a Glance+- **`examples/memory-plugin-shared/lib/`** (Node.js) holds the shared modules: recall with its fallbacks, session-start context, capture cleaning, the offline queue, batch sending, the MCP proxy, session IDs, and credentials. Hosts configured through hook files can add an adapter to `examples/agent-hook-plugin/hosts/`, as Cursor, TRAE, ZCode, and Kimi Code do.+- **The Agent Plugins package** (`agent-plugins/`) is a portable `plugin.json`, `skills/`, and `mcp.json` with a stdio-to-HTTP proxy and no hooks. Its `plugin.test.mjs` checks conformance with the Agent Plugins specification and can serve as a lint baseline for your own package.-| Integration | Form | Tool Surface | Session/Commit | Fault Tolerance | Default State |-|---|---|---|---|---|---|-| **A. [Open WebUI](./08-community-plugins.md)** | Standalone FastAPI OpenAPI tool server | 7 local OpenAPI routes (`ov_search`/`ov_recall_memories`/`ov_add_memory`/`ov_list_memories`/`ov_read_resource`/`ov_add_resource`/`ov_session_status`), no deletion tool | No session concept | Transport: bare `httpx`, no retries or negative caching; `/health` only echoes the config and does not probe OpenViking. | Inactive until the process is explicitly started. |-| **B. [LangChain/LangGraph](./07-langchain-langgraph.md)** | Python SDK adapter layer (retriever/tools/store/middleware/recorder) | `create_openviking_tools()` provides 12 StructuredTools (`viking_forget` is not in the agent profile by default) | `thread_id`/`session_id` come from the caller; `CommitPolicy` defaults to `never` | Retry behavior: read-only methods automatically retry once, writes never retry (to prevent duplicates), and partial successes raise a structured exception that can be retried as a slice. | Requires explicit construction before taking effect. |-| **C. [Agent Plugins 1.0](./15-agent-plugins.md)** | Portable package: `plugin.json` + `skills/` + `mcp.json` (stdio→HTTP proxy) | MCP passthrough for all 20 tools; intentionally excludes hooks (recall relies on a skill instructing the model). | Only `remember` creates a temporary session | Retries handled at the MCP proxy layer (401/403 triggers credential swap, 400/404 triggers re-initialization; max 1 retry each). | Active as soon as loaded by the client. |-| **D. [Direct MCP Connection](./06-mcp-clients.md)** | No local components, connects straight to `/mcp` | Same as C (20 tools) | Same as C | Depends entirely on the client. | `/mcp` is always on. |-| **E. [Log Ingestion](./09-log-ingestion.md)** | `openviking-server ingest` CLI (runs on the machine hosting the logs, importing them in reverse) | None (write-only, no recall) | Session ID `{prefix}__{harness}__{sanitized native id}`; commit token 6000 / idle 5s / keep 0 | Crash recovery: utilizes a SQLite cursor store, single-instance locking, and a reconciliation process to verify batch delivery. | Disabled by default on two levels (`ingest.enabled` and each harness's individual `enabled` flag are both false); adapters available for claude_code, codex, hermes, opencode, openclaw, and cursor. |-| **F. [OpenViking Helper](./14-openviking-helper.md)** | Closed-source desktop app | — | — | — | Outside the scope of this codebase. |+The [plugin development guide](./18-plugin-development.md) covers module ownership, configuration, generated copies, installers, and tests. Whatever you build, keep three rules so it behaves like the existing integrations:----+1. Use context-mode recall with a session ID and `dedup_turns`, so the server can expand queries and deduplicate across turns.+2. Do not let the adapter's own timeout cut the deadline the shared code computes.+3. Commit at shutdown. Otherwise a conversation tail below the threshold stays uncommitted until something else triggers a commit. If the host has no shutdown event, turn on `memory.session_auto_commit.enabled` and give sessions a policy. Then check exit events and completed writes in the real host.-*Installation, configuration, and troubleshooting for each integration are governed by their respective integration pages. In the event of a discrepancy between this summary and the individual page, the individual page takes precedence.*+<a id="_7-appendix-non-coding-integrations-at-a-glance"></a>++## Other integrations++| Integration | What it is | Tools | Sessions and commits | Failure handling | Active when |+|---|---|---|---|---|---|+| [Open WebUI](./08-community-plugins.md#open-webui-tool-server) | Standalone OpenAPI tool server | 7: `ov_search`, `ov_recall_memories`, `ov_add_memory`, `ov_list_memories`, `ov_read_resource`, `ov_add_resource`, `ov_session_status`; no delete | No sessions | No retries or cached failures. Its `/health` echoes its configuration and does not contact OpenViking | You start the process |+| [LangChain and LangGraph](./07-langchain-langgraph.md) | Python SDK adapters: retriever, tools, store, middleware, recorder | 12 tools from `create_openviking_tools()`; `viking_forget` is not in the default agent profile | Session and thread IDs come from the caller; `CommitPolicy` defaults to `never` | Reads retried once, writes never; partial writes raise a structured error | You construct it |+| [Agent Plugins](./15-agent-plugins.md) | Portable package with a stdio-to-HTTP MCP proxy | Server MCP tools; no hooks, a skill tells the model when to call them | Only `remember` | The proxy retries once after 401 or 403 with fresh credentials, and once after 400 or 404 with a new MCP session | The client loads it |+| [MCP clients](./06-mcp-clients.md) | Direct connection to `/mcp` | Server MCP tools | Only `remember` | Up to the client | Always available on the server |+| [Log ingestion](./09-log-ingestion.md) | `openviking-server ingest`, run on the machine with the logs | None; import only | Session ID `{prefix}__{harness}__{id}`; commits at 6,000 pending tokens or 5 seconds idle, `keep_recent_count` 0 | Cursor store, single-instance lock, and a check of the server's message count after a crash | Off by default; `ingest.enabled` and each adapter's `enabled` must both be on. Adapters: Claude Code, Codex, Hermes, OpenCode, OpenClaw, Cursor |+| [OpenViking Helper](./14-openviking-helper.md) | Closed-source desktop app | Not covered here | Not covered here | Not covered here | Not covered here |++## Source notes++The comparisons above were checked against these locations. They help when you need to confirm a limitation for your version.++- Server MCP tools: `openviking/server/mcp_endpoint.py`, where the `@mcp.tool` registrations are the authoritative list.+- Write and delete checks: `openviking/storage/content_write.py` and `openviking/storage/viking_fs/_access.py`.+- Server auto-commit: `openviking_cli/utils/config/memory_config.py` and `openviking/session/auto_commit_policy.py`.+- Plugin settings and defaults: `examples/memory-plugin-shared/lib/config-schema.mjs`.+- Hook hosts: `examples/agent-hook-plugin/hosts/` for Cursor, TRAE, ZCode, and Kimi Code.+- pi takeover: `examples/pi-coding-agent-extension/lib/takeover-core.mjs`.+- OpenClaw tools and lifecycle hooks: `examples/openclaw-plugin/registries/openviking-tools.ts` and `examples/openclaw-plugin/plugin/openviking-lifecycle-hooks.ts`.+- Hermes: the bundled provider at the pinned Hermes commit linked in [Hermes](#hermes), and the external plugin's [README](https://github.com/volcengine/OpenViking/blob/main/examples/hermes-plugin/README.md).## See also-- [Agent Integrations Overview](./01-overview.md)-- [MCP Clients](./06-mcp-clients.md)-- [MCP Integration Guide](../guides/06-mcp-integration.md)+- [Choose an agent integration](./01-overview.md)+- [Tune recall latency](./19-recall-tuning.md)+- [Develop and maintain an agent plugin](./18-plugin-development.md)+- [MCP clients](./06-mcp-clients.md)+- [MCP tools and protocol](../guides/06-mcp-integration.md)+- [Client configuration](../configuration/02-client.md)- [Retrieval API](../api/06-retrieval.md)- [Sessions API](../api/05-sessions.md)- [Authentication](../guides/04-authentication.md)diff --git a/docs/en/agent-integrations/17-dsh.md b/docs/en/agent-integrations/17-dsh.mdindex 6813fef93..419369dce 100644--- a/docs/en/agent-integrations/17-dsh.md+++ b/docs/en/agent-integrations/17-dsh.md@@ -1,4 +1,4 @@-# DeepSeek Harness Memory Bundle+# DeepSeek HarnessGive [DeepSeek Harness](https://www.npmjs.com/package/@deepseek-ai/dsh) (`dsh`) cross-project and cross-session long-term memory. Once installed, every conversation automatically recalls relevant memories and captures new content, and the model gets the OpenViking tools and the `openviking-memory`, `openviking-skills`, and `ov-experience-memory` skills without any extra setup.diff --git a/docs/en/agent-integrations/18-plugin-development.md b/docs/en/agent-integrations/18-plugin-development.mdindex 906f8317b..0c68f3910 100644--- a/docs/en/agent-integrations/18-plugin-development.md+++ b/docs/en/agent-integrations/18-plugin-development.md@@ -1,4 +1,4 @@-# Hook + MCP Agent Plugin Development and Maintenance Standard+# Develop and maintain an agent pluginThis guide defines how to add and maintain OpenViking agent plugins that automatically read and write memory through lifecycle hooks and expose tools through MCP. It covers module responsibilities, protocols, state handling, installation, testing, and releases. A host is the client or runtime that runs the agent; the code also calls it a harness.diff --git a/docs/en/agent-integrations/19-recall-tuning.md b/docs/en/agent-integrations/19-recall-tuning.mdnew file mode 100644index 000000000..8da2aab20--- /dev/null+++ b/docs/en/agent-integrations/19-recall-tuning.md@@ -0,0 +1,42 @@+# Tune recall latency++Use this guide after connecting a plugin. For a first installation, start with [integration selection](01-overview.md).++Query expansion and recall compression add model calls. Disable both when response time takes priority; retrieval, budgets, and cross-turn deduplication remain enabled:++```bash+export OPENVIKING_RECALL_QUERY_EXPANSION=off+export OPENVIKING_RECALL_COMPRESS=off+```++Or configure them in `~/.openviking/ovcli.conf`:++```json+{+ "plugin": {+ "recallQueryExpansion": "off",+ "recallCompress": "off"+ }+}+```++### Choose a compression mode++| Value | Behavior |+| --- | --- |+| `off` | Do not compress recall results |+| `server` | Request compression on the OpenViking server |+| `client` | Use a local compressor only; supported by Claude Code and Codex |+| `auto` | Prefer a local compressor when available; otherwise request automatic server processing |++Claude Code and Codex default to `auto`. Their local compressors are `claude -p` and `codex exec`; see [Recall digests](./16-capability-reference.md#_3-2-5-recall-digest). Other integrations that support cloud compression retain `off` as their default and require explicit opt-in. Server compression is supported by Claude Code, Codex, OpenCode, DSH, pi, Cursor, TRAE, TRAE CN, ZCode, OpenClaw, and the Hermes external plugin. The bundled Hermes provider does not support recall digests. Compression requires a server with context-search rewrite support.++These settings control automatic recall. Explicit MCP `search` calls use the arguments supplied in that call. See the [shared plugin documentation](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression) for details and older-server fallback behavior.++Shared plugins read the `plugin` section in `ovcli.conf`; `plugin.<harness>` overrides a setting for one client. Environment variables take precedence; the older `OPENVIKING_RECALL_REWRITE` still works as an alias for `OPENVIKING_RECALL_COMPRESS`. See [Plugin settings](../configuration/02-client.md#plugin-settings). Restart the agent after changing settings so its hooks load the new configuration. These are plugin-client settings; the server's `ov.conf` does not need to change.++### Request timeout++Query expansion, retrieval, and digest compression run in sequence. Query expansion defaults to a 5-second timeout (`retrieval.recall_intent_timeout_s`); digest rewriting defaults to 30 seconds (`retrieval.recall_rewrite_timeout_s`).++`OPENVIKING_RECALL_CONTEXT_TIMEOUT_MS` or `plugin.recallContextTimeoutMs` sets the client's timeout for the entire context request. When unset, the client waits the plugin's ordinary timeout, raised to at least 15 seconds when the request carries a session and query expansion is not `off` and at least 45 seconds when it asks for a digest. An override should exceed the server timeouts the request will spend and stay below the host's hook timeout. Ending the request early discards the entire response.diff --git a/docs/en/api/01-overview.md b/docs/en/api/01-overview.mdindex 3ade32142..987ed40ec 100644--- a/docs/en/api/01-overview.md+++ b/docs/en/api/01-overview.md@@ -1,4 +1,4 @@-# API Overview+# SDK, HTTP and CLI conventionsThis page covers how to connect to OpenViking and the conventions shared across all API endpoints.@@ -68,7 +68,7 @@ tenant identity from the key. Set `Account` and `User` only for trusteddeployments or gateways that explicitly forward tenant identity.It does not implement legacy `agent_id` compatibility.-See [`sdk/go/README.md`](../../../sdk/go/README.md) for package-level examples.+See [`sdk/go/README.md`](https://github.com/volcengine/OpenViking/blob/main/sdk/go/README.md) for package-level examples.#### JavaScript/TypeScript SDK Client@@ -93,7 +93,7 @@ const results = await client.search("deployment guide", {```It uses the same identity headers and response envelope as the Python and Go-HTTP clients. See [`sdk/typescript/README.md`](../../../sdk/typescript/README.md)+HTTP clients. See [`sdk/typescript/README.md`](https://github.com/volcengine/OpenViking/blob/main/sdk/typescript/README.md)for package-level examples.The Python HTTP client reads connection information from `ovcli.conf`; explicit constructor values override the corresponding settings. `ovcli.conf` is a configuration file shared between the HTTP client and CLI. Default path: `~/.openviking/ovcli.conf`. You can also specify the path via environment variable:diff --git a/docs/en/api/04-skills.md b/docs/en/api/04-skills.mdindex 4955ece42..51e23d7f4 100644--- a/docs/en/api/04-skills.md+++ b/docs/en/api/04-skills.md@@ -88,7 +88,7 @@ Concrete examples of skill invocation.| tags | List[str] | Tags for categorization || metadata | object | Preserved extensions such as `metadata.vikingbot.requires`; OpenViking does not install these dependencies |-Use hyphenated **`allowed-tools`** in `SKILL.md`; parsed structured data and API summaries use **`allowed_tools`**. Do not substitute the underscore spelling in frontmatter. An omitted declaration and an explicit empty declaration can have different Harness permissions; a summary with `allowed_tools: []` cannot distinguish them. Read the full definition before execution. See [VikingBot Skills](../../../bot/docs/en/concepts/06-skills.md) for instruction and metadata handling.+Use hyphenated **`allowed-tools`** in `SKILL.md`; parsed structured data and API summaries use **`allowed_tools`**. Do not substitute the underscore spelling in frontmatter. An omitted declaration and an explicit empty declaration can have different Harness permissions; a summary with `allowed_tools: []` cannot distinguish them. Read the full definition before execution. See [VikingBot Skills](https://github.com/volcengine/OpenViking/blob/main/bot/docs/en/concepts/06-skills.md) for instruction and metadata handling.### MCP Format Automatic Conversion@@ -616,7 +616,7 @@ The HTTP equivalent is `GET /api/v1/skills/search-web?include_content=true&incluThe manifest includes `SKILL.md`, summaries, and auxiliary files/directories, but excludes `.source.json`. Integrity limits are **512 entries (including directories), 16 MiB per file, and 64 MiB total file bytes**, with read concurrency 8. Exceeding a limit returns `RESOURCE_EXHAUSTED`. Content, manifest, and revision are obtained under one tree lock, but later downloads can encounter updates; consumers should verify file hashes and recheck revision.-Search and `get_skill` return content and manifests without executing scripts or installing files in an Agent sandbox. A Harness can read text remotely and download resources when a tool requires local paths. See [VikingBot Skills](../../../bot/docs/en/concepts/06-skills.md) for the complete consumer workflow. MCP clients reach the same package-level behavior through the `find` tool with `context_type="skill"`; see [MCP Integration](../guides/06-mcp-integration.md).+Search and `get_skill` return content and manifests without executing scripts or installing files in an Agent sandbox. A Harness can read text remotely and download resources when a tool requires local paths. See [VikingBot Skills](https://github.com/volcengine/OpenViking/blob/main/bot/docs/en/concepts/06-skills.md) for the complete consumer workflow. MCP clients reach the same package-level behavior through the `find` tool with `context_type="skill"`; see [MCP Integration](../guides/06-mcp-integration.md).### Search Skills@@ -953,4 +953,4 @@ Use kebab-case for skill names:- [Context Types](../concepts/02-context-types.md) - Skill concept- [Retrieval](06-retrieval.md) - Finding skills- [Sessions](05-sessions.md) - Tracking skill usage-- [VikingBot Skills](../../../bot/docs/en/concepts/06-skills.md) - Local/remote activation, metadata, and execution+- [VikingBot Skills](https://github.com/volcengine/OpenViking/blob/main/bot/docs/en/concepts/06-skills.md) - Local/remote activation, metadata, and executiondiff --git a/docs/en/api/22-openviking-assets.md b/docs/en/api/22-openviking-assets.mdindex 2756e37c6..cc0766d44 100644--- a/docs/en/api/22-openviking-assets.md+++ b/docs/en/api/22-openviking-assets.md@@ -1,4 +1,4 @@-# OpenViking Assets Resolver+# AssetsThe OpenViking Assets Resolver parses and validates an[`openviking-assets/1`](../guides/18-openviking-assets.md) Manifest — eitherdiff --git a/docs/en/api/99-api-doc-writing-guide.md b/docs/en/api/99-api-doc-writing-guide.mdindex 3093decd9..b7231248d 100644--- a/docs/en/api/99-api-doc-writing-guide.md+++ b/docs/en/api/99-api-doc-writing-guide.md@@ -1,4 +1,4 @@-# API Documentation Writing Guide+# API documentation standardThis document defines the unified structure and writing conventions for API module documentation in the `docs/en/api/` directory.diff --git a/docs/en/concepts/00-overview.md b/docs/en/concepts/00-overview.mdnew file mode 100644index 000000000..2f3c19217--- /dev/null+++ b/docs/en/concepts/00-overview.md@@ -0,0 +1,37 @@+# Concepts and principles++Follow this reading path through OpenViking's context model, processing flow, architecture and governance. If you have not used OpenViking yet, [import and retrieve your first document](../getting-started/02-quickstart.md), then return here to understand how the result was produced.++## Start with the context model++Read these three pages in order to understand what is stored, where it lives and how much to read:++1. [Context Types](02-context-types.md): the roles of resources, memories and skills.+2. [Viking URI](04-viking-uri.md): how to locate context and distinguish user, Peer and shared spaces.+3. [Context Layers (L0/L1/L2)](03-context-layers.md): the relationship between abstracts, overviews and source content, including the limits of layered reading.++## Follow processing and memory++Trace the paths from source ingestion and recorded conversations:++- [Context Extraction](06-extraction.md): how sources are parsed, organized and processed semantically.+- [Retrieval Mechanism](07-retrieval.md): how relevant context is found and how `find` differs from `search`.+- [Session Management](08-session.md): how messages, session commits and memory extraction connect.++When you are ready to build, choose an [application workflow](../workflows/01-overview.md). Look up parameters and responses in the [reference](../reference/01-overview.md).++## Explore architecture and governance by question++| Question | Reading path |+| --- | --- |+| How do modules work together, and where is data stored? | [Architecture Overview](01-architecture.md) → [Storage Architecture](05-storage.md) |+| When is processing complete, and how does recovery work? | [Queue State and Completion Semantics](16-queue-lifecycle.md) → [Path Locks and Crash Recovery](09-transaction.md) |+| How do primary and backup writes, reads and observation work? | [Multi-Write Storage](14-multi-write-storage.md) → [Metrics](12-metrics.md) |+| Who can see which content, and how are permissions inherited? | [Multi-Tenant](11-multi-tenant.md) → [Resource Access Control (ACL)](15-acl.md) |+| How are data encrypted and skill privacy handled? | [Data Encryption](10-encryption.md) → [Privacy Configs and Skill Privacy Extraction/Restore](13-privacy.md) |++Configuration and deployment steps live in [Deploy & Operate](../guides/00-overview.md). Concept pages explain behavior and constraints; task guides explain how to configure and verify them, with links between the two.++## See an application example++[VikingBot](15-vikingbot.md) shows how an agent combines context with multiple conversation channels. To run it, continue to [VikingBot Installation and Configuration](../guides/17-vikingbot.md). For other existing tools, [choose an agent integration](../agent-integrations/01-overview.md).diff --git a/docs/en/concepts/15-vikingbot.md b/docs/en/concepts/15-vikingbot.mdindex 8e66ed8c7..8d51f67b2 100644--- a/docs/en/concepts/15-vikingbot.md+++ b/docs/en/concepts/15-vikingbot.md@@ -1,4 +1,4 @@-# VikingBot: A Multi-Channel AI Agent Powered by OpenViking+# VikingBot: OpenViking's Native AgentVikingBot is a multi-channel AI Agent provided by OpenViking. OpenViking manages long-term context such as Resources, Memories, and Skills; VikingBot receives user messages, assembles context, invokes models and tools, and delivers results to a command line, chat platform, or HTTP client.diff --git a/docs/en/configuration/01-server.md b/docs/en/configuration/01-server.mdindex bd673ea03..f2227f1a7 100644--- a/docs/en/configuration/01-server.md+++ b/docs/en/configuration/01-server.md@@ -1,4 +1,4 @@-# Server Configuration+# Server configuration fieldsFor initial setup, run `openviking-server init`, then run `openviking-server doctor` after saving the configuration.diff --git a/docs/en/configuration/02-client.md b/docs/en/configuration/02-client.mdindex 3f6a4d6dc..cce6135d9 100644--- a/docs/en/configuration/02-client.md+++ b/docs/en/configuration/02-client.md@@ -1,4 +1,4 @@-# ovcli Configuration+# Client configuration fields`ovcli.conf` is the client configuration file for the `ov` CLI. It stores the server connection, authentication identity, and command defaults.diff --git a/docs/en/getting-started/01-introduction.md b/docs/en/getting-started/01-introduction.mdindex 64ac90076..96922f77b 100644--- a/docs/en/getting-started/01-introduction.md+++ b/docs/en/getting-started/01-introduction.md@@ -1,47 +1,46 @@-# Introduction+# What OpenViking does-OpenViking is an open-source context database for AI agents. It stores resources, memories, and skills in a virtual file system, so an application can browse known paths, retrieve relevant context, and load only the detail it needs.+OpenViking is an open-source context database for AI agents. It organizes sources, memories and skills in one virtual file system so agents can find relevant content and reuse it in later tasks.-Use it when an agent needs to reuse documents and experience across sessions, with one place to organize and retrieve that context.+If your sources are hard to find, you keep repeating background in new conversations, or useful experience is difficult to reuse, choose a path below.## Start with your task-| I want to… | Start here |-| --- | --- |-| Connect to a service and retrieve my first document | [Quick Start](./02-quickstart.md) |-| Connect an existing agent or coding tool | [Agent Integrations](../agent-integrations/01-overview.md) |-| Use OpenViking from a terminal | [CLI Setup](./05-cli-setup.md) |-| Deploy and operate a shared server | [Deployment](../guides/03-deployment.md) and [Authentication](../guides/04-authentication.md) |-| Build against the SDK or HTTP API | [API Reference](../api/01-overview.md) |+| What you want to do | First step | Then continue to |+| --- | --- | --- |+| Help an agent find evidence in project sources | [Import and retrieve your first document](02-quickstart.md) | Replace the sample with your sources and [evaluate the result](06-evaluate.md) |+| Add cross-session memory to an existing agent | [Choose an agent integration](../agent-integrations/01-overview.md) | Follow its installation guide, then [check memory across two sessions](06-evaluate.md#check-memory-across-two-sessions) |+| Use context in your own application | [Application workflows](../workflows/01-overview.md) | Choose a resource, session or skill workflow, then look up its APIs |+| Turn sources into a wiki, graph or report | [Context Compilation Overview](../context-compilation/01-overview.md) | Choose an output and check it against familiar sources |-## How context is organized+**Not sure where to start?** [Import and retrieve your first document](02-quickstart.md). This path uses a small document to connect, import, retrieve and read the source, without requiring you to study the architecture first.-Each file or directory has a `viking://` URI. Use a known URI to list or read context, or search when you do not know where it lives.+If you already have a service URL and API key, [install and use the CLI](05-cli-setup.md). To provide a service yourself, choose a [deployment path](../guides/00-overview.md). To use the agent included with OpenViking, see [VikingBot Installation and Configuration](../guides/17-vikingbot.md).-| Context | What it contains | Learn more |-| --- | --- | --- |-| Resources | Documents, repositories, and other reference material | [Resources](../api/02-resources.md) |-| Memories | User preferences, entities, events, and experience extracted from sessions | [Memory](../api/16-memory.md) |-| Skills | Instructions and supporting files for reusable agent workflows | [Skills](../api/04-skills.md) |+## Turn a first result into a working habit-Shared resources live under `viking://resources/`. User context lives under `viking://user/{user_id}/`, with Peer-specific context under `peers/{peer_id}/`. Shared skills can live under `viking://agent/skills/`. See [Viking URI](../concepts/04-viking-uri.md) for scope and path rules.+1. **Get a first result.** Confirm that you can read imported content, beyond checking service health.+2. **Try your own task.** Use sources with known answers or context needed across sessions. Check what is found and used through [Evaluate OpenViking on your tasks](06-evaluate.md).+3. **Connect it to your work.** Choose an agent, application or compilation workflow. Add deployment and access controls when you need to share the service.-## Load context in layers+If something fails, use [observability and diagnostics](../guides/05-observability.md) to distinguish connection, processing and retrieval problems.-OpenViking can generate directory summaries during semantic processing:+## How context is organized-| Layer | Content | Default body limit |-| --- | --- | --- |-| L0 | Abstract for quick filtering | 256 characters |-| L1 | Overview for navigation | 4,000 characters |-| L2 | Original content for detailed reading | No uniform limit |+| Context | What it stores |+| --- | --- |+| Resources | Documents, code repositories and other external sources |+| Memories | Preferences, facts and experience extracted from sessions |+| Skills | Instructions and supporting files for reusable workflows |-L0 and L1 are directory sidecars, not a pair of summaries attached to every file. Their availability depends on processing state and configuration. See [Context Layers](../concepts/03-context-layers.md).+Content is addressed by a `viking://` URI. Browse a known path, or retrieve a match and then read it. [Context Types](../concepts/02-context-types.md) and [Viking URI](../concepts/04-viking-uri.md) explain the objects and their scope.++## Load context in layers-[Retrieval](../concepts/07-retrieval.md) combines semantic matching with directory traversal. Use `find` for retrieval without session context, or `search` when session context should inform the query. [Observability](../guides/05-observability.md) helps inspect processing and retrieval behavior.+During semantic processing, OpenViking can generate directory abstracts (L0) and overviews (L1), then load source content (L2) when needed. L0 and L1 are directory sidecars; availability depends on processing state and configuration. They are not a fixed pair of summaries for every file. See [Context Layers](../concepts/03-context-layers.md).## Build memory from sessions-Applications record messages in a session and commit it for asynchronous memory extraction. The active memory policy determines which memories are created or updated for the user or Peer. Integration plugins can automate parts of this workflow; check the integration's supported behavior before relying on it. See [Sessions](../concepts/08-session.md) and [Memory Configuration](../guides/01-configuration.md).+Applications record messages and commit sessions for asynchronous extraction under a memory policy. Plugins can automate some of these steps; check the [capability comparison](../agent-integrations/16-capability-reference.md) for their scope. Inspect the actual output and recall behavior to learn what was retained and used.-For implementation details, read the [Architecture](../concepts/01-architecture.md). For release-specific changes, check [GitHub Releases](https://github.com/volcengine/OpenViking/releases).+For a reading path through these mechanisms, start with [Concepts and principles](../concepts/00-overview.md). To continue with a task, choose a link under “Use it in your work” in the sidebar.diff --git a/docs/en/getting-started/02-quickstart.md b/docs/en/getting-started/02-quickstart.mdindex 80ae70a90..999ca712d 100644--- a/docs/en/getting-started/02-quickstart.md+++ b/docs/en/getting-started/02-quickstart.md@@ -1,4 +1,4 @@-# Quick Start+# Import and retrieve your first documentOpenViking runs as a server. Connect to it with the standalone `ov` CLI, import a small document, and retrieve its content. If you use a managed service or someone else's deployment, you only need the CLI.@@ -102,3 +102,7 @@ Replace `<returned-file-uri>` with a file URI from the results, without the angl## Use an SDKOpenViking also provides Python, TypeScript/JavaScript, and Go SDKs that connect to the same server. See the [API Overview](../api/01-overview.md) for client examples.++## Next steps++First confirm that you can read the sample source, then [evaluate OpenViking on your tasks](06-evaluate.md) using your own sources or conversations. To use it in a daily tool, [choose an agent integration](../agent-integrations/01-overview.md). To write your own application, follow the [application workflows](../workflows/01-overview.md).diff --git a/docs/en/getting-started/04-setup-for-agent.md b/docs/en/getting-started/04-setup-for-agent.mdindex 4e5053a83..badaba4e7 100644--- a/docs/en/getting-started/04-setup-for-agent.md+++ b/docs/en/getting-started/04-setup-for-agent.md@@ -1,4 +1,4 @@-# OpenViking Setup SOP (For Agent)+# Server setup instructions for agents## Goaldiff --git a/docs/en/getting-started/05-cli-setup.md b/docs/en/getting-started/05-cli-setup.mdindex 60db4cfa6..57d573c05 100644--- a/docs/en/getting-started/05-cli-setup.md+++ b/docs/en/getting-started/05-cli-setup.md@@ -1,6 +1,6 @@-# OpenViking CLI Setup+# Install and use the CLI-This guide helps you install the OpenViking CLI, configure it, and verify that it can connect to OpenViking.+This guide shows you how to install and configure the OpenViking CLI and use it to connect to an OpenViking server.`ov` is the client CLI. It connects to an existing OpenViking server or to OpenViking Service (VolcEngine Cloud). It does not replace server setup. If you still need to install or start a custom OpenViking server, follow the [Quick Start](02-quickstart.md) first.diff --git a/docs/en/getting-started/06-evaluate.md b/docs/en/getting-started/06-evaluate.mdnew file mode 100644index 000000000..637b2f753--- /dev/null+++ b/docs/en/getting-started/06-evaluate.md@@ -0,0 +1,50 @@+# Evaluate OpenViking on your tasks++After your [first import and retrieval](02-quickstart.md), try documents or conversations from your own work. Check whether OpenViking helps you find evidence, reuse context or produce useful content. Start with one scenario, then expand after you have a result.++| What you want to improve | Start here | What to check |+| --- | --- | --- |+| Spend less time looking through project files | [Import and retrieve documents](02-quickstart.md) | Find the source needed to answer the question, beyond words that merely look similar |+| Reuse background in a new agent session | [Choose an agent integration](../agent-integrations/01-overview.md) | Confirm that memory is stored and recalled for a relevant task without entering the same background again |+| Organize scattered sources into readable content | [Context compilation](../context-compilation/01-overview.md) | Check which sources the output uses, whether its structure helps the reader, and what it omits or gets wrong |++## Check retrieval with your own sources++Choose a small set of sources you know, such as project notes, an operating manual or an incident review. Import them using the [quick start](02-quickstart.md). Prepare questions with known answers, recording the expected source for each. After retrieval, read the returned URI and compare it with the original text.++Include a direct-answer question, one that requires two pieces of information, and one the sources cannot answer. Record whether the evidence was found, whether anything essential was missed, and whether a subsequent agent answer follows the source. `find` returns URIs and scores; your agent or application still needs to read and use the content to generate an answer.++Add more sources after this first check. If results change, you can distinguish ingestion, retrieval and answer-generation problems. Use [observability and diagnostics](../guides/05-observability.md) to inspect processing state and request behavior.++## Check memory across two sessions++Use the [capability comparison](../agent-integrations/16-capability-reference.md) to check which capture, commit and recall steps your plugin automates. Then follow that plugin's verification instructions.++1. In the first session, provide a non-sensitive preference or piece of project context that a later task will need.+2. End or commit the session using the plugin's mechanism. Check processing state, the actual memory output and its user or Peer ownership. A successful commit does not guarantee a particular memory will be created.+3. Start a new session with the same identity. Ask for a task that needs the earlier context without entering that context again. Inspect recall records and the final answer to confirm the stored information was used.+4. Ask an unrelated question and check whether old context is carried into the answer inappropriately.++Installing a plugin is only part of verifying memory. If no memory was produced, inspect [sessions and extraction](../concepts/08-session.md). If memory exists but is not recalled, inspect identity, retrieval scope and plugin behavior. For applications that manage their own sessions, follow the [application workflows](../workflows/01-overview.md) to the relevant APIs.++## Check one compiled output++Choose a [knowledge wiki](../context-compilation/02-llm-wiki.md), [knowledge graph](../context-compilation/03-knowledge-graph.md) or [daily report](../context-compilation/04-daily-report.md). Follow the tutorial to prepare sources and run the task. Confirm completion and the output location, then review the content:++- Can you verify key facts against their sources?+- What is missing, repeated or unsupported?+- Can you use the output for the reading or organizing task you intended?++Start with familiar sources so you can recognize mistakes. Task completion and generated files show that processing finished; the output still needs review before you rely on it.++## Choose what to do next++| Your result | Next step |+| --- | --- |+| Retrieval meets your needs and you want it in a daily tool | [Connect an existing agent](../agent-integrations/01-overview.md) |+| You have verified the capability and want it in your application | [Application workflows](../workflows/01-overview.md) |+| You want to use the agent included with OpenViking | [VikingBot Installation and Configuration](../guides/17-vikingbot.md) |+| You are ready to share a service with your team | [Choose a deployment path](../guides/00-overview.md), then verify identity and access control |+| You want to understand why the system behaves this way | [Concepts and principles](../concepts/00-overview.md) |++Keep your questions, expected sources and observed results. Reuse them when changing configuration or upgrading. When comparing results before and after a change, keep tasks, models and inputs consistent; a retrieval score or one successful run does not establish an improvement.diff --git a/docs/en/guides/00-overview.md b/docs/en/guides/00-overview.mdnew file mode 100644index 000000000..cebb4fe68--- /dev/null+++ b/docs/en/guides/00-overview.md@@ -0,0 +1,23 @@+# Choose a deployment path++If someone has already provided a service URL and API key, go directly to [CLI setup](../getting-started/05-cli-setup.md) or [agent integration](../agent-integrations/01-overview.md). The paths below are for people deploying and operating the service.++| Goal | Reading order | Completion check |+| --- | --- | --- |+| Try it locally | [Quick start](../getting-started/02-quickstart.md) | Import a document, retrieve a match and read its content |+| Host a shared service | [Self-host a server](03-deployment.md) → [Authentication](04-authentication.md) → [Public access](12-public-access.md) | Verify persistence, authorized access, unauthorized rejection and initial data processing |+| Install an enterprise delivery | [Pre-deployment checklist](19-deployment-checklist.md) → [Install and verify](20-private-deployment.md) → [Upgrade and troubleshoot](21-private-operations.md) | Verify each item in the delivery manifest and installation guide |++Enterprise deployment depends on delivery artifacts, images and environment requirements; check the manifest first.++## Configure models and access++For initial model setup, use [Configure models and services](01-configuration.md). For a field lookup, use [server configuration fields](../configuration/01-server.md). The server's `ov.conf` and the client's `ovcli.conf` have different responsibilities; see [client configuration](../configuration/02-client.md) for client fields.++Configure authentication and reverse proxies before exposing remote access. For MCP clients that require OAuth, continue to [OAuth 2.1](11-oauth.md). For shared installations, understand [multi-tenant identity](../concepts/11-multi-tenant.md) and [ACL inheritance](../concepts/15-acl.md). If you need encryption at rest, follow the [encryption guide](08-encryption.md).++## Check the running service++Choose a tool through the [observability and diagnostics guide](05-observability.md). Inspect individual requests with [operation telemetry](07-operation-telemetry.md), trends with [Prometheus / Grafana](11-grafana-prometheus.md), and metric meanings in [metric definitions](../concepts/12-metrics.md). See the [FAQ](../faq/faq.md) for common problems.++Add [multi-write storage](13-multi-write-storage.md), [RAGFS caching](14-ragfs-cache.md) or [cuVS](16-cuvs.md) when needed. These are optional configurations rather than prerequisites for a first deployment.diff --git a/docs/en/guides/01-configuration.md b/docs/en/guides/01-configuration.mdindex 39b402000..220e41199 100644--- a/docs/en/guides/01-configuration.md+++ b/docs/en/guides/01-configuration.md@@ -1,4 +1,6 @@-# Configuration+# Configure models and services++Use this guide to choose models, combine configuration examples and understand configuration scope. For field lookups, see [server configuration](../configuration/01-server.md) or [client configuration](../configuration/02-client.md). For a first deployment, start with [deployment paths](00-overview.md).OpenViking uses a JSON configuration file (`~/.openviking/ov.conf`) for settings.@@ -15,27 +17,6 @@ openviking-server doctor`openviking-server init` prompts for embedding and VLM settings separately. For API-based VLM choices such as `OpenAI`, `Volcengine`, `Kimi`, and `GLM`, enter the VLM API key when prompted. If you want to use Codex as the VLM provider, choose `OpenAI Codex`; the wizard can import existing Codex auth or guide you through login directly.-## Account Embedding and VectorDB--ROOT can configure `settings.embedding` and `settings.vectordb` when creating an-Account. These sections use Account-specific allowlist schemas. Account and-Cluster settings remain independent; the vector resolver applies Cluster defaults-for omitted Account values. Provider connections can only be supplied through a-complete `credentials` binding. Configuration reads return only Account values.--VectorDB is immutable after Account creation. Existing Accounts may rotate complete-Embedding credential/deployment bindings and update retry, concurrency, failback, and-circuit-breaker settings. Outer model identity and other vector-space fields remain-create-only. Compatible endpoint updates do not interrupt in-flight calls or rebuild-historical vectors.--Account-owned VectorDB configurations use remote backends only. Account-configuration cannot select local/cuvs backends, local paths, cuVS tuning, or-custom adapter parameters. Accounts with no VectorDB settings continue sharing-the Cluster connection with Account data filtering. Remote resources must-already exist.-See [Admin configuration API](../api/08-admin.md#runtime-configuration) for permissions and PATCH rules.-## Configuration FileCreate `~/.openviking/ov.conf` in your home configuration directory:@@ -138,6 +119,27 @@ The request body wraps a PATCH document in `settings`:PATCH uses three states: an omitted field is unchanged, a concrete value sets or replaces the value, and `null` removes that value from the addressed scope. Objects merge recursively and arrays replace as a whole. The response contains settings from that scope, not a business-effective Account/Cluster composition. Declarative `fallback` is deprecated, supports only complete sections, and remains solely for compatibility; new features must implement Cluster defaults in their business resolver. See [Admin API - Runtime Configuration](../api/08-admin.md#runtime-configuration) for details.+## Account Embedding and VectorDB++ROOT can configure `settings.embedding` and `settings.vectordb` when creating an+Account. These sections use Account-specific allowlist schemas. Account and+Cluster settings remain independent; the vector resolver applies Cluster defaults+for omitted Account values. Provider connections can only be supplied through a+complete `credentials` binding. Configuration reads return only Account values.++VectorDB is immutable after Account creation. Existing Accounts may rotate complete+Embedding credential/deployment bindings and update retry, concurrency, failback, and+circuit-breaker settings. Outer model identity and other vector-space fields remain+create-only. Compatible endpoint updates do not interrupt in-flight calls or rebuild+historical vectors.++Account-owned VectorDB configurations use remote backends only. Account+configuration cannot select local/cuvs backends, local paths, cuVS tuning, or+custom adapter parameters. Accounts with no VectorDB settings continue sharing+the Cluster connection with Account data filtering. Remote resources must+already exist.+See [Admin configuration API](../api/08-admin.md#runtime-configuration) for permissions and PATCH rules.+## Configuration Examples<details>@@ -1592,7 +1594,7 @@ Vector database storage configuration|-----------|------|-------------|---------|| `backend` | str | VectorDB backend type: 'local' (file-based), 'http' (remote service), 'volcengine' (cloud VikingDB), 'vikingdb' (private deployment), or 'cuvs' (local storage + GPU dense search) | "local" || `name` | str | VectorDB collection name | "context" |-| `url` | str | Remote service URL for 'http' type (e.g., 'http://localhost:5000') | null |+| `url` | str | Remote service URL for 'http' type (e.g., `http://localhost:5000`) | null || `project_name` | str | Project name (alias project) | "default" || `distance_metric` | str | Distance metric for vector similarity search (e.g., 'cosine', 'l2', 'ip') | "cosine" || `dimension` | int | Vector embedding dimension | 0 |diff --git a/docs/en/guides/05-observability.md b/docs/en/guides/05-observability.mdindex d185bcd34..d8fdcc375 100644--- a/docs/en/guides/05-observability.md+++ b/docs/en/guides/05-observability.md@@ -552,7 +552,7 @@ A beginner-friendly viewing order is:After a successful import, you should see a dashboard centered on OpenViking requests, queues, probes, model calls, and overall system state. For a visual reference, see:-- [grafana-demo-dashboard.png](../../images/grafana-demo-dashboard.png)+- [grafana-demo-dashboard.png](/grafana-demo-dashboard.png)This screenshot helps you quickly verify whether the imported layout looks correct. If the dashboard structure matches but some panels are empty, it usually means the corresponding metrics have not produced samples yet, or the filters do not match the current traffic.diff --git a/docs/en/guides/06-mcp-integration.md b/docs/en/guides/06-mcp-integration.mdindex 8f007bd7d..899154ec9 100644--- a/docs/en/guides/06-mcp-integration.md+++ b/docs/en/guides/06-mcp-integration.md@@ -1,4 +1,4 @@-# MCP Integration Guide+# MCP tools and protocolOpenViking Server includes an [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) endpoint. Clients supporting Streamable HTTP can connect directly. Clients supporting only stdio can use the proxy in the [Agent Plugins package](../agent-integrations/15-agent-plugins.md).diff --git a/docs/en/guides/10-prompt-guide.md b/docs/en/guides/10-prompt-guide.mdindex 8858ecf5e..b3e619d87 100644--- a/docs/en/guides/10-prompt-guide.md+++ b/docs/en/guides/10-prompt-guide.md@@ -1,4 +1,4 @@-# OpenViking Prompt Guide and Customization+# Customize processing promptsThis document introduces OpenViking's current prompt template system, with a focus on:diff --git a/docs/en/guides/17-vikingbot.md b/docs/en/guides/17-vikingbot.mdindex f2120054f..c732273cd 100644--- a/docs/en/guides/17-vikingbot.md+++ b/docs/en/guides/17-vikingbot.md@@ -1,5 +1,7 @@# VikingBot Installation and Configuration+For its role and architecture, read [VikingBot](../concepts/15-vikingbot.md), then use this page to install it.+VikingBot is the multi-channel AI Agent built into OpenViking. It can start together with OpenViking, run independently for local debugging, or operate as a long-running Gateway connected to chat platforms.This guide covers installation and configuration for the three main usage scenarios. For complete documentation about Agent tools, chat channels, and architecture, see the [VikingBot documentation](https://github.com/volcengine/OpenViking/blob/main/bot/README.md).diff --git a/docs/en/reference/01-overview.md b/docs/en/reference/01-overview.mdnew file mode 100644index 000000000..ec023b2af--- /dev/null+++ b/docs/en/reference/01-overview.md@@ -0,0 +1,15 @@+# Find a reference++Use this section to look up interface contracts, protocols and configuration fields. For system behavior and design constraints, see [Concepts and principles](../concepts/00-overview.md). For your first use, follow the [quick start](../getting-started/02-quickstart.md). If you have not decided which interfaces to call, choose an [application workflow](../workflows/01-overview.md) first.++| What you need | Entry point |+| --- | --- |+| SDK connections, HTTP authentication, response formats and errors | [SDK, HTTP and CLI conventions](../api/01-overview.md) |+| Server or client configuration fields | [Server configuration](../configuration/01-server.md), [client configuration](../configuration/02-client.md) |+| MCP tools, parameters and upload protocol | [MCP tools and protocol](../guides/06-mcp-integration.md); for client installation, see [Connect an MCP client](../agent-integrations/06-mcp-clients.md) |+| Resources, files and retrieval interfaces | [Resources](../api/02-resources.md), [file system](../api/03-filesystem.md), [content](../api/12-content.md), [retrieval](../api/06-retrieval.md) |+| Sessions, memory and skills interfaces | [Sessions](../api/05-sessions.md), [memory](../api/16-memory.md), [skills](../api/04-skills.md) |+| Administration, permissions and background state | [Admin](../api/08-admin.md), [ACL](../api/12-acl.md), [background tasks](../api/17-tasks.md), [Observer](../api/18-observer.md) |+| Consistency, isolation and processing completion | [Architecture](../concepts/01-architecture.md), [transactions and recovery](../concepts/09-transaction.md), [multi-tenancy](../concepts/11-multi-tenant.md), [queue state](../concepts/16-queue-lifecycle.md) |++The sidebar groups interfaces by the objects they operate on. Task guides remain in Build Applications or Deploy & Operate and link to the relevant references. For configuration steps, see [Configure models and services](../guides/01-configuration.md). For differences between integrations, see the [capability comparison](../agent-integrations/16-capability-reference.md).diff --git a/docs/en/workflows/01-overview.md b/docs/en/workflows/01-overview.mdnew file mode 100644index 000000000..3e1f57a9b--- /dev/null+++ b/docs/en/workflows/01-overview.md@@ -0,0 +1,25 @@+# Application workflows++Complete your [first import and retrieval](../getting-started/02-quickstart.md), then choose a task below. If you use an existing agent, start with [Connect Agents](../agent-integrations/01-overview.md). If you are writing an application, choose a client through the [SDK, HTTP and CLI conventions](../api/01-overview.md).++| Task | Reading order | Check the result |+| --- | --- | --- |+| Retrieve documents or code in an application | [Import resources](../api/02-resources.md) → [Retrieve](../api/06-retrieval.md) → [Read content](../api/12-content.md) | Ask a question with a known answer, read the returned URI and compare it with the source |+| Reuse memory across sessions | [Session and memory model](../concepts/08-session.md) → [Session API](../api/05-sessions.md) → [Memory API](../api/16-memory.md) | Commit a session, confirm background completion, then inspect the memories and their ownership |+| Reuse agent skills | [Skills API](../api/04-skills.md) → [Privacy model](../concepts/13-privacy.md) | Inspect the installed skill, its visibility and how it is invoked |+| Produce a wiki, graph or report from sources | [Context compilation](../context-compilation/01-overview.md) → choose an output tutorial | Check task status, output files and how the output relates to the input sources |+| Sync or migrate existing context | [Project asset sync](../guides/18-openviking-assets.md), [OVPack](../guides/09-ovpack.md) or [version recovery](../guides/15-snapshot.md) | Follow the relevant guide to verify sync state, imported data or restored content |++## Verify retrieval before wiring it into an application++Use a small document with known content. Import it, wait for processing, retrieve a match and read the source. A successful health check only confirms the service can respond; an empty search result alone does not prove ingestion failed. Use [background tasks](../api/17-tasks.md) and [diagnostic tools](../guides/05-observability.md) to distinguish processing state from retrieval results.++Add [Resource Watches](../api/15-watches.md) when remote sources need recurring updates. To change content processing, see [prompt customization](../guides/10-prompt-guide.md).++## Verify memory across sessions++Decide the [user, Peer and shared-context boundaries](../concepts/11-multi-tenant.md) before recording messages and committing sessions. Extraction depends on configuration and policy; a successful commit does not guarantee a particular memory will be created. Inspect the output through the [Session API](../api/05-sessions.md) and [Memory API](../api/16-memory.md). For existing tools, check the [integration capability comparison](../agent-integrations/16-capability-reference.md) to learn which steps the plugin automates.++## Add access control and operations before rollout++Shared services need [authentication](../guides/04-authentication.md) and [ACLs](../concepts/15-acl.md). Find deployment, monitoring and upgrade paths in [Deploy & Operate](../guides/00-overview.md). For parameters, responses and errors, use the [reference index](../reference/01-overview.md).diff --git a/docs/images/integrations/README.md b/docs/images/integrations/README.mdindex 73b2d8369..36a6a6e23 100644--- a/docs/images/integrations/README.md+++ b/docs/images/integrations/README.md@@ -2,6 +2,13 @@These are the same product marks used by the OpenViking website and documentation.+Docs sidebar additions (2026-10-03):++- `claude-code.svg`, `codex.svg`, `cursor.svg`, `trae.svg`, and `opencode.svg`: copied from the image assets rendered by [OpenViking integrations](https://openviking.ai/integrations). Monochrome marks invert in dark mode, matching the website; colored marks retain their colors.+- DSH reuses the README's `logos/dsh.svg` and `logos/dsh-dark.svg` monochrome marks, switching between black and white with the theme. The blue DeepSeek mark is not used for this entry.+- `langchain.svg`: the framework's chain-link icon from the [official LangChain product page](https://www.langchain.com/langchain), reused in both themes. The corporate LangChain symbol is a different mark and is not used for this framework entry.+- The sidebar reuses `openclaw.jpg`, `hermes-agent.png`, and `pi.svg` below. All images are served locally, have empty alt text beside their product names, and keep their aspect ratio.+- `codex.png`: [documentation catalog artwork](https://lf3-static.bytednsdoc.com/obj/eden-cn/lm_sth/ljhwZthlaukjlkulzlp/agent_logo/codex.png), referenced by `docs/images/agents/en/index.json`.- `openclaw.jpg`, `hermes-agent.png`, `pi.svg`: reused from `openviking_playground/src/assets/brand/` (`ca4fb82`). The OpenClaw file contains JPEG data and uses the matching extension here.- `pi-dark.svg`: the same monochrome pi mark with a light foreground for dark backgrounds.diff --git a/docs/images/integrations/claude-code.svg b/docs/images/integrations/claude-code.svgnew file mode 100644index 000000000..5424926b9--- /dev/null+++ b/docs/images/integrations/claude-code.svg@@ -0,0 +1 @@+<svg width='248' height='248' viewBox='0 0 248 248' fill='none' xmlns='http://www.w3.org/2000/svg'><path d='M52.4285 162.873L98.7844 136.879L99.5485 134.602L98.7844 133.334H96.4921L88.7237 132.862L62.2346 132.153L39.3113 131.207L17.0249 130.026L11.4214 128.844L6.2 121.873L6.7094 118.447L11.4214 115.257L18.171 115.847L33.0711 116.911L55.485 118.447L71.6586 119.392L95.728 121.873H99.5485L100.058 120.337L98.7844 119.392L97.7656 118.447L74.5877 102.732L49.4995 86.1905L36.3823 76.62L29.3779 71.7757L25.8121 67.2858L24.2839 57.3608L30.6515 50.2716L39.3113 50.8623L41.4763 51.4531L50.2636 58.1879L68.9842 72.7209L93.4357 90.6804L97.0015 93.6343L98.4374 92.6652L98.6571 91.9801L97.0015 89.2625L83.757 65.2772L69.621 40.8192L63.2534 30.6579L61.5978 24.632C60.9565 22.1032 60.579 20.0111 60.579 17.4246L67.8381 7.49965L71.9133 6.19995L81.7193 7.49965L85.7946 11.0443L91.9074 24.9865L101.714 46.8451L116.996 76.62L121.453 85.4816L123.873 93.6343L124.764 96.1155H126.292V94.6976L127.566 77.9197L129.858 57.3608L132.15 30.8942L132.915 23.4505L136.608 14.4708L143.994 9.62643L149.725 12.344L154.437 19.0788L153.8 23.4505L150.998 41.6463L145.522 70.1215L141.957 89.2625H143.994L146.414 86.7813L156.093 74.0206L172.266 53.698L179.398 45.6635L187.803 36.802L193.152 32.5484H203.34L210.726 43.6549L207.415 55.1159L196.972 68.3492L188.312 79.5739L175.896 96.2095L168.191 109.585L168.882 110.689L170.738 110.53L198.755 104.504L213.91 101.787L231.994 98.7149L240.144 102.496L241.036 106.395L237.852 114.311L218.495 119.037L195.826 123.645L162.07 131.592L161.696 131.893L162.137 132.547L177.36 133.925L183.855 134.279H199.774L229.447 136.524L237.215 141.605L241.8 147.867L241.036 152.711L229.065 158.737L213.019 154.956L175.45 145.977L162.587 142.787H160.805V143.85L171.502 154.366L191.242 172.089L215.82 195.011L217.094 200.682L213.91 205.172L210.599 204.699L188.949 188.394L180.544 181.069L161.696 165.118H160.422V166.772L164.752 173.152L187.803 207.771L188.949 218.405L187.294 221.832L181.308 223.959L174.813 222.777L161.187 203.754L147.305 182.486L136.098 163.345L134.745 164.2L128.075 235.42L125.019 239.082L117.887 241.8L111.902 237.31L108.718 229.984L111.902 215.452L115.722 196.547L118.779 181.541L121.58 162.873L123.291 156.636L123.14 156.219L121.773 156.449L107.699 175.752L86.304 204.699L69.3663 222.777L65.291 224.431L58.2867 220.768L58.9235 214.27L62.8713 208.48L86.304 178.705L100.44 160.155L109.551 149.507L109.462 147.967L108.959 147.924L46.6977 188.512L35.6182 189.93L30.7788 185.44L31.4156 178.115L33.7079 175.752L52.4285 162.873Z' fill='#D97757'/></svg>\ No newline at end of filediff --git a/docs/images/integrations/codex.svg b/docs/images/integrations/codex.svgnew file mode 100644index 000000000..f6ea6fe18--- /dev/null+++ b/docs/images/integrations/codex.svg@@ -0,0 +1 @@+<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M11.248 18.25q-.825 0-1.568-.314a4.3 4.3 0 0 1-1.32-.874 4 4 0 0 1-1.304.214 4 4 0 0 1-2.046-.544 4.27 4.27 0 0 1-1.518-1.485 4 4 0 0 1-.56-2.095q0-.48.131-1.04A4.4 4.4 0 0 1 2.04 10.71a4.07 4.07 0 0 1 .017-3.4 4.2 4.2 0 0 1 1.056-1.418 3.8 3.8 0 0 1 1.6-.842 3.9 3.9 0 0 1 .76-1.683q.593-.759 1.451-1.188a4.04 4.04 0 0 1 1.832-.429q.825 0 1.567.313.742.314 1.32.875a4 4 0 0 1 1.304-.215q1.106 0 2.046.545a4.14 4.14 0 0 1 1.501 1.485q.578.941.578 2.095 0 .48-.132 1.04.66.61 1.023 1.419.363.792.363 1.666 0 .892-.38 1.717a4.3 4.3 0 0 1-1.072 1.435 3.8 3.8 0 0 1-1.584.825 3.8 3.8 0 0 1-.775 1.683 4.06 4.06 0 0 1-1.436 1.188 4.04 4.04 0 0 1-1.832.429m-4.076-2.062q.825 0 1.435-.347l3.103-1.782a.36.36 0 0 0 .164-.313v-1.42L7.881 14.62a.67.67 0 0 1-.726 0l-3.118-1.798a.5.5 0 0 1-.017.115v.198q0 .841.396 1.551.413.693 1.139 1.089a3.2 3.2 0 0 0 1.617.412m.165-2.69a.4.4 0 0 0 .181.05q.083 0 .165-.05l1.238-.71-3.977-2.31a.7.7 0 0 1-.363-.643v-3.58q-.825.362-1.32 1.122a2.9 2.9 0 0 0-.495 1.65q0 .809.413 1.55.412.743 1.072 1.123zm3.91 3.663q.875 0 1.585-.396a2.96 2.96 0 0 0 1.534-2.64v-3.564a.32.32 0 0 0-.165-.297l-1.254-.726v4.604a.7.7 0 0 1-.363.643l-3.119 1.799a3 3 0 0 0 1.783.577m.627-6.039V8.878L10.01 7.822 8.129 8.878v2.244l1.881 1.056zM7.057 5.859a.7.7 0 0 1 .363-.644l3.119-1.798a3 3 0 0 0-1.782-.578q-.874 0-1.584.396A2.96 2.96 0 0 0 6.05 4.324a3.07 3.07 0 0 0-.396 1.551v3.547q0 .199.165.314l1.237.726zm8.383 7.887q.825-.364 1.303-1.123.495-.758.495-1.65a3.15 3.15 0 0 0-.412-1.55q-.413-.743-1.073-1.123l-3.086-1.782q-.099-.065-.181-.049a.3.3 0 0 0-.165.05l-1.238.692 3.993 2.327a.6.6 0 0 1 .264.264.64.64 0 0 1 .1.363zm-3.317-8.382a.63.63 0 0 1 .726 0l3.135 1.831v-.297q0-.792-.396-1.501a2.86 2.86 0 0 0-1.105-1.155q-.71-.43-1.65-.43-.825 0-1.436.347L8.294 5.941a.36.36 0 0 0-.165.314v1.418z'/></svg>\ No newline at end of filediff --git a/docs/images/integrations/cursor.svg b/docs/images/integrations/cursor.svgnew file mode 100644index 000000000..fa4b96967--- /dev/null+++ b/docs/images/integrations/cursor.svg@@ -0,0 +1 @@+<svg fill='#000000' role='img' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><title>Cursor</title><path d='M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23'/></svg>\ No newline at end of filediff --git a/docs/images/integrations/opencode.svg b/docs/images/integrations/opencode.svgnew file mode 100644index 000000000..0ce453b3e--- /dev/null+++ b/docs/images/integrations/opencode.svg@@ -0,0 +1 @@+<svg fill='#000000' role='img' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><title>OpenCode</title><path d='M22 24H2V0h20zM17 4.8H7v14.4h10z'/></svg>\ No newline at end of filediff --git a/docs/images/integrations/trae.svg b/docs/images/integrations/trae.svgnew file mode 100644index 000000000..9c5f3e38b--- /dev/null+++ b/docs/images/integrations/trae.svg@@ -0,0 +1 @@+<svg fill='#32F08C' role='img' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><title>TRAE</title><path d='M24 20.5H3.5V17H0V3.5h24ZM3.5 17h17V7h-17Zm8.5-5-2.5 2.5L7 12l2.5-2.5Zm7 0-2.5 2.5L14 12l2.5-2.5z'/></svg>\ No newline at end of filediff --git a/docs/package-lock.json b/docs/package-lock.jsonindex 382fb8b95..c098fa7bf 100644--- a/docs/package-lock.json+++ b/docs/package-lock.json@@ -11,6 +11,7 @@"ogl": "^1.0.11"},"devDependencies": {+ "markdown-it-task-lists": "^2.1.1","vitepress": "1.6.4"}},@@ -1867,6 +1868,13 @@"dev": true,"license": "MIT"},+ "node_modules/markdown-it-task-lists": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz",+ "integrity": "sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA==",+ "dev": true,+ "license": "ISC"+ },"node_modules/mdast-util-to-hast": {"version": "13.2.1","resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-13.2.1.tgz",diff --git a/docs/package.json b/docs/package.jsonindex 75134a0c9..ef6110c06 100644--- a/docs/package.json+++ b/docs/package.json@@ -13,6 +13,7 @@"check:docs": "node scripts/check-docs-consistency.mjs"},"devDependencies": {+ "markdown-it-task-lists": "^2.1.1","vitepress": "1.6.4"},"dependencies": {diff --git a/docs/scripts/check-built-anchors.py b/docs/scripts/check-built-anchors.pyindex 23a172635..cc13f850c 100644--- a/docs/scripts/check-built-anchors.py+++ b/docs/scripts/check-built-anchors.py@@ -1,8 +1,8 @@#!/usr/bin/env python3-"""Check local section links against IDs in built VitePress HTML, not guessed slugs.+"""Check local links and section IDs against the built VitePress output.Run after docs:build. DOCS_BASE must match the build's base path.-External URLs, text fragments, and non-HTML assets are outside this check.+External URLs and browser text fragments are outside this check. Local assets must exist."""import argparse@@ -45,13 +45,11 @@ def check(dist, base):for filename, page in pages.items():for href in page.links:url = urlsplit(href)- if url.scheme or url.netloc or not url.fragment:+ if url.scheme or url.netloc or (not url.path and not url.fragment):continue# Browser text fragments do not refer to element IDs. A preceding# element fragment still needs to exist (e.g. #heading:~:text=...).fragment = unquote(url.fragment.split(":~:text=", 1)[0])- if not fragment:- continuetarget = unquote(url.path)if target.startswith("/"):if not target.startswith(base):@@ -65,20 +63,23 @@ def check(dist, base):target = filenametarget = posixpath.normpath(target)if Path(target).suffix not in ("", ".html"):+ checked += 1+ if not (dist / target).is_file():+ errors.append(f"{filename}: {href} (local asset not found)")continuecandidates = [target, target + ".html", posixpath.normpath(posixpath.join(target, "index.html"))]resolved = next((candidate for candidate in candidates if candidate in pages), None)checked += 1if resolved is None:errors.append(f"{filename}: {href} (target HTML not found)")- elif fragment not in pages[resolved].ids:+ elif fragment and fragment not in pages[resolved].ids:errors.append(f"{filename}: {href} (ID {fragment!r} missing in {resolved})")- print(f"Checked {checked} local section links across {len(pages)} built HTML pages.")+ print(f"Checked {checked} local links and section anchors across {len(pages)} built HTML pages.")if errors:print("\n".join(errors))- print(f"Found {len(errors)} broken section links.")+ print(f"Found {len(errors)} broken local links.")return 1- print("Built section-link checks passed.")+ print("Built link and anchor checks passed.")return 0diff --git a/docs/scripts/check-docs-consistency.mjs b/docs/scripts/check-docs-consistency.mjsindex e2a3b856e..725eef50b 100644--- a/docs/scripts/check-docs-consistency.mjs+++ b/docs/scripts/check-docs-consistency.mjs@@ -59,7 +59,7 @@ for (const [index, files] of localized.entries()) {const candidates = [target, `${target}.md`, path.join(target, 'index.md')]if (target.endsWith('.html')) candidates.push(target.slice(0, -5) + '.md')// VitePress serves public assets from the site root.- if (decoded.startsWith('/')) candidates.push(path.join(root, 'public', decoded))+ if (decoded.startsWith('/')) candidates.push(path.join(root, 'images', decoded))linkCount++if (!candidates.some((candidate) => fs.existsSync(candidate))) errors.push(`${label}:${lineAt(match.index)}: missing link target ${href}`)}diff --git a/docs/zh/about/01-about-us.md b/docs/zh/about/01-about-us.mdindex b73de2e64..7940dd54f 100644--- a/docs/zh/about/01-about-us.md+++ b/docs/zh/about/01-about-us.md@@ -4,6 +4,8 @@OpenViking 是面向 AI Agent 的开源上下文数据库,由字节跳动火山引擎 Viking 团队发起并维护。它用文件系统组织资源、记忆和技能,供 Agent 浏览、检索和按需读取。+[在 GitHub 查看 OpenViking](https://github.com/volcengine/OpenViking)+## 团队介绍### Viking 团队背景diff --git a/docs/zh/agent-integrations/01-overview.md b/docs/zh/agent-integrations/01-overview.mdindex 2c651e190..cb3fac8a9 100644--- a/docs/zh/agent-integrations/01-overview.md+++ b/docs/zh/agent-integrations/01-overview.md@@ -1,4 +1,4 @@-# Agent 集成概览+# 选择 Agent 接入方式OpenViking 可以作为多种 Agent 运行时的长期记忆与上下文后端。按你的运行时挑选合适的接入方式即可。@@ -35,41 +35,4 @@ OpenViking 可以作为多种 Agent 运行时的长期记忆与上下文后端## 低延迟召回-查询扩展和召回压缩都会增加模型调用。优先考虑响应速度时,可以关闭这两项;检索、预算控制和跨轮去重仍然保留:--```bash-export OPENVIKING_RECALL_QUERY_EXPANSION=off-export OPENVIKING_RECALL_COMPRESS=off-```--也可以在 `~/.openviking/ovcli.conf` 中配置:--```json-{- "plugin": {- "recallQueryExpansion": "off",- "recallCompress": "off"- }-}-```--### 选择压缩方式--| 值 | 行为 |-| --- | --- |-| `off` | 不压缩召回结果 |-| `server` | 请求 OpenViking 服务端压缩 |-| `client` | 只用本地压缩器,适用于 Claude Code 和 Codex |-| `auto` | 有本地压缩器时优先使用,否则请求服务端自动处理 |--Claude Code 和 Codex 默认使用 `auto`,本地压缩器分别是 `claude -p` 和 `codex exec`,见 [§3.2.5](./16-capability-reference.md#_3-2-5-召回再摘要)。其他支持云端压缩的集成默认保持 `off`,需要显式开启。服务端压缩适用于 Claude Code、Codex、OpenCode、DSH、pi、Cursor、TRAE、TRAE CN、ZCode、OpenClaw 和 Hermes,要求服务端支持 context-search rewrite。--这些设置控制自动召回。模型主动调用 MCP `search` 时,使用该次调用传入的参数。完整规则与旧服务端回退行为见[共享插件说明](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression)。--共享插件读取 `ovcli.conf` 的 `plugin` 段;`plugin.<harness>` 可覆盖某个客户端的配置。环境变量优先级更高;旧变量 `OPENVIKING_RECALL_REWRITE` 仍可作为 `OPENVIKING_RECALL_COMPRESS` 的别名使用,详见[插件配置](../configuration/02-client.md#插件配置)。修改后重启对应 Agent,使 hook 进程加载新配置。这些都是插件客户端配置,不需要修改服务端的 `ov.conf`。--### 请求超时--查询扩展、检索和 digest 压缩依次执行。查询扩展默认超时为 5 秒(`retrieval.recall_intent_timeout_s`),digest 默认超时为 30 秒(`retrieval.recall_rewrite_timeout_s`)。--`OPENVIKING_RECALL_CONTEXT_TIMEOUT_MS` 或 `plugin.recallContextTimeoutMs` 控制客户端等待整个 context 请求的上限。未设置时沿用插件的普通超时;请求带 session 且未将 query expansion 设为 `off` 时至少 15 秒,请求 digest 时至少 45 秒。自定义值应高于该请求会用到的服务端超时,并低于宿主 hook 的超时;客户端提前结束会丢失整个响应。+接入并验证插件后,可按[调整召回延迟](19-recall-tuning.md)配置查询扩展、结果压缩与超时。diff --git a/docs/zh/agent-integrations/02-claude-code.md b/docs/zh/agent-integrations/02-claude-code.mdindex f8be416fa..d138ae0c4 100644--- a/docs/zh/agent-integrations/02-claude-code.md+++ b/docs/zh/agent-integrations/02-claude-code.md@@ -1,4 +1,4 @@-# Claude Code 记忆插件+# Claude Code为 [Claude Code](https://docs.claude.com/zh-CN/docs/claude-code/overview) 添加跨项目、跨会话(session)的长期记忆功能。安装完成后,每轮对话均会自动召回相关记忆并捕获新内容,无需模型主动调用任何工具。diff --git a/docs/zh/agent-integrations/03-openclaw.md b/docs/zh/agent-integrations/03-openclaw.mdindex 250337680..1b8845f2f 100644--- a/docs/zh/agent-integrations/03-openclaw.md+++ b/docs/zh/agent-integrations/03-openclaw.md@@ -1,4 +1,4 @@-# OpenClaw 插件+# OpenClaw为 [OpenClaw](https://github.com/openclaw/openclaw) 添加长效记忆。安装完成后,OpenClaw 会自动记住对话中的重要信息,并在每次回复前召回相关上下文。diff --git a/docs/zh/agent-integrations/04-codex.md b/docs/zh/agent-integrations/04-codex.mdindex f85e79dcf..9f9195bf6 100644--- a/docs/zh/agent-integrations/04-codex.md+++ b/docs/zh/agent-integrations/04-codex.md@@ -1,4 +1,4 @@-# Codex 记忆插件+# Codex为 [Codex](https://developers.openai.com/codex) 提供跨会话记忆。插件通过 hooks 自动召回、捕获和提交对话,通过 MCP 提供检索、读取和记忆管理工具。diff --git a/docs/zh/agent-integrations/05-hermes.md b/docs/zh/agent-integrations/05-hermes.mdindex 25b7219dd..e9cc84696 100644--- a/docs/zh/agent-integrations/05-hermes.md+++ b/docs/zh/agent-integrations/05-hermes.md@@ -1,4 +1,4 @@-# Hermes Agent+# Hermes[Hermes Agent](https://hermes-agent.nousresearch.com/) (Nous Research) 内置 OpenViking 记忆提供方。无需安装插件——把 Hermes 指向你的 OpenViking 服务即可,记忆存储、召回和抽取均原生支持。diff --git a/docs/zh/agent-integrations/07-langchain-langgraph.md b/docs/zh/agent-integrations/07-langchain-langgraph.mdindex f46d83a06..f02172f24 100644--- a/docs/zh/agent-integrations/07-langchain-langgraph.md+++ b/docs/zh/agent-integrations/07-langchain-langgraph.md@@ -1,4 +1,4 @@-# LangChain 和 LangGraph+# LangChain / LangGraph把 OpenViking 接入你的 LangChain 或 LangGraph Agent 作为上下文后端。独立集成包提供retriever、chat history、context wrapper、agent tools、LangGraph store 和 middleware,diff --git a/docs/zh/agent-integrations/10-opencode.md b/docs/zh/agent-integrations/10-opencode.mdindex d0286a485..bb56d440e 100644--- a/docs/zh/agent-integrations/10-opencode.md+++ b/docs/zh/agent-integrations/10-opencode.md@@ -1,4 +1,4 @@-# OpenCode 插件+# OpenCode为 [OpenCode](https://opencode.ai/) 提供跨项目、跨会话的长期记忆和已索引仓库上下文。安装后,每次对话都会通过 OpenCode plugin hooks 自动召回相关记忆并捕获新内容;模型可调用工具来自 Claude Code / Codex 记忆插件同款的 OpenViking stdio MCP 代理。diff --git a/docs/zh/agent-integrations/11-pi.md b/docs/zh/agent-integrations/11-pi.mdindex a3b5f2efa..64bb12655 100644--- a/docs/zh/agent-integrations/11-pi.md+++ b/docs/zh/agent-integrations/11-pi.md@@ -1,4 +1,4 @@-# pi Coding Agent 扩展+# pi为 [pi](https://github.com/earendil-works/pi) 提供跨会话长期记忆和 context takeover。召回、捕获和 takeover 基于 pi 原生扩展 API:每个 prompt 前自动召回、每个 turn 后自动捕获,并可由 OpenViking 在 pi 的 `context` hook 中用归档 overview 替换已 commit 的本地历史。扩展使用官方 MCP 客户端,把服务端的 MCP 工具注册成 pi 原生工具。diff --git a/docs/zh/agent-integrations/12-cursor.md b/docs/zh/agent-integrations/12-cursor.mdindex 397c3194a..90f1c0061 100644--- a/docs/zh/agent-integrations/12-cursor.md+++ b/docs/zh/agent-integrations/12-cursor.md@@ -1,4 +1,4 @@-# Cursor 记忆集成+# Cursor为 Cursor 添加跨项目、跨会话的长期记忆。安装完成后,OpenViking Hook 会在会话启动和用户提交问题时注入相关上下文,在回复结束后捕获新对话;MCP 仅用于主动搜索、读取和管理记忆。diff --git a/docs/zh/agent-integrations/13-trae.md b/docs/zh/agent-integrations/13-trae.mdindex e64b9edf0..2150e3d78 100644--- a/docs/zh/agent-integrations/13-trae.md+++ b/docs/zh/agent-integrations/13-trae.md@@ -1,4 +1,4 @@-# TRAE、TRAE CN 与 TraeCode CLI 2.0 记忆集成+# TRAE为 TRAE、TRAE CN 和 TraeCode CLI 2.0 添加跨项目、跨会话的长期记忆。安装后,OpenViking Hook 会自动加载相关上下文、捕获每轮对话并提交给记忆抽取器;MCP 用于主动搜索、读取和管理记忆。diff --git a/docs/zh/agent-integrations/16-capability-reference.md b/docs/zh/agent-integrations/16-capability-reference.mdindex 54a8d3ecd..010b8f781 100644--- a/docs/zh/agent-integrations/16-capability-reference.md+++ b/docs/zh/agent-integrations/16-capability-reference.md@@ -1,725 +1,729 @@-# 集成能力参考+<a id="agent-集成能力对照"></a>-**Hermes 范围**:表中的 Hermes 描述其[内置 provider](https://github.com/NousResearch/hermes-agent/tree/989798cd5e691230b54b2ea72e5937b68133014c/plugins/memory/openviking),-核对版本为 Hermes main `989798cd5e`。[OpenViking 维护的外部插件](https://github.com/volcengine/OpenViking/tree/main/examples/hermes-plugin)-另有提交、召回和镜像改进。内置副本仍在时优先加载;正常使用请按-[配置指南](./05-hermes.md)操作。+# Agent 集成能力-## 导读+本页对比各 OpenViking Agent 集成安装后的实际行为。依赖某个集成之前,可以先用本页回答三个问题:-| 你想知道 | 去哪里 |-|---|---|-| 特定 harness 下,agent 可主动调用的工具列表 | [§1.1](#_1-1-主动工具面-agentic-调用能力) 主动工具面 + [§2.1](#_2-1-服务端-mcp-工具面)(MCP 面)+ 各档案卡 |-| 不同关闭方式下,记忆归档的时机 | **[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) 关闭方式 × harness 终局矩阵** |-| 自动召回是否携带 session_id 及其影响 | [§3.2.2](#_3-2-2-判定矩阵) / [§3.2.3](#_3-2-3-profile-开场注入) |-| 如何开启召回再摘要,以及服务端与客户端的职责划分 | [§3.2.5](#_3-2-5-召回再摘要) |-| `forget` 操作与删除功能的类型边界 | [§3.5](#_3-5-写入与删除的类型边界) |-| 特定环境变量在不同 harness 下的生效情况 | [§3.1.4](#_3-1-4-配置体系分层) 配置体系分层 + 各档案卡"配置" |-| 服务端是否具备自动 commit 兜底机制 | [§2.3](#_2-3-服务端会话与-commit-语义) |-| ov CLI 命令全集 | [§5](#_5-ov-cli-命令参考) |-| 自定义 agent 如何接入 OpenViking | [§6](#_6-自定义-agent-接入指南) |-| 某个集成怎么安装、怎么配、怎么排障 | 该集成的单独页面([§4](#_4-harness-档案卡) 各档案卡首行给出链接) |+- Agent 能自己调用哪些 OpenViking 工具?+- 哪些事情不需要 Agent 请求就会发生:每次提问前的召回、会话开场注入的上下文、对话捕获,以及把对话变成长期记忆的提交?+- Agent 退出、崩溃、压缩上下文或连不上服务端时,哪些内容会保留,哪些会丢失?----+安装请从[选择 Agent 接入方式](./01-overview.md)开始。下文的对比基于[源码依据](#源码依据)中列出的实现;一个集成能用哪些 MCP 工具,由所连的服务端决定。-# 1. 能力总览+## 两类能力-## 1.1 主动工具面(Agentic 调用能力)+**Agent 可调用的工具**由模型决定是否调用,例如 `search`、`read`、`remember`。模型不调用,就不会发生任何事。只接 MCP 时,只有这一类能力。-- **MCP 型 harness(claude-code、codex/trae-cli、cursor、trae/trae-cn、zcode、kimicode、opencode、dsh、pi)的主动工具面完全一致,共 20 个工具**:这些工具由服务端统一定义,各插件读取 `~/.openviking/ovcli.conf` 并连接服务端 MCP 工具;pi 在扩展中使用官方 MCP 客户端,再把发现的工具注册成 pi 原生工具。+**自动生命周期行为**由宿主事件触发,不需要模型请求,包括:提问到达模型前的召回、会话开场注入的 profile 和 skill 上下文、把每轮对话捕获到 OpenViking 会话,以及提交。hook、插件和原生扩展提供这类能力。-- trae-cli 指 TraeCode CLI 2.0(仅支持 2.0),经 codex 插件别名安装,插件与 codex 格式兼容,下文矩阵并入 codex 行。+长期记忆只在**提交**(commit)之后才会从会话中抽取。已捕获但未提交的消息留在服务端会话里,要等之后的某次提交才会变成记忆。[捕获与提交](#捕获与提交)说明每个集成何时提交,以及退出时可能留下什么。-| harness | 工具面形态 | 工具数(默认开) | 搜 memory | 搜 resource | 搜 skill | 写 memory | 写 resource | 写 skill | 删除类型边界 |-|---|---|---|---|---|---|---|---|---|---|-| claude-code | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| codex / trae-cli | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| cursor | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| trae / trae-cn | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| zcode | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| kimicode | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| opencode | MCP 透传(宿主加 `openviking_` 前缀) | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| dsh | MCP 透传 | 20 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| pi | MCP 镜像(官方客户端;扩展加 `openviking_` 前缀) | 20,即 `tools/list` 返回什么就是什么(注册有前置条件³) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ `add_skill`¹ | 无类型区分² |-| openclaw | 原生注册(15 个 `memory_*`/`ov_*` 等) | 15(默认开 14⁴) | ✅ `memory_recall` | ✅ `ov_search`(默认双 scope) | ✅ `ov_search` | ✅ `memory_store` | 默认关⁴ | ✅ `add_skill` | memory-only 白名单 + 单候选 score≥0.85 才自动删 |-| hermes | 原生注册(6 个 `viking_*`) | 6(provider 激活即全开) | ✅ | ✅ | ✅ | ✅ `viking_remember`(独立会话提交,异步抽取) | ✅ 多协议摄取(HTTP/Git/SSH/本地文件/目录 zip) | ❌ | memory-only + `.md` 叶子校验 |-| ov CLI | CLI 命令 | ~40 命令组 | ✅ `ov find` | ✅ `ov find` | ✅ `ov find` | ✅ `ov add-memory` | ✅ `ov add-resource` | ✅ `ov add-skill` | `ov rm` 直接执行(TUI 删除有确认 + root/scope 禁删) |+<a id="导读"></a><a id="_1-能力总览"></a><a id="_1-2-自动-hook-面-通过-harness-自动实现"></a><a id="_1-3-形态分组"></a>-¹ MCP `write` 拒绝写用户自己的 `skills/` 子树;写 `viking://agent/skills` 时会生成一个绕过 skill 安装流程的普通文件(没有 frontmatter abstract,也不做 privacy 抽取),所以共享 skill 同样要走 `add_skill`。skill 的新建、安装和替换走 MCP `add_skill` 工具(内联 SKILL.md 文本、Git URL,或本地目录/zip 的签名上传),它和 REST `POST /api/v1/skills` 共用同一套安装实现。-² MCP `forget` 不区分 memory/resource/skill 类型;存储层保留了命名空间根保护机制(裸 `viking://`、`viking://user`、`viking://agent` 根拒删),详见 [§3.5](#_3-5-写入与删除的类型边界)。-³ pi 工具注册前置:需未命中 `bypassSessionPatterns`、`client.health()` 通过、`ensureSession` 成功,且 `/mcp` 握手取回工具清单(`index.ts:150-205`);共享键 `mcpEnabled: false` 则整个桥接都不发起,不算失败。握手失败只让本次会话没有 OpenViking 工具,召回、会话同步与 takeover 照常,`before_agent_start` 会在后续轮次重试(`index.ts:252-255`),因此 pi 启动之后才拉起的 server 不必重启 pi 就能接上。详见 [§3.6](#_3-6-降级与容错)。-⁴ openclaw 的 `add_resource` 需经过双重 opt-in 后方可开启。+## 一览-**skill 的增删边界**:新增入口包含 MCP `add_skill`、openclaw `add_skill`(默认开)、`ov add-skill` 与 REST;删除边界分四档,详见 [§3.5](#_3-5-写入与删除的类型边界)。+### 可调用工具-## 1.2 自动 hook 面(通过 Harness 自动实现)+“服务端 MCP 工具”指服务端 `tools/list` 返回的工具:当前服务端有 20 个,列在[服务端 MCP 工具](#服务端-mcp-工具)。-| harness | 接入方式 | 自动召回 | 召回带 session_id | 再摘要(客户端)* | profile 注入 | 接管宿主压缩 | 离线补偿 | statusline |-|---|---|---|---|---|---|---|---|---|-| claude-code | 9 hook + MCP 代理 + slash + statusline + skill | ✅ | ✅ | ✅ 本地 `claude -p` / 服务端 rewrite(默认 auto) | ✅(10000)+ `<available-skills>`(1200) | ❌(PreCompact 只 commit) | ✅ | ✅ |-| codex / trae-cli | 6 hook + MCP 代理 + skill | ✅ | ✅ | ✅ 本地 `codex exec`(默认开) | ✅(10000)+ `<available-skills>`(1200) | ❌ | ✅ transcript + 游标 | ❌ |-| cursor | 6 hook + MCP 代理 + rule + skill | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200) | ❌ | ✅ | ❌ |-| trae / trae-cn | 4 hook + MCP 代理 | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200) | ❌ | ✅ | ❌ |-| zcode | 4 hook + MCP 代理 | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200) | ❌ | ✅ | ❌ |-| kimicode | 7 个原生 plugin hook + MCP 代理 | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200),首次成功 prompt 加载 | ❌(PreCompact 只捕获/commit) | ✅ | ❌ |-| opencode | v1/v2 双栈 plugin hook + MCP 代理 | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200) + repo 列表进 system prompt | ❌(只在压缩完成后 commit) | ✅ | ❌ |-| dsh | Cordis 原生插件(同进程)+ MCP 代理 + skill | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200),每 session 一次 | ❌ | ✅ | ❌ |-| pi | 原生扩展(9 事件) | ✅ | ✅ | ❌ | ✅(10000)+ `<available-skills>`(1200),进 systemPrompt 每轮重拼 | ✅ **takeover**(默认开) | ✅ | ✅ |-| openclaw | context-engine 插件(`ownsCompaction:true`) | ✅ | ❌(走 `/find`,该接口无 session_id 字段) | ❌ | ❌ | ✅ **ContextEngine 全接管** | ❌ 失败轮次不重放 | ❌ |-| hermes | MemoryProvider 原生插件 | ✅ | 部分(仅 `search/search` 首选路径;降级 `/find` 不带) | ❌ | ✅(会话开场记忆预算默认 6000 token) | ❌ | ✅ 进程内上传;待提交标记落盘 | ❌ |-| ov CLI | 一次性命令 | ❌(`ov find/search` 是显式命令) | —(`ov search --session-id` 为显式参数) | ❌ | ❌ | ❌ | ❌ | ❌ |+| 集成 | 接入方式 | Agent 可调用的工具 |+|---|---|---|+| [Claude Code](#claude-code) | 插件:hook + MCP 代理 | 服务端 MCP 工具 |+| [Codex、TraeCode CLI 2.0](#codex-与-traecode-cli-2-0) | Codex 插件:hook + MCP 代理 | 服务端 MCP 工具 |+| [Cursor](#cursor) | hook 与 MCP 配置,外加一条 rule | 服务端 MCP 工具 |+| [TRAE、TRAE CN](#trae-与-trae-cn) | hook 与 MCP 配置 | 服务端 MCP 工具 |+| [ZCode](#zcode) | hook 与 MCP 配置 | 服务端 MCP 工具 |+| [Kimi Code](#kimi-code) | Kimi Code 插件:hook + MCP 代理 | 服务端 MCP 工具 |+| [OpenCode](#opencode) | npm 插件,自动添加 MCP 条目 | 服务端 MCP 工具,名为 `openviking_<tool>` |+| [DSH](#dsh) | 同进程 Cordis 插件 + MCP 代理 | 服务端 MCP 工具,名为 `mcp__openviking__<tool>` |+| [pi](#pi) | 原生扩展,内置 MCP 客户端 | 服务端 MCP 工具;MCP 握手成功后注册为 `openviking_<tool>` |+| [OpenClaw](#openclaw) | context-engine 插件 | 15 个原生工具,默认启用 14 个 |+| [Hermes](#hermes) | Hermes memory provider | 6 个原生 `viking_*` 工具 |+| [MCP 客户端、Agent Plugins](#其他集成) | 仅 MCP | 服务端 MCP 工具 |+| [ov CLI](#ov-cli) | 命令行客户端 | 每个操作都是显式命令,不经过 Agent |++### 自动行为++| 集成 | 每次提问前召回 | 会话开场上下文 | 会话中的提交 | 正常退出时提交 | 宿主压缩 |+|---|---|---|---|---|---|+| Claude Code | 是,带会话 | profile、记忆索引、skill | 待提交 token 达到 20,000 | 是 | 先提交,再由宿主摘要 |+| Codex | 是,带会话 | profile、记忆索引、skill | 待提交 token 达到 20,000 | Codex 0.145+;否则下次启动时 | 先提交,再由宿主摘要 |+| TraeCode CLI 2.0 | 是,带会话 | profile、记忆索引、skill | 待提交 token 达到 20,000 | 仅当版本带 `SessionEnd`;否则下次启动时 | 同 Codex |+| Cursor | 是,带会话 | profile、记忆索引、skill | 每捕获 8 条消息 | 否 | 先提交,再由宿主摘要 |+| TRAE、TRAE CN | 是,带会话 | profile、记忆索引、skill | 每轮 | 没有退出事件;每轮已提交 | 没有压缩前事件 |+| ZCode | 是,带会话 | profile、记忆索引、skill | 每轮 | 没有退出事件;每轮已提交 | 没有压缩前事件 |+| Kimi Code | 是,带会话 | profile、记忆索引、skill,在首次提问时 | 每捕获 8 条消息 | 仅当 `SessionEnd` 捕获到新消息 | 提交新捕获的消息 |+| OpenCode | 是,带会话 | profile、记忆索引、skill、已索引的仓库 | 空闲时,待提交 token 达到 20,000 | 是,在宿主的清理时限内 | 在压缩前后提交 |+| DSH | 是,带会话 | profile、记忆索引、skill,每个会话一次 | 待提交 token 达到 20,000 | 是,预算 3 秒 | 未观察到 |+| pi | 是,带会话 | profile、记忆索引、skill,每轮 | takeover 开:约 30,000 token;关:20,000 | takeover 开:否;关:是 | takeover 替换 pi 的摘要 |+| OpenClaw | 是,不带会话 | 无 | token 预算的一半(默认 64,000) | 否 | 插件接管压缩 |+| Hermes(内置) | 是,带会话,有回退路径 | profile 与记忆清单 | 否;只在会话边界 | 是,前提是待上传内容在 10 秒内完成 | fork 型压缩时提交 |+| ov CLI | 否 | 否 | 只有 `ov session commit` | 不适用 | 不适用 |-\* 此列指客户端是否内建了针对召回结果的本地压缩;服务端则在 context 检索面上,统一为所有调用方提供 digest 能力(`rewrite` 参数,[§3.2.5](#_3-2-5-召回再摘要))。+表格说明:-profile 注入列里,第一个数字是 `profileTokenBudget` 的默认值,`<available-skills>` 后面的数字是它单独的 `skillCatalogTokenBudget` 默认值([§3.2.3](#_3-2-3-profile-开场注入))。+- **带会话的召回**会发送会话 ID,服务端借助对话内容理解查询。共享插件的 context 模式还会扩写查询,并记录最近注入过的记忆,避免重复注入。Hermes 用 list 模式,没有注入台账;OpenClaw 用 `/find`,该接口没有会话字段。请求路径和回退见[召回请求如何到达服务端](#召回请求如何到达服务端)。+- **待提交 token** 是服务端统计的、已捕获但未提交的消息量。多数阈值是客户端设置,见[各集成何时提交](#各集成何时提交)。+- **正常退出时提交**指集成会发出提交请求。网络错误、宿主的退出时限或进程被终止仍可能打断它。Ctrl+C、信号和崩溃见[退出时会发生什么](#退出时会发生什么)。-**session_id 携带现状**:除 openclaw(其调用的 `/find` 接口无该字段)与 hermes 的降级路径外,其余所有 harness 的自动召回均显式携带 session_id,并有跨插件回归测试钉死(`examples/memory-plugin-shared/recall-session-wiring.test.mjs:16-39`)。+<a id="_1-1-主动工具面-agentic-调用能力"></a><a id="_2-公共能力核"></a>-## 1.3 形态分组+## Agent 可调用的工具-- **全家桶型**(hook 自动化 + MCP 工具面 + 周边 UX 齐全):claude-code、codex(trae-cli 经别名安装同属此档)。-- **瘦 hook 型**(共享 agent-hook-runtime,核心行为基本一致,差异仅体现在宿主事件、transcript 解码与阈值上):cursor、trae/trae-cn、zcode、kimicode。-- **plugin 事件型**:opencode(宿主事件面最丰富,dispose 覆盖关闭)。-- **同进程原生型**:dsh(Cordis)、pi(扩展 + takeover 压缩接管)、openclaw(context-engine 全接管)、hermes(MemoryProvider)。-- **工具型**:ov CLI(所有操作均为显式调用,不存在任何自动行为)。-- **非 coding**:Open WebUI(工具服务器)、LangChain(SDK 库)、Agent Plugins 便携包(MCP+skill 规范包)、通用 MCP 直连、log ingestion(日志反向导入)、Helper(桌面端)。+<a id="_2-1-服务端-mcp-工具面"></a>----+### 服务端 MCP 工具-# 2. 公共能力核+所有基于 MCP 的集成都暴露同一组由服务端定义的工具,自己不维护工具目录。本地代理(pi 则是内置 MCP 客户端)读取 `~/.openviking/ovcli.conf`,连接服务端的 `/mcp`,原样转发 `tools/list` 的结果。服务端升级可以直接增加工具,不需要插件发版;客户端重新连接后即可看到。各工具的参数见 [MCP 工具与协议](../guides/06-mcp-integration.md#可用的-mcp-工具)。-per-harness 章节(档案卡)只写差异;所有共享事实均在本章一次性说明完毕。+| 分组 | 工具 |+|---|---|+| 检索与浏览 | `find`、`search`、`read`、`list`、`tree`、`grep`、`glob` |+| 写入 | `remember`、`write`、`edit`、`add_resource`、`add_skill` |+| 删除 | `forget` |+| 监听资源 | `list_watches`、`cancel_watch`(商业版暂不支持) |+| 账户与权限 | `list_users`、`list_groups`、`get_acl`、`set_acl` |+| 状态 | `health` |-## 2.1 服务端 MCP 工具面+使用前需要了解的行为:-工具定义来自服务端的 `tools/list`。插件代理读取本地 `~/.openviking/ovcli.conf` 中的连接配置,再连接服务端发现工具;服务端增加工具后,客户端需重新连接或刷新工具列表。本页的工具数量对应当前仓库实现,实际以所连服务端返回的列表为准。+- **`remember`** 会创建一个名为 `mcp-store-<id>` 的一次性会话,写入消息后立即提交。它是唯一会提交的 MCP 工具。没有任何 MCP 工具会提交 Agent 当前的对话,那是自动 hook 的工作。+- **`find` 与 `search`**:`find` 是不带会话上下文的快速检索。`search` 可以传 `session_id`,并做意图分析(`retrieval.enable_intent`,默认开启)。`find` 传 `context_type="skill"` 时,每个 skill 包只返回一条命中,指向它的 `SKILL.md`,范围包括用户自己的和账户共享的 skill。+- **`write` 与 `edit`** 只能写 `viking://resources`、`viking://user` 和 `viking://agent`。新文件的扩展名必须是 `.md`、`.txt`、`.json`、`.yaml`、`.yml`、`.toml`、`.py`、`.js` 或 `.ts`。用户的 `skills/`、`peers/`、`privacy/` 和 `sessions/` 目录只读。写入 `viking://agent/skills` 不会被拒绝,但会跳过 skill 安装流程,skill 请用 `add_skill`。+- **`add_resource` 传本地路径**时返回一个签名上传 URL(默认 600 秒有效)。模型需要把文件上传到这个 URL,例如用一条 shell 命令;上传后自动开始入库。远程 URL 会直接入库。+- **`forget`** 删除传入的任意 URI,默认不递归。它不检查 URI 是记忆、资源还是 skill,见[写入与删除限制](#写入与删除限制)。+- **Schema** 在服务端启动时被展平,只接受 OpenAPI 3.0 子集的客户端(如 Gemini)也能加载。校验仍按原始签名进行,例如 `read` 也接受单个字符串。所有客户端拿到的 schema 相同。+- **身份**的解析方式与 REST 请求相同,见[认证](../guides/04-authentication.md)。-| # | 工具名 | 功能 | 参数要点(定义行号) |-|---|---|---|---|-| 1 | `find` | 不依赖会话上下文的快速语义检索 | `query, target_uri="", limit=10, min_score=0.35, level, context_type, read_content`;只传 `context_type="skill"` 时改调 `SearchService.find_skills`(包级检索,`skill_package_retriever.py`):一个 skill 包一条命中,URI 改写为 `<包根>/SKILL.md`,摘要取包自身的 abstract,`read_content` 也读这个文件;不传 `target_uri` 时同时检索 `viking://~/skills` 与 `viking://agent/skills`。其它 `context_type` 组合,以及不带 query 只给 filter 的调用,仍走通用检索路径;渲染时的 URI 改写和「一个包一条」合并照常生效(`:262`) |-| 2 | `search` | 深检索,可带 `session_id` + 意图分析 | `session_id` 仅在服务端 `retrieval.enable_intent`(默认 true)开启时才会加载会话(`:315`)。这里按条目检索 skill,只在渲染时合并,所以一个包在多个文件上命中会占掉多个 `limit` 名额,摘要也取自实际命中的文件 |-| 3 | `read` | 读取单个或多个 `viking://` 文件全文 | 并发信号量 10;单条失败返回 `(nothing found at <uri>)` 不抛错(`:643`) |-| 4 | `list` | 列目录(函数名 `ls`,注册名显式改写为 `list`) | `recursive=False`(`:784`) |-| 5 | `tree` | 递归目录树 | `level_limit=3, node_limit=1000, include_abstract=False`;`include_abstract=true` 时打印每个目录的 abstract(最长 1024 字符),因此 `tree(uri="viking://~/skills", level_limit=1, include_abstract=true)` 能列出全部 skill 及其描述(`:862`) |-| 6 | `remember` | 写长期记忆 | 内部建一次性会话 `mcp-store-<uuid12>` 并立即 `commit_async`(`:940`)——这是 MCP 面唯一的 commit 入口;MCP 没有显式 commit 工具 |-| 7 | `write` | 写 `viking://` 文件 | `mode=replace\|append\|create`:replace 覆盖或在缺失时创建,append 追加或在缺失时创建,create 仅创建缺失文件且已存在时返回冲突;显式 create 的文件扩展名白名单为 `.md .txt .json .yaml .yml .toml .py .js .ts`;可写域 `resources/user/agent`;用户根下 `skills/ peers/ privacy/ sessions/` 只读;已存在的 `.abstract.md/.overview.md` sidecar 可改正文,但公共 API 不能创建;写 `viking://agent/skills` 不会被拒绝,但会绕过 skill 安装流程,skill 请改用 `add_skill`,详见 [§3.5](#_3-5-写入与删除的类型边界)(`:965`;`content_write.py:60-81`) |-| 8 | `edit` | 精确字符串替换 | `old_string` 空/0 命中/多命中且非 replace_all 均报错,且文件内容不变;编辑 skill 包内的文件不会重新触发 skill 安装流程,详见 [§3.5](#_3-5-写入与删除的类型边界)(`:1005`) |-| 9 | `add_resource` | 资源摄取(远程 URL / 本地文件签名上传 / Connector) | `watch_interval` 单位为分钟(0=不 watch);本地路径分支返回签名上传 URL(TTL 默认 600s),上传后自动入库,无需二次调用(`:1161`) |-| 10 | `add_skill` | 新建、安装或替换 skill | `data`(完整 SKILL.md 文本)或 `path`(Git URL / GitHub tree URL,或本地 SKILL.md、目录、zip——本地分支和 `add_resource` 一样返回签名上传 URL);`skills=[...]` 从多 skill 源里挑选,`list_only=true` 只预览;`target_uri="viking://agent/skills"` 表示账户共享。与 REST `POST /api/v1/skills` 共用安装代码。工具描述里写明它是新建和更新 skill 的唯一入口,删除请走 `ov skills remove` 或 Studio(`:1452`) |-| 11 | `list_watches` | 列 watch 订阅,商业版尚未支持 | scheduler 未运行时返回错误串(`:1621`) |-| 12 | `cancel_watch` | 按 `to_uri` 取消,商业版尚未支持 | 刻意不暴露 pause/resume/trigger/update(`:1653`) |-| 13 | `grep` | 正则内容检索 | 多 pattern 并发(信号量 10),`node_limit=10`(`:1696`) |-| 14 | `glob` | 文件名 glob | `node_limit=100`(`:1765`) |-| 15 | `forget` | 永久删除 URI(不可恢复) | 默认 `recursive=False`;类型边界详见 [§3.5](#_3-5-写入与删除的类型边界)(`:1791`) |-| 16 | `health` | 健康检查 | 无参(`:1808`) |-| 17 | `list_users` | 列出账户内用户 ID;凭据需显式请求并具有 ADMIN/ROOT 权限,trusted 模式禁用 | `query`、`limit`、`page`、`include_credentials`(`mcp_endpoint.py:356`) |-| 18 | `list_groups` | 列出账户内组 ID,不返回成员 | 无用户参数(`mcp_endpoint.py:394`) |-| 19 | `get_acl` | 读取资源 ACL;需 manage 权限或账户 ADMIN | `uri`(`mcp_endpoint.py:408`) |-| 20 | `set_acl` | 设置资源 ACL;需 manage 权限或账户 ADMIN | `uri`、`acl`(`mcp_endpoint.py:418`) |--配套机制:--- **可移植 schema 重写**(`:1149-1218`):模块导入时把所有工具的 `anyOf`/`$ref` 折成扁平类型,以兼容 Gemini 等 OpenAPI 3.0 子集客户端;运行时校验仍用原始 Python 签名(例如 `read` 广播的 schema 是 array,但仍接受裸字符串)。所有 MCP 客户端拿到的 schema 都由服务端统一产出,客户端无差异。-- **身份中间件**(`:149-233`):与 REST 共用 `resolve_identity`,按认证模式解析凭据和身份:API key 模式从 key 确定账户与用户,trusted 模式接受可信网关传入的账户/用户头,dev 模式接受账户/用户头,缺省字段使用 `default`。actor peer 另行解析,不能覆盖认证身份。见[认证指南](../guides/04-authentication.md)。--## 2.2 memory-plugin-shared 共享层--`examples/memory-plugin-shared/lib/` 下共 25 个 `.mjs` 模块,是 JS 系 harness 的唯一事实源。两种消费形态:--1. **Vendoring(复制)**:由 `sync.mjs` 分发到 7 个目标,每个文件首行加 `// GENERATED FROM ... DO NOT EDIT.`(因此 vendored 副本行号 = lib 源行号 + 1)。分发清单不再手写:每个目标拿的是自身代码实际 import 的传递闭包。claude-code、codex、agent-plugins 由宿主直接指向仓库目录安装,openclaw 的 `ov-install` 可以按 git ref 逐个文件下载插件,所以这四个的生成副本提交进 git,并由 main 上的推送重新生成;opencode、dsh 以 npm 包发布,pi 由安装脚本打包,这三个在打包时生成副本,git 中不保留。-2. **相对路径直接 import(不复制)**:cursor / trae / trae-cn / zcode 直接 `import "../../memory-plugin-shared/lib/..."`;安装器把包与这些 hook 传递 import 到的共享模块一起复制到 `~/.openviking/agent-integrations/{<client>,memory-plugin-shared}/`,保持相对层级。这份安装集合对 import 闭合,包括 hook 运行时所需的 workspace 配置层。运行期几个 harness 共用该目录,任一重装都会整体覆盖。--核心模块速览(细节在各维度章展开):--| 模块 | 职责 | 消费方 |-|---|---|---|-| `recall-core.mjs` | 召回请求构造 + 三级降级 + 本地兜底排序注入 | 全部 JS 系 harness |-| `agent-hook-runtime.mjs` | "瘦 hook"一体化运行时(配置经共享 schema 解析、session id 派生、跨进程锁、fetch、commit) | cc / codex / cursor / trae / trae-cn / zcode |-| `mcp-proxy-core.mjs` | stdio↔streamable-HTTP MCP 代理内核 | 使用子进程通信的 MCP 集成与 agent-plugins;pi 直接使用官方客户端 |-| `ov-http.mjs` | hook 到 OpenViking 服务端的唯一出网路径:请求头、AbortController、信封解析 | 全部 JS 系 + agent-plugins |-| `pending-queue.mjs` | 磁盘离线队列 + 会话启动重放 | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `batch-send.mjs` | 100 条/批写入 + 404/405 逐条降级 + 连续前缀入队 | cc / codex / opencode + agent-hook 系 |-| `profile-inject.mjs` | session-start 的 profile + 可用记忆清单 + `<available-skills>` skill 清单注入 | 9 个 harness(openclaw / hermes 除外) |-| `recall-compress-core.mjs` | 召回压缩 prompt + URI 编辑距离修复 + 缓存 | claude-code |-| `capture-utils.mjs` | 消息归一 + 注入回流防护 + 内置捕获启发式(应答语、slash 命令、信息量下限) | cc / codex / opencode / dsh / pi / zcode / cursor / trae×2 |-| `input-filters.mjs` | 编译并执行操作员自己配的 sed 风格规则 —— `s` 替换、`d` 丢弃、`k` 仅保留,可限定角色 —— 作用于召回 query 与每个被捕获的回合;解析失败的规则会被报告并跳过,不抛异常([语法](https://github.com/volcengine/OpenViking/blob/main/examples/claude-code-memory-plugin/README_CN.md#输入过滤器)) | 所有 hook 插件;`recallQueryFilters` / `captureFilters` 两个 knob 目前由 claude-code / codex 提供 |-| `credentials.mjs` | 凭据解析链(详见 [§3.1.3](#_3-1-3-凭据体系)) | 全部 JS 系 |-| `session-model.mjs` | 会话 id 前缀派生 + bypass glob | 全部 JS 系 |-| `async-writer.mjs` | 写路径 detach(drain stdin → spawn → approve → write → unref;spawn 失败回落同步) | cc / codex / zcode |-| `workspace-peer.mjs` | 按 `peer.source` 解析 actor peer(预设 / 模板 / 保留用于双读的旧 peer id,详见 [§3.1.3](#_3-1-3-凭据体系)) | 全部 JS 系 |-| `workspace-identity.mjs` | workspace 根目录 + git 身份(归一化 `origin`、仓库根路径、worktree/submodule 类型),纯文件系统上溯、不起 `git` 子进程,按 cwd 缓存 | 全部 JS 系 |-| `workspace-config.mjs` | 分层 workspace 配置:读 `<root>/.openviking/config.json` 与 `config.local.json`,带来源(provenance)合并各层,剥离连接与凭据类 key | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `workspace-registry.mjs` | 每机注册表 `~/.openviking/workspaces/<slot>.json`——一个 workspace 一个文件,由人工创建、插件只读,优先级高于任何已提交的文件 | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `uri-guard.mjs` | 文件工具的路径参数是 `viking://` URI 时拒绝调用;shell 命令带 `viking://` URI 时照常执行,并给模型附加提示;grep 的 `pattern` 是搜索文本,不当作路径;目标是 skill URI(`isSkillUri()`)时,write 与 edit 的提示改为 `add_skill`,不再指向 `write` / `edit` | 拒绝:各 harness 的 PreToolUse/tool.execute.before 类 hook;提示:PreToolUse,或执行后的 hook(dsh `tools/post-execute`、pi `tool_result`、opencode `tool.execute.after`) |-| `config-schema.mjs` | 全部配置项的唯一声明:规范名、类型、默认值、取值范围、`OPENVIKING_*` 变量、可接受的旧拼写、workspace 键。doctor 的已知键集合与 workspace 文件的点分键映射都是它的投影 | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `plugin-config.mjs` | 按层解析全部已声明配置项:env → workspace 各层 → ovcli.conf `plugin.<harness>` → ovcli.conf `plugin` → ov.conf 的 harness 段 → 默认值 | cc / codex / cursor / trae×2 / zcode / opencode / dsh / pi |-| `setup-wizard.mjs` | 交互式写 ovcli.conf | cc / codex / opencode / pi 暴露入口 |-| `retryable.mjs` | 可重试判定:status 0/408/429/≥500,或 409 且 `error.details.retryable===true`;4xx(含 401/403)不重试 | 全部 JS 系 |--## 2.3 服务端会话与 commit 语义--- **会话隐式创建**:插件普遍不显式调用 `POST /sessions`(dsh 例外,它会发一个只含 `session_id` 的 create);首次 `POST /sessions/{id}/messages(/batch)` 时由服务端 `auto_create=True` 建会话。召回侧 `mode="context"` 的 `_load_session(auto_create=True)` 也会建(第一次召回即在服务端创建会话)。-- **commit 两阶段**:`POST /sessions/{id}/commit` 的 Phase 1(归档 archive)同步完成后才返回,Phase 2(记忆抽取)作为后台任务返回 `task_id`。`keep_recent_count` 服务端默认 **0**(全量归档,不留 live tail)。-- **服务端自动 commit 默认关闭,除非显式策略或部署级默认策略将其启用**:- - `memory.session_auto_commit.enabled = false`(`memory_config.py`);无存储 policy 的会话自动 commit 关闭(`session_service.py`);idle 扫描器在 `enabled=false` 时根本不创建(`core.py`),构成双重门控。- - `POST /messages` 的 auto_create 不接受 policy 参数,但配置后会继承 `server.user_config_defaults.auto_commit_policy`;`POST /sessions`(create)与 `PATCH /sessions/{id}/config` 仍是显式的 Session 级控制面。- - 当前记忆插件不主动下发 `auto_commit_policy`。可通过 Python SDK 的 `create_session` / `update_session_config`、HTTP API 或 **ov CLI** 设置(`ov session new --auto-commit-policy-json` / `--no-auto-commit`、`ov session config set`)。- - policy 显式启用时,服务端默认阈值是 `pending_token_threshold=150000(严格大于)/ message_count_threshold=100 / idle_timeout_seconds=86400 / keep_recent_count=0 / min_commit_interval_seconds=0`。注意这组服务端默认值与各插件客户端的 20000/10 是相互独立的两层配置。-- **由此**:插件可通过 `server.user_config_defaults.auto_commit_policy` 继承新 Session 的 token/message 阈值;idle timeout 兜底还需开启 `memory.session_auto_commit.enabled=true`。未配置该 fallback 时,客户端仍需自行安排 commit 路径([§3.3](#_3-3-会话与-commit-生命周期))。-- **tool output 外置**:服务端 `tool_output_externalization.enabled=True`、`threshold_chars=20000`(`server/config.py:257-258`)——客户端普遍把 `captureToolMaxChars` 设到 1000000 仅作兜底,真正的截断/外置在服务端做,externalized 结果通过 `tool_output_ref` 引用(openclaw 有三个专门工具读它)。-- **服务端召回相关熔断**:`retrieval.recall_intent_timeout_s=5.0`(query expansion)、`recall_rewrite_timeout_s=30.0`(digest,[§3.2.5](#_3-2-5-召回再摘要))、`enable_intent=true`。客户端超时预算按这两条推导([§3.2.4](#_3-2-4-超时与预算链))。-------# 3. 维度详解--## 3.1 接入形态、安装与配置体系--### 3.1.1 判定矩阵--| harness | 集成形态 | 安装通道 | 会话 id 前缀/格式 | 配置来源 | 独立 setup 向导 |-|---|---|---|---|---|---|-| claude-code | CC 插件(marketplace):包含 9 hook + MCP 代理 + slash + statusline + skill | 一键 `install.sh --harness claude`(Claude Code 2.0+)/ 手动 marketplace | `cc-<CC session_id 原文>`;subagent 格式为 `…__subagent-<agent_id>` | env + ovcli.conf `plugin.claude_code` + ov.conf `claude_code` | ✅ `scripts/setup.mjs` |-| codex | Codex 插件(marketplace):包含 6 hook + MCP 代理 + skill | 一键 `--harness codex` / `codex plugin marketplace add`(TOS 走 dumb-HTTP git 以保留远程更新能力) | `cx-<safeId>`(确定性推导,不读取 state) | env + ovcli.conf `plugin.codex` + ov.conf `codex` | ✅ |-| trae-cli | **codex 插件别名安装**(TraeCode CLI 2.0,仅支持 2.0;Codex 系:binary `traecli`、配置 `~/.trae/traecli.toml`;能力面与 codex 一致) | 一键 `--harness trae-cli`(复用 codex 安装流程;marketplace 命令会随指向的 binary 执行,如 `traecli plugin marketplace add`) | 与 codex 的派生规则一致 | 与 codex 一致(env + ovcli.conf `plugin.codex` + ov.conf) | ✅(同 codex) |-| cursor | 配置驱动(写入 `~/.cursor/hooks.json`+`mcp.json`)+ rule + skill | 一键 `--harness cursor` | `cu-<conversation_id>` | env + ovcli.conf `plugin.cursor` | ❌(共用安装器 TUI) |-| trae / trae-cn | 配置驱动(`~/.trae{,-cn}/hooks.json` + 平台相关 mcp.json) | 一键 `--harness trae,trae-cn` | `tr-` / `trcn-` | env + ovcli.conf `plugin.trae` / `plugin.trae_cn` | ❌ |-| zcode | 配置驱动(合并进 `~/.zcode/cli/config.json`,并强制 `hooks.enabled=true`) | 一键 `--harness zcode` | `zc-<sess_…>` | env + ovcli.conf `plugin.zcode` | ❌ |-| kimicode | Kimi Code 原生插件(`kimi.plugin.json`,managed copy + `installed.json`) | 一键 `--harness kimicode` | `kc-<session_id>` | env + ovcli.conf `plugin.kimicode` + workspace 文件 | ❌ |-| opencode | npm 插件 `@openviking/opencode-plugin`(config hook 自注入 MCP 条目) | 一键 `--harness opencode`(复制为 `~/.config/opencode/plugins/` 下的本地文件插件)/ 手动 npm / 源码 | `oc-<id>`;subagent 格式为 `oc-<parent>__subagent-<child>` | env + ovcli.conf `plugin.opencode` | ✅ |-| dsh | Cordis 同进程插件(`cordis.patch.yml` 条目) | 统一安装器(默认装到 `web` profile,可用 `--dsh-profile` 指定),或执行 `dsh plugin --profile web add @openviking/dsh-memory-plugin` | `dsh-<session.id 原样>`;subagent 各自独立会话 | env + ovcli.conf `plugin.dsh` + cordis patch config(行为旋钮的最低层;凭据仍以 patch 优先) | ❌ |-| pi | pi 原生扩展(目录装载,jiti 直译 TS) | 一键 `--harness pi`(复制到自动发现目录,无需 `pi install`) | `pi-<piSessionId>` | env + ovcli.conf `plugin.pi`(凭据字段由凭据链统一解析) | ✅ |-| openclaw | context-engine 插件(`ownsCompaction:true`)+ 15 工具 + 5 slash + 4 hook + HTTP 路由 | ClawHub 执行 `openclaw plugins install clawhub:@openviking/openclaw-plugin` 搭配 `openclaw openviking setup` / npm 安装器 / TOS 离线包 | UUID 原样小写,否则 `sha256(sessionKey)`;`memory_store` 临时会话 `memory-store-<ts>-<rand>` | `openclaw.json` 的 `plugins.entries.openviking.config`(严格校验:存在未知键/非法值时插件进入 setup-only 模式)+ 少量 env | ✅ `openclaw openviking setup`(交互/非交互 + key 角色探测 + 版本兼容检查) |-| hermes | Hermes bundled MemoryProvider(随 Hermes 发布,无需装插件) | 执行 `hermes memory setup openviking`(curses 向导)或手动 `hermes config set memory.provider openviking` + `.env` | 由 Hermes 生成,插件原样使用 | `.env`(`OPENVIKING_*`)或 ovcli.conf 联动(`use_ovcli_config` 模式会清空 .env 里的 5 个对应变量)+ config.yaml | ✅(多层菜单) |-| ov CLI | Rust 原生二进制 | npm `@openviking/cli` / `uv tool install openviking` / cargo / GitHub Releases | 无自有会话(`ov chat` 默认使用 machine-uid) | `ovcli.conf`(多 profile)+ 少量 env | ✅ `ov config`(TUI 向导) |--### 3.1.2 统一安装器--统一安装脚本 `examples/memory-plugin-shared/install.sh` 覆盖 11 个 harness id:`claude, codex, cursor, trae, trae-cn, trae-cli, zcode, kimicode, opencode, pi, dsh`(其中 openclaw 走自有渠道;`trae-cli` 则复用 codex 安装流程,[§3.1.1](#_3-1-1-判定矩阵))。要点如下:--- 安装源与交互:全部从 OpenViking 文档站提供的下载安装;在仓库 checkout 中运行时改用该 checkout(`--source archive|dev`)。以 `curl … | bash` 方式执行时会从 `/dev/tty` 读取输入,从而保留交互。-- 官方 docs 的规范一键命令是不带 `--harness` 的裸命令(执行后进入 TUI 多选);而各插件自带的 setup-helper 转发脚本在调用时会自动补 `--harness`。-- 幂等合并:hooks/mcp 条目按 `OPENVIKING_INTEGRATION_ID` 标记识别自有条目,做到剔旧追新的同时不动第三方;写入采用原子操作——先备份 `.bak`,写 tmp 后 rename 覆盖,权限 0600。-- 凭据向导写 `~/.openviking/ovcli.conf`:三选一(本地 `http://127.0.0.1:1933` / 火山云 `https://api.vikingdb.cn-beijing.volces.com/openviking` / 自定义),已有配置先展示当前值再问"沿用/重配",API key 掩码。-- 卸载:`--uninstall` 覆盖 cursor / trae / trae-cn / zcode / kimicode,并顺带清理 trae-cli 遗留的旧 hook 配置;其他 Codex 格式或宿主托管插件通过各自宿主的插件管理卸载。-- 安装后自检:grep 配置 + `node --check` + 一次 `OPENVIKING_MEMORY_ENABLED=0` 的 smoke run。-- Node 门槛:安装器检查 18+。--### 3.1.3 凭据体系--代码中并存着四套并行的凭据解析体系,env 变量名与认证头各不相同,排障时先分清对象:--| 家族 | 消费者 | URL env | Key env | 身份 env | 认证头 |-|---|---|---|---|---|---|-| **A. JS 共享核**(`credentials.mjs`) | claude-code / codex(含 trae-cli)/ cursor / trae×2 / zcode / opencode / pi / dsh / agent-plugins | `OPENVIKING_URL` → `OPENVIKING_BASE_URL` | `OPENVIKING_BEARER_TOKEN` → `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT` / `OPENVIKING_USER` / `OPENVIKING_PEER_ID` | 只发 `Authorization: Bearer`;本家族任何 harness 都不发 `X-API-Key` |-| **B. openclaw**(自有 `config.ts`) | openclaw | `OPENVIKING_BASE_URL` → `OPENVIKING_URL` | `OPENVIKING_API_KEY`(支持 SecretRef env/file) | `OPENVIKING_ACCOUNT_ID` / `OPENVIKING_USER_ID`(注意此处带 `_ID`) | `X-API-Key`(指向 OV Cloud 时注意其实际采用 Bearer 认证) |-| **C. hermes**(Python) | hermes | `OPENVIKING_ENDPOINT` | `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT` / `OPENVIKING_USER` / `OPENVIKING_AGENT`(=actor peer) | `X-API-Key` + `Bearer` 双发;有 key 时默认不发租户头(被服务端以 trusted 报错拒绝时会自动补头重试一次) |-| **D. ov CLI**(Rust) | ov | conf 文件为主 | conf | `--account/--user/--actor-peer-id` | `X-API-Key`;LDAP Basic / OIDC Bearer 按 `auth_mode` 切换;api_key 含 ≥2 个 `.` 时自动附加 Bearer(JWT 兜底) |+各宿主的差异:-家族 A 的解析链如下(其余家族见档案卡):+- **OpenCode** 给工具加 `openviking_` 前缀;**DSH** 把工具命名为 `mcp__openviking__<tool>`。+- **DSH** 每个 DSH profile 只运行一个 MCP 代理,所以工具调用带的是进程级 actor peer,`remember` 也不绑定 DSH 会话。召回、捕获和提交仍按会话解析 peer。+- **pi** 只在以下条件都满足时注册工具:会话未被 bypass、健康检查通过、OpenViking 会话存在、`/mcp` 握手返回了工具列表。握手失败时,本次会话没有 OpenViking 工具,但召回、同步和 takeover 照常进行,后续轮次会重试握手。`mcpEnabled: false` 会关闭这条桥接。root API key 访问 `/mcp` 会得到 403,所以凭据链最终落到 `ov.conf` 的 `server.root_api_key` 时,会话里没有工具。+- **Codex** 只把 `.mcp.json` 的 `env_vars` 中列出的环境变量传给 MCP 服务。-1. 模式由 `OPENVIKING_CREDENTIAL_SOURCE`(别名 `_CREDENTIALS_SOURCE`)控制,取值 ∈ `env|cli|auto`(默认 auto)。强制为 `env` 时,连接不读两个文件:没设的变量就是空,URL 默认 `http://127.0.0.1:1933`。`peerId` 配置仍按它自己的分层解析。-2. **auto 语义是 env 优先**:只要任一 env 凭据字段(`URL`、`BASE_URL`、`MCP_URL`、`BEARER_TOKEN`、`API_KEY`、`ACCOUNT`、`USER`、`PEER_ID`)存在,就从环境变量开始往下解析;只有这些全空、且 ovcli.conf 存在并含凭据字段时,链条才钉在这个文件上:跳过环境变量里的凭据,`apiKey` 仍会依次回落到 `plugin` 键和 ov.conf `<harness>.apiKey`(Claude Code 与 agent-plugins 再回落到 `server.root_api_key`),`account` / `user` 只回落到 `plugin` 键。`OPENVIKING_AUTH_MODE` 不算凭据字段,单独设置不会解除钉定。-3. baseUrl:env → ovcli `url` → ov.conf `server.url` → `http://{server.host|127.0.0.1}:{server.port|1933}`(其中 `0.0.0.0` 归一为 `127.0.0.1`);兜底 `http://127.0.0.1:1933`。-4. apiKey:嵌入宿主传入的值(dsh 的 Cordis patch)排在所有层之上,URL、account、user、auth mode 同理;其后是 `BEARER_TOKEN` → `API_KEY` → ovcli `api_key` → ovcli `plugin.<harness>.apiKey` → ovcli `plugin.apiKey` → ov.conf `<harness>.apiKey` → `server.root_api_key`。`<harness>` 是调用方 harness 自己的那段(snake_case,如 `trae_cn`;`claude-code` 与 `claude_code` 指向同一段);account / user / peerId 在各自链条的同一位置读同一段。-5. mcpUrl:`OPENVIKING_MCP_URL`(非 cli 模式)→ `${baseUrl}/mcp`。-6. 统一请求头:`Authorization: Bearer` + `X-OpenViking-Account/User`(仅 trusted 模式)+ `X-OpenViking-Actor-Peer` + `User-Agent: openviking-memory-<harness>/<version>`。`api_key` 模式的服务端从 key 里取身份、忽略这两个头,所以那里不发,免得把身份报给链路上的每一层代理。模式解析顺序:`OPENVIKING_AUTH_MODE`(任何模式下都读)→ `ovcli` `plugin.<harness>.authMode` → `plugin.authMode` → `ov.conf` `<harness>.authMode` → `ov.conf` `server.auth_mode` → 只要解析出了 account 或 user 就算 trusted。-7. **hook 与 MCP 共用一份连接**:以上规则都由 `credentials.mjs` 的 `resolveConnection()` 实现。hook 的 loader(`buildPluginConfig()`)和每个 MCP proxy(经各自 harness 的 loader,agent-plugins 经 `buildProxyConnection()`)都调用它,而且它不读当前目录,所以从插件目录启动的 proxy 与 hook 解析结果相同。跨进程边界只有两种做法:Codex 只把 `.mcp.json` `env_vars` 列出的变量交给 MCP 进程,这份名单必须包含 `MCP_PROXY_ENV_VARS`;dsh 直接转发解析好的连接,每个凭据变量都显式写出(空值也写),并带上 `OPENVIKING_CREDENTIAL_SOURCE=env`,所以文件和子进程继承到的变量都改变不了它。`mcp-hook-parity.test.mjs` 断言两边发出的 URL、key 和身份一致。+### OpenClaw 工具-**workspace peer**(家族 A 各 harness 均适用;agent-plugins 包既不派生 workspace peer,也不转发任何 peer——它没有能把 `recallPeerScope` 设成 `actor` 的配置项层,代理始终不发这个头):无显式 peerId 且 `OPENVIKING_WORKSPACE_PEER≠0` 时由 workspace 派生,随 `X-OpenViking-Actor-Peer` 发送(服务端会对该头校验,含 `/` 或 `\` 返回 400)。派生规则由 `peer.source` 决定,**默认 `git`**:先取归一化后的 `origin` URL,取不到回落到仓库根路径;不在仓库中则什么都不发送,在那里记下的内容进入用户级空间 `viking://user/<you>/memories`。例如在 `/Users/x/Dev/OpenViking/examples/codex-memory-plugin` 下、origin 为 `[email protected]:volcengine/OpenViking.git` 时,peer 是 `github.com-volcengine-openviking`——任意子目录、任意 worktree、任意机器、任意 clone 都是同一个值。`peer.source` 的读取层为 env `OPENVIKING_PEER_SOURCE`、ovcli.conf `plugin.peerSource` / `plugin.<harness>.peerSource`、workspace 文件的 `peer.source`;家族 A 的每个 harness 都会读这几层。+OpenClaw 注册自己的工具,不转发 MCP 工具。-| `peer.source` | 展开为 | 得到的 peer |+| 分组 | 工具 | 说明 ||---|---|---|-| `git`(默认) | `["{git_remote}", "{git_root}"]` | 归一化 origin → 仓库根路径;不在仓库中则什么都不发送,预设一律不加前缀 |-| `cwd` | `["{cwd}"]` | 旧行为,逐字节等价:路径中所有非字母数字字符替换成 `-`(`/Users/x/Dev/OpenViking` → `-Users-x-Dev-OpenViking`) |-| `none` | `[]` | 完全不发 peer;`OPENVIKING_WORKSPACE_PEER=0` 仍是同一含义 |-| 模板串(如 `"git-{git_remote}"`、`"team-{dir}"`) | 自身 | 自由形式;也可给一组模板(如 `["team-{dir}", "{cwd}"]`)按顺序尝试,变量为空的模板跳过、落到下一个 |+| 记忆 | `memory_recall`、`memory_store`、`memory_forget` | `memory_recall` 检索记忆;`memory_store` 通过临时会话提交 |+| 资源与 skill | `ov_search`、`ov_read`、`ov_multi_read`、`ov_list`、`add_skill`、`add_resource` | `ov_search` 默认检索资源和用户的 skill。`add_resource` 默认关闭,还需要开启 `enableAddResourceTool` |+| 会话归档 | `ov_archive_search`、`ov_archive_expand` | 检索并展开已归档的历史 |+| 大块工具输出 | `openviking_tool_result_read`、`openviking_tool_result_search`、`openviking_tool_result_list` | 读取服务端单独存放的工具输出 |+| 诊断 | `ov_recall_trace` | 查看自动召回是如何构建的 |-| 变量 | 取值 | 何时为空 |-|---|---|---|-| `{git_remote}` | 归一化后的 `origin`,形如 `github.com-org-repo`;host 与 path 转小写,`.git` 后缀与 userinfo 一并丢弃,因此同一仓库的 ssh / https 两种写法结果一致,且 URL 里内嵌的 token 不可能进入 peer id | 非 git 仓库,或未配 `origin` |-| `{git_root}` | 仓库根路径,按上述旧 sanitation 处理 | 不在 git 仓库中。仓库内某个子目录放了标记文件时,它仍然是仓库自己的根,因此标记子目录不会拆散默认 peer |-| `{cwd}` | 当前工作目录,按上述旧 sanitation 处理 | 从不为空——它也不在任何默认链里,裸路径只有在你明确要求时才会成为 peer |-| `{dir}` | 工作区根目录的目录名:仓库根,或放着 `.openviking/config.json` 的那个目录 | 该目录不是工作区 |-| `{harness}` | 当前 agent 的名字,与 User-Agent 里那个一致 | 从不为空——但 MCP proxy 不参与推导(它的 cwd 不是可靠身份),只走 proxy 的读路径解析不出它 |+### Hermes 工具-要让一个不是仓库的目录拥有独立 peer,在该目录下创建 `.openviking/config.json`,写上 `{"version": 1, "peer": {"id": "my-project"}}`,或者为它设置显式的 `OPENVIKING_PEER_ID`。+Hermes 有 6 个工具:`viking_search`、`viking_read`、`viking_browse`、`viking_remember`、`viking_forget` 和 `viking_add_resource`,没有 skill 工具。`viking_remember` 通过独立会话提交一条事实,在抽取完成前就返回;抽取可能新增、合并或跳过这条事实。内置 provider 与外部插件的区别见 [Hermes](#hermes)。-**身份语义**:同一仓库的所有 clone 共用一个 peer,项目记忆跟着项目走而非跟着 checkout 走。fork 的 `origin` 不同,因此默认就是另一个 peer;用 `gh pr checkout` 评审外部 PR 不改 `origin`,身份也就不受影响。派生是纯文件系统操作(`workspace-identity.mjs`),不起 `git` 子进程,因此能塞进最紧的 hook 预算,也能在 `git` 不在 `PATH` 上、或因 dubious ownership 拒绝该仓库时照常工作。worktree 经 `commondir` 收敛回主仓库,submodule 保留自己的身份,`$HOME` 与 `/` 永远不会被当作 workspace 根。+<a id="_3-5-写入与删除的类型边界"></a><a id="_3-5-1-写入边界"></a><a id="_3-5-2-删除边界"></a>-**迁移**(无需用户操作):旧 peer id 是 cwd 的纯函数,客户端随时可以本地重算,召回仍能覆盖到写在它名下的记忆。默认 `peer_scope: "all"` 下,服务端本就有的跨 peer 扫描零成本地把它包含在内;`peer_scope: "actor"` 下插件会另外向该 peer 发一次召回并拼接结果。此事没有截止期限。+### 写入与删除限制-openclaw 的 peer 由 `peer_role`/`peer_prefix` 推导(`peer_role=sender` 时需保证 sender 信息可用,否则工具调用报错;旧值 `person` 作为别名兼容);Hermes 的助手 peer 可由 `OPENVIKING_AGENT`、关联的 OpenViking 配置或 YAML `agent` 指定;默认不设置。+无论删除来自哪个工具或命令,服务端都做同样的检查:-### 3.1.4 配置体系分层+- 调用方需要对该 URI 有 manage 权限;正在被删除的用户会被拒绝。+- `viking://`、`viking://user` 和 `viking://agent` 不能删除。删除 `viking://resources` 或整个用户根(如 `viking://user/<id>`)需要 ROOT 角色。非 root 调用方不能写 `viking://temp` 根。+- 调用方的 actor-peer 视图中不可见的 URI 会被拒绝。-| 配置层 | 生效范围 | 备注 |+这些检查保护的是命名空间,不区分内容类型。按类型的限制来自客户端:++| 入口 | 能删除 | 客户端限制 ||---|---|---|-| env `OPENVIKING_*` | 各家族见上;行为配置项见各档案卡 | 唯一横跨所有 JS 系的层 |-| workspace 层:每机注册表 `~/.openviking/workspaces/<slot>.json` > `<repo-root>/.openviking/config.local.json`(私有,gitignore)> `<repo-root>/.openviking/config.json`(提交进仓库、团队共享) | claude-code / codex / cursor / trae / trae-cn / zcode / opencode / dsh / pi | schema v1,必须写 `version: 1`,声明其他版本的文件会被跳过并告警。可用 key:`peer.source`、`peer.id`、`recall.{enabled,peer_scope,dedup_turns,max_items,score_threshold}`、`capture.{enabled,commit_token_threshold}`、`bypass.session_patterns`、`labels`。列表类跨层取并集,首元素写 `"!reset"` 可清空继承来的内容;不认识的 key 原样保留但不生效。hook 是非交互的,这些文件因此无提示直接信任,换来的是结构性的拒绝:连接与凭据类 key(`url`、`api_key`、`account`、`user`、`extra_headers` 等)一律剥离并告警,这些文件里的 `${VAR}` 永不展开。注册表目前没有写入方:条目由人工创建,`ov-memory-doctor` 会打印该放到哪个 slot 路径。提交进仓库的文件关掉了什么,由 `ov-memory-doctor` 播报而不是拦截 |-| ovcli.conf `plugin` 段(共享标量,可被 `plugin.<harness>` 对象覆盖) | claude-code / codex / cursor / trae / trae-cn / zcode / opencode / dsh / pi | 每个 harness 键两种写法都认——`claude_code` 或 `claude-code`、`trae_cn` 或 `trae-cn`。`ov config` 编辑和重命名会保留 `plugin` 等额外顶层字段;切换时以新配置显式提供的字段为准,缺省的额外字段沿用 active 文件 |-| ov.conf harness 段(`<harness>.*`,legacy) | 每个 harness 读与自己同名的那段 | 凭据字段(`apiKey`/`accountId`/`userId`/`peerId`)与调优配置项都按调用方 harness 取自己的段。两种写法指向同一段 |-| harness 自有配置文件 | dsh cordis patch(会被 `plugin` 段压过)、openclaw `openclaw.json`、hermes `config.yaml`+`.env` | |+| MCP `forget`(所有 MCP 集成,含 DSH 与 pi) | 传入的任意 URI | 除非 `recursive=true`,否则不递归;不检查类型或分数 |+| `ov rm` | 任意 URI | 不确认;`-r` 递归删除 |+| `ov tui` 的 `d` 键 | 根目录和 scope 目录以外的任意 URI | 需要确认 |+| OpenClaw `memory_forget` | 只能删记忆文件 | URI 必须匹配用户、peer 或 agent 的记忆路径。按搜索删除时,只有唯一候选且分数不低于 0.85 才执行,否则列出候选。始终不递归 |+| Hermes `viking_forget` | 一个用户记忆 `.md` 文件 | 拒绝目录、非 `.md` 文件、自动生成的 `.abstract.md` 和 `.overview.md`,以及带 query 或 fragment 的 URI |+| LangChain `viking_forget` | 任意 URI | 只在 `profile="admin"` 或 `allow_forget=True` 时提供;`recursive` 由模型决定 |+| Open WebUI | 无 | 没有删除工具 |-**配置项生效范围速查**(这些配置项只在列出的 harness 上生效):+skill 走单独的路径。创建、安装或替换 skill 用 MCP `add_skill` 工具、OpenClaw 的 `add_skill`、`ov add-skill` 或 `POST /api/v1/skills`;`add_resource` 拒绝 skill URI。删除 skill 用 `ov skills remove` 或 `DELETE /api/v1/skills/{name}`。MCP `forget` 和 `ov rm` 也能删掉 skill 目录,但会留下该 skill 的 privacy 配置。见[技能](../api/04-skills.md)。-- `OPENVIKING_COMMIT_TURN_THRESHOLD`:仅 cursor(trae×2/zcode 每 Stop 必 commit,不走该阈值)。-- `OPENVIKING_WRITE_PATH_ASYNC`:claude-code / codex / zcode。-- 召回再摘要:`OPENVIKING_RECALL_COMPRESS` 的 `server` 模式适用于各记忆集成,本地 `client` 模式仅 Claude Code / Codex 支持。默认值和模式见 [§3.2.5](#_3-2-5-召回再摘要)。-- `OPENVIKING_RECALL_DEDUP_TURNS`、`OPENVIKING_RECALL_QUERY_EXPANSION`、`OPENVIKING_PEER_SOURCE`、`OPENVIKING_SKILL_CATALOG`、`OPENVIKING_SKILL_CATALOG_TOKEN_BUDGET`、workspace 配置文件与 ovcli.conf `plugin` 段:经共享加载器解析配置的每个 harness——claude-code / codex / cursor / trae / trae-cn / zcode / opencode / dsh / pi;openclaw 与 hermes 各有自己的配置体系。+<a id="_3-维度详解"></a><a id="_3-2-自动召回与注入"></a>-## 3.2 自动召回与注入+## 自动召回与会话开场上下文-### 3.2.1 机制底座:一条共享管线,两条服务端路径+<a id="_3-2-1-机制底座-一条共享管线-两条服务端路径"></a>-JS 系 harness 的召回逻辑均由 `recall-core.mjs` 中的三级降级链处理:+### 召回请求如何到达服务端-1. **context face**:调用 `POST /api/v1/search/search`,参数设定为 `mode:"context"` 且 `purpose:"coding"`。其核心设计原则为"只声明意图,机制交服务端":对于 `quotas`/`max_tokens`/`query_expansion`/`rewrite_max_bullets` 等参数,仅在用户显式配置时(带有 configured 哨兵字段)才会发送,否则直接采用服务端的默认设定。-2. **legacy `/recall`**:若 context face 请求返回 400/422 错误,且响应报文包含 `extra`/`mode`/`unexpected` 等特征字段,则判定对接了旧版服务端。此时会在本地写入 6 小时的负缓存(路径为 `~/.openviking/state/context-face.json`,该文件全机共享,一旦被任一 harness 标记,同机所有 JS 系 harness 均会跳过 context face 阶段)。随后降级调用已弃用的 `/api/v1/search/recall` 接口;若 `peer_scope` 被拒,则去掉该参数重试一次。-3. **raw find 兜底**:并发请求 `viking://~/memories` 与 `viking://~/skills`,调用两次 `POST /search/find`(注意:resources 被刻意排除在自动召回之外,资源类文档由模型主动调用 `search` 获取)。客户端收到结果后进行本地重排(权重规则为:leaf +0.12 / 时间意图 +0.10 / 偏好意图 +0.08 / 词面重叠 ≤0.2)、去重,最后按客户端 token 预算装填。`recallTokenBudget`、`recallMaxContentChars` 与 `recallPreferAbstract` 三个配置项只在这一级生效;而在 context face 下,注入预算由服务端 `max_tokens`(默认 1600)决定。+除 OpenClaw 和 Hermes 外,所有集成都使用共享插件代码,最多依次尝试三种请求:-服务端在处理 session_id 时,分为两条截然不同的执行路径:+1. **context 检索**。`POST /api/v1/search/search`,带 `mode: "context"`、`purpose: "coding"` 和会话 ID。预算、配额、查询扩写和摘要选项只在你配置后才发送;否则使用服务端默认值,包括 1,600 token 的注入预算(`max_tokens`)。+2. **旧版 recall**。服务端版本较旧、拒绝 context 模式时,插件在 `~/.openviking/state/context-face.json` 中记录这一结果,有效 6 小时,并改调 `/api/v1/search/recall`。这个文件由本机所有集成共享,一个集成的判断对所有集成生效。+3. **普通 find**。最后一步,插件对 `viking://~/memories` 和 `viking://~/skills` 执行 `find`,在本地排序,并按自己的 token 预算装填。`recallTokenBudget`、`recallMaxContentChars` 和 `recallPreferAbstract` 只在这一步生效。-- **路径 A:`mode="context"`**(适用于 context face 与 `/recall` preset)。此路径负责 query expansion 与跨轮去重台账。expansion 设有三重闸门:`retrieval.enable_intent` 需开启(默认 true) → 会话必须已物化(即 `messages.jsonl` 文件存在) → `latest_archive_overview` 或 `current_messages` 不能为空。扩写后原 query 永远排第一,追加的 planned queries 上限为 3。台账(`.recall_log.json`)按 `dedup_turns` 冷却已发正文的 URI;若"当轮只发了 URI 没发正文",该记录则不参与冷却;digest 判定 no_relevant 时亦不记账。-- **路径 B:`mode="list"`**(不写 mode 时的默认行为)。此路径下,IntentAnalyzer 会整体替换 typed_queries(原 query 不保证保留),无台账、无原-query 保底。实际落在这条路径上的调用方包括:codex 的第二级降级 `searchScope`、hermes 的 `viking_search(mode="deep")` 以及 prefetch 的首选路径。尽管它们带了 session_id,但拿不到 context 面的 expansion 与去重机制。+共享插件的召回不包含资源;资源文档由模型自己调用 `search` 检索。Hermes 开启资源召回选项后可以包含资源。-**`dedup_turns` 的三点说明**:① 服务端 context 面的默认值是 **0**,常见的"5"实则源自客户端 `recall-core.mjs` 兜底与 `/recall` preset(后者仅当带 session_id)——不经共享库直接打 API 的第三方即使带了 session_id,也要显式发 `dedup_turns` 才有跨轮去重;② "turn"的计数单位是消息条数而非对话轮(`_resolve_turn` 用 `total_message_count`),对同时推 user+assistant 的 harness,默认 5 ≈ 1-2 个真实对话轮;③ 注意:`autoCapture=0` 且 `autoRecall=1` 时消息数恒 0 → 台账时钟不走 → 已发过正文的 URI 在本会话内持续冷却;可用 `OPENVIKING_RECALL_DEDUP_TURNS=0` 关闭去重。+服务端对会话 ID 有两种处理方式:-### 3.2.2 判定矩阵+- **context 模式**(context 检索和旧版 recall)根据对话扩写查询,并为每个会话维护一份已注入记忆的台账。扩写需要同时满足:`retrieval.enable_intent` 开启(默认开启)、会话中已有消息、存在归档概览或当前消息。原始查询始终排第一,后面最多追加三条规划出的查询。+- **list 模式**(不传 `mode` 时的默认值)由意图分析替换查询,原始查询不一定保留,也不使用台账。Codex 的第二级回退、Hermes 的 `viking_search(mode="deep")` 以及 Hermes 召回的首选路径都走这里。它们会发送会话 ID,但得不到扩写和去重。-下表描述默认召回路径。显式开启服务端压缩后,请求路径按 §3.2.5 调整。+跨轮去重(`dedup_turns`):-| harness | 触发点 | query 构造 | session_id | 服务端路径 | 注入格式 / 位置 | 再摘要(客户端)* |-|---|---|---|---|---|---|---|-| claude-code | 每轮 `UserPromptSubmit` | prompt 原文 trim | ✅ `cc-` | A(context face) | `<openviking-context>` → `hookSpecificOutput.additionalContext` | ✅ 本地/服务端(默认 auto,[§3.2.5](#_3-2-5-召回再摘要)) |-| codex / trae-cli | 每轮 `UserPromptSubmit`(整 hook 120s 硬截止) | prompt 原文 | ✅ `cx-`(确定性推导,不读 state) | A;二级降级 searchScope 落入 B | `<openviking-context source="auto-recall" format="digest">` | ✅ 本地 `codex exec`([§3.2.5](#_3-2-5-召回再摘要)) |-| cursor | `beforeSubmitPrompt` | prompt 原文;基于事件 id 与 500ms 窗口去重,同 promptHash 复用缓存块 | ✅ `cu-` | A | `additional_context` | ❌ |-| trae / trae-cn | `UserPromptSubmit` | 剥离历史注入块后的 prompt(只认 `input.prompt`) | ✅ `tr-`/`trcn-` | A | `additionalContext` | ❌ |-| zcode | `UserPromptSubmit` | 剥离三类注入块(含 `<system-reminder>`) | ✅ `zc-` | A | `additionalContext`(严格 JSON) | ❌ |-| opencode | v1:每条 `chat.message`;v2:每条 `prompt` | v1 拼接非 synthetic text part;v2 直接读取 prompt text | ✅ `oc-` | A(timeoutMs=30000) | v1 合成 synthetic part;v2 写入消息 metadata,并在 context hook 中插到该 user message 前 | ❌ |-| dsh | `agent/pre-step` waterfall(先 await next 再 append) | claimed batch 全部消息(过滤自身注入的内容) | ✅ `dsh-` | A | 借由 `createUserMessage` append 到 `decision.messages` 尾部(source: plugin/openviking-memory) | ❌ |-| pi | `before_agent_start` 阶段排队;在 `context` 事件内检索(当前轮 prompt 拿当前轮记忆) | prompt 原文 | ✅ `pi-`(会话未建立时不带) | A | 前置到最后一条真实 user 消息(通过 `<openviking-context` 幂等检测) | ❌ |-| openclaw | context-engine transformContext assemble(设有 7 道 passthrough 门) | 最后一条 user 消息纯 text,清洗后截 4000 字符 | ❌(`/find` 无该字段) | `/find` | 以 `<relevant-memories>` + `Source: openviking-auto-recall` 格式前置进最后一条 user 消息 | ❌ |-| hermes | 每轮 API 调用前同步执行 `prefetch` | 原始用户输入,双层剥 skill 脚手架;<5 字符跳过 | 部分携带(仅 `search/search` 首选路径,落 B;降级 `/find` 时不带) | B / find | `<memory-context>` fenced 块追加到当轮 user 消息(只进 API 请求体,不写回持久化) | ❌ |--\* 本表的再摘要列描述本地压缩能力。各集成都可显式开启服务端压缩;开启后会使用 context-search rewrite,见 [§3.2.5](#_3-2-5-召回再摘要)。`ov` CLI 不提供自动召回。--### 3.2.3 profile / 开场注入--- **实现**:`profile-inject.mjs`——读 `viking://user/<space>/memories/profile.md` 全文 + `preferences/`、`entities/` 递归清单(abs_limit=512)。预算估算引入 CJK 感知(≥U+3000 记 1.5 token/字,其余 chars/4);profile 占一半预算,超限则采用"头 8 行 + 尾部"的中段省略;清单超限时会再撤掉几条,直到放得下 `... +N more` 提示。-- **谁注入、何时、预算**:claude-code(SessionStart 全部 source,10000);codex(SessionStart startup/clear/resume,10000);cursor/trae×2/zcode(SessionStart,10000,2s 去抖);opencode(每会话首条 chat.message 一次,10000,进程内 Set 去重,subagent 会话跳过;注意开场注入每会话只尝试一次,失败后本进程内不重试);dsh(每 session 投一次 `profileDelivered`,10000;compaction 之后不重投);pi(进 systemPrompt,每个 prompt 重拼,10000 常驻)。openclaw 无 profile 注入。Hermes 使用独立的开场读取逻辑,注入用户 profile 及 preferences/entities 清单,`profile_token_budget` 默认 6000。-- **skill 清单**(`<available-skills>`):由 `buildProfileBlock()` 追加在同一个 `<openviking-context>` 信封里,排在 `<user-profile>` 和 `<available-memories>` 之后,所以上述使用共享 profile 加载器的 harness 都会随 profile 一起注入它(codex 覆盖 trae-cli)。数据来自一次 `GET /api/v1/skills?node_limit=200`,包含用户自己的 skill 和账户共享的 `viking://agent/skills`:自己的排在前面,和自己某个 skill 同名的共享 skill 不再列出。每条描述按同一套 CJK 感知估算截到约 40 token,描述里出现的信封标签会被转义。- - **预算与开关**:`skillCatalogTokenBudget`(默认 1200 token,取值 0-20000,env `OPENVIKING_SKILL_CATALOG_TOKEN_BUDGET`)是这一块自己的预算,不占 `profileTokenBudget`。`skillCatalog`(默认 true,env `OPENVIKING_SKILL_CATALOG`)控制开关,预算设为 0 同样关闭。两者都在 `config-schema.mjs` 中声明,因此和其他旋钮一样,也能在 ovcli.conf 的 `plugin` / `plugin.<harness>` 段里设置。- - **降级**:放得下时每条都带描述;放不下就只列名称,名称也列不全时以 `... +N more, search OpenViking skills to find the rest` 收尾;连一个名称都放不下时,只剩一行 `<available-skills>N OpenViking skills; search OpenViking skills to find them.</available-skills>`。没有任何 skill,或服务端没有 `GET /api/v1/skills` 时,整块省略。- - **总量上限**:`sessionStartMaxBytes`(env `OPENVIKING_SESSION_START_MAX_BYTES`)按 UTF-8 字节限制整个会话开场注入:claude-code 和 codex 为 9500,因为这两个宿主会把超过约 10,000 字符或字节的 hook 上下文存成文件、只给模型看预览;zcode 为 20000,因为它会丢弃超过 32 KB 的 stdout;其余不设上限。在上限内各项预算相应收缩,仍放不下时先去掉记忆索引,再去掉 skill 清单。resume/compact 时会话归档最多占一半,截断处附 `viking://~/sessions/<id>/history/` 指针;resume 时 claude-code 和 codex 若 profile 块与本会话上次注入的相同就不再重复注入。- - **示例**(claude-code,`source="startup"`):- ```text- <openviking-context source="startup">- <user-profile uri="viking://user/default/memories/profile.md">...</user-profile>- <available-memories>...</available-memories>- <available-skills>- OpenViking skills (stored in OpenViking, not local files). Before following one, read <dir>/<name>/SKILL.md with the OpenViking read tool.- viking://user/default/skills/- - pr-review — Review a pull request against the team checklist.- viking://agent/skills/- - deploy-runbook — Shared deployment runbook for the payments service.- </available-skills>- </openviking-context>- ```-- **archive 注入**(resume 场景把上次归档摘要拉回来):claude-code(source=resume/compact,`token_budget=32000`);codex(resume 且本地 ovSessionId 已清时,32000/截 6000 字符);opencode(开场注入 B 部分,32000);pi 非 takeover 模式(32000)。-- **repo 上下文注入**:opencode 独有——通过 `experimental.chat.system.transform` 把已索引仓库列表放进 system prompt。--### 3.2.4 超时与预算链--- 家族 A 客户端推导:带 rewrite → `max(timeoutMs, 45000)`;带 expansion → `max(timeoutMs, 15000)`;对应服务端熔断 5s(expansion)/30s(rewrite)——设计上让客户端预算覆盖服务端各阶段,防止客户端提前 abort 丢掉整个响应。-- 实际值:cc 15s(hook 预算 60s);codex 召回整 hook 120s 硬截止 + 压缩子进程 110s;cursor/trae×2/zcode 15s(宿主 hook 预算 20s);opencode 30s;dsh HTTP 默认 10s,context expansion 请求至少 15s(阻塞 pre-step);pi 15s;openclaw 整个召回流程外层 5s 硬超时(500ms health precheck;默认 `recallPreferAbstract=false` 时每条 leaf 记忆多一次 read,预算内最多 1 find + 6 read + 1 health);hermes 总预算 4s / 单请求 3s(可配)。-- 注入体预算:服务端 `max_tokens` 默认 1600(家族 A 默认不发、由服务端决定);openclaw / hermes 用字符预算 4000(两家都是"装不下整条跳过"而非截断)。--### 3.2.5 召回再摘要--**服务端实现(对所有调用方可用)**:context 检索面(涵盖 REST 的 `mode="context"` 与 legacy 的 `/recall`)支持传入 `rewrite` 参数——可选值为 `false | true | "auto"`,默认为 `false`;并配套提供 `rewrite_max_bullets`(默认 6,1-20)。开启后,服务端会用 `query_planner` 模型(`rewrite=true` 时未配置则回落主 `vlm`;`"auto"` 仅在显式配置了 `query_planner` 时生效)把召回结果改写成带引用的 digest:`OpenViking memory digest:` 头 + `- ` bullets,每条 ≤500 字符且必须引用一条本次命中的 `viking://` URI(无引用或引用越界的 bullet 被丢弃);判定无相关记忆时输出哨兵并清空注入块(该轮不记入去重台账)。模型调用受 `retrieval.recall_rewrite_timeout_s=30s` 熔断,超时回落未改写的 rendered 块(`rewrite.py:78-141`、`pipeline.py:122-130`、`search.py:195-196`)。--**客户端配置**:自动召回统一使用 `OPENVIKING_RECALL_COMPRESS`,共享配置文件中对应 `recallCompress`(`recallRewrite` 为兼容别名)。+- 服务端在 context 模式下的默认值是 **0**,即关闭。共享插件发送 5(`recallDedupTurns`)。直接调用 API 时必须自己发送 `dedup_turns`,只带会话 ID 不会开启去重。+- 窗口按消息条数计算,不按对话轮。同时捕获用户和助手消息时,5 大约覆盖两轮。+- 关闭自动捕获但开启召回时,消息数不会增长,已注入过的记忆会在整个会话里一直被抑制。设置 `OPENVIKING_RECALL_DEDUP_TURNS=0` 可以关闭去重。++<a id="_3-2-2-判定矩阵"></a>++### 各集成的召回方式++下表是默认路径。开启[召回摘要](#召回摘要)后,请求会有变化。++| 集成 | 触发时机 | 查询内容 | 上下文放在哪里 |+|---|---|---|---|+| Claude Code | 每次 `UserPromptSubmit` | 去掉首尾空白的提问 | `additionalContext` 中的 `<openviking-context>` |+| Codex、TraeCode CLI 2.0 | 每次 `UserPromptSubmit`;整个 hook 有 120 秒截止时间 | 提问 | `<openviking-context source="auto-recall">` |+| Cursor | `beforeSubmitPrompt` | 提问;500 ms 内的重复事件复用上次结果 | `additional_context` |+| TRAE、TRAE CN | `UserPromptSubmit` | 去掉之前注入块的提问 | `additionalContext` |+| ZCode | `UserPromptSubmit` | 去掉三类注入块(含 `<system-reminder>`)的提问 | `additionalContext`,严格 JSON |+| Kimi Code | `UserPromptSubmit` | 提问 | 纯文本上下文,不是 JSON |+| OpenCode | v1:每次 `chat.message`;v2:每次提问 | 消息的文本部分 | v1 在消息前插入一个合成 part。v2 把结果存进消息 metadata,每个模型 step 在该消息前注入,不发新请求 |+| DSH | `agent/pre-step` | 本批认领的所有消息,去掉自身注入的内容 | 追加为一条用户消息 |+| pi | 在 `before_agent_start` 排队,在 `context` 事件中执行 | 提问 | 前置到最后一条真实用户消息,本轮提问拿到本轮的记忆 |+| OpenClaw | 上下文组装时 | 最后一条用户消息,清洗后截到 4,000 字符 | `<relevant-memories>`,前置到最后一条用户消息 |+| Hermes | 每次模型调用前 | 5 个字符及以上的用户输入,去掉 skill 脚手架 | `<memory-context>`,只追加到本次请求中的当前用户消息,不写入存储 |++<a id="_3-2-3-profile-开场注入"></a>++### 会话开场上下文++使用共享插件代码的集成会在会话开始时注入一个 `<openviking-context>` 块,包含用户 profile(`viking://user/<space>/memories/profile.md`)、`preferences/` 和 `entities/` 记忆的索引,以及 `<available-skills>` skill 清单:++```text+<openviking-context source="startup">+<user-profile uri="viking://user/default/memories/profile.md">...</user-profile>+<available-memories>...</available-memories>+<available-skills>+ OpenViking skills (stored in OpenViking, not local files). Before following one, read <dir>/<name>/SKILL.md with the OpenViking read tool.+ viking://user/default/skills/+ - pr-review — Review a pull request against the team checklist.+ viking://agent/skills/+ - deploy-runbook — Shared deployment runbook for the payments service.+</available-skills>+</openviking-context>+```++各集成的注入时机:++| 集成 | 时机 |+|---|---|+| Claude Code | `SessionStart`,所有 source |+| Codex | `SessionStart` 的 startup、clear 和 resume |+| Cursor、TRAE、TRAE CN、ZCode | `SessionStart` |+| Kimi Code | 首次提问时;失败后在后续提问中重试,直到成功 |+| OpenCode | 每个会话的第一条消息;失败后不重试,子代理会话跳过。已索引仓库的列表同时进入 system prompt |+| DSH | 每个会话一次;压缩后不再发送 |+| pi | 放在 system prompt 中,每轮重建 |+| OpenClaw | 不注入 |+| Hermes | 用自己的读取逻辑加载 profile 及 preferences、entities 清单,默认预算 6,000 token |++预算与限制:++- `profileTokenBudget`(默认 10,000 token)覆盖 profile 和记忆索引,profile 占一半。profile 超长时保留前 8 行和结尾;清单超长时以 `... +N more` 结尾。token 估算中,CJK 字符按 1.5 token 计,其他文本按每 4 个字符 1 token 计。+- `skillCatalogTokenBudget`(默认 1,200 token,`OPENVIKING_SKILL_CATALOG_TOKEN_BUDGET`)是 skill 清单的独立预算。`skillCatalog`(`OPENVIKING_SKILL_CATALOG`)或把预算设为 0 都会关闭清单。+- 清单来自一次 `GET /api/v1/skills` 请求。用户自己的 skill 排在前面,与用户 skill 同名的账户 skill 不再列出。每条描述截到约 40 token。描述放不下时只列名称;名称也放不下时以 `... +N more` 结尾,或缩成一行数量。服务端没有该接口时不注入清单。+- `sessionStartMaxBytes` 按 UTF-8 字节限制整个块:Claude Code 和 Codex 为 9,500,因为这两个宿主会把超过约 10,000 字符的 hook 输出存成文件,只显示预览;ZCode 为 20,000,因为它会丢弃超过 32 KB 的输出;其他集成不设上限。超出上限时,先去掉记忆索引,再去掉 skill 清单。++恢复会话时,部分集成还会注入上一次归档的摘要,预算 32,000 token:Claude Code 在 resume 和 compact 时,Codex 在本地会话已清空后的 resume 时,OpenCode 在会话开始时,pi 在 takeover 关闭时。Claude Code 和 Codex 遇到与本会话已注入内容相同的 profile 块时会跳过。++<a id="_3-2-4-超时与预算链"></a>++### 超时与预算++服务端的查询扩写在 5 秒后停止(`retrieval.recall_intent_timeout_s`),摘要改写在 30 秒后停止(`retrieval.recall_rewrite_timeout_s`)。共享插件在开启扩写时把 context 请求超时提高到至少 15 秒,请求摘要时至少 45 秒,让客户端能等完服务端的每个阶段。宿主的截止时间仍可能先结束 hook。修改这些值见[调整召回延迟](./19-recall-tuning.md#请求超时)。++| 集成 | 召回超时 |+|---|---|+| Claude Code | 15 秒,hook 上限 60 秒 |+| Codex | 整个 hook 120 秒截止,包括最长 110 秒的本地压缩器 |+| Cursor、TRAE、TRAE CN、ZCode | 15 秒,宿主上限 20 秒 |+| OpenCode | 30 秒 |+| DSH | 10 秒,开启查询扩写时至少 15 秒。召回会阻塞 pre-step |+| pi | 15 秒 |+| OpenClaw | 整个召回 5 秒,含 500 ms 健康检查。默认 `recallPreferAbstract=false` 时每条记忆多一次 read,预算内最多一次 find 和六次 read |+| Hermes | 总计 4 秒,单请求 3 秒;可配置 |++OpenClaw 和 Hermes 把注入的召回内容限制在 4,000 字符,放不下的条目整条跳过,不截断。++<a id="_3-2-5-召回再摘要"></a>++### 召回摘要++召回摘要让模型先把召回结果改写成一份带引用的简短要点,再交给 Agent。++**服务端**。context 检索接受 `rewrite`(`false`、`true` 或 `"auto"`,默认 `false`)和 `rewrite_max_bullets`(默认 6,范围 1–20)。服务端使用 `query_planner` 模型;`rewrite=true` 且未配置 `query_planner` 时回退到主 `vlm`,`"auto"` 只在配置了 `query_planner` 时执行。摘要以 `OpenViking memory digest:` 开头,每个要点一行 `- `。每个要点最多 500 字符,必须引用结果中的一个 `viking://` URI;没有有效引用的要点会被丢弃。模型判断没有相关内容时,服务端返回 `stats.rewrite="no_relevant"` 和空块,这一轮不记入去重台账。超过 30 秒时,服务端返回未改写的块。++**插件**。`OPENVIKING_RECALL_COMPRESS` 或共享配置中的 `recallCompress` 选择模式,`recallRewrite` 仍可作为别名使用。| 模式 | 行为 || --- | --- |-| `off` | 不请求再摘要。 |-| `server` | 发送 `rewrite: true`,优先使用服务端 digest。 |-| `client` | 仅 Claude Code 和 Codex 支持,使用本地压缩器。 |-| `auto` | Claude Code 和 Codex 优先使用可用的本地压缩器,否则发送 `rewrite: "auto"`;没有本地压缩器的集成直接请求服务端自动判断。 |+| `off` | 不生成摘要 |+| `server` | 发送 `rewrite: true`,优先使用服务端摘要 |+| `client` | 使用本地压缩器;仅 Claude Code 和 Codex |+| `auto` | Claude Code 和 Codex 有本地压缩器时使用它,否则发送 `rewrite: "auto"`。其他集成发送 `rewrite: "auto"` |++Claude Code 和 Codex 默认 `auto`,其他集成默认 `off`。支持服务端摘要的有 Claude Code、Codex、OpenCode、DSH、pi、Cursor、TRAE、TRAE CN、ZCode、OpenClaw 和 Hermes 外部插件,且需要服务端支持 context-search rewrite。Hermes 内置 provider 不支持召回摘要。旧值 `1` 和 `0` 分别等同于 `auto` 和 `off`。`no_relevant` 结果会取消本轮注入,插件不能回退到原始块。++本地压缩器:++- **Claude Code** 用 `claude --version` 检测 `claude`(结果缓存 7 天),执行 `claude -p --model sonnet --effort low --strict-mcp-config`。子进程超时默认 110 秒(`recallCompressTimeoutMs`),但 60 秒的提问 hook 可能更早结束它。少于 1,500 字符的输入不压缩。引用的 URI 按编辑距离匹配回真实的结果 URI,无法匹配的要点会被丢弃。失败时注入本地格式化的结果,或注入渲染好的块。+- **Codex** 从 `~/.codex/models_cache.json` 选择模型(优先 `gpt-5.3-codex-spark`,其次低 effort 的 `gpt-5.6-luna`;缓存 7 天),在只读的临时沙箱中执行 `codex exec`,默认超时 110 秒。运行失败一次后,本地压缩停用到下一次 `SessionStart`。输出上限 4,000 字符;失败时的回退方式与 Claude Code 相同。++这些设置只作用于自动召回。模型显式调用 MCP `search` 时,使用它自己传入的参数。旧服务端的回退和宿主时间预算见[共享插件说明](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression)和[调整召回延迟](./19-recall-tuning.md)。-Claude Code 和 Codex 默认 `auto`,其他集成默认 `off`。Claude Code、Codex、OpenCode、DSH、Pi、Cursor、TRAE、TRAE CN、ZCode、OpenClaw 和 Hermes 均可显式启用服务端压缩;旧布尔值 `1` / `0` 分别对应 `auto` / `off`。`stats.rewrite="no_relevant"` 表示本轮不注入,不能再回退到原始块。+<a id="_3-2-6-注入回流防护"></a>-本地压缩器细节:+### 避免注入内容被重复捕获-- **claude-code**:用 `claude --version` 探测本地压缩器(结果缓存 7 天)。可用时执行 `claude -p --model sonnet --effort low --strict-mcp-config`,子进程默认超时 110s(`recallTimeoutMs - 10s`;宿主 60s prompt-hook 预算可提前结束它);输入少于 1500 字符时跳过(`recallCompressMinInputChars`);按 digest 缓存;引用的 URI 按编辑距离修正为本次命中的有效 URI,无法修复的 bullet 会被丢弃。子进程失败时回退到本地格式化的召回条目;没有条目时使用 rendered 块。-- **codex**:从 `~/.codex/models_cache.json` 选模型(先 `gpt-5.3-codex-spark`,其次 `gpt-5.6-luna` + low,缓存 7 天),执行 `codex --sandbox read-only --ask-for-approval never exec --ephemeral --ignore-user-config --skip-git-repo-check --output-last-message <tmp> -`,默认超时为 `recallTimeoutMs - 10s`(110s)。运行失败后本会话不再做本地压缩,下次 `SessionStart` 重新探测。输出经规范化并截断到 4000 字符;本地压缩失败时使用本地格式化的召回条目,没有条目时使用 rendered 块;关闭压缩时直接使用服务端 digest 或 rendered 块。+注入的上下文用固定标签包裹,例如 `<openviking-context>`。捕获时先去掉这些块再发送,召回的记忆就不会被当成新对话再次存储。共享捕获代码还会去掉摘要块、元数据围栏和时间戳前缀。TRAE 和 ZCode 使用各自的清理函数,ZCode 的清理函数会去掉三类注入块。OpenClaw 在捕获一轮对话和构造下一次召回查询时都会去掉 `<relevant-memories>`。Hermes 从捕获批次中丢弃三个只读工具的调用和结果,保留写入类工具的调用。-这些设置只控制自动召回,显式 MCP 调用使用调用方传入的参数。服务端需支持 context-search rewrite;旧服务回退行为、压缩器探测和宿主时间预算见 [共享插件说明](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression)及各集成页。+<a id="_3-3-会话与-commit-生命周期"></a>-### 3.2.6 注入回流防护+## 捕获与提交-为防止注入内容被二次捕获,注入时会加确定性包装(`<openviking-context>` 等),捕获时再机械剥离:capture-utils 的 `sanitizeCapturedText` 剥注入块、digest 块、元数据围栏与时间戳前缀。各端的特殊处理包括:trae/zcode 用各自的 clean 函数(其中 zcode 剥三类注入块);openclaw 在 afterTurn 写回与下轮 query 构造时各剥一次 `<relevant-memories>`;hermes 则更彻底,直接把三个召回类工具的 tool_call/result 从 sync batch 里整条剔除(写类工具保留)。+<a id="_2-3-服务端会话与-commit-语义"></a><a id="_3-3-1-机制底座"></a>-## 3.3 会话与 commit 生命周期+### 服务端会话与提交机制-### 3.3.1 机制底座+- **会话隐式创建**。服务端收到某个会话的第一条消息时创建该会话;带该会话 ID 的第一次 context 模式召回也会创建。DSH 是唯一显式创建会话的集成。+- **提交分两个阶段**。`POST /api/v1/sessions/{id}/commit` 在第一阶段归档消息后返回。响应中带有第二阶段(记忆抽取)的 `task_id`,抽取在后台运行。提交请求成功不代表抽取已经完成。+- **`keep_recent_count`** 决定提交后会话中保留多少条最近的消息。服务端默认 0,即全部归档。Claude Code、Codex、OpenCode 和 DSH 在阈值提交时发送 10;Cursor、TRAE、TRAE CN、ZCode 和 Hermes 发送 0;pi 在 takeover 模式下发送最近 3 个用户轮对应的确切消息数,其他情况发送 10;OpenClaw 在阈值提交时发送 10,在 reset、`memory_store` 和压缩时发送 0。+- **服务端自动提交默认关闭**。`memory.session_auto_commit.enabled` 默认 `false`,关闭时空闲扫描器不会启动。新会话仍可以从 `server.user_config_defaults.auto_commit_policy` 获得策略,也可以通过 `POST /api/v1/sessions`、`PATCH /api/v1/sessions/{id}/config`、SDK,或 `ov session new --auto-commit-policy-json` 与 `ov session config set` 显式设置。策略的默认值是:待提交 token 150,000(严格大于)、100 条消息、86,400 秒空闲超时、`keep_recent_count` 0、无最小间隔。空闲超时还需要 `memory.session_auto_commit.enabled=true`。记忆插件不发送策略,所以没有上述设置时,只有客户端会提交。+- **批量写入**。共享插件每次 `POST /messages/batch` 最多发送 100 条消息,与服务端上限一致;批量接口返回 404 或 405 时改为逐条发送。+- **大块工具输出单独存放**。服务端把超过 20,000 字符的工具输出移到单独的记录中,留下 `tool_output_ref`。插件把自己的上限(`captureToolMaxChars`)提高到 1,000,000,只作为兜底。+- **部分写入在后台运行**。Claude Code、Codex 和 ZCode 默认把 `Stop` 的写入交给一个分离的 worker(`OPENVIKING_WRITE_PATH_ASYNC`),宿主不用等待。worker 启动后,关闭终端不影响它,但网络错误或进程被终止仍可能打断它。开启这项设置时,`Stop` 不再输出 `appended N turn(s)` 提示。-- **写入路径**:JS 系统一通过 `batch-send.mjs` 处理(对应接口 `POST /messages/batch`,每批最多 100 条,与服务端的 `max_length=100` 限制保持一致;若遇 404/405 错误则降级为逐条发送)。增量游标由各家自行实现(cc 按 transcript turn 序号计算,codex 机制相同;cursor 采用 `sha256(index+role+content)`;zcode 基于 rollout 的 `turn_id`;opencode v1 依赖事件流 Map,v2 在 execution 结束时读取 context 并按 message id 推进游标;dsh 基于事件白名单;pi 依据 branch 条目水位;hermes 则按当前轮切片)。-- **commit 是客户端触发的**(详见 [§2.3](#_2-3-服务端会话与-commit-语义)):服务端默认不自动 commit。下表所有的"阈值/触发"条件,均指客户端逻辑。-- **keep_recent_count 差异**(即 commit 后给宿主留多少 live tail):服务端默认值为 0。各家传参如下:cc/codex 阈值提交传 10;cursor、trae×2、zcode 发空 body `{}`,即传 0(每次均为全量归档);opencode 传 10;dsh 传 10;pi 在非 takeover 模式传 10,takeover 模式传 3(本地含义是"保留 3 个用户轮",而服务端按消息条数解释,实际保留更少);openclaw 在 afterTurn 阈值触发时传 10,在 compact/reset/memory_store 操作时传 0;hermes 恒定传 0。-- **写路径 detach**(`async-writer.mjs`,cc/codex/zcode 的 Stop 默认开):drain stdin → spawn detached worker → approve → write payload → unref(注:spawn 失败时尚未 approve,回落同步恰好只输出一次)。detached worker 自成进程组,可在终端退出后继续处理已交给它的写入。但 worker 必须已经启动,网络错误、系统终止或服务端失败仍可能导致写入未完成。附带效果:执行 detach 后,Stop 的 `appended N turn(s)` 提示将不再展示(设置 `OPENVIKING_WRITE_PATH_ASYNC=0` 可恢复该提示)。+<a id="_3-3-2-常规-commit-触发条件"></a>-### 3.3.2 常规 commit 触发条件+### 各集成何时提交-| harness | 轮内阈值触发 | 显式/边界触发 | 压缩触发 |+表中的阈值都在客户端判断;除非另有说明,读取的是服务端的待提交 token 数。++| 集成 | 会话中 | 显式操作或会话边界 | 压缩前后 ||---|---|---|---|-| claude-code | Stop:`pending_tokens ≥ 20000`(读服务端值),keep 10 | SessionEnd:无条件触发;SubagentStop:无条件触发(无阈值);SessionStart:重放 pending | PreCompact:无条件触发(同步执行,不 detach) |-| codex / trae-cli | Stop:同上,20000 / keep 10 | SessionEnd(Codex ≥ 0.145):无条件触发,先补齐 Stop 漏掉的轮次再 commit——父 hook 只写 `.ended` 标记并 detach worker(Codex 默认给 1s,`timeout` 上限 3s);SessionStart(startup\|clear):兜底扫描,提交带 `.ended` 标记或闲置超过 30min 的 state。trae-cli 若无 `SessionEnd` 则只走扫描 | PreCompact:全量 commit(发空 body `{}`),随后置 `ovSessionId=null` |-| cursor | stop:`capturedSinceCommit ≥ 8`(按消息条数计算,≈4 轮问答;纯客户端计数),keep 0 | sessionEnd:已注册该事件(但实践中不触达,见 [§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵)) | preCompact:无条件触发 |-| trae / trae-cn | 每个有内容的 Stop 都 commit(无阈值),keep 0 | — | 无(上游无 PreCompact 事件) |-| zcode | 同 trae(每 Stop 都 commit,keep 0;rollout 增量游标保守推进,若有漏掉的轮次,将在同会话的下个 Stop 补齐) | — | 无(上游无 PreCompact 事件) |-| opencode | v1 `session.idle` / v2 execution 结束:flush 后 `pending_tokens ≥ 20000` 才 commit,keep 10 | `session.deleted` / v1 `session.error`:强制 commit;v1 dispose / v2 cleanup:强制 commit | v1 在 compacting 前与 compacted 后触发;v2 只在 `session.compaction.ended` 后触发 |-| dsh | `turn/end`:`pending_tokens ≥ 20000`(30s 超时),keep 10 | teardown(见 [§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵)) | 无(不监听 compaction 事件) |-| pi(takeover 默认开) | `onTurnSynced`:本地估算 `pendingTokens ≥ 30000` 且 `lastSeenUserTurns > 3` 时,执行 commitAndAdvance(keep 3;overview 15×2s 轮询,拿不到则边界不推进,但 pendingTokens 会清零,重新累计后重试) | 手动执行 `/viking commit` | `session_before_compact`(需 `firstKeptEntryId` 非空) |-| pi(takeover off) | syncBranch 执行后:服务端 `pending_tokens ≥ 20000`,keep 10 | `session_shutdown`:无条件 commit;手动执行 `/viking commit` | `session_before_compact`:无条件 commit |-| openclaw | afterTurn:`pending_tokens ≥ floor(tokenBudget × 0.5)`(ratio 默认 0.5,tokenBudget 缺省 128000,即阈值 ~64000),wait=false,keep 10 | `before_reset`(执行 `/new` `/reset`):wait=true,keep 0;`memory_store` 工具:wait=true,keep 0 | `compact()`:wait=true,keep 0(Phase2 轮询上限 5 分钟) |-| hermes | 无阈值 commit——触发面全是会话边界:`on_session_end`(drain 10s,drain 不净则本次不 commit)、`on_session_switch`(涉及 `/new`、`/resume`、`/branch` 或压缩 fork,异步 drain 预算 65s)、gateway 缓存驱逐;`/undo` 与原地压缩不 commit。用幂等集合防二次 commit;keep 0 | atexit 兜底 | fork 型压缩边界 commit;原地压缩不 commit |-| ov CLI | 无 | `ov session commit`;`ov add-memory` 第三步固定 commit | — |-| ingest | `pending ≥ 6000` 或 idle 5s,keep 0;backfill 在每个会话结束时执行 `commit_if_needed` | 退出时执行 `_flush_all()` | — |-| LangChain | `CommitPolicy.mode` 默认 `never`;`pending_tokens` 模式阈值为 8000;`always` 模式每次 record 均触发 | 调用方自理 | — |--### 3.3.3 关闭方式 × harness 终局矩阵--图例:**C** = 对应退出事件会尝试触发 commit;**C\*** = 还需满足表中前提;**—** = 该事件不触发 commit;**n/a** = 不适用。触发不代表归档和记忆抽取完成:网络错误、宿主退出预算或进程终止都可能中断请求。已成功写入的消息仍在服务端 live 区,等待后续提交。本表假设服务端自动提交未启用;配置了自动提交策略时,还需计入[服务端行为](#_2-3-服务端会话与-commit-语义)。--| harness | 正常退出 | Ctrl+C | SIGTERM | SIGHUP/关终端/关窗口·tab | kill -9/崩溃 | 补救路径 |+| Claude Code | `Stop` 时待提交 token 达到 20,000 | `SessionEnd` 和 `SubagentStop` 总是提交;`SessionStart` 重放排队的写入 | `PreCompact` 总是同步提交 |+| Codex | `Stop` 时待提交 token 达到 20,000 | `SessionEnd`(Codex 0.145+)补齐漏掉的轮次,然后在分离的 worker 中提交。startup 或 clear 的 `SessionStart` 会提交已标记结束或空闲超过 30 分钟的会话 | `PreCompact` 补齐后提交全部内容 |+| TraeCode CLI 2.0 | 同 Codex | 同 Codex;没有 `SessionEnd` 时只有启动时的扫描 | 同 Codex |+| Cursor | 距上次提交捕获满 8 条消息时,在 `stop` 提交(`commitTurnThreshold`),本地计数 | `sessionEnd` 已注册,但实际不会运行 | `preCompact` 总是提交 |+| TRAE、TRAE CN | 每个捕获到内容的 `Stop` | 无 | 没有压缩前事件 |+| ZCode | 每个 `Stop`;漏掉的 `Stop` 对应的轮次,在下一个 `Stop` 从 rollout 文件补齐 | 无 | 没有压缩前事件 |+| Kimi Code | 距上次提交捕获满 8 条消息时,在 `Stop` 提交 | `SessionEnd` 和 `Interrupt` 捕获到新消息时提交 | `PreCompact` 捕获到新消息时提交 |+| OpenCode | v1 `session.idle`、v2 执行结束时:待提交 token 达到 20,000 | 删除会话、v1 `session.error`、v1 dispose 和 v2 cleanup 强制提交 | v1 在压缩前后各一次;v2 在压缩结束后一次 |+| DSH | `turn/end` 时待提交 token 达到 20,000 | Cordis teardown 提交每个会话 | 无 |+| pi,takeover 开(默认) | 本地估算达到 30,000 token,且用户轮多于 3 个 | `/viking commit` | `session_before_compact` |+| pi,takeover 关 | 每次同步后待提交 token 达到 20,000 | `session_shutdown` 和 `/viking commit` | `session_before_compact` |+| OpenClaw | 每轮结束后达到 `tokenBudget × commitTokenThresholdRatio`(默认 128,000 × 0.5) | `/new`、`/reset` 和 `memory_store` 提交并等待 | `compact()` 提交,并最多等待 5 分钟完成抽取 |+| Hermes(内置) | 无 | 会话结束、会话切换(`/new`、`/resume`、`/branch`、fork 型压缩)、gateway 缓存驱逐,以及退出处理器;`/undo` 和原地压缩不提交 | 只在 fork 型压缩时 |+| ov CLI | 无 | `ov session commit`;`ov add-memory` 会创建、写入并提交自己的会话 | 不适用 |++<a id="_3-3-3-关闭方式-×-harness-终局矩阵"></a>++### 退出时会发生什么++“提交”指退出路径会发出提交请求,“视情况”取决于最后一列的说明。已经写入的消息留在服务端会话中,由同一会话的下一次提交归档。本表假设服务端自动提交关闭。++| 集成 | 正常退出 | Ctrl+C | SIGTERM | 关闭终端或窗口 | `kill -9` 或崩溃 | 剩余内容如何回收 ||---|---|---|---|---|---|---|-| claude-code | **C**(SessionEnd → detach 子进程 commit,用户不等待) | **C** | **C** | **C**(detached worker 自成进程组,不受 SIGHUP 波及) | **—** | 下次 Stop 越阈值 / `/compact` / 下次 SessionEnd |-| codex | **C**(SessionEnd → detach worker commit,用户不等待;需 Codex ≥ 0.145) | **C\*** | **—** | **—** | **—** | C\* 前提:连按两次 `Ctrl-C` 属于正常退出、会触发 SessionEnd,单次不会。未 commit 的一律由下次 `SessionStart(startup\|clear)` 回收:标记仍在则 `ended_retry`,否则等 30min idle-TTL 扫描 |-| trae-cli | **—**(除非 TraeCode CLI 版本已带 `SessionEnd`) | **—** | **—** | **—** | **—** | 下次 `SessionStart(startup\|clear)` 的 30min idle-TTL 扫描 |-| cursor | **—**(chat 关闭 / new-chat 无事件) | **—** | **—** | **—**(`sessionEnd` 已注册且仅 window_close 触发,但此时宿主已销毁 shell-exec host,hook 在 spawn 前中止) | **—** | 结束在 <8 条消息水位的会话,尾部依赖同一会话的后续消息触发 commit |-| trae / trae-cn | **—**(无 session-end 类事件) | **—** | **—** | **—** | **—** | 每 Stop 已 commit,最大待归档量 = 最后一轮 in-flight |-| zcode | **—**(无 session-end 类事件) | **C\*** | **—** | **—** | **—** | C\* 前提:Ctrl+C 时该轮 Stop 已触发(detached worker 照常写完);每 Stop 已 commit,漏掉的轮次靠 rollout 游标在同一会话的下个 Stop 补回 |-| opencode | **C\***(v1 ≥1.15.11 的 `dispose` 或 v2 cleanup → `flushAll({commit:true})`) | **C\*** | **C\*** | **C\*** | **—** | C\* 前提:宿主给 cleanup 的时间有限,慢请求或多个会话串行提交可能被截断;v2 会在无活动 60 分钟、服务停止和本地插件热重载时触发 cleanup |-| dsh | **C**(Cordis teardown → 每 session 一次 3s 超时 commit,无阈值) | **C**(第一次;第二次 Ctrl+C 强退 → —) | **C** | **—**(无 SIGHUP 监听) | **—** | teardown commit 与阈值 commit 共享同一条串行写链,5s 进程 grace 内前方有慢请求时可能挤不进;web 形态关浏览器 tab 不触发 teardown |-| pi(takeover 默认) | **—**(正常退出路径会 await `session_shutdown`,handler 持久化本地 takeover 状态,不 commit) | **—** | **—** | **—** | **—** | 下次续跑攒满 30000,或手动 `/viking commit` |-| pi(takeover off) | **C**(`await sync.commit()`,失败入 pending 队列) | **C** | **C** | **C** | **—** | — |-| openclaw | **—**(上游发 awaited `session_end(reason=shutdown\|restart)`,handler 缓存 agentId 后返回,不触发 commit;`gateway_stop` 未注册;无信号处理) | **—** | **—** | **—** | **—** | 显式 `/new` `/reset` 与 ~50% 阈值;低于阈值的会话依赖这两条路径归档 |-| hermes | **C\***(atexit `_run_cleanup` → flush 10s → on_session_end) | **C\***(交互与非交互最终都走 atexit) | **C\***(`_signal_handler`,grace 默认 1.5s → 干净退出 → atexit) | **C\***(SIGHUP 同 SIGTERM 路径) | **—**(atexit 不执行) | drain 不净时本次不 commit(避免提交半截数据);Hermes 退出看门狗可能中断慢 commit |-| ov CLI | n/a(一次性命令) | n/a | n/a | n/a | n/a | 无 pending queue;命令失败重跑即可 |-| ingest | **C**(`finally _flush_all`) | **C**(SIGINT → stop) | **C** | **—**(无 SIGHUP handler) | **—** | 通过游标库恢复:`needs_commit` 持久化在游标库,下次运行 reconcile 补 commit |-| LangChain / Open WebUI / Agent Plugins / 通用 MCP | **—**(无会话生命周期挂钩;MCP 代理退出时的 `DELETE /mcp` 只释放协议会话,与记忆 commit 无关) | — | — | — | — | LangChain 靠调用方 `close()`;进程内 pending-commit 集合随进程消失 |--**三点阅读提示**:--1. 正常退出时尝试 commit 的有五家:claude-code、opencode(≥1.15.11)、dsh、pi(takeover off)、hermes;其余各家均依赖表中"补救路径"列的回收机制。-2. kill -9 场景所有集成都不触发 commit——已提交的消息保留在服务端 live 区,后续同一会话再触发 commit 时一并归档;服务端提供 per-session idle 兜底能力([§2.3](#_2-3-服务端会话与-commit-语义)),当前插件默认不下发该 policy。-3. 每轮必 commit 的 trae×2 / zcode 关闭语义最简单(即最大待归档量 = 最后一个未走到 Stop 的回合),代价是每个 Stop 都触发一次全量归档 + 记忆抽取(keep 0)。--### 3.3.4 pending queue / 离线补偿对照--| harness | 机制 | 要点 |-|---|---|---|-| cc / cursor / trae×2 / zcode / opencode / dsh / pi | 磁盘队列 `~/.openviking/pending`(0700/0600) | 仅可重试的失败入队(4xx 含 401/403 判为不可重试,不入队,debug 日志可见);重放在会话启动时执行:≤50 条/次、≤3 次/条、TTL 7 天;`.processing` 原子认领,10min 陈旧回收;addMessage 失败即 break 保序 |-| codex / trae-cli | transcript + 持久化游标 | 新捕获的消息不进入 pending queue;成功发送多少条,游标才推进多少条,后续捕获或 SessionStart 扫描补发未发送的尾部。SessionStart 仍会重放已有的共享 pending 条目。 |-| openclaw | 无本地队列 | addSessionMessage 失败被 catch,该轮消息不重放 |-| hermes | 进程内上传线程;`$HERMES_HOME/openviking/pending_sessions/` 保存待提交标记 | POSIX 上启动时可提交已退出进程遗留的待提交会话;未上传消息不会从磁盘重放。 |-| LangChain | 进程内 `_pending_commit_sessions` 集合 | commit 失败下次 record 自动重试;不落盘。部分成功时抛 `OpenVikingPartialWriteError`(携带 `messages_written`、`input_messages_consumed`、`context_attached`,调用方可按位置切片重试后缀)——全部集成里唯一的部分成功上报协议 |-| ingest | SQLite 游标库 + 单实例锁 | append 前持久化意图,崩溃后 reconcile 按服务端消息数判定该批是否落地——可恢复部分落地的批次 |+| Claude Code | 提交 | 提交 | 提交 | 提交 | 否 | `SessionEnd` 把提交交给自成进程组的分离 worker,SIGHUP 不会终止它。否则等下次阈值、`/compact` 或 `SessionEnd` |+| Codex | 提交 | 视情况 | 否 | 否 | 否 | 连按两次 Ctrl+C 属于正常退出,会触发 `SessionEnd`;只按一次不会。漏掉的内容在下一次 startup 或 clear 的 `SessionStart` 提交:结束标记还在就立即提交,否则等空闲 30 分钟后提交 |+| TraeCode CLI 2.0 | 否,除非版本带 `SessionEnd` | 否 | 否 | 否 | 否 | 下一次 `SessionStart` 的 30 分钟空闲扫描 |+| Cursor | 否 | 否 | 否 | 否 | 否 | 关闭或切换对话不触发任何事件。`sessionEnd` 只在关闭窗口时触发,而此时宿主已停止执行 hook 命令。不足 8 条消息阈值的部分要等同一会话的后续消息 |+| TRAE、TRAE CN | 否 | 否 | 否 | 否 | 否 | 每个 `Stop` 已经提交,最多丢失正在进行的那一轮 |+| ZCode | 否 | 视情况 | 否 | 否 | 否 | 按 Ctrl+C 时如果该轮的 `Stop` 已触发,分离的 worker 会写完。每个 `Stop` 都提交,漏掉的轮次在下一个 `Stop` 补齐 |+| Kimi Code | 视情况 | 视情况 | 未验证 | 未验证 | 否 | `SessionEnd` 和 `Interrupt` 只在捕获到新消息时提交;已被 `Stop` 捕获的尾部等待下一次提交 |+| OpenCode | 视情况 | 视情况 | 视情况 | 视情况 | 否 | v1 1.15.11+ 的 `dispose` 和 v2 cleanup 会提交所有会话,但宿主留给清理的时间有限,慢请求或会话较多时可能被截断。v2 cleanup 还会在空闲 60 分钟和插件热重载时运行 |+| DSH | 提交 | 提交 | 提交 | 否 | 否 | teardown 给每个会话一次 3 秒的提交,排在慢写入之后,整体处于 5 秒的进程宽限期内。第二次 Ctrl+C 会强制退出,跳过提交。Web 形态下关闭浏览器标签页不会触发 teardown |+| pi,takeover 开 | 否 | 否 | 否 | 否 | 否 | `session_shutdown` 保存 takeover 状态但不提交。等下次运行达到阈值,或执行 `/viking commit` |+| pi,takeover 关 | 提交 | 提交 | 提交 | 提交 | 否 | 失败的提交进入离线队列 |+| OpenClaw | 否 | 否 | 否 | 否 | 否 | `session_end` 处理器不提交。归档依赖 `/new`、`/reset` 和阈值 |+| Hermes(内置) | 视情况 | 视情况 | 视情况 | 视情况 | 否 | 退出处理器最多用 10 秒等待上传完成,然后提交;上传没有完成就跳过提交,不提交半个会话。SIGTERM 和 SIGHUP 默认有 1.5 秒宽限期,Hermes 的退出看门狗可能中断较慢的提交 |+| LangChain、Open WebUI、Agent Plugins、MCP 客户端 | 否 | 否 | 否 | 否 | 否 | 没有会话 hook。MCP 代理退出时发送的 `DELETE /mcp` 只关闭协议会话。LangChain 依赖调用方的 `close()` |++这张表的实际含义:++- **正常退出时会提交**:Claude Code、Codex 0.145+、OpenCode、DSH、takeover 关闭的 pi,以及 Hermes。其他集成依赖最后一列的回收方式。+- **`kill -9` 之后没有任何集成会提交**。已写入的消息保持未提交,直到该会话的下一次提交。带空闲超时的服务端自动提交策略是唯一的服务端兜底,而插件不会配置它。+- **TRAE、TRAE CN 和 ZCode** 的退出行为最简单,因为每轮都提交;代价是每个 `Stop` 都要做一次完整的归档和抽取。++<a id="_3-3-4-pending-queue-离线补偿对照"></a>++### 离线重试++| 集成 | 写入失败时 |+|---|---|+| Claude Code、Cursor、TRAE、TRAE CN、ZCode、Kimi Code、OpenCode、DSH、pi | 可重试的失败进入 `~/.openviking/pending` 下的磁盘队列,在会话开始时重放:每次最多 50 条,每条最多 3 次,保留 7 天。网络错误、408、429 和 5xx 可重试;其他 4xx(含 401 和 403)不入队。某条消息重放失败时停止,以保证顺序 |+| Codex、TraeCode CLI 2.0 | 新捕获的内容不入队。transcript 游标只越过服务端已接受的消息,下次捕获或启动扫描会重发剩余部分。`SessionStart` 仍会重放已排队的条目 |+| OpenClaw | 没有队列,失败的轮次不会重发 |+| Hermes(内置) | 上传在进程内线程中运行,不从磁盘重放。`$HERMES_HOME/openviking/pending_sessions/` 下的待提交标记让之后的启动能提交已退出进程留下的会话(仅 POSIX) |+| LangChain | 提交失败时在下一次 record 时重试,只保存在内存中。部分写入会抛出 `OpenVikingPartialWriteError`,附带计数,调用方可据此重试剩余消息 |+| 日志导入 | SQLite 游标库在发送前记录每批数据。崩溃后,下次运行根据服务端的消息数判断这批数据是否已送达 |-### 3.3.5 subagent 会话对照+<a id="_3-3-5-subagent-会话对照"></a>-| harness | 处理方式 |+### 子代理++| 集成 | 子代理处理 ||---|---|-| claude-code | 隔离最完整:SubagentStart 派生 `cc-<sid>__subagent-<agent_id>` 独立会话,SubagentStop 读 subagent transcript 推送后无条件 commit 并清 state |-| codex / trae-cli | 不单独建会话:subagent 输出(`agent_message` / `sub_agent_activity`)折叠进主会话的 assistant/tool part |-| opencode | `oc-<parent>__subagent-<child>` 挂在父命名空间下;开场注入跳过 subagent(召回不跳过);v2 从 `session.created` 的 `parentID` 建立映射,再在 execution 结束时读取 context |-| dsh | 每个 subagent = 独立 `dsh-<id>` 会话,父子关系不保留;N 个 subagent = N 份 profile 注入 + N 个独立会话 |-| hermes | `delegate_task` 传 `skip_memory=True` → subagent 不接 OV(无会话/召回/工具面);子任务产出不回灌 |-| cursor / trae×2 / zcode / pi / openclaw | 无 subagent 处理(有独立会话 id 就各自成会话,否则混入主会话;openclaw 可用 `bypassSessionPatterns` 屏蔽) |-| ingest | claude_code 适配器跳过 `isSidechain` / `isMeta` 记录——subagent 对话不入库 |+| Claude Code | 每个子代理有自己的会话 `cc-<id>__subagent-<agent_id>`。`SubagentStop` 发送它的 transcript 并提交 |+| Codex、TraeCode CLI 2.0 | 子代理输出并入主会话 |+| OpenCode | 子代理使用 `oc-<parent>__subagent-<child>` 会话。会话开场上下文对它们跳过,召回不跳过 |+| DSH | 每个子代理是单独的 `dsh-<id>` 会话,与父会话没有关联,各自获得会话开场上下文 |+| Hermes | 委派任务以 `skip_memory=True` 运行,子代理没有 OpenViking 会话、召回或工具,输出也不会被捕获 |+| Cursor、TRAE、ZCode、Kimi Code、pi、OpenClaw | 没有特殊处理。有独立会话 ID 的子代理有自己的会话,否则消息并入主会话。OpenClaw 可以用 `bypassSessionPatterns` 排除会话 |+| 日志导入 | Claude Code 适配器跳过 sidechain 和 meta 记录,子代理对话不会导入 |++<a id="_3-4-压缩-compaction-接管"></a><a id="_3-4-1-判定矩阵"></a>-## 3.4 压缩 / compaction 接管+## 宿主压缩-### 3.4.1 判定矩阵+宿主缩减上下文时,多数集成只确保被丢弃的消息已经提交,摘要由宿主生成。pi 和 OpenClaw 可以用 OpenViking 的归档替换宿主的摘要。-| harness | 对宿主压缩的姿态 | 压缩前动作 | 压缩后动作 |+| 集成 | 方式 | 压缩前 | 压缩后 ||---|---|---|---|-| claude-code | 不接管 | PreCompact 同步 commit(唯一不 detach 的写路径,因为 CC 随后立刻重写 transcript) | `source="compact"` 的 SessionStart 会把 OV 的 `latest_archive_overview` + ≤5 条 abstracts 重新注回 |-| codex / trae-cli | 不接管 | PreCompact 补齐未捕获轮次 → 全量 commit → `ovSessionId=null`(补齐不全时不 commit,留待重试);无 PostCompact 接线,依靠 Stop 的转录收缩做防御性纠偏 | resume 时注入 archive digest |-| cursor / trae×2 / zcode | 不接管 | cursor:preCompact 无条件 commit(trae×2/zcode 上游无该事件) | — |-| opencode | 不接管 | v1 compacting 前 flush+commit;v2 在压缩前捕获对话 | v1 `session.compacted` 再提交一次;v2 `session.compaction.ended` 后提交一次 |-| dsh | 不感知(不监听 compaction 事件;注入走 pre-step user 消息,随宿主压缩一起收缩,profile 不重投) | — | — |-| pi | **takeover 双层接管**(默认开,[§3.4.2](#_3-4-2-pi-takeover)) | `session_before_compact`:flush → commit → pollOverview。成功则返回自定义 compaction 摘要覆盖 pi 的;失败则 fail-open 回退到 pi 默认压缩 | 成功后 resetBoundary |-| openclaw | **全接管**:`ownsCompaction: true`,宿主不再跑自己的摘要([§3.4.3](#_3-4-3-openclaw-contextengine)) | `compact()` = commit(wait=true, keep 0) → 读回 overview 当 summary | 主 assemble 用 `[Session History Summary]` 重建上下文 |-| hermes | 不接管(`on_pre_compress` 接口预留,当前不参与压缩摘要) | fork 型压缩边界会触发旧会话 commit;原地压缩不动 | — |+| Claude Code | 宿主摘要 | `PreCompact` 同步提交;这是唯一不在后台运行的写入,因为宿主紧接着就会重写 transcript | `source="compact"` 的 `SessionStart` 注入归档概览和最多 5 条摘要 |+| Codex、TraeCode CLI 2.0 | 宿主摘要 | `PreCompact` 补齐未捕获的轮次,提交全部内容,并开始一个新的 OpenViking 会话。补齐不完整时不提交,稍后重试 | resume 时注入归档摘要 |+| Cursor | 宿主摘要 | `preCompact` 提交 | 无 |+| TRAE、TRAE CN、ZCode | 宿主摘要 | 没有压缩前事件 | 无 |+| Kimi Code | 宿主摘要 | `PreCompact` 提交新捕获的消息 | 无 |+| OpenCode | 宿主摘要 | v1 刷新并提交;v2 捕获 transcript | v1 在 `session.compacted` 时再提交一次;v2 在 `session.compaction.ended` 后提交 |+| DSH | 未观察到 | 无。注入的上下文是一条用户消息,随宿主压缩一起缩减;profile 不再发送 | 无 |+| pi | takeover,默认开启 | 提交并等待归档概览 | 用概览替换 pi 的摘要;失败时 pi 照常压缩 |+| OpenClaw | 插件接管压缩 | `compact()` 提交并等待 | 下一次上下文组装从服务端重建历史 |+| Hermes(内置) | 宿主摘要 | fork 型压缩提交旧会话;原地压缩不做任何处理 | 无 |-### 3.4.2 pi takeover+<a id="_3-4-2-pi-takeover"></a>-- 接管面是 `context` 事件的 messages 改写,不接管 pi 的历史存储。触发是 token 压力(30000 + 保留 3 轮),而非 pi 的压缩事件。-- 替换动作:先定位边界,再把边界前的全部消息替换成一条合成 user 消息 `[OpenViking Session Context]`。其中 overview 按 3000 token 截断;timestamp 取保留首条 -1,以稳定 provider payload 吃 prompt cache。-- 数据源是 `GET /sessions/{id}/context` 的 `latest_archive_overview`(轮询 15×2s);状态持久化在 pi 自己的 branch custom entry `ov-takeover`。-- 失败姿态 = fail-open 回完整历史(指纹不匹配 / 历史短于边界 / overview 拿不到三重回退)。-- 与 pi 原生压缩的关系:`session_before_compact` 成功时返回 `{compaction:{summary, firstKeptEntryId, …, details:{source:"openviking"}}}` 覆盖 pi 摘要;缺 `firstKeptEntryId` 时走 pi 默认压缩。+### pi takeover-### 3.4.3 openclaw ContextEngine+- **改变了什么**。pi 自己的历史不会被修改。扩展改写每次 `context` 事件中发送的消息:边界之前的内容合并成一条合成用户消息 `[OpenViking Session Context]`,内容是截到 3,000 token 的归档概览。它的时间戳取第一条保留消息之前的时刻,让发给 provider 的请求保持稳定,prompt 缓存继续生效。+- **何时运行**。由 token 压力触发,而不是 pi 的压缩事件:约 30,000 token,保留最近 3 个用户轮。提交时把这 3 轮对应的确切消息数作为 `keep_recent_count` 发送。+- **摘要来源**。该次提交产生的归档概览,每 2 秒轮询一次,最多 15 次。边界作为 `ov-takeover` 条目存在 pi 的 branch 中,重启后仍然有效。+- **何时回退**。指纹不匹配、历史短于边界或缺少概览时,pi 使用完整历史。如果概览一直为空,边界不移动,待提交计数归零,重新累积后再试。+- **pi 自己的压缩**。takeover 成功时,`session_before_compact` 把 OpenViking 摘要返回给 pi。没有 `firstKeptEntryId` 时,pi 执行默认压缩。-- 实现宿主 `ContextEngine` 接口,`assemble()` 分两个分支:transformContext(只做召回前置注入,5 道 passthrough 守卫)与 main-assemble(`getSessionContext(tokenBudget)` → 用服务端返回替换宿主 live 历史,四层预算切分,3 道 passthrough 保护 + provider 消息 sanitize 管线)。-- `compact()` = `commit(wait=true, keep 0)`(500ms 轮询,Phase2 上限 5 分钟)→ `latest_archive_overview` 当 summary、`archive_uri` 末段当 `firstKeptEntryId`。`customInstructions`/`compactionTarget` 保留接口,当前不参与压缩产物。-- `ingest()/ingestBatch()` 是刻意 no-op,写入全走 `afterTurn`。-- 有归档时额外注入 20 行 "Session Context Guide" systemPromptAddition,指示模型在说"没有信息"之前先重读摘要,并用 `ov_archive_search` 尝试至少 2 组关键词。+<a id="_3-4-3-openclaw-contextengine"></a>-### 3.4.4 pi 与 openclaw 接管方式对照+### OpenClaw 上下文引擎-| 维度 | pi takeover | openclaw ContextEngine |+- OpenClaw 把插件注册为上下文引擎,并设置 `ownsCompaction: true`,宿主不再自己生成摘要。+- 上下文组装分两部分。`transformContext` 只添加召回,前面有五道 passthrough 检查。主组装调用 `getSessionContext(tokenBudget)`,用服务端的返回替换宿主的实时历史,按四档预算切分,前面有三道 passthrough 检查和一个消息清洗步骤。+- `compact()` 以 `keep_recent_count` 0 提交,每 500 ms 轮询一次,最多 5 分钟,然后把归档概览作为摘要返回。+- `ingest()` 和 `ingestBatch()` 有意不做任何事;对话在每轮结束后捕获。+- 存在归档时,system prompt 会加入一段简短指引,要求模型在回答“没有相关信息”之前先重读摘要,并用 `ov_archive_search` 至少尝试两组关键词。++<a id="_3-4-4-pi-与-openclaw-接管方式对照"></a>++### pi 与 OpenClaw 接管对比++| | pi takeover | OpenClaw 上下文引擎 ||---|---|---|-| 宿主契约 | 一个 context 钩子的 messages 改写 | 注册 ContextEngine,`ownsCompaction: true` |-| 历史真相源 | 仍是 pi 本地 branch | OV 服务端 getSessionContext |-| 触发 | 客户端 token 阈值 30000 + 保留 3 轮 | 宿主调用 assemble/compact |-| 压缩产物 | 一条合成 user 消息(3000 token 截断) | 重建后的整个 messages 数组 + compaction summary |-| 失败姿态 | fail-open 回完整历史 | passthrough 回宿主 live 消息 |-| 召回与 session | context face 带 session_id | `/find` 不带(expansion/台账不参与) |+| 宿主契约 | 在 `context` 事件中改写消息 | 上下文引擎,`ownsCompaction: true` |+| 历史来源 | pi 本地的 branch | 服务端的会话上下文 |+| 触发 | 客户端 token 阈值(30,000,保留最近 3 个用户轮) | 宿主每次调用 assemble 或 compact |+| 结果 | 一条合成用户消息,最多 3,000 token | 重建的消息列表,加上压缩摘要 |+| 失败时 | 完整历史 | 宿主的实时消息 |+| 召回 | 带会话 ID 的 context 检索 | 不带会话 ID 的 `/find`,没有扩写和去重 |-## 3.5 写入与删除的类型边界+<a id="_3-6-降级与容错"></a><a id="_3-6-1-判定矩阵"></a>-### 3.5.1 写入边界+## 服务端不可用时++召回出错时,宿主可以在没有注入记忆的情况下继续。但请求仍可能让提问一直等到请求结束或到达截止时间;出错后能继续,不代表不用等待。++| 集成 | 服务端不可达 | 缓存的失败状态 | 等待与错误传递 |+|---|---|---|---|+| Claude Code | 每个 hook 捕获错误并让宿主继续;会话开始时跳过队列重放 | context 检索标记 6 小时,本地 CLI 检测 7 天,健康状态 5 秒 | 召回等到请求结束或截止时间后再继续。URI guard 的拒绝是有意设计,与召回失败无关 |+| Codex、TraeCode CLI 2.0 | 每个 hook 捕获错误,不做任何处理 | context 检索标记;本地压缩器失败后停用到下次启动 | 召回等到请求结束或截止时间,然后提问继续 |+| Cursor、TRAE、TRAE CN、ZCode | 请求错误被吞掉,不注入任何内容。5 秒内拿不到锁的 hook 静默跳过 | 只有 context 检索标记,所以每轮都要等满 15 秒召回超时 | 每轮最多等到召回超时 |+| OpenCode | 召回、捕获和清理的错误被捕获并记录日志 | context 检索标记;健康检查不缓存 | 召回会等待网络请求;清理也可能等到截止时间 |+| DSH | 插件吞掉错误。会话初始化失败不缓存,所以每个 pre-step 会发两次 5 秒的健康检查 | context 检索标记;用户空间查询结果在进程生命周期内缓存 | pre-step 依次执行 profile 和召回,会话 flush 会阻塞 |+| pi | 启动时健康检查失败则不注册工具,之后的提问静默重试。只有 MCP 握手失败时,召回、同步和 takeover 不受影响;状态栏显示 `tools ✗`,`/viking` 打印错误 | context 检索标记。MCP 握手每轮重试一次,召回开始前可能用掉 5 秒的握手预算 | 召回等到请求结束或截止时间。不开 takeover 时 `session_shutdown` 最多等 30 秒;`turn_end` 遇到网络错误时每条消息等 10 秒 |+| OpenClaw | 500 ms 健康检查失败时跳过召回 | 无;每轮一次健康检查 | 只有 `memory_store` 的错误会返回给模型;`compact()` 最多可能等 5 分钟 |+| Hermes(内置) | 失败的连接在 30 秒内不重试,除非连接设置改变 | 记住失败的设置 | 召回在 4 秒总预算内等待,然后不带上下文继续 |+| ov CLI | 多数命令以状态码 1 退出;表格模式的 `ov status` 和 `ov health` 即使不健康也退出 0 | 无 | 不适用 |-MCP `write` / REST `content/write` 的三道 guard(`content_write.py`):可写域限 `viking://resources|user|agent`;新建文件扩展名需符合白名单 `.md .txt .json .yaml .yml .toml .py .js .ts`;用户根下 `skills/ peers/ privacy/ sessions/` 四个托管子树只读(`_USER_MANAGED_SUBTREES`)。已存在的 `.abstract.md/.overview.md` sidecar 可以改正文,但公共写入 API 不能创建它们。+<a id="_3-6-2-通用超时"></a>-### 3.5.2 删除边界+### 共享超时与锁-**第一档:服务端通用防线(所有删除入口共享)**。`VikingFS.rm` 第一句 `_ensure_delete_access`(`_access.py:182-229`)实施 5 道检查:命名空间可访问性;用户删除进行中 → FailedPrecondition;actor-peer 隐藏视图 → PermissionDenied;命名空间根保护:裸 `viking://`、`viking://user` 根、`viking://agent` 根一律拒删;非 ROOT 删 `viking://temp` 拒。这一档按命名空间根设防,不区分 memory/resource/skill 类型——类型级差异由后三档在客户端实施。+共享插件的 HTTP 超时为 15 秒(最小 1 秒)。MCP 代理请求 15 秒超时,退出时发送的 `DELETE /mcp` 为 2 秒。跨进程锁等待 5 秒,60 秒后视为过期;正在重放的队列条目 10 分钟后被回收。MCP 代理不处理 SIGHUP,关闭终端时不会发送 `DELETE /mcp`;服务端以无状态方式运行 MCP,不会留下残留状态。++<a id="_3-1-接入形态、安装与配置体系"></a><a id="_3-1-1-判定矩阵"></a>++## 安装、会话与配置++从会话 ID 前缀可以看出服务端上的会话由哪个集成写入。++| 集成 | 安装方式 | 会话 ID | 配置来源 |+|---|---|---|---|+| Claude Code | 统一安装器(`--harness claude`)或插件市场 | `cc-<session id>`;子代理 `cc-<id>__subagent-<agent_id>` | 共享配置,`plugin.claude_code` |+| Codex | 统一安装器(`--harness codex`)或 `codex plugin marketplace add` | `cx-<id>`,由 Codex 会话推导 | 共享配置,`plugin.codex` |+| TraeCode CLI 2.0 | 统一安装器(`--harness trae-cli`),对 `traecli` 执行 Codex 的安装流程 | 同 Codex | 同 Codex |+| Cursor | 统一安装器;写入 `~/.cursor/hooks.json` 和 `mcp.json` | `cu-<conversation id>` | 共享配置,`plugin.cursor` |+| TRAE、TRAE CN | 统一安装器;写入 `~/.trae/` 或 `~/.trae-cn/` 下的 hook 与 MCP 文件 | `tr-` 或 `trcn-` | 共享配置,`plugin.trae` 或 `plugin.trae_cn` |+| ZCode | 统一安装器;合并进 `~/.zcode/cli/config.json` 并开启 hook | `zc-<id>` | 共享配置,`plugin.zcode` |+| Kimi Code | 统一安装器;Kimi Code 托管插件 | `kc-<id>` | 共享配置,`plugin.kimicode` |+| OpenCode | 统一安装器、npm(`@openviking/opencode-plugin`)或源码 | `oc-<id>`;子代理 `oc-<parent>__subagent-<child>` | 共享配置,`plugin.opencode` |+| DSH | 统一安装器或 `dsh plugin add @openviking/dsh-memory-plugin` | `dsh-<id>` | 共享配置,`plugin.dsh`,然后是 Cordis patch |+| pi | 统一安装器,装入 pi 的扩展目录 | `pi-<id>` | 共享配置,`plugin.pi` |+| OpenClaw | ClawHub、npm 安装器或离线包;之后运行 `openclaw openviking setup` | 会话 UUID,或会话 key 的 SHA-256 | `openclaw.json` 和少量环境变量 |+| Hermes(内置) | 随 Hermes 发布;运行 `hermes memory setup openviking` | Hermes 自己的会话 ID | `.env`、关联的 `ovcli.conf` 和 Hermes `config.yaml` |+| ov CLI | npm、`uv tool install`、cargo 或 GitHub Releases | 不管理 | `ovcli.conf` profile |-**第二档:客户端零附加(MCP 面——dsh 与 pi 现在也走它——外加 langchain/ov rm)**。差异只在参数面:MCP `forget` 按给定 URI 删除,`recursive` 默认 false,没有任何分数门槛;dsh 与 pi 都已经把自己手写的 `viking_forget` 撤下工具面(旧实现把 `recursive` 固定为 false,按 query 删除还要求匹配分 >0.8),这一档因此不再有客户端附加。LangChain `viking_forget` 的 `recursive` 是模型可控参数(但默认不在工具面);`ov rm -r` 则显式开递归、无确认提示(TUI 的 `d` 键有 y/n 确认 + root/scope 目录禁删)。+“共享配置”指[配置与工作区文件](#配置与工作区文件)中分层的插件配置。-**第三档:memory-only 的两个删除面**。+<a id="_3-1-2-统一安装器"></a>-- openclaw `memory_forget`:三条白名单正则只放行 `viking://user/[…/]memories`、`viking://user/<u>/peers/<p>/memories`、`viking://agent/[…/]memories`;显式 uri 不匹配直接拒绝;搜索路径候选先过同一 guard,且只有在候选唯一且 score≥0.85 时才自动删,否则列出候选让 agent 指名;底层 URL 固定 `recursive=false`。-- Hermes `viking_forget` 拒绝空输入、非 `viking://` URI、query/fragment、目录、非 `.md` 文件及 `.abstract.md`/`.overview.md` 摘要。内置校验器允许用户记忆路径,包括直接位于 `memories/` 下的 `profile.md`。请使用服务端返回的、带明确用户 ID 的 URI。外部插件还支持 `viking://~/...`,拒绝已废弃的无用户 ID 路径,并在删除明确用户路径前验证归属。+### 统一安装器-**第四档:默认不提供删除(LangChain / Open WebUI)**。LangChain `viking_forget` 需配置 `profile="admin"` 或 `allow_forget=True` 才加入工具面;Open WebUI 则完全不提供删除工具。+`examples/memory-plugin-shared/install.sh` 安装 Claude Code、Codex、TraeCode CLI 2.0、Cursor、TRAE、TRAE CN、ZCode、Kimi Code、OpenCode、pi 和 DSH。OpenClaw 和 Hermes 有各自的安装渠道。需要知道的几点:-**skill 的增删边界**:新增入口是 MCP `add_skill`、openclaw `add_skill`(默认开)、`ov add-skill` 与 REST;`add_resource` 拒绝 skill URI,MCP `write` 拒绝用户自己的 `skills/` 子树(`_USER_MANAGED_SUBTREES`);`viking://agent/skills` 下的 `write` 目前没有拦截,但会绕过 skill 安装流程。对 skill 完全只读(不增不删)的删除面是 openclaw `memory_forget` 与 hermes `viking_forget`。MCP `forget`、dsh、pi、`ov rm` 能删掉 skill 目录,因为删除路径不检查该集合,但只有 `ov skills remove` 和 REST `DELETE /api/v1/skills/{name}` 会同时清理该 skill 的 privacy 配置。+- 不带 `--harness` 时显示多选菜单。各插件自带的 setup 脚本会替你传入 `--harness`。通过 `curl` 管道执行时,从 `/dev/tty` 读取输入。+- 从文档站下载;在仓库 checkout 中运行时,使用本地 checkout。+- hook 和 MCP 条目带有 `OPENVIKING_INTEGRATION_ID` 标记,重新运行只替换自己的条目,不动其他工具的条目。每个被修改的文件先备份为 `.bak`,再以 `0600` 权限原子替换。+- 凭据步骤为本地服务端、OpenViking Service 或自定义 URL 写入 `~/.openviking/ovcli.conf`。已有配置会先显示当前值(API key 打码),再让你选择保留或修改。+- `--uninstall` 支持 Cursor、TRAE、TRAE CN、ZCode 和 Kimi Code。其他集成通过宿主自己的插件管理卸载。+- 需要 Node.js 18 或更高版本。-## 3.6 降级与容错+<a id="_3-1-3-凭据体系"></a>-### 3.6.1 判定矩阵+### 凭据来源-| harness | 服务端不可达时 | 负缓存 | HTTP 重试 | 失败阻塞宿主 |+一共有四套凭据体系,各自使用不同的变量名和请求头。连接失败时,先确认集成用的是哪一套。++| 使用方 | 服务端 URL | API key | 身份 | 认证头 ||---|---|---|---|---|-| claude-code | 各 hook catch→approve,不阻塞;session-start 时连 pending 重放都跳过 | context-face 6h + host-cli 探测 7d + health 5s | 无(靠 pending 重放);peer_scope 降级 1 次;batch→逐条 | 否(uri-guard deny 是设计意图) |-| codex / trae-cli | 各 hook catch→noop | context-face 6h + 压缩器 runtime_failed(至下次启动) | 捕获失败靠 transcript/游标补发;SessionStart 也重放已有 pending 条目 | 否 |-| cursor/trae×2/zcode | fetch 吞成 status:0,catch 返回空注入;锁 5s 拿不到则静默跳过 | context-face 6h(服务端整体不可达时无负缓存,每轮等满 15s) | 无 | 否 |-| opencode | recall、context、after-tool、事件循环与 cleanup 失败均 catch→WARN;URI guard 的预期拒绝仍会返回给模型 | 仅 context-face 6h;`/health` 无缓存 | 无同步重试;MCP 代理 401/403、400/404 各一次 | 否(URI guard deny 是设计意图) |-| dsh | client 全吞异常;`ensureState` 失败不缓存(服务端不可达时每 pre-step 两次 health 各 5s) | context-face 6h + user-space 缓存进程内不过期 | 无;pending 跨进程重放 3 次 | 是(pre-step 串行 profile+recall;session/flush 阻塞) |-| pi | health 失败时 start() 提前返回,本轮也不注册工具,此后每 prompt 静默重试连接;`/mcp` 握手单独失败(401/403、超时、server 无 `/mcp`)不影响启动:召回、同步、takeover 照常,状态栏显示 `tools ✗`,`/viking` 打印完整错误 | context-face 6h;握手没有负缓存,一直失败就每轮重试一次,最多占满 5s 握手预算才轮到排队召回 | hook 侧无,只有 pending queue;传输失败后丢弃当前 MCP 连接,下次调用重新连接;失败的工具调用不会自动重放 | 部分(session_shutdown 被 await:takeover 近 0、非 takeover 最坏 30s,外加关闭 MCP 客户端;turn_end 网络异常时逐条各等 10s) |-| openclaw | client 构造永不失败;health 吞异常;召回 500ms precheck 失败跳过 | 无负缓存(每轮一次 500ms health 预检) | 无(单次 fetch);commit/afterTurn 的 Phase2 轮询 | 否(`memory_store` 重抛例外;`compact()` 最长阻塞 5 分钟) |-| hermes | 未变化的失败连接配置冷却 30s;配置变化触发新探测 | `_failed_refresh` 记录失败配置 | trusted 身份补发及 sync client 重试;启动时恢复已退出进程的待提交会话(POSIX) | 否 |-| ov CLI | 多数 exit 1;`ov status` 表格模式始终退 0;`ov health` 即使 unhealthy 也退 0 | 无 | 仅网关 401 挑战重试 1 次 | n/a(无宿主) |+| 共享插件代码:Claude Code、Codex、Cursor、TRAE、ZCode、Kimi Code、OpenCode、DSH、pi、Agent Plugins | `OPENVIKING_URL`,其次 `OPENVIKING_BASE_URL` | `OPENVIKING_BEARER_TOKEN`,其次 `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT`、`OPENVIKING_USER`、`OPENVIKING_PEER_ID` | 只有 `Authorization: Bearer` |+| OpenClaw | `OPENVIKING_BASE_URL`,其次 `OPENVIKING_URL` | `OPENVIKING_API_KEY` 或 SecretRef | `OPENVIKING_ACCOUNT_ID`、`OPENVIKING_USER_ID` | `X-API-Key` |+| Hermes | `OPENVIKING_ENDPOINT` | `OPENVIKING_API_KEY` | `OPENVIKING_ACCOUNT`、`OPENVIKING_USER`、`OPENVIKING_AGENT` | 同时发送 `X-API-Key` 和 `Bearer`。有 key 时不发租户头,服务端要求时补发并重试一次 |+| ov CLI | `ovcli.conf` | `ovcli.conf` | `--account`、`--user`、`--actor-peer-id` | `X-API-Key`;按 `auth_mode` 使用 Basic 或 Bearer。含两个及以上点号的 key 也会以 Bearer 发送 |-### 3.6.2 通用超时+共享插件代码的规则:-通用 HTTP 15000ms(下限 1000);MCP 代理请求 15000ms、DELETE 固定 2000ms;跨进程锁等待 5s、陈旧 60s;pending `.processing` 陈旧回收 10min。需注意 MCP 代理未注册 SIGHUP(关终端不发 `DELETE /mcp`;但服务端 `stateless_http=True`,影响有限)。+- `OPENVIKING_CREDENTIAL_SOURCE`(`env`、`cli` 或 `auto`,默认 `auto`)决定凭据来源。`auto` 下,环境中只要有任一凭据变量就以环境为准;只有一个都没设、且 `ovcli.conf` 中有凭据时,插件才改用该文件。`env` 不读任何文件,URL 默认为 `http://127.0.0.1:1933`。+- hook 和 MCP 代理用同一个函数解析连接,且都不读取工作目录,所以从插件目录启动的代理与 hook 连到同一个服务端,使用同一身份。+- `X-OpenViking-Account` 和 `X-OpenViking-User` 只在 trusted 模式下发送。使用 API key 时,服务端从 key 中读取身份。-## 3.7 附加 UX 对照+完整的解析顺序见[客户端配置字段](../configuration/02-client.md#连接与鉴权)和[插件开发指南](./18-plugin-development.md#_4-2-凭据不是普通-workspace-配置)。-| harness | statusline | slash command | rule/skill | setup 向导 | 其他 |-|---|---|---|---|---|---|-| claude-code | ✅ 独立进程写 settings.json(段位丰富,1min TTL) | ✅ `/openviking-memory:ov`(服务状态 + 身份 + 注入溯源) | 4 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`、`ov-memory-doctor`) | ✅ 行式问答 | uri-guard 不受插件开关门控 |-| codex / trae-cli | ❌ | ❌ | 与 claude-code 相同的 4 个 skill | ✅ | README.md Testing 一节的 live 检查 |-| cursor | ❌ | ❌ | rule(alwaysApply)+ 3 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`) | ❌(共用安装器 TUI) | 独立 uri-guard,不受插件开关控制 |-| trae/trae-cn | ❌ | ❌ | 无 | ❌ | — |-| zcode | ❌ | ❌ | 无 | ❌ | — |-| opencode | ❌ | ❌ | 3 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`),仅随 MCP server 提供 | ✅ | v1 有 toast;v2 只写日志 |-| dsh | ❌ | ❌ | 3 个 skill:`openviking-memory`、`openviking-skills` 与 `ov-experience-memory`(独立的 `ctx.skills` provider) | ❌ | `ctx.provide("openvikingMemory")` 供其他 Cordis 插件二次开发 |-| pi | ✅ `ctx.ui.setStatus` | ✅ `/viking` `/viking commit` | 3 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`),经 `resources_discover` 加入 | ✅ | e2e-live.sh |-| openclaw | ❌ | ✅ 5 个(/add-resource /add-skill /ov-search /ov-query-config /ov-recall-trace) | 3 skill 随插件分发 | ✅(key 角色探测 + 版本兼容检查 + `status` 命令) | Gateway HTTP 路由做 recall trace 可视化;feature-gate RPC;健康检查脚本 |-| hermes | ❌ | ❌ | 无 | ✅ curses 多层菜单 | `hermes memory status`(含 env 覆盖列表);`hermes backup` 收集 `$HOME` 下默认或环境变量指定的 `ovcli.conf`;YAML 关联的命名文件需单独备份 |-| ov CLI | ❌ | ❌(自身即命令) | 无 | ✅ TUI 向导 | 完整 help 系统(63 条 curated);语言门禁;`ov tui` 全屏文件浏览器(含终端内图片预览) |-------# 4. Harness 档案卡--每卡都是检索入口,只写该 harness 的独有事实与差异,共享机制回链维度章。统一字段:形态 / 能力亮点 / 行为要点 / 配置 / 维度索引。--## claude-code--- **集成文档**:[Claude Code 记忆插件](./02-claude-code.md)-- **形态**:CC 插件(marketplace),采用四合一架构:9 hook + MCP 代理(20 工具透传)+ slash command + statusline + 4 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`、`ov-memory-doctor`)。版本 0.6.1。-- **能力亮点**:hook 覆盖最全的 harness——SessionStart(120s) / UserPromptSubmit(60s) / PostToolUse:Read(5s,默认关的 skill-experience) / PreToolUse:Read\|Glob\|Grep\|Edit\|Write\|Bash(5s,uri-guard:文件工具的路径是 `viking://` URI 时拒绝,针对 skill URI 的 Write/Edit 会被引导到 `add_skill`;Bash 命令带 `viking://` URI 时附加提示) / Stop(45s) / PreCompact(30s) / SessionEnd(30s) / SubagentStart(10s) / SubagentStop(45s);默认启用召回再摘要(本地 `claude -p`,本地不可用时自动回落服务端 rewrite,[§3.2.5](#_3-2-5-召回再摘要));支持 SubagentStart/Stop 的完整子会话隔离([§3.3.5](#_3-3-5-subagent-会话对照));statusline + slash + uri-guard;关闭链路除 kill -9 外全部 commit([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵))。-- **行为要点**:session id 为 `cc-<CC session_id 原文>`,subagent 为 `…__subagent-<agent_id>`;Stop 阈值 commit 20000/keep 10,PreCompact 同步 commit;自动召回排除 resources([§3.2.1](#_3-2-1-机制底座-一条共享管线-两条服务端路径));增量游标存于 `/tmp`(被系统清理后,同一会话会整段重推)。-- **配置**:env + ovcli.conf `plugin.claude_code` + ov.conf `claude_code`([§3.1.4](#_3-1-4-配置体系分层)),约 70 个配置项;压缩器默认使用 `claude`/`sonnet`/`low`;超时来自 `recallCompressTimeoutMs`(默认 110s),仍受宿主 hook 预算约束。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |压缩 [§3.4](#_3-4-压缩-compaction-接管) |降级 [§3.6](#_3-6-降级与容错) |UX [§3.7](#_3-7-附加-ux-对照)。--## codex--- **集成文档**:[Codex 记忆插件](./04-codex.md)-- **形态**:Codex 插件(marketplace),6 hook(SessionStart 70s / UserPromptSubmit 130s / Stop 30s / SessionEnd 3s / PreCompact 60s / PreToolUse:Bash 5s)+ MCP 代理 + 与 claude-code 相同的 4 个 skill。版本 0.10.1。-- **能力亮点**:本地召回压缩管线(`codex exec`,[§3.2.5](#_3-2-5-召回再摘要));SessionEnd(Codex ≥ 0.145)在正常退出时补齐 Stop 漏掉的轮次并 commit,SessionStart 的兜底扫描回收那些没触发 SessionEnd 的退出所遗留的未归档消息([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵));PreToolUse:Bash(uri-guard)放行带 `viking://` URI 的 shell 命令,并附加提示,建议改用 OpenViking MCP 工具;Codex 通过 `apply_patch` 编辑文件,输入里没有路径参数,因此 guard 不会拒绝任何调用。-- **行为要点**:session id 为 `cx-<safeId>`(确定性推导,不读 state);SessionEnd 只在正常退出、且 Codex 0.145+ 时触发,信号、崩溃、旧版本以及 `codex app-server` 延后的场景都落到扫描路径;新捕获的消息不进入磁盘 pending queue(离线靠 transcript/游标补发,SessionStart 仍重放已有 pending 条目,[§3.3.4](#_3-3-4-pending-queue-离线补偿对照));idle-TTL 1800000ms、锁等待 120000ms(env 配置);Stop 与 SessionEnd 默认 detach(`appended N turn(s)` 提示默认不展示);单会话 mkdir 锁串行化 Stop worker、PreCompact、SessionEnd worker 与扫描。新增的 hook 在 Codex 侧没有信任记录,升级后需在 `/hooks` 中批准这次升级新增的 hook(SessionEnd、PreToolUse)。-- **配置**:env + ovcli.conf `plugin.codex` + ov.conf `codex`;hooks 只用 `Authorization: Bearer` 认证([§3.1.3](#_3-1-3-凭据体系))。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |降级 [§3.6](#_3-6-降级与容错)。--## trae-cli(TraeCode CLI 2.0)--- **集成文档**:[TRAE 记忆集成](./13-trae.md)-- **形态**:TraeCode CLI 2.0 是 Codex 系 CLI(binary `traecli`,用户配置 `~/.trae/traecli.toml`,TUI 支持 `/plugins` `/skills` `/mcp`)。OpenViking 经 **codex 插件别名安装**接入:`--harness trae-cli` 复用 codex 安装流程,仅安装参数(binary / home / 配置路径)指向 TraeCode CLI。-- **能力面**:与 codex 同一套插件——6 个已注册 hook + MCP 代理 + 同样的 4 个 skill、本地召回压缩、idle-TTL commit 回收、resume archive 注入等,详见 codex 档案卡。若 TraeCode CLI 所基于的 Codex 版本没有 `SessionEnd`,该 hook 会被忽略,关闭时的 commit 全部依赖 idle-TTL 扫描。-- **版本支持**:仅支持 TraeCode CLI 2.0。1.0 与 2.0 不是同一套 CLI,2.0 才是 Codex 系、才能走 codex 插件别名安装;早期面向 1.0 的独立插件(`~/.trae/cli/hooks.json` + `[mcp_servers."openviking-memory"]` 方案)已随仓库移除;安装器仍保留 `--harness trae-cli --uninstall`,用于清掉旧安装留在磁盘上的那份。-- **维度索引**:同 codex 卡。+<a id="_3-1-4-配置体系分层"></a>-## cursor+### 配置与工作区文件-- **集成文档**:[Cursor 记忆集成](./12-cursor.md)-- **形态**:配置驱动(写 `~/.cursor/hooks.json`+`mcp.json`)+ MCP 代理 + always-on rule + 3 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`)。6 hook:sessionStart(30s) / beforeSubmitPrompt(20s) / beforeReadFile(5s) / stop(30s) / preCompact(30s) / sessionEnd(30s)。相对 import 共享 lib(不 vendoring)。版本 0.5.0。-- **能力亮点**:beforeReadFile 上的 uri-guard 拒绝读取 `viking://` 路径(不受插件开关控制);shell 命令不做检查,升级时会移除旧版本注册的 beforeShellExecution 条目;rule 与三个 skill 随装;捕获只有文本,因此 `ov-experience-memory` 只检索和应用 Experience,读取不会关联回所用的 Experience。-- **行为要点**:session id 为 `cu-<conversation_id>`;stop 每 8 条消息 commit(`commitTurnThreshold=8`,消息条数计数,keep 0);`sessionEnd` 仅 window_close 触发,且此时宿主已销毁 shell-exec host,实践中不执行([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵))——结束在 <8 条消息水位的会话,尾部依赖后续同会话消息触发归档([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵));服务端不可达时,每轮等满 15s 召回超时。-- **配置**:env + ovcli.conf `plugin.cursor` + workspace 文件([§3.1.4](#_3-1-4-配置体系分层))。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |降级 [§3.6](#_3-6-降级与容错)。+基于共享插件代码的集成按以下优先级(从高到低)读取行为配置:`OPENVIKING_*` 环境变量、每机工作区注册表、仓库的 `.openviking/config.local.json` 和 `.openviking/config.json`、`ovcli.conf` 的 `plugin.<harness>`、`ovcli.conf` 的 `plugin`,以及 `ov.conf` 中旧的 harness 段。工作区文件不能设置 URL、key 或其他凭据。见[插件配置](../configuration/02-client.md#插件配置)和[工作区配置](../configuration/02-client.md#工作区配置)。OpenClaw 读取 `openclaw.json`,Hermes 读取自己的 `.env` 和 `config.yaml`。-## trae / trae-cn(IDE 版)+**工作区 peer**。这些集成默认用仓库规范化后的 `origin` URL 推导一个 peer 来标记记忆,所以同一仓库的所有 clone 共用一个 peer。不在仓库中时不发送 peer,记忆进入用户自己的空间。可以用 `peer.source` 和 `.openviking/config.json` 修改,见[工作区 peer](../configuration/02-client.md#工作区-peer)。OpenClaw 根据 `peer_role` 和 `peer_prefix` 推导 peer;`peer_role=sender` 时,如果宿主没有提供发送者,工具调用会失败。Hermes 默认不设助手 peer,除非由 `OPENVIKING_AGENT`、关联的 OpenViking peer 或 YAML 的 `agent` 键设置。Agent Plugins 不发送 peer。-- **集成文档**:[TRAE 记忆集成](./13-trae.md)-- **形态**:配置驱动(`~/.trae{,-cn}/hooks.json` + 平台相关 mcp.json)+ MCP 代理。4 hook:SessionStart(30s) / UserPromptSubmit(20s) / PreToolUse:Read\|Glob\|Grep\|Bash\|RunCommand(5s) / Stop(30s)。PreToolUse 对路径是 `viking://` URI 的 Read/Glob/Grep 直接拒绝;Bash/RunCommand 命令带 `viking://` URI 时照常执行,并附加提示。相对 import 共享 lib。MCP server 名为 `openviking`。版本 0.5.0。-- **能力亮点**:行为最简单直接的一档——每个有内容的 Stop 都 commit(keep 0),关闭场景下最大待归档量只有最后一轮 in-flight([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵))。-- **行为要点**:trae 与 trae-cn 的差异是 session id 前缀 `tr-` / `trcn-` 与安装路径——同一份记忆在两个客户端落到两组不同 session,跨客户端共享靠服务端抽取后的记忆空间而非 session 复用;无 PreCompact/statusline/skill/subagent 处理。-- **配置**:env + ovcli.conf `plugin.trae` / `plugin.trae_cn` + workspace 文件。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵)。+只对部分集成生效的设置:-## zcode+- `OPENVIKING_COMMIT_TURN_THRESHOLD`:Cursor 和 Kimi Code。TRAE、TRAE CN 和 ZCode 每轮都提交。+- `OPENVIKING_WRITE_PATH_ASYNC`:Claude Code、Codex 和 ZCode。+- `OPENVIKING_RECALL_COMPRESS=client`:Claude Code 和 Codex。`server` 和 `auto` 适用于[召回摘要](#召回摘要)中列出的所有集成。+- 工作区文件、`ovcli.conf` 的 `plugin` 段、`OPENVIKING_RECALL_DEDUP_TURNS`、`OPENVIKING_RECALL_QUERY_EXPANSION`、`OPENVIKING_PEER_SOURCE` 和 skill 清单相关设置:所有基于共享插件代码的集成,不包括 OpenClaw 和 Hermes。-- **集成文档**:[社区插件 → ZCode](./08-community-plugins.md)-- **形态**:配置驱动(合并进 `~/.zcode/cli/config.json`,强制 `hooks.enabled=true`)+ MCP 代理。4 hook:SessionStart(30s) / UserPromptSubmit(20s) / PreToolUse:Read\|Glob\|Grep(5s) / Stop(30s)。自身不 vendoring 任何共享模块:安装器按 cursor / trae 同样的方式为它拼装共享运行时。版本 0.5.0。-- **能力亮点**:以 rollout 文件 `~/.zcode/cli/rollout/model-io-<sid>.jsonl` 为增量真相源(`lastTurnId` 差集补齐漏掉的 Stop);Stop 默认 detach;已启动的 worker 可在终端收到 Ctrl+C 后继续写入,仍可能因网络错误或进程被终止而失败。-- **行为要点**:每 Stop commit(keep 0);捕获路径仅剥离三类注入块(不做额外文本清洗,[§3.2.6](#_3-2-6-注入回流防护));首次捕获会一次性读取整个 rollout(长会话首装时单次推送量大)。-- **配置**:env + ovcli.conf `plugin.zcode` + workspace 文件;`OPENVIKING_WRITE_PATH_ASYNC` 对 zcode 生效。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵)。+<a id="_3-7-附加-ux-对照"></a>-## kimicode+## 其他宿主功能-- **集成文档**:[社区插件 → Kimi Code](./08-community-plugins.md)-- **形态**:原生 managed plugin,包含 7 个 hook 和 MCP 代理。安装器在 `$KIMI_CODE_HOME/plugins/managed/openviking-memory` 下组装一份自包含副本,不向仓库提交 Kimi 的共享运行时副本。版本 0.5.0;已在 Kimi Code CLI 0.43.1 契约上验证。-- **能力亮点**:`wire.jsonl` 作为稳定的增量回合来源;profile 在 prompt hook 上重试,直到首次成功。Stop、PreCompact 和 SessionEnd 可 detached;Interrupt 保持同步,所有 OpenViking 请求共用 2 秒总预算。-- **行为要点**:UserPromptSubmit 输出原始上下文文本,不输出 JSON 字符串。只有在发送成功或已持久化入队后才推进增量游标。安装时保留其他插件记录,不修改旧式 `config.toml` 或 `mcp.json`。-- **配置**:env + ovcli.conf `plugin.kimicode` + workspace 文件。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |降级 [§3.6](#_3-6-降级与容错)。+| 集成 | 状态栏 | 命令 | 附带的 skill | 配置向导 |+|---|---|---|---|---|+| Claude Code | 有 | `/openviking-memory:ov` 显示服务端状态、身份和注入内容的来源 | `openviking-memory`、`openviking-skills`、`ov-experience-memory`、`ov-memory-doctor` | 有 |+| Codex、TraeCode CLI 2.0 | 无 | 无 | 与 Claude Code 相同的四个 | 有 |+| Cursor | 无 | 无 | 一条常驻 rule,加上 `openviking-memory`、`openviking-skills`、`ov-experience-memory` | 安装器菜单 |+| TRAE、TRAE CN、ZCode | 无 | 无 | 无 | 安装器菜单 |+| OpenCode | 无 | 无 | 与 Cursor 相同的三个,仅在插件注册自己的 MCP 服务时提供 | 有 |+| DSH | 无 | 无 | 与 Cursor 相同的三个 | 无 |+| pi | 有 | `/viking`、`/viking commit` | 与 Cursor 相同的三个,`mcpEnabled` 为 `false` 时不提供 | 有 |+| OpenClaw | 无 | `/add-resource`、`/add-skill`、`/ov-search`、`/ov-query-config`、`/ov-recall-trace` | 三个插件 skill | 有;检查 key 的角色和版本兼容性 |+| Hermes(内置) | 无 | 无 | 无 | 有;`hermes memory status` 列出环境变量覆盖项 |+| ov CLI | 无 | CLI 本身 | 无 | `ov config` |-## opencode+Claude Code、Codex、Cursor、TRAE、ZCode、Kimi Code、DSH 和 pi 还会安装 **URI guard**:文件工具的路径是 `viking://` URI 时,调用会被拒绝,并提示改用 OpenViking 工具;shell 命令中包含这种 URI 时照常执行,但附带一条提示。各宿主检查哪些工具不同,见[各集成说明](#各集成说明)。-- **集成文档**:[OpenCode 插件](./10-opencode.md)-- **形态**:npm 插件 `@openviking/opencode-plugin` 0.5.0,同一入口支持 OpenCode v1 ≥1.15.7 与 v2 ≥2.0.15。v1 保留原有 hooks;v2 使用 `setup(ctx)`、prompt/context/tool hooks 和结构化生命周期事件。MCP 工具保持 `openviking_*` 前缀,v2 显式设置 `codemode:false`。附带 3 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`):v1 在 `config` hook 里把插件的 `skills/` 目录加进 `skills.paths`,v2 用 `skill.transform` 注册;两者都只在插件注册自己的 OpenViking MCP server 时加入(hook-only 模式或关闭 `mcp.openviking` 时不加)。-- **能力亮点**:v2 在 prompt hook 只召回一次并把上下文存进用户消息 metadata,后续每个模型 step 注入同一份内容,避免重复请求和 prompt cache 失效;execution 结束后通过 `session.context()` 捕获完整的用户、助手和工具消息。repo 列表继续进入 system prompt([§3.2.3](#_3-2-3-profile-开场注入))。-- **行为要点**:`commitTokenThreshold=20000`,commit 超时 30000ms。v2 在每次 execution 结束(succeeded、failed、interrupted)后按阈值提交,session 删除、compaction ended 和 cleanup 时强制提交;failed 与 interrupted 都保留状态。v2 只处理本 location 的 session,捕获游标存放在插件 storage 中。v2 cleanup 会在 60 分钟无活动、服务停止和本地插件热重载时触发;v2 没有 toast API,只写日志。开场注入每会话尝试一次([§3.2.3](#_3-2-3-profile-开场注入))。-- **配置**:env + ovcli.conf `plugin.opencode` + workspace 文件。-- **维度索引**:工具面 [§2.1](#_2-1-服务端-mcp-工具面) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |subagent [§3.3.5](#_3-3-5-subagent-会话对照)。+<a id="_4-harness-档案卡"></a>-## dsh(DeepSeek Harness)+## 各集成说明-- **集成文档**:[DSH 插件](./17-dsh.md)+这里只写每个集成特有的内容,共享行为见上文各节。-- **形态**:唯一同进程 Cordis 原生插件(`export function apply`),工具面就是服务端的 MCP 面,经 `@deepseek-ai/dsh-mcp-client` 与共享 stdio 代理接入(以 `mcp__openviking__*` 发布),hook 侧 REST 直连。6 事件:agent/session-start(emit)/ agent/pre-step(waterfall)/ session/event / session/flush / tools/pre-execute / tools/post-execute。版本 0.5.1。-- **能力亮点**:`ctx.provide("openvikingMemory")` 供其他 Cordis 插件二次开发;pre-step 注入走 user 消息,适配 DSH persona 的 `complete:true` 渲染模式。-- **行为要点**:统一安装器已覆盖 dsh,默认装到 `web` profile,可用 `--dsh-profile` 指定其他 profile;npm 是该插件唯一的分发渠道,因此除 `dev` 外的模式一律装已发布的包;`dev` 会先把 checkout 打包再装——`dsh plugin` 转发给 pnpm,link 一个源码目录无法解析插件 import 的 dsh peer;teardown commit 3s 无阈值,SIGHUP/二次 Ctrl+C 不触发([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵));compaction 不感知(注入内容随宿主压缩收缩,profile 不重投);subagent 各自独立会话([§3.3.5](#_3-3-5-subagent-会话对照));工具面即服务端自身的 MCP 面,经与其他集成同一个 stdio 代理接入、以 `mcp__openviking__*` 发布,服务端升级即可增加工具而无需发版;代价是代理每个 profile 只起一个进程,因此工具调用带的是进程级 actor peer、`remember` 也不绑当前会话(召回/捕获/commit 仍按会话解析 peer);另随包附带共享的 `openviking-memory`、`openviking-skills` 与 `ov-experience-memory` 三个 skill,默认捕获工具结果(`captureToolResults: true`),因此 `ov-experience-memory` 能跑完整 Experience 闭环,关闭后只检索和应用;uri-guard 先把工具名转成小写再匹配,tools/pre-execute 拒绝路径是 `viking://` URI 的文件工具(针对 skill URI 的 write/edit 会被引导到 `mcp__openviking__add_skill`),bash 命令带 `viking://` URI 时由 tools/post-execute 附加提示(`form: "notice"`)。-- **配置**:env + ovcli.conf `plugin.dsh` + workspace 文件 + cordis patch(行为旋钮的最低层);凭据是例外,patch 里写的 endpoint / key / account / user / peer 仍然压过凭据链。-- **维度索引**:工具面 [§1.1](#_1-1-主动工具面-agentic-调用能力) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |降级 [§3.6](#_3-6-降级与容错)。+### Claude Code-## pi(pi Coding Agent Extension)+[Claude Code](./02-claude-code.md)。插件市场插件,包含 9 个 hook、一个 MCP 代理、一个斜杠命令、状态栏和 4 个 skill。-- **集成文档**:[pi Coding Agent 扩展](./11-pi.md)-- **形态**:pi 原生扩展(目录装载,jiti 直译 TS)。扩展使用 `@modelcontextprotocol/client`,把服务端 `tools/list` 的每个描述符注册成名为 `openviking_<tool>` 的 pi 工具,当前 20 个([§2.1](#_2-1-服务端-mcp-工具面))。扩展里没有任何工具目录,服务端增删工具,pi 下一次会话即跟上,不需要发插件版本。召回、会话同步、profile 注入与 takeover 仍走 REST。9 事件 + `/viking` 命令;tool_call 拦截路径是 `viking://` URI 的 read/grep/find/ls/write/edit,bash 命令带 `viking://` URI 时,tool_result 在结果末尾追加提示。经 `resources_discover` 附带 3 个 skill(`openviking-memory`、`openviking-skills`、`ov-experience-memory`),`mcpEnabled` 为 `false` 时不加入。版本 0.4.1。-- **能力亮点**:takeover 压缩接管(默认开,[§3.4.2](#_3-4-2-pi-takeover));两段式召回(before_agent_start 排队 + context 事件同步检索,当前轮 prompt 拿当前轮记忆);statusline;支持的正常退出路径会 await `session_shutdown`;`kill -9` 等强制终止不会执行 handler。-- **行为要点**:默认 takeover 下退出不 commit(handler 持久化本地状态,归档靠下次续跑攒满阈值或 `/viking commit`,[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵));takeover 阈值 30000 token + 保留 3 轮(keep 3,服务端按消息条数解释);非 takeover 阈值 20000/keep 10、退出无条件 commit;工具注册需 health、ensureSession 与 `/mcp` 握手三项前置([§1.1](#_1-1-主动工具面-agentic-调用能力)),ROOT 角色的 API key 访问 `/mcp` 会被 403 拒绝,凭据链最终落到 `ov.conf` 的 `server.root_api_key` 时本次会话就没有工具——0.4.0 之前是 REST 工具照常注册、每次调用静默返回 "No results found.";`openviking_remember` 走 MCP 面,即自建一次性会话并立即提交,不再并入 pi 的会话([§2.1](#_2-1-服务端-mcp-工具面));`openviking_add_resource` 可直接摄取远端 URL,本地路径则由服务端返回一条上传指引,需要模型用 `bash` 把文件 POST 上去,与其他 MCP harness 一致;`openviking_read` 读取文件正文,支持按行分页(`offset`/`limit`),目录 URI 会得到 `Cannot render …: URI points to a directory`,旧的 `level="abstract"/"overview"` 两档在 MCP 面没有对应工具,替代路径是 `openviking_search(mode="context", detail="overview")` 或 `openviking_tree(include_abstract=true)`,takeover 的归档 overview 仍由扩展自己经 REST 注入;单次工具调用受共享的 `timeoutMs` 约束(15000ms,`OPENVIKING_TIMEOUT_MS` 可调),`write`/`edit` 带 `wait=true` 或 `add_resource` 同步 ingest 有可能超过,而超时或 ESC 只让本地调用失败,已经发出的请求会跑完,写入仍可能已经生效;从 0.3.x 升级时全部工具改名且没有别名期,`--tools` / `--exclude-tools` 白名单里写死的 `viking_*` 必须手工替换,否则工具会静默消失;非 takeover 模式下 `pi -c` 续跑会重新上报整条 branch。-- **配置**:env + ovcli.conf `plugin.pi` + workspace 文件(凭据统一走凭据链,[§3.1.3](#_3-1-3-凭据体系));bypass 走共享 `isBypassed` 的 glob 匹配,键名 `bypassSessionPatterns`(旧名 `bypassPatterns` 仍可读);共享键 `mcpEnabled: false` 现在对 pi 也生效:不发起桥接、不注册工具,`/viking` 标注成配置而非故障。-- **维度索引**:工具面 [§1.1](#_1-1-主动工具面-agentic-调用能力) |召回 [§3.2](#_3-2-自动召回与注入) |takeover [§3.4.2](#_3-4-2-pi-takeover) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵)。+- 注册的 hook 比其他集成都多:`SessionStart`、`UserPromptSubmit`、`PostToolUse:Read`(skill 经验 hook,默认关闭)、作用于 Read、Glob、Grep、Edit、Write 和 Bash 的 `PreToolUse`(URI guard)、`Stop`、`PreCompact`、`SessionEnd`、`SubagentStart` 和 `SubagentStop`。+- 召回摘要默认通过本地 `claude -p` 生成,服务端摘要作为回退。+- 除 `kill -9` 外,所有退出方式都会发出提交。+- 捕获游标保存在 `/tmp` 下。系统清理后,整个会话会重新发送。+- 插件自身的开关关闭时,URI guard 仍然运行。-## openclaw+<a id="codex"></a><a id="trae-cli-traecode-cli-2-0"></a>-- **集成文档**:[OpenClaw 插件](./03-openclaw.md)-- **形态**:唯一 context-engine 全接管型(`ownsCompaction:true`)。15 原生工具(默认开 14)+ 5 slash + 4 hook + Gateway HTTP 路由 + feature-gate RPC。remote-only。版本 2026.6.18。-- **能力亮点**:检索拆两个默认不重叠入口——`memory_recall` 默认搜 memory、`ov_search` 默认搜 resource+user skills(都可显式参数越界);`add_skill` 默认开;`memory_forget` memory-only 白名单([§3.5](#_3-5-写入与删除的类型边界));三个 tool-result 工具读服务端外置输出(跨会话 guard);ContextEngine 全接管([§3.4.3](#_3-4-3-openclaw-contextengine));setup 向导带 key 角色探测与版本兼容检查。-- **行为要点**:召回走 `/find` 不带 session_id(expansion/去重台账不参与,长会话中同一记忆可能重复注入);关闭不触发 commit,归档依赖显式 `/new`/`/reset` 与 ~50% 阈值([§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵));无本地 pending queue(失败轮次不重放);`compact()` 最长阻塞 5 分钟;召回默认对每条 leaf 记忆多一次 read(`recallPreferAbstract=false`);配置严格校验,存在未知键/非法值时插件进入 setup-only 模式。-- **配置**:`openclaw.json` 的 `plugins.entries.openviking.config` + 少量 env;认证头 `X-API-Key`([§3.1.3](#_3-1-3-凭据体系));commit 阈值由 `commitTokenThresholdRatio` 控制(默认 0.5);召回字符预算 4000。-- **维度索引**:工具面 [§1.1](#_1-1-主动工具面-agentic-调用能力) |召回 [§3.2](#_3-2-自动召回与注入) |ContextEngine [§3.4.3](#_3-4-3-openclaw-contextengine) |删除 [§3.5](#_3-5-写入与删除的类型边界) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵)。+### Codex 与 TraeCode CLI 2.0-## hermes(Nous Research)+[Codex](./04-codex.md)、[TRAE](./13-trae.md)。插件市场插件,包含 6 个 hook(`SessionStart`、`UserPromptSubmit`、`PreToolUse:Bash`、`Stop`、`SessionEnd`、`PreCompact`)、一个 MCP 代理,以及与 Claude Code 相同的 4 个 skill。-- **集成文档**:[Hermes Agent](./05-hermes.md)-- **形态**:通过 HTTP 连接的内置 `MemoryProvider`,提供 6 个 `viking_*` 工具。OpenViking 运行于独立服务端环境。外部插件独立维护;范围区别见本文开头。-- **记忆写入**:`viking_remember` 将原始事实送入独立会话并提交,触发异步抽取;返回 `status: submitted`,最终可能新增、合并或跳过。内置 provider 只镜像原生记忆新增;外部插件还支持按 URI 映射替换和删除,详见其 README。-- **召回**:同步 query 召回优先使用带 session_id 的 `search/search`,降级至 `/find`。`queue_prefetch` 不做预热。会话开场注入用户 profile 和 preferences/entities 清单,默认预算 6000 token。Query 召回默认 6 条、阈值 0.15、4000 字符、总超时 4s/单请求 3s,均可配置。-- **生命周期**:commit 保留 0 条消息。上传线程不落盘,但待提交标记支持 POSIX 上的崩溃恢复。正常退出和信号会尝试 drain 与 commit,网络故障或强制终止仍可中断。`skip_memory=True` 的委派子代理不加载 provider;无 statusline 或 provider slash 命令。-- **路径与配置**:记忆写入 `viking://user/<uid>/memories/...`,设置 peer 时写入 `viking://user/<uid>/peers/<peer>/memories/...`。默认不设置助手 peer。连接读取 `OPENVIKING_ENDPOINT`、profile 凭据、关联的 `ovcli.conf` 和 Hermes YAML;关联 OpenViking profile 时会清除 Hermes `.env` 中的 5 个连接变量。-- **维度索引**:工具面 [§1.1](#_1-1-主动工具面-agentic-调用能力) |召回 [§3.2](#_3-2-自动召回与注入) |commit [§3.3.2](#_3-3-2-常规-commit-触发条件)/[§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵) |删除 [§3.5](#_3-5-写入与删除的类型边界)。+- `SessionEnd` 只在干净退出且 Codex 0.145 及以上时触发。信号、崩溃、旧版本和 `codex app-server` 延后的情况都交给启动时的扫描,扫描使用 30 分钟空闲超时。+- `Stop` 和 `SessionEnd` 在分离的 worker 中写入。每个会话一把锁,按顺序处理 `Stop` worker、`PreCompact`、`SessionEnd` worker 和扫描。+- Codex 用 `apply_patch` 编辑文件,它没有路径参数,所以 Bash 上的 URI guard 只附加提示,从不拒绝。+- Codex 为每个 hook 保存信任记录。升级新增 hook 后,需要在 `/hooks` 中批准新的 hook。+- TraeCode CLI 2.0(可执行文件 `traecli`,配置 `~/.trae/traecli.toml`)是 Codex 系 CLI,安装同一个插件。只支持 2.0;早期面向 1.0 的独立插件已移除,`--harness trae-cli --uninstall` 仍可删除旧安装留下的副本。不带 `SessionEnd` 的版本会忽略该 hook。-## ov CLI+### Cursor-- **集成文档**:[部署指南 → CLI](../guides/03-deployment.md#cli)-- **形态**:Rust 原生二进制,把服务端 REST 包成命令行;无宿主事件、无自动召回、不接管压缩。-- **能力亮点**:提供 `auto_commit_policy` 的命令行入口(`ov session new --auto-commit-policy-json`、`ov session config set`);提供多 profile、admin、privacy、snapshot、TUI 等插件面没有的能力(详见 [§5.3](#_5-3-cli-独有于插件面的能力))。-- **维度索引**:完整命令参考请见 [§5](#_5-ov-cli-命令参考)。+[Cursor](./12-cursor.md)。hook 与 MCP 配置,包含 6 个 hook(`sessionStart`、`beforeSubmitPrompt`、`beforeReadFile`、`stop`、`preCompact`、`sessionEnd`)、一条常驻 rule 和 3 个 skill。----+- URI guard 只在 `beforeReadFile` 运行,不受插件开关影响。shell 命令不检查,升级会移除旧版本注册的 `beforeShellExecution` 条目。+- 只捕获文本,所以 `ov-experience-memory` 能检索和应用 Experience,但无法把读取关联回所用的 Experience。+- `sessionEnd` 只在关闭窗口时触发,此时 Cursor 已停止执行 hook 命令,因此实际不会提交。+- 服务端不可达时,每轮都要等满 15 秒召回超时。-# 5. ov CLI 命令参考+<a id="trae-trae-cn-ide-版"></a>-`ov`(clap 内部名 `openviking`)是 Rust HTTP 客户端,大多数数据操作通过服务端 REST API 完成;CLI 还负责本地打包上传、配置校验、密钥生成、输出渲染与多 profile 管理。它不是 harness 集成——没有宿主事件、不自动召回、不接管压缩;本章覆盖它作为"人/脚本直接使用 OV"的完整命令面,以及它独有于插件面的能力(TUI、多 profile、admin、`--sudo`、privacy、snapshot 等)。+### TRAE 与 TRAE CN-> 版本说明:以 HEAD 源码为准(HEAD tag 已到 `[email protected]`),0.4.10 等旧版本的差异处已标注。需要注意的是,`ov doctor` 不在 Rust 二进制里——pip 装的 Python wrapper 会拦截 `argv[1]=="doctor"` 并走 `openviking_cli.doctor`,读取的是服务端 `ov.conf` 而非 `ovcli.conf`;npm/cargo 装的纯 Rust `ov` 无该子命令。+[TRAE](./13-trae.md)。hook 与 MCP 配置,包含 4 个 hook:`SessionStart`、`UserPromptSubmit`、`PreToolUse` 和 `Stop`。MCP 服务名为 `openviking`。-## 5.1 命令树+- `PreToolUse` 拒绝对 `viking://` 路径执行 Read、Glob 和 Grep;Bash 和 RunCommand 命令中包含这种路径时附加提示。+- 每个有内容的 `Stop` 都会提交,退出时最多丢失正在进行的那一轮。+- TRAE 和 TRAE CN 只有会话前缀和安装路径不同。同样的工作在两个客户端中会产生不同的会话,要等抽取完成后才共享记忆。+- 不处理压缩,没有状态栏和 skill,也不单独处理子代理。-命令 doc-comment 前缀 `[Data]`/`[Interactive]`/`[Admin]`/`[Experimental]` 等只影响 help 渲染,不影响运行时——即使是 `[Experimental]` 命令,默认也可用。+### ZCode-**数据写入**:`add-resource`(支持本地文件/目录/URL/Git/sitemap/RSS;目标 `--to`/`--parent`/`-p` 三选一;manifest 模式 `-m`;Connector `--add-type`;注意本地路径 + watch>0 会报错)|`add-skill`|`write`(`--content`/`--from-file` 互斥)|`mkdir`|`rm`(别名 del/delete,无确认提示,`-r` 显式递归)|`mv`(别名 rename)|`set-tags`(顶层隐藏,用 `attrs set-tags`)|`add-memory`(实验性;执行逻辑为建 session → 批量 add → commit 三步串行)+[社区插件:ZCode](./08-community-plugins.md#zcode-记忆集成)。hook 与 MCP 配置,包含 4 个 hook:`SessionStart`、`UserPromptSubmit`、作用于 Read、Glob 和 Grep 的 `PreToolUse`,以及 `Stop`。-**读取/检索**:`ls`(别名 list)|`tree`(`-L` 默认 3)|`stat`/`attrs get`|`read`/`abstract`/`overview`(分别对应 L2/L0/L1)|`get`(下载)|`find`(query 或 `--image` 至少一个非空;`--image` 支持本地路径、data URI、http、viking://)|`search`(实验性,比 find 多一个 `--session-id`)|`grep`|`glob`+- 捕获的轮次来自 rollout 文件 `~/.zcode/cli/rollout/model-io-<sid>.jsonl`;漏掉的 `Stop` 对应的轮次在下一个 `Stop` 补齐。+- 第一次捕获读取整个 rollout,所以在长时间运行的会话中安装会产生一次大上传。+- 捕获只去掉注入块,不做其他文本清理。+- `Stop` 默认在分离的 worker 中写入。-**Skills**:`skills add`(支持本地路径、git 及 GitHub tree URL,`-s` 选装、`*` 全装,有交互确认)|`skills list/find/show/update/remove`|`skills validate`(本地校验,不请求服务端)+<a id="kimicode"></a>-**会话/记忆**:`session new`(`--auto-commit-policy-json` 与 `--no-auto-commit` 互斥;SDK 和 HTTP API 也支持设置 policy)|`session list/get/delete`|`session get-session-context`(`--token-budget` 默认 128000)|`session get-session-archive`|`session add-message(s)`|`session config set`(改可变配置)|`session commit`+### Kimi Code-**导入导出/快照**:`export`/`backup`/`import`/`restore`(.ovpack)|`snapshot commit/restore/show/log/diff/ignore-*`(工作区快照,前向 commit 回滚)+[社区插件:Kimi Code](./08-community-plugins.md#kimi-code-记忆集成)。Kimi Code 托管插件,包含 7 个 hook(`SessionStart`、`UserPromptSubmit`、作用于 Read、Glob 和 Grep 的 `PreToolUse`、`Stop`、`PreCompact`、`SessionEnd`、`Interrupt`)和一个 MCP 代理。安装器在 `$KIMI_CODE_HOME/plugins/managed/openviking-memory` 下构建一份自包含的副本。-**隐私**:`privacy categories/list/get/versions/version/activate/upsert`(`--key-<name>` 语法糖)+- 捕获的轮次来自 `wire.jsonl`。一轮对话只有在发送成功或存入离线队列后才会推进游标。+- 会话开场上下文在首次提问时注入,失败后在后续提问中重试,直到成功。+- `Stop`、`PreCompact` 和 `SessionEnd` 可以在后台写入。`Interrupt` 保持同步,请求预算 2 秒。+- `UserPromptSubmit` 返回纯文本上下文,不是 JSON。+- 安装时保留其他插件记录,不修改旧的 `config.toml` 或 `mcp.json`。-**状态/可观测**:`health`(healthy=false 时仍退 0)|`status`(表格模式始终退 0)|`observer {queue,vikingdb,models,retrieval,filesystem,system}`|`wait`|`task status/cancel/list`|`task watch {ls,show,rm,pause,resume,update,trigger}`|`version`(独立 3s 超时探服务端)+### OpenCode-**配置/交互**:`config`(TUI 向导,5 项菜单含 User Management)|`config show`(固定 json+compact 输出)|`config validate`|`config list/switch/add/edit/delete`(面向 Agent,退出码 2-6 语义化)|`config add ov-service`(云)/`config add custom`|`language`(别名 lang)|`tui`(全屏文件浏览器 + 终端内图片预览 + 向量视图 + 删除确认)|`chat`(VikingBot,300s 超时)|`compile`(用 Skill 整理素材,`--wait` 本地轮询)+[OpenCode](./10-opencode.md)。npm 插件 `@openviking/opencode-plugin` 用同一个入口支持 OpenCode v1(1.15.7 及以上)和 v2(2.0.15 及以上)。-**管理(多为 ROOT/`--sudo`)**:`admin create-account/list-accounts/delete-account/set-role/migrate/register-user/list-users/remove-user/regenerate-key`|`system wait/status/health/consistency`|`system crypto init-key`(纯本地生成 32 字节 root key,权限 0600)|`system backend sync-status/sync-retry`|`reindex`(`--mode` 默认 vectors_only;`--wait` 默认 true,全 CLI 唯一)|`doctor`(仅 Python wrapper)+- v2 每次提问只召回一次,把结果存进用户消息的 metadata;后续模型 step 直接复用,不发新请求,prompt 缓存因此保持稳定。每次执行结束时,v2 读取完整的用户、助手和工具消息用于捕获。+- v2 在每次执行结束后检查提交阈值,包括失败和被中断的执行,这些执行会保留状态。v2 只处理本 location 的会话,游标存在插件 storage 中。v2 没有 toast API,改为写日志。+- MCP 工具保留 `openviking_` 前缀;v2 设置 `codemode: false`。3 个 skill 只在插件注册自己的 MCP 服务时加入,hook-only 模式或关闭 `mcp.openviking` 时不加入。+- 提交超时 30 秒。-## 5.2 全局选项与独有机制+<a id="dsh-deepseek-harness"></a>-- `-o/--output table|json`(默认取 conf `output`)|`-c/--compact`(默认 true)|`--account`/`--user`/`--actor-peer-id`|`--sudo`(用 root_api_key,只允许 admin/system/reindex/task status/task list)|`--profile`(隐藏)-- **多 profile**:active 为 `~/.openviking/ovcli.conf`,命名配置为 `ovcli.conf.<name>`。编辑和重命名保留 `plugin` 等额外顶层字段。切换时替换连接配置;新配置若显式提供 `plugin`,则采用该段,否则保留 active 文件原有的 `plugin`。-- **语言门禁**:跑任何命令前要求先存显示语言(未存 + 非交互 → exit 2);HEAD 起 `--help` 在门禁前豁免(0.4.10 尚无此豁免),但 `--version` 仍需先过门禁。-- **三种 JSON 输出格式(按命令组不同)**:普通命令 compact 下输出 `{"ok":true,"result":…}`,`-c false` 输出裸 payload,失败输出 `{"ok":false,"error":…}`;config 系为 `{"status":"ok","result":…}`;带 profile 时追加 `"profile":[…]`。脚本解析时需注意;此外 `echo_command` 默认 true 且不受 `-o json` 抑制(stdout 第一行是 `cmd: …`)。-- **env**:`OPENVIKING_CLI_CONFIG_FILE`、`OPENVIKING_UPLOAD_MODE`(local/shared)、`OPENVIKING_ASSETS_CREDENTIALS_FILE`、`OPENVIKING_LANG`/`LC_*`/`LANG`,以及 chat 用的 `VIKINGBOT_ENDPOINT`/`VIKINGBOT_API_KEY`/`OPENVIKING_URL`。+### DSH-## 5.3 CLI 提供的其他能力 {#_5-3-cli-独有于插件面的能力}+[DeepSeek Harness](./17-dsh.md)。唯一的同进程 Cordis 插件。hook 直接调用 REST API;工具通过 `@deepseek-ai/dsh-mcp-client` 和共享的 stdio 代理接入。-相比记忆插件,CLI/TUI 还提供以下操作入口;其中服务端能力也可通过相应的 HTTP API 或 SDK 调用:多 profile 切换与向导、`admin` 全套账号/用户管理、`--sudo` root 操作、`privacy` 隐私策略 CRUD + 版本、`snapshot`/`backup`/`restore`/`export`/`import` 数据搬运、`reindex` 重建索引、`system crypto init-key` 生成 root key、`ov tui` 交互浏览、依赖 VikingBot 能力的 `ov chat`/`ov compile`,以及 `ov session config set` 显式设 `auto_commit_policy`。SDK 和 HTTP API 也支持设置该策略。+- 监听 `agent/session-start`、`agent/pre-step`、`session/event`、`session/flush`、`tools/pre-execute` 和 `tools/post-execute`。+- `ctx.provide("openvikingMemory")` 让其他 Cordis 插件可以在它之上构建功能。+- 安装器默认使用 `web` profile,可以用 `--dsh-profile` 指定其他 profile。除 `dev` 外的所有模式都安装已发布的 npm 包。+- 默认捕获工具结果(`captureToolResults: true`),所以 `ov-experience-memory` 能完整运行;关闭捕获后,只能检索和应用 Experience。+- URI guard 先把工具名转成小写,在 `tools/pre-execute` 拒绝对 `viking://` 路径的文件工具调用,在 `tools/post-execute` 为包含这种路径的 `bash` 命令附加提示。+- Cordis patch 中写明的凭据优先于其他所有来源;对行为配置来说,patch 是优先级最低的一层。----+<a id="pi-pi-coding-agent-extension"></a>-# 6. 自定义 agent 接入指南+### pi-如果你使用的 agent/harness 不在上面 11 家里,可以参考以下三条接入路径(按投入成本从低到高排列)。+[pi](./11-pi.md)。原生扩展,包含 9 个事件处理器和 `/viking` 命令。召回、同步、会话开场上下文和 takeover 使用 REST;工具使用 pi 内置的 MCP 客户端。-## 6.1 接入路径 × 能获得的能力+- 工具就是服务端 `tools/list` 返回的内容,重命名为 `openviking_<tool>`。服务端增删工具后,pi 在下一个会话生效,不需要扩展发版。+- 从 0.3.x 升级时,所有工具都从 `viking_*` 改了名,没有别名过渡期。请更新 `--tools` 或 `--exclude-tools` 列表,否则工具会静默消失。+- `openviking_read` 返回文件内容,支持 `offset` 和 `limit`。目录 URI 会返回错误。旧的 `level="abstract"` 和 `"overview"` 读取在 MCP 中没有对应工具,可改用 `openviking_search(mode="context", detail="overview")` 或 `openviking_tree(include_abstract=true)`。+- 工具调用 15 秒超时(`OPENVIKING_TIMEOUT_MS`)。超时或按 ESC 只让本地调用失败,已发出的请求会继续执行,写入仍可能生效。+- `tool_call` 拒绝对 `viking://` 路径执行 read、grep、find、ls、write 和 edit;`tool_result` 为包含这种路径的 `bash` 输出附加提示。+- takeover 关闭时,用 `pi -c` 恢复会话会重新发送整个 branch。+- bypass 使用 `bypassSessionPatterns`;旧的 `bypassPatterns` 仍然有效。-| 路径 | 投入 | agent 主动工具面 | 自动召回/捕获 hook | 会话/commit | 压缩接管 |-|---|---|---|---|---|---|-| ① [通用 MCP 直连](./06-mcp-clients.md) | 分钟级:配置连接地址、凭据与传输方式 | ✅ 20 工具全量 | ❌ 由模型主动调用 | 仅 `remember` 建临时会话 | ❌ |-| ② HTTP API / SDK / [LangChain](./07-langchain-langgraph.md) | 小时级:编写调用代码和生命周期处理 | 自选(按需调 REST) | 自己实现 | 自己实现(或用 LangChain middleware) | ❌ |-| ③ 复用 shared-core | 天级:适配并验证宿主生命周期事件 | ✅ 20 工具(经 MCP 代理) | ✅ 召回/捕获/commit/pending 全套 | ✅ | 视接入哪些事件而定 |-| [Agent Plugins 便携包](./15-agent-plugins.md) | 分钟级:安装 MCP 与 skill 配置 | ✅ 服务端 MCP 工具 | ❌ 依赖模型按 skill 调工具 | 仅 `remember` 建临时会话 | ❌ |+### OpenClaw++[OpenClaw](./03-openclaw.md)。接管压缩的 context-engine 插件,包含 15 个工具、5 个斜杠命令、生命周期 hook、Gateway HTTP 路由,以及受功能开关控制的 RPC 方法。++- `memory_recall` 检索记忆,`ov_search` 检索资源和用户的 skill;通过显式参数,两个工具都能查另一类内容。+- 召回通过 `/find` 进行,不带会话 ID,所以没有查询扩写和去重,长会话中同一条记忆可能被重复注入。默认每条召回的记忆多一次 read(`recallPreferAbstract=false`)。+- 退出不提交。归档依赖 `/new`、`/reset` 和阈值。没有离线队列,失败的轮次不会重发。+- `compact()` 最多可能阻塞 5 分钟。+- 配置严格校验:有未知键或非法值时,插件进入 setup-only 模式。+- 提交阈值是 `tokenBudget`(默认 128,000)乘以 `commitTokenThresholdRatio`(默认 0.5)。++<a id="hermes-nous-research"></a>++### Hermes++[Hermes](./05-hermes.md)。Hermes 有两个 OpenViking memory provider,都以 provider 名 `openviking` 注册:++- **内置 provider** 位于 Hermes 的 `plugins/memory/openviking`,无需安装,用 `hermes memory setup openviking` 配置。本页的 Hermes 行描述的是 [Hermes 提交 `989798c`](https://github.com/NousResearch/hermes-agent/tree/989798cd5e691230b54b2ea72e5937b68133014c/plugins/memory/openviking) 时的内置 provider。+- **外部插件**在本仓库的 [`examples/hermes-plugin`](https://github.com/volcengine/OpenViking/tree/main/examples/hermes-plugin) 维护,用 `hermes plugins install` 安装。据其 README,仍内置该 provider 的 Hermes 版本会加载内置副本,外部插件要在内置副本移除后才生效。配置和已存数据可以沿用。-## 6.2 路径①:通用 MCP 直连(推荐起步)+两者是独立的代码库。行为差异如下:-支持 Streamable HTTP 的 MCP 客户端可以连接服务端 `/mcp`。下面展示使用 `mcpServers`、`url` 和 `headers` 字段的客户端配置;其他客户端的字段和格式见 [MCP 客户端](./06-mcp-clients.md)。连接后可发现服务端提供的工具([§2.1](#_2-1-服务端-mcp-工具面))。+| | 内置 provider(Hermes `989798c`) | 外部插件(本仓库) |+|---|---|---|+| 会话中的提交 | 无,只在会话边界 | 待提交 token 达到 20,000 时后台提交(`commit_token_threshold`) |+| 召回摘要 | 不支持 | 可选的服务端摘要(`recall_compress`) |+| 镜像 Hermes 内置记忆 | 只同步新增 | 同步新增、替换和删除,用 URI 注册表跟踪 |+| `viking_forget` | 带明确用户 ID 的用户记忆文件 | 还接受 `viking://~/`,拒绝不带用户 ID 的路径,删除前检查归属 |+| cron、子代理和 flush 上下文 | 该提交中没有说明 | 召回可用;跳过自动写入和镜像 |++内置 provider 的行为:++- 每次模型调用前召回,走带会话的 `search/search`,以 `/find` 作为回退。默认值:6 条结果、分数阈值 0.15、4,000 字符、总计 4 秒、单请求 3 秒。+- `viking_remember` 把事实原样通过独立会话发送并提交,返回 `status: submitted`。+- 提交不保留消息(`keep_recent_count` 0)。上传不持久化,但在 POSIX 上,待提交标记让之后的启动能提交已退出进程留下的会话。+- 记忆写入 `viking://user/<uid>/memories/`;设置了 peer 时写入 `viking://user/<uid>/peers/<peer>/memories/`。+- 关联 OpenViking 的 `ovcli.conf` profile 会清除 Hermes `.env` 中的 5 个连接变量。`hermes backup` 会包含 `$HOME` 下默认或由环境变量指定的 `ovcli.conf`;通过 YAML 关联的文件需要单独备份。++<a id="_5-ov-cli-命令参考"></a><a id="_5-1-命令树"></a><a id="_5-2-全局选项与独有机制"></a><a id="_5-3-cli-独有于插件面的能力"></a>++### ov CLI++[安装与使用 CLI](../getting-started/05-cli-setup.md)。`ov` 是 REST API 的 Rust 客户端,没有宿主事件、自动召回或压缩处理;每个动作都是由你或脚本执行的命令。运行 `ov --help` 查看命令列表,JSON 输出见 [CLI 输出格式](../api/01-overview.md#cli-输出格式)。++CLI 提供而插件没有的能力:多个 `ovcli.conf` profile、账户与用户管理(`ov admin`)、用 `--sudo` 执行 root 操作、隐私策略管理(`ov privacy`)、快照、备份与恢复、导出与导入、`ov reindex`、在本地生成 root key(`ov system crypto init-key`)、`ov tui` 文件浏览器,以及会话自动提交策略(`ov session new --auto-commit-policy-json`、`ov session config set`)。其中的服务端操作也可以通过 HTTP API 和 SDK 完成。++在脚本中需要注意:++- `ov rm` 不确认就删除;`-r` 递归删除。+- 服务端报告不健康时 `ov health` 仍退出 0,表格模式的 `ov status` 始终退出 0。+- `echo_command` 开启时(默认开启),`find`、`search`、`ls`、`tree`、`grep` 和 `glob` 会先在标准输出打印一行 `cmd: …` 再输出结果,使用 `-o json` 时也是如此。+- 大多数命令在 compact JSON 模式下输出 `{"ok": true, "result": …}` 或 `{"ok": false, "error": …}`;`ov config` 系列命令输出 `{"status": "ok", "result": …}`。+- 运行命令前必须配置显示语言;在非交互 shell 中未配置时,CLI 以状态码 2 退出。+- `ov doctor` 只存在于用 `uv tool install openviking` 安装的 Python 包中,用于检查服务端的 `ov.conf`。npm 和 cargo 安装的二进制不包含它。++<a id="_6-自定义-agent-接入指南"></a><a id="_6-1-接入路径-×-能获得的能力"></a>++## 自建集成++如果你的 Agent 不在上面的列表中,按需要的行为选择工作量最小的方式:++| 方式 | 工作量 | Agent 可用的工具 | 自动召回与捕获 | 提交 |+|---|---|---|---|---|+| [通过 MCP 连接](#通过-mcp-连接) | 几分钟 | 服务端 MCP 工具 | 无;由模型自己调用工具 | 只有 `remember`,在它自己的会话中 |+| [Agent Plugins 插件包](./15-agent-plugins.md) | 几分钟 | 服务端 MCP 工具,外加一个教模型使用这些工具的 skill | 无 | 只有 `remember` |+| [HTTP API、SDK 或 LangChain](#调用-http-api-或-sdk) | 几小时 | 取决于你调用的接口 | 自己实现,或使用 LangChain 中间件 | 由你决定 |+| [复用共享插件代码](#复用共享插件代码) | 几天 | 通过代理使用服务端 MCP 工具 | 召回、捕获、提交和离线队列 | 取决于你接入的宿主事件 |++<a id="_6-2-路径1-通用-mcp-直连-推荐起步"></a>++### 通过 MCP 连接++支持 Streamable HTTP 的客户端可以连接服务端的 `/mcp`。下面的示例使用常见的 `mcpServers` 格式;其他客户端的字段见 [MCP 客户端](./06-mcp-clients.md)。```json{@@ -734,44 +738,65 @@ MCP `write` / REST `content/write` 的三道 guard(`content_write.py`):可}```-示例使用用户或管理员 API key,账户和用户身份由服务端根据 key 确定。`X-OpenViking-Account` 与 `X-OpenViking-User` 用于可信身份模式,不能用来覆盖普通 key 的身份。需要 workspace peer 上下文时可另加 `X-OpenViking-Actor-Peer`,具体可见范围见[认证指南](../guides/04-authentication.md)。仅支持 stdio 的客户端可用 [Agent Plugins 便携代理](./15-agent-plugins.md)桥接 Streamable HTTP。直接接入 MCP 不含自动召回、捕获或会话提交;模型调用 `remember` 时会创建并提交一次性会话。+使用用户或管理员 API key,服务端从 key 中读取账户和用户。`X-OpenViking-Account` 和 `X-OpenViking-User` 只在 trusted 身份模式下生效,不能覆盖普通 key 的身份。需要工作区 peer 上下文时,添加 `X-OpenViking-Actor-Peer`,见[认证](../guides/04-authentication.md)。只支持 stdio 的客户端可以使用 [Agent Plugins 代理](./15-agent-plugins.md)。直接通过 MCP 连接没有自动召回、捕获或提交。-## 6.3 路径②:程序化接入+<a id="_6-3-路径2-程序化接入"></a>-- **直连 REST**:召回用 `POST /api/v1/search/search`(必须 `mode:"context"` + `session_id` 才有 expansion/去重,[§3.2.1](#_3-2-1-机制底座-一条共享管线-两条服务端路径);可传 `rewrite` 获得服务端 digest,[§3.2.5](#_3-2-5-召回再摘要));写入用 `POST /api/v1/sessions/{id}/messages/batch`(≤100 条/批,auto_create);提交用 `POST /api/v1/sessions/{id}/commit`;读取用 `GET /api/v1/content/read` 等。自动 commit policy 可来自 `server.user_config_defaults.auto_commit_policy`、`POST /api/v1/sessions` 或 `PATCH /{id}/config`([§2.3](#_2-3-服务端会话与-commit-语义))。-- **LangChain / LangGraph SDK**(`pip install langchain-openviking`):`OpenVikingContextMiddleware` 提供 `wrap_model_call`(把召回内容注入 `<openviking_context>`)与 `after_agent`(捕获 + 按 `CommitPolicy` 提交,默认 `never`)。这是本组唯一带 session + token 预算的现成自动召回;容错是"只读方法重试一次、写方法不重试",部分成功时抛 `OpenVikingPartialWriteError`(可按 `input_messages_consumed` 切片重试)。参考 [§7](#_7-附录-非-coding-集成速览) B。-- **Open WebUI**(OpenAPI 工具服务器):`python -m openviking_openwebui` 起独立进程,在 Open WebUI 里添加 Tool Server URL,即可得 7 个工具(无删除、无 hook)。参考 [§7](#_7-附录-非-coding-集成速览) A。-## 6.4 路径③:要自动 hook 面时复用参考实现+### 调用 HTTP API 或 SDK-如果希望实现召回、捕获、commit、pending 的全套自动化,完全不必从零开始编写。可按宿主能力选择以下实现;便携包只提供 MCP 和 skill,不包含自动 hook:+- **REST**。召回用 `POST /api/v1/search/search`;查询扩写和去重需要 `mode: "context"`、`session_id` 和 `dedup_turns`(见[召回请求如何到达服务端](#召回请求如何到达服务端)),`rewrite` 用于请求[召回摘要](#召回摘要)。写入用 `POST /api/v1/sessions/{id}/messages/batch`(最多 100 条,会自动创建会话),提交用 `POST /api/v1/sessions/{id}/commit`,读取用 `GET /api/v1/content/read`。见[会话](../api/05-sessions.md)和[检索](../api/06-retrieval.md)。服务端自动提交见[服务端会话与提交机制](#服务端会话与提交机制)。+- **LangChain 与 LangGraph**(`pip install langchain-openviking`)。`OpenVikingContextMiddleware` 在模型调用前把召回内容注入 `<openviking_context>`,在 Agent 运行后按 `CommitPolicy`(默认 `never`)捕获并提交。只读调用重试一次,写入从不重试。部分写入会抛出 `OpenVikingPartialWriteError`,附带重试剩余部分所需的计数。见 [LangChain / LangGraph](./07-langchain-langgraph.md)。+- **Open WebUI**。`python -m openviking_openwebui` 启动一个独立的 OpenAPI 工具服务器,提供 7 个工具,没有删除工具和 hook。见[其他集成](#其他集成)。-- **`examples/memory-plugin-shared/lib/`**(Node):包含完整的核心功能模块,例如 `recall-core`(三级降级召回)、`profile-inject`、`capture-utils`(消息归一 + 注入回流防护)、`pending-queue`(离线重放)、`batch-send`、`mcp-proxy-core`(stdio↔HTTP 代理)、`session-model`(会话 id 派生)以及 `credentials`。构建新集成时,需要把宿主生命周期事件映射到这些模块,并验证消息顺序、重试、超时和退出行为(例如 `agent-hook-runtime.mjs` 就是 cursor、trae、zcode 共用的现成一体化运行时,可参考其 stdin 事件解析方式)。-- **Agent Plugins 1.0 便携包**(位于 `agent-plugins/`):采用 `plugin.json` + `skills/` + `mcp.json`(stdio→HTTP 代理)的规范化便携格式。该方案刻意不含 hooks(召回/沉淀靠 skill 教模型自调工具),非常适合符合 Agent Plugins 规范的客户端直接加载;此外,`plugin.test.mjs` 定义了规范一致性校验(schema URL、name 规则、静态 headers 不含机密、`mcp.json` 引用不逃逸插件根等),可作为自行打包的 lint 依据。+<a id="_6-4-路径3-要自动-hook-面时复用参考实现"></a><a id="_2-2-memory-plugin-shared-共享层"></a>-**接入时务必对齐的三个约定**(与现有 harness 保持一致的行为):① 召回调用点必须转发 `session_id`,这样才有服务端 expansion + 跨轮去重(详见 [§3.2.1](#_3-2-1-机制底座-一条共享管线-两条服务端路径));② 适配器不要用自己的超时压过 helper 下发的 deadline;③ 关闭时要安排一条 commit 路径,否则未达阈值的尾部对话需等待后续触发才能归档(详见 [§3.3.3](#_3-3-3-关闭方式-×-harness-终局矩阵))——若宿主没有关闭事件,需开启 `memory.session_auto_commit.enabled`,并提供 Session 级或部署级默认 policy。`recall-session-wiring.test.mjs` 检查 session ID 和超时传递等接线;退出事件是否触发、写入是否完成,还需在目标宿主中验证。+### 复用共享插件代码----+需要自动召回、捕获、提交和离线重试时,复用现有代码,不必重写:-# 7. 附录:非 coding 集成速览+- **`examples/memory-plugin-shared/lib/`**(Node.js)包含共享模块:带回退的召回、会话开场上下文、捕获清理、离线队列、批量发送、MCP 代理、会话 ID 和凭据。通过 hook 文件配置的宿主可以在 `examples/agent-hook-plugin/hosts/` 下添加适配器,Cursor、TRAE、ZCode 和 Kimi Code 都是这样接入的。+- **Agent Plugins 插件包**(`agent-plugins/`)由可移植的 `plugin.json`、`skills/` 和 `mcp.json` 组成,带 stdio 到 HTTP 的代理,没有 hook。它的 `plugin.test.mjs` 检查是否符合 Agent Plugins 规范,可以作为你自己插件包的 lint 基线。-| 集成 | 形态 | 工具面 | 会话/commit | 容错 | 默认状态 |-|---|---|---|---|---|---|-| **A. [Open WebUI](./08-community-plugins.md)** | 独立的 FastAPI OpenAPI 工具服务器 | 7 个本地 OpenAPI 路由(`ov_search`/`ov_recall_memories`/`ov_add_memory`/`ov_list_memories`/`ov_read_resource`/`ov_add_resource`/`ov_session_status`),无删除工具 | 无会话概念 | 最薄:裸 httpx,无 retry/负缓存;`/health` 仅回显配置,不探测 OV | 进程不启动即不存在 |-| **B. [LangChain/LangGraph](./07-langchain-langgraph.md)** | Python SDK 适配层(retriever/tools/store/middleware/recorder) | `create_openviking_tools()` 提供 12 个 StructuredTool(`viking_forget` 默认不在 agent profile 中) | `thread_id`/`session_id` 由调用方给;`CommitPolicy` 默认 `never` | 本组最稳:只读方法自动重试 1 次、写方法不重试(防重复)、部分成功抛结构化异常可切片重试 | 需全部显式构造才生效 |-| **C. [Agent Plugins 1.0](./15-agent-plugins.md)** | 便携包 `plugin.json` + `skills/` + `mcp.json`(stdio→HTTP 代理) | MCP 透传 20 工具;刻意无 hooks(召回靠 skill 教模型) | 仅 `remember` 建临时会话 | MCP 代理层重试(401/403 换凭据、400/404 重初始化各 1 次) | 客户端加载后工具即用 |-| **D. [通用 MCP 直连](./06-mcp-clients.md)** | 零本地组件,直连 `/mcp` | 同 C(20 工具) | 同 C | 由客户端自定 | `/mcp` 常驻 |-| **E. [log ingestion](./09-log-ingestion.md)** | `openviking-server ingest` CLI(跑在日志所在机器,反向导入) | 无(只写不召回) | 会话 id `{prefix}__{harness}__{sanitized native id}`;commit token 6000/idle 5s/keep 0 | 崩溃恢复:SQLite 游标库 + 单实例锁 + reconcile 判定批次落地 | 双重默认关(`ingest.enabled` + 每 harness `enabled` 都 false);支持 claude_code/codex/hermes/opencode/openclaw/cursor 适配器 |-| **F. [OpenViking Helper](./14-openviking-helper.md)** | 闭源桌面 App | — | — | — | 不在本文代码基线内 |+[插件开发指南](./18-plugin-development.md)介绍模块职责、配置、生成副本、安装器和测试。无论构建什么,都遵守以下三条规则,让它的行为与现有集成一致:++1. 使用带会话 ID 和 `dedup_turns` 的 context 模式召回,让服务端能扩写查询并跨轮去重。+2. 不要让适配器自己的超时截断共享代码计算出的截止时间。+3. 在关闭时提交。否则低于阈值的对话尾部会一直未提交,直到其他事件触发提交。如果宿主没有关闭事件,开启 `memory.session_auto_commit.enabled` 并为会话设置策略。完成后,在真实宿主中检查退出事件是否触发、写入是否完成。----+<a id="_7-附录-非-coding-集成速览"></a>-*各集成的安装、配置与排障以对应的单独集成页面为准;当本页与单独页面不一致时,以单独页面为准。*+## 其他集成++| 集成 | 是什么 | 工具 | 会话与提交 | 失败处理 | 何时生效 |+|---|---|---|---|---|---|+| [Open WebUI](./08-community-plugins.md#open-webui-tool-server) | 独立的 OpenAPI 工具服务器 | 7 个:`ov_search`、`ov_recall_memories`、`ov_add_memory`、`ov_list_memories`、`ov_read_resource`、`ov_add_resource`、`ov_session_status`;没有删除工具 | 没有会话 | 不重试,不缓存失败。它的 `/health` 只回显配置,不连接 OpenViking | 你启动进程后 |+| [LangChain 与 LangGraph](./07-langchain-langgraph.md) | Python SDK 适配层:retriever、tools、store、middleware、recorder | `create_openviking_tools()` 提供 12 个工具;`viking_forget` 不在默认 agent profile 中 | 会话 ID 和 thread ID 由调用方提供;`CommitPolicy` 默认 `never` | 读取重试一次,写入不重试;部分写入抛出结构化错误 | 你构造它之后 |+| [Agent Plugins](./15-agent-plugins.md) | 带 stdio 到 HTTP MCP 代理的可移植插件包 | 服务端 MCP 工具;没有 hook,由 skill 告诉模型何时调用 | 只有 `remember` | 代理在 401 或 403 后用新凭据重试一次,在 400 或 404 后用新 MCP 会话重试一次 | 客户端加载后 |+| [MCP 客户端](./06-mcp-clients.md) | 直连 `/mcp` | 服务端 MCP 工具 | 只有 `remember` | 由客户端决定 | 服务端始终提供 |+| [日志导入](./09-log-ingestion.md) | `openviking-server ingest`,在日志所在的机器上运行 | 无,只导入 | 会话 ID `{prefix}__{harness}__{id}`;待提交 token 达到 6,000 或空闲 5 秒时提交,`keep_recent_count` 0 | 游标库、单实例锁,崩溃后核对服务端消息数 | 默认关闭;`ingest.enabled` 和各适配器的 `enabled` 都要开启。适配器:Claude Code、Codex、Hermes、OpenCode、OpenClaw、Cursor |+| [OpenViking Helper](./14-openviking-helper.md) | 闭源桌面应用 | 本页不涉及 | 本页不涉及 | 本页不涉及 | 本页不涉及 |++## 源码依据++以上对比依据以下位置核对。需要确认某项限制在你的版本中是否成立时,可以查看这些位置。++- 服务端 MCP 工具:`openviking/server/mcp_endpoint.py`,以其中的 `@mcp.tool` 注册为准。+- 写入与删除检查:`openviking/storage/content_write.py` 和 `openviking/storage/viking_fs/_access.py`。+- 服务端自动提交:`openviking_cli/utils/config/memory_config.py` 和 `openviking/session/auto_commit_policy.py`。+- 插件配置与默认值:`examples/memory-plugin-shared/lib/config-schema.mjs`。+- hook 宿主:`examples/agent-hook-plugin/hosts/`,对应 Cursor、TRAE、ZCode 和 Kimi Code。+- pi takeover:`examples/pi-coding-agent-extension/lib/takeover-core.mjs`。+- OpenClaw 工具和生命周期 hook:`examples/openclaw-plugin/registries/openviking-tools.ts` 和 `examples/openclaw-plugin/plugin/openviking-lifecycle-hooks.ts`。+- Hermes:[Hermes](#hermes) 中链接的固定 Hermes 提交里的内置 provider,以及外部插件的 [README](https://github.com/volcengine/OpenViking/blob/main/examples/hermes-plugin/README.md)。## 参见-- [Agent 集成概览](./01-overview.md)+- [选择 Agent 接入方式](./01-overview.md)+- [调整召回延迟](./19-recall-tuning.md)+- [开发与维护 Agent 插件](./18-plugin-development.md)- [MCP 客户端](./06-mcp-clients.md)-- [MCP 集成指南](../guides/06-mcp-integration.md)+- [MCP 工具与协议](../guides/06-mcp-integration.md)+- [客户端配置字段](../configuration/02-client.md)- [检索 API](../api/06-retrieval.md)- [会话 API](../api/05-sessions.md)-- [鉴权](../guides/04-authentication.md)+- [认证](../guides/04-authentication.md)diff --git a/docs/zh/agent-integrations/17-dsh.md b/docs/zh/agent-integrations/17-dsh.mdindex 9f29f1d66..b286a2d6c 100644--- a/docs/zh/agent-integrations/17-dsh.md+++ b/docs/zh/agent-integrations/17-dsh.md@@ -1,4 +1,4 @@-# DeepSeek Harness 记忆插件+# DeepSeek Harness为 [DeepSeek Harness](https://www.npmjs.com/package/@deepseek-ai/dsh)(`dsh`)接入跨项目、跨会话的长期记忆。安装后每次对话都会自动召回相关记忆并捕获新内容,模型也会直接拿到 OpenViking 工具以及 `openviking-memory`、`openviking-skills`、`ov-experience-memory` 三个技能,无需额外配置。diff --git a/docs/zh/agent-integrations/18-plugin-development.md b/docs/zh/agent-integrations/18-plugin-development.mdindex b2af15895..50f0127cf 100644--- a/docs/zh/agent-integrations/18-plugin-development.md+++ b/docs/zh/agent-integrations/18-plugin-development.md@@ -1,4 +1,4 @@-# Hook + MCP Agent 插件开发与维护规范+# 开发与维护 Agent 插件本文规定如何新增和维护通过生命周期 hook 自动读写记忆、通过 MCP 提供工具的 OpenViking Agent 插件,涵盖模块职责、协议、状态、安装、测试和发布。宿主是指承载 Agent 的客户端或运行时,代码中也称 harness。diff --git a/docs/zh/agent-integrations/19-recall-tuning.md b/docs/zh/agent-integrations/19-recall-tuning.mdnew file mode 100644index 000000000..339c16540--- /dev/null+++ b/docs/zh/agent-integrations/19-recall-tuning.md@@ -0,0 +1,42 @@+# 调整召回延迟++适用于已完成插件接入的用户。首次安装从[集成选型](01-overview.md)开始。++查询扩展和召回压缩都会增加模型调用。优先考虑响应速度时,可以关闭这两项;检索、预算控制和跨轮去重仍然保留:++```bash+export OPENVIKING_RECALL_QUERY_EXPANSION=off+export OPENVIKING_RECALL_COMPRESS=off+```++也可以在 `~/.openviking/ovcli.conf` 中配置:++```json+{+ "plugin": {+ "recallQueryExpansion": "off",+ "recallCompress": "off"+ }+}+```++### 选择压缩方式++| 值 | 行为 |+| --- | --- |+| `off` | 不压缩召回结果 |+| `server` | 请求 OpenViking 服务端压缩 |+| `client` | 只用本地压缩器,适用于 Claude Code 和 Codex |+| `auto` | 有本地压缩器时优先使用,否则请求服务端自动处理 |++Claude Code 和 Codex 默认使用 `auto`,本地压缩器分别是 `claude -p` 和 `codex exec`,见[Agent 集成能力:召回摘要](./16-capability-reference.md#_3-2-5-召回再摘要)。其他支持云端压缩的集成默认保持 `off`,需要显式开启。服务端压缩适用于 Claude Code、Codex、OpenCode、DSH、pi、Cursor、TRAE、TRAE CN、ZCode、OpenClaw 和 Hermes 外部插件,要求服务端支持 context-search rewrite。Hermes 内置 provider 不支持召回摘要。++这些设置控制自动召回。模型主动调用 MCP `search` 时,使用该次调用传入的参数。完整规则与旧服务端回退行为见[共享插件说明](https://github.com/volcengine/OpenViking/blob/main/examples/memory-plugin-shared/README.md#cloud-recall-compression)。++共享插件读取 `ovcli.conf` 的 `plugin` 段;`plugin.<harness>` 可覆盖某个客户端的配置。环境变量优先级更高;旧变量 `OPENVIKING_RECALL_REWRITE` 仍可作为 `OPENVIKING_RECALL_COMPRESS` 的别名使用,详见[插件配置](../configuration/02-client.md#插件配置)。修改后重启对应 Agent,使 hook 进程加载新配置。这些都是插件客户端配置,不需要修改服务端的 `ov.conf`。++### 请求超时++查询扩展、检索和 digest 压缩依次执行。查询扩展默认超时为 5 秒(`retrieval.recall_intent_timeout_s`),digest 默认超时为 30 秒(`retrieval.recall_rewrite_timeout_s`)。++`OPENVIKING_RECALL_CONTEXT_TIMEOUT_MS` 或 `plugin.recallContextTimeoutMs` 控制客户端等待整个 context 请求的上限。未设置时沿用插件的普通超时;请求带 session 且未将 query expansion 设为 `off` 时至少 15 秒,请求 digest 时至少 45 秒。自定义值应高于该请求会用到的服务端超时,并低于宿主 hook 的超时;客户端提前结束会丢失整个响应。diff --git a/docs/zh/api/01-overview.md b/docs/zh/api/01-overview.mdindex 13101dac1..468457a3b 100644--- a/docs/zh/api/01-overview.md+++ b/docs/zh/api/01-overview.md@@ -1,4 +1,4 @@-# API 概览+# SDK、HTTP 与 CLI 约定本页介绍如何连接 OpenViking 以及所有 API 端点共享的约定。@@ -64,7 +64,7 @@ Go SDK 发送的身份请求头与 Python HTTP client 一致:普通 `api_key` 部署下只需要设置 `APIKey`,服务端会从 API key 推导租户身份。只有在 trusted 部署或网关显式透传租户身份时,才需要设置 `Account` 和 `User`。-Go SDK 不保留旧 `agent_id` 兼容路径。更多示例见 [`sdk/go/README_CN.md`](../../../sdk/go/README_CN.md)。+Go SDK 不保留旧 `agent_id` 兼容路径。更多示例见 [`sdk/go/README_CN.md`](https://github.com/volcengine/OpenViking/blob/main/sdk/go/README_CN.md)。#### JavaScript/TypeScript SDK 客户端@@ -89,7 +89,7 @@ const results = await client.search("部署文档", {```它与 Python、Go HTTP Client 使用相同的身份请求头和响应信封。更多示例见-[`sdk/typescript/README_CN.md`](../../../sdk/typescript/README_CN.md)。+[`sdk/typescript/README_CN.md`](https://github.com/volcengine/OpenViking/blob/main/sdk/typescript/README_CN.md)。Python HTTP 客户端从 `ovcli.conf` 读取连接信息,显式传入的构造参数覆盖对应配置。`ovcli.conf` 是 HTTP 客户端和 CLI 共享的配置文件,默认路径 `~/.openviking/ovcli.conf`,也可通过环境变量指定:diff --git a/docs/zh/api/04-skills.md b/docs/zh/api/04-skills.mdindex d65b08a9d..4b69b10ee 100644--- a/docs/zh/api/04-skills.md+++ b/docs/zh/api/04-skills.md@@ -88,7 +88,7 @@ Concrete examples of skill invocation.| tags | List[str] | 用于分类的标签 || metadata | object | 原样保留的扩展字段,如 `metadata.vikingbot.requires`;OpenViking 不自动安装这些依赖 |-`SKILL.md` 使用带连字符的 **`allowed-tools`**,解析后的结构化数据和 API 摘要使用 **`allowed_tools`**。不要在 frontmatter 中用下划线拼写替代它。未声明和显式空声明可能在 Harness 中有不同权限含义,摘要里的 `allowed_tools: []` 不能区分二者;执行前应读取完整 `SKILL.md`。正文与扩展字段的消费方式见 [VikingBot Skills](../../../bot/docs/zh/concepts/06-skills.md)。+`SKILL.md` 使用带连字符的 **`allowed-tools`**,解析后的结构化数据和 API 摘要使用 **`allowed_tools`**。不要在 frontmatter 中用下划线拼写替代它。未声明和显式空声明可能在 Harness 中有不同权限含义,摘要里的 `allowed_tools: []` 不能区分二者;执行前应读取完整 `SKILL.md`。正文与扩展字段的消费方式见 [VikingBot Skills](https://github.com/volcengine/OpenViking/blob/main/bot/docs/zh/concepts/06-skills.md)。### MCP 格式自动转换@@ -617,7 +617,7 @@ HTTP 对应查询为 `GET /api/v1/skills/search-web?include_content=true&include清单包含 `SKILL.md`、摘要和辅助文件/目录,不包含 `.source.json`。完整性 API 上限为 **512 个条目(包含目录)、单文件 16 MiB、总文件字节数 64 MiB**,读取并发为 8;超限返回 `RESOURCE_EXHAUSTED`。正文、清单和 revision 在同一次树锁保护的读取中取得,但后续下载仍可能遇到更新,消费方应校验文件哈希并复查 revision。-检索与 `get_skill` 只返回内容和清单,不会执行脚本或把文件安装到 Agent 沙箱。Harness 可按需远程读文本,在工具需要本地路径时下载资源。VikingBot 的完整流程见 [Skills](../../../bot/docs/zh/concepts/06-skills.md)。MCP 客户端通过 `find` 工具传 `context_type="skill"` 得到同样的包级行为,见 [MCP 集成](../guides/06-mcp-integration.md)。+检索与 `get_skill` 只返回内容和清单,不会执行脚本或把文件安装到 Agent 沙箱。Harness 可按需远程读文本,在工具需要本地路径时下载资源。VikingBot 的完整流程见 [Skills](https://github.com/volcengine/OpenViking/blob/main/bot/docs/zh/concepts/06-skills.md)。MCP 客户端通过 `find` 工具传 `context_type="skill"` 得到同样的包级行为,见 [MCP 集成](../guides/06-mcp-integration.md)。### 搜索技能@@ -956,4 +956,4 @@ skill = {- [上下文类型](../concepts/02-context-types.md) - 技能概念- [检索](06-retrieval.md) - 查找技能- [会话](05-sessions.md) - 跟踪技能使用情况-- [VikingBot Skills](../../../bot/docs/zh/concepts/06-skills.md) - 本地/远程 Skill 的激活、metadata 与执行+- [VikingBot Skills](https://github.com/volcengine/OpenViking/blob/main/bot/docs/zh/concepts/06-skills.md) - 本地/远程 Skill 的激活、metadata 与执行diff --git a/docs/zh/api/08-admin.md b/docs/zh/api/08-admin.mdindex 1e3e6a373..b1ef6d25c 100644--- a/docs/zh/api/08-admin.md+++ b/docs/zh/api/08-admin.md@@ -1,4 +1,4 @@-# 管理员(多租户)+# 多租户Admin API 用于多租户环境下的账户、用户和用户组管理。包括工作区(account)的创建与删除、用户注册与移除、用户组成员、角色变更、API Key 重新生成。diff --git a/docs/zh/api/10-privacy.md b/docs/zh/api/10-privacy.mdindex 8aa83c7a7..649c5a4b8 100644--- a/docs/zh/api/10-privacy.md+++ b/docs/zh/api/10-privacy.md@@ -1,4 +1,4 @@-# 隐私配置(Privacy Configs)+# 隐私配置隐私配置用于按 `category + target_key` 管理敏感字段版本(如 skill 的 `api_key`、`base_url`)。diff --git a/docs/zh/api/11-snapshot.md b/docs/zh/api/11-snapshot.mdindex 5675d728f..a7dac26df 100644--- a/docs/zh/api/11-snapshot.md+++ b/docs/zh/api/11-snapshot.md@@ -1,4 +1,4 @@-# 多版本管理(快照)+# 版本管理快照将指定范围内的文件树保存为不可变版本。使用 `commit` 保存、`log` 查看历史、`show` 读取旧版文件、`diff` 对比文件在两个版本间的差异、`restore` 恢复已保存的内容。未提交或被排除的文件不在恢复范围内,ACL 和向量索引也不保存历史版本。diff --git a/docs/zh/api/22-openviking-assets.md b/docs/zh/api/22-openviking-assets.mdindex df9093892..8434764fe 100644--- a/docs/zh/api/22-openviking-assets.md+++ b/docs/zh/api/22-openviking-assets.md@@ -1,4 +1,4 @@-# OpenViking Assets Resolver+# AssetsOpenViking Assets Resolver 用于解析并校验[`openviking-assets/1`](../guides/18-openviking-assets.md) Manifest。支持在diff --git a/docs/zh/api/99-api-doc-writing-guide.md b/docs/zh/api/99-api-doc-writing-guide.mdindex 1c6aefe0f..ae740078c 100644--- a/docs/zh/api/99-api-doc-writing-guide.md+++ b/docs/zh/api/99-api-doc-writing-guide.md@@ -1,4 +1,4 @@-# API 文档编写说明+# API 文档编写规范本文档定义 `docs/zh/api/` 目录下各 API 模块文档的统一结构和编写规范。diff --git a/docs/zh/concepts/00-overview.md b/docs/zh/concepts/00-overview.mdnew file mode 100644index 000000000..533b53ac3--- /dev/null+++ b/docs/zh/concepts/00-overview.md@@ -0,0 +1,37 @@+# 概念与原理++这里按学习顺序组织 OpenViking 的上下文模型、处理机制、架构与治理。尚未运行过 OpenViking,可以先[导入并检索第一份文档](../getting-started/02-quickstart.md),再回到这里理解结果如何产生。++## 先理解上下文模型++按顺序阅读前三篇,回答“存什么、在哪里、读多少”:++1. [上下文类型](02-context-types.md):资源、记忆与技能各自承担什么职责。+2. [Viking URI](04-viking-uri.md):如何定位上下文,如何区分用户、Peer 与共享空间。+3. [上下文层级(L0/L1/L2)](03-context-layers.md):摘要、概览与原文的关系,以及按层读取的边界。++## 再看处理与记忆++沿着资料导入和会话积累两条路径阅读:++- [上下文提取](06-extraction.md):原始资料如何经过解析、组织与语义处理。+- [检索机制](07-retrieval.md):如何查找相关上下文,`find` 与 `search` 有什么区别。+- [会话管理](08-session.md):消息、会话提交与记忆提取如何衔接。++准备写应用时,回到[应用开发路径](../workflows/01-overview.md)选择操作流程;参数和响应查[参考文档](../reference/01-overview.md)。++## 按问题深入架构与治理++| 想理解的问题 | 阅读路径 |+| --- | --- |+| 模块如何协作,数据存在哪里? | [架构概述](01-architecture.md) → [存储架构](05-storage.md) |+| 处理何时结束,失败后如何恢复? | [任务状态](16-queue-lifecycle.md) → [路径锁与崩溃恢复](09-transaction.md) |+| 主备写入、读取和观测有什么语义? | [主备存储](14-multi-write-storage.md) → [指标与 Metrics](12-metrics.md) |+| 谁能看到什么,权限如何继承? | [多租户](11-multi-tenant.md) → [资源访问控制(ACL)](15-acl.md) |+| 数据如何加密,Skill 隐私如何处理? | [数据加密](10-encryption.md) → [隐私配置与 Skill 隐私提取/加载](13-privacy.md) |++配置和部署步骤集中在[部署运维](../guides/00-overview.md)。原理页说明行为与约束,操作指南说明如何设置和验证,两者通过链接连接。++## 看一个应用示例++[VikingBot](15-vikingbot.md)展示 Agent、上下文与多渠道交互如何组合。需要运行它时,继续阅读[VikingBot 安装与配置](../guides/17-vikingbot.md);接入其他现成工具时,先[选择 Agent 接入方式](../agent-integrations/01-overview.md)。diff --git a/docs/zh/concepts/11-multi-tenant.md b/docs/zh/concepts/11-multi-tenant.mdindex c4280b059..cc8b91c5a 100644--- a/docs/zh/concepts/11-multi-tenant.md+++ b/docs/zh/concepts/11-multi-tenant.md@@ -310,7 +310,7 @@ peer 集合过滤选择当前用户内的 peer 内容子空间,例如- [认证](../guides/04-authentication.md) - 认证模式、请求头和 key 规则- [配置](../guides/01-configuration.md) - `root_api_key` 和 `auth_mode`-- [管理员(多租户)](../api/08-admin.md) - Admin API 参考+- [多租户](../api/08-admin.md) - Admin API 参考- [API 概览](../api/01-overview.md) - CLI / HTTP 连接方式- [资源访问控制(ACL)](./15-acl.md) - account 内资源授权、继承和检索过滤- [ACL API](../api/12-acl.md) - HTTP、SDK 和 CLI 接口diff --git a/docs/zh/concepts/15-vikingbot.md b/docs/zh/concepts/15-vikingbot.mdindex 3bf1767dc..b9a0d00ff 100644--- a/docs/zh/concepts/15-vikingbot.md+++ b/docs/zh/concepts/15-vikingbot.md@@ -1,4 +1,4 @@-# VikingBot:基于 OpenViking 的多渠道 AI Agent+# VikingBot:OpenViking 原生 AgentVikingBot 是 OpenViking 提供的多渠道 AI Agent。OpenViking 负责统一管理 Resource、Memory 和 Skill 等长期上下文;VikingBot 负责接收用户消息、组织上下文、调用模型和工具,并把任务结果交付回命令行、聊天平台或 HTTP 客户端。diff --git a/docs/zh/configuration/01-server.md b/docs/zh/configuration/01-server.mdindex f1e4b3883..f61b171cc 100644--- a/docs/zh/configuration/01-server.md+++ b/docs/zh/configuration/01-server.md@@ -1,4 +1,4 @@-# 服务端配置+# 服务端配置字段首次配置建议使用 `openviking-server init`,保存后运行 `openviking-server doctor`。diff --git a/docs/zh/configuration/02-client.md b/docs/zh/configuration/02-client.mdindex 79cdfee4b..21fde7de2 100644--- a/docs/zh/configuration/02-client.md+++ b/docs/zh/configuration/02-client.md@@ -1,4 +1,4 @@-# ovcli 配置+# 客户端配置字段`ovcli.conf` 是 `ov` CLI 的客户端配置文件,用于保存服务端连接、鉴权身份和命令默认行为。diff --git a/docs/zh/getting-started/01-introduction.md b/docs/zh/getting-started/01-introduction.mdindex b17992aba..c7c2fd8a2 100644--- a/docs/zh/getting-started/01-introduction.md+++ b/docs/zh/getting-started/01-introduction.md@@ -1,47 +1,46 @@-# 简介+# OpenViking 能做什么-OpenViking 是面向 AI Agent 的开源上下文数据库。它用虚拟文件系统组织资源、记忆和技能,让应用按路径浏览、检索相关上下文,并按需读取详细内容。+OpenViking 是面向 AI Agent 的开源上下文数据库。它把资料、记忆和技能组织在同一个虚拟文件系统里,让 Agent 能找到相关内容,并在后续任务中继续使用。-当 Agent 需要跨会话复用文档和经验时,可以用它集中组织和检索这些上下文。+如果你正在解决“资料散落不好找”“每次会话都要重述背景”或“已有经验难以复用”,可以从下面选一条路径。## 从你的任务开始-| 我想要…… | 阅读入口 |-| --- | --- |-| 连接服务并检索第一份文档 | [快速开始](./02-quickstart.md) |-| 接入已有 Agent 或编程工具 | [Agent 集成](../agent-integrations/01-overview.md) |-| 在终端使用 OpenViking | [CLI 配置](./05-cli-setup.md) |-| 部署和运维共享服务 | [部署](../guides/03-deployment.md)与[认证](../guides/04-authentication.md) |-| 使用 SDK 或 HTTP API 开发 | [API 参考](../api/01-overview.md) |+| 你想做到什么 | 先做什么 | 再往哪里走 |+| --- | --- | --- |+| 让 Agent 找到项目资料中的依据 | [导入并检索第一份文档](02-quickstart.md) | 换成你的资料,[验证实际效果](06-evaluate.md) |+| 给正在使用的 Agent 加入跨会话记忆 | [选择 Agent 接入方式](../agent-integrations/01-overview.md) | 按插件说明安装,再[用两次会话检查记忆](06-evaluate.md#用两次会话检查记忆) |+| 在自己的应用中使用上下文 | [应用开发路径](../workflows/01-overview.md) | 选资源、会话或技能流程,再查对应 API |+| 将资料整理成 Wiki、图谱或日报 | [上下文编译概览](../context-compilation/01-overview.md) | 选一种产物,用熟悉的来源核对结果 |-## 上下文如何组织+**还没决定从哪条开始?** 先完成[第一次导入与检索](02-quickstart.md)。这条路径用一份小文档走完连接、导入、检索和读取原文,不要求先读完原理。-每个文件或目录都有一个 `viking://` URI。已知路径时可直接列目录、读内容;不知道内容在哪里时可先检索。+已有服务地址和 API Key,可直接[安装与使用 CLI](05-cli-setup.md)。需要自己提供服务,查看[部署路径](../guides/00-overview.md);想使用 OpenViking 自带的 Agent,查看[VikingBot 安装与配置](../guides/17-vikingbot.md)。-| 上下文 | 存放内容 | 详细说明 |-| --- | --- | --- |-| 资源 | 文档、代码仓库等参考资料 | [资源](../api/02-resources.md) |-| 记忆 | 从会话提取的用户偏好、实体、事件和经验 | [记忆](../api/16-memory.md) |-| 技能 | 可复用 Agent 工作流的指令和配套文件 | [技能](../api/04-skills.md) |+## 怎样把第一次体验用起来-共享资源位于 `viking://resources/`;用户上下文位于 `viking://user/{user_id}/`,其中 `peers/{peer_id}/` 存放特定 Peer 的上下文。共享技能可放在 `viking://agent/skills/`。作用域和路径规则见 [Viking URI](../concepts/04-viking-uri.md)。+1. **取得第一个结果。** 不只确认服务健康,还要能读到导入的原文。+2. **换成自己的任务。** 用你知道答案的资料或跨会话背景,检查命中内容和实际使用情况,见[用你的任务验证效果](06-evaluate.md)。+3. **接进日常工作。** 选择一个 Agent、应用或编译流程继续使用。需要多人共享时,再完善部署和访问控制。-## 按层读取内容+出现问题时,从[观测与排障](../guides/05-observability.md)区分连接、处理与检索问题。-OpenViking 可在语义处理时生成目录摘要:+## 上下文如何组织-| 层级 | 内容 | 默认正文上限 |-| --- | --- | --- |-| L0 | 用于快速筛选的摘要 | 256 字符 |-| L1 | 用于导航的概览 | 4,000 字符 |-| L2 | 按需读取的原始内容 | 无统一上限 |+| 上下文 | 用来存什么 |+| --- | --- |+| 资源 | 文档、代码仓库等外部资料 |+| 记忆 | 从会话提取的偏好、事实与经验 |+| 技能 | 可复用工作流程的指令与配套文件 |-L0 和 L1 是目录级附属文件,不会为每个文件固定生成一对摘要;是否可用取决于处理状态和配置。详见[上下文层级](../concepts/03-context-layers.md)。+内容通过 `viking://` URI 定位,可以按路径浏览,也可以先检索再读取。[上下文类型](../concepts/02-context-types.md)和 [Viking URI](../concepts/04-viking-uri.md)解释对象与空间的边界。++## 按层读取内容-[检索](../concepts/07-retrieval.md)结合语义匹配与目录遍历。不需要会话上下文时用 `find`,需要结合会话理解查询时用 `search`。[可观测性](../guides/05-observability.md)介绍如何检查处理和检索行为。+OpenViking 可在语义处理时生成目录摘要(L0)和概览(L1),再按需读取原文(L2)。L0、L1 是目录级附属文件,是否生成取决于处理状态和配置;它们不是每个文件都固定具备的一对摘要。详见[上下文层级](../concepts/03-context-layers.md)。## 从会话生成记忆-应用把消息写入会话,提交后触发异步记忆提取。当前记忆策略决定为用户或 Peer 创建、更新哪些记忆。集成插件可自动执行其中部分步骤,使用前需确认对应集成的支持范围。详见[会话](../concepts/08-session.md)和[记忆配置](../guides/01-configuration.md)。+应用记录消息,提交会话后按策略异步提取记忆。插件可以自动执行其中部分步骤,支持范围见[集成能力对照](../agent-integrations/16-capability-reference.md)。生成了哪些记忆、后续是否召回,需要检查实际结果。-实现原理见[架构](../concepts/01-architecture.md),各版本变更见 [GitHub Releases](https://github.com/volcengine/OpenViking/releases)。+想系统理解这套流程,从[概念与原理](../concepts/00-overview.md)开始;想直接完成任务,用左侧“接入你的工作”选择下一步。diff --git a/docs/zh/getting-started/02-quickstart.md b/docs/zh/getting-started/02-quickstart.mdindex b8cc7f42f..506558f73 100644--- a/docs/zh/getting-started/02-quickstart.md+++ b/docs/zh/getting-started/02-quickstart.md@@ -1,4 +1,4 @@-# 快速开始+# 导入并检索第一份文档OpenViking 以服务端运行。用独立的 `ov` CLI 连接服务,导入一份小文档,再检索其中的内容。使用托管服务或他人部署的服务时,只需安装 CLI。@@ -102,3 +102,7 @@ ov read "<returned-file-uri>"## 使用 SDKOpenViking 也提供 Python、TypeScript/JavaScript 和 Go SDK,均连接同一个服务端。客户端示例见 [API 概览](../api/01-overview.md)。++## 下一步++先确认你已经读到示例原文,再按[用你的任务验证效果](06-evaluate.md)换成自己的资料或会话。接入日常工具时,选择[Agent 接入方式](../agent-integrations/01-overview.md);自己写应用时,进入[应用开发路径](../workflows/01-overview.md)。diff --git a/docs/zh/getting-started/04-setup-for-agent.md b/docs/zh/getting-started/04-setup-for-agent.mdindex 63211e9b7..849b8d8df 100644--- a/docs/zh/getting-started/04-setup-for-agent.md+++ b/docs/zh/getting-started/04-setup-for-agent.md@@ -1,4 +1,4 @@-# OpenViking 安装 SOP(For Agent)+# 供 Agent 执行的服务端安装说明## 目标diff --git a/docs/zh/getting-started/05-cli-setup.md b/docs/zh/getting-started/05-cli-setup.mdindex c5e514948..35b85dc7b 100644--- a/docs/zh/getting-started/05-cli-setup.md+++ b/docs/zh/getting-started/05-cli-setup.md@@ -1,6 +1,6 @@-# OpenViking CLI 配置指南+# 安装与使用 CLI-本文介绍如何安装 OpenViking CLI、完成配置,并验证它可以连接到 OpenViking。+本文介绍如何安装和配置 OpenViking CLI,并使用它连接到 OpenViking 服务端。`ov` 是客户端 CLI。它连接到已经存在的 OpenViking 服务端,或连接到 OpenViking Service(火山引擎云)。它不是服务端安装命令。如果你还没有安装或启动自定义 OpenViking 服务端,请先阅读[快速开始](02-quickstart.md)。diff --git a/docs/zh/getting-started/06-evaluate.md b/docs/zh/getting-started/06-evaluate.mdnew file mode 100644index 000000000..24fa46c38--- /dev/null+++ b/docs/zh/getting-started/06-evaluate.md@@ -0,0 +1,50 @@+# 用你的任务验证效果++[第一次导入与检索](02-quickstart.md)跑通后,换成你工作中的资料或会话,验证它能否帮你找到依据、复用经验或产出内容。先选一个场景,得到结果后再扩展。++| 你希望改善什么 | 从哪里开始 | 看什么结果 |+| --- | --- | --- |+| 查项目资料时少翻文件 | [资源导入与检索](02-quickstart.md) | 能找到回答问题所需的原文,而不只是返回相似词 |+| Agent 在新会话里复用已有背景 | [选择 Agent 接入方式](../agent-integrations/01-overview.md) | 记忆确实被保存,并在相关任务中召回;用户不必再次输入相同背景 |+| 把散落资料整理成可读的内容 | [上下文编译](../context-compilation/01-overview.md) | 产物引用或使用了哪些来源,结构是否适合后续阅读,是否仍有遗漏或错误 |++## 用自己的资料检查检索++选一小组你熟悉的资料,例如项目说明、操作手册或一次问题复盘。按[快速开始](02-quickstart.md)导入,再准备几个你知道答案的问题。每个问题记下预期来源,检索后读取返回的 URI,核对原文。++至少覆盖三种情况:资料中有直接答案;答案需要结合两处内容;资料中没有答案。记录是否找到依据、是否漏掉关键内容,以及后续 Agent 回答是否忠于原文。`find` 返回 URI 和分数,生成回答还需要你的 Agent 或应用读取并使用这些内容。++首次成功后,再逐步加入其他来源。这样发现问题时,可以判断是资料处理、检索还是回答生成出了偏差。结果不符合预期时,使用[观测与排障](../guides/05-observability.md)检查处理状态和请求行为。++## 用两次会话检查记忆++先查看[集成能力对照](../agent-integrations/16-capability-reference.md),确认你选的插件支持哪些自动捕获、提交和召回行为,再按该插件的验证步骤操作。++1. 在第一次会话中提供一条无敏感信息、后续确实会用到的偏好或项目背景。+2. 按插件的提交机制结束或提交会话。检查处理状态、实际生成的记忆及其用户或 Peer 归属;提交成功不保证产生某条记忆。+3. 用同一身份开启新会话,提出需要该背景的任务,不再次输入那条信息。检查召回记录与最终回答,确认 Agent 使用了保存的内容。+4. 再问一个无关问题,观察旧背景是否被不恰当地带入回答。++插件安装成功不等于记忆验证完成。若没有产物,检查[会话与记忆提取](../concepts/08-session.md);已有产物却没有召回时,检查身份、检索范围和插件行为。应用自己管理会话时,从[应用开发路径](../workflows/01-overview.md)进入对应 API。++## 用一份产物检查上下文编译++选择[知识 Wiki](../context-compilation/02-llm-wiki.md)、[知识图谱](../context-compilation/03-knowledge-graph.md)或[日报](../context-compilation/04-daily-report.md)中的一种,按教程准备来源并执行。先确认任务完成和产物位置,再检查内容:++- 关键事实是否能回到来源核对?+- 有哪些遗漏、重复或没有依据的表述?+- 你能否用产物完成原本的阅读或整理任务?++第一次选你熟悉的来源,便于识别错误。任务成功或文件生成,只说明处理完成;产物是否可用仍需要核对。++## 有结果后,选择一条继续路径++| 当前结果 | 下一步 |+| --- | --- |+| 文档检索满足需要,想在日常工具里使用 | [接入已有 Agent](../agent-integrations/01-overview.md) |+| 已验证能力,准备写入自己的应用 | [应用开发路径](../workflows/01-overview.md) |+| 想使用 OpenViking 自带的 Agent | [VikingBot 安装与配置](../guides/17-vikingbot.md) |+| 准备让团队共享服务 | [选择部署路径](../guides/00-overview.md),再核对身份与访问控制 |+| 想理解结果背后的机制 | [概念与原理](../concepts/00-overview.md) |++保留试用中的问题、预期来源和实际结果,后续改配置或升级时用同一组任务复查。若要比较使用前后的变化,保持任务、模型与输入条件一致;检索分数和单次成功不能代替效果比较。diff --git a/docs/zh/guides/00-overview.md b/docs/zh/guides/00-overview.mdnew file mode 100644index 000000000..f69ceb89f--- /dev/null+++ b/docs/zh/guides/00-overview.md@@ -0,0 +1,23 @@+# 选择部署路径++如果你只需要使用别人提供的服务地址和 API Key,直接[连接 CLI](../getting-started/05-cli-setup.md)或[接入 Agent](../agent-integrations/01-overview.md)。下面的路径面向服务部署与运维人员。++| 部署目标 | 阅读顺序 | 完成标准 |+| --- | --- | --- |+| 本地体验 | [快速开始](../getting-started/02-quickstart.md) | 导入一份文档,检索并读取其中的内容 |+| 自建共享服务 | [自建服务](03-deployment.md) → [身份认证](04-authentication.md) → [公网访问](12-public-access.md) | 验证持久化、授权访问、未授权拒绝和首次数据处理 |+| 企业私有化交付 | [部署前检查](19-deployment-checklist.md) → [安装与验收](20-private-deployment.md) → [升级与排障](21-private-operations.md) | 按交付物清单与安装指南逐项验收 |++企业私有化路径依赖交付物、镜像和环境条件,先核对清单。++## 配置模型与访问控制++首次设置模型,使用[配置模型与服务](01-configuration.md);查某个字段,使用[服务端配置字段](../configuration/01-server.md)。服务端 `ov.conf` 与客户端 `ovcli.conf` 的职责不同,客户端字段见[客户端配置](../configuration/02-client.md)。++开放远程访问前完成身份认证和反向代理配置。需要 OAuth 的 MCP 客户端继续阅读 [OAuth 2.1](11-oauth.md)。多用户共享时,理解[多租户身份](../concepts/11-multi-tenant.md)和 [ACL 继承](../concepts/15-acl.md);需要静态数据加密时,按[加密指南](08-encryption.md)配置。++## 运行后如何检查++先从[观测与排障入口](05-observability.md)选择工具。单次请求看[操作遥测](07-operation-telemetry.md),时间趋势看 [Prometheus / Grafana](11-grafana-prometheus.md),指标含义查[指标口径](../concepts/12-metrics.md)。常见问题见[FAQ](../faq/faq.md)。++有存储或性能需求时,再选择[主备存储](13-multi-write-storage.md)、[RAGFS 缓存](14-ragfs-cache.md)或 [cuVS](16-cuvs.md)。这些是按需配置项,不是首次部署的必经步骤。diff --git a/docs/zh/guides/01-configuration.md b/docs/zh/guides/01-configuration.mdindex 5443a0069..a39025aed 100644--- a/docs/zh/guides/01-configuration.md+++ b/docs/zh/guides/01-configuration.md@@ -1,4 +1,6 @@-# 配置+# 配置模型与服务++本文用于选择模型、组合配置示例和理解生效范围。只查字段时,请看[服务端配置字段](../configuration/01-server.md)或[客户端配置字段](../configuration/02-client.md);首次部署从[部署路径](00-overview.md)开始。OpenViking 使用 JSON 配置文件(`ov.conf`)进行设置。配置文件支持 Embedding、VLM、Rerank、存储、解析器等多个模块的配置。@@ -15,24 +17,6 @@ openviking-server doctor`openviking-server init` 会分别引导你填写 Embedding 和 VLM 的配置。对于 `OpenAI`、`Volcengine`、`Kimi`、`GLM` 这类 API 型 VLM,按提示填写对应的 VLM API Key;如果要使用 Codex 作为 VLM,请选择 `OpenAI Codex`,向导会自动帮你处理已有 Codex 鉴权的导入,或直接引导你完成登录。-## Account Embedding 与 VectorDB--ROOT 可在创建 Account 时配置 `settings.embedding` 和 `settings.vectordb`,-两者使用 Account 专用白名单模型。Account 与 Cluster 配置分别保存,向量业务-resolver 为 Account 未设置的值应用 Cluster 默认。Provider 连接只能通过完整-`credentials` binding 提交,不能跨 Account/Cluster 拼接。配置查询只返回-Account 配置。--VectorDB 创建后不可修改。新旧 Account 均可轮换完整 Embedding-credentials/deployment binding,并更新重试、并发、failback 和熔断参数;-外层 model 身份及其他向量空间字段仅创建时可设。兼容 endpoint 更新不打断-在途调用,也不会自动重建历史向量。--Account 独立配置的 VectorDB 仅支持远端 backend;Account 不能选择 local/cuvs,-也不能设置本地路径、cuVS 调优或自定义 adapter 参数。未设置 VectorDB 的-Account 复用 Cluster 连接并保留数据过滤。远端资源由外部控制面提前创建。权限与 PATCH 规则见-[Admin 配置 API](../api/08-admin.md#runtime-configuration)。-## 快速开始在用户配置目录 `~/.openviking/` 下创建 `ov.conf`:@@ -136,6 +120,24 @@ PATCH 采用三态语义:字段缺失表示不修改,具体值表示设置配置,且仅用于兼容旧行为;新功能需要在业务解析器中实现 Cluster 默认值。详见 [Admin API - 运行时配置](../api/08-admin.md#runtime-configuration)。+## Account Embedding 与 VectorDB++ROOT 可在创建 Account 时配置 `settings.embedding` 和 `settings.vectordb`,+两者使用 Account 专用白名单模型。Account 与 Cluster 配置分别保存,向量业务+resolver 为 Account 未设置的值应用 Cluster 默认。Provider 连接只能通过完整+`credentials` binding 提交,不能跨 Account/Cluster 拼接。配置查询只返回+Account 配置。++VectorDB 创建后不可修改。新旧 Account 均可轮换完整 Embedding+credentials/deployment binding,并更新重试、并发、failback 和熔断参数;+外层 model 身份及其他向量空间字段仅创建时可设。兼容 endpoint 更新不打断+在途调用,也不会自动重建历史向量。++Account 独立配置的 VectorDB 仅支持远端 backend;Account 不能选择 local/cuvs,+也不能设置本地路径、cuVS 调优或自定义 adapter 参数。未设置 VectorDB 的+Account 复用 Cluster 连接并保留数据过滤。远端资源由外部控制面提前创建。权限与 PATCH 规则见+[Admin 配置 API](../api/08-admin.md#runtime-configuration)。+## 配置示例<details>@@ -1585,7 +1587,7 @@ RAGFS 默认使用 Rust binding 模式,通过 Rust 实现直接访问文件系|------|------|------|--------|| `backend` | str | VectorDB 后端类型: 'local'(基于文件), 'http'(远程服务), 'volcengine'(云上 VikingDB), 'vikingdb'(私有部署)或 'cuvs'(本地存储 + GPU dense search) | "local" || `name` | str | VectorDB 的集合名称 | "context" |-| `url` | str | 'http' 类型的远程服务 URL(例如 'http://localhost:5000') | null |+| `url` | str | 'http' 类型的远程服务 URL(例如 `http://localhost:5000`) | null || `project_name` | str | 项目名称(别名 project) | "default" || `distance_metric` | str | 向量相似度搜索的距离度量(例如 'cosine', 'l2', 'ip') | "cosine" || `dimension` | int | 向量嵌入的维度 | 0 |diff --git a/docs/zh/guides/05-observability.md b/docs/zh/guides/05-observability.mdindex f9a4c04a9..3e5ff4a5c 100644--- a/docs/zh/guides/05-observability.md+++ b/docs/zh/guides/05-observability.md@@ -544,7 +544,7 @@ OpenViking 仓库里已经提供了可直接导入的 dashboard JSON:导入成功后,你最终会看到一个以 OpenViking 请求、队列、探针、模型调用和系统状态为主的总览 dashboard。效果示意可以参考:-- [grafana-demo-dashboard.png](../../images/grafana-demo-dashboard.png)+- [grafana-demo-dashboard.png](/grafana-demo-dashboard.png)这张图可以帮助你快速确认“导入后的面板布局是不是正常”。如果你的 dashboard 基本结构和它一致,但局部面板没有数据,通常说明是对应指标当前没有产生样本,或者筛选条件与实际流量不匹配。diff --git a/docs/zh/guides/06-mcp-integration.md b/docs/zh/guides/06-mcp-integration.mdindex 736b3ac3f..a3cfc7fcf 100644--- a/docs/zh/guides/06-mcp-integration.md+++ b/docs/zh/guides/06-mcp-integration.md@@ -1,4 +1,4 @@-# MCP 集成指南+# MCP 工具与协议OpenViking Server 内置 [MCP (Model Context Protocol)](https://modelcontextprotocol.io/) 端点。支持 Streamable HTTP 的客户端可直接连接;只支持 stdio 的客户端可使用 [Agent Plugins 包](../agent-integrations/15-agent-plugins.md)提供的代理。diff --git a/docs/zh/guides/10-prompt-guide.md b/docs/zh/guides/10-prompt-guide.mdindex 8912b716b..b0b677d40 100644--- a/docs/zh/guides/10-prompt-guide.md+++ b/docs/zh/guides/10-prompt-guide.md@@ -1,4 +1,4 @@-# OpenViking Prompt 说明与自定义指南+# 自定义处理 Prompt本文介绍 OpenViking 当前的 prompt 模板体系,重点说明:diff --git a/docs/zh/guides/15-snapshot.md b/docs/zh/guides/15-snapshot.mdindex a96e2b28f..7bca6fe3c 100644--- a/docs/zh/guides/15-snapshot.md+++ b/docs/zh/guides/15-snapshot.md@@ -1,4 +1,4 @@-# 多版本管理(快照)指南+# 版本管理指南快照将指定范围内的文件树保存为不可变版本。使用 `commit` 保存、`log` 查看历史、`show` 读取旧版文件、`restore` 恢复已保存的内容。快照不保存未提交的改动或提交时被排除的文件,ACL 和向量索引也不保存历史版本。恢复会比较来源快照与 HEAD,因此受影响路径上的未提交改动可能被覆盖。diff --git a/docs/zh/guides/17-vikingbot.md b/docs/zh/guides/17-vikingbot.mdindex ea368648f..197143197 100644--- a/docs/zh/guides/17-vikingbot.md+++ b/docs/zh/guides/17-vikingbot.md@@ -1,5 +1,7 @@# VikingBot 安装与配置+先了解 [VikingBot 的用途与架构](../concepts/15-vikingbot.md),再按本页完成安装。+VikingBot 是 OpenViking 内置的多渠道 AI Agent。它既可以和 OpenViking 一起启动,也可以在本地独立调试,或作为长期运行的 Gateway 接入聊天平台。本指南介绍安装方式,以及三种主要使用场景的配置和启动方法。Agent 工具、聊天渠道、架构等完整说明请参见 [VikingBot 中文文档](https://github.com/volcengine/OpenViking/blob/main/bot/README_CN.md)。diff --git a/docs/zh/reference/01-overview.md b/docs/zh/reference/01-overview.mdnew file mode 100644index 000000000..682601d3b--- /dev/null+++ b/docs/zh/reference/01-overview.md@@ -0,0 +1,15 @@+# 选择参考文档++这里用于查接口约定、协议和配置字段。系统行为与设计约束见[概念与原理](../concepts/00-overview.md)。第一次使用请走[快速开始](../getting-started/02-quickstart.md);还没确定调用哪些接口,请先选[应用开发任务](../workflows/01-overview.md)。++| 要查什么 | 入口 |+| --- | --- |+| SDK 连接、HTTP 认证、响应格式、错误码 | [SDK、HTTP 与 CLI 约定](../api/01-overview.md) |+| 服务端或客户端配置字段 | [服务端配置](../configuration/01-server.md)、[客户端配置](../configuration/02-client.md) |+| MCP 工具、参数与上传协议 | [MCP 工具与协议](../guides/06-mcp-integration.md);安装客户端看[连接 MCP 客户端](../agent-integrations/06-mcp-clients.md) |+| 资源、文件和检索接口 | [资源](../api/02-resources.md)、[文件系统](../api/03-filesystem.md)、[内容](../api/12-content.md)、[检索](../api/06-retrieval.md) |+| 会话、记忆与技能接口 | [会话](../api/05-sessions.md)、[记忆](../api/16-memory.md)、[技能](../api/04-skills.md) |+| 管理、权限与后台状态 | [Admin](../api/08-admin.md)、[ACL](../api/12-acl.md)、[后台任务](../api/17-tasks.md)、[Observer](../api/18-observer.md) |+| 数据一致性、隔离和处理完成的含义 | [系统架构](../concepts/01-architecture.md)、[事务与恢复](../concepts/09-transaction.md)、[多租户](../concepts/11-multi-tenant.md)、[任务状态](../concepts/16-queue-lifecycle.md) |++侧边栏按接口所属对象排列;同一主题的操作指南保留在“开发应用”或“部署运维”,通过文内链接互相连接。配置步骤见[配置模型与服务](../guides/01-configuration.md),集成之间的差异见[集成能力对照](../agent-integrations/16-capability-reference.md)。diff --git a/docs/zh/workflows/01-overview.md b/docs/zh/workflows/01-overview.mdnew file mode 100644index 000000000..f2557f4a6--- /dev/null+++ b/docs/zh/workflows/01-overview.md@@ -0,0 +1,25 @@+# 应用开发路径++先完成[第一次导入与检索](../getting-started/02-quickstart.md),再选择下面的任务。已有 Agent 的用户从[接入 Agent](../agent-integrations/01-overview.md)开始;自己编写应用时,用 [SDK、HTTP 与 CLI 约定](../api/01-overview.md)选择调用方式。++| 要完成的任务 | 阅读顺序 | 用什么确认结果 |+| --- | --- | --- |+| 让应用检索文档或代码 | [导入资源](../api/02-resources.md) → [检索](../api/06-retrieval.md) → [读取内容](../api/12-content.md) | 用已知答案的问题查询,读取命中 URI,核对原文 |+| 跨会话复用记忆 | [会话与记忆模型](../concepts/08-session.md) → [会话 API](../api/05-sessions.md) → [记忆 API](../api/16-memory.md) | 提交会话并确认后台任务完成,再检查记忆内容和归属 |+| 让 Agent 复用技能 | [技能 API](../api/04-skills.md) → [隐私模型](../concepts/13-privacy.md) | 检查安装后的技能内容、可见范围和调用方式 |+| 从已有资料产出 Wiki、图谱或日报 | [上下文编译](../context-compilation/01-overview.md) → 选择产物教程 | 检查任务状态、产物目录,以及产物与输入来源的对应关系 |+| 同步或迁移已有上下文 | [项目资源同步](../guides/18-openviking-assets.md)、[OVPack](../guides/09-ovpack.md)或[版本恢复](../guides/15-snapshot.md) | 按对应指南核对同步状态、导入结果或恢复后的内容 |++## 先验证检索,再接入应用++使用一份内容已知的小文档,走完导入、等待处理、检索、读取原文的流程。`health` 成功只说明服务可以响应;空结果也不能单独证明导入失败。查看[后台任务](../api/17-tasks.md)与[观测入口](../guides/05-observability.md),区分处理状态和检索结果。++需要持续更新远程资源时,再接入 [Resource Watch](../api/15-watches.md)。需要调整内容处理方式时,查看 [Prompt 自定义](../guides/10-prompt-guide.md)。++## 再验证跨会话记忆++先确定[用户、Peer 与共享上下文的边界](../concepts/11-multi-tenant.md),再写入消息并提交会话。记忆提取受配置和策略控制,提交成功不等于一定产生某条记忆。用[会话 API](../api/05-sessions.md)与[记忆 API](../api/16-memory.md)检查实际产物;接入已有工具时,先查[集成能力对照](../agent-integrations/16-capability-reference.md),确认哪些步骤由插件自动执行。++## 上线前补齐访问与运维++共享服务需要配置[身份认证](../guides/04-authentication.md)和 [ACL](../concepts/15-acl.md)。部署路径、观测与升级入口集中在[部署运维](../guides/00-overview.md)。查参数、响应和错误时,进入[参考文档](../reference/01-overview.md)。