Skip to main content
Goal: see the difference between asking for a file and actually including it in a task’s context. AI calls: none. Context means the information provided for a task. Think of it as a reading packet: the chosen pages and their saved versions. The exercise below builds that packet locally; it does not send it to an AI service. Use the practice project from the previous lessons and stay in the outer folder.

1. Save the helper

Create choose_context.py beside practice-project, using the plain-text editor method from lesson 3. Paste this entire code block:
This helper adds two tutorial files and saves a new local snapshot when they change. long-note.txt is deliberately larger than the first limit. The policy file records the size rules. It does not overwrite your greeting or push anything to GitHub. Use it only in the practice project.

2. Try the small reading limit

Windows PowerShell:
Linux:
Expected result:
A byte is a unit of stored data. In these simple ASCII examples, each character takes one byte. The greeting fits within 128 bytes; the 2,000-character note does not. Other languages and characters can take more bytes per character.

3. Allow the larger file

Windows PowerShell:
Linux:
Expected result:
You changed the rule deliberately and saved it in another snapshot. In a real task, you would first ask whether the larger file is relevant, rather than always increasing the limit.

What this teaches

Requesting a file is not a guarantee that it reaches the final reading packet. Inspect what was included and why other items were excluded. The full API result includes a manifest: a list describing those decisions. This helper prints a simpler summary for the exercise. The operation reads committed text. It does not ask a model to decide which files matter. If you return to lesson 3 now, “Previous” will mean the prior policy snapshot, not the original greeting snapshot; moving labels change as you save more commits.

If you get stuck

  • The greeting is missing: check that welcome.txt was committed in lesson 2.
  • Both files are left out: check you copied the exact policy and did not enlarge the greeting.
  • An error names a missing package: use the .venv Python command, not an unrelated Python installation.
Next: write a task that another person or agent can understand. For the complete technical explanation, see context selection.