Skip to main content

Module token_gate

Module token_gate 

Source
Expand description

Cross-surface token/performance gate (#tokegate).

Records and gates token efficiency across tsift agent-facing surfaces: context-pack, session-review --next-context, graph-db evidence, conflict-matrix, and dispatch-trace.

For each surface the gate tracks: prompt tokens, envelope bytes, runtime, cache-hit rate, raw-read avoidance, and useful-hit density. A regression on any required metric across any surface blocks the gate.

Spec: see specs/graph.md § “Cross-Surface Token Gate”.

Structs§

TokenGateReport
TokenGateSample
TokenSurfaceEvaluation
TokenSurfaceMetricEvaluation

Enums§

TokenGateDecision
TokenMetricDirection
TokenSurfaceVerdict

Constants§

MIN_TOKEN_GATE_SAMPLES
REQUIRED_TOKEN_METRICS
TOKEN_GATE_SURFACES

Functions§

evaluate_token_gate
evaluate_token_regression
metric_direction
parse_token_history
surface_display_name