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/runtime/Freeze-RuntimeInputPacket.ps1

View on GitHub
param(
    [Parameter(Mandatory)] [string]$Task,
    [string]$Mode = 'interactive_governed',
    [string]$RunId = '',
    [AllowEmptyString()] [string]$WorkspaceRoot = '',
    [string]$ArtifactRoot = '',
    [AllowEmptyString()] [string]$EntryIntentId = '',
    [AllowEmptyString()] [string]$RequestedStageStop = '',
    [AllowEmptyString()] [string]$RequestedGradeFloor = '',
    [AllowEmptyString()] [string]$HostDecisionJson = '',
    [AllowEmptyString()] [string]$GovernanceScope = '',
    [AllowEmptyString()] [string]$RootRunId = '',
    [AllowEmptyString()] [string]$ParentRunId = '',
    [AllowEmptyString()] [string]$ParentUnitId = '',
    [AllowEmptyString()] [string]$InheritedRequirementDocPath = '',
    [AllowEmptyString()] [string]$InheritedExecutionPlanPath = '',
    [AllowEmptyString()] [string]$DelegationEnvelopePath = '',
    [string[]]$ApprovedSpecialistSkillIds = @()
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

. (Join-Path $PSScriptRoot 'VibeRuntime.Common.ps1')
. (Join-Path $PSScriptRoot 'VibeSkillRouting.Common.ps1')

function Get-VibeRouterTaskType {
    param(
        [Parameter(Mandatory)] [string]$Task
    )

    return Get-VibeInferredTaskType -Task $Task
}

function New-VibeAdviceSnapshot {
    param(
        [string]$Name,
        [object]$Advice
    )

    if ($null -eq $Advice) {
        return $null
    }

    $snapshot = [ordered]@{
        name = $Name
    }

    foreach ($field in @('enabled', 'mode', 'enforcement', 'reason', 'preserve_routing_assignment', 'confirm_required', 'scope_applicable', 'task_applicable', 'grade_applicable')) {
        if ($Advice.PSObject.Properties.Name -contains $field) {
            $snapshot[$field] = $Advice.$field
        }
    }

    return [pscustomobject]$snapshot
}

function Get-VibeRouteAdviceFieldNames {
    param(
        [AllowNull()] [object]$RouteResult
    )

    if ($null -eq $RouteResult) {
        return @()
    }

    return @(
        @($RouteResult.PSObject.Properties) |
            Where-Object {
                $_.Name -match '_advice$' -and $null -ne $_.Value
            } |
            ForEach-Object { [string]$_.Name } |
            Sort-Object -Unique
    )
}

function Invoke-VibeFrozenRoute {
    param(
        [Parameter(Mandatory)] [string]$RouterScriptPath,
        [Parameter(Mandatory)] [string[]]$BaseArgs,
        [AllowEmptyString()] [string]$HostDecisionJson = ''
    )

    $routeArgs = @($BaseArgs)
    if (-not [string]::IsNullOrWhiteSpace([string]$HostDecisionJson)) {
        $routeArgs += @('-HostDecisionJson', [string]$HostDecisionJson)
    }

    $routeInvocation = Invoke-VgoPowerShellFile -ScriptPath $RouterScriptPath -ArgumentList $routeArgs -NoProfile
    if ([int]$routeInvocation.exit_code -ne 0) {
        throw ("Failed to freeze runtime input packet because local installed skill recommender exited with code {0}." -f [int]$routeInvocation.exit_code)
    }

    $routeJson = (@($routeInvocation.output) -join [Environment]::NewLine).Trim()
    return ($routeJson | ConvertFrom-Json)
}

function Resolve-VibeControllerEntryIntentId {
    param(
        [AllowEmptyString()] [string]$EntryIntentId = ''
    )

    if ([string]::IsNullOrWhiteSpace([string]$EntryIntentId)) {
        return ''
    }
    return [string]$EntryIntentId
}

function Get-VibeSkillMetadata {
    param(
        [Parameter(Mandatory)] [string]$RepoRoot,
        [Parameter(Mandatory)] [string]$SkillId,
        [AllowEmptyString()] [string]$SkillEntrypoint = '',
        [AllowEmptyString()] [string]$TargetRoot = '',
        [AllowEmptyString()] [string]$HostId = '',
        [AllowEmptyString()] [string]$WorkspaceRoot = '',
        [AllowNull()] [object]$Authority = $null
    )

    if ($null -eq $Authority) {
        $authority = Resolve-VibeLocalSkillAuthority `
            -RepoRoot $RepoRoot `
            -SkillId $SkillId `
            -SkillEntrypoint $SkillEntrypoint `
            -TargetRoot $TargetRoot `
            -HostId $HostId `
            -WorkspaceRoot $WorkspaceRoot
    }
    if (-not [bool]$authority.valid) {
        return [pscustomobject]@{
            skill_id = $SkillId
            skill_path = $null
            skill_root = $null
            description = $null
            authority_valid = $false
            authority_reason = [string]$authority.reason
        }
    }
    $skillPath = [string]$authority.canonical_entrypoint

    $description = [string]$authority.description

    return [pscustomobject]@{
        skill_id = $SkillId
        skill_path = [System.IO.Path]::GetFullPath($skillPath)
        skill_root = [string]$authority.skill_root
        description = $description
        authority_valid = $true
        authority_reason = 'ok'
        source_root = [string]$authority.source_root
        source_kind = [string]$authority.source_kind
        source_priority = [int]$authority.source_priority
        duplicate_state = [string]$authority.duplicate_state
        content_sha256 = [string]$authority.content_sha256
    }
}

function Get-VibeCustomAdmissionIndex {
    param(
        [AllowNull()] [object]$RouteResult
    )

    $index = @{}
    if ($null -eq $RouteResult) {
        return $index
    }
    if (-not ($RouteResult.PSObject.Properties.Name -contains 'custom_admission')) {
        return $index
    }

    $customAdmission = $RouteResult.custom_admission
    if ($null -eq $customAdmission) {
        return $index
    }
    if (-not ($customAdmission.PSObject.Properties.Name -contains 'admitted_candidates')) {
        return $index
    }

    foreach ($candidate in @($customAdmission.admitted_candidates)) {
        if ($null -eq $candidate) {
            continue
        }
        $skillId = if ($candidate.PSObject.Properties.Name -contains 'skill_id') { [string]$candidate.skill_id } else { '' }
        if ([string]::IsNullOrWhiteSpace($skillId)) {
            continue
        }
        $index[$skillId] = $candidate
    }

    return $index
}

function Resolve-VibeSpecialistWriteScopeTemplate {
    param(
        [AllowEmptyString()] [string]$Template,
        [Parameter(Mandatory)] [string]$SkillId
    )

    $value = if ([string]::IsNullOrWhiteSpace($Template)) {
        'specialist:{skill_id}'
    } else {
        [string]$Template
    }
    return $value.Replace('{skill_id}', $SkillId)
}

function Get-VibeSpecialistBindingProfile {
    param(
        [Parameter(Mandatory)] [string]$SkillId,
        [Parameter(Mandatory)] [object]$Policy,
        [Parameter(Mandatory)] [object]$DispatchContract
    )

    return [pscustomobject]@{
        binding_profile = 'default'
        dispatch_phase = [string]$DispatchContract.dispatch_phase
        execution_priority = [int]$DispatchContract.execution_priority
        lane_policy = [string]$DispatchContract.lane_policy
        parallelizable_in_root_xl = [bool]$DispatchContract.parallelizable_in_root_xl
        write_scope = Resolve-VibeSpecialistWriteScopeTemplate -Template ([string]$DispatchContract.write_scope_template) -SkillId $SkillId
        review_mode = [string]$DispatchContract.review_mode
    }
}

function New-VibeSpecialistRecommendation {
    param(
        [Parameter(Mandatory)] [string]$RepoRoot,
        [Parameter(Mandatory)] [string]$Task,
        [Parameter(Mandatory)] [string]$SkillId,
        [Parameter(Mandatory)] [string]$Source,
        [Parameter(Mandatory)] [string]$TaskType,
        [Parameter(Mandatory)] [string]$Reason,
        [AllowNull()] [object]$PackId,
        [AllowNull()] [object]$Confidence,
        [AllowNull()] [object]$Rank,
        [Parameter(Mandatory)] [object]$DispatchContract,
        [AllowNull()] [object]$ExecutionSafetyPolicy = $null,
        [AllowNull()] [object]$CustomMetadata = $null,
        [AllowEmptyString()] [string]$TargetRoot = '',
        [AllowEmptyString()] [string]$HostId = '',
        [AllowEmptyString()] [string]$WorkspaceRoot = '',
        [AllowNull()] [object]$SkillMetadata = $null
    )

    $metadata = if ($null -ne $SkillMetadata) { $SkillMetadata } else {
        Get-VibeSkillMetadata -RepoRoot $RepoRoot -SkillId $SkillId -TargetRoot $TargetRoot -HostId $HostId -WorkspaceRoot $WorkspaceRoot
    }
    $bindingProfile = Get-VibeSpecialistBindingProfile -SkillId $SkillId -Policy $DispatchContract.policy -DispatchContract $DispatchContract
    $customSkillEntrypoint = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'skill_entrypoint' -and -not [string]::IsNullOrWhiteSpace([string]$CustomMetadata.skill_entrypoint)) {
        [string]$CustomMetadata.skill_entrypoint
    } elseif ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'skill_md_path' -and -not [string]::IsNullOrWhiteSpace([string]$CustomMetadata.skill_md_path)) {
        [string]$CustomMetadata.skill_md_path
    } else {
        $null
    }
    $skillEntrypoint = if ($metadata.skill_path) {
        [string]$metadata.skill_path
    } elseif (-not [string]::IsNullOrWhiteSpace([string]$customSkillEntrypoint)) {
        [string]$customSkillEntrypoint
    } else {
        $null
    }
    $skillDescription = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'description' -and -not [string]::IsNullOrWhiteSpace([string]$CustomMetadata.description)) {
        [string]$CustomMetadata.description
    } elseif ($metadata.description) {
        [string]$metadata.description
    } else {
        $null
    }
    $skillRoot = if ($metadata.PSObject.Properties.Name -contains 'skill_root' -and -not [string]::IsNullOrWhiteSpace([string]$metadata.skill_root)) {
        [string]$metadata.skill_root
    } elseif ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'skill_root' -and -not [string]::IsNullOrWhiteSpace([string]$CustomMetadata.skill_root)) {
        [string]$CustomMetadata.skill_root
    } elseif (-not [string]::IsNullOrWhiteSpace([string]$skillEntrypoint)) {
        [string](Split-Path -Parent $skillEntrypoint)
    } else {
        $null
    }
    $progressiveLoadPolicy = if (-not [string]::IsNullOrWhiteSpace([string]$skillEntrypoint)) {
        @(
            "Read the assigned $skillEntrypoint before starting the module."
        )
    } else {
        @()
    }
    $safetyMetadata = Get-VgoSkillExecutionSafetyMetadata `
        -Prompt $Task `
        -SkillMdPath $skillEntrypoint `
        -SkillRoot $skillRoot `
        -Description $skillDescription `
        -RequiredInputs @($DispatchContract.required_inputs) `
        -ExpectedOutputs @($DispatchContract.expected_outputs) `
        -VerificationExpectation ([string]$DispatchContract.verification_expectation) `
        -MustPreserveWorkflow ([bool]$DispatchContract.must_preserve_workflow) `
        -ExecutionSafetyPolicy $ExecutionSafetyPolicy
    return [pscustomobject]@{
        skill_id = $SkillId
        source = $Source
        pack_id = if ($null -eq $PackId) { $null } else { [string]$PackId }
        rank = if ($null -eq $Rank) { $null } else { [int]$Rank }
        confidence = if ($null -eq $Confidence) { $null } else { [double]$Confidence }
        reason = $Reason
        task_type = $TaskType
        recommended_scope = 'bounded specialist assistance inside vibe-governed runtime'
        bounded_role = [string]$DispatchContract.bounded_role
        must_preserve_workflow = [bool]$DispatchContract.must_preserve_workflow
        required_inputs = @($DispatchContract.required_inputs)
        expected_outputs = @($DispatchContract.expected_outputs)
        verification_expectation = [string]$DispatchContract.verification_expectation
        binding_profile = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'binding_profile') { [string]$CustomMetadata.binding_profile } else { [string]$bindingProfile.binding_profile }
        dispatch_phase = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'dispatch_phase') { [string]$CustomMetadata.dispatch_phase } else { [string]$bindingProfile.dispatch_phase }
        execution_priority = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'execution_priority') { [int]$CustomMetadata.execution_priority } else { [int]$bindingProfile.execution_priority }
        lane_policy = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'lane_policy') { [string]$CustomMetadata.lane_policy } else { [string]$bindingProfile.lane_policy }
        parallelizable_in_root_xl = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'parallelizable_in_root_xl') { [bool]$CustomMetadata.parallelizable_in_root_xl } else { [bool]$bindingProfile.parallelizable_in_root_xl }
        write_scope = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'write_scope') { [string]$CustomMetadata.write_scope } else { [string]$bindingProfile.write_scope }
        review_mode = if ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'review_mode') { [string]$CustomMetadata.review_mode } else { [string]$bindingProfile.review_mode }
        skill_entrypoint = $skillEntrypoint
        skill_md_path = $skillEntrypoint
        skill_root = $skillRoot
        source_root = if ($metadata.PSObject.Properties.Name -contains 'source_root' -and -not [string]::IsNullOrWhiteSpace([string]$metadata.source_root)) { [string]$metadata.source_root } elseif ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'source_root') { [string]$CustomMetadata.source_root } else { $null }
        source_kind = if ($metadata.PSObject.Properties.Name -contains 'source_kind' -and -not [string]::IsNullOrWhiteSpace([string]$metadata.source_kind)) { [string]$metadata.source_kind } elseif ($null -ne $CustomMetadata -and $CustomMetadata.PSObject.Properties.Name -contains 'source_kind') { [string]$CustomMetadata.source_kind } else { $null }
        source_priority = if ($metadata.PSObject.Properties.Name -contains 'source_priority' -and $null -ne $metadata.source_priority) { [int]$metadata.source_priority } else { $null }
        duplicate_state = if ($metadata.PSObject.Properties.Name -contains 'duplicate_state') { [string]$metadata.duplicate_state } else { $null }
        local_skill_authority = if ($metadata.PSObject.Properties.Name -contains 'authority_valid') { [bool]$metadata.authority_valid } else { $false }
        local_skill_authority_reason = if ($metadata.PSObject.Properties.Name -contains 'authority_reason') { [string]$metadata.authority_reason } else { 'not_in_local_skill_index' }
        skill_description = $skillDescription
        visibility_class = if (-not [string]::IsNullOrWhiteSpace([string]$skillEntrypoint) -and -not [string]::IsNullOrWhiteSpace([string]$skillRoot)) { 'path_resolved' } else { 'path_unresolved' }
        invocation_reason = $Reason
        expected_contribution = [string]$DispatchContract.bounded_role
        progressive_load_policy = @($progressiveLoadPolicy)
        destructive = [bool]$safetyMetadata.destructive
        destructive_reason_codes = [object[]]@($safetyMetadata.destructive_reason_codes)
        rollback_possible = [bool]$safetyMetadata.rollback_possible
        snapshot_required = [bool]$safetyMetadata.snapshot_required
        contract_required = [bool]$safetyMetadata.contract_required
        contract_complete = [bool]$safetyMetadata.contract_complete
        contract_missing_fields = [object[]]@($safetyMetadata.contract_missing_fields)
    }
}

function Get-VibeStageAssistantHints {
    param(
        [Parameter(Mandatory)] [string]$RepoRoot,
        [Parameter(Mandatory)] [string]$Task,
        [Parameter(Mandatory)] [object]$RouteResult,
        [Parameter(Mandatory)] [string]$RuntimeSelectedSkill,
        [Parameter(Mandatory)] [string]$TaskType,
        [Parameter(Mandatory)] [object]$Policy,
        [AllowNull()] [object]$ExecutionSafetyPolicy = $null,
        [AllowEmptyString()] [string]$TargetRoot = '',
        [AllowEmptyString()] [string]$HostId = ''
    )

    $limit = 4
    if ($Policy.PSObject.Properties.Name -contains 'specialist_recommendation_limit' -and $Policy.specialist_recommendation_limit -ne $null) {
        $limit = [int]$Policy.specialist_recommendation_limit
    }
    $dispatchContract = if ($Policy.PSObject.Properties.Name -contains 'module_skill_contract' -and $null -ne $Policy.module_skill_contract) {
        $Policy.module_skill_contract
    } else {
        [pscustomobject]@{
            bounded_role = 'specialist_assist'
            must_preserve_workflow = $true
            dispatch_phase = 'in_execution'
            execution_priority = 50
            lane_policy = 'inherit_grade'
            parallelizable_in_root_xl = $true
            write_scope_template = 'specialist:{skill_id}'
            review_mode = 'module_acceptance'
            required_inputs = @(
                'bounded specialist subtask contract',
                'frozen requirement context',
                'relevant source files or domain artifacts'
            )
            expected_outputs = @(
                'bounded specialist findings or code changes',
                'verification notes aligned with the specialist skill'
            )
            verification_expectation = 'Follow the assigned SKILL.md boundaries and satisfy module acceptance.'
        }
    }
    $dispatchContractForHint = [pscustomobject]@{
        bounded_role = [string]$dispatchContract.bounded_role
        must_preserve_workflow = [bool]$dispatchContract.must_preserve_workflow
        dispatch_phase = [string]$dispatchContract.dispatch_phase
        execution_priority = [int]$dispatchContract.execution_priority
        lane_policy = [string]$dispatchContract.lane_policy
        parallelizable_in_root_xl = [bool]$dispatchContract.parallelizable_in_root_xl
        write_scope_template = [string]$dispatchContract.write_scope_template
        review_mode = [string]$dispatchContract.review_mode
        required_inputs = @($dispatchContract.required_inputs)
        expected_outputs = @($dispatchContract.expected_outputs)
        verification_expectation = [string]$dispatchContract.verification_expectation
        policy = $Policy
    }

    # Current route output omits retired sibling-role candidate lists. Old runtime
    # packets remain readable through VibeRuntime.Common.ps1 compatibility helpers.
    return @()
}

function Get-VibeModuleSkillContract {
    param(
        [Parameter(Mandatory)] [object]$Policy
    )

    if ($Policy.PSObject.Properties.Name -contains 'module_skill_contract' -and $null -ne $Policy.module_skill_contract) {
        return $Policy.module_skill_contract
    }

    return [pscustomobject]@{
        bounded_role = 'specialist_assist'
        must_preserve_workflow = $true
        dispatch_phase = 'in_execution'
        execution_priority = 50
        lane_policy = 'inherit_grade'
        parallelizable_in_root_xl = $true
        write_scope_template = 'specialist:{skill_id}'
        review_mode = 'module_acceptance'
        required_inputs = @('bounded specialist subtask contract')
        expected_outputs = @('bounded specialist result')
        verification_expectation = 'Follow the assigned SKILL.md and satisfy module acceptance.'
    }
}

function New-VibeRecommendationsFromAgentSkillOrganization {
    param(
        [Parameter(Mandatory)] [string]$RepoRoot,
        [Parameter(Mandatory)] [string]$Task,
        [AllowNull()] [object]$AgentSkillOrganization = $null,
        [Parameter(Mandatory)] [string]$TaskType,
        [Parameter(Mandatory)] [object]$Policy,
        [AllowNull()] [object]$ExecutionSafetyPolicy = $null,
        [AllowEmptyString()] [string]$TargetRoot = '',
        [AllowEmptyString()] [string]$HostId = '',
        [AllowEmptyString()] [string]$WorkspaceRoot = ''
    )

    if ($null -eq $AgentSkillOrganization) {
        return @()
    }

    $dispatchContract = Get-VibeModuleSkillContract -Policy $Policy
    $dispatchContractForRecommendation = [pscustomobject]@{}
    foreach ($property in @($dispatchContract.PSObject.Properties)) {
        $dispatchContractForRecommendation | Add-Member -NotePropertyName $property.Name -NotePropertyValue $property.Value
    }
    $dispatchContractForRecommendation | Add-Member -NotePropertyName policy -NotePropertyValue $Policy -Force

    $recommendations = New-Object System.Collections.Generic.List[object]
    $selectedSkills = @(@($AgentSkillOrganization.selected_skills) | Where-Object {
        -not [string]::IsNullOrWhiteSpace([string](Get-VibePropertySafe -InputObject $_ -PropertyName 'skill_id' -DefaultValue ''))
    })
    if ($selectedSkills.Count -eq 0) { return @() }
    $requests = @($selectedSkills | ForEach-Object {
        [pscustomobject]@{
            skill_id = [string]$_.skill_id
            skill_entrypoint = [string](Get-VibePropertySafe -InputObject $_ -PropertyName 'skill_entrypoint' -DefaultValue '')
        }
    })
    $authorities = @(Resolve-VibeLocalSkillAuthorities `
        -RepoRoot $RepoRoot -Requests $requests -TargetRoot $TargetRoot `
        -HostId $HostId -WorkspaceRoot $WorkspaceRoot)
    for ($index = 0; $index -lt $selectedSkills.Count; $index++) {
        $selectedSkill = $selectedSkills[$index]
        $skillId = [string](Get-VibePropertySafe -InputObject $selectedSkill -PropertyName 'skill_id' -DefaultValue '')
        if ([string]::IsNullOrWhiteSpace($skillId)) {
            continue
        }
        if ([string]::Equals($skillId, [string]$Policy.explicit_runtime_skill, [System.StringComparison]::OrdinalIgnoreCase)) {
            throw ('agent_skill_organization cannot select the governed runtime controller `{0}` as a task skill' -f $skillId)
        }
        $frozenEntrypoint = [string](Get-VibePropertySafe -InputObject $selectedSkill -PropertyName 'skill_entrypoint' -DefaultValue '')
        $frozenDigest = [string](Get-VibePropertySafe -InputObject $selectedSkill -PropertyName 'content_sha256' -DefaultValue '')
        $metadata = Get-VibeSkillMetadata -RepoRoot $RepoRoot -SkillId $skillId -SkillEntrypoint $frozenEntrypoint -TargetRoot $TargetRoot -HostId $HostId -WorkspaceRoot $WorkspaceRoot -Authority $authorities[$index]
        if (-not [bool]$metadata.authority_valid) {
            throw ('agent_skill_organization selected skill `{0}` is not available from the declared local skill roots: {1}' -f $skillId, [string]$metadata.authority_reason)
        }
        if (-not [string]::IsNullOrWhiteSpace($frozenDigest) -and $frozenDigest -cne [string]$metadata.content_sha256) {
            throw ('agent_skill_organization selected skill `{0}`: skill_content_changed' -f $skillId)
        }
        $selectedSkill | Add-Member -NotePropertyName skill_entrypoint -NotePropertyValue ([string]$metadata.skill_path) -Force
        $selectedSkill | Add-Member -NotePropertyName content_sha256 -NotePropertyValue ([string]$metadata.content_sha256) -Force
        $responsibility = [string](Get-VibePropertySafe -InputObject $selectedSkill -PropertyName 'responsibility' -DefaultValue '')
        $reason = [string](Get-VibePropertySafe -InputObject $selectedSkill -PropertyName 'reason' -DefaultValue '')
        $recommendation = New-VibeSpecialistRecommendation `
            -RepoRoot $RepoRoot `
            -Task $Task `
            -SkillId $skillId `
            -Source 'agent_skill_organization' `
            -TaskType $TaskType `
            -Reason $reason `
            -PackId $null `
            -Confidence 1.0 `
            -Rank ($recommendations.Count + 1) `
            -DispatchContract $dispatchContractForRecommendation `
            -ExecutionSafetyPolicy $ExecutionSafetyPolicy `
            -CustomMetadata $selectedSkill `
            -TargetRoot $TargetRoot `
            -HostId $HostId `
            -WorkspaceRoot $WorkspaceRoot `
            -SkillMetadata $metadata
        $recommendation | Add-Member -NotePropertyName task_slice -NotePropertyValue $responsibility -Force
        $recommendation | Add-Member -NotePropertyName organization_module_ids -NotePropertyValue @($selectedSkill.module_ids) -Force
        $recommendation | Add-Member -NotePropertyName organization_responsibility -NotePropertyValue $responsibility -Force
        $recommendations.Add($recommendation) | Out-Null
    }

    return [object[]]$recommendations.ToArray()
}

$runtime = Get-VibeRuntimeContext -ScriptPath $PSCommandPath
$requestedArtifactRoot = $ArtifactRoot
$WorkspaceRoot = Get-VibeWorkspaceRoot -RepoRoot $runtime.repo_root -WorkspaceRoot $WorkspaceRoot
$runtime | Add-Member -NotePropertyName workspace_root -NotePropertyValue $WorkspaceRoot -Force
$artifactBaseRoot = Get-VibeArtifactRoot `
    -RepoRoot $runtime.repo_root `
    -Runtime $runtime `
    -WorkspaceRoot $WorkspaceRoot `
    -ArtifactRoot $requestedArtifactRoot
$Mode = Resolve-VibeRuntimeMode -Mode $Mode -DefaultMode ([string]$runtime.runtime_modes.default_mode)
if ([string]::IsNullOrWhiteSpace($RunId)) {
    $RunId = New-VibeRunId
}

if ([string]::IsNullOrWhiteSpace($requestedArtifactRoot)) {
    Initialize-VibeWorkspaceProjectDescriptor -RepoRoot $runtime.repo_root -WorkspaceRoot $WorkspaceRoot -Runtime $runtime | Out-Null
}
$sessionRoot = Ensure-VibeSessionRoot -RepoRoot $runtime.repo_root -RunId $RunId -Runtime $runtime -WorkspaceRoot $WorkspaceRoot -ArtifactRoot $artifactBaseRoot
$policy = $runtime.runtime_input_packet_policy
$hostDecision = ConvertFrom-VibeHostDecisionJson -HostDecisionJson $HostDecisionJson
$continuationContext = Get-VibeHostContinuationContext -HostDecision $hostDecision
$executionPhaseDecomposition = Resolve-VibeHostPhaseDecomposition -HostDecision $hostDecision -Task $Task -Policy $policy
$effectiveRequestedStageStop = Resolve-VibeEntryRequestedStageStop `
    -RepoRoot $runtime.repo_root `
    -EntryIntentId $EntryIntentId `
    -RequestedStageStop $RequestedStageStop
