feat: mutation hooks system#28
Merged
Merged
Conversation
Introduces a MutationHook trait and HookRegistry that enables callbacks after node/edge mutations (create, update, delete). Hooks are called synchronously in the write path and provide the foundation for SSE event streaming and future WASM plugins. - New hooks module in cortex-core with MutationHook trait - HookRegistry dispatches to all registered hooks in order - Cortex (library mode) calls hooks after store() and create_edge() - gRPC service calls hooks after all 5 write operations - Server initializes shared HookRegistry passed to gRPC service Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 tasks
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
MutationHooktrait andHookRegistryin cortex-core for node/edge write callbacksCortex) and server mode (gRPC service)Changes
crates/cortex-core/src/hooks/mod.rs(NEW) — trait, registry, 5 unit testscrates/cortex-core/src/api.rs— hooks field on Cortex, called afterstore()andcreate_edge()crates/cortex-core/src/lib.rs— module + re-exportscrates/cortex-server/src/grpc/service.rs— hooks called after all 5 write operationscrates/cortex-server/src/serve.rs— HookRegistry initializationTest plan
cargo test --workspacepasses (all 327 tests)cargo clippy --workspaceclean🤖 Generated with Claude Code