Skip to content

Fix Hermes memory vault sync - #156

Open
yourconscience wants to merge 1 commit into
mainfrom
fix/hermes-memory-sync
Open

Fix Hermes memory vault sync#156
yourconscience wants to merge 1 commit into
mainfrom
fix/hermes-memory-sync

Conversation

@yourconscience

@yourconscience yourconscience commented Sep 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • register Hermes-specific vault import/export hooks for the memsearch tier
  • avoid sending Claude-style SessionStart output to Hermes
  • avoid rewriting full Hermes user memory or reindexing when no fact fits
  • document and test the three-store Hermes memory flow

Verification

  • go test ./...
  • go vet ./...
  • python3 -m unittest discover -s memory/tests -p 'test_*.py' -v
  • dotagents sync --agents=hermes
  • dotagents status --agents=hermes
  • hermes --accept-hooks hooks test on_session_start
  • hermes --accept-hooks hooks test on_session_finalize

@sourcery-ai

sourcery-ai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR fixes Hermes memsearch integration by routing Hermes through explicit vault/built-in-memory synchronization hooks, suppressing incompatible Claude-style output, avoiding no-op USER.md rewrites, and documenting and testing the resulting three-store flow.

Sequence diagram for the Hermes three-store memory flow

sequenceDiagram
    participant Hermes
    participant Vault
    participant HermesMemory
    participant Memsearch

    Hermes->>Vault: sync-vault-to-memory.sh
    Vault->>HermesMemory: import new facts
    Hermes->>Memsearch: session-end.sh
    Memsearch->>Vault: capture finalized session
    Hermes->>HermesMemory: sync-memory-to-vault.sh
    HermesMemory->>Vault: export durable memory
Loading

File-Level Changes

Change Details Files
Register Hermes-specific vault synchronization hooks while excluding Hermes from the generic Claude-oriented session-start hook.
  • Add managed hook names and native script cleanup support for vault-to-memory and memory-to-vault synchronization.
  • Attach vault import at SessionStart and memory export at SessionEnd for enabled Hermes agents.
  • Filter Hermes out of the generic memsearch session-start hook and retain generic hooks for other agents.
  • Expand setup tests to verify hook ordering, commands, and agent targeting.
cmd/dotagents/hooks.go
cmd/dotagents/hooks_test.go
cmd/dotagents/setup_scaffold.go
cmd/dotagents/setup_separation_test.go
Prevent unnecessary Hermes memory rewrites when no new vault facts fit within the memory limit.
  • Write USER.md only when new facts are added.
  • Report synchronization as unchanged when no facts fit.
  • Add regression coverage for preserving content and modification time in the no-fit case.
memory/lib/sync.py
memory/tests/test_sync.py
Document the three-store Hermes memory flow and its operational verification steps.
  • Explain synchronization between the knowledge vault, Hermes built-in memory, and memsearch index.
  • Document hook behavior, native memory injection, and Hermes approval/doctor checks.
docs/memory.md
skills/dotagents/SKILL.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The new Hermes hooks write synchronized facts into persistent Hermes memory and the knowledge vault, so an incorrect sync could leave bounded stale or incorrect records after the hooks are reverted. The affected memory can be inspected and repaired or regenerated, but reverting alone would not remove data already written.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7afec6397f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
if len(hermesTargets) > 0 {
cfg.Hooks = append(cfg.Hooks,
hookConfig{Name: "memory-hermes-vault-to-memory", Enabled: true, Event: "SessionStart", Command: managedMemoryHookCommand(root, home, "sync-vault-to-memory.sh"), Timeout: 30, Agents: hermesTargets},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Create the Hermes memory directory before vault import

When memsearch is enabled for a fresh Hermes installation, or whenever ~/.hermes/memories/ has not been initialized, this newly registered SessionStart hook calls vault_to_memory; if the vault profile contains an importable fact, its Path.write_text to ~/.hermes/memories/USER.md raises FileNotFoundError because neither setup nor the function creates the parent directory. The first-session bridge therefore fails instead of importing the facts; create the directory before writing and cover this fresh-profile failure mode.

AGENTS.md reference: AGENTS.md:L46-L46

Useful? React with 👍 / 👎.

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