atlas-workflow 0.9.2 → 0.9.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 (113) hide show
  1. package/README.md +18 -9
  2. package/VERSION +1 -1
  3. package/build/bump-version.mjs +6 -21
  4. package/build/cli/atlas-init.mjs +92 -5
  5. package/build/tests/etapa3.test.mjs +36 -6
  6. package/hosts/opencode/.opencode/atlas/VERSION +1 -1
  7. package/hosts/opencode/.opencode/atlas/orchestrator/README.md +15 -2
  8. package/hosts/opencode/.opencode/atlas/orchestrator/commands/workflow.md +7 -5
  9. package/hosts/opencode/.opencode/atlas/orchestrator/references/host-adapters.md +13 -12
  10. package/hosts/opencode/.opencode/atlas/orchestrator/references/subagent_dispatch.md +11 -1
  11. package/hosts/opencode/.opencode/atlas/orchestrator/skills/atlas-workflow-orchestrator/SKILL.md +32 -10
  12. package/hosts/opencode/.opencode/atlas/packages/mcp-server/README.md +2 -2
  13. package/hosts/opencode/.opencode/atlas/packages/mcp-server/package.json +1 -1
  14. package/hosts/opencode/.opencode/atlas/packages/mcp-server/server.js +149 -21
  15. package/hosts/opencode/.opencode/skills/_shared/references/stack-profiles.md +36 -0
  16. package/hosts/opencode/.opencode/skills/_shared/scripts/document_quality.mjs +37 -1
  17. package/hosts/opencode/.opencode/skills/atlas-audit/SKILL.md +201 -0
  18. package/hosts/opencode/.opencode/skills/atlas-audit/agents/openai.yaml +7 -0
  19. package/hosts/opencode/.opencode/skills/atlas-task-validator/SKILL.md +6 -0
  20. package/hosts/opencode/.opencode/skills/atlas-workflow-orchestrator/SKILL.md +32 -10
  21. package/hosts/pi/atlas/VERSION +1 -1
  22. package/hosts/pi/atlas/orchestrator/README.md +15 -2
  23. package/hosts/pi/atlas/orchestrator/commands/workflow.md +7 -5
  24. package/hosts/pi/atlas/orchestrator/references/host-adapters.md +13 -12
  25. package/hosts/pi/atlas/orchestrator/references/subagent_dispatch.md +11 -1
  26. package/hosts/pi/atlas/orchestrator/skills/atlas-workflow-orchestrator/SKILL.md +32 -10
  27. package/hosts/pi/atlas/packages/mcp-server/README.md +2 -2
  28. package/hosts/pi/atlas/packages/mcp-server/package.json +1 -1
  29. package/hosts/pi/atlas/packages/mcp-server/server.js +149 -21
  30. package/hosts/pi/skills/_shared/references/stack-profiles.md +36 -0
  31. package/hosts/pi/skills/_shared/scripts/document_quality.mjs +37 -1
  32. package/hosts/pi/skills/atlas-audit/SKILL.md +201 -0
  33. package/hosts/pi/skills/atlas-audit/agents/openai.yaml +7 -0
  34. package/hosts/pi/skills/atlas-task-validator/SKILL.md +6 -0
  35. package/hosts/pi/skills/atlas-workflow-orchestrator/SKILL.md +32 -10
  36. package/hosts/zcode/.zcode-plugin/plugin.json +27 -0
  37. package/hosts/zcode/agents/atlas-direct-execute.md +31 -0
  38. package/hosts/zcode/agents/atlas-findings-repair.md +39 -0
  39. package/hosts/zcode/agents/atlas-plan-execute.md +33 -0
  40. package/hosts/zcode/agents/atlas-slice-review.md +27 -0
  41. package/hosts/zcode/agents/atlas-task-validator.md +138 -0
  42. package/hosts/zcode/packages/mcp-server/README.md +29 -0
  43. package/hosts/zcode/packages/mcp-server/VERSION +1 -0
  44. package/hosts/zcode/packages/mcp-server/package.json +15 -0
  45. package/hosts/zcode/packages/mcp-server/server.js +3963 -0
  46. package/hosts/zcode/packages/orchestrator/README.md +283 -0
  47. package/hosts/zcode/packages/orchestrator/commands/workflow.md +39 -0
  48. package/hosts/zcode/packages/orchestrator/defaults/paths.md +21 -0
  49. package/hosts/zcode/packages/orchestrator/references/host-adapters.md +106 -0
  50. package/hosts/zcode/packages/orchestrator/references/qa_s13_matrix.md +141 -0
  51. package/hosts/zcode/packages/orchestrator/references/subagent_dispatch.md +52 -0
  52. package/hosts/zcode/packages/orchestrator/skills/atlas-workflow-orchestrator/SKILL.md +411 -0
  53. package/hosts/zcode/packages/templates/BACKLOG_MESTRE_TEMPLATE.md +855 -0
  54. package/hosts/zcode/packages/templates/BOUNDARY_PRD_PLAN.md +93 -0
  55. package/hosts/zcode/packages/templates/PERGUNTAS_EM_ABERTO_TEMPLATE.md +139 -0
  56. package/hosts/zcode/packages/templates/PLAN_TEMPLATE.md +146 -0
  57. package/hosts/zcode/packages/templates/PRD_TEMPLATE.md +150 -0
  58. package/hosts/zcode/packages/templates/STATE_FILE_SCHEMA.md +56 -0
  59. package/hosts/zcode/skills/_shared/references/stack-profiles.md +72 -0
  60. package/hosts/zcode/skills/_shared/scripts/document_quality.mjs +288 -0
  61. package/hosts/zcode/skills/atlas-audit/SKILL.md +201 -0
  62. package/hosts/zcode/skills/atlas-audit/agents/openai.yaml +7 -0
  63. package/hosts/zcode/skills/atlas-backlog-generator/SKILL.md +93 -0
  64. package/hosts/zcode/skills/atlas-backlog-generator/agents/openai.yaml +4 -0
  65. package/hosts/zcode/skills/atlas-direct-execute/SKILL.md +221 -0
  66. package/hosts/zcode/skills/atlas-direct-execute/agents/openai.yaml +7 -0
  67. package/hosts/zcode/skills/atlas-findings-repair/SKILL.md +158 -0
  68. package/hosts/zcode/skills/atlas-findings-repair/agents/openai.yaml +7 -0
  69. package/hosts/zcode/skills/atlas-plan-execute/SKILL.md +175 -0
  70. package/hosts/zcode/skills/atlas-plan-execute/agents/openai.yaml +7 -0
  71. package/hosts/zcode/skills/atlas-plan-execute/references/plan-contract.md +88 -0
  72. package/hosts/zcode/skills/atlas-plan-execute/references/quality-gates.md +60 -0
  73. package/hosts/zcode/skills/atlas-plan-execute/scripts/check_budget_state.py +96 -0
  74. package/hosts/zcode/skills/atlas-plan-execute/scripts/extract_plan_contract.py +191 -0
  75. package/hosts/zcode/skills/atlas-plan-execute/scripts/validate_gate_result.py +56 -0
  76. package/hosts/zcode/skills/atlas-plan-handoff/SKILL.md +183 -0
  77. package/hosts/zcode/skills/atlas-plan-handoff/agents/openai.yaml +7 -0
  78. package/hosts/zcode/skills/atlas-prd-interview/SKILL.md +82 -0
  79. package/hosts/zcode/skills/atlas-prd-interview/agents/openai.yaml +7 -0
  80. package/hosts/zcode/skills/atlas-slice-review/SKILL.md +156 -0
  81. package/hosts/zcode/skills/atlas-slice-review/agents/openai.yaml +4 -0
  82. package/hosts/zcode/skills/atlas-slice-review/references/review-contract.md +58 -0
  83. package/hosts/zcode/skills/atlas-slice-review/references/scenario-lenses.md +57 -0
  84. package/hosts/zcode/skills/atlas-slice-review/scripts/classify_findings.mjs +60 -0
  85. package/hosts/zcode/skills/atlas-slice-review/scripts/classify_findings.py +24 -0
  86. package/hosts/zcode/skills/atlas-slice-review/scripts/extract_review_slice.py +158 -0
  87. package/hosts/zcode/skills/atlas-sprint-prd-generator/SKILL.md +77 -0
  88. package/hosts/zcode/skills/atlas-sprint-prd-generator/agents/openai.yaml +7 -0
  89. package/hosts/zcode/skills/atlas-task-validator/SKILL.md +179 -0
  90. package/hosts/zcode/skills/atlas-task-validator/agents/openai.yaml +7 -0
  91. package/hosts/zcode/skills/atlas-workflow-orchestrator/SKILL.md +411 -0
  92. package/package.json +1 -1
  93. package/plugins/atlas-workflow-orchestrator/.codex-plugin/plugin.json +5 -4
  94. package/plugins/atlas-workflow-orchestrator/VERSION +1 -1
  95. package/plugins/atlas-workflow-orchestrator/orchestrator/README.md +15 -2
  96. package/plugins/atlas-workflow-orchestrator/orchestrator/commands/workflow.md +7 -5
  97. package/plugins/atlas-workflow-orchestrator/orchestrator/references/host-adapters.md +13 -12
  98. package/plugins/atlas-workflow-orchestrator/orchestrator/references/subagent_dispatch.md +11 -1
  99. package/plugins/atlas-workflow-orchestrator/orchestrator/skills/atlas-workflow-orchestrator/SKILL.md +32 -10
  100. package/plugins/atlas-workflow-orchestrator/packages/mcp-server/README.md +2 -2
  101. package/plugins/atlas-workflow-orchestrator/packages/mcp-server/package.json +1 -1
  102. package/plugins/atlas-workflow-orchestrator/packages/mcp-server/server.js +149 -21
  103. package/plugins/atlas-workflow-orchestrator/packages/skills/_shared/references/stack-profiles.md +36 -0
  104. package/plugins/atlas-workflow-orchestrator/packages/skills/_shared/scripts/document_quality.mjs +37 -1
  105. package/plugins/atlas-workflow-orchestrator/packages/skills/atlas-audit/SKILL.md +201 -0
  106. package/plugins/atlas-workflow-orchestrator/packages/skills/atlas-audit/agents/openai.yaml +7 -0
  107. package/plugins/atlas-workflow-orchestrator/packages/skills/atlas-task-validator/SKILL.md +6 -0
  108. package/plugins/atlas-workflow-orchestrator/skills/_shared/references/stack-profiles.md +36 -0
  109. package/plugins/atlas-workflow-orchestrator/skills/_shared/scripts/document_quality.mjs +37 -1
  110. package/plugins/atlas-workflow-orchestrator/skills/atlas-audit/SKILL.md +201 -0
  111. package/plugins/atlas-workflow-orchestrator/skills/atlas-audit/agents/openai.yaml +7 -0
  112. package/plugins/atlas-workflow-orchestrator/skills/atlas-task-validator/SKILL.md +6 -0
  113. package/plugins/atlas-workflow-orchestrator/skills/atlas-workflow-orchestrator/SKILL.md +32 -10
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: atlas-direct-execute
3
+ description: Execute a scoped PRD, task, or implementation slice directly using a compact execution contract, PRD obligation tracking, finite task gates, bounded repair, and mandatory cold validation via atlas-task-validator. Use when the user provides a PRD/spec/path or a debated task and wants implementation now without first producing a separate planning artifact. Preserve evidence against acceptance criteria, dependencies, fixtures, and invariants.
4
+ ---
5
+
6
+ # Atlas Direct Execute
7
+
8
+ ## Purpose
9
+
10
+ Execute directly from a PRD/spec/task while preserving execution quality: explicit scope, obligations, invariants, task order, risks, and validation. Do not write a separate planning artifact unless the user asks.
11
+
12
+ This is not planless execution. Replace the visible markdown plan with a compact operational contract held in the current turn and passed to validation.
13
+
14
+ ## Executor liveness checkpoints
15
+
16
+ Depois de carregar esta skill e antes de qualquer discovery longo, emita um checkpoint MCP:
17
+
18
+ ```json
19
+ atlas_lock_dispatch({
20
+ "action": "checkpoint",
21
+ "phase": "plan_execute",
22
+ "event": "executor_started"
23
+ })
24
+ ```
25
+
26
+ Em seguida, emita checkpoints materiais conforme avança:
27
+
28
+ - `skill_loaded` — skill carregada e contrato reconhecido.
29
+ - `plan_loaded` — PRD/spec/task de entrada lido.
30
+ - `handoff_accepted` — boundary, obligations, `state_path` alvo e contrato direto aceitos.
31
+ - `task_started` — primeira task começou.
32
+ - `first_write` — primeira mutação de workspace feita.
33
+ - `state_path_created` — state file escrito antes de devolver `validator_handoff_required`.
34
+
35
+ Se não conseguir emitir checkpoint por MCP, retorne `blocked`: liveness não é comprovável. Sem `state_path_created` com o mesmo `state_path`, `atlas_lock_validator(start)` bloqueia em G12 e o orquestrador não pode despachar o validador frio.
36
+
37
+ ## Use Criteria
38
+
39
+ Use when all are true:
40
+
41
+ - User wants implementation, not a planning artifact.
42
+ - Scope is a PRD/spec/path or a debated task with clear boundaries.
43
+ - Work fits one coherent slice or a bounded task sequence.
44
+ - Execution happens in the same chat/context.
45
+ - A compact contract can be materialized into the state file boundary required by `atlas-task-validator`.
46
+
47
+ Do not use when any are true:
48
+
49
+ - User asks only for planning, review, explanation, or handoff artifact.
50
+ - Product rules, permissions, backend contract, migrations, security, or data-loss risk are materially ambiguous.
51
+ - The PRD/spec conflicts with code or adjacent docs in a way that blocks implementation.
52
+
53
+ ## Workflow
54
+
55
+ ### 0. Triage
56
+
57
+ Before implementation, decide one exact path:
58
+
59
+ - `direct`: proceed with this skill.
60
+ - `blocked`: ask for the missing decision or environment.
61
+
62
+ Ask at most 1-3 blocking questions only when a reasonable assumption could change product behavior, contract, permissions, persistence, or user-visible outcome. Otherwise state assumptions and proceed.
63
+
64
+ ### 1. Load inputs
65
+
66
+ First, emit `executor_started`, then `skill_loaded`, before doing any long scan.
67
+
68
+ Read the user-provided PRD/spec/task and any directly referenced files needed to resolve scope. If the input names repo artifacts, verify those artifacts exist before editing.
69
+
70
+ Extract only execution-relevant items:
71
+
72
+ - in scope / out of scope
73
+ - acceptance criteria and required deliverables
74
+ - accepted decisions
75
+ - invariants and "do not change" rules
76
+ - contracts, entities, routes, schemas, wrappers, generated files
77
+ - dependency contracts that must be consumed, bridged, or preserved
78
+ - fixture requirements and scenario language such as "weeks", "profiles", "matrix", "sequence", or "integration"
79
+ - validation requirements
80
+ - regression risks
81
+ - likely files/modules
82
+
83
+ If the PRD references another PRD or code contract as dependency, inspect enough to confirm the dependency shape and required bridge. Do not satisfy a dependency by creating parallel synthetic contracts unless the PRD explicitly allows it.
84
+
85
+ After the input is loaded, emit `plan_loaded`. After validating the execution boundary, obligations, and `state_path` target, emit `handoff_accepted`.
86
+
87
+ ### 2. Build Compact Execution Contract
88
+
89
+ Before editing, write a compact contract in the working response or internal task state. Size follows complexity: terse for simple tasks, denser only where needed to preserve scope, invariants, and validator quality.
90
+
91
+ Required shape:
92
+
93
+ ```text
94
+ Direct Execute Contract
95
+ - Goal:
96
+ - Boundary:
97
+ - In scope:
98
+ - Out of scope:
99
+ - Obligations:
100
+ - Invariants:
101
+ - Dependency bridges:
102
+ - Fixtures/scenarios:
103
+ - Scenario probes:
104
+ - Risk probes:
105
+ - Task order:
106
+ - Validation:
107
+ - Stop conditions:
108
+ ```
109
+
110
+ Do not expand this into a separate planning artifact. The goal is execution guardrails, not transfer documentation. The contract may be terse in the user-visible response, but it must be concrete enough to materialize into `.atlas/state/<run_id>/<slice>.json` and referenced evidence for `atlas-task-validator`.
111
+
112
+ Obligations are mandatory. Convert every PRD acceptance criterion and explicit deliverable into one compact row:
113
+
114
+ ```text
115
+ O1 <requirement> -> evidence: <file/test/check>
116
+ ```
117
+
118
+ When the PRD asks for fixtures, profiles, weeks, matrices, bridges/adapters, immutability, determinism, or calendar semantics, name those explicitly in `Obligations`. Do not collapse them into generic "tests cover rules".
119
+
120
+ Add a closure analysis packet before implementation starts. Keep it compact, but concrete enough that a cold validator can hunt omissions instead of only confirming obvious files:
121
+
122
+ - `Invariant ledger`: each invariant or "do not change" rule, with expected code evidence.
123
+ - `Scenario probes`: negative, repeated, empty/null, out-of-order, partial failure, stale state, permission, and cleanup scenarios relevant to this slice.
124
+ - `Contract probes`: DTO/entity/schema/route/RPC/generated/localization/import boundaries that could drift.
125
+ - `Risk probes`: each regression risk translated into a specific question the validator must answer from code.
126
+ - `Validation map`: which checks prove which obligations, and which obligations remain only manually evidenced.
127
+
128
+ If a probe is irrelevant, omit it. Do not write generic probes such as "check edge cases"; name the exact state, actor, field, route, or failure mode.
129
+
130
+ ### 3. Implement by finite tasks
131
+
132
+ Execute one task at a time. Prefer this order when applicable:
133
+
134
+ 1. contracts/types/domain
135
+ 2. dependency bridges/adapters from existing models or contracts
136
+ 3. datasource/client boundary
137
+ 4. repository/use case/state
138
+ 5. UI/route wiring
139
+ 6. fixtures/tests/generation/docs required for closure
140
+
141
+ For each task, keep a tiny task contract:
142
+
143
+ - objective
144
+ - files likely touched
145
+ - invariants at risk
146
+ - obligations satisfied
147
+ - focused check
148
+ - repair budget
149
+
150
+ Do not widen scope for opportunistic cleanup.
151
+
152
+ **Minimalism rung (per task, before writing):** prefer the minimal viable implementation that satisfies the obligation — reuse existing repo code/symbol before introducing a new abstraction; use a stdlib/native platform feature before a new dependency; avoid indirection, factory, wrapper, extra layer, config option, or extra file not required by an obligation or invariant. This rung constrains only new abstraction/indirection/file/dependency. It never reduces trust-boundary validation, error handling, data-loss handling, invariants, scenario/test coverage, or negative paths. When minimal and safe conflict, choose safe.
153
+
154
+ Before the first concrete task, emit `task_started`. After the first workspace mutation, emit `first_write`.
155
+
156
+ ### 4. Gate each task
157
+
158
+ Run focused checks appropriate to the diff:
159
+
160
+ - targeted tests
161
+ - analyzer/typecheck/lint
162
+ - codegen/localization/schema checks when relevant
163
+ - diff scan for scope creep
164
+ - runtime/browser verification when UI changed
165
+
166
+ If a check fails, classify:
167
+
168
+ - `fixable`: caused by current diff and repairable inside budget
169
+ - `blocked`: missing env, upstream failure, ambiguous contract, or required decision
170
+ - `pre-existing`: outside slice; report, do not repair unless blocking closure
171
+
172
+ Repair only current-diff failures. Stop after repeated failure or budget exhaustion.
173
+
174
+ ### 5. Mandatory cold validation
175
+
176
+ After tasks and local gates pass, write `.atlas/state/<run_id>/<slice>.json` following `packages/templates/STATE_FILE_SCHEMA.md`.
177
+
178
+ For direct execution, the state file is still the only validator input. Use the user-provided PRD/spec path as `plan_path` when no handoff plan exists, and include direct-contract anchors in `boundary_refs` such as `direct.O1`, `direct.invariant.permissions`, or `direct.risk.partial_failure`.
179
+
180
+ Persist the full direct contract using the additive state extension: `base_sha`, `head_sha`, `contract_kind: direct`, non-empty `obligations`, `invariants`, `scenario_probes`, `risk_probes`, `validation_map`, `task_evidence`, empty `repair_evidence`, `worktree_baseline` and `worktree_final`. Capture baseline before the first mutation and final immediately before handoff; `files_changed`/evidence must equal `base_sha...head_sha` + snapshot delta. Capture base from an explicit task/spec anchor or execution-start `HEAD`; never infer it from branch name. Recompute `head_sha` and `diff_stat` immediately before handoff. A direct state without obligations is invalid and must block.
181
+
182
+ The state file is the only validator input. Validation is always **sibling**, on every host: this executor **never** dispatches `atlas-task-validator` itself and never validates its own work in the same context. After tasks and local gates pass and the state file is written, this executor **stops mutation** and returns `validator_handoff_required` with the `state_path`. The orchestrator then dispatches `atlas-task-validator` as the next isolated sibling phase, locks it via `atlas_lock_validator`, and — if the verdict is `fail` — dispatches `atlas-findings-repair` (not this executor) before the **2nd and last** validator.
183
+
184
+ After writing the state file and before returning, emit `state_path_created` with the same `state_path`.
185
+
186
+ Do not paste the compact contract, diff, obligation ledger, local checks, or closure analysis packet into the state file's handoff. Those belong in the state file and referenced artifacts.
187
+
188
+ **Finish all local work before the handoff — then stop idle.** Finish every local gate (lint, analyze, tests, `git diff --check`, diff-stat) and write the state file **before** returning the handoff. After returning `validator_handoff_required`, do nothing: no diff hygiene checks, no extra reads, no opportunistic edits, no parallel work. The orchestrator now owns the slice; any mutation here would change what the sibling validator reads and breaks determinism (same failure class as the orchestrator's G9).
189
+
190
+ The verdict is consumed by the **orchestrator**, not by this executor:
191
+
192
+ - `pass` / `pass_with_observations`: terminal — the orchestrator closes the slice (observations are reported residuals, never a trigger for another validator dispatch).
193
+ - `fail`: the orchestrator opens `repair_start`, dispatches `atlas-findings-repair`, closes with `repair_run_id`, and runs the **2nd and last** validator. This executor does not re-validate itself and is not reused for the repair retry.
194
+
195
+ This executor only re-engages if the orchestrator explicitly re-dispatches it for a new slice. It must not "fix" observations and reopen a closed slice; real follow-up from an observation goes to the final report or backlog, not into an extra in-slice change.
196
+
197
+ If isolated subagents or MCP are unavailable, return `blocked` with the missing prerequisite and next safe action. Never replace cold validation with a local self-check or report `validator not run` as an accepted pipeline outcome.
198
+
199
+ ## Stop Conditions
200
+
201
+ Stop and report instead of improvising when:
202
+
203
+ - code contradicts the PRD in product behavior, permissions, backend contract, or persistence shape
204
+ - required dependency PRD/contract is missing or unstable
205
+ - implementing would violate explicit out-of-scope
206
+ - deterministic checks cannot run and no equivalent evidence exists
207
+ - repair loops repeat the same failure twice
208
+ - validator cannot receive a valid `.atlas/state/<run_id>/<slice>.json` state path
209
+ - any PRD obligation lacks code/test/check evidence after implementation
210
+
211
+ ## Final Report
212
+
213
+ Keep final report short:
214
+
215
+ - changed scope
216
+ - files touched
217
+ - validations run
218
+ - `validator_handoff_required` + `state_path`
219
+ - blockers or residual risks
220
+
221
+ Do not include the full internal contract unless the user asks.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Atlas Direct Execute"
3
+ short_description: "Direct PRD execution with cold validation"
4
+ default_prompt: "Use $atlas-direct-execute to implement this PRD or scoped task directly with a compact obligation ledger, focused gates, and validator closure."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: atlas-findings-repair
3
+ description: Skill `atlas-findings-repair`. Corrige findings P0/P1/P2 retornados por `atlas-task-validator` dentro do boundary já executado, sem reabrir o plano completo. Use quando o orquestrador receber `fail` do validator (topologia sibling, única em todos os hosts) e precisar de um reparo enxuto, bounded e sem reusar `atlas-plan-execute`.
4
+ ---
5
+
6
+ # Atlas Findings Repair
7
+
8
+ Use esta skill apenas no caminho de recuperação pós-validator. Ela **não** substitui `atlas-plan-execute` nem `atlas-direct-execute`; serve só para corrigir findings bloqueantes já emitidos pelo `atlas-task-validator`.
9
+
10
+ ## Finalidade
11
+
12
+ Corrigir findings P0/P1/P2 dentro do boundary atual com o menor contexto possível:
13
+
14
+ - sem replanejar
15
+ - sem carregar skill de execução
16
+ - sem criar novas tasks
17
+ - sem ampliar o escopo
18
+ - sem despachar validator
19
+
20
+ O orquestrador é dono do ciclo sibling em todos os hosts:
21
+
22
+ 1. executor inicial entrega `state_path`
23
+ 2. orquestrador roda `atlas-task-validator`
24
+ 3. se `fail`, orquestrador trava o ciclo em `repair_required`
25
+ 4. orquestrador chama `atlas_lock_validator(action=repair_start, state_path=...)`
26
+ 5. orquestrador despacha `atlas-findings-repair` com o pacote retornado pelo lock
27
+ 6. esta skill corrige e devolve `repair_complete`
28
+ 7. orquestrador fecha o lock com `repair_run_id`
29
+ 8. orquestrador roda o **2º e último** validator
30
+
31
+ ## Entrada obrigatória
32
+
33
+ Receba do orquestrador:
34
+
35
+ - `state_path`
36
+ - findings estruturados do validator
37
+ - `validator_attempt`
38
+ - `repair_run_id`
39
+ - `repair_budget: 1`
40
+
41
+ Leia `atlas_run_state` como fonte primária do estado da run. O `state_path` continua sendo a fronteira canônica da slice.
42
+
43
+ ## Regras duras
44
+
45
+ 1. **Não carregar `atlas-plan-execute` nem `atlas-direct-execute`.**
46
+ 2. **Não reabrir o plano inteiro.** Corrija só o que os findings exigem.
47
+ 3. **Não aumentar boundary** sem evidência estrita de dependência técnica inevitável.
48
+ 4. **Não corrigir observações/P3 por capricho.** O foco é fechamento do `fail`.
49
+ 5. **Não despachar validator, review ou qualquer subagente.** O orquestrador faz isso.
50
+ 6. **Não iniciar terceiro ciclo.** Esta skill existe só entre validator 1 e validator 2.
51
+ 7. **Não trocar o `state_path`.** Atualize o arquivo original em lugar; redirecionar o boundary invalida a correlação do repair.
52
+ 8. **Não inventar correlação.** IDs devem existir no packet recebido, sem duplicatas; todo arquivo tocado pertence a pelo menos um `repair_evidence` recebido e nenhum arquivo extra é permitido.
53
+
54
+ ## Fluxo
55
+
56
+ ### 1. Ler o boundary
57
+
58
+ Abra o `state_path` e extraia:
59
+
60
+ - `files_changed`
61
+ - `diff_stat`
62
+ - `plan_path`
63
+ - `boundary_refs`
64
+
65
+ Leia do plano apenas o mínimo necessário:
66
+
67
+ - Section 2 — invariantes
68
+ - Section 6 — contratos técnicos
69
+ - Section 8 — checklist
70
+
71
+ Capture também `base_sha`, `head_sha`, `task_evidence`, `repair_evidence`, `worktree_baseline` e `worktree_final` do state.
72
+
73
+ ### 2. Ler os findings recebidos
74
+
75
+ Trabalhe somente com findings de severidade:
76
+
77
+ - `P0`
78
+ - `P1`
79
+ - `P2`
80
+
81
+ Cada finding novo deve ter `id`, `failure_mode`, `evidence`, `recommendation` e `fix_validation`. `msg` é compatibilidade deprecated e não substitui esses campos.
82
+
83
+ Se o pacote vier vazio, inconsistente ou sem finding reparável, pare em `blocked`.
84
+
85
+ ### 3. Montar contrato mínimo de reparo
86
+
87
+ Antes de editar, reduza o trabalho a:
88
+
89
+ - finding alvo
90
+ - arquivos a tocar
91
+ - invariante em risco
92
+ - check focado
93
+ - budget de reparo
94
+
95
+ ### 4. Corrigir de forma bounded
96
+
97
+ Permissões:
98
+
99
+ - corrigir arquivos do boundary
100
+ - tocar arquivo adjacente apenas quando necessário para satisfazer contrato/invariante
101
+
102
+ Proibições:
103
+
104
+ - cleanup oportunista
105
+ - refactor largo
106
+ - nova feature
107
+ - mudança fora da causa do finding
108
+
109
+ ### 5. Rodar gates focados
110
+
111
+ Rode só validações coerentes com o diff:
112
+
113
+ - teste alvo
114
+ - lint/analyze/typecheck do pacote afetado
115
+ - `git diff --check`
116
+
117
+ Se o finding persistir por falta de decisão de produto, dependência externa ou widening de escopo, pare em `blocked`.
118
+
119
+ ### 6. Atualizar evidência
120
+
121
+ Ao terminar:
122
+
123
+ - atualize `files_changed` com todo arquivo tocado, inclusive novo/adjacente
124
+ - recompute `head_sha` (`git rev-parse HEAD`) e `diff_stat`; preserve `base_sha`
125
+ - preserve `worktree_baseline` e recapture `worktree_final` após o repair; derive o boundary completo do delta entre snapshots
126
+ - acrescente `repair_evidence[]` no shape `{finding_id, files_touched, checks_run, status}`
127
+ - garanta que cada `repair_evidence.files_touched` esteja em `files_changed`
128
+ - mantenha a mesma slice
129
+ - não invente novo run state paralelo
130
+
131
+ ### 7. Devolver resultado ao orquestrador
132
+
133
+ Retorne saída curta e estruturada com:
134
+
135
+ - `status: repair_complete | blocked`
136
+ - `repair_run_id`
137
+ - `state_path`
138
+ - `files_touched`
139
+ - `checks_run`
140
+ - `repairs`: array `{finding_id, files_touched, checks_run, status: resolved|blocked}`
141
+ - `residual_risk` (se houver)
142
+
143
+ O orquestrador chamará `atlas_lock_validator(action=repair_complete, repair_run_id=..., state_path=<mesmo path original>)` e só então poderá despachar o validator final.
144
+ Antes disso, ele deve ter aberto o slot com `atlas_lock_validator(action=repair_start, state_path=...)`; `repair_run_id` é obrigatório no fechamento.
145
+
146
+ ## Stop conditions
147
+
148
+ Pare e reporte `blocked` quando:
149
+
150
+ - finding exige reabrir decisão fechada
151
+ - finding exige ampliar escopo além da slice
152
+ - mesmo erro repete sem sinal novo
153
+ - correção depende de ambiente ausente
154
+ - pacote de findings não é confiável
155
+
156
+ ## Resultado esperado
157
+
158
+ Esta skill deve ser menor e mais barata que um executor completo, mas ainda disciplinada. Ela repara findings; ela **não** “continua a execução”.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Atlas Findings Repair"
3
+ short_description: "Repair-only post-validator fixer for bounded findings"
4
+ default_prompt: "Use $atlas-findings-repair to fix the blocking validator findings inside the current slice boundary without reloading the full executor."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -0,0 +1,175 @@
1
+ ---
2
+ name: atlas-plan-execute
3
+ description: Executa planos produzidos por `atlas-plan-handoff` task-a-task com gates finitos e self-repair local pré-handoff (lint/tests/diff — máximo 2 passes por task). Ao concluir todas as tasks da slice, escreve o state file, para toda mutação e retorna `validator_handoff_required` ao orquestrador para validação fria sibling via `atlas-task-validator`. O orquestrador consome o veredito e decide sobre repair ou fechamento — este executor nunca valida o próprio trabalho nem processa resultado do validador. Use quando o cliente precisar implementar um plano sem derivar dos invariantes.
4
+ ---
5
+
6
+ # Atlas Plan Execute
7
+
8
+ Use this skill to turn a `atlas-plan-handoff` artifact into a controlled execution loop.
9
+
10
+ Prefer finite, stage-based execution over continuous self-critique. The goal is to finish the task with high confidence, not to keep polishing indefinitely.
11
+
12
+ ---
13
+
14
+ ## Execution Model
15
+
16
+ Operate as a bounded state machine:
17
+ `ready` → `implementing` → `gating` → `repairing` (self-repair LOCAL, gates pré-handoff) → `task_done` → `validator_handoff_required` (or `blocked`).
18
+
19
+ `repairing` cobre exclusivamente falhas de gates locais (lint, analyze, tests, diff-check) introduzidas pelo diff corrente — máximo 2 passes por task. O executor não entra em `repairing` pós-validação; qualquer repair pós-veredito é de responsabilidade do orquestrador via `atlas-findings-repair`. Após `task_done` para todas as tasks da slice, o executor escreve o state file e transita para `validator_handoff_required` — não existe `slice_validating` nem `slice_done` no escopo deste executor.
20
+
21
+ ## State persistence
22
+
23
+ Use `atlas_run_state` as the primary source of run state. Do not read or write run ledger files directly. If the MCP is unavailable, report the gate as unprovable and abort instead of continuing with a silent file fallback.
24
+
25
+ ## Executor liveness checkpoints
26
+
27
+ Depois de carregar esta skill e antes de qualquer discovery longo, emita um checkpoint MCP:
28
+
29
+ ```json
30
+ atlas_lock_dispatch({
31
+ "action": "checkpoint",
32
+ "phase": "plan_execute",
33
+ "event": "executor_started"
34
+ })
35
+ ```
36
+
37
+ Em seguida, emita checkpoints materiais conforme avança:
38
+
39
+ - `skill_loaded` — skill carregada e contrato reconhecido.
40
+ - `plan_loaded` — plano/PRD de entrada lido.
41
+ - `handoff_accepted` — `plan_path`, `state_path` alvo, boundary e tasks aceitos.
42
+ - `task_started` — primeira task começou.
43
+ - `first_write` — primeira mutação de workspace feita.
44
+ - `state_path_created` — state file escrito antes de devolver `validator_handoff_required`.
45
+
46
+ Se não conseguir emitir checkpoint por MCP, retorne `blocked`: liveness não é comprovável. Não fique em discovery/preflight interno sem checkpoint. O orquestrador trata ausência de checkpoint como `stalled` via Gate G12.
47
+
48
+ ## Plan path resolution
49
+
50
+ Resolve plan paths in this order:
51
+
52
+ 1. `.atlas/plans/`
53
+ 2. `.cursor/plans/` with a deprecation warning
54
+ 3. `.codex/plans/` with a deprecation warning
55
+
56
+ New or rewritten plan artifacts must use `.atlas/plans/`.
57
+
58
+ ## Host adapter
59
+
60
+ This skill is host-agnostic. To resolve any host-specific verb (subagent dispatch, native todo tool, plan paths), call the MCP tool `atlas_capabilities` first and use the returned descriptor. Canonical reference: `packages/orchestrator/references/host-adapters.md`. Do not hardcode a host name in reasoning — read it from the descriptor.
61
+
62
+ ## Native todo mirror
63
+
64
+ When entering `implementing` for the first time in a slice, mirror the plan tasks into the native todo surface named by `atlas_capabilities.todo_tool` (e.g. `TodoWrite` on Claude Code, `tasks` on Codex App). If `todo_tool` is `null`, proceed without a mirror — do not invent a tool.
65
+
66
+ The plan is the SSoT. Map `ready` to `pending`, `implementing`/`gating` to `in_progress`, and `task_done` to `completed`. If todo state diverges, sync from the plan to todo, never from todo back to the plan. Do not create parallel todos that are not derived from plan task IDs.
67
+
68
+ ## Review gate
69
+
70
+ `atlas-slice-review` is dispatched only when `--review` is present in the user command or executor arguments. Without `--review`, the orchestrator closes the slice upon receiving `pass` or `pass_with_observations` from the validator — this executor is not involved in that decision and never observes the validator verdict directly.
71
+
72
+ ## Entrada via modo `execute` (PRD D1/D13)
73
+
74
+ Esta skill aceita entrada pelo modo `execute` do orquestrador: um `PLAN_*.md` pronto de pipeline curta, apontado diretamente e já reverificado na entrada (`atlas_verify_artifact` + TC) pelo orquestrador. **A entrada `execute` é o mesmo executor, com as mesmas garantias** — o contrato não muda: o state file (`.atlas/state/<run_id>/<slice>.json`) permanece **obrigatório** e o `atlas-task-validator` (validador frio, só `state_path`) permanece **obrigatório** antes do relatório final. Não há caminho de execução sem state file nem sem validador, em nenhum modo de entrada.
75
+
76
+ ---
77
+
78
+ ## Required Workflow
79
+
80
+ ### 1. Load the plan as an execution contract
81
+ First, emit `executor_started`, then `skill_loaded`, before doing any long scan.
82
+
83
+ Read the `atlas-plan-handoff` artifact. Extract at minimum:
84
+ * **Execution metadata**: Prefix, mode, and validator options.
85
+ * **Executive translation and PRD links** (from Section 1 — include path to PRD; cite `PRD §3` D* IDs, do not paste the full D* table).
86
+ * **Execution invariants** (from Section 2).
87
+ * **Current state at sprint opening** (from Section 4 — not Section 2).
88
+ * **Pitfalls** (from Section 3).
89
+ * **All execution tasks TNN** (from Section 5).
90
+ * **Technical contracts** (from Section 6).
91
+ * **Slices of execution** (from Section 7).
92
+ * **Checklist for the validator** (from Section 8).
93
+
94
+ Treat headings as semantic. If the plan uses equivalent wording but carries the same contract, continue. If the plan is missing the substance, stop and report.
95
+ The old Gate of Readiness (§15) and Handoff Prompt (§16) are **no longer required** in the compact template.
96
+ If optional Section 9 (open questions / real blockers — **not** PRD §7 Apêndice/Referências) has active blocking items, stop execution and request clarification.
97
+
98
+ When Section 8 checklist is thin, read **PRD §4–6** from the PRD path in the plan header for business acceptance.
99
+
100
+ After the plan is loaded, emit `plan_loaded`. After validating the execution boundary and `state_path` target, emit `handoff_accepted`.
101
+
102
+ ### 2. Create a task-scoped execution contract
103
+ Before editing code, write a short task contract for the current task only (objective, files, invariants, local checks, and repair budget).
104
+
105
+ ### 3. Implement in the smallest coherent slice
106
+ Do not implement the entire feature before validating anything. Prefer one task at a time. Follow closed decisions from the plan.
107
+
108
+ Before the first concrete task, emit `task_started`. After the first workspace mutation, emit `first_write`.
109
+
110
+ ### 4. Run a focused quality gate after each task slice
111
+ Run only the checks that are relevant to the current diff and task risks (linter, analyze of the affected package, or tests).
112
+
113
+ ### 5. Repair only what the current diff introduced
114
+ If the gate fails, classify the outcome as `fixable` (maximum 2 repair passes per task) or `blocked`.
115
+
116
+ ### 6. Enforce hard stop conditions
117
+ Stop repair and move to `blocked` when budget is exhausted, the same failure repeats twice, or the fix requires reopening closed plan decisions.
118
+
119
+ ### 7. Close the task with evidence
120
+ Mark a task complete and move to the next. Once all tasks are `completed`, write the state file and transition to `validator_handoff_required`.
121
+
122
+ ### 8. Write the state file and hand off to the orchestrator
123
+ After all tasks in the current slice are complete, write the state file boundary. The cold validation runs as an isolated **sibling** dispatched by the orchestrator — never by this executor (see below).
124
+
125
+ #### State file boundary
126
+
127
+ Create `.atlas/state/<run_id>/<slice>.json` following `packages/templates/STATE_FILE_SCHEMA.md`:
128
+
129
+ ```json
130
+ {
131
+ "run_id": "<run_id>",
132
+ "slice": "<slice id>",
133
+ "base_sha": "<base commit explícito do plano/handoff>",
134
+ "head_sha": "<git rev-parse HEAD ao fechar a execução>",
135
+ "contract_kind": "plan",
136
+ "tasks": ["T01"],
137
+ "files_changed": ["relative/path.ext"],
138
+ "diff_stat": "N files, +X -Y",
139
+ "plan_path": ".atlas/plans/<id>.plan.md",
140
+ "boundary_refs": ["§2.I1", "§6.1", "§8"],
141
+ "obligations": [],
142
+ "invariants": [{"id": "I1", "requirement": "<invariante>", "expected_evidence": ["<path/check>"]}],
143
+ "scenario_probes": [{"id": "S1", "scenario": "<cenário>", "expected": "<resultado>"}],
144
+ "risk_probes": [{"id": "R1", "risk": "<risco>", "probe": "<pergunta verificável>"}],
145
+ "validation_map": [{"obligation_ids": [], "checks": ["<comando>"], "status": "passed"}],
146
+ "task_evidence": [{"task": "T01", "files": ["relative/path.ext"], "checks": ["<comando>"], "result": "passed"}],
147
+ "repair_evidence": [],
148
+ "worktree_baseline": [{"path": "relative/preexisting.ext", "status": "M", "sha256": "<64 hex>"}],
149
+ "worktree_final": [{"path": "relative/preexisting.ext", "status": "M", "sha256": "<64 hex>"}],
150
+ "executed_at": "ISO8601",
151
+ "executor_skill": "atlas-plan-execute"
152
+ }
153
+ ```
154
+
155
+ Capture `base_sha` da referência explícita do plano/handoff; nunca infira pelo nome da branch. Antes da primeira mutação, capture `worktree_baseline`; imediatamente antes do handoff, capture `worktree_final`. `files_changed` e `task_evidence` representam exatamente `base_sha...head_sha` + delta entre snapshots. Dirty preexistente byte/status-idêntico fica fora; qualquer alteração posterior entra.
156
+
157
+ Validation is always **sibling**, on every host. The validator is registered as a real subagent on every host, but this executor **never** dispatches it and never validates its own work. After tasks and local gates pass and the state file is written, this executor **stops mutation** and returns `validator_handoff_required` with the `state_path`. The orchestrator dispatches `atlas-task-validator` as the next isolated sibling phase, locks it via `atlas_lock_validator`, and — if the verdict is `fail` — dispatches `atlas-findings-repair` (not this executor) before the **2nd and last** validator.
158
+
159
+ After writing the state file and before returning, emit `state_path_created` with the same `state_path`.
160
+ Without this exact checkpoint, `atlas_lock_validator(start)` blocks in G12 and the orchestrator cannot dispatch the cold validator.
161
+
162
+ The only handoff input is `state_path`. Do not paste the contract, diff, or task list inline. The validator reads everything it needs from the state file and the plan it points to. (`atlas_capabilities` is the runtime source of truth for the dispatch mechanism the orchestrator uses — see `references/host-adapters.md`.)
163
+
164
+ **Finish all local work before the handoff — then stop idle.** Finish every local gate (lint, analyze, tests, `git diff --check`, diff-stat) and write the state file **before** returning the handoff. After returning `validator_handoff_required`, the executor must not mutate anything: the orchestrator now owns the slice, and any mutation here would change what the sibling validator reads and breaks determinism (same failure class as the orchestrator's G9).
165
+
166
+ ### 9. The orchestrator consumes the verdict
167
+ This executor does not parse the validator output — the **orchestrator** does, deciding only from `verdict`:
168
+
169
+ - `pass` / `pass_with_observations`: terminal — close the slice. Observations and `boundary_violations` returned alongside a non-`fail` verdict are reported residuals, never a trigger for another validator dispatch.
170
+ - `fail`: the orchestrator opens `repair_start`, dispatches `atlas-findings-repair`, closes with `repair_run_id`, then runs the **2nd and last** validator (max 2 cycles total). This executor is not reused for the retry.
171
+
172
+ Never decide by substring matching prose. Once the slice is closed, do not edit code, tests, or boundary files just to satisfy an observation; that reopens the slice and forces an avoidable re-validation. Real follow-up from an observation goes to the final report or a backlog item, not into an extra in-slice change.
173
+
174
+ ### 10. Report executor handoff
175
+ Report only completed tasks, local validations, files changed, and `validator_handoff_required` with `state_path`. Validator verdict/cycles and final residuals belong exclusively to the orchestrator's final report.
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Atlas Plan Execute"
3
+ short_description: "Bounded plan execution with gates (atlas-plan-execute)"
4
+ default_prompt: "Use $atlas-plan-execute to execute this handoff plan task by task with explicit invariants, focused validation, bounded self-repair, and clear stop conditions."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true