Skip to content

fix(agent): drop removed memory_tree modes from orchestrator prompt#3275

Merged
graycyrus merged 1 commit into
tinyhumansai:mainfrom
sanil-23:fix/memory-tree-prompt-stale-modes
Jun 3, 2026
Merged

fix(agent): drop removed memory_tree modes from orchestrator prompt#3275
graycyrus merged 1 commit into
tinyhumansai:mainfrom
sanil-23:fix/memory-tree-prompt-stale-modes

Conversation

@sanil-23
Copy link
Copy Markdown
Contributor

@sanil-23 sanil-23 commented Jun 3, 2026

Summary

  • Remove the query_topic and query_global modes from the orchestrator's memory_tree documentation — both were deleted when the global/topic trees were removed, but two LLM-facing strings still advertised them.
  • Add the modes the prompt was missing: walk, smart_walk, and ingest_document.
  • Fix the memory_tree_search_entities tool description, which pointed the model at a nonexistent memory_tree_query_topic tool.

Problem

The memory_tree dispatcher (src/openhuman/memory/query/mod.rs) supports exactly: search_entities, query_source, drill_down, fetch_leaves, ingest_document, walk, smart_walk. The query_topic / query_global modes were removed with the global/topic trees (asserted gone in mod.rs tests), but two prompts the model actually reads were never updated:

  • orchestrator/prompt.md still listed mode: "query_topic" and mode: "query_global" as valid, and the "Start cheap (query_* summaries)" line leaned on them. If the orchestrator followed its prompt it would emit a call the dispatcher rejects with unknown mode. The prompt also never mentioned the more capable walk / smart_walk retrieval paths, so the agent was blind to them.
  • memory_tree_search_entities's tool description() told the model to call a memory_tree_query_topic tool that does not exist.

Solution

Align both LLM-facing strings with the dispatcher's real mode list — drop the two dead modes, document smart_walk (multi-strategy retrieval) and walk (agentic traversal) as the open-ended-query defaults, add ingest_document, and update search_entities to reference memory_tree's real retrieval modes.

Submission Checklist

  • N/A: prompt/description string-only change — no executable behaviour to unit-test. The dispatcher already asserts the removed modes are gone (memory/query/mod.rs).
  • N/A: behaviour-only change — no changed executable lines for diff-cover.
  • Coverage matrix updated — N/A: behaviour-only change
  • Affected feature IDs — N/A
  • No new external network dependencies introduced
  • Manual smoke checklist — N/A: does not touch release-cut surfaces
  • Linked issue — N/A: no tracking issue

Impact

  • Desktop/CLI agent runtime: the orchestrator and search_entities tool now describe only modes the tool actually accepts, eliminating a class of guaranteed-failing memory_tree calls and surfacing smart_walk / walk. No code-path or schema change.

Related

  • Closes: N/A
  • Follow-up PR(s)/TODOs: optional tidy-up of historical query_topic mentions in memory_tree/retrieval/{drill_down,types}.rs comments (non-LLM-facing).

AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: fix/memory-tree-prompt-stale-modes

Summary by CodeRabbit

  • Improvements
    • Expanded AI agent memory retrieval strategies with new search modes to improve context understanding.
    • Clarified tool usage instructions for better performance when searching by user name.

The memory_tree query tool dropped the `query_topic` and `query_global`
modes when the global/topic trees were removed (see the assertions in
src/openhuman/memory/query/mod.rs that these modes are gone), but two
LLM-facing strings still advertised them:

- orchestrator prompt.md listed `mode: "query_topic"` / `query_global`
  as valid modes, so the agent would emit calls that the dispatcher
  rejects with "unknown mode". It also never mentioned the real
  `walk` / `smart_walk` / `ingest_document` modes.
- memory_tree_search_entities's tool description told the model to call
  a nonexistent `memory_tree_query_topic` tool.

Align both with the dispatcher's actual modes: search_entities,
query_source, drill_down, fetch_leaves, ingest_document, walk,
smart_walk.

Co-Authored-By: Claude <noreply@anthropic.com>
@sanil-23 sanil-23 requested a review from a team June 3, 2026 06:11
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates memory tree retrieval guidance across two files: the orchestrator prompt now describes expanded retrieval modes (smart_walk, walk, ingest_document) while removing obsolete modes, and the search entities tool description is aligned to reference the canonical id-based lookup pattern.

Changes

Memory Tree Retrieval Mode Updates

