Skip to content

/compact — provider compaction + summary banner #87

@harrryyd

Description

@harrryyd

Parent

Parent PRD: #82

What to build

Implement the /compact slash command. This is a two-phase operation:

  1. Provider compaction: The server calls the provider adapter's compaction method (e.g., Codex thread/compact/start) to ask the provider to summarize the full conversation history into a compact summary text.
  2. Trim + summary: Once the summary is returned, the server records it via thread.context.summarize, then trims all messages before the current point via the existing thread.context.trim flow (from Slice 1), attaching the summary to the trim point.

The UI shows a ContextSummaryBanner above the trim point divider displaying the compaction summary. The summary text is also used to bootstrap the restarted provider session.

Acceptance criteria

  • ProviderAdapter interface gains a compactThread method (returns summary text)
  • CodexSessionRuntime implements compactThread via Codex JSON-RPC (or falls back gracefully if unsupported)
  • thread.context.summarize command schema defined in contracts
  • thread.context-summarized domain event schema defined in contracts
  • ContextTrimPoint read model type gains optional summary field
  • Server-side: for /compact, call compactThread first, then dispatch thread.context.summarize, then dispatch thread.context.trim with summary attached
  • Session bootstrap after /compact: summary text is sent as initial context to the new provider session
  • /compact parses correctly in the composer slash command system
  • ContextSummaryBanner component renders above trim divider: shows header and summary, visually distinct
  • If provider compaction fails or is unsupported, summarize is skipped but trim still proceeds
  • Compaction duration is recorded on the summary event
  • Tests cover: compaction flow end-to-end, summary banner rendering, fallback when compaction unsupported

Blocked by

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions