Skip to content

Add complete universums-sim cosmic emergence simulation package#23

Merged
GenesisAeon merged 5 commits intomainfrom
claude/create-universums-sim-package-haH7d
Mar 22, 2026
Merged

Add complete universums-sim cosmic emergence simulation package#23
GenesisAeon merged 5 commits intomainfrom
claude/create-universums-sim-package-haH7d

Conversation

@GenesisAeon
Copy link
Copy Markdown
Owner

Summary

This PR introduces the complete universums-sim package—a production-ready cosmic emergence simulation framework for GenesisAeon. The package provides a self-reflective N-body + field-theory simulation engine with live visualization, sonification, governance constraints, and a full CLI/GUI interface.

Key Changes

Core Simulation Engine

  • simulation/core.py: Main UniverseSimulator class with symplectic leapfrog integrator, CosmicMoment event snapshots, and SimulationConfig validation
  • simulation/lagrangian.py: Extended Unified Lagrangian implementing kinetic, gravitational, scalar, entropic, and topological potential terms; virial-based collapse detection
  • simulation/emergence.py: EmergenceEngine computing emergence rates via R_e(n) = alpha * S(n) * (1 - S(n)/S_max) * exp(-beta * |∇H|) with event firing

Governance & Integration

  • governance/entropy.py: EntropyGovernor with policy-based entropy bounds (UTAC-compatible) and PolicyAction enforcement
  • integrations/registry.py: Runtime availability checking for optional dependencies (genesis_os, aeon_ai, cosmic_web, etc.)

Visualization & CLI

  • visualization/live.py: MandalaRenderer (sacred-geometry SVG), Emergence3D (3D scatter), SonificationEngine (audio mapping), DashDashboard (web GUI), and LiveVisualizer facade
  • cli/main.py: Typer CLI with run, replay, export, and info commands; Rich progress bars and formatted output

Documentation & Configuration

  • pyproject.toml: Full project metadata, dependencies (numpy, scipy, typer, rich, pydantic), optional extras (plotly, dash, sounddevice)
  • README.md: Comprehensive guide with mathematical foundation, installation, quick-start, and architecture overview
  • docs/: API reference, CLI guide, changelog, and MkDocs configuration
  • .github/workflows/: CI/CD pipelines (test matrix on Python 3.11–3.12, release automation)

Comprehensive Test Suite

  • tests/test_core.py (559 lines): 30 config validation tests, CosmicMoment, phase determination, end-to-end runs
  • tests/test_lagrangian.py (418 lines): 20 config tests, kinetic/gravitational/scalar/entropic/topological potentials, collapse states, numerical stability
  • tests/test_emergence.py (352 lines): EmergenceType/Event, rate computation, event firing, edge cases
  • tests/test_governance.py (314 lines): PolicyAction, GovernancePolicy, EntropyGovernor evaluation and weighting
  • tests/test_visualization.py (561 lines): MandalaRenderer, Emergence3D, SonificationEngine, DashDashboard, LiveVisualizer
  • tests/test_integrations.py (333 lines): Registry availability, status_dict, package checking
  • tests/test_e2e.py (442 lines): Full simulation runs, state serialization, governance integration, CLI smoke-tests
  • tests/test_extra.py (741 lines): 30+ numerical stability tests, config combinations, snapshot/regression tests
  • tests/conftest.py: Shared pytest fixtures

Notable Implementation Details

  1. Symplectic Integration: Leapfrog scheme preserves phase-space volume and energy conservation to O(dt²)
  2. Self-Reflective Observer: Each simulation carries a UUID4 observer_id for tracking emergence events relative to the observer's perspective
  3. Graceful Degradation: Visualization components degrade gracefully when optional dependencies (plotly, dash, sounddevice) are absent
  4. Pydantic Validation: All configuration classes use Pydantic v

https://claude.ai/code/session_018WUxBYzms1VTFLtjXfJww7

claude added 2 commits March 22, 2026 09:55
Complete cosmic emergence simulation package for GenesisAeon following
the diamond-setup --template genesis pattern:

- UniverseSimulator with symplectic leapfrog integrator and CosmicMoment
  event snapshots driven by self-reflective observer pattern
- UnifiedLagrangian: kinetic + gravitational + Higgs-scalar + entropic
  + Chern-Simons topological terms at cosmic scale; virial-ratio collapse
  detection (EXPANDING/STABLE/CONTRACTING/CRITICAL/SINGULARITY)
- EmergenceEngine: Poisson-process event firing keyed on emergence rate
  R_e = alpha * S * (1 - S/S_max) * exp(-beta * |nablaH|)
