Skip to content

fix(openclaw-plugin): move recall into assemble path#1714

Closed
0xble wants to merge 1 commit into
volcengine:mainfrom
0xble:fix/openclaw-assemble-recall-v2
Closed

fix(openclaw-plugin): move recall into assemble path#1714
0xble wants to merge 1 commit into
volcengine:mainfrom
0xble:fix/openclaw-assemble-recall-v2

Conversation

@0xble
Copy link
Copy Markdown
Contributor

@0xble 0xble commented Apr 25, 2026

Description

Moves OpenClaw plugin automatic recall onto the context-engine assemble() path by default, while keeping before_prompt_build behind recallPath: "hook" for legacy compatibility. This replaces #1424 with a clean branch scoped to examples/openclaw-plugin.

Related Issue

Fixes #1283. Replaces #1424.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Test update

Changes Made

  • Added recallPath config with default assemble and legacy hook.
  • Extracted shared recall query and context building into recall-context.ts.
  • Injected <relevant-memories> into assembled messages so OpenClaw transformContext callers receive recall even when systemPromptAddition or prompt hooks are not consumed.
  • Bounded afterTurn auto-capture with the configured timeout so capture fails open instead of blocking a turn.
  • Updated plugin docs and focused tests.

Example

With default config:

{
  "autoRecall": true,
  "recallPath": "assemble"
}

A context-engine assemble() call for:

messages: [{ role: "user", content: "what backend language should we use?" }]

now returns the first user message with a leading <relevant-memories> block, followed by the assembled session summary/history. recallPath: "hook" keeps the previous before_prompt_build behavior for older OpenClaw integrations.

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • Linux
    • macOS
    • Windows

Focused checks run locally:

npx vitest run tests/ut/context-engine-assemble.test.ts tests/ut/context-engine-afterTurn.test.ts tests/ut/tools.test.ts tests/ut/plugin-bypass-session-patterns.test.ts tests/ut/plugin-normal-flow-real-server.test.ts tests/ut/local-startup-failure.test.ts

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@Mijamind719
Copy link
Copy Markdown
Collaborator

感谢关注和贡献代码,before_promt_build hook时注入记忆的逻辑归一到assemble中,已经通过#1835 合入。

@Mijamind719 Mijamind719 closed this May 5, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Incompatible with OpenClaw 2026.4.5: model call never fires after before_prompt_build hook

2 participants