mega-brain-ai 1.3.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.
- package/.antigravity/README.md +46 -0
- package/.antigravity/rules/.gitkeep +0 -0
- package/.antigravity/rules/mega-brain.md +39 -0
- package/.claude/CLAUDE.md +172 -0
- package/.claude/agents.yaml +44 -0
- package/.claude/commands/agents.md +161 -0
- package/.claude/commands/ask.md +117 -0
- package/.claude/commands/benchmark.md +224 -0
- package/.claude/commands/chat.md +343 -0
- package/.claude/commands/compare.md +116 -0
- package/.claude/commands/conclave.md +196 -0
- package/.claude/commands/config.md +133 -0
- package/.claude/commands/create-agent.md +467 -0
- package/.claude/commands/debate.md +159 -0
- package/.claude/commands/documentation/create-architecture-documentation.md +175 -0
- package/.claude/commands/dossiers.md +180 -0
- package/.claude/commands/evolve.md +223 -0
- package/.claude/commands/extract-dna.md +172 -0
- package/.claude/commands/extract-knowledge.md +507 -0
- package/.claude/commands/gsd/add-phase.md +43 -0
- package/.claude/commands/gsd/add-tests.md +41 -0
- package/.claude/commands/gsd/add-todo.md +47 -0
- package/.claude/commands/gsd/audit-milestone.md +36 -0
- package/.claude/commands/gsd/check-todos.md +45 -0
- package/.claude/commands/gsd/cleanup.md +18 -0
- package/.claude/commands/gsd/complete-milestone.md +136 -0
- package/.claude/commands/gsd/debug.md +167 -0
- package/.claude/commands/gsd/discuss-phase.md +83 -0
- package/.claude/commands/gsd/execute-phase.md +41 -0
- package/.claude/commands/gsd/health.md +22 -0
- package/.claude/commands/gsd/help.md +22 -0
- package/.claude/commands/gsd/insert-phase.md +32 -0
- package/.claude/commands/gsd/join-discord.md +18 -0
- package/.claude/commands/gsd/list-phase-assumptions.md +46 -0
- package/.claude/commands/gsd/map-codebase.md +71 -0
- package/.claude/commands/gsd/new-milestone.md +44 -0
- package/.claude/commands/gsd/new-project.md +42 -0
- package/.claude/commands/gsd/pause-work.md +38 -0
- package/.claude/commands/gsd/plan-milestone-gaps.md +34 -0
- package/.claude/commands/gsd/plan-phase.md +45 -0
- package/.claude/commands/gsd/progress.md +24 -0
- package/.claude/commands/gsd/quick.md +41 -0
- package/.claude/commands/gsd/reapply-patches.md +110 -0
- package/.claude/commands/gsd/remove-phase.md +31 -0
- package/.claude/commands/gsd/research-phase.md +189 -0
- package/.claude/commands/gsd/resume-work.md +40 -0
- package/.claude/commands/gsd/set-profile.md +34 -0
- package/.claude/commands/gsd/settings.md +36 -0
- package/.claude/commands/gsd/update.md +37 -0
- package/.claude/commands/gsd/verify-work.md +38 -0
- package/.claude/commands/inbox.md +296 -0
- package/.claude/commands/ingest-empresa.md +191 -0
- package/.claude/commands/ingest.md +183 -0
- package/.claude/commands/jarvis-briefing.md +67 -0
- package/.claude/commands/jarvis-control.md +169 -0
- package/.claude/commands/jarvis-full.md +182 -0
- package/.claude/commands/jarvis.md +212 -0
- package/.claude/commands/ler-drive.md +212 -0
- package/.claude/commands/log.md +158 -0
- package/.claude/commands/loop.md +133 -0
- package/.claude/commands/loops.md +73 -0
- package/.claude/commands/mission-autopilot.md +538 -0
- package/.claude/commands/mission.md +353 -0
- package/.claude/commands/process-inbox.md +148 -0
- package/.claude/commands/process-jarvis.md +3036 -0
- package/.claude/commands/process-video.md +131 -0
- package/.claude/commands/rag-search.md +78 -0
- package/.claude/commands/resume.md +33 -0
- package/.claude/commands/save.md +38 -0
- package/.claude/commands/scan-inbox.md +125 -0
- package/.claude/commands/setup.md +99 -0
- package/.claude/commands/system-digest.md +243 -0
- package/.claude/commands/verify.md +182 -0
- package/.claude/commands/view-dna.md +169 -0
- package/.claude/get-shit-done/VERSION +1 -0
- package/.claude/get-shit-done/bin/gsd-tools.cjs +588 -0
- package/.claude/get-shit-done/bin/lib/commands.cjs +553 -0
- package/.claude/get-shit-done/bin/lib/config.cjs +162 -0
- package/.claude/get-shit-done/bin/lib/core.cjs +411 -0
- package/.claude/get-shit-done/bin/lib/frontmatter.cjs +299 -0
- package/.claude/get-shit-done/bin/lib/init.cjs +710 -0
- package/.claude/get-shit-done/bin/lib/milestone.cjs +216 -0
- package/.claude/get-shit-done/bin/lib/phase.cjs +871 -0
- package/.claude/get-shit-done/bin/lib/roadmap.cjs +298 -0
- package/.claude/get-shit-done/bin/lib/state.cjs +679 -0
- package/.claude/get-shit-done/bin/lib/template.cjs +222 -0
- package/.claude/get-shit-done/bin/lib/verify.cjs +773 -0
- package/.claude/get-shit-done/references/checkpoints.md +776 -0
- package/.claude/get-shit-done/references/continuation-format.md +249 -0
- package/.claude/get-shit-done/references/decimal-phase-calculation.md +65 -0
- package/.claude/get-shit-done/references/git-integration.md +248 -0
- package/.claude/get-shit-done/references/git-planning-commit.md +38 -0
- package/.claude/get-shit-done/references/model-profile-resolution.md +34 -0
- package/.claude/get-shit-done/references/model-profiles.md +92 -0
- package/.claude/get-shit-done/references/phase-argument-parsing.md +61 -0
- package/.claude/get-shit-done/references/planning-config.md +196 -0
- package/.claude/get-shit-done/references/questioning.md +145 -0
- package/.claude/get-shit-done/references/tdd.md +263 -0
- package/.claude/get-shit-done/references/ui-brand.md +160 -0
- package/.claude/get-shit-done/references/verification-patterns.md +612 -0
- package/.claude/get-shit-done/templates/DEBUG.md +164 -0
- package/.claude/get-shit-done/templates/UAT.md +247 -0
- package/.claude/get-shit-done/templates/VALIDATION.md +76 -0
- package/.claude/get-shit-done/templates/codebase/architecture.md +255 -0
- package/.claude/get-shit-done/templates/codebase/concerns.md +310 -0
- package/.claude/get-shit-done/templates/codebase/conventions.md +307 -0
- package/.claude/get-shit-done/templates/codebase/integrations.md +280 -0
- package/.claude/get-shit-done/templates/codebase/stack.md +186 -0
- package/.claude/get-shit-done/templates/codebase/structure.md +285 -0
- package/.claude/get-shit-done/templates/codebase/testing.md +480 -0
- package/.claude/get-shit-done/templates/config.json +37 -0
- package/.claude/get-shit-done/templates/context.md +283 -0
- package/.claude/get-shit-done/templates/continue-here.md +78 -0
- package/.claude/get-shit-done/templates/debug-subagent-prompt.md +91 -0
- package/.claude/get-shit-done/templates/discovery.md +146 -0
- package/.claude/get-shit-done/templates/milestone-archive.md +123 -0
- package/.claude/get-shit-done/templates/milestone.md +115 -0
- package/.claude/get-shit-done/templates/phase-prompt.md +569 -0
- package/.claude/get-shit-done/templates/planner-subagent-prompt.md +117 -0
- package/.claude/get-shit-done/templates/project.md +184 -0
- package/.claude/get-shit-done/templates/requirements.md +231 -0
- package/.claude/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
- package/.claude/get-shit-done/templates/research-project/FEATURES.md +147 -0
- package/.claude/get-shit-done/templates/research-project/PITFALLS.md +200 -0
- package/.claude/get-shit-done/templates/research-project/STACK.md +120 -0
- package/.claude/get-shit-done/templates/research-project/SUMMARY.md +170 -0
- package/.claude/get-shit-done/templates/research.md +552 -0
- package/.claude/get-shit-done/templates/retrospective.md +54 -0
- package/.claude/get-shit-done/templates/roadmap.md +202 -0
- package/.claude/get-shit-done/templates/state.md +176 -0
- package/.claude/get-shit-done/templates/summary-complex.md +59 -0
- package/.claude/get-shit-done/templates/summary-minimal.md +41 -0
- package/.claude/get-shit-done/templates/summary-standard.md +48 -0
- package/.claude/get-shit-done/templates/summary.md +248 -0
- package/.claude/get-shit-done/templates/user-setup.md +311 -0
- package/.claude/get-shit-done/templates/verification-report.md +322 -0
- package/.claude/get-shit-done/workflows/add-phase.md +111 -0
- package/.claude/get-shit-done/workflows/add-tests.md +350 -0
- package/.claude/get-shit-done/workflows/add-todo.md +157 -0
- package/.claude/get-shit-done/workflows/audit-milestone.md +297 -0
- package/.claude/get-shit-done/workflows/check-todos.md +176 -0
- package/.claude/get-shit-done/workflows/cleanup.md +152 -0
- package/.claude/get-shit-done/workflows/complete-milestone.md +763 -0
- package/.claude/get-shit-done/workflows/diagnose-issues.md +219 -0
- package/.claude/get-shit-done/workflows/discovery-phase.md +289 -0
- package/.claude/get-shit-done/workflows/discuss-phase.md +542 -0
- package/.claude/get-shit-done/workflows/execute-phase.md +449 -0
- package/.claude/get-shit-done/workflows/execute-plan.md +448 -0
- package/.claude/get-shit-done/workflows/health.md +156 -0
- package/.claude/get-shit-done/workflows/help.md +489 -0
- package/.claude/get-shit-done/workflows/insert-phase.md +129 -0
- package/.claude/get-shit-done/workflows/list-phase-assumptions.md +178 -0
- package/.claude/get-shit-done/workflows/map-codebase.md +315 -0
- package/.claude/get-shit-done/workflows/new-milestone.md +382 -0
- package/.claude/get-shit-done/workflows/new-project.md +1116 -0
- package/.claude/get-shit-done/workflows/pause-work.md +122 -0
- package/.claude/get-shit-done/workflows/plan-milestone-gaps.md +274 -0
- package/.claude/get-shit-done/workflows/plan-phase.md +569 -0
- package/.claude/get-shit-done/workflows/progress.md +381 -0
- package/.claude/get-shit-done/workflows/quick.md +453 -0
- package/.claude/get-shit-done/workflows/remove-phase.md +154 -0
- package/.claude/get-shit-done/workflows/research-phase.md +73 -0
- package/.claude/get-shit-done/workflows/resume-project.md +306 -0
- package/.claude/get-shit-done/workflows/set-profile.md +80 -0
- package/.claude/get-shit-done/workflows/settings.md +213 -0
- package/.claude/get-shit-done/workflows/transition.md +544 -0
- package/.claude/get-shit-done/workflows/update.md +219 -0
- package/.claude/get-shit-done/workflows/verify-phase.md +242 -0
- package/.claude/get-shit-done/workflows/verify-work.md +569 -0
- package/.claude/gsd-file-manifest.json +144 -0
- package/.claude/hooks/agent_creation_trigger.py +168 -0
- package/.claude/hooks/agent_index_updater.py +255 -0
- package/.claude/hooks/agent_memory_persister.py +203 -0
- package/.claude/hooks/claude_md_agent_sync.py +162 -0
- package/.claude/hooks/claude_md_guard.py +154 -0
- package/.claude/hooks/continuous_save.py +414 -0
- package/.claude/hooks/creation_validator.py +360 -0
- package/.claude/hooks/enforce_dual_location.py +501 -0
- package/.claude/hooks/enforce_plan_mode.py +220 -0
- package/.claude/hooks/gsd-check-update.js +62 -0
- package/.claude/hooks/gsd-context-monitor.js +122 -0
- package/.claude/hooks/gsd-statusline.js +108 -0
- package/.claude/hooks/inbox_age_alert.py +367 -0
- package/.claude/hooks/ledger_updater.py +303 -0
- package/.claude/hooks/memory_hints_injector.py +251 -0
- package/.claude/hooks/memory_updater.py +202 -0
- package/.claude/hooks/notification_system.py +115 -0
- package/.claude/hooks/pending_tracker.py +188 -0
- package/.claude/hooks/pipeline_checkpoint.py +583 -0
- package/.claude/hooks/post_batch_cascading.py +1740 -0
- package/.claude/hooks/post_tool_use.py +120 -0
- package/.claude/hooks/quality_watchdog.py +394 -0
- package/.claude/hooks/ralph_wiggum.py +286 -0
- package/.claude/hooks/session-source-sync.py +223 -0
- package/.claude/hooks/session_autosave_v2.py +1135 -0
- package/.claude/hooks/session_end.py +203 -0
- package/.claude/hooks/session_start.py +939 -0
- package/.claude/hooks/skill_indexer.py +48 -0
- package/.claude/hooks/skill_router.py +358 -0
- package/.claude/hooks/stop_hook_completeness.py +187 -0
- package/.claude/hooks/user_prompt_submit.py +125 -0
- package/.claude/package.json +1 -0
- package/.claude/rules/ANTHROPIC-STANDARDS.md +384 -0
- package/.claude/rules/CLAUDE-LITE.md +201 -0
- package/.claude/rules/RULE-GROUP-1.md +320 -0
- package/.claude/rules/RULE-GROUP-2.md +307 -0
- package/.claude/rules/RULE-GROUP-3.md +248 -0
- package/.claude/rules/RULE-GROUP-4.md +427 -0
- package/.claude/rules/RULE-GROUP-5.md +388 -0
- package/.claude/rules/RULE-GROUP-6.md +387 -0
- package/.claude/rules/RULE-GSD-MANDATORY.md +106 -0
- package/.claude/rules/agent-cognition.md +779 -0
- package/.claude/rules/agent-integrity.md +692 -0
- package/.claude/rules/epistemic-standards.md +333 -0
- package/.claude/rules/logging.md +53 -0
- package/.claude/rules/mcp-governance.md +128 -0
- package/.claude/rules/pipeline.md +60 -0
- package/.claude/rules/state-management.md +93 -0
- package/.claude/scripts/apply-tags.py +77 -0
- package/.claude/scripts/batch-extract-transcriptions.py +132 -0
- package/.claude/scripts/build-complete-index.py +250 -0
- package/.claude/scripts/build-planilha-index.py +170 -0
- package/.claude/scripts/complete-tag-matching.py +250 -0
- package/.claude/scripts/deduplicate-inbox.py +139 -0
- package/.claude/scripts/docx-xml-extractor.py +141 -0
- package/.claude/scripts/extract-docx-text.py +58 -0
- package/.claude/scripts/extract-single-transcription.py +74 -0
- package/.claude/scripts/extract_docx_from_gdrive.py +77 -0
- package/.claude/scripts/jarvis_orchestrator.py +5 -0
- package/.claude/scripts/organized-downloader.py +246 -0
- package/.claude/scripts/planilha-tagger.py +187 -0
- package/.claude/scripts/revert-tags.py +70 -0
- package/.claude/scripts/source-sync.py +265 -0
- package/.claude/scripts/tag-inbox-files.py +276 -0
- package/.claude/scripts/tag-inbox-v2.py +253 -0
- package/.claude/scripts/test-extraction.py +35 -0
- package/.claude/scripts/test-full-extraction.py +74 -0
- package/.claude/scripts/validate_cascading_integrity.py +409 -0
- package/.claude/settings.json +215 -0
- package/.claude/skills/DETECTION-PROTOCOL.md +217 -0
- package/.claude/skills/README.md +240 -0
- package/.claude/skills/SKILL-REGISTRY.md +283 -0
- package/.claude/skills/SKILL-SUGGESTIONS.md +114 -0
- package/.claude/skills/_TEMPLATES/SKILL-WRITER-GUIDE.md +385 -0
- package/.claude/skills/agent-creation/SKILL.md +374 -0
- package/.claude/skills/ask-company/SKILL.md +198 -0
- package/.claude/skills/brainstorming/SKILL.md +72 -0
- package/.claude/skills/chronicler/SKILL.md +146 -0
- package/.claude/skills/chronicler/chronicler_core.py +468 -0
- package/.claude/skills/code-review/SKILL.md +160 -0
- package/.claude/skills/convert-to-company-docs/SKILL.md +68 -0
- package/.claude/skills/convert-to-company-docs/convert.py +532 -0
- package/.claude/skills/dispatching-parallel-agents/SKILL.md +193 -0
- package/.claude/skills/docs-megabrain/SKILL.md +251 -0
- package/.claude/skills/executing-plans/SKILL.md +114 -0
- package/.claude/skills/executor/SKILL.md +161 -0
- package/.claude/skills/fase-2-5-tagging/SKILL.md +182 -0
- package/.claude/skills/feature-dev/SKILL.md +154 -0
- package/.claude/skills/frontend-design/SKILL.md +165 -0
- package/.claude/skills/gdrive-transcription-downloader/SKILL.md +249 -0
- package/.claude/skills/gemini-fallback/SKILL.md +67 -0
- package/.claude/skills/gemini-fallback/gemini_fetch.py +0 -0
- package/.claude/skills/gha/SKILL.md +96 -0
- package/.claude/skills/gha/gha_diagnostic.py +227 -0
- package/.claude/skills/github-workflow/SKILL.md +190 -0
- package/.claude/skills/hookify/SKILL.md +134 -0
- package/.claude/skills/hybrid-source-reading/SKILL.md +265 -0
- package/.claude/skills/jarvis/SKILL.md +546 -0
- package/.claude/skills/jarvis-briefing/SKILL.md +340 -0
- package/.claude/skills/knowledge-extraction/SKILL.md +318 -0
- package/.claude/skills/ler-planilha/SKILL.md +281 -0
- package/.claude/skills/pipeline-jarvis/SKILL.md +430 -0
- package/.claude/skills/plugin-dev/SKILL.md +176 -0
- package/.claude/skills/pr-review-toolkit/SKILL.md +178 -0
- package/.claude/skills/process-company-inbox/SKILL.md +183 -0
- package/.claude/skills/python-megabrain/SKILL.md +323 -0
- package/.claude/skills/resume/SKILL.md +61 -0
- package/.claude/skills/save/SKILL.md +87 -0
- package/.claude/skills/skill-creator-internal/SKILL.md +186 -0
- package/.claude/skills/skill-writer/SKILL.md +153 -0
- package/.claude/skills/skill-writer/examples.md +191 -0
- package/.claude/skills/skill-writer/troubleshooting.md +205 -0
- package/.claude/skills/smart-download-tagger/SKILL.md +148 -0
- package/.claude/skills/source-sync/SKILL.md +240 -0
- package/.claude/skills/sync-docs/SKILL.md +193 -0
- package/.claude/skills/sync-docs/config.json +37 -0
- package/.claude/skills/sync-docs/gdrive_sync.py +358 -0
- package/.claude/skills/sync-docs/reauth.py +71 -0
- package/.claude/skills/using-superpowers/SKILL.md +105 -0
- package/.claude/skills/verification-before-completion/SKILL.md +130 -0
- package/.claude/skills/verify/SKILL.md +154 -0
- package/.claude/skills/verify/verify_runner.py +0 -0
- package/.claude/skills/verify-6-levels/SKILL.md +234 -0
- package/.claude/skills/writing-plans/SKILL.md +184 -0
- package/.claude/templates/BATCH-LOG-TEMPLATE.md +221 -0
- package/.claudeignore +9 -0
- package/.cursor/agents.yaml +44 -0
- package/.cursor/rules/mega-brain.md +39 -0
- package/.gitattributes +19 -0
- package/.github/CODEOWNERS +8 -0
- package/.github/ISSUE_TEMPLATE/agent.md +96 -0
- package/.github/ISSUE_TEMPLATE/bug.md +67 -0
- package/.github/ISSUE_TEMPLATE/feature.md +56 -0
- package/.github/ISSUE_TEMPLATE/pipeline.md +70 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +30 -0
- package/.github/assets/banner.svg +152 -0
- package/.github/assets/logo-dark.svg +79 -0
- package/.github/assets/social-preview.png +0 -0
- package/.github/layer1-allowlist.txt +196 -0
- package/.github/layer2-manifest.txt +42 -0
- package/.github/layer3-manifest.txt +94 -0
- package/.github/workflows/claude-code-pr.yml +198 -0
- package/.github/workflows/claude-code-review.yml +57 -0
- package/.github/workflows/claude.yml +76 -0
- package/.github/workflows/publish-pro.yml +72 -0
- package/.github/workflows/publish.yml +86 -0
- package/.github/workflows/verification.yml +251 -0
- package/.gitignore +244 -0
- package/.gitleaks.toml +118 -0
- package/.windsurf/agents.yaml +44 -0
- package/.windsurf/rules/mega-brain.md +39 -0
- package/CONTRIBUTING.md +62 -0
- package/QUICK-START.md +231 -0
- package/README.md +168 -0
- package/agents/AGENT-INDEX.yaml +107 -0
- package/agents/MASTER-AGENT.md +612 -0
- package/agents/README.md +48 -0
- package/agents/_templates/INDEX.md +741 -0
- package/agents/_templates/TEMPLATE-AGENT-MD-ULTRA-ROBUSTO-V3.md +2399 -0
- package/agents/boardroom/CHECKLIST-MASTER.md +281 -0
- package/agents/boardroom/INTEGRATION-GUIDE.md +406 -0
- package/agents/boardroom/README.md +238 -0
- package/agents/boardroom/config/BOARDROOM-CONFIG.md +186 -0
- package/agents/boardroom/config/TTS-INTEGRATION.md +258 -0
- package/agents/boardroom/config/VOICE-PROFILES.md +624 -0
- package/agents/boardroom/scripts/audio_generator.py +375 -0
- package/agents/boardroom/scripts/audio_generator_edge.py +353 -0
- package/agents/boardroom/scripts/jarvis_boardroom_hook.py +415 -0
- package/agents/boardroom/scripts/notebooklm_generator.py +578 -0
- package/agents/boardroom/templates/EPISODE-TEMPLATE.md +367 -0
- package/agents/boardroom/templates/scene-templates/SCENE-AGENT-DEBATE.md +252 -0
- package/agents/boardroom/templates/scene-templates/SCENE-COUNCIL.md +270 -0
- package/agents/boardroom/templates/scene-templates/SCENE-DNA-CONSULTATION.md +126 -0
- package/agents/boardroom/templates/scene-templates/SCENE-QUESTION.md +174 -0
- package/agents/boardroom/workflows/WORKFLOW-AUDIO-GENERATION.md +421 -0
- package/agents/conclave/CRITIC.md +197 -0
- package/agents/conclave/DEVILS-ADVOCATE.md +274 -0
- package/agents/conclave/README.md +35 -0
- package/agents/conclave/SYNTHESIZER.md +293 -0
- package/agents/conclave/advogado-do-diabo/AGENT.md +502 -0
- package/agents/conclave/advogado-do-diabo/SOUL.md +100 -0
- package/agents/conclave/critico-metodologico/AGENT.md +683 -0
- package/agents/conclave/critico-metodologico/SOUL.md +107 -0
- package/agents/conclave/sintetizador/AGENT.md +571 -0
- package/agents/conclave/sintetizador/SOUL.md +94 -0
- package/agents/constitution/BASE-CONSTITUTION.md +254 -0
- package/agents/persona-registry.yaml +300 -0
- package/agents/sua-empresa/.gitkeep +0 -0
- package/agents/sua-empresa/README.md +44 -0
- package/agents/sua-empresa/_example/jds/EXAMPLE-JD.md +42 -0
- package/agents/sua-empresa/_example/org/EXAMPLE-ORG.md +32 -0
- package/agents/sua-empresa/_example/roles/EXAMPLE-ROLE.md +38 -0
- package/artifacts/README.md +11 -0
- package/artifacts/canonical/.gitkeep +0 -0
- package/artifacts/chunks/.gitkeep +0 -0
- package/artifacts/insights/.gitkeep +0 -0
- package/artifacts/narratives/.gitkeep +0 -0
- package/bin/cli.js +2 -0
- package/bin/lib/ascii-art.js +202 -0
- package/bin/lib/feature-gate.js +46 -0
- package/bin/lib/installer.js +593 -0
- package/bin/lib/license.js +59 -0
- package/bin/lib/pro-commands.js +75 -0
- package/bin/lib/setup-wizard.js +547 -0
- package/bin/lib/validate-email.js +113 -0
- package/bin/mega-brain.js +136 -0
- package/bin/pre-publish-gate.js +229 -0
- package/bin/push.js +1056 -0
- package/bin/templates/env.example +27 -0
- package/bin/utils/pro-detector.js +50 -0
- package/bin/validate-package.js +190 -0
- package/core/__init__.py +2 -0
- package/core/glossary/INDEX.md +63 -0
- package/core/glossary/digital.md +243 -0
- package/core/glossary/finance.md +49 -0
- package/core/glossary/marketing.md +69 -0
- package/core/glossary/operations.md +50 -0
- package/core/glossary/sales.md +690 -0
- package/core/intelligence/__init__.py +41 -0
- package/core/intelligence/agent_trigger.py +468 -0
- package/core/intelligence/audit_layers.py +491 -0
- package/core/intelligence/autonomous_processor.py +796 -0
- package/core/intelligence/bootstrap_registry.py +550 -0
- package/core/intelligence/business_model_detector.py +476 -0
- package/core/intelligence/dossier_trigger.py +336 -0
- package/core/intelligence/entity_normalizer.py +565 -0
- package/core/intelligence/org_chain_detector.py +411 -0
- package/core/intelligence/review_dashboard.py +338 -0
- package/core/intelligence/role_detector.py +855 -0
- package/core/intelligence/session_autosave.py +46 -0
- package/core/intelligence/skill_generator.py +601 -0
- package/core/intelligence/sow_generator.py +711 -0
- package/core/intelligence/sync_package_files.py +504 -0
- package/core/intelligence/task_orchestrator.py +780 -0
- package/core/intelligence/theme_analyzer.py +562 -0
- package/core/intelligence/tool_discovery.py +432 -0
- package/core/intelligence/validate_json_integrity.py +106 -0
- package/core/intelligence/validate_layers.py +310 -0
- package/core/intelligence/verify_classifications.py +94 -0
- package/core/intelligence/viability_scorer.py +592 -0
- package/core/jarvis/02-JARVIS-SOUL.md +390 -0
- package/core/jarvis/03-JARVIS-DNA.yaml +312 -0
- package/core/jarvis/AGENT.md +191 -0
- package/core/jarvis/agent-creator/AGENT.md +199 -0
- package/core/jarvis/agent-creator/SOUL.md +82 -0
- package/core/jarvis/agent-creator/tasks/create-agent.md +133 -0
- package/core/jarvis/agent-creator/tasks/sync-agents.md +100 -0
- package/core/jarvis/agent-creator/workflows/wf-create-agent.yaml +110 -0
- package/core/jarvis/agent-creator/workflows/wf-pipeline-trigger.yaml +111 -0
- package/core/jarvis/autonomous/benchmark/AGENT.md +347 -0
- package/core/jarvis/autonomous/benchmark/SOUL.md +78 -0
- package/core/jarvis/autonomous/critic/AGENT.md +324 -0
- package/core/jarvis/autonomous/critic/SOUL.md +78 -0
- package/core/jarvis/autonomous/evolver/AGENT.md +294 -0
- package/core/jarvis/autonomous/evolver/SOUL.md +85 -0
- package/core/jarvis/autonomous/playbook-generator/AGENT.md +399 -0
- package/core/jarvis/autonomous/playbook-generator/SOUL.md +80 -0
- package/core/patterns/_ROLE_PATTERNS.yaml +547 -0
- package/core/patterns/quality_gates.yaml +259 -0
- package/core/patterns/trigger_config.yaml +193 -0
- package/core/schemas/SCHEMA-INDEX.md +94 -0
- package/core/schemas/canonical-map.schema.json +98 -0
- package/core/schemas/chunks-state.schema.json +131 -0
- package/core/schemas/decisions-registry.schema.json +120 -0
- package/core/schemas/file-registry.schema.json +69 -0
- package/core/schemas/insights-state.schema.json +111 -0
- package/core/schemas/narratives-state.schema.json +150 -0
- package/core/tasks/CHANGELOG.md +55 -0
- package/core/tasks/TASK-REGISTRY.md +113 -0
- package/core/tasks/_templates/task-tmpl.md +105 -0
- package/core/tasks/analyze-themes.md +84 -0
- package/core/tasks/detect-role.md +82 -0
- package/core/tasks/extract-dna.md +114 -0
- package/core/tasks/normalize-entities.md +82 -0
- package/core/tasks/process-batch.md +111 -0
- package/core/tasks/validate-cascade.md +105 -0
- package/core/templates/README.md +27 -0
- package/core/templates/agents/dna-config-template.yaml +181 -0
- package/core/templates/agents/enrichment-protocol.md +408 -0
- package/core/templates/agents/memory-template.md +567 -0
- package/core/templates/agents/reasoning-model.md +331 -0
- package/core/templates/agents/soul-template.md +416 -0
- package/core/templates/agents/template-evolution.md +544 -0
- package/core/templates/debates/CONCLAVE-LOG-TEMPLATE-v2.md +309 -0
- package/core/templates/debates/conclave-log-template.md +309 -0
- package/core/templates/debates/conclave-protocol.md +518 -0
- package/core/templates/debates/debate-dynamics-config.yaml +322 -0
- package/core/templates/debates/debate-dynamics.md +613 -0
- package/core/templates/debates/debate-protocol.md +323 -0
- package/core/templates/logs/LOG-TEMPLATES.md +1068 -0
- package/core/templates/logs/batch-visual-template.md +841 -0
- package/core/templates/logs/log-structure.md +65 -0
- package/core/templates/logs/visual-diff.md +159 -0
- package/core/templates/phases/dossier-compilation.md +790 -0
- package/core/templates/phases/narrative-metabolism.md +292 -0
- package/core/templates/phases/narrative-synthesis.md +278 -0
- package/core/templates/phases/phase4-checkpoint.md +146 -0
- package/core/templates/phases/prompt-1.1-chunking.md +154 -0
- package/core/templates/phases/prompt-1.2-entity-resolution.md +186 -0
- package/core/templates/phases/prompt-2.1-dna-tags.md +208 -0
- package/core/templates/phases/prompt-2.1-insight-extraction.md +191 -0
- package/core/templates/phases/prompt-3.1-narrative.md +331 -0
- package/core/templates/phases/sources-compilation.md +340 -0
- package/core/workflows/PIPELINE-JARVIS-DOCS.md +606 -0
- package/core/workflows/wf-conclave.yaml +139 -0
- package/core/workflows/wf-extract-dna.yaml +158 -0
- package/core/workflows/wf-ingest.yaml +88 -0
- package/core/workflows/wf-pipeline-full.yaml +138 -0
- package/docs/API-KEYS-GUIDE.md +372 -0
- package/docs/INTEGRATION-POINTS.md +501 -0
- package/docs/LAYERS.md +403 -0
- package/docs/PLAN-MODE-PROTOCOL.md +388 -0
- package/docs/RESTORE-AND-INDEX.md +203 -0
- package/docs/TAG-RESOLVER-IMPLEMENTATION.md +597 -0
- package/docs/conselho.md +337 -0
- package/docs/context7-readme.md +28 -0
- package/docs/jarvis-logging-protocol.md +380 -0
- package/docs/pipeline-completa-v4.md +1315 -0
- package/docs/prompts/meta_agente_mapeamento_processos.md +297 -0
- package/docs/quick-start.md +197 -0
- package/docs/readme-ralph-cascateamento.md +207 -0
- package/docs/template-master.md +727 -0
- package/docs/templates/phase5/IMPLEMENTATION-GUIDE.md +355 -0
- package/docs/templates/phase5/MOGA-BRAIN-PHASE5-TEMPLATES.md +1284 -0
- package/docs/templates/phase5/README.md +165 -0
- package/docs/workflow-continuous-claude.md +2232 -0
- package/inbox/.gitkeep +0 -0
- package/inbox/README.md +15 -0
- package/knowledge/NAVIGATION-MAP.json +292 -0
- package/knowledge/README.md +11 -0
- package/knowledge/dna/.gitkeep +0 -0
- package/knowledge/dossiers/persons/.gitkeep +0 -0
- package/knowledge/dossiers/system/.gitkeep +0 -0
- package/knowledge/dossiers/themes/.gitkeep +0 -0
- package/knowledge/playbooks/.gitkeep +0 -0
- package/knowledge/sources/.gitkeep +0 -0
- package/logs/.gitkeep +0 -0
- package/logs/README.md +11 -0
- package/package.json +180 -0
- package/requirements.txt +4 -0
|
@@ -0,0 +1,711 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
SOW GENERATOR - Intelligence Layer v1.0
|
|
4
|
+
========================================
|
|
5
|
+
Gera Statement of Work (SOW) dual-purpose para cada cargo detectado.
|
|
6
|
+
|
|
7
|
+
O SOW serve TANTO para:
|
|
8
|
+
1. Configurar agente IA (tools, tasks, autonomy level)
|
|
9
|
+
2. Servir como job description para contratar pessoa real
|
|
10
|
+
|
|
11
|
+
Inclui Executor Decision Tree (inspirado Squad Creator):
|
|
12
|
+
6 perguntas -> Worker | Agent | Hybrid | Human
|
|
13
|
+
|
|
14
|
+
Dependencias: Sprint 5 completo (business models)
|
|
15
|
+
Inspiracao: Squad Creator executor-decision-tree, task-anatomy
|
|
16
|
+
|
|
17
|
+
Versao: 1.0.0
|
|
18
|
+
Data: 2026-02-26
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
import json
|
|
22
|
+
import re
|
|
23
|
+
import sys
|
|
24
|
+
import yaml
|
|
25
|
+
from pathlib import Path
|
|
26
|
+
from datetime import datetime, timezone
|
|
27
|
+
|
|
28
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
|
29
|
+
from entity_normalizer import load_registry, save_registry, load_taxonomy
|
|
30
|
+
|
|
31
|
+
# ---------------------------------------------------------------------------
|
|
32
|
+
# PATHS
|
|
33
|
+
# ---------------------------------------------------------------------------
|
|
34
|
+
BASE_DIR = Path(__file__).parent.parent
|
|
35
|
+
AGENTS_DIR = BASE_DIR / "agents" / "cargo"
|
|
36
|
+
SOW_LOG_PATH = BASE_DIR / "logs" / "sow_generation.jsonl"
|
|
37
|
+
|
|
38
|
+
# ---------------------------------------------------------------------------
|
|
39
|
+
# EXECUTOR DECISION TREE
|
|
40
|
+
# ---------------------------------------------------------------------------
|
|
41
|
+
# Adapted from Squad Creator's 6-question decision tree.
|
|
42
|
+
# Maps role characteristics to executor types.
|
|
43
|
+
|
|
44
|
+
# Heuristics for auto-classifying roles based on registry data
|
|
45
|
+
ROLE_EXECUTOR_HINTS = {
|
|
46
|
+
# Roles that are typically Worker (predictable, function-like)
|
|
47
|
+
"worker_indicators": [
|
|
48
|
+
"data entry", "report", "dashboard", "scheduling",
|
|
49
|
+
"email sequence", "auto-responder", "template",
|
|
50
|
+
],
|
|
51
|
+
# Roles that are typically Agent (need NLP, context understanding)
|
|
52
|
+
"agent_indicators": [
|
|
53
|
+
"content creation", "copywriting", "social media",
|
|
54
|
+
"research", "analysis", "strategy",
|
|
55
|
+
],
|
|
56
|
+
# Roles that are typically Hybrid (strategic + AI-assistable)
|
|
57
|
+
"hybrid_indicators": [
|
|
58
|
+
"sales", "closing", "negotiation", "pitch",
|
|
59
|
+
"hiring", "interview", "management", "leadership",
|
|
60
|
+
"consulting", "coaching",
|
|
61
|
+
],
|
|
62
|
+
# Roles that are typically Human (high-stakes, judgment-critical)
|
|
63
|
+
"human_indicators": [
|
|
64
|
+
"legal", "compliance", "financial decision",
|
|
65
|
+
"firing", "termination", "crisis",
|
|
66
|
+
],
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Domain-based default executor types
|
|
70
|
+
DOMAIN_EXECUTOR_DEFAULTS = {
|
|
71
|
+
"vendas": "Hybrid",
|
|
72
|
+
"outbound": "Agent",
|
|
73
|
+
"hiring": "Hybrid",
|
|
74
|
+
"compensation": "Human",
|
|
75
|
+
"management": "Hybrid",
|
|
76
|
+
"scaling": "Hybrid",
|
|
77
|
+
"operations": "Agent",
|
|
78
|
+
"marketing": "Agent",
|
|
79
|
+
"offers": "Hybrid",
|
|
80
|
+
"delivery": "Hybrid",
|
|
81
|
+
"product": "Hybrid",
|
|
82
|
+
"mindset": "Human",
|
|
83
|
+
"copywriting": "Agent",
|
|
84
|
+
"content": "Agent",
|
|
85
|
+
"growth": "Agent",
|
|
86
|
+
"design": "Agent",
|
|
87
|
+
"technology": "Worker",
|
|
88
|
+
"legal": "Human",
|
|
89
|
+
"education": "Hybrid",
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Autonomy levels by executor type
|
|
93
|
+
AUTONOMY_LEVELS = {
|
|
94
|
+
"Worker": 90, # Near-full automation
|
|
95
|
+
"Agent": 70, # AI executes, human monitors
|
|
96
|
+
"Hybrid": 50, # AI prepares, human decides
|
|
97
|
+
"Human": 10, # Human drives, AI assists
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
# ---------------------------------------------------------------------------
|
|
102
|
+
# SOW TEMPLATE
|
|
103
|
+
# ---------------------------------------------------------------------------
|
|
104
|
+
def generate_sow(role_name, registry=None):
|
|
105
|
+
"""
|
|
106
|
+
Generate a dual-purpose SOW for a role.
|
|
107
|
+
|
|
108
|
+
Returns dict with ai_config, human_config, shared, executor_decision.
|
|
109
|
+
"""
|
|
110
|
+
if registry is None:
|
|
111
|
+
registry = load_registry()
|
|
112
|
+
|
|
113
|
+
roles = registry.get("roles", {})
|
|
114
|
+
role_data = roles.get(role_name, {})
|
|
115
|
+
taxonomy = load_taxonomy()
|
|
116
|
+
cargo_taxonomy = taxonomy.get("cargos", {}).get(role_name, {})
|
|
117
|
+
|
|
118
|
+
# Gather data from registry
|
|
119
|
+
responsibilities = role_data.get("responsibilities", [])
|
|
120
|
+
domain_ids = role_data.get("domain_ids", [])
|
|
121
|
+
reports_to = role_data.get("reports_to")
|
|
122
|
+
direct_reports = role_data.get("direct_reports", [])
|
|
123
|
+
weighted_score = role_data.get("weighted_score", 0)
|
|
124
|
+
sources = role_data.get("sources", [])
|
|
125
|
+
|
|
126
|
+
# Taxonomy domains
|
|
127
|
+
if not domain_ids and cargo_taxonomy:
|
|
128
|
+
domain_ids = (cargo_taxonomy.get("dominios_primarios", []) +
|
|
129
|
+
cargo_taxonomy.get("dominios_secundarios", []))
|
|
130
|
+
|
|
131
|
+
# Executor Decision
|
|
132
|
+
executor_decision = _evaluate_executor_type(
|
|
133
|
+
role_name, responsibilities, domain_ids, role_data
|
|
134
|
+
)
|
|
135
|
+
executor_type = executor_decision["result"]
|
|
136
|
+
autonomy = AUTONOMY_LEVELS.get(executor_type, 50)
|
|
137
|
+
|
|
138
|
+
# Build SOW
|
|
139
|
+
sow = {
|
|
140
|
+
"role_id": role_name,
|
|
141
|
+
"canonical_name": role_name.replace("-", " ").title(),
|
|
142
|
+
"version": "1.0.0",
|
|
143
|
+
"generated_at": datetime.now(timezone.utc).isoformat(),
|
|
144
|
+
|
|
145
|
+
# === AI CONFIG ===
|
|
146
|
+
"ai_config": {
|
|
147
|
+
"executor_type": executor_type,
|
|
148
|
+
"autonomy_level": autonomy,
|
|
149
|
+
"tools_required": _suggest_tools(role_name, domain_ids),
|
|
150
|
+
"tasks_assigned": _suggest_tasks(role_name, responsibilities),
|
|
151
|
+
"decision_authority": _decision_authority(executor_type),
|
|
152
|
+
"escalation_triggers": _escalation_triggers(executor_type, role_name),
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
# === HUMAN CONFIG ===
|
|
156
|
+
"human_config": {
|
|
157
|
+
"job_title": role_name.replace("-", " ").title(),
|
|
158
|
+
"department": _primary_department(domain_ids),
|
|
159
|
+
"reports_to": reports_to,
|
|
160
|
+
"manages": direct_reports,
|
|
161
|
+
"responsibilities": responsibilities[:10],
|
|
162
|
+
"kpis": _suggest_kpis(role_name, domain_ids),
|
|
163
|
+
"skills_required": _suggest_skills(role_name, domain_ids),
|
|
164
|
+
},
|
|
165
|
+
|
|
166
|
+
# === SHARED ===
|
|
167
|
+
"shared": {
|
|
168
|
+
"domains": domain_ids,
|
|
169
|
+
"competencies": _extract_competencies(responsibilities),
|
|
170
|
+
"frameworks_used": [], # Populated by skill_generator later
|
|
171
|
+
"knowledge_sources": sources[:10],
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
# === EXECUTOR DECISION ===
|
|
175
|
+
"executor_decision": executor_decision,
|
|
176
|
+
|
|
177
|
+
# === METADATA ===
|
|
178
|
+
"metadata": {
|
|
179
|
+
"weighted_score": weighted_score,
|
|
180
|
+
"source_count": len(sources),
|
|
181
|
+
"responsibility_count": len(responsibilities),
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return sow
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def generate_sow_markdown(sow):
|
|
189
|
+
"""Render SOW as markdown for human reading and agent configuration."""
|
|
190
|
+
role = sow["role_id"]
|
|
191
|
+
canonical = sow["canonical_name"]
|
|
192
|
+
ai = sow["ai_config"]
|
|
193
|
+
human = sow["human_config"]
|
|
194
|
+
shared = sow["shared"]
|
|
195
|
+
ed = sow["executor_decision"]
|
|
196
|
+
|
|
197
|
+
lines = [
|
|
198
|
+
f"# SOW: {canonical}",
|
|
199
|
+
f"",
|
|
200
|
+
f"> **Role ID:** {role}",
|
|
201
|
+
f"> **Executor Type:** {ai['executor_type']}",
|
|
202
|
+
f"> **Autonomy Level:** {ai['autonomy_level']}%",
|
|
203
|
+
f"> **Generated:** {sow['generated_at'][:10]}",
|
|
204
|
+
f"> **Version:** {sow['version']}",
|
|
205
|
+
f"",
|
|
206
|
+
f"---",
|
|
207
|
+
f"",
|
|
208
|
+
f"## AI Agent Configuration",
|
|
209
|
+
f"",
|
|
210
|
+
f"**Executor Type:** {ai['executor_type']}",
|
|
211
|
+
f"**Autonomy:** {ai['autonomy_level']}%",
|
|
212
|
+
f"**Decision Authority:** {ai['decision_authority']}",
|
|
213
|
+
f"",
|
|
214
|
+
f"### Tools Required",
|
|
215
|
+
]
|
|
216
|
+
|
|
217
|
+
for tool in ai["tools_required"]:
|
|
218
|
+
lines.append(f"- {tool}")
|
|
219
|
+
|
|
220
|
+
lines.extend([
|
|
221
|
+
f"",
|
|
222
|
+
f"### Tasks Assigned",
|
|
223
|
+
])
|
|
224
|
+
for task in ai["tasks_assigned"]:
|
|
225
|
+
lines.append(f"- {task}")
|
|
226
|
+
|
|
227
|
+
lines.extend([
|
|
228
|
+
f"",
|
|
229
|
+
f"### Escalation Triggers",
|
|
230
|
+
])
|
|
231
|
+
for trigger in ai["escalation_triggers"]:
|
|
232
|
+
lines.append(f"- {trigger}")
|
|
233
|
+
|
|
234
|
+
lines.extend([
|
|
235
|
+
f"",
|
|
236
|
+
f"---",
|
|
237
|
+
f"",
|
|
238
|
+
f"## Job Description (Human)",
|
|
239
|
+
f"",
|
|
240
|
+
f"**Job Title:** {human['job_title']}",
|
|
241
|
+
f"**Department:** {human['department']}",
|
|
242
|
+
f"**Reports To:** {human['reports_to'] or 'TBD'}",
|
|
243
|
+
])
|
|
244
|
+
|
|
245
|
+
if human["manages"]:
|
|
246
|
+
lines.append(f"**Manages:** {', '.join(human['manages'])}")
|
|
247
|
+
|
|
248
|
+
lines.extend([
|
|
249
|
+
f"",
|
|
250
|
+
f"### Responsibilities",
|
|
251
|
+
])
|
|
252
|
+
for resp in human["responsibilities"]:
|
|
253
|
+
lines.append(f"- {resp}")
|
|
254
|
+
|
|
255
|
+
lines.extend([
|
|
256
|
+
f"",
|
|
257
|
+
f"### KPIs",
|
|
258
|
+
])
|
|
259
|
+
for kpi in human["kpis"]:
|
|
260
|
+
lines.append(f"- {kpi}")
|
|
261
|
+
|
|
262
|
+
lines.extend([
|
|
263
|
+
f"",
|
|
264
|
+
f"### Skills Required",
|
|
265
|
+
])
|
|
266
|
+
for skill in human["skills_required"]:
|
|
267
|
+
lines.append(f"- {skill}")
|
|
268
|
+
|
|
269
|
+
lines.extend([
|
|
270
|
+
f"",
|
|
271
|
+
f"---",
|
|
272
|
+
f"",
|
|
273
|
+
f"## Executor Decision Analysis",
|
|
274
|
+
f"",
|
|
275
|
+
f"| Question | Answer |",
|
|
276
|
+
f"|----------|--------|",
|
|
277
|
+
f"| 1. Output 100% previsivel? | {'Sim' if ed['question_1_predictable'] else 'Nao'} |",
|
|
278
|
+
f"| 2. Pode ser funcao pura? | {'Sim' if ed['question_2_pure_function'] else 'Nao'} |",
|
|
279
|
+
f"| 3. Precisa NLP? | {'Sim' if ed['question_3_nlp_required'] else 'Nao'} |",
|
|
280
|
+
f"| 4. Impacto de erro? | {ed['question_4_error_impact']} |",
|
|
281
|
+
f"| 5. Requer julgamento estrategico? | {'Sim' if ed['question_5_strategic'] else 'Nao'} |",
|
|
282
|
+
f"| 6. IA pode assistir? | {'Sim' if ed['question_6_ai_assist'] else 'Nao'} |",
|
|
283
|
+
f"",
|
|
284
|
+
f"**Result:** {ed['result']}",
|
|
285
|
+
f"**Rationale:** {ed['rationale']}",
|
|
286
|
+
f"",
|
|
287
|
+
f"---",
|
|
288
|
+
f"",
|
|
289
|
+
f"## Shared Context",
|
|
290
|
+
f"",
|
|
291
|
+
f"**Domains:** {', '.join(shared['domains'])}",
|
|
292
|
+
f"**Sources:** {sow['metadata']['source_count']}",
|
|
293
|
+
f"**Weighted Score:** {sow['metadata']['weighted_score']}",
|
|
294
|
+
f"",
|
|
295
|
+
f"---",
|
|
296
|
+
f"Auto-generated by Mega Brain Intelligence Layer | {sow['generated_at'][:10]}",
|
|
297
|
+
])
|
|
298
|
+
|
|
299
|
+
return "\n".join(lines)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def generate_all_sows(registry=None, save=True):
|
|
303
|
+
"""Generate SOWs for all roles that meet established threshold."""
|
|
304
|
+
if registry is None:
|
|
305
|
+
registry = load_registry()
|
|
306
|
+
|
|
307
|
+
roles = registry.get("roles", {})
|
|
308
|
+
generated = []
|
|
309
|
+
skipped = []
|
|
310
|
+
|
|
311
|
+
for role_name, role_data in roles.items():
|
|
312
|
+
ws = role_data.get("weighted_score", 0)
|
|
313
|
+
sources = role_data.get("sources", [])
|
|
314
|
+
|
|
315
|
+
# Only generate for established roles (ws >= 10, sources >= 2)
|
|
316
|
+
if ws >= 10 and len(sources) >= 2:
|
|
317
|
+
sow = generate_sow(role_name, registry=registry)
|
|
318
|
+
md = generate_sow_markdown(sow)
|
|
319
|
+
|
|
320
|
+
if save:
|
|
321
|
+
_save_sow(role_name, sow, md)
|
|
322
|
+
|
|
323
|
+
# Update registry
|
|
324
|
+
role_data["sow_generated"] = True
|
|
325
|
+
role_data["sow_path"] = f"agents/cargo/{_domain_dir(sow)}/{role_name.lower()}/SOW.md"
|
|
326
|
+
role_data["executor_type"] = sow["ai_config"]["executor_type"]
|
|
327
|
+
role_data["autonomy_level"] = sow["ai_config"]["autonomy_level"]
|
|
328
|
+
|
|
329
|
+
generated.append({
|
|
330
|
+
"role": role_name,
|
|
331
|
+
"executor_type": sow["ai_config"]["executor_type"],
|
|
332
|
+
"autonomy": sow["ai_config"]["autonomy_level"],
|
|
333
|
+
"weighted_score": ws,
|
|
334
|
+
})
|
|
335
|
+
else:
|
|
336
|
+
skipped.append({
|
|
337
|
+
"role": role_name,
|
|
338
|
+
"reason": f"ws={ws}, sources={len(sources)}",
|
|
339
|
+
})
|
|
340
|
+
|
|
341
|
+
if save:
|
|
342
|
+
save_registry(registry)
|
|
343
|
+
_log_generation(generated)
|
|
344
|
+
|
|
345
|
+
return {
|
|
346
|
+
"generated": len(generated),
|
|
347
|
+
"skipped": len(skipped),
|
|
348
|
+
"details": generated,
|
|
349
|
+
"skipped_details": skipped[:10],
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
# ---------------------------------------------------------------------------
|
|
354
|
+
# EXECUTOR DECISION TREE
|
|
355
|
+
# ---------------------------------------------------------------------------
|
|
356
|
+
def _evaluate_executor_type(role_name, responsibilities, domain_ids, role_data):
|
|
357
|
+
"""
|
|
358
|
+
Run 6-question executor decision tree.
|
|
359
|
+
|
|
360
|
+
Returns decision dict with all questions answered and result.
|
|
361
|
+
"""
|
|
362
|
+
resp_text = " ".join(responsibilities).lower()
|
|
363
|
+
role_lower = role_name.lower().replace("-", " ")
|
|
364
|
+
|
|
365
|
+
# Q1: Is the output 100% predictable?
|
|
366
|
+
q1 = _is_output_predictable(role_lower, resp_text)
|
|
367
|
+
|
|
368
|
+
# Q2: Can this be a pure function?
|
|
369
|
+
q2 = q1 # If predictable, likely pure function
|
|
370
|
+
|
|
371
|
+
# Q3: Does it require NLP / natural language understanding?
|
|
372
|
+
q3 = _requires_nlp(role_lower, resp_text, domain_ids)
|
|
373
|
+
|
|
374
|
+
# Q4: What's the error impact?
|
|
375
|
+
q4 = _error_impact(role_lower, domain_ids)
|
|
376
|
+
|
|
377
|
+
# Q5: Requires strategic judgment?
|
|
378
|
+
q5 = _requires_strategic_judgment(role_lower, resp_text, domain_ids)
|
|
379
|
+
|
|
380
|
+
# Q6: Can AI assist or prepare?
|
|
381
|
+
q6 = not q1 # If not fully predictable, AI can at least assist
|
|
382
|
+
|
|
383
|
+
# Decision logic
|
|
384
|
+
if q1 and q2:
|
|
385
|
+
result = "Worker"
|
|
386
|
+
rationale = "Output previsivel e pode ser funcao pura. Automacao completa."
|
|
387
|
+
elif q5 and not q6:
|
|
388
|
+
result = "Human"
|
|
389
|
+
rationale = "Requer julgamento estrategico e IA nao pode assistir adequadamente."
|
|
390
|
+
elif q5 and q6:
|
|
391
|
+
result = "Hybrid"
|
|
392
|
+
rationale = "Requer julgamento estrategico mas IA pode preparar e assistir."
|
|
393
|
+
elif q3 and q4 in ("HIGH", "CRITICAL"):
|
|
394
|
+
result = "Hybrid"
|
|
395
|
+
rationale = "Precisa NLP com alto impacto de erro. IA executa, humano valida."
|
|
396
|
+
elif q3:
|
|
397
|
+
result = "Agent"
|
|
398
|
+
rationale = "Precisa NLP mas impacto de erro e gerenciavel. IA executa com monitoramento."
|
|
399
|
+
else:
|
|
400
|
+
# Fallback: use domain default
|
|
401
|
+
result = _domain_default_executor(domain_ids)
|
|
402
|
+
rationale = f"Classificacao por dominio primario ({domain_ids[0] if domain_ids else 'geral'})."
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
"question_1_predictable": q1,
|
|
406
|
+
"question_2_pure_function": q2,
|
|
407
|
+
"question_3_nlp_required": q3,
|
|
408
|
+
"question_4_error_impact": q4,
|
|
409
|
+
"question_5_strategic": q5,
|
|
410
|
+
"question_6_ai_assist": q6,
|
|
411
|
+
"result": result,
|
|
412
|
+
"rationale": rationale,
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
def _is_output_predictable(role_lower, resp_text):
|
|
417
|
+
"""Q1: Is output 100% predictable?"""
|
|
418
|
+
predictable_keywords = ["data entry", "report generation", "template",
|
|
419
|
+
"scheduling", "auto-", "automated"]
|
|
420
|
+
return any(kw in role_lower or kw in resp_text for kw in predictable_keywords)
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def _requires_nlp(role_lower, resp_text, domain_ids):
|
|
424
|
+
"""Q3: Does it require NLP?"""
|
|
425
|
+
nlp_domains = {"copywriting", "content", "marketing", "vendas", "outbound"}
|
|
426
|
+
nlp_keywords = ["write", "create", "draft", "respond", "communicate",
|
|
427
|
+
"pitch", "present", "negotiate", "coach"]
|
|
428
|
+
has_nlp_domain = bool(set(domain_ids) & nlp_domains)
|
|
429
|
+
has_nlp_keyword = any(kw in resp_text for kw in nlp_keywords)
|
|
430
|
+
return has_nlp_domain or has_nlp_keyword
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def _error_impact(role_lower, domain_ids):
|
|
434
|
+
"""Q4: What's the error impact?"""
|
|
435
|
+
critical_domains = {"legal", "compensation"}
|
|
436
|
+
high_domains = {"vendas", "hiring", "management"}
|
|
437
|
+
if set(domain_ids) & critical_domains:
|
|
438
|
+
return "CRITICAL"
|
|
439
|
+
if set(domain_ids) & high_domains:
|
|
440
|
+
return "HIGH"
|
|
441
|
+
return "MEDIUM"
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
def _requires_strategic_judgment(role_lower, resp_text, domain_ids):
|
|
445
|
+
"""Q5: Requires strategic judgment?"""
|
|
446
|
+
strategic_keywords = ["strategy", "decision", "judgment", "evaluate",
|
|
447
|
+
"negotiate", "hire", "fire", "budget", "prioritize"]
|
|
448
|
+
strategic_roles = ["manager", "director", "head", "lead", "chief", "vp",
|
|
449
|
+
"cro", "cmo", "coo", "cfo"]
|
|
450
|
+
has_strategic_keyword = any(kw in resp_text for kw in strategic_keywords)
|
|
451
|
+
is_strategic_role = any(sr in role_lower for sr in strategic_roles)
|
|
452
|
+
return has_strategic_keyword or is_strategic_role
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
def _domain_default_executor(domain_ids):
|
|
456
|
+
"""Get default executor type from domain."""
|
|
457
|
+
for did in domain_ids:
|
|
458
|
+
if did in DOMAIN_EXECUTOR_DEFAULTS:
|
|
459
|
+
return DOMAIN_EXECUTOR_DEFAULTS[did]
|
|
460
|
+
return "Hybrid"
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
# ---------------------------------------------------------------------------
|
|
464
|
+
# SUGGESTION HELPERS
|
|
465
|
+
# ---------------------------------------------------------------------------
|
|
466
|
+
def _suggest_tools(role_name, domain_ids):
|
|
467
|
+
"""Suggest tools based on role and domain."""
|
|
468
|
+
tools = []
|
|
469
|
+
role_lower = role_name.lower()
|
|
470
|
+
|
|
471
|
+
if any(d in domain_ids for d in ["vendas", "outbound"]):
|
|
472
|
+
tools.extend(["CRM (HubSpot/Pipedrive)", "Calendar (Calendly)"])
|
|
473
|
+
if "outbound" in domain_ids:
|
|
474
|
+
tools.extend(["Dialer (JustCall)", "Email Sequencer"])
|
|
475
|
+
if "copywriting" in domain_ids:
|
|
476
|
+
tools.extend(["Google Docs", "Reference Library"])
|
|
477
|
+
if "content" in domain_ids:
|
|
478
|
+
tools.extend(["Social Media Scheduler", "Design Tool (Canva)"])
|
|
479
|
+
if "growth" in domain_ids:
|
|
480
|
+
tools.extend(["Ad Platform (Meta/Google)", "Analytics Dashboard"])
|
|
481
|
+
if "technology" in domain_ids:
|
|
482
|
+
tools.extend(["IDE", "Git", "CI/CD Pipeline"])
|
|
483
|
+
if "operations" in domain_ids:
|
|
484
|
+
tools.extend(["Project Management (ClickUp)", "Reporting Dashboard"])
|
|
485
|
+
|
|
486
|
+
if "closer" in role_lower:
|
|
487
|
+
tools.extend(["Zoom/Google Meet", "Proposal Tool (PandaDoc)"])
|
|
488
|
+
if "bdr" in role_lower or "sdr" in role_lower:
|
|
489
|
+
tools.extend(["LinkedIn Sales Navigator", "Lead Database"])
|
|
490
|
+
|
|
491
|
+
return list(dict.fromkeys(tools))[:10] # dedupe, cap at 10
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
def _suggest_tasks(role_name, responsibilities):
|
|
495
|
+
"""Suggest tasks based on role name and responsibilities."""
|
|
496
|
+
tasks = []
|
|
497
|
+
role_lower = role_name.lower()
|
|
498
|
+
|
|
499
|
+
if "closer" in role_lower:
|
|
500
|
+
tasks = ["Execute sales call framework", "Handle objections", "Review pipeline"]
|
|
501
|
+
elif "bdr" in role_lower or "sdr" in role_lower:
|
|
502
|
+
tasks = ["Execute outbound sequences", "Qualify leads", "Book meetings"]
|
|
503
|
+
elif "setter" in role_lower:
|
|
504
|
+
tasks = ["Pre-qualify prospects", "Schedule appointments", "Follow up leads"]
|
|
505
|
+
elif "copywriter" in role_lower:
|
|
506
|
+
tasks = ["Write sales copy", "Create email sequences", "Draft ad copy"]
|
|
507
|
+
elif "content" in role_lower:
|
|
508
|
+
tasks = ["Create content calendar", "Produce content", "Manage distribution"]
|
|
509
|
+
elif "media" in role_lower or "ppc" in role_lower:
|
|
510
|
+
tasks = ["Manage ad campaigns", "Optimize ROAS", "Scale winning ads"]
|
|
511
|
+
elif "manager" in role_lower:
|
|
512
|
+
tasks = ["Run 1-on-1s", "Review team metrics", "Coach team members"]
|
|
513
|
+
elif "designer" in role_lower:
|
|
514
|
+
tasks = ["Create visual assets", "Maintain brand guidelines", "Design creatives"]
|
|
515
|
+
else:
|
|
516
|
+
# Generic from responsibilities
|
|
517
|
+
tasks = [f"Execute: {r[:60]}" for r in responsibilities[:5]]
|
|
518
|
+
|
|
519
|
+
return tasks[:8]
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
def _suggest_kpis(role_name, domain_ids):
|
|
523
|
+
"""Suggest KPIs based on role."""
|
|
524
|
+
role_lower = role_name.lower()
|
|
525
|
+
|
|
526
|
+
if "closer" in role_lower:
|
|
527
|
+
return ["Close rate (%)", "Revenue per close ($)", "Show rate (%)", "Cash collected ($)"]
|
|
528
|
+
if "bdr" in role_lower or "sdr" in role_lower:
|
|
529
|
+
return ["Calls per day", "Meetings booked per week", "Lead qualification rate (%)"]
|
|
530
|
+
if "setter" in role_lower:
|
|
531
|
+
return ["Appointments set per day", "Show rate (%)", "Qualification accuracy (%)"]
|
|
532
|
+
if "media" in role_lower or "ppc" in role_lower:
|
|
533
|
+
return ["ROAS", "CPA ($)", "Ad spend managed ($)", "Conversion rate (%)"]
|
|
534
|
+
if "copywriter" in role_lower:
|
|
535
|
+
return ["Conversion rate (%)", "Copy pieces delivered", "A/B test win rate (%)"]
|
|
536
|
+
if "content" in role_lower:
|
|
537
|
+
return ["Content pieces per week", "Engagement rate (%)", "Follower growth (%)"]
|
|
538
|
+
if "manager" in role_lower or "director" in role_lower:
|
|
539
|
+
return ["Team target attainment (%)", "Employee retention (%)", "Ramp time (days)"]
|
|
540
|
+
if "data" in role_lower or "analyst" in role_lower:
|
|
541
|
+
return ["Reports delivered on time (%)", "Data accuracy (%)", "Insights acted upon"]
|
|
542
|
+
|
|
543
|
+
return ["Target attainment (%)", "Tasks completed on time (%)"]
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
def _suggest_skills(role_name, domain_ids):
|
|
547
|
+
"""Suggest required skills."""
|
|
548
|
+
skills = []
|
|
549
|
+
for d in domain_ids:
|
|
550
|
+
if d == "vendas":
|
|
551
|
+
skills.extend(["Negotiation", "Communication", "Objection handling"])
|
|
552
|
+
elif d == "outbound":
|
|
553
|
+
skills.extend(["Cold calling", "Email outreach", "Lead qualification"])
|
|
554
|
+
elif d == "copywriting":
|
|
555
|
+
skills.extend(["Persuasive writing", "Research", "Headline crafting"])
|
|
556
|
+
elif d == "content":
|
|
557
|
+
skills.extend(["Content creation", "Social media management", "Storytelling"])
|
|
558
|
+
elif d == "growth":
|
|
559
|
+
skills.extend(["Paid advertising", "Analytics", "A/B testing"])
|
|
560
|
+
elif d == "technology":
|
|
561
|
+
skills.extend(["Programming", "System design", "Debugging"])
|
|
562
|
+
elif d == "management":
|
|
563
|
+
skills.extend(["Leadership", "Coaching", "Performance management"])
|
|
564
|
+
return list(dict.fromkeys(skills))[:8]
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
def _primary_department(domain_ids):
|
|
568
|
+
"""Map primary domain to department name."""
|
|
569
|
+
dept_map = {
|
|
570
|
+
"vendas": "Sales", "outbound": "Sales",
|
|
571
|
+
"marketing": "Marketing", "copywriting": "Marketing",
|
|
572
|
+
"content": "Content", "growth": "Growth/Marketing",
|
|
573
|
+
"operations": "Operations", "technology": "Engineering",
|
|
574
|
+
"hiring": "Human Resources", "management": "Management",
|
|
575
|
+
"design": "Design", "legal": "Legal",
|
|
576
|
+
}
|
|
577
|
+
for d in domain_ids:
|
|
578
|
+
if d in dept_map:
|
|
579
|
+
return dept_map[d]
|
|
580
|
+
return "General"
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
def _decision_authority(executor_type):
|
|
584
|
+
"""Map executor type to decision authority description."""
|
|
585
|
+
if executor_type == "Worker":
|
|
586
|
+
return "Executa tarefas predefinidas sem decisao"
|
|
587
|
+
elif executor_type == "Agent":
|
|
588
|
+
return "Pode decidir dentro de parametros definidos, escala excecoes"
|
|
589
|
+
elif executor_type == "Hybrid":
|
|
590
|
+
return "Prepara e sugere, humano decide em casos criticos"
|
|
591
|
+
elif executor_type == "Human":
|
|
592
|
+
return "Humano decide, IA apenas assiste com informacao"
|
|
593
|
+
return "Indefinido"
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
def _escalation_triggers(executor_type, role_name):
|
|
597
|
+
"""Generate escalation triggers based on executor type."""
|
|
598
|
+
if executor_type == "Worker":
|
|
599
|
+
return ["Erro de execucao", "Input fora do padrao"]
|
|
600
|
+
elif executor_type == "Agent":
|
|
601
|
+
return ["Confianca < 70%", "Erro repetido 2x", "Caso nao coberto por regras"]
|
|
602
|
+
elif executor_type == "Hybrid":
|
|
603
|
+
return ["Decisao acima do threshold de autonomia", "Excecao de processo",
|
|
604
|
+
"Impacto financeiro > threshold", "Conflito entre regras"]
|
|
605
|
+
elif executor_type == "Human":
|
|
606
|
+
return ["IA detecta inconsistencia", "Prazo critico", "Compliance check"]
|
|
607
|
+
return []
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
def _extract_competencies(responsibilities):
|
|
611
|
+
"""Extract competency keywords from responsibilities."""
|
|
612
|
+
comps = set()
|
|
613
|
+
for r in responsibilities:
|
|
614
|
+
r_lower = r.lower()
|
|
615
|
+
if any(kw in r_lower for kw in ["sell", "vend", "close", "deal"]):
|
|
616
|
+
comps.add("Sales execution")
|
|
617
|
+
if any(kw in r_lower for kw in ["lead", "manag", "coach", "train"]):
|
|
618
|
+
comps.add("People management")
|
|
619
|
+
if any(kw in r_lower for kw in ["write", "copy", "draft", "creat"]):
|
|
620
|
+
comps.add("Content creation")
|
|
621
|
+
if any(kw in r_lower for kw in ["analyz", "report", "metric", "data"]):
|
|
622
|
+
comps.add("Analytics")
|
|
623
|
+
if any(kw in r_lower for kw in ["strategy", "plan", "design", "architect"]):
|
|
624
|
+
comps.add("Strategic planning")
|
|
625
|
+
return list(comps)[:6]
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
def _domain_dir(sow):
|
|
629
|
+
"""Determine directory name for SOW storage."""
|
|
630
|
+
domains = sow["shared"]["domains"]
|
|
631
|
+
domain_to_dir = {
|
|
632
|
+
"vendas": "sales", "outbound": "sales", "marketing": "marketing",
|
|
633
|
+
"copywriting": "marketing", "content": "content", "growth": "growth",
|
|
634
|
+
"operations": "operations", "technology": "tech", "hiring": "hr",
|
|
635
|
+
"management": "management", "design": "design", "legal": "legal",
|
|
636
|
+
}
|
|
637
|
+
for d in domains:
|
|
638
|
+
if d in domain_to_dir:
|
|
639
|
+
return domain_to_dir[d]
|
|
640
|
+
return "general"
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
def _save_sow(role_name, sow, md):
|
|
644
|
+
"""Save SOW files."""
|
|
645
|
+
domain = _domain_dir(sow)
|
|
646
|
+
sow_dir = AGENTS_DIR / domain / role_name.lower()
|
|
647
|
+
sow_dir.mkdir(parents=True, exist_ok=True)
|
|
648
|
+
|
|
649
|
+
# Save JSON
|
|
650
|
+
with open(sow_dir / "SOW.json", "w", encoding="utf-8") as f:
|
|
651
|
+
json.dump(sow, f, indent=2, ensure_ascii=False)
|
|
652
|
+
|
|
653
|
+
# Save Markdown
|
|
654
|
+
with open(sow_dir / "SOW.md", "w", encoding="utf-8") as f:
|
|
655
|
+
f.write(md)
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
def _log_generation(generated):
|
|
659
|
+
"""Log SOW generation to JSONL."""
|
|
660
|
+
SOW_LOG_PATH.parent.mkdir(parents=True, exist_ok=True)
|
|
661
|
+
now = datetime.now(timezone.utc).isoformat()
|
|
662
|
+
for entry in generated:
|
|
663
|
+
log_entry = {
|
|
664
|
+
"timestamp": now,
|
|
665
|
+
"trigger_type": "sow_generation",
|
|
666
|
+
"role": entry["role"],
|
|
667
|
+
"executor_type": entry["executor_type"],
|
|
668
|
+
"autonomy": entry["autonomy"],
|
|
669
|
+
"weighted_score": entry["weighted_score"],
|
|
670
|
+
}
|
|
671
|
+
with open(SOW_LOG_PATH, "a", encoding="utf-8") as f:
|
|
672
|
+
f.write(json.dumps(log_entry, ensure_ascii=False) + "\n")
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
# ---------------------------------------------------------------------------
|
|
676
|
+
# CLI
|
|
677
|
+
# ---------------------------------------------------------------------------
|
|
678
|
+
def main():
|
|
679
|
+
if len(sys.argv) > 1 and sys.argv[1] == "--all":
|
|
680
|
+
print("\n=== SOW GENERATOR v1.0: Generate All ===\n")
|
|
681
|
+
result = generate_all_sows(save=True)
|
|
682
|
+
print(f"SOWs generated: {result['generated']}")
|
|
683
|
+
print(f"Roles skipped: {result['skipped']}")
|
|
684
|
+
|
|
685
|
+
if result["details"]:
|
|
686
|
+
print(f"\n--- Generated SOWs ---")
|
|
687
|
+
for d in result["details"]:
|
|
688
|
+
print(f" {d['role']:25s} executor={d['executor_type']:8s} "
|
|
689
|
+
f"autonomy={d['autonomy']}% ws={d['weighted_score']:.1f}")
|
|
690
|
+
|
|
691
|
+
if result["skipped_details"]:
|
|
692
|
+
print(f"\n--- Skipped (top 10) ---")
|
|
693
|
+
for s in result["skipped_details"]:
|
|
694
|
+
print(f" {s['role']:25s} reason: {s['reason']}")
|
|
695
|
+
|
|
696
|
+
elif len(sys.argv) > 1 and sys.argv[1] != "--help":
|
|
697
|
+
role = sys.argv[1].upper()
|
|
698
|
+
print(f"\n=== SOW for {role} ===\n")
|
|
699
|
+
sow = generate_sow(role)
|
|
700
|
+
md = generate_sow_markdown(sow)
|
|
701
|
+
print(md)
|
|
702
|
+
|
|
703
|
+
else:
|
|
704
|
+
print("Uso:")
|
|
705
|
+
print(" python3 sow_generator.py --all # Gerar SOWs para todos os roles")
|
|
706
|
+
print(" python3 sow_generator.py CLOSER # Gerar SOW para role especifico")
|
|
707
|
+
sys.exit(1)
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
if __name__ == "__main__":
|
|
711
|
+
main()
|