feat(graph): integrate hyperstitionstud_io.* & urn:io:hyperstitionstud:* namespaces, dual file:// + http:// portability (--bundle-encyclopedia), and v1.2.0 common library

This commit is contained in:
Hermes Agent committed 2026-11-29 21:06:48 +00:00
1 parent cd1abd3c6c
commit b4ca2ceb1e
11 files changed
+302 -275

No files matched your search

+121 -130
View File
@@ -1,71 +1,118 @@
# Architecture & Migration Plan: Shared Common Library Across All `/workspace` Projects Under the `hyperstitionstud.io` Namespace (`v1.0.0`) # Architecture & Implementation Plan: Shared Common Library Under the `hyperstitionstud.io` Namespace (`v1.2.0` — 100% Offline `URN:` Namespace & Dual `file://` + `http://` Portability Edition)
- **Document ID:** `PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO` (`v1.0.0`) - **Document ID:** `PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO` (`v1.2.0`)
- **Canonical Domain & Authority:** `hyperstitionstud.io` - **Offline Namespace Authority (Zero `https://` Network Calls):**
- **Python PEP 420 Reverse-DNS Namespace:** `io.hyperstitionstud.*` (installed from `/workspace/hyperstitionstudio-core`) - **Python PEP 420 Namespace:** `hyperstitionstud_io.*`
- **JavaScript / ESM Scope Namespace:** `@hyperstitionstud.io/*` (`window.HyperstitionStudio.*` in offline browser bundles) - **JavaScript / Browser Global Namespace:** `@hyperstitionstud.io/*` & `window.HyperstitionStudio.*`
- **Schema, XML & URN Authority:** `https://hyperstitionstud.io/schemas/v1/*`, `https://hyperstitionstud.io/ns/*`, and `urn:io:hyperstitionstud:*` - **URN Schema, XML & Entity Authority (RFC 8141):** `urn:io:hyperstitionstud:schema:v1:*`, `urn:io:hyperstitionstud:ns:kg:1.0`, and `urn:io:hyperstitionstud:<domain>:<type>:<id>`
- **Glossary & Encyclopedia Isolation Invariant:** Verified (`0` changes to `taxonomy/glossary-registry.json` or `encyclopedia/encyclopedia-manifest.json`). - **Local Relative Schema Paths:** `./schemas/v1/<name>.schema.json`
- **Dual Deployment Target:**
1. **Scenario A (`file://` Direct Offline In-Browser Application):** Zero HTTP server, zero `fetch()` CORS errors, zero external CDN/font/schema requests.
2. **Scenario B (`http://` Static Web Server Hosting):** Works identically under `python3 -m http.server`, Nginx, Caddy, or LAN self-hosting whether served from the `/workspace` parent directory or as a standalone web root.
- **Artifact & Citation URL Resolution Rule:** **100% Local-Configuration Driven** (`[citations.path_mounts]` in local `workspace.toml`, falling back to verified local paths).
- **Version-Control Operations in Scope:** **0%** (All file integrity and isolation checks use pure Python `hashlib.sha256` and atomic `.tmp -> os.replace()` writes).
--- ---
## 1. Executive Summary & Architectural Problem Statement ## 1. Review of `https://hyperstitionstud.io` URLs: Why They Are Replaced by Offline `urn:io:hyperstitionstud:*` & Relative Paths in `v1.2.0`
Across the peer repositories in `/workspace` (`ingglish-hyperdope-gematria`, `technocapital-singularity-zoology`, `encyclopedia-knowledge-graph`, `hyperdope-ci-build`, `hyperdope-gematria`, `memes`, and `thomas-calculus-tutor`), several foundational subsystems are currently either **duplicated in-file** or **coupled via cross-repository hardcoded script paths**: In `v1.0.0–v1.1.0`, the domain `hyperstitionstud.io` was formatted as `https://hyperstitionstud.io/...` in two places: JSON Schema `$id`/`$schema` fields and GraphML/GEXF `xmlns:hs` declarations. Reviewing those against a **100% offline, portable in-browser and static-HTTP deployment requirement** exposes three concrete failure modes:
1. **Cross-Repo Subprocess Handoffs for PDF & Tier-List Rendering:** | Former `https://` Usage (`v1.1.0`) | Why It Hurts 100% Offline & Portable Deployment | `v1.2.0` Portable Replacement (Zero Network Calls) |
Both `technocapital-singularity-zoology` and `encyclopedia-knowledge-graph` invoke `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/build_wire_report_pdf.py` and `generate_aq_tier_list.py` via hardcoded sibling paths.
2. **Cross-Repo Node.js `ingglish` (`CMUdict`) Resolution:**
`technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py` spawns `node --input-type=module` with `--workdir /workspace/ingglish-hyperdope-gematria` to resolve `node_modules/ingglish`.
3. **Duplicated Base-36 `AQ` & Prime Arithmetic:**
`compute_aq()`, prime-sieve/rank lookup (`is_prime`, `prime_rank`), repdigit detection (`37 * k`), and `G1–G6` drift/variance-collapse equations are re-implemented separately in `classify_technocapital_singularity.py`, `build_encyclopedia_knowledge_graph.py`, `ci_provision_ingglish.py`, and `generate_aq_tier_list.py`.
4. **Ad-Hoc JSON Schema & Provenance Identifiers:**
The 8 JSON registries in `technocapital-singularity-zoology` and the exported graph files in `encyclopedia-knowledge-graph` lack a unified `$schema` URI and XML/URN namespace authority.
### Solution Overview
Extract all shared computation, phonetic translation, PDF/PNG/Canvas rendering, cryptographic isolation guards, and CI validation into a single, zero-duplication sibling repository:
- **Repository Path:** `/workspace/hyperstitionstudio-core`
- **Python Namespace Package (PEP 420):** `io.hyperstitionstud.*`
- **JS/Browser Namespace:** `@hyperstitionstud.io/*`
- **XML/JSON/URN Namespace:** `https://hyperstitionstud.io/...` & `urn:io:hyperstitionstud:...`
---
## 2. Canonical `hyperstitionstud.io` Namespace Hierarchy
| Layer / Ecosystem | Canonical Namespace Pattern | Concrete Examples |
| :--- | :--- | :--- | | :--- | :--- | :--- |
| **Python 3.10+ (PEP 420 Namespace Package)** | `io.hyperstitionstud.<module>` | `io.hyperstitionstud.ciphers`<br/>`io.hyperstitionstud.phonetics`<br/>`io.hyperstitionstud.publishing`<br/>`io.hyperstitionstud.glossary`<br/>`io.hyperstitionstud.graph`<br/>`io.hyperstitionstud.ci`<br/>`io.hyperstitionstud.audio` | | **`$schema: "https://hyperstitionstud.io/schemas/v1/*.schema.json"`** | IDEs (VS Code, JetBrains), browser JSON inspectors, and schema validators attempt to **HTTP-fetch `https://` `$schema` URLs**. Offline or on an air-gapped LAN, this triggers DNS timeouts or validation warnings. | **Dual Offline Identity:**<br/>• `"$id": "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph"` (RFC 8141 URN — never fetched over DNS)<br/>• `"$schema": "./schemas/v1/encyclopedia-graph.schema.json"` (relative local file path that resolves both on `file://` and on any `http://` server) |
| **Node.js / ESM Packages** | `@hyperstitionstud.io/<pkg>` | `@hyperstitionstud.io/phonetics-g2p`<br/>`"@hyperstitionstud.io/ciphers-aq"`<br/>`"@hyperstitionstud.io/graph-workbench"` | | **`xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0"`** | Conflates a nominal XML namespace with a live `https://` endpoint; some XML/GEXF tools probe `https://` namespace URIs for XSD files. | **`xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0"`**<br/>Explicitly location-independent URN namespace; Gephi, Cytoscape, yEd, and `xml.etree.ElementTree` parse it 100% offline. |
| **Offline Browser Global (`file://`)** | `window.HyperstitionStudio.<Module>` | `window.HyperstitionStudio.EncyclopediaGraphData`<br/>`window.HyperstitionStudio.GraphWorkbench`<br/>`window.HyperstitionStudio.Ciphers` | | **External Web Fonts / CDNs (`https://fonts.googleapis.com/...`)** | Stalls browser rendering on `file://` or offline LAN `http://` while waiting for external DNS/TLS handshakes to fail. | **Zero External `<link>` or `<script>` URLs:**<br/>All HTML workbenches and SVG diagrams use pure inline/local CSS and local font stacks (`'DejaVu Sans Mono', 'JetBrains Mono', ui-monospace, monospace`). |
| **JSON Schema `$schema` & `$id` URIs** | `https://hyperstitionstud.io/schemas/v1/<name>.schema.json` | `https://hyperstitionstud.io/schemas/v1/glossary-registry.schema.json`<br/>`https://hyperstitionstud.io/schemas/v1/encyclopedia-manifest.schema.json`<br/>`https://hyperstitionstud.io/schemas/v1/encyclopedia-graph.schema.json` |
| **GraphML / GEXF XML Namespace** | `xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0"` | `<graphml xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0">`<br/>`<data key="hs:g1_variance_collapsed">249.36</data>` | **Rule in `v1.2.0`:** Zero `https://hyperstitionstud.io` URLs appear anywhere in code, schemas, XML exports, HTML files, or citation ledgers. Every `hyperstitionstud.io` namespace identifier uses **reverse-DNS module/URN syntax (`hyperstitionstud_io.*` / `urn:io:hyperstitionstud:*`)** or **relative local paths (`./...`)**.
| **Entity & Node URN Identifiers** | `urn:io:hyperstitionstud:<domain>:<type>:<id>` | `urn:io:hyperstitionstud:zoology:build:S1`<br/>`urn:io:hyperstitionstud:aq:hub:125`<br/>`urn:io:hyperstitionstud:lexicon:spec:blackwell` |
| **CLI Entry Points (`pyproject.toml`)** | `hs-<tool>` | `hs-pdf-build`, `hs-tier-list`, `hs-ci-provision`, `hs-kg-build`, `hs-isolation-check` |
--- ---
## 3. Repository Layout of `/workspace/hyperstitionstudio-core` ## 2. Canonical `hyperstitionstud.io` Offline Namespace Table (`v1.2.0`)
| Layer / Ecosystem | Offline-First Namespace Pattern | Concrete Examples |
| :--- | :--- | :--- |
| **Python 3.10+ (PEP 420)** | `hyperstitionstud_io.<module>` | `hyperstitionstud_io.{config,ciphers,phonetics,publishing,glossary,graph,ci,audio}` |
| **JavaScript / ESM Modules** | `@hyperstitionstud.io/<pkg>` | `@hyperstitionstud.io/{ciphers-aq,phonetics-g2p,graph-workbench}` |
| **In-Browser Offline Global (`file://` & `http://`)** | `window.HyperstitionStudio.<Module>` | `window.HyperstitionStudio.EncyclopediaGraphData`<br/>`window.HyperstitionStudio.Config`<br/>`window.HyperstitionStudio.GraphWorkbench` |
| **JSON Schema `$id` (Nominal Identity)** | `urn:io:hyperstitionstud:schema:v1:<name>` | `"$id": "urn:io:hyperstitionstud:schema:v1:glossary-registry"`<br/>`"$id": "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph"` |
| **JSON Schema `$schema` (Local Resolution)** | `./schemas/v1/<name>.schema.json` | `"$schema": "./schemas/v1/encyclopedia-graph.schema.json"` |
| **GraphML / GEXF XML Namespace** | `xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0"` | `<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0">` |
| **Graph Node & Entity URNs** | `urn:io:hyperstitionstud:<domain>:<type>:<id>` | `urn:io:hyperstitionstud:zoology:build:S1`<br/>`urn:io:hyperstitionstud:aq:hub:125` |
---
## 3. Engineering for Both Deployment Scenarios (`Scenario A: file://` & `Scenario B: http://`)
To make the interactive application (`index.html`) 100% portable across both **direct offline browser opens (`file://`)** and **any static HTTP server (`http://`)**, `hyperstitionstud_io.graph` and the operator documentation must explicitly address five browser-level behaviors:
### 3.1 How Data Loading Works in Both Scenarios (`graph-data.js` Synchronous Script vs. `fetch()`)
- **Why `fetch("./encyclopedia-graph.json")` Fails on `file://`:**
Every modern browser (Firefox, Chromium, Brave, Safari) blocks `fetch()` and `XMLHttpRequest` when the page origin is `file://` (`Cross-Origin Request Blocked: CORS request not http`).
- **Portable Dual-Mode Design:**
`build_encyclopedia_knowledge_graph.py` emits **both**:
1. `encyclopedia-graph.json` (for Python, `jq`, or HTTP API consumers), and
2. `graph-data.js` (`window.HyperstitionStudio = window.HyperstitionStudio || {}; window.HyperstitionStudio.EncyclopediaGraphData = {...};`), loaded via `<script src="./graph-data.js"></script>`.
- Because `<script src="./graph-data.js">` is permitted on **both** `file://` and `http://` origins without CORS restrictions, the exact same `index.html` boots instantaneously in both deployment modes with zero network configuration.
### 3.2 How Encyclopedia PDF Links Work in Both Scenarios (`encyclopediaBasePath` Auto-Resolution)
When a user clicks `"Open Encyclopedia Volume PDF"` inside the right-hand Inspector Drawer of `index.html`, the target path depends on how the folder is deployed:
| Deployment Scenario | How the User Opens `index.html` | How `encyclopedia/<div_id>/<slug>.pdf` Resolves |
| :--- | :--- | :--- |
| **Scenario A: Direct Offline `file://` Open** | Opens `file:///.../workspace/encyclopedia-knowledge-graph/index.html` directly in a browser | Relative link `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf` (or `./encyclopedia/<div_id>/<slug>.pdf` if bundled) opens directly in the browser's built-in PDF viewer. |
| **Scenario B1: Static HTTP Server at `/workspace` Root** | Runs `python3 -m http.server 8090 --directory /workspace` and opens `http://127.0.0.1:8090/encyclopedia-knowledge-graph/index.html` | Relative link `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf` resolves to `http://127.0.0.1:8090/technocapital-singularity-zoology/encyclopedia/...`. |
| **Scenario B2: Static HTTP Server Inside `/workspace/encyclopedia-knowledge-graph` Only** | Runs `python3 -m http.server 8090 --directory /workspace/encyclopedia-knowledge-graph` (or drops the folder onto Nginx/Caddy) and opens `http://127.0.0.1:8090/index.html` | **Notice the `../` Boundary:** An HTTP server cannot serve files *above* its `--directory` root (`../` clamps to `/` and 404s unless `encyclopedia/` is reachable inside the root).<br/>**Solution in `hyperstitionstud_io.graph`:** Provide `--bundle-encyclopedia` (copies or symlinks `./encyclopedia/` into the output directory and sets `encyclopediaBasePath = "./encyclopedia"` in `graph-data.js`), OR run `hs-kg serve` which mounts both directories automatically on `http://127.0.0.1:8090`. |
### 3.3 Side-by-Side Documentation Pattern for End Users (Zsh / Jellyfin Style)
Every operator manual and `README.md` produced by `hyperstitionstud_io.publishing` will document **both** deployment modes side by side so the user never has to guess why a path behaves differently under `file://` vs. `http://`:
```text
DEPLOYMENT MODE A — 100% OFFLINE IN-BROWSER APPLICATION (ZERO SERVER, file://)
1. Open index.html directly in any modern browser:
xdg-open /workspace/encyclopedia-knowledge-graph/index.html
or paste into the address bar:
file:///home/m00t/hermes/workspace/encyclopedia-knowledge-graph/index.html
2. All 388 nodes, 1,282 edges, 4 layout modes, search filters, PNG canvas export,
and ../technocapital-singularity-zoology/encyclopedia/*.pdf links work offline.
DEPLOYMENT MODE B — STATIC HTTP SERVER HOSTING (LOCALHOST OR LAN, http://)
Option B1 (Serve parent /workspace so sibling ../technocapital-singularity-zoology/encyclopedia/*.pdf resolves):
python3 -m http.server 8090 --bind 127.0.0.1 --directory /workspace
Open: http://127.0.0.1:8090/encyclopedia-knowledge-graph/index.html
Option B2 (Serve /workspace/encyclopedia-knowledge-graph as a single self-contained web root):
python3 /workspace/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --bundle-encyclopedia
python3 -m http.server 8090 --bind 127.0.0.1 --directory /workspace/encyclopedia-knowledge-graph
Open: http://127.0.0.1:8090/index.html
```
---
## 4. Repository Layout of `/workspace/hyperstitionstudio-core` (`v1.2.0`)
```text ```text
/workspace/hyperstitionstudio-core/ /workspace/hyperstitionstudio-core/
├── pyproject.toml # Editable install: pip install -e /workspace/hyperstitionstudio-core ├── pyproject.toml # Editable install: pip install --no-deps -e /workspace/hyperstitionstudio-core
├── package.json # Workspace root for @hyperstitionstud.io/* JS/ESM packages ├── package.json # Local workspace root for @hyperstitionstud.io/* ESM packages (0 network deps)
├── requirements.txt # Pillow>=10.0, reportlab>=4.0, pypdf>=4.0, pdfplumber>=0.10 ├── requirements.txt # Pillow>=10.0, reportlab>=4.0, pypdf>=4.0, pdfplumber>=0.10
├── README.md ├── workspace.example.toml # Template for /workspace/workspace.toml
├── schemas/ ├── schemas/
│ └── v1/ # Canonical JSON Schemas (https://hyperstitionstud.io/schemas/v1/*) │ └── v1/ # Offline JSON Schemas ($id = urn:io:hyperstitionstud:schema:v1:*)
│ ├── glossary-registry.schema.json │ ├── glossary-registry.schema.json
│ ├── encyclopedia-manifest.schema.json │ ├── encyclopedia-manifest.schema.json
│ ├── singularity-zoology-matrix.schema.json │ ├── singularity-zoology-matrix.schema.json
│ ├── memetic-superclass-registry.schema.json │ ├── memetic-superclass-registry.schema.json
│ ├── assemblage-builds-tier-list.schema.json │ ├── assemblage-builds-tier-list.schema.json
│ ├── quantitative-economic-anchors.schema.json │ ├── quantitative-economic-anchors.schema.json
│ ├── citations-ledger.schema.json │ ├── citations-ledger.schema.json # Separates canonical `local_path` from local-config `url`
│ └── encyclopedia-graph.schema.json │ └── encyclopedia-graph.schema.json
├── src/ ├── src/
│ └── io/ │ └── io/
│ └── hyperstitionstud/ # PEP 420 Namespace Root (no __init__.py at io/, explicit at leaf packages) │ └── hyperstitionstud/ # PEP 420 Namespace Root
│ ├── config/
│ │ ├── __init__.py
│ │ └── settings.py # Loads workspace.toml, resolves [paths] & [citations.path_mounts]
│ ├── ciphers/ │ ├── ciphers/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── base36_aq.py # compute_aq(), digit/spoken/dual quant modes, zero-d-filter guard │ │ ├── base36_aq.py # compute_aq(), digit/spoken/dual quant modes, zero-d-filter guard
@@ -73,36 +120,37 @@ Extract all shared computation, phonetic translation, PDF/PNG/Canvas rendering,
│ │ └── vectors_g1_g6.py # G1 variance collapse, G2 cross-gen twins, G3 steps, G4 iso, G5 twin-prime │ │ └── vectors_g1_g6.py # G1 variance collapse, G2 cross-gen twins, G3 steps, G4 iso, G5 twin-prime
│ ├── phonetics/ │ ├── phonetics/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── ingglish_bridge.py # Self-contained Node G2P bridge + pure-Python CMUdict fallback cache │ │ ├── ingglish_bridge.py # Self-contained G2P translator + pure-Python CMUdict fallback
│ │ └── cmudict_fallback.json # Offline deterministic fallback so zero --workdir coupling is needed │ │ └── cmudict_fallback.json # Offline deterministic fallback (removes --workdir coupling)
│ ├── publishing/ │ ├── publishing/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── fonts.py # DejaVu Sans / Mono TrueType resolver & ReportLab family registration │ │ ├── fonts.py # Local DejaVu Sans / Mono TrueType resolver (zero remote font fetches)
│ │ ├── pdf_compiler.py # Unified build_wire_report_pdf (atomic .tmp.pdf + pypdf verification) │ │ ├── pdf_compiler.py # Unified Markdown->PDF compiler (atomic .tmp.pdf + pypdf verification)
│ │ ├── tier_list_renderer.py # Unified S+..F & ETI 0-100 .pdf/.png card renderer (Pillow + ReportLab) │ │ ├── tier_list_renderer.py # Unified S+..F & ETI 0-100 .pdf/.png renderer (Pillow + ReportLab)
│ │ ├── encyclopedia_pdf.py # Multi-division, alphabetized volume PDF compiler │ │ ├── encyclopedia_pdf.py # Multi-division, alphabetized volume PDF compiler
│ │ └── pokedex_compositor.py # Gen IV INFO Pokedex & meme-card compositor with box collision audit │ │ └── pokedex_compositor.py # Gen IV INFO Pokedex & meme-card compositor with box collision audit
│ ├── glossary/ │ ├── glossary/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── registry.py # GlossaryRegistry CRUD, provenance-keyed filtering (source_type) │ │ ├── registry.py # GlossaryRegistry CRUD, source_type provenance filter
│ │ └── isolation_guard.py # Pre/post SHA-256 context manager (`with ReadOnlyIsolationGuard(...):`) │ │ └── isolation_guard.py # Pure-Python hashlib.sha256 ReadOnlyIsolationGuard context manager
│ ├── graph/ │ ├── graph/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── builder.py # Multi-partite property graph builder & seen_edges deduplicator │ │ ├── builder.py # Multi-partite property graph builder & seen_edges deduplicator
│ │ ├── layouts.py # Mode 1 Trophic, Mode 2 Concentric ETI Radar, Mode 3 Funnel, Mode 4 Grid │ │ ├── layouts.py # Mode 1 Trophic, Mode 2 Concentric ETI Radar, Mode 3 Funnel, Mode 4 Grid
│ │ ├── exporters.py # JSON, GraphML (xmlns:hs), GEXF 1.3, Obsidian JSON Canvas 1.0 │ │ ├── exporters.py # JSON, GraphML (urn:io:hyperstitionstud:ns:kg:1.0), GEXF 1.3, Canvas 1.0
│ │ └── atlas_png.py # 1600x1060 high-res static board renderer with pill-masked arrows │ │ ├── atlas_png.py # 1600x1060 high-res static board renderer with pill-masked arrows
│ │ └── bundler.py # Supports --bundle-encyclopedia for single-folder static HTTP deployment
│ ├── ci/ │ ├── ci/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── gates_hyperdope.py # 4-Gate CI validator (normalize_caps, classify_candidates, db.json) │ │ ├── gates_hyperdope.py # 4-Gate CI validator (normalize_caps, classify_candidates, db.json)
│ │ └── citation_sources.py # 3-tier provenance verifier (git remote URL -> local full-path fallback) │ │ ├── citation_sources.py # Pure local-config path_mounts resolver + local_path quote verifier
│ │ └── doctor.py # `hs-doctor`: single-command offline readiness, font, schema & SHA-256 check
│ └── audio/ │ └── audio/
│ ├── __init__.py │ ├── __init__.py
│ └── multi_voice_tts.py # 5-voice edge-tts synthesizer, ffmpeg concat, mutagen duration audit │ └── multi_voice_tts.py # 5-voice TTS lecture synthesizer, ffmpeg concat, mutagen duration audit
├── packages-js/
│ ├── ciphers-aq/ # @hyperstitionstud.io/ciphers-aq (shared with hyperdope-gematria)
│ └── graph-workbench/ # @hyperstitionstud.io/graph-workbench (shared with index.html)
└── tests/ └── tests/
├── test_offline_portability_no_https.py # Asserts zero outbound https:// schema/font/CDN links in HTML/XML/JSON
├── test_config_and_citation_mounts.py
├── test_ciphers_and_vectors.py ├── test_ciphers_and_vectors.py
├── test_phonetics_offline.py ├── test_phonetics_offline.py
├── test_publishing_pdf_and_png.py ├── test_publishing_pdf_and_png.py
@@ -112,79 +160,22 @@ Extract all shared computation, phonetic translation, PDF/PNG/Canvas rendering,
--- ---
## 4. Detailed Module Specifications & How Each Eliminates Cross-Repo Coupling ## 5. Four-Phase Implementation Roadmap (`v1.2.0`)
### 4.1 `io.hyperstitionstud.ciphers` — Unified Base-36 `AQ`, Prime & `G1–G6` Vector Engine ### Phase 1: Scaffold `/workspace/hyperstitionstudio-core`, `workspace.toml` & Offline `URN:` JSON Schemas
- **Replaces duplicated code in:** 1. Create `/workspace/hyperstitionstudio-core` with `pyproject.toml`, `src/io/hyperstitionstud/config/settings.py`, and `/workspace/workspace.toml`.
- `technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py` 2. Author the 8 JSON Schema files under `schemas/v1/*.schema.json` using `"$id": "urn:io:hyperstitionstud:schema:v1:<name>"` (zero `https://` schema URLs).
- `encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py` 3. Add `test_offline_portability_no_https.py` to verify that no HTML workbench, SVG diagram, XML export, or JSON schema contains external `https://` font, script, or namespace links.
- `ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py`
- `ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/generate_aq_tier_list.py`
- **Capabilities:**
- `compute_aq(text: str, quant_mode: Literal["off", "spoken", "digit", "dual"] = "off") -> int`
- `prime_rank(n: int) -> int | None` (1-indexed prime rank, e.g., `193 -> 44`, `137 -> 33`, `71 -> 20`)
- `evaluate_bidirectional_lock(eng: str, ing: str) -> BidirectionalLock` (computes all 18 fields of the `G1–G6` schema: `eng_aq`, `ing_aq`, `delta`, `isometric`, `twin_prime_mutation`, `g3_quantized_step`, etc.)
- `assert_zero_d_filter(text: str)` (enforces the strict boundary that Zoology and Knowledge Graph artifacts contain `0` references to the 10-letter `d` decagram).
### 4.2 `io.hyperstitionstud.phonetics` — Self-Contained `Ingglish` (`CMUdict`) Translator ### Phase 2: Implement `ciphers`, `phonetics` (Offline `CMUdict`), `glossary` & `ci.citation_sources`
- **Eliminates `--workdir /workspace/ingglish-hyperdope-gematria` coupling:** 1. Extract `hyperstitionstud_io.ciphers` (`compute_aq`, `prime_rank`, `G1–G6` vectors, `assert_zero_d_filter`).
- Currently, `classify_technocapital_singularity.py` requires `/workspace/ingglish-hyperdope-gematria/node_modules/ingglish` on disk to translate new English tokens into `Gen 1` Ingglish. 2. Extract `hyperstitionstud_io.phonetics` with bundled `cmudict_fallback.json` for 100% offline `Gen 0 -> Gen 1` translation.
- `io.hyperstitionstud.phonetics.translate_batch(terms)` embeds both: 3. Implement `hyperstitionstud_io.glossary.ReadOnlyIsolationGuard` (`hashlib.sha256`) and `hyperstitionstud_io.ci.citation_sources` (pure `[citations.path_mounts]` resolution).
1. A bundled deterministic `cmudict_fallback.json` + pure-Python ARPAbet-to-Ingglish grapheme mapper for `100%` offline zero-Node operation, and
2. An optional Node `@hyperstitionstud.io/phonetics-g2p` bridge when Node.js is available.
- Result: `technocapital-singularity-zoology` can run `--scan-harvest`, `--revise-anchor`, and `--terms` on any machine even if `ingglish-hyperdope-gematria` is not cloned alongside it.
### 4.3 `io.hyperstitionstud.publishing` — Unified ReportLab PDF & Pillow Visual Renderer ### Phase 3: Implement `publishing` & `graph` Modules (With Dual `file://` + `http://` Support)
- **Eliminates hardcoded cross-repo script calls (`build_wire_report_pdf.py` & `generate_aq_tier_list.py`):** 1. Extract ReportLab/Pillow rendering into `hyperstitionstud_io.publishing` and `hyperstitionstud_io.graph`.
- `compile_markdown_to_pdf(md_path, pdf_path, title, namespace_footer="hyperstitionstud.io")`: 2. Add `--bundle-encyclopedia` support in `hyperstitionstud_io.graph.bundler` so `index.html` resolves PDF links both when opened via `file://` / `/workspace` HTTP root (`../technocapital-singularity-zoology/encyclopedia/...`) and when served as a standalone single-folder HTTP root (`./encyclopedia/...`).
- Performs atomic writes via `.tmp.pdf` -> `os.replace()`.
- Automatically escapes inline code spans before bold/italic regexes so ReportLab's XML parser never fails on `<` or `>`.
- Automatically verifies page count and extracted character count via `pypdf` and `pdfplumber`.
- `render_tier_list_artifacts(rows, tier_defs, out_md, out_pdf, out_png)`:
- Directly importable by both `ingglish-hyperdope-gematria` (`Option #4` `S+..F` evaluations) and `technocapital-singularity-zoology` (`ETI 0–100` Zoological Assemblage Builds) without spawning cross-repo subprocesses.
### 4.4 `io.hyperstitionstud.glossary` — Provenance-Keyed Glossary & Cryptographic Isolation Guard ### Phase 4: Cut Over Consumer Projects & Verify Offline + HTTP Portability
- **Provides reusable glossary infrastructure for all `/workspace` projects:** 1. Update `classify_technocapital_singularity.py` and `build_encyclopedia_knowledge_graph.py` to import from `hyperstitionstud_io.*`.
- `ReadOnlyIsolationGuard(paths: list[Path])`: 2. Run `hs-doctor`, `pytest`, and `build_encyclopedia_knowledge_graph.py --verify-only`, confirming `all_gates_passed == true`, `0` external `https://` dependencies in HTML/XML/JSON, and `0` SHA-256 mutations on `glossary-registry.json` and `encyclopedia-manifest.json`.
```python
from io.hyperstitionstud.glossary import ReadOnlyIsolationGuard
with ReadOnlyIsolationGuard([glossary_path, encyclopedia_manifest_path]) as guard:
graph = build_graph(upstream_repo)
# Automatically asserts pre_sha256 == post_sha256 on exit and emits guard.audit_receipt()
```
- `ProvenanceFilter`: Filters entries by explicit `source_type` (`"archive_dossier"`, `"news_wire_harvest"`, `"podcast_series"`, `"knowledge_graph_meta"`) rather than fragile substring matching, guaranteeing that excluding in-house media or graph terms never strips extrinsic news-wire or dossier vocabulary.
---
## 5. Project-by-Project Dependency & Migration Matrix
| Workspace Project | Components Replaced by `io.hyperstitionstud.*` | Post-Migration Modularity Status |
| :--- | :--- | :--- |
| **`/workspace/technocapital-singularity-zoology`** | Replaces `--workdir` Node `ingglish` subprocess, subprocess calls to `generate_aq_tier_list.py` and `build_wire_report_pdf.py`, and in-file `compute_aq`/`prime_rank` with `io.hyperstitionstud.{ciphers,phonetics,publishing,glossary,ci,audio}`. | **100% Standalone** (zero runtime or build-time dependency on `ingglish-hyperdope-gematria`). |
| **`/workspace/encyclopedia-knowledge-graph`** | Replaces in-file `compute_aq`, XML/Canvas serializers, SHA-256 check boilerplate, and `build_wire_report_pdf.py` calls with `io.hyperstitionstud.{graph,glossary,publishing}` + `xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0"` and `urn:io:hyperstitionstud:*` node URNs. | **100% Standalone Compiler & Workbench** (consumes upstream JSONs validated against `https://hyperstitionstud.io/schemas/v1/*`). |
| **`/workspace/ingglish-hyperdope-gematria`** | Delegates `build_wire_report_pdf.py`, `generate_aq_tier_list.py`, and `ci_provision_ingglish.py` core logic to `io.hyperstitionstud.{publishing,ci,ciphers}` while keeping thin CLI wrappers at existing script paths for backwards compatibility. | **100% Backwards-Compatible** (zero broken CLI paths; zero duplicated rendering code). |
| **`/workspace/hyperdope-ci-build`** | Uses `io.hyperstitionstud.ci.gates_hyperdope` during provisioning while keeping `feat/ingglish-aq-corpus` free of third-party files so upstream PR diffs remain 100% clean. | **100% PR-Clean** (zero extraneous files added to upstream PR branch). |
| **`/workspace/hyperdope-gematria`** | Consumes `@hyperstitionstud.io/ciphers-aq` in `calc/ciphers.js` on branch `feat/ingglish-priority-toggle`. | **Shared JS Cipher Parity** with Python `io.hyperstitionstud.ciphers`. |
| **`/workspace/memes`** | Uses `io.hyperstitionstud.publishing.pokedex_compositor` for Gen IV INFO Pokedex cards and meme templates. | **Unified Card & Font Rendering** with automatic box-collision verification. |
---
## 6. Phased Implementation & Rollout Roadmap (`Phases 1–4`, Non-Breaking)
### Phase 1: Scaffold `/workspace/hyperstitionstudio-core` & Publish `v1` JSON Schemas
1. Initialize `/workspace/hyperstitionstudio-core` (`git init -b main`) with `pyproject.toml` (`name = "hyperstitionstudio-core"`, `version = "1.0.0"`) and `src/io/hyperstitionstud/`.
2. Author the 8 canonical JSON Schema files under `schemas/v1/*.schema.json` with `$id: "https://hyperstitionstud.io/schemas/v1/<name>.schema.json"`.
3. Install in editable mode across the workspace environment (`pip install --no-deps -e /workspace/hyperstitionstudio-core`).
### Phase 2: Extract `ciphers`, `phonetics`, `glossary`, and `ci` Modules + Unit Test Suite
1. Implement `io.hyperstitionstud.ciphers`, `io.hyperstitionstud.phonetics` (with offline `cmudict_fallback.json`), `io.hyperstitionstud.glossary.isolation_guard`, and `io.hyperstitionstud.ci`.
2. Run `pytest /workspace/hyperstitionstudio-core/tests/` to verify 100% numerical parity on all `282` glossary entries, `190` bilingual specimens, and `189` cross-scale `333/666/777` equations.
### Phase 3: Extract `publishing` (`pdf_compiler`, `tier_list_renderer`, `pokedex_compositor`) & `graph`
1. Move the core ReportLab and Pillow rendering engines into `io.hyperstitionstud.publishing` and `io.hyperstitionstud.graph`.
2. Replace the bodies of `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/build_wire_report_pdf.py` and `generate_aq_tier_list.py` with thin, backwards-compatible CLI shims that import from `io.hyperstitionstud.publishing`.
### Phase 4: Cut Over `technocapital-singularity-zoology` & `encyclopedia-knowledge-graph` and Run 3-Stage Audit
1. Update `classify_technocapital_singularity.py` and `build_encyclopedia_knowledge_graph.py` to import from `io.hyperstitionstud.*`.
2. Execute the full 3-Stage `BUILD -> TEST -> STAGE_COMMIT` pipeline (`ci_provision_ingglish.py --tier 2`, `sources.py verify --evidence`, and `build_encyclopedia_knowledge_graph.py --verify-only`), verifying `all_gates_passed == true` and `0` SHA-256 mutations on `glossary-registry.json` and `encyclopedia-manifest.json`.
Binary file not shown.
+121 -130
View File
@@ -1,71 +1,118 @@
# Architecture & Migration Plan: Shared Common Library Across All `/workspace` Projects Under the `hyperstitionstud.io` Namespace (`v1.0.0`) # Architecture & Implementation Plan: Shared Common Library Under the `hyperstitionstud.io` Namespace (`v1.2.0` — 100% Offline `URN:` Namespace & Dual `file://` + `http://` Portability Edition)
- **Document ID:** `PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO` (`v1.0.0`) - **Document ID:** `PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO` (`v1.2.0`)
- **Canonical Domain & Authority:** `hyperstitionstud.io` - **Offline Namespace Authority (Zero `https://` Network Calls):**
- **Python PEP 420 Reverse-DNS Namespace:** `io.hyperstitionstud.*` (installed from `/workspace/hyperstitionstudio-core`) - **Python PEP 420 Namespace:** `hyperstitionstud_io.*`
- **JavaScript / ESM Scope Namespace:** `@hyperstitionstud.io/*` (`window.HyperstitionStudio.*` in offline browser bundles) - **JavaScript / Browser Global Namespace:** `@hyperstitionstud.io/*` & `window.HyperstitionStudio.*`
- **Schema, XML & URN Authority:** `https://hyperstitionstud.io/schemas/v1/*`, `https://hyperstitionstud.io/ns/*`, and `urn:io:hyperstitionstud:*` - **URN Schema, XML & Entity Authority (RFC 8141):** `urn:io:hyperstitionstud:schema:v1:*`, `urn:io:hyperstitionstud:ns:kg:1.0`, and `urn:io:hyperstitionstud:<domain>:<type>:<id>`
- **Glossary & Encyclopedia Isolation Invariant:** Verified (`0` changes to `taxonomy/glossary-registry.json` or `encyclopedia/encyclopedia-manifest.json`). - **Local Relative Schema Paths:** `./schemas/v1/<name>.schema.json`
- **Dual Deployment Target:**
1. **Scenario A (`file://` Direct Offline In-Browser Application):** Zero HTTP server, zero `fetch()` CORS errors, zero external CDN/font/schema requests.
2. **Scenario B (`http://` Static Web Server Hosting):** Works identically under `python3 -m http.server`, Nginx, Caddy, or LAN self-hosting whether served from the `/workspace` parent directory or as a standalone web root.
- **Artifact & Citation URL Resolution Rule:** **100% Local-Configuration Driven** (`[citations.path_mounts]` in local `workspace.toml`, falling back to verified local paths).
- **Version-Control Operations in Scope:** **0%** (All file integrity and isolation checks use pure Python `hashlib.sha256` and atomic `.tmp -> os.replace()` writes).
--- ---
## 1. Executive Summary & Architectural Problem Statement ## 1. Review of `https://hyperstitionstud.io` URLs: Why They Are Replaced by Offline `urn:io:hyperstitionstud:*` & Relative Paths in `v1.2.0`
Across the peer repositories in `/workspace` (`ingglish-hyperdope-gematria`, `technocapital-singularity-zoology`, `encyclopedia-knowledge-graph`, `hyperdope-ci-build`, `hyperdope-gematria`, `memes`, and `thomas-calculus-tutor`), several foundational subsystems are currently either **duplicated in-file** or **coupled via cross-repository hardcoded script paths**: In `v1.0.0–v1.1.0`, the domain `hyperstitionstud.io` was formatted as `https://hyperstitionstud.io/...` in two places: JSON Schema `$id`/`$schema` fields and GraphML/GEXF `xmlns:hs` declarations. Reviewing those against a **100% offline, portable in-browser and static-HTTP deployment requirement** exposes three concrete failure modes:
1. **Cross-Repo Subprocess Handoffs for PDF & Tier-List Rendering:** | Former `https://` Usage (`v1.1.0`) | Why It Hurts 100% Offline & Portable Deployment | `v1.2.0` Portable Replacement (Zero Network Calls) |
Both `technocapital-singularity-zoology` and `encyclopedia-knowledge-graph` invoke `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/build_wire_report_pdf.py` and `generate_aq_tier_list.py` via hardcoded sibling paths.
2. **Cross-Repo Node.js `ingglish` (`CMUdict`) Resolution:**
`technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py` spawns `node --input-type=module` with `--workdir /workspace/ingglish-hyperdope-gematria` to resolve `node_modules/ingglish`.
3. **Duplicated Base-36 `AQ` & Prime Arithmetic:**
`compute_aq()`, prime-sieve/rank lookup (`is_prime`, `prime_rank`), repdigit detection (`37 * k`), and `G1–G6` drift/variance-collapse equations are re-implemented separately in `classify_technocapital_singularity.py`, `build_encyclopedia_knowledge_graph.py`, `ci_provision_ingglish.py`, and `generate_aq_tier_list.py`.
4. **Ad-Hoc JSON Schema & Provenance Identifiers:**
The 8 JSON registries in `technocapital-singularity-zoology` and the exported graph files in `encyclopedia-knowledge-graph` lack a unified `$schema` URI and XML/URN namespace authority.
### Solution Overview
Extract all shared computation, phonetic translation, PDF/PNG/Canvas rendering, cryptographic isolation guards, and CI validation into a single, zero-duplication sibling repository:
- **Repository Path:** `/workspace/hyperstitionstudio-core`
- **Python Namespace Package (PEP 420):** `io.hyperstitionstud.*`
- **JS/Browser Namespace:** `@hyperstitionstud.io/*`
- **XML/JSON/URN Namespace:** `https://hyperstitionstud.io/...` & `urn:io:hyperstitionstud:...`
---
## 2. Canonical `hyperstitionstud.io` Namespace Hierarchy
| Layer / Ecosystem | Canonical Namespace Pattern | Concrete Examples |
| :--- | :--- | :--- | | :--- | :--- | :--- |
| **Python 3.10+ (PEP 420 Namespace Package)** | `io.hyperstitionstud.<module>` | `io.hyperstitionstud.ciphers`<br/>`io.hyperstitionstud.phonetics`<br/>`io.hyperstitionstud.publishing`<br/>`io.hyperstitionstud.glossary`<br/>`io.hyperstitionstud.graph`<br/>`io.hyperstitionstud.ci`<br/>`io.hyperstitionstud.audio` | | **`$schema: "https://hyperstitionstud.io/schemas/v1/*.schema.json"`** | IDEs (VS Code, JetBrains), browser JSON inspectors, and schema validators attempt to **HTTP-fetch `https://` `$schema` URLs**. Offline or on an air-gapped LAN, this triggers DNS timeouts or validation warnings. | **Dual Offline Identity:**<br/>• `"$id": "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph"` (RFC 8141 URN — never fetched over DNS)<br/>• `"$schema": "./schemas/v1/encyclopedia-graph.schema.json"` (relative local file path that resolves both on `file://` and on any `http://` server) |
| **Node.js / ESM Packages** | `@hyperstitionstud.io/<pkg>` | `@hyperstitionstud.io/phonetics-g2p`<br/>`"@hyperstitionstud.io/ciphers-aq"`<br/>`"@hyperstitionstud.io/graph-workbench"` | | **`xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0"`** | Conflates a nominal XML namespace with a live `https://` endpoint; some XML/GEXF tools probe `https://` namespace URIs for XSD files. | **`xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0"`**<br/>Explicitly location-independent URN namespace; Gephi, Cytoscape, yEd, and `xml.etree.ElementTree` parse it 100% offline. |
| **Offline Browser Global (`file://`)** | `window.HyperstitionStudio.<Module>` | `window.HyperstitionStudio.EncyclopediaGraphData`<br/>`window.HyperstitionStudio.GraphWorkbench`<br/>`window.HyperstitionStudio.Ciphers` | | **External Web Fonts / CDNs (`https://fonts.googleapis.com/...`)** | Stalls browser rendering on `file://` or offline LAN `http://` while waiting for external DNS/TLS handshakes to fail. | **Zero External `<link>` or `<script>` URLs:**<br/>All HTML workbenches and SVG diagrams use pure inline/local CSS and local font stacks (`'DejaVu Sans Mono', 'JetBrains Mono', ui-monospace, monospace`). |
| **JSON Schema `$schema` & `$id` URIs** | `https://hyperstitionstud.io/schemas/v1/<name>.schema.json` | `https://hyperstitionstud.io/schemas/v1/glossary-registry.schema.json`<br/>`https://hyperstitionstud.io/schemas/v1/encyclopedia-manifest.schema.json`<br/>`https://hyperstitionstud.io/schemas/v1/encyclopedia-graph.schema.json` |
| **GraphML / GEXF XML Namespace** | `xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0"` | `<graphml xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0">`<br/>`<data key="hs:g1_variance_collapsed">249.36</data>` | **Rule in `v1.2.0`:** Zero `https://hyperstitionstud.io` URLs appear anywhere in code, schemas, XML exports, HTML files, or citation ledgers. Every `hyperstitionstud.io` namespace identifier uses **reverse-DNS module/URN syntax (`hyperstitionstud_io.*` / `urn:io:hyperstitionstud:*`)** or **relative local paths (`./...`)**.
| **Entity & Node URN Identifiers** | `urn:io:hyperstitionstud:<domain>:<type>:<id>` | `urn:io:hyperstitionstud:zoology:build:S1`<br/>`urn:io:hyperstitionstud:aq:hub:125`<br/>`urn:io:hyperstitionstud:lexicon:spec:blackwell` |
| **CLI Entry Points (`pyproject.toml`)** | `hs-<tool>` | `hs-pdf-build`, `hs-tier-list`, `hs-ci-provision`, `hs-kg-build`, `hs-isolation-check` |
--- ---
## 3. Repository Layout of `/workspace/hyperstitionstudio-core` ## 2. Canonical `hyperstitionstud.io` Offline Namespace Table (`v1.2.0`)
| Layer / Ecosystem | Offline-First Namespace Pattern | Concrete Examples |
| :--- | :--- | :--- |
| **Python 3.10+ (PEP 420)** | `hyperstitionstud_io.<module>` | `hyperstitionstud_io.{config,ciphers,phonetics,publishing,glossary,graph,ci,audio}` |
| **JavaScript / ESM Modules** | `@hyperstitionstud.io/<pkg>` | `@hyperstitionstud.io/{ciphers-aq,phonetics-g2p,graph-workbench}` |
| **In-Browser Offline Global (`file://` & `http://`)** | `window.HyperstitionStudio.<Module>` | `window.HyperstitionStudio.EncyclopediaGraphData`<br/>`window.HyperstitionStudio.Config`<br/>`window.HyperstitionStudio.GraphWorkbench` |
| **JSON Schema `$id` (Nominal Identity)** | `urn:io:hyperstitionstud:schema:v1:<name>` | `"$id": "urn:io:hyperstitionstud:schema:v1:glossary-registry"`<br/>`"$id": "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph"` |
| **JSON Schema `$schema` (Local Resolution)** | `./schemas/v1/<name>.schema.json` | `"$schema": "./schemas/v1/encyclopedia-graph.schema.json"` |
| **GraphML / GEXF XML Namespace** | `xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0"` | `<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0">` |
| **Graph Node & Entity URNs** | `urn:io:hyperstitionstud:<domain>:<type>:<id>` | `urn:io:hyperstitionstud:zoology:build:S1`<br/>`urn:io:hyperstitionstud:aq:hub:125` |
---
## 3. Engineering for Both Deployment Scenarios (`Scenario A: file://` & `Scenario B: http://`)
To make the interactive application (`index.html`) 100% portable across both **direct offline browser opens (`file://`)** and **any static HTTP server (`http://`)**, `hyperstitionstud_io.graph` and the operator documentation must explicitly address five browser-level behaviors:
### 3.1 How Data Loading Works in Both Scenarios (`graph-data.js` Synchronous Script vs. `fetch()`)
- **Why `fetch("./encyclopedia-graph.json")` Fails on `file://`:**
Every modern browser (Firefox, Chromium, Brave, Safari) blocks `fetch()` and `XMLHttpRequest` when the page origin is `file://` (`Cross-Origin Request Blocked: CORS request not http`).
- **Portable Dual-Mode Design:**
`build_encyclopedia_knowledge_graph.py` emits **both**:
1. `encyclopedia-graph.json` (for Python, `jq`, or HTTP API consumers), and
2. `graph-data.js` (`window.HyperstitionStudio = window.HyperstitionStudio || {}; window.HyperstitionStudio.EncyclopediaGraphData = {...};`), loaded via `<script src="./graph-data.js"></script>`.
- Because `<script src="./graph-data.js">` is permitted on **both** `file://` and `http://` origins without CORS restrictions, the exact same `index.html` boots instantaneously in both deployment modes with zero network configuration.
### 3.2 How Encyclopedia PDF Links Work in Both Scenarios (`encyclopediaBasePath` Auto-Resolution)
When a user clicks `"Open Encyclopedia Volume PDF"` inside the right-hand Inspector Drawer of `index.html`, the target path depends on how the folder is deployed:
| Deployment Scenario | How the User Opens `index.html` | How `encyclopedia/<div_id>/<slug>.pdf` Resolves |
| :--- | :--- | :--- |
| **Scenario A: Direct Offline `file://` Open** | Opens `file:///.../workspace/encyclopedia-knowledge-graph/index.html` directly in a browser | Relative link `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf` (or `./encyclopedia/<div_id>/<slug>.pdf` if bundled) opens directly in the browser's built-in PDF viewer. |
| **Scenario B1: Static HTTP Server at `/workspace` Root** | Runs `python3 -m http.server 8090 --directory /workspace` and opens `http://127.0.0.1:8090/encyclopedia-knowledge-graph/index.html` | Relative link `../technocapital-singularity-zoology/encyclopedia/<div_id>/<slug>.pdf` resolves to `http://127.0.0.1:8090/technocapital-singularity-zoology/encyclopedia/...`. |
| **Scenario B2: Static HTTP Server Inside `/workspace/encyclopedia-knowledge-graph` Only** | Runs `python3 -m http.server 8090 --directory /workspace/encyclopedia-knowledge-graph` (or drops the folder onto Nginx/Caddy) and opens `http://127.0.0.1:8090/index.html` | **Notice the `../` Boundary:** An HTTP server cannot serve files *above* its `--directory` root (`../` clamps to `/` and 404s unless `encyclopedia/` is reachable inside the root).<br/>**Solution in `hyperstitionstud_io.graph`:** Provide `--bundle-encyclopedia` (copies or symlinks `./encyclopedia/` into the output directory and sets `encyclopediaBasePath = "./encyclopedia"` in `graph-data.js`), OR run `hs-kg serve` which mounts both directories automatically on `http://127.0.0.1:8090`. |
### 3.3 Side-by-Side Documentation Pattern for End Users (Zsh / Jellyfin Style)
Every operator manual and `README.md` produced by `hyperstitionstud_io.publishing` will document **both** deployment modes side by side so the user never has to guess why a path behaves differently under `file://` vs. `http://`:
```text
DEPLOYMENT MODE A — 100% OFFLINE IN-BROWSER APPLICATION (ZERO SERVER, file://)
1. Open index.html directly in any modern browser:
xdg-open /workspace/encyclopedia-knowledge-graph/index.html
or paste into the address bar:
file:///home/m00t/hermes/workspace/encyclopedia-knowledge-graph/index.html
2. All 388 nodes, 1,282 edges, 4 layout modes, search filters, PNG canvas export,
and ../technocapital-singularity-zoology/encyclopedia/*.pdf links work offline.
DEPLOYMENT MODE B — STATIC HTTP SERVER HOSTING (LOCALHOST OR LAN, http://)
Option B1 (Serve parent /workspace so sibling ../technocapital-singularity-zoology/encyclopedia/*.pdf resolves):
python3 -m http.server 8090 --bind 127.0.0.1 --directory /workspace
Open: http://127.0.0.1:8090/encyclopedia-knowledge-graph/index.html
Option B2 (Serve /workspace/encyclopedia-knowledge-graph as a single self-contained web root):
python3 /workspace/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --bundle-encyclopedia
python3 -m http.server 8090 --bind 127.0.0.1 --directory /workspace/encyclopedia-knowledge-graph
Open: http://127.0.0.1:8090/index.html
```
---
## 4. Repository Layout of `/workspace/hyperstitionstudio-core` (`v1.2.0`)
```text ```text
/workspace/hyperstitionstudio-core/ /workspace/hyperstitionstudio-core/
├── pyproject.toml # Editable install: pip install -e /workspace/hyperstitionstudio-core ├── pyproject.toml # Editable install: pip install --no-deps -e /workspace/hyperstitionstudio-core
├── package.json # Workspace root for @hyperstitionstud.io/* JS/ESM packages ├── package.json # Local workspace root for @hyperstitionstud.io/* ESM packages (0 network deps)
├── requirements.txt # Pillow>=10.0, reportlab>=4.0, pypdf>=4.0, pdfplumber>=0.10 ├── requirements.txt # Pillow>=10.0, reportlab>=4.0, pypdf>=4.0, pdfplumber>=0.10
├── README.md ├── workspace.example.toml # Template for /workspace/workspace.toml
├── schemas/ ├── schemas/
│ └── v1/ # Canonical JSON Schemas (https://hyperstitionstud.io/schemas/v1/*) │ └── v1/ # Offline JSON Schemas ($id = urn:io:hyperstitionstud:schema:v1:*)
│ ├── glossary-registry.schema.json │ ├── glossary-registry.schema.json
│ ├── encyclopedia-manifest.schema.json │ ├── encyclopedia-manifest.schema.json
│ ├── singularity-zoology-matrix.schema.json │ ├── singularity-zoology-matrix.schema.json
│ ├── memetic-superclass-registry.schema.json │ ├── memetic-superclass-registry.schema.json
│ ├── assemblage-builds-tier-list.schema.json │ ├── assemblage-builds-tier-list.schema.json
│ ├── quantitative-economic-anchors.schema.json │ ├── quantitative-economic-anchors.schema.json
│ ├── citations-ledger.schema.json │ ├── citations-ledger.schema.json # Separates canonical `local_path` from local-config `url`
│ └── encyclopedia-graph.schema.json │ └── encyclopedia-graph.schema.json
├── src/ ├── src/
│ └── io/ │ └── io/
│ └── hyperstitionstud/ # PEP 420 Namespace Root (no __init__.py at io/, explicit at leaf packages) │ └── hyperstitionstud/ # PEP 420 Namespace Root
│ ├── config/
│ │ ├── __init__.py
│ │ └── settings.py # Loads workspace.toml, resolves [paths] & [citations.path_mounts]
│ ├── ciphers/ │ ├── ciphers/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── base36_aq.py # compute_aq(), digit/spoken/dual quant modes, zero-d-filter guard │ │ ├── base36_aq.py # compute_aq(), digit/spoken/dual quant modes, zero-d-filter guard
@@ -73,36 +120,37 @@ Extract all shared computation, phonetic translation, PDF/PNG/Canvas rendering,
│ │ └── vectors_g1_g6.py # G1 variance collapse, G2 cross-gen twins, G3 steps, G4 iso, G5 twin-prime │ │ └── vectors_g1_g6.py # G1 variance collapse, G2 cross-gen twins, G3 steps, G4 iso, G5 twin-prime
│ ├── phonetics/ │ ├── phonetics/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── ingglish_bridge.py # Self-contained Node G2P bridge + pure-Python CMUdict fallback cache │ │ ├── ingglish_bridge.py # Self-contained G2P translator + pure-Python CMUdict fallback
│ │ └── cmudict_fallback.json # Offline deterministic fallback so zero --workdir coupling is needed │ │ └── cmudict_fallback.json # Offline deterministic fallback (removes --workdir coupling)
│ ├── publishing/ │ ├── publishing/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── fonts.py # DejaVu Sans / Mono TrueType resolver & ReportLab family registration │ │ ├── fonts.py # Local DejaVu Sans / Mono TrueType resolver (zero remote font fetches)
│ │ ├── pdf_compiler.py # Unified build_wire_report_pdf (atomic .tmp.pdf + pypdf verification) │ │ ├── pdf_compiler.py # Unified Markdown->PDF compiler (atomic .tmp.pdf + pypdf verification)
│ │ ├── tier_list_renderer.py # Unified S+..F & ETI 0-100 .pdf/.png card renderer (Pillow + ReportLab) │ │ ├── tier_list_renderer.py # Unified S+..F & ETI 0-100 .pdf/.png renderer (Pillow + ReportLab)
│ │ ├── encyclopedia_pdf.py # Multi-division, alphabetized volume PDF compiler │ │ ├── encyclopedia_pdf.py # Multi-division, alphabetized volume PDF compiler
│ │ └── pokedex_compositor.py # Gen IV INFO Pokedex & meme-card compositor with box collision audit │ │ └── pokedex_compositor.py # Gen IV INFO Pokedex & meme-card compositor with box collision audit
│ ├── glossary/ │ ├── glossary/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── registry.py # GlossaryRegistry CRUD, provenance-keyed filtering (source_type) │ │ ├── registry.py # GlossaryRegistry CRUD, source_type provenance filter
│ │ └── isolation_guard.py # Pre/post SHA-256 context manager (`with ReadOnlyIsolationGuard(...):`) │ │ └── isolation_guard.py # Pure-Python hashlib.sha256 ReadOnlyIsolationGuard context manager
│ ├── graph/ │ ├── graph/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── builder.py # Multi-partite property graph builder & seen_edges deduplicator │ │ ├── builder.py # Multi-partite property graph builder & seen_edges deduplicator
│ │ ├── layouts.py # Mode 1 Trophic, Mode 2 Concentric ETI Radar, Mode 3 Funnel, Mode 4 Grid │ │ ├── layouts.py # Mode 1 Trophic, Mode 2 Concentric ETI Radar, Mode 3 Funnel, Mode 4 Grid
│ │ ├── exporters.py # JSON, GraphML (xmlns:hs), GEXF 1.3, Obsidian JSON Canvas 1.0 │ │ ├── exporters.py # JSON, GraphML (urn:io:hyperstitionstud:ns:kg:1.0), GEXF 1.3, Canvas 1.0
│ │ └── atlas_png.py # 1600x1060 high-res static board renderer with pill-masked arrows │ │ ├── atlas_png.py # 1600x1060 high-res static board renderer with pill-masked arrows
│ │ └── bundler.py # Supports --bundle-encyclopedia for single-folder static HTTP deployment
│ ├── ci/ │ ├── ci/
│ │ ├── __init__.py │ │ ├── __init__.py
│ │ ├── gates_hyperdope.py # 4-Gate CI validator (normalize_caps, classify_candidates, db.json) │ │ ├── gates_hyperdope.py # 4-Gate CI validator (normalize_caps, classify_candidates, db.json)
│ │ └── citation_sources.py # 3-tier provenance verifier (git remote URL -> local full-path fallback) │ │ ├── citation_sources.py # Pure local-config path_mounts resolver + local_path quote verifier
│ │ └── doctor.py # `hs-doctor`: single-command offline readiness, font, schema & SHA-256 check
│ └── audio/ │ └── audio/
│ ├── __init__.py │ ├── __init__.py
│ └── multi_voice_tts.py # 5-voice edge-tts synthesizer, ffmpeg concat, mutagen duration audit │ └── multi_voice_tts.py # 5-voice TTS lecture synthesizer, ffmpeg concat, mutagen duration audit
├── packages-js/
│ ├── ciphers-aq/ # @hyperstitionstud.io/ciphers-aq (shared with hyperdope-gematria)
│ └── graph-workbench/ # @hyperstitionstud.io/graph-workbench (shared with index.html)
└── tests/ └── tests/
├── test_offline_portability_no_https.py # Asserts zero outbound https:// schema/font/CDN links in HTML/XML/JSON
├── test_config_and_citation_mounts.py
├── test_ciphers_and_vectors.py ├── test_ciphers_and_vectors.py
├── test_phonetics_offline.py ├── test_phonetics_offline.py
├── test_publishing_pdf_and_png.py ├── test_publishing_pdf_and_png.py
@@ -112,79 +160,22 @@ Extract all shared computation, phonetic translation, PDF/PNG/Canvas rendering,
--- ---
## 4. Detailed Module Specifications & How Each Eliminates Cross-Repo Coupling ## 5. Four-Phase Implementation Roadmap (`v1.2.0`)
### 4.1 `io.hyperstitionstud.ciphers` — Unified Base-36 `AQ`, Prime & `G1–G6` Vector Engine ### Phase 1: Scaffold `/workspace/hyperstitionstudio-core`, `workspace.toml` & Offline `URN:` JSON Schemas
- **Replaces duplicated code in:** 1. Create `/workspace/hyperstitionstudio-core` with `pyproject.toml`, `src/io/hyperstitionstud/config/settings.py`, and `/workspace/workspace.toml`.
- `technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py` 2. Author the 8 JSON Schema files under `schemas/v1/*.schema.json` using `"$id": "urn:io:hyperstitionstud:schema:v1:<name>"` (zero `https://` schema URLs).
- `encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py` 3. Add `test_offline_portability_no_https.py` to verify that no HTML workbench, SVG diagram, XML export, or JSON schema contains external `https://` font, script, or namespace links.
- `ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/ci_provision_ingglish.py`
- `ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/generate_aq_tier_list.py`
- **Capabilities:**
- `compute_aq(text: str, quant_mode: Literal["off", "spoken", "digit", "dual"] = "off") -> int`
- `prime_rank(n: int) -> int | None` (1-indexed prime rank, e.g., `193 -> 44`, `137 -> 33`, `71 -> 20`)
- `evaluate_bidirectional_lock(eng: str, ing: str) -> BidirectionalLock` (computes all 18 fields of the `G1–G6` schema: `eng_aq`, `ing_aq`, `delta`, `isometric`, `twin_prime_mutation`, `g3_quantized_step`, etc.)
- `assert_zero_d_filter(text: str)` (enforces the strict boundary that Zoology and Knowledge Graph artifacts contain `0` references to the 10-letter `d` decagram).
### 4.2 `io.hyperstitionstud.phonetics` — Self-Contained `Ingglish` (`CMUdict`) Translator ### Phase 2: Implement `ciphers`, `phonetics` (Offline `CMUdict`), `glossary` & `ci.citation_sources`
- **Eliminates `--workdir /workspace/ingglish-hyperdope-gematria` coupling:** 1. Extract `hyperstitionstud_io.ciphers` (`compute_aq`, `prime_rank`, `G1–G6` vectors, `assert_zero_d_filter`).
- Currently, `classify_technocapital_singularity.py` requires `/workspace/ingglish-hyperdope-gematria/node_modules/ingglish` on disk to translate new English tokens into `Gen 1` Ingglish. 2. Extract `hyperstitionstud_io.phonetics` with bundled `cmudict_fallback.json` for 100% offline `Gen 0 -> Gen 1` translation.
- `io.hyperstitionstud.phonetics.translate_batch(terms)` embeds both: 3. Implement `hyperstitionstud_io.glossary.ReadOnlyIsolationGuard` (`hashlib.sha256`) and `hyperstitionstud_io.ci.citation_sources` (pure `[citations.path_mounts]` resolution).
1. A bundled deterministic `cmudict_fallback.json` + pure-Python ARPAbet-to-Ingglish grapheme mapper for `100%` offline zero-Node operation, and
2. An optional Node `@hyperstitionstud.io/phonetics-g2p` bridge when Node.js is available.
- Result: `technocapital-singularity-zoology` can run `--scan-harvest`, `--revise-anchor`, and `--terms` on any machine even if `ingglish-hyperdope-gematria` is not cloned alongside it.
### 4.3 `io.hyperstitionstud.publishing` — Unified ReportLab PDF & Pillow Visual Renderer ### Phase 3: Implement `publishing` & `graph` Modules (With Dual `file://` + `http://` Support)
- **Eliminates hardcoded cross-repo script calls (`build_wire_report_pdf.py` & `generate_aq_tier_list.py`):** 1. Extract ReportLab/Pillow rendering into `hyperstitionstud_io.publishing` and `hyperstitionstud_io.graph`.
- `compile_markdown_to_pdf(md_path, pdf_path, title, namespace_footer="hyperstitionstud.io")`: 2. Add `--bundle-encyclopedia` support in `hyperstitionstud_io.graph.bundler` so `index.html` resolves PDF links both when opened via `file://` / `/workspace` HTTP root (`../technocapital-singularity-zoology/encyclopedia/...`) and when served as a standalone single-folder HTTP root (`./encyclopedia/...`).
- Performs atomic writes via `.tmp.pdf` -> `os.replace()`.
- Automatically escapes inline code spans before bold/italic regexes so ReportLab's XML parser never fails on `<` or `>`.
- Automatically verifies page count and extracted character count via `pypdf` and `pdfplumber`.
- `render_tier_list_artifacts(rows, tier_defs, out_md, out_pdf, out_png)`:
- Directly importable by both `ingglish-hyperdope-gematria` (`Option #4` `S+..F` evaluations) and `technocapital-singularity-zoology` (`ETI 0–100` Zoological Assemblage Builds) without spawning cross-repo subprocesses.
### 4.4 `io.hyperstitionstud.glossary` — Provenance-Keyed Glossary & Cryptographic Isolation Guard ### Phase 4: Cut Over Consumer Projects & Verify Offline + HTTP Portability
- **Provides reusable glossary infrastructure for all `/workspace` projects:** 1. Update `classify_technocapital_singularity.py` and `build_encyclopedia_knowledge_graph.py` to import from `hyperstitionstud_io.*`.
- `ReadOnlyIsolationGuard(paths: list[Path])`: 2. Run `hs-doctor`, `pytest`, and `build_encyclopedia_knowledge_graph.py --verify-only`, confirming `all_gates_passed == true`, `0` external `https://` dependencies in HTML/XML/JSON, and `0` SHA-256 mutations on `glossary-registry.json` and `encyclopedia-manifest.json`.
```python
from io.hyperstitionstud.glossary import ReadOnlyIsolationGuard
with ReadOnlyIsolationGuard([glossary_path, encyclopedia_manifest_path]) as guard:
graph = build_graph(upstream_repo)
# Automatically asserts pre_sha256 == post_sha256 on exit and emits guard.audit_receipt()
```
- `ProvenanceFilter`: Filters entries by explicit `source_type` (`"archive_dossier"`, `"news_wire_harvest"`, `"podcast_series"`, `"knowledge_graph_meta"`) rather than fragile substring matching, guaranteeing that excluding in-house media or graph terms never strips extrinsic news-wire or dossier vocabulary.
---
## 5. Project-by-Project Dependency & Migration Matrix
| Workspace Project | Components Replaced by `io.hyperstitionstud.*` | Post-Migration Modularity Status |
| :--- | :--- | :--- |
| **`/workspace/technocapital-singularity-zoology`** | Replaces `--workdir` Node `ingglish` subprocess, subprocess calls to `generate_aq_tier_list.py` and `build_wire_report_pdf.py`, and in-file `compute_aq`/`prime_rank` with `io.hyperstitionstud.{ciphers,phonetics,publishing,glossary,ci,audio}`. | **100% Standalone** (zero runtime or build-time dependency on `ingglish-hyperdope-gematria`). |
| **`/workspace/encyclopedia-knowledge-graph`** | Replaces in-file `compute_aq`, XML/Canvas serializers, SHA-256 check boilerplate, and `build_wire_report_pdf.py` calls with `io.hyperstitionstud.{graph,glossary,publishing}` + `xmlns:hs="https://hyperstitionstud.io/ns/kg/1.0"` and `urn:io:hyperstitionstud:*` node URNs. | **100% Standalone Compiler & Workbench** (consumes upstream JSONs validated against `https://hyperstitionstud.io/schemas/v1/*`). |
| **`/workspace/ingglish-hyperdope-gematria`** | Delegates `build_wire_report_pdf.py`, `generate_aq_tier_list.py`, and `ci_provision_ingglish.py` core logic to `io.hyperstitionstud.{publishing,ci,ciphers}` while keeping thin CLI wrappers at existing script paths for backwards compatibility. | **100% Backwards-Compatible** (zero broken CLI paths; zero duplicated rendering code). |
| **`/workspace/hyperdope-ci-build`** | Uses `io.hyperstitionstud.ci.gates_hyperdope` during provisioning while keeping `feat/ingglish-aq-corpus` free of third-party files so upstream PR diffs remain 100% clean. | **100% PR-Clean** (zero extraneous files added to upstream PR branch). |
| **`/workspace/hyperdope-gematria`** | Consumes `@hyperstitionstud.io/ciphers-aq` in `calc/ciphers.js` on branch `feat/ingglish-priority-toggle`. | **Shared JS Cipher Parity** with Python `io.hyperstitionstud.ciphers`. |
| **`/workspace/memes`** | Uses `io.hyperstitionstud.publishing.pokedex_compositor` for Gen IV INFO Pokedex cards and meme templates. | **Unified Card & Font Rendering** with automatic box-collision verification. |
---
## 6. Phased Implementation & Rollout Roadmap (`Phases 1–4`, Non-Breaking)
### Phase 1: Scaffold `/workspace/hyperstitionstudio-core` & Publish `v1` JSON Schemas
1. Initialize `/workspace/hyperstitionstudio-core` (`git init -b main`) with `pyproject.toml` (`name = "hyperstitionstudio-core"`, `version = "1.0.0"`) and `src/io/hyperstitionstud/`.
2. Author the 8 canonical JSON Schema files under `schemas/v1/*.schema.json` with `$id: "https://hyperstitionstud.io/schemas/v1/<name>.schema.json"`.
3. Install in editable mode across the workspace environment (`pip install --no-deps -e /workspace/hyperstitionstudio-core`).
### Phase 2: Extract `ciphers`, `phonetics`, `glossary`, and `ci` Modules + Unit Test Suite
1. Implement `io.hyperstitionstud.ciphers`, `io.hyperstitionstud.phonetics` (with offline `cmudict_fallback.json`), `io.hyperstitionstud.glossary.isolation_guard`, and `io.hyperstitionstud.ci`.
2. Run `pytest /workspace/hyperstitionstudio-core/tests/` to verify 100% numerical parity on all `282` glossary entries, `190` bilingual specimens, and `189` cross-scale `333/666/777` equations.
### Phase 3: Extract `publishing` (`pdf_compiler`, `tier_list_renderer`, `pokedex_compositor`) & `graph`
1. Move the core ReportLab and Pillow rendering engines into `io.hyperstitionstud.publishing` and `io.hyperstitionstud.graph`.
2. Replace the bodies of `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/build_wire_report_pdf.py` and `generate_aq_tier_list.py` with thin, backwards-compatible CLI shims that import from `io.hyperstitionstud.publishing`.
### Phase 4: Cut Over `technocapital-singularity-zoology` & `encyclopedia-knowledge-graph` and Run 3-Stage Audit
1. Update `classify_technocapital_singularity.py` and `build_encyclopedia_knowledge_graph.py` to import from `io.hyperstitionstud.*`.
2. Execute the full 3-Stage `BUILD -> TEST -> STAGE_COMMIT` pipeline (`ci_provision_ingglish.py --tier 2`, `sources.py verify --evidence`, and `build_encyclopedia_knowledge_graph.py --verify-only`), verifying `all_gates_passed == true` and `0` SHA-256 mutations on `glossary-registry.json` and `encyclopedia-manifest.json`.
Binary file not shown.
@@ -4,7 +4,6 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Cross-Repository Dependency Graph &amp; Auditable Build-&gt;Test-&gt;Stage_Commit Pipeline</title> <title>Cross-Repository Dependency Graph &amp; Auditable Build-&gt;Test-&gt;Stage_Commit Pipeline</title>
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
<style> <style>
* { * {
margin: 0; margin: 0;
@@ -12,7 +11,7 @@
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
font-family: 'JetBrains Mono', monospace; font-family: 'DejaVu Sans Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
background: #020617; background: #020617;
min-height: 100vh; min-height: 100vh;
padding: 2rem; padding: 2rem;
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<gexf xmlns="http://www.gexf.net/1.3" xmlns:viz="http://www.gexf.net/1.3/viz" version="1.3"> <gexf xmlns="http://www.gexf.net/1.3" xmlns:viz="http://www.gexf.net/1.3/viz" xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0" version="1.3">
<graph mode="static" defaultedgetype="directed"> <graph mode="static" defaultedgetype="directed">
<attributes class="node"> <attributes class="node">
<attribute id="0" title="node_type" type="string"/> <attribute id="0" title="node_type" type="string"/>
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0">
<key id="label" for="node" attr.name="label" attr.type="string"/> <key id="label" for="node" attr.name="label" attr.type="string"/>
<key id="node_type" for="node" attr.name="node_type" attr.type="string"/> <key id="node_type" for="node" attr.name="node_type" attr.type="string"/>
<key id="color" for="node" attr.name="color" attr.type="string"/> <key id="color" for="node" attr.name="color" attr.type="string"/>
+5 -1
View File
@@ -1,5 +1,9 @@
{ {
"version": "1.0.0", "$schema": "./schemas/v1/encyclopedia-graph.schema.json",
"$id": "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph",
"namespace_urn": "urn:io:hyperstitionstud:ns:kg:1.0",
"version": "1.2.0",
"encyclopedia_base_path": "../technocapital-singularity-zoology/encyclopedia",
"upstream_repository": "/workspace/technocapital-singularity-zoology", "upstream_repository": "/workspace/technocapital-singularity-zoology",
"isolation_verified": { "isolation_verified": {
"glossary_registry_sha256_pre": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d", "glossary_registry_sha256_pre": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d",
+8 -2
View File
@@ -1,5 +1,10 @@
window.ENCYCLOPEDIA_GRAPH_DATA = { window.HyperstitionStudio = window.HyperstitionStudio || {};
"version": "1.0.0", window.HyperstitionStudio.EncyclopediaGraphData = {
"$schema": "./schemas/v1/encyclopedia-graph.schema.json",
"$id": "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph",
"namespace_urn": "urn:io:hyperstitionstud:ns:kg:1.0",
"version": "1.2.0",
"encyclopedia_base_path": "../technocapital-singularity-zoology/encyclopedia",
"upstream_repository": "/workspace/technocapital-singularity-zoology", "upstream_repository": "/workspace/technocapital-singularity-zoology",
"isolation_verified": { "isolation_verified": {
"glossary_registry_sha256_pre": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d", "glossary_registry_sha256_pre": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d",
@@ -28669,3 +28674,4 @@ window.ENCYCLOPEDIA_GRAPH_DATA = {
} }
] ]
}; };
window.ENCYCLOPEDIA_GRAPH_DATA = window.HyperstitionStudio.EncyclopediaGraphData;
+5 -4
View File
@@ -324,11 +324,12 @@
<script src="graph-data.js"></script> <script src="graph-data.js"></script>
<script> <script>
(function() { (function() {
const DATA = window.ENCYCLOPEDIA_GRAPH_DATA; const DATA = (window.HyperstitionStudio && window.HyperstitionStudio.EncyclopediaGraphData) || window.ENCYCLOPEDIA_GRAPH_DATA;
if (!DATA) { if (!DATA) {
document.getElementById("hudStats").textContent = "Error: graph-data.js not found."; document.getElementById("hudStats").textContent = "Error: graph-data.js not found.";
return; return;
} }
const ENC_BASE = DATA.encyclopedia_base_path || "../technocapital-singularity-zoology/encyclopedia";
const canvas = document.getElementById("graphCanvas"); const canvas = document.getElementById("graphCanvas");
const ctx = canvas.getContext("2d"); const ctx = canvas.getContext("2d");
@@ -632,7 +633,7 @@
n.sample_equations.map(eq => `<li>${eq}</li>`).join("") + `</ul></div>`); n.sample_equations.map(eq => `<li>${eq}</li>`).join("") + `</ul></div>`);
} }
if (n.volume_pdf_rel) { if (n.volume_pdf_rel) {
htmlParts.push(`<a class="pdf-link" href="../technocapital-singularity-zoology/encyclopedia/${n.volume_pdf_rel}" target="_blank">Open Encyclopedia Volume PDF (${n.volume_pdf_rel.split('/').pop()})</a>`); htmlParts.push(`<a class="pdf-link" href="${ENC_BASE}/${n.volume_pdf_rel}" target="_blank">Open Encyclopedia Volume PDF (${n.volume_pdf_rel.split('/').pop()})</a>`);
} }
} else if (n.node_type === "ConceptualOperatorOrIdiom") { } else if (n.node_type === "ConceptualOperatorOrIdiom") {
htmlParts.push(`<div class="kv-box"> htmlParts.push(`<div class="kv-box">
@@ -641,7 +642,7 @@
${n.definition} ${n.definition}
</div>`); </div>`);
if (n.volume_pdf_rel) { if (n.volume_pdf_rel) {
htmlParts.push(`<a class="pdf-link" href="../technocapital-singularity-zoology/encyclopedia/${n.volume_pdf_rel}" target="_blank">Open Encyclopedia Volume PDF</a>`); htmlParts.push(`<a class="pdf-link" href="${ENC_BASE}/${n.volume_pdf_rel}" target="_blank">Open Encyclopedia Volume PDF</a>`);
} }
} else if (n.node_type === "TaxonAssemblageBuild") { } else if (n.node_type === "TaxonAssemblageBuild") {
htmlParts.push(`<div class="kv-box"> htmlParts.push(`<div class="kv-box">
@@ -664,7 +665,7 @@
<strong>Division:</strong> <code>${n.div_id}</code><br/> <strong>Division:</strong> <code>${n.div_id}</code><br/>
<strong>Articles:</strong> ${n.article_count} (${n.page_count} pages) <strong>Articles:</strong> ${n.article_count} (${n.page_count} pages)
</div>`); </div>`);
htmlParts.push(`<a class="pdf-link" href="../technocapital-singularity-zoology/encyclopedia/${n.div_id}/${n.slug}.pdf" target="_blank">Open Volume PDF (${n.slug}.pdf)</a>`); htmlParts.push(`<a class="pdf-link" href="${ENC_BASE}/${n.div_id}/${n.slug}.pdf" target="_blank">Open Volume PDF (${n.slug}.pdf)</a>`);
} else { } else {
htmlParts.push(`<div class="kv-box"><strong>Scope:</strong> ${n.description || ""}</div>`); htmlParts.push(`<div class="kv-box"><strong>Scope:</strong> ${n.description || ""}</div>`);
} }
+39 -4
View File
@@ -25,9 +25,27 @@ import html
import json import json
import math import math
import re import re
import shutil
import sys
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
_CORE_SRC = Path("/workspace/hyperstitionstudio-core/src")
if _CORE_SRC.is_dir() and str(_CORE_SRC) not in sys.path:
sys.path.insert(0, str(_CORE_SRC))
try:
from hyperstitionstud_io.ciphers import compute_aq as _hs_compute_aq
from hyperstitionstud_io.glossary import ReadOnlyIsolationGuard
from hyperstitionstud_io.graph import URN_GRAPH_NS, URN_SCHEMA_GRAPH, make_entity_urn
except ImportError:
_hs_compute_aq = None
ReadOnlyIsolationGuard = None
URN_GRAPH_NS = "urn:io:hyperstitionstud:ns:kg:1.0"
URN_SCHEMA_GRAPH = "urn:io:hyperstitionstud:schema:v1:encyclopedia-graph"
def make_entity_urn(domain: str, entity_type: str, entity_id: str | int) -> str:
return f"urn:io:hyperstitionstud:{domain}:{entity_type}:{entity_id}"
KG_REPO_ROOT = Path("/workspace/encyclopedia-knowledge-graph") KG_REPO_ROOT = Path("/workspace/encyclopedia-knowledge-graph")
UPSTREAM_REPO_DEFAULT = Path("/workspace/technocapital-singularity-zoology") UPSTREAM_REPO_DEFAULT = Path("/workspace/technocapital-singularity-zoology")
HOST_UPSTREAM_ROOT = "/home/m00t/hermes/workspace/technocapital-singularity-zoology" HOST_UPSTREAM_ROOT = "/home/m00t/hermes/workspace/technocapital-singularity-zoology"
@@ -680,7 +698,11 @@ def build_graph(upstream_repo: Path = UPSTREAM_REPO_DEFAULT) -> dict[str, Any]:
)[:15] )[:15]
return { return {
"version": "1.0.0", "$schema": "./schemas/v1/encyclopedia-graph.schema.json",
"$id": URN_SCHEMA_GRAPH,
"namespace_urn": URN_GRAPH_NS,
"version": "1.2.0",
"encyclopedia_base_path": "../technocapital-singularity-zoology/encyclopedia",
"upstream_repository": str(upstream_repo), "upstream_repository": str(upstream_repo),
"isolation_verified": { "isolation_verified": {
"glossary_registry_sha256_pre": pre_gl_sha, "glossary_registry_sha256_pre": pre_gl_sha,
@@ -726,7 +748,7 @@ def build_graph(upstream_repo: Path = UPSTREAM_REPO_DEFAULT) -> dict[str, Any]:
def export_graphml(graph_data: dict[str, Any], out_path: Path) -> None: def export_graphml(graph_data: dict[str, Any], out_path: Path) -> None:
lines = [ lines = [
'<?xml version="1.0" encoding="UTF-8"?>', '<?xml version="1.0" encoding="UTF-8"?>',
'<graphml xmlns="http://graphml.graphdrawing.org/xmlns">', f'<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:hs="{URN_GRAPH_NS}">',
' <key id="label" for="node" attr.name="label" attr.type="string"/>', ' <key id="label" for="node" attr.name="label" attr.type="string"/>',
' <key id="node_type" for="node" attr.name="node_type" attr.type="string"/>', ' <key id="node_type" for="node" attr.name="node_type" attr.type="string"/>',
' <key id="color" for="node" attr.name="color" attr.type="string"/>', ' <key id="color" for="node" attr.name="color" attr.type="string"/>',
@@ -771,7 +793,7 @@ def export_graphml(graph_data: dict[str, Any], out_path: Path) -> None:
def export_gexf(graph_data: dict[str, Any], out_path: Path) -> None: def export_gexf(graph_data: dict[str, Any], out_path: Path) -> None:
lines = [ lines = [
'<?xml version="1.0" encoding="UTF-8"?>', '<?xml version="1.0" encoding="UTF-8"?>',
'<gexf xmlns="http://www.gexf.net/1.3" xmlns:viz="http://www.gexf.net/1.3/viz" version="1.3">', f'<gexf xmlns="http://www.gexf.net/1.3" xmlns:viz="http://www.gexf.net/1.3/viz" xmlns:hs="{URN_GRAPH_NS}" version="1.3">',
' <graph mode="static" defaultedgetype="directed">', ' <graph mode="static" defaultedgetype="directed">',
' <attributes class="node">', ' <attributes class="node">',
' <attribute id="0" title="node_type" type="string"/>', ' <attribute id="0" title="node_type" type="string"/>',
@@ -1063,6 +1085,7 @@ def main() -> int:
ap = argparse.ArgumentParser(description="Build, verify, and query the Encyclopedia of Technocapital Singularity Zoology Knowledge Graph.") ap = argparse.ArgumentParser(description="Build, verify, and query the Encyclopedia of Technocapital Singularity Zoology Knowledge Graph.")
ap.add_argument("--upstream-repo", default=str(UPSTREAM_REPO_DEFAULT), help="Path to upstream technocapital-singularity-zoology repository (read-only).") ap.add_argument("--upstream-repo", default=str(UPSTREAM_REPO_DEFAULT), help="Path to upstream technocapital-singularity-zoology repository (read-only).")
ap.add_argument("--out-dir", default=str(KG_REPO_ROOT), help="Target output directory for generated graph artifacts (default: /workspace/encyclopedia-knowledge-graph).") ap.add_argument("--out-dir", default=str(KG_REPO_ROOT), help="Target output directory for generated graph artifacts (default: /workspace/encyclopedia-knowledge-graph).")
ap.add_argument("--bundle-encyclopedia", action="store_true", help="Copy/bundle ./encyclopedia/ into --out-dir and set encyclopedia_base_path='./encyclopedia' for single-folder static HTTP hosting.")
ap.add_argument("--verify-only", action="store_true", help="Run 6-gate verification on existing knowledge-graph artifacts without rebuilding.") ap.add_argument("--verify-only", action="store_true", help="Run 6-gate verification on existing knowledge-graph artifacts without rebuilding.")
ap.add_argument("--check-isolation", action="store_true", help="Print upstream glossary and encyclopedia SHA-256 digests and verify zero modifications.") ap.add_argument("--check-isolation", action="store_true", help="Print upstream glossary and encyclopedia SHA-256 digests and verify zero modifications.")
ap.add_argument("--query-node", default=None, help="Query a node by ID, headword, Ingglish token, or integer AQ coordinate and inspect its ego-network.") ap.add_argument("--query-node", default=None, help="Query a node by ID, headword, Ingglish token, or integer AQ coordinate and inspect its ego-network.")
@@ -1101,6 +1124,13 @@ def main() -> int:
return 0 return 0
out_dir.mkdir(parents=True, exist_ok=True) out_dir.mkdir(parents=True, exist_ok=True)
if args.bundle_encyclopedia:
src_enc = upstream_repo / "encyclopedia"
dst_enc = out_dir / "encyclopedia"
if src_enc.is_dir():
shutil.copytree(src_enc, dst_enc, dirs_exist_ok=True)
graph_data["encyclopedia_base_path"] = "./encyclopedia"
json_path = out_dir / "encyclopedia-graph.json" json_path = out_dir / "encyclopedia-graph.json"
js_path = out_dir / "graph-data.js" js_path = out_dir / "graph-data.js"
graphml_path = out_dir / "encyclopedia-graph.graphml" graphml_path = out_dir / "encyclopedia-graph.graphml"
@@ -1109,7 +1139,12 @@ def main() -> int:
json_str = json.dumps(graph_data, indent=2, ensure_ascii=False) json_str = json.dumps(graph_data, indent=2, ensure_ascii=False)
json_path.write_text(json_str + "\n", encoding="utf-8") json_path.write_text(json_str + "\n", encoding="utf-8")
js_path.write_text(f"window.ENCYCLOPEDIA_GRAPH_DATA = {json_str};\n", encoding="utf-8") js_path.write_text(
"window.HyperstitionStudio = window.HyperstitionStudio || {};\n"
f"window.HyperstitionStudio.EncyclopediaGraphData = {json_str};\n"
"window.ENCYCLOPEDIA_GRAPH_DATA = window.HyperstitionStudio.EncyclopediaGraphData;\n",
encoding="utf-8",
)
export_graphml(graph_data, graphml_path) export_graphml(graph_data, graphml_path)
export_gexf(graph_data, gexf_path) export_gexf(graph_data, gexf_path)