The era of internet of things [3] has witnessed the rapid growth of edge sensors. [4] The abundant data generated from the edge sensors are a tremendous challenge to the central computing source. [5] One solution to this challenge is processing the data near or in the edge of sensors, known as near-sensor-computing or in-sensorcomputing. [6] The in-sensor-computing requires the sensor device blocks to generate a tunable response to the physical stimulation. The tunable response to physical stimulations enables the combination of the functions of sensing and computing, and allows synchronous signal collecting and processing. Among all the senses, vision is the most important and human perceive up to 80% of all impressions by means of sight. [7] Herein programmable photodetectors with tunable photoelectrical response are key to achieving insensor-computing machine vision system or the state-of-art artificial retina. [8] The photovoltaic effect is one of the most important mechanisms to generate self-powered optical-electrical response, which is usually seen at the p-n junction, [9] Schottky junction, [10] or heterojunctions [11] where the built-in electric field can separate the photon stimulated hole and electrons. The photovoltaic effect at the p-n junction, Schottky junction, or heterojunctions is usually not tunable and lacks programmability. The switchable photovoltaic effect has been reported in ferroelectric materials, such as the BiFeO 3 and organic perovskites, [12] however, the large bandgap of BiFeO 3 (up to 2.7 eV) allows only photoresponse to high-energy band photons, and the stability of organic perovskites is to be improved. Metal-oxide-semiconductor (MOS) junction with a gate-tunable band structure has been massively used in switch devices such as MOS field-effect-transistors and insulated gate bipolar translators. [13] Taking use of the MOS field effect, lateral p-n junction of 2D materials such as WSe 2 and black phosphorous has been demonstrated using local split gates, which form a photovoltaic sensitive region between the split gates. [14] By far, the MOS junction has rarely been related to photovoltaics as its mirror symmetry hinders the net photocurrent or photovoltage between source and drain. Here we report a transition metal dichalcogenide (TMDC) photodetector device based on the MOS junction with broken mirror symmetry generating a programmable photovoltaic response. The sensor takes advantage of the field effect tunable band structure, and generates an adjustable or even reversible out-of-plane photovoltaic effect Programmability, fundamental to the computing of electronic systems, is traditionally achieved in processing and memory modules. Recently, the emergence of in-sensor computing allows the programmability of the sensing modules and the process of raw data upon the sensor edge, which reduces data transport and energy consumption. Here, a programmable photodetector module with a tunable photoelectric response based on molybdenum sulfide (MoS 2 ) metal-oxide-semiconductor (MOS) j...