This repository has been archived on 2026-08-16. You can view files and clone it, but cannot push or open issues or pull requests.
ollie-core/agent
Levi Neely 833f9e0a00 agent: add bounded context builder to prevent prompt explosion
Add agent/context.go with a ContextBuilder that enforces a character budget
(soft + hard) over the assembled history, evicting oldest non-system messages
first and replacing large tool outputs with truncated summaries.

Update agent/session.go to use ContextBuilder in History(), so the loop
always sees a bounded context window regardless of how many steps have run.

The budget defaults are:
  - SoftLimit: 24000 chars (~6k tokens at 4 chars/token)
  - HardLimit: 96000 chars (~24k tokens)
  - MaxToolOutputChars: 2000
  - TailMessages: 6 (always keep last N messages verbatim)

All limits are configurable via ContextConfig.
2026-04-01 13:10:56 +02:00
..
context.go agent: add bounded context builder to prevent prompt explosion 2026-04-01 13:10:56 +02:00
loop.go Fix: skip [0 0 tokens] when counts are zero 2026-04-01 12:56:35 +02:00
session.go agent: add bounded context builder to prevent prompt explosion 2026-04-01 13:10:56 +02:00
state.go Add agent package: observe/decide/act/update/terminate loop 2026-03-31 22:53:40 +02:00