feat(memory): graph-memory adapter + migration script (Phase D) - #5
Merged
Conversation
Hermes side of the two-repo Phase D lift (TechDevGroup/devagentic#54). agent/devagentic_memory.py is the read-through adapter: when DEVAGENTIC_MEMORY_GRAPH=1, it POSTs userFactQuery to a running devagentic and returns the relevance-ranked facts; on any failure (gate off, network error, parse error, no user_id) returns [] so the caller's existing file-based memory fallback runs unchanged. scripts/migrate_memory_to_graph.py is the one-way migration — walks HERMES_HOME for MEMORY.md / USER.md / SOUL.md and POSTs each file as a kind:user-fact node via userFactCreate. --dry-run prints the plan; v0 granularity is one fact per file with tags=[origin:<name>, migration:YYYY-MM-DD, ...]. Companion devagentic PR: TechDevGroup/devagentic#<TBD> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hermes side of the two-repo Phase D graph-memory lift (devagentic#54). Last Lane C item — completes the lane.
Summary
Three pieces, mirroring C1's structure:
agent/devagentic_memory.py— read-through adapter. WhenDEVAGENTIC_MEMORY_GRAPH=1, POSTsuserFactQueryto a running devagentic and returns relevance-ranked facts. Returns[]on any failure (gate off, no user_id, network/parse error, no facts) so the caller's existing file-based memory fallback runs unchanged. Adapter never raises — every network path wrapped in try/except.scripts/migrate_memory_to_graph.py— one-way migration. WalksHERMES_HOMEforMEMORY.md/USER.md/SOUL.mdand POSTs each file as akind:user-factnode viauserFactCreate.--dry-runprints the plan without mutating;--tagattaches extra tags;--confidencetunes the default (0.9 for file-aged facts).tests/test_devagentic_memory.py— 15 pytest cases covering env gate, query happy / sad paths (empty query, no user_id, network failure, blank-body filtering),create_user_factmutation shape, migration helpers (file iteration, empty/missing skip, today-tag format).Companion devagentic PR: TechDevGroup/devagentic#144
User-id resolution
Mirrors the devagentic-local provider's contract (Phase G #50) and the skill adapter (Phase C #52):
DEVAGENTIC_USER_IDenv override.hermes_cli.profiles.get_active_profile_name().Rollout
After both PRs land:
Acceptance (from devagentic#54)
test_iter_memory_files*; live-run pending operator dispatch).[]on any failure (verified bytest_query_user_facts_off_returns_empty,test_query_user_facts_network_failure, etc.).create_user_factposts the right GraphQL mutation and returns the new fact id (verified bytest_create_user_fact_posts_and_returns_id).Design calls
agent/memory_manager.py/tools/memory_tool.pyaren't patched in this PR. Keeping the call-site swap behind a separate, focused PR isolates the network-introduced risk. Documented as deferred follow-up.\n\nor by leading-bullets in a v1.userFactSupersede(old, new)manually for each pair (or wait for a--supersede-priorflag).Deferred
agent/memory_manager.py/tools/memory_tool.py— separate focused PR.--supersede-priordedup flag on the migration script.