feat: add filter hooks to fully override daily memory storage backend#1050
Closed
feat: add filter hooks to fully override daily memory storage backend#1050
Conversation
Add datamachine_daily_memory_{read,write,list,search,delete} filters to
DailyMemoryAbilities. Each filter receives null by default — return a
non-null result array to completely replace the flat-file operation.
This lets consumers like Intelligence store daily memory as WordPress
pages, external services, or anything else without Data Machine needing
to know or care.
Remove the duplicative datamachine_daily_memory_archived action from
DailyMemoryTask — the pre_archive filter already handles the write
override, and the new ability-level filters cover read-back.
Contributor
Homeboy Results —
|
Member
Author
|
Superseded — redoing with a single storage filter instead of 5 per-operation filters. |
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
Adds
datamachine_daily_memory_{read,write,list,search,delete}filters toDailyMemoryAbilitiesso a consumer plugin can completely replace the daily memory storage mechanism.Each filter receives
nullby default. Return a non-null result array to short-circuit the flat-file operation entirely. If nothing hooks the filter, behavior is 100% unchanged.Removes the duplicative
datamachine_daily_memory_archivedaction fromDailyMemoryTask— thepre_archivefilter already handles the write override, and the new ability-level filters cover read-back.Why
PR #1046 added
datamachine_daily_memory_pre_archivewhich lets plugins intercept the archive write. But the read, list, search, and delete paths all go straight to the filesystem. If a consumer stores archives as WordPress pages and skips the flat file, agents can't read their knowledge back.These filters complete the picture — a plugin like Intelligence can hook all 5 operations and own the entire storage layer. Data Machine fires the filters and falls back to flat files. It doesn't need to know or care what's behind them.
Filters
datamachine_daily_memory_read$result, $date, $inputdatamachine_daily_memory_write$result, $date, $content, $mode, $inputdatamachine_daily_memory_list$result, $inputdatamachine_daily_memory_search$result, $query, $from, $to, $inputdatamachine_daily_memory_delete$result, $date, $inputAll filters pass the full
$inputarray which includesuser_idandagent_idfor scoping.Example usage
Changes
inc/Abilities/DailyMemoryAbilities.php— Add 5 filter hooks with full PHPDocinc/Engine/AI/System/Tasks/DailyMemoryTask.php— Removedatamachine_daily_memory_archivedaction, add cross-reference to new filters inpre_archivedocblock