the imperial household agency can trace its origins back to the institutions established by the taihō code (or more formally ) promulgated in 701–702 ad. the "ritsuryō" system established the namesake which is a precursor to the present agency. the old code also gave rise to the which has its legacy in the under the current agency, and the which oversaw the that would now correspond to the agency's . the basic structures remained in place until the meiji restoration (1868).