From 335d2384ea08385d2b8eb652208b3f124fe89fcf Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 1 Apr 2026 22:27:39 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20optimize=20identify=5Fanti?= =?UTF-8?q?=5Fpatterns=20loop=20in=20FeedbackLoops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: daggerstuff <261005129+daggerstuff@users.noreply.github.com> --- data/pipeline/feedback_loops.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/data/pipeline/feedback_loops.py b/data/pipeline/feedback_loops.py index 55471fbe..83e99e6f 100644 --- a/data/pipeline/feedback_loops.py +++ b/data/pipeline/feedback_loops.py @@ -126,8 +126,14 @@ def identify_anti_patterns(self) -> List[Dict[str, Any]]: try: # Mocked naive pattern extraction dummy_keywords = ["toxic positivity", "abrupt ending", "unhelpful generic"] - for keyword in dummy_keywords: - matches = sum(1 for c in failure_contexts if keyword in c) + # ⚡ Bolt: Consolidated multiple iterations over failure_contexts into a single O(N) loop to reduce Python iteration overhead. + keyword_counts = {k: 0 for k in dummy_keywords} + for c in failure_contexts: + for keyword in dummy_keywords: + if keyword in c: + keyword_counts[keyword] += 1 + + for keyword, matches in keyword_counts.items(): if matches > 5: anti_patterns.append( {