Skip to content

feat: add filter hooks to fully override daily memory storage backend#1050

Closed
chubes4 wants to merge 1 commit intomainfrom
feat/daily-memory-storage-filters
Closed

feat: add filter hooks to fully override daily memory storage backend#1050
chubes4 wants to merge 1 commit intomainfrom
feat/daily-memory-storage-filters

Conversation

@chubes4
Copy link
Copy Markdown
Member

@chubes4 chubes4 commented Apr 14, 2026

Summary

Adds datamachine_daily_memory_{read,write,list,search,delete} filters to DailyMemoryAbilities so a consumer plugin can completely replace the daily memory storage mechanism.

Each filter receives null by 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_archived action from DailyMemoryTask — the pre_archive filter already handles the write override, and the new ability-level filters cover read-back.

Why

PR #1046 added datamachine_daily_memory_pre_archive which 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

Filter Parameters Short-circuit
datamachine_daily_memory_read $result, $date, $input Return result array
datamachine_daily_memory_write $result, $date, $content, $mode, $input Return result array
datamachine_daily_memory_list $result, $input Return result array
datamachine_daily_memory_search $result, $query, $from, $to, $input Return result array
datamachine_daily_memory_delete $result, $date, $input Return result array

All filters pass the full $input array which includes user_id and agent_id for scoping.

Example usage

// Intelligence plugin: store daily archives as WordPress pages.
add_filter( 'datamachine_daily_memory_read', function ( $result, $date, $input ) {
    $agent_id = $input['agent_id'] ?? 0;
    // Query WordPress for this agent's daily archive page...
    $post = get_daily_knowledge_post( $agent_id, $date );
    if ( $post ) {
        return [ 'success' => true, 'date' => $date, 'content' => $post->post_content ];
    }
    return null; // Fall back to flat file.
}, 10, 3 );

Changes

  • inc/Abilities/DailyMemoryAbilities.php — Add 5 filter hooks with full PHPDoc
  • inc/Engine/AI/System/Tasks/DailyMemoryTask.php — Remove datamachine_daily_memory_archived action, add cross-reference to new filters in pre_archive docblock

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.
@homeboy-ci
Copy link
Copy Markdown
Contributor

homeboy-ci bot commented Apr 14, 2026

Homeboy Results — data-machine

Audit

⚡ Scope: changed files only

audit (changed files only)

  • Alignment score: 0.763
  • Outliers in current run: 52
  • Drift increased: no
  • Severity counts: info: 39, unknown: 52, warning: 40
  • Top actionable findings:
    1. inc/Engine/AI/Directives/DirectiveOutputValidator.php — missing_method — Missing method: get_outputs
    2. inc/Abilities/Flow/FlowHelpers.php — naming_mismatch — Helper-like name does not match convention suffix 'Ability': FlowHelpers
    3. inc/Abilities/FlowStep/FlowStepHelpers.php — naming_mismatch — Helper-like name does not match convention suffix 'Ability': FlowStepHelpers
    4. inc/Abilities/Job/JobHelpers.php — naming_mismatch — Helper-like name does not match convention suffix 'Ability': JobHelpers
    5. inc/Abilities/DailyMemoryAbilities.php — intra_method_duplicate — Duplicated block in registerAbilities — 5 identical lines at line 60 and line 99
    6. inc/Abilities/Flow/CreateFlowAbility.php — intra_method_duplicate — Duplicated block in executeBulk — 5 identical lines at line 359 and line 390
    7. inc/Abilities/FlowStep/FlowStepHelpers.php — intra_method_duplicate — Duplicated block in updateUserMessage — 6 identical lines at line 523 and line 538
    8. inc/Core/Steps/Update/Handlers/WordPress/WordPress.php — intra_method_duplicate — Duplicated block in registerTools — 6 identical lines at line 64 and line 86
    9. inc/Engine/AI/System/Tasks/DailyMemoryTask.php — intra_method_duplicate — Duplicated block in execute — 5 identical lines at line 189 and line 273
    10. inc/Engine/AI/System/Tasks/ImageGenerationTask.php — intra_method_duplicate — Duplicated block in trySetFeaturedImage — 6 identical lines at line 281 and line 299
Audit findings (10 shown)
1. **inc/Engine/AI/Directives/DirectiveOutputValidator.php** — missing_method — Missing method: get_outputs
2. **inc/Abilities/Flow/FlowHelpers.php** — naming_mismatch — Helper-like name does not match convention suffix 'Ability': FlowHelpers
3. **inc/Abilities/FlowStep/FlowStepHelpers.php** — naming_mismatch — Helper-like name does not match convention suffix 'Ability': FlowStepHelpers
4. **inc/Abilities/Job/JobHelpers.php** — naming_mismatch — Helper-like name does not match convention suffix 'Ability': JobHelpers
5. **inc/Abilities/DailyMemoryAbilities.php** — intra_method_duplicate — Duplicated block in `registerAbilities` — 5 identical lines at line 60 and line 99
6. **inc/Abilities/Flow/CreateFlowAbility.php** — intra_method_duplicate — Duplicated block in `executeBulk` — 5 identical lines at line 359 and line 390
7. **inc/Abilities/FlowStep/FlowStepHelpers.php** — intra_method_duplicate — Duplicated block in `updateUserMessage` — 6 identical lines at line 523 and line 538
8. **inc/Core/Steps/Update/Handlers/WordPress/WordPress.php** — intra_method_duplicate — Duplicated block in `registerTools` — 6 identical lines at line 64 and line 86
9. **inc/Engine/AI/System/Tasks/DailyMemoryTask.php** — intra_method_duplicate — Duplicated block in `execute` — 5 identical lines at line 189 and line 273
10. **inc/Engine/AI/System/Tasks/ImageGenerationTask.php** — intra_method_duplicate — Duplicated block in `trySetFeaturedImage` — 6 identical lines at line 281 and line 299
Tooling versions
  • Homeboy CLI: homeboy 0.88.7+8d56ebca
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: unknown
  • Action: Extra-Chill/homeboy-action@v2

Homeboy Action v1

@chubes4
Copy link
Copy Markdown
Member Author

chubes4 commented Apr 14, 2026

Superseded — redoing with a single storage filter instead of 5 per-operation filters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant