Skip to content

Latest commit

 

History

History
96 lines (69 loc) · 2.86 KB

File metadata and controls

96 lines (69 loc) · 2.86 KB

Scripts

trigger.ps1 / trigger.sh

Test scripts for that implement card selection based on session timing.

General Note: 1 LLM-prompt might use 0.3-3 watt hours.

Card Selection System

How It Works

The trigger system uses time-based peudo-random card selection:

  1. Session Start: Record conversation start time (HH:MM)
  2. Interval Calculation: (start_minute % 3) + 3 gives intervals of 3, 4, or 6 minutes
  3. Card Selection: (start_minute + current_minute) % 66 + 1 for deterministic card choice
  4. Application: Card applied when (current_time - session_start) >= interval_minutes AND session is sustained (10+ minutes)

Example

  • Session starts at 14:23 (minute 23)
  • Interval: (23 % 3) + 3 = 2 + 3 = 5 minutes
  • First card at 14:28 (5 minutes later)
  • Card selection: (23 + 28) % 66 + 1 = 51 + 1 = 52 → Card #52

"Randomness"

  • Same session start time = same interval and card sequence
  • Different start times = different patterns
  • Predictable but varied across sessions
  • Good for study consistency

Card Application Logic

IF (current_time - session_start) >= interval_minutes AND session >= 10 minutes:
    - Check for recent logs (within last 3 minutes)
    - If no recent logs:
        - Select card using deterministic formula
        - Log card usage to session file
        - Output TRIGGER:<card_number>
    - Else:
        - Skip (output SKIP:Recent)
ELSE:
    - Skip (output SKIP:Timing)

Benefits

  • Consistent: Same session = same card sequence
  • Varied: Different sessions = different patterns
  • Time-based: Cards appear during sustained work (10+ minutes)
  • Study-friendly: Predictable for analysis and reproducibility

Usage

PowerShell (Windows):

# Run from the repository root
.\scripts\trigger.ps1

Bash (Linux/macOS):

# Run from the repository root
./scripts/trigger.sh

The script will:

  • Calculate if trigger conditions are met
  • Select a card number deterministically if conditions are met
  • Log all actions to study_logs/logs/trigger-log-YYYY-MM-DD-HHmmss.md
  • Output TRIGGER:<card_number>, SKIP:Recent, or SKIP:Timing

Configuration

Edit the script to set:

  • $sessionStart: The actual session start time (currently hardcoded for testing)
  • Card count: Currently set to 66 cards (modify the modulo operation if needed)

Logging

All trigger decisions are logged to study_logs/logs/ with:

  • Session info (date, time, start time, minutes elapsed)
  • Trigger analysis (interval, conditions, decision)
  • Card selection (if triggered)

Related Documentation

  • Study logs: See ../study_logs/README.md for logging format
  • Rule cards: See ../rule_cards/README.md for card structure

This is a test/development script. It sort works, but its not good. For production use, integrate proper logic into your extension or application.