MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / estimate_tokens

Method estimate_tokens

crates/opencode-session/src/compaction.rs:232–235  ·  view source on GitHub ↗
(text: &str)

Source from the content-addressed store, hash-verified

230 }
231
232 pub fn estimate_tokens(text: &str) -> u64 {
233 let char_count = text.chars().count() as u64;
234 char_count / 4
235 }
236
237 pub fn generate_summary_prompt() -> String {
238 r#"Provide a detailed prompt for continuing our conversation above.

Callers

nothing calls this directly

Calls 1

countMethod · 0.80

Tested by

no test coverage detected