Pervasive computing creates environments saturated with computing and communication capability, yet grace-fully integrated with human users. Remote execution has a natural role to play in such environments, since it lets applications simultaneously leverage the mobility of small devices and the greater resources of large devices. In this paper, we describe Spectra, a remote execution system de-signed for pervasive environments. Spectra monitors resources such as battery energy and file cache state which are especially important for mo-bile clients. It also dynamically balances energy use and quality goals with traditional performance concerns to de-cide where to locate functionality. Finally, Spectra is self-tuning— it does not require applications to explicitly specify intended resource usage. Instead, it monitors application behavior, learns functions predicting their resource usage, and uses the information to anticipate future behavior.