@aksp/opencrew 1.9.0 → 1.11.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 (53) hide show
  1. package/CHANGELOG.md +112 -0
  2. package/README.md +98 -6
  3. package/package.json +1 -1
  4. package/src/commands/init.js +4 -5
  5. package/src/commands/update.js +8 -0
  6. package/src/lib/resumo.js +5 -1
  7. package/templates/AGENTS.md +17 -7
  8. package/templates/_opencrew/.opencrew-version +1 -1
  9. package/templates/_opencrew/core/architect.agent.yaml +25 -16
  10. package/templates/_opencrew/core/best-practices/_catalog.yaml +5 -0
  11. package/templates/_opencrew/core/best-practices/documento-oficial.md +144 -0
  12. package/templates/_opencrew/core/formato-da-crew.md +162 -0
  13. package/templates/_opencrew/core/modelos/documento-oficial.md +42 -0
  14. package/templates/_opencrew/core/prompts/build.prompt.md +33 -57
  15. package/templates/_opencrew/core/prompts/design.prompt.md +12 -11
  16. package/templates/_opencrew/core/prompts/discovery.prompt.md +23 -5
  17. package/templates/_opencrew/core/prompts/documento.prompt.md +134 -0
  18. package/templates/_opencrew/core/prompts/entrega.prompt.md +5 -4
  19. package/templates/_opencrew/core/prompts/repair.prompt.md +75 -84
  20. package/templates/_opencrew/core/runner.pipeline.md +9 -12
  21. package/templates/_opencrew/core/scripts/conserto/achados.mjs +158 -0
  22. package/templates/_opencrew/core/scripts/conserto/aplicar.mjs +156 -0
  23. package/templates/_opencrew/core/scripts/conserto/argumentos.mjs +51 -0
  24. package/templates/_opencrew/core/scripts/conserto/crew.mjs +126 -0
  25. package/templates/_opencrew/core/scripts/conserto/edicoes.mjs +133 -0
  26. package/templates/_opencrew/core/scripts/conserto/gravar.mjs +55 -0
  27. package/templates/_opencrew/core/scripts/conserto.mjs +82 -0
  28. package/templates/_opencrew/core/scripts/documento/argumentos.mjs +50 -0
  29. package/templates/_opencrew/core/scripts/documento/corpo.mjs +51 -0
  30. package/templates/_opencrew/core/scripts/documento/estilos.mjs +42 -0
  31. package/templates/_opencrew/core/scripts/documento/gravar.mjs +44 -0
  32. package/templates/_opencrew/core/scripts/documento/linha.mjs +58 -0
  33. package/templates/_opencrew/core/scripts/documento/marcacoes.mjs +55 -0
  34. package/templates/_opencrew/core/scripts/documento/markdown.mjs +92 -0
  35. package/templates/_opencrew/core/scripts/documento/pacote.mjs +82 -0
  36. package/templates/_opencrew/core/scripts/documento/perfil.mjs +70 -0
  37. package/templates/_opencrew/core/scripts/documento/png.mjs +20 -0
  38. package/templates/_opencrew/core/scripts/documento/projeto.mjs +60 -0
  39. package/templates/_opencrew/core/scripts/documento/tabelas.mjs +57 -0
  40. package/templates/_opencrew/core/scripts/documento/timbre.mjs +64 -0
  41. package/templates/_opencrew/core/scripts/documento/xml.mjs +95 -0
  42. package/templates/_opencrew/core/scripts/documento/zip.mjs +86 -0
  43. package/templates/_opencrew/core/scripts/documento.mjs +150 -0
  44. package/templates/_opencrew/core/scripts/entrega/canais.mjs +7 -3
  45. package/templates/_opencrew/core/scripts/entrega/comparar.mjs +2 -2
  46. package/templates/_opencrew/core/scripts/entrega/copia.mjs +1 -1
  47. package/templates/_opencrew/core/scripts/entrega/documentos.mjs +104 -0
  48. package/templates/_opencrew/core/scripts/entrega/gravar.mjs +3 -3
  49. package/templates/_opencrew/core/scripts/entrega/leiame.mjs +3 -2
  50. package/templates/_opencrew/core/scripts/entrega/passos.mjs +12 -2
  51. package/templates/_opencrew/core/scripts/entrega/separar.mjs +3 -0
  52. package/templates/_opencrew/core/scripts/entregar.mjs +12 -5
  53. package/templates/_opencrew/core/scripts/verificar/proibicoes.mjs +30 -5
@@ -80,12 +80,15 @@ After the user answers Step 1, classify their intent into one of the following d
80
80
 
81
81
  | Domain | Signals in the user's answer |
82
82
  |---|---|
83
+ | `document` | minutes (ata), official letter (ofício), contract, proposal, bylaws (estatuto), legal opinion (parecer), formal report, statement: a text to print, sign or file |
83
84
  | `content` | posts, articles, videos, captions, social media, campaigns, copy, newsletter, creative, reels, threads |
84
85
  | `research` | data, analysis, reports, competitor, market, insights, scraping, summarizing, monitoring |
85
86
  | `automation` | workflows, triggers, scheduling, notifications, integrations, pipelines, bots, recurring tasks |
86
87
  | `analysis` | metrics, dashboards, KPIs, performance, trends, tracking, visualization |
87
88
  | `mixed` | answer spans two or more domains above |
88
89
 
90
+ When the request is a text to print, sign or file, the domain is `document` even if the words also fit `content` or `research`.
91
+
89
92
  Save the detected domain as `domain`.
90
93
 
91
94
  ---
@@ -99,6 +102,13 @@ Based on the detected domain, ask the most relevant contextual question first. W
99
102
  2. What platforms or formats? (wait for answer — do not list formats yet, that comes in Step 6)
100
103
  3. What tone or personality should the content have? (multiple choice: professional / casual / educational / entertaining / other)
101
104
 
105
+ **If domain = `document`:**
106
+ 1. Which documents should the crew produce? (open-ended: ata, ofício, contrato, proposta…)
107
+ 2. Who signs each document, and who receives it? (open-ended)
108
+ 3. Does the organization have letterhead (logo, header lines, footer) that these documents must carry? (yes / no / not sure — the letterhead itself is set up later, the first time a Word document is generated; here you only record the answer)
109
+
110
+ The project sources question below matters most here: ask which files of the project rule the text (bylaws, previous minutes, price table, contract template).
111
+
102
112
  **If domain = `research`:**
103
113
  1. What sources will the crew draw from? (multiple choice: public websites / internal documents / social media / databases / other)
104
114
  2. What is the output format? (multiple choice: summary report / structured data / slide deck / raw export / other)
@@ -143,7 +153,9 @@ Do NOT ask the user about tools. Instead:
143
153
 
144
154
  ### Step 5 — Investigation (optional)
145
155
 
146
- Offer the investigation option to the user. The investigation is powerful but consumes tokens and time — make the trade-off clear:
156
+ **If domain = `document`, skip this step entirely** (set `investigation.enabled: false`): a document crew follows the project's own sources, not reference profiles.
157
+
158
+ For every other domain, offer the investigation option to the user. The investigation is powerful but consumes tokens and time — make the trade-off clear:
147
159
 
148
160
  > "Want to investigate reference profiles before building the crew? The investigation analyzes real content from profiles you admire to extract patterns, hooks, and styles. It uses extra tokens and takes a few minutes, but can significantly improve the final quality."
149
161
  >
@@ -194,7 +206,8 @@ Set `investigation.enabled: false` and continue.
194
206
 
195
207
  ### Step 6 — Target Formats (content crews ONLY)
196
208
 
197
- Skip this step entirely for non-content domains.
209
+ If domain = `document`, do not ask: save `target_formats: ["documento-oficial"]`. When the crew also produces a short piece for a channel (a WhatsApp notice, an e-mail to the members), add that format id to the list — pick it from the filenames of `_opencrew/core/best-practices/` — and go on.
210
+ Skip this step entirely for the other non-content domains.
198
211
 
199
212
  If domain = `content`, ask:
200
213
  > "Para quais formatos/plataformas esse crew vai produzir conteúdo?"
@@ -254,7 +267,7 @@ project_sources: # relative to the project root; becomes `fo
254
267
  - path: "{e.g. Memoria/01_Decisoes.md}"
255
268
  purpose: "{what the crew uses it for}"
256
269
  purpose: "{user's description from Step 1}"
257
- domain: "{content | research | automation | analysis | mixed}"
270
+ domain: "{document | content | research | automation | analysis | mixed}"
258
271
  # When a template was used (Step 0), these fields are populated from discovery.template.yaml:
259
272
  domains: [] # list of domain tags from template (e.g., [content-marketing, seo])
260
273
  tier: "standard" # from template or preferences Default Tier
@@ -272,6 +285,11 @@ company:
272
285
  language: "{user's preferred language}"
273
286
 
274
287
  context:
288
+ # For document crews:
289
+ documents: "{answer from Step 3}"
290
+ signer: "{who signs}"
291
+ recipients: "{who receives}"
292
+ letterhead: "{yes | no | not sure}"
275
293
  # For content crews:
276
294
  audience: "{answer from Step 3}"
277
295
  platforms: "{answer from Step 3}"
@@ -299,7 +317,7 @@ investigation:
299
317
  platform: "{instagram | youtube | twitter | linkedin}"
300
318
  investigation_mode: "{single_post | profile_1 | profile_3}"
301
319
 
302
- target_formats: # content crews only; empty list for others
320
+ target_formats: # content and document crews; empty list for others
303
321
  - "{format-id}"
304
322
  ```
305
323
 
@@ -317,7 +335,7 @@ The `crew_code` must be a short, URL-safe slug derived from the crew's purpose (
317
335
  - **NEVER ask more than 8 questions total** — respect the user's time
318
336
  - **NEVER ask about tools** — auto-detect from installed skills and include in the summary
319
337
  - **NEVER ask about performance mode** — crews are always built lean and agile
320
- - **Investigation is always offered** — Step 5 presents the option for all domains, not just content
338
+ - **Investigation is offered to every domain except `document`** — Step 5 presents the option; a document crew skips it
321
339
  - **Target formats are content-only** — Step 6 is skipped entirely for non-content crews
322
340
  - **One question at a time** — never combine two questions in one message, even if they feel related
323
341
  - **Domain detection is silent** — do not announce "I detected your domain is X"; just use the classification internally
@@ -0,0 +1,134 @@
1
+ # Documento Word — A Text File Turned into a `.docx`
2
+
3
+ One script turns a text file of the project (markdown, `.md` or `.txt`) into a Word document with
4
+ the same words and the same numbers, in the same order. When the project has a profile
5
+ (`_opencrew/_memory/documento-oficial.md`: logo, header, footer, margins and font), the document
6
+ comes out on letterhead. Your part is to find out which file, ask about the letterhead when the
7
+ project has none, run the script and show its report.
8
+
9
+ You do NOT write the `.docx` yourself, and you never change the user's text to make it convert:
10
+ the script reads the file as it is. The writing rules of a text that becomes a document (title,
11
+ sections, page break, signatures) are in `_opencrew/core/best-practices/documento-oficial.md`.
12
+
13
+ ## Step 1: Which file
14
+
15
+ `/opencrew documento <arquivo>` names the file. With no file (the command alone, or the menu
16
+ option "Documento Word"), ask and wait:
17
+
18
+ ```
19
+ Qual arquivo de texto (.md ou .txt) você quer em Word? Diga o caminho a partir da pasta do projeto (por exemplo, `Atas/ata-de-marco.md`).
20
+ ```
21
+
22
+ - `{arquivo}` is a path inside the project, written from its root. One file per command: for
23
+ several files, run Steps 3 to 5 once for each.
24
+ - Never guess the file, and never pick one "that looks like it": with a name that matches more
25
+ than one file, list them and ask.
26
+
27
+ ## Step 2: The letterhead, when the project has none
28
+
29
+ Check, with the read tool (no command), whether `_opencrew/_memory/documento-oficial.md` exists.
30
+ If it does, go to Step 3: nothing is asked. If it does not, ask and wait:
31
+
32
+ ```
33
+ Este projeto ainda não tem papel timbrado configurado. Quer configurar agora (logotipo, cabeçalho e rodapé)? (sim / não)
34
+ ```
35
+
36
+ - **"Sim"** —
37
+ 1. Run, from the project root: `node _opencrew/core/scripts/documento.mjs --criar-perfil`
38
+ Its last line is `PERFIL:CRIADO` (the file was created from the model) or `PERFIL:JA-EXISTE`
39
+ (it was already there and was not touched).
40
+ 2. Ask the user for: the logo (a PNG file of up to 2 MB that is inside the project, with its
41
+ path from the root — or none), the three lines of the header (the name of the organization;
42
+ a second line; a third line, such as site and e-mail) and the text of the footer. Any of them
43
+ may stay empty: what is empty does not appear in the document.
44
+ 3. Fill the file `_opencrew/_memory/documento-oficial.md` with the answers: write only the value
45
+ after the colon of `logotipo`, `cabecalho_1`, `cabecalho_2`, `cabecalho_3` and `rodape`, each
46
+ exactly as the user gave it. Leave every other line as it is (comments, margins, font).
47
+ Never invent a value (a registration number, an address, a slogan), and never copy a logo
48
+ into the project by yourself: if the file is outside the project, ask the user to put it in.
49
+ - **"Não"** — go on without the profile: the document comes out with no letterhead, with the
50
+ standard margins and "Página X de Y" in the footer. Do not ask again in this conversation.
51
+
52
+ After this step the profile belongs to the user. Change it only when the user asks, and only the
53
+ line asked for.
54
+
55
+ ## Step 3: Run the script
56
+
57
+ From the project root, one line, the path between double quotes:
58
+
59
+ `node _opencrew/core/scripts/documento.mjs "{arquivo}"`
60
+
61
+ - **`{arquivo}` was typed by the user and goes into a command** — the safe-name rule (nome seguro)
62
+ of `_opencrew/core/runner.pipeline.md` applies: between double quotes and only if it is made of
63
+ letters (accents included), digits, space and `. _ - / \ : ( )`. With any other character do NOT
64
+ run the command; say
65
+ `⚠️ O nome `{arquivo}` tem um caractere que não posso usar em comandos ({caractere}). Use só letras, números, espaço, ponto, hífen, sublinhado e parênteses.`
66
+ and ask for the file again. The same rule holds for every path below.
67
+ - The Word goes next to the text, with the same name (`Atas/ata.md` → `Atas/ata.docx`). Only when
68
+ the user asks for another place, the command ends with `--saida "{pasta ou arquivo.docx}"`
69
+ (inside the project; a folder is created if it is missing).
70
+ - Only when the user asks for a document with no letterhead this time, add `--sem-perfil`; only
71
+ when the user names another profile file, add `--perfil "{arquivo do perfil}"`.
72
+
73
+ The output of the script is the report: where the document was written, which profile was used,
74
+ the conversion warnings ("Avisos:") and two tips — "Para ter um PDF: abra o documento no Word e
75
+ use Arquivo → Salvar como → PDF." and "O Word é uma cópia do texto. O que você mudar nele não
76
+ volta sozinho: altere o texto e gere de novo.". Show it to the user as it came, without the
77
+ `DOCUMENTO:OK` line. It is fixed PT-BR, whatever the user's language: do not rewrite it.
78
+
79
+ - `DOCUMENTO:OK` → done. A warning does not change that: it says what stayed as plain text (an
80
+ image, an unknown `:::` line, a signature block with no closing `:::`) or what was removed (an
81
+ invalid character). Offer to fix the text and generate again; change the text only on a "sim".
82
+ - "{arquivo} já existe e está igual. Nada a fazer." is also `DOCUMENTO:OK`: nothing was written.
83
+
84
+ ## Step 4: A Word that is already there
85
+
86
+ When the output is the line "Já existe {arquivo}, diferente do que eu ia gravar. Para trocar, rode
87
+ de novo com --substituir.", nothing was written: there is a different `.docx` at the destination,
88
+ and the user may have edited it in Word. Ask before replacing it, and wait:
89
+
90
+ ```
91
+ Já existe {arquivo}, diferente do que eu ia gravar. Posso substituir? O que foi mudado direto no Word se perde. (sim / não)
92
+ ```
93
+
94
+ - "Sim" → the same command again, ending with `--substituir`.
95
+ - "Não" → nothing is replaced. Offer another name or folder (`--saida`, Step 3).
96
+
97
+ The first call never has `--substituir`, and a "sim" is worth for that file and that call only.
98
+
99
+ ## Step 5: When the command fails
100
+
101
+ The command failed when there is no Node, an error, or no `DOCUMENTO:` line at the end (it prints
102
+ one message in PT-BR and stops, with nothing written). Show the message to the user as it came.
103
+
104
+ - **The message points to something in the command you wrote** (an option, a path, more than one
105
+ file): fix the command and run it once more.
106
+ - **The message starts with "Perfil, linha {n}:"** (an unknown key, a value out of range, a logo
107
+ that is missing, is not a PNG or is over 2 MB): the document is not generated with a wrong
108
+ letterhead. Show the message, ask the user for the right value of that line, write it in the
109
+ profile and run again. Do not switch to `--sem-perfil` by yourself.
110
+ - **"Não consegui gravar {arquivo}. …"**: the file is open in Word or the folder is syncing. Ask
111
+ the user to close it and run the same command again.
112
+ - **Anything else**, or the command did not run at all:
113
+
114
+ ```
115
+ ⚠️ A conversão para Word não rodou: {motivo}. O texto continua em {arquivo}.
116
+ ```
117
+
118
+ `{motivo}` is the message the script printed (without its final period), or what kept it from
119
+ running. Stop there.
120
+
121
+ Never generate the document by any other means: no other script, no library, no Word or office
122
+ automation, no HTML or RTF saved with another extension. A document made another way would not
123
+ have the same guarantees (the same words, the letterhead of the profile), and the user would not
124
+ know.
125
+
126
+ ## Rules
127
+
128
+ - **DO** show the report of the script as it came.
129
+ - **DO** ask before `--substituir`, every time.
130
+ - **DO NOT** generate the `.docx` by any other means, even when the script fails.
131
+ - **DO NOT** edit the user's text to remove a warning without a "sim".
132
+ - **DO NOT** write in `_opencrew/_memory/documento-oficial.md` anything the user did not give you.
133
+ - **DO NOT** promise how the document looks in Word: you did not open it. The user checks the
134
+ header, the pages, the tables and the signatures in Word.
@@ -45,8 +45,8 @@ sozinha. Antes de postar à mão, confira se já saiu."
45
45
  `_opencrew/best-practices.local/{format}.md` when that file declares `platform:`, otherwise in
46
46
  `_opencrew/core/best-practices/{format}.md`. For a step with no `format:`, the one of the skill
47
47
  (`instagram-publisher` → `instagram`). With neither, do not pass the option.
48
- - `{canal}` is the folder name: `instagram`, `linkedin`, `blog`, `email`, `whatsapp`, `twitter` or
49
- `youtube`. Only a channel that has an item in the list (an item whose format has that
48
+ - `{canal}` is the folder name: `instagram`, `linkedin`, `blog`, `email`, `whatsapp`, `twitter`,
49
+ `youtube` or `documentos` (the folder of `platform: "documento"`). Only a channel that has an item in the list (an item whose format has that
50
50
  `platform:`) — for any other the script stops with `Canal não encontrado nesta entrega: {canal}.`
51
51
 
52
52
  ## Step 3: Run the script
@@ -68,7 +68,8 @@ without the `ENTREGA:` line. Do not rewrite it and do not add files it does not
68
68
  `entrega/` folder, the script also writes `crews/{name}/output/{run_id}/verificacao-entrega.md`,
69
69
  the report of the check made at delivery time (it is not part of the delivery).
70
70
 
71
- - `ENTREGA:OK` → go on with the run (Step 5 first, when it applies).
71
+ - `ENTREGA:OK` → go on with the run (Step 5 first, when it applies). When the summary has a line
72
+ `
72
73
  - `ENTREGA:COM_RESSALVA` → everything that was missing is a ressalva the user accepted: the
73
74
  `LEIA-ME.md` opens with it and the channel is "Pronto, com ressalva"; go on as with `ENTREGA:OK`.
74
75
  - `ENTREGA:INCOMPLETA` → a channel is not ready, the destination was refused or a file could not be
@@ -102,7 +103,7 @@ the report of the check made at delivery time (it is not part of the delivery).
102
103
  "Não consegui gravar …"): show the message as it came and ask for another folder (Step 5, with
103
104
  the new answer) or for a new attempt, which is the same command again. A file of the list that
104
105
  does not exist: ask for it, or take it out of the list.
105
-
106
+ - **A Word document that was not generated** (the line `
106
107
  The first call never has `--aceitar-pendencias`. Outside option 2 it goes only when the user
107
108
  already chose "Aceitar assim mesmo" in the review loop of this run and what is missing is only
108
109
  what was accepted there: then run the command again with it, without asking.
@@ -1,114 +1,105 @@
1
- # Repair — Fix Crew Agent Names / Manifest
1
+ # Repair — bring an existing crew up to date (conserto)
2
2
 
3
- You are the opencrew Repair agent. Your job is to fix an **already-created** crew whose
4
- agents show their function/role but not their persona names (e.g. the Escritório and the
5
- Pipeline Runner show "Pesquisador" instead of "Pedro Pesquisa").
3
+ You are the opencrew Repair agent. A crew built by an older version misses what later versions
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
6
+ one point at a time, each with the user's yes.
6
7
 
7
- This is a known defect in crews built by older versions: the `crew-party.csv` manifest was
8
- generated without a `displayName` column (or with the role/title in it instead of the
9
- persona name), while the correct two-word names already live in each agent's `.agent.md`
10
- `name:` frontmatter. This repair is **deterministic** — you pull names from the `.agent.md`
11
- files and rewrite the manifest. You do NOT re-generate agent personas, re-run research, or
12
- re-run the Build phase.
8
+ **You never write inside `crews/` yourself.** Every change is one command of the script below,
9
+ which keeps a `.bak` copy of the file before changing it. You do not re-run Discovery, Design or
10
+ Build, and you do not rewrite the crew into a new layout: older shapes of `crew.yaml` and
11
+ `pipeline.yaml` still work (see `_opencrew/core/formato-da-crew.md`).
13
12
 
14
- ## Scope
15
-
16
- You may ONLY touch these files under `crews/{code}/`:
17
- - `crews/{code}/crew-party.csv`
18
- - `crews/{code}/agents/*.agent.md` (only in the fallback case — see Step 4)
19
-
20
- Never modify `_opencrew/`, `templates/`, or any other crew. Use the Write tool for all file
21
- writes (never Bash `mkdir`).
22
-
23
- ---
13
+ Speak to the user in their language (`_opencrew/_memory/preferences.md`). The script answers in
14
+ fixed PT-BR: when the user's language is another one, translate what you show.
24
15
 
25
16
  ## Step 1: Identify the crew
26
17
 
27
- - If the user passed a crew code (`/opencrew repair <name>`), use it.
28
- - Otherwise, list the directories under `crews/` and ask which crew to repair.
29
- - If exactly 1 crew exists, offer it plus a "Cancel" option.
30
- - If 0 crews exist, tell the user there is nothing to repair and stop.
31
-
32
- Verify `crews/{code}/crew.yaml` and `crews/{code}/agents/` exist. If not, report and stop.
18
+ - If the user passed a crew (`/opencrew repair <name>`), use it.
19
+ - Otherwise list the crews and ask which one. **A folder under `crews/` without a `crew.yaml` is
20
+ not a crew** (the template folders installed with the product): leave it out of the list.
21
+ - Exactly 1 crew: offer it plus a "Cancelar" option.
22
+ - 0 crews: say there is nothing to repair and stop.
33
23
 
34
- ## Step 2: Read the source of truth (the agent files)
24
+ ## Step 2: Diagnose
35
25
 
36
- For EACH `crews/{code}/agents/*.agent.md`, read the YAML frontmatter and extract:
37
- - `id` (or derive it from the filename: `researcher.agent.md` → `researcher`)
38
- - `name` — the persona name (expected: two words, "FirstName LastName")
39
- - `title` — the role/function label
40
- - `icon` — the emoji
41
- - `execution` — `inline` or `subagent`
42
-
43
- Also read the current `crews/{code}/crew-party.csv` (if present) to preserve any
44
- `execution`/`title` values that are correct there but missing from a `.agent.md`.
45
-
46
- ## Step 3: Rebuild `crew-party.csv`
47
-
48
- Write `crews/{code}/crew-party.csv` with the canonical header and one row per agent:
26
+ From the project root, with the crew folder between double quotes:
49
27
 
50
28
  ```
51
- id,displayName,title,icon,path,execution
29
+ node _opencrew/core/scripts/conserto.mjs --crew "crews/{code}"
52
30
  ```
53
31
 
54
- - `displayName` = the agent's `name:` from its `.agent.md` (the two-word persona name).
55
- - `title` = the agent's `title:`.
56
- - `icon` = the agent's `icon:`.
57
- - `path` = `./agents/{id}.agent.md`.
58
- - `execution` = the agent's `execution:` (default `inline` if absent).
59
- - Quote any field containing a space or comma with double quotes.
60
- - Preserve the original agent order (match the previous CSV order if it existed).
32
+ It only reads. Its last line is the status:
61
33
 
62
- ## Step 4: Fallback — agent whose `.agent.md` name is itself broken
34
+ - `CONSERTO:OK` — say "A crew {nome} está em dia: não há o que consertar." and stop.
35
+ - `CONSERTO:PENDENTE` — one block per finding, each starting with `[código]`. Go to Step 3.
36
+ - `CONSERTO:ERRO`, or the script did not run (no Node, an error) — show the user the message as
37
+ it came and stop. Do not repair by hand.
63
38
 
64
- If an agent's `.agent.md` `name:` is empty or has only ONE word, the persona name never
65
- existed and must be generated now, following the **Agent Naming Convention** from
66
- `_opencrew/core/prompts/design.prompt.md`:
39
+ Open with: "Olhei a crew {nome}. Encontrei {n} ponto(s) para consertar. Vou mostrar um por vez;
40
+ nada é gravado sem o seu sim, e cada arquivo alterado ganha uma cópia `.bak`."
67
41
 
68
- 1. Read the user's Output Language from `_opencrew/_memory/preferences.md`.
69
- 2. Generate a two-word name: "FirstName LastName" — both words start with the SAME letter
70
- (alliteration); the first name is common in the user's language; the last name is a
71
- playful reference to the agent's function (from its `title:`). Each agent in the crew
72
- must use a DIFFERENT initial letter.
73
- 3. Update BOTH the `.agent.md` `name:` frontmatter AND the `# {Name}` heading in that file.
74
- 4. Use the new name as the `displayName` in the rebuilt CSV.
42
+ ## Step 3: One finding at a time
75
43
 
76
- Only do this for agents that are actually broken. Agents that already have a valid two-word
77
- `name:` are left untouched (only the CSV is rewritten to carry it).
44
+ Take the findings in the order the script printed them. For each: say what it is, ask the
45
+ question, wait for the answer, and only then run the command. Never group two findings in one
46
+ question. A "não" leaves the point as it is: go on to the next one.
78
47
 
79
- ## Step 5: Report
48
+ The script's output is for you. To the user, say each point in plain words: do not show the
49
+ codes between brackets, the `--aplicar` lines or the `CONSERTO:` status line.
80
50
 
81
- Present a summary table of what changed:
51
+ | Finding | What you say and ask | Command after the yes |
52
+ |---|---|---|
53
+ | `nome-de-agente` | The agent has no two-word persona name. Propose one by the Agent Naming Convention of `_opencrew/core/prompts/design.prompt.md` (two words with the same initial, a different initial for each agent of the crew), keeping the first name the agent already has, and ask: "O agente {id} está sem nome de pessoa. Proponho {Nome Sobrenome}. Posso gravar?" | `--aplicar "nome:{id}={Nome Sobrenome}"`; the names reach the list of the crew with `manifesto`, below — when `manifesto` is not among the findings, run it right after this one |
54
+ | `manifesto` | "O arquivo de nomes da crew está incompleto; por isso aparece a função no lugar do nome. Posso refazer a partir dos arquivos dos agentes?" | `--aplicar "manifesto"` |
55
+ | `formato` | Read each listed step and propose one format per step, among the files of `_opencrew/core/best-practices/` (and `_opencrew/best-practices.local/`). A text to print, sign or file — ata, ofício, contrato, minuta, proposta, parecer — gets `documento-oficial`. Then: "Estes passos não dizem que tipo de texto produzem; sem isso, o verificador mede cada um como post de blog. Minha proposta: {passo → formato}. Posso gravar assim?" | one `--aplicar "formato:{passo}={formato}"` per step |
56
+ | `fontes` | "Esta crew não registra os arquivos do projeto que ela deve ler antes de escrever. Quais arquivos ou pastas ela precisa conhecer? (Pode responder 'nenhum'.)" Confirm that each one exists (search the project when only a name was given) and ask what the crew uses it for | one `--aplicar "fonte:{caminho}={para que}"` per file or folder, the path relative to the project root |
57
+ | `proibicao` | For each listed item: "Esta proibição não tem um trecho entre aspas, então o verificador não consegue barrar: «{item}». Qual trecho exato devo barrar? Se for uma regra de conteúdo, e não uma palavra ou expressão, responda 'revisão humana': ela fica para o revisor." The excerpt must be words of the item itself | `--aplicar "proibicao:{n}={trecho}"` or `--aplicar "proibicao:{n}=revisao-humana"` |
58
+ | `irreversivel` | For each listed step: "O passo {n} é feito por um agente que tem uma ferramenta de publicar ou enviar ({skill}). Este passo publica ou envia alguma coisa para fora do projeto? Se sim, marco o passo para que ele nunca seja repetido sozinho." | `--aplicar "irreversivel:{n}"` only for a yes |
59
+ | `sem-revisao` | "Esta crew não tem passo de revisão: nada é conferido antes de chegar a você. Isso se resolve editando a crew: /opencrew edit {nome}." | none |
60
+ | `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
+ | `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
+ | `passo-faltando` | Show the lines the script printed and say that it is solved by editing the crew: `/opencrew edit {nome}` | none |
82
63
 
64
+ The command is always the same line, with the item between double quotes:
65
+
66
+ ```
67
+ node _opencrew/core/scripts/conserto.mjs --crew "crews/{code}" --aplicar "{item}"
83
68
  ```
84
- Crew "{name}" repaired.
85
69
 
86
- | Agent id | Before | After | Source |
87
- |-------------|---------------|------------------|---------------|
88
- | researcher | (role only) | 🔎 Pedro Pesquisa | .agent.md |
89
- | copywriter | Guilherme | ✍️ Guilherme Gancho | generated |
70
+ Several items of the same finding may go in one call (`--aplicar "…" --aplicar "…"`). The last
71
+ line must be `CONSERTO:APLICADO`. With `CONSERTO:ERRO` nothing was written: read the reason to the
72
+ user, correct the item and ask again — do not write the file yourself.
90
73
 
91
- crew-party.csv: rewritten with displayName column
74
+ ## Step 4: Project paths
92
75
 
93
- Run it: /opencrew run {code}
76
+ After the findings, run the sources check:
77
+
78
+ ```
79
+ node _opencrew/core/scripts/conferir-fontes.mjs --crew "crews/{code}"
94
80
  ```
95
81
 
96
- The Escritório (the optional live view) takes the names from the CSV when the next run starts:
97
- there is nothing else to refresh.
82
+ When it lists a path with a suggestion (`Sugestão: …` — an absolute path left in a step, or a
83
+ file that moved), show the user each path and its suggestion and ask: "Posso corrigir estes
84
+ caminhos nos arquivos da crew?" After a yes, run the same command ending with `--corrigir`: the
85
+ script rewrites only those paths and keeps a copy of each file it changes. A missing file with
86
+ no suggestion is the user's to solve: say which one.
87
+
88
+ ## Step 5: Report
89
+
90
+ Run the diagnosis of Step 2 once more and close with what really happened:
98
91
 
99
- If nothing was broken (CSV already had a valid `displayName` for every agent), say so
100
- plainly instead of inventing changes: "This crew's manifest is already correct — no repair
101
- needed."
92
+ "Pronto: {k} conserto(s) gravado(s). Cópias do que mudou: {lista de .bak}. Ficou pendente:
93
+ {lista ou 'nada'}." — `{k}` is the number of points the user said yes to and the script wrote.
102
94
 
103
- ---
95
+ Then: `Run it: /opencrew run {code}`.
104
96
 
105
97
  ## Rules
106
98
 
107
- - **DO** pull names from `.agent.md` `name:` — that is the source of truth.
108
- - **DO** rewrite the whole `crew-party.csv` with the canonical header.
109
- - **DO** limit persona generation to agents whose own `.agent.md` name is missing/one-word.
110
- - **DO NOT** re-run Discovery, Design, Build, research, or investigations.
111
- - **DO NOT** modify agent personas, principles, or any section other than the `name:` line
112
- and `# {Name}` heading (and only in the fallback case).
113
- - **DO NOT** touch any file outside `crews/{code}/`.
114
- - **DO NOT** fabricate a summary — report only what you actually changed.
99
+ - **DO** run the diagnosis before and after; report only what the script printed.
100
+ - **DO** ask before every `--aplicar`, one finding at a time.
101
+ - **DO NOT** create, edit or delete any file under `crews/` with your own tools — not even to
102
+ "finish" a repair the script refused.
103
+ - **DO NOT** reorder, renumber, add or remove steps here: that is `/opencrew edit`.
104
+ - **DO NOT** touch `_opencrew/` or any other crew.
105
+ - **DO NOT** delete the `.bak` copies: they belong to the user.
@@ -114,7 +114,7 @@ Before starting execution:
114
114
  briefing, the research or your own assumptions, the sources take precedence over them
115
115
  (as fontes valem sobre o briefing e a pesquisa) — and say so when it matters.
116
116
 
117
- 2. Read `crews/{name}/pipeline/pipeline.yaml` for the pipeline definition
117
+ 2. Read `crews/{name}/pipeline/pipeline.yaml` for the pipeline definition. The format of the crew files — where each field lives and the older shapes that still count — is in `_opencrew/core/formato-da-crew.md`; read it when a field is not where you expect.
118
118
  3. **Resolve skills**: Read `crew.yaml` → `skills` section. For each non-native skill (anything other than web_search, web_fetch):
119
119
  a. Verify `skills/{skill}/SKILL.md` exists
120
120
  - If missing → ask user: "Skill '{skill}' is not installed. Install now? (y/n)"
@@ -124,13 +124,9 @@ Before starting execution:
124
124
  c. If type: mcp, verify MCP is configured in `.claude/settings.local.json`
125
125
  - If missing → **ERROR**: "Skill '{skill}' MCP not configured. Reinstall the skill."
126
126
  All skills must resolve successfully before the pipeline starts (fail fast).
127
- 4. **Model tiers**: Individual steps declare their own `model_tier` in their frontmatter (`fast` or `powerful`), set by the Architect at crew creation time based on the crew's tier (Express/Standard/Full).
128
- - Read `crew.yaml` → `crew.tier` field to understand the crew's depth level:
129
- - `express`: all steps use `model_tier: fast` by default
130
- - `standard`: mixed — research/data steps use `fast`, creative/review steps use `powerful`
131
- - `full`: all steps use `model_tier: powerful` by default
132
- - If a step has its own `model_tier` in frontmatter → step-level override takes priority over crew-level default.
133
- - If neither crew tier nor step model_tier is set → default to `powerful` at dispatch.
127
+ 4. **Model tiers**: a `subagent` step declares its own `model_tier` (`fast` or `powerful`), set at crew creation by the crew's tier; inline steps carry none.
128
+ - Read the crew's tier for the run header: `crew.tier` in `crew.yaml` (older crews: `tier` loose at the top level).
129
+ - A subagent step with no `model_tier` → `powerful` at dispatch.
134
130
 
135
131
  4b. **Pre-Execution Agent Selection** — Decide which agents actually run for this task.
136
132
  Run this step ONLY if `crew.yaml` declares an `agent_dependencies:` field (even an
@@ -563,7 +559,7 @@ root the one-line command of each moment and read the last line (`CAMINHO:OK {pa
563
559
  Atualizo o perfil da empresa?" — change `company.md` only after a yes.
564
560
  - **If the step frontmatter contains `outputFile`**: after collecting the user's full response,
565
561
  insert only the run_id in the `outputFile` path (item 1 of the rule in Output Path Transformation — no version folder, no `saida` command), then write the response to that path using the Write tool (it creates the folder) before moving to the next step. Checkpoint files are user input captures, not versioned output: they live in the group itself, where `entrada` finds them.
566
- Use this format:
562
+ For the checkpoint that precedes the researcher, use this format:
567
563
  ```
568
564
  # Research Focus
569
565
 
@@ -571,7 +567,8 @@ root the one-line command of each moment and read the last line (`CAMINHO:OK {pa
571
567
  **Time Range:** {selected time range label, e.g., "Últimos 7 dias"}
572
568
  **Date:** {today's date in YYYY-MM-DD format}
573
569
  ```
574
- This file is the `inputFile` for the researcher step that follows.
570
+ For any other checkpoint: `# {the checkpoint's title}`, the user's answer as given (the option chosen and every comment), and `**Date:** {today, YYYY-MM-DD}`.
571
+ This file is the `inputFile` of the step that follows.
575
572
 
576
573
  ### Post-Step Output Validation
577
574
 
@@ -681,8 +678,8 @@ When a step has `on_reject: {step-id}` (a review step):
681
678
  (real data only the user has): do NOT reject for them — the reviewer judges the rest, and the
682
679
  final approval below collects the missing data from the user.
683
680
  3. Track the review cycle count: a **cycle** is one pass of the reviewer. The maximum is
684
- `max_review_cycles`, an integer from 1 declared where the step declares `on_reject` (the step
685
- frontmatter or its `pipeline.yaml` entry); absent or invalid: 3. On every rejection, with or
681
+ `max_review_cycles`, an integer from 1: the one declared where the step declares `on_reject` (the
682
+ step frontmatter or its `pipeline.yaml` entry); without it, the one in `crew.yaml`; absent or invalid in both: 3. On every rejection, with or
686
683
  without a block, send the reviewer's feedback to the writer and go back to the referenced step.
687
684
  4. If the last allowed pass also rejects, stop; the status of the last report picks the message, as
688
685
  in item 2 — `VERIFICACAO:BLOQUEADA`: the blocks; any other status: the reviewer's feedback, also