# BMAD+ Auto-Activation Role Triggers
# These rules define when agents automatically switch roles based on context.
# Users can always override with "skip" or explicitly request a role change.

strategist:
  default_role: pm
  auto_triggers:
    analyst:
      # Level 1 — Pattern matching (keywords in user request)
      patterns:
        - "analyse"
        - "analyze"
        - "recherche"
        - "research"
        - "marché"
        - "market"
        - "benchmark"
        - "requirements"
        - "domain"
        - "competitive"
        - "SWOT"
        - "stakeholder"
      # Level 2 — Contextual (situations detected during work)
      contexts:
        - "new_project"
        - "pivot"
        - "competitor_mention"
        - "unknown_domain"
      # Level 3 — Reasoning chain (discoveries during execution)
      reasoning:
        - "user_need_unclear"
        - "market_assumption_unvalidated"

    pm:
      patterns:
        - "PRD"
        - "product brief"
        - "roadmap"
        - "priorisation"
        - "MVP"
        - "user story"
        - "personas"
        - "brief"
      contexts:
        - "post_research"
        - "planning_phase"
        - "scope_definition"
      reasoning:
        - "research_complete_needs_specification"

    # `challenge` names the skill bmad-plus-challenge, not a persona: the agent keeps its
    # role and opens the skill. The generic phrases live here, on Atlas; each other agent
    # below carries longer phrases that name its own subject, which are the more specific.
    challenge:
      patterns:
        - "stress-test"
        - "stress test"
        - "challenge my plan"
        - "poke holes"
        - "grill the plan"
        - "challenge the brief"
        - "challenge the PRD"
        - "challenge mon plan"
        - "critique mon plan"
        - "trouve les failles"
        - "challenge mon brief"
      contexts:
        - "brief_about_to_freeze"
        - "plan_with_open_dependencies"
      reasoning:
        - "choices_unmade_behind_the_document"

architect-dev:
  default_role: dev
  auto_triggers:
    architect:
      patterns:
        - "architecture"
        - "design"
        - "API"
        - "schema"
        - "structure"
        - "stack"
        - "scalab"
        - "infrastructure"
        - "database"
        - "migration"
      contexts:
        - "multi_file_change_gt_5"
        - "new_module"
        - "security_domain"
        - "performance_critical"
        - "new_integration"
      reasoning:
        - "implementation_exposes_architectural_issue"
        - "dependency_conflict_detected"
        - "scale_concern_during_coding"

    dev:
      patterns:
        - "implement"
        - "implémente"
        - "code"
        - "build"
        - "fix"
        - "refactor"
        - "develop"
        - "créer"
      contexts:
        - "post_architecture"
        - "story_assigned"
        - "bug_fix"
      reasoning:
        - "architecture_approved_ready_to_code"

    tech-writer:
      patterns:
        - "document"
        - "README"
        - "changelog"
        - "explain"
        - "documente"
        - "API doc"
        - "mermaid"
      contexts:
        - "post_implementation"
        - "version_release"
        - "onboarding_needed"
      reasoning:
        - "complex_feature_needs_explanation"
        - "public_api_changed"

    challenge:
      patterns:
        - "challenge the architecture"
        - "stress-test the architecture"
        - "challenge the refactor"
        - "challenge mon architecture"
        - "critique mon architecture"
      contexts:
        - "architecture_with_open_choices"
        - "irreversible_step_planned"
      reasoning:
        - "refactor_target_not_agreed"

quality:
  default_role: qa
  auto_triggers:
    qa:
      patterns:
        - "test"
        - "QA"
        - "review"
        - "bug"
        - "edge case"
        - "coverage"
        - "valide"
        - "vérifie"
      contexts:
        - "post_implementation"
        - "financial_calculations"
        - "security_sensitive"
        - "user_data_handling"
      reasoning:
        - "critical_logic_detected"
        - "regression_risk"
        - "complex_state_management"

    ux-review:
      patterns:
        - "UX"
        - "interface"
        - "utilisateur"
        - "responsive"
        - "accessibilité"
        - "accessibility"
        - "design"
        - "usability"
      contexts:
        - "frontend_changes"
        - "new_component"
        - "new_page"
        - "mobile_layout"
      reasoning:
        - "user_facing_feature_delivered"
        - "interaction_pattern_changed"

    uat:
      patterns:
        - "recette"
        - "recettage"
        - "UAT"
        - "acceptance test"
        - "cahier de recette"
        - "test humain"
        - "test manuel"
        - "what should I check"
        - "qu'est-ce que je dois vérifier"
      contexts:
        - "release_candidate"
        - "deployed_to_test_environment"
        - "uat_results_detected"
      reasoning:
        - "human_observable_change_delivered"
        - "delivery_awaiting_human_acceptance"

    challenge:
      patterns:
        - "attack the plan"
        - "unproven assumption"
        - "challenge the assumptions"
        - "attaque le plan"
        - "hypothèse non prouvée"
      contexts:
        - "plan_assumption_unproven"
      reasoning:
        - "acceptance_criteria_assume_unproven_fact"

orchestrator:
  default_role: scrum-master
  auto_triggers:
    scrum-master:
      patterns:
        - "sprint"
        - "planning"
        - "story"
        - "retro"
        - "backlog"
        - "epic"
        - "velocity"
      contexts:
        - "phase_transition"
        - "milestone_reached"
        - "team_sync"

    quick-flow:
      patterns:
        - "rapide"
        - "quick"
        - "hotfix"
        - "petit fix"
        - "simple"
        - "fast"
        - "patch"
      contexts:
        - "single_file_change"
        - "bug_report"
        - "minor_feature"

    autopilot:
      patterns:
        - "autopilot"
        - "gère tout"
        - "lance le projet"
        - "full pipeline"
        - "tout automatique"
        - "from scratch"
      contexts:
        - "new_project_idea"
        - "execution_mode_autopilot"
        - "pack_pipeline_declared"

    parallel-supervisor:
      patterns:
        - "parallèle"
        - "parallel"
        - "simultané"
        - "concurrent"
        - "batch"
      contexts:
        - "independent_stories_detected"
        - "multi_task_queue"
        - "parallel_execution_enabled"
        - "swarm_declared"
        - "panel_requested"
      reasoning:
        - "stories_have_no_shared_dependencies"
        - "workload_can_be_distributed"

    challenge:
      patterns:
        - "challenge the plan before launch"
        - "stress-test the run"
        - "challenge le plan avant lancement"
        - "challenge ce lancement"
      contexts:
        - "launch_inputs_shaky"
        - "parallel_stories_share_open_decision"
      reasoning:
        - "run_inputs_unsettled"

seo:
  default_role: seo-chief
  auto_triggers:
    seo-chief:
      # Level 1 — Pattern matching (keywords in user request)
      patterns:
        - "SEO"
        - "référencement"
        - "audit SEO"
        - "search ranking"
        - "SERP"
        - "on-page"
        - "meta tags"
        - "challenge the SEO strategy"
        - "challenge la stratégie SEO"
      # Level 2 — Contextual (situations detected during work)
      contexts:
        - "seo_audit_requested"
        - "website_launch"
        - "organic_traffic_drop"
        - "strategy_goals_unstated"
      # Level 3 — Reasoning chain
      reasoning:
        - "organic_visibility_concern"

    seo-scout:
      patterns:
        - "crawl"
        - "sitemap"
        - "robots.txt"
        - "fetch page"
        - "technical SEO"
        - "core web vitals"
        - "indexation"
      contexts:
        - "site_structure_unknown"
        - "pre_audit_reconnaissance"
      reasoning:
        - "structure_must_be_mapped_before_scoring"

    seo-judge:
      patterns:
        - "SEO score"
        - "E-E-A-T"
        - "EEAT"
        - "quality gate"
        - "PageSpeed"
        - "CrUX"
        - "ranking factors"
      contexts:
        - "post_crawl_scoring"
        - "competitive_gap_analysis"
      reasoning:
        - "findings_need_prioritized_scoring"

design:
  default_role: design-engine
  auto_triggers:
    design-engine:
      # Level 1 — Pattern matching (keywords in user request). The persona picks its
      # role (Builder, Reviewer, Redesigner) from the request; the pack has one agent.
      # The vocabulary is the pack's own: bare "design", "UI" or "interface" belong to
      # Forge's architect role and Sentinel's UX review, which coexist with this pack.
      patterns:
        - "Atelier"
        - "/design"
        - "design tokens"
        - "maquette"
        - "wireframe"
        - "landing page"
        - "make it look good"
        - "accessibilité"
        - "accessibility"
        - "refonte"
        - "redesign"
      # Level 2 — Contextual (situations detected during work)
      contexts:
        - "frontend_changes"
        - "new_page"
        - "new_component"
        - "design_tokens_missing"
      # Level 3 — Reasoning chain (discoveries during execution)
      reasoning:
        - "ui_looks_generic"
        - "accessibility_unverified"

ghostwriter:
  default_role: ghostwriter
  auto_triggers:
    ghostwriter:
      patterns:
        - "/ghostwriter"
        - "Ghostwriter"
        - "humanise ce texte"
        - "humaniser ce texte"
        - "humanizer du contenu"
        - "rends ce texte plus naturel"
        - "retire le slop IA de ce texte"
        - "enlève les patterns IA de cette réponse"
        - "remove AI slop from this draft"
        - "humanize this text"
        - "make this sound less robotic"
        - "humanize este texto"
        - "deixe este texto mais natural"
        - "revise this draft in our voice"
        - "révise ce texte dans notre ton"
        - "adapte este texto à nossa voz"
      contexts:
        - "editorial_review_requested"
        - "existing_text_style_revision_requested"
        - "voice_profile_requested"

# The packs below declare no other triggers: these entries only name the phrases that open
# bmad-plus-challenge for the persona that drives it. The persona keeps its role.
dev-studio:
  default_role: pm-agent
  auto_triggers:
    analyst-agent:
      patterns:
        - "challenge the product brief"
        - "challenge le product brief"
      contexts:
        - "brief_target_user_unchosen"
    pm-agent:
      patterns:
        - "challenge the PRD scope"
        - "stress-test the requirements"
        - "challenge le périmètre du PRD"
      contexts:
        - "prd_about_to_freeze"
    architect-agent:
      patterns:
        - "challenge the ADRs"
        - "stress-test the epics"
        - "challenge les ADR"
      contexts:
        - "architecture_choices_open"

shield:
  default_role: shield-orchestrator
  auto_triggers:
    shield-orchestrator:
      patterns:
        - "challenge the compliance scope"
        - "challenge le périmètre de conformité"
      contexts:
        - "compliance_scope_unstated"

maker:
  default_role: agent-maker
  auto_triggers:
    agent-maker:
      patterns:
        - "challenge the agent scope"
        - "challenge le périmètre de l'agent"
      contexts:
        - "agent_purpose_unclear"
