@danmoisan/drm-copilot-mcp 1.1.10 → 1.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/mcp-server.js +3517 -1104
- package/package.json +1 -1
- package/resources/claude-customizations/.claude/agents/epic-orchestrator.md +1 -1
- package/resources/claude-customizations/.claude/agents/epic-planner.md +4 -1
- package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +15 -2
- package/resources/claude-customizations/.claude/agents/parallel-planner.md +3 -0
- package/resources/claude-customizations/.claude/agents/pr-author.md +15 -0
- package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-authorization.ps1 +443 -0
- package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +82 -51
- package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +52 -3
- package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +120 -5
- package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1 +127 -0
- package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +163 -15
- package/resources/claude-customizations/.claude/hooks/enforce-orchestration-preimplementation-gate.ps1 +21 -28
- package/resources/claude-customizations/.claude/hooks/enforce-parallel-abandon-gate.ps1 +103 -6
- package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +124 -8
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +171 -15
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.epic-base-branch.ps1 +50 -10
- package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.ps1 +3 -1
- package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner-helpers.ps1 +332 -0
- package/resources/claude-customizations/.claude/hooks/enforce-prd-feature-before-planner.ps1 +211 -182
- package/resources/claude-customizations/.claude/hooks/enforce-promotion-mcp-only.ps1 +35 -7
- package/resources/claude-customizations/.claude/hooks/hook-command-invocation.ps1 +483 -0
- package/resources/claude-customizations/.claude/hooks/hook-command-scanner.ps1 +483 -0
- package/resources/claude-customizations/.claude/hooks/validate-bash.ps1 +218 -6
- package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadius.psm1 +18 -75
- package/resources/claude-customizations/.claude/lib/blast-radius/BlastRadiusConflict.psm1 +290 -0
- package/resources/claude-customizations/.claude/lib/cleanup-manifest/CleanupWorktreeManifest.psm1 +415 -0
- package/resources/claude-customizations/.claude/lib/codex-routing/CodexDeployment.psm1 +1 -0
- package/resources/claude-customizations/.claude/lib/project-file-merge/ProjectFileMerge.psm1 +355 -0
- package/resources/claude-customizations/.claude/lib/project-file-merge/ProjectFileMergeGrammar.psm1 +318 -0
- package/resources/claude-customizations/.claude/lib/project-file-merge/Resolve-MergeableConflict.ps1 +229 -0
- package/resources/claude-customizations/.claude/lib/worktree-resolution/EpicScopeReadiness.psm1 +176 -0
- package/resources/claude-customizations/.claude/lib/worktree-resolution/EpicScopeResolution.psm1 +369 -0
- package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeItemResolution.psm1 +392 -0
- package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeResolution.psm1 +500 -0
- package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeTargetResolution.psm1 +347 -0
- package/resources/claude-customizations/.claude/rules/orchestrator-state.md +27 -0
- package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +66 -2
- package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +323 -16
- package/resources/claude-customizations/.claude/skills/epic-orchestrate/SKILL.md +14 -1
- package/resources/claude-customizations/.claude/skills/epic-plan/SKILL.md +4 -0
- package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +46 -1
- package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +3 -1
- package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +75 -8
- package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +6 -0
- package/resources/claude-customizations/.claude/skills/powershell-orchestration-state-machine/SKILL.md +29 -1
- package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +15 -0
- package/resources/claude-customizations/.claude/skills/quota-throttling/SKILL.md +221 -0
- package/resources/claude-customizations/config/blast-radius.json +7 -0
- package/resources/claude-customizations/pack-manifests/core.json +16 -0
- package/resources/codex-and-agents-customizations/.agents/skills/codex-model-routing/SKILL.md +13 -14
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrate/SKILL.md +41 -0
- package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md +41 -0
- package/resources/codex-and-agents-customizations/.agents/skills/repo-automation-adapter/SKILL.md +26 -0
- package/resources/codex-and-agents-customizations/.codex/config.toml +1 -1
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-merge-gate.ps1 +242 -3
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-planning-only.ps1 +67 -12
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-epic-worktree-removal-gate.ps1 +34 -8
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1 +163 -15
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-orchestration-preimplementation-gate.ps1 +6 -1
- package/resources/codex-and-agents-customizations/.codex/hooks/enforce-promotion-mcp-only.ps1 +34 -7
- package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-invocation.ps1 +483 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/hook-command-scanner.ps1 +483 -0
- package/resources/codex-and-agents-customizations/.codex/hooks/validate-bash.ps1 +130 -2
- package/resources/codex-and-agents-customizations/.codex/scripts/Resolve-CodexDeployment.ps1 +87 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/Resolve-CodexTopology.ps1 +96 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/codex-routing-cli-common.ps1 +370 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-launch-contract.ps1 +475 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-launch-runtime.ps1 +445 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-persistence-runtime.ps1 +118 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/epic-child-sandbox-preflight.ps1 +69 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/launch-epic-child-wave.ps1 +471 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/post-codex-worktree-session.ps1 +280 -0
- package/resources/codex-and-agents-customizations/.codex/scripts/resume-epic-child.ps1 +263 -0
- package/resources/codex-and-agents-customizations/.codex-variants/csharp-legacy/agents/csharp-typed-engineer.toml +2 -1
- package/resources/codex-and-agents-customizations/pack-manifests/core.json +23 -1
- package/resources/config/orchestration-handoff-registry.json +138 -0
- package/resources/config/orchestration-handoff.schema.json +472 -0
- package/resources/lib/codex-routing/CodexDeployment.psm1 +315 -0
- package/resources/lib/codex-routing/CodexTopology.psm1 +394 -0
- package/resources/powershell/PoshQC/settings/pester.runsettings.psd1 +64 -0
|
@@ -234,6 +234,8 @@ There is no final integration pull request and no fan-in path: the epic surface'
|
|
|
234
234
|
integration-branch lifecycle has no counterpart on this surface, and its absence is structural
|
|
235
235
|
rather than an omission.
|
|
236
236
|
|
|
237
|
+
**Checkpoint hygiene (issue #673).** The coordinating session never holds a per-feature checkpoint at its own root. Before the first item delegation of a run it moves any `artifacts/orchestration/orchestrator-state.json` at its root to `artifacts/orchestration/handoff/orchestrator-state.issue-<issue-num>.<yyyy-MM-ddTHH-mm>.json`, and writes none there for the rest of the run, because each item's checkpoint lives in that item's worktree. A gated call the coordinator issues on an item's behalf is resolved by the item's issue number and branch, never by the coordinator root.
|
|
238
|
+
|
|
237
239
|
## Parallel-Mode Kickoff Parameter
|
|
238
240
|
|
|
239
241
|
When `parallel-orchestrator` delegates an item to `Agent(orchestrator)`, the delegation prompt
|
|
@@ -326,12 +328,43 @@ Procedure, per item:
|
|
|
326
328
|
|
|
327
329
|
**Merge-gate authorization.** `.claude/hooks/enforce-epic-merge-gate.ps1` is a project-wide
|
|
328
330
|
`PreToolUse` Bash-matcher hook that denies any `gh pr merge --merge` unless a checkpoint satisfies
|
|
329
|
-
one of its allow conditions; its block reason is `EPIC_MERGE_GATE_BLOCKED`. The gate
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
331
|
+
one of its allow conditions; its block reason is `EPIC_MERGE_GATE_BLOCKED`. The gate has
|
|
332
|
+
four allow conditions
|
|
333
|
+
which it evaluates in this order: a per-feature checkpoint with `epic_mode == true` and
|
|
334
|
+
`step9_status == "passed"`; an epic checkpoint whose `epic_merge_pr.ci_gate.conclusion` is
|
|
335
|
+
`success` with a matching `pr_number`; the parallel condition described next; and a standalone
|
|
336
|
+
merge authorization record, described after it. The parallel condition authorizes a per-item merge
|
|
337
|
+
when the parallel-orchestrator checkpoint has `route_id == "parallel"`, the target item's
|
|
338
|
+
`merge_status == "ci_green"`, and, when a PR number is named, it matches the item's `pr_number`.
|
|
339
|
+
Step 3 above is therefore permitted for a legitimate parallel merge; a missing, unreadable, or
|
|
340
|
+
invalid parallel checkpoint, a target item whose `merge_status` is not `ci_green`, or a PR number
|
|
341
|
+
that matches no item still fails closed with `EPIC_MERGE_GATE_BLOCKED`.
|
|
342
|
+
|
|
343
|
+
The standalone condition (issue #670) is the only route for merging a pull request that is not a
|
|
344
|
+
parallel item, such as a standalone fix that unblocks the run. It is evaluated last and never
|
|
345
|
+
overrides the other three. Writer procedure for the coordinating session:
|
|
346
|
+
|
|
347
|
+
1. Write the record into a top-level `standalone_merge_authorizations` array in the
|
|
348
|
+
parallel-orchestrator checkpoint (`artifacts/orchestration/parallel-orchestrator-state.json`);
|
|
349
|
+
the gate also reads the key from the per-feature and epic checkpoints.
|
|
350
|
+
2. Write one entry per authorized pull request, with these fields: `pr_number` (JSON integer),
|
|
351
|
+
`pr_url` (ending in `/pull/<pr_number>`), `issue_num` (JSON integer), `branch_name`,
|
|
352
|
+
`authorized_by`, `authorized_at` (ISO 8601 date-time), `session_id`, `basis` (at least 20
|
|
353
|
+
characters), and optionally `run_slug`.
|
|
354
|
+
3. Set `session_id` to the session id of the coordinating session that will run the merge
|
|
355
|
+
command. The gate compares it with the live hook envelope and denies on any difference, so a
|
|
356
|
+
record written by another session or a previous run authorizes nothing.
|
|
357
|
+
4. Name the pull request explicitly in the merge command (`gh pr merge <PR> --merge`); a bare
|
|
358
|
+
command never satisfies the standalone condition.
|
|
359
|
+
|
|
360
|
+
A blanket flag is actively rejected: a `standalone_merge_authorizations` value that names no
|
|
361
|
+
specific pull request (for example `true`) denies with
|
|
362
|
+
`STANDALONE_MERGE_AUTHORIZATION_NOT_PR_SPECIFIC`. Other denials carry
|
|
363
|
+
`STANDALONE_MERGE_AUTHORIZATION_ABSENT`, `STANDALONE_MERGE_AUTHORIZATION_PR_MISMATCH`, or
|
|
364
|
+
`STANDALONE_MERGE_AUTHORIZATION_MALFORMED` (naming the failing field) after the
|
|
365
|
+
`EPIC_MERGE_GATE_BLOCKED` token. The record is a policy-level, auditable declaration, not a
|
|
366
|
+
security control; see the Standalone-Merge-Authorization section of
|
|
367
|
+
`.claude/rules/orchestrator-state.md` for the full field rules and the disclosure.
|
|
335
368
|
|
|
336
369
|
Branch protection on `main` affects only the pacing of step 3, not its ownership: if `main`
|
|
337
370
|
requires branches to be up to date, an automated `gh pr update-branch` plus re-green cycle is
|
|
@@ -344,6 +377,29 @@ Remediation is child-owned and parent-initiated. The conflict is always between
|
|
|
344
377
|
branch and `origin/main`; there is no integration branch and therefore no fan-in conflict path on
|
|
345
378
|
this surface.
|
|
346
379
|
|
|
380
|
+
Project-file conflicts are resolved by the parent first (issue #643); the numbered steps below are
|
|
381
|
+
the escalation path.
|
|
382
|
+
|
|
383
|
+
- (a) On a conflicted `gh pr merge --merge`, the parent runs the two commands
|
|
384
|
+
`git -C <worktree_path> fetch origin main` and
|
|
385
|
+
`git -C <worktree_path> merge --no-commit origin/main`.
|
|
386
|
+
- (b) The parent then runs
|
|
387
|
+
`pwsh -NoProfile -File .claude/lib/project-file-merge/Resolve-MergeableConflict.ps1 -Worktree <worktree_path>`
|
|
388
|
+
and parses its single JSON object. A `result` of `escalate` makes the parent run
|
|
389
|
+
`git -C <worktree_path> merge --abort`
|
|
390
|
+
and continue with step 1 below, including `escalate_paths` in the Blocking finding.
|
|
391
|
+
- (c) On `resolved` the parent stages and commits the resolved paths with a message body listing
|
|
392
|
+
every entry added from each side and every version choice, then runs the three commands
|
|
393
|
+
`dotnet tool restore --tool-manifest <worktree_path>/.config/dotnet-tools.json`,
|
|
394
|
+
`dotnet csharpier check <worktree_path>`, and
|
|
395
|
+
`dotnet build <worktree_path>/<solution>`, each with path arguments rather than `cd`.
|
|
396
|
+
A failing check reverts with
|
|
397
|
+
`git -C <worktree_path> reset --hard HEAD~1`
|
|
398
|
+
and escalates with the tool output as the finding.
|
|
399
|
+
- (d) On success the parent pushes the item branch, records `mergeable_conflicts_resolved` on the
|
|
400
|
+
item, sets `merge_status: pr_open`, regenerates `parallel-status.md`, and re-enters
|
|
401
|
+
`## Per-Item Merge to Main (Merge-on-Green)` at the durable `gh pr checks` confirmation step.
|
|
402
|
+
|
|
347
403
|
1. On a conflicted `gh pr merge --merge`, the parent detects the failure and re-delegates that item's
|
|
348
404
|
child orchestration, passing the conflict signal and the instruction to resolve against
|
|
349
405
|
`origin/main`. The conflict capture and the finding write both belong to the child's
|
|
@@ -427,6 +483,14 @@ whose rows appear only once F6 populates that array; section `## Drift Events` p
|
|
|
427
483
|
`drift_events[]`, which only F8 populates. An empty array renders an empty section rather than an
|
|
428
484
|
omitted one.
|
|
429
485
|
|
|
486
|
+
The projection's `## Mergeable Conflicts Resolved` heading renders
|
|
487
|
+
`items[].mergeable_conflicts_resolved`: for each entry the path, the `resolved_at` stamp, the
|
|
488
|
+
`merged_against` ref, the `merge_commit_sha`, the entries added from each side, and the version
|
|
489
|
+
resolutions. The same resolution is cited in three further places: the body of the resolution
|
|
490
|
+
commit message, the pull-request body, and an evidence artifact at
|
|
491
|
+
`docs/features/parallel/<slug>/evidence/other/mergeable-conflicts.<yyyy-MM-ddTHH-mm>.md` carrying
|
|
492
|
+
`Timestamp`, `Command`, `EXIT_CODE`, and the script's JSON output verbatim.
|
|
493
|
+
|
|
430
494
|
Regeneration boundaries — regenerate at each of the following, not only at final completion:
|
|
431
495
|
|
|
432
496
|
- Run kickoff, seeding the initial projection from the manifest and the seeded cohorts.
|
|
@@ -435,6 +499,7 @@ Regeneration boundaries — regenerate at each of the following, not only at fin
|
|
|
435
499
|
- Every `recolor_generation` increment.
|
|
436
500
|
- Every append to `mutations[]`.
|
|
437
501
|
- Every append to `drift_events[]`.
|
|
502
|
+
- Every append to an item's `mergeable_conflicts_resolved`.
|
|
438
503
|
- Run completion in `closed` mode, or run close in `open` mode.
|
|
439
504
|
|
|
440
505
|
Defining the `mutations[]` and `drift_events[]` appends as regeneration boundaries here means F6 and
|
|
@@ -444,8 +509,10 @@ F8 need no amendment to these projection rules.
|
|
|
444
509
|
|
|
445
510
|
This section is consumption documentation only. The checkpoint schema is owned by F3, defined once
|
|
446
511
|
as prose invariants in `.claude/rules/parallel-orchestration.md`, and enforced by
|
|
447
|
-
`scripts/dev_tools/validate_parallel_orchestrator_state.py`. Consume that schema;
|
|
448
|
-
|
|
512
|
+
`scripts/dev_tools/validate_parallel_orchestrator_state.py`. Consume that schema;
|
|
513
|
+
add no field to it that `.claude/rules/parallel-orchestration.md` does not declare,
|
|
514
|
+
and extend no enum in it. `mergeable_conflicts_resolved` is the one declared optional item
|
|
515
|
+
field.
|
|
449
516
|
|
|
450
517
|
Fields `parallel-orchestrator` writes to `artifacts/orchestration/parallel-orchestrator-state.json`:
|
|
451
518
|
`objective`, `route_id: "parallel"`, `parallel_slug`, `parallel_manifest_path`,
|
|
@@ -196,6 +196,10 @@ The facade re-exports the five functions this skill needs: `Get-PlanPaths` (port
|
|
|
196
196
|
call to `Test-BlastRadius` in `@(...)`: it writes its findings to the pipeline, so a zero-element
|
|
197
197
|
result writes nothing and a one-element result writes a single object.
|
|
198
198
|
|
|
199
|
+
`Test-BlastRadiusConflict` reads the optional `mergeable_paths` list from that truth table and
|
|
200
|
+
contributes no `path_overlap` edge for a path matching it, while the path itself stays in the
|
|
201
|
+
declared radius and is still read by every audit.
|
|
202
|
+
|
|
199
203
|
The truth table the port reads is `config/blast-radius.json`, which push-down publishes into the
|
|
200
204
|
destination workspace alongside `.claude`.
|
|
201
205
|
|
|
@@ -312,6 +316,8 @@ The library returns the partition; the planner supplies the record fields.
|
|
|
312
316
|
`Test-BlastRadiusConflict` to every unordered pair of `declared` radii, then pass the pairs as
|
|
313
317
|
`--edges "<a>:<b> ..."` and the item keys as `--keys "<k1> <k2> ..."`.
|
|
314
318
|
Read the verdict from the conflict key of the returned hashtable.
|
|
319
|
+
`Test-BlastRadiusConflict` contributes no `path_overlap` edge for a path matching the truth
|
|
320
|
+
table's optional `mergeable_paths` list, and the path stays in the declared radius.
|
|
315
321
|
The hashtable itself is always truthy, so a bare boolean test on the result treats every pair as
|
|
316
322
|
conflicting and serializes the whole run. This is the sibling hazard to the `@(...)` warning
|
|
317
323
|
above for `Test-BlastRadius`: that function writes an `IList`-shaped pipeline result whose
|
|
@@ -42,6 +42,35 @@ For short-path runs, also persist:
|
|
|
42
42
|
- `phase0_execution_summary`
|
|
43
43
|
- `resume_after_manual_bootstrap` (next step token)
|
|
44
44
|
|
|
45
|
+
## Portable Prepared-State Projection
|
|
46
|
+
|
|
47
|
+
When the PowerShell delivery flow resumes from a provider-neutral prepared-state
|
|
48
|
+
handoff, the active destination projection is
|
|
49
|
+
`artifacts/orchestration/orchestrator-state.json`. Validate and retain:
|
|
50
|
+
|
|
51
|
+
- the destination provider, checkpoint expression, selected projector,
|
|
52
|
+
`plan-path`, and exact recorded `next_step`;
|
|
53
|
+
- the portable handoff ID, envelope and latest-history SHA-256 values, selected
|
|
54
|
+
adapter, source validator, identity, repository/workspace/branch binding,
|
|
55
|
+
exact plan proof, lifecycle, capabilities, and scheduler context;
|
|
56
|
+
- the source checkpoint path/hash/archive facts and opaque historical receipt
|
|
57
|
+
references without converting them into Claude receipts; and
|
|
58
|
+
- `destination_evidence: { status: "pending_first_delegation", receipts: [] }`
|
|
59
|
+
until the first new Claude delegation after materialization.
|
|
60
|
+
|
|
61
|
+
Do not rediscover the plan or rerun any phase listed in
|
|
62
|
+
`portable_handoff.lifecycle.completed_phases`. Resume only the recorded
|
|
63
|
+
transition. Record Claude model, launch, worktree, and receipt evidence through
|
|
64
|
+
Claude-native fields for new work; functional parity does not require copying
|
|
65
|
+
Codex field names or launch representations.
|
|
66
|
+
|
|
67
|
+
For a scheduled parallel or epic child, validate the run/item, parent
|
|
68
|
+
checkpoint path/hash, scheduler and child owners, return contract, exact plan
|
|
69
|
+
hash, child checkpoint hash, and result hash before returning a result. The
|
|
70
|
+
ordinary child may update only its bounded status/result projection. Cohort or
|
|
71
|
+
wave order, barriers, fan-in, integration, cleanup, worktree lifecycle, and
|
|
72
|
+
parent completion remain owned by the parent scheduler.
|
|
73
|
+
|
|
45
74
|
## Update Protocol
|
|
46
75
|
|
|
47
76
|
- Write checkpoint after every completed orchestration sub-step.
|
|
@@ -55,4 +84,3 @@ On invocation:
|
|
|
55
84
|
2) If incomplete, resume from `next_step` without re-running `completed_steps`.
|
|
56
85
|
3) If missing or completed, start at phase-0 intake.
|
|
57
86
|
4) If user explicitly requests restart, reset checkpoint and start phase-0.
|
|
58
|
-
|
|
@@ -76,3 +76,18 @@ writes and the `gh pr create` / `gh pr edit --body-file` handoff.
|
|
|
76
76
|
- Do not treat PR numbers as issues.
|
|
77
77
|
- Auto-close bullets must use exactly `- Closes #NNN` format, sourced only from "Issues to autoclose" or "Author-asserted autoclose issues."
|
|
78
78
|
- If GitHub validation is unavailable/unverified, do not emit `Closes`; use the fallback `None` bullet.
|
|
79
|
+
|
|
80
|
+
## Required `--head` on `gh pr create` (issue #687)
|
|
81
|
+
|
|
82
|
+
Every `gh pr create` command this agent issues MUST carry an explicit
|
|
83
|
+
`--head <branch>` naming the branch the pull request is opened from.
|
|
84
|
+
|
|
85
|
+
This is what makes the call's target derivable. `enforce-pr-author-skill.ps1` resolves the
|
|
86
|
+
worktree the call pertains to from the command text, and validates the orchestrator checkpoint
|
|
87
|
+
belonging to that worktree. Without `--head`, `gh pr create` infers its head branch from the
|
|
88
|
+
current checkout and the command carries no signal at all, so the gate denies with
|
|
89
|
+
`TARGET_WORKTREE_NOT_DERIVABLE` rather than validating against whichever checkpoint occupies the
|
|
90
|
+
session root, which in a parallel or epic topology belongs to a different item.
|
|
91
|
+
|
|
92
|
+
Pass `--head` even when the branch is the current one: the gate resolves it to the session root
|
|
93
|
+
and behaves exactly as before, and the command stays correct if it is ever replayed elsewhere.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quota-throttling
|
|
3
|
+
description: 'Quota throttling and account-switching policy for multi-agent orchestration. Use when pacing agent work against five-hour and seven-day usage limits, deciding whether and when to switch accounts, setting concurrency caps, forecasting a rate-limit wall, handling total weekly exhaustion, or designing a usage monitor. Covers account viability, failover-dependent pacing targets, the measured cost model, commit-before-the-wall, and the coordinator/agent division of labour.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Quota Throttling and Account-Switching Policy
|
|
7
|
+
|
|
8
|
+
Policy for keeping long-running, multi-agent orchestration inside account usage limits without
|
|
9
|
+
losing work. Derived from about five days of continuous multi-agent orchestration (TaskMaster runs
|
|
10
|
+
`bugs-2026-09-11` and `bugs-2026-09-17`).
|
|
11
|
+
|
|
12
|
+
Every figure marked **MEASURED** was observed; figures marked **ESTIMATE** are extrapolations.
|
|
13
|
+
Cost figures are machine- and repository-specific. Re-measure before relying on them elsewhere.
|
|
14
|
+
|
|
15
|
+
## When to Use This Skill
|
|
16
|
+
|
|
17
|
+
Use this skill when:
|
|
18
|
+
|
|
19
|
+
- a coordinating session runs orchestrators, epic runs, or parallel runs that spawn subagents;
|
|
20
|
+
- deciding whether to start, stagger, hold, or stop agent work because of usage limits;
|
|
21
|
+
- choosing whether and when to switch between accounts;
|
|
22
|
+
- a rate-limit wall is forecast, or every account is exhausted;
|
|
23
|
+
- designing a monitor that watches usage or CI state.
|
|
24
|
+
|
|
25
|
+
## Reading Quota
|
|
26
|
+
|
|
27
|
+
The coordinator reads usage from the account switcher, for example `cswap list --json`. The
|
|
28
|
+
fields each rule below depends on:
|
|
29
|
+
|
|
30
|
+
| Field | Meaning |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `accounts[].active` | Whether the account currently supplies credentials. |
|
|
33
|
+
| `accounts[].usageStatus` | Must be `ok`; any other value makes the account non-viable. |
|
|
34
|
+
| `usage.fiveHour.pct` | Five-hour window utilization, an integer percentage. |
|
|
35
|
+
| `usage.fiveHour.resetsAt` | Authoritative ISO-8601 UTC reset time. `null` means the window has not started. |
|
|
36
|
+
| `usage.sevenDay.pct` | Seven-day utilization, an integer percentage. |
|
|
37
|
+
| `usage.sevenDay.resetsAt` | Authoritative ISO-8601 UTC weekly reset time. |
|
|
38
|
+
| `usage.sevenDay.willLastToReset` | The switcher's own projection of whether the weekly budget lasts. |
|
|
39
|
+
| `usage.*.clock`, `usage.*.countdown` | Human-readable display values. `clock` is LOCAL time; do not use it for arithmetic. |
|
|
40
|
+
|
|
41
|
+
Some switchers switch automatically on the five-hour threshold alone and do not consult the
|
|
42
|
+
seven-day window. Such a switcher can hand over to an account whose five-hour window has reset
|
|
43
|
+
but whose weekly budget is spent. Apply section 1 yourself rather than relying on the switcher.
|
|
44
|
+
|
|
45
|
+
## 1. Account Viability
|
|
46
|
+
|
|
47
|
+
An account is a viable target only if BOTH hold:
|
|
48
|
+
|
|
49
|
+
- seven-day usage < 95%
|
|
50
|
+
- five-hour usage < 90%
|
|
51
|
+
|
|
52
|
+
The weekly gate dominates. An account at >= 95% weekly is NOT a viable target regardless of its
|
|
53
|
+
five-hour state, and must be excluded from all pacing math.
|
|
54
|
+
|
|
55
|
+
The binding budget is `min(five-hour headroom to 90%, weekly headroom to 95%)`. Compute both every
|
|
56
|
+
time. Late in a week the weekly headroom is usually the smaller number, and the five-hour window
|
|
57
|
+
is then irrelevant.
|
|
58
|
+
|
|
59
|
+
## 2. Pacing Target Depends on Whether a Failover Exists
|
|
60
|
+
|
|
61
|
+
**Two or more viable accounts: front-load.** Target about 90% of the five-hour window in about
|
|
62
|
+
2 hours (about 45% per hour). Reaching 90% triggers a switch, so the unused remainder of the
|
|
63
|
+
window costs nothing.
|
|
64
|
+
|
|
65
|
+
**Exactly one viable account: spread.** Target about 90% across the WHOLE five-hour window (about
|
|
66
|
+
18% per hour). Front-loading here is wrong: reaching 90% at the 2-hour mark produces a stall of
|
|
67
|
+
about 3 hours with no account to switch to.
|
|
68
|
+
|
|
69
|
+
These are different policies, not different settings of one policy. Applying the two-account
|
|
70
|
+
target to a one-account situation is the most expensive mistake observed (see section 12,
|
|
71
|
+
item 1).
|
|
72
|
+
|
|
73
|
+
## 3. Cost Model (MEASURED, Serialized Single Items)
|
|
74
|
+
|
|
75
|
+
| Activity | Five-hour points | Weekly points | Wall clock |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| Coordination only (API calls, git, checkpoint writes, no agents) | ~3 total | negligible | — |
|
|
78
|
+
| One item, full cycle (child + executor + toolchain + coverage run) | ~17 | ~3 | ~43 min |
|
|
79
|
+
| One plan revision, or a low-cost item | ~4-5 | — | — |
|
|
80
|
+
| Three items entering Phase 0 simultaneously | 96-108 per hour | — | a full five-hour window in 62 min |
|
|
81
|
+
|
|
82
|
+
Builds and test runs consume wall-clock time but zero quota. A long quiet period at 0% per hour
|
|
83
|
+
with agents alive usually means they are inside a build, not stalled.
|
|
84
|
+
|
|
85
|
+
Ratio (ESTIMATE, two data points): one full five-hour window is about 14 weekly points.
|
|
86
|
+
|
|
87
|
+
## 4. Concurrency Control
|
|
88
|
+
|
|
89
|
+
A concurrency cap governs an orchestrator's DIRECT children. Each child spawns its own
|
|
90
|
+
grandchildren (executors, planners, researchers), and those are the dominant consumers. Always
|
|
91
|
+
express a cap as a budget on TOTAL AGENTS IN THE SUBTREE, and require that it be propagated
|
|
92
|
+
verbatim to every level.
|
|
93
|
+
|
|
94
|
+
A cap change only restricts NEW starts. It does nothing to work already running. Cutting a cap
|
|
95
|
+
from 6 to 2 mid-flight changed the burn rate by zero, because the cost was in agents already
|
|
96
|
+
alive.
|
|
97
|
+
|
|
98
|
+
For in-flight burn there are exactly two controls:
|
|
99
|
+
|
|
100
|
+
- **Commit-and-hold** — finish the current task, commit, start nothing new.
|
|
101
|
+
- **Stopping agents outright** — destructive; use only as a last resort.
|
|
102
|
+
|
|
103
|
+
**Stagger starts.** The dominant cost driver is not item count; it is simultaneous Phase 0
|
|
104
|
+
cycles. Bring items in one at a time and let each settle before starting the next.
|
|
105
|
+
|
|
106
|
+
## 5. Measurement Discipline
|
|
107
|
+
|
|
108
|
+
- The usage percentage is an INTEGER. At 5-minute sampling the computed rate quantizes to
|
|
109
|
+
multiples of about 12% per hour. Do not react to a single sample; measure over spans of at
|
|
110
|
+
least 15 minutes.
|
|
111
|
+
- The FIRST sample after an account switch is inflated by batched accounting. Take a second
|
|
112
|
+
reading before acting on it, but do not dismiss it either; it has been partly real more than
|
|
113
|
+
once.
|
|
114
|
+
- Reset times: the human-readable `clock` field is LOCAL time. The ISO `resetsAt` field is
|
|
115
|
+
authoritative. Convert before doing arithmetic; a four-hour error from this changed a plan.
|
|
116
|
+
- Five-hour window elapsed time = 300 − (minutes until reset). The window starts on first use,
|
|
117
|
+
not on a fixed clock boundary.
|
|
118
|
+
- VERIFY a reset directly before resuming. Never infer it from the clock. A reset timestamp can
|
|
119
|
+
pass while the counter still reads the old value for a minute or two.
|
|
120
|
+
|
|
121
|
+
## 6. Approaching a Wall
|
|
122
|
+
|
|
123
|
+
Commit BEFORE the wall, not at it. A rate-limit error terminates an agent immediately; the agent
|
|
124
|
+
does not wait out the gap and resume. The duration of the outage does not change this risk: even
|
|
125
|
+
a 60-second gap terminates in-flight work.
|
|
126
|
+
|
|
127
|
+
Sequence when a wall is forecast:
|
|
128
|
+
|
|
129
|
+
1. Order all in-flight children to COMMIT NOW, in whatever state, without finishing the current
|
|
130
|
+
task. A committed partial result is recoverable; an uncommitted complete one is not.
|
|
131
|
+
2. Let them keep working until the wall actually arrives.
|
|
132
|
+
3. Set the commit checkpoint with real margin, and recompute it as the rate moves. A checkpoint
|
|
133
|
+
that lands ON the forecast wall protects nothing.
|
|
134
|
+
|
|
135
|
+
Git operations are LOCAL and consume no model quota; they succeed on a fully exhausted account.
|
|
136
|
+
If errors start before committing finishes, keep retrying the COMMIT specifically and nothing
|
|
137
|
+
else.
|
|
138
|
+
|
|
139
|
+
## 7. Total Weekly Exhaustion
|
|
140
|
+
|
|
141
|
+
When no account is viable:
|
|
142
|
+
|
|
143
|
+
1. **Serialize** — stop all parallel activity; zero new starts.
|
|
144
|
+
2. **Commit ALL working documents across ALL worktrees** — every item worktree, the plan-home
|
|
145
|
+
worktree, and every in-flight child, not only the current item.
|
|
146
|
+
3. **Report and hold.**
|
|
147
|
+
|
|
148
|
+
This differs from a routine pause: the outage may last days, so nothing may be left uncommitted
|
|
149
|
+
on the assumption of a quick return.
|
|
150
|
+
|
|
151
|
+
## 8. Switching
|
|
152
|
+
|
|
153
|
+
- Switch at 90% of the five-hour window IF a viable target exists.
|
|
154
|
+
- If no viable target exists, do NOT switch; hold until the earliest reset. Switching onto an
|
|
155
|
+
exhausted account produces immediate failures.
|
|
156
|
+
- Verify the switch landed (active account, both windows) before releasing work.
|
|
157
|
+
- A mid-flight credential change is transparent to running agents. Instruct them explicitly not
|
|
158
|
+
to treat the change, or a brief error around it, as a failure signal.
|
|
159
|
+
|
|
160
|
+
## 9. Usage Credits and Overage
|
|
161
|
+
|
|
162
|
+
Never spend credits on work. The ONLY sanctioned use is completing a non-destructive
|
|
163
|
+
serialization and commit so that work is not lost. If any path offers to continue past a limit
|
|
164
|
+
by consuming credits, stop and ask the user.
|
|
165
|
+
|
|
166
|
+
## 10. Reserve Policy
|
|
167
|
+
|
|
168
|
+
Holding an account's last few points as an emergency commit reserve is correct ONLY while
|
|
169
|
+
something is uncommitted. Verify first: if every branch is pushed and every worktree is clean,
|
|
170
|
+
the reserve protects nothing and should be spent on useful work instead. Check before assuming.
|
|
171
|
+
|
|
172
|
+
## 11. Monitor Design
|
|
173
|
+
|
|
174
|
+
Report on thresholds, not on every sample. An idle monitor that fires every ten minutes costs a
|
|
175
|
+
turn each time and hides the signal among routine readings.
|
|
176
|
+
|
|
177
|
+
**A check for the ABSENCE of a bad state is satisfied by the absence of ALL state.** A CI waiter
|
|
178
|
+
polling for "no pending checks" reported SETTLED during the window between one run being
|
|
179
|
+
superseded and the next registering, when no checks existed at all. Require a POSITIVE assertion
|
|
180
|
+
instead: a conjunction that an empty set cannot satisfy (for example, "at least one required check
|
|
181
|
+
exists AND none is pending").
|
|
182
|
+
|
|
183
|
+
Alert on:
|
|
184
|
+
|
|
185
|
+
- threshold crossings;
|
|
186
|
+
- a sustained rate above target;
|
|
187
|
+
- a non-`ok` status;
|
|
188
|
+
- account-viability changes;
|
|
189
|
+
- window rollovers.
|
|
190
|
+
|
|
191
|
+
Stay silent otherwise.
|
|
192
|
+
|
|
193
|
+
## 12. Observed Failure Modes
|
|
194
|
+
|
|
195
|
+
1. Applying the two-account front-load target with only one viable account.
|
|
196
|
+
Cost: about 95 minutes of idle time.
|
|
197
|
+
2. Cutting a concurrency cap to control burn from work already running.
|
|
198
|
+
Cost: none directly, but the effective control went unused while the window drained.
|
|
199
|
+
3. Launching multiple items into simultaneous Phase 0.
|
|
200
|
+
Cost: a full five-hour window in 62 minutes.
|
|
201
|
+
4. Assuming a fallback account was fresh without checking.
|
|
202
|
+
Cost: about 1 hour, and seven items' preparation output stranded uncommitted when agents were
|
|
203
|
+
terminated.
|
|
204
|
+
5. Setting a commit checkpoint that landed on the forecast wall instead of before it.
|
|
205
|
+
6. Reacting to single 5-minute samples inside the quantization band, producing cap oscillation
|
|
206
|
+
that achieved nothing.
|
|
207
|
+
|
|
208
|
+
## 13. Division of Labour
|
|
209
|
+
|
|
210
|
+
An orchestrating agent generally CANNOT see quota. Do not ask it to estimate usage. The workable
|
|
211
|
+
split is:
|
|
212
|
+
|
|
213
|
+
- the **agent** reports its COST PROFILE: how many agents are alive, what kind of work they are
|
|
214
|
+
doing, and what it is about to start;
|
|
215
|
+
- the **coordinator** supplies the MEASUREMENT and the decision.
|
|
216
|
+
|
|
217
|
+
Have the agent announce before starting each item, and reply with a live reading.
|
|
218
|
+
|
|
219
|
+
Corollary: if the coordinator is slow to respond, the agent should proceed on its own rather than
|
|
220
|
+
stall. A four-hour idle period occurred because an agent correctly held for a ruling that was
|
|
221
|
+
never sent. Absorbing a small pacing error is preferable to repeating that.
|
|
@@ -27,12 +27,14 @@
|
|
|
27
27
|
".claude/hooks/enforce-discovery-artifact-gate.ps1",
|
|
28
28
|
".claude/hooks/enforce-epic-invocation-origin.ps1",
|
|
29
29
|
".claude/hooks/enforce-epic-merge-gate.ps1",
|
|
30
|
+
".claude/hooks/enforce-epic-merge-gate-authorization.ps1",
|
|
30
31
|
".claude/hooks/enforce-epic-wave-barrier.ps1",
|
|
31
32
|
".claude/hooks/enforce-epic-worktree-removal-gate.ps1",
|
|
32
33
|
".claude/hooks/enforce-evidence-locations.ps1",
|
|
33
34
|
".claude/hooks/enforce-feature-folder-order.ps1",
|
|
34
35
|
".claude/hooks/enforce-model-routing-receipt.ps1",
|
|
35
36
|
".claude/hooks/enforce-orchestration-preimplementation-gate.ps1",
|
|
37
|
+
".claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1",
|
|
36
38
|
".claude/hooks/enforce-orchestration-preimplementation-gate-helpers.ps1",
|
|
37
39
|
".claude/hooks/enforce-orchestration-preimplementation-gate-modes.ps1",
|
|
38
40
|
".claude/hooks/enforce-parallel-abandon-gate.ps1",
|
|
@@ -44,8 +46,11 @@
|
|
|
44
46
|
".claude/hooks/enforce-pr-author-skill.epic-base-branch.ps1",
|
|
45
47
|
".claude/hooks/enforce-pr-author-skill.ps1",
|
|
46
48
|
".claude/hooks/enforce-pr-author-skill-helpers.ps1",
|
|
49
|
+
".claude/hooks/enforce-prd-feature-before-planner-helpers.ps1",
|
|
47
50
|
".claude/hooks/enforce-prd-feature-before-planner.ps1",
|
|
48
51
|
".claude/hooks/enforce-promotion-mcp-only.ps1",
|
|
52
|
+
".claude/hooks/hook-command-invocation.ps1",
|
|
53
|
+
".claude/hooks/hook-command-scanner.ps1",
|
|
49
54
|
".claude/hooks/persist-session-id.ps1",
|
|
50
55
|
".claude/hooks/validate-bash.ps1",
|
|
51
56
|
".claude/hooks/validate-discovery-artifact-gate.ps1",
|
|
@@ -101,6 +106,7 @@
|
|
|
101
106
|
".claude/skills/pr-author/SKILL.md",
|
|
102
107
|
".claude/skills/pr-base-branch-merge-base/SKILL.md",
|
|
103
108
|
".claude/skills/pr-context-artifacts/SKILL.md",
|
|
109
|
+
".claude/skills/quota-throttling/SKILL.md",
|
|
104
110
|
".claude/skills/remediation-handoff-atomic-planner/SKILL.md",
|
|
105
111
|
".claude/skills/research-issue/SKILL.md",
|
|
106
112
|
".claude/skills/review-epic/SKILL.md",
|
|
@@ -134,6 +140,11 @@
|
|
|
134
140
|
".claude/lib/blast-radius/BlastRadius.psm1",
|
|
135
141
|
".claude/lib/blast-radius/BlastRadiusNormalization.psm1",
|
|
136
142
|
".claude/lib/blast-radius/BlastRadiusTokenShape.psm1",
|
|
143
|
+
".claude/lib/cleanup-manifest/CleanupWorktreeManifest.psm1",
|
|
144
|
+
".claude/lib/blast-radius/BlastRadiusConflict.psm1",
|
|
145
|
+
".claude/lib/project-file-merge/ProjectFileMergeGrammar.psm1",
|
|
146
|
+
".claude/lib/project-file-merge/ProjectFileMerge.psm1",
|
|
147
|
+
".claude/lib/project-file-merge/Resolve-MergeableConflict.ps1",
|
|
137
148
|
".claude/rules/parallel-orchestration.md",
|
|
138
149
|
".claude/rules/shell.md",
|
|
139
150
|
".claude/lib/bash/compute-cohorts.sh",
|
|
@@ -156,6 +167,11 @@
|
|
|
156
167
|
".claude/lib/mermaid/MermaidLineScanner.psm1",
|
|
157
168
|
".claude/lib/mermaid/MermaidMarkdownFences.psm1",
|
|
158
169
|
".claude/lib/mermaid/MermaidValidation.psm1",
|
|
170
|
+
".claude/lib/worktree-resolution/WorktreeResolution.psm1",
|
|
171
|
+
".claude/lib/worktree-resolution/WorktreeTargetResolution.psm1",
|
|
172
|
+
".claude/lib/worktree-resolution/WorktreeItemResolution.psm1",
|
|
173
|
+
".claude/lib/worktree-resolution/EpicScopeResolution.psm1",
|
|
174
|
+
".claude/lib/worktree-resolution/EpicScopeReadiness.psm1",
|
|
159
175
|
".claude/skills/mermaid-diagram/references/flowchart.md",
|
|
160
176
|
".claude/skills/mermaid-diagram/references/sequence.md",
|
|
161
177
|
".claude/skills/mermaid-diagram/references/class.md",
|
package/resources/codex-and-agents-customizations/.agents/skills/codex-model-routing/SKILL.md
CHANGED
|
@@ -16,7 +16,7 @@ agent profile.
|
|
|
16
16
|
2. Run the canonical topology resolver before choosing a logical agent:
|
|
17
17
|
|
|
18
18
|
```powershell
|
|
19
|
-
|
|
19
|
+
pwsh -NoProfile -File .codex/scripts/Resolve-CodexTopology.ps1 `
|
|
20
20
|
--language <python|powershell|csharp|typescript> `
|
|
21
21
|
--production-file-count <count> `
|
|
22
22
|
--test-file-count <count> `
|
|
@@ -53,7 +53,7 @@ epic root personas are forced independently of file count.
|
|
|
53
53
|
5. Run the canonical resolver:
|
|
54
54
|
|
|
55
55
|
```powershell
|
|
56
|
-
|
|
56
|
+
pwsh -NoProfile -File .codex/scripts/Resolve-CodexDeployment.ps1 `
|
|
57
57
|
--logical-agent <agent> `
|
|
58
58
|
--complexity-band <C1|C2|C3|C4> `
|
|
59
59
|
--execution-context <context> `
|
|
@@ -96,15 +96,14 @@ incomplete, and request a policy change. Do not silently fall back.
|
|
|
96
96
|
## Validation
|
|
97
97
|
|
|
98
98
|
Before accepting delegated results or reporting completion, validate the
|
|
99
|
-
checkpoint with the Codex routing gate
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
when available.
|
|
99
|
+
checkpoint with the Codex routing gate by calling the MCP tool
|
|
100
|
+
`validate_orchestration_artifacts` with these arguments:
|
|
101
|
+
|
|
102
|
+
- `artifact_type`: `orchestrator-state` (use `epic-orchestrator-state` for epic
|
|
103
|
+
execution)
|
|
104
|
+
- `artifact_path`: `artifacts/orchestration/orchestrator-state.json`
|
|
105
|
+
- `workspace_root`: the repository root
|
|
106
|
+
- `require_codex_topology`: `true`
|
|
107
|
+
- `require_codex_model_routing`: `true`
|
|
108
|
+
|
|
109
|
+
The MCP tool is the authoritative completion gate and needs no Python toolchain.
|
|
@@ -39,6 +39,47 @@ On every invocation, the main session must:
|
|
|
39
39
|
selected route's required agents, skills, and MCP tools into checkpoint
|
|
40
40
|
state.
|
|
41
41
|
|
|
42
|
+
## Prepared-State Portable Handoff Intake
|
|
43
|
+
|
|
44
|
+
Treat a portable prepared-state checkpoint as a resume request, not as a new
|
|
45
|
+
orchestration intake. Before delegation:
|
|
46
|
+
|
|
47
|
+
1. Validate the portable envelope through the published, workspace-explicit
|
|
48
|
+
orchestration authority. Require the repository, workspace, branch lineage,
|
|
49
|
+
issue, feature folder, work mode, scheduler context, capabilities, and exact
|
|
50
|
+
next transition to match the current checkout. Supply the complete
|
|
51
|
+
caller-controlled independent expected context on every call to
|
|
52
|
+
`resolve_orchestration_topology`, `resolve_provider_routing`, and
|
|
53
|
+
`transition_prepared_orchestration`: `expected_repository_id`,
|
|
54
|
+
`expected_workspace_root`, `expected_branch`, `expected_source_head_sha`,
|
|
55
|
+
`allowed_head_relationship`, `expected_issue_number`,
|
|
56
|
+
`expected_feature_folder`, `expected_work_mode`, `expected_plan_path`, and
|
|
57
|
+
`expected_plan_sha256`. Derive each value from the destination checkout and
|
|
58
|
+
the caller's own record. A call that omits a value, or that copies one from
|
|
59
|
+
the envelope under validation, is rejected before any service invocation.
|
|
60
|
+
2. Prove the plan from the independently expected repository-relative path and
|
|
61
|
+
raw-byte SHA-256 the caller supplied in `expected_plan_path` and
|
|
62
|
+
`expected_plan_sha256`. Do not search for another plan, rewrite the path,
|
|
63
|
+
follow a symlink outside the repository, substitute a newer plan, or read
|
|
64
|
+
the plan identity from the envelope.
|
|
65
|
+
3. Use `transition_prepared_orchestration` as the only authority permitted to
|
|
66
|
+
materialize the provider-native destination checkpoint. A dry run may
|
|
67
|
+
validate and project the destination state but must not archive or replace
|
|
68
|
+
checkpoint bytes.
|
|
69
|
+
4. Preserve the ordered completed phases and reject any request to replay one
|
|
70
|
+
of them. Do not rerun promotion, research, feature-document authoring,
|
|
71
|
+
atomic planning, or preflight when the envelope records them as complete.
|
|
72
|
+
5. Preserve source-provider model, profile, topology, launch, and receipt data
|
|
73
|
+
as opaque historical evidence. Resolve Codex topology, model routing, and
|
|
74
|
+
launch evidence only for the first new destination delegation after
|
|
75
|
+
materialization; never synthesize Codex receipts for source-provider work.
|
|
76
|
+
|
|
77
|
+
For an ordinary handoff whose recorded next transition is `atomic_execution`,
|
|
78
|
+
resume the exact approved plan through the ordinary Codex atomic-executor path
|
|
79
|
+
at `atomic_execution`. Do not invoke a parent scheduler or rediscover lifecycle
|
|
80
|
+
work. Any contract, authority, plan, replay, or materialization failure returns
|
|
81
|
+
the deterministic blocked result before destination delegation.
|
|
82
|
+
|
|
42
83
|
## Epic Entry Boundary
|
|
43
84
|
|
|
44
85
|
This standalone workflow must not invoke `epic-planner` or `epic-orchestrator`. If intake names
|
package/resources/codex-and-agents-customizations/.agents/skills/orchestrator-state/SKILL.md
CHANGED
|
@@ -17,6 +17,47 @@ A hardened snapshot from another repository contains a JSON Schema for the orche
|
|
|
17
17
|
|
|
18
18
|
This prohibition is specific to the disqualified foreign schema identified by the `drmoisan.github.io/mix-calculator/` `$id`. A schema whose `$id` is repo-local and whose required-field set and `additionalProperties` policy match this repository's checkpoint contract is not the disqualified foreign artifact; even so, the repository's enforcement mechanism remains the Python validator prose-and-logic above, not an imported schema file.
|
|
19
19
|
|
|
20
|
+
## Portable Handoff Projection Invariants
|
|
21
|
+
|
|
22
|
+
A provider-native destination checkpoint materialized from the portable handoff
|
|
23
|
+
contract must retain the following linkage:
|
|
24
|
+
|
|
25
|
+
- `provider`, `checkpoint_expression`, and `destination_projector` identify the
|
|
26
|
+
destination expression and selected adapter.
|
|
27
|
+
- `plan-path` and `next_step` equal the portable envelope's exact plan path and
|
|
28
|
+
recorded lifecycle transition. The destination must not rediscover a plan or
|
|
29
|
+
replace either value from local convention.
|
|
30
|
+
- `portable_handoff` retains the handoff ID, envelope SHA-256, latest history
|
|
31
|
+
entry SHA-256, adapter identity, source validator, identity and binding
|
|
32
|
+
fields, source checkpoint/archive facts, exact plan proof, lifecycle,
|
|
33
|
+
capabilities, and scheduler context.
|
|
34
|
+
- Historical source receipts remain opaque references under
|
|
35
|
+
`portable_handoff.source.expression.historical_receipts`. They must not be
|
|
36
|
+
rewritten as destination-provider receipts.
|
|
37
|
+
- `destination_evidence` starts as `pending_first_delegation` with an empty
|
|
38
|
+
receipt list. Destination routing, topology, model, and receipts may be
|
|
39
|
+
recorded only for the first new delegation after checkpoint materialization.
|
|
40
|
+
|
|
41
|
+
The portable lifecycle permits only the registered state transitions:
|
|
42
|
+
`legacy_v1` to migration, `preparation_complete` to
|
|
43
|
+
`prepared_to_atomic_execution`, `validated` to destination materialization,
|
|
44
|
+
`materialized` to `atomic_execution`, and a bounded scheduled-child return from
|
|
45
|
+
an authorized child execution phase. An attempted replay of a completed phase
|
|
46
|
+
is invalid.
|
|
47
|
+
|
|
48
|
+
A failed contract, binding, capability, authority, plan, replay, dirty-worktree,
|
|
49
|
+
candidate, archive, or replacement check must produce the deterministic blocked
|
|
50
|
+
result and leave the source checkpoint authoritative. A blocked result must
|
|
51
|
+
retain the primary `HANDOFF_*` code and affected paths where applicable; it must
|
|
52
|
+
not record a completed transition or destination delegation.
|
|
53
|
+
|
|
54
|
+
For parallel and epic children, `return_to_scheduler` accepts only a result
|
|
55
|
+
whose run, item, parent checkpoint path/hash, scheduler owner, child execution
|
|
56
|
+
owner, return contract, plan hash, child checkpoint hash, and result hash match
|
|
57
|
+
the envelope. The child may return that bounded result but may not assume
|
|
58
|
+
cohort or wave ordering, barriers, fan-in, integration, cleanup, or parent
|
|
59
|
+
completion authority.
|
|
60
|
+
|
|
20
61
|
## Scope and Backward Compatibility
|
|
21
62
|
|
|
22
63
|
These invariants apply only when the checkpoint contains a top-level `remediation_loop` with a `cycles` array. A checkpoint with no `remediation_loop` (the existing step-based checkpoint shape) is unaffected: it validates exactly as before and produces no new errors. The invariants are additive.
|