
On February 13, 1755, or the 29th of Rabiulakhir 1650 in the Javanese calendar, an agreement was reached between the VOC and Paku Buwono III on one side, and Prince Mangkubumi on the other, that their war must come to an end. The war, which had erupted in 1749, had caused great suffering to the common people. To resolve this, the Giyanti Agreement was established—a treaty signed in the village of Giyanti. The agreement stipulated the division of the Mataram Kingdom. Half of it remained under the control of Susuhunan Paku Buwono III, while the other half was handed over to Prince Mangkubumi, who later took the title Sultan Hamengku Buwono Senopati Ing Alogo Abdurrahman Sayidin Panotogomo Kalifatullah I.
Before the palace was completed, Sri Sultan resided in Ambar Ketawang, an area in Gamping, not far from the art gallery owned by the painter Amri Yahya today. This location is about 1.5 kilometers west of the palace.
Visitors to the Yogyakarta Palace today may find it hard to imagine that the area was once a dense forest with towering, ancient teak trees. The forest, known as Garjitawati, was located near the village of Beringan and only three to four kilometers from the village of Pacethokan.
During the reign of Amangkurat IV in Mataram, the Garjitawati forest was often used for meditation and seclusion. It is said that Amangkurat IV frequently found solutions to governmental issues during his time there. Perhaps this is why Sultan Hamengku Buwono I chose the location for the palace, which remains a significant landmark to this day.
However, others believe in a different story. They claim the location was chosen based on the message of a giant dragon that emerged from a clear lake in the forest. The story goes that a grass cutter, or pekathik, was gathering grass for his livestock in the forest. Feeling thirsty due to the heat, he looked around for water. Noticing a flock of herons flying nearby, he deduced there must be water in the area. Following the birds, he discovered a small, clear pond. As he bent down to drink, a dragon emerged from beneath the water.
Terrified, the grass cutter froze, but the dragon spoke in a calm and clear voice, delivering a message. The dragon instructed him that if Prince Mangkubumi ever intended to build a palace, it should be in that forest. After delivering the message, the dragon disappeared. The grass cutter immediately reported this to Sri Sultan Hamengku Buwono I.
Thus, the construction of the palace began, following the dragon’s advice. Sultan Hamengku Buwono I wanted the palace to be strong and durable, which required the use of robust materials. One of the essential steps was obtaining ancient teak wood. Young, strong, and capable men were tasked with felling teak trees believed to be hundreds of years old. These trees were located in forests within the area now known as Karangasem Village, Paliyan District, Gunung Kidul Regency.
According to local folklore, these forests were once so dense that they were home to various kinds of spirits. For this reason, the woodcutters were required to take precautions, such as fasting beforehand—either mutih (eating plain rice without side dishes and drinking only water) or ngebleng (fasting completely for three days and nights without food or water).
After several days of logging, the Sultan issued a specific order to find a tree not only ancient but also exuding a sense of authority and grandeur. This wood was intended for the main pillar of the Proboyeksa Hall, the first part of the palace to be built. The hall would serve as a place where the Sultan sat and received his attendants. Therefore, it was fitting to choose an ancient and majestic tree, as the hall was considered a vital part of the palace.
One night, a palace servant in the forest heard a deep, resonant voice. When he inquired who was speaking, the voice identified itself as Kiai Jegod, the guardian of the forest. The servant searched for the source of the voice and discovered it came from a tall, ancient, and majestic teak tree. The voice explained that Kiai Jegod was willing to let the tree be cut down and used as the main pillar, on the condition that he would be allowed to remain in the pillar forever.
The servant was puzzled by this request, but when the Sultan was informed, he agreed. Through the servant, the Sultan sent a message to Kiai Jegod, asking him to guard the Yogyakarta Palace for all eternity.
When the Sultan’s consent was conveyed, Kiai Jegod expressed his happiness, stating that by residing in the pillar, he would share in the Sultan's majesty and protection.
And so, the teak tree inhabited by Kiai Jegod was cut down and became the main pillar of the Proboyeksa Hall, where Kiai Jegod continues to serve as the spiritual guardian of the Yogyakarta Palace to this day.