﻿# Unsaved editor buffers and agent file tools: two visible revisions

Reconcile editor, filesystem, and running-process revisions before debugging a contradiction; different tool paths can legitimately observe different states.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-vscode-unsaved-buffer-disk/
Language: en

An unsaved editor buffer and the file on disk can contain different revisions. An editor-aware context attachment may reflect an open document, while a terminal process often reads saved filesystem contents unless its workflow explicitly synchronizes them. Agent IDE behavior depends on the particular tool path. This distinction explains seemingly impossible cases where the agent sees a change but a build still reports the old code.

## An open document has its own state

Typing changes the editor's in-memory document before an explicit save or configured automatic save writes it to disk. Language services can receive those document updates, while an unrelated shell command may still read the earlier file. A tab's visible text therefore does not establish what every tool consumed. Check the editor's save state and the behavior of the specific context mechanism instead of assuming one universal rule for all agent integrations.

Primary reference: [VS Code: Basic Editing](https://code.visualstudio.com/docs/editing/codebasics).

## A terminal usually follows filesystem inputs

A compiler or test runner normally opens files through its execution environment. It does not automatically share the editor's in-memory document object. Some tasks save files before running, but that is workflow behavior that should be verified. Record the working directory as well as the saved revision. A command launched in another checkout can produce a correct result for the wrong code, making a save-state problem look like an inexplicable compiler inconsistency.

Primary reference: [VS Code: How Copilot Understands Your Workspace](https://code.visualstudio.com/docs/agents/reference/workspace-context).

## A running process can add another revision

Even after saving, a server may use previously built assets or loaded modules until its documented reload mechanism runs. The browser can then display a state older than both the editor and disk. Confirm the intended process and a visible marker of the change. Avoid repeatedly rewriting correct source to compensate for stale runtime output. The causal chain is save, build or reload where required, and then observation of the intended running application.

Primary reference: [VS Code: Add Context to Chat](https://code.visualstudio.com/docs/chat/copilot-chat-context).

## Concurrent edits need a clear handoff

A human and an agent can both modify related content. Before replacing a file from a stale snapshot, inspect the current state and preserve unrelated changes. A dirty buffer can complicate how an external edit appears in the editor. Use the editor's supported conflict and reload behavior rather than assuming every refresh is harmless. The important question is which revision owns the intended change and how the next edit preserves it.

## Diagnose with a minimal revision check

Choose a harmless distinctive change and trace it from the open buffer to saved file, build input, and visible output. Stop at the first boundary where it disappears. This produces a specific explanation without broad cache clearing or unnecessary dependency changes. Once states agree, repeat the relevant check and continue the original task. The useful outcome is a known revision shared by the evidence, not a vague claim that the editor or model was confused.

Related reading: [Continue vs Cline vs Aider for local coding](/journal/continue-cline-aider-coding-choice/); [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/).
