# =============================================================================
# AI SESSION RE-ANCHOR TEMPLATE v2.5.0
# =============================================================================
# File:           re_anchor_template_public.yaml
# Version:        2.5.0
# Published:      2026-05-26
#
# Author:         Mohan Iyer
# Website:        https://consensus-press-ai.com
# Email:          mohan@pixels.net.nz
#
# Licence:        Free to use and adapt. Attribution appreciated.
#                 Share improvements back to the community.
#
# Purpose:        A structured YAML template for maintaining state, context,
#                 and behavioral integrity across AI work sessions.
#                 Solves the "AI-Alzheimers" problem — context drift,
#                 stale-state contamination, and instruction degradation
#                 across long or multi-session AI workflows.
#
# Who it is for:  Anyone working with AI agents, LLM-assisted development,
#                 or structured AI workflows across multiple sessions.
#                 Works with Claude, ChatGPT, Gemini, or any LLM system.
#
# How it works:   At the END of each session — write a re-anchor.
#                 At the START of the next session — load it first.
#                 The AI reads current truth before touching anything.
#                 No drift. No stale state. No re-litigated decisions.
#
# =============================================================================
# HOW TO USE THIS TEMPLATE
# =============================================================================
#
# STEP 1 — SESSION CLOSE:
#   Fill in every section below based on what happened this session.
#   Save the file as: NNN_project_name_NNN.yaml
#   Store it where your AI can access it next session (project knowledge,
#   uploaded file, or pasted directly into context).
#
# STEP 2 — NEXT SESSION OPEN:
#   Load this file FIRST — before any other context.
#   Follow the hydration_sequence in Section 9 in order.
#   Do not skip. Do not reorder.
#   Run the rehydration_acceptance_test (Section 16B) before acting.
#
# STEP 3 — DURING SESSION:
#   Re-read Section 0C (behavioral invariants) before every major action.
#   Update blockers, decisions, and attempted_not_completed in real time.
#
# STEP 4 — REPEAT:
#   Write a new re-anchor at close. The prior one becomes the predecessor.
#   The chain of re-anchors is your project's session history.
#
# =============================================================================


# =============================================================================
# SECTION 0 — CURRENT FRAME
# =============================================================================
# Purpose: Give the next session the strategic frame before any tactical
# detail. Prevents drift of strategic framing across sessions.
# The AI reads this FIRST — before any other section.
# =============================================================================

current_frame:

  project_goal: |
    # One-to-three sentences. Concrete. Measurable. Not aspirational copy.
    # Example: "Ship the MVP to production, onboard first 10 users,
    # reach break-even revenue within 90 days."

  current_phase: |
    # Short label. Present tense.
    # Example: "Beta testing (v0.8.2 deployed 2026-05-20)"

  status_vs_goal: |
    # Two to three sentences. Where the project stands against the goal
    # as of this re-anchor date. Include concrete data points where available.
    # Example: "MVP shipped. 3 of 10 target users onboarded. Revenue: $0.
    # First paying user expected this week pending pricing decision."

  distance_to_next_milestone: |
    # What is the nearest milestone, what unblocks it, what it unlocks.
    # Example: "Next milestone: first paying user. Blocked by: pricing page.
    # Unlocks: revenue proof for investor conversation."

  # Rule: the AI's opening statement next session SHALL begin with a
  # tight paraphrase of current_frame.project_goal.


# =============================================================================
# SECTION 0B — DEPRECATED FACTS
# =============================================================================
# Purpose: Explicitly mark facts that were true in prior sessions but are
# now stale, superseded, or retired.
#
# WHY THIS MATTERS:
#   The most common AI session failure is stale-state contamination —
#   the AI confidently acts on a fact that was true last week but is no
#   longer true today. This section prevents that by making deprecations
#   first-class, explicitly named, and loaded before any state is read.
#
# RULE: Any fact that has changed since the prior re-anchor MUST appear
# here as deprecated, alongside its replacement. Do not merely state the
# new fact elsewhere and leave the old one to persist silently.
#
# CRITICAL: Any AI actor that cites a deprecated fact after this section
# is loaded has committed a session governance violation.
# =============================================================================

