6.8 KiB
6.8 KiB
PLAN: Ecosystem-Wide Efficiency, Deduplication, Optimization & Simplification (Audit Points 1–6 Affirmed, Rule C Piecewise Specification)
Document ID: PLAN-PIECEWISE-CODEBASE-MODULARITY-DEFERRED-STRATEGIES
Status: ACTIVE / FULLY AFFIRMED PIECEWISE (docs/plans/piecewise/ — 6/6 AUDIT POINTS AFFIRMED: 1A, 2A, 3A, 4A, 5A, 6A)
Companion Deferred Strategies Plan: docs/plans/inactive/PLAN-PIECEWISE-CODEBASE-MODULARITY-DEFERRED-CANDIDATE-STRATEGIES.md
Parent Plan: PLAN-PIECEWISE-CODEBASE-MODULARITY-DEDUPLICATION-AND-RESOURCE-ECONOMIZATION (v2.12.0)
Target Ecosystem Version: v2.18.0 (Baseline: v2.17.0 + working tree)
Target Repositories: All 6 repositories (hyperstitionstudio-core, ingglish-hyperdope-gematria, technocapital-singularity-zoology, encyclopedia-knowledge-graph, haiperdohp-jemaytreeah, hyperdope-ci-build)
Author: m00t & Hermes Agent
Date: 2026-12-01
1. Fixed Architectural Constraints & Four Binary Gates (PLAN-GATE-G01..G04)
- Fixed Constraint 1 (6-Repo Separation): Keep all
6peer Git repositories distinct. - Fixed Constraint 2 (
task-routerDisciplinary Separation): Keep Tier 1 deterministic zero-token code cleanly partitioned by domain (phonetics/,ciphers/+ipld/+lenses/,quant/,graph/,publishing/,ci/,mcp/,db/) and preservehaiperdohp-jemaytreeahupstream patch compatibility. - Fixed Constraint 3 (Zero Broken Functionality): Preserve all
20hs-*CLI entrypoints,20MCP/OpenAPI 3.1 tools,63Caddy routes, Fedora 41 RPM (ingglish-isopsephic-exegesis),ReadOnlyIsolationGuardSHA-256 locks, andtests/test_core_suite.py(7/7suites). - Binary Gates:
PLAN-GATE-G01.EXTANT_DATA,PLAN-GATE-G02.ZERO_LLM,PLAN-GATE-G03.EROFS_SAFE,PLAN-GATE-G04.EXPORTABLE.
2. Affirmed Deliverables Across Audit Points 1–6 (Rule C.4)
Audit Point 1 — [AFFIRMED: Strategy 1A] Explication HTML/Nav/Subpage Template Engine (publishing/explication_template.py)
- Create
src/hyperstitionstud_io/publishing/explication_template.py(render_explication_nav_html(),render_explication_hub_page_html(),render_explication_subpage_html(),write_explication_site_bundle()) and refactorengineering_docs.py(841lines) andmath_docs.py(650lines) to delegate their shared Group 3 (UI-G03.BASALT_CHAMFER) HTML/nav/subpage/bundle rendering while keeping all domain specs, cartridges, manifests, and public signatures 100% intact (~-290duplicate lines).
Audit Point 2 — [AFFIRMED: Strategy 2A] Cross-Repo Script, Wrapper, Media & Quant Split Deduplication
- Script Single Source of Truth + Clean RPM Staging: Keep
ingglish-aq-archive/scripts/*canonical; replace the9mirrored copies (~4,128lines) inpackaging/bundle/scripts/andpackaging/bundle/skills/*/scripts/with ~25-line self-locatingrunpy/JS wrappers; updatebuild-fedora41-rpm.shto copy canonical scripts directly into${STAGE_TOP}/SOURCES/(so tracked wrappers never get overwritten dirty on RPM builds); updatetest_core_suite.py(L1331–1335) to assert wrapper delegation + canonical script integrity; delegatecompute_aq()&safe_urlopen()insynthesize_news_dossier_openrouter.pywhenhyperstitionstud_iois importable. - Cross-Repo Media & Disabled Demo Cleanup (
-83.9 MB): Remove the5byte-identicallecture-podcast-ep01..05-*-ingglish-aq.{mp3,md}duplicates (83.14 MB) fromingglish-hyperdope-gematria(canonical home:technocapital-singularity-zoology/podcast-ep01..05-*) and prune duplicatememe_2_memegen_awkward_moment_seal_id_ams.png(747 KB) from disabledsite/gallery/media/demos/. - Disciplinary Quant Consolidation (
site/quant/): Movefinancial-aq-harvest-latest.jsonanddaily-brief-state.jsonfromingglish-hyperdope-gematria/intohyperstitionstudio-core/site/quant/(updatingcollector.py,daily_brief.py,readme_sync.py,tests/test_core_suite.py) and retire the redundant 20-linecollect_financial_quant_aq.pyshim (hs-quant-harvestis canonical), keeping/archive/Caddy routes (25..73-dossier-news-*.md&10..19-ledger-*.md) intact.
Audit Point 3 — [AFFIRMED: Strategy 3A] Shared Workspace Helpers, Stat Line Cache & Read-Only JSON Fast-Path (config/__init__.py)
- Add
CANONICAL_SIX_REPOS,resolve_workspace_repo_dir(),normalize_workspace_relpath(),run_git_stdout(), and(resolved_path, st_mtime_ns, st_size)-memoizedcount_file_lines_cached()toconfig/__init__.py; remove duplicate_norm_ws_path(deploy_scripts_sync.py,archive_rotator.py),_git_out/_git_run(readme_sync.py,version_sync.py), and uncacheddb.txtscans (archive_rotator.py,closeups_sync.py); audit read-onlyload_json_cached()callers to passcopy_result=False(eliminating1.5 MBdeepcopyoverhead).
Audit Point 4 — [AFFIRMED: Strategy 4A] Eliminate 25+ Uncached JSON Reads & Per-Font rglob Walks (core/src)
- Replace repeated
json.loads(p.read_text())reads acrossmath_docs.py(x5),quant/timeseries.py(x2),quant/daily_brief.py,quant/macro.py,quant/collector.py,db/sqlite_meta.py,publishing/quant_voice.py(L396),publishing/highlights.py(L47),publishing/closeups_sync.py,ci/doctor.py,ci/citation_sources.py,ci/public_regression.py, andmcp/tools.pywithload_json_cached(..., copy_result=False), and replace per-font/usr/share/fontsrglobcalls inpublishing/fonts.pywith a single@lru_cachefont-filename index map.
Audit Point 5 — [AFFIRMED: Strategy 5A] Bounded Pillow Typography (publishing/fonts.py) & Zero-Churn flow_diagram.py Digest Skip
- Promote
fit_pillow_text_to_width(),draw_bounded_box_text(), anddraw_bounded_kv_row()out ofcloseups_sync.py(1,021lines) intopublishing/fonts.py, reuse them acrosscloseups_sync.py,flow_diagram.py, andquant/cards.py(verify_closeup_geometry()invariants 100% preserved), and embed a deterministichs_diagram_sha256PNGtEXtchunk inflow_diagram.pysorender_periodic_harvest_cicd_flow_diagram_png(if_changed=True)skips rewriting the285 KBPNG when inputs and version are unchanged.
Audit Point 6 — [AFFIRMED: Strategy 6A] Path-Aware .git/hooks/pre-commit & Push Deduplication (push-all-to-git-libre-audio.sh, readme_sync.py)
- Update
PRE_COMMIT_HOOK_SCRIPTinreadme_sync.pysocloseups_syncanddeploy_scripts_synconly run when staged files affect their respective surfaces (falling back cleanly to--checkor skipping irrelevant repos), and remove duplicate pre-test subprocess calls inpush-all-to-git-libre-audio.shthattests/test_core_suite.pyalready enforces in-process (keepingversion_sync --corpus-delta,build-fedora41-rpm.sh,run_exegesis_and_push_fedora41.sh --dry-run,test_core_suite.py, andbuild_encyclopedia_knowledge_graph.py --verify-only).