diff --git a/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.md b/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.md new file mode 100644 index 0000000..e613aa4 --- /dev/null +++ b/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.md @@ -0,0 +1,71 @@ +# Operator's Manual: LLM-Token-Dependent vs. Zero-Token Deterministic Parts of the `hyperstitionstud.io` Data Pipeline (`v2.0.29`) + +- **Document ID:** `OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES` (`v2.0.29`) +- **Canonical Locations:** + - `/workspace/encyclopedia-knowledge-graph/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.md` + - `/workspace/encyclopedia-knowledge-graph/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.pdf` +- **Core Operational Architecture (Post-`PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO`):** + 1. **Zero LLM Tokens & Zero API Keys on `hyperstitionstud.io`:** The public VPS web host (`hyperstitionstud.io`) stores **0 LLM/OpenRouter API keys** and runs **0 LLM-dependent jobs**. All VPS scheduled tasks (`21:30 UTC` Closing-Bell Harvest, `00:00 UTC` Rollover Refresh, and `00:20 UTC` CI Provisioning + Archive/SQLite Rotation) execute `100%` deterministic local Python and Bash scripts (`unset OPENROUTER_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY`). + 2. **Single Remaining Recurring LLM Cronjob on `localhost` (`d28b479ec217`):** Following the elimination of the two non-exegesis `localhost` Hermes cronjobs (`29c871eb6b78` and `7effa9679803`, saving `12` LLM agent cron runs per week / `-63%`), **`d28b479ec217` (`current-events-isopsephic-exegesis-daily-0000-gmt`) is the sole recurring job in the ecosystem that consumes metered LLM tokens.** + +--- + +## 1. Master Boundary Table: Metered LLM Surfaces (`localhost` Only) vs. Zero-Token VPS & CLI Surfaces + +| Pipeline Component / Cronjob / CLI | Execution Host & Surface | Metered LLM Token Cost | Role & Boundary Between Deterministic Code and LLM Exegesis | +| :--- | :--- | :---: | :--- | +| **1. `d28b479ec217` (`current-events-isopsephic-exegesis-daily-0000-gmt`, `00:00 UTC` / `19:00 EST` Daily)** | **`localhost` Only** (Hermes Agent Cron — **Sole Recurring LLM Cronjob**) | **METERED (`~15K–35K` tokens/run, `7` runs/wk)** | • **Step A (`0` tokens):** Runs `collect_news_aq.py` (`TZ=UTC`) to fetch Wikipedia `Portal:Current_events`, BBC RSS, and AP RSS, translate terms via Node `ingglish`, and compute `333/666/777` candidate equations.
• **Step B (Metered LLM Exegesis):** Selects the top 5–8 stories, writes the synchronic critical prose commentary ("exegesis") under Division `08` *"The Room Filter"*, writes `-dossier-news-YYYY-MM-DD.md`, and updates `00-index-and-methodology.md`.
• **Step C (`0` tokens, in-turn):** Runs `ci_provision_ingglish.py --tier 2 --apply-repo` deterministically at the end of the turn (replacing former job `7effa9679803`). | +| **2. Ad-Hoc Creative / Editorial Synthesis Skills** (`isopsephic-lecture-synthesis`, `isopsephic-wire-report-synthesis`, `technocapital-singularity-zoology`) | **`localhost` Only** (On-Demand Operator Chat Turn) | **METERED (`~15K–45K` tokens when invoked manually)** | • Invoked only when the operator explicitly asks to draft a new spoken lecture (`lecture-*-ingglish-aq.md`), wire report, thematic dossier, or podcast script (`Episodes 06–09`). Never scheduled via cron. | +| **3. Window A (`21:30 UTC` Mon–Fri): US Closing-Bell Market, FRED Macro & Bayesian Brief** | **`hyperstitionstud.io` VPS** (`hyperstition-closing-bell-harvest.timer` -> `deploy/run-vps-data-production.sh --window=us-closing-bell`)
*(Former `localhost` `29c871eb6b78` eliminated)* | **`0` METERED LLM TOKENS (`0` API Keys)** | • `100%` deterministic Python: `hs-quant-harvest --append-history --live`, `hs-macro-harvest` (`FRED` CSV), `quant/timeseries.py` (14-point `eng_aq`/`ing_aq` census & `Dose 0..3+`), `hs-daily-brief` (5-Agenda Bayesian update), `tmpfs` hydration, and `git.libre.audio` push. Eliminates `5` LLM cron runs/week. | +| **4. Window B (`00:00 UTC` Daily): Rollover Time-Series & Knowledge Graph Refresh** | **`hyperstitionstud.io` VPS** (`hyperstition-utc-rollover-harvest.timer` -> `deploy/run-vps-data-production.sh --window=utc-rollover`) | **`0` METERED LLM TOKENS (`0` API Keys)** | • `100%` deterministic Python: recomputes `timeseries.py`, `hs-daily-brief`, and `build_encyclopedia_knowledge_graph.py` (`388` nodes / `1,282` edges) and hydrates `tmpfs`. | +| **5. Window C (`00:20 UTC` Daily): CI Provisioning, Cold-Archive Rotation & SQLite Logrotate** | **`hyperstitionstud.io` VPS** (`/etc/cron.d/hyperstition-archive-rotate` & `hyperstition-archive-rotate.timer` -> `deploy/run-vps-archive-rotation.sh`)
*(Former `localhost` `7effa9679803` eliminated)* | **`0` METERED LLM TOKENS (`0` API Keys)** | • `100%` deterministic Python: runs `ci_provision_ingglish.py` (`--tier 2 --apply-repo`) + `generate_db_json.py`, `hs-archive-rotate` (`docs/archive/completed-plans-archive.tar.gz`), and `sqlite_meta --run-logrotate-directive` (`100M` `.1.gz`). Eliminates `7` LLM cron runs/week. | +| **6. All Other Compilers, Renderers & Verifiers** (`hs-pdf-build`, `hs-ticker-card`, `hs-eng-docs`, `hs-math-docs`, `hs-public-smoke`, `hs-mcp`) | Local / VPS Python CLI & `hyperstition-mcp.service` (`:8095`) | **`0` METERED LLM TOKENS (`0` API Keys)** | • `100%` local CPU execution: Dark-Mode PDFs, `900×1260` `.png+.json` Stats Cards, `/engineering/` & `/math/` introspection, and Gates `P1–P6` regression checks. | + +--- + +## 2. Operating the Sole Remaining LLM-Dependent Cronjob (`d28b479ec217` on `localhost`) + +### 2.1 Job Configuration (`cronjob_manage(action="list")`) +- **Job ID:** `d28b479ec217` (`current-events-isopsephic-exegesis-daily-0000-gmt`) +- **Schedule:** `0 19 * * *` (`19:00 EST` / `00:00 UTC` Daily on `localhost`) +- **Skills Loaded:** `["current-events-isopsephic-exegesis", "phonetic-and-gematria-ciphers", "hyperdope-ingglish-ci"]` +- **Continuity:** `True` (injects the prior run's output to deduplicate multi-day "Most Read" stories) +- **Single-Turn End-to-End Execution (No Chained Second Agent Job):** + Because `7effa9679803` is eliminated (`PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO`), `d28b479ec217` executes the deterministic `ci_provision_ingglish.py --tier 2 --apply-repo` command directly in `terminal` at the end of its own turn after saving `-dossier-news-YYYY-MM-DD.md`—avoiding a second LLM agent invocation and eliminating `context_from` race conditions and concurrent `HTTP 402` credit spikes altogether! + +--- + +## 3. Standard Operating Procedures (SOPs) + +### SOP 1: Running or Backfilling `d28b479ec217` for a Specific UTC Date (`YYYY-MM-DD`) on `localhost` +1. **Pre-Verify Headlines at `0` LLM Token Cost:** + ```bash + TZ=UTC python3 /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/scripts/collect_news_aq.py \ + --date YYYY-MM-DD \ + --out /workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/news-aq-harvest-YYYY-MM-DD.json + ``` +2. **Trigger `d28b479ec217` on `localhost`:** + ```text + cronjob_manage( + action="run", + job_id="d28b479ec217", + prompt="CRITICAL OVERRIDE: pass --date YYYY-MM-DD to collect_news_aq.py, write the dossier for YYYY-MM-DD, and run ci_provision_ingglish.py --tier 2 --apply-repo." + ) + ``` + +### SOP 2: What Happens If `localhost` Is Off or `d28b479ec217` Is Paused +- Because all market, FRED macro, time-series, Bayesian daily-brief, archive-rotation, and SQLite logrotate jobs run autonomously on `hyperstitionstud.io` via `systemd` timers and `/etc/cron.d/hyperstition-archive-rotate` (`0` LLM tokens, `0` API keys): + - **If `localhost` is asleep or `d28b479ec217` is paused**, `https://hyperstitionstud.io/quant/` continues updating its closing-bell market bars, FRED macro series, `Dose 0..3+` scores, and 5-Agenda Bayesian Daily Brief on schedule (`equation_counts` for any date without a news dossier simply serialize as `{"eq_333": null, "eq_666": null, "eq_777": null, "total": null}`, `"No data available"`). + - When `localhost` wakes up, `d28b479ec217` (`catch_up=True` default) backfills the missed UTC news dossier (`collect_news_aq.py` automatically checks `now_utc - 48h` before `now_utc - 24h`) and pushes to `git.libre.audio`, which the VPS pulls on its next `00:20 UTC` / `21:30 UTC` timer tick. + +--- + +## 4. Troubleshooting Reference for `d28b479ec217` (`localhost` Exegesis) + +| Symptom / Failure Mode | Root Cause | Exact Operator Remedy | +| :--- | :--- | :--- | +| **1. `collect_news_aq.py` returns `0` Wikipedia items at `00:00 UTC`** | At `00:00 UTC`, the newly started UTC day section on Wikipedia `Portal:Current_events` is still empty while `now_utc - 24h` holds the completed 24-hour global ledger; or `_` HTML entities in `id="2026_November_30"` were not unescaped. | `collect_news_aq.py` automatically targets `now_utc - 24h` (and checks `now_utc - 48h` for unarchived backfills) and runs `html.unescape()`. If running manually during afternoon UTC, pass `--date YYYY-MM-DD` explicitly. | +| **2. Foreground `terminal` timeout (`> 180s`) during `333/666/777` equation search** | The agent wrote a global 6-nested combinatorial loop across all 5–8 stories simultaneously (`> 600M` iterations). | Always partition vocabulary by story cluster (`<= 15` items per part of speech per story) so all clusters complete in `< 2s`. | +| **3. Node `ERR_MODULE_NOT_FOUND: Cannot find package 'ingglish'`** | The agent invoked `node --input-type=module -e 'import("ingglish")...'` from `/root` or `/workspace` instead of `/workspace/ingglish-hyperdope-gematria`. | Always pass `workdir="/workspace/ingglish-hyperdope-gematria"` (or use `python3 -c "from hyperstitionstud_io.phonetics import translate_batch..."` with `PYTHONPATH=/workspace/hyperstitionstudio-core/src`). | +| **4. `ci_provision_ingglish.py` Gate 2 drops an 8–9 word `666/777` equation as `long-scraped`** | Lines with `nw >= 15` total tokens (including `[Ingglish: ...]`) require `>= 40%` standard `/usr/share/dict/words` hits; equations packed with out-of-dictionary acronyms (`TSMC`, `ASML`, `NVDA`, `Dario`, `Amodei`) dip below `0.40`. | Pair proper-noun anchors in `666/777` equations with standard English nouns (`proof`, `grid`, `wafer`, `silicon`, `drone`, `laser`, `loss`) so `dict_hits / nw >= 0.45`. | +| **5. LLM invents or guesses an AQ sum or Ingglish spelling in prose** | Mental arithmetic by the LLM instead of copying deterministic script output. | Never allow mental AQ calculation: every `(word, ing, eng_aq, ing_aq, breakdown = 333/666/777)` printed in a dossier must be copied verbatim from `collect_news_aq.py` / `hyperstitionstud_io.ciphers.compute_aq()`, and verified afterward by `ci_provision_ingglish.py` Gate 4 (`aq_mismatches == 0`). | diff --git a/docs/archive/plan-interactive-knowledge-graph-encyclopedia.pdf b/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.pdf similarity index 52% rename from docs/archive/plan-interactive-knowledge-graph-encyclopedia.pdf rename to docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.pdf index 8d78c22..d1e9bc2 100644 Binary files a/docs/archive/plan-interactive-knowledge-graph-encyclopedia.pdf and b/docs/OPERATORS-MANUAL-LLM-TOKEN-DEPENDENT-DATA-PIPELINES.pdf differ diff --git a/docs/PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.md b/docs/PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.md deleted file mode 100644 index 3ed0102..0000000 --- a/docs/PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.md +++ /dev/null @@ -1,77 +0,0 @@ -# Plan: Rotating Completed Archives (`docs/archive/`) Into Compressed Cold-Storage Bundles (`.tar.gz`) to Economize Stylistic Refreshes, Revisions & Search Sweeps (`v2.0.28`) - -- **Document ID:** `PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER` (`v2.0.28`) -- **Roadmap Status:** **ACTIVE / READY** -- **Target Directories & Modules:** - - `/workspace/encyclopedia-knowledge-graph/docs/archive/` (`56` loose `.md`/`.pdf` files = `3,215,398` bytes -> compressed `completed-plans-archive.tar.gz` + `archive-manifest.json` + `README.md`) - - `/workspace/technocapital-singularity-zoology/docs/archive/` (`6` completed loose `.md`/`.pdf` files -> compressed `completed-plans-archive.tar.gz` + `archive-manifest.json`; moving the deferred `podcast-series-plan-encyclopedia-of-technocapital-singularity-zoology.{md,pdf}` for `Episodes 06–09` up to `technocapital-singularity-zoology/docs/` so `docs/archive/` holds strictly completed cold records) - - `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/archive_rotator.py` (`hs-archive-rotate` CLI & deterministic `.tar.gz` rotator) - - `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/pdf_compiler.py` (Excluding `docs/archive/` from `discover_web_and_repo_pdf_pairs()`) - - `/workspace/hyperstitionstudio-core/tests/test_core_suite.py` - ---- - -## 1. Problem Statement & Empirical Economy Analysis - -Currently, completed planning documents and historical audits are stored as **uncompressed loose `.md` and `.pdf` files** inside `/workspace/encyclopedia-knowledge-graph/docs/archive/` (`28` `.md` + `28` `.pdf` = `56` files, `3.22 MB`) and `/workspace/technocapital-singularity-zoology/docs/archive/` (`4` `.md` + `4` `.pdf` = `8` files, `351 KB`): - -| Overhead Dimension | Current Uncompressed Loose `docs/archive/` State | After Compressed `.tar.gz` Rotation & Archive Exclusion | Measured Savings | -| :--- | :--- | :--- | :---: | -| **1. Stylistic PDF Refreshes (`hs-pdf-build --refresh-all-web-pdfs`)** | `84` total `.md -> .pdf` compilations (`32` of which are historical `docs/archive/` files never linked from the web UI). | **`52` active/web-linked `.md -> .pdf` compilations** (`0` compilations inside `docs/archive/`). | **`-38.1%` fewer PDFs compiled** (`32` redundant PDF builds eliminated on every refresh) | -| **2. Repository Content Search (`search_files` / `rglob("*.md")`)** | Every content search or glob sweep scans `31` historical `.md` files (`~410,000` chars / `~128,000` BPE tokens of superseded specs), polluting search matches and context windows. | Loose `.md` and `.pdf` files are packed inside `completed-plans-archive.tar.gz`; only `docs/archive/README.md` and `archive-manifest.json` remain unpacked. | **`-100%` (`~128K` BPE tokens) of stale plan prose excluded from `search_files` & glob sweeps** | -| **3. Disk & `tmpfs` Webroot Footprint (`/var/www/hyperstitionstud.io/repos`)** | `3,566,151` bytes (`3.57 MB`) across `64` loose files (`128` files after `.gz`/`.br` pre-compression in `sync-vps-repos.sh`). | Single deterministic `completed-plans-archive.tar.gz` per `docs/archive/` directory + `README.md` + `archive-manifest.json` (and `sync-vps-repos.sh` `--exclude='docs/archive/*.tar.gz'`). | **`62` loose files consolidated into `2` cold `.tar.gz` bundles** | - ---- - -## 2. Boundary Guardrail: What Gets Rotated vs. What Must Never Be Compressed - -1. **Rotated Into Cold Storage (`docs/archive/completed-plans-archive.tar.gz`):** - - `/workspace/encyclopedia-knowledge-graph/docs/archive/*.{md,pdf}` (excluding `README.md`, which stays unpacked as the human-readable index). - - `/workspace/technocapital-singularity-zoology/docs/archive/*.{md,pdf}` (after moving the still-deferred `podcast-series-plan-encyclopedia-of-technocapital-singularity-zoology.{md,pdf}` for `Episodes 06–09` to `/workspace/technocapital-singularity-zoology/docs/` so no deferred plan is buried in cold storage). -2. **Never Rotated / Always Kept Live & Uncompressed:** - - `/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/dossiers/*.md` (`71` verified dossiers & `21` dated `00:00 UTC` news-wire dossiers served live at `/archive/*` and `/api/v1/dossiers/{number}` and ingested by `timeseries.py` and `sqlite_meta.py`). - - All 22 Encyclopedia PDF volumes (`/workspace/technocapital-singularity-zoology/encyclopedia/00..08/*.{md,pdf}`) and top-level `/zoology/*.{md,pdf}` manuals/proposals. - - Active and long-term deferred plans in top-level `/workspace/encyclopedia-knowledge-graph/docs/PLAN-*.{md,pdf}`. - ---- - -## 3. Architecture of `hyperstitionstud_io.publishing.archive_rotator` (`hs-archive-rotate`) - -### 3.1 Deterministic `.tar.gz` Rotation & Manifest Schema (`docs/archive/archive-manifest.json`) - -The new module `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/archive_rotator.py` (registered in `pyproject.toml` as `hs-archive-rotate = "hyperstitionstud_io.publishing.archive_rotator:main"`) implements: - -1. **`rotate_docs_archive_directory(archive_dir: Path) -> dict[str, Any]`:** - - If `completed-plans-archive.tar.gz` already exists in `archive_dir`, extracts its existing members into a temporary staging directory first so newly archived `.md`/`.pdf` files are **merged** into the bundle without losing any previously rotated files. - - Collects all loose `*.md` (except `README.md`) and `*.pdf` files in `archive_dir`. - - Writes a deterministic gzip-compressed tarball `completed-plans-archive.tar.gz` (`gzip.GzipFile(mtime=0)`, sorted member names, normalized `TarInfo` permissions `0644` and `mtime=0` so identical contents always produce the exact same SHA-256 digest). - - Writes `archive_dir / "archive-manifest.json"` recording: - - `bundle_filename`: `"completed-plans-archive.tar.gz"`, - - `bundle_size_bytes` and `bundle_sha256`, - - `member_count` and `total_uncompressed_bytes`, - - `members`: sorted array of `{name, size_bytes, sha256}` for every `.md` and `.pdf` stored inside the `.tar.gz` archive. - - Unlinks the loose `.md` (except `README.md`) and `.pdf` files from `archive_dir` only after verifying that every member in `archive-manifest.json` can be read back from `completed-plans-archive.tar.gz` with matching SHA-256 digests. -2. **Inspection & On-Demand Extraction CLI (`hs-archive-rotate`):** - - `hs-archive-rotate`: Rotates any loose `.md`/`.pdf` files in `encyclopedia-knowledge-graph/docs/archive/` and `technocapital-singularity-zoology/docs/archive/` into their `completed-plans-archive.tar.gz` bundles. - - `hs-archive-rotate --list`: Lists all members and SHA-256 hashes from `archive-manifest.json`. - - `hs-archive-rotate --extract --out-dir `: Extracts a specific historical `.md` or `.pdf` on demand without unpacking the rest of the archive. - -### 3.2 Hardening `discover_web_and_repo_pdf_pairs()` in `src/hyperstitionstud_io/publishing/pdf_compiler.py` -- Update `discover_web_and_repo_pdf_pairs()` to explicitly skip any path whose parent directory is named `archive` (`if "archive" in p.parts: continue`), guaranteeing that even before `hs-archive-rotate` runs, `hs-pdf-build --refresh-all-web-pdfs` **never** wastes cycles recompiling archived documents. - ---- - -## 4. Three-Phase Implementation Roadmap (`Phases 1–3`) - -### Phase 1: Build `src/hyperstitionstud_io/publishing/archive_rotator.py` & Update `pdf_compiler.py` -1. Create `/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/archive_rotator.py` implementing `rotate_docs_archive_directory()`, `rotate_all_docs_archives()`, `list_archive_members()`, and `extract_archive_member()`. -2. Register `hs-archive-rotate = "hyperstitionstud_io.publishing.archive_rotator:main"` in `pyproject.toml`. -3. Update `discover_web_and_repo_pdf_pairs()` in `src/hyperstitionstud_io/publishing/pdf_compiler.py` to exclude `/docs/archive/` paths. - -### Phase 2: Relocate Deferred Podcast Plan & Rotate Both `docs/archive/` Directories -1. Move `/workspace/technocapital-singularity-zoology/docs/archive/podcast-series-plan-encyclopedia-of-technocapital-singularity-zoology.{md,pdf}` (`Episodes 06–09` deferred plan) up to `/workspace/technocapital-singularity-zoology/docs/` so it remains an accessible deferred plan outside cold storage. -2. Archive `PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.{md,pdf}` into `/workspace/encyclopedia-knowledge-graph/docs/archive/`, update `docs/archive/README.md`, and run `hs-archive-rotate` across both repositories so all loose historical `.md` and `.pdf` files in `docs/archive/` are rotated into `completed-plans-archive.tar.gz` + `archive-manifest.json`. - -### Phase 3: Update Skill Procedure & Verify in `tests/test_core_suite.py` -1. Update `hyperstitionstudio-roadmap-and-release` (`SKILL.md` Procedure 3: Archiving Completed Plans) so archiving a completed plan moves the `.md`/`.pdf` pair into `docs/archive/`, updates `docs/archive/README.md`, and runs `hs-archive-rotate` to fold the pair into `completed-plans-archive.tar.gz`. -2. Add unit assertions in `tests/test_core_suite.py` verifying that `docs/archive/completed-plans-archive.tar.gz` and `docs/archive/archive-manifest.json` exist, contain `0` loose `.pdf` files in `docs/archive/`, and that `discover_web_and_repo_pdf_pairs()` returns `0` paths inside `docs/archive/`. diff --git a/docs/PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.pdf b/docs/PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.pdf deleted file mode 100644 index 6be1cb7..0000000 Binary files a/docs/PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.pdf and /dev/null differ diff --git a/docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.md b/docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.md new file mode 100644 index 0000000..cf7bbb0 --- /dev/null +++ b/docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.md @@ -0,0 +1,66 @@ +# Plan: Scheduled Archive Rotation Cronjob (`00:20 UTC` / `19:20 EST` Daily) on `hyperstitionstud.io` — Coordinating `hs-archive-rotate` (`docs/archive/*.tar.gz`) & Quiescent SQLite Telemetry Rotation Across `/etc/cron.d/`, `systemd` Timers & Hermes Cron (`v2.0.29`) + +- **Document ID:** `PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO` (`v2.0.29`) +- **Roadmap Status:** **ACTIVE / READY** +- **Strict Zero-LLM-Token / Zero-API-Key VPS Mandate:** + **No cronjob or timer requiring metered LLM tokens or an LLM/OpenRouter API key will ever run on `hyperstitionstud.io`.** All scheduled jobs installed on the `hyperstitionstud.io` VPS (`/etc/cron.d/hyperstition-archive-rotate`, `hyperstition-archive-rotate.{service,timer}`, `hyperstition-closing-bell-harvest.{service,timer}`, `hyperstition-utc-rollover-harvest.{service,timer}`, and `/etc/logrotate.d/hyperstition-sqlite-meta`) execute **100% deterministic, keyless local Python and Bash scripts (`0` LLM tokens, `0` API keys)** and explicitly `unset OPENROUTER_API_KEY OPENAI_API_KEY ANTHROPIC_API_KEY`. All LLM-token-dependent agent cronjobs remain strictly on `localhost`. +- **Target Schedule (`00:20 UTC` / `19:20 EST` Daily — Window C on `hyperstitionstud.io` VPS Only):** + Runs daily at `00:20 UTC` via `/etc/cron.d/hyperstition-archive-rotate` (and `hyperstition-archive-rotate.timer`) on the `hyperstitionstud.io` web host. +- **Target Modules & Deployment Files:** + - `/workspace/hyperstitionstudio-core/deploy/cron.d/hyperstition-archive-rotate` (Installed to `/etc/cron.d/hyperstition-archive-rotate` by `deploy/sync-vps-repos.sh` Step 5) + - `/workspace/hyperstitionstudio-core/deploy/hyperstition-archive-rotate.{service,timer}` (`systemd` timer unit for `00:20:00 UTC` daily execution on `hyperstitionstud.io`) + - `/workspace/hyperstitionstudio-core/deploy/run-vps-archive-rotation.sh` (Flock-guarded, zero-`/dev/null`, zero-API-key wrapper script executing `hs-archive-rotate`, `sqlite_meta --run-logrotate-directive`, `tmpfs` sync when loose files were rotated, and optional `git.libre.audio` push) + +--- + +## 1. Unified Daily Cron Topology (`21:30 UTC` -> `00:00 UTC` -> `00:20 UTC`) + +With `29c871eb6b78` and `7effa9679803` decommissioned under `PLAN-MIGRATE-PERIODIC-DATA-PRODUCTION-FROM-LOCALHOST-TO-VPS` (leaving `d28b479ec217` as the sole `localhost` exegesis cronjob), `PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO` is scoped strictly to **Window C (`00:20 UTC` Cold-Archive & SQLite Telemetry Rotation on `hyperstitionstud.io`)**: + +| Window | Schedule (`UTC` / `EST`) | Execution Surface & Unit Name | What It Executes | Metered LLM Token Cost | +| :---: | :--- | :--- | :--- | :---: | +| **Window A** | `21:30 UTC` / `16:30 EST` (`Mon–Fri`) | • **VPS `hyperstition-closing-bell-harvest.timer`**
*(Implemented in `PLAN-MIGRATE-PERIODIC-DATA-PRODUCTION-FROM-LOCALHOST-TO-VPS`; `29c871eb6b78` decommissioned)* | US Closing-Bell Financial (`hs-quant-harvest --append-history --live`), FRED Macro (`hs-macro-harvest`), 14-point `timeseries.py`, 5-Agenda Bayesian `hs-daily-brief`, `tmpfs` RAM hydration, & `git.libre.audio` push. | **`0` LLM tokens & `0` API keys** | +| **Window B** | `00:00 UTC` / `19:00 EST` (`Daily`) | • **`localhost` Hermes `d28b479ec217`** *(Sole Remaining LLM Cronjob)*
• **VPS `hyperstition-utc-rollover-harvest.timer`** *(Implemented in `PLAN-MIGRATE-PERIODIC-DATA-PRODUCTION-FROM-LOCALHOST-TO-VPS`; `7effa9679803` decommissioned)* | • **`localhost` (`d28b479ec217`):** LLM-assisted narrative exegesis prose synthesis for `-dossier-news-YYYY-MM-DD.md`.
• **VPS (`00:00 UTC` timer):** Deterministic `ci_provision_ingglish.py --tier 2`, `timeseries.py`, `hs-daily-brief`, and `build_encyclopedia_knowledge_graph.py`. | Metered **only** on `localhost` `d28b479ec217`; **`0` tokens on VPS** | +| **Window C**
*(This Plan — VPS Archive Rotation Only)* | **`00:20 UTC` / `19:20 EST` (`Daily`)** | • **VPS `/etc/cron.d/hyperstition-archive-rotate`**
• **VPS `hyperstition-archive-rotate.timer`** | 1. Explicitly unsets `OPENROUTER_API_KEY`, `OPENAI_API_KEY`, `ANTHROPIC_API_KEY` (`0` API keys).
2. Runs `hs-archive-rotate` (`publishing.archive_rotator`): rotates any loose completed `docs/archive/*.{md,pdf}` pairs (`require_companion_md=True`) into `completed-plans-archive.tar.gz` + `archive-manifest.json` while enforcing `assert_not_gematria_pipeline_source()` and `verify_gematria_pipeline_richness_invariant()`.
3. Runs `python3 -m hyperstitionstud_io.db.sqlite_meta --run-logrotate-directive`: checks `/var/lib/hyperstitionstud.io/api-telemetry.db` against the `100M` limit and performs quiescent `BEGIN EXCLUSIVE` `.1.gz` compression + truncation when `>= 100M`.
4. If loose `docs/archive/` files were rotated, refreshes `/var/www/hyperstitionstud.io/repos` (`tmpfs` RAM) via `sync-vps-repos.sh --no-pull --no-caddy`. | **`0` LLM tokens & `0` API keys** (`100%` local Python/Bash on VPS) | + +--- + +## 2. Specification of the Three Coordinated Components + +### 2.1 Flock-Guarded Execution Script (`deploy/run-vps-archive-rotation.sh`) +- Contains **`0` `/dev/null` redirections**, uses `set -euo pipefail`, `trap 'on_error ${LINENO}' ERR`, and `run_checked()`, and acquires `/tmp/hyperstition-vps-harvest.lock` via `flock -n 9` so it never collides with `run-vps-data-production.sh` or `sync-vps-repos.sh`. +- Executes: + 1. `python3 -m hyperstitionstud_io.publishing.archive_rotator` (`hs-archive-rotate`), verifying `gematria_richness_invariant_verified == true` (`0` gematria/dossier/lexicon/graph/quant/calc files ever touched; standalone `.pdf`s with `has_md == False` preserved). + 2. `python3 -m hyperstitionstud_io.db.sqlite_meta --run-logrotate-directive` on `/var/lib/hyperstitionstud.io/api-telemetry.db` (or `$HYPERSTITION_TELEMETRY_DB_PATH`). + 3. Checks if `git status -s` in `encyclopedia-knowledge-graph` or `technocapital-singularity-zoology` shows newly rotated `docs/archive/` files; if so, runs `deploy/sync-vps-repos.sh --no-pull --no-caddy` to remove the unlinked loose files from `/var/www/hyperstitionstud.io/repos` (`tmpfs` RAM) and (when `/etc/hyperstitionstud.io/id_ed25519_git_libre_audio` is present) commits and pushes the updated `completed-plans-archive.tar.gz` and `archive-manifest.json` to `git.libre.audio`. + +### 2.2 VPS System Cron & `systemd` Timer (`deploy/cron.d/hyperstition-archive-rotate` & `deploy/hyperstition-archive-rotate.{service,timer}`) +1. **`/workspace/hyperstitionstudio-core/deploy/cron.d/hyperstition-archive-rotate`:** + ```cron + # /etc/cron.d/hyperstition-archive-rotate — Daily 00:20 UTC Cold-Archive & SQLite Telemetry Rotation + SHELL=/bin/bash + PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + 20 0 * * * root /srv/hyperstitionstud.io/repos/hyperstitionstudio-core/deploy/run-vps-archive-rotation.sh >> /var/log/hyperstition-archive-rotate.log 2>&1 + ``` + Installed idempotently to `/etc/cron.d/hyperstition-archive-rotate` (`chmod 0644`) in Step `[5/5]` of `deploy/sync-vps-repos.sh` (right alongside `/etc/logrotate.d/hyperstition-sqlite-meta`). +2. **`/workspace/hyperstitionstudio-core/deploy/hyperstition-archive-rotate.{service,timer}`:** + Provides the matching `systemd` timer (`OnCalendar=*-*-* 00:20:00 UTC`, `Persistent=true`) installed by `deploy/sync-vps-repos.sh` Step `[5/5]`. + +### 2.3 Strict Host & Plan Scope Boundary (`PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO` Is Scoped Strictly to Archive Rotation) +- **Why `29c871eb6b78` & `7effa9679803` Decommissioning Belonged to `PLAN-MIGRATE-PERIODIC-DATA-PRODUCTION-FROM-LOCALHOST-TO-VPS`:** + - Decommissioning the two non-exegesis `localhost` data-production cronjobs (`29c871eb6b78` and `7effa9679803`) is the source-decommissioning half of `PLAN-MIGRATE-PERIODIC-DATA-PRODUCTION-FROM-LOCALHOST-TO-VPS` (`deploy/run-vps-data-production.sh`), and has now been executed directly as part of that migration (`cronjob_manage(action="remove")` on `29c871eb6b78` and `7effa9679803`, leaving `d28b479ec217` as the sole `localhost` exegesis cronjob). +- **Scoped Responsibility of `PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO`:** + - This plan is responsible **solely** for daily `00:20 UTC` cold-archive rotation (`hs-archive-rotate`) and SQLite telemetry logrotate (`sqlite_meta --run-logrotate-directive`) on `hyperstitionstud.io` via `/etc/cron.d/hyperstition-archive-rotate`, `deploy/hyperstition-archive-rotate.{service,timer}`, and `deploy/run-vps-archive-rotation.sh` (`0` LLM tokens, `0` API keys). + +--- + +## 3. Test-Suite Appropriateness Analysis & Guardrails + +1. **Appropriate for `tests/test_core_suite.py` (Offline & Deterministic):** + - Assert that `deploy/run-vps-archive-rotation.sh`, `deploy/cron.d/hyperstition-archive-rotate`, `deploy/hyperstition-archive-rotate.service`, and `deploy/hyperstition-archive-rotate.timer` exist on disk, contain `0` `/dev/null` redirections, and specify `20 0 * * *` / `00:20:00 UTC`. + - Assert that `deploy/sync-vps-repos.sh` installs `/etc/cron.d/hyperstition-archive-rotate` and `hyperstition-archive-rotate.{service,timer}` in Step `[5/5]`. + - Execute `deploy/run-vps-archive-rotation.sh --skip-hydrate --no-push` in `test_core_suite.py` (using a temporary telemetry DB path) to verify end-to-end execution of `hs-archive-rotate` + `sqlite_meta --run-logrotate-directive` with `0` errors. +2. **Appropriate for `deploy/test-first-deployment.sh`:** + - Verify that `sync-vps-repos.sh --no-pull` installs `/etc/cron.d/hyperstition-archive-rotate` when `/etc/cron.d` is writable, and that `run-vps-archive-rotation.sh --skip-hydrate --no-push` exits `0`. +3. **Inappropriate for Test Suites (Excluded):** + - Never wait on a live cron tick or require a running `crond`/`systemd` daemon inside `tests/test_core_suite.py`. diff --git a/docs/archive/PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO.pdf b/docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.pdf similarity index 62% rename from docs/archive/PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO.pdf rename to docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.pdf index 1404734..ed9d6ba 100644 Binary files a/docs/archive/PLAN-COMMON-LIBRARY-HYPERSTITIONSTUDIO.pdf and b/docs/PLAN-CRONJOB-ARCHIVE-ROTATION-ON-HYPERSTITIONSTUD-IO.pdf differ diff --git a/docs/archive/ASSESSMENT-IPLD-DAG-JSON-CODEC-INTEGRATION.md b/docs/archive/ASSESSMENT-IPLD-DAG-JSON-CODEC-INTEGRATION.md deleted file mode 100644 index 2ddbd77..0000000 --- a/docs/archive/ASSESSMENT-IPLD-DAG-JSON-CODEC-INTEGRATION.md +++ /dev/null @@ -1,103 +0,0 @@ -# Technical Assessment: Integrating the IPLD `dag-json` Codec (`0x0129`) Across the `hyperstitionstud.io` JSON Data Ecosystem - -- **Document ID:** `ASSESSMENT-IPLD-DAG-JSON-CODEC-INTEGRATION` (`v2.0.0`) -- **Codec Specification:** IPLD `dag-json` (`multicodec 0x0129`) + `sha2-256` (`multihash 0x12`) + `CIDv1` Base32 (`baguqeera...`) -- **Evaluated Scope:** All 8 JSON registries in `technocapital-singularity-zoology`, `encyclopedia-graph.json` and `graph-data.js` in `encyclopedia-knowledge-graph`, `db.json` and `db_lite.json` in `haiperdohp-jemaytreeah`, and `ReadOnlyIsolationGuard` in `hyperstitionstudio-core` (`hyperstitionstud_io.*`). - ---- - -## 1. Executive Summary - -Integrating the **IPLD `dag-json` codec** (`multicodec 0x0129`, paired with `SHA-256` `multihash 0x12` and `CIDv1` `{"/": "baguqeera..."}` content-addressed links) aligns directly with the `hyperstitionstud.io` architecture. Because the workspace already enforces `SHA-256` immutability gates, offline-first `URN:` identifiers (`urn:io:hyperstitionstud:*`), and a multi-repository directed acyclic graph (`DAG`) of dependencies, adopting `dag-json` upgrades existing JSON artifacts into a cryptographically linked **Merkle DAG** while remaining `100%` valid RFC 8259 JSON readable by standard browser `JSON.parse()`, Python `json.loads()`, and `jq`. - ---- - -## 2. Five Core Architectural Benefits - -### 2.1 Deterministic Canonical Serialization (Eliminating Formatting-Induced Hash Drift) -- **Current Limitation:** - `ReadOnlyIsolationGuard` hashes raw file bytes (`hashlib.sha256(path.read_bytes())`). A non-semantic change in indentation (`indent=2` vs. minified), key ordering, or trailing newline alters the file's SHA-256 digest even when the underlying data model is identical (which previously required a separate normalized-JSON forensic audit). -- **How `dag-json` Solves It:** - The `dag-json` specification mandates a single deterministic byte representation for any IPLD Data Model object: - 1. Map/object keys are sorted deterministically by UTF-8 byte sequence (RFC 8949 / IPLD canonical ordering), - 2. All insignificant whitespace is omitted (`separators=(",", ":")`), - 3. Non-portable IEEE-754 tokens (`NaN`, `Infinity`, `-Infinity`, `-0.0`) are rejected, and - 4. Strings are encoded in canonical UTF-8 without arbitrary `\uXXXX` escape variations. -- **Result:** Any two runtimes (Python `hyperstitionstud_io` and browser JavaScript `window.HyperstitionStudio`) serializing the same in-memory structure always produce the **exact same byte stream, the exact same `SHA-256` digest, and the exact same `CIDv1`**. - -### 2.2 First-Class Merkle-DAG Provenance Links (`{"/": ""}`) Across Repositories -- **Current Limitation:** - `encyclopedia-graph.json` records upstream provenance via custom string fields (`"glossary_registry_sha256_pre": "7564ef40fb3e..."` and `"encyclopedia_manifest_sha256_pre": "0d7ce833bb0a..."`). -- **How `dag-json` Upgrades Provenance:** - In `dag-json`, cross-artifact references are represented as native **IPLD Links**: - ```json - { - "upstream_glossary": {"/": "baguqeera..."}, - "upstream_encyclopedia": {"/": "baguqeera..."} - } - ``` - Because a `dag-json` `CIDv1` consists of the 4-byte multicodec/multihash prefix (`0x01` `CIDv1` + `0x8002`/`0x0129` `dag-json` varint + `0x12` `sha2-256` + `0x20` 32-byte length) followed immediately by the raw **32-byte SHA-256 digest** (encoded in lowercase RFC 4648 Base32 with multibase prefix `b` -> `baguqeera...`), every `CIDv1` is **100% mathematically reversible to and from our existing SHA-256 baseline locks** while turning all 8 JSON registries and `encyclopedia-graph.json` into a verifiable Merkle DAG. - -### 2.3 Constant-Time `O(1)` Sub-Graph Diffing for `M7+` Two-Run (`Run N -> Run N+1`) Nucleation -- **Current Limitation:** - In `technocapital-singularity-zoology`, detecting whether an emergent `M7_candidate` or an `S1–S6` equivalence ring changed between daily `00:00 GMT` wire harvests requires traversing nested dictionaries and lists. -- **How `dag-json` Solves It:** - When each assemblage build (`build:S1..Q0`), AQ coordinate hub (`aq:71..777`), and lexical specimen (`spec:*`) is canonicalized as a `dag-json` block with its own `CIDv1`, any unchanged node or equivalence ring retains the exact same CID across runs. Cross-run persistence checking (`Run N -> Run N+1`) and incremental graph rebuilds reduce to `O(1)` CID comparisons. - -### 2.4 100% Standard RFC 8259 JSON Compatibility in Browser (`file://`) and CLI (`jq`) -- Unlike binary `dag-cbor` (`multicodec 0x71`), which requires a CBOR decoder library in the browser and cannot be inspected directly with standard text tools, `dag-json` is **strictly valid UTF-8 JSON**. -- Consequently: - - ``. -- Because ` +