Commit Graph
41 Commits
Author SHA1 Message Date
agent 2d5aa9cd3d fix(plugins): ship Experience skill in plugin packages (#3946)
* fix(plugins): ship experience memory skill

* fix(openclaw): drop unpublished selector aliases
2026-08-12 11:18:22 +08:00
agent 00f3738edb feat(usage): emit resource-scoped experience usage records (#3921)
* feat(usage): expand experience tracking and log schema

* fix(usage): preserve experience count event names

* refactor(agent-evolution): use generic OpenViking tools

* fix(usage): capture generic OpenViking tool events

* feat(skills): guide cross-agent experience retrieval

* fix(usage): address generic tool migration review
2026-08-11 22:20:18 +08:00
Zayn JarvisandClaude Fable 5 03bd469417 fix(openclaw-plugin): drop SecretRef exec resolver from packaged plugin (#3849)
Marketplace install scanners (ArkClaw) block plugins whose shipped code
contains child_process. Keep env/file SecretRef sources; configuring
{source:"exec"} now fails with a clear error pointing at env/file.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-06 18:50:38 +08:00
Zayn JarvisandClaude Fable 5 1be7b83640 fix(openclaw-plugin): narrow ParsedMemoryOpenVikingConfig.apiKey to string (#3832)
parse() resolves SecretRef values to plain strings before returning, but the
parsed type still inherited string | OpenVikingSecretRef from the input type,
breaking tsc -p tsconfig.build.json (release prepack) since #3618.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-06 16:10:33 +08:00
agent 61c42e3bb0 feat(openclaw): add experience memory tools (#3827) 2026-08-06 15:52:31 +08:00
Ziyang Guo abc387955d feat(openclaw-plugin): SecretRef support for config.apiKey (#3522) (#3618)
Issue #3522 — the OpenClaw plugin's `config.apiKey` only accepted a plain
string, resolved through local `${ENV_VAR}` interpolation. `INSTALL*.md`
documented this as a known limitation: users who store their other OpenClaw
provider credentials (LLM, TTS, MCP servers) through the standard
`{source, id[, provider]}` SecretRef mechanism (env / file mount /
exec-backed vault such as 1Password, Vault, gopass) had to keep the
OpenViking key as cleartext inside `openclaw.json`.

### config.ts — `string | OpenVikingSecretRef` widening

* Add `OpenVikingSecretRef = "env"|"file"|"exec"` discriminated union type,
  matching the shape OpenClaw core uses for its own credential fields
  (`env` + `file` implemented in-plugin, `exec` forwarded to `child_process`
  so providers like `@transmitt0r/openclaw-plugin-onepassword` can manage
  the OpenViking key without SDK coupling).
* Add `resolveSecret()` resolver with explicit, actionable errors:
  - env: unset var = throw, no silent empty fallback
  - file: `~` expanded, UTF-8 read, whitespace trimmed; unreadable file
    rethrows with the OpenViking field name prefixed so config misconfigs
    surface with a clear label and path
  - exec: lazy `require("node:child_process").execFileSync(provider,[id])`,
    stdout trimmed, 15s timeout; errors prefixed with provider + id
  - unknown source / missing id / missing exec provider = explicit throw
* `memoryOpenVikingConfigSchema.parse()` widens `rawApiKey` to
  `string | OpenVikingSecretRef`, then passes it through
  `resolveSecret(rawApiKey, "config.apiKey")` *before* the existing
  `resolveEnvVars` pass. Plain strings transparently fall through
  `resolveSecret` unchanged, so `${ENV_VAR}` interpolation is preserved
  100% backward-compatibly.
* `OPENVIKING_API_KEY` env fallback is unchanged and triggers only when the
  `apiKey` config key is absent — a user who deliberately sets `apiKey: ""`
  still gets "" (explicitly unauthenticated), not the env fallback.
* `uiHints.apiKey.help` documents the SecretRef shape and recommends it.

### openclaw.plugin.json — widening schema + UI hints

* `configSchema.properties.apiKey` becomes `oneOf: [string, env ref, file ref, exec ref]`.
  Each object variant has a `title`, `additionalProperties: false`,
  `required`, and explicit description per field, so OpenClaw's config UI
  can render them individually instead of showing a generic JSON object blob.
* `uiHints.apiKey.help` matches the new config.ts wording.

### INSTALL.md / INSTALL-ZH.md — SecretRef usage tables

Replace the old "plaintext / chmod 0600" caveat bullet with a 3-row table
(env / file / exec) showing example JSON + notes (Kubernetes secretKeyRef
mount for `file`, 1Password `op://` URL convention for `exec`). The
backward-compat string path is retained at the end of the new bullet so
existing deployments that haven't migrated yet still get the old permission
advice — no surprise behaviour for upgrading users.

### tests/ut/config.test.ts — SecretRef regression suite (10 new cases)

Under a new `describe("… SecretRef (#3522)")`:

1. Backward compat: `${OV_KEY}` interpolation still resolves.
2. env source — happy path with a fresh env var.
3. env source — unset var throws, no silent fallback.
4. file source — real `mkdtemp`-created file, trimmed whitespace. Cleanup
   in `afterEach`.
5. file source — missing-path error message contains readable label + path.
6. exec source — `vi.spyOn(child_process.execFileSync)` asserts provider +
   args, stdout trimmed.
7. exec source — missing `provider` field errors.
8. Schema validation — unknown `source` and missing `id` each throw with
   error messages that name the problem.
9. Env fallback boundary — explicit `apiKey: ""` is NOT overridden by
   OPENVIKING_API_KEY, but `apiKey` absent IS (backward-compat behaviour
   contract pinned with a test so future refactors can't regress).

Covers every branch inside `resolveSecret()`, plus the backward-compat
contracts issue #3522 called out.
2026-07-30 16:21:06 +08:00
Carateffee 1a11b1ba3d fix(openclaw-plugin): support config headers (#3044) 2026-07-07 13:42:55 +08:00
LinQiang391andLinQiang391 7fa34c9520 fix(session): make failed archives skippable and tune OpenClaw auto-commit (#2775)
Treat failed session archives as terminal skipped state so later commits can continue, and replace OpenClaw's fixed auto-commit token threshold with a context-window ratio while tolerating the deprecated config key.

Co-authored-by: LinQiang391 <linqiang391@users.noreply.github.com>
2026-06-23 12:00:29 +08:00
Mingjian Que d9e40b0974 refactor(openclaw): add setup and routing modules (#2654)
* refactor(openclaw): add setup and routing modules

* docs(openclaw): align docs and healthcheck with peer routing

* refactor(openclaw): wire modular runtime into core

* fix(openclaw): package plugin runtime directory
2026-06-17 10:26:23 +08:00
Mingjian Que 740b7fcbe7 feat(openclaw): add runtime query config (#2646) 2026-06-16 20:47:47 +08:00
Qin Haojie 794ee3ee41 fix(openclaw): default peer role to assistant (#2626) 2026-06-15 21:54:55 +08:00
Mingjian Que 564c7624b8 feat(openclaw): configure recall target types (#2590)
* feat(openclaw): configure recall target types

* fix(openclaw): align recall session target uri

* fix(openclaw): remove session semantic recall target
2026-06-13 11:22:08 +08:00
Mingjian Que d497b05aee feat(openclaw): wire recall trace runtime (#2589)
* feat(openclaw): wire recall trace runtime

* feat(openclaw): expose recall trace gateway routes

* feat(openclaw): align archive recall trace details

* test(openclaw): cover auto recall trace recording

* fix(openclaw): avoid duplicate memory recall search
2026-06-13 11:05:33 +08:00
Mingjian Que e2ca85d8ec feat(openclaw): add recall trace core (#2587) 2026-06-13 10:28:20 +08:00
Mingjian Que 61203e84b2 feat(openclaw): gate agent-visible tools (#2566) 2026-06-12 14:48:21 +08:00
Mingjian Que 790daaf885 feat(openclaw): inject agent experience memories (#2281) 2026-06-10 10:43:41 +08:00
Mingjian Que e5c8208dcb Make OpenClaw auto-recall timeout configurable (#2448) 2026-06-05 14:05:54 +08:00
Qin Haojie ff258768c2 feat(memory): 引入 User/Peer 记忆隔离模型 (#2236)
* feat(memory): introduce user and peer memory isolation

Unify agent-scoped memory behavior into user-owned memory spaces, add peer_id compatibility for session and retrieval paths, and wire memory_policy through session commit flows.

* feat(memory): align session identity around peer IDs

* feat(search): pass peer id through retrieval

* refactor(memory): remove agent identity from integrations

* fix(memory): isolate peer identity from self extraction

* fix(tau2): provision benchmark user configs

* fix(auth): allow admin keys to access data APIs

* fix(openclaw): enable peer memory policy for peer roles

* fix(openclaw): resolve sender for peer recall

* refactor(session): simplify memory extraction routing

* refactor(ov-cli): reduce formatting-only diff

* refactor(message): remove unused message helpers

* refactor(retrieval): simplify peer target resolution

* refactor(namespace): remove deprecated agent namespace policy

* fix(agent): propagate peer id through integrations

* fix(auth): align integration clients with api-key mode
2026-06-05 10:55:48 +08:00
LinQiang391andLinQiang391 72a3cd29f0 feat(openclaw-plugin): support OpenClaw install and ClawHub release flow (#1904)
Squashes OpenClaw plugin install compatibility, setup helper source-build support, built dist output, and ClawHub release workflow updates into one publish commit.

Co-authored-by: LinQiang391 <linqiang391@users.noreply.github.com>
2026-05-08 17:38:04 +08:00
Eurakaxunandwlff123 51342319b4 Introduce Working Memory v2: 7-section session memory, anti-bloat guards, sliding-window tokens, and OpenClaw integration (#1782)
* feat(wm): WM v2 core - 7-section structure, pending_tokens, anti-bloat guard

Server-side implementation of Working Memory v2:

- 7-section structured WM format with section integrity guards

- pending_tokens sliding window for live session tracking (O(1) read)

- Anti-bloat Key Facts guard (dedup, capping, consolidation sentinel)

- Regex recovery fallback for malformed LLM WM output

- commitKeepRecentCount: keep recent messages live after commit

- WM v2 prompt templates (ov_wm_v2.yaml, ov_wm_v2_update.yaml)

- CommitRequest model with keep_recent_count parameter

* fix(wm): address 4 code review findings

- Replace hardcoded debug log path with configurable workspace path

- Add _rebuild_pending_tokens() after _update_message_in_jsonl()

- Detect WM v2 format via _is_wm_v2 to route legacy sessions to creation path

- Pass latest_archive_overview to creation template for legacy-aware bootstrapping

* test(wm): add unit tests for WM v2 guards, growth, and merge guardrails

- 62 tests for section guards, regex recovery, pending_tokens, merge logic

- 6 tests for anti-bloat growth behavior (dedup, capping, consolidation)

- 3 tests for dynamic reminders, key facts consolidation, and URL pruning guard

* feat(plugin): WM v2 plugin integration + ov_archive_search tool

- Add ov_archive_search tool for keyword-grep across session archives

- Add grepSessionArchives() client method for /api/v1/search/grep endpoint

- Rewrite system prompt to describe WM v2 structured sections

- Simplify archive index assembly (remove preAbstracts/budget processing)

- Add keepRecentCount to commitSession calls (afterTurn=cfg, compact=0)

- Add commitKeepRecentCount to plugin config schema

* fix(wm): post-feature refinements for WM v2

- Replace _wm_debug file logging with logger.debug
- Defensive clamps for pending_tokens / keep_recent_count
- Include tool/context parts in WM generation formatting
- Limit Open Issues anti-drift restore to one round (allow stale resolution)
- Resolve commitSession merge conflict in plugin
- Edge case tests + plugin tests update

* fix(wm): restore Phase 2 request tracking, archive_uri, and agentId

* docs(wm): add WM v2 design overview

---------

Co-authored-by: wlff123 <wlff123@users.noreply.github.com>
2026-05-02 22:09:59 +08:00
AutoCoder 4d6f5b65bd fix(openclaw): route auto recall through assemble (#1835) 2026-05-01 16:39:32 +08:00
bot-of-qin-ctxandqin-ctx 9c08d716ca fix(openclaw): treat agent_prefix as prefix only (#1809)
* fix(openclaw): treat agent_prefix as prefix only

* fix(openclaw): treat agent_prefix as prefix only

---------

Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
2026-04-29 22:42:56 +08:00
Qin Haojie 08dcfc10ac fix(openclaw-plugin): stop synthesizing tenant headers (#1789) 2026-04-29 11:49:37 +08:00
LinQiang391 dac750e144 refactor(openclaw-plugin): remove local mode and rename agentId to agent_prefix (#1783)
Made-with: Cursor
2026-04-28 22:42:49 +08:00
Eurakaxun 16c0bfe76f fix(openclaw-plugin): use character budget for auto recall (#1740) 2026-04-28 18:57:25 +08:00
Qin Haojie f7cab2d55d fix: change openclaw mode into remote (#1634) 2026-04-22 15:30:42 +08:00
Eurakaxun 299166c928 adjust default value for recallTokenBudget and recallMaxContentChars. (#1617) 2026-04-22 11:47:59 +08:00
x__dotandjohnny ef2513c3e7 feat(openclaw-plugin): align auth, namespace, and role id handling (#1606)
* feat(plugin): multi-tenant identity, agent scope mode, and resource recall

Made-with: Cursor

* fix(openclaw-plugin): avoid default tenant fallback

* feat(openclaw-plugin): add server auth mode handling

* feat(openclaw-plugin): add server auth mode and canonical namespace config

* feat(openclaw-plugin): propagate sender role id in session writes

* test(openclaw-plugin): add multi-tenant coverage and Chinese report

* docs(openclaw-plugin): update Chinese multi-tenant docs

* fix(openclaw-plugin): align default namespace policy and shared role id logic

* test(auth): drop unintended test_auth changes from plugin PR

* fix(openclaw-plugin): preserve tenant headers for api key root flows

---------

Co-authored-by: johnny <1667704220@qq.com>
2026-04-21 16:02:06 +08:00
LinQiang391 09bb76cf61 feat: add ClawHub publishing, setup wizard, and OPENCLAW_STATE_DIR support (#1587)
Made-with: Cursor
2026-04-21 11:27:46 +08:00
AutoCoder 98b47904ee Remove ingestReplyAssist feature and all related config, logic, and tests (#1564)
Made-with: Cursor
2026-04-18 14:02:16 +08:00
AutoCoderandClaude Opus 4.6 6e5d125663 fix(openclaw-plugin): default ingestReplyAssist to false (#1206)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 20:05:06 +08:00
AutoCoderandClaude Opus 4.6 89616a619e fix(openclaw-plugin): default recallPreferAbstract to false (#1204)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 15:44:43 +08:00
Mingjian QueandGPT-5.4 7bcdb85647 feat(openclaw-plugin): add bypass session patterns (#1194)
Co-authored-by: GPT-5.4 <noreply@openai.com>
2026-04-03 10:30:18 +08:00
Mingjian QueandGPT-5.4 27f61889bf feat(openclaw-plugin): add session-pattern guard for ingest reply assist (#1136)
Co-authored-by: GPT-5.4 <noreply@openai.com>
2026-03-31 22:27:07 +08:00
LinQiang391 df632107f5 feat(openclaw-plugin): align agent routing and reduce default log noise; fix(system/status): align resolved user id (#1054) 2026-03-28 19:32:50 +08:00
AutoCoder 8c57069409 set DEFAULT_COMMIT_TOKEN_THRESHOLD to 20000 for openclaw-plugin (#1052) 2026-03-28 17:13:01 +08:00
6d26e7a4fa refactor(openclaw-plugin): Unified session APIs and refactored the OpenClaw context pipeline for more consistent behavior, better maintainability, and stronger test coverage. (#1040)
* feat(openclaw-plugin): unify context assembly and compaction workflows

Co-authored-by: wlff123 <wulf234@163.com>
Co-authored-by: Eurekaxun <eurekaxun@163.com>
Co-authored-by: lin-qiang123 <1667704220@qq.com>
Co-authored-by: jcp0578 <jcp0578@gmail.com>

* feat(openviking-server): unify session context and commit APIs

Authored-by: Qin Haojie <qinhaojie.exe@bytedance.com>

* set default value of DEFAULT_EMIT_STANDARD_DIAGNOSTICS to false

---------

Co-authored-by: Eurekaxun <eurekaxun@163.com>
Co-authored-by: lin-qiang123 <1667704220@qq.com>
Co-authored-by: jcp0578 <jcp0578@gmail.com>
Co-authored-by: qin-ctx <qinhaojie.exe@bytedance.com>
2026-03-28 10:41:03 +08:00
Qin Haojie d8858afad6 Revert "feat(openclaw-plugin): add archive-aware context assembly and async s…" (#953)
This reverts commit 08b278da81.
2026-03-25 11:35:20 +08:00
08b278da81 feat(openclaw-plugin): add archive-aware context assembly and async session commit (#938)
* 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>
2026-03-24 23:40:32 +08:00
3b5b9a42c0 feat(openclaw-plugin):context engine refactor design & enforce token budget and reduce context bloat (#891)
* fix(openclaw-plugin): enforce token budget and reduce context bloat (#730) (#796)

* test(openclaw-plugin): add vitest test infrastructure for #730

* fix(openclaw-plugin): raise recallScoreThreshold default from 0.01 to 0.15 (#730)

* fix(openclaw-plugin): narrow isLeafLikeMemory boost to level-2 only (#730)

* fix(openclaw-plugin): prefer abstract over full content fetch in memory injection (#730)

* feat(openclaw-plugin): add recallMaxContentChars and recallPreferAbstract config (#730)

* feat(openclaw-plugin): enforce tokenBudget in injection with decrement loop (#730)

* fix(openclaw-plugin): update recallScoreThreshold placeholder to match new default (#730)

* fix(openclaw-plugin): deduplicate content resolution and document budget behavior (#730)

Extract resolveMemoryContent() helper to eliminate duplicate content-resolution
logic between buildMemoryLines and buildMemoryLinesWithBudget. Add JSDoc and
inline comment documenting intentional first-line budget overshoot (spec §6.2).
Tighten test assertion from <=120 to <=106 tokens.

* fix(openclaw-plugin): use truthy fallback for empty abstract strings (#730)

Change nullish coalescing (??) to truthy fallback (||) in
resolveMemoryContent() so empty-string abstracts fall back to item.uri
instead of producing empty content lines.

* docs: add openclaw context engine refactor design

Co-authored-by: Mijamind <mijamind@163.com>
Co-authored-by: GPT-5.4 <noreply@openai.com>

* add afterTurn refactor in design_doc

* add afterTurn compact in design_doc

---------

Co-authored-by: chethanuk <chethanuk@outlook.com>
Co-authored-by: GPT-5.4 <noreply@openai.com>
Co-authored-by: wlff123 <wulf234@163.com>
Co-authored-by: xuwengui <huangxun375@gmail.com>
2026-03-23 15:40:15 +08:00
Mingjian QueandGPT-5.4 f93d10523b feat(openclaw-plugin 2.0): from memory plugin to context engine (#662)
* 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>
2026-03-18 21:10:20 +08:00