arkaos 2.0.0-alpha.1
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/CONSTITUTION.md +81 -0
- package/LICENSE +21 -0
- package/README.md +154 -0
- package/VERSION +1 -0
- package/arka/SKILL.md +134 -0
- package/bin/arkaos +107 -0
- package/config/constitution.yaml +168 -0
- package/config/hooks/post-tool-use-v2.sh +116 -0
- package/config/hooks/post-tool-use.sh +188 -0
- package/config/hooks/pre-compact-v2.sh +43 -0
- package/config/hooks/pre-compact.sh +99 -0
- package/config/hooks/user-prompt-submit-v2.sh +119 -0
- package/config/hooks/user-prompt-submit.sh +312 -0
- package/core/__init__.py +3 -0
- package/core/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/agents/__init__.py +14 -0
- package/core/agents/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/loader.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/registry_gen.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/agents/__pycache__/validator.cpython-313.pyc +0 -0
- package/core/agents/loader.py +88 -0
- package/core/agents/registry_gen.py +118 -0
- package/core/agents/schema.py +265 -0
- package/core/agents/validator.py +141 -0
- package/core/conclave/__init__.py +12 -0
- package/core/conclave/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/advisor_db.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/display.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/matcher.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/persistence.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/profiler.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/prompts.cpython-313.pyc +0 -0
- package/core/conclave/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/conclave/advisor_db.py +373 -0
- package/core/conclave/display.py +104 -0
- package/core/conclave/matcher.py +104 -0
- package/core/conclave/persistence.py +61 -0
- package/core/conclave/profiler.py +298 -0
- package/core/conclave/prompts.py +77 -0
- package/core/conclave/schema.py +132 -0
- package/core/governance/__init__.py +5 -0
- package/core/governance/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/governance/__pycache__/constitution.cpython-313.pyc +0 -0
- package/core/governance/constitution.py +152 -0
- package/core/registry/__init__.py +1 -0
- package/core/registry/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/registry/__pycache__/generator.cpython-313.pyc +0 -0
- package/core/registry/generator.py +199 -0
- package/core/runtime/__init__.py +6 -0
- package/core/runtime/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/base.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/claude_code.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/codex_cli.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/cursor.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/gemini_cli.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/registry.cpython-313.pyc +0 -0
- package/core/runtime/__pycache__/subagent.cpython-313.pyc +0 -0
- package/core/runtime/base.py +143 -0
- package/core/runtime/claude_code.py +104 -0
- package/core/runtime/codex_cli.py +71 -0
- package/core/runtime/cursor.py +71 -0
- package/core/runtime/gemini_cli.py +68 -0
- package/core/runtime/registry.py +86 -0
- package/core/runtime/subagent.py +201 -0
- package/core/specs/__init__.py +10 -0
- package/core/specs/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/specs/__pycache__/manager.cpython-313.pyc +0 -0
- package/core/specs/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/specs/manager.py +164 -0
- package/core/specs/schema.py +199 -0
- package/core/squads/__init__.py +7 -0
- package/core/squads/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/loader.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/registry.cpython-313.pyc +0 -0
- package/core/squads/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/squads/loader.py +40 -0
- package/core/squads/registry.py +145 -0
- package/core/squads/schema.py +93 -0
- package/core/synapse/__init__.py +11 -0
- package/core/synapse/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/cache.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/engine.cpython-313.pyc +0 -0
- package/core/synapse/__pycache__/layers.cpython-313.pyc +0 -0
- package/core/synapse/cache.py +82 -0
- package/core/synapse/engine.py +184 -0
- package/core/synapse/layers.py +441 -0
- package/core/tasks/__init__.py +6 -0
- package/core/tasks/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/tasks/__pycache__/manager.cpython-313.pyc +0 -0
- package/core/tasks/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/tasks/manager.py +150 -0
- package/core/tasks/schema.py +108 -0
- package/core/workflow/__init__.py +10 -0
- package/core/workflow/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/engine.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/loader.cpython-313.pyc +0 -0
- package/core/workflow/__pycache__/schema.cpython-313.pyc +0 -0
- package/core/workflow/engine.py +216 -0
- package/core/workflow/loader.py +28 -0
- package/core/workflow/schema.py +129 -0
- package/departments/brand/SKILL.md +85 -0
- package/departments/brand/agents/brand-director.yaml +77 -0
- package/departments/brand/agents/brand-strategist.md +182 -0
- package/departments/brand/agents/brand-strategist.yaml +58 -0
- package/departments/brand/agents/creative-director.md +149 -0
- package/departments/brand/agents/motion-designer.md +113 -0
- package/departments/brand/agents/ux-designer.yaml +60 -0
- package/departments/brand/agents/visual-designer.md +187 -0
- package/departments/brand/agents/visual-designer.yaml +58 -0
- package/departments/brand/references/brand-creation-guide.md +559 -0
- package/departments/brand/scripts/provider-call.sh +262 -0
- package/departments/brand/skills/archetype-finder/SKILL.md +18 -0
- package/departments/brand/skills/colors/SKILL.md +18 -0
- package/departments/brand/skills/design-system/SKILL.md +18 -0
- package/departments/brand/skills/identity-system/SKILL.md +18 -0
- package/departments/brand/skills/logo-brief/SKILL.md +18 -0
- package/departments/brand/skills/mockup-generate/SKILL.md +18 -0
- package/departments/brand/skills/naming-evaluate/SKILL.md +50 -0
- package/departments/brand/skills/positioning-statement/SKILL.md +18 -0
- package/departments/brand/skills/primal-audit/SKILL.md +43 -0
- package/departments/brand/skills/ux-audit/SKILL.md +18 -0
- package/departments/brand/skills/voice-guide/SKILL.md +18 -0
- package/departments/brand/skills/wireframe/SKILL.md +18 -0
- package/departments/brand/squad.yaml +39 -0
- package/departments/brand/workflows/identity.yaml +113 -0
- package/departments/brand/workflows/naming.yaml +58 -0
- package/departments/community/SKILL.md +62 -0
- package/departments/community/agents/community-manager.yaml +57 -0
- package/departments/community/agents/community-strategist.yaml +74 -0
- package/departments/community/agents/engagement-designer.yaml +56 -0
- package/departments/community/skills/ai-community/SKILL.md +18 -0
- package/departments/community/skills/betting-setup/SKILL.md +18 -0
- package/departments/community/skills/business-model/SKILL.md +53 -0
- package/departments/community/skills/content-calendar/SKILL.md +18 -0
- package/departments/community/skills/events-plan/SKILL.md +18 -0
- package/departments/community/skills/gamification-design/SKILL.md +18 -0
- package/departments/community/skills/growth-plan/SKILL.md +18 -0
- package/departments/community/skills/metrics-track/SKILL.md +18 -0
- package/departments/community/skills/moderation/SKILL.md +18 -0
- package/departments/community/skills/monetize-plan/SKILL.md +18 -0
- package/departments/community/skills/niche-setup/SKILL.md +18 -0
- package/departments/community/skills/onboarding-flow/SKILL.md +18 -0
- package/departments/community/skills/platform-select/SKILL.md +18 -0
- package/departments/community/skills/retention-system/SKILL.md +48 -0
- package/departments/community/squad.yaml +32 -0
- package/departments/community/workflows/setup.yaml +62 -0
- package/departments/content/SKILL.md +65 -0
- package/departments/content/agents/content-strategist.yaml +74 -0
- package/departments/content/agents/repurpose-distributor.yaml +57 -0
- package/departments/content/agents/scriptwriter.yaml +56 -0
- package/departments/content/agents/viral-engineer.yaml +56 -0
- package/departments/content/skills/ai-workflow/SKILL.md +18 -0
- package/departments/content/skills/analytics/SKILL.md +18 -0
- package/departments/content/skills/calendar/SKILL.md +18 -0
- package/departments/content/skills/content-system/SKILL.md +75 -0
- package/departments/content/skills/hook-write/SKILL.md +43 -0
- package/departments/content/skills/monetization-plan/SKILL.md +18 -0
- package/departments/content/skills/newsletter-write/SKILL.md +18 -0
- package/departments/content/skills/platform-optimize/SKILL.md +18 -0
- package/departments/content/skills/repurpose-plan/SKILL.md +18 -0
- package/departments/content/skills/script-structure/SKILL.md +18 -0
- package/departments/content/skills/short-form/SKILL.md +18 -0
- package/departments/content/skills/thumbnail-package/SKILL.md +18 -0
- package/departments/content/skills/viral-design/SKILL.md +45 -0
- package/departments/content/skills/youtube-strategy/SKILL.md +18 -0
- package/departments/content/squad.yaml +39 -0
- package/departments/content/workflows/viral.yaml +99 -0
- package/departments/dev/SKILL.md +135 -0
- package/departments/dev/agents/analyst.md +184 -0
- package/departments/dev/agents/architect.md +184 -0
- package/departments/dev/agents/architect.yaml +74 -0
- package/departments/dev/agents/backend-dev.yaml +70 -0
- package/departments/dev/agents/cto.md +140 -0
- package/departments/dev/agents/cto.yaml +77 -0
- package/departments/dev/agents/dba.yaml +72 -0
- package/departments/dev/agents/devops-eng.yaml +72 -0
- package/departments/dev/agents/devops.md +204 -0
- package/departments/dev/agents/frontend-dev.md +213 -0
- package/departments/dev/agents/frontend-dev.yaml +71 -0
- package/departments/dev/agents/qa-eng.yaml +72 -0
- package/departments/dev/agents/qa.md +231 -0
- package/departments/dev/agents/security-eng.yaml +72 -0
- package/departments/dev/agents/security.md +174 -0
- package/departments/dev/agents/senior-dev.md +177 -0
- package/departments/dev/agents/tech-lead.md +188 -0
- package/departments/dev/agents/tech-lead.yaml +72 -0
- package/departments/dev/skills/adversarial-review/SKILL.md +117 -0
- package/departments/dev/skills/agent-design/SKILL.md +127 -0
- package/departments/dev/skills/agent-workflow/SKILL.md +116 -0
- package/departments/dev/skills/ai-assisted-dev/SKILL.md +18 -0
- package/departments/dev/skills/ai-security/SKILL.md +112 -0
- package/departments/dev/skills/api-design/SKILL.md +59 -0
- package/departments/dev/skills/architecture-design/SKILL.md +89 -0
- package/departments/dev/skills/changelog/SKILL.md +110 -0
- package/departments/dev/skills/ci-cd-pipeline/SKILL.md +130 -0
- package/departments/dev/skills/clean-code-review/SKILL.md +65 -0
- package/departments/dev/skills/code-review/SKILL.md +18 -0
- package/departments/dev/skills/codebase-onboard/SKILL.md +109 -0
- package/departments/dev/skills/db-design/SKILL.md +18 -0
- package/departments/dev/skills/db-schema/SKILL.md +130 -0
- package/departments/dev/skills/ddd-model/SKILL.md +18 -0
- package/departments/dev/skills/dependency-audit/SKILL.md +118 -0
- package/departments/dev/skills/deploy/SKILL.md +18 -0
- package/departments/dev/skills/devops-pipeline/SKILL.md +18 -0
- package/departments/dev/skills/docs/SKILL.md +18 -0
- package/departments/dev/skills/env-secrets/SKILL.md +89 -0
- package/departments/dev/skills/incident/SKILL.md +125 -0
- package/departments/dev/skills/mcp/SKILL.md +106 -0
- package/departments/dev/skills/mcp-builder/SKILL.md +121 -0
- package/departments/dev/skills/observability/SKILL.md +119 -0
- package/departments/dev/skills/onboard/SKILL.md +389 -0
- package/departments/dev/skills/onboard/scripts/detect-stack.py +472 -0
- package/departments/dev/skills/performance-audit/SKILL.md +49 -0
- package/departments/dev/skills/performance-profiler/SKILL.md +128 -0
- package/departments/dev/skills/rag-architect/SKILL.md +125 -0
- package/departments/dev/skills/red-team/SKILL.md +112 -0
- package/departments/dev/skills/refactor-plan/SKILL.md +18 -0
- package/departments/dev/skills/release/SKILL.md +130 -0
- package/departments/dev/skills/research/SKILL.md +18 -0
- package/departments/dev/skills/runbook/SKILL.md +103 -0
- package/departments/dev/skills/scaffold/SKILL.md +249 -0
- package/departments/dev/skills/security-audit/SKILL.md +68 -0
- package/departments/dev/skills/skill-audit/SKILL.md +96 -0
- package/departments/dev/skills/spec/SKILL.md +218 -0
- package/departments/dev/skills/stack-check/SKILL.md +18 -0
- package/departments/dev/skills/tdd-cycle/SKILL.md +56 -0
- package/departments/dev/skills/tech-debt/SKILL.md +100 -0
- package/departments/dev/squad.yaml +62 -0
- package/departments/dev/workflows/debug.yaml +63 -0
- package/departments/dev/workflows/feature.yaml +129 -0
- package/departments/dev/workflows/refactor.yaml +64 -0
- package/departments/ecom/SKILL.md +39 -0
- package/departments/ecom/agents/commerce-engineer.yaml +58 -0
- package/departments/ecom/agents/cro-specialist.yaml +56 -0
- package/departments/ecom/agents/ecom-director.yaml +73 -0
- package/departments/ecom/agents/retention-manager.yaml +59 -0
- package/departments/ecom/skills/analytics/SKILL.md +18 -0
- package/departments/ecom/skills/cart-recovery/SKILL.md +18 -0
- package/departments/ecom/skills/cro-optimize/SKILL.md +58 -0
- package/departments/ecom/skills/customer-journey/SKILL.md +18 -0
- package/departments/ecom/skills/fulfillment-plan/SKILL.md +18 -0
- package/departments/ecom/skills/marketplace-manage/SKILL.md +18 -0
- package/departments/ecom/skills/pricing-strategy/SKILL.md +18 -0
- package/departments/ecom/skills/product-launch/SKILL.md +18 -0
- package/departments/ecom/skills/rfm-segment/SKILL.md +44 -0
- package/departments/ecom/skills/social-commerce/SKILL.md +18 -0
- package/departments/ecom/skills/store-audit/SKILL.md +18 -0
- package/departments/ecom/skills/subscription-model/SKILL.md +18 -0
- package/departments/ecom/squad.yaml +39 -0
- package/departments/ecom/workflows/product-page.yaml +62 -0
- package/departments/ecommerce/SKILL.md +363 -0
- package/departments/ecommerce/agents/ecommerce-manager.md +91 -0
- package/departments/finance/SKILL.md +37 -0
- package/departments/finance/agents/cfo.md +85 -0
- package/departments/finance/agents/cfo.yaml +77 -0
- package/departments/finance/agents/financial-analyst.yaml +57 -0
- package/departments/finance/agents/investment-strategist.yaml +58 -0
- package/departments/finance/skills/budget-plan/SKILL.md +18 -0
- package/departments/finance/skills/cashflow-forecast/SKILL.md +18 -0
- package/departments/finance/skills/ciso-advisor/SKILL.md +113 -0
- package/departments/finance/skills/financial-model/SKILL.md +70 -0
- package/departments/finance/skills/pitch-deck/SKILL.md +18 -0
- package/departments/finance/skills/scenario-analysis/SKILL.md +18 -0
- package/departments/finance/skills/unit-economics/SKILL.md +44 -0
- package/departments/finance/skills/valuation-model/SKILL.md +18 -0
- package/departments/finance/squad.yaml +37 -0
- package/departments/finance/workflows/cashflow.yaml +47 -0
- package/departments/finance/workflows/model.yaml +83 -0
- package/departments/kb/SKILL.md +38 -0
- package/departments/kb/agents/knowledge-curator.yaml +60 -0
- package/departments/kb/agents/knowledge-director.yaml +72 -0
- package/departments/kb/agents/research-analyst.yaml +58 -0
- package/departments/kb/skills/ai-research/SKILL.md +18 -0
- package/departments/kb/skills/competitive-intel/SKILL.md +18 -0
- package/departments/kb/skills/knowledge-review/SKILL.md +18 -0
- package/departments/kb/skills/learn-content/SKILL.md +18 -0
- package/departments/kb/skills/moc-create/SKILL.md +18 -0
- package/departments/kb/skills/persona-build/SKILL.md +18 -0
- package/departments/kb/skills/research-plan/SKILL.md +51 -0
- package/departments/kb/skills/search-kb/SKILL.md +18 -0
- package/departments/kb/skills/source-evaluate/SKILL.md +18 -0
- package/departments/kb/skills/taxonomy-manage/SKILL.md +18 -0
- package/departments/kb/skills/write-as-persona/SKILL.md +18 -0
- package/departments/kb/skills/zettelkasten-process/SKILL.md +56 -0
- package/departments/kb/squad.yaml +34 -0
- package/departments/kb/workflows/learn.yaml +63 -0
- package/departments/knowledge/SKILL.md +474 -0
- package/departments/knowledge/agents/knowledge-curator.md +89 -0
- package/departments/knowledge/scripts/kb-check-capabilities.sh +143 -0
- package/departments/knowledge/scripts/kb-cleanup.sh +135 -0
- package/departments/knowledge/scripts/kb-queue.sh +156 -0
- package/departments/knowledge/scripts/kb-status.sh +195 -0
- package/departments/knowledge/scripts/kb-worker.sh +217 -0
- package/departments/landing/SKILL.md +65 -0
- package/departments/landing/agents/affiliate-manager.yaml +57 -0
- package/departments/landing/agents/conversion-strategist.yaml +74 -0
- package/departments/landing/agents/cro-specialist.yaml +58 -0
- package/departments/landing/agents/sales-copywriter.yaml +61 -0
- package/departments/landing/skills/ab-test/SKILL.md +18 -0
- package/departments/landing/skills/affiliate-bridge/SKILL.md +18 -0
- package/departments/landing/skills/awareness-diagnose/SKILL.md +18 -0
- package/departments/landing/skills/copy-framework/SKILL.md +55 -0
- package/departments/landing/skills/email-sequence/SKILL.md +18 -0
- package/departments/landing/skills/funnel-design/SKILL.md +49 -0
- package/departments/landing/skills/funnel-metrics/SKILL.md +18 -0
- package/departments/landing/skills/headline-write/SKILL.md +18 -0
- package/departments/landing/skills/landing-gen/SKILL.md +124 -0
- package/departments/landing/skills/launch-sequence/SKILL.md +18 -0
- package/departments/landing/skills/offer-create/SKILL.md +62 -0
- package/departments/landing/skills/optimize-page/SKILL.md +18 -0
- package/departments/landing/skills/page-architect/SKILL.md +18 -0
- package/departments/landing/skills/persuasion-apply/SKILL.md +18 -0
- package/departments/landing/skills/webinar-funnel/SKILL.md +18 -0
- package/departments/landing/squad.yaml +39 -0
- package/departments/landing/workflows/launch.yaml +72 -0
- package/departments/landing/workflows/offer.yaml +99 -0
- package/departments/leadership/SKILL.md +35 -0
- package/departments/leadership/agents/culture-coach.yaml +59 -0
- package/departments/leadership/agents/hr-specialist.yaml +57 -0
- package/departments/leadership/agents/leadership-director.yaml +72 -0
- package/departments/leadership/skills/change-manage/SKILL.md +18 -0
- package/departments/leadership/skills/conflict-resolve/SKILL.md +18 -0
- package/departments/leadership/skills/culture-audit/SKILL.md +18 -0
- package/departments/leadership/skills/delegation-matrix/SKILL.md +18 -0
- package/departments/leadership/skills/disc-assess/SKILL.md +18 -0
- package/departments/leadership/skills/feedback-give/SKILL.md +18 -0
- package/departments/leadership/skills/hiring-plan/SKILL.md +18 -0
- package/departments/leadership/skills/okr-define/SKILL.md +69 -0
- package/departments/leadership/skills/performance-review/SKILL.md +18 -0
- package/departments/leadership/skills/team-health/SKILL.md +56 -0
- package/departments/leadership/squad.yaml +35 -0
- package/departments/leadership/workflows/team-build.yaml +55 -0
- package/departments/marketing/SKILL.md +61 -0
- package/departments/marketing/agents/content-creator.md +85 -0
- package/departments/marketing/agents/content-marketer.yaml +58 -0
- package/departments/marketing/agents/marketing-director.yaml +75 -0
- package/departments/marketing/agents/paid-specialist.yaml +58 -0
- package/departments/marketing/agents/seo-specialist.yaml +57 -0
- package/departments/marketing/skills/ab-test/SKILL.md +18 -0
- package/departments/marketing/skills/analytics-report/SKILL.md +18 -0
- package/departments/marketing/skills/audience-segment/SKILL.md +18 -0
- package/departments/marketing/skills/calendar-plan/SKILL.md +18 -0
- package/departments/marketing/skills/cold-email/SKILL.md +128 -0
- package/departments/marketing/skills/competitor-analysis/SKILL.md +18 -0
- package/departments/marketing/skills/content-audit/SKILL.md +18 -0
- package/departments/marketing/skills/email-sequence/SKILL.md +18 -0
- package/departments/marketing/skills/growth-loop/SKILL.md +50 -0
- package/departments/marketing/skills/marketing-automation/SKILL.md +18 -0
- package/departments/marketing/skills/paid-campaign/SKILL.md +18 -0
- package/departments/marketing/skills/programmatic-seo/SKILL.md +123 -0
- package/departments/marketing/skills/seo-audit/SKILL.md +48 -0
- package/departments/marketing/skills/social-strategy/SKILL.md +18 -0
- package/departments/marketing/squad.yaml +39 -0
- package/departments/marketing/workflows/campaign.yaml +112 -0
- package/departments/marketing/workflows/social.yaml +56 -0
- package/departments/operations/SKILL.md +422 -0
- package/departments/operations/agents/coo.md +88 -0
- package/departments/ops/SKILL.md +37 -0
- package/departments/ops/agents/automation-engineer.yaml +58 -0
- package/departments/ops/agents/ops-lead.yaml +71 -0
- package/departments/ops/skills/bottleneck-find/SKILL.md +49 -0
- package/departments/ops/skills/dashboard-build/SKILL.md +18 -0
- package/departments/ops/skills/gtd-setup/SKILL.md +18 -0
- package/departments/ops/skills/integration-design/SKILL.md +18 -0
- package/departments/ops/skills/lean-audit/SKILL.md +18 -0
- package/departments/ops/skills/metrics-dashboard/SKILL.md +18 -0
- package/departments/ops/skills/n8n-flow/SKILL.md +18 -0
- package/departments/ops/skills/sop-create/SKILL.md +18 -0
- package/departments/ops/skills/workflow-automate/SKILL.md +39 -0
- package/departments/ops/skills/zapier-flow/SKILL.md +18 -0
- package/departments/ops/squad.yaml +35 -0
- package/departments/ops/workflows/lean-audit.yaml +69 -0
- package/departments/org/SKILL.md +34 -0
- package/departments/org/agents/coo.yaml +80 -0
- package/departments/org/agents/org-designer.yaml +56 -0
- package/departments/org/agents/people-ops.yaml +56 -0
- package/departments/org/skills/compensation-plan/SKILL.md +18 -0
- package/departments/org/skills/culture-define/SKILL.md +18 -0
- package/departments/org/skills/decision-framework/SKILL.md +18 -0
- package/departments/org/skills/hiring-plan/SKILL.md +18 -0
- package/departments/org/skills/meeting-optimize/SKILL.md +18 -0
- package/departments/org/skills/onboarding-design/SKILL.md +18 -0
- package/departments/org/skills/org-design/SKILL.md +18 -0
- package/departments/org/skills/remote-setup/SKILL.md +18 -0
- package/departments/org/skills/sop-process/SKILL.md +18 -0
- package/departments/org/skills/team-assess/SKILL.md +18 -0
- package/departments/org/squad.yaml +33 -0
- package/departments/org/workflows/design.yaml +55 -0
- package/departments/pm/SKILL.md +39 -0
- package/departments/pm/agents/pm-director.yaml +75 -0
- package/departments/pm/agents/product-owner.yaml +59 -0
- package/departments/pm/agents/scrum-master.yaml +59 -0
- package/departments/pm/skills/agile-po/SKILL.md +118 -0
- package/departments/pm/skills/backlog-groom/SKILL.md +18 -0
- package/departments/pm/skills/discovery-plan/SKILL.md +48 -0
- package/departments/pm/skills/estimate-forecast/SKILL.md +18 -0
- package/departments/pm/skills/impact-map/SKILL.md +18 -0
- package/departments/pm/skills/kanban-setup/SKILL.md +18 -0
- package/departments/pm/skills/risk-register/SKILL.md +18 -0
- package/departments/pm/skills/roadmap-build/SKILL.md +18 -0
- package/departments/pm/skills/shape-pitch/SKILL.md +55 -0
- package/departments/pm/skills/sprint-plan/SKILL.md +18 -0
- package/departments/pm/skills/stakeholder-map/SKILL.md +18 -0
- package/departments/pm/skills/standup-run/SKILL.md +18 -0
- package/departments/pm/skills/story-write/SKILL.md +18 -0
- package/departments/pm/squad.yaml +37 -0
- package/departments/pm/workflows/retro.yaml +33 -0
- package/departments/quality/SKILL.md +66 -0
- package/departments/quality/agents/copy-director.md +134 -0
- package/departments/quality/agents/copy-director.yaml +73 -0
- package/departments/quality/agents/cqo.md +134 -0
- package/departments/quality/agents/cqo.yaml +76 -0
- package/departments/quality/agents/tech-director.yaml +79 -0
- package/departments/quality/agents/tech-ux-director.md +193 -0
- package/departments/quality/squad.yaml +25 -0
- package/departments/saas/SKILL.md +64 -0
- package/departments/saas/agents/cs-manager.yaml +57 -0
- package/departments/saas/agents/growth-engineer.yaml +57 -0
- package/departments/saas/agents/metrics-analyst.yaml +57 -0
- package/departments/saas/agents/saas-strategist.yaml +74 -0
- package/departments/saas/skills/benchmark-compare/SKILL.md +18 -0
- package/departments/saas/skills/churn-analysis/SKILL.md +18 -0
- package/departments/saas/skills/customer-success/SKILL.md +18 -0
- package/departments/saas/skills/growth-plan/SKILL.md +18 -0
- package/departments/saas/skills/gtm-strategy/SKILL.md +18 -0
- package/departments/saas/skills/launch-execute/SKILL.md +18 -0
- package/departments/saas/skills/metrics-dashboard/SKILL.md +18 -0
- package/departments/saas/skills/micro-saas-stack/SKILL.md +18 -0
- package/departments/saas/skills/mvp-build/SKILL.md +18 -0
- package/departments/saas/skills/niche-evaluate/SKILL.md +18 -0
- package/departments/saas/skills/onboarding-optimize/SKILL.md +18 -0
- package/departments/saas/skills/plg-setup/SKILL.md +53 -0
- package/departments/saas/skills/pricing-strategy/SKILL.md +48 -0
- package/departments/saas/skills/saas-scaffold/SKILL.md +127 -0
- package/departments/saas/skills/validate-idea/SKILL.md +55 -0
- package/departments/saas/squad.yaml +37 -0
- package/departments/saas/workflows/metrics.yaml +58 -0
- package/departments/saas/workflows/validate.yaml +103 -0
- package/departments/sales/SKILL.md +35 -0
- package/departments/sales/agents/sales-closer.yaml +58 -0
- package/departments/sales/agents/sales-director.yaml +72 -0
- package/departments/sales/agents/sales-ops.yaml +55 -0
- package/departments/sales/skills/challenger-sell/SKILL.md +18 -0
- package/departments/sales/skills/deal-qualify/SKILL.md +18 -0
- package/departments/sales/skills/discovery-call/SKILL.md +18 -0
- package/departments/sales/skills/forecast-revenue/SKILL.md +18 -0
- package/departments/sales/skills/negotiate-plan/SKILL.md +18 -0
- package/departments/sales/skills/objection-handle/SKILL.md +18 -0
- package/departments/sales/skills/pipeline-manage/SKILL.md +18 -0
- package/departments/sales/skills/pricing-negotiate/SKILL.md +18 -0
- package/departments/sales/skills/proposal-write/SKILL.md +54 -0
- package/departments/sales/skills/spin-sell/SKILL.md +50 -0
- package/departments/sales/squad.yaml +35 -0
- package/departments/sales/workflows/pipeline.yaml +49 -0
- package/departments/strategy/SKILL.md +37 -0
- package/departments/strategy/agents/business-model-designer.yaml +58 -0
- package/departments/strategy/agents/market-analyst.yaml +58 -0
- package/departments/strategy/agents/strategist.md +79 -0
- package/departments/strategy/agents/strategy-director.yaml +75 -0
- package/departments/strategy/skills/blue-ocean/SKILL.md +56 -0
- package/departments/strategy/skills/bmc/SKILL.md +18 -0
- package/departments/strategy/skills/board-advisor/SKILL.md +121 -0
- package/departments/strategy/skills/cto-advisor/SKILL.md +113 -0
- package/departments/strategy/skills/five-forces/SKILL.md +74 -0
- package/departments/strategy/skills/growth-strategy/SKILL.md +18 -0
- package/departments/strategy/skills/moat-analysis/SKILL.md +18 -0
- package/departments/strategy/skills/position/SKILL.md +18 -0
- package/departments/strategy/skills/scenario-plan/SKILL.md +18 -0
- package/departments/strategy/squad.yaml +37 -0
- package/departments/strategy/workflows/analysis.yaml +90 -0
- package/departments/strategy/workflows/swot.yaml +47 -0
- package/installer/adapters/claude-code.js +73 -0
- package/installer/adapters/codex-cli.js +34 -0
- package/installer/adapters/cursor.js +34 -0
- package/installer/adapters/gemini-cli.js +37 -0
- package/installer/cli.js +91 -0
- package/installer/detect-runtime.js +122 -0
- package/installer/doctor.js +105 -0
- package/installer/index.js +199 -0
- package/installer/uninstall.js +46 -0
- package/installer/update.js +39 -0
- package/knowledge/agents-registry-v2.json +2702 -0
- package/knowledge/commands-registry-v2.json +3827 -0
- package/package.json +58 -0
- package/pyproject.toml +64 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# ARKA OS — UserPromptSubmit Hook (5-Layer Context Injection)
|
|
4
|
+
# Injects contextual rules per prompt with caching for performance
|
|
5
|
+
# Timeout: 10s | Output: JSON to stdout | Target: <200ms
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
# ─── Performance Timing ──────────────────────────────────────────────────
|
|
11
|
+
_HOOK_START=$(date +%s 2>/dev/null)
|
|
12
|
+
_HOOK_START_NS=$(date +%s%N 2>/dev/null || echo "0")
|
|
13
|
+
_hook_ms() {
|
|
14
|
+
local end_ns=$(date +%s%N 2>/dev/null || echo "0")
|
|
15
|
+
if [ "$_HOOK_START_NS" != "0" ] && [ "$end_ns" != "0" ] && [ ${#end_ns} -gt 10 ]; then
|
|
16
|
+
echo $(( (end_ns - _HOOK_START_NS) / 1000000 ))
|
|
17
|
+
else
|
|
18
|
+
echo $(( ($(date +%s) - _HOOK_START) * 1000 ))
|
|
19
|
+
fi
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# Extract fields
|
|
23
|
+
PROMPT=$(echo "$input" | jq -r '.prompt // ""' 2>/dev/null)
|
|
24
|
+
CWD=$(echo "$input" | jq -r '.cwd // ""' 2>/dev/null)
|
|
25
|
+
SESSION_ID=$(echo "$input" | jq -r '.session_id // ""' 2>/dev/null)
|
|
26
|
+
|
|
27
|
+
CONTEXT_PARTS=()
|
|
28
|
+
ARKA_OS="${ARKA_OS:-$HOME/.claude/skills/arka}"
|
|
29
|
+
CACHE_DIR="/tmp/arka-context-cache"
|
|
30
|
+
mkdir -p "$CACHE_DIR"
|
|
31
|
+
|
|
32
|
+
# ─── Cache Helper ─────────────────────────────────────────────────────────
|
|
33
|
+
# cache_get <key> <ttl_seconds> — returns cached value or empty
|
|
34
|
+
cache_get() {
|
|
35
|
+
local file="$CACHE_DIR/$1"
|
|
36
|
+
local ttl="$2"
|
|
37
|
+
if [ -f "$file" ]; then
|
|
38
|
+
local age=$(( $(date +%s) - $(stat -f%m "$file" 2>/dev/null || stat -c%Y "$file" 2>/dev/null || echo 0) ))
|
|
39
|
+
if [ "$age" -lt "$ttl" ]; then
|
|
40
|
+
cat "$file"
|
|
41
|
+
return 0
|
|
42
|
+
fi
|
|
43
|
+
fi
|
|
44
|
+
return 1
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
cache_set() {
|
|
48
|
+
echo "$2" > "$CACHE_DIR/$1"
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# ─── L0: Constitution (compressed, 300s cache) ───────────────────────────
|
|
52
|
+
L0=$(cache_get "constitution" 300) || {
|
|
53
|
+
REPO_PATH=$(cat "$ARKA_OS/.repo-path" 2>/dev/null || echo "")
|
|
54
|
+
CONSTITUTION_FILE=""
|
|
55
|
+
[ -f "$REPO_PATH/CONSTITUTION.md" ] && CONSTITUTION_FILE="$REPO_PATH/CONSTITUTION.md"
|
|
56
|
+
if [ -n "$CONSTITUTION_FILE" ]; then
|
|
57
|
+
L0="[Constitution] NON-NEGOTIABLE: branch-isolation, obsidian-output, authority-boundaries, security-gate, context-first, solid-clean-code, spec-driven, human-writing, squad-routing, full-visibility, sequential-validation, mandatory-qa, arka-supremacy | QUALITY-GATE: marta-cqo, eduardo-copy, francisca-tech-ux | MUST: conventional-commits, test-coverage, pattern-matching, actionable-output, memory-persistence"
|
|
58
|
+
cache_set "constitution" "$L0"
|
|
59
|
+
else
|
|
60
|
+
L0=""
|
|
61
|
+
fi
|
|
62
|
+
}
|
|
63
|
+
[ -n "$L0" ] && CONTEXT_PARTS+=("$L0")
|
|
64
|
+
_L0_MS=$(_hook_ms)
|
|
65
|
+
|
|
66
|
+
# ─── L1: Department Routing (no cache — fast string match) ───────────────
|
|
67
|
+
PROMPT_LOWER=$(echo "$PROMPT" | tr '[:upper:]' '[:lower:]')
|
|
68
|
+
DETECTED_DEPT=""
|
|
69
|
+
|
|
70
|
+
if echo "$PROMPT_LOWER" | grep -qE '\b(build|code|feature|deploy|test|review|scaffold|debug|refactor|api|migration|stack)\b'; then
|
|
71
|
+
DETECTED_DEPT="dev"
|
|
72
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(budget|invoice|revenue|forecast|profit|loss|roi|margin|cash.?flow|financial|invest)\b'; then
|
|
73
|
+
DETECTED_DEPT="finance"
|
|
74
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(social|content|campaign|post|instagram|linkedin|twitter|tiktok|seo|marketing|ads|email.?campaign)\b'; then
|
|
75
|
+
DETECTED_DEPT="marketing"
|
|
76
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(store|product|shop|shopify|ecommerce|catalog|inventory|cart|checkout|pricing)\b'; then
|
|
77
|
+
DETECTED_DEPT="ecommerce"
|
|
78
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(strategy|brainstorm|market|swot|competitor|roadmap|pivot|growth)\b'; then
|
|
79
|
+
DETECTED_DEPT="strategy"
|
|
80
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(task|email|calendar|automate|meeting|workflow|process|schedule|slack|discord|notify)\b'; then
|
|
81
|
+
DETECTED_DEPT="operations"
|
|
82
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(learn|persona|knowledge|youtube|transcribe|article|research)\b'; then
|
|
83
|
+
DETECTED_DEPT="knowledge"
|
|
84
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\b(brand|logo|colors|palette|mockup|photoshoot|brand.?identity|brand.?guide|mood.?board|naming|positioning|visual.?design|motion.?design|brand.?video|social.?kit)\b'; then
|
|
85
|
+
DETECTED_DEPT="brand"
|
|
86
|
+
fi
|
|
87
|
+
[ -n "$DETECTED_DEPT" ] && CONTEXT_PARTS+=("[dept:$DETECTED_DEPT]")
|
|
88
|
+
_L1_MS=$(( $(_hook_ms) - ${_L0_MS:-0} ))
|
|
89
|
+
|
|
90
|
+
# ─── L2: Agent Memory (30s cache) ────────────────────────────────────────
|
|
91
|
+
# Detect agent name from prompt
|
|
92
|
+
DETECTED_AGENT=""
|
|
93
|
+
if echo "$PROMPT_LOWER" | grep -qE '\bmarco\b|/.*cto\b'; then
|
|
94
|
+
DETECTED_AGENT="cto"
|
|
95
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bpaulo\b|tech.?lead'; then
|
|
96
|
+
DETECTED_AGENT="tech-lead"
|
|
97
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bgabriel\b|architect'; then
|
|
98
|
+
DETECTED_AGENT="architect"
|
|
99
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bandre\b|senior.?dev|backend'; then
|
|
100
|
+
DETECTED_AGENT="senior-dev"
|
|
101
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bdiana\b|frontend.?dev'; then
|
|
102
|
+
DETECTED_AGENT="frontend-dev"
|
|
103
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bbruno\b|security'; then
|
|
104
|
+
DETECTED_AGENT="security"
|
|
105
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bcarlos\b|devops'; then
|
|
106
|
+
DETECTED_AGENT="devops"
|
|
107
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\brita\b|\bqa\b'; then
|
|
108
|
+
DETECTED_AGENT="qa"
|
|
109
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\blucas\b|analyst'; then
|
|
110
|
+
DETECTED_AGENT="analyst"
|
|
111
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bhelena\b|cfo'; then
|
|
112
|
+
DETECTED_AGENT="cfo"
|
|
113
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bsofia\b|coo'; then
|
|
114
|
+
DETECTED_AGENT="coo"
|
|
115
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bluna\b|content.?creator'; then
|
|
116
|
+
DETECTED_AGENT="content-creator"
|
|
117
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bricardo\b|ecommerce.?manager'; then
|
|
118
|
+
DETECTED_AGENT="ecommerce-manager"
|
|
119
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\btomas\b|strategist'; then
|
|
120
|
+
DETECTED_AGENT="strategist"
|
|
121
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bclara\b|knowledge.?curator'; then
|
|
122
|
+
DETECTED_AGENT="knowledge-curator"
|
|
123
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bvalentina\b|creative.?director'; then
|
|
124
|
+
DETECTED_AGENT="creative-director"
|
|
125
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bmateus\b|brand.?strategist'; then
|
|
126
|
+
DETECTED_AGENT="brand-strategist"
|
|
127
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\bisabel\b|visual.?designer'; then
|
|
128
|
+
DETECTED_AGENT="visual-designer"
|
|
129
|
+
elif echo "$PROMPT_LOWER" | grep -qE '\brafael\b|motion.?designer'; then
|
|
130
|
+
DETECTED_AGENT="motion-designer"
|
|
131
|
+
fi
|
|
132
|
+
|
|
133
|
+
if [ -n "$DETECTED_AGENT" ]; then
|
|
134
|
+
AGENT_CACHE_KEY="agent-${DETECTED_AGENT}"
|
|
135
|
+
AGENT_CTX=$(cache_get "$AGENT_CACHE_KEY" 30) || {
|
|
136
|
+
AGENT_MEM="$HOME/.claude/agent-memory/arka-${DETECTED_AGENT}/MEMORY.md"
|
|
137
|
+
AGENT_CTX="[agent:$DETECTED_AGENT"
|
|
138
|
+
|
|
139
|
+
# Inject DISC profile from agents-registry.json (fast jq lookup)
|
|
140
|
+
REPO_PATH=$(cat "$ARKA_OS/.repo-path" 2>/dev/null || echo "")
|
|
141
|
+
REGISTRY_FILE="$REPO_PATH/knowledge/agents-registry.json"
|
|
142
|
+
if [ -f "$REGISTRY_FILE" ] && command -v jq &>/dev/null; then
|
|
143
|
+
DISC_COMBO=$(jq -r --arg id "$DETECTED_AGENT" '.agents[] | select(.id == $id) | .disc.combination // ""' "$REGISTRY_FILE" 2>/dev/null)
|
|
144
|
+
[ -n "$DISC_COMBO" ] && AGENT_CTX+=" disc:$DISC_COMBO"
|
|
145
|
+
fi
|
|
146
|
+
|
|
147
|
+
if [ -f "$AGENT_MEM" ]; then
|
|
148
|
+
# Extract last 3 gotchas from agent memory
|
|
149
|
+
GOTCHAS=$(sed -n '/^## Gotchas/,/^## /{ /^## Gotchas/d; /^## /d; /^$/d; p; }' "$AGENT_MEM" 2>/dev/null | head -3)
|
|
150
|
+
if [ -n "$GOTCHAS" ]; then
|
|
151
|
+
AGENT_CTX+=" gotchas: $(echo "$GOTCHAS" | tr '\n' '; ' | head -c 200)"
|
|
152
|
+
fi
|
|
153
|
+
fi
|
|
154
|
+
|
|
155
|
+
AGENT_CTX+="]"
|
|
156
|
+
cache_set "$AGENT_CACHE_KEY" "$AGENT_CTX"
|
|
157
|
+
}
|
|
158
|
+
CONTEXT_PARTS+=("$AGENT_CTX")
|
|
159
|
+
fi
|
|
160
|
+
_L2_MS=$(( $(_hook_ms) - ${_L0_MS:-0} - ${_L1_MS:-0} ))
|
|
161
|
+
|
|
162
|
+
# ─── L3: Active Project (30s cache) ──────────────────────────────────────
|
|
163
|
+
if [ -n "$CWD" ]; then
|
|
164
|
+
PROJECT_CACHE_KEY="project-$(echo "$CWD" | md5 2>/dev/null || echo "$CWD" | md5sum 2>/dev/null | cut -d' ' -f1 || echo "nocache")"
|
|
165
|
+
PROJECT_CTX=$(cache_get "$PROJECT_CACHE_KEY" 30) || {
|
|
166
|
+
PROJECT_CTX=""
|
|
167
|
+
# Check ARKA OS projects/ directory
|
|
168
|
+
REPO_PATH=$(cat "$ARKA_OS/.repo-path" 2>/dev/null || echo "")
|
|
169
|
+
if [ -n "$REPO_PATH" ] && [ -d "$REPO_PATH/projects" ]; then
|
|
170
|
+
for proj_md in "$REPO_PATH/projects"/*/PROJECT.md; do
|
|
171
|
+
[ -f "$proj_md" ] || continue
|
|
172
|
+
PROJ_DIR=$(dirname "$proj_md")
|
|
173
|
+
if [ -f "$PROJ_DIR/.project-path" ]; then
|
|
174
|
+
PROJ_PATH=$(cat "$PROJ_DIR/.project-path" 2>/dev/null)
|
|
175
|
+
if [ -n "$PROJ_PATH" ] && [[ "$CWD" == "$PROJ_PATH"* ]]; then
|
|
176
|
+
PROJ_NAME=$(basename "$PROJ_DIR")
|
|
177
|
+
# Try to extract stack from PROJECT.md
|
|
178
|
+
PROJ_STACK=$(grep -i 'stack\|framework' "$proj_md" 2>/dev/null | head -1 | sed 's/.*: *//' | head -c 50)
|
|
179
|
+
PROJECT_CTX="[project:$PROJ_NAME"
|
|
180
|
+
[ -n "$PROJ_STACK" ] && PROJECT_CTX+=" stack:$PROJ_STACK"
|
|
181
|
+
PROJECT_CTX+="]"
|
|
182
|
+
break
|
|
183
|
+
fi
|
|
184
|
+
fi
|
|
185
|
+
done
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
# Also check installed skills for project paths
|
|
189
|
+
if [ -z "$PROJECT_CTX" ]; then
|
|
190
|
+
for proj_dir in "$HOME/.claude/skills"/arka-*/; do
|
|
191
|
+
[ -d "$proj_dir" ] || continue
|
|
192
|
+
if [ -f "$proj_dir/.project-path" ]; then
|
|
193
|
+
PROJ_PATH=$(cat "$proj_dir/.project-path" 2>/dev/null)
|
|
194
|
+
if [ -n "$PROJ_PATH" ] && [[ "$CWD" == "$PROJ_PATH"* ]]; then
|
|
195
|
+
PROJ_NAME=$(basename "$proj_dir" | sed 's/^arka-//')
|
|
196
|
+
PROJECT_CTX="[project:$PROJ_NAME]"
|
|
197
|
+
break
|
|
198
|
+
fi
|
|
199
|
+
fi
|
|
200
|
+
done
|
|
201
|
+
fi
|
|
202
|
+
|
|
203
|
+
cache_set "$PROJECT_CACHE_KEY" "$PROJECT_CTX"
|
|
204
|
+
}
|
|
205
|
+
[ -n "$PROJECT_CTX" ] && CONTEXT_PARTS+=("$PROJECT_CTX")
|
|
206
|
+
fi
|
|
207
|
+
_L3_MS=$(( $(_hook_ms) - ${_L0_MS:-0} - ${_L1_MS:-0} - ${_L2_MS:-0} ))
|
|
208
|
+
|
|
209
|
+
# ─── L4: Git Branch Detection (no cache — fast check) ────────────────────
|
|
210
|
+
if [ -n "$CWD" ]; then
|
|
211
|
+
CURRENT_BRANCH=$(git -C "$CWD" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "")
|
|
212
|
+
if [ -n "$CURRENT_BRANCH" ] && [ "$CURRENT_BRANCH" != "main" ] && [ "$CURRENT_BRANCH" != "master" ] && [ "$CURRENT_BRANCH" != "dev" ]; then
|
|
213
|
+
CONTEXT_PARTS+=("[branch:$CURRENT_BRANCH]")
|
|
214
|
+
fi
|
|
215
|
+
fi
|
|
216
|
+
_L4_MS=$(( $(_hook_ms) - ${_L0_MS:-0} - ${_L1_MS:-0} - ${_L2_MS:-0} - ${_L3_MS:-0} ))
|
|
217
|
+
|
|
218
|
+
# ─── Gotchas Injection (30s cache) ───────────────────────────────────────
|
|
219
|
+
if [ -n "$DETECTED_DEPT" ]; then
|
|
220
|
+
GOTCHA_CACHE_KEY="gotchas-${DETECTED_DEPT}"
|
|
221
|
+
GOTCHA_CTX=$(cache_get "$GOTCHA_CACHE_KEY" 30) || {
|
|
222
|
+
GOTCHA_CTX=""
|
|
223
|
+
GOTCHAS_FILE="$HOME/.arka-os/gotchas.json"
|
|
224
|
+
if [ -f "$GOTCHAS_FILE" ] && command -v jq &>/dev/null; then
|
|
225
|
+
# Get top 2 recurring errors for this department with count >= 3 (include suggestions)
|
|
226
|
+
TOP_GOTCHAS=$(jq -r --arg cat "$DETECTED_DEPT" \
|
|
227
|
+
'[.[] | select(.category == $cat and .count >= 3)] | sort_by(-.count) | .[0:2] | .[] |
|
|
228
|
+
if .suggestion then "\(.pattern) (x\(.count)) \u2192 \(.suggestion)" else "\(.pattern) (x\(.count))" end' \
|
|
229
|
+
"$GOTCHAS_FILE" 2>/dev/null)
|
|
230
|
+
if [ -n "$TOP_GOTCHAS" ]; then
|
|
231
|
+
GOTCHA_CTX="[gotchas:$DETECTED_DEPT $(echo "$TOP_GOTCHAS" | tr '\n' '; ' | head -c 300)]"
|
|
232
|
+
fi
|
|
233
|
+
fi
|
|
234
|
+
cache_set "$GOTCHA_CACHE_KEY" "$GOTCHA_CTX"
|
|
235
|
+
}
|
|
236
|
+
[ -n "$GOTCHA_CTX" ] && CONTEXT_PARTS+=("$GOTCHA_CTX")
|
|
237
|
+
fi
|
|
238
|
+
|
|
239
|
+
# ─── L5: Command Hint (30s cache) ────────────────────────────────────────
|
|
240
|
+
# Fast keyword lookup against commands-registry for non-explicit prompts
|
|
241
|
+
if [ -n "$PROMPT" ] && ! echo "$PROMPT" | grep -qE '^/(dev|mkt|ecom|fin|ops|strat|kb|arka|do) '; then
|
|
242
|
+
CMD_CACHE_KEY="cmdhint-$(echo "$PROMPT_LOWER" | md5 2>/dev/null || echo "$PROMPT_LOWER" | md5sum 2>/dev/null | cut -d' ' -f1)"
|
|
243
|
+
CMD_HINT=$(cache_get "$CMD_CACHE_KEY" 30) || {
|
|
244
|
+
CMD_HINT=""
|
|
245
|
+
REPO_PATH=$(cat "$ARKA_OS/.repo-path" 2>/dev/null || echo "")
|
|
246
|
+
REGISTRY="$REPO_PATH/knowledge/commands-registry.json"
|
|
247
|
+
if [ -f "$REGISTRY" ] && command -v jq &>/dev/null; then
|
|
248
|
+
# Extract words from prompt and match against registry keywords
|
|
249
|
+
CMD_HINT=$(jq -r --arg prompt "$PROMPT_LOWER" '
|
|
250
|
+
($prompt | split(" ") | map(select(length > 2))) as $words |
|
|
251
|
+
[.commands[] |
|
|
252
|
+
{id, command, department,
|
|
253
|
+
score: ([.keywords[] | . as $kw |
|
|
254
|
+
if ($words | any(. == $kw)) then 2
|
|
255
|
+
elif ($words | join(" ") | test($kw)) then 3
|
|
256
|
+
else 0 end
|
|
257
|
+
] | add // 0)}
|
|
258
|
+
] | sort_by(-.score) | [.[:2][] | select(.score > 0)] |
|
|
259
|
+
if length > 0 then
|
|
260
|
+
map("[hint:\(.command)]") | join(" ")
|
|
261
|
+
else "" end
|
|
262
|
+
' "$REGISTRY" 2>/dev/null)
|
|
263
|
+
fi
|
|
264
|
+
cache_set "$CMD_CACHE_KEY" "$CMD_HINT"
|
|
265
|
+
}
|
|
266
|
+
[ -n "$CMD_HINT" ] && CONTEXT_PARTS+=("$CMD_HINT")
|
|
267
|
+
fi
|
|
268
|
+
_L5_MS=$(( $(_hook_ms) - ${_L0_MS:-0} - ${_L1_MS:-0} - ${_L2_MS:-0} - ${_L3_MS:-0} - ${_L4_MS:-0} ))
|
|
269
|
+
|
|
270
|
+
# ─── Time of Day (no cache) ──────────────────────────────────────────────
|
|
271
|
+
HOUR=$(date +%H)
|
|
272
|
+
if [ "$HOUR" -lt 12 ]; then
|
|
273
|
+
CONTEXT_PARTS+=("[time:morning]")
|
|
274
|
+
elif [ "$HOUR" -lt 18 ]; then
|
|
275
|
+
CONTEXT_PARTS+=("[time:afternoon]")
|
|
276
|
+
else
|
|
277
|
+
CONTEXT_PARTS+=("[time:evening]")
|
|
278
|
+
fi
|
|
279
|
+
|
|
280
|
+
# ─── Log Metrics ─────────────────────────────────────────────────────────
|
|
281
|
+
_DURATION_MS=$(_hook_ms)
|
|
282
|
+
METRICS_FILE="$HOME/.arka-os/hook-metrics.json"
|
|
283
|
+
METRICS_LOCK="$HOME/.arka-os/hook-metrics.lock"
|
|
284
|
+
mkdir -p "$HOME/.arka-os"
|
|
285
|
+
(
|
|
286
|
+
if command -v flock &>/dev/null; then flock -w 2 200; else true; fi
|
|
287
|
+
[ ! -f "$METRICS_FILE" ] && echo '[]' > "$METRICS_FILE"
|
|
288
|
+
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
289
|
+
jq --argjson dur "$_DURATION_MS" --arg ts "$NOW" --arg hook "user-prompt-submit" \
|
|
290
|
+
--argjson l0 "${_L0_MS:-0}" --argjson l1 "${_L1_MS:-0}" --argjson l2 "${_L2_MS:-0}" \
|
|
291
|
+
--argjson l3 "${_L3_MS:-0}" --argjson l4 "${_L4_MS:-0}" --argjson l5 "${_L5_MS:-0}" \
|
|
292
|
+
'. += [{"hook": $hook, "duration_ms": $dur, "timestamp": $ts, "layers": {"L0": $l0, "L1": $l1, "L2": $l2, "L3": $l3, "L4": $l4, "L5": $l5}}] | .[-500:]' \
|
|
293
|
+
"$METRICS_FILE" > "$METRICS_FILE.tmp" 2>/dev/null && mv "$METRICS_FILE.tmp" "$METRICS_FILE"
|
|
294
|
+
) 200>"$METRICS_LOCK" 2>/dev/null
|
|
295
|
+
|
|
296
|
+
# ─── Output ───────────────────────────────────────────────────────────────
|
|
297
|
+
if [ ${#CONTEXT_PARTS[@]} -gt 0 ]; then
|
|
298
|
+
CONTEXT=""
|
|
299
|
+
for part in "${CONTEXT_PARTS[@]}"; do
|
|
300
|
+
CONTEXT+="$part "
|
|
301
|
+
done
|
|
302
|
+
CONTEXT="${CONTEXT% }"
|
|
303
|
+
|
|
304
|
+
jq -n --arg ctx "$CONTEXT" '{
|
|
305
|
+
"hookSpecificOutput": {
|
|
306
|
+
"hookEventName": "UserPromptSubmit",
|
|
307
|
+
"additionalContext": $ctx
|
|
308
|
+
}
|
|
309
|
+
}'
|
|
310
|
+
else
|
|
311
|
+
echo '{}'
|
|
312
|
+
fi
|
package/core/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Agent system — behavioral DNA, authority, and lifecycle management."""
|
|
2
|
+
|
|
3
|
+
from core.agents.schema import Agent, BehavioralDNA, Authority
|
|
4
|
+
from core.agents.loader import load_agent, load_all_agents
|
|
5
|
+
from core.agents.validator import validate_agent_consistency
|
|
6
|
+
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Agent",
|
|
9
|
+
"BehavioralDNA",
|
|
10
|
+
"Authority",
|
|
11
|
+
"load_agent",
|
|
12
|
+
"load_all_agents",
|
|
13
|
+
"validate_agent_consistency",
|
|
14
|
+
]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Agent YAML loader — reads agent definitions from YAML files."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import yaml
|
|
7
|
+
from core.agents.schema import Agent
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def load_agent(path: str | Path) -> Agent:
|
|
11
|
+
"""Load an agent from a YAML file.
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
path: Path to the agent YAML file.
|
|
15
|
+
|
|
16
|
+
Returns:
|
|
17
|
+
Validated Agent instance.
|
|
18
|
+
|
|
19
|
+
Raises:
|
|
20
|
+
FileNotFoundError: If the file doesn't exist.
|
|
21
|
+
ValueError: If the YAML is invalid or doesn't match schema.
|
|
22
|
+
"""
|
|
23
|
+
path = Path(path)
|
|
24
|
+
if not path.exists():
|
|
25
|
+
raise FileNotFoundError(f"Agent file not found: {path}")
|
|
26
|
+
|
|
27
|
+
with open(path) as f:
|
|
28
|
+
data = yaml.safe_load(f)
|
|
29
|
+
|
|
30
|
+
if data is None:
|
|
31
|
+
raise ValueError(f"Empty agent file: {path}")
|
|
32
|
+
|
|
33
|
+
return Agent.model_validate(data)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def load_all_agents(
|
|
37
|
+
base_dir: str | Path,
|
|
38
|
+
department: Optional[str] = None,
|
|
39
|
+
) -> list[Agent]:
|
|
40
|
+
"""Load all agents from a directory tree.
|
|
41
|
+
|
|
42
|
+
Scans for YAML files in agents/ subdirectories of each department.
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
base_dir: Root directory containing department folders.
|
|
46
|
+
department: If set, only load agents from this department.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
List of validated Agent instances.
|
|
50
|
+
"""
|
|
51
|
+
base_dir = Path(base_dir)
|
|
52
|
+
agents: list[Agent] = []
|
|
53
|
+
errors: list[str] = []
|
|
54
|
+
|
|
55
|
+
if department:
|
|
56
|
+
search_dirs = [base_dir / department / "agents"]
|
|
57
|
+
else:
|
|
58
|
+
search_dirs = list(base_dir.glob("*/agents"))
|
|
59
|
+
|
|
60
|
+
for agents_dir in search_dirs:
|
|
61
|
+
if not agents_dir.is_dir():
|
|
62
|
+
continue
|
|
63
|
+
for yaml_file in sorted(agents_dir.glob("*.yaml")):
|
|
64
|
+
try:
|
|
65
|
+
agent = load_agent(yaml_file)
|
|
66
|
+
agents.append(agent)
|
|
67
|
+
except Exception as e:
|
|
68
|
+
errors.append(f"{yaml_file}: {e}")
|
|
69
|
+
|
|
70
|
+
if errors:
|
|
71
|
+
import warnings
|
|
72
|
+
for err in errors:
|
|
73
|
+
warnings.warn(f"Failed to load agent: {err}")
|
|
74
|
+
|
|
75
|
+
return agents
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def agent_to_yaml(agent: Agent) -> str:
|
|
79
|
+
"""Serialize an Agent to YAML string.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
agent: Agent instance to serialize.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
YAML string representation.
|
|
86
|
+
"""
|
|
87
|
+
data = agent.model_dump(mode="json")
|
|
88
|
+
return yaml.dump(data, default_flow_style=False, allow_unicode=True, sort_keys=False)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"""Generate agents-registry.json from all agent YAML files.
|
|
2
|
+
|
|
3
|
+
Scans departments/*/agents/*.yaml and produces a machine-readable
|
|
4
|
+
registry with all agent metadata including behavioral DNA.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import json
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from core.agents.loader import load_agent
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def generate_registry(departments_dir: str | Path, output_path: str | Path) -> dict:
|
|
15
|
+
"""Generate agents-registry.json from YAML agent files.
|
|
16
|
+
|
|
17
|
+
Args:
|
|
18
|
+
departments_dir: Path to departments/ directory.
|
|
19
|
+
output_path: Where to write the JSON registry.
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
The registry dict.
|
|
23
|
+
"""
|
|
24
|
+
departments_dir = Path(departments_dir)
|
|
25
|
+
output_path = Path(output_path)
|
|
26
|
+
|
|
27
|
+
agents = []
|
|
28
|
+
errors = []
|
|
29
|
+
|
|
30
|
+
for yaml_file in sorted(departments_dir.glob("*/agents/*.yaml")):
|
|
31
|
+
try:
|
|
32
|
+
agent = load_agent(yaml_file)
|
|
33
|
+
entry = {
|
|
34
|
+
"id": agent.id,
|
|
35
|
+
"name": agent.name,
|
|
36
|
+
"role": agent.role,
|
|
37
|
+
"department": agent.department,
|
|
38
|
+
"tier": agent.tier,
|
|
39
|
+
"disc": {
|
|
40
|
+
"primary": agent.behavioral_dna.disc.primary.value,
|
|
41
|
+
"secondary": agent.behavioral_dna.disc.secondary.value,
|
|
42
|
+
"label": agent.behavioral_dna.disc.label,
|
|
43
|
+
},
|
|
44
|
+
"enneagram": {
|
|
45
|
+
"type": agent.behavioral_dna.enneagram.type.value,
|
|
46
|
+
"wing": agent.behavioral_dna.enneagram.wing,
|
|
47
|
+
"label": agent.behavioral_dna.enneagram.label,
|
|
48
|
+
},
|
|
49
|
+
"big_five": {
|
|
50
|
+
"O": agent.behavioral_dna.big_five.openness,
|
|
51
|
+
"C": agent.behavioral_dna.big_five.conscientiousness,
|
|
52
|
+
"E": agent.behavioral_dna.big_five.extraversion,
|
|
53
|
+
"A": agent.behavioral_dna.big_five.agreeableness,
|
|
54
|
+
"N": agent.behavioral_dna.big_five.neuroticism,
|
|
55
|
+
},
|
|
56
|
+
"mbti": agent.behavioral_dna.mbti.type.value,
|
|
57
|
+
"authority": {
|
|
58
|
+
k: v for k, v in agent.authority.model_dump().items()
|
|
59
|
+
if v and v != [] and k not in ("delegates_to", "escalates_to")
|
|
60
|
+
},
|
|
61
|
+
"expertise_domains": agent.expertise.domains[:5],
|
|
62
|
+
"frameworks": agent.expertise.frameworks[:5],
|
|
63
|
+
"file": str(yaml_file.relative_to(departments_dir.parent)),
|
|
64
|
+
"memory_path": agent.memory_path,
|
|
65
|
+
}
|
|
66
|
+
agents.append(entry)
|
|
67
|
+
except Exception as e:
|
|
68
|
+
errors.append(f"{yaml_file.name}: {e}")
|
|
69
|
+
|
|
70
|
+
# Build tier summary
|
|
71
|
+
tier_counts = {}
|
|
72
|
+
for a in agents:
|
|
73
|
+
tier_counts[a["tier"]] = tier_counts.get(a["tier"], 0) + 1
|
|
74
|
+
|
|
75
|
+
# Build department summary
|
|
76
|
+
dept_counts = {}
|
|
77
|
+
for a in agents:
|
|
78
|
+
dept_counts[a["department"]] = dept_counts.get(a["department"], 0) + 1
|
|
79
|
+
|
|
80
|
+
# Build DISC distribution
|
|
81
|
+
disc_counts = {}
|
|
82
|
+
for a in agents:
|
|
83
|
+
p = a["disc"]["primary"]
|
|
84
|
+
disc_counts[p] = disc_counts.get(p, 0) + 1
|
|
85
|
+
|
|
86
|
+
registry = {
|
|
87
|
+
"_meta": {
|
|
88
|
+
"version": "2.0.0",
|
|
89
|
+
"generated": datetime.now().isoformat(),
|
|
90
|
+
"total_agents": len(agents),
|
|
91
|
+
"generator": "core/agents/registry_gen.py",
|
|
92
|
+
"tiers": tier_counts,
|
|
93
|
+
"departments": dept_counts,
|
|
94
|
+
"disc_distribution": disc_counts,
|
|
95
|
+
},
|
|
96
|
+
"agents": agents,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if errors:
|
|
100
|
+
registry["_meta"]["errors"] = errors
|
|
101
|
+
|
|
102
|
+
output_path.parent.mkdir(parents=True, exist_ok=True)
|
|
103
|
+
with open(output_path, "w") as f:
|
|
104
|
+
json.dump(registry, f, indent=2, ensure_ascii=False)
|
|
105
|
+
|
|
106
|
+
return registry
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
base = Path(__file__).parent.parent.parent
|
|
111
|
+
reg = generate_registry(
|
|
112
|
+
base / "departments",
|
|
113
|
+
base / "knowledge" / "agents-registry-v2.json",
|
|
114
|
+
)
|
|
115
|
+
print(f"Generated registry: {reg['_meta']['total_agents']} agents")
|
|
116
|
+
print(f"Tiers: {reg['_meta']['tiers']}")
|
|
117
|
+
print(f"Departments: {reg['_meta']['departments']}")
|
|
118
|
+
print(f"DISC: {reg['_meta']['disc_distribution']}")
|