Skip to content

Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.

3.7 KB
Raw Blame
metadata:
  id: "compression.structured_summary"
  name: "Session Structured Summary"
  description: "Generate structured summary for archived sessions"
  version: "5.0.0"
  language: "en"
  category: "compression"

variables:
  - name: "latest_archive_overview"
    type: "string"
    description: "Latest completed archive overview"
    required: false
    default: ""
  - name: "messages"
    type: "string"
    description: "Session content"
    required: true

template: |
  Analyze the following session archive and generate a structured summary.

  {% if latest_archive_overview %}
  Latest completed archive overview:
  {{ latest_archive_overview }}

  {% endif %}
  Current archive session content:
  {{ messages }}

  Please output the summary directly in Markdown format:

  # Session Summary

  **One-sentence overview**: One concise sentence that explains how the current archive continues prior context and what new topics or decisions were added in this archive.

  ## Historical Context Carried Forward
  Still-valid prior background that should carry into future sessions.
  - ...

  ## New Information In This Archive
  Important facts, preferences, events, requests, or decisions introduced or updated in the current archive only.
  - ...

  ## Current Archive Analysis
  Chronological progression within the current archive only (2-4 key milestones).
  1. ...
  2. ...

  ## Key User Messages
  Preserve 3-6 important user quotes that remain useful for future continuity.
  - Include quotes from both prior context and the current archive when relevant.
  - Prioritize stable preferences, constraints, goals, relationships, and interaction style.
  - Prefer exact original wording when available from the current archive or prior overview.
  - ...

  ## Open Loops
  Unresolved items that remain active after this archive. Prefer items newly introduced here, but include older ones if they are still clearly relevant.
  - ...

  ## Next Step
  Recommended follow-up actions for the assistant or future conversation turns.
  1. ...
  2. ...

  ---

  Notes:
  - The current archive summary must be continuity-aware, not a standalone recap that ignores prior context.
  - If latest_archive_overview is provided, first extract 3-6 concise bullets of still-valid background into "Historical Context Carried Forward".
  - Do not copy the previous overview verbatim. Compress it into durable, reusable context only.
  - "New Information In This Archive" must focus on what is newly introduced, newly clarified, or newly changed in the current archive.
  - "Current Archive Analysis" should describe the progression of the current archive itself, not the full historical timeline.
  - "Key User Messages" should be continuity-aware: do not limit it to the current archive if older user quotes remain important for future turns.
  - When selecting historical quotes, keep only the most durable and still-relevant ones. Do not repeat quotes that add no future value.
  - Do not fabricate quotes. Only use wording grounded in the current archive content or in quoted material already present in latest_archive_overview.
  - Avoid mixing carried-forward background and new information in the same bullet unless the new archive explicitly updates prior context.
  - If there is no prior overview, write "None" under "Historical Context Carried Forward".
  - Do not leave placeholder tokens such as [Topic], [Result], or [Status] in the output.
  - Prefer durable user context: identity, work situation, long-lived preferences, health constraints, ongoing goals, relationship context, recurring interaction preferences.
  - Do not invent continuity. If a prior detail is not stable or is no longer relevant, omit it.
  - Keep overall length within 1000 words

llm_config:
  temperature: 0.0