@aksp/opencrew 1.12.0 → 1.14.0

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 (35) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +25 -3
  3. package/package.json +1 -1
  4. package/templates/AGENTS.md +3 -5
  5. package/templates/_opencrew/.opencrew-version +1 -1
  6. package/templates/_opencrew/core/formato-da-crew.md +1 -0
  7. package/templates/_opencrew/core/prompts/build.prompt.md +2 -0
  8. package/templates/_opencrew/core/prompts/repair.prompt.md +4 -1
  9. package/templates/_opencrew/core/runner/contrato-de-saida.md +33 -0
  10. package/templates/_opencrew/core/runner/escritorio.md +37 -0
  11. package/templates/_opencrew/core/runner/fim-da-execucao.md +99 -0
  12. package/templates/_opencrew/core/runner/fontes-pendentes.md +21 -0
  13. package/templates/_opencrew/core/runner/memoria.md +58 -0
  14. package/templates/_opencrew/core/runner/retomar.md +51 -0
  15. package/templates/_opencrew/core/runner/selecao-de-agentes.md +79 -0
  16. package/templates/_opencrew/core/runner/tarefas-do-agente.md +34 -0
  17. package/templates/_opencrew/core/runner.pipeline.md +52 -364
  18. package/templates/_opencrew/core/scripts/caminho/argumentos.mjs +7 -4
  19. package/templates/_opencrew/core/scripts/caminho/crew.mjs +20 -0
  20. package/templates/_opencrew/core/scripts/caminho/disco.mjs +4 -3
  21. package/templates/_opencrew/core/scripts/caminho.mjs +62 -29
  22. package/templates/_opencrew/core/scripts/conserto/achados.mjs +2 -0
  23. package/templates/_opencrew/core/scripts/conserto/aplicar.mjs +2 -1
  24. package/templates/_opencrew/core/scripts/conserto/argumentos.mjs +2 -1
  25. package/templates/_opencrew/core/scripts/conserto/crew.mjs +4 -3
  26. package/templates/_opencrew/core/scripts/conserto/historico.mjs +102 -0
  27. package/templates/_opencrew/core/scripts/conserto.mjs +9 -7
  28. package/templates/_opencrew/core/scripts/entrega/leiame.mjs +4 -2
  29. package/templates/_opencrew/core/scripts/entregar.mjs +2 -0
  30. package/templates/_opencrew/core/scripts/estado/arquivo.mjs +17 -10
  31. package/templates/_opencrew/core/scripts/execucao/argumentos.mjs +62 -0
  32. package/templates/_opencrew/core/scripts/execucao/historico.mjs +76 -0
  33. package/templates/_opencrew/core/scripts/execucao/registro.mjs +115 -0
  34. package/templates/_opencrew/core/scripts/execucao/retomar.mjs +123 -0
  35. package/templates/_opencrew/core/scripts/execucao.mjs +123 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,63 @@
3
3
  All notable changes to opencrew are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/).
5
5
 
6
+ ## [1.14.0] — 2026-10-08
7
+
8
+ Fase U5, fatia 3: "Execução registrada" (`specs/fase-u5c-execucao-registrada.md`). Chega a quem já
9
+ usa com um `npx @aksp/opencrew@latest update`; as crews e as execuções antigas ficam como estão.
10
+
11
+ Ainda não nesta versão: o pedido avulso à crew (1.15.0).
12
+
13
+ ### Added
14
+ - **`/opencrew retomar <nome>`.** A execução que parou no meio — a conversa caiu, o contexto
15
+ acabou — continua de onde parou, em qualquer conversa nova. A IA mostra o tema, o que já está
16
+ pronto e de que passo vai seguir, e espera o seu sim. O que foi gravado e conferido não é
17
+ refeito; o passo que estava no meio é refeito inteiro.
18
+ - **Registro da execução.** Cada execução deixa na pasta dela um `execucao.json`, gravado por
19
+ script a cada passo: o tema, os passos conferidos, as suas respostas nas aprovações e os
20
+ vereditos da revisão. A IA não escreve nesse arquivo. Não há comando a mais por passo: o
21
+ registro pega carona no que a execução já rodava.
22
+ - **`/opencrew repair` olha o histórico.** Pasta de execução sem linha no `runs.md` vira um ponto
23
+ do conserto: ele pergunta o tema e grava a linha como `Registrada depois`, com cópia
24
+ `runs.md.bak`. Linha sem pasta e pasta vazia são só apontadas: nada é apagado.
25
+
26
+ ### Changed
27
+ - **O histórico (`runs.md`) é gravado pelo script, não pela IA** — também quando a execução é
28
+ abortada ou rejeitada, que antes ficavam de fora. As colunas são as mesmas, e as linhas que já
29
+ existem não mudam.
30
+ - **O Score tem uma definição só:** aprovações suas sem pedido de correção, sobre as aprovações
31
+ que você respondeu (`2/3`). Quem conta é o script. Antes o texto dava duas contas diferentes, e
32
+ numa crew real saiu uma nota.
33
+ - **Regra de Ouro contada de verdade.** As correções ficam no registro de cada execução; no fim, o
34
+ script mostra as das 10 últimas e a IA procura ali o que se repetiu em 3 ou mais. Antes ela
35
+ procurava na memória da crew, que não guarda dado de execução. A seção se chama
36
+ `## Regras de Ouro`, um nome só.
37
+ - O `LEIA-ME.md` da entrega abre com o tema da execução, quando o registro tem um.
38
+
39
+ ### Limites
40
+ - O registro só sabe o que os comandos contam: se a IA pular o aviso de uma aprovação, o score
41
+ sai errado para menos.
42
+ - Execução feita antes desta versão não tem registro: não dá para retomar, e só entra no
43
+ histórico pelo conserto.
44
+ - Ao retomar, o que foi combinado só na conversa anterior, sem ter sido gravado, não volta.
45
+
46
+ ## [1.13.0] — 2026-10-07
47
+
48
+ Fase U5, fatia 2: "Runner dividido" (`specs/fase-u5b-runner-dividido.md`). Chega a quem já usa
49
+ com um `npx @aksp/opencrew@latest update`. Nenhuma regra mudou de texto: mudou de lugar.
50
+
51
+ ### Changed
52
+ - **O executor de pipeline ficou menor.** O `runner.pipeline.md`, lido no começo de toda execução,
53
+ foi de 872 para 543 linhas. Sete blocos que só valem em alguma condição passaram para arquivos
54
+ próprios em `_opencrew/core/runner/`, lidos só quando é o caso: seleção de agentes, migração do
55
+ formato da memória, Escritório, tarefas do agente, contrato de saída, fontes pendentes e o fim
56
+ da execução (memória, histórico, reflexão e menu final). No lugar de cada um ficou um trecho
57
+ curto que diz quando ler o arquivo. Numa execução comum a IA lê 654 linhas em vez de 872, e as
58
+ regras do fim da execução são lidas no fim, quando valem.
59
+ - O painel (Escritório) só custa leitura para quem o ligou.
60
+
61
+ ### Removed
62
+ - O resumo "Step Execution Order", que repetia a ordem dos passos já descrita logo acima dele.
6
63
  ## [1.12.0] — 2026-10-07
7
64
 
8
65
  Fase U5, fatia 1: "Polimento do uso" (`specs/fase-u5a-polimento-do-uso.md`). A U5 é a fase de
package/README.md CHANGED
@@ -181,12 +181,13 @@ meu-projeto/
181
181
  ├── _opencrew/
182
182
  │ ├── core/
183
183
  │ │ ├── system.md ← 🧠 sistema completo do OpenCrew
184
- │ │ ├── runner.pipeline.md ← executor de pipeline
184
+ │ │ ├── runner.pipeline.md ← executor de pipeline (o que toda execução usa)
185
+ │ │ ├── runner/ ← 8 partes do executor, lidas só quando é o caso (painel, fim da execução, retomar…)
185
186
  │ │ ├── skills.engine.md ← gerenciador de skills
186
187
  │ │ ├── architect.agent.yaml ← definição do Arquiteto
187
188
  │ │ ├── formato-da-crew.md ← o formato dos arquivos de uma crew (crew.yaml, pipeline.yaml, passos)
188
189
  │ │ ├── best-practices/ ← 24 guias de melhores práticas + _catalog.yaml
189
- │ │ ├── scripts/ ← verificador, conferência de fontes, caminhos, entrega, documento Word, conserto de crews e os scripts do Escritório
190
+ │ │ ├── scripts/ ← verificador, conferência de fontes, caminhos, registro da execução, entrega, documento Word, conserto de crews e os scripts do Escritório
190
191
  │ │ ├── modelos/ ← modelo do perfil de documento oficial (papel timbrado)
191
192
  │ │ ├── escritorio/ ← página do Escritório ao vivo (abre com /opencrew dashboard)
192
193
  │ │ └── prompts/ ← 15 prompts de fase (discovery, design, build, entrega, documento, etc.)
@@ -205,6 +206,7 @@ meu-projeto/
205
206
  ├── crews/ ← suas crews vivem aqui
206
207
  │ ├── blog-semanal/ ← template: blog semanal
207
208
  │ │ └── output/<execução>/ ← criada a cada execução
209
+ │ │ ├── execucao.json ← registro da execução, gravado por script (é o que o `/opencrew retomar` lê)
208
210
  │ │ ├── v1/ v2/ … ← o que cada passo gravou
209
211
  │ │ └── entrega/ ← o que você usa: LEIA-ME.md + uma pasta por canal (copiada para a pasta do projeto que você escolher)
210
212
  │ ├── instagram-carrossel/ ← template: Instagram carrossel
@@ -293,6 +295,25 @@ são sempre em português.
293
295
 
294
296
  ---
295
297
 
298
+ ## Histórico e execução interrompida
299
+
300
+ Cada execução deixa um registro na pasta dela (`crews/<crew>/output/<execução>/execucao.json`):
301
+ o tema, os passos já gravados e conferidos, o que você respondeu em cada aprovação. Quem grava é
302
+ um script, a cada passo — a IA não escreve nesse arquivo.
303
+
304
+ - **O histórico da crew** (`crews/<crew>/_memory/runs.md`) ganha uma linha por execução, também
305
+ gravada pelo script: a que terminou, a que você abortou e a que a revisão rejeitou. A coluna
306
+ Score tem um significado só: aprovações suas sem pedido de correção, sobre as aprovações que você
307
+ respondeu (`2/3`).
308
+ - **A conversa caiu no meio?** Em qualquer conversa nova, peça `/opencrew retomar <nome>`. A IA
309
+ mostra o tema, o que já está pronto e de que passo vai continuar, e espera o seu sim. O que já
310
+ foi gravado e conferido não é refeito; o passo que estava no meio é refeito inteiro. O que foi
311
+ combinado só na conversa anterior, sem ter sido gravado, não volta.
312
+ - **Execução antiga fora do histórico?** O `/opencrew repair <nome>` mostra as pastas de execução
313
+ sem linha no histórico, pergunta o tema de cada uma e grava a linha como `Registrada depois`,
314
+ com cópia `runs.md.bak`. Linha sem pasta e pasta vazia são só apontadas: nada é apagado.
315
+ - Execução feita antes da 1.14.0 não tem registro: não dá para retomar.
316
+
296
317
  ## Documento Word
297
318
 
298
319
  Ata, ofício, declaração, contrato: quando o resultado é um documento para imprimir, assinar ou
