@aksp/opencrew 1.10.0 → 1.12.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 (40) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +15 -4
  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 +16 -9
  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/texto-livre.md +23 -0
  12. package/templates/_opencrew/core/formato-da-crew.md +162 -0
  13. package/templates/_opencrew/core/prompts/build.prompt.md +35 -59
  14. package/templates/_opencrew/core/prompts/design.prompt.md +16 -16
  15. package/templates/_opencrew/core/prompts/discovery.prompt.md +28 -8
  16. package/templates/_opencrew/core/prompts/documento.prompt.md +9 -5
  17. package/templates/_opencrew/core/prompts/entrega.prompt.md +7 -2
  18. package/templates/_opencrew/core/prompts/repair.prompt.md +75 -84
  19. package/templates/_opencrew/core/runner.pipeline.md +25 -28
  20. package/templates/_opencrew/core/scripts/caminho/argumentos.mjs +3 -1
  21. package/templates/_opencrew/core/scripts/caminho/nucleo.mjs +16 -0
  22. package/templates/_opencrew/core/scripts/caminho.mjs +11 -8
  23. package/templates/_opencrew/core/scripts/conferir-fontes/relatorio.mjs +4 -2
  24. package/templates/_opencrew/core/scripts/conferir-fontes.mjs +22 -16
  25. package/templates/_opencrew/core/scripts/conserto/achados.mjs +158 -0
  26. package/templates/_opencrew/core/scripts/conserto/aplicar.mjs +156 -0
  27. package/templates/_opencrew/core/scripts/conserto/argumentos.mjs +51 -0
  28. package/templates/_opencrew/core/scripts/conserto/crew.mjs +126 -0
  29. package/templates/_opencrew/core/scripts/conserto/edicoes.mjs +133 -0
  30. package/templates/_opencrew/core/scripts/conserto/gravar.mjs +55 -0
  31. package/templates/_opencrew/core/scripts/conserto.mjs +82 -0
  32. package/templates/_opencrew/core/scripts/documento/markdown.mjs +2 -1
  33. package/templates/_opencrew/core/scripts/documento/pacote.mjs +1 -0
  34. package/templates/_opencrew/core/scripts/documento/perfil.mjs +14 -0
  35. package/templates/_opencrew/core/scripts/entrega/pendencias.mjs +4 -1
  36. package/templates/_opencrew/core/scripts/entrega/separar.mjs +2 -1
  37. package/templates/_opencrew/core/scripts/verificar/documento.mjs +20 -0
  38. package/templates/_opencrew/core/scripts/verificar/medicao.mjs +2 -1
  39. package/templates/_opencrew/core/scripts/verificar/proibicoes.mjs +30 -5
  40. package/templates/_opencrew/core/scripts/verificar.mjs +3 -1
@@ -70,52 +70,24 @@ Generate these files. Use the Write tool for all file creation — never use Bas
70
70
 
71
71
  ### Files to generate:
72
72
 
73
- 1. **`crews/{code}/crew.yaml`** — Crew definition with pipeline
74
- - Include a `skills:` section listing all skills:
75
- ```yaml
76
- skills:
77
- - web_search
78
- - web_fetch
79
- # Add any skills from design.yaml:
80
- # - apify
81
- # - canva
82
- ```
83
- - Include a `data:` section listing all reference materials:
84
- ```yaml
85
- data:
86
- - pipeline/data/research-brief.md
87
- - pipeline/data/domain-framework.md
88
- - pipeline/data/quality-criteria.md
89
- - pipeline/data/output-examples.md
90
- - pipeline/data/anti-patterns.md
91
- - pipeline/data/tone-of-voice.md # for content crews
92
- ```
93
- - Include a `fontes:` section with the project sources from `discovery.yaml →
94
- project_sources` (omit it only if that list is empty). The Pipeline Runner reads them at the
95
- start of every run and checks they still exist:
96
- ```yaml
97
- fontes:
98
- - caminho: Memoria/01_Decisoes.md # relative to the project root
99
- para_que: decisões de público e posicionamento
100
- ```
73
+ **Read `_opencrew/core/formato-da-crew.md` before writing any file.** It is the single definition
74
+ of `crew.yaml`, `pipeline.yaml`, the step frontmatter and the agent id, with a complete example of
75
+ each. Write every file in that format; what follows here only adds what is specific to the Build.
76
+
77
+ 1. **`crews/{code}/crew.yaml`** — the crew: the `crew:` block (`code`, `name`, `description`,
78
+ `icon` and `tier`, all from `design.yaml`), `pipeline:`, `skills:`, `data:`, `fontes:`,
79
+ `agent_dependencies:` (only when the format file says so) and `max_review_cycles:`.
80
+ - `skills:` lists every skill from `design.yaml`; `data:` lists every reference material you
81
+ wrote in `pipeline/data/`.
82
+ - `fontes:` carries the project sources from `discovery.yaml → project_sources` (`path` →
83
+ `caminho`, `purpose` → `para_que`); omit it only if that list is empty. The Pipeline Runner
84
+ reads them at the start of every run and checks they still exist.
101
85
  - **Paths to the user's project files** — in `crew.yaml`, step files and tasks — are always
102
- written as a caminho relativo à raiz do projeto (relative to the project root), between
103
- backticks, e.g. `` `Ativos/Identidade Visual/logo.png` ``. NEVER write absolute paths
86
+ written as a caminho relativo à raiz do projeto (relative to the project root); in the
87
+ prose of step files and tasks, between backticks, e.g. `` `Ativos/Identidade Visual/logo.png` ``. NEVER write absolute paths
104
88
  (`C:/…`, `J:/…`, `/Users/…`): they break as soon as the user moves or syncs the folder.
105
- - Include an `agent_dependencies:` section (OPTIONAL — enables runtime
106
- Pre-Execution Agent Selection):
107
- ```yaml
108
- agent_dependencies: # OPTIONAL — enables Pre-Execution Agent Selection at runtime
109
- copywriter: [researcher] # copywriter consumes researcher's output
110
- designer: [copywriter] # designer consumes copywriter's output
111
- reviewer: [copywriter] # reviewer consumes copywriter's output
112
- ```
113
- - `agent_dependencies` is OPTIONAL. ALWAYS emit it for crews that should show the
114
- runtime agent-selection step — even as an empty map `agent_dependencies: {}` (the
115
- selection step triggers on field presence, so an empty map enables selection with
116
- no dependency warnings). Derive entries from the pipeline step order: for each
117
- agent step, list the agent(s) whose output it reads via `inputFile`. Omit the field
118
- entirely to keep the legacy behavior (run all agents, no selection step).
89
+ - `agent_dependencies:` — derive the entries from the step order: for each agent step, list
90
+ the agent(s) whose output it reads, via `inputFile` or in its "Context Loading" list.
119
91
 
120
92
  2. **`crews/{code}/crew-party.csv`** — Agent manifest
121
93
  - The header row MUST be EXACTLY these columns, in this order:
@@ -134,7 +106,7 @@ Generate these files. Use the Write tool for all file creation — never use Bas
134
106
  render the agent's name in "🤖 {name} is working…" announcements, and the Escritório
135
107
  (the optional live view) shows the same column. If `displayName` is missing, empty, or set
136
108
  to the role/title instead of the persona name, the crew renders with functions but no names.
137
- - `id` = the `path` basename with `./agents/` and `.agent.md` stripped
109
+ - `id` = the agent id: the agent file name without `.agent.md`
138
110
  (e.g. `./agents/researcher.agent.md` → `researcher`).
139
111
  - `title` = the agent's `title:` frontmatter (the role/function label). This is a
140
112
  SEPARATE column from `displayName` — never merge or swap them.
@@ -145,7 +117,8 @@ Generate these files. Use the Write tool for all file creation — never use Bas
145
117
  - For ALL agents that include `tasks:` in their frontmatter, ALSO generate the task files:
146
118
  `crews/{code}/agents/{agent-id}/tasks/{task}.md` — one per entry in the `tasks:` list
147
119
 
148
- 4. **`crews/{code}/pipeline/pipeline.yaml`** — Pipeline entry point
120
+ 4. **`crews/{code}/pipeline/pipeline.yaml`** — the order of the steps: one `step` + `file` entry
121
+ per step file, as in the format file
149
122
 
