feat(perception): implement memory-first image storage strategy#1
Merged
IcyFeather233 merged 1 commit intoUbiquantAI:mainfrom Dec 22, 2025
Merged
feat(perception): implement memory-first image storage strategy#1IcyFeather233 merged 1 commit intoUbiquantAI:mainfrom
IcyFeather233 merged 1 commit intoUbiquantAI:mainfrom
Conversation
Implement a memory-first storage strategy to reduce disk I/O and optimize disk usage. **Key Changes:** - ImageManager: Add memory-first mode with dynamic TTL calculation - New methods: persist_image(), persist_images_batch(), cleanup_batch_screenshots() - TTL-based cleanup for memory-only images (default: processing_interval * 2.5) - Track image metadata (timestamp, is_persisted) for lifecycle management - ActionAgent: Trigger persistence only when actions are created - Persist screenshots to disk before saving actions - Immediate batch cleanup for unused screenshots after action generation - Coordinator: Add periodic TTL cleanup in processing loop - Config: Add memory-first configuration options - enable_memory_first, memory_ttl_multiplier, memory_ttl_min/max **Benefits:** - Reduce disk writes by ~95% (from 3,600/hour to ~150/hour) - Immediate cleanup of unused screenshots (vs. waiting for TTL) - Dynamic TTL based on processing_interval for adaptive behavior **Three-tier cleanup mechanism:** 1. Batch cleanup: Remove unused images immediately after action creation 2. TTL cleanup: Evict expired memory-only images every processing cycle 3. LRU eviction: Fallback when cache limit (500 images) is reached
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.
Implement a memory-first storage strategy to reduce disk I/O and optimize disk usage.
Key Changes:
ImageManager: Add memory-first mode with dynamic TTL calculation
ActionAgent: Trigger persistence only when actions are created
Coordinator: Add periodic TTL cleanup in processing loop
Config: Add memory-first configuration options
Benefits:
Three-tier cleanup mechanism: