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/Write-XlPlan.ps1

View on GitHub
param(
    [Parameter(Mandatory)] [string]$Task,
    [string]$Mode = 'interactive_governed',
    [string]$RunId = '',
    [string]$RequirementDocPath = '',
    [string]$RuntimeInputPacketPath = '',
    [string]$PlanMemoryContextPath = '',
    [string]$ArtifactRoot = '',
    [AllowEmptyString()] [string]$WorkspaceRoot = '',
    [AllowEmptyString()] [string]$GovernanceScope = '',
    [AllowEmptyString()] [string]$RootRunId = '',
    [AllowEmptyString()] [string]$ParentRunId = '',
    [AllowEmptyString()] [string]$ParentUnitId = '',
    [AllowEmptyString()] [string]$InheritedRequirementDocPath = '',
    [AllowEmptyString()] [string]$InheritedExecutionPlanPath = '',
    [AllowEmptyString()] [string]$DelegationEnvelopePath = ''
)

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

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

function Add-VibeMarkdownSection {
    param(
        [Parameter(Mandatory)] [ref]$Lines,
        [Parameter(Mandatory)] [string]$Heading,
        [AllowEmptyCollection()] [string[]]$BodyLines = @()
    )

    $filteredBodyLines = @($BodyLines | Where-Object { -not [string]::IsNullOrWhiteSpace([string]$_) })
    if (@($filteredBodyLines).Count -eq 0) {
        return
    }

    $Lines.Value += @('', ('## {0}' -f $Heading))
    $Lines.Value += @($filteredBodyLines)
}

function New-VibeBulletLines {
    param([AllowEmptyCollection()] [string[]]$Items = @())

    return @(
        $Items |
            ForEach-Object { [string]$_ } |
            Where-Object { -not [string]::IsNullOrWhiteSpace($_) } |
            ForEach-Object { '- ' + $_ }
    )
}

function Get-VibeSelectedCapsuleList {
    param(
        [AllowNull()] [object]$ContextPack = $null
    )

    if (
        $null -eq $ContextPack -or
        -not ($ContextPack.PSObject.Properties.Name -contains 'selected_capsules') -or
        $null -eq $ContextPack.selected_capsules
    ) {
        return @()
    }

    return @($ContextPack.selected_capsules | Where-Object { $null -ne $_ })
}

function Get-VibeDispatchPlanLines {
    param(
        [Parameter(Mandatory)] [AllowEmptyCollection()] [object[]]$Recommendations,
        [switch]$SuggestionMode
    )

    $lines = @()
    foreach ($recommendation in @($Recommendations)) {
        if ($SuggestionMode) {
            $lines += @(
                ('- Suggest {0}.' -f [string]$recommendation.skill_id),
                ('  Proposed phase: {0}; lane policy: {1}; write scope: {2}' -f [string]$recommendation.dispatch_phase, [string]$recommendation.lane_policy, [string]$recommendation.write_scope),
                ('  Reason: {0}' -f [string]$recommendation.reason),
                '  Escalation required: true'
            )
        } else {
            $lines += @(
                ('- Dispatch {0} as {1}.' -f [string]$recommendation.skill_id, [string]$recommendation.bounded_role),
                ('  Binding profile: {0}; dispatch phase: {1}; lane policy: {2}; parallel in XL: {3}' -f [string]$recommendation.binding_profile, [string]$recommendation.dispatch_phase, [string]$recommendation.lane_policy, [bool]$recommendation.parallelizable_in_root_xl),
                ('  Write scope: {0}; review mode: {1}; execution priority: {2}' -f [string]$recommendation.write_scope, [string]$recommendation.review_mode, [int]$recommendation.execution_priority),
                ('  Reason: {0}' -f [string]$recommendation.reason),
                ('  Required inputs: {0}' -f [string]::Join(', ', @($recommendation.required_inputs))),
                ('  Expected outputs: {0}' -f [string]::Join(', ', @($recommendation.expected_outputs))),
                ('  Verification: {0}' -f [string]$recommendation.verification_expectation)
            )
        }
        if (
            $recommendation.PSObject.Properties.Name -contains 'host_selection_action' -and
            -not [string]::IsNullOrWhiteSpace([string]$recommendation.host_selection_action)
        ) {
            $lines += ('  Host selection: {0} ({1})' -f [string]$recommendation.host_selection_action, [string]$recommendation.host_selection_mode)
        }
    }

    return @($lines)
}

