Another interpretation of "If a man hides himself in secret places, [shall I not see him?]" (Jeremiah 23:24). It is comparable to an architect who went out as a katadikon over a certain province (that is, "one who imposes punishment," in the Greek language). The inhabitants of the province began hiding their silver and their gold within those hidden vaults. The architect said to them: I built the province, and I made the hidden vaults. Would you hide from me? So too the Holy One, blessed be He, said to the adulterers: Would you hide yourselves from Me? "If a man hides himself in secret places" (Jeremiah 23:24) — I created you and made you full of cavity upon cavity, [as it is said,] "and you forgot God who brought you forth" (Deuteronomy 32:18). Nothing that you hide yourselves with will avail you anything, because "I the LORD search the heart, test the kidneys, to give to each man according to his ways, according to the fruit of his deeds" (Jeremiah 17:10). And I am the one who brings you near to judgment, as it is said, "And I will draw near to you in judgment" (Malachi 3:5). Therefore do not go astray after the evil inclination, so that the wife of one of you will not go astray, as it is said, "If any man's wife goes astray" (Numbers 5:12).
The Architect Who Built the Hidden Vaults - Nasso Midrash on Adultery
Midrash Tanchuma Buber, Nasso 8:2
ד"א אם יסתר איש במסתרים. משל (לארביטטקון) [לארכיטקטון] יצא (קאטריקון) [קאטדיקון] על אותה מדינה (פי' עונש בלשון יון), התחילו בני המדינה מטמינים כספם וזהבם בתוך אותם המטמונים, אמר להם (הארביטטקון) [הארכיטקטון] אני בניתי את המדינה, ואני עשיתי את המטמונים, ממני אתם מטמינים, כך אמר הקב"ה למנאפים, ממני אתם מסתירים עצמכם, אם יסתר איש במסתרים, אני בראתי אתכם ועשיתי אתכם מחילים מחילים, [שנאמר] ותשכח אל מחוללך (דברים לב יח), לא מועיל לכם כלום מה שאתם מטמינים עצמיכם, לפי שאני ה' חוקר לב בוחן כליות ולתת לאיש כדרכיו כפרי מעלליו (ירמיה יז י), ואני הוא שמקרב אתכם למשפט, שנאמר וקרבתי (אתכם) [אליכם] למשפט (מלאכי ג ה), לפיכך אל תהיו טועים אחר יצר הרע, שלא תשטה אשתו של אחד מכם, כמה שנאמר איש איש כי תשטה אשתו.