Skip to content

Align Hermes passive memory recall with OpenClaw six-layer DKG memory behavior #385

@Jurij89

Description

@Jurij89

Context

During Hermes adapter E2E testing on PR #315, we confirmed that the Hermes adapter tools are registering and core DKG tool flows are working, including status, context graph list/create, assertion create/write/query/promote, SWM query, sub-graph create/list, and memory_search.

One follow-up gap remains around passive memory behavior: Hermes currently does not fully mirror the latest OpenClaw DKG memory recall architecture.

Current Behavior

OpenClaw passive recall now fans out across six DKG memory layers:

  • agent-context / working-memory
  • agent-context / shared-working-memory
  • agent-context / verified-memory
  • selected project/context graph / working-memory
  • selected project/context graph / shared-working-memory
  • selected project/context graph / verified-memory

Chat turns are no longer the only passive recall source. Chat turns are included because they land in agent-context working memory, but OpenClaw no longer pins recall to only the chat-turns assertion.

Hermes currently has split behavior:

  • memory_search already performs the expected six-layer fan-out.
  • Passive Hermes memory prefetch() still reads only the configured provider memory assertion, currently defaulting to agent-context / memory.
  • Passive injected memory context is not labeled with enough provenance for the agent to reliably know which context graph and memory layer each recalled item came from.
  • dkg_memory writes to the configured provider memory assertion only. It does not currently accept an optional context_graph_id for project-scoped memory writes.

Desired Behavior

Hermes passive memory recall should mirror OpenClaw and the SKILL.md contract:

  1. Passive recall should always query agent-context across WM/SWM/VM.
  2. If a project/context graph is selected or otherwise supplied by the calling surface, passive recall should also query that graph across WM/SWM/VM.
  3. Passive recall should inject recalled snippets with explicit provenance so the agent can distinguish:
    • context graph id
    • memory layer/view
    • score/source where available
  4. The injected context should remain safe for chat persistence, i.e. avoid recalled-memory boomerang into saved chat turns.
  5. Consider extending dkg_memory with optional context_graph_id, defaulting to agent-context, so agents can store simple memory notes in a specific project/context graph when the user asks for that explicitly.

Suggested Implementation Notes

  • Reuse or share the same fan-out logic already used by Hermes memory_search rather than creating a second query planner.
  • Match OpenClaw layer labels where possible:
    • agent-context-wm
    • agent-context-swm
    • agent-context-vm
    • project-wm
    • project-swm
    • project-vm
  • Include the exact context_graph_id in Hermes injected passive context, even where OpenClaw currently only implies it through project-* labels.
  • Keep the provider default simple: agent-context / memory remains the default write target for dkg_memory unless a specific context graph is supplied.
  • Preserve existing assertion tools as the precise interface for explicit WM/SWM workflows.

Acceptance Criteria

  • Hermes passive memory prefetch() queries all three memory layers for agent-context.
  • Hermes passive memory prefetch() queries all three memory layers for the selected project/context graph when available.
  • Passive injected memory entries include enough provenance for the agent to know the context graph and memory layer.
  • memory_search and passive recall behavior are aligned and covered by tests.
  • If dkg_memory gains optional context_graph_id, the schema, handler, docs, and tests are updated.
  • Regression tests cover:
    • agent-context WM/SWM/VM passive recall
    • selected project WM/SWM/VM passive recall
    • no selected project fallback to agent-context only
    • provenance labels in injected context
    • no recalled-context boomerang into persisted chat turns, if applicable

Related Work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions