PtcRunner.SubAgent.Compaction.Context (PtcRunner v0.12.0)

Copy Markdown View Source

Read-only context passed to compaction strategies.

Locks in the shape that future custom-strategy APIs will receive so that strategies never see the full loop %State{}. Phase 1 has only one internal caller (the loop's build_llm_messages/3), but the struct shape is fixed here intentionally.

Fields:

  • turn — the turn that is about to start (1-indexed).
  • max_turns — agent's max_turns setting.
  • retry_phase?true while the loop is in a retry/validation phase.
  • memory — the agent's accumulated memory (read-only view).
  • token_counter — 1-arity function from message content to estimated tokens.

Summary

Types

t()

@type t() :: %PtcRunner.SubAgent.Compaction.Context{
  max_turns: pos_integer(),
  memory: map() | nil,
  retry_phase?: boolean(),
  token_counter: (String.t() -> non_neg_integer()),
  turn: pos_integer()
}