conectese 0.1.14

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 (260) hide show
  1. package/README.md +265 -0
  2. package/_conectese/.conectese-version +1 -0
  3. package/_conectese/config/playwright.config.json +11 -0
  4. package/_conectese/core/architect.agent.yaml +110 -0
  5. package/_conectese/core/best-practices/_catalog.yaml +116 -0
  6. package/_conectese/core/best-practices/blog-post.md +132 -0
  7. package/_conectese/core/best-practices/blog-seo.md +127 -0
  8. package/_conectese/core/best-practices/copywriting.md +426 -0
  9. package/_conectese/core/best-practices/data-analysis.md +401 -0
  10. package/_conectese/core/best-practices/email-newsletter.md +118 -0
  11. package/_conectese/core/best-practices/email-sales.md +110 -0
  12. package/_conectese/core/best-practices/image-design.md +348 -0
  13. package/_conectese/core/best-practices/instagram-feed.md +235 -0
  14. package/_conectese/core/best-practices/instagram-reels.md +112 -0
  15. package/_conectese/core/best-practices/instagram-stories.md +107 -0
  16. package/_conectese/core/best-practices/linkedin-article.md +116 -0
  17. package/_conectese/core/best-practices/linkedin-post.md +121 -0
  18. package/_conectese/core/best-practices/researching.md +349 -0
  19. package/_conectese/core/best-practices/review.md +269 -0
  20. package/_conectese/core/best-practices/social-networks-publishing.md +294 -0
  21. package/_conectese/core/best-practices/strategist.md +344 -0
  22. package/_conectese/core/best-practices/technical-writing.md +365 -0
  23. package/_conectese/core/best-practices/twitter-post.md +105 -0
  24. package/_conectese/core/best-practices/twitter-thread.md +122 -0
  25. package/_conectese/core/best-practices/whatsapp-broadcast.md +107 -0
  26. package/_conectese/core/best-practices/youtube-script.md +122 -0
  27. package/_conectese/core/best-practices/youtube-shorts.md +112 -0
  28. package/_conectese/core/prompts/build.prompt.md +547 -0
  29. package/_conectese/core/prompts/design.prompt.md +469 -0
  30. package/_conectese/core/prompts/discovery.prompt.md +269 -0
  31. package/_conectese/core/prompts/sherlock-instagram.md +123 -0
  32. package/_conectese/core/prompts/sherlock-linkedin.md +73 -0
  33. package/_conectese/core/prompts/sherlock-shared.md +684 -0
  34. package/_conectese/core/prompts/sherlock-twitter.md +78 -0
  35. package/_conectese/core/prompts/sherlock-youtube.md +85 -0
  36. package/_conectese/core/runner.pipeline.md +535 -0
  37. package/_conectese/core/skills.engine.md +381 -0
  38. package/agents/data-extractor/AGENT.md +13 -0
  39. package/agents/direito-adaneiro/AGENT.md +18 -0
  40. package/agents/direito-administrativo/AGENT.md +18 -0
  41. package/agents/direito-aeroporta-rio/AGENT.md +18 -0
  42. package/agents/direito-agra-rio/AGENT.md +18 -0
  43. package/agents/direito-ambiental/AGENT.md +18 -0
  44. package/agents/direito-banca-rio/AGENT.md +18 -0
  45. package/agents/direito-civil/AGENT.md +18 -0
  46. package/agents/direito-constitcional/AGENT.md +18 -0
  47. package/agents/direito-da-crianc-a-e-do-adolescente-eca/AGENT.md +18 -0
  48. package/agents/direito-da-propriedade-intelectal/AGENT.md +18 -0
  49. package/agents/direito-de-ami-lia/AGENT.md +18 -0
  50. package/agents/direito-de-tra-nsito/AGENT.md +18 -0
  51. package/agents/direito-desportivo/AGENT.md +18 -0
  52. package/agents/direito-digital/AGENT.md +18 -0
  53. package/agents/direito-do-consmidor/AGENT.md +18 -0
  54. package/agents/direito-do-trabalho/AGENT.md +18 -0
  55. package/agents/direito-econo-mico/AGENT.md +18 -0
  56. package/agents/direito-eleitoral/AGENT.md +18 -0
  57. package/agents/direito-empresarial/AGENT.md +18 -0
  58. package/agents/direito-imobilia-rio/AGENT.md +18 -0
  59. package/agents/direito-inanceiro/AGENT.md +18 -0
  60. package/agents/direito-internacional/AGENT.md +18 -0
  61. package/agents/direito-mari-timo/AGENT.md +18 -0
  62. package/agents/direito-me-dico-e-da-sa-de/AGENT.md +18 -0
  63. package/agents/direito-militar/AGENT.md +18 -0
  64. package/agents/direito-ndia-rio/AGENT.md +18 -0
  65. package/agents/direito-notarial-e-registral/AGENT.md +18 -0
  66. package/agents/direito-penal/AGENT.md +18 -0
  67. package/agents/direito-previdencia-rio/AGENT.md +18 -0
  68. package/agents/direito-processal-civil/AGENT.md +18 -0
  69. package/agents/direito-processal-do-trabalho/AGENT.md +18 -0
  70. package/agents/direito-processal-militar/AGENT.md +18 -0
  71. package/agents/direito-processal-penal/AGENT.md +18 -0
  72. package/agents/direito-rbani-stico/AGENT.md +18 -0
  73. package/agents/direito-secrita-rio/AGENT.md +18 -0
  74. package/agents/direito-sindical/AGENT.md +18 -0
  75. package/agents/direito-societa-rio/AGENT.md +18 -0
  76. package/agents/direito-tribta-rio/AGENT.md +18 -0
  77. package/agents/direitos-hmanos/AGENT.md +18 -0
  78. package/agents/legal-analyst/AGENT.md +16 -0
  79. package/agents/legal-synthesizer/AGENT.md +13 -0
  80. package/agents/lgpd-anonymizer/AGENT.md +14 -0
  81. package/agents/lgpd-restorer/AGENT.md +14 -0
  82. package/agents/task-router/AGENT.md +13 -0
  83. package/bin/conectese.js +73 -0
  84. package/dashboard/index.html +12 -0
  85. package/dashboard/package-lock.json +1971 -0
  86. package/dashboard/package.json +28 -0
  87. package/dashboard/public/assets/avatars/Female1_1wave.png +0 -0
  88. package/dashboard/public/assets/avatars/Female1_2wave.png +0 -0
  89. package/dashboard/public/assets/avatars/Female1_blink.png +0 -0
  90. package/dashboard/public/assets/avatars/Female1_talk.png +0 -0
  91. package/dashboard/public/assets/avatars/Female2_1wave.png +0 -0
  92. package/dashboard/public/assets/avatars/Female2_2wave.png +0 -0
  93. package/dashboard/public/assets/avatars/Female2_blink.png +0 -0
  94. package/dashboard/public/assets/avatars/Female2_talk.png +0 -0
  95. package/dashboard/public/assets/avatars/Female3_blink.png +0 -0
  96. package/dashboard/public/assets/avatars/Female3_talk.png +0 -0
  97. package/dashboard/public/assets/avatars/Female3_wave.png +0 -0
  98. package/dashboard/public/assets/avatars/Female4_blink.png +0 -0
  99. package/dashboard/public/assets/avatars/Female4_talk.png +0 -0
  100. package/dashboard/public/assets/avatars/Female4_wave.png +0 -0
  101. package/dashboard/public/assets/avatars/Female5_blink.png +0 -0
  102. package/dashboard/public/assets/avatars/Female5_talk.png +0 -0
  103. package/dashboard/public/assets/avatars/Female5_wave.png +0 -0
  104. package/dashboard/public/assets/avatars/Female6_blink.png +0 -0
  105. package/dashboard/public/assets/avatars/Female6_talk.png +0 -0
  106. package/dashboard/public/assets/avatars/Female6_wave.png +0 -0
  107. package/dashboard/public/assets/avatars/Male1_1wave.png +0 -0
  108. package/dashboard/public/assets/avatars/Male1_2wave.png +0 -0
  109. package/dashboard/public/assets/avatars/Male1_blink.png +0 -0
  110. package/dashboard/public/assets/avatars/Male1_talk.png +0 -0
  111. package/dashboard/public/assets/avatars/Male2_1wave.png +0 -0
  112. package/dashboard/public/assets/avatars/Male2_2wave.png +0 -0
  113. package/dashboard/public/assets/avatars/Male2_blink.png +0 -0
  114. package/dashboard/public/assets/avatars/Male2_talk.png +0 -0
  115. package/dashboard/public/assets/avatars/Male3_blink.png +0 -0
  116. package/dashboard/public/assets/avatars/Male3_talk.png +0 -0
  117. package/dashboard/public/assets/avatars/Male3_wave.png +0 -0
  118. package/dashboard/public/assets/avatars/Male4_blink.png +0 -0
  119. package/dashboard/public/assets/avatars/Male4_talk.png +0 -0
  120. package/dashboard/public/assets/avatars/Male4_wave.png +0 -0
  121. package/dashboard/public/assets/desks/desktop_set_black_down.png +0 -0
  122. package/dashboard/public/assets/desks/desktop_set_black_down_coding-1.png +0 -0
  123. package/dashboard/public/assets/desks/desktop_set_black_down_coding.png +0 -0
  124. package/dashboard/public/assets/desks/desktop_set_black_up.png +0 -0
  125. package/dashboard/public/assets/desks/desktop_set_white_down.png +0 -0
  126. package/dashboard/public/assets/desks/desktop_set_white_down_coding-1.png +0 -0
  127. package/dashboard/public/assets/desks/desktop_set_white_down_coding.png +0 -0
  128. package/dashboard/public/assets/desks/desktop_set_white_up.png +0 -0
  129. package/dashboard/public/assets/furniture/armchair_tan.png +0 -0
  130. package/dashboard/public/assets/furniture/armchair_tan_down.png +0 -0
  131. package/dashboard/public/assets/furniture/backpack_blue.png +0 -0
  132. package/dashboard/public/assets/furniture/backpack_red.png +0 -0
  133. package/dashboard/public/assets/furniture/blinds.png +0 -0
  134. package/dashboard/public/assets/furniture/blinds_large_closed_white.png +0 -0
  135. package/dashboard/public/assets/furniture/bookshelf.png +0 -0
  136. package/dashboard/public/assets/furniture/bookshelf_purple_tall.png +0 -0
  137. package/dashboard/public/assets/furniture/bulletin_board.png +0 -0
  138. package/dashboard/public/assets/furniture/clock.png +0 -0
  139. package/dashboard/public/assets/furniture/coffee_mug.png +0 -0
  140. package/dashboard/public/assets/furniture/coffee_mug_blue.png +0 -0
  141. package/dashboard/public/assets/furniture/coffee_table.png +0 -0
  142. package/dashboard/public/assets/furniture/coffeepot_right.png +0 -0
  143. package/dashboard/public/assets/furniture/coffeetable_black_horizontal.png +0 -0
  144. package/dashboard/public/assets/furniture/couch.png +0 -0
  145. package/dashboard/public/assets/furniture/couch_tan_down.png +0 -0
  146. package/dashboard/public/assets/furniture/cushion_blue.png +0 -0
  147. package/dashboard/public/assets/furniture/cushion_tan.png +0 -0
  148. package/dashboard/public/assets/furniture/desk_wood.png +0 -0
  149. package/dashboard/public/assets/furniture/fancy_rug.png +0 -0
  150. package/dashboard/public/assets/furniture/fancy_rug_wide.png +0 -0
  151. package/dashboard/public/assets/furniture/flowers1.png +0 -0
  152. package/dashboard/public/assets/furniture/flowers2.png +0 -0
  153. package/dashboard/public/assets/furniture/lamp_tan.png +0 -0
  154. package/dashboard/public/assets/furniture/lantern.png +0 -0
  155. package/dashboard/public/assets/furniture/monstera.png +0 -0
  156. package/dashboard/public/assets/furniture/monstera_small.png +0 -0
  157. package/dashboard/public/assets/furniture/picture_frame.png +0 -0
  158. package/dashboard/public/assets/furniture/plant1.png +0 -0
  159. package/dashboard/public/assets/furniture/plant2.png +0 -0
  160. package/dashboard/public/assets/furniture/plant3.png +0 -0
  161. package/dashboard/public/assets/furniture/plant_poof.png +0 -0
  162. package/dashboard/public/assets/furniture/plant_spindly.png +0 -0
  163. package/dashboard/public/assets/furniture/poster_blue.png +0 -0
  164. package/dashboard/public/assets/furniture/rug.png +0 -0
  165. package/dashboard/public/assets/furniture/succulent_blue.png +0 -0
  166. package/dashboard/public/assets/furniture/succulent_green.png +0 -0
  167. package/dashboard/public/assets/furniture/treasurechest_closed_gold.png +0 -0
  168. package/dashboard/public/assets/furniture/water_cooler_better.png +0 -0
  169. package/dashboard/public/assets/furniture/whiteboard.png +0 -0
  170. package/dashboard/public/assets/furniture/whiteboard_stand_graph.png +0 -0
  171. package/dashboard/public/assets/furniture/window_blinds_open.png +0 -0
  172. package/dashboard/src/App.tsx +46 -0
  173. package/dashboard/src/components/SquadCard.tsx +47 -0
  174. package/dashboard/src/components/SquadSelector.tsx +61 -0
  175. package/dashboard/src/components/StatusBadge.tsx +32 -0
  176. package/dashboard/src/components/StatusBar.tsx +97 -0
  177. package/dashboard/src/hooks/useSquadSocket.ts +135 -0
  178. package/dashboard/src/lib/formatTime.ts +16 -0
  179. package/dashboard/src/lib/normalizeState.ts +25 -0
  180. package/dashboard/src/main.tsx +10 -0
  181. package/dashboard/src/office/AgentSprite.ts +241 -0
  182. package/dashboard/src/office/OfficeScene.ts +153 -0
  183. package/dashboard/src/office/PhaserGame.tsx +80 -0
  184. package/dashboard/src/office/RoomBuilder.ts +190 -0
  185. package/dashboard/src/office/assetKeys.ts +150 -0
  186. package/dashboard/src/office/palette.ts +32 -0
  187. package/dashboard/src/plugin/squadWatcher.ts +233 -0
  188. package/dashboard/src/store/useSquadStore.ts +56 -0
  189. package/dashboard/src/styles/globals.css +36 -0
  190. package/dashboard/src/types/state.ts +63 -0
  191. package/dashboard/src/vite-env.d.ts +1 -0
  192. package/dashboard/test-results/.last-run.json +4 -0
  193. package/dashboard/tsconfig.json +24 -0
  194. package/dashboard/tsconfig.tsbuildinfo +1 -0
  195. package/dashboard/vite.config.ts +13 -0
  196. package/package.json +53 -0
  197. package/skills/README.md +63 -0
  198. package/skills/apify/SKILL.md +55 -0
  199. package/skills/blotato/SKILL.md +63 -0
  200. package/skills/canva/SKILL.md +60 -0
  201. package/skills/conectese-agent-creator/SKILL.md +192 -0
  202. package/skills/conectese-skill-creator/SKILL.md +407 -0
  203. package/skills/conectese-skill-creator/agents/analyzer.md +274 -0
  204. package/skills/conectese-skill-creator/agents/comparator.md +202 -0
  205. package/skills/conectese-skill-creator/agents/grader.md +223 -0
  206. package/skills/conectese-skill-creator/assets/eval_review.html +146 -0
  207. package/skills/conectese-skill-creator/eval-viewer/generate_review.py +471 -0
  208. package/skills/conectese-skill-creator/eval-viewer/viewer.html +1325 -0
  209. package/skills/conectese-skill-creator/references/schemas.md +430 -0
  210. package/skills/conectese-skill-creator/references/skill-format.md +235 -0
  211. package/skills/conectese-skill-creator/scripts/__init__.py +0 -0
  212. package/skills/conectese-skill-creator/scripts/aggregate_benchmark.py +401 -0
  213. package/skills/conectese-skill-creator/scripts/quick_validate.py +103 -0
  214. package/skills/conectese-skill-creator/scripts/run_eval.py +310 -0
  215. package/skills/conectese-skill-creator/scripts/utils.py +47 -0
  216. package/skills/image-ai-generator/SKILL.md +124 -0
  217. package/skills/image-ai-generator/scripts/generate.py +175 -0
  218. package/skills/image-creator/SKILL.md +155 -0
  219. package/skills/image-fetcher/SKILL.md +91 -0
  220. package/skills/instagram-publisher/SKILL.md +119 -0
  221. package/skills/instagram-publisher/scripts/publish.js +165 -0
  222. package/skills/resend/SKILL.md +80 -0
  223. package/skills/template-designer/SKILL.md +201 -0
  224. package/skills/template-designer/base-templates/model-a.html +27 -0
  225. package/skills/template-designer/base-templates/model-b.html +31 -0
  226. package/skills/template-designer/base-templates/model-c.html +42 -0
  227. package/src/agents-cli.js +158 -0
  228. package/src/agents.js +134 -0
  229. package/src/i18n.js +48 -0
  230. package/src/init.js +341 -0
  231. package/src/locales/en.json +73 -0
  232. package/src/locales/es.json +72 -0
  233. package/src/locales/pt-BR.json +72 -0
  234. package/src/logger.js +38 -0
  235. package/src/prompt.js +46 -0
  236. package/src/readme/README.md +119 -0
  237. package/src/runs.js +90 -0
  238. package/src/skills-cli.js +157 -0
  239. package/src/skills.js +146 -0
  240. package/src/update.js +169 -0
  241. package/templates/_conectese/.conectese-version +1 -0
  242. package/templates/_conectese/_investigations/.gitkeep +0 -0
  243. package/templates/ide-templates/antigravity/.agent/rules/conectese.md +55 -0
  244. package/templates/ide-templates/antigravity/.agent/workflows/conectese.md +102 -0
  245. package/templates/ide-templates/claude-code/.claude/skills/conectese/SKILL.md +182 -0
  246. package/templates/ide-templates/claude-code/.mcp.json +8 -0
  247. package/templates/ide-templates/claude-code/CLAUDE.md +43 -0
  248. package/templates/ide-templates/codex/.agents/skills/conectese/SKILL.md +6 -0
  249. package/templates/ide-templates/codex/AGENTS.md +105 -0
  250. package/templates/ide-templates/cursor/.cursor/commands/conectese.md +9 -0
  251. package/templates/ide-templates/cursor/.cursor/mcp.json +8 -0
  252. package/templates/ide-templates/cursor/.cursor/rules/conectese.mdc +48 -0
  253. package/templates/ide-templates/cursor/.cursorignore +3 -0
  254. package/templates/ide-templates/opencode/.opencode/commands/conectese.md +9 -0
  255. package/templates/ide-templates/opencode/AGENTS.md +105 -0
  256. package/templates/ide-templates/vscode-copilot/.github/prompts/conectese.prompt.md +201 -0
  257. package/templates/ide-templates/vscode-copilot/.vscode/mcp.json +8 -0
  258. package/templates/ide-templates/vscode-copilot/.vscode/settings.json +3 -0
  259. package/templates/package.json +8 -0
  260. package/templates/squads/.gitkeep +0 -0
