MCPcopy Index your code
hub / github.com/docker/docker-agent / executeBeforeCompactionHooks

Method executeBeforeCompactionHooks

pkg/runtime/hooks.go:497–512  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

495// can use a single nil check to mean "nothing to do, fall through to
496// the default LLM-based path".
497func (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

Callers 1

doCompactMethod · 0.95

Calls 1

dispatchHookMethod · 0.95

Tested by

no test coverage detected