* lisence: change the main lisence from Apache-2.0 to AGPL-v3
* lisence: change the main lisence from Apache-2.0 to AGPL-v3
* lisence: change the main lisence from Apache-2.0 to AGPL-v3
---------
Co-authored-by: openviking <openviking@example.com>
The quickstart-server.md auth section previously just said "pass api_key"
without distinguishing user_key from root_key. This causes users to
mistakenly use root_key for tenant-scoped APIs (add_resource, find, ls),
which fails with "ROOT requests to tenant-scoped APIs must include
X-OpenViking-Account and X-OpenViking-User headers".
Changes:
- docs/zh/getting-started/03-quickstart-server.md: expanded auth section
with user_key (recommended) and root_key (must pass account/user)
examples, plus warning about the common pitfall
- docs/en/getting-started/03-quickstart-server.md: same changes in English
- examples/basic-usage/README.md: added multi-tenant auth note after
HTTP client example
- examples/basic-usage/README_CN.md: same note in Chinese
Closes#1022
Co-authored-by: wzr <2668940489@qq.com>
Line 722 re-declared `const sessionId = ctx.sessionId ?? ""` which was
already declared on line 711 within the same execute() scope. This
caused a ParseError at plugin load time:
Identifier 'sessionId' has already been declared.
/home/.../.openclaw/extensions/openviking/index.ts:722:14
Removed the duplicate declaration so the existing sessionId from
line 711 is reused.
Co-authored-by: Evaldas <evaldas@openclaw.ai>
* fix(openclaw-plugin): fix compact result mapping
* fix(openclaw-plugin): align compact result fields
* fix(openclaw-plugin): mark unknown tokensBefore as -1
- Resolve latest semver tag from GitHub API when PLUGIN_VERSION unset
- Mirror logic in install.sh and setup-helper/install.js
- Update INSTALL.md / INSTALL-ZH.md for new defaults and examples
- Bump openclaw-openviking-setup-helper to 0.2.11 (npm)
Made-with: Cursor
* chore: remove old claude-memory-plugin example
* feat(claude code): add Claude Code memory plugin example
* Revert "chore: remove old claude-memory-plugin example"
This reverts commit e4519a06be.
* chore: replace legacy claude-memory-plugin with migration guide
- Installer: Python path fix, version compatibility, legacy plugin support (79781f58)
- OpenClaw plugin: manifest/FALLBACK optional+required, download retries, optional 404 UX; session-transcript-repair.ts optional in manifest (installer may skip on 404)
- context-engine unchanged from base (static session-transcript-repair import)
- Docs: INSTALL/INSTALL-ZH; Windows via npm/ov-install; remove install.ps1 and INSTALLER-UPGRADE-PROPOSAL
- setup-helper version bump for npm dev line
Made-with: Cursor
Make duplicate plugin registration idempotent across retries and stop/reload flows, and add regression coverage for failure rollback and stale stop handling.
* docs: Add Chinese documentation for example READMEs
- Add README_CN.md for claude-memory-plugin
- Add README_CN.md for k8s-helm
- Add README_CN.md for mcp-query
These translations help Chinese users understand the example usage and configuration.
* docs: Add basic usage example for Python SDK
- Add comprehensive README.md with code examples
- Add Chinese version README_CN.md
- Add basic_usage.py demonstrating core features:
- Initialization (embedded mode and HTTP client mode)
- Adding resources (URLs, files, directories)
- Browsing the virtual filesystem
- Semantic search and retrieval
- Tiered context loading (L0/L1/L2)
- Session management for memory
This example helps developers quickly get started with OpenViking.
---------
Co-authored-by: xingzihai <xingzihai@users.noreply.github.com>
* feat(session): make commit two-phase with async memory extraction
Session commit now returns immediately after archiving messages (Phase 1).
Summary generation and memory extraction (Phase 2) run in the background
via asyncio.create_task(), returning a task_id for polling progress.
- Add get_task() API across all client layers for querying background task status
- get_session() auto-creates session if it does not exist
- Remove wait parameter and telemetry from commit endpoint
- Add .done completion marker to archive directories
- Update docs (EN/ZH) and tests for new two-phase flow
* feat(session): add .meta.json persistence and auto_create control for get_session
SessionService.get() now defaults to auto_create=False, raising NotFoundError
for missing sessions. A new SessionMeta dataclass tracks created_at, updated_at,
message_count, commit_count, memories_extracted (by category), last_commit_at,
and cumulative llm_token_usage. Meta is persisted to .meta.json and updated on
add_message, commit Phase 1 (message clear), and commit Phase 2 completion
(token usage, memory counts via bind_telemetry). All client layers
(local/async/sync/HTTP) and API docs updated accordingly.
* fix: remove session vectorize
* support commit for openclaw-plugin
Made-with: Cursor
* feat(openclaw-plugin): archive-aware context assembler with lazy-read optimization
- Implement get_context_for_assemble with token-budget-aware archive trimming
- Write .meta.json during commit for pre-stored token counts
- Lazy-read archives from newest to oldest, skip old archives when budget exhausted
- Backward-compatible: fall back to reading overview for old archives without .meta.json
- Pass agentId through getContextForAssemble in client.ts
- Use sessionKey from OpenClaw in assemble to match afterTurn session resolution
- Emit non-error toolResult for pending/running tools instead of synthetic error
- Log warning and mark stats on ls(history) failure instead of silent swallow
* refactor(openclaw-plugin): unify OV session identity to sessionId
Made-with: Cursor
* feat(openclaw-plugin): add memory chain integration test script
Made-with: Cursor
* add test and desc of openclaw-plugin
* change commit to async
---------
Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
Co-authored-by: wlff123 <wulf234@163.com>
Co-authored-by: Eurekaxun <eurekaxun@163.com>
Co-authored-by: lin-qiang123 <1667704220@qq.com>
* feat(session): make commit two-phase with async memory extraction
Session commit now returns immediately after archiving messages (Phase 1).
Summary generation and memory extraction (Phase 2) run in the background
via asyncio.create_task(), returning a task_id for polling progress.
- Add get_task() API across all client layers for querying background task status
- get_session() auto-creates session if it does not exist
- Remove wait parameter and telemetry from commit endpoint
- Add .done completion marker to archive directories
- Update docs (EN/ZH) and tests for new two-phase flow
* feat(session): add .meta.json persistence and auto_create control for get_session
SessionService.get() now defaults to auto_create=False, raising NotFoundError
for missing sessions. A new SessionMeta dataclass tracks created_at, updated_at,
message_count, commit_count, memories_extracted (by category), last_commit_at,
and cumulative llm_token_usage. Meta is persisted to .meta.json and updated on
add_message, commit Phase 1 (message clear), and commit Phase 2 completion
(token usage, memory counts via bind_telemetry). All client layers
(local/async/sync/HTTP) and API docs updated accordingly.
* fix: remove session vectorize
* support commit for openclaw-plugin (#902)
Made-with: Cursor
* fix: reuse latest archive overview in session context
Thread the latest completed archive overview into archive summary generation and memory extraction, and simplify search context assembly to current messages plus the latest archive overview.
Co-Authored-By: Claude Opus 4.6
* refactor: session overview
---------
Co-authored-by: AutoCoder <wulf234@163.com>
* docs: add memory extractor templating and update mechanism optimization design document
- Add bilingual (English/Chinese) design document for memory templating system
- Include YAML-based MemoryTypeRegistry with 8 built-in types
- Detail ReAct 3+1 phase flow with pre-fetch optimization
- Describe 3-operation Schema: write/edit/delete
- Document RoocodePatch SEARCH/REPLACE format
- Explain dual-mode design: simple mode vs template mode
- Cover pre-fetch optimization: ls directories + read .abstract.md/.overview.md + search once
- Include merge operations: patch, sum, avg, immutable
- Address #578: allow custom prompt template addition and specification
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add memory templating system with ReAct orchestrator
- Add YAML-configurable memory schemas (cards, events, entities, etc.)
- Implement MemoryReAct with tool use (read/find/ls)
- Add schema-driven memory operations (write_uris/edit_uris/delete_uris)
- Implement memory patch handler for incremental updates
- Add comprehensive test suite
* refactor: memory extractor templating system with ReAct orchestrator
## Summary
Implement memory templating system (GitHub Issue #578) - a complete
rewrite of the memory extractor subsystem to support YAML-configurable
memory types instead of hardcoded categories.
## Key Changes
### Architecture
- Replace hardcoded 8 memory types with YAML-configurable schema system
- Add MemoryTypeRegistry to load memory type definitions from YAML files
- Dynamic Pydantic model generation from schema for type safety
- Field-level merge operations: PATCH, SUM, IMMUTABLE
### Memory Extraction Flow
- Implement ReAct orchestrator for single-pass memory updates
- MemoryUpdater for applying operations to storage
- Memory tools (read, search, ls) for ReAct loop
- Stable JSON parser with 5-layer fault tolerance
### File Naming & Storage
- Semantic filenames from template ({topic}.md instead of random IDs)
- Two memory modes: simple mode and template mode
- MEMORY_FIELDS HTML comment for structured metadata
### Configuration
- 9 YAML templates in openviking/prompts/templates/memory/
- memory_config.py for memory system configuration
- Dual-threshold compact upload mechanism in design doc
### Deletions
- Remove old memory_content.py, memory_data.py, memory_operations.py
- Remove memory_types.py, memory_utils.py, memory_patch.py
- Remove corresponding old test files
### Updated Components
- VLM backends (litellm, openai, volcengine) for new interfaces
- Session and service core integration
- Test suite for new architecture
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: pass ctx/user/session_id in commit_async for memory extraction
## Summary
Fix missing parameters in commit_async() when calling extract_long_term_memories().
The synchronous commit() method correctly passes these parameters, but the async
version was missing them, causing memory extraction to be skipped.
## Changes
- Pass user=self.user, session_id=self.session_id, ctx=self.ctx
in commit_async() when calling extract_long_term_memories()
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: convert FindResult to dict before returning from search tool
## Summary
Fix JSON serialization error by converting FindResult object to dict
using its to_dict() method before returning from MemorySearchTool.
## Changes
- In MemorySearchTool.execute(), return search_result.to_dict()
instead of search_result directly
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: swap None check before accessing final_operations in memory_react
Also rename schema_models.py to schema_model_generator.py for clarity.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add edit_overview support and optimize memory registry initialization
- Add edit_overview_operations to MemoryUpdater for updating .overview.md files
- Optimize MemoryTypeRegistry initialization in SessionCompressorV2 (load once)
- Various memory templating system improvements
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: remove unnecessary indent in JSON schema output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add markdown link format hint to overview field description
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add pre-fetch search based on user messages in conversation
Also fix duplicate line in system prompt.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* rebase
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* fix(resource): resolve 'file exists' errors on resource add
Two bugs caused mv to fail with "file exists" during add_resource:
1. When `to` URI has a trailing slash, parent_uri was computed as the
target directory itself instead of its parent. mkdir then created
the exact path that mv was about to rename into.
2. _resolve_unique_uri in Phase 3.5 ran outside bind_request_context,
so stat checked the default account path instead of the actual
account. On repeated adds it failed to detect the existing resource
and returned the original URI, causing mv to collide.
Also pass ctx to viking_fs calls in index_resource that were missing it.
* Update GUIDE.md
---------
Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
The token estimator (_estimate_token_count) uses a simplified heuristic
(0.3 tokens/non-CJK-non-space char) that can underestimate actual token
counts for dense code or technical content. This caused large sections to
pass the token check and be written as single L2 files, which then
exceeded embedding API limits (e.g., text-embedding-v4 8192 token cap).
Changes:
- Add `max_section_chars: int = 6000` to ParserConfig as a hard character
limit per section, guarding against token estimation errors
- `_smart_split_content`: enforces char limit per split chunk alongside
the existing token estimate limit; falls back to token-only splitting
when max_section_chars <= 0 to avoid range(n, 0) crash
- `_save_section`: requires both token AND char limits satisfied before
writing a section as a single file
- `_save_merged`: splits joined content via _smart_split_content when the
merged result exceeds max_section_chars, preventing token-small but
char-large sections from accumulating into oversized files
- `_parse_and_create_structure`: small-document fast-path now also checks
char count before writing as a single file
- `ParserConfig.validate()`: rejects max_section_chars <= 0
- `ParserConfig` class docstring: add max_section_chars attribute,
fix max_section_size description ("characters" -> "tokens")
- `ov.conf.example`: add max_section_chars to pdf parser block
Add 21 unit tests covering ParserConfig defaults and validation,
_smart_split_content char-limit enforcement, _save_section and
_save_merged char-limit gates, and _parse_and_create_structure
fast-path with and without headings (VikingFS mocked throughout).
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add OpenAIRerankClient using standard flat request/response format
compatible with DashScope compatible-api and other OpenAI/Cohere-style
rerank APIs (no input/output wrappers)
- Fix silent data corruption: add index bounds-checking so out-of-bounds
or missing index returns None with a warning
- Add provider allow-list validation in RerankConfig ('vikingdb'|'openai')
- Remove unnecessary getattr() in RerankClient.from_config()
- Update ov.conf.example: keep vikingdb (doubao) as primary rerank config,
add rerank_openai_example section for DashScope qwen3-rerank
- Update docs (en/zh): add OpenAI-compatible provider example alongside
existing volcengine example in configuration guide and schema
- Add 24 tests covering success, edge cases, and factory dispatch
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
PR #662 renamed the plugin directory and rewrote index.ts from a stale
branch base, silently dropping two merged bug fixes:
- #681: share pending clientPromise across dual-context registrations
to prevent before_agent_start hook from hanging forever
- #688: wrap auto-recall search in withTimeout(5s) to prevent indefinite
agent hang when OpenViking search API is slow or unresponsive
- Import withTimeout from process-manager.js
- Wrap getClient() call with 5-second timeout to prevent indefinite blocking
- Gracefully handle timeout by logging warning and skipping recall
- Fixes issue where agent would hang if OpenViking service wasn't ready yet
Related: #673#748
Co-authored-by: 峻谦 <junqian@192.168.31.143>
* feat(openclaw-context-plugin): migrate OpenViking memory plugin to context engine
1. Rename the OpenClaw plugin from memory-openviking to openclaw-context-plugin and switch its kind from memory to context-engine.
2. Keep auto-recall and ingest-reply-assist on before_prompt_build to preserve the existing prompt injection behavior.
3. Move the canonical auto-capture flow from the old agent_end-style lifecycle to ContextEngine afterTurn.
4. Delegate compact handling to the legacy compact engine when it is available, so existing compaction behavior can still be reused.
5. Preserve the OpenViking tools and local process management while updating setup helpers, installers, docs, and OpenClaw config paths to plugins.slots.contextEngine.
Co-authored-by: GPT-5.4 <noreply@openai.com>
* refactor(openclaw-context-plugin): rename plugin id to context-openviking
- rename the runtime plugin id, package name, install destination, and OpenClaw config keys from openclaw-context-plugin to context-openviking
- keep the source directory at examples/openclaw-context-plugin unchanged while updating docs, installers, and setup helpers to use the new runtime name
- remove unused sys imports from the demo scripts so ruff check stays green
---------
Co-authored-by: GPT-5.4 <noreply@openai.com>