Layer / File(s) Summary
Orchestrator prompt memory_tree modes and guidance
src/openhuman/agent_registry/agents/orchestrator/prompt.md
Orchestrator prompt removes query_topic and query_global modes, retains query_source, and introduces smart_walk and walk as new retrieval strategies. ingest_document mode added to the option list. "Start cheap" guidance is repositioned to recommend query_* summaries before expensive operations.
Search entities tool description update
src/openhuman/memory/query/search_entities.rs
MemoryTreeSearchEntitiesTool description updated to direct users to call this tool first when a user mentions someone by name, then perform memory_tree retrieval keyed on the canonical id.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • tinyhumansai/openhuman#3077: Implements and wires up the smart_walk memory-tree retrieval mode that is now documented in the orchestrator prompt and tool descriptions.

Suggested labels

rust-core, memory

Poem

🐰 New modes for memory trees take flight,
Smart walks and ingest_document bright,
Orchestrator's wisdom set right,
Tools aligned in prompt delight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: removing stale memory_tree modes from the orchestrator prompt, which is the primary focus of the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot added rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure. memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. labels Jun 3, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/openhuman/agent_registry/agents/orchestrator/prompt.md (1)

187-187: 💤 Low value

Consider consistent spelling variant.

The document uses British English spelling ("synthesise" on line 11), but line 187 uses American spelling "synthesized". For consistency, consider "synthesised".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/openhuman/agent_registry/agents/orchestrator/prompt.md` at line 187, The
phrase for the `mode: "walk"` description uses American spelling "synthesized"
which is inconsistent with the British variant "synthesise" used elsewhere;
update the text in the `mode: "walk"` line to use "synthesised" so the document
consistently uses British English (search for the string `mode: "walk"` and
replace "synthesized" with "synthesised").
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/openhuman/agent_registry/agents/orchestrator/prompt.md`:
- Line 187: The phrase for the `mode: "walk"` description uses American spelling
"synthesized" which is inconsistent with the British variant "synthesise" used
elsewhere; update the text in the `mode: "walk"` line to use "synthesised" so
the document consistently uses British English (search for the string `mode:
"walk"` and replace "synthesized" with "synthesised").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 42aa277f-8a60-40c2-80a8-6b37350545c0

📥 Commits

Reviewing files that changed from the base of the PR and between 38b0883 and 3bc55b7.

📒 Files selected for processing (2)
  • src/openhuman/agent_registry/agents/orchestrator/prompt.md
  • src/openhuman/memory/query/search_entities.rs

Copy link
Copy Markdown
Contributor

@oxoxDev oxoxDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strings-only fix aligning the orchestrator memory_tree prompt + search_entities tool desc to the real dispatcher. Verified the prompt now lists exactly the 7 live modes (search_entities/query_source/smart_walk/walk/drill_down/fetch_leaves/ingest_document) matching memory/query/mod.rs:143-149; the stale query_topic/query_global are dropped (the memory_tree_schema_mode_enum_has_all_modes test pins this), and search_entities no longer points at the nonexistent memory_tree_query_topic. No logic change.

Necessity: problem real (stale strings → unknown-mode routing errors) · right size (+6/-4) · right approach (align to dispatcher truth, CI-guarded) · Ship.

Approve with one nit (inline).

Comment thread src/openhuman/agent_registry/agents/orchestrator/prompt.md
@graycyrus graycyrus merged commit cb41637 into tinyhumansai:main Jun 3, 2026
24 of 27 checks passed
oxoxDev added a commit to oxoxDev/openhuman that referenced this pull request Jun 3, 2026
…fs (tinyhumansai#2780)

- prompt.md: presentation tool described as native Rust `ppt-rs` engine
  in-process (no python subprocess, no managed venv) instead of "bundled
  python-pptx helper" — matches engine.rs rustdoc post-engine-swap.
- prompt.md: grounding-rule memory_tree modes trimmed to
  `query_source` / `smart_walk` — `query_topic` / `query_global` were
  removed by tinyhumansai#3275 because dispatcher rejects them with "unknown mode".
- types.rs: rustdoc on validate_input swapped "before spawning Python /
  generic Python traceback" → "before invoking the ppt-rs engine /
  generic engine error".
- tests/orchestrator_presentation_wiring.rs: code_executor exclusion
  rationale + assertion message now reference native Rust engine, not
  the removed `runtime_python` venv.

graycyrus review on tinyhumansai#3029: both stale-text threads addressed; PR is
rebased onto upstream/main which already carries tinyhumansai#3275's mode-list
cleanup at the agent-prompt level.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

memory Memory store, memory tree, recall, summarization, and embeddings in src/openhuman/memory/. rust-core Core Rust runtime in src/: CLI, core_server, shared infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants