---
title: "Tech Tip #40: Give your AI assistant structure, not raw files"
description: "Pasting whole files into an AI wastes tokens and accuracy."
url: https://greencode.ai/tech-tips/40-structured-context-for-ai/
---

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

**Pasting whole files into an AI wastes tokens and accuracy.**

[Watch the video](https://media.greencode.ai/shorts/structured-context-for-ai-3ab70fa341bc.mp4)

Video created by [explainapaper.com](https://explainapaper.com/?utm_source=greencode.ai&utm_medium=film&utm_campaign=made-by)

### 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](https://greencode-constitution.org/?utm_source=greencode.ai&utm_medium=referral&utm_campaign=greencode) (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](https://greencode.ai/feature/green-optimised-generative-ai/).

### Tags

#llm#ai-assistants#legacy

### Sources

- [Bridging formal syntax and LLM semantics: knowledge graphs for legacy code (ICSA-C 2026)](https://greencode.ai/publications/bridging-formal-syntax-and-llm-semantics-extracting-knowledge-graphs-for-legacy/)
- [Policy makers and AI energy: energy rises with input length, output length and model size](https://greencode.ai/news/policy-software-and-ai-energy/)

[All GreenCode Tech Tips](https://greencode.ai/tech-tips/)

#### Key Facts

- Tip **#40**
- For **Developers**
- Category **AI and machine learning**
- Format **short video**
![GreenCode](https://greencode.ai/wp-content/uploads/2024/12/greencode-logo-website-small-colours-2.webp)

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

[Get in touch](https://greencode.ai/contact/)
