9.1 KiB
9.1 KiB
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/(56loose.md/.pdffiles =3,215,398bytes -> compressedcompleted-plans-archive.tar.gz+archive-manifest.json+README.md)/workspace/technocapital-singularity-zoology/docs/archive/(6completed loose.md/.pdffiles -> compressedcompleted-plans-archive.tar.gz+archive-manifest.json; moving the deferredpodcast-series-plan-encyclopedia-of-technocapital-singularity-zoology.{md,pdf}forEpisodes 06–09up totechnocapital-singularity-zoology/docs/sodocs/archive/holds strictly completed cold records)/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/archive_rotator.py(hs-archive-rotateCLI & deterministic.tar.gzrotator)/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/pdf_compiler.py(Excludingdocs/archive/fromdiscover_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
- Rotated Into Cold Storage (
docs/archive/completed-plans-archive.tar.gz):/workspace/encyclopedia-knowledge-graph/docs/archive/*.{md,pdf}(excludingREADME.md, which stays unpacked as the human-readable index)./workspace/technocapital-singularity-zoology/docs/archive/*.{md,pdf}(after moving the still-deferredpodcast-series-plan-encyclopedia-of-technocapital-singularity-zoology.{md,pdf}forEpisodes 06–09to/workspace/technocapital-singularity-zoology/docs/so no deferred plan is buried in cold storage).
- Never Rotated / Always Kept Live & Uncompressed:
/workspace/ingglish-hyperdope-gematria/ingglish-aq-archive/dossiers/*.md(71verified dossiers &21dated00:00 UTCnews-wire dossiers served live at/archive/*and/api/v1/dossiers/{number}and ingested bytimeseries.pyandsqlite_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:
rotate_docs_archive_directory(archive_dir: Path) -> dict[str, Any]:- If
completed-plans-archive.tar.gzalready exists inarchive_dir, extracts its existing members into a temporary staging directory first so newly archived.md/.pdffiles are merged into the bundle without losing any previously rotated files. - Collects all loose
*.md(exceptREADME.md) and*.pdffiles inarchive_dir. - Writes a deterministic gzip-compressed tarball
completed-plans-archive.tar.gz(gzip.GzipFile(mtime=0), sorted member names, normalizedTarInfopermissions0644andmtime=0so 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_bytesandbundle_sha256,member_countandtotal_uncompressed_bytes,members: sorted array of{name, size_bytes, sha256}for every.mdand.pdfstored inside the.tar.gzarchive.
- Unlinks the loose
.md(exceptREADME.md) and.pdffiles fromarchive_dironly after verifying that every member inarchive-manifest.jsoncan be read back fromcompleted-plans-archive.tar.gzwith matching SHA-256 digests.
- If
- Inspection & On-Demand Extraction CLI (
hs-archive-rotate):hs-archive-rotate: Rotates any loose.md/.pdffiles inencyclopedia-knowledge-graph/docs/archive/andtechnocapital-singularity-zoology/docs/archive/into theircompleted-plans-archive.tar.gzbundles.hs-archive-rotate --list: Lists all members and SHA-256 hashes fromarchive-manifest.json.hs-archive-rotate --extract <filename> --out-dir <dir>: Extracts a specific historical.mdor.pdfon 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 namedarchive(if "archive" in p.parts: continue), guaranteeing that even beforehs-archive-rotateruns,hs-pdf-build --refresh-all-web-pdfsnever 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
- Create
/workspace/hyperstitionstudio-core/src/hyperstitionstud_io/publishing/archive_rotator.pyimplementingrotate_docs_archive_directory(),rotate_all_docs_archives(),list_archive_members(), andextract_archive_member(). - Register
hs-archive-rotate = "hyperstitionstud_io.publishing.archive_rotator:main"inpyproject.toml. - Update
discover_web_and_repo_pdf_pairs()insrc/hyperstitionstud_io/publishing/pdf_compiler.pyto exclude/docs/archive/paths.
Phase 2: Relocate Deferred Podcast Plan & Rotate Both docs/archive/ Directories
- Move
/workspace/technocapital-singularity-zoology/docs/archive/podcast-series-plan-encyclopedia-of-technocapital-singularity-zoology.{md,pdf}(Episodes 06–09deferred plan) up to/workspace/technocapital-singularity-zoology/docs/so it remains an accessible deferred plan outside cold storage. - Archive
PLAN-ARCHIVE-ROTATION-AND-COMPRESSION-ECONOMIZER.{md,pdf}into/workspace/encyclopedia-knowledge-graph/docs/archive/, updatedocs/archive/README.md, and runhs-archive-rotateacross both repositories so all loose historical.mdand.pdffiles indocs/archive/are rotated intocompleted-plans-archive.tar.gz+archive-manifest.json.
Phase 3: Update Skill Procedure & Verify in tests/test_core_suite.py
- Update
hyperstitionstudio-roadmap-and-release(SKILL.mdProcedure 3: Archiving Completed Plans) so archiving a completed plan moves the.md/.pdfpair intodocs/archive/, updatesdocs/archive/README.md, and runshs-archive-rotateto fold the pair intocompleted-plans-archive.tar.gz. - Add unit assertions in
tests/test_core_suite.pyverifying thatdocs/archive/completed-plans-archive.tar.gzanddocs/archive/archive-manifest.jsonexist, contain0loose.pdffiles indocs/archive/, and thatdiscover_web_and_repo_pdf_pairs()returns0paths insidedocs/archive/.