Hypatian Codex
The earliest mention of the stronghold comes from 1150 and was written in the Hypatian Codex. The Ruthenian chronicler describes the expedition of King Géza II of Hungary to Ruthenia and the capture of the towns of Przemyśl and Sanok. In the time of the Piast dynasty, after the recovery of the Red Ruthenia by King Casimir III the Great, the royal palace surrounded by a defensive wall was built on the hilltop.