Skip to content

Implement Phase 5 tensor graph and ensemble representations - #11

Merged
EmergentMonk merged 19 commits into
mainfrom
agent/pr11-phase5-representations
Aug 23, 2026
Merged

Implement Phase 5 tensor graph and ensemble representations#11
EmergentMonk merged 19 commits into
mainfrom
agent/pr11-phase5-representations

Conversation

@EmergentMonk

@EmergentMonk EmergentMonk commented Aug 23, 2026

Copy link
Copy Markdown
Member

Summary

Implements Phase 5 as the representation/computational layer above the merged Phase 4 evidence boundary.

Perfect Mathematics Does Not Equal Perfect Biological Reality.

A representation earns scientific interpretation only from explicit evidence and validation.

This PR does not create a V1 biological model, biological validation, molecular-dynamics realism, clinical validity, patient-specific meaning, or a performance claim.

Numerical arrays and true tensors

Adds explicit row-major numerical projections for Cartesian positions and pair-distance-squared values. These remain tensor_claimed=false.

Adds a separately typed centered Cartesian coordinate tensor only because its transformation semantics are declared: component-axis basis permutations, orthogonal Cartesian vector transformations, and translation removal by centroid subtraction.

Typed graphs and hypergraphs

Adds separately named model, model-hypergraph, provenance, tensor-factor, and visualization graph contracts while retaining the existing Phase 3C execution graph as its own namespace.

N-ary model constraints remain hyperedges and are not silently expanded into pairwise biological relationships.

Observables

Adds all 120 unique pair-distance observables for the 16-node V0 fixture, an explicit assumed computational-contact cutoff, and nearest-neighbour geometric accessibility under an explicit assumed clearance threshold.

Every contact/accessibility output remains a computational observable with biological/biochemical claims fixed false.

Ensemble statistics

Uses an explicit deterministic Phase 3B index set [0, 11704, 23408]. Phase 5 first requires the existing fixed Phase 3B residual verification gate, then runs each listed conformation as a one-state slice and computes count/min/max/mean/median/population variance/population standard deviation for pair-distance extrema.

The statistics describe only that explicit synthetic index set. No sampling-population or biological-ensemble inference is made.

Computational uncertainty

Adds explicit Phase 5 uncertainty types:

unknown
interval
distribution
ensemble

Distribution records are metadata-only in this phase and do not silently sample. Computational uncertainty cannot promote evidence strength.

Tensor-network assessment

Adds a fail-closed graph-structured tensor-network assessment. Admission requires both exact reconstruction and material reduction.

The current exact candidate X = X * I3 is deliberately not admitted because it stores more elements than the dense centered tensor. This is a negative result by design, preventing tensor-network sophistication from becoming cargo-cult optimization.

Optional vortex-inspired projection

The reference config keeps vortex-inspired projection disabled. When explicitly enabled it emits only a representational radial-squared / Cartesian phase embedding and fixes biological ontology/scientific interpretation claims false.

Gate and CI

Adds IGM-PHASE5-REPRESENTATION-GATE-V1, deterministic bundle SHA-256 identity, dedicated Phase 5 schemas/validator, igm-represent, and a Phase 5 workflow covering structural validation, Rust tests, deterministic output identity, graph separation, tensor-network rejection, and scientific non-promotion.

Summary by Sourcery

Establish the Phase 5 computational representation layer above the Phase 4 evidence boundary with deterministic, schema-validated, and explicitly non-biological tensor, graph, observable, ensemble, and uncertainty outputs.

New Features:

  • Add a deterministic Phase 5 representation bundle covering numerical arrays, a semantically declared centered coordinate tensor, typed graph and hypergraph views, computational observables, ensemble statistics, uncertainty records, and optional vortex-inspired projections.
  • Add the igm-represent CLI for schema-admitted representation bundle generation.

Bug Fixes:

  • Prevent representations, graph relationships, computational contacts, accessibility results, uncertainty records, and tensor-network candidates from promoting biological, scientific, clinical, or performance claims.

Enhancements:

  • Preserve Phase 4 provenance boundaries and Phase 3B execution-profile identity throughout representation generation.
  • Add fail-closed tensor-network assessment requiring exact reconstruction and material reduction, rejecting the current non-reducing identity factorization.
  • Add deterministic canonical SHA-256 identities and validation for representation bundles, gates, schemas, graph separation, observables, and provenance consistency.

Build:

  • Register the Phase 5 representation library and igm-represent binary in Cargo.

CI:

  • Add a Phase 5 GitHub Actions workflow covering structural governance, Rust tests, deterministic output, tamper rejection, graph namespace separation, tensor-network rejection, and non-promotion checks.

Documentation:

  • Document Phase 5 representation contracts, assumptions, computational boundaries, tensor semantics, ensemble statistics, uncertainty handling, and CLI usage.

Tests:

  • Add Phase 5 Rust and validator coverage for tensor semantics, graph separation, observables, ensemble gating, uncertainty kinds, optional projections, deterministic identity, and non-promoting admission.

Chores:

  • Add Phase 5 configuration and representation-bundle JSON Schemas plus the reference V0 representation profile.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Sorry @EmergentMonk, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@sourcery-ai

sourcery-ai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

Implements the Phase 5 representation layer on top of the existing Phase 4 boundary, adding Rust runtime support, a new CLI, typed tensor/graph/ensemble structures, deterministic bundle identity, governance gates, and CI validation for the new contracts without promoting biological/clinical claims.

Sequence diagram for deterministic Phase 5 bundle generation

sequenceDiagram
    participant CLI as igm-represent
    participant Engine as Phase5Engine
    participant Model as Phase4 validated profile
    participant P3B as Phase3B engine
    participant Gate as Phase5 representation gate
    participant Bundle as JSON bundle

    CLI->>Engine: load(model_path, config_path, repository_root)
    Engine->>Model: load_profile(model_path)
    Engine->>P3B: PentaCrtEngine::load(model_path, execution_profile_path)
    CLI->>Engine: bundle()
    Engine->>P3B: verify_penta_crt(penta, verification_samples)
    P3B-->>Engine: accepted residual verification
    Engine->>P3B: run_penta_crt(index, one-state slice)
    P3B-->>Engine: pair-distance extrema
    Engine->>Gate: make_gate(config, centered_tensor, assessment, vortex)
    Gate-->>Engine: accepted non-promoting gate receipt
    Engine->>Bundle: compute bundle_sha256
    Bundle-->>CLI: deterministic representation bundle
Loading

File-Level Changes

Change Details Files
Add Phase 5 representation engine and data model in Rust, including tensors, graphs, observables, ensemble statistics, uncertainty, tensor-network assessment, and deterministic bundle identity.
  • Introduce phase5.rs with Phase5Engine that loads model/profile/config, builds geometry, and emits a RepresentationBundle JSON structure
  • Define explicit numerical array projections for positions and pair-distance-squared with tensor_claimed=false
  • Add a declared centered Cartesian tensor with explicit transformation semantics and tensor_claimed=true
  • Add typed model graph, model hypergraph, provenance graph, tensor-factor graph, visualization graph, and graph separation receipt to keep namespaces distinct and non-promoting
  • Compute pair-distance and accessibility observables under explicit assumed thresholds with biological/biochemical claims fixed false
  • Compute ensemble statistics over a deterministic Phase 3B index set after residual-gate verification, using population variance only for that explicit set
  • Define computational uncertainty kinds (unknown, interval, distribution, ensemble) and ensure they cannot promote evidence strength
  • Implement tensor-network assessment that requires exactness and material reduction, deliberately rejecting the identity factorization
  • Make vortex-inspired projection optional, representational-only, and non-ontological
  • Compute fail-closed gate receipt (Phase5GateReceipt) and bundle SHA-256 identity via canonical JSON, enforcing non-promotion of scientific/biological/clinical claims
runtime/rust/src/phase5.rs
runtime/rust/src/lib_v6.rs
Add igm-represent CLI to emit Phase 5 bundles from model and config.
  • Introduce representation_main.rs binary that wires Phase5Engine::load + bundle() to a bundle MODEL.json CONFIG.json command
  • Provide usage/help text that clarifies the bundle is representational/computational evidence only
  • Ensure failures are reported via RuntimeError and non-zero exit codes
runtime/rust/src/representation_main.rs
Cargo.toml
Define Phase 5 JSON schemas, reference config/profile, and documentation describing contracts, semantics, and non-promotion rules.
  • Add PHASE5_REPRESENTATIONS.md documenting all Phase 5 contracts, tensor/graph/ensemble semantics, uncertainty vocabulary, tensor-network admission criteria, and the representation gate
  • Introduce phase5-representation-config.schema.json that pins config identity, V0 validation level, and non-promotion of scientific/biological/clinical/performance claims
  • Introduce phase5-representation-bundle.schema.json that pins the representation contract, gate text, and requires scientific/biological/clinical/performance claims to be false
  • Add runtime/profiles/igm-phase5-v0.json as the reference Phase 5 representation configuration with explicit thresholds, ensemble indices, tensor-network assessment settings, and claim flags fixed false