$grade = Get-VibeInternalGrade -Task $Task -RequestedGradeFloor $RequestedGradeFloor
$organizationSourceRunId = if (
    $null -ne $continuationContext -and
    (Test-VibeObjectHasProperty -InputObject $continuationContext -PropertyName 'source_run_id') -and
    -not [string]::IsNullOrWhiteSpace([string]$continuationContext.source_run_id)
) {
    [string]$continuationContext.source_run_id
} else {
    ''
}
$previousRuntimeInputPacket = Get-VibeRuntimeInputPacketFromSessionRunId `
    -ArtifactRoot $artifactBaseRoot `
    -SourceRunId $organizationSourceRunId
$inheritedAgentSkillOrganization = if (
    $null -ne $previousRuntimeInputPacket -and
    (Test-VibeObjectHasProperty -InputObject $previousRuntimeInputPacket -PropertyName 'agent_skill_organization') -and
    $null -ne $previousRuntimeInputPacket.agent_skill_organization
) {
    $previousRuntimeInputPacket.agent_skill_organization
} else {
    $null
}
$agentSkillOrganization = Resolve-VibeAgentSkillOrganization `
    -HostDecision $hostDecision `
    -InheritedOrganization $inheritedAgentSkillOrganization
if ($null -ne $agentSkillOrganization) {
    $grade = [string]$agentSkillOrganization.workflow_level
}
if ($effectiveRequestedStageStop -in @('xl_plan', 'plan_execute', 'phase_cleanup') -and $null -eq $agentSkillOrganization) {
    throw ('agent_skill_organization is required before {0}' -f $effectiveRequestedStageStop)
}
$taskType = Get-VibeRouterTaskType -Task $Task
$resolvedEntryIntentId = Resolve-VibeControllerEntryIntentId -EntryIntentId $EntryIntentId
if (
    (Test-VibeStructuredBoundedReentryContext -ContinuationContext $continuationContext) -and
    (Test-VibeObjectHasProperty -InputObject $continuationContext -PropertyName 'prior_task_type') -and
    -not [string]::IsNullOrWhiteSpace([string]$continuationContext.prior_task_type)
) {
    $taskType = [string]$continuationContext.prior_task_type
}
$routerScriptPath = Join-Path $runtime.repo_root 'scripts/router/resolve-pack-route.ps1'
$routerHostId = Resolve-VgoHostId -HostId $env:VCO_HOST_ID
$routerTargetRoot = Resolve-VgoTargetRoot -HostId $routerHostId
$storageProjection = New-VibeWorkspaceArtifactProjection `
    -RepoRoot $runtime.repo_root `
    -WorkspaceRoot $WorkspaceRoot `
    -Runtime $runtime `
    -ArtifactRoot $requestedArtifactRoot `
    -RouterTargetRoot $routerTargetRoot
$controllerEntryIntentIds = @(
    [string]$policy.explicit_runtime_skill
) | Where-Object { -not [string]::IsNullOrWhiteSpace([string]$_) }
$requestedSkill = if (
    -not [string]::IsNullOrWhiteSpace($resolvedEntryIntentId) -and
    [string]$resolvedEntryIntentId -notin @($controllerEntryIntentIds)
) {
    [string]$resolvedEntryIntentId
} else {
    ''
}
$unattended = $false
$hierarchyState = Get-VibeHierarchyState `
    -GovernanceScope $GovernanceScope `
    -RunId $RunId `
    -RootRunId $RootRunId `
    -ParentRunId $ParentRunId `
    -ParentUnitId $ParentUnitId `
    -InheritedRequirementDocPath $InheritedRequirementDocPath `
    -InheritedExecutionPlanPath $InheritedExecutionPlanPath `
    -DelegationEnvelopePath $DelegationEnvelopePath `
    -HierarchyContract $policy.hierarchy_contract

$routeArgs = @(
    '-Prompt', $Task,
    '-Grade', $grade,
    '-TaskType', $taskType,
    '-HostId', $routerHostId,
    '-TargetRoot', $routerTargetRoot,
    '-WorkspaceRoot', $WorkspaceRoot
)
if (-not [string]::IsNullOrWhiteSpace([string]$requestedSkill)) {
    $routeArgs += @('-RequestedSkill', [string]$requestedSkill)
}
if ($unattended) {
    $routeArgs += '-Unattended'
}

$routeResult = Invoke-VibeFrozenRoute -RouterScriptPath $routerScriptPath -BaseArgs $routeArgs -HostDecisionJson $HostDecisionJson
$runtimeSelectedSkill = [string]$policy.explicit_runtime_skill
$routeCandidateFocusSkill = if ($routeResult.candidate_focus) { [string]$routeResult.candidate_focus.skill } else { $null }
$skillSearchGuide = New-VibeSkillSearchGuideProjection `
    -RepoRoot $runtime.repo_root `
    -TargetRoot $routerTargetRoot `
    -HostId $routerHostId `
    -WorkspaceRoot $WorkspaceRoot
$agentRecommendations = @(New-VibeRecommendationsFromAgentSkillOrganization `
    -RepoRoot $runtime.repo_root `
    -Task $Task `
    -AgentSkillOrganization $agentSkillOrganization `
    -TaskType $taskType `
    -Policy $policy `
    -ExecutionSafetyPolicy $runtime.skill_execution_safety_policy `
    -TargetRoot $routerTargetRoot `
    -HostId $routerHostId `
    -WorkspaceRoot $WorkspaceRoot)
$agentRecommendations = @(Add-VibeExecutionPhaseMetadataToRecords `
    -Records @($agentRecommendations) `
    -PhaseDecomposition $executionPhaseDecomposition)
$stageAssistantHints = @(Get-VibeStageAssistantHints `
    -RepoRoot $runtime.repo_root `
    -Task $Task `
    -RouteResult $routeResult `
    -RuntimeSelectedSkill $runtimeSelectedSkill `
    -TaskType $taskType `
    -Policy $policy `
    -ExecutionSafetyPolicy $runtime.skill_execution_safety_policy `
    -TargetRoot $routerTargetRoot `
    -HostId $routerHostId)
$stageAssistantHints = @(Add-VibeExecutionPhaseMetadataToRecords `
    -Records @($stageAssistantHints) `
    -PhaseDecomposition $executionPhaseDecomposition)
$codeTaskTddDecision = Resolve-VibeCodeTaskTddDecision `
    -HostDecision $hostDecision `
    -Task $Task `
    -TaskType $taskType `
    -HeuristicRequiresTdd ($taskType -in @('coding', 'debug')) `
    -DocumentArtifactBaseline $false
$selectedSkillIds = if ($null -eq $agentSkillOrganization) {
    @()
} else {
    @($agentSkillOrganization.selected_skills | ForEach-Object { [string]$_.skill_id })
}
$skillRouting = New-VibeSkillCandidateAudit `
    -CandidateFocusSkill ([string]$routeCandidateFocusSkill) `
    -Recommendations @($agentRecommendations) `
    -StageAssistantHints @($stageAssistantHints) `
    -SelectedSkillIds @($selectedSkillIds)
$hierarchyProjection = New-VibeHierarchyProjection -HierarchyState $hierarchyState -IncludeGovernanceScope
$authorityFlagsProjection = New-VibeRuntimePacketAuthorityFlagsProjection `
    -HierarchyState $hierarchyState `
    -RuntimeEntry 'vibe' `
    -ExplicitRuntimeSkill $runtimeSelectedSkill `
    -RouterTruthLevel ([string]$routeResult.truth_level) `
    -ShadowOnly ([bool]$policy.shadow_only) `
    -NonAuthoritative ([bool]$routeResult.non_authoritative)
$packet = New-VibeRuntimeInputPacketProjection `
    -RunId $RunId `
    -Task $Task `
    -Mode $Mode `
    -InternalGrade $grade `
    -HierarchyState $hierarchyState `
    -HierarchyProjection $hierarchyProjection `
    -AuthorityFlagsProjection $authorityFlagsProjection `
    -StorageProjection $storageProjection `
    -RouteResult $routeResult `
    -Runtime $runtime `
    -TaskType $taskType `
    -RequestedSkill $requestedSkill `
    -EntryIntentId $EntryIntentId `
    -RequestedStageStop $effectiveRequestedStageStop `
    -RequestedGradeFloor $RequestedGradeFloor `
    -RouterHostId $routerHostId `
    -RouterTargetRoot $routerTargetRoot `
    -Unattended ([bool]$unattended) `
    -RouterScriptPath $routerScriptPath `
    -RuntimeSelectedSkill $runtimeSelectedSkill `
    -ExecutionPhaseDecomposition $executionPhaseDecomposition `
    -CodeTaskTddDecision $codeTaskTddDecision `
    -HostDecision $hostDecision `
    -StageAssistantHints @($stageAssistantHints) `
    -SkillSearchGuide $skillSearchGuide `
    -AgentSkillOrganization $agentSkillOrganization `
    -AgentSkillRecommendations @($agentRecommendations) `
    -SkillRouting $skillRouting `
    -Policy $policy

$packetPath = Get-VibeRuntimeInputPacketPath -RepoRoot $runtime.repo_root -RunId $RunId -ArtifactRoot $artifactBaseRoot
Write-VibeJsonArtifact -Path $packetPath -Value $packet

[pscustomobject]@{
    run_id = $RunId
    session_root = $sessionRoot
    packet_path = $packetPath
    packet = $packet
    route_result = $routeResult
}
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: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated 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: 322kUpdated 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: 322kUpdated Claude CodeCodexVerifiedInstall