chore: expand orchestration and discovery infrastructure#407
Merged
Conversation
- Add epic orchestration skills (epic-plan, epic-run, epic-orchestrate) and update orchestrate skill for root-session entry points and deterministic topology deployment - Add discovery workflow infrastructure: discovery-workflow, discovery-repo-inventory, discovery-coverage-ledger, discovery-parity-matrix, discovery-behavior-reconciliation, discovery-runtime-characterization, and discovery-validate-artifacts skills - Add analyst and characterization agents: legacy-parity-analyst, migration-coverage-reviewer, requirements-reconciler, runtime-characterization-analyst - Add discovery artifact validation hooks (enforce-discovery-artifact-gate, validate-discovery-artifact-gate) - Add Codex agent complexity-band profiles (C1-C4) for atomic-executor, atomic-planner, csharp-typed-engineer, powershell-typed-engineer, orchestrator, and other delegated agents - Add Codex hooks for epic root-invocation, epic planning, epic child-launch coordination, epic wave-barrier enforcement, and epic merge gating - Add Codex scripts for epic child process lifecycle and coordination (epic-child-launch-contract, epic-child-launch-runtime, epic-child-persistence-runtime, epic-child-sandbox-preflight, launch-epic-child-wave, resume-epic-child) - Expand config/orchestration-routing.json with epic route and update model-routing tables - Update .claude/settings.json permissions, hooks, and skill/agent registrations to support new workflows Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Suggested title
chore: expand orchestration and discovery infrastructure
Summary
codex_topology_policy) and complexity-band model/reasoning selection (codex_model_policy), with generated per-band agent profiles (C1–C4plusc3-elevated) for every delegated agent family.epic-plan,epic-run, andepic-orchestrateskills under.agents/skills/,epic-planner/epic-orchestratorCodex agent definitions, and the Codex hooks and scripts that enforce epic invocation origin, planning-only scope, wave barriers, child worktree binding, and merge gating.discovery-*skills, four analyst agents (legacy-parity-analyst,migration-coverage-reviewer,requirements-reconciler,runtime-characterization-analyst), and a two-sided artifact gate wired into.claude/settings.json.config/orchestration-routing.jsonwith the new policy blocks, acodex_topology_requirementon thesmallroute, apreparation-route description aligned toepic-plannerownership, andmodel_budget.fable_policymoved fromavailabletopreferred.smallroute'srequired_skillslist by removing two entries (orchestrator-workflow,repo-automation-adapter) that do not exist as.claude/skills/directories in this repository.cleanup-merged-worktreesskill for post-epic consolidation and deletion of fully mergeddrm-copilot-wt-*worktrees and branches.This change is confined to governance, configuration, hook, and script surfaces. No first-party application source file (
.cs,.ts,.py) is modified.Why
The PR Intent fields in the context bundle were left blank, so the motivation below is stated only from what the diff itself establishes; no feature-doc excerpts were available in the context bundle.
codex_topology_policyandcodex_model_policyso neither axis silently overrides the other.discovery-*skill set defines the stage order (inventory → coverage → runtime characterization → parity → behavior reconciliation → validation) and the artifact gate enforces that each stage produced its artifact before the next one runs.smallroute declared two required skills with no corresponding skill directory, which forced downstream receipt recording to reference names that could not be read. Removing them makes the route's declared requirements satisfiable.What Changed
Codex routing and agent profiles (
.codex/,.agents/)config/orchestration-routing.json: newcodex_topology_policy(execution contexts, per-language production/test budgets, forced root personas, parallelism caps, escalation precedence) andcodex_model_policy(profile order, complexity-to-profile model/reasoning mapping,c3-elevatedactivation, ceiling-transition policy, forced personas, generated agent families).model_budget.fable_policychanged topreferred..agents/skills/codex-model-routing/(SKILL.md plusagents/openai.yaml): the routing contract and provider agent mapping.atomic-executor,atomic-planner,csharp-typed-engineer,powershell-typed-engineer,orchestrator,feature-reviewer,task-researcher,prd-feature, andpr-author, plus base-profile updates for each family..codex/agents/epic-planner.toml,.codex/agents/epic-orchestrator.toml: forced-persona epic definitions..codex/config.toml: substantial expansion (+239/-…) wiring the profiles and hooks.Epic enforcement hooks and scripts (
.codex/hooks/,.codex/scripts/)authorize-root-epic-invocation,enforce-epic-root-invocation,enforce-epic-planning-only,enforce-epic-wave-barrier,enforce-epic-child-worktree-binding,enforce-epic-worktree-removal-gate,enforce-epic-merge-gate,enforce-codex-model-routing,validate-codex-subagent-routing,record-subagent-routing-attestation,codex-agent-profile-attestation,codex-epic-child-launch-attestation,codex-authority-store.epic-child-launch-contract,epic-child-launch-runtime,epic-child-persistence-runtime,epic-child-sandbox-preflight,launch-epic-child-wave,resume-epic-child.Discovery workflow (
.claude/skills/discovery-*,.claude/agents/,.claude/hooks/)discovery-workflow(umbrella sequencing and the Referenced Contracts registry),discovery-repo-inventory,discovery-coverage-ledger,discovery-runtime-characterization,discovery-parity-matrix,discovery-behavior-reconciliation,discovery-validate-artifacts.legacy-parity-analyst,migration-coverage-reviewer,requirements-reconciler,runtime-characterization-analyst— all scoped toWrite(discovery/**)only.enforce-discovery-artifact-gate.ps1(PreToolUse-side) andvalidate-discovery-artifact-gate.ps1(SubagentStop-side), both registered in.claude/settings.json.Skills and settings
.agents/skills/epic-plan/,epic-run/,epic-orchestrate/: new epic lifecycle skills..claude/skills/cleanup-merged-worktrees/: merged-worktree detection, consolidation, and deletion workflow..agents/skills/orchestrate/SKILL.md(+98),.agents/skills/orchestrator-workflow/SKILL.md(+43),.claude/skills/execute-hard-lock/SKILL.md(+2/-2): updated for root-session entry points and topology deployment..claude/settings.json: registers the two discovery gate hooks on the existing PreToolUse and SubagentStop chains.Architecture / How It Fits Together
Two independent selection axes feed a Codex delegation:
codex_topology_policy.language_budgetsmaps a language to a direct-mode production/test file budget and a logical agent. When the estimate exceeds budget, or the request is cross-language, cross-cutting, or originates in an epic child context,escalation_precedencedecides which escalation applies and routing hands off to the orchestrator persona instead of a typed engineer. Thesmallroute now carries acodex_topology_requirementblock declaring the receipt key, required execution context, and the resolved-engineer delegation source.codex_model_policy.complexity_to_profilemapsC1–C4to an exact model slug and reasoning effort; there is no silent fallback when a profile is unavailable.c3-elevatedactivates only in epic child contexts.epic-plannerandepic-orchestratorare forced personas that bypass the band table.Epic execution flows root →
epic-planner(planning only, enforced byenforce-epic-planning-only) →epic-orchestrator, which launches child waves vialaunch-epic-child-waveunder theepic-child-launch-contract.enforce-epic-wave-barrierblocks a wave from starting before its predecessor completes,enforce-epic-child-worktree-bindingties each child to its assigned worktree, andenforce-epic-merge-gategates the integration-to-main merge.record-subagent-routing-attestationandcodex-agent-profile-attestationwrite the attestation receipts thatvalidate-codex-subagent-routingandenforce-codex-model-routingcheck.The discovery workflow is a linear seven-stage pipeline.
discovery-workflowsequences the stages and holds the contract registry; each stage skill produces its artifact under the profile artifacts root;discovery-validate-artifactsruns the per-artifact validators after each stage and the completion gate at the end, with empty-error-list pass semantics. The two new.claude/hooks/scripts enforce that gate from both directions — before a tool call proceeds and when a subagent stops — so a stage cannot be skipped by invoking the next one directly.Verification
Completed
Not verified in this PR. The context bundle records no CI status for HEAD (
CI status (HEAD): (not available)) and no canonical verification evidence (No canonical verification evidence parsed). No test files are added or modified by this change.Recommended
.github/workflows/ci.yml) on this PR head:actionlintplus thewindows-latestformat/build/analyze/test job. No.github/workflows/**file and no.csfile is changed, so both jobs exercise unchanged inputs; confirm they pass on the PR head before merge.mcp__drm-copilot__run_poshqc_formatmcp__drm-copilot__run_poshqc_analyzemcp__drm-copilot__run_poshqc_test.claude/hooks/gate scripts against a discovery artifact tree, since they are now registered in.claude/settings.jsonand affect every session.config/orchestration-routing.jsonand.claude/settings.json.Backward Compatibility / Migration Notes
.claude/settings.jsonregistersenforce-discovery-artifact-gate.ps1on PreToolUse andvalidate-discovery-artifact-gate.ps1on SubagentStop. These run in every session after merge, not only in discovery work. A defect in either script affects all agent sessions.model_budget.fable_policychanges fromavailabletopreferred. Underpreferred, thepreferred_overlayredirects the C3 cell tofablefor the overlay agents only (atomic-planner,prd-feature,feature-review,task-researcher);atomic-executorandpr-authorC3 cells stay atopus. Existingmodel_routing_receipts[]recorded underavailablewill not match a recomputation underpreferred.smallrouterequired_skillsshrinks by two entries. Any checkpoint or receipt set that enumeratedorchestrator-workfloworrepo-automation-adapterfor thesmallroute will no longer match the config.require_completevalidation compares the checkpoint arrays against this config, so in-flightsmall-route checkpoints must be updated.preparationroute dropsrequires_pr_gate: false. The key is removed rather than changed; consumers that read it explicitly should treat its absence as the priorfalse.Risks and Mitigations
.claude/hooks/gate scripts run in every session and could block unrelated tool calls or subagent completions..claude/settings.jsonhook registrations, which disables the gates without removing the scripts..codex/hooks/and 6 new.codex/scripts/PowerShell files, so their enforcement logic is unverified..codex/surface is not loaded by Claude Code sessions, limiting blast radius to Codex-native runs. Tracked as a follow-up below.fable_policy: preferredchanges model selection for four agent families and will invalidate previously recorded routing receipts..codex/agents/*.tomlprofiles (45 files) pin exact model slugs with no fallback, so an unavailable slug fails rather than degrading.exact model slugs are mandatory and unavailable profiles do not fall back silently); a slug change requires a config edit, which is a visible diff.config/orchestration-routing.jsonpolicy blocks is inconsistent with the surrounding file.Review Guide
Suggested order, highest-signal first:
config/orchestration-routing.json— the contract every other file in this PR implements. Read the two new policy blocks and the three edits to existing routes..claude/settings.json— the only change with immediate, repo-wide session effect..claude/hooks/enforce-discovery-artifact-gate.ps1and.claude/hooks/validate-discovery-artifact-gate.ps1(+237) — the enforcement logic behind item 2..claude/skills/discovery-workflow/SKILL.md— the umbrella that defines stage order and the contract registry; read before the six stage skills..codex/scripts/epic-child-launch-contract.ps1(+475),.codex/scripts/launch-epic-child-wave.ps1(+471),.codex/scripts/epic-child-launch-runtime.ps1(+445) — the largest new logic files..codex/hooks/record-subagent-routing-attestation.ps1(+414),enforce-epic-child-worktree-binding.ps1(+325),enforce-epic-wave-barrier.ps1(+295),enforce-epic-planning-only.ps1(+292) — the enforcement layer..codex/config.toml(+239) — wiring..agents/skills/orchestrate/SKILL.md(+98) andorchestrator-workflow/SKILL.md(+43) — prose updates.Low-signal bulk: the 45 generated
.codex/agents/*-c{1,2,3,3-elevated,4}.tomlprofiles are near-identical per family and differ only in model slug, reasoning effort, and suffix. Review one family in full (for exampleatomic-executor-c1throughatomic-executor-c4), then diff the remaining families against it rather than reading each file.Follow-ups
.codex/hooks/scripts and 6 new.codex/scripts/files; repository PowerShell policy requires >= 85% line and >= 75% branch coverage, and this PR adds none..claude/hooks/discovery gate scripts.config/orchestration-routing.jsonpolicy blocks.preparationroute's removedrequires_pr_gatekey has any remaining readers.GitHub Auto-close