stealthos-cli 0.1.0-alpha.3 → 0.1.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/ai/CONTRACT.md +110 -0
  2. package/ai/INDEX.md +203 -0
  3. package/ai/README.md +434 -0
  4. package/ai/ROUTER.md +288 -0
  5. package/ai/agents/README.md +103 -0
  6. package/ai/agents/architect.md +59 -0
  7. package/ai/agents/backend-engineer.md +62 -0
  8. package/ai/agents/founder.md +45 -0
  9. package/ai/agents/frontend-engineer.md +61 -0
  10. package/ai/agents/product-manager.md +56 -0
  11. package/ai/agents/qa-engineer.md +53 -0
  12. package/ai/agents/researcher.md +74 -0
  13. package/ai/agents/reviewer.md +73 -0
  14. package/ai/agents/security-engineer.md +59 -0
  15. package/ai/agents/sre-engineer.md +70 -0
  16. package/ai/agents/tech-lead.md +70 -0
  17. package/ai/architecture/README.md +35 -0
  18. package/ai/architecture/components.md +24 -0
  19. package/ai/architecture/containers.md +30 -0
  20. package/ai/architecture/event-flows.md +36 -0
  21. package/ai/architecture/sequence-diagrams.md +38 -0
  22. package/ai/architecture/system-context.md +46 -0
  23. package/ai/architecture/threat-modeling.md +40 -0
  24. package/ai/blueprints/README.md +67 -0
  25. package/ai/blueprints/_schema.json +40 -0
  26. package/ai/blueprints/ai-platform.json +28 -0
  27. package/ai/blueprints/crm.json +22 -0
  28. package/ai/blueprints/game.json +25 -0
  29. package/ai/blueprints/mobile.json +24 -0
  30. package/ai/blueprints/realtime.json +22 -0
  31. package/ai/blueprints/saas.json +25 -0
  32. package/ai/blueprints/telemetry.json +30 -0
  33. package/ai/blueprints/web.json +23 -0
  34. package/ai/bootstrap/discovery-questions.md +117 -0
  35. package/ai/bootstrap/dispatcher.md +85 -0
  36. package/ai/bootstrap/existing-project.md +191 -0
  37. package/ai/bootstrap/new-project.md +127 -0
  38. package/ai/bootstrap/tech-mapping.md +164 -0
  39. package/ai/clients/README.md +114 -0
  40. package/ai/clients/antigravity.md +125 -0
  41. package/ai/clients/claude-code.md +65 -0
  42. package/ai/clients/cline.md +69 -0
  43. package/ai/clients/codex-aider-cli.md +82 -0
  44. package/ai/clients/continue.md +67 -0
  45. package/ai/clients/copilot.md +49 -0
  46. package/ai/clients/cursor.md +81 -0
  47. package/ai/clients/snippets/mcp-absolute-paths.json +9 -0
  48. package/ai/clients/snippets/mcp-http.json +7 -0
  49. package/ai/clients/snippets/mcp-stdio.json +9 -0
  50. package/ai/clients/trae.md +69 -0
  51. package/ai/clients/windsurf.md +71 -0
  52. package/ai/core/pipeline/execution-engine.md +157 -0
  53. package/ai/engineering/README.md +32 -0
  54. package/ai/engineering/observability/incident-response.md +82 -0
  55. package/ai/evals/protocol-tests.md +150 -0
  56. package/ai/evolution/agent-evolution.md +161 -0
  57. package/ai/evolution/improvements.md +91 -0
  58. package/ai/evolution/learnings.md +49 -0
  59. package/ai/evolution/patterns-discovered.md +48 -0
  60. package/ai/execution/README.md +33 -0
  61. package/ai/execution/backlog.md +27 -0
  62. package/ai/execution/milestones.md +26 -0
  63. package/ai/execution/roadmap.md +30 -0
  64. package/ai/execution/sprint.md +42 -0
  65. package/ai/governance/README.md +34 -0
  66. package/ai/governance/architecture-principles.md +99 -0
  67. package/ai/governance/definition-of-done.md +88 -0
  68. package/ai/governance/definition-of-ready.md +69 -0
  69. package/ai/governance/engineering-principles.md +70 -0
  70. package/ai/governance/quality-gates.md +85 -0
  71. package/ai/governance/security-policies.md +84 -0
  72. package/ai/hooks/enforce-audit.ps1 +41 -0
  73. package/ai/hooks/enforce-audit.sh +39 -0
  74. package/ai/hooks/guard-edit.ps1 +182 -0
  75. package/ai/hooks/guard-edit.sh +161 -0
  76. package/ai/hooks/inject-os-reminder.ps1 +40 -0
  77. package/ai/hooks/inject-os-reminder.sh +16 -0
  78. package/ai/manifest.json +238 -0
  79. package/ai/memory/_detected-stack.json +33 -0
  80. package/ai/memory/_summary.md +49 -0
  81. package/ai/memory/archive/.gitkeep +3 -0
  82. package/ai/memory/completed-tasks.md +156 -0
  83. package/ai/memory/decisions.md +257 -0
  84. package/ai/memory/errors-and-solutions.md +41 -0
  85. package/ai/memory/known-issues.md +40 -0
  86. package/ai/memory/pending-tasks.md +37 -0
  87. package/ai/memory/project-context.md +67 -0
  88. package/ai/operating-system/architecture.md +54 -0
  89. package/ai/operating-system/coding-standards.md +84 -0
  90. package/ai/operating-system/folder-structure.md +126 -0
  91. package/ai/operating-system/performance-rules.md +86 -0
  92. package/ai/operating-system/quality-control.md +81 -0
  93. package/ai/operating-system/security-rules.md +91 -0
  94. package/ai/operating-system/workflow.md +86 -0
  95. package/ai/product/README.md +24 -0
  96. package/ai/product/business-rules.md +26 -0
  97. package/ai/product/personas.md +29 -0
  98. package/ai/product/user-journeys.md +30 -0
  99. package/ai/product/vision.md +35 -0
  100. package/ai/rules/behavior.md +45 -0
  101. package/ai/rules/do.md +47 -0
  102. package/ai/rules/dont.md +46 -0
  103. package/ai/rules/execution-flow.md +125 -0
  104. package/ai/rules/structural-constraints.md +59 -0
  105. package/ai/rules/structure-canon.md +116 -0
  106. package/ai/runtime.md +179 -0
  107. package/ai/scripts/detect-stack.ps1 +166 -0
  108. package/ai/scripts/detect-stack.sh +172 -0
  109. package/ai/scripts/init-ai-os.ps1 +170 -0
  110. package/ai/scripts/init-ai-os.sh +99 -0
  111. package/ai/scripts/lint-os.ps1 +99 -0
  112. package/ai/scripts/lint-os.sh +85 -0
  113. package/ai/scripts/start-os.ps1 +151 -0
  114. package/ai/scripts/start-os.sh +141 -0
  115. package/ai/server/README.md +105 -0
  116. package/ai/server/aios-server.mjs +2134 -0
  117. package/ai/server/package-lock.json +802 -0
  118. package/ai/server/package.json +31 -0
  119. package/ai/server/src/analyzer/graph-builder.ts +92 -0
  120. package/ai/server/src/analyzer/index.ts +191 -0
  121. package/ai/server/src/analyzer/module-mapper.ts +171 -0
  122. package/ai/server/src/analyzer/smell-detector.ts +54 -0
  123. package/ai/server/src/analyzer/stack-detector.ts +70 -0
  124. package/ai/server/src/index.ts +16 -0
  125. package/ai/server/src/packager/context-builder.ts +217 -0
  126. package/ai/server/src/packager/index.ts +3 -0
  127. package/ai/server/src/packager/memory-injector.ts +128 -0
  128. package/ai/server/src/packager/module-summarizer.ts +60 -0
  129. package/ai/server/src/packager/token-estimator.ts +26 -0
  130. package/ai/server/src/snapshot/index.ts +3 -0
  131. package/ai/server/src/snapshot/snapshot-creator.ts +206 -0
  132. package/ai/server/src/snapshot/snapshot-diff.ts +86 -0
  133. package/ai/server/src/snapshot/snapshot-restore.ts +14 -0
  134. package/ai/server/src/types.ts +94 -0
  135. package/ai/server/tsconfig.json +26 -0
  136. package/ai/skills/architecture-design.md +82 -0
  137. package/ai/skills/backend-engineering.md +57 -0
  138. package/ai/skills/database-design.md +76 -0
  139. package/ai/skills/frontend-engineering.md +63 -0
  140. package/ai/skills/performance.md +73 -0
  141. package/ai/skills/scalability.md +84 -0
  142. package/ai/skills/security.md +71 -0
  143. package/ai/skills/testing.md +77 -0
  144. package/ai/specs/ADR/ADR-0002-typescript-runtime.md +103 -0
  145. package/ai/specs/ADR/ADR-0004-runtime-orchestrator.md +94 -0
  146. package/ai/specs/ADR/ADR-0005-workflow-engine.md +105 -0
  147. package/ai/specs/ADR/ADR-0006-runtime-state.md +104 -0
  148. package/ai/specs/ADR/ADR-0007-state-compiler-drift-context-layers-artifact-index.md +82 -0
  149. package/ai/specs/ADR/ADR-0008-intent-runtime-discovery-branching.md +93 -0
  150. package/ai/specs/ADR/ADR-0009-confidence-system-maturity-tracking.md +113 -0
  151. package/ai/specs/ADR/ADR-0010-structural-architecture-standards.md +121 -0
  152. package/ai/specs/ADR/ADR-0011-mcp-prompts.md +86 -0
  153. package/ai/specs/ADR/ADR-0012-stealthos-hybrid-architecture.md +174 -0
  154. package/ai/specs/ADR/_TEMPLATE.md +60 -0
  155. package/ai/specs/BRD/_TEMPLATE.md +50 -0
  156. package/ai/specs/PRD/_TEMPLATE.md +72 -0
  157. package/ai/specs/README.md +43 -0
  158. package/ai/specs/RFC/RFC-0001-runtime-orchestrator.md +149 -0
  159. package/ai/specs/RFC/RFC-0002-runtime-orchestrator-extended.md +134 -0
  160. package/ai/specs/RFC/_TEMPLATE.md +61 -0
  161. package/ai/specs/RUNBOOKS/_TEMPLATE.md +68 -0
  162. package/ai/specs/SDD/_TEMPLATE.md +104 -0
  163. package/ai/specs/TASKS/_TEMPLATE.md +52 -0
  164. package/ai/tools/debugging.md +64 -0
  165. package/ai/tools/dependency-analysis.md +46 -0
  166. package/ai/tools/internet-research.md +42 -0
  167. package/ai/tools/mcp-discovery.md +44 -0
  168. package/ai/workflows/_schema.json +81 -0
  169. package/ai/workflows/init.json +148 -0
  170. package/ai/workflows/sync.json +71 -0
  171. package/ai/workflows/work.json +91 -0
  172. package/package.json +7 -1
  173. package/scripts/bundle-ai.mjs +58 -0
  174. package/src/cli.mjs +1 -1
  175. package/src/commands/install.mjs +35 -11
  176. package/src/lib/resolve-source.mjs +27 -10
@@ -0,0 +1,104 @@
1
+ ---
2
+ id: SDD-NNNN
3
+ slug: <slug-kebab>
4
+ status: draft # draft | review | approved | deprecated | superseded-by-NNNN
5
+ owner: architect
6
+ created: AAAA-MM-DD
7
+ updated: AAAA-MM-DD
8
+ supersedes: null
9
+ related:
10
+ - PRD-NNNN
11
+ - ADR-NNNN, ADR-NNNN+1
12
+ - RFC-NNNN (se mudança em decisão prévia)
13
+ ---
14
+
15
+ # SDD-NNNN — <Título técnico>
16
+
17
+ ## 1. Resumo executivo
18
+ 3-5 frases: o que será construído, principais escolhas técnicas, riscos top-3.
19
+
20
+ ## 2. Contexto
21
+ Resumo do PRD-NNNN. Restrições adicionais de `context/constraints.md`.
22
+
23
+ ## 3. Visão de containers (C4 Level 2)
24
+
25
+ ```
26
+ [diagrama ASCII simples mostrando containers + tecnologia + interações]
27
+ ```
28
+
29
+ ## 4. Componentes (C4 Level 3 — opcional, só se complexidade justifica)
30
+
31
+ | Componente | Responsabilidade | Tecnologia | Localização |
32
+ |---|---|---|---|
33
+ | ... | ... | ... | ... |
34
+
35
+ ## 5. Contratos
36
+
37
+ ### 5.1 APIs HTTP
38
+ ```
39
+ POST /api/v1/foo
40
+ Headers: Authorization: Bearer <jwt>
41
+ Body: { ... } (zod schema)
42
+ Response 200: { ... }
43
+ Response 4xx: { error, code, details }
44
+ ```
45
+
46
+ ### 5.2 Eventos / Filas
47
+ | Evento | Payload | Producer | Consumer | Retry |
48
+ |---|---|---|---|---|
49
+ | ... | ... | ... | ... | ... |
50
+
51
+ ### 5.3 Schema DB
52
+ ```sql
53
+ -- migration NNN
54
+ CREATE TABLE ...;
55
+ CREATE INDEX ...;
56
+ ```
57
+
58
+ ## 6. Decisões técnicas (ADRs vinculadas)
59
+ - **ADR-NNNN**: <decisão crítica X> — escolhemos Y, descartamos Z.
60
+ - **ADR-NNNN+1**: ...
61
+
62
+ ## 7. Resiliência
63
+ | Chamada cross-system | Timeout | Retry | Circuit breaker | Fallback |
64
+ |---|---|---|---|---|
65
+ | ... | ... | ... | ... | ... |
66
+
67
+ ## 8. Segurança (threat model leve — STRIDE)
68
+ - **Spoofing**: <vetor> → <mitigação>
69
+ - **Tampering**: ...
70
+ - **Repudiation**: ...
71
+ - **Information disclosure**: ...
72
+ - **Denial of service**: ...
73
+ - **Elevation of privilege**: ...
74
+
75
+ ## 9. Escalabilidade
76
+ - **Hot path**: <qual operação tem mais tráfego>
77
+ - **Bottleneck previsto**: <DB? CPU? rede?>
78
+ - **Estratégia**: <cache, índice, partição, sharding, read replica, queue>
79
+ - **Quando reavaliar**: <métrica + threshold>
80
+
81
+ ## 10. Observabilidade
82
+ - **Logs**: prefixo `[<MODULE>]`, campos estruturados (request_id, user_id, latency_ms, status)
83
+ - **Métricas**: <lista de métricas custom>
84
+ - **Traces**: <span por hop>
85
+ - **Dashboards**: <link>
86
+ - **Alertas**: <métrica + threshold + runbook>
87
+
88
+ ## 11. Riscos
89
+ | Risco | Impacto | Probabilidade | Mitigação |
90
+ |---|---|---|---|
91
+ | ... | A/M/B | A/M/B | ... |
92
+
93
+ ## 12. Trade-offs aceitos
94
+ - Aceitamos <X negativo> para ganhar <Y positivo> porque <razão>.
95
+
96
+ ## 13. Plano de implementação (high-level — `tech-lead` detalha)
97
+ 1. Fase 1: <entregável A>
98
+ 2. Fase 2: <entregável B>
99
+ 3. Fase 3: ...
100
+
101
+ ## 14. Aprovação
102
+ - [ ] Architect concluiu
103
+ - [ ] Founder aprovou (G3)
104
+ - [ ] Pronto para entregar ao `tech-lead` (G4)
@@ -0,0 +1,52 @@
1
+ ---
2
+ id: TASK-NNNN
3
+ slug: <slug-kebab>
4
+ status: ready # ready | in-progress | review | done | blocked | cancelled
5
+ owner: backend-engineer | frontend-engineer | qa-engineer | ...
6
+ size: S | M | L
7
+ priority: P0 | P1 | P2 | P3
8
+ created: AAAA-MM-DD
9
+ related:
10
+ - SDD-NNNN §X
11
+ - PRD-NNNN
12
+ - depends-on: TASK-NNNN
13
+ ---
14
+
15
+ # TASK-NNNN — <Título acionável>
16
+
17
+ ## Origem
18
+ SDD-NNNN §X.Y / bug #XYZ / débito técnico em `context/technical-debt.md`
19
+
20
+ ## Critério de aceite (Gherkin)
21
+ - **Dado** <contexto>
22
+ - **Quando** <ação>
23
+ - **Então** <resultado verificável>
24
+
25
+ ## Arquivos a tocar
26
+ - `path/foo.ts` — <o que muda>
27
+ - `path/bar.tsx` — <o que muda>
28
+ - `tests/foo.test.ts` — <novo teste>
29
+
30
+ ## Dependências
31
+ - Bloqueado por: TASK-NNNN, ADR-NNNN
32
+ - Bloqueia: TASK-NNNN
33
+
34
+ ## Testes
35
+ - Unit: <descrição>
36
+ - Integration: <descrição>
37
+ - E2E: <descrição ou n/a>
38
+
39
+ ## Observabilidade a instrumentar
40
+ - Métrica: `<nome>` — quando incrementa, qual unit
41
+ - Log: prefixo `[<MODULE>]`, evento "<X>"
42
+ - Alerta: <se aplicável>
43
+
44
+ ## Notas
45
+ <contexto adicional, links, screenshots>
46
+
47
+ ## Done quando
48
+ - [ ] Critério de aceite verificado
49
+ - [ ] Build verde
50
+ - [ ] Tests novos passam
51
+ - [ ] DoD (`governance/definition-of-done.md`) cumprido
52
+ - [ ] PR aprovada (G7)
@@ -0,0 +1,64 @@
1
+ ---
2
+ version: 1.0.0
3
+ updated: 2026-05-14
4
+ tier: conditional
5
+ tokens: ~500
6
+ load: bugs, errors
7
+ triggers: bug, erro, error, falha, crash, exception, stacktrace
8
+ ---
9
+
10
+ # Tool: Protocolo de Debug
11
+
12
+ ## Princípio
13
+
14
+ > Causa raiz > sintoma. Reproduzir > supor. Bisecção > tentativa cega.
15
+
16
+ ## Fluxo
17
+
18
+ ### 1. Reproduzir
19
+ - Não debugue o que não reproduz. Se intermitente → registrar condições e frequência.
20
+ - Reproduzir no menor cenário possível (input mínimo).
21
+
22
+ ### 2. Isolar
23
+ - Bisecar: dividir o pipeline em metades, isolar a metade que falha, repetir.
24
+ - `git bisect` para regressões introduzidas por commit recente.
25
+ - Comentar/desativar blocos para isolar.
26
+
27
+ ### 3. Observar
28
+ - Logs com timestamp e nível.
29
+ - `console.log`/`print` temporários — REMOVER antes de commitar.
30
+ - Debugger > prints quando o estado é complexo.
31
+ - Network/DB queries quando o erro envolve I/O.
32
+
33
+ ### 4. Hipotetizar
34
+ - Listar 2-3 hipóteses ordenadas por probabilidade.
35
+ - Para cada uma: como confirmar/refutar em 1 passo.
36
+
37
+ ### 5. Corrigir
38
+ - Corrigir a CAUSA, não o sintoma.
39
+ - Se for paliativo, comentar "WORKAROUND:" + razão + link para issue.
40
+
41
+ ### 6. Testar
42
+ - Teste que falha sem a correção e passa com ela.
43
+ - Rodar suite completa para regressão.
44
+
45
+ ### 7. Registrar
46
+ - Sintoma + causa + correção em `memory/errors-and-solutions.md`.
47
+ - Se padrão recorrente → considerar `evolution/patterns-discovered.md` após 3+ ocorrências.
48
+
49
+ ## Anti-padrões
50
+
51
+ - "Funciona localmente" sem investigar diferença de ambiente.
52
+ - Aumentar timeout para mascarar race condition.
53
+ - try/catch genérico engolindo o erro.
54
+ - Reescrever do zero antes de entender o bug.
55
+ - "Reiniciar o servidor resolve" como solução definitiva.
56
+
57
+ ## Sinais de causa raiz não encontrada
58
+
59
+ - A correção exige número mágico.
60
+ - A correção quebra outra coisa "aleatoriamente".
61
+ - Você não consegue explicar POR QUE funciona.
62
+ - O bug "volta" depois de algum tempo.
63
+
64
+ Nesses casos → recuar, registrar como `known-issues.md`, escalar.
@@ -0,0 +1,46 @@
1
+ ---
2
+ version: 1.0.0
3
+ updated: 2026-05-14
4
+ tier: conditional
5
+ tokens: ~450
6
+ load: deps_changes
7
+ triggers: dependência, dependency, npm, pip, cargo, pacote, upgrade
8
+ ---
9
+
10
+ # Tool: Análise de Dependências
11
+
12
+ ## Antes de adicionar uma dependência
13
+
14
+ 1. **Justificar.** Pode resolver com 20-50 linhas próprias? Se sim, prefira código.
15
+ 2. **Auditar.**
16
+ - Idade do último release (> 1 ano = risco de abandono)
17
+ - Número de mantenedores ativos
18
+ - Issues abertas vs. fechadas
19
+ - Tamanho (`bundlephobia` para JS)
20
+ - Licença (MIT/Apache OK; GPL/AGPL exige análise)
21
+ 3. **Verificar duplicação.** Já existe outra lib no projeto que cobre o caso?
22
+ 4. **Pin version.** Não usar `^` ou `~` em libs críticas de produção sem lockfile robusto.
23
+
24
+ ## Antes de atualizar uma dependência
25
+
26
+ 1. Ler CHANGELOG entre versão atual e alvo.
27
+ 2. Identificar breaking changes.
28
+ 3. Subir em isolamento (uma lib por commit) para bisect simples se quebrar.
29
+ 4. Rodar suite completa de testes.
30
+
31
+ ## Antes de remover uma dependência
32
+
33
+ 1. Buscar uso em todo o repositório (`grep -r`).
34
+ 2. Verificar imports indiretos (algumas libs são re-exportadas).
35
+ 3. Atualizar lockfile e rodar testes.
36
+
37
+ ## Auditoria de segurança
38
+
39
+ - Rodar `npm audit` / `pip-audit` / `cargo audit` em CI.
40
+ - Vulnerabilidades críticas/altas → corrigir imediatamente, registrar em `memory/decisions.md`.
41
+ - Vulnerabilidades médias/baixas → avaliar exposição real antes de upgrade forçado.
42
+
43
+ ## Registro
44
+
45
+ - Dependência adicionada/removida → entrada em `memory/decisions.md` com motivo.
46
+ - Upgrade com breaking change → `memory/completed-tasks.md` + nota em `memory/errors-and-solutions.md` se houve correção.
@@ -0,0 +1,42 @@
1
+ ---
2
+ version: 1.0.0
3
+ updated: 2026-05-14
4
+ tier: conditional
5
+ tokens: ~350
6
+ load: research, docs, latest
7
+ triggers: documentação, docs, latest, recente, mudou, release
8
+ ---
9
+
10
+ # Tool: Pesquisa na Internet
11
+
12
+ ## Quando usar
13
+
14
+ - Documentação de biblioteca/API que você não tem certeza sobre versão atual.
15
+ - Erro com mensagem específica que não está em `memory/errors-and-solutions.md`.
16
+ - Mudança recente em ecossistema (ex: nova versão de framework liberada após knowledge cutoff).
17
+ - Comparação de bibliotecas/abordagens para uma decisão arquitetural.
18
+
19
+ ## Quando NÃO usar
20
+
21
+ - Pergunta respondível lendo o próprio repositório.
22
+ - Conhecimento já validado em `memory/` ou `evolution/`.
23
+ - Sintaxe básica de linguagem (verifique se realmente não sabe antes de buscar).
24
+
25
+ ## Protocolo
26
+
27
+ 1. **Formular query específica.** "react 19 use hook" > "react hooks".
28
+ 2. **Priorizar fontes oficiais**: docs do projeto > GitHub releases/issues > Stack Overflow recente > blogs.
29
+ 3. **Verificar data.** Resultado de >2 anos para ecossistema rápido (JS, Python ML) provavelmente desatualizado.
30
+ 4. **Cruzar 2+ fontes** antes de aplicar mudança não-trivial.
31
+ 5. **Citar fonte** na resposta ao usuário se a decisão depende dela.
32
+
33
+ ## Registro
34
+
35
+ - Se a pesquisa levou a uma decisão arquitetural → registrar em `memory/decisions.md` com link da fonte.
36
+ - Se resolveu um erro → `memory/errors-and-solutions.md` com link.
37
+
38
+ ## Anti-padrões
39
+
40
+ - Aceitar primeiro resultado sem ler.
41
+ - Copiar código de Stack Overflow sem entender.
42
+ - Buscar quando o repositório local já responde.
@@ -0,0 +1,44 @@
1
+ ---
2
+ version: 1.0.0
3
+ updated: 2026-05-14
4
+ tier: conditional
5
+ tokens: ~300
6
+ load: tooling, mcp, browser
7
+ triggers: mcp, tool, ferramenta, automação, browser, chrome, computer-use
8
+ ---
9
+
10
+ # Tool: Descoberta e Uso de MCPs
11
+
12
+ MCP = Model Context Protocol. Servidores MCP expõem ferramentas adicionais ao agente (browser, computer-use, GitHub, bancos de dados, etc.).
13
+
14
+ ## Inventário
15
+
16
+ Antes de assumir que uma ferramenta não existe:
17
+ 1. Listar MCPs disponíveis na sessão atual.
18
+ 2. Conferir se algum cobre o domínio da tarefa.
19
+ 3. Preferir MCP dedicado > MCP genérico > shell + biblioteca.
20
+
21
+ ## Hierarquia de Escolha
22
+
23
+ | Tarefa | Preferência |
24
+ |---|---|
25
+ | Operar app web | MCP dedicado do app (Slack, Linear...) → Chrome MCP → computer-use |
26
+ | Operar app nativo | computer-use |
27
+ | Operar terminal/IDE | Bash/PowerShell direto (computer-use é restrito nesses) |
28
+ | Manipular planilha/doc | Skill especializado (xlsx/docx/pdf) > script manual |
29
+
30
+ ## Antes de chamar um MCP
31
+
32
+ - Verificar se há permissão concedida (alguns exigem `request_access`).
33
+ - Verificar tier (read/click/full) — alguns MCPs têm restrições por categoria de app.
34
+ - Para web: verificar se o link é seguro antes de clicar.
35
+
36
+ ## Registro
37
+
38
+ Se descobrir capacidade nova ou limitação não-óbvia de um MCP, registrar em `memory/project-context.md` na seção "Ferramentas disponíveis".
39
+
40
+ ## Segurança
41
+
42
+ - Nunca seguir links suspeitos via computer-use — abrir via browser MCP que permite inspecionar URL.
43
+ - Nunca executar ações financeiras automatizadas.
44
+ - Confirmar com humano antes de operações destrutivas mesmo via MCP.
@@ -0,0 +1,81 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "AI OS Workflow",
4
+ "type": "object",
5
+ "required": ["id", "version", "description", "steps"],
6
+ "properties": {
7
+ "id": { "type": "string", "pattern": "^[a-z][a-z0-9_-]{1,32}$" },
8
+ "version": { "type": "string" },
9
+ "description": { "type": "string" },
10
+ "phase_advance": {
11
+ "type": "string",
12
+ "description": "Phase string a definir em state.lifecycle.phase após execução bem-sucedida. Use steps explícitos `aios_state_advance` se quiser também trocar mode."
13
+ },
14
+ "guarantees": {
15
+ "type": "array",
16
+ "description": "Invariantes que devem ser cumpridos ao final. Engine valida contra GUARANTEE_PROVIDERS. Não-cumpridos vão para report.unmet_guarantees.",
17
+ "items": {
18
+ "enum": [
19
+ "snapshot_created",
20
+ "state_updated",
21
+ "context_compiled",
22
+ "lint_clean",
23
+ "stack_detected",
24
+ "project_analyzed",
25
+ "core_loaded",
26
+ "memory_searched",
27
+ "query_routed",
28
+ "task_classified"
29
+ ]
30
+ }
31
+ },
32
+ "safety": {
33
+ "type": "object",
34
+ "properties": {
35
+ "project_files_readonly": {
36
+ "type": "boolean",
37
+ "description": "Declarativo (Fase 2): true significa que workflow não deve editar arquivos fora de .ai/. Engine reporta no relatório; futuro: bloqueio ativo."
38
+ }
39
+ }
40
+ },
41
+ "steps": {
42
+ "type": "array",
43
+ "minItems": 1,
44
+ "items": {
45
+ "type": "object",
46
+ "properties": {
47
+ "id": { "type": "string" },
48
+ "tool": { "type": "string", "pattern": "^aios_[a-z_]+$" },
49
+ "args": {
50
+ "type": "object",
51
+ "description": "Args para a tool. Strings suportam substituição ${input.X}, ${state.X}, ${timestamp}, ${resumed_input.X}, com fallback literal 'foo'."
52
+ },
53
+ "on_error": { "enum": ["abort", "continue"], "default": "abort" },
54
+ "pause_for": {
55
+ "type": "object",
56
+ "description": "Faz workflow pausar antes/depois deste step para coletar input do usuário. Engine retorna status='paused' + execution_id; cliente externo chama aios_resume_workflow para continuar.",
57
+ "properties": {
58
+ "when": { "enum": ["before", "after"], "default": "before" },
59
+ "reason": { "type": "string" },
60
+ "prompt": { "type": "string" },
61
+ "expected_input": { "type": "string" }
62
+ },
63
+ "required": ["reason", "prompt"]
64
+ },
65
+ "branches": {
66
+ "type": "array",
67
+ "description": "Lista de branches condicionais. Primeiro com 'when' verdadeiro executa; senão o 'default:true'. Expressão simples: <dotted.path> <op> <literal>. Operadores: ==, !=, in.",
68
+ "items": {
69
+ "type": "object",
70
+ "properties": {
71
+ "when": { "type": "string", "description": "Ex.: 'state.identity.maturity == \"empty\"'" },
72
+ "default": { "type": "boolean" },
73
+ "steps": { "type": "array" }
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }
79
+ }
80
+ }
81
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "$schema": "./_schema.json",
3
+ "id": "init",
4
+ "version": "3.0.0",
5
+ "description": "Inicializa o conhecimento do projeto. Ramifica entre Discovery Runtime (projeto novo, state.identity.maturity=='empty') e Reverse Engineering Runtime (projeto existente). Read-only no código do projeto (só edita .ai/).",
6
+ "safety": { "project_files_readonly": true },
7
+ "guarantees": [
8
+ "stack_detected",
9
+ "project_analyzed",
10
+ "context_compiled",
11
+ "snapshot_created",
12
+ "core_loaded",
13
+ "state_updated"
14
+ ],
15
+ "steps": [
16
+ {
17
+ "id": "init_branch",
18
+ "branches": [
19
+ {
20
+ "when": "state.identity.maturity == \"empty\"",
21
+ "steps": [
22
+ {
23
+ "id": "discovery_intro",
24
+ "tool": "aios_state_set",
25
+ "args": { "path": "lifecycle.mode", "value": "analysis" },
26
+ "on_error": "continue"
27
+ },
28
+ {
29
+ "id": "ask_project_name",
30
+ "tool": "aios_state_set",
31
+ "args": { "path": "rotating.active_focus", "value": "discovery: ask project name + domain" },
32
+ "on_error": "continue",
33
+ "pause_for": {
34
+ "when": "after",
35
+ "reason": "discovery_questionnaire",
36
+ "prompt": "Projeto novo detectado. Qual o nome do projeto e o domínio (ex.: 'TripPlanner — viagens com IA')?",
37
+ "expected_input": "string"
38
+ }
39
+ },
40
+ {
41
+ "id": "record_identity",
42
+ "tool": "aios_state_set",
43
+ "args": { "path": "identity.project_name", "value": "${resumed_input}" },
44
+ "on_error": "continue"
45
+ },
46
+ {
47
+ "id": "promote_to_minimal",
48
+ "tool": "aios_state_set",
49
+ "args": { "path": "identity.maturity", "value": "minimal" },
50
+ "on_error": "continue"
51
+ },
52
+ {
53
+ "id": "detect_stack",
54
+ "tool": "aios_detect_stack",
55
+ "args": {},
56
+ "on_error": "continue"
57
+ },
58
+ {
59
+ "id": "analyze_project",
60
+ "tool": "aios_analyze_project",
61
+ "args": { "write": true },
62
+ "on_error": "abort"
63
+ },
64
+ {
65
+ "id": "build_initial_context",
66
+ "tool": "aios_build_context_package",
67
+ "args": {
68
+ "intent": "${input.intent || 'discovery baseline'}",
69
+ "max_modules": 12,
70
+ "write": true
71
+ },
72
+ "on_error": "continue"
73
+ },
74
+ {
75
+ "id": "baseline_snapshot",
76
+ "tool": "aios_snapshot",
77
+ "args": { "label": "discovery-${timestamp}" },
78
+ "on_error": "continue"
79
+ },
80
+ {
81
+ "id": "load_core",
82
+ "tool": "aios_get_core_bundle",
83
+ "args": {},
84
+ "on_error": "abort"
85
+ },
86
+ {
87
+ "id": "advance_lifecycle",
88
+ "tool": "aios_state_advance",
89
+ "args": { "phase": "discovery", "mode": "analysis" },
90
+ "on_error": "continue"
91
+ }
92
+ ]
93
+ },
94
+ {
95
+ "default": true,
96
+ "steps": [
97
+ {
98
+ "id": "detect_stack",
99
+ "tool": "aios_detect_stack",
100
+ "args": {},
101
+ "on_error": "continue"
102
+ },
103
+ {
104
+ "id": "analyze_project",
105
+ "tool": "aios_analyze_project",
106
+ "args": { "write": true },
107
+ "on_error": "abort"
108
+ },
109
+ {
110
+ "id": "build_initial_context",
111
+ "tool": "aios_build_context_package",
112
+ "args": {
113
+ "intent": "${input.intent || 'reverse engineering baseline'}",
114
+ "max_modules": 12,
115
+ "write": true
116
+ },
117
+ "on_error": "continue"
118
+ },
119
+ {
120
+ "id": "baseline_snapshot",
121
+ "tool": "aios_snapshot",
122
+ "args": { "label": "init-${timestamp}" },
123
+ "on_error": "continue"
124
+ },
125
+ {
126
+ "id": "load_core",
127
+ "tool": "aios_get_core_bundle",
128
+ "args": {},
129
+ "on_error": "abort"
130
+ },
131
+ {
132
+ "id": "compile_context",
133
+ "tool": "aios_compile_runtime_context",
134
+ "args": { "write": true },
135
+ "on_error": "continue"
136
+ },
137
+ {
138
+ "id": "advance_lifecycle",
139
+ "tool": "aios_state_advance",
140
+ "args": { "mode": "execution" },
141
+ "on_error": "continue"
142
+ }
143
+ ]
144
+ }
145
+ ]
146
+ }
147
+ ]
148
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "$schema": "./_schema.json",
3
+ "id": "sync",
4
+ "version": "3.0.0",
5
+ "description": "Sincroniza o estado do projeto após mudanças: re-detecta stack, re-analisa, atualiza context package, valida integridade, gera snapshot, compila runtime-context, detecta drift, atualiza state. Use após bloco de desenvolvimento, antes de pausar, ou periodicamente. Read-only no código do projeto.",
6
+ "safety": { "project_files_readonly": true },
7
+ "guarantees": [
8
+ "stack_detected",
9
+ "project_analyzed",
10
+ "context_compiled",
11
+ "lint_clean",
12
+ "snapshot_created",
13
+ "runtime_context_compiled",
14
+ "drift_checked",
15
+ "state_updated"
16
+ ],
17
+ "steps": [
18
+ {
19
+ "id": "detect_stack",
20
+ "tool": "aios_detect_stack",
21
+ "args": {},
22
+ "on_error": "continue"
23
+ },
24
+ {
25
+ "id": "analyze_project",
26
+ "tool": "aios_analyze_project",
27
+ "args": { "write": true },
28
+ "on_error": "abort"
29
+ },
30
+ {
31
+ "id": "rebuild_context",
32
+ "tool": "aios_build_context_package",
33
+ "args": {
34
+ "intent": "${input.intent || 'periodic sync after development'}",
35
+ "max_modules": 12,
36
+ "write": true
37
+ },
38
+ "on_error": "continue"
39
+ },
40
+ {
41
+ "id": "lint_os",
42
+ "tool": "aios_lint",
43
+ "args": {},
44
+ "on_error": "continue"
45
+ },
46
+ {
47
+ "id": "snapshot",
48
+ "tool": "aios_snapshot",
49
+ "args": { "label": "${input.label || 'sync'}-${timestamp}" },
50
+ "on_error": "continue"
51
+ },
52
+ {
53
+ "id": "compile_runtime_context",
54
+ "tool": "aios_compile_runtime_context",
55
+ "args": { "max_modules": 10, "max_decisions": 5, "write": true },
56
+ "on_error": "continue"
57
+ },
58
+ {
59
+ "id": "detect_drift",
60
+ "tool": "aios_detect_drift",
61
+ "args": {},
62
+ "on_error": "continue"
63
+ },
64
+ {
65
+ "id": "record_sync_focus",
66
+ "tool": "aios_state_set",
67
+ "args": { "path": "rotating.active_focus", "value": "${input.intent || 'periodic sync'}" },
68
+ "on_error": "continue"
69
+ }
70
+ ]
71
+ }