We present a silicon implementation of a 4-port universal linear optical circuit. Instead of predefining the exact functionality of a photonic circuit at design time, we demonstrate a simple generic silicon photonic circuit, combined with electronic control and software feedback, that can perform any linear operation between its 4 input and output ports. The circuit consists of a network of thermally tunable symmetric Mach-Zehnder interferometers with phase and amplitude control, in-circuit optical power monitors, and local software controlled feedback loops. The circuit can be configured using a training mechanism, which makes it to self-adapt to implement the desired function. We use the circuit to demonstrate an adaptive, universal beam coupler, as well as a switch matrix.