Elixir facade for canonical BeamAgent context management.
BeamAgent.Context keeps compaction explicit and caller-driven. It reports
current pressure, summary state, and memory handoff candidates, then lets the
caller decide when to compact. It does not start a hidden scheduler or
background compactor.
Use budget_estimate/1 or context_status/1 to inspect pressure first, then
call maybe_compact/2 or compact_now/2 from a boundary you already own,
such as a routine runner or orchestration completion hook.
Summary
Types
Context budget estimate map.
Immediate compaction result map.
Context-layer error returned by the Erlang public API.
Current context status map.
Policy-driven compaction result map.
Session or thread scope accepted by the context manager.
Functions
Estimate current context budget pressure using default thresholds.
Summarize, optionally promote to memory, and compact immediately.
Return current context pressure and available summary/memory state.
Compact only when a configured policy trigger fires.
Types
@type budget_estimate_result() :: :beam_agent_context.budget_estimate_result()
Context budget estimate map.
@type compact_now_result() :: :beam_agent_context.compact_now_result()
Immediate compaction result map.
@type context_error() :: :beam_agent_context.context_error()
Context-layer error returned by the Erlang public API.
@type context_status() :: :beam_agent_context.context_status()
Current context status map.
@type maybe_compact_result() :: :beam_agent_context.maybe_compact_result()
Policy-driven compaction result map.
@type scope() :: :beam_agent_context.scope()
Session or thread scope accepted by the context manager.
Functions
@spec budget_estimate(scope()) :: {:ok, budget_estimate_result()} | {:error, term()}
Estimate current context budget pressure using default thresholds.
@spec compact_now(scope(), map()) :: {:ok, compact_now_result()} | {:error, context_error() | {:hook_denied, binary()} | {:hook_ask, binary()}}
Summarize, optionally promote to memory, and compact immediately.
@spec context_status(scope()) :: {:ok, context_status()} | {:error, term()}
Return current context pressure and available summary/memory state.
@spec maybe_compact(scope(), map()) :: {:ok, maybe_compact_result()} | {:error, context_error() | {:hook_denied, binary()} | {:hook_ask, binary()}}
Compact only when a configured policy trigger fires.