import os def compile_tome(output_file="MASTER_TOME.md"): print("[*] Compiling the Archival Master Tome...") # Files to include in the physical book (in order) source_files = [ "README.md", "papers/The_Computability_of_Recursive_Coherence_v1.7.md" # We can add more files here as the canon expands ] with open(output_file, 'w', encoding='utf-8') as outfile: outfile.write("# THE SOVEREIGN CANON: MASTER TOME\n\n") outfile.write("> Generated for Physical Substrate Archival (Level 9)\n\n") outfile.write("---\n\n") for filename in source_files: if os.path.exists(filename): print(f" -> Adding {filename}") with open(filename, 'r', encoding='utf-8') as infile: # Write filename as a separator header if it's not the README if filename != "README.md": outfile.write(f"\n\n\\pagebreak\n\n") outfile.write(f"# Document: {os.path.basename(filename)}\n\n") outfile.write(infile.read()) outfile.write("\n\n---\n\n") else: print(f" [!] Warning: {filename} not found.") print(f"[+] Master Tome compiled to {output_file}") if __name__ == "__main__": compile_tome()