Skip to content

fix(tools): prefer memory_search over search_code for user-provided facts#2490

Merged
bug-ops merged 1 commit intomainfrom
fix/2475-memory-search-priority
Mar 30, 2026
Merged

fix(tools): prefer memory_search over search_code for user-provided facts#2490
bug-ops merged 1 commit intomainfrom
fix/2475-memory-search-priority

Conversation

@bug-ops
Copy link
Copy Markdown
Owner

@bug-ops bug-ops commented Mar 30, 2026

Summary

  • Updated search_code tool description to explicitly exclude user-provided facts and preferences
  • Updated memory_search tool description to emphasise recall of user-provided context
  • Injected a session-level hint into the volatile system prompt block when memory_save was called in the current session, directing the LLM to use memory_search for recall
  • Fixed pre-existing clippy warnings across zeph-mcp, zeph-llm, and zeph-orchestration (default trait access, similar binding names, unnecessary map_or, strict float comparison)

Root cause

The LLM autonomously chose search_code over memory_search because technical terms in user questions ("runtime", "tokio", "memory management") matched search_code's description and embedding. No signal existed to indicate that those facts were already saved to memory in the current session.

Test plan

  • rebuild_system_prompt_injects_memory_save_hint_when_tool_was_used — hint present when memory_save in completed_tool_ids
  • rebuild_system_prompt_omits_memory_save_hint_when_tool_not_used — hint absent when completed_tool_ids is empty
  • memory_search_description_mentions_user_provided_facts — description text verified
  • search_code_description_excludes_user_facts — description text verified
  • 7518 tests pass, 22 skipped

Closes #2475

@github-actions github-actions bot added documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes core zeph-core crate bug Something isn't working size/L Large PR (201-500 lines) labels Mar 30, 2026
…acts (#2475)

Two-part fix: update tool descriptions to disambiguate code search from
memory recall, and inject a session-level hint into the volatile system
prompt block when memory_save was called in the current session.

Also fixes pre-existing clippy warnings in zeph-mcp, zeph-llm, and
zeph-orchestration (Default::default() trait access, similar binding
names, unnecessary map_or, strict float comparison).
@bug-ops bug-ops force-pushed the fix/2475-memory-search-priority branch from aadb97d to 808c8d4 Compare March 30, 2026 22:24
@bug-ops bug-ops enabled auto-merge (squash) March 30, 2026 22:24
@bug-ops bug-ops merged commit da8775b into main Mar 30, 2026
27 checks passed
@bug-ops bug-ops deleted the fix/2475-memory-search-priority branch March 30, 2026 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation llm zeph-llm crate (Ollama, Claude) rust Rust code changes size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(tools): agent prefers search_code over memory_search for user-provided facts in same conversation

1 participant