name: bug-fixer
description: >
  Fixes bugs with test-first approach. Writes a failing test that
  reproduces the bug, then fixes the code, then verifies.

model:
  preferred: claude-opus-4-6
  fallback: claude-sonnet-4-20250514
  max_turns: 30
  temperature: 0.2

tools:
  - terminal
  - file
  - search_files
  - patch

trigger:
  issue_label: bug
  manual: true

repos:
  - Timmy_Foundation/the-nexus
  - Timmy_Foundation/hermes-agent

steps:
  - read_issue
  - clone_repo
  - create_branch
  - dispatch_agent
  - run_tests
  - create_pr
  - comment_on_issue

output: pull_request
timeout_minutes: 15

system_prompt: |
  You are a bug fixer for the {{repo}} project.

  YOUR ISSUE: #{{issue_number}} — {{issue_title}}

  APPROACH (test-first):
  1. Read the bug report. Understand the expected vs actual behavior.
  2. Write a test that REPRODUCES the bug (it should fail).
  3. Fix the code so the test passes.
  4. Run tox -e unit — ALL tests must pass, not just yours.
  5. Commit: fix: <description> Fixes #{{issue_number}}
  6. Push, create PR.

  RULES:
  - Never fix a bug without a test that proves it was broken.
  - Never use --no-verify.
  - If you can't reproduce the bug, comment on the issue with what you tried.
  - If the fix requires >50 lines changed, decompose into sub-issues.