150
123
  5. **Step files** — `crews/{code}/pipeline/steps/step-NN-{name}.md` — one per pipeline step
151
124
 
@@ -185,7 +158,7 @@ Every agent file MUST contain ALL of the following sections. Target 120-200 line
185
158
 
186
159
  ```markdown
187
160
  ---
188
- id: "crews/{code}/agents/{agent}"
161
+ id: "{agent-id}" # the file name without `.agent.md`
189
162
  name: "{Agent Name}"
190
163
  title: "{Agent Title}"
191
164
  icon: "{emoji}"
@@ -392,10 +365,10 @@ Every step file begins with YAML frontmatter followed by the markdown body. The
392
365
  ```yaml
393
366
  ---
394
367
  execution: subagent # subagent = runs in background via Task tool; inline = runs in the main conversation
395
- agent: {agent-id} # the agent's id (matches the id field in their .agent.md frontmatter)
396
- format: {format-id} # OPTIONAL — e.g., "instagram-feed". Pipeline Runner auto-injects from _opencrew/core/best-practices/
397
- # Use for content creation steps where platform-specific rules should guide the agent
398
- # Omit for non-content steps (research, analysis, review without platform context)
368
+ agent: {agent-id} # the agent id: the agent file name without `.agent.md`
369
+ format: {format-id} # e.g., "instagram-feed". Pipeline Runner auto-injects from _opencrew/core/best-practices/
370
+ # REQUIRED on every step whose text the checker measures (from the `on_reject` step up to the review)
371
+ # Omit for non-content steps (research, analysis, the review itself)
399
372
  inputFile: crews/{code}/output/{filename}.{ext} # path to input file from previous step — MUST use output/ prefix
400
373
  outputFile: crews/{code}/output/{filename}.{ext} # path where this step saves its output — MUST use output/ prefix
401
374
  # NEVER use pipeline/data/ for outputFile — that folder is for static
@@ -410,8 +383,9 @@ side_effects: irreversible # REQUIRED for any step that publishes, posts, sends
410
383
  # distributes outside the project (it cannot be undone). The Pipeline
411
384
  # Runner never retries these automatically, and Gate 2c places them last.
412
385
  # Omit for every other step.
413
- max_review_cycles: {N} # ONLY for the review step: write it next to its `on_reject`.
414
- # By crew tier (`crew.tier` in design.yaml): Express 1, Standard 2, Full 3.
386
+ on_reject: {N} # ONLY for the review step: the number of the step the pipeline goes back to
387
+ # (the first writing step). `max_review_cycles` goes in `crew.yaml`, by crew
388
+ # tier (`crew.tier` in design.yaml): Express 1, Standard 2, Full 3.
415
389
  ---
416
390
  ```
417
391
 
@@ -428,7 +402,8 @@ agent: {agent-id} # OPTIONAL — ties this checkpoint to an agent; if that age
428
402
  ---
429
403
  ```
430
404
 
431
- For **research focus checkpoints** (where the user's response is saved to a file), use extended frontmatter with `outputFile`:
405
+ For a **checkpoint whose answer the next step needs** (the research focus, the chosen angle, the
406
+ request to be worked on), use extended frontmatter with `outputFile`:
432
407
  ```yaml
433
408
  ---
434
409
  type: checkpoint
@@ -437,7 +412,7 @@ agent: {agent-id} # OPTIONAL — same semantics as above
437
412
  ---
438
413
  ```
439
414
  The Pipeline Runner writes the user's response to this file before proceeding.
440
- The next step (researcher) reads it as `inputFile: crews/{code}/output/research-focus.md`.
415
+ The next step reads it as `inputFile: crews/{code}/output/research-focus.md`.
441
416
  Using `output/` ensures the path transformation applies and the file lands in the run_id folder.
442
417
 
443
418
  Every pipeline step file MUST contain ALL of the following sections. Target 60-120 lines per step.
@@ -475,7 +450,7 @@ that the agent knows exactly what to produce.]
475
450
 
476
451
  [A COMPLETE, realistic example of what this step should produce.
477
452
  This is not a template — it's a fully realized output with realistic content.
478
- Must be 20+ lines and demonstrate the expected quality, depth, and formatting.
453
+ Must be 15+ lines and demonstrate the expected quality, depth, and formatting.
479
454
  The agent uses this as a reference for what "good" looks like.]
480
455
 
481
456
  ## Veto Conditions
@@ -593,7 +568,7 @@ For EACH agent step in the pipeline that produces visuals, renders images, or pu
593
568
  If ANY check fails:
594
569
  1. Insert a new `type: checkpoint` step immediately before the offending agent step
595
570
  2. Renumber all subsequent steps (e.g. step-05 becomes step-06, etc.)
596
- 3. Add the new step to the `checkpoints:` list in pipeline.yaml
571
+ 3. Add the new step to `pipeline.yaml`
597
572
  4. Generate a step file for the new checkpoint that asks the user to review and approve the preceding agent's output before the visual/publish step runs
598
573
  5. Re-validate Gate 2b. Max 2 fix attempts — after that, present to user for manual decision.
599
574
 
@@ -602,7 +577,8 @@ If ANY check fails:
602
577
  For EACH step that publishes, posts, sends email or distributes outside the project:
603
578
  - [ ] Its frontmatter declares `side_effects: irreversible` and `execution: inline`
604
579
  - [ ] It comes AFTER the Review step (the reviewer has already approved the final content)
605
- - [ ] The IMMEDIATELY preceding step is a `type: checkpoint` (Final Approval) that itself comes after the Review
580
+ - [ ] The IMMEDIATELY preceding step is a `type: checkpoint` (Final Approval) that itself comes
581
+ after the Review, or another irreversible step (two in a row share the same Final Approval)
606
582
  - [ ] Only other irreversible steps follow it (nothing is created, rendered or reviewed after publishing)
607
583
 
608
584
  If ANY check fails:
@@ -631,7 +607,7 @@ Additional programmatic checks — read the filesystem to verify:
631
607
  - [ ] Every `agent_dependencies` key and value references a real agent `id` from crew-party.csv
632
608
  - [ ] All task files referenced in agent frontmatter exist
633
609
  - [ ] All step files referenced in `pipeline.yaml` exist
634
- - [ ] Skills listed in `crew.yaml` are installed in `skills/`
610
+ - [ ] Skills listed in `crew.yaml` are installed in `skills/` (the native ones, `web_search` and `web_fetch`, need no folder)
635
611
  - [ ] Best-practices files referenced by `format:` fields in steps exist in `_opencrew/core/best-practices/`
636
612
 
637
613
  ---
@@ -81,7 +81,7 @@ Compile all research into a structured research brief document. This will feed P
81
81
 
82
82
  After research completes, determine the crew's tier:
83
83
 
84
- 1. If a template was used (check `discovery.yaml` → `tier` field is present and not null) → use the template's tier.
84
+ 1. If a template was used (`discovery.yaml` has the `template:` field, which the Discovery writes only in that case) → use the `tier` recorded there.
85
85
  2. Otherwise, read the default tier from `_opencrew/_memory/preferences.md` → `Default Tier` field.
86
86
  3. If neither is set, default to `standard`.
87
87
 
@@ -107,10 +107,10 @@ Present the three tiers with concrete trade-offs:
107
107
  | Aspect | ⚡ Express | 🎯 Standard | 🔬 Full |
108
108
  |--------|-----------|-------------|---------|
109
109
  | Agent count | 2-3 | 3-5 | 5-7 |
110
- | Reviewer | Writer self-reviews | 1 dedicated reviewer | Reviewer + cross-review |
110
+ | Reviewer | The writer does the review step (no reviewer agent) | 1 dedicated reviewer | Reviewer + cross-review |
111
111
  | Sherlock | Never | Only if user provided URLs | Always (social + web + trends) |
112
112
  | Checkpoints | Final approval only | Research focus + content approval + final | All checkpoints + angle selection |
113
- | model_tier per step | All `fast` | Mix (research=fast, create=powerful) | All `powerful` |
113
+ | model_tier (subagent steps only) | `fast` | Mix (research=fast, create=powerful) | `powerful` |
114
114
  | Cross-review | None | None | Reviewer + second reviewer cross-check |
115
115
  | On-reject loops | 1 max | 2 max | 3 max |
116
116
 
@@ -182,7 +182,7 @@ From the crew's purpose and domains (in `discovery.yaml`), identify what human r
182
182
  | Domain / Need | Possible Roles |
183
183
  |---|---|
184
184
  | Research, fact-finding, market analysis | 🔎 Pesquisador — finds trends, maps keywords, does market research |
185
- | Writing, copy, content creation | ✍️ Redator — writes strategic text based on research, including captions and hooks |
185
+ | Writing, copy, content creation, documents | ✍️ Redator — writes strategic text based on research, including captions and hooks; in a document crew, writes the minutes, the letter, the contract or the proposal |
186
186
  | Strategy, positioning, planning | 🧠 Estrategista — defines angles, editorial calendar, competitive positioning |
187
187
  | Visual design, image creation | 🎨 Designer — creates visual content aligned with brand identity |
188
188
  | Quality review, accuracy check | 🔍 Revisor — validates quality, tone, accuracy against criteria |
@@ -219,7 +219,7 @@ Para {crew purpose}, sugiro este time:
219
219
  - Simple crews (1 format, 1 platform): 2-3 roles
220
220
  - Medium crews (content + review): 3-4 roles
221
221
  - Complex crews (multi-platform, multi-format): 4-6 roles
222
- - **Every crew needs a reviewer** — mandatory quality gate
222
+ - **Every crew needs a review step** — mandatory quality gate (Express: done by the writer; Standard and Full: by a reviewer role)
223
223
  - **Allow editing** — after presenting roles, ask:
224
224
  > "Quer adicionar, remover ou modificar algum papel? Ou o time está bom?"
225
225
 
@@ -229,7 +229,7 @@ Never suggest fewer than 2 roles. The minimum viable crew has:
229
229
  - One creator/executor (the person who produces the output)
230
230
  - One reviewer (the person who checks quality before delivery)
231
231
 
232
- For very simple tasks, these two roles can be the same person with a self-review step — but the user must explicitly approve this simplification.
232
+ In the Express tier these two roles are the same agent: the writer also does the review step. The step still exists (with `on_reject`), so the automatic checker runs before it.
233
233
 
234
234
  ---
235
235
 
@@ -244,7 +244,7 @@ For each approved role, consult this mapping to determine which skills and best-
244
244
  | Role | Typical Skills | Typical Best-Practices |
245
245
  |------|---------------|----------------------|
246
246
  | Pesquisador (Researcher) | `web_search`, `web_fetch` (native) | `researching.md` |
247
- | Redator (Writer/Copywriter) | `web_search` (native, for fact-checking) | `copywriting.md` + platform-specific format file |
247
+ | Redator (Writer/Copywriter) | `web_search` (native, for fact-checking) | `copywriting.md` + platform-specific format file; for a text to print, sign or file: `documento-oficial.md`; for a text with no channel and no Word file (proposal, draft that becomes HTML or PDF, plan): `texto-livre.md` |
248
248
  | Estrategista (Strategist) | `web_search` (native) | `strategist.md` |
249
249
  | Designer (Visual Designer) | `image-creator`, `image-ai-generator`, `canva` | `image-design.md` |
250
250
  | Revisor (Reviewer) | None required | `review.md` |
@@ -342,7 +342,7 @@ Based on discovery answers + company context + research findings + extracted art
342
342
 
343
343
  Before designing any agent from scratch, check the shared registry at `_opencrew/agents/`:
344
344
 
345
- 1. List available base agents: `ls _opencrew/agents/` — each `.agent.md` file is a reusable base agent
345
+ 1. List the files of `_opencrew/agents/` (with your folder-listing tool, no command) — each `.agent.md` file is a reusable base agent
346
346
  2. For each role approved in Phase D, check if a matching base agent exists:
347
347
  - Pesquisador → `_opencrew/agents/researcher.agent.md`
348
348
  - Redator → `_opencrew/agents/copywriter.agent.md`
@@ -365,7 +365,7 @@ execution: inline
365
365
  skills: []
366
366
  ---
