MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / estimateTokens

Function estimateTokens

src/context/memory-select.ts:43–45  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

41
42/** Rough token estimate — ~4 chars/token, the usual heuristic; good enough for a budget gate. */
43export function estimateTokens(text: string): number {
44 return Math.ceil(text.length / 4);
45}
46
47/**
48 * Pick the facts to inject. `facts` are expected newest-first (as the store returns them).

Callers 2

selectInjectedFactsFunction · 0.70
handleSlashCommandFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected