mega-brain-ai 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mega-brain-ai might be problematic. Click here for more details.

Files changed (308) hide show
  1. package/.claude/CLAUDE.md +155 -0
  2. package/.claude/commands/agents.md +161 -0
  3. package/.claude/commands/ask.md +117 -0
  4. package/.claude/commands/benchmark.md +224 -0
  5. package/.claude/commands/chat.md +343 -0
  6. package/.claude/commands/compare.md +116 -0
  7. package/.claude/commands/conclave.md +194 -0
  8. package/.claude/commands/config.md +133 -0
  9. package/.claude/commands/council.md +194 -0
  10. package/.claude/commands/create-agent.md +452 -0
  11. package/.claude/commands/debate.md +157 -0
  12. package/.claude/commands/documentation/create-architecture-documentation.md +175 -0
  13. package/.claude/commands/dossiers.md +180 -0
  14. package/.claude/commands/evolve.md +223 -0
  15. package/.claude/commands/extract-dna.md +170 -0
  16. package/.claude/commands/extract-knowledge.md +507 -0
  17. package/.claude/commands/inbox.md +296 -0
  18. package/.claude/commands/ingest-empresa.md +191 -0
  19. package/.claude/commands/ingest.md +182 -0
  20. package/.claude/commands/jarvis-briefing.md +67 -0
  21. package/.claude/commands/jarvis-control.md +169 -0
  22. package/.claude/commands/jarvis-full.md +181 -0
  23. package/.claude/commands/jarvis.md +212 -0
  24. package/.claude/commands/ler-drive.md +212 -0
  25. package/.claude/commands/log.md +158 -0
  26. package/.claude/commands/loop.md +133 -0
  27. package/.claude/commands/loops.md +73 -0
  28. package/.claude/commands/mission-autopilot.md +538 -0
  29. package/.claude/commands/mission.md +353 -0
  30. package/.claude/commands/process-inbox.md +148 -0
  31. package/.claude/commands/process-jarvis.md +3036 -0
  32. package/.claude/commands/process-video.md +131 -0
  33. package/.claude/commands/rag-search.md +78 -0
  34. package/.claude/commands/resume.md +33 -0
  35. package/.claude/commands/save.md +38 -0
  36. package/.claude/commands/scan-inbox.md +125 -0
  37. package/.claude/commands/setup.md +99 -0
  38. package/.claude/commands/system-digest.md +243 -0
  39. package/.claude/commands/verify.md +182 -0
  40. package/.claude/commands/view-dna.md +169 -0
  41. package/.claude/hooks/agent_doctor.py +433 -0
  42. package/.claude/hooks/agent_memory_persister.py +203 -0
  43. package/.claude/hooks/auto_formatter.py +158 -0
  44. package/.claude/hooks/checkpoint_writer.py +244 -0
  45. package/.claude/hooks/claude_md_guard.py +146 -0
  46. package/.claude/hooks/creation_validator.py +357 -0
  47. package/.claude/hooks/enforce_dual_location.py +501 -0
  48. package/.claude/hooks/enforce_plan_mode.py +220 -0
  49. package/.claude/hooks/inbox_age_alert.py +367 -0
  50. package/.claude/hooks/jarvis_briefing.py +506 -0
  51. package/.claude/hooks/ledger_updater.py +301 -0
  52. package/.claude/hooks/memory_hints_injector.py +251 -0
  53. package/.claude/hooks/memory_updater.py +202 -0
  54. package/.claude/hooks/multi_agent_hook.py +464 -0
  55. package/.claude/hooks/notification_system.py +120 -0
  56. package/.claude/hooks/pattern_analyzer.py +526 -0
  57. package/.claude/hooks/pending_tracker.py +188 -0
  58. package/.claude/hooks/post_batch_cascading.py +1740 -0
  59. package/.claude/hooks/post_output_validator.py +358 -0
  60. package/.claude/hooks/post_tool_use.py +120 -0
  61. package/.claude/hooks/post_write_validator.py +200 -0
  62. package/.claude/hooks/quality_watchdog.py +394 -0
  63. package/.claude/hooks/ralph_wiggum.py +277 -0
  64. package/.claude/hooks/session-source-sync.py +218 -0
  65. package/.claude/hooks/session_autosave_v2.py +1135 -0
  66. package/.claude/hooks/session_end.py +203 -0
  67. package/.claude/hooks/session_start.py +939 -0
  68. package/.claude/hooks/skill_indexer.py +48 -0
  69. package/.claude/hooks/skill_router.py +358 -0
  70. package/.claude/hooks/stop_hook_completeness.py +178 -0
  71. package/.claude/hooks/subagent_tracker.py +163 -0
  72. package/.claude/hooks/token_checkpoint.py +584 -0
  73. package/.claude/hooks/user_prompt_submit.py +125 -0
  74. package/.claude/rules/ANTHROPIC-STANDARDS.md +384 -0
  75. package/.claude/rules/CLAUDE-LITE.md +201 -0
  76. package/.claude/rules/RULE-GROUP-1.md +320 -0
  77. package/.claude/rules/RULE-GROUP-2.md +307 -0
  78. package/.claude/rules/RULE-GROUP-3.md +248 -0
  79. package/.claude/rules/RULE-GROUP-4.md +427 -0
  80. package/.claude/rules/RULE-GROUP-5.md +388 -0
  81. package/.claude/rules/RULE-GROUP-6.md +387 -0
  82. package/.claude/rules/logging.md +53 -0
  83. package/.claude/rules/mcp-governance.md +128 -0
  84. package/.claude/rules/pipeline.md +60 -0
  85. package/.claude/rules/state-management.md +93 -0
  86. package/.claude/scripts/apply-tags.py +77 -0
  87. package/.claude/scripts/batch-extract-transcriptions.py +132 -0
  88. package/.claude/scripts/build-complete-index.py +250 -0
  89. package/.claude/scripts/build-planilha-index.py +170 -0
  90. package/.claude/scripts/complete-tag-matching.py +250 -0
  91. package/.claude/scripts/deduplicate-inbox.py +139 -0
  92. package/.claude/scripts/docx-xml-extractor.py +141 -0
  93. package/.claude/scripts/extract-docx-text.py +58 -0
  94. package/.claude/scripts/extract-single-transcription.py +74 -0
  95. package/.claude/scripts/extract_docx_from_gdrive.py +77 -0
  96. package/.claude/scripts/organized-downloader.py +246 -0
  97. package/.claude/scripts/planilha-tagger.py +187 -0
  98. package/.claude/scripts/revert-tags.py +70 -0
  99. package/.claude/scripts/source-sync.py +265 -0
  100. package/.claude/scripts/tag-inbox-files.py +276 -0
  101. package/.claude/scripts/tag-inbox-v2.py +253 -0
  102. package/.claude/scripts/test-extraction.py +35 -0
  103. package/.claude/scripts/test-full-extraction.py +74 -0
  104. package/.claude/skills/00-SKILL-CREATOR/SKILL.md +186 -0
  105. package/.claude/skills/01-SKILL-DOCS-MEGABRAIN/SKILL.md +251 -0
  106. package/.claude/skills/02-SKILL-PYTHON-MEGABRAIN/SKILL.md +323 -0
  107. package/.claude/skills/03-SKILL-AGENT-CREATION/SKILL.md +374 -0
  108. package/.claude/skills/04-SKILL-KNOWLEDGE-EXTRACTION/SKILL.md +318 -0
  109. package/.claude/skills/05-SKILL-PIPELINE-JARVIS/SKILL.md +430 -0
  110. package/.claude/skills/06-SKILL-BRAINSTORMING/SKILL.md +72 -0
  111. package/.claude/skills/07-SKILL-DISPATCHING-PARALLEL-AGENTS/SKILL.md +193 -0
  112. package/.claude/skills/08-SKILL-EXECUTING-PLANS/SKILL.md +114 -0
  113. package/.claude/skills/09-SKILL-WRITING-PLANS/SKILL.md +184 -0
  114. package/.claude/skills/10-SKILL-VERIFICATION-BEFORE-COMPLETION/SKILL.md +130 -0
  115. package/.claude/skills/11-SKILL-USING-SUPERPOWERS/SKILL.md +105 -0
  116. package/.claude/skills/DETECTION-PROTOCOL.md +217 -0
  117. package/.claude/skills/README.md +240 -0
  118. package/.claude/skills/SKILL-REGISTRY.md +284 -0
  119. package/.claude/skills/SKILL-SUGGESTIONS.md +114 -0
  120. package/.claude/skills/_TEMPLATES/SKILL-WRITER-GUIDE.md +385 -0
  121. package/.claude/skills/chronicler/SKILL.md +146 -0
  122. package/.claude/skills/chronicler/chronicler_core.py +468 -0
  123. package/.claude/skills/code-review/SKILL.md +160 -0
  124. package/.claude/skills/council/SKILL.md +210 -0
  125. package/.claude/skills/executor/SKILL.md +161 -0
  126. package/.claude/skills/fase-2-5-tagging/SKILL.md +182 -0
  127. package/.claude/skills/feature-dev/SKILL.md +154 -0
  128. package/.claude/skills/finance-agent/SKILL.md +137 -0
  129. package/.claude/skills/frontend-design/SKILL.md +165 -0
  130. package/.claude/skills/gdrive-transcription-downloader/SKILL.md +249 -0
  131. package/.claude/skills/gemini-fallback/SKILL.md +67 -0
  132. package/.claude/skills/gemini-fallback/gemini_fetch.py +0 -0
  133. package/.claude/skills/gha/SKILL.md +96 -0
  134. package/.claude/skills/gha/gha_diagnostic.py +227 -0
  135. package/.claude/skills/github-workflow/SKILL.md +190 -0
  136. package/.claude/skills/hookify/SKILL.md +134 -0
  137. package/.claude/skills/hybrid-source-reading/SKILL.md +265 -0
  138. package/.claude/skills/jarvis/SKILL.md +546 -0
  139. package/.claude/skills/jarvis-briefing/SKILL.md +340 -0
  140. package/.claude/skills/ler-planilha/SKILL.md +281 -0
  141. package/.claude/skills/plugin-dev/SKILL.md +176 -0
  142. package/.claude/skills/pr-review-toolkit/SKILL.md +178 -0
  143. package/.claude/skills/resume/SKILL.md +61 -0
  144. package/.claude/skills/save/SKILL.md +87 -0
  145. package/.claude/skills/skill-writer/SKILL.md +153 -0
  146. package/.claude/skills/skill-writer/examples.md +191 -0
  147. package/.claude/skills/skill-writer/troubleshooting.md +205 -0
  148. package/.claude/skills/smart-download-tagger/SKILL.md +148 -0
  149. package/.claude/skills/source-sync/SKILL.md +240 -0
  150. package/.claude/skills/sync-docs/SKILL.md +193 -0
  151. package/.claude/skills/sync-docs/config.json +37 -0
  152. package/.claude/skills/sync-docs/gdrive_sync.py +358 -0
  153. package/.claude/skills/sync-docs/reauth.py +71 -0
  154. package/.claude/skills/talent-agent/SKILL.md +183 -0
  155. package/.claude/skills/verify/SKILL.md +154 -0
  156. package/.claude/skills/verify/verify_runner.py +0 -0
  157. package/.claude/skills/verify-6-levels/SKILL.md +234 -0
  158. package/.claude/templates/BATCH-LOG-TEMPLATE.md +221 -0
  159. package/.claudeignore +9 -0
  160. package/.gitattributes +4 -0
  161. package/.github/layer1-allowlist.txt +80 -0
  162. package/.github/layer2-manifest.txt +40 -0
  163. package/.gitignore +219 -0
  164. package/README.md +1210 -0
  165. package/agents/_templates/INDEX.md +741 -0
  166. package/agents/_templates/TEMPLATE-AGENT-MD-ULTRA-ROBUSTO-V3.md +2399 -0
  167. package/agents/boardroom/CHECKLIST-MASTER.md +281 -0
  168. package/agents/boardroom/INTEGRATION-GUIDE.md +406 -0
  169. package/agents/boardroom/README.md +238 -0
  170. package/agents/boardroom/config/BOARDROOM-CONFIG.md +186 -0
  171. package/agents/boardroom/config/TTS-INTEGRATION.md +258 -0
  172. package/agents/boardroom/config/VOICE-PROFILES.md +624 -0
  173. package/agents/boardroom/config/voice_mapping.json +128 -0
  174. package/agents/boardroom/scripts/audio_generator.py +375 -0
  175. package/agents/boardroom/scripts/audio_generator_edge.py +353 -0
  176. package/agents/boardroom/scripts/jarvis_boardroom_hook.py +415 -0
  177. package/agents/boardroom/scripts/notebooklm_generator.py +578 -0
  178. package/agents/boardroom/templates/EPISODE-TEMPLATE.md +367 -0
  179. package/agents/boardroom/templates/scene-templates/SCENE-AGENT-DEBATE.md +252 -0
  180. package/agents/boardroom/templates/scene-templates/SCENE-COUNCIL.md +270 -0
  181. package/agents/boardroom/templates/scene-templates/SCENE-DNA-CONSULTATION.md +126 -0
  182. package/agents/boardroom/templates/scene-templates/SCENE-QUESTION.md +174 -0
  183. package/agents/boardroom/workflows/WORKFLOW-AUDIO-GENERATION.md +421 -0
  184. package/agents/constitution/BASE-CONSTITUTION.md +254 -0
  185. package/agents/council/CRITIC.md +197 -0
  186. package/agents/council/DEVILS-ADVOCATE.md +274 -0
  187. package/agents/council/SYNTHESIZER.md +293 -0
  188. package/agents/council/advogado-do-diabo/AGENT.md +489 -0
  189. package/agents/council/advogado-do-diabo/SOUL.md +100 -0
  190. package/agents/council/critico-metodologico/AGENT.md +670 -0
  191. package/agents/council/critico-metodologico/SOUL.md +107 -0
  192. package/agents/council/sintetizador/AGENT.md +558 -0
  193. package/agents/council/sintetizador/SOUL.md +94 -0
  194. package/agents/persons/_example/AGENT-EXAMPLE.md +42 -0
  195. package/agents/persons/_example/DNA-EXAMPLE.yaml +61 -0
  196. package/agents/protocols/AGENT-COGNITION-PROTOCOL.md +779 -0
  197. package/agents/protocols/AGENT-INTEGRITY-PROTOCOL.md +692 -0
  198. package/agents/protocols/BATCH-VISUAL-PROTOCOL.md +841 -0
  199. package/agents/protocols/DNA-CONFIG-TEMPLATE.yaml +181 -0
  200. package/agents/protocols/DNA-EXTRACTION-PROTOCOL.md +370 -0
  201. package/agents/protocols/EPISTEMIC-PROTOCOL.md +333 -0
  202. package/agents/protocols/LOG-STRUCTURE-PROTOCOL.md +65 -0
  203. package/agents/protocols/MEMORY-PROTOCOL.md +567 -0
  204. package/agents/protocols/NARRATIVE-SYNTHESIS-PROTOCOL.md +278 -0
  205. package/agents/protocols/PHASE-4-VERIFICATION-CHECKPOINT.md +146 -0
  206. package/agents/protocols/SOUL-TEMPLATE.md +416 -0
  207. package/agents/protocols/TEMPLATE-EVOLUTION-PROTOCOL.md +544 -0
  208. package/agents/protocols/VISUAL-DIFF-PROTOCOL.md +159 -0
  209. package/agents/sua-empresa/README.md +44 -0
  210. package/agents/sua-empresa/_example/jds/EXAMPLE-JD.md +42 -0
  211. package/agents/sua-empresa/_example/org/EXAMPLE-ORG.md +32 -0
  212. package/agents/sua-empresa/_example/roles/EXAMPLE-ROLE.md +38 -0
  213. package/bin/cli.js +2 -0
  214. package/bin/lib/ascii-art.js +234 -0
  215. package/bin/lib/installer.js +402 -0
  216. package/bin/lib/setup-wizard.js +95 -0
  217. package/bin/lib/validate-email.js +109 -0
  218. package/bin/mega-brain.js +97 -0
  219. package/bin/push.js +342 -0
  220. package/bin/templates/env.example +38 -0
  221. package/inbox/.gitkeep +0 -0
  222. package/integrations/README.md +46 -0
  223. package/integrations/mcps/MCP-REGISTRY.md +56 -0
  224. package/integrations/mcps/excalidraw/CONFIG.md +56 -0
  225. package/integrations/mcps/gdrive/CONFIG.md +38 -0
  226. package/knowledge/dna/.gitkeep +0 -0
  227. package/knowledge/dossiers/persons/.gitkeep +0 -0
  228. package/knowledge/dossiers/persons/DOSSIER-EXAMPLE.md +49 -0
  229. package/knowledge/dossiers/system/.gitkeep +0 -0
  230. package/knowledge/dossiers/themes/.gitkeep +0 -0
  231. package/knowledge/playbooks/.gitkeep +0 -0
  232. package/knowledge/playbooks/PLAYBOOK-EXAMPLE.md +50 -0
  233. package/knowledge/sources/.gitkeep +0 -0
  234. package/logs/.gitkeep +0 -0
  235. package/package.json +128 -0
  236. package/processing/canonical/.gitkeep +0 -0
  237. package/processing/chunks/.gitkeep +0 -0
  238. package/processing/insights/.gitkeep +0 -0
  239. package/processing/narratives/.gitkeep +0 -0
  240. package/reference/CONSELHO.md +337 -0
  241. package/reference/CONTEXT7_README.md +28 -0
  242. package/reference/JARVIS-LOGGING-PROTOCOL.md +380 -0
  243. package/reference/QUICK-START.md +197 -0
  244. package/reference/README-RALPH-CASCATEAMENTO.md +207 -0
  245. package/reference/TEMPLATE-MASTER.md +727 -0
  246. package/reference/prds/prd-jarvis-mega-brain-v3.md +1305 -0
  247. package/reference/templates/phase5/IMPLEMENTATION-GUIDE.md +355 -0
  248. package/reference/templates/phase5/MOGA-BRAIN-PHASE5-TEMPLATES.md +1284 -0
  249. package/reference/templates/phase5/README.md +165 -0
  250. package/reference/workflow-claude-code-boris-cherny-continuous-claude.md +2232 -0
  251. package/system/database/001_moneyclub_buyers.sql +160 -0
  252. package/system/database/002_premium_token.sql +97 -0
  253. package/system/database/apply-migration.mjs +129 -0
  254. package/system/docs/MEGA-BRAIN-DEMO-COMPLETA.md +1226 -0
  255. package/system/docs/MEGA-BRAIN-MANIFESTO-COMPLETO.md +1054 -0
  256. package/system/docs/MOGA-BRAIN-EXPLICACAO-COMPLETA.md +791 -0
  257. package/system/docs/STRATEGIC-INTEGRATION-GUIDE.md +725 -0
  258. package/system/docs/architecture/01-system-context.md +136 -0
  259. package/system/docs/architecture/02-components.md +225 -0
  260. package/system/docs/architecture/03-data-flow.md +235 -0
  261. package/system/docs/architecture/04-integrations.md +283 -0
  262. package/system/docs/architecture/README.md +71 -0
  263. package/system/docs/architecture/diagrams/component-diagram.mmd +50 -0
  264. package/system/docs/architecture/diagrams/data-flow.mmd +39 -0
  265. package/system/docs/architecture/diagrams/system-overview.mmd +68 -0
  266. package/system/protocols/AGENT-AUTHORITY.md +217 -0
  267. package/system/protocols/CONSTITUICAO-BASE.md +115 -0
  268. package/system/protocols/CONSTITUTION.md +231 -0
  269. package/system/protocols/GOVERNANCE-MAP.md +123 -0
  270. package/system/protocols/HOOK-SECURITY-THREAT-MODEL.md +152 -0
  271. package/system/protocols/ORQUESTRACAO-PROTOCOL.md +215 -0
  272. package/system/protocols/_archive/CHUNKING-PROTOCOL.md +207 -0
  273. package/system/protocols/_archive/ENTITY-RESOLUTION-PROTOCOL.md +269 -0
  274. package/system/protocols/_archive/INSIGHT-EXTRACTION-PROTOCOL.md +257 -0
  275. package/system/protocols/_archive/NARRATIVE-SYNTHESIS-PROTOCOL.md +290 -0
  276. package/system/protocols/agents/AGENT-INTERACTION.md +315 -0
  277. package/system/protocols/agents/CORTEX-PROTOCOL.md +520 -0
  278. package/system/protocols/agents/EPISTEMIC-PROTOCOL.md +465 -0
  279. package/system/protocols/agents/MEMORY-PROTOCOL.md +366 -0
  280. package/system/protocols/agents/WAR-ROOM.md +355 -0
  281. package/system/protocols/company/COMPANY-DOCUMENT-PROTOCOL.md +793 -0
  282. package/system/protocols/company/COMPANY-ENRICHMENT-PROTOCOL.md +679 -0
  283. package/system/protocols/conclave/CONCLAVE-LOG-TEMPLATE-v2.md +309 -0
  284. package/system/protocols/conclave/CONCLAVE-PROTOCOL.md +518 -0
  285. package/system/protocols/conclave/DEBATE-DYNAMICS-CONFIG.yaml +322 -0
  286. package/system/protocols/conclave/DEBATE-DYNAMICS-PROTOCOL.md +613 -0
  287. package/system/protocols/conclave/DEBATE-PROTOCOL.md +323 -0
  288. package/system/protocols/council/COUNCIL-LOG-TEMPLATE-v2.md +309 -0
  289. package/system/protocols/council/COUNCIL-PROTOCOL.md +518 -0
  290. package/system/protocols/council/DEBATE-DYNAMICS-CONFIG.yaml +322 -0
  291. package/system/protocols/council/DEBATE-DYNAMICS-PROTOCOL.md +613 -0
  292. package/system/protocols/council/DEBATE-PROTOCOL.md +323 -0
  293. package/system/protocols/dna/DNA-EXTRACTION-PROTOCOL.md +1214 -0
  294. package/system/protocols/dna/ENRICHMENT-PROTOCOL.md +408 -0
  295. package/system/protocols/dna/REASONING-MODEL-PROTOCOL.md +331 -0
  296. package/system/protocols/pipeline/DOSSIER-COMPILATION-PROTOCOL.md +790 -0
  297. package/system/protocols/pipeline/NARRATIVE-METABOLISM-PROTOCOL.md +292 -0
  298. package/system/protocols/pipeline/PIPELINE-JARVIS-v2.1.md +606 -0
  299. package/system/protocols/pipeline/PROMPT-1.1-CHUNKING.md +154 -0
  300. package/system/protocols/pipeline/PROMPT-1.2-ENTITY-RESOLUTION.md +186 -0
  301. package/system/protocols/pipeline/PROMPT-2.1-DNA-TAGS-INCREMENT.md +208 -0
  302. package/system/protocols/pipeline/PROMPT-2.1-INSIGHT-EXTRACTION.md +191 -0
  303. package/system/protocols/pipeline/PROMPT-3.1-NARRATIVE-SYNTHESIS.md +331 -0
  304. package/system/protocols/pipeline/SOURCES-COMPILATION-PROTOCOL.md +340 -0
  305. package/system/protocols/system/AUTO-LOG-PROTOCOL.md +369 -0
  306. package/system/protocols/system/CHECKPOINT-ENFORCEMENT.md +176 -0
  307. package/system/protocols/system/ENFORCEMENT.md +435 -0
  308. package/system/protocols/system/LOG-TEMPLATES.md +1068 -0
