Skip to main content

Core Concepts & Protocol

Ante models agent interactions as a hierarchy of concepts, connected by a typed message-passing protocol.

Concept hierarchy

Project
└── Session
└── Task
└── Turn
└── Step
ConceptDescription
ProjectA git repo or root directory. Can have multiple sessions.
SessionOne episode of interaction between user and Ante. Manages dialog state, token usage, and context compaction.
TaskOne piece of work the user wants to accomplish. Can span multiple turns.
TurnOne back-and-forth with the agent. Starts with user input, ends with agent message or approval request.
StepOne interaction from agent with LLM. Handles tool calls and other mechanics.
note

Generally, if there is no approval interruption, one task consists of one turn.

Protocol: Ops and Events

Ante uses a message-passing protocol between the client (TUI or headless runner) and the daemon. Operations (Op) flow from client to daemon, and events (Evt) flow from daemon to client.

Message IDs

Every message has a custom Id type with a 4-byte prefix for tracing:

  • op_ — operations
  • evt_ — events
  • ses_ — sessions
  • step_ — steps

Operations reference

Operations (Op) are sent from the client to the daemon, wrapped in an OpMsg envelope with a unique Id.

OpPayloadDescription
StartSessionSessionRequestInitialize a new session; set fields are pinned and unset fields resolve from the host's current defaults
UpdateSessionSessionUpdateUpdate the active session (e.g. switch models, or rename it) without restarting
ResumeSessionsession_idResume a previously persisted session
UserInputStringSubmit a user prompt
ShellInputStringRun a daemon-side shell command without starting an agent turn
SteerStringAdditional user guidance for the active turn
ApprovalResponseturn_id, responses: [ToolDecision]Respond to tool approval requests; a Deny may carry a message back to the model
SlashCommandname, argsInvoke a skill by name
RegisterLocalProviderport, model?Register a running local llama-server as the local provider
RestoreLocalProviderRestore the previously registered local provider
Compactinstructions?Compact older conversation history, optionally steering the handoff summary
ContextReportRequest a per-category context-window usage report
GoalGoalCommandSet, clear, or inspect the goal-driven execution loop
AmbientPhrasedraft, req_idRequest a best-effort spinner phrase for the current draft
AmbientSuggestionrecent_user, recent_agent, req_idRequest a best-effort next-prompt suggestion
InterruptAbort the current running operation
ShutdownGraceful shutdown

Events reference

Events (Evt) are sent from the daemon to the client, wrapped in an EventMsg envelope with a timestamp, unique Id, and optional parent ID linking back to the originating operation.

EvtPayloadDescription
SessionStartSessionInfoSession initialized with identity, mutable settings, optional title, skills, and subagents
SessionUpdatedSessionInfoSession updated in place, repeating the session's equipped skills and subagents
SessionEndsession_id, reason, usageSession terminated with final usage accounting
TurnStartturn_idA new turn has begun
TurnPauseturn_id, reasonTurn paused (e.g. waiting for tool approval)
TurnResumeturn_idA paused turn resumed after approval or steering
TurnEndturn_id, statusTurn completed, interrupted, or errored
AgentMessageStringComplete text response from agent
ThinkingStringComplete chain-of-thought block
MessageDeltaStringStreaming message content chunk
ThinkingDeltaStringStreaming thinking content chunk
ToolStartToolUseTool execution began
ToolUpdatetool_use_id, seq, messageTool execution progress update
ToolEndtool_use_id, status, result_json, is_errorTool execution completed
UsageUpdateusageToken usage statistics
CompactStartDialog compaction started
CompactEndsummary?Dialog compaction completed; the replacement summary is absent when none was produced
ExtensionRefreshedsession_id, skills, subagents, mcp_serversSkills, subagents, and MCP server state refreshed
UserInputStringReplayed only — appears in resumed sessions, not live turns
InfoStringInformational message
ErrorStringError message
GoodbyeFinal message before disconnect
note

For the full protocol reference with wire format examples and all type definitions, see the Protocol Reference page.

Flow examples

Basic UI flow

A single user input where one turn pauses for approval (TurnPause) and then resumes:

Interruption flow

Interrupting a running turn and continuing with new input:

Context management

Ante automatically manages context windows:

  • Token budget — Each turn tracks token usage against the model's context limit
  • Auto-compaction — When the dialog approaches the context limit, Ante evicts aged tool results first, preserves the newest slice and user messages verbatim, and summarizes only the older prefix the model will no longer see. Manual /compact uses a tighter target and usually folds more history. If a provider rejects a request below the advertised limit, the session learns a smaller effective window, rescales the compaction budget, and retries once. On by default; disable with the auto_compact setting (manual /compact and overflow recovery remain available)
  • Tool result trimming — Large outputs are bounded to fit within budget, and a parallel result batch shares one overall context cap. Older results decay before conversational messages are summarized; a cleared marker names the original tool_use_id, whose complete result remains in a saved session's event log

Permissions

Ante has a permission system that gates tool execution. Rules are evaluated in first-match-wins order, with three possible decisions: Allow, Ask, or Deny. See the Permissions page for full details.