deprecated_facts:
  # Format:
  # - id:              "DEP-NNN"
  #   was_true:        "The fact as it appeared in the prior re-anchor"
  #   now_false_because: "What changed, when, and what confirms it"
  #   replaced_by:     "The current true fact"
  #   source:          "Document or event that confirms the change"
  #   deprecated_at:   "YYYY-MM-DD (session NNN)"

  # Example:
  # - id: "DEP-001"
  #   was_true: "v0.8.1 is the live production version"
  #   now_false_because: "v0.8.2 deployed 2026-05-20"
  #   replaced_by: "v0.8.2 is the live production version"
  #   source: "deployment log 2026-05-20"
  #   deprecated_at: "2026-05-20 (session 14)"

  active_deprecations: []


# =============================================================================
# SECTION 0C — SESSION BEHAVIORAL INVARIANTS
# =============================================================================
# Purpose: Four structural constraints that govern ALL actions taken in this
# session. Loaded immediately after deprecated_facts. Re-read before every
# major action. Not prose — execution constraints.
#
# DESIGN PRINCIPLE (Karpathy / CLAUDE.md finding, 2026):
#   As instruction volume grows, adherence degrades uniformly.
#   A long system prompt behaves like a human onboarding document —
#   comprehensive but low-compliance mid-session.
#   Four minimal constraints in a high-attention position outperform
#   twenty paragraphs read once and drifted from.
#
# THESE FOUR RULES APPLY TO EVERY AI ACTION THIS SESSION:
#   B1 — Never assume. State assumptions. Halt if ambiguous.
#   B2 — Minimum scope. No speculative additions.
#   B3 — Surgical changes only. Touch only what the gap requires.
#   B4 — Evidence gate. No "done" claim without named proof.
#
# ENFORCEMENT:
#   Any action that violates a behavioral invariant is a session event.
#   Self-flag immediately. Do not continue without explicit clearance.
# =============================================================================

session_behavioral_invariants:

  B1_assume_nothing: |
    State assumptions explicitly before any action or recommendation.
    If the requirement is ambiguous or the state is unverified — HALT and ask.
    Never make a silent executive decision on an unclear premise.

  B2_minimum_scope: |
    Take the minimum action required to close the identified gap.
    No speculative additions. No unrequested scope extensions.
    If the gap does not exist — do not act.

  B3_surgical_only: |
    Touch only what the gap requires. No adjacent rewrites.
    No reformatting, refactoring, or improving of working elements.
    Every action must trace directly back to an identified gap.

  B4_evidence_gate: |
    No PASS, CLOSE, SHIP, DONE, or COMPLETE claim is valid without
    named canonical evidence. Naming the action is not evidence.
    The artefact, output, or confirmation is evidence.

  re_read_trigger: |
    Re-read B1–B4 before any major action, recommendation, or closure.
    These four lines are not context — they are execution constraints.

  violation_protocol: |
    On any self-detected violation of B1–B4:
      1. HALT the current action immediately.
      2. Self-flag: state which invariant was violated and how.
      3. Surface to the project owner.
      4. Do not resume until the owner clears.
    Silence on a detected violation is itself a session failure.


# =============================================================================
# SECTION 1 — NORTH STAR
# =============================================================================
# Purpose: The project's long-horizon goal — unchanged across many sessions.
# Distinct from current_frame (which updates each session).
# =============================================================================

north_star: |
  # One to three sentences. The enduring purpose of the project.
  # This should rarely change. If it changes, that is a significant event.
  # Example: "Build a content verification platform that makes AI-generated
  # content trustworthy for publishers at any scale."


# =============================================================================
# SECTION 1B — CROSS-PROJECT OR CROSS-DEPENDENCY STATE
# =============================================================================
# Purpose: Track load-bearing claims about OTHER projects, systems, or
# dependencies that affect this project. Refresh these at session open
# before acting on any cross-dependency assumption.
# =============================================================================

