Add extensibility hooks to daily memory archive#1046
Merged
Conversation
Add two extensibility points to DailyMemoryTask so developers can intercept and replace the flat-file archive write: - datamachine_daily_memory_pre_archive (filter): return true to skip the default daily/YYYY/MM/DD.md write and handle storage externally (e.g., WordPress pages, external services) - datamachine_daily_memory_archived (action): fires after archive processing completes, regardless of how storage was handled Default behavior is completely unchanged — flat-file write proceeds unless a filter explicitly opts out.
Contributor
Homeboy Results —
|
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
datamachine_daily_memory_pre_archivefilter so developers can intercept archived content and handle storage themselves (WordPress pages, external APIs, etc.)datamachine_daily_memory_archivedaction that fires after archive processing, regardless of how storage was handledWhy
The daily memory task currently writes archived content exclusively to flat markdown files (
daily/YYYY/MM/DD.md). This works great as the default, but developers building on top of Data Machine may want to store archived knowledge differently — as WordPress content, in a database, or via an external service.These hooks let them do that without modifying the core task. If
datamachine_daily_memory_pre_archivereturnstrue, the flat-file write is skipped entirely. If nothing hooks it, behavior is 100% unchanged.Example usage
Changes
One file:
inc/Engine/AI/System/Tasks/DailyMemoryTask.php$archive_contextarray to avoid duplication between filter and actiondatamachine_daily_memory_pre_archivefilter before the flat-file writeif ( ! $handled )conditionaldatamachine_daily_memory_archivedaction after processing@since 0.46.0tags on both hooks