Much of Japanese leadership, including the Emperor, was under the impression that "the good offices" of the Soviet Union would help Japan sue for peace. Imagine the surprise of the Japanese diplomat when he was quickly told by his USSR counterpart to "go home" and that war was declared. However after the oust of Hideki Tojo, the Japanese leadership was largely disorganized. The single most powerful man in Japan at the time was Korechika Anami, head of the armed forces. He was making some preparations with the IJ forces stationed in mainland Asia, but they were far too strapped for manpower and supplies to put up a good fight against the Soviet Union. A USSR attack was certainly recognized by military leadership to be possible, but there were simply too few resources to counter it.
As the non-aggression pact held until the final days of the war, Japan's military focused more on the eminent American invasion. When Anami was not planning for his grand defense, he was busy being the loudest opponent to surrender. He is also speculated to have delayed a coup attempt. He killed himself in the traditional samurai fashion just hours before the surrender was broadcast on NHK, national radio.
In actuality their plan was to beg the Soviet Union to negotiate a peace with the other allies. By spring 1945 Japan was being bombed on a daily basis by U.S. bombers who met with little resistance. Nearly all territorial gains made in the early war had been lost. Starving Chinese troops had fought the Japanese forces to a standstill in China. Japan was running low on fuel, food, steel and every other resource required to execute a war. The Japanese Navy was decimated and the air force was being reserved for Kamikaze attacks in a desperate effort to inflict enough casualties to force a negotiated peace.
Up until the moment of the Russian invasion of Manchukuo Japan held on to hope of a negotiated surrender. Stalin pretended to be interested in helping to arrange this surrender in exchange for practically all of the lands Japan had conquered in China. This may have been a major reason Japan did not surrender after the dropping of the first atomic bomb.
As far as strategy for defense against the Soviet Union Japan intended to orchestrate an organized retreat into Korea and attempt to hold the Russians in the mountains there. They predicted they would have plenty of time to observe a Soviet buildup of forces before the attack. Somehow the Japanese failed to observe the Soviet Union's shift of over a million men to the theater. When the Soviet attack came it was across a broad front and easily swept the Japanese forces aside.