Files
hyperstitionstudio-core/docs/PLAN-SPECIFICATION-AND-GOVERNANCE-STANDARD.md
T

9.2 KiB
Raw Blame History

Global Plan Specification, Operational Governance & Flexibility Standard

Document ID: PLAN-SPECIFICATION-AND-GOVERNANCE-STANDARD
Plan Reference: PLAN-QUANT-PRE-MARKET-OPEN-DAILY-BRIEF-AND-REGIME-CADENCE (Plan #72)
Scope: Architectural planning, technical project management, release lifecycle governance, and operational execution across all 6 hyperstitionstud.io repositories.


1. Purpose & Foundational Invariants

This standard formalizes the operational and architectural planning methodology across the hyperstitionstud.io ecosystem to ensure that all project management deliverables are legible, understandable, and comprehensively sound.

Core Invariants

  1. Strict Planning vs. Implementation Boundary: When asked to plan, the deliverable is strictly the architectural planning artifact (.md and compiled Dark-Mode ReportLab .pdf under docs/plans/active/ or docs/plans/piecewise/, plus references/roadmap-plan-ledger.md), never unverified production code, partial stubs, or uncommitted working tree mutations.
  2. First-Resort Infrastructure Audit: Existing automation infrastructure (systemd timers, cron rules, collector modules, cache tables) must be evaluated and prioritized before proposing net-new services or files. Creating new services or cron files is strictly a last resort.
  3. Comprehensive Lifecycle Scope: Every plan must address end-to-end downstream impacts: data pipeline integrity, state archiving, single-layer (1x) compression, git repository commit cadence, and deployment script readiness (DEPLOY-GATE-D01.MIRROR_PARITY through DEPLOY-GATE-D08.PRE_COMMIT_STAGE).
  4. Disambiguated Prose & Comments: All shorthand references in prose and comments must comply with <PREFIX><NN>.<DOMAIN_TAG> (e.g., PANEL-P06.DAILY_BRIEF, REGIME-R01.BULL_RISK_ON), while executable code remains globally exempt.
  5. Dual-Artifact Delivery: Every active or piecewise plan is authored as version-controlled Markdown and immediately compiled to an offline-accessible Dark-Mode PDF via hs-pdf-build.

2. Three-Tier Flexibility Protocol ("Strict by Default, Flexible on Demand")

To provide institutional rigor without creating bureaucratic bottlenecks during rapid prototyping or ad-hoc analysis, planning follows a 3-tier flexibility protocol:

Planning Tier Selection Model
+----------------------------------------------------------------------------------------------------+
| Tier 1: Standard Production Architectural Plan [DEFAULT]                                           |
| Trigger: "plan to ...", "architect ...", or standard feature/release requests                      |
| Scope: Full 8-section specification, Dark-Mode PDF, ledger entry, VPS audit, gates, rollout         |
| Target: docs/plans/active/PLAN-<SLUG>.{md,pdf} or docs/plans/piecewise/PLAN-<SLUG>.{md,pdf}        |
+----------------------------------------------------------------------------------------------------+
                                                 |
                                     (If explicitly requested)
                                                 v
+----------------------------------------------------------------------------------------------------+
| Tier 2: Lightweight Tactical Memo [EXPLICIT OVERRIDE]                                              |
| Trigger: "lightweight plan", "brief plan", "memo: ...", "draft outline only"                       |
| Scope: Focused 1–2 page technical delta, core trade-offs, and verification commands                |
| Skips: Full VPS infrastructure audit, compression analysis, PDF compilation (unless requested)     |
| Target: docs/plans/active/PLAN-<SLUG>.md or inline CLI delivery                                    |
+----------------------------------------------------------------------------------------------------+
                                                 |
                                     (If explicitly requested)
                                                 v
+----------------------------------------------------------------------------------------------------+
| Tier 3: Exploratory Scratchpad / Spike [EXPLICIT OVERRIDE]                                         |
| Trigger: "spike:", "scratchpad:", "throwaway spike:", "ad-hoc exploration:"                         |
| Scope: Unformatted notes, quick spikes, throwaway experiment scripts                               |
| Invariants: Written strictly to /workspace/untracked/; 0 ledger entries; 0 git commits              |
+----------------------------------------------------------------------------------------------------+

Protocol Rules

  • Default Behavior: The agent always operates at Tier 1 unless an explicit prompt marker matches Tier 2 or Tier 3.
  • Override Handling: When an override is requested, the agent acknowledges the lighter tier in a single line (e.g., [Tier 2 Lightweight Memo requested; skipping PDF compilation and VPS scheduling audit]) and proceeds immediately with the focused delta.

3. Mandatory Sections for Tier 1 Production Architectural Plans

Tier 1 Production Plans must contain the following standard sections:

1. Document Metadata & Header

  • Document ID: PLAN-<TOPIC-SLUG>
  • Status: ACTIVE (docs/plans/active/) or PIECEWISE (docs/plans/piecewise/)
  • Target Ecosystem Version: vX.Y.Z (with baseline)
  • Target Repositories: Specific repository slugs
  • Target Surfaces: Affected web routes, CLI tools, or background timers
  • Web Route: Canonical public HTTPS URL for the compiled companion PDF
  • Author & Date

2. Operational Objective & Motivation

  • Plain-statement summary of the deliverable.
  • Domain motivation and measurable delta (e.g., information asymmetry advantage, memory reduction, latency bounds).

3. Existing Infrastructure Audit & Scheduling Hierarchy

  • Exhaustive audit of all existing automation surfaces (timers, cron, modules).
  • Explicit 3-stage candidate hierarchy:
    • Strategy A (First Resort): Maximally reuses existing units (e.g., multi-calendar systemd timer).
    • Strategy B (Second Resort): Reuses existing files (e.g., cron multiplexing).
    • Strategy C (Strict Last Resort): Dedicated net-new services/files, evaluated only if A and B are blocked.

4. Data Pipeline Integrity & Transactional Rollback Safety

  • End-to-end data flow: Harvesters -> Compilers -> Verification -> RAM Hydration -> Push.
  • Zero-synthetic-data compliance (PLAN-GATE-G01.EXTANT_DATA).
  • Transactional rollback on verification failure (git checkout -- . without touching tmpfs).

5. Archiving & Historical Ledger Evolution

  • Ledger format, storage path, and schema definition.
  • Deduplication semantics and session-window discrimination (session_window).
  • Retention window capacity and quiescent SQLite compaction (sqlite_meta.py --compress-archive).

6. Compression Standards & Optimization Guarantees

  • Single-Layer (1x) Compression Invariant (PLAN-SINGLE-LAYER-COMPRESSION-ENFORCEMENT-AND-MULTI-COMPRESSED-FILE-REMEDIATION).
  • Webroot pre-compression (.gz via gzip -9 and .br via brotli -q 11).
  • Server-side bundle size caps (--max-bundle-kb 256).

7. Git Repository Commit Cadence & Telemetry Reconciliation

  • Automated commit frequency and commit message templates (chore(telemetry): ...).
  • Gating: commits occur strictly when git diff --cached detects substantive changes.
  • Lossless telemetry reconciliation (DEPLOY-GATE-D04.LOSSLESS_TELEMETRY via --snapshot-telemetry and --reconcile-telemetry).

8. Stepwise Verification Gates & Acceptance Criteria

  • Tabulated binary verification gates with explicit command-line invocations.

9. Implementation Rollout Sequence

  • Phased, non-breaking rollout steps.

4. 5-Tier Plan Classification & Lifecycle Hierarchy

Plans reside in designated filesystem locations under encyclopedia-knowledge-graph/docs/plans/:

Tier Classification Filesystem Directory PDF Compilation Policy
Tier 1 Active Non-Piecewise docs/plans/active/ Mandatory Dark-Mode .pdf
Tier 2 Fully Affirmed Piecewise docs/plans/piecewise/ Mandatory Dark-Mode .pdf
Tier 3 Partially Affirmed Piecewise docs/plans/piecewise/ Mandatory Dark-Mode .pdf
Tier 4 Pending Audit Piecewise docs/plans/piecewise/ Mandatory Dark-Mode .pdf
Tier 5.1 Retained Inactive / Deferred docs/plans/inactive/ Zero PDF compilation/recompilation
Tier 5.2 Cold-Archived Inactive docs/plans/inactive/inactive-plans-archive.tar.gz Zero PDF; manifests record SHA-256
Tier 5.3 Cold-Archived Completed docs/archive/completed-plans-archive.tar.gz .md-only tarball; manifest records SHA-256

5. Automated Plan Verification (hs-plan-lint)

The plan specification validator (hyperstitionstud_io.ci.plan_validator) enforces:

  1. Every .md in docs/plans/active/ and docs/plans/piecewise/ has a matching .pdf in the same directory.
  2. Every active and piecewise plan has an entry in references/roadmap-plan-ledger.md.
  3. All mandatory metadata fields (Document ID:, Status:, Target Ecosystem Version:, Target Repositories:) are present.
  4. Shorthands comply with hs-shorthand-lint.
  5. No bare container host paths are serialized.