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,116 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# ArkaOS v2 — PostToolUse Hook (Error Pattern Tracking)
|
|
4
|
+
# Tracks recurring errors from tool output for gotchas system
|
|
5
|
+
# Timeout: 5s
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
ARKAOS_HOME="${HOME}/.arkaos"
|
|
11
|
+
GOTCHAS_FILE="$ARKAOS_HOME/gotchas.json"
|
|
12
|
+
|
|
13
|
+
mkdir -p "$ARKAOS_HOME" 2>/dev/null
|
|
14
|
+
|
|
15
|
+
# ─── Check for errors ────────────────────────────────────────────────────
|
|
16
|
+
exit_code=""
|
|
17
|
+
tool_output=""
|
|
18
|
+
|
|
19
|
+
if command -v jq &>/dev/null; then
|
|
20
|
+
exit_code=$(echo "$input" | jq -r '.exitCode // ""' 2>/dev/null)
|
|
21
|
+
tool_output=$(echo "$input" | jq -r '.output // ""' 2>/dev/null | head -c 2000)
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
# Only track if there's an error
|
|
25
|
+
if [ "$exit_code" = "0" ] || [ -z "$exit_code" ]; then
|
|
26
|
+
# Check for error patterns in output
|
|
27
|
+
if ! echo "$tool_output" | grep -qiE '(error|exception|fatal|failed|denied|not found)'; then
|
|
28
|
+
exit 0
|
|
29
|
+
fi
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# ─── Extract and normalize error pattern ─────────────────────────────────
|
|
33
|
+
error_line=$(echo "$tool_output" | grep -iE '(error|exception|fatal|failed)' | head -1 | head -c 200)
|
|
34
|
+
|
|
35
|
+
if [ -z "$error_line" ]; then
|
|
36
|
+
exit 0
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
# Normalize: remove timestamps, hashes, line numbers
|
|
40
|
+
pattern=$(echo "$error_line" | sed -E \
|
|
41
|
+
-e 's/[0-9]{4}-[0-9]{2}-[0-9]{2}[T ][0-9:.]+//g' \
|
|
42
|
+
-e 's/[a-f0-9]{7,40}//g' \
|
|
43
|
+
-e 's/line [0-9]+/line N/g' \
|
|
44
|
+
-e 's/[0-9]+ms/Nms/g' \
|
|
45
|
+
-e 's/\s+/ /g' \
|
|
46
|
+
| head -c 150)
|
|
47
|
+
|
|
48
|
+
# ─── Categorize ──────────────────────────────────────────────────────────
|
|
49
|
+
category="general"
|
|
50
|
+
if echo "$error_line" | grep -qiE '(laravel|artisan|eloquent|migration|php)'; then
|
|
51
|
+
category="laravel"
|
|
52
|
+
elif echo "$error_line" | grep -qiE '(vue|nuxt|react|next|npm|node|webpack|vite)'; then
|
|
53
|
+
category="frontend"
|
|
54
|
+
elif echo "$error_line" | grep -qiE '(git|merge|rebase|checkout|branch)'; then
|
|
55
|
+
category="git"
|
|
56
|
+
elif echo "$error_line" | grep -qiE '(postgres|mysql|sqlite|database|query|migration)'; then
|
|
57
|
+
category="database"
|
|
58
|
+
elif echo "$error_line" | grep -qiE '(permission|denied|access|chmod|chown)'; then
|
|
59
|
+
category="permissions"
|
|
60
|
+
elif echo "$error_line" | grep -qiE '(test|assert|expect|jest|phpunit|pytest)'; then
|
|
61
|
+
category="testing"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# ─── Store gotcha (concurrent-safe with flock) ───────────────────────────
|
|
65
|
+
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
66
|
+
cwd=$(pwd)
|
|
67
|
+
project=$(basename "$cwd")
|
|
68
|
+
|
|
69
|
+
(
|
|
70
|
+
flock -w 2 200 || exit 0
|
|
71
|
+
|
|
72
|
+
# Initialize if empty
|
|
73
|
+
if [ ! -f "$GOTCHAS_FILE" ] || [ ! -s "$GOTCHAS_FILE" ]; then
|
|
74
|
+
echo "[]" > "$GOTCHAS_FILE"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
if command -v python3 &>/dev/null; then
|
|
78
|
+
python3 -c "
|
|
79
|
+
import json, sys
|
|
80
|
+
try:
|
|
81
|
+
with open('$GOTCHAS_FILE') as f:
|
|
82
|
+
gotchas = json.load(f)
|
|
83
|
+
except:
|
|
84
|
+
gotchas = []
|
|
85
|
+
|
|
86
|
+
pattern = '''$pattern'''
|
|
87
|
+
found = False
|
|
88
|
+
for g in gotchas:
|
|
89
|
+
if g.get('pattern') == pattern:
|
|
90
|
+
g['count'] = g.get('count', 1) + 1
|
|
91
|
+
g['last_seen'] = '$timestamp'
|
|
92
|
+
if '$project' not in g.get('projects', []):
|
|
93
|
+
g.setdefault('projects', []).append('$project')
|
|
94
|
+
found = True
|
|
95
|
+
break
|
|
96
|
+
|
|
97
|
+
if not found:
|
|
98
|
+
gotchas.append({
|
|
99
|
+
'pattern': pattern,
|
|
100
|
+
'category': '$category',
|
|
101
|
+
'count': 1,
|
|
102
|
+
'first_seen': '$timestamp',
|
|
103
|
+
'last_seen': '$timestamp',
|
|
104
|
+
'projects': ['$project'],
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
# Keep top 100
|
|
108
|
+
gotchas.sort(key=lambda g: g.get('count', 0), reverse=True)
|
|
109
|
+
gotchas = gotchas[:100]
|
|
110
|
+
|
|
111
|
+
with open('$GOTCHAS_FILE', 'w') as f:
|
|
112
|
+
json.dump(gotchas, f, indent=2)
|
|
113
|
+
" 2>/dev/null
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
) 200>"$GOTCHAS_FILE.lock"
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# ARKA OS — PostToolUse Hook (Gotchas Memory)
|
|
4
|
+
# Detects errors from tool output and tracks recurring patterns
|
|
5
|
+
# Timeout: 5s | Output: JSON to stdout
|
|
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
|
+
TOOL_NAME=$(echo "$input" | jq -r '.tool_name // ""' 2>/dev/null)
|
|
24
|
+
TOOL_OUTPUT=$(echo "$input" | jq -r '.tool_output // ""' 2>/dev/null)
|
|
25
|
+
EXIT_CODE=$(echo "$input" | jq -r '.exit_code // "0"' 2>/dev/null)
|
|
26
|
+
CWD=$(echo "$input" | jq -r '.cwd // ""' 2>/dev/null)
|
|
27
|
+
|
|
28
|
+
# Only process if there was an error
|
|
29
|
+
if [ "$EXIT_CODE" = "0" ] || [ -z "$EXIT_CODE" ]; then
|
|
30
|
+
# Also check for error patterns in output even with exit code 0
|
|
31
|
+
if ! echo "$TOOL_OUTPUT" | grep -qiE '(error:|fatal:|exception:|failed|ENOENT|EACCES|EPERM|panic:)'; then
|
|
32
|
+
echo '{}'
|
|
33
|
+
exit 0
|
|
34
|
+
fi
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
# ─── Extract Error Pattern ────────────────────────────────────────────────
|
|
38
|
+
# Get first meaningful error line (skip blank lines, timestamps)
|
|
39
|
+
ERROR_LINE=$(echo "$TOOL_OUTPUT" | grep -iE '(error|fatal|exception|failed|ENOENT|EACCES|EPERM|panic|cannot|not found|permission denied)' | head -1)
|
|
40
|
+
|
|
41
|
+
if [ -z "$ERROR_LINE" ]; then
|
|
42
|
+
# Fallback: first non-empty line of output for non-zero exit
|
|
43
|
+
ERROR_LINE=$(echo "$TOOL_OUTPUT" | head -5 | tail -1)
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
[ -z "$ERROR_LINE" ] && { echo '{}'; exit 0; }
|
|
47
|
+
|
|
48
|
+
# Normalize: remove timestamps, hashes, paths with unique segments, line numbers
|
|
49
|
+
PATTERN=$(echo "$ERROR_LINE" | \
|
|
50
|
+
sed -E 's/[0-9]{4}-[0-9]{2}-[0-9]{2}[T ][0-9]{2}:[0-9]{2}:[0-9]{2}[^ ]*/TIMESTAMP/g' | \
|
|
51
|
+
sed -E 's/[0-9a-f]{7,40}/HASH/g' | \
|
|
52
|
+
sed -E 's/line [0-9]+/line N/g' | \
|
|
53
|
+
sed -E 's/:[0-9]+:/:N:/g' | \
|
|
54
|
+
head -c 200)
|
|
55
|
+
|
|
56
|
+
[ -z "$PATTERN" ] && { echo '{}'; exit 0; }
|
|
57
|
+
|
|
58
|
+
# ─── Categorize ──────────────────────────────────────────────────────────
|
|
59
|
+
CATEGORY="general"
|
|
60
|
+
if echo "$ERROR_LINE" | grep -qiE '(artisan|eloquent|laravel|blade|migration|composer|php )'; then
|
|
61
|
+
CATEGORY="laravel"
|
|
62
|
+
elif echo "$ERROR_LINE" | grep -qiE '(npm|node|vue|react|nuxt|next|vite|webpack|typescript|tsx|jsx)'; then
|
|
63
|
+
CATEGORY="frontend"
|
|
64
|
+
elif echo "$ERROR_LINE" | grep -qiE '(git |merge|rebase|checkout|branch|commit|push|pull)'; then
|
|
65
|
+
CATEGORY="git"
|
|
66
|
+
elif echo "$ERROR_LINE" | grep -qiE '(sql|postgres|mysql|database|migration|table|column|constraint)'; then
|
|
67
|
+
CATEGORY="database"
|
|
68
|
+
elif echo "$ERROR_LINE" | grep -qiE '(permission|denied|EACCES|EPERM|chmod|chown|sudo)'; then
|
|
69
|
+
CATEGORY="permissions"
|
|
70
|
+
elif echo "$ERROR_LINE" | grep -qiE '(test|assert|expect|jest|phpunit|bats|coverage)'; then
|
|
71
|
+
CATEGORY="testing"
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
# ─── Match Fix Suggestion ────────────────────────────────────────────────
|
|
75
|
+
SUGGESTION=""
|
|
76
|
+
FIXES_FILE="${ARKA_OS:-$HOME/.claude/skills/arka}/config/gotchas-fixes.json"
|
|
77
|
+
# Also check repo path
|
|
78
|
+
if [ ! -f "$FIXES_FILE" ]; then
|
|
79
|
+
REPO_PATH=$(cat "${ARKA_OS:-$HOME/.claude/skills/arka}/.repo-path" 2>/dev/null || echo "")
|
|
80
|
+
[ -n "$REPO_PATH" ] && FIXES_FILE="$REPO_PATH/config/gotchas-fixes.json"
|
|
81
|
+
fi
|
|
82
|
+
if [ -f "$FIXES_FILE" ] && command -v jq &>/dev/null; then
|
|
83
|
+
SUGGESTION=$(jq -r --arg err "$ERROR_LINE" '
|
|
84
|
+
.fixes[] | select(.pattern_match as $p | $err | test($p; "i")) | .suggestion
|
|
85
|
+
' "$FIXES_FILE" 2>/dev/null | head -1)
|
|
86
|
+
fi
|
|
87
|
+
|
|
88
|
+
# ─── Detect Active Project ───────────────────────────────────────────────
|
|
89
|
+
PROJECT=""
|
|
90
|
+
if [ -n "$CWD" ]; then
|
|
91
|
+
# Try to extract project name from CWD
|
|
92
|
+
REPO_PATH=$(cat "${ARKA_OS:-$HOME/.claude/skills/arka}/.repo-path" 2>/dev/null || echo "")
|
|
93
|
+
if [ -n "$REPO_PATH" ] && [ -d "$REPO_PATH/projects" ]; then
|
|
94
|
+
for proj_dir in "$REPO_PATH/projects"/*/; do
|
|
95
|
+
[ -f "$proj_dir/.project-path" ] || continue
|
|
96
|
+
PROJ_PATH=$(cat "$proj_dir/.project-path" 2>/dev/null)
|
|
97
|
+
if [ -n "$PROJ_PATH" ] && [[ "$CWD" == "$PROJ_PATH"* ]]; then
|
|
98
|
+
PROJECT=$(basename "$proj_dir")
|
|
99
|
+
break
|
|
100
|
+
fi
|
|
101
|
+
done
|
|
102
|
+
fi
|
|
103
|
+
# Fallback: use directory name
|
|
104
|
+
[ -z "$PROJECT" ] && PROJECT=$(basename "$CWD")
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
# ─── Store in gotchas.json ────────────────────────────────────────────────
|
|
108
|
+
GOTCHAS_FILE="$HOME/.arka-os/gotchas.json"
|
|
109
|
+
mkdir -p "$HOME/.arka-os"
|
|
110
|
+
|
|
111
|
+
# Use flock for concurrent safety (fallback if flock not available on macOS)
|
|
112
|
+
LOCK_FILE="$HOME/.arka-os/gotchas.lock"
|
|
113
|
+
if command -v flock &>/dev/null; then
|
|
114
|
+
LOCK_CMD="flock -w 3 200"
|
|
115
|
+
else
|
|
116
|
+
LOCK_CMD="true"
|
|
117
|
+
fi
|
|
118
|
+
(
|
|
119
|
+
eval "$LOCK_CMD" || { echo '{}'; exit 0; }
|
|
120
|
+
|
|
121
|
+
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
122
|
+
|
|
123
|
+
# Initialize if missing or invalid
|
|
124
|
+
if [ ! -f "$GOTCHAS_FILE" ] || ! jq empty "$GOTCHAS_FILE" 2>/dev/null; then
|
|
125
|
+
echo '[]' > "$GOTCHAS_FILE"
|
|
126
|
+
fi
|
|
127
|
+
|
|
128
|
+
# Check if pattern already exists
|
|
129
|
+
EXISTING_IDX=$(jq -r --arg pat "$PATTERN" \
|
|
130
|
+
'to_entries[] | select(.value.pattern == $pat) | .key' \
|
|
131
|
+
"$GOTCHAS_FILE" 2>/dev/null | head -1)
|
|
132
|
+
|
|
133
|
+
if [ -n "$EXISTING_IDX" ] && [ "$EXISTING_IDX" -ge 0 ] 2>/dev/null; then
|
|
134
|
+
# Increment count, update last_seen, add project if new, add suggestion if missing
|
|
135
|
+
jq --argjson idx "$EXISTING_IDX" \
|
|
136
|
+
--arg now "$NOW" \
|
|
137
|
+
--arg proj "$PROJECT" \
|
|
138
|
+
--arg sug "$SUGGESTION" \
|
|
139
|
+
'.[$idx].count += 1 |
|
|
140
|
+
.[$idx].last_seen = $now |
|
|
141
|
+
(if $proj != "" and ($proj | IN(.[$idx].projects[]?) | not) then .[$idx].projects += [$proj] else . end) |
|
|
142
|
+
(if $sug != "" and ((.[$idx].suggestion // "") == "") then .[$idx].suggestion = $sug else . end)' \
|
|
143
|
+
"$GOTCHAS_FILE" > "$GOTCHAS_FILE.tmp" 2>/dev/null && mv "$GOTCHAS_FILE.tmp" "$GOTCHAS_FILE"
|
|
144
|
+
else
|
|
145
|
+
# Add new entry
|
|
146
|
+
jq --arg pat "$PATTERN" \
|
|
147
|
+
--arg full "$ERROR_LINE" \
|
|
148
|
+
--arg cat "$CATEGORY" \
|
|
149
|
+
--arg tool "$TOOL_NAME" \
|
|
150
|
+
--arg now "$NOW" \
|
|
151
|
+
--arg proj "$PROJECT" \
|
|
152
|
+
--arg sug "$SUGGESTION" \
|
|
153
|
+
'. += [{
|
|
154
|
+
"pattern": $pat,
|
|
155
|
+
"full_pattern": ($full | .[0:500]),
|
|
156
|
+
"category": $cat,
|
|
157
|
+
"tool": $tool,
|
|
158
|
+
"count": 1,
|
|
159
|
+
"first_seen": $now,
|
|
160
|
+
"last_seen": $now,
|
|
161
|
+
"projects": (if $proj != "" then [$proj] else [] end),
|
|
162
|
+
"suggestion": (if $sug != "" then $sug else null end)
|
|
163
|
+
}]' \
|
|
164
|
+
"$GOTCHAS_FILE" > "$GOTCHAS_FILE.tmp" 2>/dev/null && mv "$GOTCHAS_FILE.tmp" "$GOTCHAS_FILE"
|
|
165
|
+
fi
|
|
166
|
+
|
|
167
|
+
# Keep top 100 sorted by count
|
|
168
|
+
jq 'sort_by(-.count) | .[0:100]' "$GOTCHAS_FILE" > "$GOTCHAS_FILE.tmp" 2>/dev/null && \
|
|
169
|
+
mv "$GOTCHAS_FILE.tmp" "$GOTCHAS_FILE"
|
|
170
|
+
|
|
171
|
+
) 200>"$LOCK_FILE"
|
|
172
|
+
|
|
173
|
+
# ─── Log Metrics ─────────────────────────────────────────────────────────
|
|
174
|
+
_DURATION_MS=$(_hook_ms)
|
|
175
|
+
METRICS_FILE="$HOME/.arka-os/hook-metrics.json"
|
|
176
|
+
METRICS_LOCK="$HOME/.arka-os/hook-metrics.lock"
|
|
177
|
+
mkdir -p "$HOME/.arka-os"
|
|
178
|
+
(
|
|
179
|
+
if command -v flock &>/dev/null; then flock -w 2 200; else true; fi
|
|
180
|
+
[ ! -f "$METRICS_FILE" ] && echo '[]' > "$METRICS_FILE"
|
|
181
|
+
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
182
|
+
jq --argjson dur "$_DURATION_MS" --arg ts "$NOW" --arg hook "post-tool-use" \
|
|
183
|
+
'. += [{"hook": $hook, "duration_ms": $dur, "timestamp": $ts}] | .[-500:]' \
|
|
184
|
+
"$METRICS_FILE" > "$METRICS_FILE.tmp" 2>/dev/null && mv "$METRICS_FILE.tmp" "$METRICS_FILE"
|
|
185
|
+
) 200>"$METRICS_LOCK" 2>/dev/null
|
|
186
|
+
|
|
187
|
+
# Silent output — no context injection needed from PostToolUse
|
|
188
|
+
echo '{}'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# ArkaOS v2 — PreCompact Hook (Session Digest Preservation)
|
|
4
|
+
# Saves session context before compaction to prevent loss
|
|
5
|
+
# Timeout: 30s
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
ARKAOS_HOME="${HOME}/.arkaos"
|
|
11
|
+
DIGEST_DIR="$ARKAOS_HOME/session-digests"
|
|
12
|
+
|
|
13
|
+
mkdir -p "$DIGEST_DIR" 2>/dev/null
|
|
14
|
+
|
|
15
|
+
# ─── Extract session data ────────────────────────────────────────────────
|
|
16
|
+
timestamp=$(date +"%Y%m%d-%H%M%S")
|
|
17
|
+
short_id=$(echo "$timestamp" | md5sum 2>/dev/null | head -c 8 || echo "$RANDOM")
|
|
18
|
+
digest_file="$DIGEST_DIR/${timestamp}-${short_id}.md"
|
|
19
|
+
|
|
20
|
+
# ─── Save digest ─────────────────────────────────────────────────────────
|
|
21
|
+
{
|
|
22
|
+
echo "# Session Digest — $timestamp"
|
|
23
|
+
echo ""
|
|
24
|
+
echo "## Last Context (before compaction)"
|
|
25
|
+
echo ""
|
|
26
|
+
|
|
27
|
+
if command -v jq &>/dev/null; then
|
|
28
|
+
# Extract transcript lines
|
|
29
|
+
echo "$input" | jq -r '.transcript // ""' 2>/dev/null | tail -50
|
|
30
|
+
echo ""
|
|
31
|
+
echo "## Last Assistant Messages"
|
|
32
|
+
echo ""
|
|
33
|
+
echo "$input" | jq -r '.messages[]? | select(.role == "assistant") | .content' 2>/dev/null | tail -c 5000
|
|
34
|
+
else
|
|
35
|
+
echo "$input" | tail -100
|
|
36
|
+
fi
|
|
37
|
+
} > "$digest_file" 2>/dev/null
|
|
38
|
+
|
|
39
|
+
# ─── Cleanup: keep only last 50 digests ──────────────────────────────────
|
|
40
|
+
digest_count=$(ls -1 "$DIGEST_DIR"/*.md 2>/dev/null | wc -l)
|
|
41
|
+
if [ "$digest_count" -gt 50 ]; then
|
|
42
|
+
ls -1t "$DIGEST_DIR"/*.md | tail -n +51 | xargs rm -f 2>/dev/null
|
|
43
|
+
fi
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# ARKA OS — PreCompact Hook
|
|
4
|
+
# Saves session digest before context compaction
|
|
5
|
+
# Timeout: 30s | No LLM analysis — raw context preservation
|
|
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
|
+
SESSION_ID=$(echo "$input" | jq -r '.session_id // "unknown"' 2>/dev/null)
|
|
24
|
+
TRANSCRIPT=$(echo "$input" | jq -r '.transcript // ""' 2>/dev/null)
|
|
25
|
+
|
|
26
|
+
# ─── Setup ────────────────────────────────────────────────────────────────
|
|
27
|
+
DIGEST_DIR="$HOME/.arka-os/session-digests"
|
|
28
|
+
mkdir -p "$DIGEST_DIR"
|
|
29
|
+
|
|
30
|
+
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
|
31
|
+
SHORT_ID=$(echo "$SESSION_ID" | head -c 8)
|
|
32
|
+
DIGEST_FILE="${DIGEST_DIR}/${TIMESTAMP}-${SHORT_ID}.md"
|
|
33
|
+
|
|
34
|
+
# ─── Extract Context ──────────────────────────────────────────────────────
|
|
35
|
+
# Get last 50 lines of transcript
|
|
36
|
+
if [ -n "$TRANSCRIPT" ]; then
|
|
37
|
+
TAIL_LINES=$(echo "$TRANSCRIPT" | tail -50)
|
|
38
|
+
else
|
|
39
|
+
TAIL_LINES="(no transcript available)"
|
|
40
|
+
fi
|
|
41
|
+
|
|
42
|
+
# Extract last 5 assistant messages from JSON if available
|
|
43
|
+
ASSISTANT_MSGS=""
|
|
44
|
+
if echo "$input" | jq -e '.messages' &>/dev/null; then
|
|
45
|
+
ASSISTANT_MSGS=$(echo "$input" | jq -r '
|
|
46
|
+
[.messages[] | select(.role == "assistant") | .content] | last(5) | .[] // empty
|
|
47
|
+
' 2>/dev/null)
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# ─── Write Digest ─────────────────────────────────────────────────────────
|
|
51
|
+
cat > "$DIGEST_FILE" << DIGEST_EOF
|
|
52
|
+
---
|
|
53
|
+
type: session-digest
|
|
54
|
+
session_id: ${SESSION_ID}
|
|
55
|
+
timestamp: ${TIMESTAMP}
|
|
56
|
+
trigger: pre-compact
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
# Session Digest — ${TIMESTAMP}
|
|
60
|
+
|
|
61
|
+
**Session:** \`${SESSION_ID}\`
|
|
62
|
+
**Saved at:** $(date '+%Y-%m-%d %H:%M:%S')
|
|
63
|
+
**Trigger:** Context compaction
|
|
64
|
+
|
|
65
|
+
## Last Assistant Messages
|
|
66
|
+
|
|
67
|
+
${ASSISTANT_MSGS:-_(none captured)_}
|
|
68
|
+
|
|
69
|
+
## Transcript Tail (last 50 lines)
|
|
70
|
+
|
|
71
|
+
\`\`\`
|
|
72
|
+
${TAIL_LINES}
|
|
73
|
+
\`\`\`
|
|
74
|
+
DIGEST_EOF
|
|
75
|
+
|
|
76
|
+
# ─── Auto-Cleanup: Keep Only Last 50 Digests ─────────────────────────────
|
|
77
|
+
DIGEST_COUNT=$(ls -1 "$DIGEST_DIR"/*.md 2>/dev/null | wc -l | tr -d ' ')
|
|
78
|
+
if [ "$DIGEST_COUNT" -gt 50 ]; then
|
|
79
|
+
REMOVE_COUNT=$((DIGEST_COUNT - 50))
|
|
80
|
+
ls -1t "$DIGEST_DIR"/*.md | tail -"$REMOVE_COUNT" | xargs rm -f 2>/dev/null
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
# ─── Log Metrics ─────────────────────────────────────────────────────────
|
|
84
|
+
_DURATION_MS=$(_hook_ms)
|
|
85
|
+
METRICS_FILE="$HOME/.arka-os/hook-metrics.json"
|
|
86
|
+
METRICS_LOCK="$HOME/.arka-os/hook-metrics.lock"
|
|
87
|
+
mkdir -p "$HOME/.arka-os"
|
|
88
|
+
(
|
|
89
|
+
if command -v flock &>/dev/null; then flock -w 2 200; else true; fi
|
|
90
|
+
[ ! -f "$METRICS_FILE" ] && echo '[]' > "$METRICS_FILE"
|
|
91
|
+
NOW=$(date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
92
|
+
jq --argjson dur "$_DURATION_MS" --arg ts "$NOW" --arg hook "pre-compact" \
|
|
93
|
+
'. += [{"hook": $hook, "duration_ms": $dur, "timestamp": $ts}] | .[-500:]' \
|
|
94
|
+
"$METRICS_FILE" > "$METRICS_FILE.tmp" 2>/dev/null && mv "$METRICS_FILE.tmp" "$METRICS_FILE"
|
|
95
|
+
) 200>"$METRICS_LOCK" 2>/dev/null
|
|
96
|
+
|
|
97
|
+
# ─── Output ───────────────────────────────────────────────────────────────
|
|
98
|
+
# Silent — no output needed for PreCompact hook
|
|
99
|
+
echo '{}'
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# ============================================================================
|
|
3
|
+
# ArkaOS v2 — UserPromptSubmit Hook (Synapse v2 Bridge)
|
|
4
|
+
# Calls Python Synapse engine for 8-layer context injection
|
|
5
|
+
# Timeout: 10s | Output: JSON to stdout | Target: <100ms
|
|
6
|
+
# ============================================================================
|
|
7
|
+
|
|
8
|
+
input=$(cat)
|
|
9
|
+
|
|
10
|
+
# ─── Performance Timing ──────────────────────────────────────────────────
|
|
11
|
+
_HOOK_START_NS=$(date +%s%N 2>/dev/null || echo "0")
|
|
12
|
+
_hook_ms() {
|
|
13
|
+
local end_ns=$(date +%s%N 2>/dev/null || echo "0")
|
|
14
|
+
if [ "$_HOOK_START_NS" != "0" ] && [ "$end_ns" != "0" ] && [ ${#end_ns} -gt 10 ]; then
|
|
15
|
+
echo $(( (end_ns - _HOOK_START_NS) / 1000000 ))
|
|
16
|
+
else
|
|
17
|
+
echo "0"
|
|
18
|
+
fi
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
# ─── Paths ───────────────────────────────────────────────────────────────
|
|
22
|
+
ARKAOS_ROOT="${ARKA_OS:-$HOME/.claude/skills/arkaos}"
|
|
23
|
+
CACHE_DIR="/tmp/arkaos-context-cache"
|
|
24
|
+
CACHE_TTL=300 # Constitution cache: 5 minutes
|
|
25
|
+
|
|
26
|
+
mkdir -p "$CACHE_DIR" 2>/dev/null
|
|
27
|
+
|
|
28
|
+
# ─── Extract user input from hook JSON ───────────────────────────────────
|
|
29
|
+
user_input=""
|
|
30
|
+
if command -v jq &>/dev/null; then
|
|
31
|
+
user_input=$(echo "$input" | jq -r '.userInput // .message // ""' 2>/dev/null)
|
|
32
|
+
fi
|
|
33
|
+
# Fallback: try to get the raw text
|
|
34
|
+
if [ -z "$user_input" ]; then
|
|
35
|
+
user_input=$(echo "$input" | head -c 2000)
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# ─── Try Python Synapse engine first ─────────────────────────────────────
|
|
39
|
+
python_result=""
|
|
40
|
+
if command -v python3 &>/dev/null; then
|
|
41
|
+
python_result=$(python3 -c "
|
|
42
|
+
import sys, os
|
|
43
|
+
sys.path.insert(0, '${ARKAOS_ROOT}')
|
|
44
|
+
try:
|
|
45
|
+
from core.synapse.engine import create_default_engine
|
|
46
|
+
from core.synapse.layers import PromptContext
|
|
47
|
+
from core.governance.constitution import load_constitution
|
|
48
|
+
import subprocess
|
|
49
|
+
|
|
50
|
+
# Load constitution for L0
|
|
51
|
+
const_path = '${ARKAOS_ROOT}/config/constitution.yaml'
|
|
52
|
+
compressed = ''
|
|
53
|
+
if os.path.exists(const_path):
|
|
54
|
+
c = load_constitution(const_path)
|
|
55
|
+
compressed = c.compress_for_context()
|
|
56
|
+
|
|
57
|
+
# Detect git branch
|
|
58
|
+
branch = ''
|
|
59
|
+
try:
|
|
60
|
+
branch = subprocess.run(['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
|
|
61
|
+
capture_output=True, text=True, timeout=2).stdout.strip()
|
|
62
|
+
except Exception:
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
# Create engine and inject
|
|
66
|
+
engine = create_default_engine(constitution_compressed=compressed)
|
|
67
|
+
ctx = PromptContext(
|
|
68
|
+
user_input='''${user_input}''',
|
|
69
|
+
cwd=os.getcwd(),
|
|
70
|
+
git_branch=branch,
|
|
71
|
+
)
|
|
72
|
+
result = engine.inject(ctx)
|
|
73
|
+
print(result.context_string)
|
|
74
|
+
except Exception as e:
|
|
75
|
+
print(f'[arkaos:error] {e}', file=sys.stderr)
|
|
76
|
+
print('')
|
|
77
|
+
" 2>/dev/null)
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
# ─── Fallback: Bash-only context (if Python unavailable) ────────────────
|
|
81
|
+
if [ -z "$python_result" ]; then
|
|
82
|
+
# L0: Constitution (cached)
|
|
83
|
+
L0=""
|
|
84
|
+
L0_CACHE="$CACHE_DIR/l0-constitution"
|
|
85
|
+
if [ -f "$L0_CACHE" ] && [ $(($(date +%s) - $(stat -f%m "$L0_CACHE" 2>/dev/null || stat -c%Y "$L0_CACHE" 2>/dev/null || echo 0))) -lt $CACHE_TTL ]; then
|
|
86
|
+
L0=$(cat "$L0_CACHE")
|
|
87
|
+
else
|
|
88
|
+
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"
|
|
89
|
+
echo "$L0" > "$L0_CACHE" 2>/dev/null
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# L4: Git branch
|
|
93
|
+
L4=""
|
|
94
|
+
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
|
|
95
|
+
if [ -n "$branch" ] && [ "$branch" != "main" ] && [ "$branch" != "master" ] && [ "$branch" != "dev" ]; then
|
|
96
|
+
L4="[branch:$branch]"
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
# L7: Time
|
|
100
|
+
hour=$(date +%H)
|
|
101
|
+
if [ "$hour" -ge 5 ] && [ "$hour" -lt 12 ]; then
|
|
102
|
+
L7="[time:morning]"
|
|
103
|
+
elif [ "$hour" -ge 12 ] && [ "$hour" -lt 18 ]; then
|
|
104
|
+
L7="[time:afternoon]"
|
|
105
|
+
else
|
|
106
|
+
L7="[time:evening]"
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
python_result="$L0 $L4 $L7"
|
|
110
|
+
fi
|
|
111
|
+
|
|
112
|
+
# ─── Output ──────────────────────────────────────────────────────────────
|
|
113
|
+
echo "{\"additionalContext\": \"$python_result\"}"
|
|
114
|
+
|
|
115
|
+
# ─── Metrics ─────────────────────────────────────────────────────────────
|
|
116
|
+
elapsed=$(_hook_ms)
|
|
117
|
+
if [ "$elapsed" -gt 0 ] 2>/dev/null; then
|
|
118
|
+
echo "{\"hook\":\"user-prompt-submit-v2\",\"ms\":$elapsed}" >> "$CACHE_DIR/hook-metrics.jsonl" 2>/dev/null
|
|
119
|
+
fi
|