Proposal: Extensible hooks and plugin support#414
Draft
araujof wants to merge 8 commits intogenerative-computing:mainfrom
Draft
Proposal: Extensible hooks and plugin support#414araujof wants to merge 8 commits intogenerative-computing:mainfrom
araujof wants to merge 8 commits intogenerative-computing:mainfrom
Conversation
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🔴 Enforce conventional commitThis rule is failing.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
|
5f5adeb to
0aee2a0
Compare
Author
|
@nrfulton I added an implementation plan document to detail the relevant components of the ContextForge Plugin Framework and required changes to Mellea to introduce the hook system. |
Author
|
@jakelorocco @HendrikStrobelt I updated the hook system specification and implementation plan with functional-first, programmatic API as per our recent discussions. |
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
…esign drifts Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
…onal suggestions by maintainers Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
70ab0c1 to
2ef5ebf
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
Introduces a design specification for an extensible hook system and plugin framework for Mellea. The hook system provides extension points across the framework's execution lifecycle — from session initialization through component execution, LLM generation, validation, sampling, and cleanup — enabling policy enforcement, observability, customization, and integrations without modifying core library code.
Specification Outline
on_<hook_name>), programmatic registration, or YAML configuration.Specification document
Implementation Plan
The implementation plan defines how Mellea's extensibility hook system will be built on top of the ContextForge plugin framework as an optional dependency. The primary developer API uses
@hookand@plugindecorators plus aregister()function for programmatic registration, with YAML configuration supported as a secondary deployment-time mechanism. Plugins can be scoped globally or per-session (viastart_session(plugins=[...])), and aPluginSetclass enables composable grouping. The centralinvoke_hook()dispatcher includes three layers of zero-overhead guards (_plugins_enabledflag,has_hooks_for()check, and early return) to ensure no performance impact when plugins are not configured. Hook call sites are added acrossfunctional.py,session.py,sampling/base.py,backend.py,context.py, and the OpenAI/HuggingFace adapter backends, with agenerate_from_context_with_hooks()wrapper on the Backend ABC to avoid modifying individual backendimplementations.
Implementation plan
Review plan