Japanese literature about samurai has a long and rich history, and includes written works such as medieval war chronicles, waka poetry, and more.
Early literature
Kojiki
The Kojiki is Japan's oldest extant book. Compiled in 712 AD, it contains passages about Yamato Takeru, the son of the emperor Keiko. It includes references to the use and admiration of the sword by Japanese warriors:
The many-clouds-rising
Izumo Takeru
Wears a Sword
With many vines wrapped around it, But no blade inside, alas.
or this:
Next to the maiden's
Sleeping place
I left
The sabre, the sword —
Alas, that sword.
Yamato Takeru may be considered the rough ideal of the Japanese warrior to come. Most important, his portrayal in the Kojiki shows the ideal of harmonizing the literary with the martial may have been an early trait of Japanese civilization, appealing to the Japanese long before its introduction from Confucian China.
Shoku Nihongi
The Shoku Nihongi (797 AD) is an early history of Japan compiled in 797. A section of the book covering the year 723 is notable for an early use of the term "bushi" in Japanese literature and a reference to the educated warrior-poet ideal:
"Again, the August Personage said, "Literary men and warriors are they whom the nation values."
In the Kokin Wakashū (905) there is an early reference to "Saburau"—originally a verb meaning "to wait upon or accompany a person in the upper ranks of society." The term would come to mean "those who serve in close attendance to the nobility." From the mid-Heian Period these attendants were armed and served as guardians to the higher nobility.
Attendant to nobility
Ask for your master's umbrella. The dews neath the trees of Miyagino Are thicker than rain.
(Poem #1091)
By the end of the 12th century, samurai became synonymous with bushi almost entirely and the word was closely associated with the middle and upper echelons of the warrior class.
Literature of the 13th to 16th centuries
Heike Monogatari
Written in 1371, The Heike Monogatari chronicles the struggle between the Minamoto and Taira clans for control of Japan at the end of the 12th century, a conflict known as the Genpei War. The Heike Monogatari is one of the longest and most beautifully composed of the genre called gunki monogatari, or war chronicles. Clearly depicted throughout the Heike Monogatari is the ideal of the cultivated warrior. This ideal is symbolized in the character 斌 or uruwashii, meaning a situation of balance and harmony between the exterior pattern, or beauty (文), and the interior essence, or substance (武). Men who possess this quality will be as accomplished in the world of the arts as in the world of martial skill and courage.
One such example is Taira no Tadanori:
Friends and foes alike wet their sleeves with tears and said, "What a pity! Tadanori was a great general, pre-eminent in the arts of both sword and poetry." (Kitagawa and Tsuchida, 1975)
The warriors in the Heike Monogatari served as models for the educated warriors of later generations, and the ideals depicted by them were not assumed to be beyond reach. Rather, these ideals were vigorously pursued in the upper echelons of warrior society and recommended as the proper form of the Japanese man of arms. With the Heike Monogatari, the image of the Japanese warrior in literature came to its full maturity. (Wilson, 1982)
The Message Of Master Gokurakuji
In the year 1256, the Shogunal Deputy in Kyoto, Hōjō Shigetoki (1198-1261) wrote a letter to his son and house elders of his clan. The letter, now known as "The Message Of Master Gokurakuji", emphasized the importance of loyalty to one's master:
When one is serving officially or in the master's court, he should not think of a hundred or a thousand people, but should consider only the importance of the master. Nor should he draw the line at his own life or anything else he considers valuable. Even if the master is being phlegmatic and one goes unrecognized, he should know that he will surely have the divine protection of the gods and Buddhas ... One should rely on neither age nor youth. But he who reveres the master and protects the people may be called a sage.