← All projects

Project notes · Built systems

ContextFair

A browser conversation planner that shows which messages fit a context budget and why.

Problem & motivation

A chat can exceed its context budget even when a simple estimate looks safe. The planner makes retention decisions visible before exporting a conversation.

How it works

Plain JavaScript applies an oldest-first policy to whole exchanges, protecting the system instruction and newest user-led exchange. A Web Worker measures Qwen message content using a pinned tokenizer.

Evidence & limits

In the documented example, a window of 256 with a reply reserve of 64 keeps three messages by estimate but only one using measured content. This is an illustrative input, not an accuracy benchmark. Formatting allowances are adjustable placeholders; full chat templates are not tokenized.

What I learned & next steps

I learned to separate estimated budgets from measured content. I would add more exact tokenizers and explicit chat-template accounting. The separate tokenizer study did not fit this application’s estimator coefficients.

Source & setup

See the repository README for installation, commands, and the underlying evidence.