consciousness/src/user
Kent Overstreet 5e4067c04f Replace token counting with token generation via HuggingFace tokenizer
Add agent/tokenizer.rs with global Qwen 3.5 tokenizer that generates
actual token IDs including chat template wrapping. ContextEntry now
stores token_ids: Vec<u32> instead of tokens: usize — the count is
derived from the length.

ContextEntry::new() tokenizes automatically via the global tokenizer.
ContextSection::push_entry() takes a raw ConversationEntry and
tokenizes it. set_message() re-tokenizes without needing an external
tokenizer parameter.

Token IDs include the full chat template: <|im_start|>role\ncontent
<|im_end|>\n — so concatenating token_ids across entries produces a
ready-to-send prompt for vLLM's /v1/completions endpoint.

The old tiktoken CoreBPE is now unused on Agent (will be removed in
a followup). Token counts are now exact for Qwen 3.5 instead of the
~85-90% approximation from cl100k_base.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-08 11:20:03 -04:00
..
chat.rs Simplify trim_entries, kill ContextBudget 2026-04-07 20:58:06 -04:00
context.rs Replace token counting with token generation via HuggingFace tokenizer 2026-04-08 11:20:03 -04:00
mod.rs Three-pane subconscious debug screen with shared widgets 2026-04-07 19:03:14 -04:00
subconscious.rs Add status column to context tree with tab-stop alignment 2026-04-07 22:13:27 -04:00
thalamus.rs Fix build warnings across workspace 2026-04-07 13:55:30 -04:00
unconscious.rs fix unused imports 2026-04-06 22:43:55 -04:00
widgets.rs Replace token counting with token generation via HuggingFace tokenizer 2026-04-08 11:20:03 -04:00