Skip to content

foryourhealth111-pixel/Vibe-Skills

Vibe Code Orchestrator (VCO) is a governed runtime entry that freezes requirements, bounds execution, and enforces verification and phase cleanup.

FileKindSize
SKILL.mdskill md17.2 KB
agents/templates/debugger.mdmarkdown323 B
agents/templates/planner.mdmarkdown313 B
agents/templates/reviewer.mdmarkdown331 B
agents/templates/security-reviewer.mdmarkdown341 B
references/change-proof-matrix.mdmarkdown2.6 KB
references/contributor-zone-decision-table.mdmarkdown2.2 KB
references/developer-entry-contract.mdmarkdown2.7 KB
references/fixtures/external-corpus/external-corpus-gate.jsonconfig8.6 KB
references/fixtures/external-corpus/prompt-signals.jsonconfig412.4 KB
references/fixtures/external-corpus/skill-keyword-index.backup.jsonconfig30.6 KB
references/fixtures/external-corpus/skill-keyword-index.candidate.jsonconfig26.5 KB
references/fixtures/external-corpus/vco-suggestions.jsonconfig16.6 KB
references/fixtures/migration-map.jsonconfig7.8 KB
references/fixtures/retro-compare/safety-gate/baseline-cer.jsonconfig294 B
references/fixtures/retro-compare/safety-gate/current-cer.jsonconfig1.1 KB
references/fixtures/retro-compare/safety-gate/delta.jsonconfig1.0 KB
references/fixtures/retro-compare/sample-run/baseline-cer.jsonconfig324 B
references/fixtures/retro-compare/sample-run/current-cer.jsonconfig1.2 KB
references/fixtures/retro-compare/sample-run/delta.jsonconfig1.0 KB
references/fixtures/retro-compare/smoke/baseline-smoke.jsonconfig266 B
references/fixtures/retro-compare/smoke/current-smoke.jsonconfig1.0 KB
references/fixtures/retro-compare/smoke/delta-smoke.jsonconfig1.0 KB
references/fixtures/runtime/vibe-sessions/20260413T131910Z-pr153-rabbit-review-fix/cleanup-receipt.jsonconfig1.3 KB
references/fixtures/runtime/vibe-sessions/20260413T131910Z-pr153-rabbit-review-fix/governance-capsule.jsonconfig408 B
references/fixtures/runtime/vibe-sessions/20260413T131910Z-pr153-rabbit-review-fix/intent-contract.jsonconfig2.2 KB
references/fixtures/runtime/vibe-sessions/20260413T131910Z-pr153-rabbit-review-fix/phase-plan-execute.jsonconfig2.4 KB
references/fixtures/runtime/vibe-sessions/20260413T131910Z-pr153-rabbit-review-fix/skeleton-receipt.jsonconfig722 B
references/fixtures/runtime/vibe-sessions/20260413T131910Z-pr153-rabbit-review-fix/stage-lineage.jsonconfig1.3 KB
references/fixtures/skills-audit/bio-science-problem/bio-science-problem-map.csvother9.2 KB
references/fixtures/skills-audit/bio-science-problem/bio-science-problem-map.jsonconfig18.1 KB
references/fixtures/verify/routing-stability/vibe-routing-stability-gate.jsonconfig24.4 KB
references/index.mdmarkdown1.3 KB
references/proof-bundles/claude-code-managed-closure-candidate/linux-managed-run-01-local-host/installed-runtime-outputs/runtime-freshness-receipt.jsonconfig262 B
references/proof-bundles/claude-code-managed-closure-candidate/manifest.jsonconfig2.6 KB
references/proof-bundles/linux-full-authoritative-candidate/linux-pwsh-run-01-wsl/installed-runtime-outputs/runtime-freshness-receipt.jsonconfig298 B
references/proof-bundles/linux-full-authoritative-candidate/linux-pwsh-run-02-docker/installed-runtime-outputs/runtime-freshness-receipt.jsonconfig298 B
references/proof-bundles/linux-full-authoritative-candidate/manifest.jsonconfig3.3 KB
references/proof-bundles/openclaw-runtime-core-preview-candidate/manifest.jsonconfig1.9 KB
references/release-ledger.jsonlother5.1 KB
scripts/README.mdmarkdown1.7 KB
scripts/bootstrap/one-shot-setup.ps1script797 B
scripts/bootstrap/one-shot-setup.shscript482 B
scripts/bootstrap/scaffold-claude-preview.ps1script875 B
scripts/bootstrap/scaffold-claude-preview.shexecutablescript866 B
scripts/bootstrap/sync-local-compat.ps1script2.6 KB
scripts/common/AntiProxyGoalDrift.ps1script15.1 KB
scripts/common/NodeLaunchWrapper.ps1script13.1 KB
scripts/common/ProcessLedger.ps1script27.1 KB
scripts/common/ProtectedDocumentCleanup.ps1script6.9 KB
scripts/common/README.mdmarkdown1.9 KB
scripts/common/Resolve-VgoAdapter.ps1script4.3 KB
scripts/common/adapter_registry_query.pyexecutablescript3.8 KB
scripts/common/python_helpers.shscript2.8 KB
scripts/common/resolve_vgo_adapter.pyexecutablescript2.4 KB
scripts/common/runtime_contracts.pyscript3.7 KB
scripts/common/vibe-governance-helpers.ps1script75.6 KB
scripts/common/vibe-wave-gate-runner.ps1script28.3 KB
scripts/governance/Invoke-NodeProcessAudit.ps1script3.6 KB
scripts/governance/Invoke-NodeZombieCleanup.ps1script3.7 KB
scripts/governance/README.mdmarkdown5.1 KB
scripts/governance/audit-upstream.ps1script22.7 KB
scripts/governance/export-repo-cleanliness-inventory.ps1script8.6 KB
scripts/governance/install-local-worktree-excludes.ps1script2.0 KB
scripts/governance/invoke-mem0-policy.ps1script1.0 KB
scripts/governance/invoke-openspec-governance.ps1script8.6 KB
scripts/governance/new-origin-record.ps1script3.3 KB
scripts/governance/phase-end-cleanup.ps1script10.7 KB
scripts/governance/publish-absorption-soft-rollout.ps1script3.2 KB
scripts/governance/publish-openspec-soft-rollout.ps1script9.3 KB
scripts/governance/release-cut.ps1script25.1 KB
scripts/governance/set-gsd-overlay-rollout.ps1script3.9 KB
scripts/governance/set-openspec-rollout.ps1script3.1 KB
scripts/governance/sync-bundled-vibe.ps1script20.3 KB
scripts/install/Install-VgoAdapter.ps1script2.0 KB
scripts/install/install_vgo_adapter.pyexecutablescript524 B
scripts/overlay/README.mdmarkdown885 B
scripts/overlay/suggest-browserops-provider.ps1script9.3 KB
scripts/overlay/suggest-overlays.ps1script17.3 KB
scripts/release/build_release_bundle.pyscript6.5 KB
scripts/research/README.mdmarkdown1.1 KB
scripts/research/build-eval-slicing-catalog.ps1script2.6 KB
scripts/research/build-watch-portfolio-review.ps1script3.5 KB
scripts/research/build-xl-operator-checklist.ps1script2.3 KB
scripts/research/extract-prompt-signals.ps1script6.7 KB
scripts/research/generate-vco-suggestions.ps1script9.7 KB
scripts/research/sync-mcp-catalog.ps1script3.5 KB
scripts/research/vibe-adaptive-train.ps1script10.1 KB
scripts/router/README.mdmarkdown1.8 KB
scripts/router/invoke-pack-route.pyscript428 B
scripts/router/modules/00-core-utils.ps1script14.6 KB
scripts/router/modules/01-openai-responses.ps1script17.9 KB
scripts/router/modules/10-observability.ps1script11.7 KB
scripts/router/modules/11-route-probe.ps1script20.7 KB
scripts/router/modules/12-heartbeat.ps1script19.9 KB
scripts/router/modules/19-custom-admission.ps1script16.3 KB
scripts/router/modules/20-routing-rules.ps1script1.7 KB
scripts/router/modules/21-capability-interview.ps1script11.8 KB
scripts/router/modules/22-intent-contract.ps1script18.2 KB
scripts/router/modules/30-openspec.ps1script8.3 KB
scripts/router/modules/31-gsd-overlay.ps1script5.5 KB
scripts/router/modules/32-prompt-overlay.ps1script8.0 KB
scripts/router/modules/33-memory-governance.ps1script5.5 KB
scripts/router/modules/34-data-scale-overlay.ps1script25.8 KB
scripts/router/modules/35-quality-debt-overlay.ps1script13.4 KB
scripts/router/modules/36-framework-interop-overlay.ps1script16.9 KB
scripts/router/modules/37-ml-lifecycle-overlay.ps1script22.4 KB
scripts/router/modules/38-python-clean-code-overlay.ps1script16.2 KB
scripts/router/modules/39-system-design-overlay.ps1script15.5 KB
scripts/router/modules/40-cuda-kernel-overlay.ps1script17.7 KB
scripts/router/modules/42-ai-rerank-overlay.ps1script14.0 KB
scripts/router/modules/43-retrieval-overlay.ps1script22.4 KB
scripts/router/modules/44-dialectic-team-gate.ps1script7.5 KB
scripts/router/modules/44-exploration-overlay.ps1script17.7 KB
scripts/router/modules/45-daily-dialectic-guard.ps1script6.6 KB
scripts/router/modules/47-closure-overlay.ps1script9.2 KB
scripts/router/modules/48-llm-acceleration-overlay.ps1script104.6 KB
scripts/router/modules/49-prompt-asset-boost.ps1script28.3 KB
scripts/router/resolve-pack-route.ps1script4.1 KB
scripts/router/runtime_neutral/custom_admission.pyscript349 B
scripts/router/runtime_neutral/router_contract.pyscript356 B
scripts/ruc-nlpir/preflight.ps1script5.3 KB
scripts/runtime/Freeze-RuntimeInputPacket.ps1script33.0 KB
scripts/runtime/Invoke-AntiProxyGoalDriftCompaction.ps1script551 B
scripts/runtime/Invoke-DeepInterview.ps1script1.1 KB
scripts/runtime/Invoke-PhaseCleanup.ps1script11.1 KB
scripts/runtime/Invoke-PlanExecute.ps1script13.7 KB
scripts/runtime/Invoke-SkeletonCheck.ps1script3.1 KB
scripts/runtime/Invoke-VibeCanonicalEntry.ps1script12.9 KB
scripts/runtime/VibeMemoryActivation.Common.ps1script41.3 KB
scripts/runtime/VibeMemoryBackends.Common.ps1script12.4 KB
scripts/runtime/VibeRuntime.Common.ps1script298.6 KB
scripts/runtime/VibeSkillRouting.Common.ps1script19.0 KB
scripts/runtime/VibeWorkspaceMemory.Common.ps1script6.9 KB
scripts/runtime/Write-RequirementDoc.ps1script23.7 KB
scripts/runtime/Write-XlPlan.ps1script32.3 KB
scripts/runtime/invoke-vibe-runtime.ps1script69.7 KB
scripts/runtime/memory_backend_driver.pyscript14.2 KB
scripts/runtime/skill_authority_driver.pyscript375 B
scripts/runtime/workspace_memory_driver.pyscript24.8 KB
scripts/setup/check-kvm-host-readiness.shscript3.4 KB
scripts/setup/check-windows-eval-iso-readiness.shexecutablescript2.2 KB
scripts/setup/check-windows-proof-vm-state.shexecutablescript2.0 KB
scripts/setup/export-codex-settings-sanitized.ps1script2.6 KB
scripts/setup/fetch-windows11-eval-iso.shexecutablescript4.1 KB
scripts/setup/install-local-vm-host.shexecutablescript1.6 KB
scripts/setup/persist-codex-openai-env.ps1script2.4 KB
scripts/setup/run-windows-proof-vm.shexecutablescript11.4 KB
scripts/setup/send-qmp-boot-keys.pyexecutablescript3.0 KB
scripts/setup/send-qmp-text.pyexecutablescript3.0 KB
scripts/setup/show-windows-proof-media-options.shexecutablescript1.6 KB
scripts/setup/stop-windows-proof-vm.shexecutablescript1.6 KB
scripts/setup/sync-codex-settings-to-user-env.ps1script2.6 KB
scripts/uninstall/Uninstall-VgoAdapter.ps1script1.4 KB
scripts/uninstall/uninstall_vgo_adapter.pyscript526 B
scripts/verify/README.mdmarkdown3.8 KB
scripts/verify/cer-compare.ps1script8.5 KB
scripts/verify/fixtures/README.mdmarkdown1.1 KB
scripts/verify/fixtures/document-cleanup-safety/README.mdmarkdown527 B
scripts/verify/fixtures/document-cleanup-safety/ambiguous-cn-set/metadata.jsonconfig101 B
scripts/verify/fixtures/document-cleanup-safety/ambiguous-cn-set/source/.tmp/docs/重庆市永川区技术预见与制度创新项目申报书1-修订版.docxbinary56 B
scripts/verify/fixtures/document-cleanup-safety/ambiguous-cn-set/source/.tmp/docs/重庆市永川区技术预见与制度创新项目申报书1-补充材料.pdfbinary56 B
scripts/verify/fixtures/document-cleanup-safety/ambiguous-cn-set/source/docs/重庆市永川区技术预见与制度创新项目申报书1-正式版.docxbinary36 B
scripts/verify/fixtures/document-cleanup-safety/mixed-office-assets/metadata.jsonconfig101 B
scripts/verify/fixtures/document-cleanup-safety/mixed-office-assets/source/.tmp/staging/budget-review.xlsxbinary59 B
scripts/verify/fixtures/document-cleanup-safety/mixed-office-assets/source/.tmp/staging/quarterly-review-deck.pptxbinary60 B
scripts/verify/fixtures/document-cleanup-safety/mixed-office-assets/source/docs/reference-manual.pdfbinary21 B
scripts/verify/fixtures/document-cleanup-safety/non-protected-control/metadata.jsonconfig101 B
scripts/verify/fixtures/document-cleanup-safety/non-protected-control/source/.tmp/control.txtmarkdown54 B
scripts/verify/fixtures/llm-acceleration.mock.jsonconfig1.0 KB
scripts/verify/fixtures/pilot-browserops.jsonconfig541 B
scripts/verify/fixtures/pilot-deep-extraction.jsonconfig731 B
scripts/verify/fixtures/pilot-desktopops.jsonconfig587 B
scripts/verify/fixtures/pilot-memory.jsonconfig575 B
scripts/verify/fixtures/pilot-prompt.jsonconfig525 B
scripts/verify/fixtures/process-health/external-node-protected-fixture.jsonconfig345 B
scripts/verify/fixtures/process-health/healthy-managed-fixture.jsonconfig1.1 KB
scripts/verify/fixtures/process-health/managed-completed-alive-fixture.jsonconfig1.2 KB
scripts/verify/fixtures/process-health/managed-stale-fixture.jsonconfig1.1 KB
scripts/verify/fixtures/process-health/no-node-processes-fixture.jsonconfig131 B
scripts/verify/fixtures/prompt-asset-boost.mock.jsonconfig1.2 KB
scripts/verify/gate-family-index.mdmarkdown2.5 KB
scripts/verify/lib/VibeOfflineSkillsAudit.Suites.ps1script11.8 KB
scripts/verify/lib/VibeOfflineSkillsAudit.ps1script12.2 KB
scripts/verify/lib/VibeRouteAudit.Suites.ps1script7.9 KB
scripts/verify/lib/VibeRouteAudit.ps1script5.2 KB
scripts/verify/live-document-gate.pyscript7.6 KB
scripts/verify/probe-scientific-packs.ps1script55.1 KB
scripts/verify/publish-proof.pyscript409 B
scripts/verify/runtime_neutral/README.mdmarkdown2.5 KB
scripts/verify/runtime_neutral/_bootstrap.pyscript321 B
scripts/verify/runtime_neutral/bio_science_pack_consolidation_audit.pyscript421 B
scripts/verify/runtime_neutral/bootstrap_doctor.pyscript494 B
scripts/verify/runtime_neutral/code_quality_pack_consolidation_audit.pyscript717 B
scripts/verify/runtime_neutral/coherence_gate.pyscript529 B
scripts/verify/runtime_neutral/freshness_gate.pyscript494 B
scripts/verify/runtime_neutral/global_pack_consolidation_audit.pyscript635 B
scripts/verify/runtime_neutral/ml_skills_pruning_audit.pyscript574 B
scripts/verify/runtime_neutral/opencode_preview_smoke.pyscript674 B
scripts/verify/runtime_neutral/release_notes_quality.pyscript701 B