function Get-VibeRecommendationPhaseId {
    param(
        [AllowNull()] [object]$Recommendation = $null
    )

    if (
        $null -eq $Recommendation -or
        -not ($Recommendation.PSObject.Properties.Name -contains 'phase_id')
    ) {
        return ''
    }

    return [string]$Recommendation.phase_id
}

$runtime = Get-VibeRuntimeContext -ScriptPath $PSCommandPath
if ([string]::IsNullOrWhiteSpace($RunId)) {
    $RunId = New-VibeRunId
}

$artifactContract = Get-VibeArtifactContractDescriptor -RepoRoot $runtime.repo_root -RunId $RunId -WorkspaceRoot $WorkspaceRoot -ArtifactRoot $ArtifactRoot
$sessionRoot = Ensure-VibeSessionRoot -RepoRoot $runtime.repo_root -RunId $RunId -Runtime $runtime -WorkspaceRoot $WorkspaceRoot -ArtifactRoot $ArtifactRoot
$hierarchyState = Get-VibeHierarchyState `
    -GovernanceScope $GovernanceScope `
    -RunId $RunId `
    -RootRunId $RootRunId `
    -ParentRunId $ParentRunId `
    -ParentUnitId $ParentUnitId `
    -InheritedRequirementDocPath $InheritedRequirementDocPath `
    -InheritedExecutionPlanPath $InheritedExecutionPlanPath `
    -DelegationEnvelopePath $DelegationEnvelopePath `
    -HierarchyContract $runtime.runtime_input_packet_policy.hierarchy_contract
$runtimeInputPath = if (-not [string]::IsNullOrWhiteSpace($RuntimeInputPacketPath)) {
    $RuntimeInputPacketPath
} else {
    Get-VibeRuntimeInputPacketPath -RepoRoot $runtime.repo_root -RunId $RunId -ArtifactRoot $ArtifactRoot
}
$runtimeInputPacket = if (-not [string]::IsNullOrWhiteSpace($runtimeInputPath) -and (Test-Path -LiteralPath $runtimeInputPath)) {
    Get-Content -LiteralPath $runtimeInputPath -Raw -Encoding UTF8 | ConvertFrom-Json
} else {
    $null
}
$skillSearchGuide = if (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'skill_search_guide' -and
    $null -ne $runtimeInputPacket.skill_search_guide
) {
    $runtimeInputPacket.skill_search_guide
} else {
    New-VibeSkillSearchGuideProjection -RepoRoot $runtime.repo_root
}
$agentSkillOrganization = if (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'agent_skill_organization' -and
    $null -ne $runtimeInputPacket.agent_skill_organization
) {
    $runtimeInputPacket.agent_skill_organization
} else {
    throw 'agent_skill_organization is required before xl_plan'
}
$selectedTaskSkillIds = @(Get-VibeSelectedTaskSkillIds -RuntimeInputPacket $runtimeInputPacket)
$requestedGradeFloor = if (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'requested_grade_floor' -and
    -not [string]::IsNullOrWhiteSpace([string]$runtimeInputPacket.requested_grade_floor)
) {
    [string]$runtimeInputPacket.requested_grade_floor
} else {
    ''
}
$entryIntentId = if (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'entry_intent_id' -and
    -not [string]::IsNullOrWhiteSpace([string]$runtimeInputPacket.entry_intent_id)
) {
    [string]$runtimeInputPacket.entry_intent_id
} else {
    'vibe'
}
$requestedStageStop = if (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'requested_stage_stop' -and
    -not [string]::IsNullOrWhiteSpace([string]$runtimeInputPacket.requested_stage_stop)
) {
    [string]$runtimeInputPacket.requested_stage_stop
} else {
    'phase_cleanup'
}
$requestedGradeFloorDisplay = if ([string]::IsNullOrWhiteSpace($requestedGradeFloor)) { 'none' } else { $requestedGradeFloor }
$grade = Get-VibeInternalGrade -Task $Task -RequestedGradeFloor $requestedGradeFloor
$isChildScope = ([string]$hierarchyState.governance_scope -eq 'child')
Assert-VibeInheritedCanonicalDocumentPaths `
    -HierarchyState $hierarchyState `
    -RepoRoot $runtime.repo_root `
    -WorkspaceRoot $WorkspaceRoot `
    -ArtifactRoot $ArtifactRoot
$planPath = if ($isChildScope) {
    if ([string]::IsNullOrWhiteSpace([string]$hierarchyState.inherited_execution_plan_path)) {
        throw 'Child-governed plan stage requires InheritedExecutionPlanPath.'
    }
    [string]$hierarchyState.inherited_execution_plan_path
} else {
    Get-VibeExecutionPlanPath `
        -RepoRoot $runtime.repo_root `
        -Task $Task `
        -RunId $RunId `
        -ArtifactRoot $ArtifactRoot `
        -WorkspaceRoot $WorkspaceRoot
}
$primaryPlanPath = if ($isChildScope) {
    $null
} else {
    [string]$artifactContract.paths.primary_plan
}
$legacyDocumentationWrite = [bool](
    -not $isChildScope -and
    [string]$artifactContract.legacy_write_mode -eq 'dual_write'
)
$legacyExecutionPlanPath = if ($legacyDocumentationWrite) {
    Get-VibeLegacyExecutionPlanPath `
        -RepoRoot $runtime.repo_root `
        -Task $Task `
        -ArtifactRoot $ArtifactRoot `
        -WorkspaceRoot $WorkspaceRoot
} else {
    $null
}
$publishedPlanPath = if ($isChildScope) { $planPath } else { $primaryPlanPath }
$requirementPath = if (-not [string]::IsNullOrWhiteSpace($RequirementDocPath)) {
    $RequirementDocPath
} elseif (-not $isChildScope) {
    [string]$artifactContract.paths.primary_requirement
} else {
    [string]$hierarchyState.inherited_requirement_doc_path
}
$antiDriftDraft = Get-VgoAntiProxyGoalDriftPacketFromRequirementDoc -RequirementDocPath $requirementPath
$requirementDocLines = if (Test-Path -LiteralPath $requirementPath) {
    @(Get-Content -LiteralPath $requirementPath -Encoding UTF8)
} else {
    @()
}
$requirementSections = Get-VgoMarkdownSectionMap -Lines $requirementDocLines
$frozenArtifactReviewRequirements = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Artifact Review Requirements')
$frozenCodeTaskTddEvidenceRequirements = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Code Task TDD Evidence Requirements' | Where-Object { -not ([string]$_).StartsWith('No code-task TDD evidence requirements were frozen', [System.StringComparison]::OrdinalIgnoreCase) })
$frozenCodeTaskTddExceptions = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Code Task TDD Exceptions' | Where-Object { -not ([string]$_).StartsWith('No code-task TDD exceptions were frozen', [System.StringComparison]::OrdinalIgnoreCase) })
$frozenBaselineDocumentQualityDimensions = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Baseline Document Quality Dimensions')
$frozenBaselineUiQualityDimensions = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Baseline UI Quality Dimensions')
$frozenTaskSpecificAcceptanceExtensions = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Task-Specific Acceptance Extensions')
$frozenResearchAugmentationSources = @(Get-VgoMarkdownSectionList -Sections $requirementSections -Heading 'Research Augmentation Sources')
$hasFrozenCodeTaskTddObligations = (@($frozenCodeTaskTddEvidenceRequirements).Count -gt 0 -or @($frozenCodeTaskTddExceptions).Count -gt 0)
$planMemoryContext = if (-not [string]::IsNullOrWhiteSpace($PlanMemoryContextPath) -and (Test-Path -LiteralPath $PlanMemoryContextPath)) {
    Get-Content -LiteralPath $PlanMemoryContextPath -Raw -Encoding UTF8 | ConvertFrom-Json
} else {
    $null
}
$moduleWorkPlanPath = Join-Path $sessionRoot 'module-work-plan.json'
$moduleWorkPlan = New-VibeModuleWorkPlan -RunId $RunId -AgentSkillOrganization $agentSkillOrganization -RequirementDocPath $requirementPath
if ($hasFrozenCodeTaskTddObligations) {
    $moduleWorkPlan | Add-Member -NotePropertyName 'code_task_tdd_evidence_requirements' -NotePropertyValue ([object[]]@($frozenCodeTaskTddEvidenceRequirements))
    $moduleWorkPlan | Add-Member -NotePropertyName 'code_task_tdd_exceptions' -NotePropertyValue ([object[]]@($frozenCodeTaskTddExceptions))
}
Write-VibeJsonArtifact -Path $moduleWorkPlanPath -Value $moduleWorkPlan
$grade = [string]$moduleWorkPlan.workflow_level
$directChatPlan = (
    @($moduleWorkPlan.modules).Count -eq 1 -and
    [string]$moduleWorkPlan.modules[0].execution_mode -eq 'agent_direct' -and
    @($moduleWorkPlan.work_units).Count -eq 1 -and
    $null -eq $moduleWorkPlan.work_units[0].skill_id
)
$executionTargetRoot = [string](Get-VibeNestedPropertySafe -InputObject $runtimeInputPacket -PropertyPath @('host_adapter', 'target_root') -DefaultValue '')
if ([string]::IsNullOrWhiteSpace($executionTargetRoot)) {
    throw 'module work plan requires host_adapter.target_root'
}
$executionTargetRoot = [System.IO.Path]::GetFullPath($executionTargetRoot)
$effectiveHostId = [string](Get-VibeNestedPropertySafe -InputObject $runtimeInputPacket -PropertyPath @('host_adapter', 'effective_host_id') -DefaultValue 'codex')
$executionWorkspaceRoot = [string](Get-VibeNestedPropertySafe -InputObject $runtimeInputPacket -PropertyPath @('storage', 'workspace_root') -DefaultValue '')
if ([string]::IsNullOrWhiteSpace($executionWorkspaceRoot)) {
    throw 'xl_plan requires storage.workspace_root'
}
$executionWorkspaceRoot = [System.IO.Path]::GetFullPath($executionWorkspaceRoot)
$approvedDispatch = @(Convert-VibeModuleWorkPlanToDispatch `
    -ModuleWorkPlan $moduleWorkPlan `
    -RepoRoot ([System.IO.Path]::GetFullPath($runtime.repo_root)) `
    -TargetRoot $executionTargetRoot `
    -HostId $effectiveHostId `
    -WorkspaceRoot $executionWorkspaceRoot)
$executionPhaseDecomposition = if (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'host_decision' -and
    $null -ne $runtimeInputPacket.host_decision -and
    $runtimeInputPacket.host_decision.PSObject.Properties.Name -contains 'phase_decomposition' -and
    $null -ne $runtimeInputPacket.host_decision.phase_decomposition
) {
    $runtimeInputPacket.host_decision.phase_decomposition
} elseif (
    $runtimeInputPacket -and
    $runtimeInputPacket.PSObject.Properties.Name -contains 'execution_phase_decomposition' -and
    $null -ne $runtimeInputPacket.execution_phase_decomposition
) {
    $runtimeInputPacket.execution_phase_decomposition
} else {
    $null
}
$plannedWaves = @(New-VibeModuleWorkWaves -ModuleWorkPlan $moduleWorkPlan -Units @($moduleWorkPlan.work_units))
$waveLines = @(
    for ($waveIndex = 0; $waveIndex -lt $plannedWaves.Count; $waveIndex++) {
        $wave = $plannedWaves[$waveIndex]
        $unitLabels = @(
            foreach ($unitId in @($wave.unit_ids)) {
                $unit = @($moduleWorkPlan.work_units | Where-Object { [string]$_.unit_id -eq [string]$unitId } | Select-Object -First 1)
                if (@($unit).Count -eq 0) {
                    throw ('visible wave references unknown module work unit `{0}`' -f [string]$unitId)
                }
                $worker = if ([string]::IsNullOrWhiteSpace([string]$unit[0].skill_id)) {
                    'current Agent'
                } else {
                    ('skill `{0}`' -f [string]$unit[0].skill_id)
                }
                ('`{0}` via {1} as `{2}`' -f [string]$unit[0].module_id, $worker, [string]$unit[0].role)
            }
        )
        ('- Wave {0} (`{1}`): {2}' -f ($waveIndex + 1), [string]$wave.execution_mode, ($unitLabels -join '; '))
    }
)

$lines = @("# $(Get-VibeTitleFromTask -Task $Task)")
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Execution Summary' -BodyLines @(
    "Governed runtime execution plan for ``vibe`` in mode $Mode."
)
$frozenInputLines = @(
    "- Requirement doc: $([System.IO.Path]::GetFullPath($requirementPath))",
    "- Source task: $Task"
)
if ($runtimeInputPacket) {
    $hostReentryAction = if (
        $runtimeInputPacket.PSObject.Properties.Name -contains 'continuation_context' -and
        $null -ne $runtimeInputPacket.continuation_context -and
        $runtimeInputPacket.continuation_context.PSObject.Properties.Name -contains 'reentry_action'
    ) {
        [string]$runtimeInputPacket.continuation_context.reentry_action
    } elseif (
        $runtimeInputPacket.PSObject.Properties.Name -contains 'host_reentry_action' -and
        -not [string]::IsNullOrWhiteSpace([string]$runtimeInputPacket.host_reentry_action)
    ) {
        [string]$runtimeInputPacket.host_reentry_action
    } else {
        ''
    }
    $hostRevisionTargetStage = if (
        $runtimeInputPacket.PSObject.Properties.Name -contains 'continuation_context' -and
        $null -ne $runtimeInputPacket.continuation_context -and
        $runtimeInputPacket.continuation_context.PSObject.Properties.Name -contains 'revision_target_stage'
    ) {
        [string]$runtimeInputPacket.continuation_context.revision_target_stage
    } elseif (
        $runtimeInputPacket.PSObject.Properties.Name -contains 'host_revision_target_stage' -and
        -not [string]::IsNullOrWhiteSpace([string]$runtimeInputPacket.host_revision_target_stage)
    ) {
        [string]$runtimeInputPacket.host_revision_target_stage
    } else {
        ''
    }
    $hostRevisionDelta = if (
        $runtimeInputPacket.PSObject.Properties.Name -contains 'continuation_context' -and
        $null -ne $runtimeInputPacket.continuation_context -and
        $runtimeInputPacket.continuation_context.PSObject.Properties.Name -contains 'revision_delta'
    ) {
        @(Get-VibeNormalizedStringList -Values $runtimeInputPacket.continuation_context.revision_delta)
    } elseif (
        $runtimeInputPacket.PSObject.Properties.Name -contains 'host_revision_delta' -and
        $null -ne $runtimeInputPacket.host_revision_delta
    ) {
        @(Get-VibeNormalizedStringList -Values $runtimeInputPacket.host_revision_delta)
    } else {
        @()
    }
    if ([string]$hostReentryAction -eq 'revise' -and @($hostRevisionDelta).Count -gt 0) {
        Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Host Revision Delta' -BodyLines @(
            ('- Re-entry action: {0}' -f [string]$hostReentryAction),
            ('- Revision target stage: {0}' -f $(if ([string]::IsNullOrWhiteSpace($hostRevisionTargetStage)) { 'xl_plan' } else { [string]$hostRevisionTargetStage })),
            @(New-VibeBulletLines -Items @($hostRevisionDelta))
        )
    }
}
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Skill Search Guide' -BodyLines @(Get-VibeSkillSearchGuideLines -SkillSearchGuide $skillSearchGuide)
$moduleLines = @($agentSkillOrganization.modules | ForEach-Object {
    ('- `{0}`: {1}' -f [string]$_.module_id, [string]$_.goal)
})
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Task Modules' -BodyLines @($moduleLines)
$candidateLines = @($agentSkillOrganization.modules | ForEach-Object {
    $candidateText = if (@($_.candidate_skill_ids).Count -gt 0) {
        @($_.candidate_skill_ids | ForEach-Object { ('`{0}`' -f [string]$_) }) -join ', '
    } else {
        'none found'
    }
    ('- `{0}`: {1}' -f [string]$_.module_id, $candidateText)
})
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Candidate Skills By Module' -BodyLines @($candidateLines)
$uncoveredModuleLines = if (@($agentSkillOrganization.uncovered_modules).Count -gt 0) {
    @($agentSkillOrganization.uncovered_modules | ForEach-Object {
        ('- `{0}`: {1}' -f [string]$_.module_id, [string]$_.reason)
    })
} else {
    $directModuleIds = @(
        $agentSkillOrganization.modules |
            Where-Object { [string]$_.execution_mode -eq 'agent_direct' } |
            ForEach-Object { ('`{0}`' -f [string]$_.module_id) }
    )
    if (@($directModuleIds).Count -gt 0) {
        @(
            '- No module is blocked by a Skill gap; {0} is explicitly assigned to the current Agent without a local Skill.' -f ($directModuleIds -join ', ')
        )
    } else {
        @('- None. Every declared module is covered by an Agent-selected local Skill.')
    }
}
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Uncovered Modules' -BodyLines @($uncoveredModuleLines)
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'L / XL Organization Difference' -BodyLines @(
    ('- L: {0}' -f [string]$agentSkillOrganization.workflow_level_contract.L),
    ('- XL: {0}' -f [string]$agentSkillOrganization.workflow_level_contract.XL),
    ('- Selected workflow level: `{0}`' -f [string]$agentSkillOrganization.workflow_level)
)
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Frozen Inputs' -BodyLines @($frozenInputLines)
if (-not $directChatPlan) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Wave Plan' -BodyLines @($waveLines)
}
$executionPhaseLines = @(Get-VibeExecutionPhaseMarkdownLines -PhaseDecomposition $executionPhaseDecomposition)
if (@($executionPhaseLines).Count -gt 0) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Execution Phase Plan' -BodyLines @($executionPhaseLines)
}
$deliveryAcceptanceReportPath = Join-Path $sessionRoot 'delivery-acceptance-report.json'
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Delivery Acceptance Plan' -BodyLines @(
    '- Freeze downstream product acceptance inside the governed requirement doc and reuse it rather than inventing closeout claims later.',
    '- Emit a per-run delivery-acceptance report during `phase_cleanup` so runtime/process success is kept separate from project-delivery success.',
    ('- Delivery-acceptance report: {0}' -f $deliveryAcceptanceReportPath),
    '- If manual spot checks are declared in the requirement doc, final completion wording stays blocked until they are cleared or explicitly downgraded to manual review.',
    '- Release truth aggregation remains an outer-layer gate; this run emits the per-run delivery-truth report only.'
)
if (@($frozenArtifactReviewRequirements).Count -gt 0) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Artifact Review Strategy' -BodyLines @(
        '- If the frozen requirement doc declares `Artifact Review Requirements`, execution must leave behind explicit artifact-review evidence rather than relying on generic completion wording.',
        '- Artifact review may be recorded inline in `phase-execute.json` or through a dedicated `artifact-review.json` sidecar, but one of those governed surfaces must exist when direct artifact review is required.',
        '- Product acceptance stays blocked when required artifact review remains missing, partial, degraded, or manual-review-only.'
    )
}
if ($hasFrozenCodeTaskTddObligations) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Code Task TDD Evidence Plan' -BodyLines @(
        '- Reuse the frozen `Code Task TDD Evidence Requirements` section from the requirement doc rather than inventing late closeout claims.',
        '- Reuse the frozen `Code Task TDD Exceptions` section when strict failing-first sequencing is intentionally exempted.',
        '- Map each frozen requirement or exception to an implementation step, a targeted verification command, and a proof artifact.',
        '- If strict failing-first sequencing is blocked, execution must record the bounded reason and fallback evidence explicitly.'
    )
}
if (@($frozenBaselineDocumentQualityDimensions).Count -gt 0) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Baseline Document Quality Mapping' -BodyLines @(
    '- Use the frozen `Baseline Document Quality Dimensions` section in the requirement doc as the authoritative list of document-artifact quality dimensions that artifact review must cover before a document delivery can claim full completion.',
    '- Track each baseline document dimension through artifact-review annotations so the delivery-acceptance report can show which structure, formatting, completeness, reference integrity, layout stability, and output fidelity expectations were inspected.',
    '- Treat missing document-dimension coverage as a manual-review-required hit and keep this mapping separate from UI baselines and code-task TDD evidence.'
    )
}
if (@($frozenBaselineUiQualityDimensions).Count -gt 0) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Baseline UI Quality Mapping' -BodyLines @(
    '- Use the frozen `Baseline UI Quality Dimensions` section in the requirement doc as the authoritative list of dimensions that artifact review must cover before a UI delivery can claim full completion.',
    '- Track each baseline dimension through execution and artifact-review annotations so the delivery-acceptance report can show which structure, interaction, state, consistency, responsiveness, and fidelity expectations were inspected.',
    '- Treat missing dimension coverage as a manual-review-required hit and include explicit mapping steps or targeted verification units that drive reviewers to capture the evidence the requirement doc established.'
    )
}
if (@($frozenTaskSpecificAcceptanceExtensions).Count -gt 0) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Task-Specific Acceptance Mapping' -BodyLines @(
    '- Reuse frozen task-specific acceptance extensions from the requirement doc instead of inventing late closeout criteria.',
    '- Keep base delivery truth separate from task-specific expectations so each can be inspected independently during review.'
    )
}
if (@($frozenResearchAugmentationSources).Count -gt 0) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Research Augmentation Plan' -BodyLines @(
    '- Preserve any frozen research augmentation sources from the requirement doc so later reviewers can tell which external standards strengthened the brief.',
    '- Research augmentation may strengthen rough asks, but it must not replace the user-owned requirement surface.'
    )
}
$moduleWorkPlanLines = @()
foreach ($module in @($moduleWorkPlan.modules)) {
    $dependencyText = if (@($module.depends_on).Count -gt 0) {
        @($module.depends_on | ForEach-Object { ('`{0}`' -f [string]$_) }) -join ', '
    } else {
        'none'
    }
    $moduleWorkPlanLines += ('- `{0}`: {1}' -f [string]$module.module_id, [string]$module.goal)
    $moduleWorkPlanLines += ('  Required: `{0}`; dependencies: {1}; Execution mode: `{2}`' -f [bool]$module.required, $dependencyText, [string]$module.execution_mode)
    $moduleUnits = @($moduleWorkPlan.work_units | Where-Object { [string]$_.module_id -eq [string]$module.module_id })
    foreach ($unit in @($moduleUnits)) {
        $worker = if ([string]::IsNullOrWhiteSpace([string]$unit.skill_id)) { 'current Agent' } else { ('skill `{0}`' -f [string]$unit.skill_id) }
        $moduleWorkPlanLines += ('  Work: {0} as `{1}` - {2}' -f $worker, [string]$unit.role, [string]$unit.responsibility)
    }
    if (@($moduleUnits).Count -eq 0) {
        $moduleWorkPlanLines += '  Work: blocked until the declared capability gap is resolved.'
    }
    foreach ($criterion in @($module.acceptance_criteria)) {
        $moduleWorkPlanLines += ('  Acceptance: `{0}` ({1}) - {2}' -f [string]$criterion.criterion_id, [string]$criterion.verification_mode, [string]$criterion.description)
    }
}
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Module Work Plan' -BodyLines @($moduleWorkPlanLines)
if (@($approvedDispatch).Count -gt 0) {
    if ($executionPhaseDecomposition -and @($executionPhaseDecomposition.phases).Count -gt 0) {
        $declaredPhaseIds = @($executionPhaseDecomposition.phases | ForEach-Object { [string]$_.phase_id } | Where-Object { -not [string]::IsNullOrWhiteSpace($_) })
        foreach ($phase in @($executionPhaseDecomposition.phases)) {
            $targetPhaseId = [string]$phase.phase_id
            $phaseDispatches = @($approvedDispatch | Where-Object { (Get-VibeRecommendationPhaseId -Recommendation $_) -eq $targetPhaseId })
            if (@($phaseDispatches).Count -eq 0) {
                continue
            }

            $lines += @(
                '',
                ('### Phase `{0}` [{1} -> {2}] order `{3}`: {4}' -f [string]$phase.phase_id, [string]$phase.stage_type, [string]$phase.dispatch_phase, [int]$phase.stage_order, [string]$phase.stage_label)
            )
            $lines += @(Get-VibeDispatchPlanLines -Recommendations @($phaseDispatches))
        }

        $ungroupedApprovedDispatch = @($approvedDispatch | Where-Object {
            $phaseId = Get-VibeRecommendationPhaseId -Recommendation $_
            [string]::IsNullOrWhiteSpace($phaseId) -or $declaredPhaseIds -notcontains $phaseId
        })
        if (@($ungroupedApprovedDispatch).Count -gt 0) {
            $lines += @(
                '',
                '### Phase `ungrouped`: module work'
            )
            $lines += @(Get-VibeDispatchPlanLines -Recommendations @($ungroupedApprovedDispatch))
        }
    } else {
        $lines += @(Get-VibeDispatchPlanLines -Recommendations @($approvedDispatch))
    }
}
$selectedPlanMemoryCapsules = @(Get-VibeSelectedCapsuleList -ContextPack $planMemoryContext)
Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Verification Commands' -BodyLines @(
    '- Run every verification command frozen for the module work units and retain its real result.',
    '- Reconcile every module acceptance criterion against the returned execution evidence.',
    '- Review the delivery-acceptance report emitted during `phase_cleanup` before using full completion language.'
)
if (-not $directChatPlan) {
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Rollback Plan' -BodyLines @(
        '- If verification fails, revert only changes inside the approved module write scopes.',
        '- Do not roll back unrelated user changes.'
    )
    Add-VibeMarkdownSection -Lines ([ref]$lines) -Heading 'Phase Cleanup Contract' -BodyLines @(
        '- Remove temporary artifacts created by the approved module work only.',
        '- Write cleanup receipt before completion.'
    )
}

$childHandoffPath = $null
if ($isChildScope) {
    if (-not (Test-Path -LiteralPath $planPath)) {
        throw ("Child-governed plan stage cannot inherit missing canonical execution plan: {0}" -f $planPath)
    }

    $childHandoffPath = Join-Path $sessionRoot 'child-execution-handoff.md'
    $handoffLines = @(
        "# Child Execution Handoff",
        '',
        '- governance_scope: child',
        ('- inherited_execution_plan: {0}' -f $planPath),
        ('- root_run_id: {0}' -f [string]$hierarchyState.root_run_id),
        ('- parent_run_id: {0}' -f [string]$hierarchyState.parent_run_id),
        ('- parent_unit_id: {0}' -f [string]$hierarchyState.parent_unit_id),
        '- canonical_write_allowed: false',
        ('- assigned_skill_work_unit_count: {0}' -f @($approvedDispatch).Count),
        '',
        'Child-governed lanes inherit the frozen root plan and may not create a second canonical execution-plan surface.'
    )
    Write-VibeMarkdownArtifact -Path $childHandoffPath -Lines $handoffLines
} else {
    Write-VibeMarkdownArtifact -Path $primaryPlanPath -Lines $lines
    if ($legacyDocumentationWrite) {
        Write-VibeMarkdownArtifact -Path $legacyExecutionPlanPath -Lines $lines
    }
}

$receipt = [pscustomobject]@{
    stage = 'xl_plan'
    run_id = $RunId
    governance_scope = [string]$hierarchyState.governance_scope
    mode = $Mode
    internal_grade = $grade
    requirement_doc_path = $requirementPath
    execution_plan_path = $publishedPlanPath
    primary_plan_path = $primaryPlanPath
    legacy_execution_plan_path = $legacyExecutionPlanPath
    module_work_plan_path = $moduleWorkPlanPath
    child_execution_handoff_path = $childHandoffPath
    canonical_write_allowed = -not $isChildScope
    inherited_execution_plan_path = if ($isChildScope) { $planPath } else { $null }
    runtime_input_packet_path = $runtimeInputPath
    plan_memory_context_path = $PlanMemoryContextPath
    plan_memory_disclosure_level = if ($planMemoryContext -and $planMemoryContext.PSObject.Properties.Name -contains 'disclosure_level') { [string]$planMemoryContext.disclosure_level } else { $null }
    plan_memory_capsule_count = @($selectedPlanMemoryCapsules).Count
    generated_at = (Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ')
    artifact_contract = [pscustomobject]@{
        artifact_root = [string]$artifactContract.artifact_root
        plan = [string]$artifactContract.paths.plan
        manifest = [string]$artifactContract.paths.manifest
        legacy_documentation_write = $legacyDocumentationWrite
        legacy_write_mode = [string]$artifactContract.legacy_write_mode
        legacy_removal_release = [string]$artifactContract.legacy_removal_release
    }
}
$receiptPath = Join-Path $sessionRoot 'execution-plan-receipt.json'
Write-VibeJsonArtifact -Path $receiptPath -Value $receipt

[pscustomobject]@{
    run_id = $RunId
    governance_scope = [string]$hierarchyState.governance_scope
    session_root = $sessionRoot
    execution_plan_path = $publishedPlanPath
    primary_plan_path = $primaryPlanPath
    legacy_execution_plan_path = $legacyExecutionPlanPath
    module_work_plan_path = $moduleWorkPlanPath
    receipt_path = $receiptPath
    receipt = $receipt
    artifact_contract = $artifactContract
    plan_artifact_path = [string]$artifactContract.paths.plan
    artifact_manifest_path = [string]$artifactContract.paths.manifest
}
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