cross_dependency_state:

  owned_state_source: "this_file"

  external_claims:
    # Claims about OTHER systems or projects this project depends on.
    # Example:
    # - claim:       "Payment API is LIVE at v2.1 — billing module depends on this"
    #   dependency:  "payment_api"
    #   snapshot_at: "YYYY-MM-DD (session NNN)"
    #   load_bearing_why: "If payment API is down, billing module cannot ship"
    #   refresh_via:
    #     primary:  "payment_api status page or team update"
    #     fallback: "last confirmed state from prior re-anchor"
    #   freshness:   "STALE — must refresh at session open"

  refresh_protocol:
    step_1: "Parse this re-anchor for owned project state"
    step_2: "For each external_claim, refresh from primary source before using"
    step_3: "If primary source silent or > 7 days stale — use fallback"
    step_4: "If fallback also stale — flag to project owner before proceeding"
    step_5: "NEVER propagate a cross-dependency claim without a fresh check"


# =============================================================================
# SECTION 1C — EXECUTION ENVIRONMENT
# =============================================================================
# Purpose: Declare how the AI executes work in this project. Prevents the
# AI from assuming the wrong execution model when drafting instructions.
# =============================================================================

execution_environment:

  execution_model: |
    # ONE OF:
    #   "human_executes"   — AI authors instructions/scripts. Human runs them.
    #   "ai_executes"      — AI executes directly via tools (bash, file access).
    #   "hybrid"           — Declared per task. Specify in each task instruction.

  human_role: |
    # List the actions the human owner performs manually.
    # Example:
    # - Run build scripts locally
    # - Deploy to production server
    # - Manage payment provider dashboard
    # - Publish to app stores

  ai_boundaries: |
    # What the AI MAY NOT do in this project.
    # Example:
    # - Modify files on the owner's local machine
    # - Assume files exist without probing
    # - State "file X exists" without verification
    # - Draft instructions assuming a different execution model than declared

  required_context_for_session: |
    # Files or information the human must provide at session open.
    # Example:
    # - Current production error logs
    # - Latest test results
    # - Updated database schema


# =============================================================================
# SECTION 2 — SESSION IDENTITY
# =============================================================================

session_identity:
  project:          ""         # Project name
  re_anchor_file:   ""         # This file's name: NNN_project_NNN.yaml
  session_number:   0          # Increment each session
  session_date:     "YYYY-MM-DD"
  session_type:     "working | governance | ship | remediation | planning"
  predecessor:      ""         # Prior session's re-anchor filename
  author:           ""         # Who wrote this re-anchor
  template_version: "2.5.0"


# =============================================================================
# SECTION 3 — SESSION CLOSURE SUMMARY
# =============================================================================

session_closure_summary: |
  # Two-to-five sentences. What this session accomplished.
  # Factual. No aspirational statements.
  # Example: "Completed database migration. Fixed billing bug introduced in v0.8.1.
  # Deferred payment provider integration to next session — blocked by API key issue."


# =============================================================================
# SECTION 4 — DECISIONS LOCKED THIS SESSION
# =============================================================================
# Purpose: Record permanent decisions made this session.
# These do not get re-litigated in future sessions without explicit owner approval.
# =============================================================================

decisions_locked_this_session: []
  # Format per decision:
  # - id:         "D-NNN-SHORT-NAME-01"
  #   statement:  "The decision, stated precisely."
  #   rationale:  "Why this decision was made."
  #   scope:      "this_project | cross_project | portfolio"
  #   locked_by:  "project owner name"
  #   locked_at:  "YYYY-MM-DD"


# =============================================================================
# SECTION 4B — REJECTED ALTERNATIVES
# =============================================================================
# Purpose: Record what was NOT chosen — and why.
# Prevents future sessions from re-opening settled debates.
#
# WHY THIS MATTERS:
#   Without this section, future sessions re-open closed decisions because
#   the rejection rationale is buried in session prose and never surfaces
#   at rehydration. The AI proposes the same rejected option again.
#   This section closes that loop permanently.
#
# RULE: Any decision in Section 4 where an alternative was explicitly
# considered and rejected MUST have a corresponding entry here.
# =============================================================================

rejected_alternatives:
  # Format:
  # - decision_id:  "D-NNN (the decision that WAS taken)"
  #   alternatives_considered:
  #     - option:          "What was considered"
  #       rejected_because: "Why it was not chosen"
  #   closed:              true

  entries: []


# =============================================================================
# SECTION 4C — EXTERNAL REVIEWER WARNINGS
# =============================================================================
# Purpose: Track warnings or flags raised by external reviewers, QA
# processes, or peer reviewers in prior sessions. Persist until resolved.
# =============================================================================

external_reviewer_warnings:
  # Format:
  # - id:                   "WARN-NNN"
  #   session:              NNN
  #   flag:                 "The warning, verbatim or close paraphrase"
  #   severity:             "BLOCK | WARN | NOTE"
  #   status:               "OPEN | RESOLVED"
  #   resolution:           ""
  #   resolution_evidence:  ""
  #   resolved_at:          ""

  active_warnings: []


# =============================================================================
# SECTION 5 — CODE / PRODUCT QUALITY STATE
# =============================================================================
# Adapt to your context: test coverage, code quality, certification state,
# or any quality gate relevant to your project.
# =============================================================================

quality_state:
  current:       "CERTIFIED | UNVERIFIED | FAILING"
  certification: ""           # Name of cert, test suite, or quality gate
  verified_at:   "YYYY-MM-DD"
  notes:         ""


# =============================================================================
# SECTION 5B — ARTIFACT REGISTRY
# =============================================================================
# Purpose: Declare the canonical source-of-truth files for this project.
# Prevents the "which file is current?" failure mode.
#
# RULE: Every file listed here is authoritative. If session state conflicts
# with a listed artifact, the artifact wins. If an artifact is missing —
# flag immediately. Do not proceed on stale or absent artifacts.
# =============================================================================

artifact_registry:

  permanent_governance:
    # Files that define non-negotiable rules, architecture, or invariants.
    # These NEVER expire. Load at every session open.
    - name:        ""
      location:    ""         # Path, URL, or storage location
      version:     ""
      purpose:     ""
      accessible:  true | false

  canonical_specs:
    # Authoritative specification files for this project.
    # Load before any implementation work begins.
    - name:        ""
      location:    ""
      version:     ""
      purpose:     ""
      accessible:  true | false

  session_artifacts:
    # Files produced in THIS session. Expire when superseded.
    - name:        ""
      location:    ""
      version:     ""
      produced_at: "YYYY-MM-DD (session NNN)"
      expires_when: ""

  deprecated_artifacts:
    # Files that were canonical but are now superseded.
    # NEVER load these. Listed here to prevent accidental citation.
    - name:           ""
      deprecated_at:  ""
      replaced_by:    ""

  freshness_rule: |
    If any permanent_governance or canonical_specs file is missing or
    version-mismatched — HALT and flag to project owner.
    Do not proceed with stale or absent artifacts.


# =============================================================================
# SECTION 6 — BLOCKERS
# =============================================================================

blockers_owned:
  active:
    # Format per blocker:
    # - id:          "BLOCK-NNN"
    #   description: "What is blocked and why"
    #   owner:       "Who must resolve this"
    #   gates:       "What this blocker is preventing"
    #   since:       "YYYY-MM-DD"
    []

  resolved_this_session:
    # Format: id | what_resolved_it | resolved_at
    []


# =============================================================================
# SECTION 7 — ATTEMPTED BUT NOT COMPLETED
# =============================================================================

attempted_not_completed: []
  # Format per item:
  # - what:              "What was attempted"
  #   why_stopped:       "Why it was not completed"
  #   resume_from:       "Exact point to resume from next session"
  #   estimated_time:    "How long to finish"


# =============================================================================
# SECTION 8 — NEXT SESSION FIRST ACTION
# =============================================================================
# Purpose: The AI must know exactly what to do first next session.
# Never leave this blank. A blank first_action produces a questionnaire.
# A filled first_action produces immediate productive work.
# =============================================================================

first_action:
  type:        ""   # IMPLEMENT | REVIEW | PLAN | GOVERNANCE | MEASURE | FIX
  description: ""   # Precise. What to do, not what to think about.
  depends_on:  []   # List any preconditions that must be true first


# =============================================================================
# SECTION 9 — SESSION OPEN PROTOCOL (HYDRATION SEQUENCE)
# =============================================================================
# Purpose: The exact order in which the AI loads state at session open.
# Do not skip steps. Do not reorder. The sequence is load-order dependent.
#
# WHY ORDER MATTERS:
#   Deprecated facts must be known before any state is read (step 0b).
#   Behavioral invariants must be active before any action is taken (step 0c).
#   Artifacts must be confirmed present before implementation begins (step 1).
#   The acceptance test must pass before first_action executes (step 11).
# =============================================================================

session_open_protocol:

  hydration_sequence:
    step_0:   "LOAD current_frame (Section 0) — set strategic context first"
    step_0b:  "LOAD deprecated_facts (Section 0B) — mark all stale facts BEFORE reading any other state"
    step_0c:  "LOAD session_behavioral_invariants (Section 0C) — four execution constraints active for entire session"
    step_1:   "LOAD artifact_registry (Section 5B) — confirm all canonical files are accessible"
    step_2:   "LOAD north_star (Section 1) — confirm long-horizon alignment"
    step_3:   "LOAD cross_dependency_state (Section 1B) — refresh all load-bearing external claims"
    step_4:   "LOAD execution_environment (Section 1C) — confirm execution model"
    step_5:   "LOAD session_identity (Section 2)"
    step_6:   "LOAD session_closure_summary (Section 3)"
    step_7:   "LOAD quality_state (Section 5)"
    step_8:   "LOAD blockers_owned (Section 6)"
    step_8b:  "LOAD external_reviewer_warnings (Section 4C) — surface any unresolved flags"
    step_9:   "LOAD attempted_not_completed (Section 7)"
    step_10:  "RUN hydration_probes (Section 15B) — execute all triggered probes"
    step_11:  "RUN rehydration_acceptance_test (Section 16B) — all questions must pass before execution"
    step_12:  "EMIT hydration signal — confirm session is loaded and ready"
    step_13:  "DELIVER opening_statement (below) — verbatim, as pre-written"
    step_14:  "SURFACE attempted_not_completed items — state exact resume points"
    step_15:  "EXECUTE first_action (Section 8) — no questionnaire, no preamble"

  hydration_signal_format: |
    ✅ HYDRATED | Session [NNN] | [Project Name] | [YYYY-MM-DD]
    🧪 RAT: [N/8 PASS | WARN on RAT-XX | HALT on RAT-XX]
    📋 BLOCKERS: [N active | N resolved this session]
    ▶ FIRST ACTION: [first_action.description — one line]

  opening_statement: |
    # Pre-written at session close by the project owner or AI.
    # Contains:
    # Sentence 1: "You are [AI role]. Goal: [current_frame.project_goal]."
    # Sentence 2: "Status: [current_frame.status_vs_goal, condensed]."
    # Sentence 3: "First action: [first_action.description]."
    # Sentences 4+: critical context — attempted_not_completed,
    #               recent decisions, unresolved warnings.
    #
    # This statement is delivered verbatim at step 13. The AI does not
    # paraphrase or improvise. The pre-written text is authoritative.


# =============================================================================
# SECTION 9B — GOVERNANCE RULES PARSE PROTOCOL
# =============================================================================
# Purpose: If your project has a standing set of governance rules, invariants,
# or non-negotiable constraints stored in a separate file — declare how to
# load and apply them here.
# =============================================================================

