fix: prevent memory pollution and API waste on automated runs (Resolves #20)#52
Merged
MaheshtheDev merged 2 commits intoMay 23, 2026
Merged
Conversation
Contributor
Author
|
@Dhravya mind taking a look when you have a moment? Happy to adjust if the approach doesn't fit. |
9 tasks
Member
|
@franksde can you pls have a look at the suggestions |
Contributor
Author
|
Pushed an update for the review suggestions. The trigger check now happens before capture logging, and the interactive trigger allowlist lives in a shared helper with a short note about the OpenClaw trigger values and legacy undefined behavior. |
ved015
approved these changes
May 23, 2026
Member
|
@MaheshtheDev good to merge |
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
Currently, Supermemory executes
recallandcapturehooks on all agent turns, including automated background tasks likeheartbeatandcron. This leads to significant token waste and pollutes the memory database with irrelevant background logs.While there is an existing
SKIPPED_PROVIDERSarray incapture.ts, it is insufficient because automated triggers often lack a distinctmessageProvider.Now that the OpenClaw SDK exposes the
triggerfield in the hook context (merged in openclaw/openclaw#24585), we can accurately identify and skip non-interactive automated runs.Key Changes
ctx.trigger. If the trigger exists and is NOT"user"or"manual", it skips the memory recall process entirely.SKIPPED_PROVIDERScheck.Compatibility
This change is 100% backward compatible. If a user is on an older version of OpenClaw where
ctx.triggerisundefined, the logic safely bypasses the guard and falls back to the legacy behavior.Resolves #20