Skip to content

Cap action item dedup context from 50 to 10 items #4640

@beastoin

Description

@beastoin

Parent: #4635

Problem

extract_action_items() fetches up to 50 recent action items (past 2 days) for deduplication context. Each item includes description, due date, and completion status — adding thousands of input tokens per call.

File: backend/utils/conversations/process_conversation.py:87-91

existing_action_items = action_items_db.get_action_items(uid=uid, start_date=two_days_ago, limit=50)

In prompt (conversation_processing.py:290-302):

existing_items_context = f"\nEXISTING ACTION ITEMS FROM PAST 2 DAYS ({len(items_list)} items):\n"

Proposed Change

  1. Reduce limit from 50 to 10 (most recent)
  2. Or reduce time window from 2 days to 12 hours
  3. Only include pending (non-completed) items — completed items don't need dedup

Impact

  • Reduces input tokens by ~500-2000 per call depending on user's action item volume
  • Estimated 2-3% reduction in total costs
  • Active users with many action items benefit most

Risk

Low — duplicate action items may occasionally slip through, but the LLM already handles near-duplicate detection. 10 recent items should catch the vast majority of duplicates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    intelligenceLayer: Summaries, insights, action itemsmaintainerLane: High-risk, cross-system changesp2Priority: Important (score 14-21)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions