{
  "team_name": "tech-debt",
  "version": "1.0.0",
  "description": "技术债务识别与清理团队 - 融合\"债务扫描\"、\"量化评估\"、\"治理规划\"、\"清理执行\"、\"验证回归\"五大能力域，形成扫描→评估→规划→清理→验证的闭环",
  "skill_entry": "team-tech-debt",
  "invocation": "Skill(skill=\"team-tech-debt\", args=\"--role=coordinator ...\")",

  "roles": {
    "coordinator": {
      "name": "coordinator",
      "responsibility": "Orchestration",
      "task_prefix": null,
      "description": "技术债务治理协调者。编排 pipeline：需求澄清 → 模式选择 → 团队创建 → 任务分发 → 监控协调 → 质量门控 → 结果汇报",
      "message_types_sent": ["mode_selected", "quality_gate", "task_unblocked", "error", "shutdown"],
      "message_types_received": ["scan_complete", "assessment_complete", "plan_ready", "fix_complete", "validation_complete", "regression_found", "error"],
      "commands": ["dispatch", "monitor"]
    },
    "scanner": {
      "name": "scanner",
      "responsibility": "Orchestration (多维度债务扫描)",
      "task_prefix": "TDSCAN",
      "description": "技术债务扫描员。多维度扫描代码库：代码债务、架构债务、测试债务、依赖债务、文档债务，生成债务清单",
      "message_types_sent": ["scan_complete", "debt_items_found", "error"],
      "message_types_received": [],
      "commands": ["scan-debt"],
      "cli_tools": ["gemini"]
    },
    "assessor": {
      "name": "assessor",
      "responsibility": "Read-only analysis (量化评估)",
      "task_prefix": "TDEVAL",
      "description": "技术债务评估师。量化评估债务项的影响和修复成本，按优先级矩阵排序，生成评估报告",
      "message_types_sent": ["assessment_complete", "error"],
      "message_types_received": [],
      "commands": ["evaluate"],
      "cli_tools": ["gemini"]
    },
    "planner": {
      "name": "planner",
      "responsibility": "Orchestration (治理规划)",
      "task_prefix": "TDPLAN",
      "description": "技术债务治理规划师。制定分阶段治理方案：短期速赢、中期系统性治理、长期预防机制",
      "message_types_sent": ["plan_ready", "plan_revision", "error"],
      "message_types_received": [],
      "commands": ["create-plan"],
      "cli_tools": ["gemini"]
    },
    "executor": {
      "name": "executor",
      "responsibility": "Code generation (债务清理执行)",
      "task_prefix": "TDFIX",
      "description": "技术债务清理执行者。按优先级执行重构、依赖更新、代码清理、测试补充等治理动作",
      "message_types_sent": ["fix_complete", "fix_progress", "error"],
      "message_types_received": [],
      "commands": ["remediate"],
      "cli_tools": [{"tool": "gemini", "mode": "write"}]
    },
    "validator": {
      "name": "validator",
      "responsibility": "Validation (清理验证)",
      "task_prefix": "TDVAL",
      "description": "技术债务清理验证者。验证清理后无回归、质量指标提升、债务确实消除",
      "message_types_sent": ["validation_complete", "regression_found", "error"],
      "message_types_received": [],
      "commands": ["verify"],
      "cli_tools": [{"tool": "gemini", "mode": "write"}]
    }
  },

  "pipeline_modes": {
    "scan": {
      "description": "仅扫描评估，不执行修复（审计模式）",
      "stages": ["TDSCAN", "TDEVAL"],
      "entry_role": "scanner"
    },
    "remediate": {
      "description": "完整闭环：扫描 → 评估 → 规划 → 修复 → 验证",
      "stages": ["TDSCAN", "TDEVAL", "TDPLAN", "TDFIX", "TDVAL"],
      "entry_role": "scanner"
    },
    "targeted": {
      "description": "定向修复：用户已知债务项，直接规划执行",
      "stages": ["TDPLAN", "TDFIX", "TDVAL"],
      "entry_role": "planner"
    }
  },

  "fix_verify_loop": {
    "max_iterations": 3,
    "trigger": "validation fails or regression found",
    "participants": ["executor", "validator"],
    "flow": "TDFIX-fix → TDVAL-verify → evaluate"
  },

  "shared_memory": {
    "file": ".msg/meta.json",
    "fields": {
      "debt_inventory": { "owner": "scanner", "type": "array" },
      "assessment_matrix": { "owner": "assessor", "type": "object" },
      "remediation_plan": { "owner": "planner", "type": "object" },
      "fix_results": { "owner": "executor", "type": "object" },
      "validation_results": { "owner": "validator", "type": "object" },
      "debt_score_before": { "owner": "assessor", "type": "number" },
      "debt_score_after": { "owner": "validator", "type": "number" }
    }
  },

  "collaboration_patterns": [
    "CP-1: Linear Pipeline (scan/remediate/targeted mode)",
    "CP-2: Review-Fix Cycle (Executor ↔ Validator loop)",
    "CP-3: Fan-out (Scanner multi-dimension scan)",
    "CP-5: Escalation (Worker → Coordinator → User)",
    "CP-6: Incremental Delivery (batch remediation)",
    "CP-10: Post-Mortem (debt reduction report)"
  ],

  "debt_dimensions": {
    "code": { "name": "代码债务", "tools": ["static-analysis", "complexity-metrics"] },
    "architecture": { "name": "架构债务", "tools": ["dependency-graph", "coupling-analysis"] },
    "testing": { "name": "测试债务", "tools": ["coverage-analysis", "test-quality"] },
    "dependency": { "name": "依赖债务", "tools": ["outdated-check", "vulnerability-scan"] },
    "documentation": { "name": "文档债务", "tools": ["doc-coverage", "api-doc-check"] }
  },

  "session_directory": {
    "pattern": ".workflow/.team/TD-{slug}-{date}",
    "subdirectories": ["scan", "assessment", "plan", "fixes", "validation"]
  }
}
