class

Arcana::AI::Chat::History

Inherits Reference < Object

Manages a rolling conversation history with size limits.

Constants

MAX_CONTENT_CHARS = 100000

Constructors

Instance methods

add_assistant(content : String)
Source
add_system(content : String)
Source
add_user(content : String)
Source
empty?
Source
messages
Source
size
Source
trim_if_needed

Trim middle messages to stay under MAX_CONTENT_CHARS. Keeps system (0), first user+assistant (1-2), and newest messages. Always removes tool_use/tool_result pairs together to maintain the pairing required by the Anthropic API.

Source
update_last_assistant(content : String)
Source