12 KiB
12 KiB
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:
- 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/*). - Zero New Bespoke REST Routes in
src/hyperstitionstud_io/mcp/rest.py: All new capabilities are registered inMCP_TOOLS_SCHEMA(src/hyperstitionstud_io/mcp/tools.py),STATIC_RESOURCES/RESOURCE_TEMPLATES(src/hyperstitionstud_io/mcp/resources.py), andMCP_PROMPTS(src/hyperstitionstud_io/mcp/prompts.py), so the existing generic/api/v1/tools/{tool_name},/api/v1/resources/{slug}, and/api/v1/openapi.jsonadapter exposes them automatically (0custom route patterns added torest.py). - 100% Read-Only &
ProtectSystem=strict(EROFS) Compliant (0LLM Tokens): Cold-rotated plans insidecompleted-plans-archive.tar.gzare extracted strictly in memory viatarfilewithout touching disk, and every new tool is automatically swept under simulatedProtectSystem=strict(EROFS) bysrc/hyperstitionstud_io/ci/erofs_harness.py.
- 100% Capability & Documentation Coverage Across All 6 Repositories: Every functional capability, quantitative/macro/Bayesian dataset, Guile Scheme
- 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& MCPtools/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, defaultTrue): Include the 3-column Homoiconic Tri-View (math_view,py_view,scm_expr, andchallenge) 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.
- Full live-introspected manifests (
2.2 hs_inspect_documentation_and_manuals
- Endpoint:
GET/POST /api/v1/tools/hs_inspect_documentation_and_manuals& MCPtools/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 insidecompleted-plans-archive.tar.gzin memory!),/learn/modules, and/quant/tutorial scenes /ⓘpopovers.include_full_markdown(boolean, defaultFalse): WhenTrue(or whendoc_idis 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, and27ⓘpopover definitions.
- Catalog of all documentation artifacts with canonical web PDF routes (
2.3 hs_evaluate_guile_scheme_z_calculus
- Endpoint:
GET/POST /api/v1/tools/hs_evaluate_guile_scheme_z_calculus& MCPtools/call - Parameters:
expression(string, default'(aq-base36 "LEMUR")'): S-expression to evaluate against the preloadedguile_prelude.scmenvironment (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, defaultTrue): Return step-by-stepβ-reductioncall trace.include_prelude_source(boolean, defaultFalse): Include the full canonicalpublishing/guile_prelude.scmsource code.
- Returns:
- Exact rational / symbolic result (
formatted), floating-point approximation (float_value),β-reductiontrace steps, and optionalguile_prelude.scmsource.
- Exact rational / symbolic result (
2.4 hs_query_workspace_catalog_and_release_state
- Endpoint:
GET/POST /api/v1/tools/hs_query_workspace_catalog_and_release_state& MCPtools/call - Parameters:
fts_query(string, default""): Optional SQLite FTS5 full-text search query acrossglossary_entries,kg_nodes, anddossiersin.cache/hyperstition-meta.db(with automatic read-only JSON fallback if the.cacheDB is absent).include_version_bump_heuristics(boolean, defaultTrue): Include the zero-tokencompute_programmatic_version_bump()(--explain-bump) report.include_baseline_and_telemetry(boolean, defaultTrue): Include the cached.cache/internal-test-baseline-latest.jsonsummary (erofs_protect_system_strict_audit, canary values,CIDv1map) andget_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):
urn:io:hyperstitionstud:resource:quant-timeseries(site/quant/quant-timeseries.json)urn:io:hyperstitionstud:resource:macro-indicators(site/quant/real-macro-indicators.json)urn:io:hyperstitionstud:resource:daily-brief(site/quant/daily-brief-latest.json)urn:io:hyperstitionstud:resource:engineering-manifest(site/engineering/engineering-manifest.json)urn:io:hyperstitionstud:resource:math-manifest(site/math/math-manifest.json)urn:io:hyperstitionstud:resource:archive-manifest(encyclopedia-knowledge-graph/docs/archive/archive-manifest.json)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-EXPOSUREis implemented first,chatbot.py(hs_ask_chatbot) can delegate documentation, manual, archived-plan,/engineering/,/math/,/learn/, Guile SchemeZ-combinator, and SQLite FTS5 queries directly to these 4 new MCP tools!
- When
- Automated Verification (
tests/test_core_suite.py&ci/erofs_harness.py):- Because
ci/erofs_harness.pydynamically iterates overMCP_TOOLS_SCHEMA, all 4 new tools are automatically tested under simulatedProtectSystem=strict(EROFS) on every test run. - Add explicit assertions in
tests/test_core_suite.pyverifying:hs_inspect_engineering_and_math_docsreturns allE0–E5andM0–M5units, Novice Prerequisite Ladders, and Guile cartridges,hs_inspect_documentation_and_manualsreads both live Operator's Manuals and cold-rotated.mdplans fromcompleted-plans-archive.tar.gzin memory underEROFS,hs_evaluate_guile_scheme_z_calculusevaluatesZ-combinator expressions and returns exact rationals +β-reductiontraces,hs_query_workspace_catalog_and_release_statereturns SQLite FTS5 search hits,--explain-bumpheuristics, and theEROFSbaseline receipt, andhs_compute_ipld_dag_json_cidsupports all 13 workspace registries.
- Because