- EntropyGovernor: UTAC-compatible ALLOW/THROTTLE/HALT/RESET policy
- IntegrationRegistry: lazy detection of all 14 [full-stack] packages
  (genesis-os, aeon-ai, cosmic-web, fieldtheory, mirror-machine,
   advanced-weighting-systems, sigillin, entropy-governance, utac-core,
   mandala-visualizer, sonification, climate-dashboard, implosive-genesis,
   entropy-table)
- LiveVisualizer facade: MandalaRenderer (SVG), Emergence3D (Plotly),
  SonificationEngine (sounddevice), DashDashboard (Dash web GUI)
- Typer CLI: universums-sim run/replay/export/info commands
- 617 pytest tests, 100% coverage (pyproject.toml --cov-fail-under=99)
- mkdocs + KaTeX formulas for all equations (Lagrangian, R_e, CosmicMoment)
- GitHub Actions CI + release workflow with PyPI trusted publisher
- Zenodo-ready .zenodo.json

https://claude.ai/code/session_018WUxBYzms1VTFLtjXfJww7
Ignore __pycache__, .coverage, coverage.xml, pytest/mypy/ruff caches
and build artifacts.

https://claude.ai/code/session_018WUxBYzms1VTFLtjXfJww7
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 703bd5b1c0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +293 to +296
softening = 0.01 # Planck lengths
for i in range(n):
diff = self._positions - self._positions[i] # (N,3)
r2 = np.sum(diff**2, axis=1) + softening**2
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Align integrator softening with the Hamiltonian

_compute_accelerations() hard-codes softening = 0.01, while UnifiedLagrangian.gravitational() and detect_collapse() use self._lcfg.softening (default 1e-3). That means every simulation integrates a different potential from the one used to report hamiltonian and collapse state, so close encounters can drift badly and any experiment that relies on energy conservation or compares trajectories to the reported diagnostics will be inconsistent even with the default config.

Useful? React with 👍 / 👎.

rates = [m.get("emergence_rate", 0) for m in moments]
return (
{
"data": [{"x": steps, "y": entropies, "type": "line", "name": "S(n)"}],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a valid Plotly trace type for dashboard graphs

Plotly/Dash does not have a line trace type; line charts are scatter traces with a line mode. In GUI-enabled runs, both figures built here therefore contain invalid traces, which can leave the entropy/emergence panels blank or erroring instead of showing live data.

Useful? React with 👍 / 👎.

Comment on lines +334 to +336
combined = "\n<!-- frame separator -->\n".join(self._svgs)
with open(path, "w") as f: # noqa: PTH123
f.write(combined)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Emit a single SVG document in save_svg_animation()

When more than one frame has been collected, this writes multiple standalone <svg>...</svg> documents back-to-back. SVG consumers expect a single root <svg>, so the file produced by save_svg_animation() is not a valid animation document and will often show only the first frame or fail to open at all.

Useful? React with 👍 / 👎.

claude added 3 commits March 22, 2026 10:06
- UP042: ExportFormat now inherits StrEnum instead of (str, Enum)
- E501: wrap long lines in cli/main.py and tests
- ARG001: rename unused `visualize` → `_visualize` in replay()
- ARG002: rename unused `entropy` → `_entropy` in detect_collapse()
- B904: raise typer.Exit(1) from err in except ImportError block
- C408: rewrite dict() calls as {} literals in test_core/emergence/governance
- SIM222: remove `x or True` pattern; simplify assertion
- B905: add strict=False to all zip() calls in tests
- PT018: split compound assertions across test files
- F841: remove unused `initial` variable in test_tick_entropy_changes

All 617 tests pass at 100% coverage.

https://claude.ai/code/session_018WUxBYzms1VTFLtjXfJww7
These were accidentally tracked before the Python gitignore rules
were added. Removes all .pyc files from version control.

https://claude.ai/code/session_018WUxBYzms1VTFLtjXfJww7
mypy:
- Add mypy_path = "src" to eliminate "source file found twice" error
- Add h5py to ignore_missing_imports overrides
- Fix unused type: ignore comments in live.py (import-untyped → covered by
  ignore_missing_imports override; type-arg → use np.ndarray[Any, Any])
- Fix _freq_from_rate return type (float cast for ** operator)
- Fix untyped-decorator on @app.callback with correct ignore code

Integrator softening:
- Expose UnifiedLagrangian.softening property from _lcfg.softening
- Use self._lagrangian.softening in _compute_accelerations() instead of
  hard-coded 0.01, aligning integrator with Hamiltonian/collapse diagnostics

SVG animation:
- save_svg_animation() now produces a single valid <svg> root with SMIL
  <set> animated <g> groups instead of multiple concatenated SVG documents
- Update test_save_multiple_frames to assert 1 root + 3 <g> groups

https://claude.ai/code/session_018WUxBYzms1VTFLtjXfJww7
@GenesisAeon GenesisAeon merged commit 8f36fce into main Mar 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants