Interactive local decision model with editable votes, policy and budget, exact scenario downloads and recomputable evidence. No wallet, provider or enactment.
When should a bounded maintenance proposal pass or stop?
For operators reviewing a proposal before enactment: rehearse integer-weight voting, budget constraints and explicit owner controls, then inspect each gate.
01
Define the scenario
Inspect requested and available cents, eligible vote weight, thresholds, controls and supplied votes. These are hypothetical inputs.
Run the bounded Python evaluator. Quorum uses cast over eligible weight; approval includes abstentions in the all-cast denominator. No transaction or proposal enactment occurs.
Compare checks, rejection reasons and exact scenario-byte digest. The browser download has its own digest; reserialization changes bytes. Original design diagrams remain reference material beyond this bounded scenario.
{"revision":"4e51d6aee7b901e42115d44380a15caacb44e940","sources":[{"file":"demo/solving-alpha-agi-governance/scenario.json","content":"{\n \"schema\": \"agijobs.governance-rehearsal.v1\",\n \"title\": \"Approve a bounded maintenance budget\",\n \"proposal\": {\n \"id\": \"maintenance-001\",\n \"requestedCents\": 420000,\n \"availableCents\": 500000\n },\n \"policy\": {\n \"eligibleWeight\": 100,\n \"quorumPercent\": 60,\n \"approvalPercent\": 67,\n \"requiredControls\": [\"pause\", \"budget\", \"review\"]\n },\n \"controls\": [\"pause\", \"budget\", \"review\"],\n \"votes\": [\n { \"voter\": \"operations\", \"weight\": 40, \"choice\": \"approve\" },\n { \"voter\": \"maintenance\", \"weight\": 30, \"choice\": \"approve\" },\n { \"voter\": \"risk\", \"weight\": 20, \"choice\": \"reject\" }\n ]\n}\n","format":"json","sha256":"39a349259079feede691de01b55a56b4db0829dda19665c47429c88e5b3e09c9","bytes":616,"download":"/AGIJobsv0/examples/39a349259079feed-scenario.json","source":"https://github.com/MontrealAI/AGIJobsv0/blob/4e51d6aee7b901e42115d44380a15caacb44e940/demo/solving-alpha-agi-governance/scenario.json"},{"file":"demo/solving-alpha-agi-governance/run.py","content":"\"\"\"Offline proposal rehearsal; never enacts a vote or transfers a budget.\"\"\"\n\nfrom __future__ import annotations\n\nimport argparse\nimport hashlib\nimport importlib.util\nimport json\nimport re\nfrom pathlib import Path\nimport sys\n\nROOT = Path(__file__).resolve().parents[2]\nENGINE = ROOT / \"demo/agi-governance/run_demo.py\"\n\n\ndef integer(value: object, name: str, minimum: int, maximum: int) -> int:\n if type(value) is not int or not minimum <= value <= maximum:\n raise ValueError(f\"{name} must be an integer in [{minimum}, {maximum}]\")\n return value\n\n\ndef exact_keys(value: object, keys: set[str], name: str) -> None:\n if not isinstance(value, dict) or set(value) != keys:\n raise ValueError(f\"{name} must contain exactly: {', '.join(sorted(keys))}\")\n\n\ndef parse_scenario(raw: bytes) -> dict:\n def unique(pairs):\n result = {}\n for key, value in pairs:\n if key in result:\n raise ValueError(f\"Duplicate JSON key: {key}\")\n result[key] = value\n return result\n\n def reject_constant(value):\n raise ValueError(f\"Non-finite JSON number: {value}\")\n\n return json.loads(raw.decode(\"utf-8\"), object_pairs_hook=unique, parse_constant=reject_constant)\n\n\ndef evaluate(scenario: dict) -> dict:\n if (\n not isinstance(scenario, dict)\n or scenario.get(\"schema\") != \"agijobs.governance-rehearsal.v1\"\n ):\n raise ValueError(\"Unsupported governance scenario\")\n exact_keys(\n scenario,\n {\"schema\", \"title\", \"proposal\", \"policy\", \"controls\", \"votes\"},\n \"scenario\",\n )\n proposal, policy = scenario[\"proposal\"], scenario[\"policy\"]\n exact_keys(proposal, {\"id\", \"requestedCents\", \"availableCents\"}, \"proposal\")\n exact_keys(\n policy,\n {\"eligibleWeight\", \"quorumPercent\", \"approvalPercent\", \"requiredControls\"},\n \"policy\",\n )\n if not isinstance(proposal, dict) or not isinstance(policy, dict):\n raise ValueError(\"proposal and policy must be objects\")\n if not isinstance(proposal.get(\"id\"), str) or not re.fullmatch(\n r\"[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}\", proposal[\"id\"]\n ):\n raise ValueError(\"Proposal id must be a bounded identifier\")\n if (\n not isinstance(scenario.get(\"title\"), str)\n or not 1 <= len(scenario[\"title\"]) <= 200\n ):\n raise ValueError(\"title must contain 1 to 200 characters\")\n requested = integer(proposal[\"requestedCents\"], \"requestedCents\", 1, 10**12)\n available = integer(proposal[\"availableCents\"], \"availableCents\", 0, 10**12)\n eligible = integer(policy[\"eligibleWeight\"], \"eligibleWeight\", 1, 10**9)\n quorum = integer(policy[\"quorumPercent\"], \"quorumPercent\", 1, 100)\n threshold = integer(policy[\"approvalPercent\"], \"approvalPercent\", 1, 100)\n votes = scenario[\"votes\"]\n if not isinstance(votes, list) or len(votes) > 1000:\n raise ValueError(\"votes must be a bounded list\")\n seen, cast, approved = set(), 0, 0\n for vote in votes:\n exact_keys(vote, {\"voter\", \"weight\", \"choice\"}, \"vote\")\n if not isinstance(vote, dict):\n raise ValueError(\"Each vote must be an object\")\n voter = vote[\"voter\"]\n if (\n not isinstance(voter, str)\n or not voter.strip()\n or len(voter) > 100\n or voter in seen\n ):\n raise ValueError(\"Voters must have unique nonempty identifiers\")\n seen.add(voter)\n weight = integer(vote[\"weight\"], \"vote weight\", 1, eligible)\n if vote[\"choice\"] not in {\"approve\", \"reject\", \"abstain\"}:\n raise ValueError(\"Unknown vote choice\")\n cast += weight\n approved += weight if vote[\"choice\"] == \"approve\" else 0\n if cast > eligible:\n raise ValueError(\"Cast weight exceeds eligible weight\")\n controls, required = scenario[\"controls\"], policy[\"requiredControls\"]\n for items in [controls, required]:\n if (\n not isinstance(items, list)\n or not items\n or len(items) > 30\n or any(\n not isinstance(x, str)\n or not re.fullmatch(r\"[a-zA-Z0-9][a-zA-Z0-9_-]{0,79}\", x)\n for x in items\n )\n or len(set(items)) != len(items)\n ):\n raise ValueError(\"Control categories must be unique nonempty lists\")\n missing = sorted(set(required) - set(controls))\n checks = {\n \"quorum\": cast * 100 >= eligible * quorum,\n \"approval\": cast > 0 and approved * 100 >= cast * threshold,\n \"budget\": requested <= available,\n \"ownerControls\": not missing,\n }\n # Reuse the established governance engine for diagnostic owner-control coverage.\n # Its model metrics are illustrative and are not real-world energy measurements.\n spec = importlib.util.spec_from_file_location(\"agijobs_governance_engine\", ENGINE)\n engine = importlib.util.module_from_spec(spec)\n sys.modules[spec.name] = engine\n spec.loader.exec_module(engine)\n mission = engine.Mission.from_payload(\n {\n \"meta\": {\"title\": str(scenario.get(\"title\", \"Governance rehearsal\"))},\n \"ownerControls\": {\n \"requiredCategories\": required,\n \"criticalCapabilities\": [{\"category\": item} for item in controls],\n },\n \"gameTheory\": {\n \"strategies\": [\n {\"initialShare\": approved},\n {\"initialShare\": cast - approved},\n ]\n },\n }\n )\n metrics = engine.compute_governance_metrics(mission)\n return {\n \"schema\": \"agijobs.governance-rehearsal-result.v1\",\n \"mode\": \"offline-simulation\",\n \"proposalId\": proposal[\"id\"],\n \"accepted\": all(checks.values()),\n \"checks\": checks,\n \"reasons\": [name for name, passed in checks.items() if not passed],\n \"castWeight\": cast,\n \"approvedWeight\": approved,\n \"requestedCents\": requested,\n \"remainingCentsIfApproved\": (\n available - requested if all(checks.values()) else available\n ),\n \"missingControls\": metrics[\"missing_owner_categories\"],\n \"enacted\": False,\n \"settlementApproved\": False,\n }\n\n\ndef main() -> int:\n parser = argparse.ArgumentParser(description=__doc__)\n parser.add_argument(\n \"--scenario\", type=Path, default=Path(__file__).with_name(\"scenario.json\")\n )\n args = parser.parse_args()\n with args.scenario.open(\"rb\") as source:\n raw = source.read(1_000_001)\n if len(raw) > 1_000_000:\n raise ValueError(\"Scenario exceeds 1 MB\")\n result = evaluate(parse_scenario(raw))\n result[\"scenarioSha256\"] = hashlib.sha256(raw).hexdigest()\n print(json.dumps(result, indent=2))\n return 0 if result[\"accepted\"] else 1\n\n\nif __name__ == \"__main__\":\n try:\n raise SystemExit(main())\n except (ValueError, KeyError, TypeError, OSError) as error:\n print(f\"Invalid scenario: {error}\", file=sys.stderr)\n raise SystemExit(2)\n","format":"text","sha256":"f92763789c7d87ce4e7aab602c03170768c47bcf85b69631d275e15ac056ac71","bytes":7021,"download":"/AGIJobsv0/examples/f92763789c7d87ce-run.py","source":"https://github.com/MontrealAI/AGIJobsv0/blob/4e51d6aee7b901e42115d44380a15caacb44e940/demo/solving-alpha-agi-governance/run.py"},{"file":"demo/solving-alpha-agi-governance/README.md","content":"# AGI Jobs v0 (v2) — Demo → Solving Alpha AGI Governance\n\n> An inspectable, offline rehearsal of proposal approval and budget gates, with a bilingual browser workspace and a matching Python evaluator.\n\n## Try the bounded proposal rehearsal\n\nThis directory now contains an executable **offline simulation** of a maintenance-budget decision. It checks quorum, approval share, available budget and required owner controls. It reuses the existing governance engine's owner-control coverage calculation. It does not enact governance, authenticate voter identities, read a live electorate, transfer funds or certify a production deployment.\n\n```bash\npython demo/solving-alpha-agi-governance/run.py\npython -m unittest discover -s test/simulation -p test_governance_rehearsal.py -v\n```\n\nThe default scenario proposes 420,000 synthetic cents from a 500,000-cent budget. Seventy of ninety cast vote units approve; ninety of one hundred eligible units participate. All four checks pass and the hypothetical remaining budget is 80,000 cents. `enacted` and `settlementApproved` remain false. These are illustrative budget units, not a payment.\n\n### Change one thing and explain the outcome\n\nCopy [scenario.json](scenario.json), edit it and run `python demo/solving-alpha-agi-governance/run.py --scenario YOUR_COPY.json`:\n\n- Raise `quorumPercent` from 60 to 95: participation fails.\n- Raise `approvalPercent` from 67 to 80: approval fails.\n- Set `requestedCents` to 500001: available budget fails.\n- Remove `pause` from `controls`: required owner control fails.\n\nThe JSON result reports each check and the failing reasons. Abstentions count toward participation and the approval denominator: approval is measured against all cast vote weight, not only approve/reject votes. Arithmetic uses integer cross-products, so exact threshold decisions do not depend on floating-point rounding. A rejected proposal returns exit status 1 and leaves the hypothetical budget unchanged; malformed input returns 2. Duplicate JSON keys, non-finite numbers, unknown fields, duplicate voter identifiers, excess weight, boolean numeric values and unsafe identifiers are rejected. The CLI commits the exact scenario bytes with SHA-256.\n\nThis rehearsal treats the supplied votes and control names as scenario data. Real governance requires authenticated identities, authoritative voting power, separately enforced permissions and the target contract's own rules. The [related governance workflow](../agi-governance/README.md) and [complete demo guide](../README.md) remain available. Existing architecture diagrams below are preserved design context, not evidence that this small simulation operates the wider system.\n\n### Use the browser workspace\n\nServe `demo/solving-alpha-agi-governance/web/` with a local static server, then open its index page. For example, run `python -m http.server 8080 --bind 127.0.0.1 --directory demo/solving-alpha-agi-governance/web` and visit `http://127.0.0.1:8080/`. The complete Pages build publishes the same workspace at `experiments/governance/` when this change is deployed.\n\nSwitch between English and French, change one gate, and download the exact scenario or an evidence bundle. Reopening a bundle recomputes its result from the scenario rather than trusting its saved result. The browser labels the hash of its exported scenario `downloadedScenarioSha256`; the CLI separately hashes the exact bytes it reads. Neither hash proves voter identity or grants authority.\n\n## Preserved architectural design\n\nThe following overview and systems map describe the wider design, beyond the bounded implementation above.\n\n### Overview\n\n- **Path:** `demo/solving-alpha-agi-governance/README.md`\n- **Module Focus:** Anchors Demo → Solving Alpha AGI Governance inside the AGI Jobs v0 (v2) lattice so teams can orchestrate economic, governance, and operational missions with deterministic guardrails.\n- **Integration Role:** Interfaces with the unified owner control plane, telemetry mesh, and contract registry to deliver end-to-end resilience.\n\n## Capabilities\n\n- Provides opinionated configuration and assets tailored to `demo/solving-alpha-agi-governance` while remaining interoperable with the global AGI Jobs v0 (v2) runtime.\n- Ships with safety-first defaults so non-technical operators can activate the experience without compromising security or compliance.\n- Publishes ready-to-automate hooks for CI, observability, and ledger reconciliation.\n\n## Systems Map\n\n```mermaid\nflowchart LR\n Operators((Mission Owners)) --> demo_solving_alpha_agi_governance[[Demo → Solving Alpha AGI Governance]]\n demo_solving_alpha_agi_governance --> Core[[\"AGI Jobs v0 (v2) Core Intelligence\"]]\n Core --> Observability[[Unified CI / CD & Observability]]\n Core --> Governance[[Owner Control Plane]]\n```\n\n## Working With This Module\n\n1. From the repository root run `npm install` once to hydrate all workspaces.\n2. Inspect the scripts under `scripts/` or this module's `package.json` entry (where applicable) to discover targeted automation for `demo/solving-alpha-agi-governance`.\n3. Execute `npm test` and `npm run lint --if-present` before pushing to guarantee a fully green AGI Jobs v0 (v2) CI signal.\n4. Capture mission telemetry with `make operator:green` or the module-specific runbooks documented in [`OperatorRunbook.md`](../../OperatorRunbook.md).\n\n## Directory Guide\n\n`run.py` evaluates `scenario.json`; behavioral acceptance tests live in `test/simulation/test_governance_rehearsal.py`. The broader design guide and diagram remain below for context.\n\n## Quality & Governance\n\n- Every change must land through a pull request with all required checks green (unit, integration, linting, security scan).\n- Reference [`RUNBOOK.md`](../../RUNBOOK.md) and [`OperatorRunbook.md`](../../OperatorRunbook.md) for escalation patterns and owner approvals.\n- Keep secrets outside the tree; use the secure parameter stores wired to the AGI Jobs v0 (v2) guardian mesh.\n\n## Next Steps\n\n- Review this module's issue board for open automation, data, or research threads.\n- Link new deliverables back to the central manifest via `npm run release:manifest`.\n- Publish artefacts (dashboards, mermaid charts, datasets) into `reports/` for downstream intelligence alignment.\n","format":"text","sha256":"e427a730c6318b78f2f5c0da7e7f4e65a485aa1586c3fcb206627fb3a1305650","bytes":6261,"download":"/AGIJobsv0/examples/e427a730c6318b78-README.md","source":"https://github.com/MontrealAI/AGIJobsv0/blob/4e51d6aee7b901e42115d44380a15caacb44e940/demo/solving-alpha-agi-governance/README.md"}]}
FROM READING TO A REPRODUCIBLE RUN
Try the selected path.
Python, no demo package install
Run from the repository root with Python 3.12. This selected entry point uses the Python standard library. Keep output in a separate directory so that you can compare runs.
The default proposal passes four modeled gates with approved weight 70 of 90 cast, 420000 requested cents and 80000 remaining. Exit 0 means a passing rehearsal; 1 means policy rejection; 2 means invalid input. Enacted and settlementApproved remain false.
The source inspector above reads bundled repository material. Local commands run separately on your computer. Recorded examples may contain historical timestamps, placeholders and simulated metrics.
MAKE IT YOUR OWN
One useful experiment.
Raise quorum to 95%, lower available cents below 420000, or remove pause control; inspect the independently rejected gate and rerun the downloaded scenario locally.
THE SYSTEM, MADE VISIBLE
Architecture & relationships
Architecture diagram · source preserved belowView original Mermaid source
flowchart LR
Operators((Mission Owners)) --> demo_solving_alpha_agi_governance[[Demo → Solving Alpha AGI Governance]]
demo_solving_alpha_agi_governance --> Core[["AGI Jobs v0 (v2) Core Intelligence"]]
Core --> Observability[[Unified CI / CD & Observability]]
Core --> Governance[[Owner Control Plane]]
WHEN SOMETHING DOESN’T MATCH
Troubleshooting
Import or dependency error
Confirm the active virtual environment and the selected demo’s requirements. Run python -m pip check; do not install unrelated demo requirements over a working environment.
Unexpected result or missing file
Check the selected entry point, configuration and output argument. Keep the seed and implementation fixed before comparing outcomes.
TRACE THE CHECKS
Verification & next steps
This directory has no standalone test source files. Follow the shared implementation and its behavioral tests before making correctness claims.