fix(memory): align Honcho routing and memory guidance - #17186
Conversation
Ensure Honcho peer-card writes use the same observer/target path as reads so profile card updates land on the card that later lookups return. Increase built-in memory headroom and make overflow guidance route durable facts to the correct persistence layer instead of implying mental retention.
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the detailed routing coverage. The underlying remaining bugs are still present on current main, but this April patch needs selective salvage rather than a mechanical apply.
Problems
plugins/memory/honcho/session.py:660changes prefetch routing but dropssearch_query=user_message or None. Current main deliberately added that behavior in0a7cc85eab299667777489a31995eb324d8b7818and uses it atplugins/memory/honcho/session.py:736; retain it while changing the observer/target route.- The
run_agent.pydefault hunk no longer reaches the active initialization path. Current main constructs the store inagent/agent_init.py:1341-1344;tools/memory_tool.py:804-818also has independent no-agent fallback defaults. tests/tools/test_memory_tool.py:45-65snapshots numeric defaults.AGENTS.md:80-83requires an invariant between surfaces rather than literals expected to change.
Suggested changes
- Preserve
search_query=user_message or Noneand test it together with the observer/target route. - Update the moved live and no-agent construction paths, then make the drift test compare each surface to
DEFAULT_CONFIG.
This is an automated hermes-sweeper review.
| try: | ||
| user_ctx = self._fetch_peer_context(session.user_peer_id, target=session.user_peer_id) | ||
| observer_peer_id, target_peer_id = self._resolve_observer_target(session, "user") | ||
| user_ctx = self._fetch_peer_context(observer_peer_id, target=target_peer_id) |
There was a problem hiding this comment.
Please retain search_query=user_message or None on this call. Current main intentionally added it in 0a7cc85eab299667777489a31995eb324d8b7818; omitting it would regress topic-relevant prefetch retrieval while fixing the observer route.
| self._memory_store = MemoryStore( | ||
| memory_char_limit=mem_config.get("memory_char_limit", 2200), | ||
| user_char_limit=mem_config.get("user_char_limit", 1375), | ||
| memory_char_limit=mem_config.get("memory_char_limit", 3200), |
There was a problem hiding this comment.
This initialization code has moved on current main to agent/agent_init.py:1341-1344; also update that live path and tools/memory_tool.py:804-818 so the new defaults apply consistently to normal and no-agent memory stores.
|
|
||
| from hermes_cli.config import DEFAULT_CONFIG | ||
|
|
||
| expected_memory = 3200 |
There was a problem hiding this comment.
Please avoid freezing these numeric defaults. Derive the expected values from DEFAULT_CONFIG and assert the constructor and migration constants agree, preserving drift coverage without making a routine capacity change fail CI.
Cleanup triage (2026-07-17)Status: leave open for selective salvage — do not merge as-is.
Next if pursued: cherry-pick only routing fixes onto fresh |
Dual-model cleanup decision (2026-07-17)Reviewers: gpt-5.6-sol xhigh (Codex) + gpt-5.6-sol (Hermes openai-codex). Decision: SALVAGE_NARROW later — do NOT mechanical-rebase this tip; do NOT roll into Matrix Ship v2 stack. If/when pursued:
Leave open only as a salvage pointer; no private dogfood of this tip as-is. |
Closing — no longer relevant for our deploymentClosing unmerged. We are not using Honcho for memory anymore (Hindsight / other paths). This PR was a Honcho routing + built-in memory guidance salvage of an old tip and is not worth re-cutting for us. If upstream still wants the remaining routing fixes without the April tip’s default freezes, that should be a fresh contribution from current Not part of Matrix Ship v2. Do not resurrect for our private feature stack. |
Summary
This PR fixes Honcho memory/profile routing and built-in memory guidance.
honcho_profile(peer="user", card=[...])updates the card thathoncho_profile(peer="user")returns.honcho_profilecard replacement semantics: passingcardoverwrites the whole peer card, so callers MUST include facts they want preserved.honcho_context.queryparameter for now because the handler did not implement query filtering; this avoids a misleading schema until filtering is added deliberately.memory.replace/memory.remove, skills, or canonical workspace artifacts instead of claiming to save exact state “mentally” or relying on semantic memory as the only canonical store.Tests
python -m pytest tests/honcho_plugin/test_session.py tests/tools/test_memory_tool.py tests/tools/test_memory_tool_import_fallback.py -q -o 'addopts='→ 162 passedhoncho_profilehandler empty-card overwrite behaviorhoncho_profileschema warning thatcardoverwrites the entire cardhoncho_contextschema no longer advertising an unimplemented query filtermemory.replace,memory.remove, skills, and canonical artifactsDEFAULT_CONFIG,MemoryStore, and the OpenClaw migration helperpython -m py_compile plugins/memory/honcho/__init__.py plugins/memory/honcho/session.py tools/memory_tool.py hermes_cli/config.py run_agent.py hermes_cli/tips.py optional-skills/migration/openclaw-migration/scripts/openclaw_to_hermes.pygit diff --checkSecurity / platform notes
honcho_context(query=...)filtering; the misleading schema field is removed instead. Query filtering can be a focused follow-up.Review feedback remediation (2026-04-30)
honcho_profile(peer="ai", card=[...])round-tripping through the same observer/target route used by reads.card=[]clearing peer cards instead of being treated as a read.honcho_contextno longer advertises the unimplementedqueryschema parameter.Relationship to context-safety work
Related but independent from the gateway context-safety PRs. This PR fixes Honcho memory/profile routing consistency so long-term context is read and written through the correct observer/target path.
Adjacent PRs: