Skip to content

SuggestionStore: no TTL, max-row, or vacuum policy on suggestions.json #1940

Description

@Widthdom

Summary

SuggestionStore.LoadAll / SaveUnlocked (SuggestionStore.cs) read and write the entire .cdidx/suggestions.json file on every operation. There is no TTL (max_age), no max-row cap, no archival policy, and no vacuum command. Over a year of AI-driven suggestions at modest rates (e.g. 50/week from a multi-agent audit), the store grows to thousands of records, inflating JSON read/write latency and making cdidx suggestions list painful to browse. Old, never-acted-on suggestions also pollute fuzzy-dedup baselines (cross-link C602).

Where

Suggested approach

(1) Add a MaxSuggestionAge (default 365 days) and MaxSuggestionCount (default 5000) config to .cdidx/config.json (cross-link C595). (2) On each TryAddAndSubmit, prune records older than MaxAge OR exceeding MaxCount (oldest-first); archive pruned records to .cdidx/suggestions.archive.jsonl (append-only) rather than discarding. (3) Add cdidx vacuum-suggestions subcommand for manual cleanup with a --dry-run mode that reports what would be pruned. (4) Surface "pruned N stale records" in stderr on each vacuum trigger so operators see the maintenance. (5) Add regression test: seed store with 100 records dated 400 days ago, call TryAddAndSubmit, assert they're archived and the live store has only the new record. (6) Cross-link with #1874, #1728, C602, C604, C595.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions