Files
encyclopedia-knowledge-graph/docs/OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.md
T

201 lines
17 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.0.0`)
- **Document ID:** `OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH` (`v1.0.0`)
- **Standalone Knowledge Graph Repository:** `/workspace/encyclopedia-knowledge-graph` (`branch: main`, `tag: v1.0.0`)
- **Upstream Read-Only Sibling Repository:** `/workspace/technocapital-singularity-zoology` (`v1.7.0`)
- **Knowledge Graph Compiler CLI:** `/workspace/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py`
- **Interactive Browser Workbench:** `/workspace/encyclopedia-knowledge-graph/index.html` (`file:///home/m00t/hermes/workspace/encyclopedia-knowledge-graph/index.html`)
- **Strict Isolation Standard:** Read-Only Upstream Ingestion (`0` Graph/Visualization Concepts Permitted in `/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json` or `encyclopedia/`)
---
## 1. System Overview & Sibling Repository Isolation
`/workspace/encyclopedia-knowledge-graph` is a standalone, source-controlled Git repository in `/workspace` housing the **Encyclopedia Knowledge Graph Compiler** (`scripts/build_encyclopedia_knowledge_graph.py`), the **Interactive HTML5/Canvas Browser Workbench** (`index.html`), the four open-source graph interchange exports (`encyclopedia-graph.json`, `encyclopedia-graph.graphml`, `encyclopedia-graph.gexf`, `encyclopedia.canvas`), the three high-resolution visual atlas PNG boards (`atlas-mode{1,2,3}.png`), and this Operator's Manual (`OPERATORS-MANUAL-ENCYCLOPEDIA-KNOWLEDGE-GRAPH.{md,pdf}`).
It 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 from `/workspace/technocapital-singularity-zoology` 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 Repository** (`/workspace/technocapital-singularity-zoology`) and this **Downstream Knowledge Graph Repository** (`/workspace/encyclopedia-knowledge-graph`):
| Repository & Layer | Canonical Files | Access Mode During Graph Build | Isolation Invariant |
| :--- | :--- | :--- | :--- |
| **Upstream Sibling Repo** (`/workspace/technocapital-singularity-zoology`) | `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 upstream glossary. |
| **Downstream Graph Repo** (`/workspace/encyclopedia-knowledge-graph`) | `index.html`, `graph-data.js`<br/>`encyclopedia-graph.json`<br/>`encyclopedia-graph.graphml`<br/>`encyclopedia-graph.gexf`<br/>`encyclopedia.canvas`<br/>`atlas-mode{1,2,3}.png` | **READ-WRITE (`w`)** | Rebuilt deterministically on demand whenever upstream encyclopedia or glossary registries are updated. |
---
## 2. Prerequisites, Dependencies & Pre-Flight Checklist
1. **Python 3.10+ & `requirements.txt`:**
- Core graph construction, centrality calculation, and JSON/GraphML/GEXF/Canvas exports use **100% Python 3.10+ standard library** (`json`, `hashlib`, `math`, `re`, `html`, `xml.etree.ElementTree`, `pathlib`, `argparse`).
- Rendering the three `1600x1060` visual atlas PNG boards and compiling PDF documentation uses `Pillow`, `reportlab`, `pypdf`, and `pdfplumber` (declared in `/workspace/encyclopedia-knowledge-graph/requirements.txt`).
2. **Upstream Sibling Repository Presence:**
Confirm that `/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json` and `/workspace/technocapital-singularity-zoology/encyclopedia/encyclopedia-manifest.json` exist on disk.
3. **Pre-Flight Isolation Baseline Check (`--check-isolation`):**
```bash
python3 /workspace/encyclopedia-knowledge-graph/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/encyclopedia-knowledge-graph/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 `/workspace/technocapital-singularity-zoology/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`) into `/workspace/encyclopedia-knowledge-graph/`.
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/encyclopedia-knowledge-graph/` at any time without rebuilding:
```bash
python3 /workspace/encyclopedia-knowledge-graph/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, equivalence ring members, and incident edges directly from the terminal using `--query-node <QUERY>`:
```bash
# 1. Query an Assemblage Build by ID
python3 /workspace/encyclopedia-knowledge-graph/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/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --query-node "125"
# 3. Query a Bilingual Lexical Specimen by English or Ingglish spelling
python3 /workspace/encyclopedia-knowledge-graph/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/encyclopedia-knowledge-graph/` directory remains untouched during testing:
```bash
python3 /workspace/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py --out-dir /tmp/kg-staging
```
---
## 4. Operating the Interactive Browser Workbench (`/workspace/encyclopedia-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, operators can open the workbench in two ways:
1. **Direct Local `file://` Open (Zero Server Required):**
Open `file:///home/m00t/hermes/workspace/encyclopedia-knowledge-graph/index.html` directly in Firefox, Chromium, or Brave.
2. **Local HTTP Server (Serving `/workspace` Parent Directory):**
```bash
python3 -m http.server 8090 --bind 127.0.0.1 --directory /workspace
```
Then navigate to `http://127.0.0.1:8090/encyclopedia-knowledge-graph/index.html`.
*(Note: Serving from `/workspace` allows the relative `../technocapital-singularity-zoology/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/encyclopedia-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.
2. **Obsidian Canvas (`JSON Canvas 1.0`):**
Copy or symlink `/workspace/encyclopedia-knowledge-graph/encyclopedia.canvas` into any Obsidian vault to browse the 282 core cards and 1,120 edges on an infinite 2D canvas.
---
## 6. Maintenance Protocol, First-Push Instructions & Troubleshooting Runbook
### 6.1 Rebuilding After Upstream Encyclopedia Updates
```bash
python3 /workspace/encyclopedia-knowledge-graph/scripts/build_encyclopedia_knowledge_graph.py
```
### 6.2 First Push to Remote `origin` (`push-to-origin.sh`)
To connect `/workspace/encyclopedia-knowledge-graph` to a remote Git host (GitHub, Forgejo/Gitea, or GitLab) and push `main` and tag `v1.0.0`:
```bash
# Option A: Use the bundled zero-ambiguity helper script (runs 6-gate verification before pushing)
/workspace/encyclopedia-knowledge-graph/push-to-origin.sh https://github.com/<org>/encyclopedia-knowledge-graph.git
# Option B: Manual Git commands
cd /workspace/encyclopedia-knowledge-graph
git remote add origin <REMOTE_GIT_URL>
git push -u origin main
git push origin v1.0.0
```
### 6.3 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 `/workspace/encyclopedia-knowledge-graph/` without `graph-data.js`. | Keep `index.html` and `graph-data.js` in `/workspace/encyclopedia-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 `/workspace/encyclopedia-knowledge-graph` instead of the parent `/workspace` directory, making `../technocapital-singularity-zoology/encyclopedia/` unreachable. | Start `python3 -m http.server 8090` with `--directory /workspace` (the parent workspace directory) or open `index.html` directly via `file://`. |
---
## 7. Operator Manual Write-Test-Edit Audit Log (`v1.0.0`)
During live verification of this manual against `/workspace/encyclopedia-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).