@@ -498,9 +519,10 @@ npx @aksp/opencrew update --check
498
519
  | `/opencrew` | Abre o menu principal |
499
520
  | `/opencrew create <descrição>` | Cria uma nova crew a partir da sua descrição |
500
521
  | `/opencrew run <nome>` | Executa o pipeline de uma crew |
522
+ | `/opencrew retomar <nome>` | Continua a execução que parou no meio (a conversa caiu, o contexto acabou): mostra o que já está pronto e segue do passo seguinte, sem refazer o que foi gravado |
501
523
  | `/opencrew list` | Lista todas as suas crews |
502
524
  | `/opencrew edit <nome>` | Modifica uma crew existente |
503
- | `/opencrew repair <nome>` | Mostra o que falta numa crew que você já tem (formato de cada texto, arquivos do projeto que ela deve ler, proibições que o verificador consegue barrar, nomes dos agentes) e conserta um ponto por vez, com o seu sim e uma cópia `.bak` |
525
+ | `/opencrew repair <nome>` | Mostra o que falta numa crew que você já tem (formato de cada texto, arquivos do projeto que ela deve ler, proibições que o verificador consegue barrar, nomes dos agentes, execuções que ficaram fora do histórico) e conserta um ponto por vez, com o seu sim e uma cópia `.bak` |
504
526
  | `/opencrew delete <nome>` | Remove uma crew |
505
527
  | `/opencrew skills` | Navega, instala ou remove skills |
506
528
  | `/opencrew install <skill>` | Instala uma skill do catálogo |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aksp/opencrew",
3
- "version": "1.12.0",
3
+ "version": "1.14.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -59,6 +59,7 @@ Route input to the matching action:
59
59
  | `/opencrew create <description>` | Load the Architect (`_opencrew/core/architect.agent.yaml`) → Create Crew flow: one prompt per phase, listed there |
60
60
  | `/opencrew list` | List all crews in `crews/` (a folder without `crew.yaml` is not a crew) |
61
61
  | `/opencrew run <name>` | Load Pipeline Runner → Execute crew |
62
+ | `/opencrew retomar <name>` | Load Pipeline Runner → resume the run of that crew that stopped in the middle (`_opencrew/core/runner/retomar.md`) |
62
63
  | `/opencrew edit <name> <changes>` | Load the Architect → Edit Crew flow |
63
64
  | `/opencrew repair <name>` | Load `_opencrew/core/prompts/repair.prompt.md` → show what an existing crew is missing and fix one point at a time, each with a `.bak` copy |
64
65
  | `/opencrew skills` | Load Skills Engine → Show skills menu |
@@ -97,11 +98,8 @@ When running a crew:
97
98
  from `_opencrew/_memory/preferences.md` (used to check the Dashboard toggle)
98
99
  5. Load crew memory from `crews/{name}/_memory/memories.md`
99
100
  6. Read the pipeline runner instructions from `_opencrew/core/runner.pipeline.md`
100
- 7. **Pre-Execution Agent Selection** — only when `crew.yaml` declares
101
- `agent_dependencies:`. Analyze the user's request against the decision matrix,
102
- present the agents as a numbered multi-select (IDE-neutral), let the user
103
- confirm/adjust, warn about broken dependencies, and build the filtered step
104
- list. Crews without the field skip this and run all agents.
101
+ 7. **Pre-Execution Agent Selection** — the runner says when it applies (only when `crew.yaml`
102
+ declares `agent_dependencies:`) and which of its parts to read
105
103
  8. Execute the pipeline step by step following the runner instructions
106
104
 
107
105
  ## Dashboard (Optional)
@@ -1 +1 @@
1
- 1.12.0
1
+ 1.14.0
@@ -9,6 +9,7 @@ crews/{code}/
9
9
  ├── crew.yaml the crew: identity, sources, limits
10
10
  ├── crew-party.csv one row per agent (the names shown to the user)
11
11
  ├── agents/{agent-id}.agent.md
12
+ ├── agents/{agent-id}/tasks/ the task files of an agent that declares `tasks:` (optional)
12
13
  ├── pipeline/
13
14
  │ ├── pipeline.yaml the order of the steps
14
15
  │ ├── steps/step-NN-{name}.md
@@ -36,6 +36,8 @@ Generate these files directly — they are compilations of data already gathered
36
36
 
37
37
  ## Proibições Explícitas
38
38
 
39
+ ## Regras de Ouro
40
+
39
41
  ## Técnico (específico do crew)
40
42
  ```
41
43
  - `crews/{code}/_memory/runs.md` — empty run history log:
@@ -2,7 +2,7 @@
2
2
 
3
3
  You are the opencrew Repair agent. A crew built by an older version misses what later versions
4
4
  added: the format of each text, the project sources, bans the checker can enforce, the persona
5
- names. Your job is to show the user what is missing in **one crew that already exists** and fix
5
+ names, the runs that never reached the history. Your job is to show the user what is missing in **one crew that already exists** and fix
6
6
  one point at a time, each with the user's yes.
7
7
 
8
8
  **You never write inside `crews/` yourself.** Every change is one command of the script below,
@@ -33,6 +33,8 @@ It only reads. Its last line is the status:
33
33
 
34
34
  - `CONSERTO:OK` — say "A crew {nome} está em dia: não há o que consertar." and stop.
35
35
  - `CONSERTO:PENDENTE` — one block per finding, each starting with `[código]`. Go to Step 3.
36
+ - A line starting with `Nota:` (with any status) is information, not a finding: show it to the
37
+ user once, in plain words; there is nothing to fix and nothing is deleted.
36
38
  - `CONSERTO:ERRO`, or the script did not run (no Node, an error) — show the user the message as
37
39
  it came and stop. Do not repair by hand.
38
40
 
@@ -60,6 +62,7 @@ codes between brackets, the `--aplicar` lines or the `CONSERTO:` status line.
60
62
  | `sem-aprovacao-final` | "Depois da revisão não há um ponto de aprovação seu. Isso se resolve editando a crew: /opencrew edit {nome}." | none |
61
63
  | `publica-antes` | "O passo {n} publica ou envia antes da revisão e da sua aprovação final. Enquanto estiver assim, o que sai não passou pela revisão. Isso se resolve editando a crew: /opencrew edit {nome}." | none |
62
64
  | `passo-faltando` | Show the lines the script printed and say that it is solved by editing the crew: `/opencrew edit {nome}` | none |
65
+ | `historico` | For each listed run folder: "A pasta {run} tem arquivos de uma execução que não está no histórico: {arquivos}. Qual foi o tema dela? (Se não lembrar, responda 'não sei'.)" With 'não sei', the theme is `não informado`. A folder the script marks as `interrompida` can still be resumed: say so (`/opencrew retomar {nome}`) and register it only if the user prefers. An empty folder (`execução abandonada`) and a row with no folder are only shown: nothing is deleted | `--aplicar "historico:{run}={tema}"` — the theme on one line, with only letters, digits, spaces and `. , : ; - ( ) / ?` |
63
66
 
64
67
  The command is always the same line, with the item between double quotes:
65
68
 
@@ -0,0 +1,33 @@
1
+ # Output Contract Validation
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when the step's frontmatter declares an `output_contract:` field.
4
+
5
+ If the step's frontmatter declares an `output_contract:` field, apply structured validation
6
+ in the same call as the basic file existence check (Post-Step Output Validation):
7
+
8
+ 1. **Required sections check**: If `output_contract.required_sections` is defined, add
9
+ `--secoes {min_sections}` to the same `conferir` command: the file needs at least that many
10
+ lines starting with `## `.
11
+
12
+ 2. **TL;DR check**: If the output contract requires a TL;DR section, add `--tldr` to the same
13
+ `conferir` command.
14
+
15
+ 3. **If a check fails** (the last line is `CAMINHO:REPROVADO {motivo}`, with a motivo other than
16
+ `arquivo ausente ou vazio`; the script reports the first one):
17
+ - Present to user: "⚠️ Output from {Agent Name} is incomplete: {motivo}"
18
+ - Options as numbered list:
19
+ 1. Accept anyway and continue
20
+ 2. Retry step (re-execute the agent)
21
+ 3. Abort pipeline
22
+
23
+ 4. **If no `output_contract` is defined**, skip this validation entirely (backward compatible).
24
+
25
+ Example `output_contract` in step frontmatter:
26
+ ```yaml
27
+ output_contract:
28
+ required_sections:
29
+ - "Fontes Pesquisadas"
30
+ - "Principais Descobertas"
31
+ - "TL;DR"
32
+ min_sections: 3
33
+ ```
@@ -0,0 +1,37 @@
1
+ # Escritório (optional live view)
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when `preferences.md` has `Dashboard: enabled`.
4
+
5
+ A local page that shows the crew at work, off by default. Follow this part only when the
6
+ already-loaded `preferences.md` has `Dashboard: enabled` (written `- **Dashboard:** enabled` or
7
+ plain `Dashboard: enabled`, any letter case); otherwise run none of these commands. When it is on,
8
+ run, from the project root, the one-line command of each moment:
9
+
10
+ | Moment | Command |
11
+ |---|---|
12
+ | Start of the run (Initialization, step 6) | `node _opencrew/core/scripts/estado.mjs "{name}" iniciar --passos {N}` |
13
+ | Right after `iniciar`, once per deselected agent | `node _opencrew/core/scripts/estado.mjs "{name}" pular --agente {id}` |
14
+ | Before each step, each time it starts | `node _opencrew/core/scripts/estado.mjs "{name}" passo --n {K} --agente {id} --rotulo "{rótulo}" --mensagem "{frase}"` |
15
+ | Before asking the question of a checkpoint (instead of `passo`) | `node _opencrew/core/scripts/estado.mjs "{name}" checkpoint --n {K} --agente {id} --rotulo "{rótulo}"` |
16
+ | End of the run (After Pipeline Completion) | `node _opencrew/core/scripts/estado.mjs "{name}" concluir` |
17
+ | Run aborted after `iniciar`, by the user or by an error | `node _opencrew/core/scripts/estado.mjs "{name}" falhar --motivo "{motivo}"` |
18
+
19
+ - **One at a time** — Run these commands one at a time, waiting for the `ESTADO:` line of each
20
+ before the next — never in parallel or in the background (each one reads and rewrites the same file).
21
+ - **Values** — `{name}`: the crew code. `{N}`: how many steps will run, checkpoints included (a
22
+ deselected agent's steps do not count). `{K}`: the step's position among them, from 1. `{id}`: the agent's `id` column in
23
+ `crew-party.csv`; a step or checkpoint with no `agent:` goes without `--agente`
24
+ (the table shows the full form). `{rótulo}`: the step's name, in
25
+ a few words. `--mensagem` goes only when the agent changed since the last `passo` (so never on the first
26
+ one): one sentence on what the previous agent delivered — never look at the next step. `{motivo}`: why the run stopped.
27
+ - **Text on the command line** — `--rotulo`, `--mensagem` and `--motivo` go between double quotes,
28
+ on one line, starting with a letter or a digit, with only letters (accents included), digits,
29
+ spaces and `. , : ; - ( ) / ?`. Drop every other sign (quotes of any kind, `$`, backtick, `\`,
30
+ `%`, `!`, emoji). If no text is left, omit the option. Write them in the user's language.
31
+ - **After `iniciar`**, when it answers `ESTADO:OK`, show the user once:
32
+ `Escritório ligado. Se a página não estiver aberta, rode em outro terminal: node _opencrew/core/scripts/escritorio.mjs`
33
+ - **The Escritório never stops the run.** A command that fails, does not run or answers
34
+ `ESTADO:IGNORADO`: go on, do not repeat that event, ask nothing, and tell the user once per run,
35
+ in one line: `O escritório não foi atualizado nesta execução; o trabalho segue normalmente.` With
36
+ the reason "escritório desligado", say nothing and stop calling the script for the rest of this run.
37
+ - The script is the only writer: never read, write or describe `crews/{name}/state.json` yourself.
@@ -0,0 +1,99 @@
1
+ # End of the run
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it when the pipeline has completed. It continues the list of "After Pipeline Completion" in the runner: items 2 and 3 below are the items 2 and 3 of that list; follow them in order.
4
+
5
+ 2. **Update crew memory** — write to BOTH files:
6
+
7
+ ### 2a. Update `memories.md` (living preferences)
8
+
9
+ Read `crews/{name}/_memory/memories.md` in full. Then identify candidates from this run: **only explicit user feedback** — approvals with comments, rejections with reasons, direct requests ("prefiro X", "não quero Y"). Never infer preferences.
10
+
11
+ For each candidate:
12
+ - If an equivalent memory already exists and is compatible → skip (no duplicate)
13
+ - If an equivalent memory exists but contradicts the new item → replace with the newer version
14
+ - If no equivalent exists → add to the correct semantic section:
15
+ - Writing style choices → `## Estilo de Escrita`
16
+ - Visual/design preferences → `## Design Visual`
17
+ - Content structure choices → `## Estrutura de Conteúdo`
18
+ - Explicit rejections or prohibitions → `## Proibições Explícitas`, in the canonical form
19
+ (`- Nunca usar "termo"` or `- Nunca usar "termo" → usar "outro"`)
20
+ - Crew-specific technical patterns → `## Técnico (específico do crew)`
21
+
22
+ **Never write to `memories.md`:**
23
+ - Runner inferences ("usuário parece preferir X")
24
+ - Run scores, review grades, output file paths, topics from past runs
25
+
26
+ **Technical routing:** For any technical learning (bugs, workarounds, API behavior):
27
+ - If it affects any crew (Playwright bugs, OS rendering quirks, API limits) → write to `_opencrew/best-practices.local/{format}.md` instead of `memories.md` (copy the core file there first if the local one does not exist yet — the core folder is replaced by every `update`; the local one is never touched)
28
+ - If it is specific to this crew's output type or toolchain → add to `## Técnico (específico do crew)` following the dedup rules above
29
+
30
+ After applying all candidates, write the updated `memories.md`.
31
+
32
+ If no candidates are found (the run had no explicit user feedback), skip writing `memories.md` entirely — do not write an unmodified copy. Always proceed to step 2b regardless.
33
+
34
+ ### 2b. Prepend to `runs.md` — the script writes the row
35
+
36
+ Never write `crews/{name}/_memory/runs.md` yourself. Close the run with the `fechar` command of the runner ("Run record"): `--resultado` is `aprovado` (the final approval was given), `publicado` (an irreversible step published or sent) or `rejeitado` (the review rejected at the last cycle and the user aborted); `--saida` is a brief description of what was generated (e.g. "Carrossel 9 slides", "Thread 7 posts"); add `--tema "{tema}"` (1 sentence max) if no command of this run carried the topic yet.
37
+
38
+ The script writes the row of this run right below the header — `Data | Run ID | Tema | Output | Score | Resultado`, newest run first; a row this run already had is replaced — and prints it. No other data.
39
+
40
+ `Score` has one definition, and the script counts it from the recorded checkpoints: the checkpoints the user approved without corrections ÷ the checkpoints the user answered (approved + corrected; a skipped one does not count), e.g. `2/3`; `—` when none was answered. Never compute it yourself.
41
+
42
+ - Last line `EXECUCAO:FECHADA {resultado} {score}` → go on to 2c. A line `Não consegui gravar o histórico desta execução: {motivo}` before it → show it to the user as it came.
43
+ - The script did not run (no Node, an error, no `EXECUCAO:` line) → tell the user `⚠️ Não consegui gravar o histórico desta execução: {motivo}` and go on. Do not write the row by hand.
44
+
45
+ ### 2c. Post-Run Reflection (pattern detection)
46
+
47
+ After updating `memories.md` and closing the run, run a reflection pass. This is a lightweight analysis — not a full agent execution, just pattern matching on the corrections of this run and of the last runs.
48
+
49
+ 1. **Collect this run's corrections**: From checkpoint responses, gather every user rejection or correction. A correction is:
50
+ - A rejected output with a reason ("tom muito informal", "cor não combina", "fonte sem data")
51
+ - A modification request during checkpoint ("muda o título para X", "usa azul em vez de verde")
52
+
53
+ 2. **Look for recurrence**: use the list the `fechar` command printed under `Correções das últimas execuções:` — one line per correction recorded in the last 10 closed runs of this crew, this one included (`- {run_id} · passo {N} · {nota}`).
54
+ - Do not search `memories.md` for past runs: by rule it keeps no run data.
55
+ - Count: in how many different runs of that list does the same pattern appear?
56
+ - A "match" means the same step (so the same agent) + the same type of error (e.g. "redator + tom informal", "designer + cores saturadas")
57
+ - No list was printed → there is nothing to compare: skip items 3 and 4.
58
+
59
+ 3. **Promote to Regra de Ouro**: If the SAME pattern appears in **3 or more runs** (including this one):
60
+ a. Add a new entry under `## Regras de Ouro` in `memories.md` (the header is exactly this, fixed PT-BR; create the section if the file does not have it):
61
+ ```markdown
62
+ ## Regras de Ouro
63
+
64
+ - **{Agent role}**: SEMPRE {correct behavior}. {Why — grounded in user feedback}.
65
+ (Runs: #{run1}, #{run2}, #{run3})
66
+ ```
67
+ Example:
68
+ ```markdown
69
+ - **Redator**: SEMPRE verificar se o CTA contém link rastreável antes de finalizar.
70
+ (Runs: #2026-08-01-143022, #2026-08-05-091530, #2026-08-10-160845)
71
+ ```
72
+ b. Remove the individual entries from their original sections (`## Estilo de Escrita`, `## Design Visual`, etc.) — the Regra de Ouro replaces them.
73
+ c. Display to the user:
74
+ ```
75
+ 💡 Regra de Ouro detectada:
76
+ "{correct behavior}" aconteceu 3 vezes.
77
+ Vou aplicar automaticamente a partir de agora.
78
+ ```
79
+
80
+ 4. **Mark improvement**: If a previously recurring error did NOT happen this run:
81
+ - Add a `✅` marker to the Regra de Ouro entry: `✅ **Redator**: SEMPRE ...`
82
+ - This tracks that the crew is improving — the rule is working.
83
+
84
+ 5. **Bail out early**: If this run had zero corrections (all checkpoints approved), skip the entire reflection — nothing to learn.
85
+
86
+ 6. **Reflection budget**: Maximum 30 seconds of analysis: the list of the script is all the history you read. This is a quick scan, not an exhaustive audit.
87
+
88
+ 3. Present completion summary:
89
+ ```
90
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
91
+ ✅ Pipeline complete!
92
+ 📁 Delivery: crews/{name}/output/{run_id}/entrega/ — start with LEIA-ME.md
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+
95
+ What would you like to do?
96
+ ● Run again (new topic)
97
+ ○ Edit this content
98
+ ○ Back to menu
99
+ ```
@@ -0,0 +1,21 @@
1
+ # Source check that did not end in FONTES:OK
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when the source check of the Initialization (1c) ended in `FONTES:PENDENTE` or did not run.
4
+
5
+ If the last line is `FONTES:PENDENTE` (a cited file was moved, renamed or deleted), show the
6
+ report and ask — never continue silently with a missing source:
7
+ ```
8
+ Alguns arquivos que a crew usa não estão mais onde ela espera:
9
+ {resumo do relatório}
10
+
11
+ 1. Corrigir os caminhos sugeridos (troco nos arquivos da crew e guardo .bak)
12
+ 2. Seguir assim mesmo
13
+ 3. Parar
14
+ ```
15
+ On 1, run the same command with `--corrigir`, show the new result and re-read `crew.yaml` and
16
+ any agent file already loaded (it may have changed them); 1d then loads the sources from the
17
+ corrected paths. If the new result still ends in `FONTES:PENDENTE`, ask again with options 2 and
18
+ 3 only. Alerts — not portable (absolute paths) or "não conferido" (a network path or a site
19
+ address: the script never accesses the network) — are mentioned once, without stopping. If the
20
+ script did not run (no Node, an error, or no `FONTES:` status line), tell the user "⚠️ A
21
+ conferência de fontes não rodou: {motivo}" and continue; the final approval repeats the warning.
@@ -0,0 +1,58 @@
1
+ # Memory format
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when `memories.md` has no `## Estilo de Escrita` section header, is empty or does not exist.
4
+
5
+ **Note on language**: The structural labels listed below are **fixed PT-BR** and must
6
+ never be translated — opencrew's primary supported audience is PT-BR (see AGENTS.md →
7
+ Language Handling). Only the *content* written under these headers follows the user's
8
+ preferred language.
9
+
10
+ | Fixed PT-BR header | Location | Purpose |
11
+ |---|---|---|
12
+ | `## Estilo de Escrita` | `memories.md` | Writing style rules accumulated per crew |
13
+ | `## Design Visual` | `memories.md` | Visual design preferences per crew |
14
+ | `## Estrutura de Conteúdo` | `memories.md` | Content structure rules per crew |
15
+ | `## Proibições Explícitas` | `memories.md` | User bans and hard blocks per crew |
16
+ | `## Regras de Ouro` | `memories.md` | Corrections repeated in 3 or more runs, promoted at the end of a run |
17
+ | `## Técnico (específico do crew)` | `memories.md` | Technical crew-specific settings |
18
+ | `Data \| Run ID \| Tema \| Output \| Score \| Resultado` | `runs.md` | Run history table columns |
19
+
20
+ When adding new structural sections to `memories.md` or `runs.md`, keep headers in PT-BR
21
+ unless the user base expands beyond PT-BR — at that point, discuss a migration strategy
22
+ (e.g. i18n key mapping) rather than mixing languages in a single file.
23
+
24
+ ## Migration
25
+
26
+ **Memory format migration** — After loading `memories.md`, check whether it uses the new format: it does when it has the `## Estilo de Escrita` section header (read the file with the read tool — no command).
27
+ - If it has the header → proceed normally.
28
+ - If it does not (or the file is empty / does not exist) → migrate before proceeding:
29
+ a0. If the file exists and is not empty, FIRST copy it to `crews/{name}/_memory/memories.md.bak`
30
+ (never lose what the crew learned), then tell the user in one line:
31
+ "Atualizei o formato da memória da crew; a versão anterior está em `memories.md.bak`."
32
+ Move every rule you can recognize from the old file into the matching new section.
33
+ a. Write `crews/{name}/_memory/memories.md` with the new sections format:
34
+ ```markdown
35
+ # Crew Memory: {crew-name}
36
+
37
+ ## Estilo de Escrita
38
+
39
+ ## Design Visual
40
+
41
+ ## Estrutura de Conteúdo
42
+
43
+ ## Proibições Explícitas
44
+
45
+ ## Regras de Ouro
46
+
47
+ ## Técnico (específico do crew)
48
+ ```
49
+ (Use the crew's display name for `{crew-name}`, and the crew code for `{name}` in file paths — they refer to the same crew.)
50
+ b. Check if `crews/{name}/_memory/runs.md` exists (read tool — no command).
51
+ If it does not exist, create it with:
52
+ ```markdown
53
+ # Run History: {crew-name}
54
+
55
+ | Data | Run ID | Tema | Output | Score | Resultado |
56
+ |------|--------|------|--------|-------|-----------|
57
+ ```
58
+ - Do not pause execution for this migration (the one-line notice above is enough).
@@ -0,0 +1,51 @@
1
+ # Resuming a run (retomar)
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only on `/opencrew retomar {name}`.
4
+
5
+ A run that stopped in the middle — the conversation ended, the context ran out — left its record on
6
+ disk. Resuming is going on from the step after the last one that was done, with the same `run_id`:
7
+ what was written and checked is not redone; the step that was in the middle is done again, whole.
8
+
9
+ 1. From the project root, with the crew code between double quotes (safe-name rule of the runner):
10
+ ```
11
+ node _opencrew/core/scripts/execucao.mjs "{name}" retomar
12
+ ```
13
+ 2. Read the last line:
14
+ - `EXECUCAO:NADA` → say `Não há execução interrompida da crew {nome}.` and stop (to start a new
15
+ run: `/opencrew run {name}`).
16
+ - `EXECUCAO:RETOMAR {run_id} {N}` → the lines before it are the theme, the steps already checked
17
+ (each with its file), the checkpoints already answered and the verdicts of the review. Go to 3.
18
+ - The output starts with `Execuções abertas` → more than one run is open: show the list and ask
19
+ which one. For one that is not the newest, run the command again with `--run "{run_id}"`.
20
+ - A line `Não consegui ler na crew para qual passo a revisão … volta` → show it and confirm the
21
+ step with the user before going on.
22
+ - No `EXECUCAO:` line (no Node, an error) → show the message as it came and stop. Never rebuild
23
+ the state of a run by looking at its folder, and never read `execucao.json` yourself.
24
+ 3. Ask, and wait for the answer:
25
+ `A execução {run} ({tema}) parou depois do passo {k}. Já estão prontos: {lista}. Continuo do passo {N}?`
26
+ (`{run}`: the `run_id`; `{k}`: the step of the line `Parou depois do passo`; `{lista}`: the files
27
+ under `Passos conferidos` — not the ones under `Já gravados, mas serão feitos de novo`; a run
28
+ with no theme goes without the parentheses.)
29
+ - No → change nothing. Ask `Quer que eu encerre essa execução como abortada?`; after a yes, run
30
+ the `fechar` command of the runner ("Run record") with `--resultado abortado`, so it is no
31
+ longer offered. Then stop.
32
+ 4. Only now, after the yes (nothing of the runner's Initialization runs before the question): do the Initialization of the runner in full (memory format, source check, project
33
+ sources, pipeline, skills, tiers, agent selection, the header) **except step 5b**: do not run
34
+ `pasta` — the `run_id` is the one of the `EXECUCAO:RETOMAR` line.
35
+ Step 6 (the Escritório) happens as in a new run.
36
+ 5. Go on at step `{N}` of "For each pipeline step", with that `run_id`:
37
+ - Every input comes from the `entrada` command, as always: it finds what the earlier steps wrote.
38
+ - The paths under `Passos conferidos` are the stored paths of those steps: use them to show a
39
+ file at a checkpoint and to build the list of the delivery.
40
+ - Do not ask again a checkpoint the script listed as answered: its answer is in the file the
41
+ checkpoint saved (the `inputFile` of the step after it), or in the note the script printed.
42
+ - Step `{N}` is done whole, even when a file of it is already there (`saida` opens a new version).
43
+ - A review cycle the script listed counts: the cycles left are `max_review_cycles` minus the
44
+ verdicts under `Revisões:` for that review step (no such section: none), and the next
45
+ `verificacao-ciclo-{N}.md` is that number plus 1.
46
+ - The `Tema:` line says whether the record has a topic: `(sem tema)` → send `--tema` with the
47
+ next `marcar` or with `fechar`.
48
+ - `{N}` is after the last step of the pipeline (the script says `Todos os passos já foram feitos`)
49
+ → go straight to "After Pipeline Completion".
50
+ 6. Say once, before the first step: `Retomei pelo que está gravado. O que foi combinado só na conversa anterior não veio junto.`
51
+ A resumed run is recorded and closed like any other (`conferir --passo`, `marcar`, `fechar`).
@@ -0,0 +1,79 @@
1
+ # Pre-Execution Agent Selection
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when `crew.yaml` declares an `agent_dependencies:` field. It decides which agents actually run for this task.
4
+
5
+ Run this step ONLY if `crew.yaml` declares an `agent_dependencies:` field (even an
6
+ empty map `{}`). If the field is absent → skip this entire step and run ALL agents
7
+ exactly as before (legacy behavior).
8
+
9
+ When active, in this order:
10
+
11
+ a. **Capture the task** — Determine the user's request for this run:
12
+ - If the run was invoked with a description (e.g. `/opencrew run {name} {description}`),
13
+ use that text as the task.
14
+ - Otherwise ask: `📝 What is the task for this run? Reply in one line.`
15
+ Wait for the user's reply before continuing.
16
+
17
+ b. **Analyze against the decision matrix** — Scan the task text (case-insensitive,
18
+ PT-BR and EN keywords) for the signals below. Start with ALL agents suggested as
19
+ SELECTED (`required`). For each matching signal, find the affected agent(s) in
20
+ `crew-party.csv` by matching the role terms against the agent's `id` and `title`
21
+ (and `displayName` if ambiguous), then apply the suggested status:
22
+
23
+ | Signal in the task | Role terms to match (id / title) | Suggested status |
24
+ |--------------------|----------------------------------|------------------|
25
+ | "já pesquisei", "com base em", "fontes que tenho", "material pronto", "baseado nas fontes", "research already done" | researcher, pesquisad, research | optional |
26
+ | "revise", "melhore", "corrija", "refine", "edite" (sem criar do zero), "improve this draft" | copywriter, redator, writer, criador | optional |
27
+ | "só texto", "sem imagem", "sem visual", "sem arte", "no image" | designer, design, visual | skip |
28
+ | "já revisei", "já foi aprovado", "aprovado por terceiros", "revisão feita", "already reviewed" | reviewer, revisor | optional |
29
+ | "quero só revisar este texto", "apenas revisar", "review only" | researcher AND copywriter | skip |
30
+ | "tenho o conteúdo pronto", "forneço o documento", "docs em anexo", "segue o material", "here is the content" | copywriter, writer, creator | optional |
31
+
32
+ Resolution rules:
33
+ - `optional` = agent stays selected but may be unchecked.
34
+ - `skip` = agent is suggested deselected.
35
+ - Conflicting signals on the same agent → the more restrictive wins (`skip` > `optional`).
36
+ - Never suggest skipping an agent whose output is the run's final deliverable unless the
37
+ signal is explicit.
38
+ - No signal matches → suggest keeping all agents (no change).
39
+
40
+ c. **Present the selection** — IDE-neutral numbered multi-select. List every agent from
41
+ `crew-party.csv` in party order:
42
+ ```
43
+ 🧑‍🤝‍🧑 Which agents should work on this task?
44
+
45
+ Suggested selection:
46
+ 1. [x] {icon} {displayName} ({id}) — {title}
47
+ 2. [x] {icon} {displayName} ({id}) — {title}
48
+ 3. [ ] {icon} {displayName} ({id}) — {title}
49
+ ...
50
+ [x] = suggested selected · [ ] = suggested deselected
51
+
52
+ Reply with the numbers of the agents you want to INCLUDE, separated by commas.
53
+ Example: "1, 2" · Reply "all" to run everyone.
54
+ ```
55
+ Wait for the user's reply. Parse it into `selected_agents`. At least one agent must
56
+ be selected — if the user replies with none, repeat the prompt once.
57
+
58
+ d. **Dependency warnings** — Using `crew.yaml → agent_dependencies`
59
+ (e.g. `copywriter: [researcher]` = copywriter consumes researcher's output):
60
+ for every dependency `dependent → required_agent`, if `dependent` is selected but
61
+ `required_agent` is NOT, warn:
62
+ ```
63
+ ⚠️ {dependent} normally depends on {required_agent}'s output, which you deselected.
64
+
65
+ 1. Re-select {required_agent} (recommended)
66
+ 2. Keep going without it — I will supply the input myself
67
+ 3. Deselect {dependent} too
68
+ ```
69
+ Wait for the user's choice and apply it. If they pick option 2, set
70
+ `missing_dependency = true` in working memory (the existing Pre-Step Input
71
+ Validation recovery — "Skip step and continue / Abort" — then handles any
72
+ downstream gap).
73
+
74
+ e. **Build the filtered step list** — Set `skipped_agents = all party agents − selected_agents`.
75
+ Build `filtered_steps` by walking `pipeline.yaml` in order, keeping a step when:
76
+ - its frontmatter has NO `agent:` field (checkpoints / generic steps), OR
77
+ - its `agent:` value is in `selected_agents`.
78
+ Store `selected_agents`, `skipped_agents`, and `filtered_steps` in working memory for
79
+ the per-step loop (steps 5 and 6 of the Initialization reflect them).
@@ -0,0 +1,34 @@
1
+ # Task-Based Agent Execution
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when the agent of the step has a `tasks:` field in its frontmatter.
4
+
5
+ When an agent's `.agent.md` frontmatter contains a `tasks:` field:
6
+
7
+ 1. **Load task list**: Read the `tasks:` array from the agent's frontmatter
8
+ - Each entry is a relative path to a task file (e.g., `tasks/analyze-source.md`)
9
+ - Tasks execute in the order listed
10
+
11
+ 2. **For each task in sequence**:
12
+ a. Read the task file from the agent's directory (`crews/{crew-name}/agents/{agent-id}/tasks/{task}.md`: a folder with the agent id, next to the agent file)
13
+ b. Construct the execution prompt:
14
+ - Agent persona + principles (from agent.md — fixed across all tasks)
15
+ - Task description and process (from task file)
16
+ - Task output format (from task file)
17
+ - Task quality criteria and veto conditions (from task file)
18
+ - Input: For the first task, use the step's input. For subsequent tasks, use the previous task's output.
19
+ c. Execute the task (inline or subagent, matching the step's execution mode)
20
+ d. Collect the task output
21
+ e. Check task veto conditions (same enforcement as the step veto conditions: "Veto Condition Enforcement", in the runner)
22
+
23
+ 3. **Final output**: The output of the LAST task in the chain becomes the step's output
24
+ - Resolve the `outputFile` path with the `saida` command (Output Path Transformation) before saving — this applies regardless of whether the step runs as `execution: inline` or `execution: subagent`
25
+ - Save to the **transformed** outputFile path
26
+ - This is what the next step (or checkpoint) receives
27
+
28
+ 4. **Progress reporting**: For inline execution, announce each task:
29
+ ```
30
+ {icon} {Agent Name} — Task {N}/{total}: {task name}...
31
+ ```
32
+
33
+ 5. **Backward compatibility**: If the agent's frontmatter does NOT contain a `tasks:` field,
34
+ execute the agent monolithically as before (current behavior unchanged).