UAT: ContextTierService._summarize_for_cold() is a stub — cold-tier demotion truncates content instead of LLM summarization #3987

Open
opened 2026-04-06 08:18:27 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/uat-context-tier-cold-summarization-stub
  • Commit Message: fix(context-tiers): implement LLM summarization for cold-tier demotion
  • Milestone: (none — backlog)
  • Parent Epic: #396

Backlog note: This issue was discovered during autonomous operation
on milestone v3.4.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.


Background and Context

The spec describes a tiered storage model (hot/warm/cold) within the Advanced Context Management System (ACMS). The Cold Tier stores long-term, persistent knowledge in the UKO. When fragments are demoted from warm to cold tier, they are expected to be summarized (semantically compressed) to reduce token usage while preserving meaning — the spec implies LLM-based summarization for cold storage.

Feature Area: Memory and Knowledge Management — Context Tier Service (Hot/Warm/Cold)
Code location: src/cleveragents/application/services/context_tiers.py, ContextTierService._summarize_for_cold()


Current Behavior

_summarize_for_cold() is a stub that simply truncates content to 200 characters:

@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})

Where _COLD_SUMMARY_MAX_CHARS = 200. This means:

  1. Any fragment with content > 200 chars gets silently truncated when demoted to cold tier.
  2. The truncation is irreversible — the original content is permanently lost.
  3. No semantic summarization occurs — just raw character truncation.

Steps to reproduce:

  1. Create a ContextTierService
  2. Store a fragment with content > 200 chars in warm tier
  3. Call service.demote(fragment_id) to demote to cold tier
  4. Retrieve the fragment — content is truncated to 200 chars + "..."

Expected Behavior

Per the spec, when a fragment is demoted from warm to cold tier, _summarize_for_cold() should invoke an LLM summarizer to produce a semantically compressed version of the content. The summary should:

  • Preserve the key semantic meaning of the original fragment
  • Reduce token count for long-term cold storage efficiency
  • Be clearly marked as a summary (not the original content)
  • Not silently discard information via raw character truncation

Acceptance Criteria

  • _summarize_for_cold() calls an LLM summarizer (not truncation) when demoting fragments to cold tier
  • Summarization is configurable (model, prompt template, max summary tokens)
  • Fragments with content ≤ threshold are passed through unchanged (no unnecessary LLM calls)
  • The summarized fragment retains provenance metadata indicating it is a summary
  • Unit tests cover: summarization invoked for long content, passthrough for short content, LLM error handling
  • Integration test: warm→cold demotion produces a semantically valid summary (not a truncation)
  • All nox stages pass
  • Coverage >= 97%

Impact

  • Cold-tier fragments lose their content beyond 200 characters permanently
  • The tiered memory system cannot function as a long-term knowledge store as the spec intends
  • Fragments demoted to cold tier become semantically degraded, not summarized

Subtasks

  • Replace truncation logic in _summarize_for_cold() with an LLM summarizer call
  • Add configuration constants/settings for summarization model, prompt template, and max summary tokens
  • Add provenance metadata to summarized fragments (e.g., is_summary=True, original_length)
  • Handle LLM summarizer errors gracefully (fallback strategy or raise with context)
  • Tests (pytest/Behave): unit tests for _summarize_for_cold() covering long content, short content passthrough, and error handling
  • Tests (Robot/integration): warm→cold demotion integration test verifying semantic summarization
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly (fix(context-tiers): implement LLM summarization for cold-tier demotion), followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly (fix/uat-context-tier-cold-summarization-stub).
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
  • All nox stages pass.
  • Coverage >= 97%.

