Add extension hooks for mental model operations#260
Merged
cdbartholomew merged 1 commit intomainfrom Jan 31, 2026
Merged
Conversation
0cc90bc to
1be9bd6
Compare
Add dataclasses and hook methods to OperationValidatorExtension for tracking mental model operations: - MentalModelGetContext/Result: context and result for GET operations - MentalModelRefreshResult: result for refresh operations with token counts - validate_mental_model_get: pre-operation validation hook - on_mental_model_get_complete: post-GET completion hook - on_mental_model_refresh_complete: post-refresh completion hook Invoke hooks in http.py (GET endpoint) and memory_engine.py (refresh). Add tests verifying hooks are called with correct parameters.
1be9bd6 to
d113b35
Compare
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.
Summary
OperationValidatorExtensionhooks for mental model operationsMentalModelGetContext,MentalModelGetResult,MentalModelRefreshResultvalidate_mental_model_get,on_mental_model_get_complete,on_mental_model_refresh_completehttp.py(GET mental model endpoint) andmemory_engine.py(refresh flow)Context
Mental model operations (retrieve and refresh) had no extension hooks, unlike retain/recall/reflect. This adds the same hook pattern so extensions can validate, track, and respond to mental model operations.
Test plan
tests/test_mental_model_hooks.pywith tests for all three hooks