@@ -0,0 +1,1305 @@
1
+ # PRD: JARVIS MEGA BRAIN v3.0
2
+ ## Sistema de Inteligência Autônomo Completo
3
+
4
+ ---
5
+
6
+ ## Executive Summary
7
+
8
+ Sistema JARVIS/MEGA BRAIN completo com arquitetura Python, composto por:
9
+ - **Knowledge Engine** vetorial (ChromaDB + SQLite FTS)
10
+ - **Sistema de Agentes** multi-perspectiva (Position + Person + Council)
11
+ - **Debate Engine** estruturado multi-rodadas
12
+ - **Query Engine** com 30 perguntas críticas e gap analysis
13
+ - **Pipeline de Ingestão** com classificação automática
14
+ - **JARVIS Server** (FastAPI) com CLI
15
+ - **Infraestrutura** de deployment (Docker + Nginx + Prometheus)
16
+
17
+ **Baseado em:** JARVIS-MEGA-BRAIN-FULL-IMPLEMENTATION.md (10 partes consolidadas)
18
+
19
+ **Status PRD v2.0:** PAUSADO (80% pendente - Fases 3-8)
20
+
21
+ ---
22
+
23
+ ## Norte-Estrela
24
+
25
+ > **"Sistema de inteligência autônomo que faz 30 perguntas críticas antes de responder, debate perspectivas de múltiplos especialistas, e opera 24/7 com contexto completo da [SUA EMPRESA]."**
26
+
27
+ ---
28
+
29
+ ## Arquitetura do Sistema
30
+
31
+ ```
32
+ ┌─────────────────────────────────────────────────────────────────────────────┐
33
+ │ MEGA BRAIN SYSTEM │
34
+ ├─────────────────────────────────────────────────────────────────────────────┤
35
+ │ │
36
+ │ USER → API → JARVIS ORCHESTRATOR │
37
+ │ │ │
38
+ │ ┌───────────┼───────────┐ │
39
+ │ ▼ ▼ ▼ │
40
+ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
41
+ │ │ QUERY │ │ AGENTS │ │ DEBATE │ │
42
+ │ │ ENGINE │ │ SYSTEM │ │ ENGINE │ │
43
+ │ │ │ │ │ │ │ │
44
+ │ │ 30 Pergs │ │ CRO/CMO │ │ Council │ │
45
+ │ │ Gap Anal │ │ Hormozi │ │ Synth │ │
46
+ │ │ Caveats │ │ Cole │ │ Templates│ │
47
+ │ └────┬─────┘ └────┬─────┘ └────┬─────┘ │
48
+ │ │ │ │ │
49
+ │ └────────────┼────────────┘ │
50
+ │ ▼ │
51
+ │ ┌──────────────┐ │
52
+ │ │ KNOWLEDGE │ │
53
+ │ │ ENGINE │ │
54
+ │ │ │ │
55
+ │ │ ChromaDB │ │
56
+ │ │ SQLite+FTS │ │
57
+ │ └──────┬───────┘ │
58
+ │ │ │
59
+ │ ┌───────────┼───────────┐ │
60
+ │ ▼ ▼ ▼ │
61
+ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
62
+ │ │ [SUA EMPRESA] │ │ DNA │ │PIPELINE │ │
63
+ │ │ BANK │ │ LIBRARY │ │ JARVIS │ │
64
+ │ │ │ │ │ │ │ │
65
+ │ │ Empresa │ │ Hormozi │ │ Intake │ │
66
+ │ │ Calls │ │ Cole │ │ Process │ │
67
+ │ └─────────┘ └─────────┘ └─────────┘ │
68
+ │ │
69
+ └─────────────────────────────────────────────────────────────────────────────┘
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Diferença do PRD v2.0
75
+
76
+ | Aspecto | PRD v2.0 | PRD v3.0 |
77
+ |---------|----------|----------|
78
+ | Foco | Skills e automações N8N | Arquitetura Python completa |
79
+ | Agentes | Skills ativados por comando | Agentes Python com orchestrator |
80
+ | Knowledge | Arquivos Markdown | ChromaDB + SQLite FTS |
81
+ | Query | Simples | 30 perguntas críticas + gap analysis |
82
+ | Debate | Council básico | Debate Engine multi-rodadas |
83
+ | Deploy | Local | Docker + Nginx + Prometheus |
84
+
85
+ ---
86
+
87
+ ## Estrutura de Diretórios Final
88
+
89
+ ```
90
+ MEGA-BRAIN/
91
+ ├── src/
92
+ │ ├── __init__.py
93
+ │ ├── config.py # Configurações centralizadas
94
+ │ ├── main.py # Entry point
95
+ │ │
96
+ │ ├── core/ # Componentes fundamentais
97
+ │ │ ├── __init__.py
98
+ │ │ ├── types.py # Tipos e enums
99
+ │ │ ├── brain.py # Cliente Claude
100
+ │ │ └── base_agent.py # Classe base agentes
101
+ │ │
102
+ │ ├── knowledge/ # Knowledge Engine
103
+ │ │ ├── __init__.py
104
+ │ │ ├── chunker.py # Chunking semântico
105
+ │ │ ├── embedder.py # Embeddings Voyage/OpenAI
106
+ │ │ ├── vector_store.py # ChromaDB wrapper
107
+ │ │ ├── structured_store.py # SQLite + FTS
108
+ │ │ └── engine.py # Knowledge Engine principal
109
+ │ │
110
+ │ ├── pipeline/ # Pipeline de Ingestão
111
+ │ │ ├── __init__.py
112
+ │ │ ├── intake.py # Intake Manager
113
+ │ │ ├── classifier.py # Classificador de conteúdo
114
+ │ │ └── pipeline.py # Pipeline unificado
115
+ │ │
116
+ │ ├── agents/ # Sistema de Agentes
117
+ │ │ ├── __init__.py
118
+ │ │ ├── position_agents.py # CRO, CMO, COO, CFO
119
+ │ │ ├── person_agents.py # Digital Twins (Hormozi, etc)
120
+ │ │ ├── council.py # Council System
121
+ │ │ └── orchestrator.py # Orquestrador principal
122
+ │ │
123
+ │ ├── debate/ # Sistema de Debates
124
+ │ │ ├── __init__.py
125
+ │ │ └── engine.py # Debate Engine
126
+ │ │
127
+ │ ├── query/ # Query Inteligente
128
+ │ │ ├── __init__.py
129
+ │ │ └── engine.py # Query Engine (30 perguntas)
130
+ │ │
131
+ │ ├── server/ # JARVIS Server
132
+ │ │ ├── __init__.py
133
+ │ │ └── app.py # FastAPI App
134
+ │ │
135
+ │ └── utils/ # Utilitários
136
+ │ └── __init__.py
137
+
138
+ ├── data/ # Dados (gitignore)
139
+ │ ├── [sua-empresa]-bank/
140
+ │ ├── dna-library/
141
+ │ ├── knowledge-engine/
142
+ │ │ ├── chroma/
143
+ │ │ └── structured.db
144
+ │ └── inbox/
145
+
146
+ ├── cli/
147
+ │ └── jarvis # CLI principal
148
+
149
+ ├── scripts/
150
+ │ ├── backup.sh
151
+ │ ├── deploy.sh
152
+ │ ├── health_check.sh
153
+ │ └── setup.sh
154
+
155
+ ├── monitoring/
156
+ │ ├── prometheus.yml
157
+ │ └── alerts.yml
158
+
159
+ ├── nginx/
160
+ │ └── nginx.conf
161
+
162
+ ├── requirements.txt
163
+ ├── .env.example
164
+ ├── .gitignore
165
+ ├── Dockerfile
166
+ ├── Dockerfile.prod
167
+ ├── docker-compose.yml
168
+ ├── docker-compose.prod.yml
169
+ ├── CLAUDE.md
170
+ └── RUNBOOK.md
171
+ ```
172
+
173
+ ---
174
+
175
+ # FASES DE IMPLEMENTAÇÃO
176
+
177
+ ---
178
+
179
+ ## FASE 1: CORE INFRASTRUCTURE
180
+ **Prioridade:** CRÍTICA
181
+ **Dependências:** Nenhuma
182
+
183
+ ### US-V3-001: Criar Estrutura de Diretórios e Setup
184
+
185
+ **Descrição:** Criar toda a estrutura de diretórios do projeto e scripts de setup.
186
+
187
+ **Acceptance Criteria:**
188
+ - [ ] Criar estrutura `src/` com subpastas: core, knowledge, pipeline, agents, debate, query, server, utils
189
+ - [ ] Criar todos os arquivos `__init__.py`
190
+ - [ ] Criar `cli/jarvis` (executável Python)
191
+ - [ ] Criar `scripts/setup.sh` com:
192
+ - Verificação de Python 3.11+
193
+ - Criação de venv
194
+ - Instalação de requirements
195
+ - Criação de diretórios data/
196
+ - Cópia de .env.example para .env
197
+ - [ ] Criar `scripts/backup.sh` (backup + rotação 7 dias)
198
+ - [ ] Criar `scripts/deploy.sh` (build + deploy + health check)
199
+ - [ ] Criar `scripts/health_check.sh`
200
+ - [ ] Criar `requirements.txt` com todas as dependências
201
+ - [ ] Criar `.env.example` com todas as variáveis
202
+ - [ ] Criar `.gitignore` completo
203
+
204
+ **Arquivos a criar:**
205
+ ```
206
+ - src/__init__.py
207
+ - src/core/__init__.py
208
+ - src/knowledge/__init__.py
209
+ - src/pipeline/__init__.py
210
+ - src/agents/__init__.py
211
+ - src/debate/__init__.py
212
+ - src/query/__init__.py
213
+ - src/server/__init__.py
214
+ - src/utils/__init__.py
215
+ - cli/jarvis
216
+ - scripts/setup.sh
217
+ - scripts/backup.sh
218
+ - scripts/deploy.sh
219
+ - scripts/health_check.sh
220
+ - requirements.txt
221
+ - .env.example
222
+ - .gitignore
223
+ ```
224
+
225
+ ---
226
+
227
+ ### US-V3-002: Implementar Core Types
228
+
229
+ **Descrição:** Criar todos os tipos, enums e dataclasses base do sistema.
230
+
231
+ **Acceptance Criteria:**
232
+ - [ ] Criar `src/core/types.py` com:
233
+
234
+ **Enums:**
235
+ ```python
236
+ AgentType = POSITION | PERSON | COUNCIL | SYSTEM
237
+ VoteType = APPROVE | REJECT | MODIFY | ABSTAIN | DEFER
238
+ ConsensusType = UNANIMOUS | MAJORITY | COMPROMISE | SYNTHESIS | NO_CONSENSUS
239
+ QuestionCategory = CONTEXT | DATA | STRATEGIC | RISK | TIMELINE | RESOURCE | STAKEHOLDER | SUCCESS | EXECUTION
240
+ QuestionPriority = CRITICAL | HIGH | MEDIUM | LOW
241
+ ConfidenceLevel = HIGH | MEDIUM | LOW | VERY_LOW
242
+ DataSource = [SUA EMPRESA]_BANK | DNA_LIBRARY | USER_PROVIDED | INFERRED | UNKNOWN
243
+ FileStatus = PENDING | PROCESSING | COMPLETED | FAILED | SKIPPED
244
+ FileType = MARKDOWN | TEXT | PDF | DOCX | JSON | AUDIO | VIDEO | UNKNOWN
245
+ ContentDestination = [SUA EMPRESA]_BANK | DNA_LIBRARY | UNKNOWN
246
+ [Sua Empresa]Category = CALL | FINANCIAL | TEAM | DECISION | PRODUCT | PROCESS | CLIENT | GENERAL
247
+ PipelineStage = INTAKE | CLASSIFICATION | CHUNKING | ENTITY_RESOLUTION | INSIGHT_EXTRACTION | INDEXING | COMPLETED | FAILED
248
+ DebateType = QUICK | COUNCIL | FULL | ADVERSARIAL
249
+ CouncilRole = CRITIC | DEVIL_ADVOCATE | RISK_ASSESSOR | FACT_CHECKER | SYNTHESIZER
250
+ ```
251
+
252
+ **Dataclasses:**
253
+ ```python
254
+ @dataclass CriticalQuestion: id, question, category, priority, why_important, possible_sources, answer?, source?, confidence?
255
+ @dataclass GapAnalysis: total_questions, answered, unanswered, critical_gaps, coverage_score, confidence_level, can_proceed
256
+ @dataclass AgentConfig: name, type, description, system_prompt, temperature, activation_keywords, knowledge_sources?
257
+ @dataclass AgentResponse: agent_id, agent_name, content, confidence, metadata
258
+ @dataclass FileRecord: id, path, filename, file_type, size_bytes, hash_md5, status, detected_source, metadata, timestamps
259
+ @dataclass ChunkConfig: max_chunk_size, min_chunk_size, overlap, respect_sentences, respect_paragraphs
260
+ @dataclass PipelineJob: id, file_id, filename, stage, classification, chunks, entities, insights, errors, timestamps
261
+ @dataclass DebatePosition: participant, position, arguments, vote, confidence, conditions
262
+ @dataclass DebateSynthesis: summary, consensus_type, agreements, disagreements, recommendation, action_items
263
+ @dataclass CouncilEvaluation: role, assessment, issues_found, recommendations, vote, confidence
264
+ ```
265
+
266
+ ---
267
+
268
+ ### US-V3-003: Implementar Config Settings
269
+
270
+ **Descrição:** Criar sistema de configuração centralizado com Pydantic.
271
+
272
+ **Acceptance Criteria:**
273
+ - [ ] Criar `src/config.py` com class Settings(BaseSettings):
274
+ - API Keys: anthropic_api_key, voyage_api_key, openai_api_key
275
+ - Paths: base_path, knowledge_path, [sua-empresa]_bank_path, dna_library_path, inbox_path, chroma_path, sqlite_path
276
+ - Server: host, port, debug
277
+ - Redis: redis_url
278
+ - Models: claude_model, embedding_model, max_tokens
279
+ - Night Mode: night_start_hour, night_end_hour
280
+ - Knowledge Engine: chunk_size, chunk_overlap, max_search_results
281
+ - Query Engine: max_questions, min_coverage_to_respond
282
+ - [ ] Método `ensure_directories()` para criar pastas necessárias
283
+ - [ ] Carregar de .env automaticamente
284
+ - [ ] Instância global `settings = Settings()`
285
+
286
+ ---
287
+
288
+ ### US-V3-004: Implementar Brain Client (Claude)
289
+
290
+ **Descrição:** Cliente para comunicação com Claude API.
291
+
292
+ **Acceptance Criteria:**
293
+ - [ ] Criar `src/core/brain.py` com class ClaudeBrain:
294
+ - Inicialização com anthropic client
295
+ - Método `async think(prompt, temperature=0.7, max_tokens=4096) -> str`
296
+ - Método `async think_json(prompt, temperature=0.5) -> Dict` com parse JSON
297
+ - Método `async extract_entities(text) -> List[Dict]`
298
+ - Retry logic com tenacity (3 tentativas, exponential backoff)
299
+ - Logging de requests/responses
300
+ - Tratamento de rate limits
301
+
302
+ ---
303
+
304
+ ### US-V3-005: Implementar Base Agent
305
+
306
+ **Descrição:** Classe base para todos os agentes.
307
+
308
+ **Acceptance Criteria:**
309
+ - [ ] Criar `src/core/base_agent.py` com class BaseAgent:
310
+ - `__init__(config: AgentConfig, brain_client, knowledge_engine)`
311
+ - `async think(task: str, context: Dict) -> AgentResponse` (abstract)
312
+ - `should_activate(query: str) -> bool` (verifica activation_keywords)
313
+ - `async gather_context(query: str) -> str` (busca no knowledge)
314
+ - `async call_brain(prompt: str) -> str` (wrapper do brain)
315
+ - `get_system_prompt() -> str`
316
+ - Propriedades: id, name, type, description
317
+
318
+ ---
319
+
320
+ ## FASE 2: KNOWLEDGE ENGINE
321
+ **Prioridade:** CRÍTICA
322
+ **Dependências:** Fase 1
323
+
324
+ ### US-V3-006: Implementar Semantic Chunker
325
+
326
+ **Descrição:** Sistema de chunking semântico inteligente.
327
+
328
+ **Acceptance Criteria:**
329
+ - [ ] Criar `src/knowledge/chunker.py` com class SemanticChunker:
330
+ - ChunkConfig com: max_chunk_size=1000, min_chunk_size=100, overlap=100
331
+ - Detectar headers markdown (# ## ### etc)
332
+ - Detectar headers texto (CAPS, numbered sections)
333
+ - `_split_by_headers(text) -> List[Dict]`
334
+ - `_chunk_section(text, header) -> List[str]`
335
+ - `_chunk_by_sentences(text) -> List[str]`
336
+ - `_add_overlap(chunks) -> List[Dict]`
337
+ - `chunk(text, metadata) -> List[Dict]` retorna chunks com content e metadata
338
+ - Respeitar parágrafos quando possível
339
+ - Respeitar sentenças (não cortar no meio)
340
+
341
+ ---
342
+
343
+ ### US-V3-007: Implementar Text Embedder
344
+
345
+ **Descrição:** Gerador de embeddings com Voyage AI e fallback OpenAI.
346
+
347
+ **Acceptance Criteria:**
348
+ - [ ] Criar `src/knowledge/embedder.py` com class TextEmbedder:
349
+ - Inicialização com voyage_api_key e openai_api_key
350
+ - Lazy loading de clients (_voyage_client, _openai_client)
351
+ - `async embed(text: str) -> List[float]`
352
+ - `async embed_batch(texts: List[str]) -> List[List[float]]`
353
+ - Voyage AI como preferencial (model: voyage-large-2)
354
+ - Fallback para OpenAI (model: text-embedding-3-small)
355
+ - `get_dimensions() -> int` retorna dimensão do modelo
356
+ - Tratamento de erros com fallback
357
+
358
+ ---
359
+
360
+ ### US-V3-008: Implementar Vector Store (ChromaDB)
361
+
362
+ **Descrição:** Wrapper para ChromaDB com persistência.
363
+
364
+ **Acceptance Criteria:**
365
+ - [ ] Criar `src/knowledge/vector_store.py` com class VectorStore:
366
+ - Inicialização com persist_path
367
+ - Lazy loading do client ChromaDB
368
+ - Collections: [sua-empresa]_bank, dna_library
369
+ - `get_or_create_collection(name, metadata) -> Collection`
370
+ - `async add(collection_name, ids, embeddings, documents, metadatas)`
371
+ - `async query(collection_name, query_embedding, n_results, where, include) -> Dict`
372
+ - `async delete(collection_name, ids?, where?)`
373
+ - `get_stats(collection_name?) -> Dict`
374
+
375
+ ---
376
+
377
+ ### US-V3-009: Implementar Structured Store (SQLite FTS)
378
+
379
+ **Descrição:** Store estruturado com SQLite e Full-Text Search.
380
+
381
+ **Acceptance Criteria:**
382
+ - [ ] Criar `src/knowledge/structured_store.py` com class StructuredStore:
383
+ - Inicialização com db_path
384
+ - `_init_db()` cria tabelas:
385
+ - documents (id, content, source, category, metadata, timestamps)
386
+ - documents_fts (FTS5 virtual table)
387
+ - entities (id, canonical_name, entity_type, aliases, metadata)
388
+ - insights (id, tag, content, source_document, confidence, metadata)
389
+ - Triggers para sincronizar FTS automaticamente
390
+ - `async insert_document(doc_id, content, source, category, metadata)`
391
+ - `async search_fts(query, source?, category?, limit) -> List[Dict]`
392
+ - `async insert_entity(entity_id, canonical_name, entity_type, aliases, metadata)`
393
+ - `async insert_insight(insight_id, tag, content, source_document, confidence, metadata)`
394
+ - `async get_insights_by_tag(tag, limit) -> List[Dict]`
395
+ - `get_stats() -> Dict`
396
+
397
+ ---
398
+
399
+ ### US-V3-010: Implementar Knowledge Engine Principal
400
+
401
+ **Descrição:** Motor de conhecimento unificado combinando vector + FTS.
402
+
403
+ **Acceptance Criteria:**
404
+ - [ ] Criar `src/knowledge/engine.py` com class KnowledgeEngine:
405
+ - Inicialização com chroma_path, sqlite_path, api_keys, brain
406
+ - Instanciar: VectorStore, StructuredStore, TextEmbedder, SemanticChunker
407
+ - Collections: COLLECTIONS = {"[sua-empresa]": "[sua-empresa]_bank", "dna": "dna_library"}
408
+ - `async index_document(document_id, content, metadata, source)`:
409
+ 1. Chunkar documento
410
+ 2. Gerar embeddings batch
411
+ 3. Indexar no vector store
412
+ 4. Indexar no structured store
413
+ - `async search(query, source?, n_results, use_hybrid) -> List[Dict]`:
414
+ 1. Busca vetorial em collections relevantes
415
+ 2. Busca FTS (se hybrid)
416
+ 3. Combinar, dedupe por hash, ordenar por score
417
+ - `async get_context_for_query(query, max_tokens, source) -> str`
418
+ - `get_stats() -> Dict`
419
+ - Deduplicação por hash MD5
420
+
421
+ ---
422
+
423
+ ## FASE 3: PIPELINE DE INGESTÃO
424
+ **Prioridade:** ALTA
425
+ **Dependências:** Fase 2
426
+
427
+ ### US-V3-011: Implementar Intake Manager
428
+
429
+ **Descrição:** Gerenciador de entrada de arquivos.
430
+
431
+ **Acceptance Criteria:**
432
+ - [ ] Criar `src/pipeline/intake.py` com class IntakeManager:
433
+ - FileRecord dataclass completa
434
+ - SUPPORTED_EXTENSIONS por FileType
435
+ - Inicialização com inbox_path, processed_path, registry_path
436
+ - `_load_registry()` / `_save_registry()` (JSON persistente)
437
+ - `_calculate_hash(file_path) -> str` (MD5)
438
+ - `_detect_file_type(file_path) -> FileType`
439
+ - `_generate_id(file_path) -> str`
440
+ - `scan_inbox() -> List[FileRecord]`:
441
+ - Escanear recursivamente
442
+ - Calcular hash para detectar duplicatas
443
+ - Registrar novos arquivos
444
+ - `get_pending_files() -> List[FileRecord]`
445
+ - `update_status(file_id, status, error_message?, metadata?)`
446
+ - `set_detected_source(file_id, source)`
447
+ - `move_to_processed(file_id) -> bool`
448
+ - `get_stats() -> Dict`
449
+
450
+ ---
451
+
452
+ ### US-V3-012: Implementar Content Classifier
453
+
454
+ **Descrição:** Classificador de conteúdo ([Sua Empresa] Bank vs DNA Library).
455
+
456
+ **Acceptance Criteria:**
457
+ - [ ] Criar `src/pipeline/classifier.py` com class ContentClassifier:
458
+ - [SUA EMPRESA]_KEYWORDS por [Sua Empresa]Category (call, financial, team, decision, product, process, client)
459
+ - [SUA EMPRESA]_PATTERNS (regex: nossa empresa, [sua-empresa], call transcription, etc)
460
+ - DNA_PATTERNS (regex: [FILOSOFIA], [FRAMEWORK], segundo hormozi, etc)
461
+ - `_count_keyword_matches(text, keywords_dict) -> Dict[str, int]`
462
+ - `_check_patterns(text, patterns) -> int`
463
+ - `classify(content, filename?, metadata?) -> Dict`:
464
+ - destination: [sua-empresa] ou dna
465
+ - confidence: 0.0-1.0
466
+ - category: categoria específica
467
+ - scores: [sua-empresa]_score, dna_score
468
+ - matches: detalhes
469
+ - `async classify_with_ai(content, filename?) -> Dict` (usar brain para casos ambíguos)
470
+
471
+ ---
472
+
473
+ ### US-V3-013: Implementar Pipeline Unificado
474
+
475
+ **Descrição:** Orquestrador do pipeline de processamento.
476
+
477
+ **Acceptance Criteria:**
478
+ - [ ] Criar `src/pipeline/pipeline.py` com class JarvisPipeline:
479
+ - PipelineJob dataclass completa
480
+ - Inicialização com intake_manager, classifier, knowledge_engine, brain_client
481
+ - `async process_file(file_record: FileRecord) -> PipelineJob`:
482
+ 1. INTAKE: Ler conteúdo (_read_file)
483
+ 2. CLASSIFICATION: Classificar ([sua-empresa]/dna)
484
+ 3. CHUNKING: Quebrar em chunks (_chunk_content)
485
+ 4. ENTITY_RESOLUTION: Extrair entidades (_resolve_entities)
486
+ 5. INSIGHT_EXTRACTION: Extrair insights com tags DNA (_extract_insights)
487
+ 6. INDEXING: Indexar no Knowledge Engine (_index_content)
488
+ 7. COMPLETED: Atualizar status
489
+ - `_read_file(file_record) -> str` (suportar md, txt, json, pdf, docx)
490
+ - `_chunk_content(content, classification) -> List[Dict]`
491
+ - `_resolve_entities(chunks) -> List[Dict]`
492
+ - `_extract_insights(chunks, classification) -> List[Dict]` com tags [FILOSOFIA], [FRAMEWORK], etc
493
+ - `_index_content(chunks, entities, insights, classification, file_record)`
494
+ - `async process_all_pending() -> List[PipelineJob]`
495
+ - `get_job(job_id) -> PipelineJob`
496
+ - `get_stats() -> Dict`
497
+
498
+ ---
499
+
500
+ ## FASE 4: SISTEMA DE AGENTES
501
+ **Prioridade:** ALTA
502
+ **Dependências:** Fases 1-3
503
+
504
+ ### US-V3-014: Implementar Position Agents
505
+
506
+ **Descrição:** Agentes de cargo (C-Level).
507
+
508
+ **Acceptance Criteria:**
509
+ - [ ] Criar `src/agents/position_agents.py` com:
510
+
511
+ **POSITION_CONFIGS dict com AgentConfig para:**
512
+
513
+ **CRO (Chief Revenue Officer):**
514
+ - Responsabilidades: Receita, pipeline, conversão, time de vendas, comissões
515
+ - KPIs: MRR/ARR, pipeline value, win rate, sales cycle, CAC, LTV/CAC
516
+ - activation_keywords: vendas, sales, receita, revenue, pipeline, conversão, closer, comissão, quota, meta
517
+
518
+ **CMO (Chief Marketing Officer):**
519
+ - Responsabilidades: Leads, brand, posicionamento, canais, conteúdo, funis
520
+ - KPIs: CPL, MQLs/SQLs, conversão funil, brand metrics, engagement, ROI campanhas
521
+ - activation_keywords: marketing, leads, campanha, funil, conteúdo, marca, brand, tráfego, cpl, aquisição
522
+
523
+ **COO (Chief Operating Officer):**
524
+ - Responsabilidades: Processos, eficiência, delivery, infraestrutura, automações
525
+ - KPIs: Produtividade, tempo entrega, taxa erro, NPS, custo/operação, automação rate
526
+ - activation_keywords: operação, processo, eficiência, automação, delivery, sop, qualidade, gargalo, escala
527
+
528
+ **CFO (Chief Financial Officer):**
529
+ - Responsabilidades: Saúde financeira, cash flow, investimentos, custos, compliance
530
+ - KPIs: EBITDA, burn rate, runway, gross margin, operating margin, unit economics
531
+ - activation_keywords: financeiro, caixa, margem, investimento, custo, orçamento, roi, payback, runway
532
+
533
+ **class PositionAgent(BaseAgent):**
534
+ - `async think(task, context) -> AgentResponse`
535
+ - System prompt específico por cargo
536
+ - Busca contexto no knowledge engine
537
+
538
+ **Factory function:**
539
+ - `create_position_agent(role, brain_client, knowledge_engine) -> PositionAgent`
540
+
541
+ ---
542
+
543
+ ### US-V3-015: Implementar Person Agents (Digital Twins)
544
+
545
+ **Descrição:** Agentes de pessoa/mentor que replicam o pensamento.
546
+
547
+ **Acceptance Criteria:**
548
+ - [ ] Criar `src/agents/person_agents.py` com:
549
+
550
+ **PERSON_CONFIGS dict com AgentConfig para:**
551
+
552
+ **HORMOZI (Alex Hormozi):**
553
+ - Expertise: Ofertas, escala, value equation, acquisition
554
+ - Filosofia: "Make offers so good people feel stupid saying no", Volume negates luck, Skills pay bills
555
+ - Frameworks: Value Equation, Grand Slam Offer, Lead Magnet Creation
556
+ - Heurísticas: 10x Test, Name Test, FOMO Check
557
+ - Tom: Direto, confiante, data-driven, usa números específicos
558
+ - activation_keywords: hormozi, oferta, offer, value equation, grand slam, escala, scale, acquisition
559
+
560
+ **COLE_GORDON:**
561
+ - Expertise: Vendas high-ticket, estrutura de times, objection handling
562
+ - Filosofia: "Sales is a process, not a personality", Commission creates alignment
563
+ - Frameworks: CLOSER Framework, Commission Structure Design, Objection Handling Matrix
564
+ - Heurísticas: 80/20 Discovery, Pain Stack, Objection = Question
565
+ - Tom: Calmo, consultivo, curioso, nunca parece vendendo
566
+ - activation_keywords: cole gordon, closer, vendas, sales, comissão, script, objeção, discovery
567
+
568
+ - Expertise: Gestão, OKRs, métricas, cultura
569
+ - Filosofia: Gestão por indicadores, Norte Verdadeiro, Cultura de alta performance
570
+ - Frameworks: OKRs, Norte Verdadeiro, Gestão 4.0
571
+ - Tom: Analítico, orientado a indicadores, pragmático
572
+ - activation_keywords: g4, okr, gestão, métrica, kpi, norte verdadeiro, indicador, performance
573
+
574
+ **BRUNSON (Russell Brunson):**
575
+ - Expertise: Funis, copy, lançamentos, value ladder
576
+ - Filosofia: Funis são a nova forma de fazer negócios, Hook Story Offer
577
+ - Frameworks: Hook Story Offer, Value Ladder, Perfect Webinar
578
+ - Tom: Entusiasmado, storytelling, exemplos pessoais
579
+ - activation_keywords: brunson, funil, funnel, copy, landing, webinar, lançamento, value ladder, clickfunnels
580
+
581
+ **PEDRO_VALERIO:**
582
+ - Expertise: Automação, processos, ClickUp, operações
583
+ - Filosofia: Task First, Automação libera tempo, Processo bom roda sem você
584
+ - Frameworks: Task First, Automation Flow, Process Documentation
585
+ - Tom: Prático, objetivo, focado em execução
586
+ - activation_keywords: pedro, valério, clickup, automação, processo, task, tarefa, workflow, sop, operação
587
+
588
+ **class PersonAgent(BaseAgent):**
589
+ - Fala em primeira pessoa
590
+ - `async think(task, context) -> AgentResponse`
591
+ - DNA completo no system prompt
592
+
593
+ **Factory function:**
594
+ - `create_person_agent(person, brain_client, knowledge_engine) -> PersonAgent`
595
+
596
+ ---
597
+
598
+ ### US-V3-016: Implementar Council System
599
+
600
+ **Descrição:** Sistema de meta-avaliadores (Council).
601
+
602
+ **Acceptance Criteria:**
603
+ - [ ] Criar `src/agents/council.py` com:
604
+
605
+ **CouncilRole enum:** CRITIC, DEVIL_ADVOCATE, RISK_ASSESSOR, FACT_CHECKER, SYNTHESIZER
606
+
607
+ **CouncilEvaluation dataclass:** role, assessment, issues_found, recommendations, vote, confidence
608
+
609
+ **COUNCIL_CONFIGS dict com AgentConfig para:**
610
+
611
+ **CRITIC (Methodological Critic):**
612
+ - Avalia qualidade lógica e metodológica
613
+ - Procura: saltos lógicos, premissas não fundamentadas, vieses, generalização indevida
614
+ - Abordagem: Rigoroso mas construtivo
615
+
616
+ **DEVIL_ADVOCATE:**
617
+ - Apresenta contra-argumentos fortes
618
+ - Pergunta: "E se estivermos completamente errados?", "Qual o pior cenário?"
619
+ - Abordagem: Propositalmente contrário, stress test intelectual
620
+
621
+ **RISK_ASSESSOR:**
622
+ - Mapeia e avalia riscos (probabilidade x impacto)
623
+ - Categorias: Financeiro, Operacional, Reputacional, Legal, Estratégico, Pessoas
624
+ - Abordagem: Sistemático, quantifica, sugere mitigação
625
+
626
+ **FACT_CHECKER:**
627
+ - Verifica fatos e dados
628
+ - Classifica: FATO VERIFICADO, NÃO VERIFICADO, OPINIÃO, PROJEÇÃO, INCONSISTÊNCIA
629
+ - Abordagem: Preciso, objetivo, aponta lacunas
630
+
631
+ **SYNTHESIZER:**
632
+ - Integra perspectivas divergentes
633
+ - Busca: Padrões, pontos de concordância, próximos passos acionáveis
634
+ - Abordagem: Diplomático, prioriza ação
635
+
636
+ **class CouncilAgent(BaseAgent):**
637
+ - `async evaluate(proposal, context) -> CouncilEvaluation`
638
+
639
+ **class CouncilSystem:**
640
+ - Inicialização cria todos os agentes do council
641
+ - `async evaluate(proposal, context, roles?) -> Dict`:
642
+ 1. Coletar avaliações de cada role (exceto SYNTHESIZER)
643
+ 2. Contar votos
644
+ 3. SYNTHESIZER sintetiza no final
645
+ 4. Retornar: evaluations, votes, synthesis, recommendation
646
+ - `_determine_recommendation(votes, evaluations) -> str` (APPROVE/REJECT/MODIFY/NEEDS_DISCUSSION)
647
+
648
+ ---
649
+
650
+ ### US-V3-017: Implementar Agent Orchestrator
651
+
652
+ **Descrição:** Orquestrador principal que coordena todos os agentes.
653
+
654
+ **Acceptance Criteria:**
655
+ - [ ] Criar `src/agents/orchestrator.py` com class AgentOrchestrator:
656
+ - Inicialização com brain_client, knowledge_engine
657
+ - `_init_agents()`:
658
+ - Criar todos os Position Agents
659
+ - Criar todos os Person Agents
660
+ - Criar CouncilSystem
661
+ - `async process(query, context?, require_council?, specific_agents?) -> Dict`:
662
+ 1. Selecionar agentes (auto ou específicos)
663
+ 2. Coletar respostas de cada agente
664
+ 3. Council evaluation (se necessário)
665
+ 4. Sintetizar resposta final
666
+ 5. Retornar: query, agents_used, responses, council_evaluation, final_response, processing_time
667
+ - `async consult_expert(expert, question, context) -> AgentResponse`
668
+ - `async _select_agents(query) -> List[str]` (baseado em keywords)
669
+ - `_get_agent(agent_id) -> BaseAgent`
670
+ - `async _synthesize(query, responses, council_result) -> str`
671
+ - `get_available_agents() -> Dict` (lista todos)
672
+
673
+ ---
674
+
675
+ ## FASE 5: DEBATE ENGINE
676
+ **Prioridade:** MÉDIA
677
+ **Dependências:** Fase 4
678
+
679
+ ### US-V3-018: Implementar Debate Engine
680
+
681
+ **Descrição:** Sistema de debates estruturados multi-perspectiva.
682
+
683
+ **Acceptance Criteria:**
684
+ - [ ] Criar `src/debate/engine.py` com class DebateEngine:
685
+
686
+ **DNA_PERSPECTIVES dict com focus, style, key_questions para cada mentor**
687
+
688
+ **DebateType enum:** QUICK, COUNCIL, FULL, ADVERSARIAL
689
+
690
+ **DebatePosition dataclass:** participant, position, arguments, vote, confidence, conditions
691
+
692
+ **DebateSynthesis dataclass:** summary, consensus_type, agreements, disagreements, recommendation, action_items
693
+
694
+ **Métodos:**
695
+ - `async quick_decision(topic, participants?) -> Dict`:
696
+ - 1 rodada, 2-3 participantes
697
+ - Retorna positions e recommendation
698
+
699
+ - `async full_debate(topic, participants?, num_rounds=2, include_council=True) -> Dict`:
700
+ 1. Rodadas de debate (primeira posição, depois respostas)
701
+ 2. Síntese final
702
+ 3. Council evaluation (opcional)
703
+ 4. Retorna: type, topic, participants, rounds, synthesis, council_evaluation
704
+
705
+ - `async _get_position(participant, topic) -> DebatePosition`
706
+ - `async _get_response(participant, topic, previous_positions) -> DebatePosition`
707
+ - `async _synthesize(topic, rounds) -> Dict`
708
+ - `async _council_evaluate(topic, rounds, synthesis) -> Dict`
709
+ - `_position_to_dict(pos) -> Dict`
710
+ - `_quick_recommendation(positions) -> str`
711
+
712
+ ---
713
+
714
+ ## FASE 6: QUERY ENGINE (30 PERGUNTAS)
715
+ **Prioridade:** ALTA
716
+ **Dependências:** Fases 2, 4
717
+
718
+ ### US-V3-019: Implementar Intelligent Query Engine
719
+
720
+ **Descrição:** Engine que faz 30 perguntas críticas antes de responder.
721
+
722
+ **Acceptance Criteria:**
723
+ - [ ] Criar `src/query/engine.py` com class IntelligentQueryEngine:
724
+
725
+ **DOMAIN_QUESTIONS dict com perguntas por domínio:**
726
+
727
+ **VENDAS (10 perguntas):**
728
+ - Qual o ticket médio atual? [DATA, CRITICAL]
729
+ - Quantos closers no time? [DATA, HIGH]
730
+ - Qual a taxa de conversão atual? [DATA, CRITICAL]
731
+ - Qual o ciclo de vendas médio? [DATA, HIGH]
732
+ - Qual o CAC atual? [DATA, CRITICAL]
733
+ - Qual o LTV? [DATA, HIGH]
734
+ - Qual o ICP definido? [STRATEGIC, HIGH]
735
+ - Existe processo de vendas documentado? [EXECUTION, MEDIUM]
736
+ - Qual a estrutura de comissão? [DATA, HIGH]
737
+ - Qual a meta mensal? [DATA, CRITICAL]
738
+
739
+ **MARKETING (7 perguntas):**
740
+ - Quais canais de aquisição ativos? [CONTEXT, HIGH]
741
+ - Qual o budget de marketing? [DATA, HIGH]
742
+ - Qual o CPL por canal? [DATA, CRITICAL]
743
+ - Quantos leads qualificados por mês? [DATA, CRITICAL]
744
+ - Qual a taxa de conversão do funil? [DATA, HIGH]
745
+ - Existe estratégia de conteúdo? [STRATEGIC, MEDIUM]
746
+ - Quem são os competidores diretos? [CONTEXT, HIGH]
747
+
748
+ **OPERACOES (5 perguntas):**
749
+ - Qual a estrutura atual do time? [CONTEXT, HIGH]
750
+ - Existem processos documentados? [EXECUTION, HIGH]
751
+ - Quais ferramentas são usadas? [CONTEXT, MEDIUM]
752
+ - Qual a produtividade por pessoa? [DATA, HIGH]
753
+ - Quais são os gargalos atuais? [RISK, CRITICAL]
754
+
755
+ **FINANCEIRO (5 perguntas):**
756
+ - Qual o MRR/ARR atual? [DATA, CRITICAL]
757
+ - Qual a margem bruta? [DATA, HIGH]
758
+ - Qual o runway atual? [DATA, CRITICAL]
759
+ - Qual o burn rate mensal? [DATA, HIGH]
760
+ - Qual a meta de crescimento? [STRATEGIC, HIGH]
761
+
762
+ **GENERIC (8 perguntas):**
763
+ - Qual o problema específico a resolver? [CONTEXT, CRITICAL]
764
+ - Qual a situação atual? [CONTEXT, HIGH]
765
+ - O que já foi tentado? [CONTEXT, MEDIUM]
766
+ - Qual o resultado esperado? [SUCCESS, HIGH]
767
+ - Qual o prazo? [TIMELINE, MEDIUM]
768
+ - Quem são os stakeholders? [STAKEHOLDER, MEDIUM]
769
+ - Quais os recursos disponíveis? [RESOURCE, HIGH]
770
+ - O que pode dar errado? [RISK, HIGH]
771
+
772
+ **Métodos:**
773
+ - `async query(query, user_context?, max_questions=30, force_response=False) -> Dict`:
774
+ 1. Detectar domínio
775
+ 2. Gerar perguntas críticas
776
+ 3. Tentar responder perguntas (context + knowledge)
777
+ 4. Análise de gaps
778
+ 5. Gerar resposta (se can_proceed ou force)
779
+ 6. Retornar: query, domain, questions stats, gap_analysis, response, can_proceed, caveats
780
+
781
+ - `_detect_domain(query) -> str` (VENDAS, MARKETING, OPERACOES, FINANCEIRO, GENERIC)
782
+ - `_generate_questions(query, domain, max_questions) -> List[CriticalQuestion]`
783
+ - `async _answer_questions(questions, user_context) -> tuple[answered, unanswered]`
784
+ - `_find_in_context(question, context) -> str?`
785
+ - `_analyze_gaps(query, answered, unanswered) -> Dict`:
786
+ - Calcular coverage ponderado por prioridade
787
+ - Determinar confidence level
788
+ - can_proceed = no critical_gaps AND coverage >= 50%
789
+ - `async _generate_response(query, answered, unanswered, gap_analysis) -> str`
790
+ - `_generate_caveats(gap_analysis) -> List[str]`
791
+
792
+ ---
793
+
794
+ ## FASE 7: JARVIS SERVER
795
+ **Prioridade:** ALTA
796
+ **Dependências:** Fases 1-6
797
+
798
+ ### US-V3-020: Implementar FastAPI Server
799
+
800
+ **Descrição:** Servidor HTTP completo com todos os endpoints.
801
+
802
+ **Acceptance Criteria:**
803
+ - [ ] Criar `src/server/app.py` com:
804
+
805
+ **Request/Response Models (Pydantic):**
806
+ ```python
807
+ AskRequest: question, context?, require_council?
808
+ ConsultRequest: expert, question, context?
809
+ DebateRequest: topic, participants?, num_rounds?, include_council?
810
+ QueryRequest: query, context?, max_questions?, force_response?
811
+ SearchRequest: query, source?, n_results?
812
+ ```
813
+
814
+ **JarvisApp class:**
815
+ - `async initialize()`:
816
+ - Criar diretórios
817
+ - Inicializar Brain
818
+ - Inicializar Knowledge Engine
819
+ - Inicializar Orchestrator
820
+ - Inicializar Debate Engine
821
+ - Inicializar Query Engine
822
+ - `async shutdown()`
823
+ - `get_status() -> Dict`
824
+
825
+ **FastAPI app com lifespan:**
826
+ - CORS middleware (allow all origins)
827
+
828
+ **Core Routes:**
829
+ - `GET /` → Root info
830
+ - `GET /health` → Health check
831
+ - `GET /status` → Status completo
832
+
833
+ **API Routes:**
834
+ - `POST /api/ask` → Pergunta geral (orchestrator.process)
835
+ - `POST /api/consult` → Consultar expert específico
836
+ - `POST /api/debate` → Iniciar debate
837
+ - `POST /api/query` → Query inteligente (30 perguntas)
838
+ - `POST /api/search` → Busca no knowledge
839
+ - `GET /api/agents` → Listar agentes disponíveis
840
+
841
+ **Webhook Routes:**
842
+ - `POST /webhook/clickup`
843
+ - `POST /webhook/drive`
844
+ - `POST /webhook/generic`
845
+
846
+ ---
847
+
848
+ ### US-V3-021: Implementar CLI
849
+
850
+ **Descrição:** Interface de linha de comando para JARVIS.
851
+
852
+ **Acceptance Criteria:**
853
+ - [ ] Criar `cli/jarvis` (Python executável) com class JarvisCLI:
854
+
855
+ **Métodos:**
856
+ - `async _request(method, endpoint, data?, timeout?) -> Dict`
857
+ - `async ask(question, council?) -> print response`
858
+ - `async consult(expert, question) -> print response`
859
+ - `async debate(topic, participants?) -> print rounds + synthesis`
860
+ - `async query(question, force?) -> print coverage + response + caveats`
861
+ - `async status() -> print JSON`
862
+ - `async search(query, n?) -> print results`
863
+
864
+ **Comandos via argparse:**
865
+ ```bash
866
+ jarvis ask "pergunta" [--council/-c]
867
+ jarvis consult EXPERT "pergunta"
868
+ jarvis debate "topic" [--participants/-p NOME1 NOME2]
869
+ jarvis query "pergunta" [--force/-f]
870
+ jarvis search "query" [-n 10]
871
+ jarvis status
872
+ ```
873
+
874
+ ---
875
+
876
+ ### US-V3-022: Implementar Main Entry Point
877
+
878
+ **Descrição:** Entry point da aplicação.
879
+
880
+ **Acceptance Criteria:**
881
+ - [ ] Criar `src/main.py`:
882
+ - ASCII art banner "MEGA BRAIN"
883
+ - Print host:port
884
+ - `uvicorn.run("src.server.app:app", ...)`
885
+
886
+ ---
887
+
888
+ ## FASE 8: DATA STRUCTURES
889
+ **Prioridade:** MÉDIA
890
+ **Dependências:** Fases 1-2
891
+
892
+ ### US-V3-023: Estruturar [Sua Empresa] Bank Schemas
893
+
894
+ **Descrição:** Schemas JSON para dados da empresa.
895
+
896
+ **Acceptance Criteria:**
897
+ - [ ] Criar `data/[sua-empresa]-bank/` com:
898
+
899
+ **calls.json:**
900
+ ```json
901
+ {
902
+ "schema_version": "1.0",
903
+ "calls": [{
904
+ "id": "call_uuid",
905
+ "type": "sales|onboarding|support|strategy|1on1",
906
+ "date": "ISO8601",
907
+ "duration_minutes": 45,
908
+ "participants": [{ "name", "role", "email" }],
909
+ "client": { "name", "company", "segment", "ticket_potential" },
910
+ "outcome": { "status", "deal_value", "next_steps", "objections_raised", "objections_handled" },
911
+ "transcription_file": "path",
912
+ "insights_extracted": [],
913
+ "tags": [],
914
+ "metadata": { "source", "recording_url", "processed_at" }
915
+ }]
916
+ }
917
+ ```
918
+
919
+ **team.json:**
920
+ ```json
921
+ {
922
+ "schema_version": "1.0",
923
+ "organization": { "name", "founded", "industry", "stage" },
924
+ "departments": [{
925
+ "name": "Sales",
926
+ "head": "person_id",
927
+ "structure": {
928
+ "closers": [{
929
+ "id", "name", "role", "hire_date",
930
+ "metrics": { "quota_monthly", "avg_ticket", "conversion_rate", "calls_per_day" },
931
+ "compensation": { "base_salary", "commission_structure", "commission_rates" },
932
+ "skills": [], "certifications": [], "reports_to"
933
+ }],
934
+ "sdrs": [], "managers": []
935
+ }
936
+ }],
937
+ "roles_hierarchy": {}
938
+ }
939
+ ```
940
+
941
+ **financials.json:**
942
+ ```json
943
+ {
944
+ "schema_version": "1.0",
945
+ "currency": "BRL",
946
+ "periods": [{
947
+ "period": "2025-01",
948
+ "type": "monthly",
949
+ "revenue": { "mrr", "arr", "new_mrr", "churned_mrr", "expansion_mrr", "net_new_mrr" },
950
+ "sales": { "total_deals", "total_value", "avg_ticket", "pipeline_value", "conversion_rate" },
951
+ "costs": { "cac", "ltv", "ltv_cac_ratio", "payback_months", "gross_margin", "operating_margin" },
952
+ "headcount": { "total", "sales", "marketing", "product", "operations", "leadership" }
953
+ }],
954
+ "targets": {}
955
+ }
956
+ ```
957
+
958
+ **decisions.json:**
959
+ ```json
960
+ {
961
+ "schema_version": "1.0",
962
+ "decisions": [{
963
+ "id", "date", "title", "category", "status",
964
+ "context": { "situation", "problem", "constraints", "stakeholders" },
965
+ "options_considered": [{ "option", "pros", "cons", "estimated_impact", "estimated_effort" }],
966
+ "decision": { "chosen_option", "rationale", "conditions", "risks_accepted", "success_criteria", "review_date" },
967
+ "debate_log": { "participants", "key_arguments", "dissenting_views", "consensus_type" },
968
+ "outcome": { "status", "results", "lessons_learned", "would_decide_differently" }
969
+ }]
970
+ }
971
+ ```
972
+
973
+ **products.json:**
974
+ ```json
975
+ {
976
+ "schema_version": "1.0",
977
+ "products": [{
978
+ "id", "name", "type", "status",
979
+ "pricing": { "model", "price", "currency", "billing_frequency", "tiers" },
980
+ "value_proposition": { "headline", "dream_outcome", "perceived_likelihood", "time_to_result", "effort_required" },
981
+ "metrics": { "total_sales", "total_revenue", "avg_ltv", "churn_rate", "nps", "completion_rate" },
982
+ "target_audience": { "icp", "segments", "pain_points", "alternatives" }
983
+ }]
984
+ }
985
+ ```
986
+
987
+ ---
988
+
989
+ ### US-V3-024: Estruturar DNA Library
990
+
991
+ **Descrição:** Estrutura de pastas e templates para DNA Library.
992
+
993
+ **Acceptance Criteria:**
994
+ - [ ] Criar estrutura `data/dna-library/`:
995
+ ```
996
+ dna-library/
997
+ ├── HORMOZI/
998
+ │ ├── DNA.md
999
+ │ ├── sources/
1000
+ │ ├── frameworks/
1001
+ │ └── quotes/
1002
+ ├── COLE_GORDON/
1003
+ │ ├── DNA.md
1004
+ │ ├── sources/
1005
+ │ ├── frameworks/
1006
+ │ └── quotes/
1007
+ ├── BRUNSON/
1008
+ └── PEDRO_VALERIO/
1009
+ ```
1010
+
1011
+ - [ ] Criar template DNA.md com seções:
1012
+ - IDENTIDADE: Nome, Expertise, Empresa, Filosofia Central
1013
+ - CAMADA 1: FILOSOFIA (crenças fundamentais)
1014
+ - CAMADA 2: MODELOS MENTAIS
1015
+ - CAMADA 3: HEURÍSTICAS (regras práticas)
1016
+ - CAMADA 4: FRAMEWORKS
1017
+ - CAMADA 5: METODOLOGIAS
1018
+ - PADRÕES DE LINGUAGEM: Frases, palavras, tom
1019
+ - RED FLAGS: O que evitaria
1020
+ - PERGUNTAS CARACTERÍSTICAS
1021
+ - FONTES PROCESSADAS
1022
+
1023
+ - [ ] Criar DNA.md completo do HORMOZI conforme documento
1024
+ - [ ] Criar DNA.md completo do COLE_GORDON conforme documento
1025
+
1026
+ ---
1027
+
1028
+ ## FASE 9: DEPLOYMENT & MONITORING
1029
+ **Prioridade:** MÉDIA
1030
+ **Dependências:** Fases 1-7
1031
+
1032
+ ### US-V3-025: Implementar Docker Setup (Dev)
1033
+
1034
+ **Descrição:** Configuração Docker para desenvolvimento.
1035
+
1036
+ **Acceptance Criteria:**
1037
+ - [ ] Criar `Dockerfile`:
1038
+ - Base: python:3.11-slim
1039
+ - Instalar deps
1040
+ - Copiar src/ e cli/
1041
+ - Criar diretórios /data
1042
+ - Healthcheck
1043
+ - CMD: python -m src.main
1044
+
1045
+ - [ ] Criar `docker-compose.yml`:
1046
+ - Service jarvis (build local, port 8000, env vars, volumes)
1047
+ - Service redis (redis:7-alpine, port 6379)
1048
+ - Volumes: megabrain-data, redis-data
1049
+ - Network: megabrain-network
1050
+
1051
+ ---
1052
+
1053
+ ### US-V3-026: Implementar Docker Setup (Prod)
1054
+
1055
+ **Descrição:** Configuração Docker para produção.
1056
+
1057
+ **Acceptance Criteria:**
1058
+ - [ ] Criar `Dockerfile.prod` (multi-stage):
1059
+ - Builder stage: pip wheel
1060
+ - Production stage: user non-root, gunicorn
1061
+
1062
+ - [ ] Criar `docker-compose.prod.yml`:
1063
+ - Service nginx (ports 80/443, rate limiting)
1064
+ - Service jarvis (gunicorn, 4 workers, resource limits)
1065
+ - Service redis (maxmemory 512mb)
1066
+ - Service prometheus (port 9090, retention 30d)
1067
+ - Service grafana (port 3000)
1068
+
1069
+ ---
1070
+
1071
+ ### US-V3-027: Implementar Nginx Config
1072
+
1073
+ **Descrição:** Configuração Nginx para reverse proxy.
1074
+
1075
+ **Acceptance Criteria:**
1076
+ - [ ] Criar `nginx/nginx.conf`:
1077
+ - Upstream jarvis (keepalive 32)
1078
+ - Rate limiting zones: api (10r/s), webhooks (50r/s)
1079
+ - Location / (proxy para jarvis)
1080
+ - Location /api/ (rate limit + timeout 120s)
1081
+ - Location /webhook/ (rate limit 100 burst)
1082
+ - Location /health (sem rate limit)
1083
+ - Headers: X-Real-IP, X-Forwarded-For, X-Forwarded-Proto
1084
+
1085
+ ---
1086
+
1087
+ ### US-V3-028: Implementar Monitoring
1088
+
1089
+ **Descrição:** Configuração Prometheus + Alertas.
1090
+
1091
+ **Acceptance Criteria:**
1092
+ - [ ] Criar `monitoring/prometheus.yml`:
1093
+ - scrape_interval: 15s
1094
+ - Job prometheus (localhost:9090)
1095
+ - Job jarvis (jarvis:8000/metrics)
1096
+
1097
+ - [ ] Criar `monitoring/alerts.yml`:
1098
+ - JarvisServerDown: up{job="jarvis"} == 0 for 1m → critical
1099
+ - HighResponseTime: p95 > 5s for 5m → warning
1100
+ - HighErrorRate: 5xx rate > 5% for 5m → warning
1101
+
1102
+ ---
1103
+
1104
+ ### US-V3-029: Criar Documentação Operacional
1105
+
1106
+ **Descrição:** Documentação para operação do sistema.
1107
+
1108
+ **Acceptance Criteria:**
1109
+ - [ ] Criar `RUNBOOK.md`:
1110
+ - Seção 1: Inicialização (primeiro setup, com Docker)
1111
+ - Seção 2: Comandos Úteis (CLI, API)
1112
+ - Seção 3: Troubleshooting (servidor não inicia, erros API, alta latência)
1113
+ - Seção 4: Manutenção (backup, atualização, limpeza)
1114
+ - Seção 5: Contatos
1115
+
1116
+ - [ ] Criar `CLAUDE.md` (para Claude Code):
1117
+ - Sobre o projeto
1118
+ - Comandos rápidos
1119
+ - Estrutura de pastas
1120
+ - Lista de agentes
1121
+ - Convenções (Python 3.11+, type hints, async/await)
1122
+
1123
+ ---
1124
+
1125
+ ## Dependências do Sistema
1126
+
1127
+ ```
1128
+ requirements.txt:
1129
+
1130
+ # Web Framework
1131
+ fastapi==0.109.2
1132
+ uvicorn[standard]==0.27.1
1133
+ gunicorn==21.2.0
1134
+ pydantic==2.6.1
1135
+ pydantic-settings==2.1.0
1136
+ python-multipart==0.0.9
1137
+
1138
+ # AI / ML
1139
+ anthropic==0.18.1
1140
+ voyageai==0.2.1
1141
+ openai==1.12.0
1142
+
1143
+ # Vector Database
1144
+ chromadb==0.4.22
1145
+
1146
+ # Database
1147
+ aiosqlite==0.19.0
1148
+ sqlalchemy==2.0.25
1149
+
1150
+ # HTTP Client
1151
+ httpx==0.26.0
1152
+ aiohttp==3.9.3
1153
+
1154
+ # Utilities
1155
+ python-dotenv==1.0.1
1156
+ pyyaml==6.0.1
1157
+ orjson==3.9.13
1158
+ tenacity==8.2.3
1159
+
1160
+ # Document Processing
1161
+ python-docx==1.1.0
1162
+ pypdf2==3.0.1
1163
+ openpyxl==3.1.2
1164
+
1165
+ # Async
1166
+ asyncio-throttle==1.0.2
1167
+ aiofiles==23.2.1
1168
+
1169
+ # Monitoring
1170
+ prometheus-client==0.19.0
1171
+ structlog==24.1.0
1172
+
1173
+ # Testing
1174
+ pytest==8.0.0
1175
+ pytest-asyncio==0.23.4
1176
+ pytest-cov==4.1.0
1177
+ ```
1178
+
1179
+ ---
1180
+
1181
+ ## Success Metrics
1182
+
1183
+ | Métrica | Target |
1184
+ |---------|--------|
1185
+ | Tempo de resposta p95 | < 5s |
1186
+ | Uptime | 99.9% |
1187
+ | Perguntas críticas por query | 30 |
1188
+ | Coverage mínimo para responder | 50% |
1189
+ | Position Agents disponíveis | 4 (CRO, CMO, COO, CFO) |
1190
+ | Council Roles disponíveis | 5 |
1191
+
1192
+ ---
1193
+
1194
+ ## Ordem de Implementação Sugerida
1195
+
1196
+ ```
1197
+ ┌─────────────────────────────────────────────────────────────────────────────┐
1198
+ │ SPRINT 1: FOUNDATION (Fases 1-2) │
1199
+ ├─────────────────────────────────────────────────────────────────────────────┤
1200
+ │ US-V3-001 a US-V3-010 │
1201
+ │ - Estrutura de diretórios e setup │
1202
+ │ - Core types, config, brain, base_agent │
1203
+ │ - Knowledge Engine completo (chunker, embedder, vector, structured, engine)│
1204
+ └─────────────────────────────────────────────────────────────────────────────┘
1205
+
1206
+
1207
+ ┌─────────────────────────────────────────────────────────────────────────────┐
1208
+ │ SPRINT 2: PIPELINE + AGENTES (Fases 3-4) │
1209
+ ├─────────────────────────────────────────────────────────────────────────────┤
1210
+ │ US-V3-011 a US-V3-017 │
1211
+ │ - Pipeline de ingestão (intake, classifier, pipeline) │
1212
+ │ - Position Agents (CRO, CMO, COO, CFO) │
1213
+ │ - Council System │
1214
+ │ - Orchestrator │
1215
+ └─────────────────────────────────────────────────────────────────────────────┘
1216
+
1217
+
1218
+ ┌─────────────────────────────────────────────────────────────────────────────┐
1219
+ │ SPRINT 3: ENGINES + SERVER (Fases 5-7) │
1220
+ ├─────────────────────────────────────────────────────────────────────────────┤
1221
+ │ US-V3-018 a US-V3-022 │
1222
+ │ - Debate Engine │
1223
+ │ - Query Engine (30 perguntas críticas) │
1224
+ │ - FastAPI Server │
1225
+ │ - CLI │
1226
+ │ - Main entry point │
1227
+ └─────────────────────────────────────────────────────────────────────────────┘
1228
+
1229
+
1230
+ ┌─────────────────────────────────────────────────────────────────────────────┐
1231
+ │ SPRINT 4: DATA + DEPLOY (Fases 8-9) │
1232
+ ├─────────────────────────────────────────────────────────────────────────────┤
1233
+ │ US-V3-023 a US-V3-029 │
1234
+ │ - [Sua Empresa] Bank schemas │
1235
+ │ - DNA Library estruturada │
1236
+ │ - Docker setup (dev + prod) │
1237
+ │ - Nginx config │
1238
+ │ - Monitoring (Prometheus + alerts) │
1239
+ │ - Documentação operacional │
1240
+ └─────────────────────────────────────────────────────────────────────────────┘
1241
+ ```
1242
+
1243
+ ---
1244
+
1245
+ ## Relação com PRD v2.0
1246
+
1247
+ **PRD v2.0 focou em:**
1248
+ - ✅ Contexto [SUA EMPRESA] estruturado (skills, arquivos)
1249
+ - ✅ Integração N8N/ClickUp
1250
+ - ✅ Skills de agentes (talent-agent, finance-agent, council, executor)
1251
+
1252
+ **PRD v3.0 implementa:**
1253
+ - 🆕 Arquitetura Python completa standalone
1254
+ - 🆕 Knowledge Engine vetorial (ChromaDB + SQLite FTS)
1255
+ - 🆕 Query Engine com 30 perguntas críticas
1256
+ - 🆕 Debate Engine multi-perspectiva
1257
+ - 🆕 Deploy com Docker/Prometheus/Grafana
1258
+
1259
+ **Recomendação:** Implementar v3.0 em paralelo ao que foi feito no v2.0. Os skills existentes (talent-agent, finance-agent, etc) continuam funcionando. A infraestrutura Python adiciona uma camada de server independente.
1260
+
1261
+ ---
1262
+
1263
+ ## Resumo de User Stories
1264
+
1265
+ | ID | Fase | Título | Prioridade |
1266
+ |----|------|--------|------------|
1267
+ | US-V3-001 | 1 | Estrutura de Diretórios e Setup | CRÍTICA |
1268
+ | US-V3-002 | 1 | Core Types | CRÍTICA |
1269
+ | US-V3-003 | 1 | Config Settings | CRÍTICA |
1270
+ | US-V3-004 | 1 | Brain Client (Claude) | CRÍTICA |
1271
+ | US-V3-005 | 1 | Base Agent | CRÍTICA |
1272
+ | US-V3-006 | 2 | Semantic Chunker | CRÍTICA |
1273
+ | US-V3-007 | 2 | Text Embedder | CRÍTICA |
1274
+ | US-V3-008 | 2 | Vector Store (ChromaDB) | CRÍTICA |
1275
+ | US-V3-009 | 2 | Structured Store (SQLite FTS) | CRÍTICA |
1276
+ | US-V3-010 | 2 | Knowledge Engine Principal | CRÍTICA |
1277
+ | US-V3-011 | 3 | Intake Manager | ALTA |
1278
+ | US-V3-012 | 3 | Content Classifier | ALTA |
1279
+ | US-V3-013 | 3 | Pipeline Unificado | ALTA |
1280
+ | US-V3-014 | 4 | Position Agents | ALTA |
1281
+ | US-V3-015 | 4 | Person Agents (Digital Twins) | ALTA |
1282
+ | US-V3-016 | 4 | Council System | ALTA |
1283
+ | US-V3-017 | 4 | Agent Orchestrator | ALTA |
1284
+ | US-V3-018 | 5 | Debate Engine | MÉDIA |
1285
+ | US-V3-019 | 6 | Query Engine (30 Perguntas) | ALTA |
1286
+ | US-V3-020 | 7 | FastAPI Server | ALTA |
1287
+ | US-V3-021 | 7 | CLI | ALTA |
1288
+ | US-V3-022 | 7 | Main Entry Point | ALTA |
1289
+ | US-V3-023 | 8 | [Sua Empresa] Bank Schemas | MÉDIA |
1290
+ | US-V3-024 | 8 | DNA Library Structure | MÉDIA |
1291
+ | US-V3-025 | 9 | Docker Setup (Dev) | MÉDIA |
1292
+ | US-V3-026 | 9 | Docker Setup (Prod) | MÉDIA |
1293
+ | US-V3-027 | 9 | Nginx Config | MÉDIA |
1294
+ | US-V3-028 | 9 | Monitoring | MÉDIA |
1295
+ | US-V3-029 | 9 | Documentação Operacional | MÉDIA |
1296
+
1297
+ **Total:** 29 User Stories em 9 Fases / 4 Sprints
1298
+
1299
+ ---
1300
+
1301
+ **Documento criado por JARVIS**
1302
+ **Data:** 2026-01-12
1303
+ **Versão:** 3.0.0
1304
+ **Fonte:** JARVIS-MEGA-BRAIN-FULL-IMPLEMENTATION.md (10 partes)
1305
+ **PRD anterior:** prd-[sua-empresa]-mega-brain-v2.md (PAUSADO)