Sub topic 3
Where your data goes: prompts, context, tools, and telemetry
This chapter assumes you can use Git and a command line, have used an AI coding assistant, and know what an environment variable is. It maps the paths your data takes when you use an AI tool. You need that map before you can decide which controls to apply.
The four paths
An AI tool sends more than the sentence you type. Four kinds of data usually leave your machine.
- Prompt. The text you type or paste, including logs and stack traces.
- Context. Files the tool adds on its own: open editor tabs, files it finds by searching the repository, and a summary of your project layout.
- Tool results. Output from commands the agent runs and content returned by connected tool servers. Once the agent reads this output, it becomes part of the next request.
- Telemetry. Usage data such as feature use, errors, and sometimes prompts or code snippets. What is collected varies by tool and by settings.
Context is the path people miss
Most leaks come from context you never typed. If the assistant indexes your repository, a .env file in the project folder can be included in a request. The same applies to a file open in your editor and to a terminal you shared with the tool.
A useful habit is to ask what the tool can see by default. Check its documentation or settings for these points:
- Which files it reads automatically.
- Whether it indexes the whole workspace, and where the index is stored.
- Whether it reads your terminal history or output.
- Which telemetry options exist and what they default to.
Tool results feed back into the conversation
An agent that runs cat config.yaml or env has just put the result into its context. The next request carries it to the provider. This is why a single harmless-looking command can expose a secret.
# Prints every environment variable, including any secrets, into the agent's context
env
# Prints only the variable names, which is usually enough for debugging
env | cut -d= -f1A quick way to check what leaves
You can test a tool's behavior with a harmless canary value. Create a fake secret, ask a question that touches the file, and check what the tool says it used.
echo 'CANARY_TOKEN=not-a-real-secret-12345' > .env.testAsk the assistant to explain your project setup. If it quotes CANARY_TOKEN, then the tool read that file, and a real secret in the same place would have been read as well. Delete .env.test afterward.
Summary table
| Path | Who controls it | Typical control |
|---|---|---|
| Prompt | You | Redact before pasting |
| Context | The tool, with your settings | Ignore files, workspace scope |
| Tool results | The agent, with your approvals | Permission prompts, limited commands |
| Telemetry | The vendor, with your settings | Opt-out options, plan terms |
Exercise
An assistant runs cat .env while debugging a failing test. You never pasted the file. Which data path carried the secret, and what would you restrict?
Show answer
The tool-results path carried it. The command output became part of the agent's context and went to the provider with the next request. Restrict it by requiring approval for commands that read secret files, excluding .env files from the agent's reach, and keeping secrets out of the project folder where possible.
Exercise
Name the four paths by which data can leave your machine when you use an AI tool, and say which one you control most directly.
Show answer
Prompt, context, tool results, and telemetry. You control the prompt most directly, because you decide what to type or paste. The other three depend on tool settings and permissions.