Skip to content

fix: move static recall policy into prompt hook#242

Merged
jalehman merged 4 commits into
mainfrom
codex/lcm-prompt-split
Apr 3, 2026
Merged

fix: move static recall policy into prompt hook#242
jalehman merged 4 commits into
mainfrom
codex/lcm-prompt-split

Conversation

@jalehman

@jalehman jalehman commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

What

Move lossless-claw's static recall policy out of systemPromptAddition and into a before_prompt_build hook, leaving systemPromptAddition responsible only for session-specific compaction state.

Why

The stable recall-order guidance should be injected through the plugin hook so it stays cacheable and clearly overrides generic memory-recall guidance only for compacted conversation history, without mixing that policy into dynamic per-session prompt state.

Changes

  • Add static recall policy prompt hook
  • Trim systemPromptAddition to dynamic state
  • Add hook coverage for prompt split
  • Update engine tests for dynamic-only guidance
  • Add patch changeset for release notes

Testing

  • npx vitest run test/engine.test.ts test/plugin-prompt-hook.test.ts
  • Expected: Vitest passes for the updated engine and plugin hook coverage

jalehman added 4 commits April 2, 2026 13:25
Move the stable lossless recall policy into a before_prompt_build hook so it
is injected through the plugin path instead of systemPromptAddition. Keep
systemPromptAddition limited to session-specific compaction guidance, with a
short reminder for shallow summaries and a stronger expand-before-asserting
checklist for deep compaction.

Update engine assertions to verify the dynamic-only prompt content and add a
plugin-level hook test that proves the static recall policy is returned from
the hook path without using systemPrompt.

Regeneration-Prompt: |
  Adjust lossless-claw so static recall-policy guidance is injected via the
  plugin prompt hook and dynamic systemPromptAddition is reserved for
  session-specific compaction state. Keep the precedence over generic memory
  recall guidance scoped to compacted conversation history only, preserve the
  existing context-engine contract, and do not change OpenClaw core,
  memory-core, or tool behavior. Update tests so engine coverage proves the
  assembled systemPromptAddition only contains dynamic summary-state guidance,
  and add a plugin hook test that proves the static guidance lives on the
  before_prompt_build path and does not use systemPrompt.
Add a patch changeset describing the lossless-claw prompt guidance split so
the release notes capture the move of static recall policy into the plugin
hook and the reduced dynamic systemPromptAddition behavior.

Regeneration-Prompt: |
  Add a changeset for the lossless-claw prompt-guidance split. Use a patch
  bump for @martian-engineering/lossless-claw, summarize that stable recall
  policy moved into the plugin prompt hook, and note that systemPromptAddition
  now only carries session-specific compaction reminders.
Restore the stronger lossless recall policy language on the plugin hook while keeping the static-vs-dynamic prompt split from PR #242. The hook again explains what , , and  do, tells the agent to verify contradictory or uncertain recall with lossless-claw tools, and drops the memory-tool fallback sentence that diluted the main priority rule.

Reinstate the deep-compaction precision workflow in the dynamic prompt so exact-answer paths again tell the agent to use , expand with , answer with summary-ID citations, and avoid guessing specifics from condensed summaries. Update the prompt-hook and engine tests to lock in that behavior.

Regeneration-Prompt: |
  Adjust PR #242 so it keeps the static-vs-dynamic prompt split but preserves
  the stronger recall-policy behavior from the original lossless-claw prompt.
  The static before_prompt_build hook should still make lossless-claw tools the
  first choice for compacted conversation history, remind the model what
  , , and  are for, and restore the
  instruction to verify contradictory or uncertain recall with those tools.
  Do not bring back the sentence telling the model to prefer generic memory
  tools before raw text search. In the dynamic compacted-context prompt, keep
  the deep-compaction precision workflow that says to locate IDs with
  , expand with , cite summary IDs in the answer,
  and avoid guessing exact specifics from condensed summaries. Update tests to
  prove the static hook and dynamic prompt each carry the right parts.
Remove the duplicate before_prompt_build prompt injection so the static lossless recall policy is only returned via prependSystemContext. Tighten the hook regression test to assert prependContext stays unset, matching the intended system-only injection behavior and preventing the policy text from appearing in live user prompts.

Regeneration-Prompt: |\n  Josh reported that the lossless recall policy text was showing up on user messages in PR #242, but the intent was to inject it only into the system prompt. Investigate the before_prompt_build hook behavior against OpenClaw's prompt assembly semantics. Preserve the static-vs-dynamic split from the PR, but remove any duplication that prepends the policy into the live prompt. Update regression coverage so the hook test proves the plugin returns only system prompt context and fails if prependContext is reintroduced.
@jalehman jalehman merged commit 3fe823f into main Apr 3, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant