Compare commits

...
2 Commits
10 changed files with 214 additions and 8 deletions

No files matched your search

@@ -0,0 +1,95 @@
# Plan: Comprehensive Exposure of All Workspace Capabilities, Compilers, Curricula & Documentation via MCP (`/mcp`) and Chatbot REST API (`/api/v1/*`) (`v2.2.1`)
- **Document ID:** `PLAN-COMPREHENSIVE-MCP-AND-CHATBOT-REST-API-CAPABILITY-EXPOSURE` (`v2.2.1`)
- **Roadmap Status:** **ACTIVE / READY**
- **Core Architectural & Governance Mandates:**
1. **100% Capability & Documentation Coverage Across All 6 Repositories:** Every functional capability, quantitative/macro/Bayesian dataset, Guile Scheme `Z`-combinator evaluator, programmatic SemVer/EROFS diagnostic, `/engineering/` (`E0–E5`) and `/math/` (`M0–M5`) explication hub/subpage, Novice Prerequisite Ladder, `/learn/` module, `/quant/` tutorial episode & `ⓘ` popover glossary, Operator's Manual, stakeholder proposal, active/deferred plan, and cold-rotated historical plan (`completed-plans-archive.tar.gz`) must be inspectable and queryable via both **MCP (`/mcp`)** and the **Chatbot OpenAPI 3.1.0 REST Adapter (`/api/v1/tools/*` & `/api/v1/resources/*`)**.
2. **Zero New Bespoke REST Routes in `src/hyperstitionstud_io/mcp/rest.py`:** All new capabilities are registered in `MCP_TOOLS_SCHEMA` (`src/hyperstitionstud_io/mcp/tools.py`), `STATIC_RESOURCES` / `RESOURCE_TEMPLATES` (`src/hyperstitionstud_io/mcp/resources.py`), and `MCP_PROMPTS` (`src/hyperstitionstud_io/mcp/prompts.py`), so the existing generic `/api/v1/tools/{tool_name}`, `/api/v1/resources/{slug}`, and `/api/v1/openapi.json` adapter exposes them automatically (`0` custom route patterns added to `rest.py`).
3. **100% Read-Only & `ProtectSystem=strict` (`EROFS`) Compliant (`0` LLM Tokens):** Cold-rotated plans inside `completed-plans-archive.tar.gz` are extracted strictly in memory via `tarfile` without touching disk, and every new tool is automatically swept under simulated `ProtectSystem=strict` (`EROFS`) by `src/hyperstitionstud_io/ci/erofs_harness.py`.
- **Target Modules & Files:**
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/mcp/tools.py`
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/mcp/resources.py`
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/mcp/prompts.py`
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/ci/erofs_harness.py`
- `/workspace/hyperstitionstudio-core/tests/test_core_suite.py`
---
## 1. Exhaustive Capability & Documentation Gap Audit (`v2.2.1`)
| Capability / Documentation Domain | Current State in `v2.2.1` | Gap Addressed by This Plan |
| :--- | :--- | :--- |
| **1. `/engineering/` (`E0–E5`) & `/math/` (`M0–M5`) Explication Hubs, Subpages & Novice Prerequisite Ladders** | Generated as static HTML/JSON in `site/engineering/` and `site/math/`, but **not** exposed via MCP tools or `/api/v1/*`. | Expose via new MCP tool **`hs_inspect_engineering_and_math_docs`** and static resources `engineering-manifest` & `math-manifest`. |
| **2. Guile Scheme & `Z`-Combinator Pedagogical Lens (`guile_prelude.scm` & S-Expression Evaluation)** | Runs in browser (`hs-guile-scheme-repl.js`), but cannot be evaluated or queried via MCP or Chatbot REST API. | Expose via new MCP tool **`hs_evaluate_guile_scheme_z_calculus`** (supporting exact rationals `p/q`, float conversion, `β-reduction` trace, and cartridge lookup) + resource `guile-prelude`. |
| **3. Operator's Manuals, Deployment Guides, Stakeholder Proposals & Specifications** | Stored as `.md`/`.pdf` files on disk (`OPERATORS-MANUAL-*`, `VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE`, `ONBOARDING-INGGLISH-AQ`, `proposal-*`, `specification-*`), but only `dossier:{01..71}` is readable via MCP. | Expose via new MCP tool **`hs_inspect_documentation_and_manuals`** (with keyword/passage search, full Markdown retrieval, and PDF deep-link URLs) and resource template `urn:io:hyperstitionstud:doc:{doc_slug}`. |
| **4. Cold-Rotated Completed Plans (`completed-plans-archive.tar.gz`) & Active/Deferred Roadmap Plans** | `76` completed `.md`/`.pdf` files in `encyclopedia-knowledge-graph/docs/archive/completed-plans-archive.tar.gz` + `5` in `zoology/docs/archive/` are indexed in `archive-manifest.json` but not queryable via API. | Expose in-memory `.tar.gz` plan listing and full `.md` extraction inside **`hs_inspect_documentation_and_manuals`** (`archive_rotator.py` in-memory `tarfile` reader — `0` disk writes, `EROFS`-safe). |
| **5. Interactive `/learn/` Curriculum (`Modules 1–6`) & `/quant/` Guided Tour (`5` Episodes) + `27` `ⓘ` Glossary Popovers** | Embedded in `site/learn/learn-app.js`, `site/quant/quant-tutorials.js`, and `site/quant/quant-app.js`, but not exposed via `/mcp` or `/api/v1/*`. | Expose structured `/learn/` curriculum modules, `/quant/` 5-episode tutorial scenes, and all `27` `QUANT_TERM_GLOSSARY` `ⓘ` definitions + PDF deep-links via **`hs_inspect_documentation_and_manuals`**. |
| **6. SQLite FTS5 Unified Catalog Search (`hyperstition-meta.db`), Programmatic Version Heuristics (`--explain-bump`) & `EROFS`/Baseline Audit State** | Implemented in `db/sqlite_meta.py`, `version_sync.py`, and `ci/public_regression.py`, but not exposed via MCP tools. | Expose via new MCP tool **`hs_query_workspace_catalog_and_release_state`**. |
| **7. IPLD `dag-json` (`0x0129`) `CIDv1` Registry Map (`hs_compute_ipld_dag_json_cid`)** | `reg_map` in `mcp/tools.py` only lists 7 v1 registries (`glossary-registry` .. `encyclopedia-graph`). | Expand `reg_map` to include `quant-timeseries`, `real-macro-indicators`, `daily-brief-latest`, `engineering-manifest`, `math-manifest`, and `archive-manifest` (`13` named registries total). |
---
## 2. Detailed Specification of the 4 New MCP / Chatbot REST Tools (`MCP_TOOLS_SCHEMA`)
### 2.1 `hs_inspect_engineering_and_math_docs`
- **Endpoint:** `GET/POST /api/v1/tools/hs_inspect_engineering_and_math_docs` & MCP `tools/call`
- **Parameters:**
- `domain` (`"all" | "engineering" | "math"`, default `"all"`): Select `/engineering/` (`E0–E5`), `/math/` (`M0–M5`), or both.
- `unit_filter` (`string`, default `""`): Optional unit ID or subpage slug (`"E0".."E5"`, `"M0".."M5"`, `"ciphers-and-phonetics"`, `"base36-algebra-and-primes"`, etc.).
- `include_guile_cartridges` (`boolean`, default `True`): Include the 3-column Homoiconic Tri-View (`math_view`, `py_view`, `scm_expr`, and `challenge`) for each unit.
- **Returns:**
- Full live-introspected manifests (`engineering-manifest.json` & `math-manifest.json`), algebraic conservation invariants, CLI scripts table, Novice Prerequisite Ladders (`expertise_level`, `prerequisites`, `public_resources`), subpage explication sections, and Guile Scheme cartridges.
### 2.2 `hs_inspect_documentation_and_manuals`
- **Endpoint:** `GET/POST /api/v1/tools/hs_inspect_documentation_and_manuals` & MCP `tools/call`
- **Parameters:**
- `category` (`"all" | "manuals" | "proposals_and_specs" | "active_and_deferred_plans" | "archived_plans" | "learn_and_tutorials" | "quant_glossary_popovers"`, default `"all"`).
- `doc_id` (`string`, default `""`): Optional document slug or plan ID (e.g. `"OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES"`, `"VPS-AND-GIT-OPERATOR-DEPLOYMENT-GUIDE"`, `"PLAN-LOCAL-SERVER-SIDE-WEB-CHATBOT-GUI"`, or any cold-archived plan like `"PLAN-HS-PDF-BUILD-DARK-MODE-AND-GLYPH-SANITIZATION"`).
- `search_query` (`string`, default `""`): Optional case-insensitive keyword or phrase to search across all manuals, plans (including inside `completed-plans-archive.tar.gz` in memory!), `/learn/` modules, and `/quant/` tutorial scenes / `ⓘ` popovers.
- `include_full_markdown` (`boolean`, default `False`): When `True` (or when `doc_id` is specified), returns the complete Markdown text of the matching document(s).
- **Returns:**
- Catalog of all documentation artifacts with canonical web PDF routes (`/graph/*.pdf`, `/quant/*.pdf`, `/zoology/*.pdf`, `/ci/*.pdf`), cold-archive manifest metadata (`bundle_sha256`, `member_count`), matched passages with line numbers, `/learn/` modules, `/quant/` tutorial scenes, and `27` `ⓘ` popover definitions.
### 2.3 `hs_evaluate_guile_scheme_z_calculus`
- **Endpoint:** `GET/POST /api/v1/tools/hs_evaluate_guile_scheme_z_calculus` & MCP `tools/call`
- **Parameters:**
- `expression` (`string`, default `'(aq-base36 "LEMUR")'`): S-expression to evaluate against the preloaded `guile_prelude.scm` environment (`Z`, `limit`, `derivative`, `nth-derivative`, `riemann-integral`, `adaptive-simpson`, `aq-base36`, `digital-root-mod9`, `prime-factors`, `variance-pop`, `eti-score`, `confluence-dose`, `bayes-update`, `evaluate-bump-scope`).
- `include_trace` (`boolean`, default `True`): Return step-by-step `β-reduction` call trace.
- `include_prelude_source` (`boolean`, default `False`): Include the full canonical `publishing/guile_prelude.scm` source code.
- **Returns:**
- Exact rational / symbolic result (`formatted`), floating-point approximation (`float_value`), `β-reduction` trace steps, and optional `guile_prelude.scm` source.
### 2.4 `hs_query_workspace_catalog_and_release_state`
- **Endpoint:** `GET/POST /api/v1/tools/hs_query_workspace_catalog_and_release_state` & MCP `tools/call`
- **Parameters:**
- `fts_query` (`string`, default `""`): Optional SQLite FTS5 full-text search query across `glossary_entries`, `kg_nodes`, and `dossiers` in `.cache/hyperstition-meta.db` (with automatic read-only JSON fallback if the `.cache` DB is absent).
- `include_version_bump_heuristics` (`boolean`, default `True`): Include the zero-token `compute_programmatic_version_bump()` (`--explain-bump`) report.
- `include_baseline_and_telemetry` (`boolean`, default `True`): Include the cached `.cache/internal-test-baseline-latest.json` summary (`erofs_protect_system_strict_audit`, canary values, `CIDv1` map) and `get_api_telemetry_summary()`.
---
## 3. Expanded MCP URN Resources (`src/hyperstitionstud_io/mcp/resources.py`)
Add 7 new static URN resources to `STATIC_RESOURCES` (all automatically accessible via `GET /api/v1/resources/{slug}` and MCP `resources/read`):
1. `urn:io:hyperstitionstud:resource:quant-timeseries` (`site/quant/quant-timeseries.json`)
2. `urn:io:hyperstitionstud:resource:macro-indicators` (`site/quant/real-macro-indicators.json`)
3. `urn:io:hyperstitionstud:resource:daily-brief` (`site/quant/daily-brief-latest.json`)
4. `urn:io:hyperstitionstud:resource:engineering-manifest` (`site/engineering/engineering-manifest.json`)
5. `urn:io:hyperstitionstud:resource:math-manifest` (`site/math/math-manifest.json`)
6. `urn:io:hyperstitionstud:resource:archive-manifest` (`encyclopedia-knowledge-graph/docs/archive/archive-manifest.json`)
7. `urn:io:hyperstitionstud:resource:guile-prelude` (`src/hyperstitionstud_io/publishing/guile_prelude.scm`, `text/x-scheme`)
---
## 4. Synergy with `PLAN-LOCAL-SERVER-SIDE-WEB-CHATBOT-GUI` & Verification Gates
- **Seamless Integration with `PLAN-LOCAL-SERVER-SIDE-WEB-CHATBOT-GUI`:**
- When `PLAN-COMPREHENSIVE-MCP-AND-CHATBOT-REST-API-CAPABILITY-EXPOSURE` is implemented first, `chatbot.py` (`hs_ask_chatbot`) can delegate documentation, manual, archived-plan, `/engineering/`, `/math/`, `/learn/`, Guile Scheme `Z`-combinator, and SQLite FTS5 queries directly to these 4 new MCP tools!
- **Automated Verification (`tests/test_core_suite.py` & `ci/erofs_harness.py`):**
- Because `ci/erofs_harness.py` dynamically iterates over `MCP_TOOLS_SCHEMA`, all 4 new tools are automatically tested under simulated `ProtectSystem=strict` (`EROFS`) on every test run.
- Add explicit assertions in `tests/test_core_suite.py` verifying:
- `hs_inspect_engineering_and_math_docs` returns all `E0–E5` and `M0–M5` units, Novice Prerequisite Ladders, and Guile cartridges,
- `hs_inspect_documentation_and_manuals` reads both live Operator's Manuals and cold-rotated `.md` plans from `completed-plans-archive.tar.gz` in memory under `EROFS`,
- `hs_evaluate_guile_scheme_z_calculus` evaluates `Z`-combinator expressions and returns exact rationals + `β-reduction` traces,
- `hs_query_workspace_catalog_and_release_state` returns SQLite FTS5 search hits, `--explain-bump` heuristics, and the `EROFS` baseline receipt, and
- `hs_compute_ipld_dag_json_cid` supports all 13 workspace registries.
@@ -0,0 +1,111 @@
# Plan: Lightweight Local Server-Side Web Chatbot GUI (`/chat/` & Dockable Widget) Powered by `hyperstition-mcp.service` & SQLite FTS5 at Zero (`0`) LLM Token Cost (`v2.2.0`)
- **Document ID:** `PLAN-LOCAL-SERVER-SIDE-WEB-CHATBOT-GUI` (`v2.2.0`)
- **Roadmap Status:** **ACTIVE / READY**
- **Core Architectural & Resource Mandates:**
1. **100% Local on the Web Host (`0` LLM Tokens, `0` External API Keys, `0` GPU RAM):**
Runs entirely inside the existing `hyperstition-mcp.service` Python daemon (`127.0.0.1:8095`) using a deterministic **Hybrid Intent Router + SQLite FTS5 BM25 Full-Text Retriever + 15-Tool MCP Orchestrator (`src/hyperstitionstud_io/mcp/chatbot.py`)**. Consumes `0` metered LLM tokens, `0` external API keys, `< 15 ms` CPU time per query, and `< 5 MB` RSS memory.
2. **Chatbot REST API Exclusivity (`0` New Bespoke REST Routes in `rest.py`):**
Exposes the server-side question-answering engine by registering **`hs_ask_chatbot`** in `MCP_TOOLS_SCHEMA` (`src/hyperstitionstud_io/mcp/tools.py`). The existing generic tool dispatcher in `src/hyperstitionstud_io/mcp/rest.py` automatically serves it at **`GET/POST /api/v1/tools/hs_ask_chatbot`** (and via MCP JSON-RPC `tools/call` on `/mcp`) with **`0` new custom route patterns** in `rest.py`.
3. **Strict Zero-Synthetic-Data & `ProtectSystem=strict` (`EROFS`) Compliance:**
Every answer is synthesized deterministically from verified server-side registries (`glossary-registry.json`, `encyclopedia-graph.json`, `quant-timeseries.json`, `real-macro-indicators.json`, `daily-brief-latest.json`, `hyperstition-meta.db` FTS5, and `72` archive dossiers). Missing/private/holiday fields report `"No data available"` (`null`), and `hs_ask_chatbot` is automatically swept under simulated `ProtectSystem=strict` (`EROFS`) by `src/hyperstitionstud_io/ci/erofs_harness.py`.
4. **Two-Script Deployment Invariant Preserved:**
All assets, symlinks (`/chat`), and tests are wired into `/workspace/push-all-to-git-libre-audio.sh` and `/workspace/hyperstitionstudio-core/deploy/sync-vps-repos.sh` so deployment requires no additional manual operator steps.
- **Target Modules & Web Surfaces:**
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/mcp/chatbot.py` (`answer_chatbot_query()` 8-intent router + SQLite FTS5 BM25 retriever + multi-tool orchestrator)
- `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/mcp/tools.py` (Registers `hs_ask_chatbot` in `MCP_TOOLS_SCHEMA`)
- `/workspace/hyperstitionstudio-core/site/assets/hs-chatbot-widget.js` (Lightweight `< 16 KB` dockable Group 3 Stealth Basalt chatbot drawer injected across `/`, `/quant/`, `/learn/`, `/engineering/*`, and `/math/*`)
- `/workspace/hyperstitionstudio-core/site/chat/index.html` (Full-screen split-pane `/chat/` Corpus & Telemetry Query Workbench with live JSON/CIDv1 & Stats-Card inspector)
- `/workspace/hyperstitionstudio-core/site/assets/hs-group3-basalt-chamfer.css` (Group 3 Stealth Basalt styling for `#hsChatbotToggleBtn`, `#hsChatbotDrawer`, and `/chat/`)
- `/workspace/hyperstitionstudio-core/deploy/{sync-vps-repos.sh,test-first-deployment.sh}` & `/workspace/hyperstitionstudio-core/tests/test_core_suite.py`
---
## 1. Local Server-Side Question-Answering Architecture (`src/hyperstitionstud_io/mcp/chatbot.py`)
When the browser sends a user question `q` to `POST /api/v1/tools/hs_ask_chatbot` (or `GET /api/v1/tools/hs_ask_chatbot?query=...`), `answer_chatbot_query(query, page_context, lens, include_card)` executes a deterministic 3-stage pipeline in `< 15 ms`:
```text
[User Question q in Browser]
│
▼ POST /api/v1/tools/hs_ask_chatbot (Caddy -> 127.0.0.1:8095 hyperstition-mcp.service)
┌───────────────────────────────────────────────────────────────────────────────────────────────┐
│ Stage 1: Deterministic Intent & Entity Extractor (Regex + Watchlist/Glossary/Coord Matcher) │
│ Extracts: ticker symbols (NVDA..ANTHR-PVT), AQ integers (1..999), FRED slugs (CPI..INDPRO), │
│ quoted phrases ("..."), and intent keywords (price, dose, card, macro, brief, define, aq). │
└───────────────────────────────────────────────┬───────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────────────────────────┐
│ Stage 2: Server-Side Tool & SQLite FTS5 Orchestration (100% Read-Only under EROFS) │
│ • Intent 1 (Ticker / Price / Dose / Stats Card) -> hs_inspect_quant_timeseries + cards.py │
│ • Intent 2 (Macro / Rates / CPI / M2 / GDP / Brief) -> hs_inspect_macro_indicators + brief │
│ • Intent 3 (Calculate AQ / Ingglish / Prime / Mod-9) -> hs_evaluate_aq_and_ingglish │
│ • Intent 4 (Define Term / S1-S6 / M1-M7 / G1-G6 / ETI) -> hs_search_glossary_encyclopedia │
│ • Intent 5 (Graph Node / Hub / Coordinate aq:N) -> hs_query_knowledge_graph │
│ • Intent 6 (333/666/777 Equations / News Dossier) -> hs_search_archive_equations │
│ • Intent 7 (Guile Scheme / Z-Combinator / Novice Track) -> guile_prelude + /learn/ ladder │
│ • Intent 8 (Open-Ended Question Fallback) -> SQLite FTS5 BM25 search across catalog tables │
└───────────────────────────────────────────────┬───────────────────────────────────────────────┘
│
▼
┌───────────────────────────────────────────────────────────────────────────────────────────────┐
│ Stage 3: Grounded Response Composer (Zero Hallucination, Full Citation & CIDv1 Provenance) │
│ Returns: { answer_markdown, summary_bullets, detected_intent, invoked_tools, │
│ citations: [{label, url}], stats_card_preview, data_available, ipld_cidv1 } │
└───────────────────────────────────────────────────────────────────────────────────────────────┘
```
### 1.1 Detailed Behavior of the 8 Server-Side Intent Handlers
| Intent ID | Example User Questions Answered Locally | Server-Side Data Sources Queried | Structured Output Returned to GUI |
| :--- | :--- | :--- | :--- |
| **`1. ticker_and_card`** | • *"What is NVDA's latest price and Confluence Dose?"*<br/>• *"Show me the stats card for SOL-USD"*<br/>• *"What is ANTHR-PVT's price?"* | `site/quant/quant-timeseries.json` + `quant/cards.py` (`35 ms` fast-path) | • Real close (`$135.40`), `change_bps`, `Vol20d`, `Dose 0..3+` taxon label, 6 TierZoo base stats, optional inline `900×1260` PNG card preview, and deep links to `/quant/` & `/graph/`.<br/>• For `ANTHR-PVT`: *"No market data available (private entity — 0 synthetic bars)."* |
| **`2. macro_and_regime_brief`** | • *"What are the current Fed rates and M2 spread?"*<br/>• *"What is today's Bayesian market regime and key question?"*<br/>• *"What is the latest CPI and PPI?"* | `site/quant/real-macro-indicators.json` + `site/quant/daily-brief-latest.json` | • Live 3-state Bayesian posteriors (`R1`, `R2`, `R3`), active Daily Key Macro Question $Q_t$, and exact FRED series values (`EFFR = 388 bps`, `SOFR = 398 bps`, `M2-M1 = $3.37T`, `GDP`, `CPI`, `PPI`) with native cadence metadata. |
| **`3. aq_and_ingglish_eval`** | • *"What is the AQ and Ingglish of 'abstract machine'?"*<br/>• *"Evaluate 'hyperstition'"* | `ciphers/aq.py` + `phonetics/__init__.py` (`4,943` offline CMUdict + fallback rules) + `encyclopedia-graph.json` | • `Gen 0` (`eng_aq`), `Gen 1` (`ing_aq` + Ingglish spelling), phonemic drift $\Delta$, prime rank $\pi(n)$, mod-9 digital root, and any matching specimens at that AQ coordinate. |
| **`4. glossary_and_zoology`** | • *"What is Vector G1?"*<br/>• *"Explain The Room Filter"*<br/>• *"What are the S+ Apex builds in the ETI tier list?"* | `taxonomy/glossary-registry.json` (`282` terms, `190` bilingual specimens) + `assemblage-builds-tier-list.json` | • Concise definition, ontological division (`Div 00–08`), verbatim grounded quote, ETI score, and clickable `#page=N&search=...` deep-link to `/zoology/technocapital-singularity-zoology-comprehensive-glossary.pdf`. |
| **`5. knowledge_graph_hub`** | • *"What connects to coordinate 292 or 666?"*<br/>• *"Inspect node aq:333"* | `encyclopedia-graph.json` (`388` nodes, `1,282` edges) | • Node type, degree centrality, incident `G1–G5` edges, guild membership, and `[ Open in /graph/?select=aq:N ]` deep-link. |
| **`6. archive_equations_and_news`** | • *"Show me archive equations that equal 333 or 666"*<br/>• *"What is in the latest news dossier?"* | `ingglish-aq-archive/01..72-*.md` | • Matching verified `Gen 1 [Ingglish] = 333/666/777` equations with dossier numbers and `/api/v1/dossiers/{N}?highlight=...` links. |
| **`7. guile_scheme_and_curriculum`** | • *"How does the Z combinator work in Guile Scheme?"*<br/>• *"Where should a novice start?"* | `publishing/guile_prelude.scm` + `engineering-manifest.json` + `math-manifest.json` | • Explains the `Z` combinator (`z-calculus-scheme`) or Novice Prerequisite Ladder, with links to `/learn/`, `/math/`, and `/engineering/`. |
| **`8. sqlite_fts5_fallback`** | • Any free-form question across the 6 repositories | `.cache/hyperstition-meta.db` (`sqlite_meta.py` FTS5 tables + JSON fallback) | • Top-ranked corpus matches with verbatim snippets and deep links (or explicit `"No matching corpus record found"` with `0` hallucination). |
---
## 2. Lightweight Group 3 Stealth Basalt Web Chatbot GUI (`site/assets/hs-chatbot-widget.js` & `/chat/index.html`)
### 2.1 Floating Dockable Widget Across All Primary Pages (`site/assets/hs-chatbot-widget.js`)
- **Header & Bottom-Left Launcher (`#hsChatbotToggleBtn`):**
- Styled in Group 3 Stealth Basalt (`10px/4px` `45°` chamfers, `34px` height, `#38bdf8` interactive border/pip, keyboard shortcut `Alt+K`).
- Does not eclipse or clutter any page: remains a single compact pill (`[ ◈ ASK CORPUS ]`) until clicked.
- **Interactive Drawer (`#hsChatbotDrawer`, `420 × 540 px`):**
- **Context-Aware Quick-Prompt Chips:** Displays 5 one-click starter questions tailored to the current page (`/`, `/quant/`, `/learn/`, `/engineering/*`, `/math/*`).
- **Instant Local Execution Badge:** Shows `0 LLM Tokens • Local Server-Side Engine (<15 ms) • CIDv1 Verified` in the drawer header.
- **Rich Answer Cards:**
- Formatted answer text + bulleted key metrics,
- Clickable deep-link pills (`Open in /quant/`, `Open in /graph/`, `Glossary PDF #page=N`),
- Inline `900×1260` `.png` Stats Card preview whenever a ticker card is queried,
- Collapsible `<details>` block showing the exact `/api/v1/tools/hs_ask_chatbot` JSON payload and IPLD `CIDv1` receipt.
### 2.2 Dedicated Full-Screen `/chat/` Workbench (`site/chat/index.html`)
- Accessible at `/chat/index.html` (with a navigation button added to `site/index.html` and the widget header `[ Expand Full /chat/ Workbench ↗ ]`).
- Provides a 2-column Group 3 Stealth Basalt layout:
- **Left Column (`60%`):** Full conversational Q&A history, categorized prompt library across all 8 intents (Watchlist Tickers, FRED Macro & Bayesian Brief, Base-36 & Ingglish Calculator, Glossary & Zoology, Knowledge Graph Hubs, 333/666/777 Archive Equations, Guile Scheme & Z-Calculus, and Novice Onboarding), and exportable `.json` transcript button.
- **Right Column (`40%`):** Live Server-Side Telemetry & Provenance Inspector displaying the triggered MCP tool chain, raw JSON response, IPLD `dag-json` `CIDv1` hash, and any rendered `900×1260` Ticker Stats Card PNG.
---
## 3. Test-Suite & Deployment Integration (`tests/test_core_suite.py`, `erofs_harness.py`, `sync-vps-repos.sh`)
1. **`src/hyperstitionstud_io/ci/erofs_harness.py`:**
- Because `hs_ask_chatbot` is registered in `MCP_TOOLS_SCHEMA` (bringing the total MCP tool count from `15` to `16`), `run_introspective_erofs_suite()` **automatically** sweeps `hs_ask_chatbot` under simulated `ProtectSystem=strict` (`EROFS`) with zero extra harness code!
2. **`tests/test_core_suite.py`:**
- Test `hs_ask_chatbot` across all 8 intent families via `dispatch_rest_v1("GET", "/api/v1/tools/hs_ask_chatbot?query=...")` and `POST /api/v1/tools/hs_ask_chatbot`:
- Verify `NVDA` ticker query returns real close `$135.40` and `data_available: True`,
- Verify `ANTHR-PVT` query returns `data_available: False` and `"No data available"` (`0` synthetic data),
- Verify FRED macro & Bayesian brief query returns `EFFR = 388 bps` and valid posterior simplex sum `== 1.0`,
- Verify AQ/Ingglish query on `"schizoanalysis"` returns `eng_aq = 264`, `ing_aq = 292`,
- Verify glossary query on `"Vector G1"` returns a valid `/zoology/technocapital-singularity-zoology-comprehensive-glossary.pdf#page=` deep-link.
- Verify `0` new bespoke routes were added to `rest.py` (all chatbot queries flow through `/api/v1/tools/hs_ask_chatbot` and `/mcp`).
3. **`deploy/sync-vps-repos.sh` & `deploy/test-first-deployment.sh`:**
- Add `${LIVE_SUDO} ln -sfn "hyperstitionstudio-core/site/chat" "${LIVE_REPOS}/chat"` to Step `[3/5]` of `deploy/sync-vps-repos.sh`.
- Add `/chat/index.html` and `/assets/hs-chatbot-widget.js` to `ROUTES=()` in `deploy/test-first-deployment.sh` and `hs-public-smoke` Gate `P1`/`P6`.
Binary file not shown.
@@ -120,7 +120,7 @@
<div class="pulse-dot"></div>
<h1>Cross-Repository Dependency Graph &amp; Auditable Build &rarr; Test &rarr; Stage_Commit Pipeline</h1>
</div>
<p class="subtitle">Sibling Repositories under /workspace: ingglish-hyperdope-gematria &bull; technocapital-singularity-zoology (v2.2.0) &bull; encyclopedia-knowledge-graph (v2.2.0)</p>
<p class="subtitle">Sibling Repositories under /workspace: ingglish-hyperdope-gematria &bull; technocapital-singularity-zoology (v2.2.2) &bull; encyclopedia-knowledge-graph (v2.2.2)</p>
</div>
<!-- Main SVG Diagram -->
Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 KiB

After

Width:  |  Height:  |  Size: 284 KiB

+1 -1
View File
@@ -2,7 +2,7 @@
"$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": "2.2.0",
"version": "2.2.2",
"encyclopedia_base_path": "../technocapital-singularity-zoology/encyclopedia",
"upstream_repository": "/workspace/technocapital-singularity-zoology",
"isolation_verified": {
+1 -1
View File
@@ -3,7 +3,7 @@ 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": "2.2.0",
"version": "2.2.2",
"encyclopedia_base_path": "../technocapital-singularity-zoology/encyclopedia",
"upstream_repository": "/workspace/technocapital-singularity-zoology",
"isolation_verified": {
+4 -4
View File
@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Encyclopedia of Technocapital Singularity Zoology — Interactive Knowledge Graph (v2.2.0)</title>
<title>Encyclopedia of Technocapital Singularity Zoology — Interactive Knowledge Graph (v2.2.2)</title>
<style>
:root {
--bg-canvas: #020617;
@@ -268,7 +268,7 @@
<header>
<div class="brand">
<h1>ENCYCLOPEDIA OF TECHNOCAPITAL SINGULARITY ZOOLOGY — INTERACTIVE KNOWLEDGE GRAPH</h1>
<p>Standalone Sibling Repository (/workspace/encyclopedia-knowledge-graph) • 388 Nodes • 1,282 Deduplicated Edges • Zero Glossary Leak &bull; v2.2.0</p>
<p>Standalone Sibling Repository (/workspace/encyclopedia-knowledge-graph) • 388 Nodes • 1,282 Deduplicated Edges • Zero Glossary Leak &bull; v2.2.2</p>
</div>
<div class="toolbar">
<button class="btn active" data-mode="mode2_radar">Mode 2: ETI Radar (S+ -> D Periphery)</button>
@@ -321,10 +321,10 @@
</aside>
</div>
<footer class="hs-global-footer" style="background:#1A1D26;border-top:1px solid #323846;padding:4px 14px;text-align:center;font-size:11px;color:#9BA3B8;z-index:20;">
<span class="hs-lemur-credit">hyperstitionstud.io/graph v2.2.0 &bull; Made with <span class="hs-heart" role="img" aria-label="love" style="color:#FB7185;display:inline-block;padding:0 2px;">&#x2665;</span> by Lemurs.</span>
<span class="hs-lemur-credit">hyperstitionstud.io/graph v2.2.2 &bull; Made with <span class="hs-heart" role="img" aria-label="love" style="color:#FB7185;display:inline-block;padding:0 2px;">&#x2665;</span> by Lemurs.</span>
</footer>
<script src="graph-data.js?v=2.2.0"></script>
<script src="graph-data.js?v=2.2.2"></script>
<script>
(function() {
const DATA = (window.HyperstitionStudio && window.HyperstitionStudio.EncyclopediaGraphData) || window.ENCYCLOPEDIA_GRAPH_DATA;
@@ -705,7 +705,7 @@ def build_graph(upstream_repo: Path = UPSTREAM_REPO_DEFAULT) -> dict[str, Any]:
"$schema": "./schemas/v1/encyclopedia-graph.schema.json",
"$id": URN_SCHEMA_GRAPH,
"namespace_urn": URN_GRAPH_NS,
"version": "2.2.0",
"version": "2.2.2",
"encyclopedia_base_path": "../technocapital-singularity-zoology/encyclopedia",
"upstream_repository": str(upstream_repo),
"isolation_verified": {