# ── Token Quest System Configuration ─────────────────────────────────────────
#
# Quests are special objectives that agents (and humans) can complete for
# bonus tokens. Each quest has:
#   - id: Unique identifier
#   - name: Display name
#   - description: What the quest requires
#   - reward_tokens: Number of tokens awarded on completion
#   - criteria: Detection rules for completion
#   - enabled: Whether this quest is active
#   - repeatable: Whether this quest can be completed multiple times
#   - cooldown_hours: Minimum hours between completions (if repeatable)
#
# Quest Types:
#   - issue_count: Complete when N issues matching criteria are closed
#   - issue_reduce: Complete when open issue count drops by N
#   - docs_update: Complete when documentation files are updated
#   - test_improve: Complete when test coverage/cases improve
#   - daily_run: Complete Daily Run session objectives
#   - custom: Special quests with manual completion
#
# ── Active Quests ─────────────────────────────────────────────────────────────

quests:
  # ── Daily Run & Test Improvement Quests ───────────────────────────────────
  
  close_flaky_tests:
    id: close_flaky_tests
    name: Flaky Test Hunter
    description: Close 3 issues labeled "flaky-test"
    reward_tokens: 150
    type: issue_count
    enabled: true
    repeatable: true
    cooldown_hours: 24
    criteria:
      issue_labels:
        - flaky-test
      target_count: 3
      issue_state: closed
      lookback_days: 7
    notification_message: "Quest Complete! You closed 3 flaky-test issues and earned {tokens} tokens."

  reduce_p1_issues:
    id: reduce_p1_issues
    name: Priority Firefighter
    description: Reduce open P1 Daily Run issues by 2
    reward_tokens: 200
    type: issue_reduce
    enabled: true
    repeatable: true
    cooldown_hours: 48
    criteria:
      issue_labels:
        - layer:triage
        - P1
      target_reduction: 2
      lookback_days: 3
    notification_message: "Quest Complete! You reduced P1 issues by 2 and earned {tokens} tokens."

  improve_test_coverage:
    id: improve_test_coverage
    name: Coverage Champion
    description: Improve test coverage by 5% or add 10 new test cases
    reward_tokens: 300
    type: test_improve
    enabled: true
    repeatable: false
    criteria:
      coverage_increase_percent: 5
      min_new_tests: 10
    notification_message: "Quest Complete! You improved test coverage and earned {tokens} tokens."

  complete_daily_run_session:
    id: complete_daily_run_session
    name: Daily Runner
    description: Successfully complete 5 Daily Run sessions in a week
    reward_tokens: 250
    type: daily_run
    enabled: true
    repeatable: true
    cooldown_hours: 168  # 1 week
    criteria:
      min_sessions: 5
      lookback_days: 7
    notification_message: "Quest Complete! You completed 5 Daily Run sessions and earned {tokens} tokens."

  # ── Documentation & Maintenance Quests ────────────────────────────────────

  improve_automation_docs:
    id: improve_automation_docs
    name: Documentation Hero
    description: Improve documentation for automations (update 3+ doc files)
    reward_tokens: 100
    type: docs_update
    enabled: true
    repeatable: true
    cooldown_hours: 72
    criteria:
      file_patterns:
        - "docs/**/*.md"
        - "**/README.md"
        - "timmy_automations/**/*.md"
      min_files_changed: 3
      lookback_days: 7
    notification_message: "Quest Complete! You improved automation docs and earned {tokens} tokens."

  close_micro_fixes:
    id: close_micro_fixes
    name: Micro Fix Master
    description: Close 5 issues labeled "layer:micro-fix"
    reward_tokens: 125
    type: issue_count
    enabled: true
    repeatable: true
    cooldown_hours: 24
    criteria:
      issue_labels:
        - layer:micro-fix
      target_count: 5
      issue_state: closed
      lookback_days: 7
    notification_message: "Quest Complete! You closed 5 micro-fix issues and earned {tokens} tokens."

  # ── Special Achievements ──────────────────────────────────────────────────

  first_contribution:
    id: first_contribution
    name: First Steps
    description: Make your first contribution (close any issue)
    reward_tokens: 50
    type: issue_count
    enabled: true
    repeatable: false
    criteria:
      target_count: 1
      issue_state: closed
      lookback_days: 30
    notification_message: "Welcome! You completed your first contribution and earned {tokens} tokens."

  bug_squasher:
    id: bug_squasher
    name: Bug Squasher
    description: Close 10 issues labeled "bug"
    reward_tokens: 500
    type: issue_count
    enabled: true
    repeatable: true
    cooldown_hours: 168  # 1 week
    criteria:
      issue_labels:
        - bug
      target_count: 10
      issue_state: closed
      lookback_days: 7
    notification_message: "Quest Complete! You squashed 10 bugs and earned {tokens} tokens."

# ── Quest System Settings ───────────────────────────────────────────────────

settings:
  # Enable/disable quest notifications
  notifications_enabled: true
  
  # Maximum number of concurrent active quests per agent
  max_concurrent_quests: 5
  
  # Auto-detect quest completions on Daily Run metrics update
  auto_detect_on_daily_run: true
  
  # Gitea issue labels that indicate quest-related work
  quest_work_labels:
    - layer:triage
    - layer:micro-fix
    - layer:tests
    - layer:economy
    - flaky-test
    - bug
    - documentation
