Files
technocapital-singularity-z…/knowledge-graph/OPERATORS-MANUAL.md
T

202 lines
16 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Operator's Manual: Building, Verifying, Inspecting & Maintaining the Encyclopedia of Technocapital Singularity Zoology Knowledge Graph (`v1.7.0`)
- **Document ID:** `OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH` (`v1.7.0`)
- **Primary Repository:** `/workspace/technocapital-singularity-zoology`
- **Knowledge Graph Compiler CLI:** `/workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py`
- **Published Knowledge Graph Directory:** `/workspace/technocapital-singularity-zoology/knowledge-graph/`
- **Interactive Browser Workbench:** `/workspace/technocapital-singularity-zoology/knowledge-graph/index.html` (`file:///home/m00t/hermes/workspace/technocapital-singularity-zoology/knowledge-graph/index.html`)
- **Strict Isolation Standard:** Read-Only Upstream Ingestion (`0` Graph/Visualization Concepts Permitted in `taxonomy/glossary-registry.json` or `encyclopedia/`)
---
## 1. System Overview & Architectural Boundaries
The **Encyclopedia Knowledge Graph Engine** (`scripts/build_encyclopedia_knowledge_graph.py`) compiles the `9` Ontological Divisions (`00`–`08`), `22` Alphabetized PDF Volumes (`122` pages), `282` unique glossary and lexical headwords (`291` volume placements), `10` Assemblage Builds (`Ranks #1–#9` + provisional `M7_candidate_2026_11_28`), `65` Base-36 Alphanumeric Qabbala (`AQ`) coordinate hubs (`71..390`, `333/666/777`), and `189` verified cross-scale equations into a **388-node, 1,282-edge multi-partite property graph** (`0` duplicate parallel edges).
### 1.1 The Strict One-Way Isolation Rule (Zero Glossary Leak)
Operators must enforce a strict unidirectional boundary between the **Upstream Domain Corpora** and the **Downstream Knowledge Graph Workbench**:
| Layer | Canonical Files | Access Mode During Graph Build | Isolation Invariant |
| :--- | :--- | :--- | :--- |
| **Upstream Source of Truth** | `taxonomy/glossary-registry.json`<br/>`encyclopedia/encyclopedia-manifest.json`<br/>`taxonomy/assemblage-builds-tier-list.json`<br/>`taxonomy/memetic-superclass-registry.json`<br/>`dossiers/65..69-dossier-*.md` | **READ-ONLY (`r`)** | Pre-build and post-build SHA-256 digests of `glossary-registry.json` and `encyclopedia-manifest.json` MUST remain 100% identical. Zero graph-theory or visualization terms may be added to the glossary. |
| **Downstream Graph Workbench** | `knowledge-graph/index.html`<br/>`knowledge-graph/encyclopedia-graph.json`<br/>`knowledge-graph/graph-data.js`<br/>`knowledge-graph/encyclopedia-graph.graphml`<br/>`knowledge-graph/encyclopedia-graph.gexf`<br/>`knowledge-graph/encyclopedia.canvas`<br/>`knowledge-graph/atlas-mode{1,2,3}.png` | **READ-WRITE (`w`)** | Rebuilt deterministically on demand whenever upstream encyclopedia or glossary registries are updated. |
---
## 2. Prerequisites & Pre-Flight Environment Checklist
Before executing a build, verify that the runtime environment and upstream registries satisfy three prerequisites:
1. **Python 3.10+ with Pillow (`PIL`):**
`build_encyclopedia_knowledge_graph.py` uses 100% Python standard library (`json`, `hashlib`, `math`, `re`, `html`, `xml.etree.ElementTree`, `pathlib`, `argparse`) for all graph construction, centrality calculation, and JSON/GraphML/GEXF/Canvas exports, plus `PIL` (`Pillow`) for rendering the three `1600x1060` visual atlas PNG boards.
2. **Upstream Encyclopedia & Glossary Presence:**
Confirm that `taxonomy/glossary-registry.json` and `encyclopedia/encyclopedia-manifest.json` exist on disk.
3. **Pre-Flight Isolation Baseline Check (`--check-isolation`):**
Run the pre-flight isolation check to record the upstream SHA-256 digests prior to building:
```bash
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py --check-isolation
```
Expected output:
- `"glossary_registry_sha256": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d"`
- `"encyclopedia_manifest_sha256": "0d7ce833bb0aa0eea069bf764b2e3b0b36ac2631821c42f3d6bcb897335f8a7d"`
---
## 3. Step-by-Step Build & Verification Procedure
### Step 1: Execute the Full Knowledge Graph Build
Run `build_encyclopedia_knowledge_graph.py` from any working directory:
```bash
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py
```
What this command executes deterministically in ~1.2 seconds:
1. Computes `pre_gl_sha` and `pre_enc_sha` over `taxonomy/glossary-registry.json` and `encyclopedia/encyclopedia-manifest.json`.
2. Constructs all **388 nodes** across 6 ontological classes:
- `OntologicalDivision` (`9` nodes: `div:00-index-and-ontological-atlas` .. `div:08-stakeholder-registers-idioms-and-pokedex-semiotics`)
- `EncyclopediaVolume` (`22` nodes: `vol:00-index-and-ontological-atlas/00-master-encyclopedia-index-a-to-z` .. `vol:08-.../i-to-z-...`)
- `TaxonAssemblageBuild` (`10` nodes: `build:S1` [`93 ETI`], `build:S2` [`90 ETI`], `build:S6` [`87 ETI`], `build:S3` [`83 ETI`], `build:M1` [`73 ETI`], `build:S5` [`61 ETI`], `build:S4` [`61 ETI`], `build:M6` [`53 ETI`], `build:M7_candidate_2026_11_28` [`53 ETI`], and `build:Q0` [`49 ETI`])
- `ConceptualOperatorOrIdiom` (`92` nodes: `concept:000` .. `concept:091` from Sections 1–8 & 8B)
- `BilingualLexicalSpecimen` (`190` nodes: `spec:incorporation` .. `spec:debt` from Section 9)
- `AQCoordinateHub` (`65` nodes: `aq:71` .. `aq:390` + macro repdigit attractors `aq:333`, `aq:666`, `aq:777`)
3. Constructs all **1,282 deduplicated typed edges** across 8 mathematical and structural relations:
- `IN_VOLUME` (`281` edges) & `IN_DIVISION` (`22` edges)
- `IN_GUILD_BUILD` (`271` edges)
- `G2_CROSS_GEN_TWIN` (`202` directed edges where `AQ_Eng(A) == AQ_Ing(B)`)
- `CLOSES_REPDIGIT_EQ` (`175` edges linking constituent tokens to `aq:333`, `aq:666`, and `aq:777`)
- `G1_COLLAPSES_TO_ING_AQ` (`167` directed edges weighted by `log(1 + Gen0_Var_Collapsed)`)
- `GEN0_WRITTEN_COLLISION` (`103` undirected edges where `AQ_Eng(A) == AQ_Eng(B)`)
- `TROPHIC_GUILD_BRIDGE` (`35` unique edges across the `13` Multi-Build Hybrid Flex Singularities)
- `G4_ISOMETRIC_INVARIANT` (`21` self-loops on `Δ = 0` chokepoints)
- `G5_TWIN_PRIME_MUTATION` (`5` edges on dual-prime mutations into shared hubs)
4. Computes deterministic `(x, y)` coordinates for all 4 spatial layouts (`mode1_trophic`, `mode2_radar`, `mode3_bipartite`, `mode4_hierarchy`).
5. Writes `encyclopedia-graph.json`, `graph-data.js`, `encyclopedia-graph.graphml`, `encyclopedia-graph.gexf`, `encyclopedia.canvas`, and the 3 high-resolution PNG atlas boards (`atlas-mode1-trophic-food-web.png`, `atlas-mode2-concentric-eti-radar.png`, `atlas-mode3-bipartite-g1-funnel.png`).
6. Runs the built-in **6-Gate Verification Suite** and asserts `pre_gl_sha == post_gl_sha` and `pre_enc_sha == post_enc_sha`.
### Step 2: Run Standalone 6-Gate Verification (`--verify-only`)
To audit the published artifacts in `/workspace/technocapital-singularity-zoology/knowledge-graph/` at any time without rebuilding:
```bash
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py --verify-only
```
Verify that the JSON response reports `"all_gates_passed": true`:
- **Gate 1 (`gate1_glossary_sha256_unchanged`):** `true` (`taxonomy/glossary-registry.json` untouched).
- **Gate 2 (`gate2_encyclopedia_sha256_unchanged`):** `true` (`encyclopedia/encyclopedia-manifest.json` untouched).
- **Gate 3 (`gate3_json_schema_counts`):** `{"nodes": 388, "edges": 1282}` (`>= 388` nodes and `>= 1282` deduplicated edges).
- **Gate 4 (`gate4_xml_well_formed`):** Parses both `encyclopedia-graph.graphml` and `encyclopedia-graph.gexf` via `xml.etree.ElementTree.parse()` with zero XML syntax errors.
- **Gate 5 (`gate5_obsidian_canvas_counts`):** Confirms valid JSON Canvas 1.0 structure (`282` hub/high-degree canvas nodes, `1,120` canvas edges).
- **Gate 6 (`gate6_atlas_pngs`):** Confirms all 3 rendered PNG atlas boards exist at `[1600, 1060]` RGB resolution.
### Step 3: Query Any Node & Inspect Its Ego-Network via CLI (`--query-node`)
Operators can inspect any node's properties, layout coordinates, and incident edges directly from the terminal using `--query-node <QUERY>`:
```bash
# 1. Query an Assemblage Build by ID
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py --query-node "build:S1"
# 2. Query an AQ Coordinate Hub by integer value (e.g., 125 = 5^3 or 193 [44th PRIME])
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py --query-node "125"
# 3. Query a Bilingual Lexical Specimen by English or Ingglish spelling
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py --query-node "blakwel"
```
### Step 4: Conduct Non-Destructive Staging Dry-Runs (`--out-dir`)
When testing layout adjustments or schema extensions, pass `--out-dir /tmp/kg-staging` so the production `/workspace/technocapital-singularity-zoology/knowledge-graph/` directory remains untouched during testing:
```bash
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py --out-dir /tmp/kg-staging
```
---
## 4. Operating the Interactive Browser Workbench (`knowledge-graph/index.html`)
### 4.1 Opening the Workbench (`file://` Direct Open or Local HTTP Server)
Because `index.html` loads `window.ENCYCLOPEDIA_GRAPH_DATA` synchronously from the co-located `graph-data.js` bundle (rather than making an asynchronous `fetch('encyclopedia-graph.json')` request that browsers block under `file://` CORS policies), operators can open the workbench in two ways:
1. **Direct Local `file://` Open (Zero Server Required):**
Open `file:///home/m00t/hermes/workspace/technocapital-singularity-zoology/knowledge-graph/index.html` directly in Firefox, Chromium, or Brave.
2. **Local HTTP Server (Optional):**
```bash
python3 -m http.server 8090 --bind 127.0.0.1 --directory /workspace/technocapital-singularity-zoology
```
Then navigate to `http://127.0.0.1:8090/knowledge-graph/index.html`.
*(Note: Serving from the repository root `/workspace/technocapital-singularity-zoology` allows the relative `../encyclopedia/<div_id>/<slug>.pdf` links inside the right-hand Inspector Drawer to open the 22 Encyclopedia PDFs directly in a new browser tab).*
### 4.2 Navigating the Four Spatial Layout Modes & Ego-Network Isolator
Use the top toolbar buttons to switch between the spatial layouts:
- **`Mode 2: ETI Radar (S+ -> D Periphery)` *(Default)*:** Displays the six concentric rings (`Ring 1: Tier S+ Center [88–100 ETI]` bullseye radiating outward through `Ring 2: Tier S`, `Ring 3: Tier A`, `Ring 4: Tier B`, `Ring 5: Tier C`, and `Ring 6: Tier D Periphery [44–51 ETI]`).
- **`Mode 1: Trophic Food-Web`:** Places `333 / 666 / 777` at the core surrounded by the `13` Flex Pivots, the `10` Assemblage Builds, the `190` specimens clustered by guild angle, and the `92` conceptual operators.
- **`Mode 3: Gen 0 -> Gen 1 Funnel`:** Five-column bipartite alignment (`Gen 0 Written Specimens [x=240]` -> `Conceptual Operators [x=500]` -> `Encyclopedia Volumes [x=790]` -> `Gen 1 AQ Hubs [x=1080]` -> `ETI Builds & 333/666/777 [x=1340]`).
- **`Mode 4: 00–08 Folder Grid`:** Arranges all `291` article placements in a `3x3` grid corresponding to Ontological Divisions `00` through `08`.
- **Interactive Ego-Network Isolation (Mode 5):**
- **Single-click any node** on the canvas (or click any of the `13 Flex Pivots & Repdigit Hubs` pills in the left sidebar: `333, 666, 777, 292, 260, 256, 211, 193, 191, 183, 166, 153, 137, 136, 133, 129, 125, 96, 95, 91, 81`) to isolate its 1-hop neighborhood and populate the right-hand **Encyclopedia Article Inspector Drawer**.
- **Double-click empty canvas** (or click **`Reset View`**) to restore the full 388-node view.
- **Click `Export PNG`** in the top-right toolbar to download a PNG snapshot of the current viewport and filter state.
---
## 5. Importing Into External Open-Source Network Science & PKM Tools
1. **Gephi (`0.10+`) / Cytoscape Desktop (`3.10+`) / yEd:**
- Open `/workspace/technocapital-singularity-zoology/knowledge-graph/encyclopedia-graph.gexf` (or `encyclopedia-graph.graphml`).
- Node colors (`viz:color`), sizes (`viz:size`), and pre-computed radar coordinates (`viz:position`) load automatically. Run Gephi's *ForceAtlas2* (with `Scaling = 12.0`, `Prevent Overlap = True`, `LinLog mode = True`) or *Modularity* (`Resolution = 1.0`) to compare unsupervised topological clusters against the `S1–S6 × M1–M7+` guilds.
2. **Python `NetworkX` Custom Scripting:**
```python
import json
p = "/workspace/technocapital-singularity-zoology/knowledge-graph/encyclopedia-graph.json"
data = json.loads(open(p).read())
print("Nodes:", data["counts"]["total_nodes"], "Edges:", data["counts"]["total_edges"])
```
3. **Obsidian Canvas (`JSON Canvas 1.0`):**
- Copy or symlink `/workspace/technocapital-singularity-zoology/knowledge-graph/encyclopedia.canvas` into any Obsidian vault to browse the 159 core hub/build cards on an infinite 2D canvas.
---
## 6. Maintenance Protocol & Troubleshooting Runbook
### 6.1 When to Rebuild the Knowledge Graph
Whenever you add a new domain term to the glossary and update the Encyclopedia:
```bash
# Step A: Update the glossary & 22-volume PDF Encyclopedia
python3 /workspace/technocapital-singularity-zoology/scripts/classify_technocapital_singularity.py \
--add-glossary-term "<NEW_TERM>" "<CATEGORY>" "<DEFINITION>" \
--build-encyclopedia
# Step B: Rebuild and verify the Knowledge Graph from the updated read-only registries
python3 /workspace/technocapital-singularity-zoology/scripts/build_encyclopedia_knowledge_graph.py
```
### 6.2 Troubleshooting Common Operator Issues
| Symptom / Error | Root Cause | Deterministic Resolution |
| :--- | :--- | :--- |
| `AssertionError: ISOLATION BREACH: glossary-registry.json modified!` | An external process modified `taxonomy/glossary-registry.json` mid-build. | Run `git -C /workspace/technocapital-singularity-zoology diff taxonomy/glossary-registry.json` to inspect the change, restore if unintended, and re-run `build_encyclopedia_knowledge_graph.py`. |
| `Error: graph-data.js not found` when opening `index.html` | `index.html` was moved outside `knowledge-graph/` without `graph-data.js`. | Keep `index.html` and `graph-data.js` in the same directory (`/workspace/technocapital-singularity-zoology/knowledge-graph/`) or re-run `build_encyclopedia_knowledge_graph.py`. |
| Clicking `Open Encyclopedia Volume PDF` in `index.html` returns 404 over HTTP | The local HTTP server was started inside `knowledge-graph/` instead of the parent repo root, making `../encyclopedia/` unreachable. | Start `python3 -m http.server 8090` with `--directory /workspace/technocapital-singularity-zoology` (the repo root) or open `index.html` directly via `file://`. |
---
## 7. Operator Manual Write-Test-Edit Audit Log (`v1.7.0`)
During live verification of this manual against `/workspace/technocapital-singularity-zoology/knowledge-graph/`, three empirical refinements were discovered, tested, and edited into both `scripts/build_encyclopedia_knowledge_graph.py` and this manual:
1. **Deduplication of Parallel `TROPHIC_GUILD_BRIDGE` Edges (`1,287 -> 1,282` Unique Edges):**
Running `build_encyclopedia_knowledge_graph.py --query-node "125"` revealed that `("aq:125", "build:S6", "TROPHIC_GUILD_BRIDGE")` was emitted twice (once from `build:S2 -> 125 -> build:S6` and once from `build:M7_candidate_2026_11_28 -> 125 -> build:S6`), causing `incident_edge_count` (`9`) to exceed `degree` (`8`). Adding `seen_edges: set[tuple[str, str, str]]` in `add_edge()` eliminated all 5 duplicate parallel bridge edges (`40 -> 35` `TROPHIC_GUILD_BRIDGE` edges, `1,287 -> 1,282` total edges) so `incident_edge_count == degree` (`8 == 8`) holds across all hubs.
2. **Multi-Match `matched_node_ids` Reporting in `--query-node`:**
Querying an integer coordinate such as `--query-node "125"` matches both the hub node (`aq:125`) and the 5 lexical specimen nodes whose `ing_aq == 125` (`spec:capital`, `spec:capture`, `spec:downs`, `spec:folds`, `spec:serres`). `query_node_ego()` was upgraded to return `"matched_node_ids"` alongside `"primary_node"` so operators immediately see the entire equivalence ring.
3. **Dynamic Threshold Guard in Gate 3 (`nodes >= 388`, `edges >= 1282`) & Empirical Canvas Counts (`282` Nodes, `1,120` Edges):**
Updated Gate 3 in `verify_published_artifacts()` to assert `>= 388` nodes and `>= 1282` edges (so future glossary additions pass `--verify-only` without false-negative equality failures) and updated Gate 5 documentation to reflect the exact verified Obsidian Canvas counts (`282` nodes, `1,120` edges).