Skip to content

The current implementation of DiffRecentChanges in diff_recent_changes.rs uses a basic L1/L2 cache system for tracking recent file changes, but there are several areas for improvement: #2166

@chojuninengu

Description

@chojuninengu

Idea

  1. The cache management is currently time-based only, without considering the importance or frequency of changes
  2. There's no mechanism to handle cache invalidation when files are reverted or modified outside the editor
  3. The L1/L2 split is currently based on file paths only, without considering the semantic relationships between files

Proposed Solution

Implement a more sophisticated caching system that:

  1. Introduces a weighted scoring system for changes based on:

    • Frequency of edits
    • Semantic relationships between files
    • User interaction patterns
    • Importance of the changes (e.g., critical fixes vs. minor updates)
  2. Add cache invalidation triggers for:

    • External file modifications
    • Git reverts
    • Large-scale refactoring operations
  3. Implement a dynamic L1/L2 split that considers:

    • File dependencies
    • Change impact analysis
    • User working context

Technical Details

The changes would primarily affect:

  • sidecar/src/agentic/tool/helpers/diff_recent_changes.rs
  • sidecar/src/agentic/tool/git/edited_files.rs
  • sidecar/src/agentic/symbol/tool_box.rs

Expected Benefits

  1. More efficient change tracking
  2. Better context preservation for AI-assisted editing
  3. Improved performance for large codebases
  4. More accurate change history for the AI to work with

Acceptance Criteria

  • Implement weighted scoring system for changes
  • Add cache invalidation triggers
  • Create dynamic L1/L2 split mechanism
  • Add unit tests for new functionality
  • Update documentation
  • Benchmark performance improvements

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions