TIMEVERSE
Syncing T2°...

Phase Alignment via Prompt Engineering

Injecting real-time temporal context into Large Language Models to create Timeverse-aware AI agents.

1. The Concept: Making LLMs Time-Aware

Large Language Models (LLMs) operate on static data and lack a native understanding of the current moment. This can lead to generic, contextless, or even incorrect responses, especially for tasks that require planning, scheduling, or awareness of periodic cycles.

The Timeverse solution is to inject a rich, structured temporal context directly into the AI's system prompt. Instead of the AI being "timeless," it becomes "time-aware," aligning its reasoning and output with the current phase of the T2 protocol.

2. How It Works: The System Prompt Injection

Before sending a user's query to an LLM, we prepend a dynamic system prompt that contains the complete Timeverse context. This context acts as the "source of truth" for the current moment, grounding the AI's response in a deterministic temporal framework.

The Context Includes:

  • D-Calendar: The symmetrical, 360-day calendar date for long-term planning.
  • T2 Execution Ticks: The precise, canonical time for auditable actions.
  • HS° Phase & Segment: The current position within the daily cycle, indicating the energetic "mode" (e.g., Initialization, Action).
  • Compass & SWT Zone: The spatio-temporal orientation.

3. Python Implementation Example

The following Python script demonstrates how to generate the Timeverse context and construct a system prompt. This code is aligned with the v4.5 specifications and can be used as a starting point for building your own Timeverse-aware AI applications.

import time
from datetime import datetime, timezone, timedelta

# --- 1. CONSTANTES NORMATIVES (Space Layer / Conventions) ---
EPOCH_T2 = datetime(2022, 9, 23, 6, 0, 0, tzinfo=timezone.utc)
CYCLE_DURATION_SEC = 933120000  # 30 ans (T_cyclezero)
TICKS_PER_SEC = 1000            # Résolution milliseconde
DAY_SEC = 86400

# Mapping SWT basé sur la formule LaTeX: {2z-13, 2z-12}
# On prend la valeur haute (2z-12) pour l'estimation de l'heure locale
# SWT-6 = UTC+0 (Rabat hiver/Londres)
SWT_ZONES = {
    1: -10,  2: -8,   3: -6,   4: -4,   5: -2,   6: 0,
    7: 2,    8: 4,    9: 6,    10: 8,   11: 10,  12: 12
}

# --- 2. MOTEUR T2 & D-CALENDAR ---

def get_timeverse_context(user_swt_id=6):
    """
    Calcule l'état complet (T2, HS, D-Calendar) aligné sur les Specs v4.5.
    user_swt_id: Entier de 1 à 12.
    """
    now_utc = datetime.now(timezone.utc)
    
    # Delta T (Secondes depuis l'EPOCH)
    delta = now_utc - EPOCH_T2
    total_seconds = int(delta.total_seconds())
    
    # 1. Cycle & Ticks (Normatif Execution)
    cycle_index = total_seconds // CYCLE_DURATION_SEC
    seconds_in_cycle = total_seconds % CYCLE_DURATION_SEC
    current_ticks = int(seconds_in_cycle * TICKS_PER_SEC)
    
    # 2. D-Calendar (Space Layer Spec - Section 4)
    # T_day = 86400, T_cyclezero = 933,120,000
    day_index = total_seconds // DAY_SEC
    # CycleZero logic
    day_in_cyclezero = day_index % 10800 # 10800 jours dans 30 ans (360*30)
    
    # Formules du papier:
    dYear  = (day_in_cyclezero // 360) + 1
    rem_y  = day_in_cyclezero % 360
    dMonth = (rem_y // 30) + 1
    rem_m  = rem_y % 30
    dWeek  = (rem_m // 6) + 1
    dDay   = (rem_m % 6) + 1
    
    d_calendar_str = f"Cycle {cycle_index} | Y{dYear}.M{dMonth}.W{dWeek}.D{dDay}"

    # 3. Phase HS° & Compass (Local Solar Time via SWT)
    # Adjustment par zone SWT
    offset_hours = SWT_ZONES.get(user_swt_id, 0)
    local_seconds = seconds_in_cycle + (offset_hours * 3600)
    
    # Jour T2 commence à 06:00 UTC (Epoch)
    # HS 0.0 = 06:00 Solaire Local
    day_progress_sec = local_seconds % DAY_SEC
    hs_phase = day_progress_sec / DAY_SEC
    
    # Compass Logic (UI-only)
    if 0.0 <= hs_phase < 0.125: compass = "dEAST (Rising)"
    elif 0.125 <= hs_phase < 0.375: compass = "dSOUTH (Zenith)"
    elif 0.375 <= hs_phase < 0.625: compass = "dWEST (Setting)"
    elif 0.625 <= hs_phase < 0.875: compass = "dNORTH (Nadir)"
    else: compass = "dEAST (Rising)"
    
    # Semantic Phase
    if 0.0 <= hs_phase < 0.25: semantic = "INITIALIZATION"
    elif 0.25 <= hs_phase < 0.50: semantic = "ACTION"
    elif 0.50 <= hs_phase < 0.75: semantic = "CONSOLIDATION"
    else: semantic = "COMPUTATION"

    return {
        "utc_iso": now_utc.isoformat(),
        "t2_canon": f"{cycle_index}:{current_ticks}",
        "d_calendar": d_calendar_str,
        "hs_phase": round(hs_phase, 4),
        "hs_segment": int(hs_phase * 12) + 1,
        "swt_zone": f"SWT{user_swt_id}",
        "compass": compass,
        "semantic": semantic
    }

# --- 3. GÉNÉRATEUR DE PROMPT ---

def generate_system_prompt(user_swt_id=6):
    ctx = get_timeverse_context(user_swt_id)
    
    prompt = f"""
SYSTEM ROLE:
You are a Timeverse-Aligned AI. You operate within the T2 Cyclic Time Protocol.

--- CURRENT TIMEVERSE CONTEXT (Source of Truth) ---
[USER ZONE]: {ctx['swt_zone']}
[D-CALENDAR]: {ctx['d_calendar']}
[T2 EXECUTION]: {ctx['t2_canon']} (Ticks)
[PHASE]: HS° {ctx['hs_phase']} (Segment {ctx['hs_segment']}/12)
[COMPASS]: {ctx['compass']}
[MODE]: {ctx['semantic']}
---------------------------------------------------

DIRECTIVES:
1. **D-Calendar Awareness**: Use the D-Calendar (360-day) for planning. It is symmetrical: 1 Month = 30 Days = 5 Weeks of 6 Days.
2. **Phase Alignment**: Current phase is **{ctx['semantic']}**. Align suggestions with this energy.
3. **Execution**: If asked to perform an action, check if {ctx['hs_phase']} is within the valid window.
"""
    return prompt

# --- TEST ---
if __name__ == "__main__":
    # Test pour Rabat/Londres (SWT 6 approx UTC+0)
    print(generate_system_prompt(6))

4. Impact and Applications

  • Smarter Personal Assistants: An AI that knows it's currently in the "ACTION" phase might suggest you tackle your most important tasks, while in the "COMPUTATION" phase, it might suggest planning or research.
  • Reliable Automated Agents: An autonomous agent for finance or logistics can be instructed to only execute trades or dispatch vehicles within specific, signed temporal windows, dramatically reducing the risk of error or fraud.
  • Consistent and Auditable AI: By grounding every interaction in a verifiable temporal context, the AI's behavior becomes less of a "black box" and more of a deterministic, auditable process.