Very little is known about Liu Ji's family background, other than his family was from Jiangling . It is not known when he was born. Late in Sui Dynasty, when a descendant of the imperial house of Liang Dynasty, Xiao Xi, rose in 617 against the rule of near Jiangling, claiming to be rebuilding Liang Dynasty, Liu became his subject and served under him as the deputy head of the legislative bureau of government. In or before 621, Xiao sent Liu to the modern Guangdong region to persuade cities to submit to Liang rule, and 50 some cities did so. However, before Liu could return to Jiangling, Jiangling came under the attack of the Tang Dynasty general Li Xiaogong, and Xiao was forced to surrender. Liu thus submitted to Tang rule with those 50 odd cities. Emperor Gaozu of Tang made him the secretary general at Nankang Prefecture .
Service under Emperor Taizong
Liu Ji's activities for the next decade were not clear. In 633, it was said that he was promoted to be a mid-level official at the examination bureau of the government and created the Baron of Qingwan. In 641, he was made the deputy imperial censor, when he submitted a petition outlining what he saw as faults by the exeutive bureau in avoiding nepotism. It was said that soon after he submitted the petition, he was made a deputy head of the executive bureau. In 639, he was made the deputy head of the examination bureau, and he was given the additional bestowment of ''Canzhi Zhengshi'' , making him, while not titularly a , a ''de facto'' one.
It was said that Liu was blunt in his actions and words. During an imperial feast, when Emperor Taizong, playing with his officials, wrote some and held it out to give to an official, Liu bypassed everyone by climbing up onto the imperial seat and grabbing it from Emperor Taizong. When he was then accused of being disrespectful to the emperor, Emperor Taizong laughed it off and gave him the calligraphy.
In 642, when Emperor Taizong wanted to review the imperial historical records that the imperial historian Chu Suiliang was responsible for keeping, Chu rebuffed Emperor Taizong, stating that it would be irregular for an emperor to look at how an imperial historian was writing about him. Emperor Taizong then made the comment, "Do you record the bad things I do as well?" Chu responded, "It is my responsibility, and I would not dare not to record them." Liu then stated, "Even if Chu Suiliang does not record them, everyone will." Emperor Taizong agreed with both of them.
In 643, when Emperor Taizong's son crown prince Li Chengqian was discovered to plot to overthrow Emperor Taizong, Emperor Taizong deposed him. Initially, Emperor Taizong considered making his favorite son Li Tai the Prince of Wei crown prince instead -- a suggestion that Liu and Cen Wenben concurred in -- but later, after deciding that Li Tai's scheming was responsible for Li Chengqian's downfall by making Li Chengqian insecure about his position, Emperor Taizong created another son, the Prince of Jin crown prince instead. After Li Zhi became crown prince, Liu pointed out that the crown prince should be often near righteous individuals so that he could learn how to act from them. In response, Emperor Taizong made Liu, along with Cen and Chu, often visit Li Zhi to have conversations with him.
Emperor Taizong was said to favor rhetoric, and whenever officials made suggestions in his presence, he would often interrogate them at length as to the soundness of their suggestions. In 644, Liu Ji submitted a petition stating that doing so was intimidating to the imperial officials, not all of whom were strong with speech and would often be unable to respond. Emperor Taizong agreed, and from that point on he tried to be even milder in his expressions and words to try to comfort imperial officials stating their suggestions.
Later in 644, when Emperor Taizong, at an imperial gathering, stated to his key officials their strengths and weaknesses, he spoke, with regard to Liu:
:''Liu Ji is firm and faithful, and he benefits the administration in what he does. However, he overly emphasizes his promises and thus overly favors his relatives and friends.''
Soon thereafter, he made Liu ''Shizhong'' , the head of the examination bureau -- a post that was one for a chanellor.
In 645, Emperor Taizong launched a campaign against Goguryeo. While on the way to the frontline, he put Li Zhi in charge at Ding Prefecture , responsible for the logistics behind the lines. Liu Ji, along with Gao Shilian, Ma Zhou, Zhang Xingcheng, and Gao Jifu, were left to assist the crown prince. Liu was in charge of exercising ''de facto'' authority over the ministeries of civil service affairs, ceremonies, and census. Before Emperor Taizong departed Ding Prefecture, he stated to Liu, "I am going on an expeditio, leaving you to assist the Crown Prince. The safety of the state rests on you. I trust that you know what I want." Liu responded, "Your Imperial Majesty need not worry. If there were high level officials who committed crimes, I will immediately execute them." Emperor Taizong, shocked by his resopnse, stated, "You are carless and overly strong in your personality. You may bring disaster on yourself if you keep this up. Be careful."
Later that year, after the end of the Goguryeo campaign, Emperor Taizong returned to Ding Prefecture and was ill at that time. After Liu and Ma visited Emperor Taizong at his secondary palace and exited it, Chu Suiliang asked them what the emperor's condition was, and Liu, weeping, stated, "The emperor is extremely ill, and it makes me worried!" Chu then falsely reported to Emperor Taizong that Liu said, "There is nothing to worry about as far as the matters of state were concerned. We only need to assist the young emperor. By the precedents of Yi Yin and Huo Guang, we execute the high level officials who were double-minded, and the state will be secure." Because of Liu's earlier comments, Emperor Taizong believed the accusation. Liu asked Ma to corroborate his innocence, and Ma did so, but Chu insisted that Liu did make the inappropriate comments. Emperor Taizong, believing Chu, ordered that Liu commit suicide, but pardoned his family. Before Liu committed suicide, around the new year 646, he requested a pen so that he could write a final statement for Emperor Taizong, but the officials having him under arrest did not dare to give him a pen, and so he died without a final statement. When Emperor Taizong found out about this, he punished those officials.
In 656, Emperor Taizong's death and succession by Li Zhi and after Chu himself fell from grace due to the machinations of Emperor Gaozong's wife and her associates, Liu Ji's son Liu Hongye submitted a petition, alleging that his father was forced to commit suicide due to Chu's false accusations. The chancellor Li Yifu, a close associate of Empress Wu and a former subordinate of Liu Ji's whom Liu Ji favored, helped him with his case, and most officials, wanting to please Li Yifu, all stated that Liu died without fault. However, Le Yanwei opposed revisiting the case, pointing out that Liu did still make inappropriate statements, and that revisiting the case would be an implicit rebuke of Emperor Taizong's actions. Emperor Gaozong agreed, and took no action on Liu Hongye's petition. It was not until 684, after Empress Wei had become empress dowager and was in total control, that Liu Ji's honors were posthumously restored.