@aksp/opencrew 1.11.0 → 1.13.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 (36) hide show
  1. package/CHANGELOG.md +66 -3
  2. package/README.md +7 -3
  3. package/package.json +1 -1
  4. package/templates/AGENTS.md +10 -8
  5. package/templates/_opencrew/.opencrew-version +1 -1
  6. package/templates/_opencrew/core/best-practices/_catalog.yaml +5 -0
  7. package/templates/_opencrew/core/best-practices/texto-livre.md +23 -0
  8. package/templates/_opencrew/core/formato-da-crew.md +2 -1
  9. package/templates/_opencrew/core/prompts/build.prompt.md +3 -3
  10. package/templates/_opencrew/core/prompts/design.prompt.md +5 -5
  11. package/templates/_opencrew/core/prompts/discovery.prompt.md +8 -6
  12. package/templates/_opencrew/core/prompts/documento.prompt.md +9 -5
  13. package/templates/_opencrew/core/prompts/entrega.prompt.md +7 -2
  14. package/templates/_opencrew/core/prompts/repair.prompt.md +1 -1
  15. package/templates/_opencrew/core/runner/contrato-de-saida.md +33 -0
  16. package/templates/_opencrew/core/runner/escritorio.md +37 -0
  17. package/templates/_opencrew/core/runner/fim-da-execucao.md +110 -0
  18. package/templates/_opencrew/core/runner/fontes-pendentes.md +21 -0
  19. package/templates/_opencrew/core/runner/memoria.md +55 -0
  20. package/templates/_opencrew/core/runner/selecao-de-agentes.md +79 -0
  21. package/templates/_opencrew/core/runner/tarefas-do-agente.md +34 -0
  22. package/templates/_opencrew/core/runner.pipeline.md +45 -373
  23. package/templates/_opencrew/core/scripts/caminho/argumentos.mjs +3 -1
  24. package/templates/_opencrew/core/scripts/caminho/nucleo.mjs +16 -0
  25. package/templates/_opencrew/core/scripts/caminho.mjs +11 -8
  26. package/templates/_opencrew/core/scripts/conferir-fontes/relatorio.mjs +4 -2
  27. package/templates/_opencrew/core/scripts/conferir-fontes.mjs +22 -16
  28. package/templates/_opencrew/core/scripts/conserto/achados.mjs +1 -1
  29. package/templates/_opencrew/core/scripts/documento/markdown.mjs +2 -1
  30. package/templates/_opencrew/core/scripts/documento/pacote.mjs +1 -0
  31. package/templates/_opencrew/core/scripts/documento/perfil.mjs +14 -0
  32. package/templates/_opencrew/core/scripts/entrega/pendencias.mjs +4 -1
  33. package/templates/_opencrew/core/scripts/entrega/separar.mjs +2 -1
  34. package/templates/_opencrew/core/scripts/verificar/documento.mjs +20 -0
  35. package/templates/_opencrew/core/scripts/verificar/medicao.mjs +2 -1
  36. package/templates/_opencrew/core/scripts/verificar.mjs +3 -1
@@ -0,0 +1,21 @@
1
+ # Source check that did not end in FONTES:OK
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when the source check of the Initialization (1c) ended in `FONTES:PENDENTE` or did not run.
4
+
5
+ If the last line is `FONTES:PENDENTE` (a cited file was moved, renamed or deleted), show the
6
+ report and ask — never continue silently with a missing source:
7
+ ```
8
+ Alguns arquivos que a crew usa não estão mais onde ela espera:
9
+ {resumo do relatório}
10
+
11
+ 1. Corrigir os caminhos sugeridos (troco nos arquivos da crew e guardo .bak)
12
+ 2. Seguir assim mesmo
13
+ 3. Parar
14
+ ```
15
+ On 1, run the same command with `--corrigir`, show the new result and re-read `crew.yaml` and
16
+ any agent file already loaded (it may have changed them); 1d then loads the sources from the
17
+ corrected paths. If the new result still ends in `FONTES:PENDENTE`, ask again with options 2 and
18
+ 3 only. Alerts — not portable (absolute paths) or "não conferido" (a network path or a site
19
+ address: the script never accesses the network) — are mentioned once, without stopping. If the
20
+ script did not run (no Node, an error, or no `FONTES:` status line), tell the user "⚠️ A
21
+ conferência de fontes não rodou: {motivo}" and continue; the final approval repeats the warning.
@@ -0,0 +1,55 @@
1
+ # Memory format
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when `memories.md` has no `## Estilo de Escrita` section header, is empty or does not exist.
4
+
5
+ **Note on language**: The structural labels listed below are **fixed PT-BR** and must
6
+ never be translated — opencrew's primary supported audience is PT-BR (see AGENTS.md →
7
+ Language Handling). Only the *content* written under these headers follows the user's
8
+ preferred language.
9
+
10
+ | Fixed PT-BR header | Location | Purpose |
11
+ |---|---|---|
12
+ | `## Estilo de Escrita` | `memories.md` | Writing style rules accumulated per crew |
13
+ | `## Design Visual` | `memories.md` | Visual design preferences per crew |
14
+ | `## Estrutura de Conteúdo` | `memories.md` | Content structure rules per crew |
15
+ | `## Proibições Explícitas` | `memories.md` | User bans and hard blocks per crew |
16
+ | `## Técnico (específico do crew)` | `memories.md` | Technical crew-specific settings |
17
+ | `Data \| Run ID \| Tema \| Output \| Score \| Resultado` | `runs.md` | Run history table columns |
18
+
19
+ When adding new structural sections to `memories.md` or `runs.md`, keep headers in PT-BR
20
+ unless the user base expands beyond PT-BR — at that point, discuss a migration strategy
21
+ (e.g. i18n key mapping) rather than mixing languages in a single file.
22
+
23
+ ## Migration
24
+
25
+ **Memory format migration** — After loading `memories.md`, check whether it uses the new format: it does when it has the `## Estilo de Escrita` section header (read the file with the read tool — no command).
26
+ - If it has the header → proceed normally.
27
+ - If it does not (or the file is empty / does not exist) → migrate before proceeding:
28
+ a0. If the file exists and is not empty, FIRST copy it to `crews/{name}/_memory/memories.md.bak`
29
+ (never lose what the crew learned), then tell the user in one line:
30
+ "Atualizei o formato da memória da crew; a versão anterior está em `memories.md.bak`."
31
+ Move every rule you can recognize from the old file into the matching new section.
32
+ a. Write `crews/{name}/_memory/memories.md` with the new sections format:
33
+ ```markdown
34
+ # Crew Memory: {crew-name}
35
+
36
+ ## Estilo de Escrita
37
+
38
+ ## Design Visual
39
+
40
+ ## Estrutura de Conteúdo
41
+
42
+ ## Proibições Explícitas
43
+
44
+ ## Técnico (específico do crew)
45
+ ```
46
+ (Use the crew's display name for `{crew-name}`, and the crew code for `{name}` in file paths — they refer to the same crew.)
47
+ b. Check if `crews/{name}/_memory/runs.md` exists (read tool — no command).
48
+ If it does not exist, create it with:
49
+ ```markdown
50
+ # Run History: {crew-name}
51
+
52
+ | Data | Run ID | Tema | Output | Score | Resultado |
53
+ |------|--------|------|--------|-------|-----------|
54
+ ```
55
+ - Do not pause execution for this migration (the one-line notice above is enough).
@@ -0,0 +1,79 @@
1
+ # Pre-Execution Agent Selection
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when `crew.yaml` declares an `agent_dependencies:` field. It decides which agents actually run for this task.
4
+
5
+ Run this step ONLY if `crew.yaml` declares an `agent_dependencies:` field (even an
6
+ empty map `{}`). If the field is absent → skip this entire step and run ALL agents
7
+ exactly as before (legacy behavior).
8
+
9
+ When active, in this order:
10
+
11
+ a. **Capture the task** — Determine the user's request for this run:
12
+ - If the run was invoked with a description (e.g. `/opencrew run {name} {description}`),
13
+ use that text as the task.
14
+ - Otherwise ask: `📝 What is the task for this run? Reply in one line.`
15
+ Wait for the user's reply before continuing.
16
+
17
+ b. **Analyze against the decision matrix** — Scan the task text (case-insensitive,
18
+ PT-BR and EN keywords) for the signals below. Start with ALL agents suggested as
19
+ SELECTED (`required`). For each matching signal, find the affected agent(s) in
20
+ `crew-party.csv` by matching the role terms against the agent's `id` and `title`
21
+ (and `displayName` if ambiguous), then apply the suggested status:
22
+
23
+ | Signal in the task | Role terms to match (id / title) | Suggested status |
24
+ |--------------------|----------------------------------|------------------|
25
+ | "já pesquisei", "com base em", "fontes que tenho", "material pronto", "baseado nas fontes", "research already done" | researcher, pesquisad, research | optional |
26
+ | "revise", "melhore", "corrija", "refine", "edite" (sem criar do zero), "improve this draft" | copywriter, redator, writer, criador | optional |
27
+ | "só texto", "sem imagem", "sem visual", "sem arte", "no image" | designer, design, visual | skip |
28
+ | "já revisei", "já foi aprovado", "aprovado por terceiros", "revisão feita", "already reviewed" | reviewer, revisor | optional |
29
+ | "quero só revisar este texto", "apenas revisar", "review only" | researcher AND copywriter | skip |
30
+ | "tenho o conteúdo pronto", "forneço o documento", "docs em anexo", "segue o material", "here is the content" | copywriter, writer, creator | optional |
31
+
32
+ Resolution rules:
33
+ - `optional` = agent stays selected but may be unchecked.
34
+ - `skip` = agent is suggested deselected.
35
+ - Conflicting signals on the same agent → the more restrictive wins (`skip` > `optional`).
36
+ - Never suggest skipping an agent whose output is the run's final deliverable unless the
37
+ signal is explicit.
38
+ - No signal matches → suggest keeping all agents (no change).
39
+
40
+ c. **Present the selection** — IDE-neutral numbered multi-select. List every agent from
41
+ `crew-party.csv` in party order:
42
+ ```
43
+ 🧑‍🤝‍🧑 Which agents should work on this task?
44
+
45
+ Suggested selection:
46
+ 1. [x] {icon} {displayName} ({id}) — {title}
47
+ 2. [x] {icon} {displayName} ({id}) — {title}
48
+ 3. [ ] {icon} {displayName} ({id}) — {title}
49
+ ...
50
+ [x] = suggested selected · [ ] = suggested deselected
51
+
52
+ Reply with the numbers of the agents you want to INCLUDE, separated by commas.
53
+ Example: "1, 2" · Reply "all" to run everyone.
54
+ ```
55
+ Wait for the user's reply. Parse it into `selected_agents`. At least one agent must
56
+ be selected — if the user replies with none, repeat the prompt once.
57
+
58
+ d. **Dependency warnings** — Using `crew.yaml → agent_dependencies`
59
+ (e.g. `copywriter: [researcher]` = copywriter consumes researcher's output):
60
+ for every dependency `dependent → required_agent`, if `dependent` is selected but
61
+ `required_agent` is NOT, warn:
62
+ ```
63
+ ⚠️ {dependent} normally depends on {required_agent}'s output, which you deselected.
64
+
65
+ 1. Re-select {required_agent} (recommended)
66
+ 2. Keep going without it — I will supply the input myself
67
+ 3. Deselect {dependent} too
68
+ ```
69
+ Wait for the user's choice and apply it. If they pick option 2, set
70
+ `missing_dependency = true` in working memory (the existing Pre-Step Input
71
+ Validation recovery — "Skip step and continue / Abort" — then handles any
72
+ downstream gap).
73
+
74
+ e. **Build the filtered step list** — Set `skipped_agents = all party agents − selected_agents`.
75
+ Build `filtered_steps` by walking `pipeline.yaml` in order, keeping a step when:
76
+ - its frontmatter has NO `agent:` field (checkpoints / generic steps), OR
77
+ - its `agent:` value is in `selected_agents`.
78
+ Store `selected_agents`, `skipped_agents`, and `filtered_steps` in working memory for
79
+ the per-step loop (steps 5 and 6 of the Initialization reflect them).
@@ -0,0 +1,34 @@
1
+ # Task-Based Agent Execution
2
+
3
+ > Part of the Pipeline Runner (`_opencrew/core/runner.pipeline.md`). Read it only when the agent of the step has a `tasks:` field in its frontmatter.
4
+
5
+ When an agent's `.agent.md` frontmatter contains a `tasks:` field:
6
+
7
+ 1. **Load task list**: Read the `tasks:` array from the agent's frontmatter
8
+ - Each entry is a relative path to a task file (e.g., `tasks/analyze-source.md`)
9
+ - Tasks execute in the order listed
10
+
11
+ 2. **For each task in sequence**:
12
+ a. Read the task file from the agent's directory (`crews/{crew-name}/agents/{agent-id}/tasks/{task}.md`: a folder with the agent id, next to the agent file)
13
+ b. Construct the execution prompt:
14
+ - Agent persona + principles (from agent.md — fixed across all tasks)
15
+ - Task description and process (from task file)
16
+ - Task output format (from task file)
17
+ - Task quality criteria and veto conditions (from task file)
18
+ - Input: For the first task, use the step's input. For subsequent tasks, use the previous task's output.
19
+ c. Execute the task (inline or subagent, matching the step's execution mode)
20
+ d. Collect the task output
21
+ e. Check task veto conditions (same enforcement as the step veto conditions: "Veto Condition Enforcement", in the runner)
22
+
23
+ 3. **Final output**: The output of the LAST task in the chain becomes the step's output
24
+ - Resolve the `outputFile` path with the `saida` command (Output Path Transformation) before saving — this applies regardless of whether the step runs as `execution: inline` or `execution: subagent`
25
+ - Save to the **transformed** outputFile path
26
+ - This is what the next step (or checkpoint) receives
27
+
28
+ 4. **Progress reporting**: For inline execution, announce each task:
29
+ ```
30
+ {icon} {Agent Name} — Task {N}/{total}: {task name}...
31
+ ```
32
+
33
+ 5. **Backward compatibility**: If the agent's frontmatter does NOT contain a `tasks:` field,
34
+ execute the agent monolithically as before (current behavior unchanged).