executeBeforeCompactionHooks fires before a session compaction. The hook may veto the compaction (Decision: "block") or supply a custom summary string via [hooks.HookSpecificOutput.Summary] to skip the LLM-based summarization. The Result is returned verbatim so the caller (doCompact) can act on Allo
( ctx context.Context, sess *session.Session, a *agent.Agent, reason string, contextLimit int64, events EventSink, )
| 495 | // can use a single nil check to mean "nothing to do, fall through to |
| 496 | // the default LLM-based path". |
| 497 | func (r *LocalRuntime) executeBeforeCompactionHooks( |
| 498 | ctx context.Context, |
| 499 | sess *session.Session, |
| 500 | a *agent.Agent, |
| 501 | reason string, |
| 502 | contextLimit int64, |
| 503 | events EventSink, |
| 504 | ) *hooks.Result { |
| 505 | return r.dispatchHook(ctx, a, hooks.EventBeforeCompaction, &hooks.Input{ |
| 506 | SessionID: sess.ID, |
| 507 | InputTokens: sess.InputTokens, |
| 508 | OutputTokens: sess.OutputTokens, |
| 509 | ContextLimit: contextLimit, |
| 510 | CompactionReason: reason, |
| 511 | }, events) |
| 512 | } |
| 513 | |
| 514 | // executeAfterCompactionHooks fires after a successful compaction has |
| 515 | // applied a summary to the session. Purely observational — the result |