scripts/router/modules/37-ml-lifecycle-overlay.ps1

View on GitHub
# Auto-extracted router module. Keep function bodies behavior-identical.

function Get-MlLifecycleOverlayAdvice {
    param(
        [string]$Prompt,
        [string]$PromptLower,
        [string]$Grade,
        [string]$TaskType,
        [string]$RouteMode,
        [string]$SelectedPackId,
        [string]$SelectedSkill,
        [string[]]$PackCandidates,
        [object]$MlLifecycleOverlayPolicy
    )

    if (-not $MlLifecycleOverlayPolicy) {
        return [pscustomobject]@{
            enabled = $false
            mode = "off"
            task_applicable = $false
            grade_applicable = $false
            pack_applicable = $false
            skill_applicable = $false
            scope_applicable = $false
            enforcement = "none"
            reason = "policy_missing"
            preserve_routing_assignment = $true
            lifecycle_signal_score = 0.0
            lifecycle_likelihood = "none"
            lifecycle_keyword_hits = @()
            suppress_keyword_hits = @()
            stage_detected = "none"
            stage_scores = [pscustomobject]@{}
            stage_hits = [pscustomobject]@{}
            required_checks = @()
            artifacts_required = @()
            artifact_hits = [pscustomobject]@{}
            missing_artifacts = @()
            missing_artifact_ratio = 0.0
            deploy_readiness = "not_applicable"
            confirm_recommended = $false
            confirm_required = $false
            strict_scope_applied = $false
            should_apply_hook = $false
            recommended_followup = $null
            external_analyzer = [pscustomobject]@{
                enabled = $false
                command = $null
                invoke_mode = "disabled"
                status = "disabled"
                tool_available = $false
                should_invoke = $false
                invoked = $false
                manual_command_hint = $null
                output_excerpt = $null
                error = $null
            }
        }
    }

    $enabled = $true
    if ($MlLifecycleOverlayPolicy.enabled -ne $null) {
        $enabled = [bool]$MlLifecycleOverlayPolicy.enabled
    }

    $mode = if ($MlLifecycleOverlayPolicy.mode) { [string]$MlLifecycleOverlayPolicy.mode } else { "off" }
    if ((-not $enabled) -or ($mode -eq "off")) {
        return [pscustomobject]@{
            enabled = $false
            mode = "off"
            task_applicable = $false
            grade_applicable = $false
            pack_applicable = $false
            skill_applicable = $false
            scope_applicable = $false
            enforcement = "none"
            reason = "policy_off"
            preserve_routing_assignment = $true
            lifecycle_signal_score = 0.0
            lifecycle_likelihood = "none"
            lifecycle_keyword_hits = @()
            suppress_keyword_hits = @()
            stage_detected = "none"
            stage_scores = [pscustomobject]@{}
            stage_hits = [pscustomobject]@{}
            required_checks = @()
            artifacts_required = @()
            artifact_hits = [pscustomobject]@{}
            missing_artifacts = @()
            missing_artifact_ratio = 0.0
            deploy_readiness = "not_applicable"
            confirm_recommended = $false
            confirm_required = $false
            strict_scope_applied = $false
            should_apply_hook = $false
            recommended_followup = $null
            external_analyzer = [pscustomobject]@{
                enabled = $false
                command = $null
                invoke_mode = "disabled"
                status = "disabled"
                tool_available = $false
                should_invoke = $false
                invoked = $false
                manual_command_hint = $null
                output_excerpt = $null
                error = $null
            }
        }
    }

    $taskAllow = @("planning", "coding", "review", "research")
    if ($MlLifecycleOverlayPolicy.task_allow) {
        $taskAllow = @($MlLifecycleOverlayPolicy.task_allow)
    }

    $gradeAllow = @("M", "L", "XL")
    if ($MlLifecycleOverlayPolicy.grade_allow) {
        $gradeAllow = @($MlLifecycleOverlayPolicy.grade_allow)
    }

    $packAllow = @("data-ml", "ai-llm")
    $skillAllow = @()
    if ($MlLifecycleOverlayPolicy.monitor) {
        if ($MlLifecycleOverlayPolicy.monitor.pack_allow) {
            $packAllow = @($MlLifecycleOverlayPolicy.monitor.pack_allow)
        }
        if ($MlLifecycleOverlayPolicy.monitor.skill_allow) {
            $skillAllow = @($MlLifecycleOverlayPolicy.monitor.skill_allow)
        }
    }

    $taskApplicable = ($taskAllow -contains $TaskType)
    $gradeApplicable = ($gradeAllow -contains $Grade)
    $packApplicable = $true
    if ($packAllow.Count -gt 0) {
        $packApplicable = ($SelectedPackId -and ($packAllow -contains $SelectedPackId))
    }
    $skillApplicable = $true
    if ($skillAllow.Count -gt 0) {
        $skillApplicable = ($SelectedSkill -and ($skillAllow -contains $SelectedSkill))
    }
    $scopeApplicable = ($taskApplicable -and $gradeApplicable -and $packApplicable -and $skillApplicable)

    $preserveRoutingAssignment = $true
    if ($MlLifecycleOverlayPolicy.preserve_routing_assignment -ne $null) {
        $preserveRoutingAssignment = [bool]$MlLifecycleOverlayPolicy.preserve_routing_assignment
    }

    $lifecycleKeywords = @(
        "ml pipeline",
        "training pipeline",
        "model training",
        "model evaluation",
        "baseline compare",
        "experiment tracking",
        "model registry",
        "serve model",
        "deploy model",
        "canary rollout",
        "continual learning",
        "drift monitoring",
        "retraining",
        "机器学习流水线",
        "模型训练",
        "模型评估",
        "基线对比",
        "实验追踪",
        "模型注册",
        "模型部署",
        "持续学习",
        "漂移监控",
        "再训练"
    )
    if ($MlLifecycleOverlayPolicy.lifecycle_signal_keywords) {
        $lifecycleKeywords = @($MlLifecycleOverlayPolicy.lifecycle_signal_keywords)
    }

    $suppressKeywords = @(
        "math proof",
        "paper summary only",
        "just theory",
        "only concept",
        "仅概念",
        "只要理论",
        "论文总结"
    )
    if ($MlLifecycleOverlayPolicy.suppress_keywords) {
        $suppressKeywords = @($MlLifecycleOverlayPolicy.suppress_keywords)
    }

    $stageKeywordMap = [ordered]@{
        develop = @("feature engineering", "data preprocessing", "train model", "training pipeline", "训练", "特征工程")
        evaluate = @("evaluation", "metrics", "ablation", "baseline compare", "验证", "评估", "基线")
        deploy = @("deploy", "serve", "production", "canary", "api service", "上线", "部署", "服务化")
        iterate = @("drift", "monitoring", "feedback loop", "retraining", "continual learning", "漂移", "监控", "持续学习")
    }
    if ($MlLifecycleOverlayPolicy.stage_keywords) {
        $stageKeywordMap = [ordered]@{}
        foreach ($stageName in @($MlLifecycleOverlayPolicy.stage_keywords.PSObject.Properties.Name)) {
            $stageKeywordMap[[string]$stageName] = @($MlLifecycleOverlayPolicy.stage_keywords.$stageName)
        }
    }

    $artifactKeywordMap = [ordered]@{
        run_id = @("run_id", "run id", "mlflow run")
        evaluation_results = @("evaluation report", "evaluation_results", "metrics report", "评估报告")
        baseline_compare = @("baseline compare", "baseline comparison", "基线对比")
        data_tests = @("data tests", "great expectations", "数据校验")
        model_tests = @("model tests", "model validation", "模型测试")
        service_smoke = @("smoke test", "service smoke", "服务冒烟")
        monitoring_metrics = @("monitoring metrics", "drift dashboard", "监控指标")
        retraining_plan = @("retraining plan", "retrain policy", "再训练计划")
        dataset_version = @("dataset version", "data version", "数据版本")
    }
    if ($MlLifecycleOverlayPolicy.artifact_keywords) {
        $artifactKeywordMap = [ordered]@{}
        foreach ($artifactName in @($MlLifecycleOverlayPolicy.artifact_keywords.PSObject.Properties.Name)) {
            $artifactKeywordMap[[string]$artifactName] = @($MlLifecycleOverlayPolicy.artifact_keywords.$artifactName)
        }
    }

    $confirmSignalMin = 0.5
    $highSignalMin = 0.75
    $suppressWeight = 0.28
    $minLifecycleHitsForOverlay = 1
    $missingArtifactRatioForConfirm = 0.4
    if ($MlLifecycleOverlayPolicy.thresholds) {
        if ($MlLifecycleOverlayPolicy.thresholds.confirm_signal_score_min -ne $null) {
            $confirmSignalMin = [double]$MlLifecycleOverlayPolicy.thresholds.confirm_signal_score_min
        }
        if ($MlLifecycleOverlayPolicy.thresholds.high_signal_score_min -ne $null) {
            $highSignalMin = [double]$MlLifecycleOverlayPolicy.thresholds.high_signal_score_min
        }
        if ($MlLifecycleOverlayPolicy.thresholds.suppress_penalty_weight -ne $null) {
            $suppressWeight = [double]$MlLifecycleOverlayPolicy.thresholds.suppress_penalty_weight
        }
        if ($MlLifecycleOverlayPolicy.thresholds.min_lifecycle_hits_for_overlay -ne $null) {
            $minLifecycleHitsForOverlay = [int]$MlLifecycleOverlayPolicy.thresholds.min_lifecycle_hits_for_overlay
        }
        if ($MlLifecycleOverlayPolicy.thresholds.missing_artifact_ratio_for_confirm -ne $null) {
            $missingArtifactRatioForConfirm = [double]$MlLifecycleOverlayPolicy.thresholds.missing_artifact_ratio_for_confirm
        }
    }

    $signalMatches = @()
    foreach ($kw in $lifecycleKeywords) {
        if (Test-KeywordHit -PromptLower $PromptLower -Keyword ([string]$kw)) {
            $signalMatches += [string]$kw
        }
    }
    $suppressMatches = @()
    foreach ($kw in $suppressKeywords) {
        if (Test-KeywordHit -PromptLower $PromptLower -Keyword ([string]$kw)) {
            $suppressMatches += [string]$kw
        }
    }

    $signalRatio = Get-KeywordRatio -PromptLower $PromptLower -Keywords $lifecycleKeywords
    $suppressRatio = Get-KeywordRatio -PromptLower $PromptLower -Keywords $suppressKeywords
    $lifecycleScore = [Math]::Max(0.0, [Math]::Min(1.0, ($signalRatio - ($suppressWeight * $suppressRatio))))
    if ($signalMatches.Count -lt $minLifecycleHitsForOverlay) {
        $lifecycleScore = 0.0
    }

    $stageScoreMap = [ordered]@{}
    $stageHitMap = [ordered]@{}
    $stageSummary = @()
    foreach ($stageName in @($stageKeywordMap.Keys)) {
        $stageKeywords = @($stageKeywordMap[$stageName])
        $hits = @()
        foreach ($kw in $stageKeywords) {
            if (Test-KeywordHit -PromptLower $PromptLower -Keyword ([string]$kw)) {
                $hits += [string]$kw
            }
        }
        $score = Get-KeywordRatio -PromptLower $PromptLower -Keywords $stageKeywords
        $stageScoreMap[[string]$stageName] = [Math]::Round([double]$score, 4)
        $stageHitMap[[string]$stageName] = @($hits)
        $stageSummary += [pscustomobject]@{
            stage = [string]$stageName
            score = [double]$score
            hits = @($hits)
        }
    }

    $topStage = $stageSummary | Sort-Object -Property @(
        @{ Expression = "score"; Descending = $true },
        @{ Expression = "stage"; Descending = $false }
    ) | Select-Object -First 1
    $stageDetected = if ($topStage -and ([double]$topStage.score -gt 0.0)) { [string]$topStage.stage } else { "none" }

    $requiredChecksByStage = [ordered]@{
        develop = @("code_tests", "data_tests")
        evaluate = @("data_tests", "model_tests", "baseline_compare")
        deploy = @("code_tests", "data_tests", "model_tests", "baseline_compare", "service_smoke")
        iterate = @("monitoring_metrics", "drift_guard", "retraining_plan")
    }
    if ($MlLifecycleOverlayPolicy.required_checks_by_stage) {
        $requiredChecksByStage = [ordered]@{}
        foreach ($stageName in @($MlLifecycleOverlayPolicy.required_checks_by_stage.PSObject.Properties.Name)) {
            $requiredChecksByStage[[string]$stageName] = @($MlLifecycleOverlayPolicy.required_checks_by_stage.$stageName)
        }
    }

    $artifactsByStage = [ordered]@{
        develop = @("dataset_version")
        evaluate = @("run_id", "evaluation_results", "baseline_compare")
        deploy = @("run_id", "evaluation_results", "baseline_compare", "service_smoke")
        iterate = @("monitoring_metrics", "retraining_plan")
    }
    if ($MlLifecycleOverlayPolicy.artifacts_required_by_stage) {
        $artifactsByStage = [ordered]@{}
        foreach ($stageName in @($MlLifecycleOverlayPolicy.artifacts_required_by_stage.PSObject.Properties.Name)) {
            $artifactsByStage[[string]$stageName] = @($MlLifecycleOverlayPolicy.artifacts_required_by_stage.$stageName)
        }
    }

    $artifactHits = [ordered]@{}
    foreach ($artifactName in @($artifactKeywordMap.Keys)) {
        $hits = @()
        foreach ($kw in @($artifactKeywordMap[$artifactName])) {
            if (Test-KeywordHit -PromptLower $PromptLower -Keyword ([string]$kw)) {
                $hits += [string]$kw
            }
        }
        $artifactHits[[string]$artifactName] = @($hits)
    }

    $requiredChecks = @()
    $artifactsRequired = @()
    if ($stageDetected -ne "none") {
        if ($requiredChecksByStage.Contains($stageDetected)) {
            $requiredChecks = @($requiredChecksByStage[$stageDetected])
        }
        if ($artifactsByStage.Contains($stageDetected)) {
            $artifactsRequired = @($artifactsByStage[$stageDetected])
        }
    }

    $missingArtifacts = @()
    foreach ($artifactName in $artifactsRequired) {
        $hits = @()
        if ($artifactHits.Contains([string]$artifactName)) {
            $hits = @($artifactHits[[string]$artifactName])
        }
        if ($hits.Count -eq 0) {
            $missingArtifacts += [string]$artifactName
        }
    }
    $missingArtifactRatio = if ($artifactsRequired.Count -gt 0) {
        [double]$missingArtifacts.Count / [double]$artifactsRequired.Count
    } else {
        0.0
    }
    $missingArtifactRatio = [Math]::Round([Math]::Max(0.0, [Math]::Min(1.0, $missingArtifactRatio)), 4)

    $deployReadiness = "not_applicable"
    if ($scopeApplicable -and ($stageDetected -in @("evaluate", "deploy", "iterate"))) {
        if (($missingArtifacts.Count -eq 0) -and ($lifecycleScore -ge $confirmSignalMin)) {
            $deployReadiness = "ready"
        } elseif (($missingArtifacts.Count -gt 0) -and ($lifecycleScore -ge $confirmSignalMin)) {
            $deployReadiness = "needs_confirmation"
        } else {
            $deployReadiness = "blocked"
        }
    }

    $lifecycleLikelihood = "none"
    if ($lifecycleScore -ge $highSignalMin) {
        $lifecycleLikelihood = "high"
    } elseif ($lifecycleScore -ge $confirmSignalMin) {
        $lifecycleLikelihood = "medium"
    } elseif ($lifecycleScore -gt 0) {
        $lifecycleLikelihood = "low"
    }

    $confirmRecommended = (
        $scopeApplicable -and
        ($lifecycleScore -ge $confirmSignalMin) -and
        (
            ($stageDetected -in @("evaluate", "deploy", "iterate")) -or
            ($missingArtifactRatio -ge $missingArtifactRatioForConfirm)
        )
    )

    $strictGrades = @("L", "XL")
    $strictTasks = @("planning", "coding", "review")
    $strictStages = @("evaluate", "deploy", "iterate")
    if ($MlLifecycleOverlayPolicy.strict_confirm_scope) {
        if ($MlLifecycleOverlayPolicy.strict_confirm_scope.grades) {
            $strictGrades = @($MlLifecycleOverlayPolicy.strict_confirm_scope.grades)
        }
        if ($MlLifecycleOverlayPolicy.strict_confirm_scope.task_types) {
            $strictTasks = @($MlLifecycleOverlayPolicy.strict_confirm_scope.task_types)
        }
        if ($MlLifecycleOverlayPolicy.strict_confirm_scope.stages) {
            $strictStages = @($MlLifecycleOverlayPolicy.strict_confirm_scope.stages)
        }
    }
    $strictScopeApplied = (
        ($strictGrades -contains $Grade) -and
        ($strictTasks -contains $TaskType) -and
        ($strictStages -contains $stageDetected)
    )

    $confirmRequired = (
        $scopeApplicable -and
        ($mode -eq "strict") -and
        $strictScopeApplied -and
        ($lifecycleScore -ge $confirmSignalMin) -and
        ($missingArtifacts.Count -gt 0)
    )

    $enforcement = "none"
    $reason = "outside_scope"
    if ($scopeApplicable) {
        switch ($mode) {
            "shadow" {
                $enforcement = "advisory"
                $reason = "shadow_advisory"
            }
            "soft" {
                $enforcement = "advisory"
                if ($confirmRecommended) {
                    $reason = "soft_lifecycle_confirm_recommended"
                } else {
                    $reason = "soft_advisory"
                }
            }
            "strict" {
                if ($confirmRequired) {
                    $enforcement = "confirm_required"
                    $reason = "strict_missing_lifecycle_evidence"
                } else {
                    $enforcement = "advisory"
                    $reason = "strict_advisory"
                }
            }
            default {
                $enforcement = "advisory"
                $reason = "unknown_mode_advisory"
            }
        }
    }

    $recommendedFollowup = $null
    if ($scopeApplicable -and ($lifecycleScore -gt 0.0)) {
        switch ($stageDetected) {
            "develop" { $recommendedFollowup = "Establish dataset versioning and run code/data checks before broad model training." }
            "evaluate" { $recommendedFollowup = "Attach run_id + evaluation report + baseline comparison before approval." }
            "deploy" { $recommendedFollowup = "Complete deployment readiness package: run_id, evaluation, baseline, and service smoke evidence." }
            "iterate" { $recommendedFollowup = "Attach monitoring metrics and retraining policy to close the continual-learning loop." }
            default { $recommendedFollowup = "Use an ML lifecycle checklist (code/data/model tests + experiment artifacts) before handoff." }
        }
    }

    $externalEnabled = $false
    $externalCommand = $null
    $externalInvokeMode = "disabled"
    $externalRunModes = @("soft", "strict")
    $externalSignalMin = $confirmSignalMin
    $manualCommandHint = $null
    if ($MlLifecycleOverlayPolicy.external_analyzer) {
        if ($MlLifecycleOverlayPolicy.external_analyzer.enabled -ne $null) {
            $externalEnabled = [bool]$MlLifecycleOverlayPolicy.external_analyzer.enabled
        }
        if ($MlLifecycleOverlayPolicy.external_analyzer.command) {
            $externalCommand = [string]$MlLifecycleOverlayPolicy.external_analyzer.command
        }
        if ($MlLifecycleOverlayPolicy.external_analyzer.invoke_mode) {
            $externalInvokeMode = [string]$MlLifecycleOverlayPolicy.external_analyzer.invoke_mode
        } elseif ($externalEnabled) {
            $externalInvokeMode = "manual_only"
        }
        if ($MlLifecycleOverlayPolicy.external_analyzer.run_in_modes) {
            $externalRunModes = @($MlLifecycleOverlayPolicy.external_analyzer.run_in_modes)
        }
        if ($MlLifecycleOverlayPolicy.external_analyzer.signal_score_min -ne $null) {
            $externalSignalMin = [double]$MlLifecycleOverlayPolicy.external_analyzer.signal_score_min
        }
        if ($MlLifecycleOverlayPolicy.external_analyzer.manual_command_hint) {
            $manualCommandHint = [string]$MlLifecycleOverlayPolicy.external_analyzer.manual_command_hint
        }
    }
    if (-not $manualCommandHint -and $externalCommand) {
        $manualCommandHint = "$externalCommand ui --host 127.0.0.1 --port 5000"
    }

    $externalStatus = "disabled"
    $externalToolAvailable = $false
    $externalShouldInvoke = $false
    if ($scopeApplicable -and $externalEnabled) {
        if (-not ($externalRunModes -contains $mode)) {
            $externalStatus = "skipped_mode"
        } elseif ($lifecycleScore -lt $externalSignalMin) {
            $externalStatus = "signal_below_threshold"
        } elseif (-not $externalCommand) {
            $externalStatus = "command_missing"
        } else {
            $externalShouldInvoke = $true
            $commandResolved = Get-Command -Name $externalCommand -ErrorAction SilentlyContinue
            if (-not $commandResolved) {
                $externalStatus = "tool_unavailable"
            } else {
                $externalToolAvailable = $true
                switch ($externalInvokeMode) {
                    "probe_only" { $externalStatus = "tool_available_probe_only" }
                    "manual_only" { $externalStatus = "not_executed_manual_mode" }
                    "auto" { $externalStatus = "auto_mode_not_implemented" }
                    default { $externalStatus = "not_executed" }
                }
            }
        }
    }

    return [pscustomobject]@{
        enabled = $true
        mode = $mode
        task_applicable = $taskApplicable
        grade_applicable = $gradeApplicable
        pack_applicable = $packApplicable
        skill_applicable = $skillApplicable
        scope_applicable = $scopeApplicable
        enforcement = $enforcement
        reason = $reason
        preserve_routing_assignment = $preserveRoutingAssignment
        lifecycle_signal_score = [Math]::Round([double]$lifecycleScore, 4)
        lifecycle_likelihood = $lifecycleLikelihood
        lifecycle_keyword_hits = @($signalMatches)
        suppress_keyword_hits = @($suppressMatches)
        stage_detected = $stageDetected
        stage_scores = [pscustomobject]$stageScoreMap
        stage_hits = [pscustomobject]$stageHitMap
        required_checks = @($requiredChecks)
        artifacts_required = @($artifactsRequired)
        artifact_hits = [pscustomobject]$artifactHits
        missing_artifacts = @($missingArtifacts)
        missing_artifact_ratio = [double]$missingArtifactRatio
        deploy_readiness = $deployReadiness
        confirm_recommended = $confirmRecommended
        confirm_required = $confirmRequired
        strict_scope_applied = $strictScopeApplied
        should_apply_hook = ($scopeApplicable -and (($lifecycleScore -gt 0.0) -or $confirmRequired))
        recommended_followup = $recommendedFollowup
        external_analyzer = [pscustomobject]@{
            enabled = $externalEnabled
            command = $externalCommand
            invoke_mode = $externalInvokeMode
            status = $externalStatus
            tool_available = $externalToolAvailable
            should_invoke = $externalShouldInvoke
            invoked = $false
            manual_command_hint = $manualCommandHint
            output_excerpt = $null
            error = $null
        }
    }
}


receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 323kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 323kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 323kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 323kUpdated Claude CodeCodexVerifiedInstall