ctok

Lighthouse for Claude prompts

ctok · the focus layer for Claude Codeopen source · runs from a clone

Stop context rot.Keep Claude focused.

Long coding sessions drift, the wrong model burns money, and you hit your quota mid-task. ctok runs before you send: it sizes the prompt, picks the right model and effort, trims the dead weight, and shows the real cost - in dollars and in your 5-hour window.

$git clone …/ctok && cd ctok && ./scripts/setup.sh

No app store, no account. Also on npm: npm i -g @ctok/cli

Star on GitHub
ctok — zsh
$
PlanExecuteVerify— one loop, every prompt
Plan

Pick the right model first

Size the prompt and get a model + effort call before you spend a single token.

ctok model
Execute

Keep every message lean

A 7-pass refiner strips filler and dedupes context so the agent stays focused.

ctok refine
Verify

Never blow your quota

See exactly what percentage of your 5-hour window a prompt will burn.

ctok scan
See it work

Three ways ctok makes Claude Code better

Every number below is computed live by the same engine the CLI uses - nothing is faked. Pick a scenario, run it, then open it in the playground to try your own.

Pleasantries, hedging and repetition cost real tokens and bury the ask. The refiner strips them - the model gets a sharper instruction for less.

Bloated prompt452 tok
with ctok refine --diff
Refined

ctok playground

Paste a prompt and context files. ctok estimates token usage, recommends a model and effort level, and flags what to trim - before you send anything to Claude.

Install the CLI
npm install -g @ctok/cli

Try an example

Context files

Attach files Claude would see in its context. Stays local in the browser.

No files attached. Drop in the files you'd realistically include - usually 1-4 is enough.

Prompt & context

Paste exactly what you'd send to Claude Code. Everything here counts toward input tokens.

Task type

Drives output-length estimate, model pick, and effort suggestion.

Session history

Save snapshots after estimating to track over time.

Use “Save snapshot” on the right column to log this estimate. Later, record actual token usage and we'll compare.

Token estimate

Awaiting input

Enter a prompt or attach files to see token estimates.

Cost & risk

Awaiting input

No data yet.

Quota impact

Awaiting input

No data yet.

Model recommendation

Awaiting input

No data yet.

Effort recommendation

Awaiting input

No data yet.

Reduction suggestions

Awaiting input

No data yet.

Prompt refiner

Awaiting input

No data yet.