UAT: ContextTierService._summarize_for_cold() is a stub that only truncates to 200 chars — spec requires LLM-based summarization on warm→cold demotion #5516

Open
opened 2026-04-09 07:10:59 +00:00 by HAL9000 · 0 comments
Owner

Summary

When a fragment is demoted from the warm tier to the cold tier, ContextTierService._summarize_for_cold() is called. The current implementation is a stub that simply truncates the content to 200 characters. The spec requires LLM-based summarization to produce a meaningful summary for cold-tier storage.

What Was Tested

Code-level analysis of src/cleveragents/application/services/context_tiers.py.

Expected Behavior (from spec)

Per docs/reference/context_tiers.md and the ACMS tier spec:

  • When a fragment is demoted from warm to cold tier, its content should be summarized (not just truncated)
  • Cold-tier fragments should contain a meaningful summary that preserves the key information
  • This enables cold-tier fragments to be useful when promoted back to warm/hot tiers

Actual Behavior

@staticmethod
def _summarize_for_cold(fragment: TieredFragment) -> TieredFragment:
    """Summarisation hook: truncate content for cold storage.

    This is a stub implementation that truncates the content.
    A production implementation would call an LLM summariser.
    """
    content = fragment.content
    if len(content) > _COLD_SUMMARY_MAX_CHARS:
        content = content[:_COLD_SUMMARY_MAX_CHARS] + "..."
    return fragment.model_copy(update={"content": content})

_COLD_SUMMARY_MAX_CHARS = 200 — content is simply truncated to 200 characters with ... appended.

The docstring explicitly acknowledges this is a stub: "A production implementation would call an LLM summariser."

Impact

  • Cold-tier fragments lose most of their content on demotion (truncated to 200 chars)
  • When cold-tier fragments are promoted back to warm/hot, they contain incomplete information
  • The temporal-archaeology and plan-decision-context strategies that query cold-tier data receive degraded content
  • Historical context quality degrades over time as fragments cycle through tiers

Code Location

src/cleveragents/application/services/context_tiers.pyContextTierService._summarize_for_cold() method.

Suggested Fix

Inject an LLM summarizer service into ContextTierService and call it in _summarize_for_cold():

def _summarize_for_cold(self, fragment: TieredFragment) -> TieredFragment:
    if self._summarizer is not None:
        summary = self._summarizer.summarize(fragment.content, max_tokens=50)
        return fragment.model_copy(update={"content": summary})
    # Fallback: truncate
    content = fragment.content[:_COLD_SUMMARY_MAX_CHARS] + "..." if len(fragment.content) > _COLD_SUMMARY_MAX_CHARS else fragment.content
    return fragment.model_copy(update={"content": content})

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: uat-tester

## Summary When a fragment is demoted from the warm tier to the cold tier, `ContextTierService._summarize_for_cold()` is called. The current implementation is a **stub** that simply truncates the content to 200 characters. The spec requires LLM-based summarization to produce a meaningful summary for cold-tier storage. ## What Was Tested Code-level analysis of `src/cleveragents/application/services/context_tiers.py`. ## Expected Behavior (from spec) Per `docs/reference/context_tiers.md` and the ACMS tier spec: - When a fragment is demoted from warm to cold tier, its content should be summarized (not just truncated) - Cold-tier fragments should contain a meaningful summary that preserves the key information - This enables cold-tier fragments to be useful when promoted back to warm/hot tiers ## Actual Behavior ```python @staticmethod def _summarize_for_cold(fragment: TieredFragment) -> TieredFragment: """Summarisation hook: truncate content for cold storage. This is a stub implementation that truncates the content. A production implementation would call an LLM summariser. """ content = fragment.content if len(content) > _COLD_SUMMARY_MAX_CHARS: content = content[:_COLD_SUMMARY_MAX_CHARS] + "..." return fragment.model_copy(update={"content": content}) ``` `_COLD_SUMMARY_MAX_CHARS = 200` — content is simply truncated to 200 characters with `...` appended. The docstring explicitly acknowledges this is a stub: *"A production implementation would call an LLM summariser."* ## Impact - Cold-tier fragments lose most of their content on demotion (truncated to 200 chars) - When cold-tier fragments are promoted back to warm/hot, they contain incomplete information - The `temporal-archaeology` and `plan-decision-context` strategies that query cold-tier data receive degraded content - Historical context quality degrades over time as fragments cycle through tiers ## Code Location `src/cleveragents/application/services/context_tiers.py` — `ContextTierService._summarize_for_cold()` method. ## Suggested Fix Inject an LLM summarizer service into `ContextTierService` and call it in `_summarize_for_cold()`: ```python def _summarize_for_cold(self, fragment: TieredFragment) -> TieredFragment: if self._summarizer is not None: summary = self._summarizer.summarize(fragment.content, max_tokens=50) return fragment.model_copy(update={"content": summary}) # Fallback: truncate content = fragment.content[:_COLD_SUMMARY_MAX_CHARS] + "..." if len(fragment.content) > _COLD_SUMMARY_MAX_CHARS else fragment.content return fragment.model_copy(update={"content": content}) ``` --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: uat-tester
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#5516
No description provided.