# Job-Specific Toolset Profiles for Local Timmy Automation
# Location: ~/.timmy/uniwizard/job_profiles.yaml
#
# Purpose: Narrow the tool surface per job type to prevent context thrashing
# and reduce token usage in local Hermes sessions.
#
# Usage in cron jobs:
#   agent = AIAgent(
#       enabled_toolsets=JOB_PROFILES["code-work"]["toolsets"],
#       disabled_toolsets=JOB_PROFILES["code-work"].get("disabled_toolsets", []),
#       ...
#   )
#
# Token savings are calculated against full toolset (~9,261 tokens, 40 tools)

profiles:
  # ============================================================================
  # CODE-WORK: Software development tasks
  # ============================================================================
  code-work:
    description: "Terminal-based coding with file operations and git"
    use_case: "Code reviews, refactoring, debugging, git operations, builds"
    toolsets:
      - terminal   # shell commands, git, builds
      - file       # read, write, patch, search
    tools_enabled: 6
    token_estimate: "~2,194 tokens"
    token_savings: "~76% reduction vs full toolset"
    notes: |
      Git operations run via terminal. Includes patch for targeted edits.
      No web access - assumes code and docs are local or git-managed.
      Process management included for background builds/tasks.

  # ============================================================================
  # RESEARCH: Information gathering and analysis
  # ============================================================================
  research:
    description: "Web research with browser automation and file persistence"
    use_case: "Documentation lookup, API research, competitive analysis, fact-checking"
    toolsets:
      - web        # web_search, web_extract
      - browser    # full browser automation
      - file       # save findings, read local files
    tools_enabled: 15
    token_estimate: "~2,518 tokens"
    token_savings: "~73% reduction vs full toolset"
    notes: |
      Browser + web search combination allows deep research workflows.
      File tools for saving research artifacts and reading local sources.
      No terminal to prevent accidental local changes during research.

  # ============================================================================
  # TRIAGE: Read-only issue and status checking
  # ============================================================================
  triage:
    description: "Read-only operations for status checks and issue triage"
    use_case: "Gitea issue monitoring, CI status checks, log analysis, health checks"
    toolsets:
      - terminal   # curl for API calls, status checks
      - file       # read local files, logs
    disabled_toolsets:
      # Note: file toolset includes write/patch - triage jobs should
      # be instructed via prompt to only use read_file and search_files
      # For truly read-only, use disabled_tools=['write_file', 'patch']
      # (requires AIAgent support or custom toolset)
    tools_enabled: 6
    token_estimate: "~2,194 tokens"
    token_savings: "~76% reduction vs full toolset"
    read_only_hint: |
      IMPORTANT: Triage jobs should only READ. Do not modify files.
      Use read_file and search_files only. Do NOT use write_file or patch.
    notes: |
      Gitea API accessed via curl in terminal (token in env).
      File reading for log analysis, config inspection.
      Prompt must include read_only_hint to prevent modifications.

  # ============================================================================
  # CREATIVE: Content creation and editing
  # ============================================================================
  creative:
    description: "Content creation with web lookup for reference"
    use_case: "Writing, editing, content generation, documentation"
    toolsets:
      - file       # read/write content
      - web        # research, fact-checking, references
    tools_enabled: 4
    token_estimate: "~1,185 tokens"
    token_savings: "~87% reduction vs full toolset"
    notes: |
      Minimal toolset for focused writing tasks.
      Web for looking up references, quotes, facts.
      No terminal to prevent accidental system changes.
      No browser to keep context minimal.

  # ============================================================================
  # OPS: System operations and maintenance
  # ============================================================================
  ops:
    description: "System operations, process management, deployment"
    use_case: "Server maintenance, process monitoring, log rotation, backups"
    toolsets:
      - terminal   # shell commands, ssh, docker
      - process    # background process management
      - file       # config files, log files
    tools_enabled: 6
    token_estimate: "~2,194 tokens"
    token_savings: "~76% reduction vs full toolset"
    notes: |
      Process management explicitly included for service control.
      Terminal for docker, systemctl, deployment commands.
      File tools for config editing and log inspection.

  # ============================================================================
  # MINIMAL: Absolute minimum for simple tasks
  # ============================================================================
  minimal:
    description: "Absolute minimum toolset for single-purpose tasks"
    use_case: "Simple file reading, status reports with no external access"
    toolsets:
      - file
    tools_enabled: 4
    token_estimate: "~800 tokens"
    token_savings: "~91% reduction vs full toolset"
    notes: |
      For tasks that only need to read/write local files.
      No network access, no terminal, no browser.

# ============================================================================
# WIRING INSTRUCTIONS FOR CRON DISPATCH
# ============================================================================
#
# In your cron job runner or dispatcher, load the profile and pass to AIAgent:
#
#   import yaml
#   
#   def load_job_profile(profile_name: str) -> dict:
#       with open("~/.timmy/uniwizard/job_profiles.yaml") as f:
#           profiles = yaml.safe_load(f)["profiles"]
#       return profiles.get(profile_name, profiles["minimal"])
#   
#   # In job execution:
#   profile = load_job_profile(job.get("tool_profile", "minimal"))
#   
#   agent = AIAgent(
#       model=model,
#       enabled_toolsets=profile["toolsets"],
#       disabled_toolsets=profile.get("disabled_toolsets", []),
#       quiet_mode=True,
#       platform="cron",
#       ...
#   )
#
# Add to job definition in ~/.hermes/cron/jobs.yaml:
#
#   - id: daily-backup-check
#     name: "Check backup status"
#     schedule: "0 9 * * *"
#     tool_profile: ops        # <-- NEW FIELD
#     prompt: "Check backup logs and report status..."
#
# ============================================================================

# ============================================================================
# COMPARISON: Toolset Size Reference
# ============================================================================
#
# Full toolset (all):           40 tools  ~9,261 tokens
# code-work, ops, triage:        6 tools  ~2,194 tokens  (-76%)
# research:                     15 tools  ~2,518 tokens  (-73%)
# creative:                      4 tools  ~1,185 tokens  (-87%)
# minimal:                       4 tools    ~800 tokens  (-91%)
#
# Token estimates based on JSON schema serialization (chars/4 approximation).
# Actual token counts vary by model tokenizer.
