# Should You Remove Unrelated Files from Your Training Tasks?

By Zorayr Khalapyan · 2026-11-13

What to keep and what to remove from a post-training task environment: the trade-offs between runtime cost, realistic context, and reliable grading.

When extracting a task for post-training, how much of the original codebase should you keep? If the solution only touches a few files, it is tempting to remove everything else.

My default is to keep the working repository, including files the solution may never touch. A more complete environment gives the agent room to practice finding the relevant code, understanding its dependencies, and leaving unrelated behavior intact. I would simplify the cost of running that environment before simplifying those decisions away.

I came to this question for a practical reason. I was extracting tasks from our financial-engineering codebase, and my local machine was struggling despite having 96 GB of RAM. Smaller environments seemed like an obvious way to make builds, testing, and iteration cheaper.

The catch is that deciding what to remove can change what the task actually teaches.

## The case for a smaller environment

A minimal environment has real advantages. There are fewer dependencies to configure, fewer services to start, and fewer ways for setup to fail. Smaller artifacts can be easier to store and move. It is also easier to inspect the task and determine whether the grader is measuring the intended behavior.

That can be the right choice for a controlled experiment. If you are comparing post-training methods on a specific capability, reducing unrelated variation may help you understand the result. A task can also be intrinsically difficult without requiring the agent to navigate a large repository.

The trade-off is that a smaller environment may remove part of the engineering work you meant to train.

## Unrelated to the solution is not unrelated to the task

Suppose a task asks an agent to fix a rounding bug in an order-validation path. The final patch changes three files. But an engineer starting from the issue would still need to find that path, inspect neighboring code, understand the numeric conventions, and decide which tests matter.

If you supply only those three files and their immediate dependencies, you have already done some of that work. The agent no longer has to distinguish the relevant module from several plausible alternatives.

In a four-file environment, it is easy to assume all four files matter. Repeated across a training distribution, that setup risks rewarding a shortcut that does not hold in a real repository.

This is a concern about the behavior the environment encourages, rather than a claim that every additional file improves learning. Arbitrary padding adds cost without necessarily adding useful decisions. Existing repository structure can provide meaningful context even when most of it never appears in the final diff.

## A realistic environment also gives the agent things to preserve

Finding the right files is only half of it. A good engineering change should leave unrelated functionality working.

In a fuller environment, an agent might fix the requested behavior while breaking a neighboring code path, deleting a useful fixture, or changing a shared configuration it should have left alone. Those outcomes give the rubric something meaningful to evaluate beyond whether the immediate fix works.

Keeping the files does not automatically create that signal. The [grader](/glossary#grader) still needs checks for relevant regressions and unwanted side effects. Those checks should permit legitimate alternative implementations; an unexpected diff is not, by itself, a defect.

This connects to the [grading problem I wrote about previously](/your-tests-can-pass-without-ever-running): the reward needs evidence that the work was completed correctly. A richer environment expands what correct completion can require, but the grader has to observe it.

## Keep the context; reduce the operating cost

For tasks intended to prepare models for work in real codebases, I recommend preserving the repository or coherent module an engineer would normally work inside. Keep the surrounding source, documentation, configuration, and tests they would reasonably search through.

Then look separately at what makes the environment expensive:

- **Unused services and external repositories:** remove them when they have no role in the task's working context or execution.
- **Generated artifacts and caches:** avoid shipping unnecessary copies, while preserving a reliable way to build and run the task.
- **Large datasets:** reduce them when the smaller fixture preserves the behavior and difficulty the task is intended to exercise.
- **Runtime setup:** retaining source files does not require running every service in the original production stack.

Sanitization still applies: private data, reference solutions, and protected grading assets do not belong in the learner's workspace simply because they existed in the original project.

When I am unsure about a source file, I would keep it, measure the cost, and remove it only if it is clearly outside the working context and expensive to retain. A file that the reference solution does not touch is not enough evidence to remove it.

The recommendation is to favor a realistic, robust environment over one curated around the known answer. The useful measure is how much engineering judgment the task preserves, rather than its file count.

**Make the environment cheaper to run without doing the agent's job of deciding what matters.**


---

[All notes](https://taskextraction.com/) · [About the author](https://taskextraction.com/about) · [Subscribe](https://taskextraction.com/subscribe)
