Skip to content

Compact stale entries from relationship index after soft deletes #19

@mgoldsborough

Description

@mgoldsborough

Problem

Soft-deleted entities remain in the reverse relationship index (by design — the file still exists on disk). Read-time methods like query_by_relationship and get_activities filter them out, but the index itself grows unboundedly for apps with frequent soft deletes.

Impact

  • Index file size grows over time with dead entries
  • Each reverse query loads and filters through stale entries
  • Not a problem for small apps, but could degrade for high-churn apps (e.g., activity-heavy CRMs)

Suggested Approach

  • Add a compact_index method that scans for soft-deleted entities and removes their entries
  • Optionally run it as part of rebuild_index
  • Could also be exposed as an MCP tool for manual invocation

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