Skip to main content

Module session

Module session 

Source
Expand description

Session-scoped symbol table – patent claim 6.

The encoder (crate::encoder) only knows the static substitution table. Real conversations introduce many more recurring terms (entity names, file paths, commit SHAs, function identifiers). When the same multi-token term appears N+ times in a session, the session table promotes it to a short alias and rewrites every subsequent turn – so savings compound across turns rather than resetting each request.

Decay-weighted utility: each occurrence decays the per-term score by a half-life so stale terms eventually drop out and the alias pool stays bounded. Promoted bindings are emitted as a single prefix the proxy prepends to the next outbound prompt; any receiver (model or tool) that has not seen the binding sees the prefix and learns the alias once.

v0.1 scope (this file):

  • Scoring: simple count + token-cost gain heuristic.
  • Promotion threshold: configurable; default 2 occurrences.
  • Pool cap: configurable; default 64 active bindings.
  • Substitution: longest-binding-first greedy, like encoder.rs.
  • Prefix format: one binding per line, <alias>=<term>.

Out of v0.1 scope (tracked as session-followup):

  • Decay across calendar time (currently per-turn only).
  • Cross-tenant alias namespaces.
  • Cryptographic binding receipts (would live next to PQC signatures in pithy-measure).

Structs§

Binding
One alias binding promoted by the session.
SessionPolicy
Tunable thresholds for promotion and pool size.
SessionSymbolTable
Multi-turn alias accumulator.