Supporting Information

  • Discovered during UAT testing of the Memory and Knowledge Management feature area
  • Related spec section: ACMS Tiered Storage — Cold Tier / UKO long-term knowledge storage
  • Parent Epic: #396 (Epic: ACMS Context Pipeline)

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/uat-context-tier-cold-summarization-stub` - **Commit Message**: `fix(context-tiers): implement LLM summarization for cold-tier demotion` - **Milestone**: *(none — backlog)* - **Parent Epic**: #396 > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.4.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. --- ## Background and Context The spec describes a tiered storage model (hot/warm/cold) within the Advanced Context Management System (ACMS). The **Cold Tier** stores long-term, persistent knowledge in the UKO. When fragments are demoted from warm to cold tier, they are expected to be **summarized** (semantically compressed) to reduce token usage while preserving meaning — the spec implies LLM-based summarization for cold storage. **Feature Area**: Memory and Knowledge Management — Context Tier Service (Hot/Warm/Cold) **Code location**: `src/cleveragents/application/services/context_tiers.py`, `ContextTierService._summarize_for_cold()` --- ## Current Behavior `_summarize_for_cold()` is a stub that simply **truncates** content to 200 characters: ```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}) ``` Where `_COLD_SUMMARY_MAX_CHARS = 200`. This means: 1. Any fragment with content > 200 chars gets **silently truncated** when demoted to cold tier. 2. The truncation is **irreversible** — the original content is permanently lost. 3. **No semantic summarization occurs** — just raw character truncation. **Steps to reproduce**: 1. Create a `ContextTierService` 2. Store a fragment with content > 200 chars in warm tier 3. Call `service.demote(fragment_id)` to demote to cold tier 4. Retrieve the fragment — content is truncated to 200 chars + `"..."` --- ## Expected Behavior Per the spec, when a fragment is demoted from warm to cold tier, `_summarize_for_cold()` should invoke an LLM summarizer to produce a semantically compressed version of the content. The summary should: - Preserve the key semantic meaning of the original fragment - Reduce token count for long-term cold storage efficiency - Be clearly marked as a summary (not the original content) - Not silently discard information via raw character truncation --- ## Acceptance Criteria - [ ] `_summarize_for_cold()` calls an LLM summarizer (not truncation) when demoting fragments to cold tier - [ ] Summarization is configurable (model, prompt template, max summary tokens) - [ ] Fragments with content ≤ threshold are passed through unchanged (no unnecessary LLM calls) - [ ] The summarized fragment retains provenance metadata indicating it is a summary - [ ] Unit tests cover: summarization invoked for long content, passthrough for short content, LLM error handling - [ ] Integration test: warm→cold demotion produces a semantically valid summary (not a truncation) - [ ] All nox stages pass - [ ] Coverage >= 97% --- ## Impact - Cold-tier fragments lose their content beyond 200 characters permanently - The tiered memory system cannot function as a long-term knowledge store as the spec intends - Fragments demoted to cold tier become semantically degraded, not summarized --- ## Subtasks - [ ] Replace truncation logic in `_summarize_for_cold()` with an LLM summarizer call - [ ] Add configuration constants/settings for summarization model, prompt template, and max summary tokens - [ ] Add provenance metadata to summarized fragments (e.g., `is_summary=True`, `original_length`) - [ ] Handle LLM summarizer errors gracefully (fallback strategy or raise with context) - [ ] Tests (pytest/Behave): unit tests for `_summarize_for_cold()` covering long content, short content passthrough, and error handling - [ ] Tests (Robot/integration): warm→cold demotion integration test verifying semantic summarization - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors --- ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly (`fix(context-tiers): implement LLM summarization for cold-tier demotion`), followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly (`fix/uat-context-tier-cold-summarization-stub`). - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. - All nox stages pass. - Coverage >= 97%. --- ## Supporting Information - Discovered during UAT testing of the Memory and Knowledge Management feature area - Related spec section: ACMS Tiered Storage — Cold Tier / UKO long-term knowledge storage - Parent Epic: #396 (Epic: ACMS Context Pipeline) --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:15 +00:00
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.

Blocks
#396 Epic: ACMS Context Pipeline
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3987
No description provided.