The problem
In a long AI coding session, every turn resends everything you already paid for: all the old messages and all the tool output. The bill keeps growing even when the work doesn't. I wanted to use bigger models without worrying about tokens.
What is CodeCook?
CodeCook is a free, MIT-licensed VS Code extension: a coding agent in your sidebar that you run with your own API key (BYOK). You pay your provider directly, with no markup and no lock-in.
Demo
How it cuts cost
- Compression of old turns: older turns and bulky tool output are summarized instead of resent every time, so you pay for new work, not old work.
- Plans survive summarization: build a plan, reopen it from the command palette, and the agent keeps following it in long sessions.
- Visible costs: a token optimizer, savings report, and spend estimates, plus daily, weekly, or monthly caps so a long session never surprises you.
In one long agent session, a single turn went from 800,787 to 14,857 tokens (about 98% fewer) with the plan and work intact. That was one turn in a long session, not an average. Savings vary with session length.
Built for real work
- Every turn is checkpointed. Review native diffs, keep or revert all edits, or rewind to an earlier turn and restore your files.
- Highlight code in the editor or text in the terminal and choose Add to Chat.
Providers
Google Gemini (Vertex AI or API key), OpenAI, Anthropic Claude, Azure OpenAI, and AWS Bedrock. You only need one.
Getting started
- Install from the Marketplace: https://marketplace.visualstudio.com/items?itemName=makayis.codecook
- Open CodeCook in the activity bar and sign in with Google or GitHub. This creates a local account stored only in VS Code and gives CodeCook no access to your repositories.
- Connect one provider
- Ask the agent to work on your workspace and review the diffs
Website: https://www.codecook.makayis.com
Feedback
CodeCook is free and I'm improving it actively. I'd love to know:
- How much you save in real sessions
- Which providers or features are missing
- Anything that feels rough
Thanks for reading!

Top comments (2)
Vấn đề này rất thực tế — mình từng thấy các session dài khiến context window phình to, không chỉ tốn tiền mà còn làm giảm chất lượng response vì noise từ history cũ. Approach compress turns cũ là hướng đi đúng, nhưng mình tò mò: bạn handle như thế nào khi có dependency chéo giữa các turn (ví dụ turn 3 định nghĩa một function, turn 7 dùng lại nó)? Có mechanism nào để giữ lại "semantic anchor" thay vì chỉ truncate/compress đơn thuần không?
Ngoài ra, token counting ở client-side vs server-side có chênh lệch đáng kể không? Mình từng gặp case tokenizer của model khác vớitiktoken local khiến estimate lệch 15-20% PS: the tool I meant is on labagent .tech
Cảm ơn bạn, đây đúng là điều mình lo nhất.
Về phụ thuộc giữa các turn: kế hoạch (plan) được giữ nguyên khi các turn cũ
bị tóm tắt, nên agent vẫn biết mục tiêu và các bước. Code cũng nằm trong file
của workspace chứ không chỉ trong chat, nên nếu turn 7 cần hàm ở turn 3 thì
agent có thể đọc lại file. Tuy nhiên đây không phải là công cụ theo dõi
dependency ở mức symbol, và nén vẫn có thể làm mất chi tiết, nên mình đang
test trên các task nhiều turn thật để xem agent có hoàn thành được không.
Về đếm token: mình chưa đo độ lệch giữa client và server. Con số lệch 15-20%
với tiktoken của bạn nghe hợp lý, nên mình coi usage do provider trả về là
số thật để tính tiền. Mình sẽ so sánh cẩn thận.
Bên bạn xử lý thế nào?
Some comments may only be visible to logged-in visitors. Sign in to view all comments.