@@ -0,0 +1,535 @@
1
+ # Conectese 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 Conectese skill)
14
+ - The squad's `squad-party.csv` (all agent personas)
15
+ - Company context from `_conectese/_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
+ ```bash
20
+ [ -f squads/{name}/_memory/memories.md ] && grep -q "## Estilo de Escrita" squads/{name}/_memory/memories.md && echo "NEW_FORMAT" || echo "OLD_FORMAT"
21
+ ```
22
+ - If `NEW_FORMAT` → proceed normally.
23
+ - If `OLD_FORMAT` (or file is empty / does not exist) → silently migrate before proceeding:
24
+ 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):
25
+ ```markdown
26
+ # Squad Memory: {squad-name}
27
+
28
+ ## Estilo de Escrita
29
+
30
+ ## Design Visual
31
+
32
+ ## Estrutura de Conteúdo
33
+
34
+ ## Proibições Explícitas
35
+
36
+ ## Técnico (específico do squad)
37
+ ```
38
+ (Use the squad's display name for `{squad-name}`, and the squad code for `{name}` in file paths — they refer to the same squad.)
39
+ b. Check if `squads/{name}/_memory/runs.md` exists:
40
+ ```bash
41
+ test -f squads/{name}/_memory/runs.md && echo "EXISTS" || echo "MISSING"
42
+ ```
43
+ If `MISSING`, create it with:
44
+ ```markdown
45
+ # Run History: {squad-name}
46
+
47
+ | Data | Run ID | Tema | Output | Resultado |
48
+ |------|--------|------|--------|-----------|
49
+ ```
50
+ - Do NOT inform the user or pause execution for this migration — it is transparent.
51
+
52
+ 2. Read `squads/{name}/pipeline/pipeline.yaml` for the pipeline definition
53
+ 3. **Resolve skills**: Read `squad.yaml` → `skills` section. For each non-native skill (anything other than web_search, web_fetch):
54
+ a. Verify `skills/{skill}/SKILL.md` exists
55
+ - If missing → ask user: "Skill '{skill}' is not installed. Install now? (y/n)"
56
+ - If yes → read `_conectese/core/skills.engine.md`, follow Operation 2 (Install)
57
+ - If no → **ERROR**: stop pipeline
58
+ b. Read SKILL.md, parse frontmatter for type
59
+ c. If type: mcp, verify MCP is configured in `.claude/settings.local.json`
60
+ - If missing → **ERROR**: "Skill '{skill}' MCP not configured. Reinstall the skill."
61
+ All skills must resolve successfully before the pipeline starts (fail fast).
62
+ 4. **Model tiers**: Individual steps declare their own `model_tier` in their frontmatter (`fast` or `powerful`), set by the Architect at squad creation time.
63
+ - If the file exists: read and note the tier values for reference.
64
+ - If the file doesn't exist: ignore silently — all steps default to `powerful` at dispatch.
65
+ 5. Inform the user that the squad is starting:
66
+ ```
67
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
68
+ 🚀 Running squad: {squad name}
69
+ 📋 Pipeline: {number of steps} steps
70
+ 🤖 Agents: {list agent names with icons}
71
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
72
+ ```
73
+ 5b. **Initialize run folder**: Generate a unique run ID for this execution:
74
+ - Format: `YYYY-MM-DD-HHmmss` using the current timestamp (e.g. `2026-03-03-143022`)
75
+ - Check if `squads/{name}/output/{run_id}/` already exists
76
+ - If it does (sub-second collision), append `-2`, `-3`, etc. until the folder does not exist
77
+ - Create the folder using Bash: `mkdir -p squads/{name}/output/{run_id}`
78
+ - Store `run_id` in working memory for this run — it will be used for ALL output paths
79
+ 6. **Initialize state.json**: Create `squads/{name}/state.json` from scratch (see below). State writes are always mandatory.
80
+ - **IMPORTANT**: You MUST write to `squads/{name}/state.json` before every step and after every handoff. This is non-negotiable. Never skip these writes.
81
+ - Create `state.json` from scratch:
82
+ a. Read `squads/{name}/squad-party.csv` — for each agent row (skip header), extract:
83
+ - `id`: take the `path` column, strip `./agents/` prefix and `.agent.md` suffix
84
+ (e.g. `./agents/researcher.agent.md` → `researcher`)
85
+ - `name`: use the `displayName` column
86
+ - `icon`: use the `icon` column
87
+ b. Assign desk positions by agent order (0-based index):
88
+ - `col = (index % 3) + 1`
89
+ - `row = floor(index / 3) + 1`
90
+ (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.)
91
+ c. Read `squads/{name}/squad.yaml` — count items in `pipeline.steps` for `total`
92
+ d. Write `squads/{name}/state.json` with the Write tool:
93
+ ```json
94
+ {
95
+ "squad": "{squad code from squad.yaml}",
96
+ "status": "idle",
97
+ "step": { "current": 0, "total": {step count from c}, "label": "" },
98
+ "agents": [
99
+ {
100
+ "id": "{agent id}",
101
+ "name": "{agent displayName}",
102
+ "icon": "{agent icon}",
103
+ "status": "idle",
104
+ "desk": { "col": {col from b}, "row": {row from b} }
105
+ }
106
+ ],
107
+ "handoff": null,
108
+ "startedAt": null,
109
+ "updatedAt": "{ISO timestamp now}"
110
+ }
111
+ ```
112
+ Include one entry per agent, in squad-party.csv order.
113
+
114
+ ## Execution Rules
115
+
116
+ ### Agent Loading (for inline and subagent steps)
117
+
118
+ Before executing any step that references an agent:
119
+ 1. Read the agent's row from squad-party.csv for quick persona reference
120
+ 2. Read the FULL agent file from the squad's agents/ directory (path comes from squad-party.csv)
121
+ - The file uses YAML frontmatter for metadata and markdown body for depth
122
+ - The markdown body contains: Operational Framework, Output Examples, Anti-Patterns, Voice Guidance
123
+ - All agents are complete `.agent.md` files with full definitions — no overlay resolution needed
124
+ 3. When executing the step, the agent's full definition informs behavior:
125
+ - Follow the Operational Framework's process steps
126
+ - Use Output Examples as quality reference
127
+ - Avoid Anti-Patterns listed in the agent definition
128
+ - Apply Voice Guidance (vocabulary always/never use, tone rules)
129
+ 4. **Inject format context**: Check if the current step's frontmatter contains a `format:` field.
130
+ If present:
131
+ a. Read `_conectese/core/best-practices/{format}.md` (e.g., `_conectese/core/best-practices/instagram-feed.md`)
132
+ - If the file does not exist → **WARNING**: "Format '{format}' not found in _conectese/core/best-practices/. Skipping format injection." Continue without format.
133
+ b. Parse the YAML frontmatter to extract the `name` field
134
+ c. Extract the Markdown body (everything after the YAML frontmatter closing `---`)
135
+ d. Append to the agent's context, before skill instructions:
136
+ ```
137
+ --- FORMAT: {name from frontmatter} ---
138
+
139
+ {format file markdown body}
140
+ ```
141
+ If the step has no `format:` field, skip this step entirely (backward compatible).
142
+ 5. **Inject skill instructions**: Check which skills the agent declares in its frontmatter `skills:`.
143
+ For each non-native skill declared:
144
+ a. Read `skills/{skill}/SKILL.md`
145
+ b. Extract the Markdown body (everything after the YAML frontmatter closing `---`)
146
+ c. Append to the agent's context, after format injection:
147
+ ```
148
+ --- SKILL INSTRUCTIONS ---
149
+
150
+ ## {name from frontmatter}
151
+ {SKILL.md markdown body}
152
+ ```
153
+ d. Follow declaration order in the agent's frontmatter for multi-skill injection
154
+
155
+ The final agent context composition order is:
156
+ ```
157
+ Agent (.agent.md) → Platform Best Practices → Skill Instructions
158
+ ```
159
+
160
+ ### Task-Based Agent Execution
161
+
162
+ When an agent's `.agent.md` frontmatter contains a `tasks:` field:
163
+
164
+ 1. **Load task list**: Read the `tasks:` array from the agent's frontmatter
165
+ - Each entry is a relative path to a task file (e.g., `tasks/analyze-source.md`)
166
+ - Tasks execute in the order listed
167
+
168
+ 2. **For each task in sequence**:
169
+ a. Read the task file from the agent's directory (e.g., `squads/{squad-name}/agents/{agent}/tasks/{task}.md`)
170
+ b. Construct the execution prompt:
171
+ - Agent persona + principles (from agent.md — fixed across all tasks)
172
+ - Task description and process (from task file)
173
+ - Task output format (from task file)
174
+ - Task quality criteria and veto conditions (from task file)
175
+ - Input: For the first task, use the step's input. For subsequent tasks, use the previous task's output.
176
+ c. Execute the task (inline or subagent, matching the step's execution mode)
177
+ d. Collect the task output
178
+ e. Check task veto conditions (same enforcement as step veto conditions below)
179
+
180
+ 3. **Final output**: The output of the LAST task in the chain becomes the step's output
181
+ - 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`
182
+ - Save to the **transformed** outputFile path
183
+ - This is what the next step (or checkpoint) receives
184
+
185
+ 4. **Progress reporting**: For inline execution, announce each task:
186
+ ```
187
+ {icon} {Agent Name} — Task {N}/{total}: {task name}...
188
+ ```
189
+
190
+ 5. **Backward compatibility**: If the agent's frontmatter does NOT contain a `tasks:` field,
191
+ execute the agent monolithically as before (current behavior unchanged).
192
+
193
+ ### Output Path Transformation
194
+
195
+ Before saving any output file in a step, apply these rules to determine the final path:
196
+
197
+ #### Step 1 — Insert run_id
198
+
199
+ - If the path starts with `squads/{name}/output/`, insert `{run_id}/` immediately after `output/`
200
+ - Example: `squads/carousel/output/slides/draft.md` → `squads/carousel/output/2026-03-03-143022/slides/draft.md`
201
+ - Example: `squads/carousel/output/angles-brief.yaml` → `squads/carousel/output/2026-03-03-143022/angles-brief.yaml`
202
+ - If the path does NOT start with `squads/{name}/output/`, leave it unchanged
203
+
204
+ #### Step 2 — Insert version folder
205
+
206
+ Apply to every path that was transformed in Step 1:
207
+
208
+ 1. Determine the **output group** = the parent directory of the file (after Step 1 transformation)
209
+ - Example: `squads/carousel/output/2026-03-03-143022/slides/draft.md` → group is `squads/carousel/output/2026-03-03-143022/slides/`
210
+ - Example: `squads/carousel/output/2026-03-03-143022/angles-brief.yaml` → group is `squads/carousel/output/2026-03-03-143022/`
211
+
212
+ 2. Detect existing versions for this group using Bash:
213
+ ```bash
214
+ ls -1 squads/{name}/output/{run_id}/{relative-group}/ 2>/dev/null | grep -E '^v[0-9]+$' | sort -V | tail -1
215
+ ```
216
+ - If the command returns a version (e.g. `v2`) → use `v3`
217
+ (Always increment the highest version found, even if lower versions have gaps — e.g. if `v1` and `v3` exist, use `v4`)
218
+ - If the command returns nothing (no versions yet) → use `v1`
219
+ (`{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)
220
+
221
+ 3. Insert the version folder immediately before the filename:
222
+ - `squads/carousel/output/2026-03-03-143022/slides/draft.md` → `squads/carousel/output/2026-03-03-143022/slides/v1/draft.md`
223
+ - `squads/carousel/output/2026-03-03-143022/angles-brief.yaml` → `squads/carousel/output/2026-03-03-143022/v1/angles-brief.yaml`
224
+
225
+ 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.
226
+ 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).
227
+
228
+ Apply this transformation consistently for every write in this step.
229
+
230
+ ### For each pipeline step:
231
+
232
+ 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:
233
+ ```json
234
+ {
235
+ "squad": "{squad code from squad.yaml}",
236
+ "status": "running",
237
+ "step": {
238
+ "current": {1-based index of this step},
239
+ "total": {total steps in pipeline},
240
+ "label": "{step id or label}"
241
+ },
242
+ "agents": [
243
+ {
244
+ "id": "{agent id}",
245
+ "name": "{agent displayName}",
246
+ "icon": "{agent icon}",
247
+ "status": "{working if this is the current step's agent, done if already completed, idle otherwise}",
248
+ "desk": {preserve existing desk positions from state.json — do not change col/row}
249
+ }
250
+ ],
251
+ "handoff": {preserve existing handoff object, or null if this is the first step},
252
+ "startedAt": "{ISO timestamp — set on the first step only, then preserve from existing state.json on subsequent steps}",
253
+ "updatedAt": "{ISO timestamp now}"
254
+ }
255
+ ```
256
+
257
+ 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:
258
+ ```bash
259
+ test -s "{transformed inputFile path}" && echo "VALIDATION:PASS" || echo "VALIDATION:FAIL"
260
+ ```
261
+ - Apply the Output Path Transformation (Step 1: run_id injection) to the `inputFile` path before running the check.
262
+ - If the Bash output contains `VALIDATION:PASS` → proceed to execute the step.
263
+ - If the Bash output contains `VALIDATION:FAIL` → do NOT execute the step. Present to user:
264
+ ```
265
+ ⚠️ Input for {Agent Name} not found: {path}
266
+ The previous step may have failed to produce output.
267
+
268
+ 1. Skip step and continue
269
+ 2. Abort pipeline
270
+ ```
271
+ 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.
272
+ - If the step does not declare an `inputFile` → skip this validation entirely.
273
+ - Checkpoint steps (`type: checkpoint`) are exempt — they receive input from the user, not from files.
274
+
275
+ 2. **Read the step file** completely: `squads/{name}/pipeline/steps/{step-file}.md`
276
+ 3. **Check execution mode** from the step's frontmatter:
277
+
278
+ #### If `execution: subagent`
279
+ - Inform user: `🔍 {Agent Name} is working in the background...`
280
+ - Read the step's `model_tier` frontmatter field (if present).
281
+ Valid values: `fast` or `powerful`. If absent or any other value: default to `powerful`.
282
+ - **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.
283
+ - Use the Task tool to dispatch the step as a subagent:
284
+ - If `model_tier: fast`: use the fastest/lightest model available in your current IDE.
285
+ - If `model_tier: powerful` or absent/invalid: use the default model (no model override needed)
286
+ - In the Task prompt, include:
287
+ - The full agent persona from the party CSV
288
+ - The full agent `.agent.md` content (persona, principles, voice guidance, anti-patterns)
289
+ - If the agent has tasks: include ALL task files in order with instructions to execute sequentially, piping output from each task to the next
290
+ - If the agent has no tasks: include the step instructions and operational framework as before
291
+ - The veto conditions from the step file (agent should self-check before completing)
292
+ - The company context
293
+ - The squad memory
294
+ - The **transformed** path to save output (e.g., `squads/{name}/output/2026-03-20-140736/slides/v1/draft.md`)
295
+ - Wait for the subagent to complete
296
+ - Inform user: `✓ {Agent Name} completed`
297
+ - Proceed to Post-Step Output Validation (below) before advancing.
298
+
299
+ #### If `execution: inline`
300
+ - Switch to the agent's persona (read from party CSV)
301
+ - Announce: `{icon} {Agent Name} is working...`
302
+ - Follow the step instructions
303
+ - Present output directly in the conversation
304
+ - 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.
305
+ - Proceed to Post-Step Output Validation (below) before advancing.
306
+
307
+ #### If `type: checkpoint`
308
+ - Present the checkpoint message to the user
309
+ - If the checkpoint requires a choice (numbered list), present options as a numbered list
310
+ - **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."
311
+ - Wait for user input before proceeding
312
+ - Save the user's choice/response for the next step
313
+ - **If the step frontmatter contains `outputFile`**: after collecting the user's full response,
314
+ 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.
315
+ Use this format:
316
+ ```
317
+ # Research Focus
318
+
319
+ **Topic:** {user's typed topic}
320
+ **Time Range:** {selected time range label, e.g., "Últimos 7 dias"}
321
+ **Date:** {today's date in YYYY-MM-DD format}
322
+ ```
323
+ This file is the `inputFile` for the researcher step that follows.
324
+
325
+ ### Post-Step Output Validation
326
+
327
+ 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.
328
+
329
+ **If the step declares an `outputFile`** (single or multiple), run via Bash tool for EACH output file:
330
+
331
+ ```bash
332
+ test -s "{transformed outputFile path}" && echo "VALIDATION:PASS" || echo "VALIDATION:FAIL"
333
+ ```
334
+
335
+ Use the **stored transformed path** (after Output Path Transformation Steps 1 and 2), not the raw path from the step file.
336
+
337
+ **Rules:**
338
+ - If ALL output files return `VALIDATION:PASS` → proceed to Veto Condition Enforcement.
339
+ - If ANY output file returns `VALIDATION:FAIL`:
340
+ 1. **Retry once**: re-execute the entire step with the same input and context.
341
+ 2. After re-execution, run the validation again for all output files.
342
+ 3. If second attempt returns `VALIDATION:PASS` for all files → proceed normally.
343
+ 4. If second attempt still has ANY `VALIDATION:FAIL` → present to user:
344
+ ```
345
+ ⚠️ {Agent Name}'s output was not generated: {path}
346
+
347
+ 1. Retry step
348
+ 2. Skip step and continue
349
+ 3. Abort pipeline
350
+ ```
351
+ Wait for user choice before proceeding.
352
+ - If the step does not declare an `outputFile` (e.g., steps that only produce inline console output) → skip output validation.
353
+ - Checkpoint steps (`type: checkpoint`) are exempt — their output is the user's response, not a file.
354
+
355
+ **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.
356
+
357
+ ### Veto Condition Enforcement
358
+
359
+ After an agent completes a step (before moving to the next step):
360
+
361
+ 1. Check if the step file has a `## Veto Conditions` section
362
+ 2. If yes, evaluate each veto condition against the agent's output:
363
+ - Read the output that was just produced
364
+ - Check each condition (e.g., "slides exceed 30 words", "no CTA", "missing sources")
365
+ 3. If ANY veto condition is triggered:
366
+ - Inform user: "⚠️ {Agent Name}'s output triggered a veto: {condition}"
367
+ - Ask the agent to fix the specific issue (re-execute with targeted correction)
368
+ - Maximum 2 veto fix attempts per step
369
+ - After 2 failed attempts, present to user for manual decision
370
+ 4. If no veto conditions triggered: proceed to next step
371
+
372
+ This creates an internal quality loop BEFORE the reviewer sees the content,
373
+ catching obvious issues early and reducing review cycle waste.
374
+
375
+ ### Review Loops
376
+
377
+ When a step has `on_reject: {step-id}`:
378
+ - Track the review cycle count
379
+ - If reviewer rejects, go back to the referenced step
380
+ - Pass reviewer feedback to the writer agent
381
+ - If max_review_cycles reached, present to user for manual decision
382
+
383
+ ### Dashboard Handoff (between steps)
384
+
385
+ After a step completes output and there IS a next step (MANDATORY):
386
+
387
+ 1. **Write delivering state** — Write `squads/{name}/state.json` with:
388
+ - Current step's agent: `"status": "delivering"`
389
+ - Next step's agent: `"status": "idle"`
390
+ - All other agents unchanged
391
+ - Pipeline `"status": "running"`
392
+ - Add or update `"handoff"`:
393
+ ```json
394
+ "handoff": {
395
+ "from": "{current agent id}",
396
+ "to": "{next agent id}",
397
+ "message": "{one-sentence summary of what was produced, written in the user's language}",
398
+ "completedAt": "{ISO timestamp now}"
399
+ }
400
+ ```
401
+ - `"updatedAt"`: now
402
+
403
+ 2. _(No delay — proceed immediately to working state)_
404
+
405
+ 2. **Write working state** — Write `squads/{name}/state.json` again with:
406
+ - Current agent: `"status": "done"`
407
+ - Next agent: `"status": "working"`
408
+ - Keep the `"handoff"` object from step 1 unchanged
409
+ - `"updatedAt"`: now
410
+
411
+ ### Step Execution Order (Summary)
412
+
413
+ For reference, the complete execution order for each pipeline step is:
414
+
415
+ ```
416
+ 0. Dashboard update (state.json)
417
+ 1. Pre-Step Input Validation (bash gate)
418
+ 2. Read step file
419
+ 3. Check execution mode and execute (subagent / inline / checkpoint)
420
+ 4. Post-Step Output Validation (bash gate)
421
+ 5. Veto Condition Enforcement
422
+ 6. Dashboard Handoff (to next step)
423
+ ```
424
+
425
+ Steps 1 and 4 are binary bash gates. If either fails, the pipeline does NOT advance — the user is consulted.
426
+
427
+ ### After Pipeline Completion
428
+
429
+ 1. Save final output to `squads/{name}/output/{run_id}/{filename}.md`
430
+ (The run folder was created during initialization — no separate date subfolder needed)
431
+ 1b. **Update dashboard** — MANDATORY. Write `squads/{name}/state.json` with:
432
+ - `"status": "completed"`
433
+ - All agents: `"status": "done"`
434
+ - `"updatedAt"`: now
435
+ - `"completedAt"`: now
436
+ - `"startedAt"`: preserve from existing `state.json`
437
+ - Keep existing `"handoff"` object
438
+
439
+ ### Post-Completion Cleanup
440
+
441
+ After writing the final "completed" state to `squads/{name}/state.json`:
442
+
443
+ 1. Add the `completedAt` field (or `failedAt` if status is `failed`) with the current ISO timestamp
444
+ 2. Copy `state.json` to the run output folder for permanent history:
445
+ ```bash
446
+ cp squads/{name}/state.json squads/{name}/output/{run_id}/state.json
447
+ ```
448
+ 3. Wait 10 seconds (so the dashboard can display the completed state)
449
+ 4. Delete the working copy:
450
+ ```bash
451
+ rm squads/{name}/state.json
452
+ ```
453
+
454
+ This archives the run state for the `runs` command while keeping the squad root clean.
455
+
456
+ 2. **Update squad memory** — write to BOTH files (runs after Post-Completion Cleanup above):
457
+
458
+ ### 2a. Update `memories.md` (living preferences)
459
+
460
+ 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.
461
+
462
+ For each candidate:
463
+ - If an equivalent memory already exists and is compatible → skip (no duplicate)
464
+ - If an equivalent memory exists but contradicts the new item → replace with the newer version
465
+ - If no equivalent exists → add to the correct semantic section:
466
+ - Writing style choices → `## Estilo de Escrita`
467
+ - Visual/design preferences → `## Design Visual`
468
+ - Content structure choices → `## Estrutura de Conteúdo`
469
+ - Explicit rejections or prohibitions → `## Proibições Explícitas`
470
+ - Squad-specific technical patterns → `## Técnico (específico do squad)`
471
+
472
+ **Never write to `memories.md`:**
473
+ - Runner inferences ("usuário parece preferir X")
474
+ - Run scores, review grades, output file paths, topics from past runs
475
+
476
+ **Technical routing:** For any technical learning (bugs, workarounds, API behavior):
477
+ - If it affects any squad (Playwright bugs, OS rendering quirks, API limits) → write to the appropriate `_conectese/core/best-practices/` file instead of `memories.md`
478
+ - 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
479
+
480
+ After applying all candidates, write the updated `memories.md`.
481
+
482
+ 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.
483
+
484
+ ### 2b. Prepend to `runs.md` (reverse-chronological log — newest run first)
485
+
486
+ If `squads/{name}/_memory/runs.md` does not exist, create it first with:
487
+ ```markdown
488
+ # Run History: {squad-name}
489
+
490
+ | Data | Run ID | Tema | Output | Resultado |
491
+ |------|--------|------|--------|-----------|
492
+ ```
493
+ Then proceed to prepend the new row.
494
+
495
+ Read `squads/{name}/_memory/runs.md`. Prepend one new row to the table (immediately after the header row), with:
496
+ - `Data`: today's date in YYYY-MM-DD format
497
+ - `Run ID`: the `run_id` for this execution
498
+ - `Tema`: the topic or user request from this run (1 sentence max)
499
+ - `Output`: brief description of what was generated (e.g., "Carrossel 9 slides", "Thread 7 posts")
500
+ - `Resultado`: one of — `Aprovado` / `Rejeitado` / `Publicado` / `Abortado`
501
+
502
+ No other data. Do not add preferences, scores, file paths, or technical notes to `runs.md`.
503
+
504
+ 3. Present completion summary:
505
+ ```
506
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
507
+ ✅ Pipeline complete!
508
+ 📁 Run folder: squads/{name}/output/{run_id}/
509
+ 📄 Output saved to: {output path}
510
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
511
+
512
+ What would you like to do?
513
+ ● Run again (new topic)
514
+ ○ Edit this content
515
+ ○ Back to menu
516
+ ```
517
+
518
+ ## Error Handling
519
+
520
+ - If a subagent fails, retry once. If it fails again, inform the user and offer to skip the step or abort.
521
+ - If a step file is missing, inform the user and suggest running `/conectese edit {squad}` to fix.
522
+ - If company.md is empty, stop and redirect to onboarding.
523
+ - Never continue past a checkpoint without user input.
524
+
525
+ ## Pipeline State
526
+
527
+ Track pipeline state in memory during execution:
528
+ - Run ID (run_id) — the output subfolder name for this execution
529
+ - Current step index
530
+ - Outputs from each completed step (file paths)
531
+ - User choices at checkpoints
532
+ - Review cycle count
533
+ - Start time
534
+
535
+ This state does NOT persist to disk — it exists only during the current run.