<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shamshad Ali on Medium]]></title>
        <description><![CDATA[Stories by Shamshad Ali on Medium]]></description>
        <link>https://medium.com/@alishamshad?source=rss-f3892819a3f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Shamshad Ali on Medium</title>
            <link>https://medium.com/@alishamshad?source=rss-f3892819a3f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:09:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alishamshad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[LLM Token Hygiene]]></title>
            <link>https://medium.com/@alishamshad/llm-token-hygiene-bffd0208b928?source=rss-f3892819a3f------2</link>
            <guid isPermaLink="false">https://medium.com/p/bffd0208b928</guid>
            <category><![CDATA[llm-tokens]]></category>
            <category><![CDATA[llm-usage]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[llm-token-hygiene]]></category>
            <category><![CDATA[tokenburn]]></category>
            <dc:creator><![CDATA[Shamshad Ali]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 17:01:45 GMT</pubDate>
            <atom:updated>2026-06-12T17:01:45.570Z</atom:updated>
            <content:encoded><![CDATA[<p>In the span of 1 year the conversation of, how AI will replace all the engineers and cost of building softwares is going to be zero, has turned into justifying ROI on AI usage across organisations. I fully acknowledge that we may never be able to go back to the pre-AI era and AI, in long run, is going to be a great automation tool that would open up new horizons in automating mundane tasks but I also believe more and more companies are going to take a critical look at optimising AI usage across different departments.</p><p>It does not matter much which LLM vendor (Claude/Codex/Co-pilot/Cursor) you use, companies spending $50K–$100K per month on tokens are now searching how to best utilise tokens and cut the AI bill.</p><p>I thought of listing out few basic things that all the engineers should think of while using any of the LLM vendors.</p><p><strong>Avoid long running chats</strong></p><p>Long running chats is one of the major reason for token consumption. Practice clearing context or starting a new chat aggressively. If you have run more than 5 iterations in a chat, have agent summarize your findings in a .md file, start a new chat and start from that summarized doc, you will save a lot on the tokens consumed just to parse previous chats messages and responses.</p><p>Claude has introduced “/compact” which can help reduce previous context but it would still use lot more tokens as compared to saving your progress and start a new chat</p><p>Have your LLM document your solution/approach once your investigations are complete and instead of prompting like “continue”, “yes please apply”, “yes please implement”, “looks good. go ahead” to implement changes, start a new chat and ask your agent to implement changes. <br>While prompts like “continue”, “yes please apply”, “yes please implement”, “looks good. go ahead” etc look harmless and you think these will use only a couple of tokens, agent would have to go through entire history of your chat to understand these ambiguous prompts just to implement suggested changes.</p><p>Lets put this in perspective, imagine if you entered one of the above “harmless prompt” but you end up burning 100K tokens just trying to figure out what you want agent to implement. If you send 11 such messages, that adds up to 23.3M tokens just because of these vague prompts.</p><p>If you were to prompt, change your prompt to something like “Yes, update the login page and run the tests.”, which is much more precise and will use far less tokens.</p><p><strong>Check your token usage regularly</strong></p><p>There are tools out there which can show you token consumption from your local LLM usage, it will make a huge difference if you review how are your tokens getting spent.<br>Ex: If you see something like, “1.1% of your tokens are Claude actually writing”, you will realize that Claude is consuming most of the tokens just to figure out the context from previous chats instead of actually writing code.</p><p>This sort of analysis would allow you to take corrective actions immediately and save on token usage.</p><p>Underlying message: “clear your context frequently”</p><p><strong>Avoid switching model mid-session</strong></p><p>Every single model change (e.g., switching from Sonnet to Opus, or changing the /effort level in Claude Code) maintains a distinct cache. Switching models completely destroys your existing cached conversation prefix, which would need to be rebuilt that would cost you tokens.</p><p><strong>Compressing data and terminal outputs before handing over to LLM</strong></p><p>While pasting console logs for LLM to process, avoid pasting entire log, instead practice removing unwanted log lines or duplicate logs. While its easy to paste the whole thing, you don’t want to give 100 lines of logs to LLM just for LLM to parse couple of lines of actual code from your repository.</p><p>You can also use tools like <a href="https://github.com/rtk-ai/rtk">https://github.com/rtk-ai/rtk</a> to de-dupe lines and remove extra contex</p><p><strong>Skills optimisation</strong></p><p>Update your skills to ensure it skips binary files, node_modules, .gitignore, lock files, and build outputs (target folder) etc or any other files that are not really necessary for building LLM context.</p><p><strong>Choose the right model</strong></p><p>Companies like Anthropic/Cursor/OpenAI etc are always selling the next shining model but if you don’t have real complex problem to solve, you don’t need latest models. You can get pretty good results with Haiku or Sonnet if you are just summarising documents, writing wikis, updating Jiras or solving trivial code problems.</p><p>Anticipate up to 10X cost difference between good enough lower models vs shining new model, you can do the math if you know your token usage.<br>Claude has launched “/advisor” to ensure Claude uses lower model for execution and only uses higher model for planning but its always better to use your judgement and choose models manually based on the problem you are trying to solve.</p><p><strong>Be specific in your request</strong></p><p>Point your LLM to specific files or, if possible, line numbers like “Fix the bug in src/auth.js line 42” or “Review LoginController and scan login method why hashed password is failing.” , this triggers fewer tool calls than “fix the login bug” where LLM has to search for the right file first with the login name or scan codebase to find out login code and read full class only to make few lines of change.</p><p><strong>Smaller agent/specific skills</strong></p><p>Smaller and specific agents and skills are way better than having one generic god agent.</p><p>Specific agent can be tasked with specific tasks/source code structure/programming language and can be made to run with limited context instead of load everything every time.</p><p><strong>Optimise Model Reasoning/effort</strong></p><p>With reasoning/thinking, every reasoning step consumes tokens.</p><p>Practice to skip reasoning for trivial tasks to prevent it from burning tokens on internal chains of thought that aren’t necessary for the current task.</p><p>Based on which LLM you are using, you can use “/effort” (CLI) or “/thinking” or “/fast” for adjusting your LLM effort and reasoning.</p><p>Here is an interesting snapshot which should make you think how you prompt your LLM and motivate practicing token hygiene. If engineer was using a better prompt, I am sure we would have saved atleast 60% of these tokens.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dx4d1OGAT7vy7KpzRQxF7g.png" /></figure><p>Bottom line is, while our role as an engineer is changing, we should be cautious of what questions we are asking LLMs and how instead of blindly dumping data into LLM and let it figure out.</p><p>Happy coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bffd0208b928" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>