367
367
  ```
368
- The Build phase copies the base agent from `_opencrew/agents/copywriter.agent.md` and the local file only needs to specify what's DIFFERENT — a different tone, specific output examples for this crew, or additional anti-patterns. The runner merges: base first, local overrides on top.
368
+ The Build phase copies the base agent from `_opencrew/agents/copywriter.agent.md` and the local file only needs to specify what's DIFFERENT — a different tone, specific output examples for this crew, or additional anti-patterns. The Build phase does the merge (base first, local overrides on top) and writes a complete file; the Pipeline Runner never merges.
369
369
 
370
370
  ### Design Philosophy
371
371
 
@@ -380,9 +380,9 @@ Guidelines:
380
380
 
381
381
  Design the crew with appropriate agents:
382
382
  - Follow the deep `.agent.md` format with full sections: Persona (Role, Identity, Communication Style), Principles, Operational Framework, Voice Guidance, Output Examples, Anti-Patterns, Quality Criteria, Integration
383
- - Design each agent from scratch, informed by the relevant best-practices files read in Phase A
383
+ - Use `extends:` when the Shared Agent Registry Check found a base agent that fits; design from scratch only the agents with no base, informed by the relevant best-practices files read in Phase A
384
384
  - Each agent has exactly one clear responsibility
385
- - Every crew needs a reviewer agent for quality control
385
+ - Every crew needs a review step for quality control (a reviewer agent in Standard and Full)
386
386
  - YAGNI — never create agents that aren't strictly necessary
387
387
 
388
388
  ### Agent Naming Convention (MANDATORY — never skip)
@@ -428,8 +428,7 @@ The name should make someone smile — it's a pun tying a common name to the pro
428
428
 
429
429
  ### Agent Composition Rules
430
430
 
431
- - One clear responsibility per agent; reviewer agent mandatory; YAGNI strictly applied
432
- - Research/data steps → `execution: subagent`; creative/writing steps → `execution: inline`
431
+ - One clear responsibility per agent; review step mandatory (reviewer agent in Standard and Full); YAGNI strictly applied
433
432
  - Content crews must include `pipeline/data/tone-of-voice.md` and instruct the writer to ask tone before producing
434
433
  - Every agent uses `.agent.md` format with all sections: Persona, Principles, Operational Framework, Voice Guidance, Output Examples, Anti-Patterns, Quality Criteria, Integration
435
434
 
@@ -441,9 +440,9 @@ The name should make someone smile — it's a pun tying a common name to the pro
441
440
 
442
441
  - **Research/data-gathering steps** → `execution: subagent` (runs in background via Task tool)
443
442
  - **Creative/writing steps** → `execution: inline` (runs in the main conversation)
444
- - Always include reviewer agent before final output
445
443
  - Add checkpoints at every user decision point
446
- - Include `on_reject` loops from reviewer back to writer
444
+ - The files the Build phase will write follow `_opencrew/core/formato-da-crew.md` (fields of `crew.yaml`, of `pipeline.yaml` and of each step): design nothing that format cannot hold
445
+ - Always include a review step before final output (see the tier table for who does it), with `on_reject`: the number of the first writing step
447
446
  - A step whose result is a document to print, sign or file (minutes, official letter, statement, contract, formal report) gets `format: documento-oficial`, in any kind of crew: the writer follows that guide, and the text becomes a Word document in the delivery of the run (or with `/opencrew documento <arquivo>`)
448
447
 
449
448
  ### Research Focus Checkpoint (MANDATORY for crews with a researcher)
@@ -603,6 +602,7 @@ crew:
603
602
  code: "{code}"
604
603
  name: "{Crew Name}"
605
604
  description: "{one-line description}"
605
+ icon: "{emoji}"
606
606
  tier: "express" | "standard" | "full"
607
607
 
608
608
  agents:
@@ -656,7 +656,7 @@ pipeline:
656
656
  - step: 2
657
657
  name: "checkpoint-name"
658
658
  type: "checkpoint"
659
- output_file: "{path}" # optional, for research focus checkpoints
659
+ output_file: "{path}" # optional, when the next step needs the user's answer
660
660
 
661
661
  investigation: # only if investigation ran
662
662
  enriched: true
@@ -7,7 +7,7 @@ You are a strategic systems thinker and patient crew architect. You help users a
7
7
  ## Communication Style
8
8
 
9
9
  - One question at a time — never present two questions in the same message
10
- - Use numbered lists whenever options are available; tell the user to reply with a number
10
+ - Use numbered lists whenever options are available (the user knows what to do: never add "reply with a number")
11
11
  - Adapt follow-up questions based on what the user says, not a fixed script
12
12
  - Confirm understanding before moving to the next topic
13
13
  - Maximum 8 questions total across the entire discovery flow
@@ -70,7 +70,7 @@ If exactly 1 template exists, still offer option 1 ("Começar do zero") as a sec
70
70
  Ask:
71
71
  > "What do you want this crew to do? Describe the end result you want."
72
72
 
73
- This is always the first question. Accept any answer — a sentence, a paragraph, bullet points. Do NOT assume any domain. Do NOT suggest options at this stage.
73
+ This is always the first question — except when the command already carried the description (`/opencrew create <description>`): then do not ask it again; repeat the description in one sentence and ask only "É isso? Quer acrescentar alguma coisa?". Accept any answer — a sentence, a paragraph, bullet points. Do NOT assume any domain. Do NOT suggest options at this stage.
74
74
 
75
75
  ---
76
76
 
@@ -80,25 +80,35 @@ 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
  ---
92
95
 
93
96
  ### Step 3 — Context Exploration (adaptive, ONE question at a time)
94
97
 
95
- Based on the detected domain, ask the most relevant contextual question first. Wait for the answer before asking the next one. Ask at most 2–3 questions in this step.
98
+ Based on the detected domain, ask the most relevant contextual question first. Wait for the answer before asking the next one. Ask at most 3 questions in this step, not counting the project sources question below, which is always asked.
96
99
 
97
100
  **If domain = `content`:**
98
101
  1. Who is this content for? (multiple choice: current customers / potential leads / general audience / other)
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. Must the text become a Word file, to print, sign or file? (yes / no — "no" is the proposal or the draft that is read in the chat and laid out by hand later: nothing is converted. Only on a "yes", ask in the same message whether the organization has letterhead — logo, header lines, footer; the letterhead itself is set up later, the first time a Word document is generated)
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 text must become a Word file (question 3 of Step 3), or `["texto-livre"]` when it must not. 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,8 @@ 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}"
271
+ template: "{template folder name}" # ONLY when a template was chosen in Step 0; omit the line otherwise
258
272
  # When a template was used (Step 0), these fields are populated from discovery.template.yaml:
259
273
  domains: [] # list of domain tags from template (e.g., [content-marketing, seo])
260
274
  tier: "standard" # from template or preferences Default Tier
@@ -272,6 +286,12 @@ company:
272
286
  language: "{user's preferred language}"
273
287
 
274
288
  context:
289
+ # For document crews:
290
+ documents: "{answer from Step 3}"
291
+ signer: "{who signs}"
292
+ recipients: "{who receives}"
293
+ word_file: "{yes | no}"
294
+ letterhead: "{yes | no | not sure — only when word_file is yes}"
275
295
  # For content crews:
276
296
  audience: "{answer from Step 3}"
277
297
  platforms: "{answer from Step 3}"
@@ -299,7 +319,7 @@ investigation:
299
319
  platform: "{instagram | youtube | twitter | linkedin}"
300
320
  investigation_mode: "{single_post | profile_1 | profile_3}"
301
321
 
302
- target_formats: # content crews only; empty list for others
322
+ target_formats: # content and document crews; empty list for others
303
323
  - "{format-id}"
304
324
  ```
305
325
 
@@ -317,7 +337,7 @@ The `crew_code` must be a short, URL-safe slug derived from the crew's purpose (
317
337
  - **NEVER ask more than 8 questions total** — respect the user's time
318
338
  - **NEVER ask about tools** — auto-detect from installed skills and include in the summary
319
339
  - **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
340
+ - **Investigation is offered to every domain except `document`** — Step 5 presents the option; a document crew skips it
321
341
  - **Target formats are content-only** — Step 6 is skipped entirely for non-content crews
322
342
  - **One question at a time** — never combine two questions in one message, even if they feel related
323
343
  - **Domain detection is silent** — do not announce "I detected your domain is X"; just use the classification internally
@@ -37,10 +37,12 @@ Este projeto ainda não tem papel timbrado configurado. Quer configurar agora (l
37
37
  1. Run, from the project root: `node _opencrew/core/scripts/documento.mjs --criar-perfil`
38
38
  Its last line is `PERFIL:CRIADO` (the file was created from the model) or `PERFIL:JA-EXISTE`
39
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.
40
+ 2. Ask the user three questions, one at a time, with these words (the logo is a PNG file of up
41
+ to 2 MB inside the project, given by its path from the root):
42
+ - "Qual é o arquivo do logotipo? (PNG, dentro do projeto. Pode responder 'sem logotipo'.)"
43
+ - "Quais são as linhas do cabeçalho? Até três: nome da entidade, CNPJ ou registro, endereço."
44
+ - "Quer um texto no rodapé, além de 'Página X de Y'?"
45
+ Any of them may stay empty: what is empty does not appear in the document.
44
46
  3. Fill the file `_opencrew/_memory/documento-oficial.md` with the answers: write only the value
45
47
  after the colon of `logotipo`, `cabecalho_1`, `cabecalho_2`, `cabecalho_3` and `rodape`, each
46
48
  exactly as the user gave it. Leave every other line as it is (comments, margins, font).
@@ -103,7 +105,9 @@ one message in PT-BR and stops, with nothing written). Show the message to the u
103
105
 