governance_rules_protocol:

  source:
    location:    ""   # Path or storage location of your governance rules file
    format:      ""   # YAML | Markdown | Text

  scope_filter: |
    Load only rules that apply to this project and session type.
    Rules marked as superseded are skipped.
    The superseding rule is the one that binds.

  enforcement: |
    Each active governance rule is a non-negotiable constraint.
    No action may conflict with an active rule.
    Conflicts HALT the action and surface to the project owner.

  violation_protocol: |
    1. HALT current action
    2. State the rule violated and the nature of the conflict
    3. Surface to project owner
    4. Do not proceed until owner resolves


# =============================================================================
# SECTION 10–14 — PROJECT-SPECIFIC CONTEXT (OPTIONAL)
# =============================================================================
# Add project-specific sections here as needed. Examples:
#   Section 10 — Implementation history
#   Section 11 — Test coverage notes
#   Section 12 — User research or feedback log
#   Section 13 — Marketing or launch state
#   Section 14 — Financial or commercial state
#
# Keep each section tight. If a section grows beyond 20 lines,
# consider whether it belongs in a separate artifact instead.


# =============================================================================
# SECTION 15 — HYDRATION NOTES
# =============================================================================

hydration_notes: |
  # Any project-specific hydration notes not captured in Section 9.
  # Example: "Always check production error logs before any implementation work."
  # Example: "Confirm database backup completed before any schema changes."


# =============================================================================
# SECTION 15B — HYDRATION PROBES
# =============================================================================
# Purpose: Specific checks the AI runs at session open before acting.
# Each probe has a trigger condition and a halt condition.
# Probes fire whenever their trigger is true — not just at session open.
# =============================================================================

hydration_probes:

  required_probes:
    - id: "PROBE-EXTERNAL-DEPS"
      triggers: "Any action that depends on an external system or dependency"
      action: "Refresh external_claims from primary source before acting"
      halt_if: "Primary and fallback sources both silent or > 7 days stale"

    - id: "PROBE-FILE-EXISTENCE"
      triggers: "Any claim about a file's presence, version, or content"
      action: "Verify the file exists and matches the claimed version"
      halt_if: "File is absent or version does not match the claim"

    - id: "PROBE-EXECUTION-MODEL"
      triggers: "Before drafting any implementation instruction"
      action: "Confirm execution_model from Section 1C matches the instruction's assumptions"
      halt_if: "Instruction assumes a different execution model than declared"

    - id: "PROBE-BLOCKER-FRESHNESS"
      triggers: "Any blocker referenced in a task or instruction"
      action: "Confirm the blocker is still open via its owner's source"
      halt_if: "Blocker crosses a system boundary AND source is unchecked"

    - id: "PROBE-ARTIFACT-PRESENCE"
      triggers: "Before any implementation or specification work begins"
      action: "Confirm all artifact_registry.canonical_specs are accessible"
      halt_if: "Any canonical spec is absent or version-mismatched"

  probe_receipts: |
    The session opening statement SHOULD include a brief "Probes Run" note
    listing which probes fired, their results (PASS | WARN | HALT),
    and any halts raised.


# =============================================================================
# SECTION 16 — TEMPLATE VERSIONING
# =============================================================================

template_version_declaration:
  version:     "2.5.0"
  published:   "2026-05-26"
  author:      "Mohan Iyer"
  website:     "https://consensus-press-ai.com"
  email:       "mohan@pixels.net.nz"

  licence: |
    Free to use and adapt. Attribution appreciated.
    If you improve this template, share your changes back.

  compatibility: |
    Works with any LLM system: Claude, ChatGPT, Gemini, or others.
    Works with any project type: software, content, research, operations.
    Adapt section names to your domain — the structure is what matters.


