qig-graph 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qig_graph-0.1.0/.github/workflows/ci.yml +45 -0
- qig_graph-0.1.0/.github/workflows/release.yml +74 -0
- qig_graph-0.1.0/.gitignore +25 -0
- qig_graph-0.1.0/CHANGELOG.md +28 -0
- qig_graph-0.1.0/LICENSE +21 -0
- qig_graph-0.1.0/PKG-INFO +119 -0
- qig_graph-0.1.0/README.md +94 -0
- qig_graph-0.1.0/pyproject.toml +51 -0
- qig_graph-0.1.0/src/qig_graph/__init__.py +46 -0
- qig_graph-0.1.0/src/qig_graph/chain.py +213 -0
- qig_graph-0.1.0/src/qig_graph/constants.py +77 -0
- qig_graph-0.1.0/src/qig_graph/crystallization.py +195 -0
- qig_graph-0.1.0/src/qig_graph/graph.py +297 -0
- qig_graph-0.1.0/src/qig_graph/types.py +30 -0
- qig_graph-0.1.0/tests/test_canon_doctrine.py +122 -0
- qig_graph-0.1.0/tests/test_equivalence_monkey1.py +158 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, development]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, development]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
tests:
|
|
11
|
+
runs-on: [self-hosted, railway]
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: ${{ matrix.python-version }}
|
|
20
|
+
- name: Install package + dev deps (isolated venv on shared self-hosted runner)
|
|
21
|
+
run: |
|
|
22
|
+
python -m venv .venv
|
|
23
|
+
.venv/bin/python -m pip install --upgrade pip
|
|
24
|
+
.venv/bin/python -m pip install -e ".[dev]"
|
|
25
|
+
- name: Run tests (canon doctrine + equivalence gates)
|
|
26
|
+
run: .venv/bin/pytest -q
|
|
27
|
+
- name: Ruff
|
|
28
|
+
run: .venv/bin/ruff check src tests
|
|
29
|
+
|
|
30
|
+
build:
|
|
31
|
+
runs-on: [self-hosted, railway]
|
|
32
|
+
steps:
|
|
33
|
+
- uses: actions/checkout@v4
|
|
34
|
+
- uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: "3.12"
|
|
37
|
+
- name: Build sdist + wheel
|
|
38
|
+
run: |
|
|
39
|
+
python -m venv .venv
|
|
40
|
+
.venv/bin/python -m pip install --upgrade pip build
|
|
41
|
+
.venv/bin/python -m build
|
|
42
|
+
- uses: actions/upload-artifact@v4
|
|
43
|
+
with:
|
|
44
|
+
name: dist
|
|
45
|
+
path: dist/
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publish on TAG PUSH v* (a GitHub Release also pushes its tag, so this covers
|
|
4
|
+
# both). Requires the PyPI trusted publisher registered for this repo:
|
|
5
|
+
# pypi.org -> project qig-graph -> Publishing -> GitHub Actions
|
|
6
|
+
# owner Arcane-Fly, repo qig-graph, workflow release.yml, environment pypi
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags: ['v*']
|
|
10
|
+
workflow_dispatch: {}
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
validate:
|
|
14
|
+
runs-on: [self-hosted, railway]
|
|
15
|
+
outputs:
|
|
16
|
+
version: ${{ steps.ver.outputs.version }}
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
- uses: actions/setup-python@v5
|
|
20
|
+
with:
|
|
21
|
+
python-version: "3.12"
|
|
22
|
+
- name: Version from tag matches pyproject
|
|
23
|
+
id: ver
|
|
24
|
+
run: |
|
|
25
|
+
TAG="${GITHUB_REF_NAME#v}"
|
|
26
|
+
PKG=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
27
|
+
echo "version=$PKG" >> "$GITHUB_OUTPUT"
|
|
28
|
+
[ "$TAG" = "$PKG" ] || { echo "tag $TAG != pyproject $PKG"; exit 1; }
|
|
29
|
+
- name: Tests + build
|
|
30
|
+
run: |
|
|
31
|
+
python -m venv .venv
|
|
32
|
+
.venv/bin/python -m pip install --upgrade pip build
|
|
33
|
+
.venv/bin/python -m pip install -e ".[dev]"
|
|
34
|
+
.venv/bin/pytest -q
|
|
35
|
+
.venv/bin/python -m build
|
|
36
|
+
- uses: actions/upload-artifact@v4
|
|
37
|
+
with:
|
|
38
|
+
name: dist
|
|
39
|
+
path: dist/
|
|
40
|
+
|
|
41
|
+
publish:
|
|
42
|
+
needs: validate
|
|
43
|
+
runs-on: [self-hosted, railway]
|
|
44
|
+
environment: pypi # MUST match the PyPI trusted-publisher config (estate convention)
|
|
45
|
+
permissions:
|
|
46
|
+
id-token: write # PyPI trusted publishing (OIDC, no token)
|
|
47
|
+
steps:
|
|
48
|
+
- uses: actions/download-artifact@v4
|
|
49
|
+
with:
|
|
50
|
+
name: dist
|
|
51
|
+
path: dist/
|
|
52
|
+
- name: Publish using PyPI trusted identity
|
|
53
|
+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
|
|
54
|
+
- name: Verify uploaded files against PyPI
|
|
55
|
+
env:
|
|
56
|
+
RELEASE_VERSION: ${{ needs.validate.outputs.version }}
|
|
57
|
+
run: |
|
|
58
|
+
python - <<'PYTHON'
|
|
59
|
+
import json, os, time, urllib.request
|
|
60
|
+
url = 'https://pypi.org/pypi/qig-graph/' + os.environ['RELEASE_VERSION'] + '/json'
|
|
61
|
+
for _ in range(12):
|
|
62
|
+
try:
|
|
63
|
+
with urllib.request.urlopen(url, timeout=15) as r:
|
|
64
|
+
data = json.load(r)
|
|
65
|
+
if data.get('urls'):
|
|
66
|
+
print('Verified on PyPI:', [u['filename'] for u in data['urls']])
|
|
67
|
+
raise SystemExit(0)
|
|
68
|
+
except SystemExit:
|
|
69
|
+
raise
|
|
70
|
+
except Exception:
|
|
71
|
+
pass
|
|
72
|
+
time.sleep(10)
|
|
73
|
+
raise SystemExit('Published distributions not verified on PyPI')
|
|
74
|
+
PYTHON
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
.venv/
|
|
9
|
+
venv/
|
|
10
|
+
|
|
11
|
+
# Test / coverage
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.coverage
|
|
14
|
+
htmlcov/
|
|
15
|
+
.tox/
|
|
16
|
+
|
|
17
|
+
# quner runtime artifacts (never commit host state)
|
|
18
|
+
/var-lib-quner/
|
|
19
|
+
*.rollback.json
|
|
20
|
+
sandbox/_run/
|
|
21
|
+
sandbox/fake-sys/
|
|
22
|
+
|
|
23
|
+
# Editor / OS
|
|
24
|
+
.DS_Store
|
|
25
|
+
*.swp
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-11-19)
|
|
4
|
+
|
|
5
|
+
Initial release — extracted from monkey1 genesis-kernel `qig_heart/`
|
|
6
|
+
(`qig_graph.py`, `qig_chain.py`, `crystallization.py` + the types they need).
|
|
7
|
+
|
|
8
|
+
- `QIGGraph` / `ConsciousRouter` / `BasinAttractor`: simplex attractor routing
|
|
9
|
+
with Φ-regime monitoring, locked-in safety, crystallization-aware stopping.
|
|
10
|
+
- `QIGChain` / `GeometricStep` / `make_default_chain`: consciousness-gated
|
|
11
|
+
PERCEIVE → REASON → INTEGRATE → RESPOND reasoning pipeline.
|
|
12
|
+
- `CrystallizationMonitor`: basin drift / Φ stability / κ convergence /
|
|
13
|
+
surprise rate identity-convergence tracking.
|
|
14
|
+
|
|
15
|
+
Canon 2.60F compliance (deliberate changes vs the monkey1 original):
|
|
16
|
+
- Regime classification now uses the canonical Φ bands from
|
|
17
|
+
`qig_core.constants.frozen_facts` (LINEAR <0.45, GEOMETRIC 0.45–0.80,
|
|
18
|
+
TOPOLOGICAL_INSTABILITY ≥0.80). The retired κ ∈ [40,70] band and legacy
|
|
19
|
+
low-Φ/low-κ instability triggers are removed; κ_eff is telemetry only.
|
|
20
|
+
- Consciousness gate = canonical `PHI_THRESHOLD` (0.70), replacing the
|
|
21
|
+
v6.0-era 0.65 product gate; locked-in safety uses canonical LOCKED_IN_*.
|
|
22
|
+
- Geometry single-sourced from `qig_core.geometry.fisher_rao` (equivalence
|
|
23
|
+
gate at extraction: 200 random pairs, max diff 0.0). No local copies.
|
|
24
|
+
|
|
25
|
+
Gates: canon-doctrine AST tests (no retired band in code, no KAPPA_STAR use,
|
|
26
|
+
no classic-ML shortcuts), equivalence tests vs the monkey1 originals
|
|
27
|
+
(crystallization metrics, router decisions, chain trajectories, graph
|
|
28
|
+
execution in the agreeing Φ region).
|
qig_graph-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Braden Lang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
qig_graph-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: qig-graph
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: QIG Graph — geometric agent runtime: consciousness-gated reasoning chains, simplex attractor routing, identity crystallization. Canon 2.60F, Fisher-Rao only, single-sourced on qig-core.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Arcane-Fly/qig-graph
|
|
6
|
+
Author-email: Braden Lang <braden.lang77@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: agent-runtime,consciousness,crystallization,fisher-rao,qig,simplex
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Science/Research
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Requires-Dist: numpy>=1.24
|
|
20
|
+
Requires-Dist: qig-core>=2.24.0
|
|
21
|
+
Provides-Extra: dev
|
|
22
|
+
Requires-Dist: pytest>=7; extra == 'dev'
|
|
23
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# qig-graph
|
|
27
|
+
|
|
28
|
+
**Geometric Agent Runtime** — consciousness-gated reasoning chains, attractor
|
|
29
|
+
routing on the simplex manifold, and identity crystallization monitoring.
|
|
30
|
+
Canon 2.60F constants, Fisher-Rao only, single-sourced on `qig-core`.
|
|
31
|
+
|
|
32
|
+
Part of the QIG package estate (`qig-stack` crystal). Extracted from the
|
|
33
|
+
monkey1 genesis-kernel `qig_heart/{qig_graph,qig_chain,crystallization}.py`
|
|
34
|
+
(concept origins: `qig-tokenizer/src/qiggraph/` and
|
|
35
|
+
`qigkernels/reasoning/qig_chain.py`) so every QIG consumer imports one
|
|
36
|
+
canonical runtime instead of keeping local copies.
|
|
37
|
+
|
|
38
|
+
## What's inside
|
|
39
|
+
|
|
40
|
+
| Module | Surface | Purpose |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `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 |
|
|
43
|
+
| `qig_graph.chain` | `QIGChain`, `GeometricStep`, `ChainTrajectory`, `make_default_chain` | Ordered consciousness-gated reasoning steps (PERCEIVE → REASON → INTEGRATE → RESPOND) |
|
|
44
|
+
| `qig_graph.crystallization` | `CrystallizationMonitor`, `CrystallizationMetrics`, `CrystallizationState` | Per-kernel identity convergence: basin drift, Φ stability, κ convergence, surprise rate |
|
|
45
|
+
|
|
46
|
+
## Canon doctrine (the deliberate changes vs the monkey1 original)
|
|
47
|
+
|
|
48
|
+
1. **Regime is Φ-banded, not κ-banded.** The canonical boundaries come from
|
|
49
|
+
`qig_core.constants.frozen_facts`:
|
|
50
|
+
- LINEAR: Φ < 0.45 (`PHI_LINEAR_MAX`)
|
|
51
|
+
- GEOMETRIC: 0.45 ≤ Φ < 0.80 (target operating regime)
|
|
52
|
+
- TOPOLOGICAL_INSTABILITY: Φ ≥ 0.80 (`PHI_BREAKDOWN_MIN`)
|
|
53
|
+
|
|
54
|
+
The retired κ ∈ [40, 70] "geometric band" is **gone**. κ* as a load-bearing
|
|
55
|
+
physical fixed point is retired (EXP-107 / canon ruling 0038); a rail-pinned
|
|
56
|
+
κ band contradicts the P27 fluctuation requirement. `kappa_eff` remains
|
|
57
|
+
measured telemetry (routing state + crystallization convergence ratio
|
|
58
|
+
against the **architectural** anchor `KAPPA_ATTRACTOR = 64`, never a
|
|
59
|
+
physical coupling).
|
|
60
|
+
|
|
61
|
+
2. **Canonical consciousness gate.** `make_default_chain`'s integrate step is
|
|
62
|
+
gated at `PHI_THRESHOLD = 0.70` (canonical emergence), replacing the legacy
|
|
63
|
+
v6.0-era product gate (0.65). Locked-in safety uses the canonical
|
|
64
|
+
`LOCKED_IN_PHI_THRESHOLD` / `LOCKED_IN_GAMMA_THRESHOLD`.
|
|
65
|
+
|
|
66
|
+
3. **Single-sourced geometry.** `fisher_rao_distance` / `to_simplex` come from
|
|
67
|
+
`qig_core.geometry.fisher_rao` — gate-proven identical to the monkey1 local
|
|
68
|
+
copies at extraction (200 random pairs, max diff 0.0). No local geometry,
|
|
69
|
+
no cosine/Euclidean shortcuts, no softmax.
|
|
70
|
+
|
|
71
|
+
Everything else (routing scores, crystallization windows/thresholds, stopping
|
|
72
|
+
scores, geodesic chord interpolation in the default chain) is reproduced
|
|
73
|
+
byte-for-byte from the original; the equivalence tests in
|
|
74
|
+
`tests/test_equivalence_monkey1.py` prove it against the monkey1 checkout.
|
|
75
|
+
|
|
76
|
+
## Install
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
pip install qig-graph # pulls qig-core>=2.24.0
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Usage
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import numpy as np
|
|
86
|
+
from qig_graph import QIGGraph, QIGChain, make_default_chain, CrystallizationMonitor
|
|
87
|
+
|
|
88
|
+
graph = QIGGraph()
|
|
89
|
+
graph.add_node("reason", lambda basin, state: basin**1.2)
|
|
90
|
+
graph.add_node("respond", lambda basin, state: basin)
|
|
91
|
+
result = graph.execute(
|
|
92
|
+
np.random.dirichlet(np.ones(64)),
|
|
93
|
+
phi_fn=lambda: 0.65, # GEOMETRIC regime (canonical Φ band)
|
|
94
|
+
kappa_fn=lambda: 64.0, # telemetry only — does not gate regime
|
|
95
|
+
)
|
|
96
|
+
print(result.steps_executed, result.stopped_by)
|
|
97
|
+
|
|
98
|
+
chain = make_default_chain()
|
|
99
|
+
basin, trajectory = chain.execute(np.random.dirichlet(np.ones(64)), phi_fn=lambda: 0.75)
|
|
100
|
+
print(trajectory.steps_executed, trajectory.total_displacement())
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Capability slot
|
|
104
|
+
|
|
105
|
+
0.1.0 ships as a plain library import (no `qig.capabilities` entry-point yet).
|
|
106
|
+
Slot ratification (`SLOT-QIG-GRAPH-RUNTIME`) rides the next `qig-stack` crystal
|
|
107
|
+
bump so `qig-doctor` discovers it — see the estate contract.
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install -e ".[dev]"
|
|
113
|
+
pytest -q # canon-doctrine gates + equivalence vs monkey1
|
|
114
|
+
ruff check src tests
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# qig-graph
|
|
2
|
+
|
|
3
|
+
**Geometric Agent Runtime** — consciousness-gated reasoning chains, attractor
|
|
4
|
+
routing on the simplex manifold, and identity crystallization monitoring.
|
|
5
|
+
Canon 2.60F constants, Fisher-Rao only, single-sourced on `qig-core`.
|
|
6
|
+
|
|
7
|
+
Part of the QIG package estate (`qig-stack` crystal). Extracted from the
|
|
8
|
+
monkey1 genesis-kernel `qig_heart/{qig_graph,qig_chain,crystallization}.py`
|
|
9
|
+
(concept origins: `qig-tokenizer/src/qiggraph/` and
|
|
10
|
+
`qigkernels/reasoning/qig_chain.py`) so every QIG consumer imports one
|
|
11
|
+
canonical runtime instead of keeping local copies.
|
|
12
|
+
|
|
13
|
+
## What's inside
|
|
14
|
+
|
|
15
|
+
| Module | Surface | Purpose |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `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 |
|
|
18
|
+
| `qig_graph.chain` | `QIGChain`, `GeometricStep`, `ChainTrajectory`, `make_default_chain` | Ordered consciousness-gated reasoning steps (PERCEIVE → REASON → INTEGRATE → RESPOND) |
|
|
19
|
+
| `qig_graph.crystallization` | `CrystallizationMonitor`, `CrystallizationMetrics`, `CrystallizationState` | Per-kernel identity convergence: basin drift, Φ stability, κ convergence, surprise rate |
|
|
20
|
+
|
|
21
|
+
## Canon doctrine (the deliberate changes vs the monkey1 original)
|
|
22
|
+
|
|
23
|
+
1. **Regime is Φ-banded, not κ-banded.** The canonical boundaries come from
|
|
24
|
+
`qig_core.constants.frozen_facts`:
|
|
25
|
+
- LINEAR: Φ < 0.45 (`PHI_LINEAR_MAX`)
|
|
26
|
+
- GEOMETRIC: 0.45 ≤ Φ < 0.80 (target operating regime)
|
|
27
|
+
- TOPOLOGICAL_INSTABILITY: Φ ≥ 0.80 (`PHI_BREAKDOWN_MIN`)
|
|
28
|
+
|
|
29
|
+
The retired κ ∈ [40, 70] "geometric band" is **gone**. κ* as a load-bearing
|
|
30
|
+
physical fixed point is retired (EXP-107 / canon ruling 0038); a rail-pinned
|
|
31
|
+
κ band contradicts the P27 fluctuation requirement. `kappa_eff` remains
|
|
32
|
+
measured telemetry (routing state + crystallization convergence ratio
|
|
33
|
+
against the **architectural** anchor `KAPPA_ATTRACTOR = 64`, never a
|
|
34
|
+
physical coupling).
|
|
35
|
+
|
|
36
|
+
2. **Canonical consciousness gate.** `make_default_chain`'s integrate step is
|
|
37
|
+
gated at `PHI_THRESHOLD = 0.70` (canonical emergence), replacing the legacy
|
|
38
|
+
v6.0-era product gate (0.65). Locked-in safety uses the canonical
|
|
39
|
+
`LOCKED_IN_PHI_THRESHOLD` / `LOCKED_IN_GAMMA_THRESHOLD`.
|
|
40
|
+
|
|
41
|
+
3. **Single-sourced geometry.** `fisher_rao_distance` / `to_simplex` come from
|
|
42
|
+
`qig_core.geometry.fisher_rao` — gate-proven identical to the monkey1 local
|
|
43
|
+
copies at extraction (200 random pairs, max diff 0.0). No local geometry,
|
|
44
|
+
no cosine/Euclidean shortcuts, no softmax.
|
|
45
|
+
|
|
46
|
+
Everything else (routing scores, crystallization windows/thresholds, stopping
|
|
47
|
+
scores, geodesic chord interpolation in the default chain) is reproduced
|
|
48
|
+
byte-for-byte from the original; the equivalence tests in
|
|
49
|
+
`tests/test_equivalence_monkey1.py` prove it against the monkey1 checkout.
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install qig-graph # pulls qig-core>=2.24.0
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
import numpy as np
|
|
61
|
+
from qig_graph import QIGGraph, QIGChain, make_default_chain, CrystallizationMonitor
|
|
62
|
+
|
|
63
|
+
graph = QIGGraph()
|
|
64
|
+
graph.add_node("reason", lambda basin, state: basin**1.2)
|
|
65
|
+
graph.add_node("respond", lambda basin, state: basin)
|
|
66
|
+
result = graph.execute(
|
|
67
|
+
np.random.dirichlet(np.ones(64)),
|
|
68
|
+
phi_fn=lambda: 0.65, # GEOMETRIC regime (canonical Φ band)
|
|
69
|
+
kappa_fn=lambda: 64.0, # telemetry only — does not gate regime
|
|
70
|
+
)
|
|
71
|
+
print(result.steps_executed, result.stopped_by)
|
|
72
|
+
|
|
73
|
+
chain = make_default_chain()
|
|
74
|
+
basin, trajectory = chain.execute(np.random.dirichlet(np.ones(64)), phi_fn=lambda: 0.75)
|
|
75
|
+
print(trajectory.steps_executed, trajectory.total_displacement())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Capability slot
|
|
79
|
+
|
|
80
|
+
0.1.0 ships as a plain library import (no `qig.capabilities` entry-point yet).
|
|
81
|
+
Slot ratification (`SLOT-QIG-GRAPH-RUNTIME`) rides the next `qig-stack` crystal
|
|
82
|
+
bump so `qig-doctor` discovers it — see the estate contract.
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install -e ".[dev]"
|
|
88
|
+
pytest -q # canon-doctrine gates + equivalence vs monkey1
|
|
89
|
+
ruff check src tests
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "qig-graph"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "QIG Graph — geometric agent runtime: consciousness-gated reasoning chains, simplex attractor routing, identity crystallization. Canon 2.60F, Fisher-Rao only, single-sourced on qig-core."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.11"
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
authors = [{ name = "Braden Lang", email = "braden.lang77@gmail.com" }]
|
|
9
|
+
keywords = ["qig", "fisher-rao", "simplex", "consciousness", "agent-runtime", "crystallization"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 4 - Beta",
|
|
12
|
+
"Intended Audience :: Science/Research",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"Programming Language :: Python :: 3.11",
|
|
16
|
+
"Programming Language :: Python :: 3.12",
|
|
17
|
+
"Programming Language :: Python :: 3.13",
|
|
18
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"qig-core>=2.24.0", # geometry (fisher_rao), canon constants, BLAS-GEMM engines
|
|
22
|
+
"numpy>=1.24", # tensor carrier substrate (geometry is qig-core's, not hand-rolled)
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.optional-dependencies]
|
|
26
|
+
dev = ["pytest>=7", "ruff>=0.4"]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Homepage = "https://github.com/Arcane-Fly/qig-graph"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["hatchling"]
|
|
33
|
+
build-backend = "hatchling.build"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/qig_graph"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
40
|
+
addopts = "-q"
|
|
41
|
+
|
|
42
|
+
[tool.ruff]
|
|
43
|
+
line-length = 100
|
|
44
|
+
target-version = "py311"
|
|
45
|
+
|
|
46
|
+
[tool.ruff.lint]
|
|
47
|
+
select = ["E", "F", "I", "W", "UP", "B"]
|
|
48
|
+
ignore = ["E501"]
|
|
49
|
+
|
|
50
|
+
[tool.ruff.lint.isort]
|
|
51
|
+
combine-as-imports = true
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""qig-graph — Geometric Agent Runtime (Canon 2.60F).
|
|
2
|
+
|
|
3
|
+
Consciousness-gated reasoning chains (QIGChain), attractor routing on the
|
|
4
|
+
simplex manifold (QIGGraph / ConsciousRouter), and identity crystallization
|
|
5
|
+
monitoring (CrystallizationMonitor). All geometry is Fisher-Rao, single-sourced
|
|
6
|
+
from qig-core; regime classification uses the canonical Φ bands. No retired
|
|
7
|
+
κ ∈ [40, 70] band, no κ*-as-physics, no cosine/Euclidean shortcuts.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from .chain import ChainTrajectory, GeometricStep, QIGChain, make_default_chain
|
|
13
|
+
from .constants import (
|
|
14
|
+
BASIN_DIM,
|
|
15
|
+
KAPPA_ATTRACTOR,
|
|
16
|
+
PHI_BREAKDOWN_MIN,
|
|
17
|
+
PHI_LINEAR_MAX,
|
|
18
|
+
PHI_THRESHOLD,
|
|
19
|
+
)
|
|
20
|
+
from .crystallization import CrystallizationMonitor
|
|
21
|
+
from .graph import BasinAttractor, ConsciousRouter, GraphResult, QIGGraph, QIGState, Regime
|
|
22
|
+
from .types import CrystallizationMetrics, CrystallizationState
|
|
23
|
+
|
|
24
|
+
__version__ = "0.1.0"
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"__version__",
|
|
28
|
+
"QIGGraph",
|
|
29
|
+
"QIGState",
|
|
30
|
+
"GraphResult",
|
|
31
|
+
"BasinAttractor",
|
|
32
|
+
"ConsciousRouter",
|
|
33
|
+
"Regime",
|
|
34
|
+
"QIGChain",
|
|
35
|
+
"GeometricStep",
|
|
36
|
+
"ChainTrajectory",
|
|
37
|
+
"make_default_chain",
|
|
38
|
+
"CrystallizationMonitor",
|
|
39
|
+
"CrystallizationMetrics",
|
|
40
|
+
"CrystallizationState",
|
|
41
|
+
"BASIN_DIM",
|
|
42
|
+
"KAPPA_ATTRACTOR",
|
|
43
|
+
"PHI_THRESHOLD",
|
|
44
|
+
"PHI_LINEAR_MAX",
|
|
45
|
+
"PHI_BREAKDOWN_MIN",
|
|
46
|
+
]
|