From 36e918cb47379b6082459717eddedcdb3d488cf0 Mon Sep 17 00:00:00 2001 From: Chris Means Date: Thu, 26 Mar 2026 03:15:49 -0500 Subject: [PATCH] Fix catchup prompt loading all entries into memory Push since filter to get_knowledge() and get_active_alerts() instead of fetching everything and filtering in Python. Prevents linear degradation as the store grows. Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.md | 3 +++ src/mcp_awareness/server.py | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c18cd33..1dcbcdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed +- Catchup prompt now pushes `since` filter to SQL instead of loading all entries into Python + ### Added - **Branding assets**: 9 SVG logo variants (icon sizes 16–200px, light/dark, wordmark light/dark) and favicon.ico in `docs/branding/` - **README logo header**: Wordmark hero replaces plain `# mcp-awareness` heading, centered badge row diff --git a/src/mcp_awareness/server.py b/src/mcp_awareness/server.py index 7bf1b02..2f4deef 100644 --- a/src/mcp_awareness/server.py +++ b/src/mcp_awareness/server.py @@ -1519,12 +1519,8 @@ async def write_guide() -> str: async def catchup(hours: int = 24) -> str: """Compose a catchup summary of recently updated entries.""" since = now_utc() - timedelta(hours=hours) - # Pull all knowledge and filter by updated timestamp - all_entries = store.get_knowledge(include_history="true") - recent = [e for e in all_entries if e.updated >= since] - # Also check alerts - alerts = store.get_active_alerts() - recent_alerts = [a for a in alerts if a.updated >= since] + recent = store.get_knowledge(include_history="true", since=since) + recent_alerts = store.get_active_alerts(since=since) parts: list[str] = [f"# Catchup — last {hours} hours"]