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,136 @@
1
+ # Mega Brain - System Context
2
+
3
+ ## Overview
4
+
5
+ Mega Brain is an intelligent knowledge management system designed for building high-ticket B2B sales playbooks. The system processes video content, transcriptions, and documents to extract, classify, and organize actionable sales knowledge into a structured knowledge base.
6
+
7
+ ## Purpose
8
+
9
+ Transform unstructured sales content (videos, podcasts, courses) into organized, searchable, and actionable knowledge documents that can be used to train sales teams and build consistent playbooks.
10
+
11
+ ## Target Domain
12
+
13
+ - **Industry**: B2B Sales
14
+ - **Ticket Size**: High-ticket ($10k+)
15
+ - **Focus Areas**: Outbound sales, team structure, compensation, hiring, metrics
16
+
17
+ ---
18
+
19
+ ## System Boundaries
20
+
21
+ ```
22
+ ┌─────────────────────────────────────────────────────────────────┐
23
+ │ MEGA BRAIN SYSTEM │
24
+ │ │
25
+ │ ┌──────────┐ ┌──────────────┐ ┌───────────────────────┐ │
26
+ │ │ inbox │───▶│ Processing │───▶│ KNOWLEDGE/ │ │
27
+ │ │ │ │ Pipeline │ │ (10 theme folders) │ │
28
+ │ └──────────┘ └──────────────┘ └───────────────────────┘ │
29
+ │ ▲ │ │
30
+ │ │ ▼ │
31
+ │ ┌────┴─────┐ ┌──────────────┐ │
32
+ │ │ .claude/ │ │ scripts/ │ │
33
+ │ │ configs │ │ utilities │ │
34
+ │ └──────────┘ └──────────────┘ │
35
+ └─────────────────────────────────────────────────────────────────┘
36
+ ▲ ▲
37
+ │ │
38
+ ┌────┴────┐ ┌────┴────┐
39
+ │ YouTube │ │Assembly │
40
+ │ API │ │ AI │
41
+ └─────────┘ └─────────┘
42
+ ```
43
+
44
+ ---
45
+
46
+ ## External Actors
47
+
48
+ ### Human Actors
49
+
50
+ | Actor | Role | Interactions |
51
+ |-------|------|--------------|
52
+ | **Content Curator** | Identifies and drops content into INBOX | Adds videos, URLs, documents |
53
+ | **Knowledge Consumer** | Uses extracted knowledge | Reads KNOWLEDGE files |
54
+ | **System Administrator** | Configures and maintains system | Edits .claude/ configs |
55
+
56
+ ### System Actors
57
+
58
+ | System | Purpose | Integration Type |
59
+ |--------|---------|------------------|
60
+ | **YouTube** | Source of video transcripts | API (youtube-transcript-api) |
61
+ | **AssemblyAI** | Transcription service for local files | REST API |
62
+ | **Claude Code** | AI-powered extraction and analysis | Native (CLI) |
63
+
64
+ ---
65
+
66
+ ## Key Interactions
67
+
68
+ ### 1. Content Ingestion
69
+ ```
70
+ User drops content → inbox/
71
+
72
+ /scan-inbox detects new files
73
+
74
+ Suggests processing action
75
+ ```
76
+
77
+ ### 2. Video Processing
78
+ ```
79
+ YouTube URL → youtube-transcript-api → Transcript (.txt)
80
+ Local Video → AssemblyAI API → Transcript (.txt)
81
+ ```
82
+
83
+ ### 3. Knowledge Extraction
84
+ ```
85
+ Transcript → b2b-sales-expert agent → Theme classification
86
+
87
+ KNOWLEDGE/[theme]/[topic].md
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Quality Attributes
93
+
94
+ | Attribute | Requirement |
95
+ |-----------|-------------|
96
+ | **Accuracy** | Preserve exact numbers and metrics from sources |
97
+ | **Traceability** | Every piece of knowledge must have source attribution |
98
+ | **Organization** | Knowledge organized by 10 predefined themes |
99
+ | **Language** | Output in Portuguese (BR) |
100
+ | **Specificity** | Actionable insights only, no generic advice |
101
+
102
+ ---
103
+
104
+ ## Constraints
105
+
106
+ 1. **Data Privacy**: Local processing, no cloud storage of sensitive content
107
+ 2. **API Dependencies**: Requires AssemblyAI API key for local file transcription
108
+ 3. **Format Support**: Limited to specific video/audio formats (MP4, MP3, WAV, M4A)
109
+ 4. **Language**: Primary focus on English content sources, Portuguese output
110
+
111
+ ---
112
+
113
+ ## Context Diagram (C4 Level 1)
114
+
115
+ ```
116
+ ┌─────────────┐ ┌─────────────────────────────┐
117
+ │ Content │ │ │
118
+ │ Curator │────────▶│ │
119
+ └─────────────┘ drops │ │
120
+ content │ │
121
+ │ MEGA BRAIN │
122
+ ┌─────────────┐ │ │
123
+ │ Knowledge │◀────────│ Knowledge Management │
124
+ │ Consumer │ reads │ System │
125
+ └─────────────┘ playbook│ │
126
+ │ │
127
+ └──────────┬──────────────────┘
128
+
129
+ ┌──────────────┼──────────────┐
130
+ │ │ │
131
+ ▼ ▼ ▼
132
+ ┌──────────┐ ┌──────────┐ ┌──────────┐
133
+ │ YouTube │ │ Assembly │ │ Claude │
134
+ │ API │ │ AI │ │ Code │
135
+ └──────────┘ └──────────┘ └──────────┘
136
+ ```
@@ -0,0 +1,225 @@
1
+ # Mega Brain - Component Architecture
2
+
3
+ ## Component Overview (C4 Level 2)
4
+
5
+ ```
6
+ ┌─────────────────────────────────────────────────────────────────────────┐
7
+ │ MEGA BRAIN │
8
+ │ │
9
+ │ ┌─────────────────────────────────────────────────────────────────┐ │
10
+ │ │ .claude/ (Configuration Layer) │ │
11
+ │ │ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌─────────────┐ │ │
12
+ │ │ │ agents/ │ │ commands/ │ │ skills/ │ │ settings │ │ │
13
+ │ │ └───────────┘ └───────────┘ └───────────┘ └─────────────┘ │ │
14
+ │ └─────────────────────────────────────────────────────────────────┘ │
15
+ │ │
16
+ │ ┌──────────────┐ ┌──────────────────┐ ┌─────────────────────────┐ │
17
+ │ │ inbox │ │ scripts/ │ │ KNOWLEDGE/ │ │
18
+ │ │ (Input) │──│ (Processing) │──│ (Output) │ │
19
+ │ └──────────────┘ └──────────────────┘ └─────────────────────────┘ │
20
+ │ │
21
+ └─────────────────────────────────────────────────────────────────────────┘
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Configuration Components (.claude/)
27
+
28
+ ### Agents
29
+
30
+ | Agent | File | Purpose |
31
+ |-------|------|---------|
32
+ | **b2b-sales-expert** | `agents/b2b-sales-expert.md` | Specialized agent for analyzing B2B sales content with domain expertise |
33
+
34
+ **Agent Capabilities:**
35
+ - Team structure analysis (Christmas Tree, Farm System)
36
+ - Sales process evaluation (CLOSER framework)
37
+ - Compensation plan validation
38
+ - Metric benchmarking
39
+ - Context-aware advice (ticket size, industry)
40
+
41
+ ---
42
+
43
+ ### Commands
44
+
45
+ | Command | File | Trigger | Description |
46
+ |---------|------|---------|-------------|
47
+ | `/process-video` | `commands/process-video.md` | URL or path | Process YouTube or local video |
48
+ | `/extract-knowledge` | `commands/extract-knowledge.md` | File path | Extract knowledge from transcript |
49
+ | `/scan-inbox` | `commands/scan-inbox.md` | None | Scan INBOX for pending files |
50
+ | `/documentation/create-architecture-documentation` | `commands/documentation/...` | None | Generate architecture docs |
51
+
52
+ **Command Flow:**
53
+ ```
54
+ /scan-inbox → Lists pending files
55
+
56
+ /process-video [URL] → Creates transcript
57
+
58
+ /extract-knowledge [path] → Creates knowledge files
59
+ ```
60
+
61
+ ---
62
+
63
+ ### Skills
64
+
65
+ | Skill | Directory | Capabilities |
66
+ |-------|-----------|--------------|
67
+ | **video-processing** | `skills/video-processing/` | YouTube transcript fetch, AssemblyAI integration, format handling |
68
+ | **knowledge-extraction** | `skills/knowledge-extraction/` | Theme detection, content classification, structured output |
69
+
70
+ **Skill Structure:**
71
+ ```
72
+ skills/
73
+ ├── video-processing/
74
+ │ └── SKILL.md # Skill definition and capabilities
75
+ └── knowledge-extraction/
76
+ └── SKILL.md # Extraction rules and patterns
77
+ ```
78
+
79
+ ---
80
+
81
+ ### Settings
82
+
83
+ **File:** `settings.local.json`
84
+
85
+ | Section | Purpose |
86
+ |---------|---------|
87
+ | `permissions.allow` | Allowed tools and domains |
88
+ | `permissions.deny` | Blocked operations |
89
+ | `hooks.PreToolUse` | Pre-execution triggers |
90
+ | `hooks.PostToolUse` | Post-execution triggers |
91
+ | `mcpServers` | MCP server configurations |
92
+ | `env` | Environment variables |
93
+
94
+ **Configured Permissions:**
95
+ - Bash operations: mkdir, cp, mv, ls, python, pip, npm, node, git, yt-dlp
96
+ - File operations: Read, Write, Edit
97
+ - Web access: youtube.com, youtu.be, api.assemblyai.com
98
+ - Web search enabled
99
+
100
+ **Configured Hooks:**
101
+ - `PreToolUse:WebSearch` - Adds current year to searches
102
+ - `PostToolUse:Write` - Detects new transcripts in INBOX
103
+
104
+ ---
105
+
106
+ ## Processing Components (scripts/)
107
+
108
+ ### transcribe.py
109
+
110
+ **Purpose:** Transcribe local audio/video files using AssemblyAI API
111
+
112
+ **Dependencies:**
113
+ - `assemblyai` Python package
114
+ - `ASSEMBLYAI_API_KEY` environment variable
115
+
116
+ **Features:**
117
+ - Supports MP4, MP3, WAV, M4A formats
118
+ - Auto language detection
119
+ - Punctuation and formatting
120
+ - Auto chapters
121
+ - Speaker labels
122
+ - Entity detection
123
+
124
+ ---
125
+
126
+ ### auto_organize_inbox.py
127
+
128
+ **Purpose:** Scan INBOX folder and suggest actions for each file
129
+
130
+ **Features:**
131
+ - File type detection
132
+ - Theme keyword matching
133
+ - Word count for transcripts
134
+ - Action suggestions
135
+
136
+ **Output:**
137
+ ```
138
+ MEGA BRAIN - INBOX SCANNER
139
+ ============================================================
140
+ File: transcript.txt
141
+ Type: transcript
142
+ Words: 15,234
143
+ Detected themes: 01-estrutura-time, 03-contratacao
144
+ Action: Run /extract-knowledge inbox/transcript.txt
145
+ ============================================================
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Data Components
151
+
152
+ ### inbox (Input)
153
+
154
+ **Purpose:** Drop zone for unprocessed content
155
+
156
+ **Accepted Formats:**
157
+ | Type | Extensions |
158
+ |------|------------|
159
+ | Video | .mp4 |
160
+ | Audio | .mp3, .wav, .m4a |
161
+ | Transcript | .txt |
162
+ | Document | .pdf, .docx, .xlsx |
163
+
164
+ ---
165
+
166
+ ### KNOWLEDGE (Output)
167
+
168
+ **Purpose:** Organized knowledge base with themed folders
169
+
170
+ | Folder | Theme | Content Type |
171
+ |--------|-------|--------------|
172
+ | `01-estrutura-time/` | Team Structure | Org charts, roles, hierarchy |
173
+ | `02-processo-vendas/` | Sales Process | Closing, qualification, scripts |
174
+ | `03-contratacao/` | Hiring | Recruiting, interviews, onboarding |
175
+ | `04-comissionamento/` | Compensation | OTE, commissions, incentives |
176
+ | `05-metricas/` | Metrics | KPIs, benchmarks, conversion rates |
177
+ | `06-funil-aplicacao/` | Application Funnel | Lead qualification, pipeline |
178
+ | `07-pricing/` | Pricing | High-ticket strategies |
179
+ | `08-ferramentas/` | Tools | CRM, tech stack |
180
+ | `09-gestao/` | Management | Leadership, coaching |
181
+ | `99-secundario/` | Secondary | Other supporting topics |
182
+
183
+ **Current Knowledge Files (16):**
184
+ - 01-estrutura-time: 2 files
185
+ - 02-processo-vendas: 3 files
186
+ - 03-contratacao: 1 file
187
+ - 04-comissionamento: 1 file
188
+ - 05-metricas: 2 files
189
+ - 06-funil-aplicacao: 1 file
190
+ - 07-pricing: 1 file
191
+ - 08-ferramentas: 1 file
192
+ - 99-secundario: 4 files
193
+
194
+ ---
195
+
196
+ ## Component Dependencies
197
+
198
+ ```
199
+ ┌────────────────┐ ┌────────────────┐
200
+ │ Commands │────▶│ Skills │
201
+ └───────┬────────┘ └───────┬────────┘
202
+ │ │
203
+ ▼ ▼
204
+ ┌────────────────┐ ┌────────────────┐
205
+ │ Agents │ │ Scripts │
206
+ └───────┬────────┘ └───────┬────────┘
207
+ │ │
208
+ └──────────┬───────────┘
209
+
210
+ ┌────────────────┐
211
+ │ KNOWLEDGE │
212
+ └────────────────┘
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Technology Stack
218
+
219
+ | Layer | Technology |
220
+ |-------|------------|
221
+ | **AI Runtime** | Claude Code CLI |
222
+ | **Configuration** | JSON, Markdown |
223
+ | **Scripts** | Python 3.x |
224
+ | **APIs** | youtube-transcript-api, AssemblyAI |
225
+ | **MCP** | @anthropic-ai/mcp-server-filesystem |
@@ -0,0 +1,235 @@
1
+ # Mega Brain - Data Flow Architecture
2
+
3
+ ## High-Level Data Flow
4
+
5
+ ```
6
+ ┌─────────────────────────────────────────────────────────────────────────┐
7
+ │ DATA FLOW OVERVIEW │
8
+ └─────────────────────────────────────────────────────────────────────────┘
9
+
10
+ EXTERNAL SOURCES PROCESSING OUTPUT
11
+ ═══════════════ ══════════ ══════
12
+
13
+ ┌─────────────┐ ┌──────────┐
14
+ │ YouTube │──┐ │ 01-time │
15
+ │ Video │ │ ├──────────┤
16
+ └─────────────┘ │ ┌──────────┐ ┌──────────────────┐ │ 02-sales │
17
+ ├──▶│ inbox │──▶│ Knowledge │───▶├──────────┤
18
+ ┌─────────────┐ │ │ │ │ Extraction │ │ 03-hire │
19
+ │ Local Video │──┘ └──────────┘ │ Pipeline │ ├──────────┤
20
+ │ (.mp4) │ └──────────────────┘ │ ... │
21
+ └─────────────┘ └──────────┘
22
+ ```
23
+
24
+ ---
25
+
26
+ ## Processing Pipelines
27
+
28
+ ### Pipeline 1: YouTube Video Processing
29
+
30
+ ```
31
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
32
+ │ YouTube URL │───▶│ Extract │───▶│ Fetch │───▶│ Save to │
33
+ │ │ │ Video ID │ │ Transcript │ │ inbox │
34
+ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
35
+
36
+ youtube-transcript-api
37
+
38
+ ┌─────────▼─────────┐
39
+ │ Returns: list of │
40
+ │ {text, start, │
41
+ │ duration} │
42
+ └───────────────────┘
43
+ ```
44
+
45
+ **Data Transformation:**
46
+ ```python
47
+ # Input
48
+ url = "https://youtube.com/watch?v=VIDEO_ID"
49
+
50
+ # Processing
51
+ video_id = extract_video_id(url) # "VIDEO_ID"
52
+ transcript = api.fetch(video_id) # [{text: "...", start: 0.0}, ...]
53
+ text = " ".join([t['text'] for t in transcript])
54
+
55
+ # Output
56
+ # inbox/Video Title.txt (plain text, UTF-8)
57
+ ```
58
+
59
+ ---
60
+
61
+ ### Pipeline 2: Local File Transcription
62
+
63
+ ```
64
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
65
+ │ Local File │───▶│ Upload to │───▶│ AssemblyAI │───▶│ Save to │
66
+ │ (.mp4/.mp3) │ │ AssemblyAI │ │ Transcribe │ │ inbox │
67
+ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
68
+
69
+ AssemblyAI API
70
+
71
+ ┌─────────▼─────────┐
72
+ │ Returns: text, │
73
+ │ chapters, │
74
+ │ speakers, │
75
+ │ entities │
76
+ └───────────────────┘
77
+ ```
78
+
79
+ **Configuration:**
80
+ ```python
81
+ config = aai.TranscriptionConfig(
82
+ language_code="en",
83
+ punctuate=True,
84
+ format_text=True,
85
+ auto_chapters=True,
86
+ speaker_labels=True,
87
+ entity_detection=True,
88
+ )
89
+ ```
90
+
91
+ ---
92
+
93
+ ### Pipeline 3: Knowledge Extraction
94
+
95
+ ```
96
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
97
+ │ Transcript │───▶│ Theme │───▶│ AI Agent │───▶│ Knowledge │
98
+ │ (.txt) │ │ Detection │ │ Extraction │ │ Files │
99
+ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘
100
+ │ │ │ │
101
+ ▼ ▼ ▼ ▼
102
+ Plain text Keyword b2b-sales-expert Markdown files
103
+ 78,000+ chars matching agent analysis in KNOWLEDGE/
104
+ ```
105
+
106
+ **Theme Detection Keywords:**
107
+ ```python
108
+ THEMES = {
109
+ "01-estrutura-time": ["team", "bdr", "sds", "bc", "christmas tree"],
110
+ "02-processo-vendas": ["sales", "closer", "closing", "objection"],
111
+ "03-contratacao": ["hiring", "recruit", "farm system"],
112
+ "04-comissionamento": ["compensation", "commission", "ote"],
113
+ "05-metricas": ["kpi", "metric", "cac", "ltv", "conversion"],
114
+ ...
115
+ }
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Data Formats
121
+
122
+ ### Input Formats
123
+
124
+ | Format | Extension | Source | Handler |
125
+ |--------|-----------|--------|---------|
126
+ | YouTube URL | - | Web | youtube-transcript-api |
127
+ | Video | .mp4 | Local | AssemblyAI |
128
+ | Audio | .mp3, .wav, .m4a | Local | AssemblyAI |
129
+ | Transcript | .txt | INBOX | Direct read |
130
+ | Document | .pdf, .docx | Local | Manual |
131
+
132
+ ### Output Format
133
+
134
+ **Knowledge File Template:**
135
+ ```markdown
136
+ # [Topic Title]
137
+
138
+ ## Resumo Executivo
139
+ [1-2 sentence summary]
140
+
141
+ ---
142
+
143
+ ## Visão [Source Name]
144
+
145
+ ### Contexto
146
+ [Industry, ticket size, team stage]
147
+
148
+ ### [Subtopic 1]
149
+ - Point 1 with specific numbers
150
+ - Point 2 with exact metrics
151
+ - Actionable recommendation
152
+
153
+ ### Fonte
154
+ - Video: [Title]
155
+ - Fonte: [Speaker/Company]
156
+ - Confiabilidade: Alta/Média
157
+ ```
158
+
159
+ ---
160
+
161
+ ## Data Transformation Rules
162
+
163
+ ### 1. Number Preservation
164
+ ```
165
+ Input: "We had a 25% close rate"
166
+ Output: "Close rate: 25%" (exact, never rounded)
167
+ ```
168
+
169
+ ### 2. Context Annotation
170
+ ```
171
+ Input: "Our BDRs make 100 calls per day"
172
+ Output: "BDR calls: 100/dia (contexto: high-ticket B2B, $20k+ ticket)"
173
+ ```
174
+
175
+ ### 3. Source Attribution
176
+ ```
177
+ Every extracted insight MUST include:
178
+ - Source video/document name
179
+ - Speaker/author
180
+ - Reliability rating
181
+ ```
182
+
183
+ ### 4. Language Handling
184
+ ```
185
+ Input: English transcripts
186
+ Output: Portuguese (BR) knowledge files
187
+ (Technical terms may remain in English)
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Data Volume Estimates
193
+
194
+ | Stage | Typical Size |
195
+ |-------|--------------|
196
+ | YouTube transcript | 15,000 - 100,000 chars |
197
+ | Local video (1 hour) | 10,000 - 50,000 words |
198
+ | Knowledge file | 500 - 2,000 words |
199
+ | Themes per source | 2-5 themes |
200
+
201
+ ---
202
+
203
+ ## State Transitions
204
+
205
+ ```
206
+ ┌────────────────┐
207
+ │ UNPROCESSED │ ◀─── File dropped in inbox
208
+ └───────┬────────┘
209
+ │ /scan-inbox or /process-video
210
+
211
+ ┌────────────────┐
212
+ │ TRANSCRIBED │ ◀─── Transcript created in inbox
213
+ └───────┬────────┘
214
+ │ /extract-knowledge
215
+
216
+ ┌────────────────┐
217
+ │ EXTRACTED │ ◀─── Knowledge files in KNOWLEDGE/
218
+ └───────┬────────┘
219
+ │ Manual review (optional)
220
+
221
+ ┌────────────────┐
222
+ │ VALIDATED │ ◀─── Ready for use in playbook
223
+ └────────────────┘
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Error Handling
229
+
230
+ | Error | Cause | Resolution |
231
+ |-------|-------|------------|
232
+ | No transcript available | YouTube video without captions | Use local transcription |
233
+ | API rate limit | Too many requests | Wait and retry |
234
+ | Theme not detected | Content doesn't match keywords | Put in 99-secundario |
235
+ | File too large | Video > 1GB | Split or compress |