compactionpoint

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package compactionpoint answers ONE question: at what provider-billed input does a conversation's own compaction mechanism act?

It is a separate package because two very different layers need the same answer and neither can own it. The GATE needs it to decide when to fire (components, through apply); the PANEL needs it to size an episode's attribution span (dash). A copy in each would be two tables to keep in agreement, which is the failure this repo has already had with cache TTLs and with token rulers.

It is NOT in internal/modelinfo, despite being keyed by model, because it is not a property of the model. It is a property of a (deployment, client, model) TRIPLE: the same model behind a different agent, or behind Claude Code with a different auto-compact threshold, acts somewhere else. modelinfo owns what the provider publishes; this owns what a client does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Point

type Point struct {
	// Frac is C as a fraction of the model's context window, in provider-billed tokens.
	Frac   float64
	Source Source
	// Note is why this value, in enough detail to tell whether it still holds.
	Note string
}

Point is one resolved C.

func For

func For(model string) Point

For resolves a model's compaction point from the bootstrap table.

An unlisted model gets C == W. That is NOT conservative for the span -- too high makes the span too wide and OVER-reports -- and it is chosen anyway, because a fabricated lower bound would make every unlisted model's savings quietly smaller by an amount nobody chose, and an operator comparing two models would be reading a difference this table invented. C == W is transparently an absence of information rather than a guess pretending to be one, and the Source says so.

func (Point) Tokens

func (p Point) Tokens(window int) int

Tokens is C in absolute billed tokens for a given window. 0 when the window is unknown.

type Source

type Source string

Source says where a resolved C came from, so a published figure can be read for what it is. The same measured/guessed discipline modelinfo.Exact keeps for windows.

const (
	// Measured: case 1 or 2 -- observed in billed tokens on a real run, or set by us.
	Measured Source = "measured"
	// Assumed: reported behaviour or a reasoned bound, not observed.
	Assumed Source = "assumed"
	// WindowFallback: case 3 and case 4 together -- C == W, because either nothing compacts here
	// (a fact) or we have never seen this client compact (a guess). This package cannot yet tell
	// those apart, which is itself worth reporting rather than smoothing over.
	WindowFallback Source = "window_fallback"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL