An implantable apparatus (10a; 10b; 10c) for stimulating a target anatomy and recording from the target anatomy, the apparatus comprising: a flexible substrate (36a; 36b; 36c) configured to house a plurality of electrodes (16a; 16b; 16c) disposed in an electrode array; a system-on-chip coupled to the flexible substrate (36a; 36b; 36c); passive/active components (14a; 14b; 14c) coupled to the system-on-chip; a capsule configured to encapsulate said flexible substrate (36a; 36b; 36c) with its electrode array, and said system-on-chip, and passive/active components (14a, 14b; 14c) coupled to said system-on-chip; wherein one or more of the system-on-chip and active/passive components (14a; 14b; 14c) comprises a processor, and a non-transitory memory storing instructions executable by the processor; wherein said instructions, when executed by the processor, configure the apparatus to perform steps comprising: activating the electrode array according to a user-determined stimulation pattern that is configurable based on the patient's physiological status, wherein the stimulation pattern comprises: a periodic stimulus comprising high-intensity pulses used to trigger muscle or neurons in the gastrointestinal tract; a low-intensity stimulus comprising a short pulse inserted between each high-intensity stimulus; and wherein the low-intensity stimulus is used to monitor the tissue impedance during a contraction or relaxation of the gastrointestinal smooth muscle; wherein the tissue impedance is determined in response to measuring the electrode overpotential evoked by the low-intensity stimulus; wherein the implantable apparatus (10a; 10b; 10c) is configured to be installed at a treatment location of a gastrointestinal tract of a patient or the vagus nerve and its associated branches; wherein the target anatomy is selected from the group of anatomical locations consisting of one or more of gastrointestinal tract smooth muscles, associated neurons, and nerve fibers; and wherein the processor is configured to provide stimulation to the target anatomy in response to monitoring tissue impedance toward restoring gastrointestinal motility and reducing inflammatory responses within the gastrointestinal tract. a flexible substrate (36a; 36b; 36c) configured to house a plurality of electrodes (16a; 16b; 16c) disposed in an electrode array; a system-on-chip coupled to the flexible substrate (36a; 36b; 36c); passive/active components (14a; 14b; 14c) coupled to the system-on-chip; a capsule configured to encapsulate said flexible substrate (36a; 36b; 36c) with its electrode array, and said system-on-chip, and passive/active components (14a, 14b; 14c) coupled to said system-on-chip; wherein one or more of the system-on-chip and active/passive components (14a; 14b; 14c) comprises a processor, and a non-transitory memory storing instructions executable by the processor; wherein said instructions, when executed by the processor, configure the apparatus to perform steps comprising: activating the electrode array according to a user-determined stimulation pattern that is configurable based on the patient's physiological status, wherein the stimulation pattern comprises: a periodic stimulus comprising high-intensity pulses used to trigger muscle or neurons in the gastrointestinal tract; a low-intensity stimulus comprising a short pulse inserted between each high-intensity stimulus; and wherein the low-intensity stimulus is used to monitor the tissue impedance during a contraction or relaxation of the gastrointestinal smooth muscle; wherein the tissue impedance is determined in response to measuring the electrode overpotential evoked by the low-intensity stimulus; a periodic stimulus comprising high-intensity pulses used to trigger muscle or neurons in the gastrointestinal tract; a low-intensity stimulus comprising a short pulse inserted between each high-intensity stimulus; and wherein the low-intensity stimulus is used to monitor the tissue impedance during a contraction or relaxation of the gastrointestinal smooth muscle; wherein the tissue impedance is determined in response to measuring the electrode overpotential evoked by the low-intensity stimulus; wherein the implantable apparatus (10a; 10b; 10c) is configured to be installed at a treatment location of a gastrointestinal tract of a patient or the vagus nerve and its associated branches; wherein the target anatomy is selected from the group of anatomical locations consisting of one or more of gastrointestinal tract smooth muscles, associated neurons, and nerve fibers; and wherein the processor is configured to provide stimulation to the target anatomy in response to monitoring tissue impedance toward restoring gastrointestinal motility and reducing inflammatory responses within the gastrointestinal tract.