@orkastery/cli 0.5.3 → 0.5.6

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 (212) hide show
  1. package/adapters/claude-code/README.md +158 -0
  2. package/adapters/claude-code/mods/autoridade.json +56 -0
  3. package/adapters/claude-code/mods/ork-clima/.claude-plugin/plugin.json +14 -0
  4. package/adapters/claude-code/mods/ork-clima/hooks/contas.ts +283 -0
  5. package/adapters/claude-code/mods/ork-clima/hooks/hooks.json +3 -0
  6. package/adapters/claude-code/mods/ork-clima/hooks/previsao.ts +393 -0
  7. package/adapters/claude-code/mods/ork-clima/hooks/register.ts +205 -0
  8. package/adapters/claude-code/mods/ork-clima/orkastery-mod.json +5 -0
  9. package/adapters/claude-code/mods/ork-clima/types/index.d.ts +80 -0
  10. package/adapters/claude-code/mods/ork-freio/.claude-plugin/plugin.json +14 -0
  11. package/adapters/claude-code/mods/ork-freio/hooks/carga.ts +160 -0
  12. package/adapters/claude-code/mods/ork-freio/hooks/conferencia.ts +309 -0
  13. package/adapters/claude-code/mods/ork-freio/hooks/hooks.json +3 -0
  14. package/adapters/claude-code/mods/ork-freio/hooks/lote.ts +270 -0
  15. package/adapters/claude-code/mods/ork-freio/hooks/register.ts +285 -0
  16. package/adapters/claude-code/mods/ork-freio/orkastery-mod.json +5 -0
  17. package/adapters/claude-code/mods/ork-freio/types/index.d.ts +127 -0
  18. package/adapters/claude-code/mods/ork-mesa/.claude-plugin/plugin.json +14 -0
  19. package/adapters/claude-code/mods/ork-mesa/hooks/cartoes.tsx +246 -0
  20. package/adapters/claude-code/mods/ork-mesa/hooks/decidir.ts +110 -0
  21. package/adapters/claude-code/mods/ork-mesa/hooks/fila.ts +253 -0
  22. package/adapters/claude-code/mods/ork-mesa/hooks/hooks.json +3 -0
  23. package/adapters/claude-code/mods/ork-mesa/hooks/obvia.ts +98 -0
  24. package/adapters/claude-code/mods/ork-mesa/hooks/register.tsx +493 -0
  25. package/adapters/claude-code/mods/ork-mesa/orkastery-mod.json +5 -0
  26. package/adapters/claude-code/mods/ork-mesa/types/index.d.ts +131 -0
  27. package/adapters/claude-code/mods/ork-pista/.claude-plugin/plugin.json +14 -0
  28. package/adapters/claude-code/mods/ork-pista/hooks/acoes.ts +71 -0
  29. package/adapters/claude-code/mods/ork-pista/hooks/ci.ts +117 -0
  30. package/adapters/claude-code/mods/ork-pista/hooks/hooks.json +3 -0
  31. package/adapters/claude-code/mods/ork-pista/hooks/pista.tsx +356 -0
  32. package/adapters/claude-code/mods/ork-pista/hooks/register.tsx +439 -0
  33. package/adapters/claude-code/mods/ork-pista/orkastery-mod.json +5 -0
  34. package/adapters/claude-code/mods/ork-pista/types/index.d.ts +85 -0
  35. package/adapters/claude-code/mods/ork-ponte/.claude-plugin/plugin.json +13 -0
  36. package/adapters/claude-code/mods/ork-ponte/hooks/faixa.tsx +57 -0
  37. package/adapters/claude-code/mods/ork-ponte/hooks/guarda.ts +410 -0
  38. package/adapters/claude-code/mods/ork-ponte/hooks/hooks.json +3 -0
  39. package/adapters/claude-code/mods/ork-ponte/hooks/mostrado.ts +55 -0
  40. package/adapters/claude-code/mods/ork-ponte/hooks/nucleo.ts +157 -0
  41. package/adapters/claude-code/mods/ork-ponte/hooks/papel.ts +42 -0
  42. package/adapters/claude-code/mods/ork-ponte/hooks/register.ts +331 -0
  43. package/adapters/claude-code/mods/ork-ponte/hooks/vigia.ts +76 -0
  44. package/adapters/claude-code/mods/ork-ponte/orkastery-mod.json +5 -0
  45. package/adapters/claude-code/mods/ork-ponte/types/index.d.ts +178 -0
  46. package/adapters/claude-code/mods/ork-portao/.claude-plugin/plugin.json +14 -0
  47. package/adapters/claude-code/mods/ork-portao/hooks/hooks.json +3 -0
  48. package/adapters/claude-code/mods/ork-portao/hooks/lease.ts +201 -0
  49. package/adapters/claude-code/mods/ork-portao/hooks/plano.ts +304 -0
  50. package/adapters/claude-code/mods/ork-portao/hooks/register.ts +339 -0
  51. package/adapters/claude-code/mods/ork-portao/hooks/verify.ts +152 -0
  52. package/adapters/claude-code/mods/ork-portao/orkastery-mod.json +5 -0
  53. package/adapters/claude-code/mods/ork-portao/types/index.d.ts +60 -0
  54. package/adapters/claude-code/mods/ork-radar/.claude-plugin/plugin.json +14 -0
  55. package/adapters/claude-code/mods/ork-radar/hooks/colisao.ts +420 -0
  56. package/adapters/claude-code/mods/ork-radar/hooks/hooks.json +3 -0
  57. package/adapters/claude-code/mods/ork-radar/hooks/mapa.tsx +322 -0
  58. package/adapters/claude-code/mods/ork-radar/hooks/register.tsx +470 -0
  59. package/adapters/claude-code/mods/ork-radar/orkastery-mod.json +5 -0
  60. package/adapters/claude-code/mods/ork-radar/types/index.d.ts +72 -0
  61. package/adapters/claude-code/mods/ork-sentinela/.claude-plugin/plugin.json +14 -0
  62. package/adapters/claude-code/mods/ork-sentinela/hooks/alertas.ts +85 -0
  63. package/adapters/claude-code/mods/ork-sentinela/hooks/despacho.ts +156 -0
  64. package/adapters/claude-code/mods/ork-sentinela/hooks/hooks.json +3 -0
  65. package/adapters/claude-code/mods/ork-sentinela/hooks/register.ts +511 -0
  66. package/adapters/claude-code/mods/ork-sentinela/hooks/vigia.ts +186 -0
  67. package/adapters/claude-code/mods/ork-sentinela/orkastery-mod.json +5 -0
  68. package/adapters/claude-code/mods/ork-sentinela/types/index.d.ts +65 -0
  69. package/adapters/claude-code/mods/ork-torre/.claude-plugin/plugin.json +14 -0
  70. package/adapters/claude-code/mods/ork-torre/hooks/agenda.ts +60 -0
  71. package/adapters/claude-code/mods/ork-torre/hooks/detalhe.tsx +236 -0
  72. package/adapters/claude-code/mods/ork-torre/hooks/frases.ts +42 -0
  73. package/adapters/claude-code/mods/ork-torre/hooks/hooks.json +3 -0
  74. package/adapters/claude-code/mods/ork-torre/hooks/painel.tsx +344 -0
  75. package/adapters/claude-code/mods/ork-torre/hooks/rede.ts +97 -0
  76. package/adapters/claude-code/mods/ork-torre/hooks/register.tsx +437 -0
  77. package/adapters/claude-code/mods/ork-torre/orkastery-mod.json +5 -0
  78. package/adapters/claude-code/mods/ork-torre/types/index.d.ts +108 -0
  79. package/adapters/hermes/skills/orkastery-devmaster/SKILL.md +1 -1
  80. package/adapters/openclaw/README.md +2 -1
  81. package/adapters/openclaw/openclaw.plugin.json +1 -1
  82. package/adapters/openclaw/package.json +1 -1
  83. package/assets/docs-en/markdownlint-cli2.jsonc +22 -0
  84. package/assets/docs-en/padroes/documentacao-de-produto.md +135 -0
  85. package/assets/docs-en/padroes/roadmap-de-produto.md +100 -0
  86. package/assets/docs-en/produto/README.md +14 -0
  87. package/assets/docs-en/produto/_modelo-feature.md +62 -0
  88. package/assets/docs-en/roadmap/README.md +14 -0
  89. package/assets/docs-en/roadmap/_modelo-item.md +75 -0
  90. package/dist/adapters/claude-bg.js +77 -13
  91. package/dist/adapters/codex.js +10 -1
  92. package/dist/agents-md.js +24 -15
  93. package/dist/auditrun.js +17 -2
  94. package/dist/board.js +4 -3
  95. package/dist/branch-de-estado.js +23 -1
  96. package/dist/catalogo.js +33 -0
  97. package/dist/ci.js +13 -7
  98. package/dist/claims-conferir.js +342 -0
  99. package/dist/claims.js +3 -1
  100. package/dist/company-brain-client.js +36 -1
  101. package/dist/company-brain-journal.js +2 -1
  102. package/dist/company-brain-migration.js +36 -1
  103. package/dist/conducao-sentinela.js +388 -0
  104. package/dist/conducao-texto.js +12 -18
  105. package/dist/conducao.js +122 -30
  106. package/dist/conhecimento.js +490 -0
  107. package/dist/docs.js +22 -8
  108. package/dist/doctor-pulse-cron.js +182 -27
  109. package/dist/doctor-rede.js +18 -17
  110. package/dist/doctor.js +115 -111
  111. package/dist/entrega-pr.js +22 -21
  112. package/dist/escopo-escrita.js +10 -1
  113. package/dist/estado-thread.js +23 -1
  114. package/dist/experiencia-instalacao.js +45 -25
  115. package/dist/fabrica-batida.js +310 -0
  116. package/dist/fabrica-estado.js +38 -8
  117. package/dist/fabrica-publicar.js +3 -1
  118. package/dist/fila-pesada.js +444 -0
  119. package/dist/fix.js +3 -2
  120. package/dist/forja.js +1 -1
  121. package/dist/gates.js +3 -28
  122. package/dist/handoff.js +10 -6
  123. package/dist/hitl-local-receipt.js +2 -0
  124. package/dist/hitl-resumo.js +29 -3
  125. package/dist/hitl-tempo-parado.js +4 -4
  126. package/dist/hitl.js +29 -33
  127. package/dist/horario.js +14 -7
  128. package/dist/hosts.js +52 -1
  129. package/dist/impedimento.js +108 -14
  130. package/dist/index.js +623 -521
  131. package/dist/indice.js +7 -1
  132. package/dist/init.js +43 -47
  133. package/dist/instabilidade.js +144 -0
  134. package/dist/integracoes-locais.js +2 -0
  135. package/dist/intelligence-graph-cli.js +92 -21
  136. package/dist/intelligence-graph-contexto.js +56 -17
  137. package/dist/intelligence-graph-contract.js +2 -1
  138. package/dist/intelligence-graph-extract-md.js +56 -4
  139. package/dist/intelligence-graph-extract-ts.js +71 -3
  140. package/dist/intelligence-graph-query.js +66 -19
  141. package/dist/ledger.js +15 -1
  142. package/dist/liveness.js +6 -3
  143. package/dist/locale-ajuda.js +761 -0
  144. package/dist/locale-gerados.js +160 -0
  145. package/dist/locale-master.js +99 -0
  146. package/dist/locale-onboarding.js +92 -0
  147. package/dist/locale-phase.js +151 -0
  148. package/dist/locale-pulse.js +211 -0
  149. package/dist/locale-retry.js +385 -0
  150. package/dist/locale-roadmap.js +102 -0
  151. package/dist/locale-ship.js +494 -0
  152. package/dist/locale-thread.js +277 -0
  153. package/dist/locale-verify.js +125 -0
  154. package/dist/locale.js +714 -0
  155. package/dist/manifest.js +129 -3
  156. package/dist/maquina.js +23 -4
  157. package/dist/master-digest.js +6 -1
  158. package/dist/master-nota.js +4 -6
  159. package/dist/master.js +21 -24
  160. package/dist/mcp-artifacts.js +11 -2
  161. package/dist/mcp-git.js +23 -6
  162. package/dist/mcp-grafo.js +7 -4
  163. package/dist/mcp-server.js +8 -2
  164. package/dist/mcp-ship.js +3 -1
  165. package/dist/mcp-verify.js +6 -1
  166. package/dist/modos.js +3 -6
  167. package/dist/network-roadmap.js +5 -2
  168. package/dist/noctum-arco.js +911 -0
  169. package/dist/noctum-capacidade.js +141 -0
  170. package/dist/noctum-envelope.js +810 -0
  171. package/dist/noctum-execucao.js +304 -0
  172. package/dist/noctum-fila.js +280 -0
  173. package/dist/ocupacao.js +29 -2
  174. package/dist/onboarding.js +40 -21
  175. package/dist/orkmind.js +9 -2
  176. package/dist/orquestracao.js +13 -12
  177. package/dist/parado-no-condutor.js +34 -9
  178. package/dist/phase.js +94 -39
  179. package/dist/policies.js +4 -4
  180. package/dist/portfolio.js +4 -2
  181. package/dist/postura-local.js +234 -0
  182. package/dist/preflight.js +11 -10
  183. package/dist/procedencia.js +225 -0
  184. package/dist/projeto-alvo.js +127 -4
  185. package/dist/prompts.js +6 -2
  186. package/dist/pulse-delivery.js +13 -2
  187. package/dist/pulse.js +52 -19
  188. package/dist/ratelimit.js +4 -2
  189. package/dist/redacao-saida.js +63 -0
  190. package/dist/rede-status.js +3 -2
  191. package/dist/retry.js +232 -148
  192. package/dist/roadmap-reservas.js +20 -3
  193. package/dist/roadmap-status.js +129 -33
  194. package/dist/runtime-context.js +181 -3
  195. package/dist/runtimes.js +2 -1
  196. package/dist/session-events.js +7 -3
  197. package/dist/session-watcher-claude.js +7 -1
  198. package/dist/session-watcher.js +185 -33
  199. package/dist/sessoes-contas.js +1 -1
  200. package/dist/ship-publicar.js +800 -0
  201. package/dist/ship.js +84 -81
  202. package/dist/steal.js +77 -0
  203. package/dist/thread-close.js +3 -2
  204. package/dist/thread.js +153 -82
  205. package/dist/util.js +8 -1
  206. package/dist/verify.js +141 -52
  207. package/dist/vida-da-thread.js +254 -0
  208. package/dist/worktree-local.js +165 -0
  209. package/dist/worktree.js +20 -0
  210. package/dist/yaml.js +27 -8
  211. package/package.json +1 -1
  212. package/schemas/code-artifact-graph.v1.schema.json +2 -1
@@ -0,0 +1,135 @@
1
+ # Software product documentation standard
2
+
3
+ > Version 1.1 · Applies to: platforms, systems, modules and features · Companion document: [Product roadmap standard](roadmap-de-produto.md)
4
+ >
5
+ > Version 1.1 keeps 1.0 and adds section 6 (three readers and SDLC facts) and the template frontmatter, which `ork docs verificar` checks.
6
+
7
+ The frontmatter keys and values, the section titles of the page templates and the `> **Em uma frase:**` line stay in Portuguese in every language, because they are the contract that `ork docs verificar` reads.
8
+
9
+ ## 1. Purpose and documentation unit
10
+
11
+ This standard describes **the product and its verifiable behavior**, from the platform context to the technical contracts. Create one page per relevant entity; a feature (`Feature`) is the recommended unit for specifying behavior. Lengthy details, such as OpenAPI contracts and data schemas, can live in their own files, linked by stable identifiers.
12
+
13
+ Use the hierarchy `Platform → System/Service → Module → Submodule/Domain → Feature`. A use case belongs to a feature; an operation represents an action of that feature. Entities and fields describe data; APIs, endpoints, events, triggers and jobs describe interfaces and execution. The same service or contract can serve several features: keep one canonical source and reference it, without copying divergent definitions.
14
+
15
+ The **roadmap** records the problems, hypotheses, choices, priorities and progress of changes. This documentation records current behavior and, when needed, future specification explicitly identified as such. Relate both through IDs and links; do not treat a proposal as an already delivered feature.
16
+
17
+ ## 2. Mandatory conventions
18
+
19
+ | Rule | How to apply |
20
+ | --- | --- |
21
+ | Identity | Assign stable IDs, for example `PLAT-01`, `SYS-01`, `MOD-01`, `FEAT-042`, `UC-042-01`, `BR-042-01`, `API-01`, `EVT-01`, `JOB-01` and `RM-042`. Renaming does not change the ID. In Orkastery, the number of a new FEAT comes from `ork roadmap feat`, reserved across machines; never from the highest number on your branch. |
22
+ | Scope and state | Say whether what the page describes is `vigente` (current), `em desenvolvimento` (in development), `proposto` (proposed) or `descontinuado` (discontinued), with environment, version and verification date. |
23
+ | Traceability | Link feature ↔ roadmap item ↔ use cases/rules ↔ contracts/schemas ↔ code/PR ↔ tests/evidence ↔ release. Use `Not applicable: reason` when a section does not make sense. |
24
+ | Source | Distinguish `confirmed` (code, contract, test or approved decision), `planned` (roadmap item) and `to be validated`. Never fill a gap by silent inference. |
25
+ | Form | Use clear language, in the language the product's docs are written in; keep the exact names of code, endpoints, flags and events in backticks. Dates in ISO 8601 with time zone; explicit units. |
26
+ | Responsibility | Record the page's human owner, the technical approver when applicable and the last review. An AI agent can propose changes, with source and human review defined by the team. |
27
+ | History | Behavior changes require updating the page and linking it to the roadmap item/release; relevant technical decisions point to an ADR. |
28
+
29
+ ## 3. Documentation categories
30
+
31
+ Fill in the applicable fields. For reusable entities, create their own pages and link their IDs to the feature page.
32
+
33
+ ### 3.1 Context and architecture
34
+
35
+ | Field | What to record |
36
+ | --- | --- |
37
+ | Platform; system/service; module; submodule | IDs, names and links to their respective parents. |
38
+ | Purpose; boundaries | Problem addressed, the component's responsibility and what does not belong to it. |
39
+ | Dependencies | Internal/external services and impact in case of failure. |
40
+ | Repository; code location | URL, directories and reference version/commit. |
41
+ | Deployment; environments | Deploy model, environments and regions actually used. |
42
+ | Isolation; configuration | Tenancy model and system parameters; cite names, effect, default and environment, never secret values. |
43
+ | Retention | Data types, retention period, disposal and approved policy/decision. |
44
+
45
+ ### 3.2 Features and behavior
46
+
47
+ | Field | What to record |
48
+ | --- | --- |
49
+ | Feature; actors/personas | ID, purpose, participating users and systems. |
50
+ | Use cases; operations | IDs and names; CRUD operations and business actions kept separate. |
51
+ | Preconditions; trigger | Required state and the action/event that starts the flow. |
52
+ | Main flow; alternatives | Observable steps and paths for error, cancellation, timeout and recovery. |
53
+ | Postconditions | Persisted changes, emitted messages and external effects. |
54
+ | Business rules | Atomic rule with ID, condition, result and exceptions. |
55
+ | Acceptance criteria | Testable scenarios, preferably Given/When/Then, linked to the rules. |
56
+ | Interface | Screens, components, states, accessibility and a reference to the approved prototype. |
57
+
58
+ ### 3.3 Data and fields
59
+
60
+ Define each entity once. For each field, record `technical name`, `label`, `type`, `unit`, `required`, `nullability`, `limits`, `validation`, `format/mask`, `default value`, `sensitivity classification`, `retention` and `source/destination`. Explain differences between the UI, API and database representations; for example, `refund_amount_cents` is an integer in cents and appears as currency in the interface. Relate the table/migration/schema and the contract version. Do not use a format regex as proof that a document number is semantically valid.
61
+
62
+ ### 3.4 APIs and integrations
63
+
64
+ Record `API/integration`, `protocol and version`, `provider/consumer`, `method and endpoint`, `path/query/header params`, `authentication`, `authorization`, `request`, `success response`, `errors`, `pagination`, `usage limits`, `timeout`, `idempotency`, `compatibility` and a link to the OpenAPI or canonical contract. Include sanitized examples without credentials; spell out the behavior on failures and with previous versions.
65
+
66
+ ### 3.5 Events, triggers and scheduled tasks
67
+
68
+ Record `event ID/name/version`, `producer`, `trigger`, `payload/schema`, `broker/topic`, `consumers`, `delivery/ordering`, `retry/backoff`, `DLQ`, `idempotency`, `observability` and `retention`. For jobs, include `ID`, `owner`, `schedule expression`, `time zone`, `timeout`, `concurrency`, `effects`, `retry` and the reprocessing procedure. A cron in UTC needs a readable description and a time zone reference.
69
+
70
+ ### 3.6 Observability and operations
71
+
72
+ Record `correlation_id/trace_id`, logs and allowed fields, technical and business metrics, SLI/SLO with a measurement window, alerts and thresholds, dashboards, error tracking, health checks, runbook, audit events and expected impact on cost/capacity. Distinguish a service objective (SLO) from a contractual commitment (SLA).
73
+
74
+ ### 3.7 Security, governance and compliance
75
+
76
+ Record risk, roles and the permission matrix (RBAC/ABAC), authentication/session, encryption and secrets management, handling of personal data, masking in logs, input validation, origin policies when there is a browser, applicable regulatory requirements, maintenance window and rollback procedure. Cite internal policies and approved decisions instead of assuming that every cited regulation applies.
77
+
78
+ ## 4. Feature page template
79
+
80
+ Reserve the number with `ork roadmap feat --thread <thread>` and copy [the template](../produto/_modelo-feature.md) for each feature; replace the brackets with values or with `Not applicable: reason`. The frontmatter is the layer that agents and the checker read; the body is the layer that people read. Add tables of fields and contracts when there are several elements.
81
+
82
+ Frontmatter keys of a feature:
83
+
84
+ | Key | Content | Checked by `ork docs verificar` |
85
+ | --- | --- | --- |
86
+ | `id`, `tipo`, `titulo` | `FEAT-000`, `feature`, name | ID format, file name, uniqueness |
87
+ | `estado` | `vigente`, `em desenvolvimento`, `proposto` or `descontinuado` | value from the standard |
88
+ | `pai` | `MOD-00` | exists and is from the level above |
89
+ | `roadmap` | list of `RM-000` | exists, and the item cites the feature back |
90
+ | `owner`, `aprovador` | people | presence |
91
+ | `verificado_em`, `versao` | ISO 8601 with time zone; branch@commit | format |
92
+ | `fontes.codigo`, `fontes.testes`, `fontes.docs` | paths relative to the root | **exist in the repository** |
93
+ | `fontes.simbolos` | `file#name` | **the name appears in the file** |
94
+ | `fontes.contratos` | contract IDs (`ork.hitl/v2`) | **appear in `fontes.codigo`** |
95
+ | `fontes.comandos` | commands of the product's CLI | **the CLI declares the command** |
96
+
97
+ ## 5. Review and synchronization
98
+
99
+ Before approving a change, check IDs and links, behavior and exceptions, names and types against code/migrations, API/event contracts, permissions, tests and the real environment. Update the documentation together with the implementation change; mark differences as `to be validated` with an owner and a deadline. Automation or an agent can compare sources and prepare a diff, but must record the commit/contract consulted and must not turn an assumption into a fact. Execution status and priority decisions live in the [roadmap standard](roadmap-de-produto.md).
100
+
101
+ In Orkastery, this comparison has an owner and a command:
102
+
103
+ - `ork docs verificar`: runs in CI on every PR; fails a page whose `fontes` no longer exist, or with a broken link, a repeated ID or a forgotten template field.
104
+ - `ork docs sincronizar`: runs on the project's machine; reads the threads' ledger and git and updates **only facts** (merge, phase), never status because time has passed. Without `--escrever`, it only shows what would change.
105
+ - `ork docs init`: creates this structure in any product conducted by Orkastery.
106
+
107
+ ## 6. Three readers and SDLC facts (Orkastery adaptation)
108
+
109
+ Every page is read by three readers at the same time. If one of them is left behind, the page has failed.
110
+
111
+ ### 6.1 Person with ADHD
112
+
113
+ - **Answer first.** Right below the title, a `> **Em uma frase:**` (in one sentence) line of up to 240 characters.
114
+ - **State at a glance.** State, verification date and version appear before any explanation.
115
+ - **One idea per line.** Bullets instead of paragraphs; a paragraph with more than 600 characters raises a warning.
116
+ - **Sections always have the same names.** Anyone who has read one page knows where everything is on the next.
117
+ - **Nothing silently empty.** A section without content says `Not applicable: reason` or `To be defined: owner, deadline`.
118
+
119
+ ### 6.2 Parity checker
120
+
121
+ - The page asserts checkable things: paths, symbols, contracts, commands, commits.
122
+ - A divergence between page and repository is a **lint error**, not a matter of opinion.
123
+ - The checker never fills a gap or infers a state; it only points them out.
124
+
125
+ ### 6.3 AI models and agents
126
+
127
+ - YAML frontmatter with fixed keys and values (section 4); stable IDs in the file name and in the title.
128
+ - `ork docs verificar --json` returns the findings with a typed rule (`docs.paridade.fonte`, `docs.leitura.resumo`...).
129
+ - An agent can propose the change; review and decision stay with people (section 2, Responsibility).
130
+
131
+ ### 6.4 SDLC facts of the Orkastery method
132
+
133
+ - **Product facts** go into the documentation: the feature is `vigente`, in which version, verified when, against which sources.
134
+ - Delivery progress (thread, phase, CHECK, merge) is recorded in the [roadmap](roadmap-de-produto.md), in the item's `sdlc` section.
135
+ - **Conduction micro-decisions stay out**: which claim was re-registered, which GO-FIX fixed a test, which session dropped. That lives in the thread's ledger.
@@ -0,0 +1,100 @@
1
+ # Software product roadmap standard
2
+
3
+ > Version 1.1 · Applies to: initiatives, epics, features and changes · Companion document: [Product documentation standard](documentacao-de-produto.md)
4
+ >
5
+ > Version 1.1 keeps 1.0 and adds section 6 (three readers and SDLC facts) and the template frontmatter, which `ork docs verificar` checks.
6
+
7
+ The frontmatter keys and values, the section titles of the page templates and the `> **Em uma frase:**` line stay in Portuguese in every language, because they are the contract that `ork docs verificar` reads.
8
+
9
+ ## 1. Purpose and tracking unit
10
+
11
+ This standard records **why to change, what is meant to be delivered, how to validate it and what the real state of execution is**. Use one item per traceable investment/delivery decision. Initiatives can contain epics, and epics can contain features; each item has its own ID and points to its parent item. An implemented feature points to its `FEAT-ID` specification. Do not replicate extensive technical fields of the product in the roadmap: keep links to the canonical documentation.
12
+
13
+ The roadmap is a planning view subject to revision. Dates, priorities and scope are commitments only when explicitly approved and identified as such. Mark estimates and hypotheses as such.
14
+
15
+ ## 2. Common rules
16
+
17
+ | Rule | How to apply |
18
+ | --- | --- |
19
+ | ID and links | Use a stable `RM-001`; state the parent, affected features and links to specifications, ADRs, issue, PR, tests and release. |
20
+ | Outcome | Spell out the problem, audience, objective, measurable hypothesis, baseline, target, window and source of the metric. |
21
+ | Prioritization | Record method, criteria, score and date; priority is distinct from urgency and does not replace a rationale. |
22
+ | Scope | Separate what is included, what is excluded, dependencies and assumptions. Scope changes call for a decision record. |
23
+ | Dates | Distinguish target, forecast and actual date; use ISO 8601, time zone and confidence level. Never infer progress from the date. |
24
+ | Evidence | Give the source and date of each status. Merged PR, deploy and availability to users are distinct facts. |
25
+ | Responsibility | Name a human owner for decision, execution and validation. AI agents can draft, verify or execute within recorded autonomy; assign review and the final decision to people. |
26
+ | Gaps | Use `To be defined` with an owner and a deadline; for an irrelevant section, `Not applicable: reason`. Do not make up status or metrics. |
27
+
28
+ ## 3. Roadmap item categories
29
+
30
+ ### 3.1 Identification and positioning
31
+
32
+ Record `ID`, `outcome-oriented title`, `type` (initiative, epic, feature or improvement; the `categoria` key takes `iniciativa`, `épico`, `feature` or `melhoria`), `parent item`, `platform`, `system`, `module`, `affected features`, `audience`, `requesting area`, `canonical links` and `page version`. The architectural hierarchy describes where the change happens; the roadmap hierarchy describes how it is planned.
33
+
34
+ ### 3.2 Problem, objective and hypothesis
35
+
36
+ Record `problem/opportunity`, `evidence`, `objective/OKR`, `hypothesis in the form If... then... because...`, `main metric`, `guardrail metrics`, `baseline`, `target`, `observation window`, `analysis segment` and `data source`. Without a known baseline, define how it will be measured before declaring success.
37
+
38
+ ### 3.3 Scope, deliverables and validation
39
+
40
+ Record `included scope`, `out of scope`, `deliverables`, `affected use cases`, `acceptance criteria`, `experiment/pilot`, `measurement plan`, `criteria to expand/stop`, `operational enablement` and `required documentation`. Point to the IDs of rules, contracts and tests in the product documentation.
41
+
42
+ ### 3.4 Prioritization and planning
43
+
44
+ Record `priority`, `method/score` (for example RICE, with explicit factors), `rationale`, `urgency`, `horizon` (Now/Next/Later or quarter), `target date`, `forecast`, `confidence`, `milestones`, `estimated capacity/cost` and `trade-offs`. A score without criteria and a date is not reproducible.
45
+
46
+ ### 3.5 Dependencies, risks and decisions
47
+
48
+ Record `dependencies with IDs and owners`, `blockers`, `assumptions not yet validated`, `risks with probability/impact`, `mitigation/contingency`, `product decisions`, `technical ADR`, `discarded alternatives`, `date/decider` and `review trigger`. An ADR is a decision record that can be superseded by another; preserve the history, without erasing earlier decisions.
49
+
50
+ ### 3.6 Lifecycle and independent states
51
+
52
+ Do not use a single field to hide differences between plan, code and delivery. Update each dimension separately:
53
+
54
+ | Dimension | Recommended values | Minimum evidence |
55
+ | --- | --- | --- |
56
+ | Item lifecycle | `Discovery` → `Backlog` → `Refinamento` (refinement) → `Pronto para desenvolvimento` (ready for development) → `Em desenvolvimento` (in development) → `Em validação` (in validation) → `Piloto` (pilot) → `Disponível` (available) → `Concluído` (done); side states: `Bloqueado` (blocked), `Cancelado` (canceled), `Descontinuado` (discontinued) | Decision, milestone or delivery with date and owner. |
57
+ | Documentation | `Rascunho` (draft), `Em revisão` (in review), `Aprovada` (approved), `Desatualizada` (outdated) | Link, version and reviewer. |
58
+ | Code | `Não iniciado` (not started), `Branch criada` (branch created), `PR aberto` (PR open), `Mesclado` (merged) | Repository, branch/PR and commit. |
59
+ | Tests | `Não iniciados` (not started), `Em execução` (running), `Aprovados` (passing), `Falhando` (failing) | Run and date; coverage, if relevant. |
60
+ | Deploy | `Não implantado` (not deployed), `Dev`, `Staging`, `Produção` (production) | Pipeline, release and actual date. |
61
+ | Exposure | `Flag desligada` (flag off), `Piloto/Canary` (pilot/canary), `Parcial` (partial), `Geral` (general) | Configuration per environment/cohort and verification. |
62
+ | Enablement | `Pendente` (pending), `Em andamento` (in progress), `Concluída` (done) | Communication, training or published material. |
63
+
64
+ `Bloqueado` requires a reason, a dependency, an owner and a next review. `Concluído` requires met acceptance criteria, evidence of availability and a record of the initial measurement or a post-launch evaluation plan. Status must not be updated merely because time has passed.
65
+
66
+ ### 3.7 Owners and collaboration between people and agents
67
+
68
+ Record `PM/PO accountable`, `technical lead`, `implementing engineer`, `QA/validator`, `sponsor`, `consulted`, `informed`, `channel`, `planning agent`, `execution agent`, `validation agent`, `allowed autonomy`, `human reviewer` and `RACI`. Separate an agent's contribution from the person who approves; document the actions taken and the evidence, without attributing decisions to an agent by default.
69
+
70
+ ## 4. Roadmap item template
71
+
72
+ Copy [the template](../roadmap/_modelo-item.md) for each item. The frontmatter holds the seven dimensions of section 3.6 with the standard's exact values, and the checker enforces coherence between them:
73
+
74
+ | Coherence rule | Why |
75
+ | --- | --- |
76
+ | `ciclo: Concluído` requires `codigo: Mesclado` and `testes: Aprovados` | done without code on the base branch is a promise |
77
+ | `deploy: Produção` requires `codigo: Mesclado` | you do not deploy what has not been merged |
78
+ | `codigo: Mesclado` requires `evidencias.codigo.commit` **on the base branch** | a merge is proven by git, not by declaration |
79
+ | `ciclo: Bloqueado` requires the `bloqueio` map (reason, dependency, owner, next review) | a blocker without an owner does not get cleared |
80
+
81
+ ## 5. Cadence and consistency
82
+
83
+ Revisit active items at the team's cadence and always after a decision, relevant PR, test, deploy, flag change or outcome measurement. At each review, compare roadmap, feature documentation, code, contracts and production evidence; note divergences with an owner and a deadline. Agents can suggest status updates from repository events, but a merged PR updates only the **code** dimension until deploy and exposure are proven. Record the update date and keep a history of decisions and scope changes.
84
+
85
+ In Orkastery, `ork docs sincronizar` is that agent: it updates `estado.codigo` and `evidencias.codigo.commit` from the ledger (`ship_done`) and git, and the `sdlc` section from the thread. **It never touches lifecycle, documentation, deploy, exposure or enablement**: those dimensions are a person's decision, and the checker only requires them to be coherent with the code. In a thread's worktree, it only touches that thread's item and the indexes, so that one thread's PR does not change another thread's item; `--so RM-NNN` picks the items, and `--todos` (the default at the project root, where the conductor syncs after the merge) goes back to all of them.
86
+
87
+ ## 6. Three readers and SDLC facts (Orkastery adaptation)
88
+
89
+ The reading rules of the [documentation standard](documentacao-de-produto.md#6-three-readers-and-sdlc-facts-orkastery-adaptation) apply here: answer first, state at a glance, one idea per line, sections with fixed names, frontmatter for agents.
90
+
91
+ What changes in the roadmap is the `sdlc` block, which ties the item to the Orkastery method **with product facts only**:
92
+
93
+ | Key | Content | Who fills it in |
94
+ | --- | --- | --- |
95
+ | `sdlc.thread` | ID of the thread that delivers the item | a person, when opening the thread |
96
+ | `sdlc.modo` | `#Classic`, `#Maestro` or `#Auto` | a person |
97
+ | `sdlc.fase`, `sdlc.status` | current phase and status of the thread | `ork docs sincronizar` |
98
+ | `sdlc.check` | latest verdict of the independent CHECK | a person, based on the assessment |
99
+
100
+ Conduction micro-decisions (re-registered claims, a GO-FIX for a test, a session that dropped) **stay out of the item**: they live in the thread's ledger, which is the method's audit record.
@@ -0,0 +1,14 @@
1
+ # Product documentation
2
+
3
+ > **In one sentence:** what the product is and does today, one page per entity, checked against the code on every PR.
4
+
5
+ - **Standard:** [product documentation](../padroes/documentacao-de-produto.md) · **Companion:** [roadmap](../roadmap/README.md)
6
+ - **Hierarchy:** platform (`PLAT`) → system (`SYS`) → module (`MOD`) → feature (`FEAT`)
7
+ - **New page:** copy [the template](_modelo-feature.md) and run `ork docs verificar`
8
+
9
+ ## Index
10
+
11
+ Generated by `ork docs sincronizar` from the frontmatter of each page, with the column labels in Portuguese.
12
+
13
+ <!-- ork-docs:indice:inicio -->
14
+ <!-- ork-docs:indice:fim -->
@@ -0,0 +1,62 @@
1
+ ---
2
+ id: FEAT-000
3
+ tipo: feature
4
+ titulo: <Feature name>
5
+ estado: proposto
6
+ pai: MOD-00
7
+ roadmap: [RM-000]
8
+ owner: <name>
9
+ aprovador: <name>
10
+ verificado_em: 2026-01-01T00:00:00-03:00
11
+ versao: main@0000000
12
+ fontes:
13
+ codigo: []
14
+ testes: []
15
+ simbolos: []
16
+ contratos: []
17
+ comandos: []
18
+ ---
19
+
20
+ <!-- The feature number comes from `ork roadmap feat --thread <thread>`, reserved across machines; never from the highest number on your branch. -->
21
+ <!-- Keep the frontmatter keys and values, the section titles and the "Em uma frase" line as they are: `ork docs verificar` reads them in Portuguese in every language. -->
22
+
23
+ # FEAT-000: Feature name
24
+
25
+ > **Em uma frase:** [what this feature does, for whom, in up to 240 characters]
26
+
27
+ - **State:** `proposto` · **Verified on:** [YYYY-MM-DD] · **Version:** [branch@commit]
28
+ - **Where it lives:** [PLAT-00 > SYS-00 > MOD-00, with links]
29
+ - **Roadmap:** [RM-000, with a link]
30
+ - **Page owner / approver:** [names]
31
+
32
+ ## Comportamento
33
+
34
+ - **Use cases and operations:** [UC-ID, action, actor]
35
+ - **Preconditions and trigger:** [what must exist and what starts it]
36
+ - **Main flow:**
37
+ 1. [observable step]
38
+ - **Alternatives, errors and recovery:** [error, cancellation, timeout, resume]
39
+ - **Postconditions:** [what is recorded, emitted or changed outside]
40
+ - **Business rules:** [BR-ID: condition → result; exception]
41
+ - **Acceptance criteria and tests:** [Given/When/Then, with the test that proves it]
42
+ - **Interface and accessibility:** [screens, states, prototype, or Not applicable: reason]
43
+
44
+ ## Dados e contratos
45
+
46
+ - **Entities and fields:** [links, types, validations, sensitivity]
47
+ - **APIs and endpoints:** [IDs, methods, contracts, errors, versioning]
48
+ - **Events and jobs:** [IDs, schemas, triggers, retries, time zone]
49
+
50
+ ## Operação e controle
51
+
52
+ - **Configuration and environments:** [parameters, no secrets]
53
+ - **Observability:** [metrics, SLO, logs, alerts, runbook]
54
+ - **Access, privacy and compliance:** [applicable controls]
55
+ - **Dependencies and rollback:** [what it uses and how to roll it back]
56
+ - **Code, PR, tests and release:** [identifiable links]
57
+
58
+ ## Histórico
59
+
60
+ | Date | Change | Author/reviewer | Evidence or decision |
61
+ | --- | --- | --- | --- |
62
+ | [YYYY-MM-DD] | [description] | [names] | [link] |
@@ -0,0 +1,14 @@
1
+ # Roadmap
2
+
3
+ > **In one sentence:** why change, what to deliver and where each item stands, with the state proven by git, not declared.
4
+
5
+ - **Standard:** [product roadmap](../padroes/roadmap-de-produto.md) · **Companion:** [product documentation](../produto/README.md)
6
+ - **One file per item:** `RM-000-subject.md`, with the state in the frontmatter
7
+ - **New item:** copy [the template](_modelo-item.md) and run `ork docs verificar`
8
+
9
+ ## Items
10
+
11
+ Generated by `ork docs sincronizar` from the frontmatter of each item, with the column labels in Portuguese.
12
+
13
+ <!-- ork-docs:indice:inicio -->
14
+ <!-- ork-docs:indice:fim -->
@@ -0,0 +1,75 @@
1
+ ---
2
+ id: RM-000
3
+ tipo: roadmap
4
+ titulo: <Intended result>
5
+ categoria: iniciativa
6
+ pai: null
7
+ features: []
8
+ owner: <name>
9
+ atualizado_em: 2026-01-01T00:00:00-03:00
10
+ estado:
11
+ ciclo: Discovery
12
+ documentacao: Rascunho
13
+ codigo: Não iniciado
14
+ testes: Não iniciados
15
+ deploy: Não implantado
16
+ exposicao: Flag desligada
17
+ habilitacao: Pendente
18
+ evidencias:
19
+ codigo:
20
+ commit: null
21
+ pr: null
22
+ sdlc:
23
+ thread: null
24
+ modo: null
25
+ ---
26
+
27
+ <!-- Keep the frontmatter keys and values, the section titles and the "Em uma frase" line as they are: `ork docs verificar` reads them in Portuguese in every language. -->
28
+
29
+ # RM-000: Intended result
30
+
31
+ > **Em uma frase:** [what this item delivers, for whom, in up to 240 characters]
32
+
33
+ <!-- ork-docs:relance:inicio -->
34
+ <!-- ork-docs:relance:fim -->
35
+
36
+ ## Problema e resultado
37
+
38
+ - **Audience and problem/opportunity:** [who suffers what]
39
+ - **Evidence and source:** [data, conversation, incident, with a link]
40
+ - **Objective/OKR:** [what changes for whom]
41
+ - **Hypothesis:** If [change], then [measurable effect], because [mechanism].
42
+ - **Main metric / baseline / target / window / source:** [values and origin]
43
+ - **Guardrail metrics:** [what must not get worse]
44
+
45
+ ## Escopo e validação
46
+
47
+ - **Included:** [what is in]
48
+ - **Out of scope:** [what is out]
49
+ - **Deliverables and acceptance criteria:** [deliverable → how it is proven]
50
+ - **Pilot, measurement and expand/stop criteria:** [how and when to decide]
51
+
52
+ ## Plano e decisões
53
+
54
+ - **Priority / method / score / rationale / date:** [values]
55
+ - **Horizon / target / forecast / confidence / milestones:** [values]
56
+ - **Dependencies and blockers (ID, owner, next review):** [list]
57
+ - **Assumptions / risks / mitigation:** [list]
58
+ - **Decisions, alternatives and ADRs (ID, decider, date, link):** [list]
59
+
60
+ ## Estado com evidências
61
+
62
+ The state is edited in the frontmatter; this table is generated by `ork docs sincronizar`, with its labels in Portuguese.
63
+
64
+ <!-- ork-docs:estado:inicio -->
65
+ <!-- ork-docs:estado:fim -->
66
+
67
+ ## Responsabilidades e histórico
68
+
69
+ - **RACI (R / A / C / I):** [names]
70
+ - **Agents involved, role, autonomy and human reviewer:** [who did what, and who approved]
71
+ - **Next action, owner and deadline:** [one line]
72
+
73
+ | Date | Change of plan, scope or status | Reason and evidence | Decider |
74
+ | --- | --- | --- | --- |
75
+ | [YYYY-MM-DD] | [description] | [link] | [name] |
@@ -42,11 +42,13 @@ var __importStar = (this && this.__importStar) || (function () {
42
42
  };
43
43
  })();
44
44
  Object.defineProperty(exports, "__esModule", { value: true });
45
- exports.JANELA_CURTA_MAX_MS = exports.NOME_ADAPTER = void 0;
45
+ exports.JANELA_CURTA_MAX_MS = exports.MOD_DOS_TETOS = exports.MINIMO_DA_API_DE_MODS = exports.NOME_ADAPTER = void 0;
46
46
  exports.ambienteDoPerfil = ambienteDoPerfil;
47
47
  exports.semContextoDeDespacho = semContextoDeDespacho;
48
48
  exports.disponivel = disponivel;
49
49
  exports.versao = versao;
50
+ exports.modsParaOClaude = modsParaOClaude;
51
+ exports.agentTeamsDoDespacho = agentTeamsDoDespacho;
50
52
  exports.montarComando = montarComando;
51
53
  exports.extrairSessionId = extrairSessionId;
52
54
  exports.listarSessoes = listarSessoes;
@@ -73,6 +75,7 @@ const path = __importStar(require("node:path"));
73
75
  const runtime_context_1 = require("../runtime-context");
74
76
  const runtime_profiles_1 = require("../runtime-profiles");
75
77
  const mcp_grafo_1 = require("../mcp-grafo");
78
+ const locale_1 = require("../locale");
76
79
  function exec(cmd, args, cwd, timeoutMs, ambiente = (0, runtime_ambiente_1.ambienteDeAssinatura)()) {
77
80
  return (0, util_1.exec)(cmd, args, cwd, timeoutMs, ambiente);
78
81
  }
@@ -138,6 +141,63 @@ function versao() {
138
141
  }
139
142
  /** Ferramentas de arquivo negadas no PLAN: o plano sai pelo núcleo, não pelo disco. */
140
143
  const ESCRITA_DE_ARQUIVO = ['Edit', 'Write', 'NotebookEdit'];
144
+ /** O contexto do despacho conferido para o host Claude Code (D4 do RM-037: o host errado recusa antes de tudo). */
145
+ function validarDoClaude(contexto, cwd) {
146
+ if (contexto.host !== 'claude-code')
147
+ throw Error('runtime.context.invalid: host Claude esperado');
148
+ return (0, runtime_context_1.validarContextoRuntime)(contexto, cwd);
149
+ }
150
+ /** RM-059 (T0.7, D2): a API de mods saiu no Claude Code 2.1.287; nenhum mod vai a um `claude` mais velho. */
151
+ exports.MINIMO_DA_API_DE_MODS = '2.1.287';
152
+ /** `2.1.296 (Claude Code)` vira `[2, 1, 296]`; texto sem versao vira `null`. */
153
+ function versaoNumerica(texto) {
154
+ const m = /(\d+)\.(\d+)\.(\d+)/.exec(texto ?? '');
155
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
156
+ }
157
+ function atende(versao, minimo) {
158
+ const i = versao.findIndex((parte, j) => parte !== minimo[j]);
159
+ return i < 0 || versao[i] > minimo[i];
160
+ }
161
+ /**
162
+ * RM-059 (T0.7, D2): os mods de fase que este `claude` carrega. O mod que pede versao mais nova fica de
163
+ * fora e o despacho segue, porque o nucleo nao depende de mod; versao ilegivel nao leva mod nenhum. Mod
164
+ * cuja dependencia ficou de fora (por versao, ou por ser so de papel `dono`) tambem fica: sem ela, ele
165
+ * carregaria pela metade na sessao de fase.
166
+ */
167
+ function modsParaOClaude(mods, versao) {
168
+ const atual = versaoNumerica(versao);
169
+ if (!atual)
170
+ return [];
171
+ const piso = versaoNumerica(exports.MINIMO_DA_API_DE_MODS);
172
+ let vao = mods.filter((m) => atende(atual, piso) && atende(atual, versaoNumerica(m.claudeCodeMinimo) ?? piso));
173
+ for (;;) {
174
+ const nomes = new Set(vao.map((m) => m.nome));
175
+ const sobram = vao.filter((m) => m.dependencias.every((d) => nomes.has(d)));
176
+ if (sobram.length === vao.length)
177
+ return vao;
178
+ vao = sobram;
179
+ }
180
+ }
181
+ /** RM-059 (T10.4): o mod que aplica os tetos de agent teams dentro da sessao de fase. */
182
+ exports.MOD_DOS_TETOS = 'ork-portao';
183
+ /**
184
+ * RM-059 (T10.4, D11 da thread ork-rm059portao): o que o despacho acrescenta ao `--settings` para agent teams no
185
+ * piloto, e so quando o contexto validado trouxe os tetos (manifesto ligado, GO no bloco) e o Portao de Tarefas esta
186
+ * entre os mods que vao de fato a sessao: sem ele, ninguem aplicaria os tetos. A sessao de fundo nao tem `tmux`, entao
187
+ * os teammates rodam no mesmo processo (`teammateMode` `in-process`).
188
+ */
189
+ function agentTeamsDoDespacho(tetos, mods) {
190
+ if (!tetos || !mods.some((m) => m.nome === exports.MOD_DOS_TETOS))
191
+ return null;
192
+ return {
193
+ env: {
194
+ CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1',
195
+ ORK_AGENT_TEAMS_TEAMMATES: String(tetos.teammates),
196
+ ORK_AGENT_TEAMS_CUSTO_USD: String(tetos.custo_usd),
197
+ },
198
+ teammateMode: 'in-process',
199
+ };
200
+ }
141
201
  /** Monta a linha de comando exata do despacho (usada tambem pelo `--dry-run`). */
142
202
  function montarComando(pedido) {
143
203
  const args = ['--bg', pedido.prompt, '--name', pedido.nome];
@@ -153,13 +213,17 @@ function montarComando(pedido) {
153
213
  // O `claude --bg` entrega a sessao a um processo reserva do daemon da conta, e o daemon guarda o
154
214
  // ambiente de quem o iniciou: pelo ambiente, a sessao nascia com a identidade de outro despacho.
155
215
  // Medido em 28/09/2026 (2.1.284): o `env` de `--settings` chega ao Bash da sessao e vence o herdado.
156
- const doDespacho = pedido.ambienteExtra ?? {};
157
- if (Object.keys(doDespacho).length)
158
- args.push('--settings', JSON.stringify({ env: doDespacho }));
159
- if (pedido.contextoRuntime) {
160
- if (pedido.contextoRuntime.host !== 'claude-code')
161
- throw Error('runtime.context.invalid: host Claude esperado');
162
- const contexto = (0, runtime_context_1.validarContextoRuntime)(pedido.contextoRuntime, pedido.cwd);
216
+ const contexto = pedido.contextoRuntime ? validarDoClaude(pedido.contextoRuntime, pedido.cwd) : null;
217
+ // RM-059 (T0.7): cada mod de fase conferido entra com o proprio --plugin-dir, depois do plugin do Orkastery.
218
+ const mods = !contexto || contexto.modsDeFase.length === 0 ? []
219
+ : modsParaOClaude(contexto.modsDeFase, pedido.versaoClaude !== undefined ? pedido.versaoClaude : versao());
220
+ // RM-059 (T10.4): agent teams so no piloto, com os tetos no env e o Portao na sessao; sem eles, o --settings de antes.
221
+ const teams = agentTeamsDoDespacho(contexto?.agentTeams, mods);
222
+ const doDespacho = { ...(pedido.ambienteExtra ?? {}), ...(teams ? teams.env : {}) };
223
+ if (Object.keys(doDespacho).length) {
224
+ args.push('--settings', JSON.stringify(teams ? { env: doDespacho, teammateMode: teams.teammateMode } : { env: doDespacho }));
225
+ }
226
+ if (contexto) {
163
227
  const consultas = [...CONSULTAS_MCP, ...(contexto.grafoMcp ? consultasDoGrafoMcp() : [])];
164
228
  // Somente o servidor gerado: nao mesclar MCP de outros escopos nesta sessao filha.
165
229
  const permissoes = contexto.permissoesFilho === 'worktree'
@@ -169,7 +233,7 @@ function montarComando(pedido) {
169
233
  const allow = plano ? [...consultas, 'mcp__orkastery__ork_artifact_write', 'mcp__orkastery__ork_decision_record']
170
234
  : permissoes?.allow ?? consultas;
171
235
  const deny = [...(plano ? ESCRITA_DE_ARQUIVO : []), ...(permissoes?.deny ?? [])];
172
- args.push('--plugin-dir', contexto.instalacao, '--strict-mcp-config', '--mcp-config', JSON.stringify({ mcpServers: { orkastery: contexto.servidor } }), '--allowedTools', allow.join(','));
236
+ args.push('--plugin-dir', contexto.instalacao, ...mods.flatMap((m) => ['--plugin-dir', m.dir]), '--strict-mcp-config', '--mcp-config', JSON.stringify({ mcpServers: { orkastery: contexto.servidor } }), '--allowedTools', allow.join(','));
173
237
  if (deny.length)
174
238
  args.push('--disallowedTools', deny.join(','));
175
239
  }
@@ -203,15 +267,15 @@ function listarSessoes(cwd, todas = false, ambiente = (0, runtime_ambiente_1.amb
203
267
  * falha aqui (o observador e o pulse não concluem nada dele); só o inventário o trata como fonte
204
268
  * ausente, com a correção.
205
269
  */
206
- function consultarSessoes(cwd, todas = false, ambiente = (0, runtime_ambiente_1.ambienteDeAssinatura)()) {
270
+ function consultarSessoes(cwd, todas = false, ambiente = (0, runtime_ambiente_1.ambienteDeAssinatura)(), prazoMs = 60000) {
207
271
  const args = ['agents', '--json'];
208
272
  if (todas)
209
273
  args.push('--all');
210
- const r = exec('claude', args, undefined, 60000, ambiente);
274
+ const r = exec('claude', args, undefined, prazoMs, ambiente);
211
275
  if (r.error === 'ENOENT')
212
- return { ok: false, ausente: true, sessoes: [], detalhe: 'binário `claude` fora do PATH' };
276
+ return { ok: false, ausente: true, sessoes: [], detalhe: (0, locale_1.textoDoCatalogo)((m) => m.pulse.claudeForaDoPath) };
213
277
  if (!r.ok)
214
- return { ok: false, sessoes: [], detalhe: `claude agents falhou (código ${r.code})` };
278
+ return { ok: false, sessoes: [], detalhe: (0, locale_1.textoDoCatalogo)((m) => m.pulse.claudeAgentsFalhou(r.code)) };
215
279
  let dados;
216
280
  try {
217
281
  const bruto = JSON.parse(r.stdout);
@@ -48,6 +48,7 @@ exports.montarComando = montarComando;
48
48
  exports.extrairThreadId = extrairThreadId;
49
49
  exports.acharRollout = acharRollout;
50
50
  exports.parseRateLimitCodex = parseRateLimitCodex;
51
+ exports.ambienteDoFilho = ambienteDoFilho;
51
52
  exports.despachar = despachar;
52
53
  exports.logs = logs;
53
54
  const codex_controller_1 = require("./codex-controller");
@@ -351,6 +352,14 @@ function parseRateLimitCodex(saida, agoraMs = Date.now()) {
351
352
  const linha = (saida ?? '').split('\n').find((l) => frase.test(l)) ?? saida;
352
353
  return { resetEm: null, fonte: 'sem-horario', trecho: linha.trim().slice(0, 200) };
353
354
  }
355
+ /**
356
+ * O ambiente do filho do despacho: o do processo, sem provider pago, com o contexto da condução POR
357
+ * CIMA. RM-052 (fatia 2, D2): a ordem importa, porque e o extra que neutraliza o `ORK_PROJETO` e o
358
+ * modo host herdados de quem despachou.
359
+ */
360
+ function ambienteDoFilho(pedido, base = process.env) {
361
+ return { ...ambienteDoDespacho(base, pedido.perfil), ...(pedido.ambienteExtra ?? {}) };
362
+ }
354
363
  /** Despacho governado exige vínculo: nenhum fallback implícito para codex exec. */
355
364
  function despachar(pedido) {
356
365
  if (!pedido.vinculo)
@@ -370,7 +379,7 @@ function despachar(pedido) {
370
379
  }
371
380
  let ambiente;
372
381
  try {
373
- ambiente = { ...ambienteDoDespacho(process.env, pedido.perfil), ...(pedido.ambienteExtra ?? {}) };
382
+ ambiente = ambienteDoFilho(pedido);
374
383
  }
375
384
  catch (e) {
376
385
  return { ok: false, comando: [], sessionId: null, verificada: false, stdout: '', stderr: '', erro: e.message };