Tech Tip #40: Give your AI assistant structure, not raw files

Pasting whole files into an AI wastes tokens and accuracy.

Video created by explainapaper.com

The problem

Assistants fed whole files or text-chunk search spend tokens reading code that is irrelevant and still miss how the parts connect.

The fix you can use today

  • Retrieve only the functions and files relevant to the task.
  • Use structure-aware retrieval (call graphs, symbols) rather than plain text chunks.
  • Keep prompts and context as short as the task allows.

GreenCode researchers found that a map of the code helped AI find the right parts better than plain text search.

Tools that help

  • GreenCode Constitution skill (GreenCode researchers): open-source energy principles and a catalogue of 37 energy anti-patterns that an AI coding agent can follow to find and fix waste like this

How GreenCode helps

GreenCode helps tackle this by giving its own AI only the code a task needs, retrieved from a searchable map of every interface in the codebase. Its models are small and fine-tuned, and each request goes to the smallest capable component. More on this.

Tags

#llm#ai-assistants#legacy

Sources

Transcript

Pasting whole files into an AI wastes tokens, and accuracy. Many AI assistants are fed whole files, or chunks of plain text. They spend tokens reading code that has nothing to do with the task. And they still miss how the parts connect. The energy an AI uses rises with the length of what it reads. Here is the fix you can use today. Give the assistant only the functions and files the task needs. Use search that knows the code's structure, like call graphs and symbols. Not plain chunks of text. Keep prompts and context as short as the task allows. GreenCode researchers found that a map of the code helped AI find the right parts. It did better than plain text search, on legacy code. GreenCode's Constitution skill can guide an AI coding agent to cut this waste. GreenCode helps tackle this by giving its own AI only the code it needs. It works from a searchable map of every interface, with small, fine-tuned models. That was GreenCode Tech Tip number forty. Follow for the next tip, and find more on greencode.ai/tech-tips.

All GreenCode Tech Tips · All GreenCode videos

  • Tip #40
  • For Developers
  • Length 1:10
  • Category AI and machine learning
GreenCode

Want this checked on your own system? Talk to the GreenCode team.

Get in touch