consciousness/src/agent
Kent Overstreet bb80225942 Recursive render_into/token_ids_into, compose from cached children
render_into(&mut String) and token_ids_into(&mut Vec<u32>) recurse
the tree extending the output in place. Branches emit their wrapping
(im_start/role/im_end) and recurse into children — same structure in
both methods. token_ids() now composes from cached leaf tokens instead
of re-encoding the full rendered string.

Killed the AstEvent/AstIter iterator experiment — explicit recursion
is cleaner for a tree walk that isn't truly flattening.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-08 14:00:42 -04:00
..
api ContextState + private AstNode fields: enforce token_ids invariant 2026-04-08 12:58:59 -04:00
tools Agent-aware provenance for memory tools 2026-04-07 17:46:40 -04:00
context.rs Kill tiktoken — all token counting now uses Qwen 3.5 tokenizer 2026-04-08 11:25:28 -04:00
context_new.rs Recursive render_into/token_ids_into, compose from cached children 2026-04-08 14:00:42 -04:00
mod.rs WIP: Context AST design — AstNode with Leaf{text,token_ids}/Branch 2026-04-08 12:46:44 -04:00
oneshot.rs Fix bail script: pass own pid file so it can exclude itself 2026-04-08 09:35:52 -04:00
tokenizer.rs Redesign context AST: typed NodeBody, Role as grammar roles, tests 2026-04-08 13:35:04 -04:00