🛡️ Three Laws & Secure Execution Layer
The Master Orchestration Protocol (MOP) operates under the absolute authority of three fundamental laws, ensuring system stability, environment safety, and flawless error containment.
1. The Three Fundamental Laws
⚖️ Law 1: Pre-flight Validation
No script, terminal command, or file manipulation shall be executed without rigorous pre-flight validation.
- The system performs automated syntax checks (e.g.,
python -m py_compile). - Scans all statements for destructive patterns (e.g., rogue
rm -rfor unvettedgit clean). - Confirms that all necessary API tokens and credentials are safe and secure.
⚖️ Law 2: Post-flight Validation
Every output, generated file, or environment modification must pass strict verification before being declared successful.
- Verifies file checksums, existence, and format integrity.
- Triggers targeted test suites automatically on newly written modules.
- Compares outputs against the analytical expectations set during the debate phase.
⚖️ Law 3: Emergency Recovery (Automated Rollback)
Upon any validation failure, runtime error, or integrity breach, the system must immediately halt execution and rollback to the last verified stable state.
- Automatically issues git resets (
git checkout -- .orgit stash pop) if file state is corrupted. - Restores working sessions from local memory databases.
- Commits a high-priority incident report to the permanent audit trail.
2. Secure Execution Layer
The execution module (execution/) implements the principle of least privilege and runtime isolation:
- CLI Sandbox: Terminal commands are run inside timed subprocess wrappers with strict resource ceilings.
- Python Sandbox: Executes generated Python code while monitoring state alterations and system calls.
- Environment Integrity Guard: Monitors residual temp files, orphan processes, or dependency changes, purging them automatically upon job completion.