Programming Sensor Networks currently is a subtle task not because of enormous amount of code but due to inherent limitations of embedded hardware like the power, memory, network bandwidth and clock speed. In addition, there are very few programming abstractions and standards available which lead to close coupling between the application code and the embedded OS requiring understanding of law-level primitives during implementation. A Middleware can provide glue code between the applications and the heterogeneity of devices by providing optimized set of services for autonomously managing the resources and functionality of wireless nodes in a distributed wireless sensor network. This paper presents an autonomous middleware framework for low power distributed wireless sensor networks that support adaptive sensor functionality, context aware communications, clustering, quality of service and fault-tolerance. Finally an application on how to use the autonomous middleware is illustrated on the Envelope System Research Apparatus (ESRA).