Skip to content

Add generic compaction item contract #16

@chubes4

Description

@chubes4

Problem

AgentConversationCompaction is currently transcript-shaped: it operates on normalized message envelopes and uses conversation-specific boundary rules. Persistent memory compaction needs the same safety model, but over generic ordered items such as markdown sections, memory records, daily archive chunks, or tool traces.

Goal

Introduce a generic compaction item contract that conversation compaction and future memory compaction can both use without forcing markdown sections into fake chat messages.

Proposed Shape

  • Define a normalized item shape or value object with:
    • id
    • type
    • content
    • metadata
    • optional grouping/boundary hints
  • Add normalization helpers similar to AgentMessageEnvelope::normalize_many().
  • Keep provider/model execution out of Agents API.
  • Keep Data Machine vocabulary out of Agents API.

Acceptance Criteria

  • Agents API exposes a public item normalization contract for compaction inputs.
  • Conversation compaction can continue using message envelopes without breaking public API.
  • Tests cover valid items, invalid/missing item fields, stable IDs, metadata preservation, and ordering.

Notes

This is the foundation for later MEMORY.md and daily-memory compaction without coupling Agents API to Data Machine files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions