@startuml
interface ContextPackBuilder
interface DecisionPointBuilder
interface ContextCompressor
interface ContextReducer
interface Projection

class DefaultContextPackBuilder
class DefaultDecisionPointBuilder
class DefaultContextCompressor
class DefaultContextReducer
class ContextProjector
class DefaultContextRepository

class ContextPack
class ContextEntry
class ContextLayer
class TokenBudget
class CompressionMetadata
class CompressionStrategy
class SteeringNote
class ContextState

ContextPackBuilder <|.. DefaultContextPackBuilder
DecisionPointBuilder <|.. DefaultDecisionPointBuilder
ContextCompressor <|.. DefaultContextCompressor
ContextReducer <|.. DefaultContextReducer
Projection <|.. ContextProjector
ContextProjector --> ContextReducer
DefaultContextRepository --> ContextProjector

DefaultContextPackBuilder --> ContextCompressor
DefaultContextPackBuilder ..> ContextPack
DefaultContextPackBuilder --> TokenBudget
ContextPack --> "layers" ContextLayer
ContextPack --> "entries" ContextEntry
ContextPack --> CompressionMetadata
DefaultContextCompressor --> CompressionStrategy
DefaultContextCompressor --> TokenBudget
DefaultDecisionPointBuilder ..> ContextPack
DefaultDecisionPointBuilder --> ContextEntry

package "core:events" <<External>> {
  [ContextBuildingStartedEvent]
  [ContextPackBuiltEvent]
  [ContextBuildingFailedEvent]
  [ContextBuildingInterruptedEvent]
}
package "core:sessions" <<External>> {
  [Projection]
  [EventReplayer]
}

DefaultContextReducer ..> "core:events"
DefaultContextRepository ..> "core:events"
DefaultContextRepository ..> "core:sessions"

@enduml
