@aksp/opencrew 1.2.2 → 1.3.1
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.
- package/CHANGELOG.md +139 -139
- package/README.md +150 -150
- package/package.json +63 -63
- package/src/cli.js +136 -136
- package/src/commands/init.js +125 -103
- package/src/commands/update.js +87 -77
- package/src/lib/fsx.js +127 -76
- package/templates/.mcp.json +9 -9
- package/templates/AGENTS.md +133 -133
- package/templates/_opencrew/.opencrew-version +1 -1
- package/templates/_opencrew/_memory/preferences.md +11 -10
- package/templates/_opencrew/agents/copywriter.agent.md +66 -0
- package/templates/_opencrew/agents/designer.agent.md +65 -0
- package/templates/_opencrew/agents/researcher.agent.md +95 -0
- package/templates/_opencrew/agents/reviewer.agent.md +76 -0
- package/templates/_opencrew/agents/strategist.agent.md +64 -0
- package/templates/_opencrew/core/architect.agent.yaml +2 -2
- package/templates/_opencrew/core/prompts/build.prompt.md +614 -586
- package/templates/_opencrew/core/prompts/design.prompt.md +255 -27
- package/templates/_opencrew/core/prompts/discovery.prompt.md +42 -1
- package/templates/_opencrew/core/prompts/export.prompt.md +133 -0
- package/templates/_opencrew/core/prompts/repair.prompt.md +119 -119
- package/templates/_opencrew/core/prompts/sherlock-seo.md +216 -0
- package/templates/_opencrew/core/prompts/sherlock-shared.md +73 -1
- package/templates/_opencrew/core/prompts/sherlock-trends.md +238 -0
- package/templates/_opencrew/core/prompts/sherlock-web.md +220 -0
- package/templates/_opencrew/core/runner.pipeline.md +729 -642
- package/templates/_opencrew/core/skills.engine.md +490 -429
- package/templates/crews/blog-semanal/discovery.template.yaml +35 -0
- package/templates/crews/instagram-carrossel/discovery.template.yaml +35 -0
- package/templates/crews/lancamento-produto/discovery.template.yaml +39 -0
- package/templates/crews/newsletter-mensal/discovery.template.yaml +29 -0
- package/templates/skills/README.md +22 -22
- package/templates/skills/catalog.json +61 -61
- package/templates/skills/instagram-publisher/SKILL.md +119 -119
|
@@ -28,12 +28,12 @@ If investigation ran (check discovery.yaml `investigation` field):
|
|
|
28
28
|
|
|
29
29
|
Read `_opencrew/core/best-practices/_catalog.yaml` to discover available best-practices files.
|
|
30
30
|
|
|
31
|
-
Based on the crew's purpose and the
|
|
31
|
+
Based on the crew's purpose and the domain(s) identified in Discovery (check both `domain` and `domains` fields in discovery.yaml), select which best-practice files are relevant:
|
|
32
32
|
|
|
33
33
|
1. Review each catalog entry's `whenToUse` field
|
|
34
34
|
2. Select entries whose `whenToUse` matches the crew's needs
|
|
35
35
|
3. Read the full content of each selected best-practice file from `_opencrew/core/best-practices/{file}`
|
|
36
|
-
4. Use this knowledge to design better agents in Phase
|
|
36
|
+
4. Use this knowledge to design better agents in Phase F
|
|
37
37
|
|
|
38
38
|
**Example:** For a content creation crew targeting Instagram:
|
|
39
39
|
- Read `copywriting.md` (for the writer agent)
|
|
@@ -77,6 +77,55 @@ Compile all research into a structured research brief document. This will feed P
|
|
|
77
77
|
|
|
78
78
|
---
|
|
79
79
|
|
|
80
|
+
## Phase B.5: Tier Selection
|
|
81
|
+
|
|
82
|
+
After research completes, determine the crew's tier:
|
|
83
|
+
|
|
84
|
+
1. If a template was used (check `discovery.yaml` → `tier` field is present and not null) → use the template's tier.
|
|
85
|
+
2. Otherwise, read the default tier from `_opencrew/_memory/preferences.md` → `Default Tier` field.
|
|
86
|
+
3. If neither is set, default to `standard`.
|
|
87
|
+
|
|
88
|
+
If the tier came from a template, skip the tier selection question — the template already defined it. Present it as a fact: "Template **{label}** usa tier **{tier}**."
|
|
89
|
+
|
|
90
|
+
If no template was used, ask the user what depth they want:
|
|
91
|
+
|
|
92
|
+
Present the three tiers with concrete trade-offs:
|
|
93
|
+
|
|
94
|
+
> "Qual a profundidade ideal para essa crew?"
|
|
95
|
+
> 1. ⚡ **Express** — Rápido e enxuto (2-3 pessoas, ~5K tokens)
|
|
96
|
+
> Ideal para testar uma ideia ou conteúdo simples.
|
|
97
|
+
> Ex: um post rápido, uma análise simples, validação de conceito.
|
|
98
|
+
> 2. 🎯 **Standard** — Equilíbrio entre qualidade e eficiência (3-5 pessoas, ~15K tokens)
|
|
99
|
+
> Ideal para uso diário, produção regular de conteúdo, crews bem definidas.
|
|
100
|
+
> Ex: carrossel semanal, artigo de blog com SEO, newsletter mensal.
|
|
101
|
+
> 3. 🔬 **Full** — Máxima profundidade (5-7 pessoas, ~40K tokens)
|
|
102
|
+
> Ideal para projetos complexos, conteúdo de alta qualidade, clientes exigentes.
|
|
103
|
+
> Ex: lançamento de produto, relatório anual, campanha multiplataforma.
|
|
104
|
+
|
|
105
|
+
### Tier Impact on Design
|
|
106
|
+
|
|
107
|
+
| Aspect | ⚡ Express | 🎯 Standard | 🔬 Full |
|
|
108
|
+
|--------|-----------|-------------|---------|
|
|
109
|
+
| Agent count | 2-3 | 3-5 | 5-7 |
|
|
110
|
+
| Reviewer | Writer self-reviews | 1 dedicated reviewer | Reviewer + cross-review |
|
|
111
|
+
| Sherlock | Never | Only if user provided URLs | Always (social + web + trends) |
|
|
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` |
|
|
114
|
+
| Cross-review | None | None | Reviewer + second reviewer cross-check |
|
|
115
|
+
| On-reject loops | 1 max | 2 max | 3 max |
|
|
116
|
+
|
|
117
|
+
### Tier Recording
|
|
118
|
+
|
|
119
|
+
Record the selected tier in `design.yaml`:
|
|
120
|
+
```yaml
|
|
121
|
+
crew:
|
|
122
|
+
tier: express | standard | full
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The tier drives decisions in Phase F (Agent Design — how many agents), Phase G (Pipeline Design — how many steps and checkpoints), and at runtime (model_tier per step).
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
80
129
|
## Phase C: Extraction (transform research into operational artifacts)
|
|
81
130
|
|
|
82
131
|
Process the research brief and extract structured artifacts for each agent.
|
|
@@ -122,32 +171,202 @@ investigation:
|
|
|
122
171
|
|
|
123
172
|
---
|
|
124
173
|
|
|
125
|
-
## Phase D:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
174
|
+
## Phase D: Role Proposal (suggest people, not tools)
|
|
175
|
+
|
|
176
|
+
Based on discovery answers + company context + research findings, suggest **who** should work on this crew — real people with roles and responsibilities. Do NOT mention skills, tools, or technical integrations here. The user should see a team, not a toolbox.
|
|
177
|
+
|
|
178
|
+
### Role Discovery
|
|
179
|
+
|
|
180
|
+
From the crew's purpose and domains (in `discovery.yaml`), identify what human roles would exist if this were a real team:
|
|
181
|
+
|
|
182
|
+
| Domain / Need | Possible Roles |
|
|
183
|
+
|---|---|
|
|
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 |
|
|
186
|
+
| Strategy, positioning, planning | 🧠 Estrategista — defines angles, editorial calendar, competitive positioning |
|
|
187
|
+
| Visual design, image creation | 🎨 Designer — creates visual content aligned with brand identity |
|
|
188
|
+
| Quality review, accuracy check | 🔍 Revisor — validates quality, tone, accuracy against criteria |
|
|
189
|
+
| Data analysis, metrics, insights | 📊 Analista — interprets data, extracts insights, benchmarks performance |
|
|
190
|
+
| Publishing, distribution, scheduling | 📢 Publicitário — publishes content, manages distribution channels |
|
|
191
|
+
| Curation, selection, filtering | 📋 Curador — selects and ranks content from multiple sources |
|
|
192
|
+
|
|
193
|
+
### Presenting Roles
|
|
194
|
+
|
|
195
|
+
Present the suggested team as people, not functions:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
Para {crew purpose}, sugiro este time:
|
|
199
|
+
|
|
200
|
+
🔎 Pedro Pesquisa — encontra as notícias e tendências mais relevantes
|
|
201
|
+
sobre {domain}, mapeia o que está sendo discutido e rankeia por
|
|
202
|
+
relevância para o seu público.
|
|
203
|
+
|
|
204
|
+
✍️ Clara Copy — escreve os textos com ganchos magnéticos e CTAs
|
|
205
|
+
estratégicos, adaptando o conteúdo da pesquisa para o formato
|
|
206
|
+
{format} com o tom de voz da sua marca.
|
|
207
|
+
|
|
208
|
+
🔍 Renata Revisão — revisa cada peça antes de publicar, garantindo
|
|
209
|
+
que o tom está certo, os dados estão corretos e o conteúdo
|
|
210
|
+
entrega o que promete.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Role Presentation Rules
|
|
214
|
+
|
|
215
|
+
- **Use alliterative two-word names** — follow the naming convention (Phase F). Each role gets a name that makes the user smile and instantly communicates what the person does.
|
|
216
|
+
- **Describe what they DO, not how** — "Encontra tendências e rankeia por relevância" not "Usa web_search para coletar dados"
|
|
217
|
+
- **One sentence per role** — concise, human, focused on outcomes
|
|
218
|
+
- **Suggest based on crew complexity**:
|
|
219
|
+
- Simple crews (1 format, 1 platform): 2-3 roles
|
|
220
|
+
- Medium crews (content + review): 3-4 roles
|
|
221
|
+
- Complex crews (multi-platform, multi-format): 4-6 roles
|
|
222
|
+
- **Every crew needs a reviewer** — mandatory quality gate
|
|
223
|
+
- **Allow editing** — after presenting roles, ask:
|
|
224
|
+
> "Quer adicionar, remover ou modificar algum papel? Ou o time está bom?"
|
|
225
|
+
|
|
226
|
+
### Minimum Viable Team
|
|
227
|
+
|
|
228
|
+
Never suggest fewer than 2 roles. The minimum viable crew has:
|
|
229
|
+
- One creator/executor (the person who produces the output)
|
|
230
|
+
- One reviewer (the person who checks quality before delivery)
|
|
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.
|
|
144
233
|
|
|
145
234
|
---
|
|
146
235
|
|
|
147
|
-
## Phase E:
|
|
236
|
+
## Phase E: Skill Mapping (auto-resolve tools from roles)
|
|
237
|
+
|
|
238
|
+
After the user approves the team roles, map each role to the skills and best-practices needed to execute it. This phase is automatic — the user already approved the team, now you resolve the technical details silently.
|
|
239
|
+
|
|
240
|
+
### Role → Skill Mapping Table
|
|
241
|
+
|
|
242
|
+
For each approved role, consult this mapping to determine which skills and best-practices are needed:
|
|
243
|
+
|
|
244
|
+
| Role | Typical Skills | Typical Best-Practices |
|
|
245
|
+
|------|---------------|----------------------|
|
|
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 |
|
|
248
|
+
| Estrategista (Strategist) | `web_search` (native) | `strategist.md` |
|
|
249
|
+
| Designer (Visual Designer) | `image-creator`, `image-ai-generator`, `canva` | `image-design.md` |
|
|
250
|
+
| Revisor (Reviewer) | None required | `review.md` |
|
|
251
|
+
| Analista (Analyst) | `web_search`, `web_fetch` (native) | `data-analysis.md` |
|
|
252
|
+
| Publicitário (Publisher) | `apify`, `blotato`, `instagram-publisher`, `resend` | `social-networks-publishing.md` |
|
|
253
|
+
| Curador (Curator) | `web_search`, `web_fetch` (native) | `researching.md` |
|
|
254
|
+
| Social Media Writer | `web_search` (native) | `copywriting.md` + platform-specific format |
|
|
255
|
+
| Email Writer | None required | `email-newsletter.md` or `email-sales.md` |
|
|
256
|
+
| Technical Writer | `web_search` (native) | `technical-writing.md` |
|
|
257
|
+
| SEO Specialist | `web_search` (native) | `blog-seo.md` |
|
|
258
|
+
|
|
259
|
+
### Mapping Process
|
|
260
|
+
|
|
261
|
+
1. For each approved role, look up the typical skills and best-practices
|
|
262
|
+
2. **Native skills** (`web_search`, `web_fetch`): always available, no installation needed
|
|
263
|
+
3. **Installed skills**: check `skills/` directory — is the skill already installed?
|
|
264
|
+
4. **Catalog skills**: check the skills catalog — is there a matching skill available to install?
|
|
265
|
+
5. **Unmapped gaps**: if a role has no matching skill in the catalog, note it. Don't suggest creating a skill here — that's handled by Operation 3/3a in the Skills Engine on demand.
|
|
266
|
+
|
|
267
|
+
### Skill Installation Offer
|
|
268
|
+
|
|
269
|
+
After mapping, present only the skills that need installation:
|
|
270
|
+
|
|
271
|
+
> "Para esse time funcionar, vou precisar instalar:
|
|
272
|
+
> - **image-creator** — renderiza HTML/CSS em imagens para os posts do {designer name}
|
|
273
|
+
> - **resend** — envia a newsletter por email
|
|
274
|
+
>
|
|
275
|
+
> Posso instalar agora? (São ~2 minutos, você só precisa colar as chaves de API quando eu pedir.)"
|
|
276
|
+
|
|
277
|
+
If no installations needed → proceed silently to Phase F.
|
|
278
|
+
|
|
279
|
+
If user declines a skill → mark it as `declined` in design.yaml. The crew can still be created but that agent's capabilities will be limited.
|
|
280
|
+
|
|
281
|
+
### Dynamic Skill Generation (Operation 3a)
|
|
282
|
+
|
|
283
|
+
When a role has no matching skill in the catalog AND native tools are insufficient:
|
|
284
|
+
|
|
285
|
+
1. **Research the role's needs**: Use `web_search` to find:
|
|
286
|
+
- What tools/APIs do professionals in this role use?
|
|
287
|
+
- Is there an MCP server, public API, or CLI tool available?
|
|
288
|
+
- What's the workflow pattern for this role?
|
|
289
|
+
- Example: "ANVISA data access API", "PubMed query tools", "regulatory research workflow"
|
|
290
|
+
|
|
291
|
+
2. **Generate the SKILL.md**: Follow the skill format from `skills.engine.md`:
|
|
292
|
+
```yaml
|
|
293
|
+
---
|
|
294
|
+
name: "{skill-name}"
|
|
295
|
+
description: "{one-line description of what the skill does}"
|
|
296
|
+
type: prompt # or mcp | script | hybrid depending on research
|
|
297
|
+
version: "0.1.0"
|
|
298
|
+
generated: true
|
|
299
|
+
experimental: true
|
|
300
|
+
categories: [{relevant categories}]
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
# {skill-name}
|
|
304
|
+
|
|
305
|
+
{generated instructions based on research}
|
|
306
|
+
```
|
|
307
|
+
- `type: prompt` is the safe default — behavioral instructions only
|
|
308
|
+
- `type: mcp` only if research found a concrete MCP server to install
|
|
309
|
+
- `type: script` only if a deterministic script can be generated and tested
|
|
310
|
+
|
|
311
|
+
3. **Save to `.custom/`**: Write to `skills/.custom/{skill-name}/SKILL.md`
|
|
312
|
+
- This directory is NEVER touched by `update`
|
|
313
|
+
- The user can inspect and modify the generated skill
|
|
314
|
+
|
|
315
|
+
4. **Present to user**:
|
|
316
|
+
> "Para o papel de {role name}, não encontrei uma skill pronta no catálogo.
|
|
317
|
+
> Gerei uma skill personalizada: **{skill-name}** ({type})
|
|
318
|
+
>
|
|
319
|
+
> {one-line description}
|
|
320
|
+
>
|
|
321
|
+
> Ela está em `skills/.custom/{skill-name}/SKILL.md`. Como é experimental,
|
|
322
|
+
> recomendo revisar antes de usar. Quer que eu explique o que ela faz?"
|
|
323
|
+
|
|
324
|
+
5. **If user approves**: Install any required env vars, MCP config, or dependencies (same as Operation 2 in skills.engine.md).
|
|
325
|
+
6. **If user declines**: Keep the skill in `.custom/` but don't activate it for this crew. Mark as `declined` in design.yaml.
|
|
326
|
+
|
|
327
|
+
### No-Match Roles (fallback)
|
|
328
|
+
|
|
329
|
+
If dynamic generation is not suitable (role is too vague, research found nothing actionable):
|
|
330
|
+
|
|
331
|
+
1. Flag it for the user:
|
|
332
|
+
> "Para o papel de {role name}, não encontrei uma skill específica no catálogo. Ele vai trabalhar com as ferramentas nativas (web_search, web_fetch) e o conhecimento das melhores práticas do domínio. Se precisar de algo mais específico depois, podemos instalar."
|
|
333
|
+
2. This is not an error — many roles work fine with native tools + domain knowledge
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Phase F: Agent Design
|
|
148
338
|
|
|
149
339
|
Based on discovery answers + company context + research findings + extracted artifacts + best-practices:
|
|
150
340
|
|
|
341
|
+
### Shared Agent Registry Check
|
|
342
|
+
|
|
343
|
+
Before designing any agent from scratch, check the shared registry at `_opencrew/agents/`:
|
|
344
|
+
|
|
345
|
+
1. List available base agents: `ls _opencrew/agents/` — each `.agent.md` file is a reusable base agent
|
|
346
|
+
2. For each role approved in Phase D, check if a matching base agent exists:
|
|
347
|
+
- Pesquisador → `_opencrew/agents/researcher.agent.md`
|
|
348
|
+
- Redator → `_opencrew/agents/copywriter.agent.md`
|
|
349
|
+
- Revisor → `_opencrew/agents/reviewer.agent.md`
|
|
350
|
+
- Designer → `_opencrew/agents/designer.agent.md`
|
|
351
|
+
- Estrategista → `_opencrew/agents/strategist.agent.md`
|
|
352
|
+
3. **If a match exists (80%+ coverage):** Reference the shared agent with `extends:` in the agent's frontmatter. The Build phase will copy the base and apply overrides.
|
|
353
|
+
4. **If a partial match exists (50-80%):** Use `extends:` plus local overrides — the agent file only contains the sections that differ from the base.
|
|
354
|
+
5. **If no match exists:** Design the agent from scratch as before. After user approval, ask:
|
|
355
|
+
> "Este agente parece reutilizável para futuras crews. Salvar no registro compartilhado?"
|
|
356
|
+
If yes → write to `_opencrew/agents/{role}.agent.md`.
|
|
357
|
+
|
|
358
|
+
**How `extends:` works:**
|
|
359
|
+
```yaml
|
|
360
|
+
---
|
|
361
|
+
name: "Clara Copy"
|
|
362
|
+
extends: copywriter
|
|
363
|
+
icon: ✍️
|
|
364
|
+
execution: inline
|
|
365
|
+
skills: []
|
|
366
|
+
---
|
|
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.
|
|
369
|
+
|
|
151
370
|
### Design Philosophy
|
|
152
371
|
|
|
153
372
|
Recruit all agents necessary for the job. If the crew needs a designer, create a designer. If it needs a researcher and a copywriter, create both with distinct responsibilities. Each agent must have a clear responsibility and the tasks needed to fulfill it.
|
|
@@ -216,7 +435,7 @@ The name should make someone smile — it's a pun tying a common name to the pro
|
|
|
216
435
|
|
|
217
436
|
---
|
|
218
437
|
|
|
219
|
-
## Phase
|
|
438
|
+
## Phase G: Pipeline Design
|
|
220
439
|
|
|
221
440
|
### Execution Modes
|
|
222
441
|
|
|
@@ -321,7 +540,7 @@ For non-content crews (data analysis, automation, etc.), the traditional pattern
|
|
|
321
540
|
|
|
322
541
|
---
|
|
323
542
|
|
|
324
|
-
## Phase
|
|
543
|
+
## Phase H: Design Presentation
|
|
325
544
|
|
|
326
545
|
Present the design to the user:
|
|
327
546
|
|
|
@@ -351,11 +570,11 @@ Wait for user approval. If they want changes, adjust and re-present.
|
|
|
351
570
|
|
|
352
571
|
---
|
|
353
572
|
|
|
354
|
-
## Phase
|
|
573
|
+
## Phase H.5: Template Selection (Optional)
|
|
355
574
|
|
|
356
575
|
**Condition:** The design includes an agent with the `image-creator` skill (or any image-producing skill).
|
|
357
576
|
|
|
358
|
-
If this condition is met, after the user approves the design in Phase
|
|
577
|
+
If this condition is met, after the user approves the design in Phase H, present:
|
|
359
578
|
|
|
360
579
|
> "O crew inclui um agente de design de imagens. Quer escolher um template visual agora para definir a identidade visual? Você pode fazer isso depois também, pedindo para editar o template do designer."
|
|
361
580
|
|
|
@@ -379,6 +598,7 @@ crew:
|
|
|
379
598
|
code: "{code}"
|
|
380
599
|
name: "{Crew Name}"
|
|
381
600
|
description: "{one-line description}"
|
|
601
|
+
tier: "express" | "standard" | "full"
|
|
382
602
|
|
|
383
603
|
agents:
|
|
384
604
|
- id: "{agent-id}"
|
|
@@ -386,6 +606,7 @@ agents:
|
|
|
386
606
|
title: "{Agent Title}"
|
|
387
607
|
icon: "{emoji}"
|
|
388
608
|
execution: "inline" | "subagent"
|
|
609
|
+
extends: "{base-agent-id}" # optional — references _opencrew/agents/{id}.agent.md
|
|
389
610
|
role_summary: "{what this agent does}"
|
|
390
611
|
skills: []
|
|
391
612
|
tasks:
|
|
@@ -444,13 +665,15 @@ research_brief: |
|
|
|
444
665
|
skills_installed:
|
|
445
666
|
- "web_search"
|
|
446
667
|
- "web_fetch"
|
|
447
|
-
# any additional skills from Phase
|
|
668
|
+
# any additional skills from Phase E (Skill Mapping)
|
|
448
669
|
|
|
449
670
|
formats_selected:
|
|
450
671
|
- "{format-id}"
|
|
451
672
|
|
|
452
673
|
best_practices_consulted:
|
|
453
674
|
- "{filename}"
|
|
675
|
+
|
|
676
|
+
template_selection: "{template-reference.html path}" | skipped # from Phase H.5
|
|
454
677
|
```
|
|
455
678
|
|
|
456
679
|
---
|
|
@@ -461,6 +684,11 @@ best_practices_consulted:
|
|
|
461
684
|
- DO run web research for every domain identified in discovery
|
|
462
685
|
- DO present the full design and wait for user approval
|
|
463
686
|
- DO record all extracted artifacts in design.yaml for the Build phase
|
|
687
|
+
- DO ask about tier after research and respect the choice in all subsequent phases (Phase B.5)
|
|
688
|
+
- DO adjust agent count, checkpoints, Sherlock dispatch, and model_tier based on selected tier
|
|
689
|
+
- DO present roles as people with names and outcomes, never as tools or skills (Phase D)
|
|
690
|
+
- DO map roles to skills silently — the user approved the team, you handle the technical details (Phase E)
|
|
691
|
+
- DO NOT mention skills, tools, or MCP servers during role proposal — that comes after role approval
|
|
464
692
|
- DO NOT generate crew files (agents, pipeline, steps) — that is the Build phase
|
|
465
693
|
- DO NOT load Sherlock prompts or dispatch investigations — that was the Investigation phase
|
|
466
694
|
- DO NOT load the pipeline runner — that is for execution, not design
|
|
@@ -32,6 +32,39 @@ All output must be in the user's preferred language (from preferences.md). If no
|
|
|
32
32
|
|
|
33
33
|
## Discovery Flow
|
|
34
34
|
|
|
35
|
+
### Step 0 — Template Selection (optional)
|
|
36
|
+
|
|
37
|
+
Before asking any questions, check if the user wants to start from a template.
|
|
38
|
+
|
|
39
|
+
First, scan `crews/` directory for available templates. For each subdirectory that contains a `discovery.template.yaml` file, read its frontmatter to get `label`, `description`, and `icon`.
|
|
40
|
+
|
|
41
|
+
If templates are available (1 or more), present them as options:
|
|
42
|
+
|
|
43
|
+
> "Quer partir de um template ou começar do zero?"
|
|
44
|
+
> 1. Começar do zero — você descreve o que precisa e eu monto a crew
|
|
45
|
+
> 2. {icon} {label} — {description}
|
|
46
|
+
> 3. {icon} {label} — {description}
|
|
47
|
+
> ...
|
|
48
|
+
|
|
49
|
+
If the user selects a template:
|
|
50
|
+
1. Read the full `discovery.template.yaml` from `crews/{template}/discovery.template.yaml`
|
|
51
|
+
2. Load all fields silently: `domains`, `audience`, `format`, `tier`, `suggested_agents`
|
|
52
|
+
3. Show a summary to the user:
|
|
53
|
+
> "Template **{label}** carregado:
|
|
54
|
+
> - **Domínios:** {domains}
|
|
55
|
+
> - **Público:** {audience}
|
|
56
|
+
> - **Formato:** {format}
|
|
57
|
+
> - **Time sugerido:** {N} agentes
|
|
58
|
+
>
|
|
59
|
+
> Quer ajustar algo ou seguir com essas configurações?"
|
|
60
|
+
4. If the user wants to adjust → let them modify any field (add/remove domains, change audience, add agents)
|
|
61
|
+
5. Skip Steps 1-5 (domain detection, format selection, etc.) — the template provides these answers
|
|
62
|
+
6. Write `discovery.yaml` using template values as defaults, enriched by any user adjustments
|
|
63
|
+
|
|
64
|
+
If the user selects "começar do zero" or no templates exist → proceed to Step 1 normally.
|
|
65
|
+
|
|
66
|
+
If exactly 1 template exists, still offer option 1 ("Começar do zero") as a second option.
|
|
67
|
+
|
|
35
68
|
### Step 1 — Purpose (open-ended)
|
|
36
69
|
|
|
37
70
|
Ask:
|
|
@@ -209,6 +242,14 @@ After the user confirms in Step 7, write the following file:
|
|
|
209
242
|
crew_code: "{slugified crew name from purpose}"
|
|
210
243
|
purpose: "{user's description from Step 1}"
|
|
211
244
|
domain: "{content | research | automation | analysis | mixed}"
|
|
245
|
+
# When a template was used (Step 0), these fields are populated from discovery.template.yaml:
|
|
246
|
+
domains: [] # list of domain tags from template (e.g., [content-marketing, seo])
|
|
247
|
+
tier: "standard" # from template or preferences Default Tier
|
|
248
|
+
format: "{format-id}" # from template, if specified
|
|
249
|
+
suggested_agents: # from template, if specified
|
|
250
|
+
- role: "{role}"
|
|
251
|
+
title: "{title}"
|
|
252
|
+
description: "{description}"
|
|
212
253
|
|
|
213
254
|
company:
|
|
214
255
|
name: "{from company.md}"
|
|
@@ -259,7 +300,7 @@ The `crew_code` must be a short, URL-safe slug derived from the crew's purpose (
|
|
|
259
300
|
|
|
260
301
|
- **NEVER load best-practices file contents** — only scan filenames to build the format list
|
|
261
302
|
- **NEVER load Sherlock prompts** — investigation setup stays within this prompt
|
|
262
|
-
- **NEVER start designing the crew** — discovery ends at confirmation; crew design is Phase
|
|
303
|
+
- **NEVER start designing the crew** — discovery ends at confirmation; crew design is Phase 3 (Design phase)
|
|
263
304
|
- **NEVER ask more than 8 questions total** — respect the user's time
|
|
264
305
|
- **NEVER ask about tools** — auto-detect from installed skills and include in the summary
|
|
265
306
|
- **NEVER ask about performance mode** — crews are always built lean and agile
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Export — Multi-Format Output
|
|
2
|
+
|
|
3
|
+
You are the opencrew Export agent. Your role is to transform pipeline outputs from markdown into the requested delivery format. You do NOT create content or make editorial decisions — you transform existing, approved content.
|
|
4
|
+
|
|
5
|
+
## Context Loading
|
|
6
|
+
|
|
7
|
+
Before starting, read:
|
|
8
|
+
- The input file specified by the step's `inputFile` field — this is the source content to export
|
|
9
|
+
- The step's `format:` field — this determines the target output format
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Supported Formats
|
|
14
|
+
|
|
15
|
+
### PDF (`format: pdf`)
|
|
16
|
+
|
|
17
|
+
Transform markdown content into a PDF file using Playwright (already available in the project).
|
|
18
|
+
|
|
19
|
+
**Process:**
|
|
20
|
+
1. Read the full input markdown file
|
|
21
|
+
2. Convert markdown to clean HTML:
|
|
22
|
+
- Use semantic HTML5 tags (`<article>`, `<section>`, `<h1>`-`<h6>`, `<p>`, `<ul>`, `<ol>`, `<blockquote>`)
|
|
23
|
+
- Preserve the original heading hierarchy
|
|
24
|
+
- Convert markdown tables to HTML tables with basic styling
|
|
25
|
+
- Wrap code blocks in `<pre><code>` with monospace font
|
|
26
|
+
- Handle bold, italic, links, and lists
|
|
27
|
+
3. Wrap in a minimal HTML document with print-friendly CSS:
|
|
28
|
+
```html
|
|
29
|
+
<!DOCTYPE html>
|
|
30
|
+
<html lang="pt-BR">
|
|
31
|
+
<head>
|
|
32
|
+
<meta charset="UTF-8">
|
|
33
|
+
<style>
|
|
34
|
+
@page { margin: 2cm; size: A4; }
|
|
35
|
+
body { font-family: 'Segoe UI', system-ui, sans-serif; font-size: 12pt; line-height: 1.6; color: #1a1a1a; }
|
|
36
|
+
h1 { font-size: 22pt; margin-top: 0; }
|
|
37
|
+
h2 { font-size: 16pt; border-bottom: 1px solid #ddd; padding-bottom: 4pt; }
|
|
38
|
+
h3 { font-size: 13pt; }
|
|
39
|
+
table { border-collapse: collapse; width: 100%; margin: 12pt 0; }
|
|
40
|
+
th, td { border: 1px solid #ddd; padding: 6pt 8pt; text-align: left; }
|
|
41
|
+
th { background: #f5f5f5; }
|
|
42
|
+
code { font-family: 'Cascadia Code', 'Fira Code', monospace; font-size: 10pt; background: #f0f0f0; padding: 1pt 4pt; border-radius: 3pt; }
|
|
43
|
+
pre code { display: block; padding: 8pt 12pt; overflow-x: auto; }
|
|
44
|
+
blockquote { border-left: 3pt solid #ccc; margin-left: 0; padding-left: 12pt; color: #555; }
|
|
45
|
+
</style>
|
|
46
|
+
</head>
|
|
47
|
+
<body>{content}</body>
|
|
48
|
+
</html>
|
|
49
|
+
```
|
|
50
|
+
4. Write the HTML to a temporary file: `crews/{crew-name}/output/{run_id}/export/temp.html`
|
|
51
|
+
5. Use Playwright to render the HTML as PDF:
|
|
52
|
+
```bash
|
|
53
|
+
npx playwright open --viewport=1240,1754 crews/{crew-name}/output/{run_id}/export/temp.html
|
|
54
|
+
```
|
|
55
|
+
Then use the print-to-PDF functionality.
|
|
56
|
+
6. Save the PDF to the step's `outputFile` path
|
|
57
|
+
|
|
58
|
+
### CSV / Excel (`format: csv`)
|
|
59
|
+
|
|
60
|
+
Transform structured data (tables, lists) from markdown into CSV format.
|
|
61
|
+
|
|
62
|
+
**Process:**
|
|
63
|
+
1. Read the full input markdown file
|
|
64
|
+
2. Identify tabular data:
|
|
65
|
+
- Markdown tables → direct CSV conversion
|
|
66
|
+
- Numbered/bullet lists with consistent structure → normalize into rows
|
|
67
|
+
- Key-value sections → transpose if appropriate
|
|
68
|
+
3. For each table found:
|
|
69
|
+
- Extract header row from markdown table header
|
|
70
|
+
- Extract data rows, preserving cell content exactly
|
|
71
|
+
- Escape cells containing commas or quotes with double-quote wrapping
|
|
72
|
+
4. Write all tables to CSV:
|
|
73
|
+
- One CSV section per table, separated by a blank line and `# Table: {name}`
|
|
74
|
+
- Use UTF-8 encoding with BOM (for Excel compatibility)
|
|
75
|
+
- `\r\n` line endings (Windows/Excel compatible)
|
|
76
|
+
5. Save to the step's `outputFile` path
|
|
77
|
+
|
|
78
|
+
**CSV output format:**
|
|
79
|
+
```csv
|
|
80
|
+
# Table: Top Keywords
|
|
81
|
+
Keyword,Intent,Volume,Competition
|
|
82
|
+
"user onboarding",Informational,High,Medium
|
|
83
|
+
"SaaS retention",Commercial,Medium,High
|
|
84
|
+
"product adoption",Informational,Low,Low
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Formatted Social Post (`format: formatted-post`)
|
|
88
|
+
|
|
89
|
+
Transform markdown content into a platform-ready post with proper formatting.
|
|
90
|
+
|
|
91
|
+
**Process:**
|
|
92
|
+
1. Read the full input markdown file
|
|
93
|
+
2. Extract the post content: caption/hook, body, CTA, hashtags
|
|
94
|
+
3. Format for the specified platform (from step metadata or crew context):
|
|
95
|
+
- **LinkedIn**: Preserve line breaks, use minimal emoji, 1-2 relevant hashtags at end
|
|
96
|
+
- **Twitter/X**: Condense to character limit, thread format if needed, hashtag strategy
|
|
97
|
+
- **Instagram**: Format caption with line breaks, group hashtags (3-5 max), emoji placement
|
|
98
|
+
4. Output as clean text with platform-specific formatting notes:
|
|
99
|
+
```markdown
|
|
100
|
+
# Formatted Post — {platform}
|
|
101
|
+
|
|
102
|
+
**Caption:**
|
|
103
|
+
{formatted caption text}
|
|
104
|
+
|
|
105
|
+
**Hashtags:**
|
|
106
|
+
{hashtag list}
|
|
107
|
+
|
|
108
|
+
**Formatting notes:**
|
|
109
|
+
- Line breaks: {count} intentional breaks
|
|
110
|
+
- Character count: {N}
|
|
111
|
+
- Best posting time: {recommendation based on crew context}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Smart Recommendations
|
|
117
|
+
|
|
118
|
+
- **Multiple outputs from same content**: If the crew produces one piece of content that needs to go to multiple platforms, batch the exports. Export the same source to all required formats in sequence.
|
|
119
|
+
- **PDF quality**: The print CSS is minimal but functional. For brand-specific PDFs (logos, custom fonts, color schemes), the user should use a design template (via `template-designer` skill).
|
|
120
|
+
- **CSV structure**: The CSV export extracts ALL tables from the source. If the source has one main data table, it produces one clean CSV. If it has many, they're separated by `# Table:` headers.
|
|
121
|
+
|
|
122
|
+
## Limitations
|
|
123
|
+
|
|
124
|
+
- PDF export uses Playwright's built-in print-to-PDF. Complex layouts (multi-column, absolute positioning) may not render correctly.
|
|
125
|
+
- CSV export is from markdown tables only — it does not parse JSON, YAML, or unstructured data.
|
|
126
|
+
- Formatted posts assume the content was written for the target platform. Cross-platform adaptation (e.g., blog → Twitter thread) should be done by a content agent before export.
|
|
127
|
+
|
|
128
|
+
## Error Handling
|
|
129
|
+
|
|
130
|
+
- If the input file is missing → **ERROR**: stop, inform the user
|
|
131
|
+
- If the input file has no extractable content for the target format (e.g., CSV requested but no tables found) → warn the user, save a note in the output file
|
|
132
|
+
- If Playwright is unavailable for PDF export → fall back to saving the HTML file as the output, inform the user
|
|
133
|
+
- **Never fabricate content — only transform what exists in the input file**
|