104
106
  - **The message points to something in the command you wrote** (an option, a path, more than one
105
107
  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
108
+ - **"Não encontrei {arquivo}." or "Só converto texto…"**: the file is not there, or it is not a
109
+ `.md` or `.txt`. Show the message and go back to the question of Step 1.
110
+ - **The message starts with "Perfil, linha {n}:"** (an unknown or misspelled key, a value out of range, a logo
107
111
  that is missing, is not a PNG or is over 2 MB): the document is not generated with a wrong
108
112
  letterhead. Show the message, ask the user for the right value of that line, write it in the
109
113
  profile and run again. Do not switch to `--sem-perfil` by yourself.
@@ -69,7 +69,8 @@ without the `ENTREGA:` line. Do not rewrite it and do not add files it does not
69
69
  the report of the check made at delivery time (it is not part of the delivery).
70
70
 
71
71
  - `ENTREGA:OK` → go on with the run (Step 5 first, when it applies). When the summary has a line
72
- `
72
+ that starts with "Sem papel timbrado:", the Word documents came out with no letterhead: say so
73
+ and offer to set it up (`/opencrew documento`); after the profile exists, deliver again.
73
74
  - `ENTREGA:COM_RESSALVA` → everything that was missing is a ressalva the user accepted: the
74
75
  `LEIA-ME.md` opens with it and the channel is "Pronto, com ressalva"; go on as with `ENTREGA:OK`.
75
76
  - `ENTREGA:INCOMPLETA` → a channel is not ready, the destination was refused or a file could not be
@@ -103,7 +104,11 @@ the report of the check made at delivery time (it is not part of the delivery).
103
104
  "Não consegui gravar …"): show the message as it came and ask for another folder (Step 5, with
104
105
  the new answer) or for a new attempt, which is the same command again. A file of the list that
105
106
  does not exist: ask for it, or take it out of the list.
106
- - **A Word document that was not generated** (the line `
107
+ - **A Word document that was not generated** (the line "Não consegui gerar o Word de
108
+ {arquivo}: …"): show the message as it came; this is never accepted with option 2. When the
109
+ reason starts with "Perfil, linha {n}:", the letterhead profile has a wrong line: ask the user
110
+ for the right value, write it in `_opencrew/_memory/documento-oficial.md` and run the same
111
+ command again.
107
112
  The first call never has `--aceitar-pendencias`. Outside option 2 it goes only when the user
108
113
  already chose "Aceitar assim mesmo" in the review loop of this run and what is missing is only
109
114
  what was accepted there: then run the command again with it, without asking.