version: 2
capabilities:
  - id: agentic-sdd-loop
    category: command
    title: Agentic SDD Loop
    stages: [project-discovery, risk, idea, prd, techspec, tasks, refinement, execution, adr, review, memory]
    trigger: Entrada de demanda por agent, card, bot, webhook ou texto livre que precisa virar ciclo SDD durável com checkpoint humano.
    canonical_source: templates/workflows/agentic-sdd-loop.yaml
    adapters:
      cli:
        command: sdd workflow run agentic-sdd-loop --input "<demanda>" --max-iterations 3 --json
        kind: workflow
      codex:
        path: .codex/commands/agentic-sdd-loop.md
        kind: command
      claude-code:
        path: .claude/commands/agentic-sdd-loop.md
        kind: command
      opencode:
        path: .opencode/commands/agentic-sdd-loop.md
        kind: command
      devin:
        path: .devin/workflows/agentic-sdd-loop.md
        kind: workflow
      antigravity:
        path: .agents/rules/sdd.md
        kind: rule
      trae:
        path: .trae/commands/agentic-sdd-loop.md
        kind: command
    fallback: Use `sdd workflow run standard-sdd --input "<demanda>" --json`, depois continue por `sdd auto run` e registre handoff manual.
    validation: [delegates-to-cli, checkpoints, artifact-store, preserve-pt-br, provider-fallback]
    docs:
      - docs/AGENTIC-SDD-LOOP.md
  - id: orchestration-skill
    category: skill
    title: Orchestration skill portável
    stages: [project-discovery, risk, idea, prd, techspec, tasks, refinement, execution, adr, review, memory]
    trigger: Fluxo SDD completo, etapas isoladas, artifact store, checkpoints e portabilidade entre clients.
    canonical_source: templates/client-skills/orchestration.md
    adapters:
      codex:
        path: .agents/skills/orchestration/SKILL.md
        kind: skill
      claude-code:
        path: .claude/skills/orchestration/SKILL.md
        kind: skill
      cursor:
        path: .cursor/skills/orchestration/SKILL.md
        kind: skill
      devin:
        path: .devin/skills/orchestration/SKILL.md
        kind: skill
      antigravity:
        path: .agents/skills/orchestration/SKILL.md
        kind: skill
      trae:
        path: .trae/skills/orchestration/SKILL.md
        kind: skill
    fallback: Se o client não carregar skills, invoque `sdd orchestration` pelo shell e salve artefatos com `sdd artifact save`.
    validation: [canonical-command, legacy-alias, checkpoints, artifact-store, preserve-pt-br, skill-frontmatter]
    docs:
      - https://developers.openai.com/codex/codex-manual.md
      - https://code.claude.com/docs/en/skills
      - https://opencode.ai/docs/skills/
      - https://cursor.com/docs/skills
  - id: stage-skills
    category: skill
    title: Skills portáveis por etapa SDD
    stages: [discover, risk, idea, prd, techspec, tasks, refinement, execution, adr, review, memory]
    trigger: Iniciar ou retomar uma etapa SDD isolada sem depender de command, subagent ou memória de conversa específicos do client.
    canonical_source: templates/client-skills/orchestration.md
    adapters:
      codex:
        path: .agents/skills/idea/SKILL.md
        kind: skill
      claude-code:
        path: .claude/skills/idea/SKILL.md
        kind: skill
      cursor:
        path: .cursor/skills/idea/SKILL.md
        kind: skill
      opencode:
        path: .opencode/skills/idea/SKILL.md
        kind: skill
      devin:
        path: .devin/skills/idea/SKILL.md
        kind: skill
      antigravity:
        path: .agents/skills/idea/SKILL.md
        kind: skill
      trae:
        path: .trae/skills/idea/SKILL.md
        kind: skill
    fallback: Se o client não carregar skills, use o command da etapa ou rode `sdd <stage> "$ARGUMENTS"` pelo terminal, preservando artifact store e checkpoints.
    validation: [delegates-to-cli, artifact-store, preserve-pt-br, skill-frontmatter, stage-skill-collection]
    docs:
      - docs/CLIENTS.md
      - docs/PROGRAMAS.md
      - docs/AGENTIC-SDD-LOOP.md
      - https://developers.openai.com/codex/skills
      - https://code.claude.com/docs/en/skills
      - https://opencode.ai/docs/skills/
      - https://cursor.com/docs/skills
      - https://docs.devin.ai/product-guides/skills
      - https://docs.trae.ai/ide/skills
  - id: orchestration-command
    category: command
    title: Slash command fino para orchestration
    stages: [project-discovery, risk, idea, prd, techspec, tasks, refinement, execution, adr, review, memory]
    trigger: Entrada slash command/workflow que deve delegar ao harness `sdd`.
    canonical_source: templates/client-skills/orchestration.md
    adapters:
      claude-code:
        path: .claude/commands/orchestration.md
        kind: command
      cursor:
        path: .cursor/commands/orchestration.md
        kind: command
      opencode:
        path: .opencode/commands/orchestration.md
        kind: command
      devin:
        path: .devin/workflows/orchestration.md
        kind: workflow
      trae:
        path: .trae/commands/orchestration.md
        kind: command
    fallback: Rode `sdd orchestration "<ideia>"` diretamente no terminal do projeto.
    validation: [canonical-command, delegates-to-cli]
    docs:
      - https://code.claude.com/docs/en/commands
      - https://opencode.ai/docs/commands/
      - https://docs.devin.ai/product-guides/creating-playbooks
  - id: diagram-command
    category: command
    title: Slash command para diagramas SDD
    stages: [idea, prd, techspec]
    trigger: Gerar ou anexar Mermaid/Excalidraw e companions HTML/SVG de `diagram-design` aos artefatos de planejamento.
    canonical_source: plugins/orchestration/commands/diagram.md
    adapters:
      cli:
        command: sdd diagram doctor --name "<ciclo>"
        kind: cli
      claude-code:
        path: .claude/commands/diagram.md
        kind: command
      cursor:
        path: .cursor/commands/diagram.md
        kind: command
      opencode:
        path: .opencode/commands/diagram.md
        kind: command
      devin:
        path: .devin/workflows/diagram.md
        kind: workflow
      trae:
        path: .trae/commands/diagram.md
        kind: command
    fallback: Use `artifact-diagrams` manualmente e anexe o arquivo visual com `sdd diagram attach`.
    validation: [delegates-to-cli, artifact-store, preserve-pt-br, provider-fallback]
    docs:
      - docs/ARTIFACTS.md
      - docs/SKILLS.md
  - id: sdd-agent-manifest
    category: agent
    title: Manifesto canônico do agente SDD
    stages: [project-discovery, risk, idea, prd, techspec, tasks, refinement, execution, adr, review, memory]
    trigger: Expor o agente principal `sdd-orchestrator` para clients ACP/MCP sem duplicar contrato por editor.
    canonical_source: templates/client-agents/sdd-orchestrator.md
    adapters:
      cli:
        command: sdd acp serve --root .
        kind: acp
      codex:
        path: .agents/agents/sdd-orchestrator/AGENT.md
        command: sdd acp serve --root .
        kind: agent
      antigravity:
        path: .agents/agents/sdd-orchestrator/AGENT.md
        command: sdd acp serve --root .
        kind: agent
    fallback: Se ACP ou MCP não estiverem disponíveis, rode `sdd workflow run agentic-sdd-loop --input "<demanda>" --max-iterations 3 --json` e persista artefatos em `docs/<slug>/`.
    validation: [delegates-to-cli, checkpoints, artifact-store, provider-fallback, preserve-pt-br, read-only]
    docs:
      - templates/client-agents/sdd-orchestrator.md
      - docs/CLIENTS.md
  - id: clients-doctor
    category: command
    title: Doctor de superfícies de clients
    stages: [project-discovery, review]
    trigger: Verificar cobertura de `.codex`, `.claude`, `.cursor`, `.opencode`, `.trae`, `.devin` e `.agents`.
    canonical_source: clients/README.md
    adapters:
      cli:
        command: sdd clients doctor
        kind: cli
      cursor:
        path: .cursor/commands/sdd.md
        command: sdd clients doctor
        kind: command
      devin:
        path: .devin/workflows/sdd.md
        command: sdd clients doctor
        kind: workflow
    fallback: Inspecione os paths listados em `clients/README.md` e rode `sdd clients sync --targets all`.
    validation: [adapter-command, delegates-to-cli]
    docs:
      - clients/README.md
  - id: sdd-mcp-observability
    category: mcp
    title: MCP read-only principal para context bundle, readiness, status, busca, artifacts, handoff, capabilities, agentes e traces
    stages: [project-discovery, techspec, execution, review, memory]
    trigger: Consultar o `sdd_context_bundle` como primeira leitura MCP, mais veredito de cockpit via `sdd_readiness_summary`, status compacto, busca única em artifacts/traces/handoffs, contexto SDD tipado, status de otimização, capability catalog, manifesto de agents, traces, adapters runtime e recomendações CodeGraph a partir de um client MCP.
    canonical_source: clients/README.md
    adapters:
      codex:
        path: .mcp.json
        command: sdd mcp serve --root .
        kind: mcp
      claude-code:
        path: .claude/settings.json
        command: sdd mcp serve --root .
        kind: permission
      cursor:
        path: .cursor/mcp.json
        command: sdd mcp serve --root .
        kind: mcp
    fallback: Use `sdd mcp doctor --root . --json`, `sdd health --json`, `sdd auto status --json`, `sdd workflow status`, `sdd trace list|show|summary|doctor`, `sdd artifact status`, `sdd context build`, `sdd capabilities doctor`, `sdd clients doctor` e `sdd mcp serve --root .` pelo terminal; quando MCP existir, comece por `sdd_readiness_summary` e `sdd_context_bundle`; adapters opcionais aparecem em `sdd_runtime_adapters`.
    validation: [mcp-server]
    docs:
      - clients/README.md
  - id: providers-doctor
    category: command
    title: Diagnóstico de provider e login
    stages: [project-discovery, execution, review]
    trigger: Diagnosticar provider/modelo, sessão deslogada, credenciais e fallback offline/provider-neutral.
    canonical_source: clients/README.md
    adapters:
      cli:
        command: sdd providers doctor
        kind: cli
      codex:
        path: clients/codex.md
        command: sdd providers doctor
        kind: doc
      claude-code:
        path: clients/claude-code.md
        command: sdd providers doctor
        kind: doc
      cursor:
        path: clients/cursor.md
        command: sdd providers doctor
        kind: doc
      opencode:
        path: clients/opencode.md
        command: sdd providers doctor
        kind: doc
      devin:
        path: clients/devin.md
        command: sdd providers doctor
        kind: doc
      antigravity:
        path: clients/antigravity.md
        command: sdd providers doctor
        kind: doc
      trae:
        path: clients/trae.md
        command: sdd providers doctor
        kind: doc
    fallback: Use artifact store local, registre provider resolvido e siga com modo offline quando credenciais estiverem ausentes.
    validation: [provider-fallback]
    docs:
      - clients/README.md
  - id: context-recommend
    category: context
    title: Recomendações de skills e rules por projeto
    stages: [project-discovery, techspec, execution, review]
    trigger: Após discovery ou quando a stack mudar, recomendar skills/rules/MCP/hooks específicos do projeto.
    canonical_source: templates/project-discovery.md
    adapters:
      cli:
        command: sdd context recommend
        kind: cli
      codex:
        path: .agents/skills/project-discovery/SKILL.md
        command: sdd context recommend
        kind: skill
      claude-code:
        path: .claude/skills/project-discovery/SKILL.md
        command: sdd context recommend
        kind: skill
    fallback: Gere recomendações manualmente a partir de manifests, CI, comandos, docs e arquivos de agentes do repo.
    validation: [adapter-command, delegates-to-cli, preserve-pt-br]
    docs:
      - templates/project-discovery.md
  - id: team-techspec
    category: command
    title: Agent Team para Tech Spec
    stages: [techspec]
    trigger: Tech Spec complexa, cross-layer, arriscada ou brownfield.
    canonical_source: .claude/commands/team-techspec.md
    adapters:
      claude-code:
        path: .claude/commands/team-techspec.md
        kind: command
      antigravity:
        path: .agents/skills/orchestration-plugin/commands/team-techspec.md
        kind: command
    fallback: Rode as lentes architecture/security/data/test sequencialmente no agente atual e sintetize uma Tech Spec única.
    validation: [preserve-pt-br]
    docs:
      - https://code.claude.com/docs/en/sub-agents
  - id: team-execution
    category: command
    title: Agent Team para Execution
    stages: [execution]
    trigger: Tasks independentes com ownership de arquivos claro.
    canonical_source: .claude/commands/team-execution.md
    adapters:
      claude-code:
        path: .claude/commands/team-execution.md
        kind: command
      antigravity:
        path: .agents/skills/orchestration-plugin/commands/team-execution.md
        kind: command
      opencode:
        path: .opencode/commands/team-execution.md
        kind: command
    fallback: Execute uma task por vez com `execution-discipline`, ownership explícito e verificação fresca.
    validation: [preserve-pt-br]
    docs:
      - https://code.claude.com/docs/en/sub-agents
  - id: team-review
    category: command
    title: Agent Team para Review
    stages: [review]
    trigger: PR não trivial, mudança cross-layer, risco de segurança/performance/dados ou release importante.
    canonical_source: .claude/commands/team-review.md
    adapters:
      claude-code:
        path: .claude/commands/team-review.md
        kind: command
      antigravity:
        path: .agents/skills/orchestration-plugin/commands/team-review.md
        kind: command
      opencode:
        path: .opencode/commands/team-review.md
        kind: command
    fallback: Rode checklist sequencial de segurança, performance, testes, arquitetura e contratos de dados em modo read-only.
    validation: [preserve-pt-br]
    docs:
      - https://code.claude.com/docs/en/sub-agents
  - id: opencode-verify-changes
    category: command
    title: OpenCode Verify Changes
    stages: [execution, review]
    trigger: Verificar diff recente em OpenCode com gates fail-fast antes de review, commit, merge ou handoff.
    canonical_source: .opencode/commands/verify-changes.md
    adapters:
      opencode:
        path: .opencode/commands/verify-changes.md
        kind: command
    fallback: Rode `sdd ci`, `sdd eval orchestration --name "<ciclo>" --json` e `sdd quality report --name "<ciclo>" --json` no shell.
    validation: [delegates-to-cli, artifact-store, checkpoints, preserve-pt-br]
    docs:
      - clients/opencode.md
  - id: opencode-security-audit
    category: command
    title: OpenCode Security Audit
    stages: [techspec, execution, review]
    trigger: Auditar segurança, privacidade, permissões, secrets e dados sensíveis a partir do OpenCode.
    canonical_source: .opencode/commands/security-audit.md
    adapters:
      opencode:
        path: .opencode/commands/security-audit.md
        kind: command
    fallback: Use a skill `security-privacy` no agente atual e registre achados no artifact store.
    validation: [delegates-to-cli, preserve-pt-br]
    docs:
      - clients/opencode.md
  - id: opencode-test-design
    category: command
    title: OpenCode Test Design
    stages: [techspec, tasks, refinement, execution, review]
    trigger: Planejar cobertura de testes por critérios de aceite sem executar implementação.
    canonical_source: .opencode/commands/test-design.md
    adapters:
      opencode:
        path: .opencode/commands/test-design.md
        kind: command
    fallback: Use a skill `test-strategy` no agente atual e liste comandos/evidências manualmente.
    validation: [delegates-to-cli, preserve-pt-br]
    docs:
      - clients/opencode.md
  - id: opencode-fast-lane
    category: command
    title: OpenCode Fast Lane SDD
    stages: [risk, execution, review]
    trigger: Mudança pequena e reversível que ainda precisa respeitar risco, rastreabilidade e verificação SDD.
    canonical_source: .opencode/commands/fast-lane.md
    adapters:
      opencode:
        path: .opencode/commands/fast-lane.md
        kind: command
    fallback: Volte ao fluxo `sdd orchestration` completo quando o risco não for baixo.
    validation: [delegates-to-cli, artifact-store, checkpoints, preserve-pt-br]
    docs:
      - clients/opencode.md
  - id: opencode-selected-skills
    category: skill
    title: Skills SDD selecionadas para OpenCode
    stages: [techspec, execution, review]
    trigger: Disponibilizar rubricas SDD de review, segurança, testes, arquitetura, execução e release como skills OpenCode.
    canonical_source: .opencode/skills/code-review/SKILL.md
    adapters:
      opencode:
        path: .opencode/skills/code-review/SKILL.md
        kind: skill
    fallback: Rode `sdd capabilities sync --targets opencode --dry-run` para revisar a materialização; use `sdd clients sync --targets opencode --force` apenas quando quiser sobrescrever a superfície OpenCode gerada.
    validation: [skill-frontmatter, preserve-pt-br, opencode-skill-collection]
    docs:
      - clients/opencode.md
  - id: automation
    category: automation
    title: Automação de PR, CI, deploy, checkpoints e memória
    stages: [review, memory]
    trigger: Acompanhar eventos externos, polling temporário, follow-up de PR/CI/deploy ou checkpoint pendente.
    canonical_source: .claude/commands/automation.md
    adapters:
      claude-code:
        path: .claude/commands/automation.md
        kind: command
      antigravity:
        path: .agents/skills/orchestration-plugin/commands/automation.md
        kind: command
    fallback: Registre evento, prompt, critério de parada e execute acompanhamento manual via `sdd artifact status`.
    validation: [preserve-pt-br]
    docs:
      - https://developers.openai.com/codex/codex-manual.md
  - id: hooks-guardrails
    category: hook
    title: Hooks SDD sob demanda
    stages: [execution, review]
    trigger: Executar validações determinísticas, auditoria e artifact gate via CLI/CI ou harness em modo estrito, sem instalar bloqueios automáticos por padrão.
    canonical_source: .agents/skills/orchestration-plugin/hooks/hooks.json
    adapters:
      claude-code:
        path: .claude/settings.json
        kind: settings
      antigravity:
        path: .agents/skills/orchestration-plugin/hooks/hooks.json
        kind: hook
      opencode:
        path: .opencode/plugins/sdd-security-scan.ts
        kind: plugin
    fallback: Rode `sdd hook <nome>` explicitamente no harness/CI ou registre a evidência esperada no artifact store; não dependa de `PreToolUse` para loops automáticos.
    validation: [hooks]
    docs:
      - https://code.claude.com/docs/en/hooks
      - https://developers.openai.com/codex/codex-manual.md
  - id: opencode-verification-plugin
    category: hook
    title: OpenCode Verification Plugin
    stages: [execution, review]
    trigger: Sugerir verificação SDD depois de mudanças relevantes sem formatar ou alterar arquivos automaticamente.
    canonical_source: .opencode/plugins/sdd-verification.ts
    adapters:
      opencode:
        path: .opencode/plugins/sdd-verification.ts
        kind: plugin
    fallback: Rode `/verify-changes` ou `sdd ci` manualmente antes do handoff.
    validation: [hooks, preserve-pt-br]
    docs:
      - clients/opencode.md
  - id: opencode-parallel-guard-plugin
    category: hook
    title: OpenCode Parallel Guard Plugin
    stages: [techspec, execution, review]
    trigger: Educar sobre paralelização real de tasks independentes em uma única rodada de subagents.
    canonical_source: .opencode/plugins/sdd-parallel-guard.ts
    adapters:
      opencode:
        path: .opencode/plugins/sdd-parallel-guard.ts
        kind: plugin
    fallback: Use `/team-review` ou `/team-execution` e sintetize resultados manualmente no lead.
    validation: [hooks, preserve-pt-br]
    docs:
      - clients/opencode.md
  - id: model-routing
    category: routing
    title: Roteamento de modelo por stage
    stages: [project-discovery, risk, idea, prd, techspec, tasks, refinement, execution, adr, review, memory]
    trigger: Selecionar modelo/esforço por etapa sem acoplar o contrato SDD a um provider.
    canonical_source: .codex/sdd-model-routing.toml
    adapters:
      codex:
        path: .codex/sdd-model-routing.toml
        kind: config
      cursor:
        path: .cursor/model-routing.yaml
        kind: config
      opencode:
        path: .opencode/model-routing.yaml
        kind: config
    fallback: Use `sdd providers list` e overrides em `sdd.config.yaml`.
    validation: []
    docs:
      - clients/README.md
