A program can be reened either by transforming the whole program or by reening one of its components. The reenement of a component is, for the main part, independent of the remainder of the program. However, reenement of a component can depend on the context of the component for information about the variables that are in scope and what their types are. The reenement can also take advantage of additional information, such as any precondition the component can assume. The aim of this paper is to introduce a technique, which we call program window inference, to handle such contextual informationduring derivations in the reenement calculus. The idea is borrowed from a technique, called window inference, for handling context in theorem proving. Window inference is the primary proof paradigm of the Ergo proof editor. This tool has been extended to mechanize reenement using program window inference.