docs/PHASE5_REPRESENTATIONS.md
schemas/phase5-representation-config.schema.json
schemas/phase5-representation-bundle.schema.json
runtime/profiles/igm-phase5-v0.json
Add fail-closed Python validation tooling and CI workflow for Phase 5 representations.
  • Introduce tools/validate_phase5.py to validate repository-level Phase 5 contracts and optional bundles, enforcing invariants like non-promotion, graph separation, hypergraph non-expansion, ensemble assumptions, tensor-network rejection, and deterministic SHA-256 identity
  • Wire validate_phase5.py, JSON-schema validation, Phase 4/profile/docs checks, Rust tests, release build, deterministic bundle emission, tensor-network rejection check, and graph-separation/non-claims checks into a new GitHub Actions workflow
  • Ensure the workflow runs on pushes and PRs that touch Phase 5-relevant files and verifies that Phase 5 bundles satisfy the representation gate
tools/validate_phase5.py
.github/workflows/phase5-representations.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Member Author

Phase 5 implementation is now green on the exact current head 087153a4ad8170b733bd3a6abc81bcb8fc344e4f.

Implemented contracts include explicit non-tensor arrays, a transformation-declared centered coordinate tensor, typed model/hypergraph/provenance/tensor-factor/visualization namespaces, 120 pair-distance/contact observables, geometric accessibility, Phase-3B-gated explicit-index ensemble statistics, computational uncertainty (unknown|interval|distribution|ensemble), optional non-ontological vortex-inspired projection, fail-closed tensor-network assessment, deterministic bundle identity, and IGM-PHASE5-REPRESENTATION-GATE-V1.

The governance policy also now carries normative INV-REP-001: A representation earns scientific interpretation only from explicit evidence and validation.

Current exact-head workflows are all green: documentation foundation, visual laboratory, Rust runtime, Phase 4 evidence adapters, and the dedicated Phase 5 representation suite. No unresolved review threads are present at this point.

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

Copy link
Copy Markdown

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: 171195d1bb

ℹ️ 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 thread tools/validate_phase5.py
Comment thread runtime/rust/src/phase5.rs
Comment thread .github/workflows/phase5-representations.yml
Comment thread runtime/rust/src/phase5.rs
Comment thread schemas/phase5-representation-bundle.schema.json Outdated
Comment thread tools/validate_phase5.py Outdated
Comment thread tools/validate_phase5.py

Copy link
Copy Markdown
Member Author

Addressed all 7 Codex review findings on the current Phase 5 head 7d63b073586b8ce4b1406bd20f60b6c4e8b764bb.

Fixes include:

  • recompute and verify the domain-separated canonical bundle_sha256 and gate identity rather than only checking digest shape;
  • retain the exact Phase 3B execution-profile ID and canonical SHA-256 in ensemble output and bind them into the final bundle identity;
  • run the mandatory Phase 4 source validators and executable evidence CLI checks inside the Phase 5 workflow;
  • route the public Phase 5 API through phase5_v2.rs, which applies the declared model/config JSON-Schema gates before projection;
  • replace permissive nested bundle objects with fail-closed JSON-Schema definitions, required fields/constants/shapes, and additionalProperties=false;
  • independently recompute pair coverage, distances, contact predicates, nearest-neighbour accessibility, ensemble/statistical consistency, uncertainty constraints, and tensor-network accounting;
  • validate actual model/provenance/tensor-factor/visualization graph contracts, namespaces, endpoints, hyperedge participants, and non-promotion semantics rather than trusting only the separation receipt.

The tamper suite now also checks stale bundle identities, a recomputed-digest graph semantic promotion, and a recomputed-digest inconsistent observable. The first version of that regression targeted the visualization graph, which legitimately has zero edges under the current V0 cutoff, so it was corrected to tamper a populated model-graph edge instead.

All five workflows are green on this exact head: Phase 5 representation checks, Rust runtime checks, Phase 4 evidence adapter checks, documentation foundation, and visual laboratory checks. All 7 Codex review threads are resolved.

@EmergentMonk
EmergentMonk merged commit 9b2df31 into main Aug 23, 2026
7 checks passed
@EmergentMonk
EmergentMonk deleted the agent/pr11-phase5-representations branch August 23, 2026 07:33
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.

1 participant