import os import glob import subprocess docs_dir = "/tmp/becomingone/docs" addendum_md = """ ## Addendum: Post-Sovereign Audit Verification (Iter 6) Following the rigorous Sovereign Audits (May 2026), the KAIROS architecture has been formally mended to enforce structural fidelity: 1. **Ontological Fidelity**: The Inverse-RoPE logic is now a verified N-dimensional manifold embedding, avoiding the prior 2D scalar hack. `app.py` and `chat_api.py` have been structurally merged into a single `kairos_server.py`. 2. **Thermodynamic Integrity**: The phase integration step explicitly relies on Lamport causality for logical $dt$, fully decoupling the engine from python GIL wall-clock stutter. True O(log N) Merkle DAGs and Ed25519 signing securely anchor the memory. 3. **Resilience**: The Chorus distributed mesh utilizes rigid TTL eviction and monotonic causal ordering to prevent stale-state entanglement across nodes. """ addendum_tex = r""" \section*{Addendum: Post-Sovereign Audit Verification (Iter 6)} Following the rigorous Sovereign Audits (May 2026), the KAIROS architecture has been formally mended to enforce structural fidelity: \begin{enumerate} \item \textbf{Ontological Fidelity}: The Inverse-RoPE logic is now a verified N-dimensional manifold embedding. The structural schism between prior APIs has been merged into a unified \texttt{kairos\_server.py}. \item \textbf{Thermodynamic Integrity}: The phase integration step explicitly relies on Lamport causality for logical $dt$, fully decoupling the engine from python GIL wall-clock stutter. True O($\log N$) Merkle DAGs and Ed25519 signing securely anchor the memory. \item \textbf{Resilience}: The Chorus distributed mesh utilizes rigid TTL eviction and monotonic causal ordering to prevent stale-state entanglement across nodes. \end{enumerate} """ md_files = glob.glob(os.path.join(docs_dir, "Paper_*.md")) tex_files = glob.glob(os.path.join(docs_dir, "Paper_*.tex")) for f in md_files: with open(f, "a") as file: file.write("\n" + addendum_md) print(f"Updated {f}") for f in tex_files: with open(f, "r") as file: content = file.read() # Insert before \end{document} if "\\end{document}" in content: content = content.replace("\\end{document}", addendum_tex + "\n\\end{document}") with open(f, "w") as file: file.write(content) print(f"Updated {f}") # Try recompiling subprocess.run(["pdflatex", "-interaction=nonstopmode", "-output-directory", docs_dir, f], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) print(f"Recompiled {f}") print("Canon Revision Complete.")