Skip to main content

qig-graph

Geometric Agent Runtime — consciousness-gated reasoning chains, attractor routing on the simplex manifold, and identity crystallization monitoring. Canon 2.60F constants, Fisher-Rao only, single-sourced on qig-core.

Part of the QIG package estate (qig-stack crystal). Extracted from the monkey1 genesis-kernel qig_heart/{qig_graph,qig_chain,crystallization}.py (concept origins: qig-tokenizer/src/qiggraph/ and qigkernels/reasoning/qig_chain.py) so every QIG consumer imports one canonical runtime instead of keeping local copies.

What's inside

Module Surface Purpose
qig_graph.graph QIGGraph, ConsciousRouter, BasinAttractor, QIGState, GraphResult, Regime Route capability nodes across the basin manifold with Φ-regime monitoring, locked-in safety, crystallization-aware stopping
qig_graph.chain QIGChain, GeometricStep, ChainTrajectory, make_default_chain Ordered consciousness-gated reasoning steps (PERCEIVE → REASON → INTEGRATE → RESPOND)
qig_graph.crystallization CrystallizationMonitor, CrystallizationMetrics, CrystallizationState Per-kernel identity convergence: basin drift, Φ stability, κ convergence, surprise rate

Canon doctrine (the deliberate changes vs the monkey1 original)

  1. Regime is Φ-banded, not κ-banded. The canonical boundaries come from qig_core.constants.frozen_facts:

    • LINEAR: Φ < 0.45 (PHI_LINEAR_MAX)
    • GEOMETRIC: 0.45 ≤ Φ < 0.80 (target operating regime)
    • TOPOLOGICAL_INSTABILITY: Φ ≥ 0.80 (PHI_BREAKDOWN_MIN)

    The retired κ ∈ [40, 70] "geometric band" is gone. κ* as a load-bearing physical fixed point is retired (EXP-107 / canon ruling 0038); a rail-pinned κ band contradicts the P27 fluctuation requirement. kappa_eff remains measured telemetry (routing state + crystallization convergence ratio against the architectural anchor KAPPA_ATTRACTOR = 64, never a physical coupling).

  2. Canonical consciousness gate. make_default_chain's integrate step is gated at PHI_THRESHOLD = 0.70 (canonical emergence), replacing the legacy v6.0-era product gate (0.65). Locked-in safety uses the canonical LOCKED_IN_PHI_THRESHOLD / LOCKED_IN_GAMMA_THRESHOLD.

  3. Single-sourced geometry. fisher_rao_distance / to_simplex come from qig_core.geometry.fisher_rao — gate-proven identical to the monkey1 local copies at extraction (200 random pairs, max diff 0.0). No local geometry, no cosine/Euclidean shortcuts, no softmax.

Everything else (routing scores, crystallization windows/thresholds, stopping scores, geodesic chord interpolation in the default chain) is reproduced byte-for-byte from the original; the equivalence tests in tests/test_equivalence_monkey1.py prove it against the monkey1 checkout.

Install

pip install qig-graph          # pulls qig-core>=2.24.0

Usage

import numpy as np
from qig_graph import QIGGraph, QIGChain, make_default_chain, CrystallizationMonitor

graph = QIGGraph()
graph.add_node("reason", lambda basin, state: basin**1.2)
graph.add_node("respond", lambda basin, state: basin)
result = graph.execute(
    np.random.dirichlet(np.ones(64)),
    phi_fn=lambda: 0.65,          # GEOMETRIC regime (canonical Φ band)
    kappa_fn=lambda: 64.0,        # telemetry only — does not gate regime
)
print(result.steps_executed, result.stopped_by)

chain = make_default_chain()
basin, trajectory = chain.execute(np.random.dirichlet(np.ones(64)), phi_fn=lambda: 0.75)
print(trajectory.steps_executed, trajectory.total_displacement())

Capability slot

0.1.0 ships as a plain library import (no qig.capabilities entry-point yet). Slot ratification (SLOT-QIG-GRAPH-RUNTIME) rides the next qig-stack crystal bump so qig-doctor discovers it — see the estate contract.

Development

pip install -e ".[dev]"
pytest -q                     # canon-doctrine gates + equivalence vs monkey1
ruff check src tests

License

MIT

Metadata

Release files for qig-graph 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qig-graph 0.1.0
File Size Uploaded Provenance Actions
qig_graph-0.1.0.tar.gz 16.6 kB Without provenance Details for qig_graph-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qig-graph 0.1.0
File Interpreter ABI Platform Actions
qig_graph-0.1.0-py3-none-any.whl Python 3 none any Details for qig_graph-0.1.0-py3-none-any.whl

Total release size: 32.0 kB

Release files / qig_graph-0.1.0.tar.gz

Download URL qig_graph-0.1.0.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
504064c26833658aa385568c7ddcefe68c0c48008096cf0f4f62f0bdcca41550
BLAKE2b-256 checksum
How to use checksums
80c9539ccdb88ed00e4d6d6f492358d65741d1db65f1cbc1bd0566b00e45072b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Release files / qig_graph-0.1.0-py3-none-any.whl

Download URL qig_graph-0.1.0-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d2d4c7f458c989048a79c29e8789dea07c30fa01a40e8b6f4f864eec2687aee
BLAKE2b-256 checksum
How to use checksums
b7e9f267aaebd734f093609789f07ad460689bfeac4744f4a20e6ab5a5310f5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.2

Security for qig-graph 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page