docs(cleanup): implement Option 3 — remove duplicate root/docs plans, add unified VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE, and archive historical plans in docs/archive/ (v1.0.0)

This commit is contained in:
Hermes Agent committed 2026-11-29 21:54:13 +00:00
1 parent da3fcc714e
commit 9e282db059
28 files changed
+306 -1578

No files matched your search

@@ -0,0 +1,181 @@
# 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.2.0`)
- **Offline Namespace Authority (Zero `https://` Network Calls):**
- **Python PEP 420 Namespace:** `hyperstitionstud_io.*`
- **JavaScript / Browser Global Namespace:** `@hyperstitionstud.io/*` & `window.HyperstitionStudio.*`
- **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>`
- **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. Review of `https://hyperstitionstud.io` URLs: Why They Are Replaced by Offline `urn:io:hyperstitionstud:*` & Relative Paths in `v1.2.0`
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:
| Former `https://` Usage (`v1.1.0`) | Why It Hurts 100% Offline & Portable Deployment | `v1.2.0` Portable Replacement (Zero Network Calls) |
| :--- | :--- | :--- |
| **`$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) |
| **`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. |
| **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`). |
**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 (`./...`)**.
---
## 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
/workspace/hyperstitionstudio-core/
├── pyproject.toml # Editable install: pip install --no-deps -e /workspace/hyperstitionstudio-core
├── 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
├── workspace.example.toml # Template for /workspace/workspace.toml
├── schemas/
│ └── v1/ # Offline JSON Schemas ($id = urn:io:hyperstitionstud:schema:v1:*)
│ ├── glossary-registry.schema.json
│ ├── encyclopedia-manifest.schema.json
│ ├── singularity-zoology-matrix.schema.json
│ ├── memetic-superclass-registry.schema.json
│ ├── assemblage-builds-tier-list.schema.json
│ ├── quantitative-economic-anchors.schema.json
│ ├── citations-ledger.schema.json # Separates canonical `local_path` from local-config `url`
│ └── encyclopedia-graph.schema.json
├── src/
│ └── io/
│ └── hyperstitionstud/ # PEP 420 Namespace Root
│ ├── config/
│ │ ├── __init__.py
│ │ └── settings.py # Loads workspace.toml, resolves [paths] & [citations.path_mounts]
│ ├── ciphers/
│ │ ├── __init__.py
│ │ ├── base36_aq.py # compute_aq(), digit/spoken/dual quant modes, zero-d-filter guard
│ │ ├── primes.py # Prime sieve, prime_rank(), twin-prime & repdigit (37*k) predicates
│ │ └── vectors_g1_g6.py # G1 variance collapse, G2 cross-gen twins, G3 steps, G4 iso, G5 twin-prime
│ ├── phonetics/
│ │ ├── __init__.py
│ │ ├── ingglish_bridge.py # Self-contained G2P translator + pure-Python CMUdict fallback
│ │ └── cmudict_fallback.json # Offline deterministic fallback (removes --workdir coupling)
│ ├── publishing/
│ │ ├── __init__.py
│ │ ├── fonts.py # Local DejaVu Sans / Mono TrueType resolver (zero remote font fetches)
│ │ ├── pdf_compiler.py # Unified Markdown->PDF compiler (atomic .tmp.pdf + pypdf verification)
│ │ ├── tier_list_renderer.py # Unified S+..F & ETI 0-100 .pdf/.png renderer (Pillow + ReportLab)
│ │ ├── encyclopedia_pdf.py # Multi-division, alphabetized volume PDF compiler
│ │ └── pokedex_compositor.py # Gen IV INFO Pokedex & meme-card compositor with box collision audit
│ ├── glossary/
│ │ ├── __init__.py
│ │ ├── registry.py # GlossaryRegistry CRUD, source_type provenance filter
│ │ └── isolation_guard.py # Pure-Python hashlib.sha256 ReadOnlyIsolationGuard context manager
│ ├── graph/
│ │ ├── __init__.py
│ │ ├── 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
│ │ ├── 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
│ │ └── bundler.py # Supports --bundle-encyclopedia for single-folder static HTTP deployment
│ ├── ci/
│ │ ├── __init__.py
│ │ ├── gates_hyperdope.py # 4-Gate CI validator (normalize_caps, classify_candidates, db.json)
│ │ ├── 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/
│ ├── __init__.py
│ └── multi_voice_tts.py # 5-voice TTS lecture synthesizer, ffmpeg concat, mutagen duration audit
└── 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_phonetics_offline.py
├── test_publishing_pdf_and_png.py
├── test_glossary_isolation_guard.py
└── test_graph_exporters_and_urns.py
```
---
## 5. Four-Phase Implementation Roadmap (`v1.2.0`)
### Phase 1: Scaffold `/workspace/hyperstitionstudio-core`, `workspace.toml` & Offline `URN:` JSON Schemas
1. Create `/workspace/hyperstitionstudio-core` with `pyproject.toml`, `src/io/hyperstitionstud/config/settings.py`, and `/workspace/workspace.toml`.
2. Author the 8 JSON Schema files under `schemas/v1/*.schema.json` using `"$id": "urn:io:hyperstitionstud:schema:v1:<name>"` (zero `https://` schema URLs).
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.
### Phase 2: Implement `ciphers`, `phonetics` (Offline `CMUdict`), `glossary` & `ci.citation_sources`
1. Extract `hyperstitionstud_io.ciphers` (`compute_aq`, `prime_rank`, `G1–G6` vectors, `assert_zero_d_filter`).
2. Extract `hyperstitionstud_io.phonetics` with bundled `cmudict_fallback.json` for 100% offline `Gen 0 -> Gen 1` translation.
3. Implement `hyperstitionstud_io.glossary.ReadOnlyIsolationGuard` (`hashlib.sha256`) and `hyperstitionstud_io.ci.citation_sources` (pure `[citations.path_mounts]` resolution).
### Phase 3: Implement `publishing` & `graph` Modules (With Dual `file://` + `http://` Support)
1. Extract ReportLab/Pillow rendering into `hyperstitionstud_io.publishing` and `hyperstitionstud_io.graph`.
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/...`).
### Phase 4: Cut Over Consumer Projects & Verify Offline + HTTP Portability
1. Update `classify_technocapital_singularity.py` and `build_encyclopedia_knowledge_graph.py` to import from `hyperstitionstud_io.*`.
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`.