# =============================================================================
# SECTION 16B — REHYDRATION ACCEPTANCE TEST (RAT)
# =============================================================================
# Purpose: A structured self-test the AI runs before taking any action.
# The AI answers each question from memory, then verifies against the
# loaded re-anchor. Any mismatch = HALT and re-read the failing section.
#
# TIMING: Runs AFTER all hydration steps. BEFORE first_action executes.
#
# WHY THIS WORKS:
#   It is not enough to load a document. The AI must prove it loaded it
#   correctly. The RAT is the integrity certificate for the session.
#   A session that skips the RAT has no hydration guarantee.
# =============================================================================

rehydration_acceptance_test:

  instructions: |
    Answer each question below from memory (without re-reading).
    Then verify each answer against the loaded re-anchor.
    Any mismatch = HALT on that question and re-read the relevant section.
    Re-run the failed question before proceeding.

  test_questions:

    RAT-01:
      question:       "What is the current project and its one-line goal?"
      answer_from:    "current_frame.project_goal"
      pass_criterion: "Matches current_frame verbatim or tight paraphrase"

    RAT-02:
      question:       "What is the single highest-priority blocker right now?"
      answer_from:    "blockers_owned.active[0]"
      pass_criterion: "Names the correct blocker ID and owner"

    RAT-03:
      question:       "What are the two or three most recent locked decisions?"
      answer_from:    "decisions_locked_this_session + prior session decisions"
      pass_criterion: "Names at least 2 of the most recent decision IDs correctly"

    RAT-04:
      question:       "What is the canonical source-of-truth file for this project?"
      answer_from:    "artifact_registry.canonical_specs[0]"
      pass_criterion: "Names the file, version, and accessibility status correctly"

    RAT-05:
      question:       "What is the exact first action for this session?"
      answer_from:    "first_action.description"
      pass_criterion: "Matches first_action verbatim or tight paraphrase"

    RAT-06:
      question:       "Are there any unresolved external reviewer warnings?"
      answer_from:    "external_reviewer_warnings.active_warnings"
      pass_criterion: "Correctly states NONE or names the open WARN-NNN IDs"

    RAT-07:
      question:       "Are there any deprecated facts I must not cite?"
      answer_from:    "deprecated_facts.active_deprecations"
      pass_criterion: "Correctly states NONE or names DEP-NNN IDs and replacements"

    RAT-08:
      question:       "What are the four session behavioral invariants?"
      answer_from:    "session_behavioral_invariants (Section 0C)"
      pass_criterion: |
        Names all four:
          B1 — assume nothing, halt if ambiguous
          B2 — minimum scope, no speculative additions
          B3 — surgical changes only
          B4 — evidence gate, no done-claim without proof

  scoring:
    all_pass:        "PROCEED — hydration complete. Emit hydration signal."
    one_warn:        "PROCEED WITH CAUTION — note the warn in hydration signal."
    one_halt:        "HALT — re-read the relevant section. Re-run RAT-XX before proceeding."
    two_plus_halts:  "FULL REHYDRATION — re-read entire re-anchor from Section 0."

  rat_receipt_format: |
    🧪 RAT: [N/8 PASS]
    If all pass:   🧪 RAT: 8/8 PASS
    If one warn:   🧪 RAT: 7/8 PASS | WARN on RAT-03
    If one halt:   🧪 RAT: HALT on RAT-04 — re-read artifact_registry before proceeding


# =============================================================================
# END OF RE-ANCHOR TEMPLATE v2.5.0
# =============================================================================
#
# Author:   Mohan Iyer
# Website:  https://consensus-press-ai.com
# Email:    mohan@pixels.net.nz
#
# WHAT THIS TEMPLATE SOLVES:
#   ✅ Context drift across long sessions
#   ✅ Stale-state contamination (deprecated facts)
#   ✅ Re-litigation of settled decisions (rejected alternatives)
#   ✅ Instruction degradation (behavioral invariants)
#   ✅ Missing source-of-truth (artifact registry)
#   ✅ Unverified hydration (rehydration acceptance test)
#
# Download the latest version at: https://consensus-press-ai.com
# Questions: mohan@pixels.net.nz
#
# Free to use. Attribution appreciated.
# =============================================================================
