๐ง๐ต๐ฒ ๐ญ๐ฌ-๐๐ถ๐ป๐ฒ ๐ฆ๐ฒ๐ฐ๐ฟ๐ฒ๐ ๐๐ผ ๐๐ฒ๐๐๐ฒ๐ฟ ๐๐ ๐ฃ๐ฒ๐ฟ๐ณ๐ผ๐ฟ๐บ๐ฎ๐ป๐ฐ๐ฒ
Stop writing long instruction files for your AI. Most users waste tokens by adding unnecessary details to their project files.
I tested how the length of a GEMINI.md file affects Gemini CLI performance. Here are the results.
I compared three versions:
- GEMINI_0: Empty file.
- GEMINI_10: 10 lines of core settings (language, indentation, server location).
- GEMINI_100: 100 lines of full background, naming rules, and tool settings.
The results show that 10 lines are just as effective as 100 lines.
The Data: โข GEMINI_0: 33.3% accuracy | 66.8s latency โข GEMINI_10: 100% accuracy | 16.1s latency โข GEMINI_100: 100% accuracy | 20.2s latency
Why 10 lines win:
- Accuracy stays at 100%.
- It uses 87% fewer tokens than the long version.
- It responds faster.
Rules for writing instructions:
- Do NOT include: Project stories, official documentation, or general coding standards (like PEP8). The AI already knows these.
- DO include: Specific language requirements, project-specific naming rules, custom SSH mappings, or non-standard local ports.
- Use this rule: If you can find the rule on Google, do not put it in your instruction file.
Other ways to save tokens:
- Context Caching: Use this for repetitive long prompts.
- Prompt Compression: Use tools like LLMLingua for long documents.
- RAG: Use vector search instead of stuffing entire files into context.
- Output Control: Use JSON format to reduce response length by 85%.
Summary of strategies:
- Slim system prompts: Best for all CLI and API users.
- Context Caching: Best for repetitive long prompts.
- JSON Output: Best for structured data tasks.
Keep your instructions lean. Only write what the model does not already know.
Source: https://dev.to/jh5_pulse/rang-sheng-huo-chan-sheng-bian-hua-de-geminixiao-shi-yan-men-45ke
Optional learning community: https://t.me/GyaanSetuAi