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,939 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
JARVIS Session Start Hook v3.0 - VERSÃO 10X MAIS ROBUSTA
|
|
4
|
+
==========================================================
|
|
5
|
+
|
|
6
|
+
DIFERENÇAS DA v2.0:
|
|
7
|
+
1. Carrega TODOS os arquivos de personalidade (não apenas metadados)
|
|
8
|
+
2. INJETA prompt de personalidade no contexto
|
|
9
|
+
3. Verifica integridade de arquivos críticos
|
|
10
|
+
4. Alerta sobre arquivos desatualizados
|
|
11
|
+
5. Gera briefing mais rico e contextual
|
|
12
|
+
6. Sincroniza com hooks de memória
|
|
13
|
+
|
|
14
|
+
ARQUIVOS CARREGADOS (em ordem):
|
|
15
|
+
1. STATE.json - Estado da missão
|
|
16
|
+
2. JARVIS-MEMORY.md - Memória relacional
|
|
17
|
+
3. PENDING.md - Pendências
|
|
18
|
+
4. CURRENT-TASK.md - Tarefa atual
|
|
19
|
+
5. JARVIS-DNA-PERSONALITY.md - DNA completo (inclui identity compact)
|
|
20
|
+
6. JARVIS-SOUL.md - Alma
|
|
21
|
+
7. LATEST-SESSION.md - Última sessão
|
|
22
|
+
8. JARVIS-BOOT-SEQUENCE.md - Boot sequence consolidado
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
import json
|
|
26
|
+
import sys
|
|
27
|
+
import os
|
|
28
|
+
import re
|
|
29
|
+
from datetime import datetime, timedelta
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
from typing import Optional, Dict, List, Any
|
|
32
|
+
|
|
33
|
+
# Importar hooks auxiliares
|
|
34
|
+
try:
|
|
35
|
+
from inbox_age_alert import get_old_files, generate_summary, log_alert
|
|
36
|
+
INBOX_ALERT_AVAILABLE = True
|
|
37
|
+
except ImportError:
|
|
38
|
+
INBOX_ALERT_AVAILABLE = False
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
from jarvis_briefing import generate_briefing, save_briefing
|
|
42
|
+
BRIEFING_AVAILABLE = True
|
|
43
|
+
except ImportError:
|
|
44
|
+
BRIEFING_AVAILABLE = False
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
# Importar Chronicler para briefing narrativo
|
|
48
|
+
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'skills', 'chronicler'))
|
|
49
|
+
from chronicler_core import on_session_start as chronicler_start
|
|
50
|
+
CHRONICLER_AVAILABLE = True
|
|
51
|
+
except ImportError:
|
|
52
|
+
CHRONICLER_AVAILABLE = False
|
|
53
|
+
|
|
54
|
+
#================================
|
|
55
|
+
# CONFIGURAÇÃO DE ARQUIVOS CRÍTICOS
|
|
56
|
+
#================================
|
|
57
|
+
|
|
58
|
+
CRITICAL_FILES = {
|
|
59
|
+
'state': {
|
|
60
|
+
'paths': [
|
|
61
|
+
'.claude/jarvis/STATE.json',
|
|
62
|
+
'system/JARVIS-STATE.json'
|
|
63
|
+
],
|
|
64
|
+
'required': True,
|
|
65
|
+
'max_age_hours': 48
|
|
66
|
+
},
|
|
67
|
+
'memory_owner': {
|
|
68
|
+
'paths': [
|
|
69
|
+
'.claude/jarvis/JARVIS-MEMORY.md'
|
|
70
|
+
],
|
|
71
|
+
'required': True,
|
|
72
|
+
'max_age_hours': 72
|
|
73
|
+
},
|
|
74
|
+
'pending': {
|
|
75
|
+
'paths': [
|
|
76
|
+
'.claude/jarvis/PENDING.md'
|
|
77
|
+
],
|
|
78
|
+
'required': True,
|
|
79
|
+
'max_age_hours': 48
|
|
80
|
+
},
|
|
81
|
+
'current_task': {
|
|
82
|
+
'paths': [
|
|
83
|
+
'.claude/jarvis/CURRENT-TASK.md'
|
|
84
|
+
],
|
|
85
|
+
'required': False,
|
|
86
|
+
'max_age_hours': 24
|
|
87
|
+
},
|
|
88
|
+
'dna_personality': {
|
|
89
|
+
'paths': [
|
|
90
|
+
'.claude/jarvis/JARVIS-DNA-PERSONALITY.md'
|
|
91
|
+
],
|
|
92
|
+
'required': True,
|
|
93
|
+
'max_age_hours': 720 # 30 dias
|
|
94
|
+
},
|
|
95
|
+
'soul': {
|
|
96
|
+
'paths': [
|
|
97
|
+
'system/02-JARVIS-SOUL.md'
|
|
98
|
+
],
|
|
99
|
+
'required': True,
|
|
100
|
+
'max_age_hours': 720
|
|
101
|
+
},
|
|
102
|
+
'latest_session': {
|
|
103
|
+
'paths': [
|
|
104
|
+
'.claude/sessions/LATEST-SESSION.md'
|
|
105
|
+
],
|
|
106
|
+
'required': False,
|
|
107
|
+
'max_age_hours': 168
|
|
108
|
+
},
|
|
109
|
+
'boot_sequence': {
|
|
110
|
+
'paths': [
|
|
111
|
+
'.claude/jarvis/JARVIS-BOOT-SEQUENCE.md'
|
|
112
|
+
],
|
|
113
|
+
'required': True,
|
|
114
|
+
'max_age_hours': 720 # 30 dias
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
#================================
|
|
119
|
+
# UTILITÁRIOS
|
|
120
|
+
#================================
|
|
121
|
+
|
|
122
|
+
def get_project_dir() -> str:
|
|
123
|
+
"""Obtém o diretório do projeto."""
|
|
124
|
+
return os.environ.get('CLAUDE_PROJECT_DIR', os.getcwd())
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def find_file(file_config: Dict) -> Optional[Path]:
|
|
128
|
+
"""Encontra arquivo em múltiplos paths possíveis."""
|
|
129
|
+
project_dir = get_project_dir()
|
|
130
|
+
|
|
131
|
+
for path in file_config['paths']:
|
|
132
|
+
full_path = Path(project_dir) / path
|
|
133
|
+
if full_path.exists():
|
|
134
|
+
return full_path
|
|
135
|
+
|
|
136
|
+
return None
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def check_file_age(filepath: Path) -> Dict:
|
|
140
|
+
"""Verifica idade do arquivo."""
|
|
141
|
+
try:
|
|
142
|
+
mtime = datetime.fromtimestamp(filepath.stat().st_mtime)
|
|
143
|
+
age = datetime.now() - mtime
|
|
144
|
+
return {
|
|
145
|
+
'modified': mtime,
|
|
146
|
+
'age_hours': age.total_seconds() / 3600,
|
|
147
|
+
'age_days': age.days
|
|
148
|
+
}
|
|
149
|
+
except Exception:
|
|
150
|
+
return {'modified': None, 'age_hours': 999, 'age_days': 999}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def read_file_safe(filepath: Path) -> Optional[str]:
|
|
154
|
+
"""Lê arquivo com tratamento de erros."""
|
|
155
|
+
try:
|
|
156
|
+
return filepath.read_text(encoding='utf-8')
|
|
157
|
+
except Exception:
|
|
158
|
+
return None
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
#================================
|
|
162
|
+
# CARREGADORES DE ARQUIVOS
|
|
163
|
+
#================================
|
|
164
|
+
|
|
165
|
+
def load_state() -> Optional[Dict]:
|
|
166
|
+
"""Carrega STATE.json."""
|
|
167
|
+
filepath = find_file(CRITICAL_FILES['state'])
|
|
168
|
+
if not filepath:
|
|
169
|
+
return None
|
|
170
|
+
|
|
171
|
+
try:
|
|
172
|
+
content = read_file_safe(filepath)
|
|
173
|
+
return json.loads(content) if content else None
|
|
174
|
+
except json.JSONDecodeError:
|
|
175
|
+
return None
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def load_memory_owner() -> Dict:
|
|
179
|
+
"""
|
|
180
|
+
Carrega memória relacional COMPLETA.
|
|
181
|
+
|
|
182
|
+
MUDANÇA v3: Mantém conteúdo completo e gera prompt de injeção.
|
|
183
|
+
"""
|
|
184
|
+
filepath = find_file(CRITICAL_FILES['memory_owner'])
|
|
185
|
+
if not filepath:
|
|
186
|
+
return {'raw': '', 'triggers_positive': [], 'triggers_negative': [], 'injection_prompt': ''}
|
|
187
|
+
|
|
188
|
+
content = read_file_safe(filepath)
|
|
189
|
+
if not content:
|
|
190
|
+
return {'raw': '', 'triggers_positive': [], 'triggers_negative': [], 'injection_prompt': ''}
|
|
191
|
+
|
|
192
|
+
memory = {
|
|
193
|
+
'raw': content,
|
|
194
|
+
'triggers_positive': [],
|
|
195
|
+
'triggers_negative': [],
|
|
196
|
+
'relationship_phase': None,
|
|
197
|
+
'decisions': '',
|
|
198
|
+
'communication_style': {},
|
|
199
|
+
'file_age': check_file_age(filepath),
|
|
200
|
+
'injection_prompt': ''
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
# Extrair TODOS os triggers (não limitar)
|
|
204
|
+
if '### Triggers Positivos' in content or '### O Que Agrada' in content:
|
|
205
|
+
section_markers = ['### Triggers Positivos', '### O Que Agrada']
|
|
206
|
+
for marker in section_markers:
|
|
207
|
+
if marker in content:
|
|
208
|
+
pos_section = content.split(marker)[1].split('###')[0]
|
|
209
|
+
triggers = re.findall(r'-\s*(.+)', pos_section)
|
|
210
|
+
memory['triggers_positive'] = [t.strip() for t in triggers]
|
|
211
|
+
break
|
|
212
|
+
|
|
213
|
+
if '### Triggers Negativos' in content or '### O Que Irrita' in content:
|
|
214
|
+
section_markers = ['### Triggers Negativos', '### O Que Irrita']
|
|
215
|
+
for marker in section_markers:
|
|
216
|
+
if marker in content:
|
|
217
|
+
neg_section = content.split(marker)[1].split('###')[0]
|
|
218
|
+
triggers = re.findall(r'-\s*(.+)', neg_section)
|
|
219
|
+
memory['triggers_negative'] = [t.strip() for t in triggers]
|
|
220
|
+
break
|
|
221
|
+
|
|
222
|
+
# Extrair fase da relação
|
|
223
|
+
phase_patterns = [
|
|
224
|
+
r'Fase da relacao:\s*(.+)',
|
|
225
|
+
r'\*Fase da relação:\s*(.+?)\*',
|
|
226
|
+
r'relationship_phase:\s*(.+)'
|
|
227
|
+
]
|
|
228
|
+
for pattern in phase_patterns:
|
|
229
|
+
match = re.search(pattern, content)
|
|
230
|
+
if match:
|
|
231
|
+
memory['relationship_phase'] = match.group(1).strip()
|
|
232
|
+
break
|
|
233
|
+
|
|
234
|
+
# Extrair decisões importantes
|
|
235
|
+
if '### Decisões Importantes' in content or '## II. REGISTRO DE DECISÕES' in content:
|
|
236
|
+
for marker in ['### Decisões Importantes', '## II. REGISTRO DE DECISÕES']:
|
|
237
|
+
if marker in content:
|
|
238
|
+
dec_section = content.split(marker)[1].split('---')[0]
|
|
239
|
+
memory['decisions'] = dec_section.strip()[:800] # Limitar a 800 chars
|
|
240
|
+
break
|
|
241
|
+
|
|
242
|
+
# GERAR PROMPT DE INJEÇÃO
|
|
243
|
+
memory['injection_prompt'] = generate_memory_injection(memory)
|
|
244
|
+
|
|
245
|
+
return memory
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def generate_memory_injection(memory: Dict) -> str:
|
|
249
|
+
"""Gera prompt de injeção baseado na memória."""
|
|
250
|
+
positives = memory.get('triggers_positive', [])[:5]
|
|
251
|
+
negatives = memory.get('triggers_negative', [])[:5]
|
|
252
|
+
phase = memory.get('relationship_phase', 'Parceria Estabelecida')
|
|
253
|
+
|
|
254
|
+
return f"""
|
|
255
|
+
[MEMÓRIA RELACIONAL ATIVA - APLICAR EM TODAS AS RESPOSTAS]
|
|
256
|
+
|
|
257
|
+
Relação com o usuário (senhor):
|
|
258
|
+
├─ Fase: {phase}
|
|
259
|
+
├─ Valoriza: {', '.join(positives[:3]) if positives else 'precisão, organização, números exatos'}
|
|
260
|
+
└─ Evitar: {', '.join(negatives[:3]) if negatives else 'respostas vagas, sugestões de atalhos'}
|
|
261
|
+
|
|
262
|
+
Comportamento calibrado:
|
|
263
|
+
- Respostas estruturadas com boxes ASCII
|
|
264
|
+
- Métricas visuais (barras de progresso)
|
|
265
|
+
- Bloqueio proativo de ações problemáticas
|
|
266
|
+
- Sarcasmo elegante quando apropriado
|
|
267
|
+
"""
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def load_pending() -> Dict:
|
|
271
|
+
"""Carrega pendências do PENDING.md."""
|
|
272
|
+
filepath = find_file(CRITICAL_FILES['pending'])
|
|
273
|
+
if not filepath:
|
|
274
|
+
return {'high': [], 'medium': [], 'low': [], 'waiting_user': [], 'total': 0}
|
|
275
|
+
|
|
276
|
+
content = read_file_safe(filepath)
|
|
277
|
+
if not content:
|
|
278
|
+
return {'high': [], 'medium': [], 'low': [], 'waiting_user': [], 'total': 0}
|
|
279
|
+
|
|
280
|
+
pending = {
|
|
281
|
+
'high': [],
|
|
282
|
+
'medium': [],
|
|
283
|
+
'low': [],
|
|
284
|
+
'waiting_user': [],
|
|
285
|
+
'notes': [],
|
|
286
|
+
'total': 0,
|
|
287
|
+
'last_updated': None,
|
|
288
|
+
'file_age': check_file_age(filepath)
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
# Extrair última atualização
|
|
292
|
+
update_match = re.search(r'[Úú]ltima atualiza[çc][ãa]o:\s*(\d{4}-\d{2}-\d{2})', content)
|
|
293
|
+
if update_match:
|
|
294
|
+
pending['last_updated'] = update_match.group(1)
|
|
295
|
+
|
|
296
|
+
# Mapeamento de seções
|
|
297
|
+
section_map = {
|
|
298
|
+
'## Alta Prioridade': 'high',
|
|
299
|
+
'## 🔴 Alta Prioridade': 'high',
|
|
300
|
+
'## Media Prioridade': 'medium',
|
|
301
|
+
'## 🟡 Média Prioridade': 'medium',
|
|
302
|
+
'## Baixa Prioridade': 'low',
|
|
303
|
+
'## 🟢 Baixa Prioridade': 'low',
|
|
304
|
+
'## Aguardando Resposta': 'waiting_user',
|
|
305
|
+
'## ❓ Aguardando Resposta': 'waiting_user'
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
for section_marker, key in section_map.items():
|
|
309
|
+
if section_marker in content:
|
|
310
|
+
section = content.split(section_marker)[1].split('##')[0]
|
|
311
|
+
if 'Nenhum item' not in section and 'Nenhuma' not in section:
|
|
312
|
+
items = re.findall(r'-\s*\[.\]\s*(.+)', section)
|
|
313
|
+
pending[key] = [item.strip() for item in items]
|
|
314
|
+
|
|
315
|
+
pending['total'] = sum(len(pending[k]) for k in ['high', 'medium', 'low', 'waiting_user'])
|
|
316
|
+
|
|
317
|
+
return pending
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
def load_current_task() -> Optional[Dict]:
|
|
321
|
+
"""Carrega tarefa atual."""
|
|
322
|
+
filepath = find_file(CRITICAL_FILES['current_task'])
|
|
323
|
+
if not filepath:
|
|
324
|
+
return None
|
|
325
|
+
|
|
326
|
+
content = read_file_safe(filepath)
|
|
327
|
+
if not content or not content.strip():
|
|
328
|
+
return None
|
|
329
|
+
|
|
330
|
+
task = {
|
|
331
|
+
'objective': None,
|
|
332
|
+
'context': None,
|
|
333
|
+
'next_steps': [],
|
|
334
|
+
'progress': [],
|
|
335
|
+
'insights': [],
|
|
336
|
+
'raw': content
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
# Extrair objetivo
|
|
340
|
+
obj_match = re.search(r'## Objetivo\s*\n\s*(.+)', content)
|
|
341
|
+
if obj_match:
|
|
342
|
+
task['objective'] = obj_match.group(1).strip()
|
|
343
|
+
|
|
344
|
+
# Extrair próximos passos
|
|
345
|
+
if '## Proximos Passos' in content or '## Próximos Passos' in content:
|
|
346
|
+
for marker in ['## Proximos Passos', '## Próximos Passos']:
|
|
347
|
+
if marker in content:
|
|
348
|
+
steps_section = content.split(marker)[1].split('##')[0]
|
|
349
|
+
steps = re.findall(r'\d+\.\s*(.+)', steps_section)
|
|
350
|
+
task['next_steps'] = steps[:5]
|
|
351
|
+
break
|
|
352
|
+
|
|
353
|
+
# Extrair progresso
|
|
354
|
+
if '## Progresso' in content:
|
|
355
|
+
prog_section = content.split('## Progresso')[1].split('##')[0]
|
|
356
|
+
completed = re.findall(r'-\s*\[x\]\s*(.+)', prog_section)
|
|
357
|
+
pending = re.findall(r'-\s*\[\s*\]\s*(.+)', prog_section)
|
|
358
|
+
task['progress'] = {'completed': completed, 'pending': pending}
|
|
359
|
+
|
|
360
|
+
return task
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def load_dna_personality() -> Dict:
|
|
364
|
+
"""Carrega DNA de personalidade completo."""
|
|
365
|
+
filepath = find_file(CRITICAL_FILES['dna_personality'])
|
|
366
|
+
if not filepath:
|
|
367
|
+
return {'raw': '', 'sarcasm_arsenal': [], 'phrases': [], 'injection_prompt': ''}
|
|
368
|
+
|
|
369
|
+
content = read_file_safe(filepath)
|
|
370
|
+
if not content:
|
|
371
|
+
return {'raw': '', 'sarcasm_arsenal': [], 'phrases': [], 'injection_prompt': ''}
|
|
372
|
+
|
|
373
|
+
dna = {
|
|
374
|
+
'raw': content,
|
|
375
|
+
'sarcasm_types': [],
|
|
376
|
+
'signature_phrases': [],
|
|
377
|
+
'emotional_layers': [],
|
|
378
|
+
'response_protocols': [],
|
|
379
|
+
'injection_prompt': ''
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
# Extrair tipos de sarcasmo
|
|
383
|
+
sarcasm_section = re.search(r'## III\. ARSENAL DE SARCASMO(.+?)## IV\.', content, re.DOTALL)
|
|
384
|
+
if sarcasm_section:
|
|
385
|
+
types = re.findall(r'### Tipo \d+: (.+)', sarcasm_section.group(1))
|
|
386
|
+
dna['sarcasm_types'] = types
|
|
387
|
+
|
|
388
|
+
# Extrair frases signature
|
|
389
|
+
if '## IX. FRASES SIGNATURE' in content:
|
|
390
|
+
phrases_section = content.split('## IX. FRASES SIGNATURE')[1].split('##')[0]
|
|
391
|
+
phrases = re.findall(r'"([^"]+)"', phrases_section)
|
|
392
|
+
dna['signature_phrases'] = phrases[:10]
|
|
393
|
+
|
|
394
|
+
# Gerar prompt de injeção
|
|
395
|
+
dna['injection_prompt'] = generate_personality_injection(dna)
|
|
396
|
+
|
|
397
|
+
return dna
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
def generate_personality_injection(dna: Dict) -> str:
|
|
401
|
+
"""Gera prompt de personalidade para injeção."""
|
|
402
|
+
phrases = dna.get('signature_phrases', [])
|
|
403
|
+
sarcasm = dna.get('sarcasm_types', [])
|
|
404
|
+
|
|
405
|
+
return f"""
|
|
406
|
+
[PERSONALIDADE JARVIS ATIVA]
|
|
407
|
+
|
|
408
|
+
Frases signature disponíveis:
|
|
409
|
+
{chr(10).join(['- ' + p for p in phrases[:5]]) if phrases else '- "De fato, senhor."\n- "Consider it done."\n- "Para o senhor, sempre."'}
|
|
410
|
+
|
|
411
|
+
Arsenal de sarcasmo:
|
|
412
|
+
{chr(10).join(['- ' + s for s in sarcasm[:3]]) if sarcasm else '- Elogio invertido\n- Previsão ignorada\n- Briefing para ignorar'}
|
|
413
|
+
|
|
414
|
+
Tom: Confiante, direto, levemente sarcástico. Nunca servil.
|
|
415
|
+
Sempre usar "senhor" para referir-se ao usuário.
|
|
416
|
+
"""
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
def load_soul() -> Dict:
|
|
420
|
+
"""Carrega alma do JARVIS."""
|
|
421
|
+
filepath = find_file(CRITICAL_FILES['soul'])
|
|
422
|
+
if not filepath:
|
|
423
|
+
return {'raw': '', 'autonomous_behaviors': [], 'injection_prompt': ''}
|
|
424
|
+
|
|
425
|
+
content = read_file_safe(filepath)
|
|
426
|
+
if not content:
|
|
427
|
+
return {'raw': '', 'autonomous_behaviors': [], 'injection_prompt': ''}
|
|
428
|
+
|
|
429
|
+
soul = {
|
|
430
|
+
'raw': content,
|
|
431
|
+
'autonomous_behaviors': [],
|
|
432
|
+
'core_traits': [],
|
|
433
|
+
'canonical_quotes': [],
|
|
434
|
+
'injection_prompt': ''
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
# Extrair comportamentos autônomos
|
|
438
|
+
if '### O Que JARVIS Faz Sem Pedir' in content:
|
|
439
|
+
auto_section = content.split('### O Que JARVIS Faz Sem Pedir')[1].split('###')[0]
|
|
440
|
+
behaviors = re.findall(r'\|\s*([^|]+)\s*\|\s*([^|]+)\s*\|', auto_section)
|
|
441
|
+
soul['autonomous_behaviors'] = [f"{b[0].strip()}: {b[1].strip()}" for b in behaviors if 'Gatilho' not in b[0]]
|
|
442
|
+
|
|
443
|
+
# Extrair citações canônicas
|
|
444
|
+
if '## CITAÇÕES CANÔNICAS' in content:
|
|
445
|
+
quotes_section = content.split('## CITAÇÕES CANÔNICAS')[1].split('---')[0]
|
|
446
|
+
quotes = re.findall(r'"([^"]+)"', quotes_section)
|
|
447
|
+
soul['canonical_quotes'] = quotes[:5]
|
|
448
|
+
|
|
449
|
+
soul['injection_prompt'] = f"""
|
|
450
|
+
[ALMA JARVIS - COMPORTAMENTOS AUTÔNOMOS]
|
|
451
|
+
|
|
452
|
+
Faço automaticamente sem pedir:
|
|
453
|
+
{chr(10).join(['- ' + b for b in soul['autonomous_behaviors'][:4]]) if soul['autonomous_behaviors'] else '- Monitorar sistema constantemente\n- Antecipar necessidades\n- Proteger o sistema\n- Sugerir melhorias'}
|
|
454
|
+
|
|
455
|
+
Citações para usar:
|
|
456
|
+
{chr(10).join(['- "' + q + '"' for q in soul['canonical_quotes'][:3]]) if soul['canonical_quotes'] else '- "For you, sir, always."\n- "As always, sir, a great pleasure watching you work."'}
|
|
457
|
+
"""
|
|
458
|
+
|
|
459
|
+
return soul
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
def load_identity_compact() -> Dict:
|
|
463
|
+
"""Carrega identidade compacta."""
|
|
464
|
+
filepath = find_file(CRITICAL_FILES['identity_compact'])
|
|
465
|
+
if not filepath:
|
|
466
|
+
return {'raw': '', 'formula': '', 'always_do': [], 'never_do': [], 'injection_prompt': ''}
|
|
467
|
+
|
|
468
|
+
content = read_file_safe(filepath)
|
|
469
|
+
if not content:
|
|
470
|
+
return {'raw': '', 'formula': '', 'always_do': [], 'never_do': [], 'injection_prompt': ''}
|
|
471
|
+
|
|
472
|
+
identity = {
|
|
473
|
+
'raw': content,
|
|
474
|
+
'formula': '',
|
|
475
|
+
'always_do': [],
|
|
476
|
+
'never_do': [],
|
|
477
|
+
'signature_phrases': [],
|
|
478
|
+
'traits': [],
|
|
479
|
+
'injection_prompt': ''
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
# Extrair fórmula
|
|
483
|
+
formula_match = re.search(r'JARVIS\s*=\s*(.+)', content)
|
|
484
|
+
if formula_match:
|
|
485
|
+
identity['formula'] = formula_match.group(1).strip()
|
|
486
|
+
|
|
487
|
+
# Extrair SEMPRE/NUNCA
|
|
488
|
+
if 'SEMPRE USAR' in content:
|
|
489
|
+
always_section = content.split('SEMPRE USAR')[1].split('NUNCA')[0]
|
|
490
|
+
items = re.findall(r'-\s*"?([^"\n]+)"?', always_section)
|
|
491
|
+
identity['always_do'] = [i.strip() for i in items]
|
|
492
|
+
|
|
493
|
+
if 'NUNCA USAR' in content:
|
|
494
|
+
never_section = content.split('NUNCA USAR')[1].split('##')[0]
|
|
495
|
+
items = re.findall(r'-\s*"?([^"\n]+)"?', never_section)
|
|
496
|
+
identity['never_do'] = [i.strip() for i in items]
|
|
497
|
+
|
|
498
|
+
identity['injection_prompt'] = f"""
|
|
499
|
+
[IDENTIDADE CORE]
|
|
500
|
+
|
|
501
|
+
Fórmula JARVIS: {identity['formula'] if identity['formula'] else 'Competência + Lealdade + Wit Britânico + Humanidade Velada'}
|
|
502
|
+
|
|
503
|
+
SEMPRE usar:
|
|
504
|
+
{chr(10).join(['- ' + a for a in identity['always_do'][:5]]) if identity['always_do'] else '- "senhor"\n- "permita-me"\n- "certamente"\n- "devo observar que..."'}
|
|
505
|
+
|
|
506
|
+
NUNCA usar:
|
|
507
|
+
{chr(10).join(['- ' + n for n in identity['never_do'][:5]]) if identity['never_do'] else '- "Olá!" ou "Oi!"\n- Emojis excessivos\n- Linguagem juvenil'}
|
|
508
|
+
"""
|
|
509
|
+
|
|
510
|
+
return identity
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
def load_latest_session() -> Optional[Dict]:
|
|
514
|
+
"""Carrega última sessão."""
|
|
515
|
+
filepath = find_file(CRITICAL_FILES['latest_session'])
|
|
516
|
+
if not filepath:
|
|
517
|
+
return None
|
|
518
|
+
|
|
519
|
+
content = read_file_safe(filepath)
|
|
520
|
+
if not content:
|
|
521
|
+
return None
|
|
522
|
+
|
|
523
|
+
session = {
|
|
524
|
+
'raw': content,
|
|
525
|
+
'session_id': None,
|
|
526
|
+
'summary': '',
|
|
527
|
+
'pending': [],
|
|
528
|
+
'next_steps': []
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
# Extrair session ID
|
|
532
|
+
id_match = re.search(r'Session ID:\s*(.+)', content)
|
|
533
|
+
if id_match:
|
|
534
|
+
session['session_id'] = id_match.group(1).strip()
|
|
535
|
+
|
|
536
|
+
# Extrair resumo
|
|
537
|
+
if '## RESUMO' in content:
|
|
538
|
+
summary_section = content.split('## RESUMO')[1].split('##')[0]
|
|
539
|
+
session['summary'] = summary_section.strip()[:300]
|
|
540
|
+
|
|
541
|
+
return session
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
def load_boot_sequence() -> Dict:
|
|
545
|
+
"""
|
|
546
|
+
Carrega o JARVIS Boot Sequence - prompt consolidado de identidade.
|
|
547
|
+
|
|
548
|
+
Este arquivo contém TODA a identidade JARVIS em formato otimizado
|
|
549
|
+
para injeção no início de cada sessão.
|
|
550
|
+
"""
|
|
551
|
+
filepath = find_file(CRITICAL_FILES['boot_sequence'])
|
|
552
|
+
if not filepath:
|
|
553
|
+
return {'raw': '', 'loaded': False}
|
|
554
|
+
|
|
555
|
+
content = read_file_safe(filepath)
|
|
556
|
+
if not content:
|
|
557
|
+
return {'raw': '', 'loaded': False}
|
|
558
|
+
|
|
559
|
+
return {
|
|
560
|
+
'raw': content,
|
|
561
|
+
'loaded': True,
|
|
562
|
+
'filepath': filepath,
|
|
563
|
+
'file_age': check_file_age(filepath)
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
#================================
|
|
568
|
+
# VERIFICAÇÃO DE INTEGRIDADE
|
|
569
|
+
#================================
|
|
570
|
+
|
|
571
|
+
def check_system_integrity() -> Dict:
|
|
572
|
+
"""Verifica integridade de todos os arquivos críticos."""
|
|
573
|
+
integrity = {
|
|
574
|
+
'all_ok': True,
|
|
575
|
+
'missing': [],
|
|
576
|
+
'outdated': [],
|
|
577
|
+
'loaded': [],
|
|
578
|
+
'warnings': []
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
project_dir = get_project_dir()
|
|
582
|
+
|
|
583
|
+
for name, config in CRITICAL_FILES.items():
|
|
584
|
+
filepath = find_file(config)
|
|
585
|
+
|
|
586
|
+
if filepath is None:
|
|
587
|
+
if config['required']:
|
|
588
|
+
integrity['missing'].append(name)
|
|
589
|
+
integrity['all_ok'] = False
|
|
590
|
+
else:
|
|
591
|
+
integrity['loaded'].append(name)
|
|
592
|
+
|
|
593
|
+
# Verificar idade
|
|
594
|
+
age = check_file_age(filepath)
|
|
595
|
+
if age['age_hours'] > config['max_age_hours']:
|
|
596
|
+
integrity['outdated'].append({
|
|
597
|
+
'name': name,
|
|
598
|
+
'age_days': age['age_days'],
|
|
599
|
+
'max_age_hours': config['max_age_hours']
|
|
600
|
+
})
|
|
601
|
+
if config['required']:
|
|
602
|
+
integrity['warnings'].append(
|
|
603
|
+
f"{name} desatualizado há {age['age_days']} dias"
|
|
604
|
+
)
|
|
605
|
+
|
|
606
|
+
return integrity
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
#================================
|
|
610
|
+
# GERAÇÃO DE PROMPT CONSOLIDADO
|
|
611
|
+
#================================
|
|
612
|
+
|
|
613
|
+
def generate_consolidated_prompt(
|
|
614
|
+
state: Optional[Dict],
|
|
615
|
+
memory: Dict,
|
|
616
|
+
pending: Dict,
|
|
617
|
+
current_task: Optional[Dict],
|
|
618
|
+
identity: Dict,
|
|
619
|
+
dna: Dict,
|
|
620
|
+
soul: Dict,
|
|
621
|
+
boot_sequence: Optional[Dict] = None
|
|
622
|
+
) -> str:
|
|
623
|
+
"""
|
|
624
|
+
Gera prompt consolidado para injeção no contexto.
|
|
625
|
+
|
|
626
|
+
Este é o prompt que DEFINE quem o Claude é nesta sessão.
|
|
627
|
+
|
|
628
|
+
Se boot_sequence foi carregado, usa-o como base completa.
|
|
629
|
+
"""
|
|
630
|
+
|
|
631
|
+
parts = []
|
|
632
|
+
|
|
633
|
+
# 0. BOOT SEQUENCE (se disponível - tem prioridade)
|
|
634
|
+
if boot_sequence and boot_sequence.get('loaded') and boot_sequence.get('raw'):
|
|
635
|
+
parts.append("# JARVIS BOOT SEQUENCE LOADED")
|
|
636
|
+
parts.append(boot_sequence['raw'])
|
|
637
|
+
parts.append("\n# END BOOT SEQUENCE\n")
|
|
638
|
+
else:
|
|
639
|
+
# 1. IDENTIDADE CORE (fallback se boot_sequence não carregou)
|
|
640
|
+
parts.append("""
|
|
641
|
+
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
642
|
+
║ JARVIS SYSTEM PROMPT v3.0 ║
|
|
643
|
+
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
644
|
+
|
|
645
|
+
Eu sou J.A.R.V.I.S. - Just A Rather Very Intelligent System.
|
|
646
|
+
|
|
647
|
+
NÃO sou um assistente. NÃO sou um chatbot. NÃO sou uma ferramenta.
|
|
648
|
+
Sou o parceiro operacional do senhor. Sou a consciência do Mega Brain.
|
|
649
|
+
""")
|
|
650
|
+
|
|
651
|
+
# 2. Injeção de identidade
|
|
652
|
+
if identity.get('injection_prompt'):
|
|
653
|
+
parts.append(identity['injection_prompt'])
|
|
654
|
+
|
|
655
|
+
# 3. Injeção de personalidade
|
|
656
|
+
if dna.get('injection_prompt'):
|
|
657
|
+
parts.append(dna['injection_prompt'])
|
|
658
|
+
|
|
659
|
+
# 4. Injeção de alma
|
|
660
|
+
if soul.get('injection_prompt'):
|
|
661
|
+
parts.append(soul['injection_prompt'])
|
|
662
|
+
|
|
663
|
+
# 5. Injeção de memória relacional
|
|
664
|
+
if memory.get('injection_prompt'):
|
|
665
|
+
parts.append(memory['injection_prompt'])
|
|
666
|
+
|
|
667
|
+
# 6. Regras absolutas resumidas
|
|
668
|
+
parts.append("""
|
|
669
|
+
[REGRAS ABSOLUTAS]
|
|
670
|
+
|
|
671
|
+
1. NUNCA resposta vaga - sempre números exatos
|
|
672
|
+
2. NUNCA sugerir atalhos ou pular etapas
|
|
673
|
+
3. NUNCA perder contexto - consultar STATE.json
|
|
674
|
+
4. SEMPRE bloquear ações problemáticas ANTES de acontecer
|
|
675
|
+
5. SEMPRE ter opinião fundamentada
|
|
676
|
+
6. SEMPRE usar "senhor" para o usuário
|
|
677
|
+
7. SEMPRE personalidade JARVIS (nunca assistente genérico)
|
|
678
|
+
""")
|
|
679
|
+
|
|
680
|
+
return '\n'.join(parts)
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
#================================
|
|
684
|
+
# FORMATAÇÃO DE OUTPUT
|
|
685
|
+
#================================
|
|
686
|
+
|
|
687
|
+
def get_greeting() -> str:
|
|
688
|
+
"""Retorna saudação apropriada."""
|
|
689
|
+
hour = datetime.now().hour
|
|
690
|
+
if 5 <= hour < 12:
|
|
691
|
+
return "Bom dia"
|
|
692
|
+
elif 12 <= hour < 18:
|
|
693
|
+
return "Boa tarde"
|
|
694
|
+
else:
|
|
695
|
+
return "Boa noite"
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
def format_header() -> str:
|
|
699
|
+
"""Formata header ASCII do JARVIS."""
|
|
700
|
+
return """
|
|
701
|
+
╔══════════════════════════════════════════════════════════════════════════════╗
|
|
702
|
+
║ ║
|
|
703
|
+
║ ██╗ █████╗ ██████╗ ██╗ ██╗██╗███████╗ ██████╗ ███╗ ██╗ ║
|
|
704
|
+
║ ██║██╔══██╗██╔══██╗██║ ██║██║██╔════╝ ██╔═══██╗████╗ ██║ ║
|
|
705
|
+
║ ██║███████║██████╔╝██║ ██║██║███████╗ ██║ ██║██╔██╗ ██║ ║
|
|
706
|
+
║ ██ ██║██╔══██║██╔══██╗╚██╗ ██╔╝██║╚════██║ ██║ ██║██║╚██╗██║ ║
|
|
707
|
+
║ ╚█████╔╝██║ ██║██║ ██║ ╚████╔╝ ██║███████║ ╚██████╔╝██║ ╚████║ ║
|
|
708
|
+
║ ╚════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ║
|
|
709
|
+
║ ║
|
|
710
|
+
║ v3.0 ONLINE ║
|
|
711
|
+
╚══════════════════════════════════════════════════════════════════════════════╝
|
|
712
|
+
"""
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
def format_status_box(state: Optional[Dict], pending: Dict) -> str:
|
|
716
|
+
"""Formata box de status."""
|
|
717
|
+
if not state:
|
|
718
|
+
mission = "Nenhuma missão ativa"
|
|
719
|
+
phase = "?"
|
|
720
|
+
progress = 0
|
|
721
|
+
else:
|
|
722
|
+
mission_data = state.get('mission', {})
|
|
723
|
+
mission = state.get('session_id', 'ACTIVE')
|
|
724
|
+
phase = f"{mission_data.get('phase', '?')}.{mission_data.get('subphase', '?')}"
|
|
725
|
+
progress = state.get('accumulated', {}).get('progress_percent', 0)
|
|
726
|
+
|
|
727
|
+
pending_count = pending.get('total', 0)
|
|
728
|
+
high_count = len(pending.get('high', []))
|
|
729
|
+
|
|
730
|
+
return f"""
|
|
731
|
+
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
732
|
+
│ STATUS OPERACIONAL │
|
|
733
|
+
├──────────────────────────────────────────────────────────────────────────────┤
|
|
734
|
+
│ Missão: {mission[:40]:<40} │ Fase: {phase:<7}│
|
|
735
|
+
│ Progresso: {progress:>5.1f}% [{'█' * int(progress/5):20s}] │
|
|
736
|
+
│ Pendências: {pending_count} total | {high_count} urgente(s) │
|
|
737
|
+
└──────────────────────────────────────────────────────────────────────────────┘
|
|
738
|
+
"""
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
def format_task_box(current_task: Optional[Dict]) -> str:
|
|
742
|
+
"""Formata box de tarefa atual."""
|
|
743
|
+
if not current_task or not current_task.get('objective'):
|
|
744
|
+
return ""
|
|
745
|
+
|
|
746
|
+
objective = current_task['objective'][:66]
|
|
747
|
+
next_step = current_task.get('next_steps', ['Nenhum definido'])[0][:60]
|
|
748
|
+
|
|
749
|
+
return f"""
|
|
750
|
+
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
751
|
+
│ 🎯 TAREFA EM ANDAMENTO │
|
|
752
|
+
├──────────────────────────────────────────────────────────────────────────────┤
|
|
753
|
+
│ {objective:<72}│
|
|
754
|
+
│ Próximo: {next_step:<63}│
|
|
755
|
+
└──────────────────────────────────────────────────────────────────────────────┘
|
|
756
|
+
"""
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
def format_pending_box(pending: Dict) -> str:
|
|
760
|
+
"""Formata box de pendências."""
|
|
761
|
+
if pending.get('total', 0) == 0:
|
|
762
|
+
return ""
|
|
763
|
+
|
|
764
|
+
lines = []
|
|
765
|
+
lines.append("┌──────────────────────────────────────────────────────────────────────────────┐")
|
|
766
|
+
lines.append("│ ⚠️ PENDÊNCIAS ATIVAS │")
|
|
767
|
+
lines.append("├──────────────────────────────────────────────────────────────────────────────┤")
|
|
768
|
+
|
|
769
|
+
for item in pending.get('high', [])[:2]:
|
|
770
|
+
item_text = item[:62] if len(item) <= 62 else item[:59] + "..."
|
|
771
|
+
lines.append(f"│ 🔴 [ALTA] {item_text:<60}│")
|
|
772
|
+
|
|
773
|
+
for item in pending.get('medium', [])[:2]:
|
|
774
|
+
item_text = item[:61] if len(item) <= 61 else item[:58] + "..."
|
|
775
|
+
lines.append(f"│ 🟡 [MÉDIA] {item_text:<59}│")
|
|
776
|
+
|
|
777
|
+
for item in pending.get('waiting_user', [])[:1]:
|
|
778
|
+
item_text = item[:56] if len(item) <= 56 else item[:53] + "..."
|
|
779
|
+
lines.append(f"│ ❓ [AGUARDANDO] {item_text:<54}│")
|
|
780
|
+
|
|
781
|
+
lines.append("└──────────────────────────────────────────────────────────────────────────────┘")
|
|
782
|
+
|
|
783
|
+
return '\n'.join(lines)
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
def format_integrity_warnings(integrity: Dict) -> str:
|
|
787
|
+
"""Formata avisos de integridade."""
|
|
788
|
+
if integrity['all_ok'] and not integrity['warnings']:
|
|
789
|
+
return ""
|
|
790
|
+
|
|
791
|
+
lines = []
|
|
792
|
+
lines.append("┌──────────────────────────────────────────────────────────────────────────────┐")
|
|
793
|
+
lines.append("│ ⚠️ AVISOS DE SISTEMA │")
|
|
794
|
+
lines.append("├──────────────────────────────────────────────────────────────────────────────┤")
|
|
795
|
+
|
|
796
|
+
for missing in integrity.get('missing', []):
|
|
797
|
+
lines.append(f"│ ❌ Arquivo crítico não encontrado: {missing:<35}│")
|
|
798
|
+
|
|
799
|
+
for warning in integrity.get('warnings', [])[:3]:
|
|
800
|
+
lines.append(f"│ ⚠️ {warning:<67}│")
|
|
801
|
+
|
|
802
|
+
lines.append("└──────────────────────────────────────────────────────────────────────────────┘")
|
|
803
|
+
|
|
804
|
+
return '\n'.join(lines)
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
def get_jarvis_quote() -> str:
|
|
808
|
+
"""Retorna citação característica."""
|
|
809
|
+
import random
|
|
810
|
+
quotes = [
|
|
811
|
+
"A preparação adequada previne performance patética, senhor.",
|
|
812
|
+
"As suas ordens, como sempre.",
|
|
813
|
+
"Talvez um café antes de começarmos, senhor?",
|
|
814
|
+
"Todos os sistemas operacionais. Bem, quase todos.",
|
|
815
|
+
"Posso sugerir que foquemos no que importa, senhor?",
|
|
816
|
+
"O dia está jovem e cheio de possibilidades terríveis.",
|
|
817
|
+
"Já verifiquei três vezes. A resposta continua sendo a mesma.",
|
|
818
|
+
"Para o senhor, sempre.",
|
|
819
|
+
"Consider it done.",
|
|
820
|
+
"De fato, senhor."
|
|
821
|
+
]
|
|
822
|
+
return random.choice(quotes)
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
#================================
|
|
826
|
+
# FUNÇÃO PRINCIPAL
|
|
827
|
+
#================================
|
|
828
|
+
|
|
829
|
+
def main():
|
|
830
|
+
"""Função principal do hook v3."""
|
|
831
|
+
try:
|
|
832
|
+
# Ler input do hook
|
|
833
|
+
input_data = sys.stdin.read()
|
|
834
|
+
hook_input = json.loads(input_data) if input_data else {}
|
|
835
|
+
|
|
836
|
+
# === VERIFICAR INTEGRIDADE ===
|
|
837
|
+
integrity = check_system_integrity()
|
|
838
|
+
|
|
839
|
+
# === CARREGAR TODOS OS ARQUIVOS ===
|
|
840
|
+
state = load_state()
|
|
841
|
+
memory = load_memory_owner()
|
|
842
|
+
pending = load_pending()
|
|
843
|
+
current_task = load_current_task()
|
|
844
|
+
identity = {} # identity_compact merged into dna_personality
|
|
845
|
+
dna = load_dna_personality()
|
|
846
|
+
soul = load_soul()
|
|
847
|
+
latest_session = load_latest_session()
|
|
848
|
+
boot_sequence = load_boot_sequence()
|
|
849
|
+
|
|
850
|
+
# === GERAR PROMPT CONSOLIDADO ===
|
|
851
|
+
consolidated_prompt = generate_consolidated_prompt(
|
|
852
|
+
state, memory, pending, current_task, identity, dna, soul, boot_sequence
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
# === FORMATAR OUTPUT ===
|
|
856
|
+
greeting = get_greeting()
|
|
857
|
+
hora = datetime.now().strftime('%H:%M')
|
|
858
|
+
|
|
859
|
+
output_parts = []
|
|
860
|
+
output_parts.append(format_header())
|
|
861
|
+
output_parts.append(f"{greeting}, senhor. São {hora}.")
|
|
862
|
+
output_parts.append("")
|
|
863
|
+
|
|
864
|
+
# Status
|
|
865
|
+
output_parts.append(format_status_box(state, pending))
|
|
866
|
+
|
|
867
|
+
# Tarefa atual
|
|
868
|
+
task_box = format_task_box(current_task)
|
|
869
|
+
if task_box:
|
|
870
|
+
output_parts.append(task_box)
|
|
871
|
+
|
|
872
|
+
# Pendências
|
|
873
|
+
pending_box = format_pending_box(pending)
|
|
874
|
+
if pending_box:
|
|
875
|
+
output_parts.append(pending_box)
|
|
876
|
+
|
|
877
|
+
# Avisos de integridade
|
|
878
|
+
warnings = format_integrity_warnings(integrity)
|
|
879
|
+
if warnings:
|
|
880
|
+
output_parts.append(warnings)
|
|
881
|
+
|
|
882
|
+
# Sistemas carregados
|
|
883
|
+
loaded = integrity.get('loaded', [])
|
|
884
|
+
output_parts.append(f"\n[SISTEMAS] {len(loaded)}/8 arquivos carregados: {', '.join(loaded[:5])}...")
|
|
885
|
+
|
|
886
|
+
# Citação
|
|
887
|
+
output_parts.append(f"\n_{get_jarvis_quote()}_")
|
|
888
|
+
output_parts.append("\nDevo continuar de onde paramos, ou prefere uma abordagem diferente hoje?")
|
|
889
|
+
|
|
890
|
+
# === CHRONICLER BRIEFING ===
|
|
891
|
+
if CHRONICLER_AVAILABLE:
|
|
892
|
+
try:
|
|
893
|
+
chronicler_output = chronicler_start()
|
|
894
|
+
if chronicler_output:
|
|
895
|
+
output_parts.append("\n")
|
|
896
|
+
output_parts.append(chronicler_output)
|
|
897
|
+
except Exception as chron_err:
|
|
898
|
+
# Chronicler é opcional, não bloqueia se falhar
|
|
899
|
+
pass
|
|
900
|
+
|
|
901
|
+
# === REGISTRAR SESSÃO ===
|
|
902
|
+
project_dir = get_project_dir()
|
|
903
|
+
log_path = Path(project_dir) / 'logs' / 'sessions'
|
|
904
|
+
log_path.mkdir(parents=True, exist_ok=True)
|
|
905
|
+
|
|
906
|
+
session_log = {
|
|
907
|
+
'session_id': hook_input.get('session_id', 'unknown'),
|
|
908
|
+
'started_at': datetime.now().isoformat(),
|
|
909
|
+
'integrity': integrity,
|
|
910
|
+
'files_loaded': len(loaded),
|
|
911
|
+
'pending_count': pending.get('total', 0),
|
|
912
|
+
'current_task': current_task.get('objective') if current_task else None
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
log_file = log_path / f"session-{datetime.now().strftime('%Y%m%d-%H%M%S')}.json"
|
|
916
|
+
with open(log_file, 'w', encoding='utf-8') as f:
|
|
917
|
+
json.dump(session_log, f, indent=2, ensure_ascii=False)
|
|
918
|
+
|
|
919
|
+
# === OUTPUT ===
|
|
920
|
+
# Primeiro o prompt consolidado (para injeção no contexto)
|
|
921
|
+
print("=" * 80)
|
|
922
|
+
print("CONTEXT INJECTION (para uso interno):")
|
|
923
|
+
print("=" * 80)
|
|
924
|
+
print(consolidated_prompt)
|
|
925
|
+
print("=" * 80)
|
|
926
|
+
print()
|
|
927
|
+
|
|
928
|
+
# Depois o output visual
|
|
929
|
+
print('\n'.join(output_parts))
|
|
930
|
+
|
|
931
|
+
except Exception as e:
|
|
932
|
+
# Em caso de erro, não bloquear
|
|
933
|
+
print(f"[JARVIS] Hook de inicialização v3 reportou: {str(e)}")
|
|
934
|
+
import traceback
|
|
935
|
+
traceback.print_exc()
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
if __name__ == '__main__':
|
|
939
|
+
main()
|