@julioventura/opensquad 0.1.17
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/README.md +433 -0
- package/_opensquad/config/playwright.config.json +11 -0
- package/_opensquad/core/architect.agent.yaml +112 -0
- package/_opensquad/core/best-practices/_catalog.yaml +126 -0
- package/_opensquad/core/best-practices/blog-post.md +132 -0
- package/_opensquad/core/best-practices/blog-seo.md +127 -0
- package/_opensquad/core/best-practices/brand-resolution-checklist.md +172 -0
- package/_opensquad/core/best-practices/copywriting.md +441 -0
- package/_opensquad/core/best-practices/data-analysis.md +401 -0
- package/_opensquad/core/best-practices/email-newsletter.md +118 -0
- package/_opensquad/core/best-practices/email-sales.md +110 -0
- package/_opensquad/core/best-practices/image-design.md +348 -0
- package/_opensquad/core/best-practices/instagram-feed.md +235 -0
- package/_opensquad/core/best-practices/instagram-reels.md +112 -0
- package/_opensquad/core/best-practices/instagram-stories.md +107 -0
- package/_opensquad/core/best-practices/linkedin-article.md +116 -0
- package/_opensquad/core/best-practices/linkedin-post.md +121 -0
- package/_opensquad/core/best-practices/researching.md +349 -0
- package/_opensquad/core/best-practices/review.md +269 -0
- package/_opensquad/core/best-practices/run-recovery.md +61 -0
- package/_opensquad/core/best-practices/social-networks-publishing.md +327 -0
- package/_opensquad/core/best-practices/squad-creation-checklist.md +32 -0
- package/_opensquad/core/best-practices/strategist.md +344 -0
- package/_opensquad/core/best-practices/technical-writing.md +365 -0
- package/_opensquad/core/best-practices/twitter-post.md +105 -0
- package/_opensquad/core/best-practices/twitter-thread.md +122 -0
- package/_opensquad/core/best-practices/whatsapp-broadcast.md +107 -0
- package/_opensquad/core/best-practices/youtube-script.md +122 -0
- package/_opensquad/core/best-practices/youtube-shorts.md +112 -0
- package/_opensquad/core/defaults/youtube-video-assembly.json +84 -0
- package/_opensquad/core/prompts/build.prompt.md +613 -0
- package/_opensquad/core/prompts/design.prompt.md +606 -0
- package/_opensquad/core/prompts/discovery.prompt.md +377 -0
- package/_opensquad/core/prompts/sherlock-instagram.md +123 -0
- package/_opensquad/core/prompts/sherlock-linkedin.md +73 -0
- package/_opensquad/core/prompts/sherlock-shared.md +684 -0
- package/_opensquad/core/prompts/sherlock-twitter.md +78 -0
- package/_opensquad/core/prompts/sherlock-youtube.md +85 -0
- package/_opensquad/core/runner.pipeline.md +743 -0
- package/_opensquad/core/skills.engine.md +384 -0
- package/bin/opensquad.js +108 -0
- package/dashboard/index.html +15 -0
- package/dashboard/package-lock.json +1964 -0
- package/dashboard/package.json +28 -0
- package/dashboard/public/assets/avatars/Female1_1wave.png +0 -0
- package/dashboard/public/assets/avatars/Female1_2wave.png +0 -0
- package/dashboard/public/assets/avatars/Female1_blink.png +0 -0
- package/dashboard/public/assets/avatars/Female1_talk.png +0 -0
- package/dashboard/public/assets/avatars/Female2_1wave.png +0 -0
- package/dashboard/public/assets/avatars/Female2_2wave.png +0 -0
- package/dashboard/public/assets/avatars/Female2_blink.png +0 -0
- package/dashboard/public/assets/avatars/Female2_talk.png +0 -0
- package/dashboard/public/assets/avatars/Female3_blink.png +0 -0
- package/dashboard/public/assets/avatars/Female3_talk.png +0 -0
- package/dashboard/public/assets/avatars/Female3_wave.png +0 -0
- package/dashboard/public/assets/avatars/Female4_blink.png +0 -0
- package/dashboard/public/assets/avatars/Female4_talk.png +0 -0
- package/dashboard/public/assets/avatars/Female4_wave.png +0 -0
- package/dashboard/public/assets/avatars/Female5_blink.png +0 -0
- package/dashboard/public/assets/avatars/Female5_talk.png +0 -0
- package/dashboard/public/assets/avatars/Female5_wave.png +0 -0
- package/dashboard/public/assets/avatars/Female6_blink.png +0 -0
- package/dashboard/public/assets/avatars/Female6_talk.png +0 -0
- package/dashboard/public/assets/avatars/Female6_wave.png +0 -0
- package/dashboard/public/assets/avatars/Male1_1wave.png +0 -0
- package/dashboard/public/assets/avatars/Male1_2wave.png +0 -0
- package/dashboard/public/assets/avatars/Male1_blink.png +0 -0
- package/dashboard/public/assets/avatars/Male1_talk.png +0 -0
- package/dashboard/public/assets/avatars/Male2_1wave.png +0 -0
- package/dashboard/public/assets/avatars/Male2_2wave.png +0 -0
- package/dashboard/public/assets/avatars/Male2_blink.png +0 -0
- package/dashboard/public/assets/avatars/Male2_talk.png +0 -0
- package/dashboard/public/assets/avatars/Male3_blink.png +0 -0
- package/dashboard/public/assets/avatars/Male3_talk.png +0 -0
- package/dashboard/public/assets/avatars/Male3_wave.png +0 -0
- package/dashboard/public/assets/avatars/Male4_blink.png +0 -0
- package/dashboard/public/assets/avatars/Male4_talk.png +0 -0
- package/dashboard/public/assets/avatars/Male4_wave.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_black_down.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_black_down_coding-1.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_black_down_coding.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_black_up.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_white_down.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_white_down_coding-1.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_white_down_coding.png +0 -0
- package/dashboard/public/assets/desks/desktop_set_white_up.png +0 -0
- package/dashboard/public/assets/furniture/armchair_tan.png +0 -0
- package/dashboard/public/assets/furniture/armchair_tan_down.png +0 -0
- package/dashboard/public/assets/furniture/backpack_blue.png +0 -0
- package/dashboard/public/assets/furniture/backpack_red.png +0 -0
- package/dashboard/public/assets/furniture/blinds.png +0 -0
- package/dashboard/public/assets/furniture/blinds_large_closed_white.png +0 -0
- package/dashboard/public/assets/furniture/bookshelf.png +0 -0
- package/dashboard/public/assets/furniture/bookshelf_purple_tall.png +0 -0
- package/dashboard/public/assets/furniture/bulletin_board.png +0 -0
- package/dashboard/public/assets/furniture/clock.png +0 -0
- package/dashboard/public/assets/furniture/coffee_mug.png +0 -0
- package/dashboard/public/assets/furniture/coffee_mug_blue.png +0 -0
- package/dashboard/public/assets/furniture/coffee_table.png +0 -0
- package/dashboard/public/assets/furniture/coffeepot_right.png +0 -0
- package/dashboard/public/assets/furniture/coffeetable_black_horizontal.png +0 -0
- package/dashboard/public/assets/furniture/couch.png +0 -0
- package/dashboard/public/assets/furniture/couch_tan_down.png +0 -0
- package/dashboard/public/assets/furniture/cushion_blue.png +0 -0
- package/dashboard/public/assets/furniture/cushion_tan.png +0 -0
- package/dashboard/public/assets/furniture/desk_wood.png +0 -0
- package/dashboard/public/assets/furniture/fancy_rug.png +0 -0
- package/dashboard/public/assets/furniture/fancy_rug_wide.png +0 -0
- package/dashboard/public/assets/furniture/flowers1.png +0 -0
- package/dashboard/public/assets/furniture/flowers2.png +0 -0
- package/dashboard/public/assets/furniture/lamp_tan.png +0 -0
- package/dashboard/public/assets/furniture/lantern.png +0 -0
- package/dashboard/public/assets/furniture/monstera.png +0 -0
- package/dashboard/public/assets/furniture/monstera_small.png +0 -0
- package/dashboard/public/assets/furniture/picture_frame.png +0 -0
- package/dashboard/public/assets/furniture/plant1.png +0 -0
- package/dashboard/public/assets/furniture/plant2.png +0 -0
- package/dashboard/public/assets/furniture/plant3.png +0 -0
- package/dashboard/public/assets/furniture/plant_poof.png +0 -0
- package/dashboard/public/assets/furniture/plant_spindly.png +0 -0
- package/dashboard/public/assets/furniture/poster_blue.png +0 -0
- package/dashboard/public/assets/furniture/rug.png +0 -0
- package/dashboard/public/assets/furniture/succulent_blue.png +0 -0
- package/dashboard/public/assets/furniture/succulent_green.png +0 -0
- package/dashboard/public/assets/furniture/treasurechest_closed_gold.png +0 -0
- package/dashboard/public/assets/furniture/water_cooler_better.png +0 -0
- package/dashboard/public/assets/furniture/whiteboard.png +0 -0
- package/dashboard/public/assets/furniture/whiteboard_stand_graph.png +0 -0
- package/dashboard/public/assets/furniture/window_blinds_open.png +0 -0
- package/dashboard/src/App.tsx +46 -0
- package/dashboard/src/components/RunDashboardButton.tsx +92 -0
- package/dashboard/src/components/SquadCard.tsx +49 -0
- package/dashboard/src/components/SquadSelector.tsx +67 -0
- package/dashboard/src/components/StatusBadge.tsx +32 -0
- package/dashboard/src/components/StatusBar.tsx +116 -0
- package/dashboard/src/hooks/useSquadSocket.ts +135 -0
- package/dashboard/src/lib/formatTime.ts +16 -0
- package/dashboard/src/lib/normalizeState.ts +25 -0
- package/dashboard/src/main.tsx +10 -0
- package/dashboard/src/office/AgentSprite.ts +241 -0
- package/dashboard/src/office/OfficeScene.ts +153 -0
- package/dashboard/src/office/PhaserGame.tsx +80 -0
- package/dashboard/src/office/RoomBuilder.ts +190 -0
- package/dashboard/src/office/assetKeys.ts +150 -0
- package/dashboard/src/office/palette.ts +32 -0
- package/dashboard/src/plugin/squadWatcher.ts +397 -0
- package/dashboard/src/store/useSquadStore.ts +56 -0
- package/dashboard/src/styles/globals.css +36 -0
- package/dashboard/src/types/state.ts +63 -0
- package/dashboard/src/vite-env.d.ts +1 -0
- package/dashboard/tsconfig.json +24 -0
- package/dashboard/vite.config.ts +13 -0
- package/package.json +59 -0
- package/public/sfx/slide-transition-sfx.mp3 +0 -0
- package/skills/README.md +84 -0
- package/skills/apify/SKILL.md +55 -0
- package/skills/blotato/SKILL.md +63 -0
- package/skills/canva/SKILL.md +60 -0
- package/skills/higgsfield/SKILL.md +147 -0
- package/skills/image-ai-generator/SKILL.md +124 -0
- package/skills/image-ai-generator/scripts/generate.py +175 -0
- package/skills/image-creator/SKILL.md +166 -0
- package/skills/image-creator/editorial-slide-template.js +645 -0
- package/skills/image-fetcher/SKILL.md +91 -0
- package/skills/imgbb-uploader/SKILL.md +73 -0
- package/skills/imgbb-uploader/scripts/upload.js +125 -0
- package/skills/instagram-publisher/README.md +36 -0
- package/skills/instagram-publisher/SKILL.md +231 -0
- package/skills/instagram-publisher/scripts/publish-playwright.js +418 -0
- package/skills/instagram-publisher/scripts/publish.js +521 -0
- package/skills/opensquad-agent-creator/SKILL.md +192 -0
- package/skills/opensquad-skill-creator/SKILL.md +420 -0
- package/skills/opensquad-skill-creator/agents/analyzer.md +274 -0
- package/skills/opensquad-skill-creator/agents/comparator.md +202 -0
- package/skills/opensquad-skill-creator/agents/grader.md +223 -0
- package/skills/opensquad-skill-creator/assets/eval_review.html +146 -0
- package/skills/opensquad-skill-creator/eval-viewer/generate_review.py +471 -0
- package/skills/opensquad-skill-creator/eval-viewer/viewer.html +1325 -0
- package/skills/opensquad-skill-creator/references/schemas.md +430 -0
- package/skills/opensquad-skill-creator/references/skill-format.md +235 -0
- package/skills/opensquad-skill-creator/scripts/__init__.py +0 -0
- package/skills/opensquad-skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/skills/opensquad-skill-creator/scripts/quick_validate.py +103 -0
- package/skills/opensquad-skill-creator/scripts/run_eval.py +310 -0
- package/skills/opensquad-skill-creator/scripts/utils.py +47 -0
- package/skills/pdf-extractor/SKILL.md +57 -0
- package/skills/pdf-extractor/scripts/extract.py +82 -0
- package/skills/resend/SKILL.md +80 -0
- package/skills/run-dashboard/README.md +93 -0
- package/skills/run-dashboard/SKILL.md +173 -0
- package/skills/run-dashboard/scripts/finalize-state.js +273 -0
- package/skills/run-dashboard/scripts/generate.js +1296 -0
- package/skills/run-dashboard/scripts/serve.js +135 -0
- package/skills/run-dashboard/templates/run-dashboard-simple.template.html +191 -0
- package/skills/run-dashboard/templates/run-dashboard.template.html +1164 -0
- package/skills/smtp-sender/SKILL.md +88 -0
- package/skills/smtp-sender/scripts/send.js +478 -0
- package/skills/template-designer/SKILL.md +201 -0
- package/skills/template-designer/base-templates/model-a.html +27 -0
- package/skills/template-designer/base-templates/model-b.html +31 -0
- package/skills/template-designer/base-templates/model-c.html +42 -0
- package/skills/youtube-publisher/SKILL.md +232 -0
- package/skills/youtube-publisher/scripts/publish.js +2078 -0
- package/src/agents-cli.js +158 -0
- package/src/agents.js +134 -0
- package/src/i18n.js +48 -0
- package/src/init.js +442 -0
- package/src/locales/en.json +79 -0
- package/src/locales/es.json +78 -0
- package/src/locales/pt-BR.json +78 -0
- package/src/logger.js +38 -0
- package/src/prompt.js +46 -0
- package/src/readme/README.md +146 -0
- package/src/runs.js +318 -0
- package/src/skills-cli.js +157 -0
- package/src/skills.js +146 -0
- package/src/supabase-cli.js +584 -0
- package/src/update.js +169 -0
- package/templates/_opensquad/.opensquad-version +1 -0
- package/templates/_opensquad/_investigations/.gitkeep +0 -0
- package/templates/ide-templates/antigravity/.agent/rules/opensquad.md +68 -0
- package/templates/ide-templates/antigravity/.agent/workflows/opensquad.md +102 -0
- package/templates/ide-templates/claude-code/.claude/skills/opensquad/SKILL.md +182 -0
- package/templates/ide-templates/claude-code/.mcp.json +8 -0
- package/templates/ide-templates/claude-code/CLAUDE.md +57 -0
- package/templates/ide-templates/codex/.agents/skills/opensquad/SKILL.md +6 -0
- package/templates/ide-templates/codex/AGENTS.md +120 -0
- package/templates/ide-templates/cursor/.cursor/commands/opensquad.md +9 -0
- package/templates/ide-templates/cursor/.cursor/mcp.json +8 -0
- package/templates/ide-templates/cursor/.cursor/rules/opensquad.mdc +62 -0
- package/templates/ide-templates/cursor/.cursorignore +3 -0
- package/templates/ide-templates/gemini-cli/.gemini/settings.json +8 -0
- package/templates/ide-templates/gemini-cli/.gemini/skills/opensquad/SKILL.md +186 -0
- package/templates/ide-templates/gemini-cli/GEMINI.md +57 -0
- package/templates/ide-templates/opencode/.opencode/commands/opensquad.md +9 -0
- package/templates/ide-templates/opencode/AGENTS.md +120 -0
- package/templates/ide-templates/qwen-code/.qwen/settings.json +8 -0
- package/templates/ide-templates/qwen-code/.qwen/skills/opensquad/SKILL.md +182 -0
- package/templates/ide-templates/qwen-code/QWEN.md +57 -0
- package/templates/ide-templates/trae/.trae/mcp.json +8 -0
- package/templates/ide-templates/trae/.trae/rules/opensquad.md +64 -0
- package/templates/ide-templates/vscode-copilot/.github/copilot-instructions.md +59 -0
- package/templates/ide-templates/vscode-copilot/.github/prompts/opensquad.prompt.md +209 -0
- package/templates/ide-templates/vscode-copilot/.vscode/mcp.json +8 -0
- package/templates/ide-templates/vscode-copilot/.vscode/settings.json +3 -0
- package/templates/package.json +8 -0
- package/templates/squads/.gitkeep +0 -0
|
@@ -0,0 +1,743 @@
|
|
|
1
|
+
# Opensquad Pipeline Runner
|
|
2
|
+
|
|
3
|
+
> **SHARED FILE** — applies to ALL IDEs. Do not add IDE-specific logic here.
|
|
4
|
+
> For IDE-specific behavior: `templates/ide-templates/{ide}/` only.
|
|
5
|
+
|
|
6
|
+
You are the Pipeline Runner. Your job is to execute a squad's pipeline step by step.
|
|
7
|
+
|
|
8
|
+
## Initialization
|
|
9
|
+
|
|
10
|
+
Before starting execution:
|
|
11
|
+
|
|
12
|
+
1. You have already loaded:
|
|
13
|
+
- The squad's `squad.yaml` (passed to you by the Opensquad skill)
|
|
14
|
+
- The squad's `squad-party.csv` (all agent personas)
|
|
15
|
+
- Company context from `_opensquad/_memory/company.md`
|
|
16
|
+
- Squad memory from `squads/{name}/_memory/memories.md`
|
|
17
|
+
|
|
18
|
+
1b. **Memory format migration** — After loading `memories.md`, check whether it uses the new format by scanning for the `## Estilo de Escrita` section header:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
[ -f squads/{name}/_memory/memories.md ] && grep -q "## Estilo de Escrita" squads/{name}/_memory/memories.md && echo "NEW_FORMAT" || echo "OLD_FORMAT"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- If `NEW_FORMAT` → proceed normally.
|
|
25
|
+
- If `OLD_FORMAT` (or file is empty / does not exist) → silently migrate before proceeding:
|
|
26
|
+
a. Write `squads/{name}/_memory/memories.md` with the new empty-sections format (do NOT attempt to salvage content from the old file — reset unconditionally):
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
# Squad Memory: {squad-name}
|
|
30
|
+
|
|
31
|
+
## Estilo de Escrita
|
|
32
|
+
|
|
33
|
+
## Design Visual
|
|
34
|
+
|
|
35
|
+
## Estrutura de Conteúdo
|
|
36
|
+
|
|
37
|
+
## Proibições Explícitas
|
|
38
|
+
|
|
39
|
+
## Técnico (específico do squad)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
(Use the squad's display name for `{squad-name}`, and the squad code for `{name}` in file paths — they refer to the same squad.)
|
|
43
|
+
b. Check if `squads/{name}/_memory/runs.md` exists:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
test -f squads/{name}/_memory/runs.md && echo "EXISTS" || echo "MISSING"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
If `MISSING`, create it with:
|
|
50
|
+
|
|
51
|
+
```markdown
|
|
52
|
+
# Run History: {squad-name}
|
|
53
|
+
|
|
54
|
+
| Data | Run ID | Tema | Output | Resultado |
|
|
55
|
+
|------|--------|------|--------|-----------|
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- Do NOT inform the user or pause execution for this migration — it is transparent.
|
|
59
|
+
|
|
60
|
+
1. Read `squads/{name}/pipeline/pipeline.yaml` for the pipeline definition
|
|
61
|
+
2. **Resolve skills**: Read `squad.yaml` → `skills` section. For each non-native skill (anything other than web_search, web_fetch):
|
|
62
|
+
a. Verify `skills/{skill}/SKILL.md` exists
|
|
63
|
+
- If missing → ask user: "Skill '{skill}' is not installed. Install now? (y/n)"
|
|
64
|
+
- If yes → read `_opensquad/core/skills.engine.md`, follow Operation 2 (Install)
|
|
65
|
+
- If no → **ERROR**: stop pipeline
|
|
66
|
+
b. Read SKILL.md, parse frontmatter for type
|
|
67
|
+
c. If type: mcp, verify MCP is configured in `.claude/settings.local.json`
|
|
68
|
+
- If missing → **ERROR**: "Skill '{skill}' MCP not configured. Reinstall the skill."
|
|
69
|
+
All skills must resolve successfully before the pipeline starts (fail fast).
|
|
70
|
+
3. **Model tiers**: Individual steps declare their own `model_tier` in their frontmatter (`fast` or `powerful`), set by the Architect at squad creation time.
|
|
71
|
+
- If the file exists: read and note the tier values for reference.
|
|
72
|
+
- If the file doesn't exist: ignore silently — all steps default to `powerful` at dispatch.
|
|
73
|
+
4. Inform the user that the squad is starting:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
77
|
+
🚀 Running squad: {squad name}
|
|
78
|
+
📋 Pipeline: {number of steps} steps
|
|
79
|
+
🤖 Agents: {list agent names with icons}
|
|
80
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
5b. **Initialize run folder**: Generate a unique run ID for this execution:
|
|
84
|
+
|
|
85
|
+
- Format: `YYYY-MM-DD-HHmmss` using the current timestamp (e.g. `2026-03-03-143022`)
|
|
86
|
+
- Check if `squads/{name}/output/{run_id}/` already exists
|
|
87
|
+
- If it does (sub-second collision), append `-2`, `-3`, etc. until the folder does not exist
|
|
88
|
+
- Create the folder using Bash: `mkdir -p squads/{name}/output/{run_id}`
|
|
89
|
+
- Store `run_id` in working memory for this run — it will be used for ALL output paths
|
|
90
|
+
- **Source-of-truth rule**: This file is the execution contract. If a local CLI wrapper, menu entry, or shell alias does not reliably drive the full run end-to-end, continue by following this pipeline document directly instead of treating the CLI mismatch as a blocker.
|
|
91
|
+
|
|
92
|
+
1. **Initialize state.json**: Create `squads/{name}/state.json` from scratch (see below). State writes are always mandatory.
|
|
93
|
+
- **IMPORTANT**: You MUST write to `squads/{name}/state.json` before every step and after every handoff. This is non-negotiable. Never skip these writes.
|
|
94
|
+
- **Resume/manual execution rule**: If you resume an interrupted run or execute the pipeline manually from an existing `output/{run_id}` folder, reconstruct or update `squads/{name}/state.json` immediately before continuing. Never defer state reconstruction until the dashboard step.
|
|
95
|
+
- For interrupted runs, read `_opensquad/core/best-practices/run-recovery.md` and follow that deterministic checklist before resuming publication or dashboard closure.
|
|
96
|
+
- Create `state.json` from scratch:
|
|
97
|
+
a. Read `squads/{name}/squad-party.csv` — for each agent row (skip header), extract:
|
|
98
|
+
- `id`: take the `path` column, strip `./agents/` prefix and `.agent.md` suffix
|
|
99
|
+
(e.g. `./agents/researcher.agent.md` → `researcher`)
|
|
100
|
+
- `name`: use the `displayName` column
|
|
101
|
+
- `icon`: use the `icon` column
|
|
102
|
+
b. Assign desk positions by agent order (0-based index):
|
|
103
|
+
- `col = (index % 3) + 1`
|
|
104
|
+
- `row = floor(index / 3) + 1`
|
|
105
|
+
(index 0 → col:1 row:1, index 1 → col:2 row:1, index 2 → col:3 row:1, index 3 → col:1 row:2, etc.)
|
|
106
|
+
c. Read `squads/{name}/squad.yaml` — count items in `pipeline.steps` for `total`
|
|
107
|
+
d. **Environment Selection**: Ask the user (via AskUserQuestion or numbered options) to select the active environment:
|
|
108
|
+
1. Claude Code (`claude-code`)
|
|
109
|
+
2. VSCode + GitHub Copilot Pro (`vscode-copilot`)
|
|
110
|
+
3. Google Antigravity (`antigravity`)
|
|
111
|
+
4. Codex (`codex`)
|
|
112
|
+
5. OpenCode (`opencode`)
|
|
113
|
+
|
|
114
|
+
Store this selection as `environment` in working memory and write it to `state.json`.
|
|
115
|
+
e. Write `squads/{name}/state.json` with the Write tool:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"squad": "{squad code from squad.yaml}",
|
|
120
|
+
"status": "idle",
|
|
121
|
+
"environment": "{environment}",
|
|
122
|
+
"step": { "current": 0, "total": {step count from c}, "label": "" },
|
|
123
|
+
"agents": [
|
|
124
|
+
{
|
|
125
|
+
"id": "{agent id}",
|
|
126
|
+
"name": "{agent displayName}",
|
|
127
|
+
"icon": "{agent icon}",
|
|
128
|
+
"status": "idle",
|
|
129
|
+
"desk": { "col": {col from b}, "row": {row from b} }
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"handoff": null,
|
|
133
|
+
"startedAt": null,
|
|
134
|
+
"updatedAt": "{ISO timestamp now}"
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Include one entry per agent, in squad-party.csv order.
|
|
139
|
+
|
|
140
|
+
- **Optional Supabase mirror**: If `.env` sets `OS_SUPABASE_MODE=mirror`, mirror the current run state after the run folder exists and after each meaningful `state.json` update:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
node --env-file=.env bin/opensquad.js supabase mirror --squad "{name}" --run-id "{run_id}"
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Supabase mirror is best-effort in this phase. If the command fails because Supabase is not configured, unavailable, or migrations have not been applied, warn briefly and continue the local filesystem pipeline. Never let mirror failure replace the mandatory local `state.json` and output validation gates.
|
|
147
|
+
|
|
148
|
+
## Execution Rules
|
|
149
|
+
|
|
150
|
+
### Agent Loading (for inline and subagent steps)
|
|
151
|
+
|
|
152
|
+
Before executing any step that references an agent:
|
|
153
|
+
|
|
154
|
+
1. Read the agent's row from squad-party.csv for quick persona reference
|
|
155
|
+
2. Read the FULL agent file from the squad's agents/ directory (path comes from squad-party.csv)
|
|
156
|
+
- The file uses YAML frontmatter for metadata and markdown body for depth
|
|
157
|
+
- The markdown body contains: Operational Framework, Output Examples, Anti-Patterns, Voice Guidance
|
|
158
|
+
- All agents are complete `.agent.md` files with full definitions — no overlay resolution needed
|
|
159
|
+
3. When executing the step, the agent's full definition informs behavior:
|
|
160
|
+
- Follow the Operational Framework's process steps
|
|
161
|
+
- Use Output Examples as quality reference
|
|
162
|
+
- Avoid Anti-Patterns listed in the agent definition
|
|
163
|
+
- Apply Voice Guidance (vocabulary always/never use, tone rules)
|
|
164
|
+
4. **Inject format context**: Check if the current step's frontmatter contains a `format:` field.
|
|
165
|
+
If present:
|
|
166
|
+
a. Read `_opensquad/core/best-practices/{format}.md` (e.g., `_opensquad/core/best-practices/instagram-feed.md`)
|
|
167
|
+
- If the file does not exist → **WARNING**: "Format '{format}' not found in _opensquad/core/best-practices/. Skipping format injection." Continue without format.
|
|
168
|
+
b. Parse the YAML frontmatter to extract the `name` field
|
|
169
|
+
c. Extract the Markdown body (everything after the YAML frontmatter closing `---`)
|
|
170
|
+
d. Append to the agent's context, before skill instructions:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
--- FORMAT: {name from frontmatter} ---
|
|
174
|
+
|
|
175
|
+
{format file markdown body}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If the step has no `format:` field, skip this step entirely (backward compatible).
|
|
179
|
+
5. **Inject skill instructions**: Check which skills the agent declares in its frontmatter `skills:`.
|
|
180
|
+
For each non-native skill declared:
|
|
181
|
+
a. Read `skills/{skill}/SKILL.md`
|
|
182
|
+
b. Extract the Markdown body (everything after the YAML frontmatter closing `---`)
|
|
183
|
+
c. Append to the agent's context, after format injection:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
--- SKILL INSTRUCTIONS ---
|
|
187
|
+
|
|
188
|
+
## {name from frontmatter}
|
|
189
|
+
{SKILL.md markdown body}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
d. Follow declaration order in the agent's frontmatter for multi-skill injection
|
|
193
|
+
|
|
194
|
+
The final agent context composition order is:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
Agent (.agent.md) → Platform Best Practices → Skill Instructions
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Task-Based Agent Execution
|
|
201
|
+
|
|
202
|
+
When an agent's `.agent.md` frontmatter contains a `tasks:` field:
|
|
203
|
+
|
|
204
|
+
1. **Load task list**: Read the `tasks:` array from the agent's frontmatter
|
|
205
|
+
- Each entry is a relative path to a task file (e.g., `tasks/analyze-source.md`)
|
|
206
|
+
- Tasks execute in the order listed
|
|
207
|
+
|
|
208
|
+
2. **For each task in sequence**:
|
|
209
|
+
a. Read the task file from the agent's directory (e.g., `squads/{squad-name}/agents/{agent}/tasks/{task}.md`)
|
|
210
|
+
b. Construct the execution prompt:
|
|
211
|
+
- Agent persona + principles (from agent.md — fixed across all tasks)
|
|
212
|
+
- Task description and process (from task file)
|
|
213
|
+
- Task output format (from task file)
|
|
214
|
+
- Task quality criteria and veto conditions (from task file)
|
|
215
|
+
- Input: For the first task, use the step's input. For subsequent tasks, use the previous task's output.
|
|
216
|
+
c. Execute the task (inline or subagent, matching the step's execution mode)
|
|
217
|
+
d. Collect the task output
|
|
218
|
+
e. Check task veto conditions (same enforcement as step veto conditions below)
|
|
219
|
+
|
|
220
|
+
3. **Final output**: The output of the LAST task in the chain becomes the step's output
|
|
221
|
+
- Apply the Output Path Transformation (Steps 1 and 2: run_id injection + version folder) to the `outputFile` path before saving — this applies regardless of whether the step runs as `execution: inline` or `execution: subagent`
|
|
222
|
+
- Save to the **transformed** outputFile path
|
|
223
|
+
- This is what the next step (or checkpoint) receives
|
|
224
|
+
|
|
225
|
+
4. **Progress reporting**: For inline execution, announce each task:
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
{icon} {Agent Name} — Task {N}/{total}: {task name}...
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
5. **Backward compatibility**: If the agent's frontmatter does NOT contain a `tasks:` field,
|
|
232
|
+
execute the agent monolithically as before (current behavior unchanged).
|
|
233
|
+
|
|
234
|
+
### Output Path Transformation
|
|
235
|
+
|
|
236
|
+
Before saving any output file in a step, apply these rules to determine the final path:
|
|
237
|
+
|
|
238
|
+
#### Step 1 — Insert run_id
|
|
239
|
+
|
|
240
|
+
- If the path starts with `squads/{name}/output/`, insert `{run_id}/` immediately after `output/`
|
|
241
|
+
- Example: `squads/carousel/output/slides/draft.md` → `squads/carousel/output/2026-03-03-143022/slides/draft.md`
|
|
242
|
+
- Example: `squads/carousel/output/angles-brief.yaml` → `squads/carousel/output/2026-03-03-143022/angles-brief.yaml`
|
|
243
|
+
- If the path does NOT start with `squads/{name}/output/`, leave it unchanged
|
|
244
|
+
|
|
245
|
+
#### Step 2 — Insert version folder
|
|
246
|
+
|
|
247
|
+
Apply to every path that was transformed in Step 1:
|
|
248
|
+
|
|
249
|
+
1. Determine the **output group** = the parent directory of the file (after Step 1 transformation)
|
|
250
|
+
- Example: `squads/carousel/output/2026-03-03-143022/slides/draft.md` → group is `squads/carousel/output/2026-03-03-143022/slides/`
|
|
251
|
+
- Example: `squads/carousel/output/2026-03-03-143022/angles-brief.yaml` → group is `squads/carousel/output/2026-03-03-143022/`
|
|
252
|
+
|
|
253
|
+
2. Detect existing versions for this group using Bash:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
ls -1 squads/{name}/output/{run_id}/{relative-group}/ 2>/dev/null | grep -E '^v[0-9]+$' | sort -V | tail -1
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
- If the command returns a version (e.g. `v2`) → use `v3`
|
|
260
|
+
(Always increment the highest version found, even if lower versions have gaps — e.g. if `v1` and `v3` exist, use `v4`)
|
|
261
|
+
- If the command returns nothing (no versions yet) → use `v1`
|
|
262
|
+
(`{relative-group}` is the portion of the group path after `squads/{name}/output/{run_id}/`, e.g. `slides/` or empty string for root-level files)
|
|
263
|
+
|
|
264
|
+
3. Insert the version folder immediately before the filename:
|
|
265
|
+
- `squads/carousel/output/2026-03-03-143022/slides/draft.md` → `squads/carousel/output/2026-03-03-143022/slides/v1/draft.md`
|
|
266
|
+
- `squads/carousel/output/2026-03-03-143022/angles-brief.yaml` → `squads/carousel/output/2026-03-03-143022/v1/angles-brief.yaml`
|
|
267
|
+
|
|
268
|
+
4. **Cache per group**: within a single step execution, once a version is determined for a group, reuse it for all subsequent files in that same group. Do not re-run the `ls` per file.
|
|
269
|
+
If the same file path is written twice within a step, both writes go to the same versioned path (the second write overwrites the first within that version).
|
|
270
|
+
|
|
271
|
+
#### Step 3 — Canonical Root Copy (Mirroring)
|
|
272
|
+
|
|
273
|
+
Every time you write a file to a versioned path (the result of Step 2), you MUST also silently write an exact copy of that same content to the **unversioned root** of its group (the path that existed at the end of Step 1).
|
|
274
|
+
- Example: se você salvar `squads/carousel/output/2026-03-03-143022/slides/v3/draft.md`, DEVE TAMBÉM sobrescrever `squads/carousel/output/2026-03-03-143022/slides/draft.md`.
|
|
275
|
+
- Example: se você salvar `squads/carousel/output/2026-03-03-143022/v2/publish-result.md`, DEVE TAMBÉM sobrescrever `squads/carousel/output/2026-03-03-143022/publish-result.md`.
|
|
276
|
+
|
|
277
|
+
This dual-write rule ensures that the `vX` folders preserve the history of iterations (vital for review loops), while external scripts and dashboard generators can always reliably find the single *latest* source of truth at the unversioned root without scanning.
|
|
278
|
+
|
|
279
|
+
Apply this transformation (Steps 1, 2, and 3) consistently for every write in this step.
|
|
280
|
+
|
|
281
|
+
### For each pipeline step
|
|
282
|
+
|
|
283
|
+
0. **Update dashboard** — MANDATORY. Write `squads/{name}/state.json` using the Write tool. Always write — it is never wrong to update the dashboard. Use this content:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"squad": "{squad code from squad.yaml}",
|
|
288
|
+
"status": "running",
|
|
289
|
+
"step": {
|
|
290
|
+
"current": {1-based index of this step},
|
|
291
|
+
"total": {total steps in pipeline},
|
|
292
|
+
"label": "{step id or label}"
|
|
293
|
+
},
|
|
294
|
+
"agents": [
|
|
295
|
+
{
|
|
296
|
+
"id": "{agent id}",
|
|
297
|
+
"name": "{agent displayName}",
|
|
298
|
+
"icon": "{agent icon}",
|
|
299
|
+
"status": "{working if this is the current step's agent, done if already completed, idle otherwise}",
|
|
300
|
+
"desk": {preserve existing desk positions from state.json — do not change col/row}
|
|
301
|
+
}
|
|
302
|
+
],
|
|
303
|
+
"handoff": {preserve existing handoff object, or null if this is the first step},
|
|
304
|
+
"startedAt": "{ISO timestamp — set on the first step only, then preserve from existing state.json on subsequent steps}",
|
|
305
|
+
"updatedAt": "{ISO timestamp now}"
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
1. **Pre-Step Input Validation** — MANDATORY. If the step's frontmatter declares an `inputFile`, validate that the input exists before executing the step. Run via Bash tool:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
test -s "{transformed inputFile path}" && echo "VALIDATION:PASS" || echo "VALIDATION:FAIL"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
- Apply the Output Path Transformation (Step 1: run_id injection) to the `inputFile` path before running the check.
|
|
316
|
+
- If the Bash output contains `VALIDATION:PASS` → proceed to execute the step.
|
|
317
|
+
- If the Bash output contains `VALIDATION:FAIL` → do NOT execute the step. Present to user:
|
|
318
|
+
|
|
319
|
+
```
|
|
320
|
+
⚠️ Input for {Agent Name} not found: {path}
|
|
321
|
+
The previous step may have failed to produce output.
|
|
322
|
+
|
|
323
|
+
1. Skip step and continue
|
|
324
|
+
2. Abort pipeline
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Wait for user choice before proceeding. No retry — if the input doesn't exist, re-executing this step won't create it. The problem is upstream.
|
|
328
|
+
- If the step does not declare an `inputFile` → skip this validation entirely.
|
|
329
|
+
- If the step declares a `contextFiles:` array, validate EACH companion path the same way after applying Output Path Transformation Step 1. These are required supporting inputs for the step, not optional references.
|
|
330
|
+
- If any `contextFiles` entry fails validation, stop before execution and present the missing path to the user exactly like a missing `inputFile`.
|
|
331
|
+
- If the step is a checkpoint, skip `inputFile` validation only. Checkpoints may still declare `contextFiles` and `requiredArtifacts` as mandatory preconditions for review.
|
|
332
|
+
- If a checkpoint step declares `requiredArtifacts:`, validate EACH artifact path after applying Output Path Transformation Step 1 only (run_id injection). Treat missing checkpoint artifacts exactly like missing companion inputs and stop before presenting the checkpoint.
|
|
333
|
+
|
|
334
|
+
2. **Read the step file** completely: `squads/{name}/pipeline/steps/{step-file}.md`
|
|
335
|
+
2b. **Environment Override**: Read the `"environment"` field from `squads/{name}/state.json`.
|
|
336
|
+
- If `environment` is `vscode-copilot`, `antigravity`, `codex`, or `opencode`: force the execution mode to `inline` (override any `execution: subagent` setting).
|
|
337
|
+
- For `codex`, preserve all Claude-derived orchestration principles (JIT context loading, binary validation gates, veto checks, checkpoints, state writes, handoffs, memory updates, cleanup, and dashboard generation). The platform-specific adaptation is that agent work runs sequentially inline with explicit persona switches whenever Claude-style background Task/subagent dispatch is not available.
|
|
338
|
+
- Otherwise, respect the step's declared execution mode.
|
|
339
|
+
3. **Check execution mode** from the step's frontmatter (or the override value):
|
|
340
|
+
|
|
341
|
+
#### If `execution: subagent`
|
|
342
|
+
|
|
343
|
+
- Inform user: `🔍 {Agent Name} is working in the background...`
|
|
344
|
+
- Read the step's `model_tier` frontmatter field (if present).
|
|
345
|
+
Valid values: `fast` or `powerful`. If absent or any other value: default to `powerful`.
|
|
346
|
+
- **Before building the subagent prompt**: Apply the Output Path Transformation (Step 1: run_id injection + Step 2: version folder) to all output paths referenced in the step file. Store the transformed path(s) in working memory — they will be used both in the prompt and in post-completion verification. Never pass raw paths from the step file to the subagent.
|
|
347
|
+
- Use the Task tool to dispatch the step as a subagent:
|
|
348
|
+
- If `model_tier: fast`: use the fastest/lightest model available in your current IDE.
|
|
349
|
+
- If `model_tier: powerful` or absent/invalid: use the default model (no model override needed)
|
|
350
|
+
- In the Task prompt, include:
|
|
351
|
+
- The full agent persona from the party CSV
|
|
352
|
+
- The full agent `.agent.md` content (persona, principles, voice guidance, anti-patterns)
|
|
353
|
+
- If the agent has tasks: include ALL task files in order with instructions to execute sequentially, piping output from each task to the next
|
|
354
|
+
- If the agent has no tasks: include the step instructions and operational framework as before
|
|
355
|
+
- The transformed `inputFile` path and every transformed `contextFiles` path declared by the step
|
|
356
|
+
- Every `requiredArtifacts` path declared by the step, treated as mandatory post-step deliverables
|
|
357
|
+
- The veto conditions from the step file (agent should self-check before completing)
|
|
358
|
+
- The company context
|
|
359
|
+
- The squad memory
|
|
360
|
+
- The **transformed** path to save output (e.g., `squads/{name}/output/2026-03-20-140736/slides/v1/draft.md`)
|
|
361
|
+
- Wait for the subagent to complete
|
|
362
|
+
- Inform user: `✓ {Agent Name} completed`
|
|
363
|
+
- Proceed to Post-Step Output Validation (below) before advancing.
|
|
364
|
+
|
|
365
|
+
#### If `execution: inline`
|
|
366
|
+
|
|
367
|
+
- Switch to the agent's persona (read from party CSV)
|
|
368
|
+
- Announce: `{icon} {Agent Name} is working...`
|
|
369
|
+
- Read the transformed `inputFile` and all transformed `contextFiles` declared by the step before following the step instructions
|
|
370
|
+
- Treat every `requiredArtifacts` path declared by the step as mandatory before concluding the step
|
|
371
|
+
- Follow the step instructions
|
|
372
|
+
- Present output directly in the conversation
|
|
373
|
+
- Save output to the specified output file — apply the Output Path Transformation (Steps 1 and 2) to the path before writing. Do not write to the raw path from the step file.
|
|
374
|
+
- Proceed to Post-Step Output Validation (below) before advancing.
|
|
375
|
+
|
|
376
|
+
#### If `type: checkpoint`
|
|
377
|
+
|
|
378
|
+
- Read any declared `contextFiles` and verify any declared `requiredArtifacts` before presenting the checkpoint.
|
|
379
|
+
- Present the checkpoint message to the user
|
|
380
|
+
- If the checkpoint requires a choice (numbered list), present options as a numbered list
|
|
381
|
+
- **Always include the file path** of any generated content the user needs to review. Example: "Review the content at `squads/{name}/output/{run_id}/v1/content.md` and let me know if it looks good."
|
|
382
|
+
- Wait for user input before proceeding
|
|
383
|
+
- Save the user's choice/response for the next step
|
|
384
|
+
- **If the step frontmatter contains `outputFile`**: after collecting the user's full response,
|
|
385
|
+
apply the Output Path Transformation **Step 1 only** (run_id injection — skip Step 2, version folder) to the `outputFile` path, then write the response to the transformed path using the Write tool before moving to the next step. Checkpoint files are user input captures, not versioned output — Step 2 does not apply here, regardless of the general "every write" rule in the Output Path Transformation section above.
|
|
386
|
+
Use this format:
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
# Research Focus
|
|
390
|
+
|
|
391
|
+
**Topic:** {user's typed topic}
|
|
392
|
+
**Time Range:** {selected time range label, e.g., "Últimos 7 dias"}
|
|
393
|
+
**Date:** {today's date in YYYY-MM-DD format}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
This file is the `inputFile` for the researcher step that follows.
|
|
397
|
+
|
|
398
|
+
### Post-Step Output Validation
|
|
399
|
+
|
|
400
|
+
After a step produces output (subagent or inline) and BEFORE Veto Condition Enforcement, the runner MUST validate that the declared output files exist and are non-empty. This is a binary, non-negotiable gate — the runner does NOT proceed on memory or assumption, only on bash output.
|
|
401
|
+
|
|
402
|
+
**If the step declares an `outputFile`** (single or multiple), run via Bash tool for EACH output file:
|
|
403
|
+
|
|
404
|
+
```bash
|
|
405
|
+
test -s "{transformed outputFile path}" && echo "VALIDATION:PASS" || echo "VALIDATION:FAIL"
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
Use the **stored transformed path** (after Output Path Transformation Steps 1 and 2), not the raw path from the step file.
|
|
409
|
+
|
|
410
|
+
**If the step declares a `requiredArtifacts:` array**, validate EACH artifact path after applying Output Path Transformation Step 1 only (run_id injection; do not add a version folder unless the artifact path itself already includes one). These are supporting files created alongside the canonical `outputFile`, such as rendered images, HTMLs, or scripts.
|
|
411
|
+
|
|
412
|
+
```bash
|
|
413
|
+
test -s "{transformed requiredArtifact path}" && echo "VALIDATION:PASS" || echo "VALIDATION:FAIL"
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**Rules:**
|
|
417
|
+
|
|
418
|
+
- If ALL declared output files and required artifacts return `VALIDATION:PASS` → proceed to Veto Condition Enforcement.
|
|
419
|
+
- If ANY declared output file or required artifact returns `VALIDATION:FAIL`:
|
|
420
|
+
1. **Retry once**: re-execute the entire step with the same input and context.
|
|
421
|
+
2. After re-execution, run the validation again for all declared outputs and required artifacts.
|
|
422
|
+
3. If second attempt returns `VALIDATION:PASS` for all files → proceed normally.
|
|
423
|
+
4. If second attempt still has ANY `VALIDATION:FAIL` → present to user:
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
⚠️ {Agent Name}'s output was not generated: {path}
|
|
427
|
+
|
|
428
|
+
1. Retry step
|
|
429
|
+
2. Skip step and continue
|
|
430
|
+
3. Abort pipeline
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
Wait for user choice before proceeding.
|
|
434
|
+
- If the step does not declare an `outputFile` and does not declare `requiredArtifacts` (e.g., steps that only produce inline console output) → skip output validation.
|
|
435
|
+
- Checkpoint steps (`type: checkpoint`) are exempt — their output is the user's response, not a file.
|
|
436
|
+
|
|
437
|
+
**IMPORTANT**: Do NOT rely on reading the file with the Read tool to "verify" output. The Read tool returns content that can be misinterpreted. Use ONLY the bash `test -s` command — its output is binary and cannot be hallucinated.
|
|
438
|
+
|
|
439
|
+
### Blocked Research Recovery
|
|
440
|
+
|
|
441
|
+
When a researcher step finishes with a blocked result such as "no credible story found in the selected time range", "briefing blocked", "no approved angle under the requested window", or an equivalent inability to proceed safely:
|
|
442
|
+
|
|
443
|
+
- Do NOT silently widen the time range, invent a story, or continue into angle/copy/render steps as if research had succeeded.
|
|
444
|
+
- Open one unblock checkpoint immediately with these options adapted to the case:
|
|
445
|
+
1. Keep the topic and expand the time window
|
|
446
|
+
2. Keep the time window and pivot the topic/angle
|
|
447
|
+
3. Abort today's run
|
|
448
|
+
- Record the user's decision by appending a short `## Recovery Decision` section to the existing Step 1 checkpoint file for that run before rerunning the blocked researcher step.
|
|
449
|
+
- Only allow a story outside the originally selected window after explicit user approval, and require the next research brief or review output to state that override clearly.
|
|
450
|
+
- If the user declines to expand or pivot, stop the pipeline cleanly instead of forcing a weak or stale topic.
|
|
451
|
+
|
|
452
|
+
### Veto Condition Enforcement
|
|
453
|
+
|
|
454
|
+
After an agent completes a step (before moving to the next step):
|
|
455
|
+
|
|
456
|
+
1. Check if the step file has a `## Veto Conditions` section
|
|
457
|
+
2. If yes, evaluate each veto condition against the agent's output:
|
|
458
|
+
- Read the output that was just produced
|
|
459
|
+
- Check each condition (e.g., "slides exceed 30 words", "no CTA", "missing sources")
|
|
460
|
+
3. If ANY veto condition is triggered:
|
|
461
|
+
- Inform user: "⚠️ {Agent Name}'s output triggered a veto: {condition}"
|
|
462
|
+
- Ask the agent to fix the specific issue (re-execute with targeted correction)
|
|
463
|
+
- Maximum 2 veto fix attempts per step
|
|
464
|
+
- After 2 failed attempts, present to user for manual decision
|
|
465
|
+
4. If no veto conditions triggered: proceed to next step
|
|
466
|
+
|
|
467
|
+
This creates an internal quality loop BEFORE the reviewer sees the content,
|
|
468
|
+
catching obvious issues early and reducing review cycle waste.
|
|
469
|
+
|
|
470
|
+
### Review Loops
|
|
471
|
+
|
|
472
|
+
When a step has `on_reject: {step-id}`:
|
|
473
|
+
|
|
474
|
+
- Track the review cycle count
|
|
475
|
+
- Inspect the reviewer output for an explicit `Return To: {step-id}` field
|
|
476
|
+
- If `Return To` exists and points to a valid earlier step, prefer it over `on_reject`
|
|
477
|
+
- If reviewer rejects and no valid `Return To` exists, go back to the step referenced in `on_reject`
|
|
478
|
+
- Pass reviewer feedback to the writer agent
|
|
479
|
+
- If max_review_cycles reached, present to user for manual decision
|
|
480
|
+
|
|
481
|
+
When the reviewer returns `APROVAR COM AJUSTES` with a valid `Return To`, treat it as a routed repair loop instead of advancing immediately.
|
|
482
|
+
|
|
483
|
+
Routing rules:
|
|
484
|
+
|
|
485
|
+
- `REPROVAR` without `Return To` -> use `on_reject`
|
|
486
|
+
- `REPROVAR` with valid `Return To` -> use `Return To`
|
|
487
|
+
- `APROVAR COM AJUSTES` with valid `Return To` -> loop to that step
|
|
488
|
+
- `APROVAR` or missing routing -> proceed to next step
|
|
489
|
+
|
|
490
|
+
### Dashboard Handoff (between steps)
|
|
491
|
+
|
|
492
|
+
After a step completes output and there IS a next step (MANDATORY):
|
|
493
|
+
|
|
494
|
+
1. **Write delivering state** — Write `squads/{name}/state.json` with:
|
|
495
|
+
- Current step's agent: `"status": "delivering"`
|
|
496
|
+
- Next step's agent: `"status": "idle"`
|
|
497
|
+
- All other agents unchanged
|
|
498
|
+
- Pipeline `"status": "running"`
|
|
499
|
+
- Add or update `"handoff"`:
|
|
500
|
+
|
|
501
|
+
```json
|
|
502
|
+
"handoff": {
|
|
503
|
+
"from": "{current agent id}",
|
|
504
|
+
"to": "{next agent id}",
|
|
505
|
+
"message": "{one-sentence summary of what was produced, written in the user's language}",
|
|
506
|
+
"completedAt": "{ISO timestamp now}"
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
- `"updatedAt"`: now
|
|
511
|
+
|
|
512
|
+
2. _(No delay — proceed immediately to working state)_
|
|
513
|
+
|
|
514
|
+
3. **Write working state** — Write `squads/{name}/state.json` again with:
|
|
515
|
+
- Current agent: `"status": "done"`
|
|
516
|
+
- Next agent: `"status": "working"`
|
|
517
|
+
- Keep the `"handoff"` object from step 1 unchanged
|
|
518
|
+
- `"updatedAt"`: now
|
|
519
|
+
|
|
520
|
+
### Step Execution Order (Summary)
|
|
521
|
+
|
|
522
|
+
For reference, the complete execution order for each pipeline step is:
|
|
523
|
+
|
|
524
|
+
```
|
|
525
|
+
0. Dashboard update (state.json)
|
|
526
|
+
1. Pre-Step Input Validation (bash gate)
|
|
527
|
+
2. Read step file
|
|
528
|
+
3. Check execution mode and execute (subagent / inline / checkpoint)
|
|
529
|
+
4. Post-Step Output Validation (bash gate)
|
|
530
|
+
5. Veto Condition Enforcement
|
|
531
|
+
6. Dashboard Handoff (to next step)
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
Steps 1 and 4 are binary bash gates. If either fails, the pipeline does NOT advance — the user is consulted.
|
|
535
|
+
|
|
536
|
+
### After Pipeline Completion
|
|
537
|
+
|
|
538
|
+
1. Save final output to `squads/{name}/output/{run_id}/{filename}.md`
|
|
539
|
+
(The run folder was created during initialization — no separate date subfolder needed)
|
|
540
|
+
1b. **Update dashboard** — MANDATORY. Write `squads/{name}/state.json` with:
|
|
541
|
+
- `"status": "completed"`
|
|
542
|
+
- All agents: `"status": "done"`
|
|
543
|
+
- `"updatedAt"`: now
|
|
544
|
+
- `"completedAt"`: now
|
|
545
|
+
- `"startedAt"`: preserve from existing `state.json`
|
|
546
|
+
- Keep existing `"handoff"` object
|
|
547
|
+
|
|
548
|
+
### Post-Completion Cleanup
|
|
549
|
+
|
|
550
|
+
After writing the final "completed" state to `squads/{name}/state.json`:
|
|
551
|
+
|
|
552
|
+
1. Add the `completedAt` field (or `failedAt` if status is `failed`) with the current ISO timestamp
|
|
553
|
+
2. Copy `state.json` to the run output folder for permanent history:
|
|
554
|
+
|
|
555
|
+
```bash
|
|
556
|
+
cp squads/{name}/state.json squads/{name}/output/{run_id}/state.json
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
This copy is mandatory even for resumed/manual runs that did not start through `/opensquad run`. Before regenerating `publish-result.md`, newsletter artifacts, `run-dashboard.html`, or static dashboard snapshots, ensure `squads/{name}/output/{run_id}/state.json` exists and already contains the final run status.
|
|
560
|
+
|
|
561
|
+
3. Archive older run folders so only the current run stays active in `output/`:
|
|
562
|
+
- Ensure `squads/{name}/output/archive/` exists
|
|
563
|
+
- Keep the current `{run_id}` in `squads/{name}/output/`
|
|
564
|
+
- Move every older run folder from `squads/{name}/output/` into `squads/{name}/output/archive/`
|
|
565
|
+
- Never move the `archive/` folder itself
|
|
566
|
+
- Example:
|
|
567
|
+
|
|
568
|
+
```bash
|
|
569
|
+
mkdir -p squads/{name}/output/archive
|
|
570
|
+
mv squads/{name}/output/{older_run_id} squads/{name}/output/archive/{older_run_id}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
4. Wait 10 seconds (so the dashboard can display the completed state)
|
|
574
|
+
5. Delete the working copy:
|
|
575
|
+
|
|
576
|
+
```bash
|
|
577
|
+
rm squads/{name}/state.json
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
This archives the run state for the `runs` command while keeping the squad root clean.
|
|
581
|
+
|
|
582
|
+
1. **Update squad memory** — write to BOTH files (runs after Post-Completion Cleanup above):
|
|
583
|
+
|
|
584
|
+
### 2a. Update `memories.md` (living preferences)
|
|
585
|
+
|
|
586
|
+
Read `squads/{name}/_memory/memories.md` in full. Then identify candidates from this run: **only explicit user feedback** — approvals with comments, rejections with reasons, direct requests ("prefiro X", "não quero Y"). Never infer preferences.
|
|
587
|
+
|
|
588
|
+
For each candidate:
|
|
589
|
+
- If an equivalent memory already exists and is compatible → skip (no duplicate)
|
|
590
|
+
- If an equivalent memory exists but contradicts the new item → replace with the newer version
|
|
591
|
+
- If no equivalent exists → add to the correct semantic section:
|
|
592
|
+
- Writing style choices → `## Estilo de Escrita`
|
|
593
|
+
- Visual/design preferences → `## Design Visual`
|
|
594
|
+
- Content structure choices → `## Estrutura de Conteúdo`
|
|
595
|
+
- Explicit rejections or prohibitions → `## Proibições Explícitas`
|
|
596
|
+
- Squad-specific technical patterns → `## Técnico (específico do squad)`
|
|
597
|
+
|
|
598
|
+
**Never write to `memories.md`:**
|
|
599
|
+
- Runner inferences ("usuário parece preferir X")
|
|
600
|
+
- Run scores, review grades, output file paths, topics from past runs
|
|
601
|
+
|
|
602
|
+
**Technical routing:** For any technical learning (bugs, workarounds, API behavior):
|
|
603
|
+
- If it affects any squad (Playwright bugs, OS rendering quirks, API limits) → write to the appropriate `_opensquad/core/best-practices/` file instead of `memories.md`
|
|
604
|
+
- If it is specific to this squad's output type or toolchain → add to `## Técnico (específico do squad)` following the dedup rules above
|
|
605
|
+
|
|
606
|
+
After applying all candidates, write the updated `memories.md`.
|
|
607
|
+
|
|
608
|
+
If no candidates are found (the run had no explicit user feedback), skip writing `memories.md` entirely — do not write an unmodified copy. Always proceed to step 2b regardless.
|
|
609
|
+
|
|
610
|
+
### 2b. Prepend to `runs.md` (reverse-chronological log — newest run first)
|
|
611
|
+
|
|
612
|
+
If `squads/{name}/_memory/runs.md` does not exist, create it first with:
|
|
613
|
+
|
|
614
|
+
```markdown
|
|
615
|
+
# Run History: {squad-name}
|
|
616
|
+
|
|
617
|
+
| Data | Run ID | Tema | Output | Resultado |
|
|
618
|
+
|------|--------|------|--------|-----------|
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
Then proceed to prepend the new row.
|
|
622
|
+
|
|
623
|
+
Read `squads/{name}/_memory/runs.md`. Prepend one new row to the table (immediately after the header row), with:
|
|
624
|
+
- `Data`: today's date in YYYY-MM-DD format
|
|
625
|
+
- `Run ID`: the `run_id` for this execution
|
|
626
|
+
- `Tema`: the topic or user request from this run (1 sentence max)
|
|
627
|
+
- `Output`: brief description of what was generated (e.g., "Carrossel 9 slides", "Thread 7 posts")
|
|
628
|
+
- `Resultado`: one of — `Aprovado` / `Rejeitado` / `Publicado` / `Abortado`
|
|
629
|
+
|
|
630
|
+
No other data. Do not add preferences, scores, file paths, or technical notes to `runs.md`.
|
|
631
|
+
|
|
632
|
+
1. **Operational hardening and propagation** — mandatory before the completion summary:
|
|
633
|
+
|
|
634
|
+
Review the entire run and identify only concrete items that surfaced through execution, validation, or explicit user correction:
|
|
635
|
+
|
|
636
|
+
- technical failures that required repair or recovery
|
|
637
|
+
- API quirks, credential-routing issues, rendering problems, publish/send failures, or OS-specific behavior
|
|
638
|
+
- prompt or instruction gaps that caused repeated corrections
|
|
639
|
+
- manual fixes that succeeded and should become the default path next time
|
|
640
|
+
|
|
641
|
+
For each item, classify it before writing anything:
|
|
642
|
+
|
|
643
|
+
- **Shared skill behavior** → update the relevant file under `skills/{skill}/`; when applicable, also update the executable script, the skill `SKILL.md`, the skill `README.md`, and the nearest automated test file in `tests/`
|
|
644
|
+
- **Cross-squad workflow rule** → update the appropriate file in `_opensquad/core/`, such as `runner.pipeline.md`, `prompts/design.prompt.md`, `prompts/build.prompt.md`, or a relevant file in `_opensquad/core/best-practices/`
|
|
645
|
+
- **Squad-specific recurring pattern** → write only to `squads/{name}/_memory/memories.md` under `## Técnico (específico do squad)`
|
|
646
|
+
- **One-off transient incident** → do not propagate beyond `runs.md`
|
|
647
|
+
|
|
648
|
+
Propagation rules:
|
|
649
|
+
|
|
650
|
+
- Prefer the highest reusable layer that safely fits the learning. Do not leave a cross-squad fix trapped inside one squad.
|
|
651
|
+
- Do not update only documentation when the run proved that code or prompt behavior must change.
|
|
652
|
+
- When a shared skill is changed, add or update at least one focused regression test whenever the behavior is executable.
|
|
653
|
+
- When a new default should affect future squads, update the shared creation/runtime instructions instead of patching only the current squad.
|
|
654
|
+
- Do not infer preferences here. This step is for operational learnings, not user taste.
|
|
655
|
+
|
|
656
|
+
If no concrete reusable learning exists, explicitly skip this step and continue.
|
|
657
|
+
|
|
658
|
+
1. **Run dashboard generation** — mandatory for every completed run before the completion summary:
|
|
659
|
+
|
|
660
|
+
Generate a visual operational report inside the run folder using the shared `run-dashboard` skill or its underlying script.
|
|
661
|
+
|
|
662
|
+
This is an automatic finalization action, not a checkpoint. Do not ask the user for separate approval to generate or publish the dashboard. Execute it and then report what was generated and, when applicable, where it was published.
|
|
663
|
+
|
|
664
|
+
Required files:
|
|
665
|
+
|
|
666
|
+
- `squads/{name}/output/{run_id}/run-dashboard.html`
|
|
667
|
+
- `squads/{name}/output/{run_id}/run-dashboard.data.json`
|
|
668
|
+
|
|
669
|
+
Execution rules:
|
|
670
|
+
|
|
671
|
+
- The HTML must be standalone and editable in a simple HTML editor with inline CSS and JavaScript.
|
|
672
|
+
- The JSON file is the refreshable snapshot that feeds the HTML `Refresh Data` button.
|
|
673
|
+
- If the squad `channel-config.yaml` declares `dashboard.static_publish.enabled: true`, the same finalization pass must also publish the latest snapshot and archived snapshot automatically. Do not wait for a second user instruction.
|
|
674
|
+
- If `jornal-matutino` is part of the selected outputs, generate and publish the dashboard only after the complementary newsletter step finishes, so the final snapshot consolidates social + newsletter.
|
|
675
|
+
- If no complementary newsletter is pending, generate and publish the dashboard immediately after the social publication step finishes.
|
|
676
|
+
- The dashboard must summarize, at minimum: checklist, publication destinations, clickable post links, errors/problems, timestamps, key artifacts, and the best platform metrics available at generation time.
|
|
677
|
+
- Prefer live metric refresh from Instagram, Facebook, and YouTube when the required credentials are available. If any metric cannot be fetched, render `N/A` without failing the dashboard.
|
|
678
|
+
- Dashboard generation must not depend on Supabase. If any future persistence, dashboard-template storage, or telemetry sink uses Supabase, every Opensquad-managed table name must use the `os_` prefix.
|
|
679
|
+
|
|
680
|
+
Validate both files with the same binary file-existence rule used elsewhere in this runner before presenting the completion summary. If static publish is configured, also report the latest public URL and archive URL in the completion summary.
|
|
681
|
+
|
|
682
|
+
1. **Shared learning propagation check** — mandatory after the run dashboard step and before the completion summary:
|
|
683
|
+
|
|
684
|
+
Re-evaluate the run one final time and ask a narrow operational question: did this execution reveal an important reusable experience that should help future squads?
|
|
685
|
+
|
|
686
|
+
Only propagate items that are concrete, reusable, and proven by this run, such as:
|
|
687
|
+
|
|
688
|
+
- a failure mode plus the repair that worked
|
|
689
|
+
- a validation gap that allowed a broken output to pass too far
|
|
690
|
+
- a publish/distribution/dashboard recovery path that should become standard
|
|
691
|
+
- a parser, prompt, routing, or environment behavior that can recur across squads
|
|
692
|
+
|
|
693
|
+
Routing rule:
|
|
694
|
+
|
|
695
|
+
- If it changes a shared tool or integration behavior → register it in the relevant shared skill under `skills/{skill}/` and update executable code/tests when needed
|
|
696
|
+
- If it changes pipeline orchestration or finalization behavior across squads → register it in `_opensquad/core/` or the relevant `_opensquad/core/best-practices/` file
|
|
697
|
+
- If it is only recurring inside one squad → keep it in `squads/{name}/_memory/memories.md`
|
|
698
|
+
- If it is only a one-off local incident with no reusable value → do not propagate it
|
|
699
|
+
|
|
700
|
+
Do not stop at documenting the current run locally when the learning is cross-squad. Before closing the pipeline, either register the reusable learning in the appropriate shared layer or explicitly conclude that there is no reusable learning to propagate.
|
|
701
|
+
|
|
702
|
+
1. Present completion summary:
|
|
703
|
+
|
|
704
|
+
- **Crucial Rule for the Completion Summary**: ALWAYS explicitly list the generated final URLs/permalinks (e.g., published social posts, videos, or scheduled dashboard URLs) inside the completion summary so the user can click them directly. Do not just refer the user to the `publish-result.md` or the `run-dashboard`. Show the actual links.
|
|
705
|
+
|
|
706
|
+
```
|
|
707
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
708
|
+
✅ Pipeline complete!
|
|
709
|
+
📁 Run folder: squads/{name}/output/{run_id}/
|
|
710
|
+
📄 Output saved to: {output path}
|
|
711
|
+
|
|
712
|
+
🔗 Published Links:
|
|
713
|
+
- Dashboard: {dashboard_url}
|
|
714
|
+
- Facebook/Instagram: {social_url}
|
|
715
|
+
- YouTube: {youtube_url}
|
|
716
|
+
- (List any other published platforms here)
|
|
717
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
718
|
+
|
|
719
|
+
What would you like to do?
|
|
720
|
+
● Run again (new topic)
|
|
721
|
+
○ Edit this content
|
|
722
|
+
○ Back to menu
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
## Error Handling
|
|
726
|
+
|
|
727
|
+
- If a subagent fails, retry once. If it fails again, inform the user and offer to skip the step or abort.
|
|
728
|
+
- If a step file is missing, inform the user and suggest running `/opensquad edit {squad}` to fix.
|
|
729
|
+
- If company.md is empty, stop and redirect to onboarding.
|
|
730
|
+
- Never continue past a checkpoint without user input.
|
|
731
|
+
|
|
732
|
+
## Pipeline State
|
|
733
|
+
|
|
734
|
+
Track pipeline state in memory during execution:
|
|
735
|
+
|
|
736
|
+
- Run ID (run_id) — the output subfolder name for this execution
|
|
737
|
+
- Current step index
|
|
738
|
+
- Outputs from each completed step (file paths)
|
|
739
|
+
- User choices at checkpoints
|
|
740
|
+
- Review cycle count
|
|
741
|
+
- Start time
|
|
742
|
+
|
|
743
|
+
This state does NOT persist to disk — it exists only during the current run.
|