============================================================
AGLA WIKI DEPLOYMENT PROTOCOL
Version: 1.0.0-STATIC-HTML-MIRROR
Status: ACTIVE
Date: 2026-05-01
Authority: AGLA / DEPLOYMENT CONTROL
============================================================

PURPOSE
------------------------------------------------------------

Define the repeatable process for generating and updating the
AGLA_WIKI static HTML mirror.

AGLA_WIKI is a navigable documentation mirror of the project. It
is intended to work like a plain wiki that can be opened locally
or hosted as static files.


============================================================
OUTPUT IDENTITY
============================================================

Output kind:

    AGLA_WIKI

Output root:

    00_DEPLOYMENT/02_HTML_MIRROR

Entry page:

    00_DEPLOYMENT/02_HTML_MIRROR/index.html

Folder tree:

    00_DEPLOYMENT/02_HTML_MIRROR/tree.html

Manifest:

    00_DEPLOYMENT/02_HTML_MIRROR/mirror_manifest.json

Generator:

    00_DEPLOYMENT/GENERATE_HTML_MIRROR.ps1


============================================================
SCOPE
============================================================

AGLA_WIKI mirrors project-readable artifact files:

    - Markdown files (*.md)
    - JSON files (*.json)

Excluded from source scan:

    - the generated HTML mirror output root itself
    - desktop.ini

Rule:

    AGLA_WIKI is not the same output as the deployable chat
    kernel package.

    The chat kernel package is runtime/deployment constrained.
    AGLA_WIKI is a documentation mirror and may include
    development-only documentation when it exists in the project.


============================================================
PAGE MODEL
============================================================

For each mirrored artifact, generate one HTML page under:

    00_DEPLOYMENT/02_HTML_MIRROR/pages

Each artifact page must include:

    - link back to Project Index
    - link back to Folder Tree
    - source-relative artifact path
    - bytes
    - SHA-256
    - page section anchors derived from visible headings
    - backlink list for artifacts that reference the current page
    - preformatted source content with hyperlink insertion


============================================================
LINK MODEL
============================================================

AGLA_WIKI links artifacts using static relative links.

Recognized references:

    - full relative paths ending in .md or .json
    - unique bare filenames ending in .md or .json

Rules:

    Full relative paths have priority.

    Bare filename links are created only when the filename is
    unique in the mirrored project.

    Ambiguous bare filenames remain plain text.

    All links must be hostable as static files without server-side
    processing.


============================================================
UPDATE MODEL
============================================================

AGLA_WIKI updates by full rebuild.

On every generation:

    1. Scan the project for eligible artifact files.
    2. Exclude the existing HTML mirror output root.
    3. Build a current artifact registry.
    4. Resolve path links and unique filename links.
    5. Compute backlinks.
    6. Rewrite index.html.
    7. Rewrite tree.html.
    8. Rewrite every current artifact page.
    9. Remove stale generated artifact pages whose sources no
       longer exist.
    10. Rewrite mirror_manifest.json.

Rule:

    The generator must be rerunnable without manual cleanup.


============================================================
SCALABILITY RULES
============================================================

AGLA_WIKI must remain scalable by preserving these constraints:

    - one artifact maps to one HTML page
    - generated pages are filesystem-addressable
    - links are relative, not absolute local machine paths
    - the mirror excludes itself from scanning
    - stale pages are cleaned on rebuild
    - manifest records page href, byte count, and SHA-256
    - CSS remains inline and minimal
    - no JavaScript is required for navigation
    - no server-side process is required to browse the mirror

If artifact volume grows substantially, the same protocol remains
valid because pages are generated independently and can be hosted
as static files.


============================================================
VALIDATION
============================================================

After generation, validate:

    - index.html exists
    - tree.html exists
    - mirror_manifest.json exists
    - pages directory exists
    - manifest artifact_count equals generated page count
    - every manifest PageHref exists
    - no generated page points to an absolute local filesystem path

Failure:

    Any validation failure means the mirror is not release-ready.


============================================================
COMMAND
============================================================

Preferred command from project root:

    powershell -NoProfile -ExecutionPolicy Bypass -File .\00_DEPLOYMENT\GENERATE_HTML_MIRROR.ps1

Reason:

    Some Windows environments block direct script execution by
    policy. The bypass is process-local and does not alter machine
    policy.


============================================================
END AGLA WIKI DEPLOYMENT PROTOCOL
============================================================
