@danmoisan/drm-copilot-mcp 1.1.21 → 1.1.23

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.
Files changed (91) hide show
  1. package/out/mcp-server.js +2568 -1261
  2. package/package.json +1 -1
  3. package/resources/claude-customizations/.claude/agent-memory/orchestrator/MEMORY.md +1 -1
  4. package/resources/claude-customizations/.claude/agent-memory/orchestrator/feedback_test_files_count_against_500_cap.md +4 -4
  5. package/resources/claude-customizations/.claude/agents/csharp-typed-engineer.md +1 -1
  6. package/resources/claude-customizations/.claude/agents/feature-review.md +8 -0
  7. package/resources/claude-customizations/.claude/agents/orchestrator.md +1 -1
  8. package/resources/claude-customizations/.claude/agents/parallel-orchestrator.md +46 -6
  9. package/resources/claude-customizations/.claude/agents/powershell-typed-engineer.md +1 -1
  10. package/resources/claude-customizations/.claude/agents/pr-author.md +32 -7
  11. package/resources/claude-customizations/.claude/agents/python-typed-engineer.md +1 -1
  12. package/resources/claude-customizations/.claude/hooks/enforce-completion-consistency.ps1 +4 -3
  13. package/resources/claude-customizations/.claude/hooks/enforce-discovery-artifact-gate.ps1 +2 -1
  14. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate-green-ci.ps1 +325 -0
  15. package/resources/claude-customizations/.claude/hooks/enforce-epic-merge-gate.ps1 +22 -6
  16. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1 +23 -10
  17. package/resources/claude-customizations/.claude/hooks/enforce-epic-worktree-removal-gate.ps1 +29 -21
  18. package/resources/claude-customizations/.claude/hooks/enforce-file-size-limit.ps1 +244 -0
  19. package/resources/claude-customizations/.claude/hooks/enforce-model-routing-receipt.ps1 +48 -0
  20. package/resources/claude-customizations/.claude/hooks/enforce-parallel-worktree-removal-gate.ps1 +22 -11
  21. package/resources/claude-customizations/.claude/hooks/enforce-powershell-batch-budget.ps1 +2 -1
  22. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-command-allowlist.ps1 +8 -2
  23. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill-helpers.ps1 +15 -10
  24. package/resources/claude-customizations/.claude/hooks/enforce-pr-author-skill.current-branch.ps1 +149 -0
  25. package/resources/claude-customizations/.claude/hooks/enforce-python-batch-budget.ps1 +2 -1
  26. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output-feature-folder.ps1 +146 -0
  27. package/resources/claude-customizations/.claude/hooks/validate-orchestrator-output.ps1 +25 -3
  28. package/resources/claude-customizations/.claude/lib/cleanup-manifest/CleanupWorktreeManifest.psm1 +33 -6
  29. package/resources/claude-customizations/.claude/lib/file-size-policy/FileSizePolicy.psm1 +434 -0
  30. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateFeatureFolderRecord.psm1 +166 -0
  31. package/resources/claude-customizations/.claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1 +8 -3
  32. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeRunRecordPath.psm1 +185 -0
  33. package/resources/claude-customizations/.claude/lib/worktree-resolution/WorktreeRunResolution.psm1 +11 -21
  34. package/resources/claude-customizations/.claude/rules/general-code-change.md +4 -1
  35. package/resources/claude-customizations/.claude/rules/orchestrator-state.md +28 -5
  36. package/resources/claude-customizations/.claude/rules/parallel-orchestration.md +2 -2
  37. package/resources/claude-customizations/.claude/rules/powershell.md +1 -1
  38. package/resources/claude-customizations/.claude/rules/shell.md +1 -1
  39. package/resources/claude-customizations/.claude/settings.json +4 -0
  40. package/resources/claude-customizations/.claude/skills/cleanup-merged-worktrees/SKILL.md +2 -2
  41. package/resources/claude-customizations/.claude/skills/execution-environment/SKILL.md +2 -1
  42. package/resources/claude-customizations/.claude/skills/feature-promotion-lifecycle/SKILL.md +1 -0
  43. package/resources/claude-customizations/.claude/skills/orchestrate/SKILL.md +11 -4
  44. package/resources/claude-customizations/.claude/skills/parallel-add/SKILL.md +4 -1
  45. package/resources/claude-customizations/.claude/skills/parallel-orchestrate/SKILL.md +90 -14
  46. package/resources/claude-customizations/.claude/skills/parallel-plan/SKILL.md +3 -1
  47. package/resources/claude-customizations/.claude/skills/pr-author/SKILL.md +39 -9
  48. package/resources/claude-customizations/.claude-variants/csharp-legacy/agents/csharp-typed-engineer.md +1 -1
  49. package/resources/claude-customizations/pack-manifests/core.json +14 -0
  50. package/resources/codex-and-agents-customizations/.agents/skills/execution-environment/SKILL.md +2 -1
  51. package/resources/codex-and-agents-customizations/.agents/skills/feature-promotion-lifecycle/SKILL.md +1 -1
  52. package/resources/codex-and-agents-customizations/.agents/skills/feature-review/SKILL.md +8 -0
  53. package/resources/codex-and-agents-customizations/.agents/skills/general-code-change/SKILL.md +4 -1
  54. package/resources/codex-and-agents-customizations/.agents/skills/powershell/SKILL.md +1 -1
  55. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c1.toml +1 -1
  56. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c2.toml +1 -1
  57. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c3-elevated.toml +1 -1
  58. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c3.toml +1 -1
  59. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer-c4.toml +1 -1
  60. package/resources/codex-and-agents-customizations/.codex/agents/csharp-typed-engineer.toml +1 -1
  61. package/resources/codex-and-agents-customizations/.codex/agents/feature-review.toml +8 -0
  62. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c1.toml +1 -1
  63. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c2.toml +1 -1
  64. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c3-elevated.toml +1 -1
  65. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c3.toml +1 -1
  66. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer-c4.toml +1 -1
  67. package/resources/codex-and-agents-customizations/.codex/agents/powershell-typed-engineer.toml +1 -1
  68. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c1.toml +1 -1
  69. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c2.toml +1 -1
  70. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c3-elevated.toml +1 -1
  71. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c3.toml +1 -1
  72. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer-c4.toml +1 -1
  73. package/resources/codex-and-agents-customizations/.codex/agents/python-typed-engineer.toml +1 -1
  74. package/resources/codex-and-agents-customizations/.codex/config.toml +7 -1
  75. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-file-size-limit.ps1 +282 -0
  76. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-powershell-batch-budget.ps1 +2 -1
  77. package/resources/codex-and-agents-customizations/.codex/hooks/enforce-python-batch-budget.ps1 +2 -1
  78. package/resources/codex-and-agents-customizations/.codex/hooks/file-size-policy.ps1 +421 -0
  79. package/resources/codex-and-agents-customizations/.codex-variants/csharp-legacy/agents/csharp-typed-engineer.toml +1 -1
  80. package/resources/codex-and-agents-customizations/AGENTS.md +4 -1
  81. package/resources/codex-and-agents-customizations/pack-manifests/core.json +3 -0
  82. package/resources/customizations/.github/agents/commentary-remediation.agent.md +1 -1
  83. package/resources/customizations/.github/agents/python-execution-only-typed.agent.md +1 -1
  84. package/resources/customizations/.github/agents/python-typed-engineer.agent.md +1 -1
  85. package/resources/customizations/.github/instructions/general-code-change.instructions.md +5 -2
  86. package/resources/customizations/.github/instructions/powershell-code-change.instructions.md +1 -1
  87. package/resources/customizations/.github/prompts/remediate-comments.prompt.md +1 -1
  88. package/resources/customizations/.github/skills/execution-environment/SKILL.md +2 -1
  89. package/resources/customizations/.github/skills/feature-review-workflow/SKILL.md +8 -0
  90. package/resources/templates/policy_audit/code-review.yyyy-MM-ddTHH-mm.md +4 -4
  91. package/resources/templates/policy_audit/policy-audit.yyyy-MM-ddTHH-mm.md +4 -4
@@ -248,6 +248,10 @@ carries exactly these five elements.
248
248
  The token `Parallel mode: true` must appear exactly: it is the marker F7's Layer 1 barrier hook
249
249
  matches on. The clause `PR base branch MUST be main` is the child's explicit base-branch
250
250
  instruction, recorded as prompt text rather than left to a base-branch ancestry heuristic.
251
+ The prompt also instructs the child to record top-level `parallel_mode: true` and
252
+ `parallel_slug: <slug>` in its first per-feature checkpoint write (issue #997). Both keys are
253
+ unvalidated; the merge gate's green-CI branch declines a checkpoint that carries either, so a
254
+ parallel child that records them cannot merge its own pull request through that branch; the exclusion is best-effort when the keys are omitted.
251
255
  2. The item's active feature folder path, written literally as `docs/features/active/<basename>`.
252
256
  The child needs it for its own operation, and F7's Layer 1 hook resolves the target item by
253
257
  scanning the prompt for exactly that path shape, so the path is emitted as a bare path token.
@@ -263,7 +267,12 @@ carries exactly these five elements.
263
267
  with origin `filed_before_orchestration` unless the issue was transferred, waiving
264
268
  `potential_to_issue` and the promotion-entry tool for the checkpoint's promotion-type. When a
265
269
  lifecycle record for the item exists under `docs/features/potential/promoted/`, the child cites
266
- it as `potential_record`.
270
+ it as `potential_record`. The preparation child already created and committed the item's feature
271
+ folder, so the prompt also instructs the execution child not to call
272
+ `new_active_feature_folder`, to confirm the folder read-only
273
+ (`git cat-file -t HEAD:<feature-folder>` prints `tree`), to add `new_active_feature_folder` to
274
+ `waived_tools`, and to record `issue_adoption.feature_folder_record` with `path` equal to the
275
+ checkpoint `feature-folder`, `verified_via` `git_cat_file_head`, `verified_at`, and `evidence`.
267
276
  5. The model-budget marker line `model_budget.fable_policy: <disabled|available|preferred>.`
268
277
 
269
278
  Spawn parameters, passed on the `Agent` call and never written into the prompt text:
@@ -358,9 +367,11 @@ delegations, not to fork-routed skill invocations.
358
367
  ## Per-Item Merge to Main (Merge-on-Green)
359
368
 
360
369
  The parent — `parallel-orchestrator` — performs each item's merge to `main`. The child contract is
361
- unchanged: `.claude/skills/orchestrate/SKILL.md` is **not modified by this feature**. There is no
362
- `parallel_mode` clause in its step 9, no `parallel_merge` object in the child checkpoint, and no
363
- additional condition on the child's PR Creation Gate.
370
+ unchanged: `.claude/skills/orchestrate/SKILL.md` is **not modified by this feature**.
371
+ Issue #997 amends `.claude/skills/orchestrate/SKILL.md` for standalone runs only: a standalone run with a green S9 gate merges its own pull request, and a parallel child never merges its own pull request.
372
+ Its step 9 mentions `parallel_mode` only to exclude a parallel child from that standalone merge.
373
+ There is no `parallel_merge` object in the child checkpoint and no parallel-specific condition on
374
+ the child's PR Creation Gate.
364
375
 
365
376
  Issue #744 later amended two parts of that child contract for CI-dependent acceptance criteria,
366
377
  whose verification requires the result of CI on the item's pull-request head: PR Creation Gate
@@ -416,20 +427,32 @@ Procedure, per item:
416
427
  `gh pr merge` spelling except a pure `--disable-auto`, and every `gh api` merge or enqueue
417
428
  mutation; issue #952) unless a checkpoint satisfies
418
429
  one of its allow conditions; its block reason is `EPIC_MERGE_GATE_BLOCKED`. The gate has
419
- four allow conditions
430
+ five allow conditions
420
431
  which it evaluates in this order: a per-feature checkpoint with `epic_mode == true` and
421
432
  `step9_status == "passed"`; an epic checkpoint whose `epic_merge_pr.ci_gate.conclusion` is
422
- `success` with a matching `pr_number`; the parallel condition described next; and a standalone
423
- merge authorization record, described after it. The parallel condition authorizes a per-item merge
433
+ `success` with a matching `pr_number`; the parallel condition described next; the green-CI
434
+ standalone condition (issue #997), evaluated after the parallel condition and before the
435
+ authorization record; and a standalone merge authorization record, described after it. The parallel condition authorizes a per-item merge
424
436
  when the parallel-orchestrator checkpoint has `route_id == "parallel"`, the target item's
425
437
  `merge_status == "ci_green"`, and, when a PR number is named, it matches the item's `pr_number`.
426
438
  Step 3 above is therefore permitted for a legitimate parallel merge; a missing, unreadable, or
427
439
  invalid parallel checkpoint, a target item whose `merge_status` is not `ci_green`, or a PR number
428
440
  that matches no item still fails closed with `EPIC_MERGE_GATE_BLOCKED`.
429
441
 
430
- The standalone condition (issue #670) is the only route for merging a pull request that is not a
431
- parallel item, such as a standalone fix that unblocks the run. It is evaluated last and never
432
- overrides the other three. Writer procedure for the coordinating session:
442
+ The green-CI condition (issue #997) lets a standalone run merge its own pull request after S9
443
+ step 7 of `.claude/skills/orchestrate/SKILL.md`: the command names the PR number, no epic or
444
+ parallel checkpoint records that number or the item worktree, the per-feature checkpoint carries
445
+ no `parallel_mode` or `parallel_slug` marker and records `step9_status == "passed"`,
446
+ `ci_gate.conclusion == "success"`, and a matching `pr_gate.pr_number`, and the live PR head
447
+ equals `ci_gate.head_sha` (and `--match-head-commit`, when passed). Its parallel exclusion is
448
+ best-effort: the `Parallel mode: true` marker is in the delegation prompt, not in a Bash payload,
449
+ so a parallel child whose PR number and worktree are not yet recorded by this checkpoint, and
450
+ which omits the `parallel_mode` key, is not excluded by the hook. A parallel child still never
451
+ merges its own pull request; that rule is enforced by the kickoff contract above.
452
+
453
+ The standalone authorization condition (issue #670) is the route for merging a pull request that
454
+ is not a parallel item and has no green S9 gate, such as a standalone fix that unblocks the run.
455
+ It is evaluated last and never overrides the other four. Writer procedure for the coordinating session:
433
456
 
434
457
  1. Write the record into a top-level `standalone_merge_authorizations` array in the
435
458
  parallel-orchestrator checkpoint (`artifacts/orchestration/parallel-orchestrator-state.json`);
@@ -531,8 +554,9 @@ against the observed radius, and requeue of the later-started item to F8.
531
554
  ## Worktree Cleanup
532
555
 
533
556
  After an item reaches `merge_status: merged` and that state is durably confirmed by
534
- `gh pr view --json state,mergedAt,headRefOid`, the parent — running from the main repository
535
- checkout, never from inside a child worktree — issues `git worktree remove <worktree_path>`. On
557
+ `gh pr view --json state,mergedAt,headRefOid`, the parent removes the item's worktree through
558
+ substep 1 of `### Run Closing` below, which takes the absolute path from
559
+ `git worktree list --porcelain` rather than from the relative `items[].worktree_path`. On
536
560
  success it records `merge_status: worktree_removed` and `worktree_removed_at`, then regenerates
537
561
  `docs/features/parallel/<slug>/parallel-status.md`.
538
562
 
@@ -550,7 +574,56 @@ non-authorizing `merge_status` still denies on both branches. The coordination m
550
574
  `PreToolUse` denials are conjunctive: a new allow-hook alone could not have overridden the epic
551
575
  gate's independent deny, which is why the epic gate itself had to gain the parallel branch.
552
576
  The parallel-orchestrator-surface feature (F7) shipped no hook file and made no
553
- `.claude/settings.json` change of its own.
577
+ `.claude/settings.json` change of its own. Both gates compare a recorded `worktree_path` to the
578
+ removal target through `Test-WorktreeRunRecordedPathMatchesTarget`, so a relative record is joined
579
+ to the main checkout root and to the root that holds the checkpoint (issue #995).
580
+
581
+ ### Run Closing
582
+
583
+ Run Closing runs once per run, after every non-withdrawn item has `merge_status` of `merged` or
584
+ `worktree_removed` and before completion is reported (issue #995). It re-derives state from
585
+ `git worktree list --porcelain`, `git`, and `gh` rather than from the checkpoint, so it is safe to
586
+ repeat: a substep whose outcome already holds is skipped. The five substeps run in order.
587
+
588
+ 1. **Item worktrees.** For each item whose `merge_status` is `merged`, take the absolute worktree
589
+ path from `git worktree list --porcelain`, never from the relative `items[].worktree_path`. When
590
+ that registration is locked, run `git worktree unlock <path>` only when the lock reason names
591
+ the item's own agent; leave any other lock in place. Run `git worktree remove <path>` with no
592
+ force flag. On success, set `merge_status: worktree_removed` and `worktree_removed_at`. On
593
+ refusal, leave `merge_status: merged`, append a `completed_steps` entry naming the path and the
594
+ refusal reason as a deferral, and continue with the next item.
595
+ 2. **Final status.** Regenerate `docs/features/parallel/<slug>/parallel-status.md` so it shows the
596
+ closing state.
597
+ 3. **Run documents.** Stage the run folder and the promoted lifecycle files created for this run by
598
+ literal path only, in commands of the form
599
+ `git add -- docs/features/parallel/<slug>/parallel-status.md docs/features/potential/promoted/<promoted-file>.md`
600
+ and
601
+ `git commit -m "docs(parallel): close run <slug>" -- docs/features/parallel/<slug>/parallel-status.md docs/features/potential/promoted/<promoted-file>.md`,
602
+ in which every pathspec begins with `docs/features/`. The `artifacts/` tree is gitignored, so Run
603
+ Closing never stages it. Never use
604
+ `git add -A` or `git add .`, and never stage a `docs/features/active/<item>/` folder: each item
605
+ folder lands through that item's own pull request. Before pushing, require that
606
+ `git diff --name-only origin/main...HEAD` lists only `docs/` paths; when it lists any other
607
+ path, stop and report without forcing, rebasing, or splitting the branch. The coordinator holds
608
+ no `artifacts/orchestration/orchestrator-state.json`, so the existing documentation-only
609
+ exemptions apply to these commands. Push the branch, delegate the pull request to
610
+ `Agent(pr-author)` with a `branch:` label in place of an issue number, merge it with
611
+ `gh pr merge <PR> --merge` naming the pull request number, and confirm the merge with the step 3
612
+ procedure of `## Per-Item Merge to Main (Merge-on-Green)`.
613
+ 4. **Scratch worktrees.** After the merge of the run-document pull request is confirmed, run the
614
+ `cleanup-merged-worktrees` report with
615
+ `bash .claude/skills/cleanup-merged-worktrees/scripts/cleanup-worktrees.sh`. Run the same script
616
+ with `--apply` only when every row the report marks delete-eligible is a worktree this run
617
+ created: an item worktree, or a planner scratch worktree named in the run's manifest, kickoff,
618
+ or checkpoint. Otherwise apply nothing and report each remaining scratch worktree as a deferral,
619
+ because apply mode is repository-wide and can classify a concurrent session's clean,
620
+ zero-commit worktree as merged. Add no hook allow for scratch worktrees.
621
+ 5. **Report.** Report every deferral. The named deferral cases are LV1, an item worktree whose
622
+ removal was refused after unlock because the item's harness process still holds it; LV2, a
623
+ run-document pull request still open because the merge queue has not merged it or `origin/main`
624
+ was absent when the merge gate evaluated it; and LV3, a run-document pull request that needs
625
+ manual authoring because the `Agent(pr-author)` delegation without an issue number failed its
626
+ model-routing receipt check. Each scratch worktree left in place is also a deferral.
554
627
 
555
628
  ## Documentation Maintenance Boundaries
556
629
 
@@ -660,6 +733,8 @@ hold:
660
733
  source files by that item's own run, per the `acceptance-criteria-tracking` skill.
661
734
  A CI-dependent criterion is checked off and pushed by that item's own run before its DONE, so
662
735
  the head the parent merges already contains the check-off; the parent never commits it.
736
+ 5. `### Run Closing` (under `## Worktree Cleanup`) has run, and its run-document pull request is
737
+ merged or reported as a deferral.
663
738
 
664
739
  In `open` mode there is no automatic completion. The run is a standing queue and terminates only via
665
740
  `/parallel-close`, which is owned by F6 and is neither specified nor shipped by this feature. Do not
@@ -667,7 +742,8 @@ synthesize a completion condition for an `open`-mode run.
667
742
 
668
743
  No completion condition involves a run-level pull request. There is no final integration pull
669
744
  request on this surface, so completion keys on the per-item terminal states above and on nothing
670
- else.
745
+ else. The Run Closing run-document pull request is a bookkeeping pull request that lands the run's
746
+ generated documents; it is not a run-level integration pull request and merges no item work.
671
747
 
672
748
  ## Mutation Protocol (F6)
673
749
 
@@ -140,7 +140,9 @@ the model-budget marker line, and is omitted for a potential-entry item, whose c
140
140
  The line carries no mode marker, no digits, and no active feature-folder path, so hook target
141
141
  resolution and mode classification are unchanged. The preparation checkpoint does not carry over
142
142
  to execution, so the execution child records its own adoption (see
143
- `.claude/skills/parallel-orchestrate/SKILL.md`, kickoff element 4).
143
+ `.claude/skills/parallel-orchestrate/SKILL.md`, kickoff element 4). Because the preparation child
144
+ creates and commits the feature folder, the execution child's adoption also waives
145
+ `new_active_feature_folder` and records `feature_folder_record` for that committed folder.
144
146
 
145
147
  **No edit to shared surfaces.** No edit is made to `.claude/skills/orchestrate/SKILL.md` or to
146
148
  `config/orchestration-routing.json`, including the `preparation` route. The route mechanism is
@@ -40,7 +40,7 @@ Use these sections in this order:
40
40
  8. **Risks and Mitigations** — realistic risks with mitigations and rollback notes
41
41
  9. **Review Guide** — suggested order, noisy mechanical moves, large diffs
42
42
  10. **Follow-ups** — known TODOs, deferred cleanup, next PRs
43
- 11. **GitHub Auto-close** — `- Closes #NNN` only from verified autoclose lists; do not invent issue numbers
43
+ 11. **GitHub Auto-close** — `- Closes #NNN` from the three sources in Issue/PR Reference Rules (the PR-context "Issues to autoclose" list, the PR-context "Author-asserted autoclose issues" list, and an issue named as author-asserted in the delegation prompt); `- None` only when no source has an entry; do not invent issue numbers
44
44
 
45
45
  ## Output Artifact
46
46
 
@@ -74,22 +74,52 @@ writes and the `gh pr create` / `gh pr edit --body-file` handoff.
74
74
 
75
75
  ## Issue/PR Reference Rules
76
76
 
77
- - Only mention an issue/PR number if it appears verbatim in the provided context.
77
+ - Only mention an issue/PR number if it appears verbatim in the provided context or in the delegation prompt.
78
78
  - Do not treat PR numbers as issues.
79
- - Auto-close bullets must use exactly `- Closes #NNN` format, sourced only from "Issues to autoclose" or "Author-asserted autoclose issues."
80
- - If GitHub validation is unavailable/unverified, do not emit `Closes`; use the fallback `None` bullet.
79
+ - Auto-close bullets must use exactly `- Closes #NNN` format. Three sources are valid:
80
+ 1. the PR-context "Issues to autoclose" list;
81
+ 2. the PR-context "Author-asserted autoclose issues" list (rendered from the PR Intent);
82
+ 3. an issue named as author-asserted in the delegation prompt, on the line
83
+ `Author-asserted autoclose issues: #NNN`. This source is valid even when the PR context
84
+ lists no verified autoclose issues.
85
+ - Emit the fallback `- None` bullet only when no source has an entry.
86
+ - GitHub validation applies to the two PR-context lists: if it is unavailable or unverified for
87
+ an entry on those lists, do not emit `Closes` for that entry. An issue named as author-asserted
88
+ in the delegation prompt is emitted without that validation; the closing-reference
89
+ verification below confirms it after the pull request exists.
90
+
91
+ ## Closing-Reference Verification
92
+
93
+ The pr-author agent MUST run `gh pr view <N> --json closingIssuesReferences,body` as a single
94
+ command (no chaining, no extra flags) after every `gh pr create` or `gh pr edit` it issues, where
95
+ `<N>` is the pull request number. It reports the closing issue numbers that
96
+ `closingIssuesReferences` lists, and reports any mismatch with the author-asserted list: an
97
+ author-asserted issue that GitHub does not list as closing, or a closing issue that no source
98
+ named. The command is read-only, and this exact form is the only pull-request view form the
99
+ agent's allowlist hook permits.
81
100
 
82
101
  ## Required `--head` on `gh pr create` (issue #687)
83
102
 
84
103
  Every `gh pr create` command this agent issues MUST carry an explicit
85
- `--head <branch>` naming the branch the pull request is opened from.
104
+ `--head <branch>` naming the branch the pull request is opened from, for example
105
+ `gh pr create --head <branch> --body-file artifacts/pr_body_<N>.md`.
86
106
 
87
107
  This is what makes the call's target derivable. `enforce-pr-author-skill.ps1` resolves the
88
108
  worktree the call pertains to from the command text, and validates the orchestrator checkpoint
89
109
  belonging to that worktree. Without `--head`, `gh pr create` infers its head branch from the
90
- current checkout and the command carries no signal at all, so the gate denies with
91
- `TARGET_WORKTREE_NOT_DERIVABLE` rather than validating against whichever checkpoint occupies the
92
- session root, which in a parallel or epic topology belongs to a different item.
110
+ current checkout and the command carries no signal at all, so the gate falls back to the branch
111
+ checked out in its own working directory (issue #989) and denies with
112
+ `TARGET_WORKTREE_NOT_DERIVABLE` when that checkout is detached or unreadable, rather than
113
+ validating against whichever checkpoint occupies the session root, which in a parallel or epic
114
+ topology belongs to a different item.
93
115
 
94
116
  Pass `--head` even when the branch is the current one: the gate resolves it to the session root
95
- and behaves exactly as before, and the command stays correct if it is ever replayed elsewhere.
117
+ and behaves exactly as before, and the command stays correct if it is ever replayed elsewhere.
118
+
119
+ `gh pr edit` takes no head-branch flag, and --head is not valid for gh pr edit. Name the target of
120
+ an edit in one of two ways:
121
+
122
+ - Run `gh pr edit <N> --body-file artifacts/pr_body_<N>.md` from the item worktree. The gate
123
+ derives the branch from that worktree's checkout.
124
+ - When running outside the item worktree, append the shell comment `# branch: <branch>` to the
125
+ command, and pass the absolute canonical body path beneath the item worktree.
@@ -54,7 +54,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
54
54
  Stop implementation and return to the user when:
55
55
 
56
56
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
57
- - a file is near or would exceed the 500-line limit,
57
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
58
58
  - any QA gate delta is non-zero after self-correction,
59
59
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
60
60
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -16,26 +16,32 @@
16
16
  ".claude/agents/orchestrator.md",
17
17
  ".claude/agents/parallel-orchestrator.md",
18
18
  ".claude/agents/parallel-planner.md",
19
+ ".claude/agents/pr-author.md",
19
20
  ".claude/agents/prd-feature.md",
20
21
  ".claude/agents/requirements-reconciler.md",
21
22
  ".claude/agents/runtime-characterization-analyst.md",
22
23
  ".claude/agents/staged-review.md",
23
24
  ".claude/agents/status-updater.md",
24
25
  ".claude/agents/task-researcher.md",
26
+ ".claude/hooks/check-powershell-test-purity.ps1",
27
+ ".claude/hooks/check-python-test-purity.ps1",
25
28
  ".claude/hooks/enforce-batch-budget-route.ps1",
26
29
  ".claude/hooks/enforce-checkpoint-monotonic.ps1",
27
30
  ".claude/hooks/enforce-completion-consistency.ps1",
31
+ ".claude/hooks/enforce-completion-helpers.ps1",
28
32
  ".claude/hooks/enforce-discovery-artifact-gate.ps1",
29
33
  ".claude/hooks/enforce-epic-invocation-origin.ps1",
30
34
  ".claude/hooks/enforce-epic-merge-gate.ps1",
31
35
  ".claude/hooks/enforce-epic-merge-gate-authorization.ps1",
32
36
  ".claude/hooks/enforce-epic-merge-gate-resolution.ps1",
33
37
  ".claude/hooks/enforce-epic-merge-gate-command.ps1",
38
+ ".claude/hooks/enforce-epic-merge-gate-green-ci.ps1",
34
39
  ".claude/hooks/enforce-epic-wave-barrier.ps1",
35
40
  ".claude/hooks/enforce-epic-worktree-removal-gate.ps1",
36
41
  ".claude/hooks/enforce-epic-worktree-removal-gate-resolution.ps1",
37
42
  ".claude/hooks/enforce-evidence-locations.ps1",
38
43
  ".claude/hooks/enforce-feature-folder-order.ps1",
44
+ ".claude/hooks/enforce-file-size-limit.ps1",
39
45
  ".claude/hooks/enforce-model-routing-receipt.ps1",
40
46
  ".claude/hooks/enforce-orchestration-preimplementation-gate.ps1",
41
47
  ".claude/hooks/enforce-orchestration-preimplementation-gate-epic-scope.ps1",
@@ -48,8 +54,10 @@
48
54
  ".claude/hooks/enforce-parallel-drift-gate.ps1",
49
55
  ".claude/hooks/enforce-parallel-drift-gate-helpers.ps1",
50
56
  ".claude/hooks/enforce-parallel-worktree-removal-gate.ps1",
57
+ ".claude/hooks/enforce-powershell-batch-budget.ps1",
51
58
  ".claude/hooks/enforce-pr-author-command-allowlist.ps1",
52
59
  ".claude/hooks/enforce-pr-author-skill.artifact-root.ps1",
60
+ ".claude/hooks/enforce-pr-author-skill.current-branch.ps1",
53
61
  ".claude/hooks/enforce-pr-author-skill.docs-only.ps1",
54
62
  ".claude/hooks/enforce-pr-author-skill.epic-base-branch.ps1",
55
63
  ".claude/hooks/enforce-pr-author-skill.ps1",
@@ -57,6 +65,7 @@
57
65
  ".claude/hooks/enforce-prd-feature-before-planner-helpers.ps1",
58
66
  ".claude/hooks/enforce-prd-feature-before-planner.ps1",
59
67
  ".claude/hooks/enforce-promotion-mcp-only.ps1",
68
+ ".claude/hooks/enforce-python-batch-budget.ps1",
60
69
  ".claude/hooks/feature-folder-resolution.ps1",
61
70
  ".claude/hooks/feature-review-coverage-thresholds.ps1",
62
71
  ".claude/hooks/hook-command-heredoc.ps1",
@@ -78,8 +87,10 @@
78
87
  ".claude/hooks/validate-feature-review-coverage.ps1",
79
88
  ".claude/hooks/validate-orchestrator-output-resolution.ps1",
80
89
  ".claude/hooks/validate-orchestrator-output-routing.ps1",
90
+ ".claude/hooks/validate-orchestrator-output-feature-folder.ps1",
81
91
  ".claude/hooks/validate-orchestrator-output.ps1",
82
92
  ".claude/hooks/validate-planner-output.ps1",
93
+ ".claude/hooks/validate-pr-author-output.ps1",
83
94
  ".claude/hooks/validate-prd-feature-output.ps1",
84
95
  ".claude/hooks/validate-required-artifact-output.ps1",
85
96
  ".claude/hooks/validate-task-researcher-output.ps1",
@@ -150,6 +161,7 @@
150
161
  ".claude/skills/translate-copilot-to-claude/SKILL.md",
151
162
  ".claude/skills/update-status/SKILL.md",
152
163
  ".claude/lib/hook-payload/HookPayload.psm1",
164
+ ".claude/lib/file-size-policy/FileSizePolicy.psm1",
153
165
  ".claude/lib/requirements/GeneratedDocumentCounters.psm1",
154
166
  ".claude/lib/model-routing/ModelRouting.psm1",
155
167
  ".claude/lib/orchestrator-state/OrchestratorState.psm1",
@@ -164,6 +176,7 @@
164
176
  ".claude/lib/orchestrator-state/OrchestratorStateCompletionChecks.psm1",
165
177
  ".claude/lib/orchestrator-state/OrchestratorStateRoutingContract.psm1",
166
178
  ".claude/lib/orchestrator-state/OrchestratorStateIssueAdoption.psm1",
179
+ ".claude/lib/orchestrator-state/OrchestratorStateFeatureFolderRecord.psm1",
167
180
  ".claude/lib/orchestrator-state/OrchestratorStateUnconditional.psm1",
168
181
  ".claude/lib/orchestrator-state/OrchestratorStateEpicWaveBarrier.psm1",
169
182
  ".claude/lib/discovery-validation/DiscoveryValidation.psm1",
@@ -221,6 +234,7 @@
221
234
  ".claude/lib/worktree-resolution/WorktreeItemResolution.psm1",
222
235
  ".claude/lib/worktree-resolution/EpicScopeResolution.psm1",
223
236
  ".claude/lib/worktree-resolution/EpicScopeReadiness.psm1",
237
+ ".claude/lib/worktree-resolution/WorktreeRunRecordPath.psm1",
224
238
  ".claude/lib/worktree-resolution/WorktreeRunResolution.psm1",
225
239
  ".claude/skills/mermaid-diagram/references/flowchart.md",
226
240
  ".claude/skills/mermaid-diagram/references/sequence.md",
@@ -83,6 +83,7 @@ Run these after editing any mirrored or bundled file; each is under `tests/scrip
83
83
 
84
84
  - `test_push_down_claude_resource_contracts.py` and `test_push_down_codex_and_agents_resource_contracts.py`: every distributable `.claude`, `.agents`, and `.codex` file exists in the bundle with equal text.
85
85
  - `test_push_down_claude_pack_manifest_completeness.py` and `test_push_down_codex_and_agents_pack_manifest_completeness.py`: every bundled file is listed in a pack manifest.
86
+ - `test_push_down_pack_manifest_dependency_closure.py`: every `$PSScriptRoot` dependency of a manifested PowerShell file, and every hook script named by `.claude/settings.json`, manifested agent frontmatter, or `.codex/config.toml`, is in core plus the owning pack.
86
87
  - The Codex generator check: `scripts/dev_tools/generate_codex_agent_variants.py` run in module form with `--check` (base agents are hand-edited; variants, bundle copies, and the Codex `core.json` are generated).
87
88
  - `test_codex_agent_wrapper_contracts.py` and `test_codex_handoff_contract_parity.py`: pinned Codex agent fragments and handoff parity.
88
89
  - `test_claude_rules_frontmatter.py`: rule `paths:` scopes and that every preloaded skill exists.
@@ -121,7 +122,7 @@ These pass every validator rule and are found only by reading the plan against t
121
122
  - Python: measure a module with `--cov=<dotted.module>`, `--cov-branch`, `--cov-report=term-missing`, and `--cov-report=json:<path>`; read branch figures from the JSON report.
122
123
  - TypeScript: a new production file needs its own entry in the `coverageThreshold` map of `extensions/drm-copilot/jest.config.cjs`; Jest runs through `node run-jest.cjs` in `extensions/drm-copilot/`.
123
124
  - PowerShell: per-file line coverage is read from `artifacts/pester/powershell-coverage.xml` written by the self-hosted PoshQC module.
124
- - No production, test, or reusable script file exceeds 500 physical lines; Markdown is exempt. Files at or near the limit are not extended; new logic goes into a new module and a new test file.
125
+ - File size follows three tiers for production, test, and reusable script files, counted in logical lines (a trailing terminator adds no line): at 500 lines look for a logical split (guidance); at 700 lines split more aggressively, and reviewers report a non-blocking Warning (advisory); above 800 lines a split is enforced regardless of logical separability (hard limit; exactly 800 passes). The hard limit is enforced by `tests/scripts/ci/FileSizePolicy.RepoGate.Tests.ps1` in the existing PowerShell shards against `config/file-size-baseline.json`, where legacy files above 800 may shrink (with the entry tightened) or stay equal but may not grow, and by the PreToolUse hook `.claude/hooks/enforce-file-size-limit.ps1` (`.codex/hooks/enforce-file-size-limit.ps1`). New logic in a file near a tier goes into a new module and a new test file. Markdown is exempt.
125
126
 
126
127
  ## Test Isolation Checks
127
128
 
@@ -83,7 +83,7 @@ Lifecycle guardrails:
83
83
 
84
84
  4) Create the potential entry through `mcp__drm-copilot__new_potential_entry` or `mcp__drm-copilot__new_potential_bug_entry`.
85
85
 
86
- 5) Promote the potential document through `mcp__drm-copilot__potential_to_issue` with the selected `${work-mode}` and capture the numeric `${issue-num}`. When the issue already exists, do not call `potential_to_issue`; verify the issue read-only and record `issue_adoption` with the existing number as `${issue-num}`.
86
+ 5) Promote the potential document through `mcp__drm-copilot__potential_to_issue` with the selected `${work-mode}` and capture the numeric `${issue-num}`. When the issue already exists, do not call `potential_to_issue`; verify the issue read-only and record `issue_adoption` with the existing number as `${issue-num}`. When the feature folder for that issue was also created and committed before this run, do not call `new_active_feature_folder` again in step 7; waive it in `issue_adoption.waived_tools` and record `issue_adoption.feature_folder_record` (`path` equal to `${feature-folder}`, `verified_via`, `verified_at`, `evidence`) after confirming the folder is in `HEAD`.
87
87
 
88
88
  6) Rename the branch to the final branch:
89
89
  - `${final-branch}`
@@ -121,6 +121,14 @@ When remediation is required:
121
121
  - MUST contain `## Summary`.
122
122
  - MUST contain `## Acceptance Criteria Check-off`.
123
123
 
124
+ ## File Size Advisory
125
+
126
+ The tiered file-size policy (`## File Size Limit` in `.agents/skills/general-code-change/SKILL.md`) sets a 500-line guidance tier, a 700-line advisory tier, and an 800-line hard limit. Measure the logical line count of every added or modified covered file in the branch diff. Covered files have one of the extensions `.py`, `.ps1`, `.psm1`, `.ts`, `.tsx`, `.js`, `.cjs`, `.mjs`, `.cs`, `.sh`, or `.bats` and are not under a build, cache, dependency, virtual-environment, or `docs` directory. A logical line count splits the content on line terminators, and a trailing terminator does not add a line; it equals `@(Get-Content -LiteralPath <path>).Count`. Do not use `wc -l` or `Measure-Object -Line`.
127
+
128
+ - Report each covered file at or above 700 lines as a non-blocking `Warning` row in the Findings Table of `code-review.<timestamp>.md`, naming the file and its line count. Do not write the Warning to `remediation-inputs.<timestamp>.md`, and do not give it a remediation severity label.
129
+ - Report a covered file above 800 lines that has no entry in `config/file-size-baseline.json`, and any added or increased entry in `config/file-size-baseline.json`, as a blocking policy finding.
130
+ - Produce no finding for the 500-line guidance tier.
131
+
124
132
  ## Review Constraints
125
133
 
126
134
  - Do not silently fix code during review.
@@ -49,7 +49,10 @@ Mutation testing and golden tests run in pre-merge or nightly pipelines, not the
49
49
 
50
50
  ## File Size Limit
51
51
 
52
- - No production code, test code, or reusable script file may exceed **500 lines**.
52
+ - File size follows three tiers for production code, test code, and reusable script files, counted in logical lines (a trailing line terminator does not add a line):
53
+ - **500 lines (guidance):** look for a logical way to divide the file into multiple files, provided the parts can be separated logically. No gate fails at this tier.
54
+ - **700 lines (advisory):** look for a split more aggressively. Reviewers and `feature-review` report a non-blocking Warning for a file at or above 700 lines. No gate fails at this tier.
55
+ - **Above 800 lines (hard block):** split the file regardless of logical separability. The repository CI check and the PreToolUse hook block a file of 801 lines or more; a file of exactly 800 lines passes. Legacy files above 800 lines are listed in `config/file-size-baseline.json` and may shrink (with the entry tightened) or stay the same size, but may not grow.
53
56
  - Exceptions: temporary throwaway scripts created and deleted within an agent session; raw text fixtures for language-processing test data; Markdown documentation files.
54
57
 
55
58
  ## Error Handling and Logging
@@ -29,7 +29,7 @@ Run the toolchain in order: format → analyze → test. Restart from step 1 if
29
29
  - Avoid `Invoke-Expression`, plaintext secrets, and hard-coded credentials/paths.
30
30
  - Use `Write-Error`/`throw` for failures; avoid silent catch-alls.
31
31
  - Use approved verbs and descriptive nouns for function names (PSScriptAnalyzer enforces this).
32
- - Keep scripts cohesive and under 500 lines.
32
+ - Keep scripts cohesive and within the tiered file-size policy in `.agents/skills/general-code-change/SKILL.md` (`## File Size Limit`).
33
33
 
34
34
  ## Change Budget
35
35
 
@@ -83,7 +83,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
83
83
  Stop implementation and return to the user when:
84
84
 
85
85
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
86
- - a file is near or would exceed the 500-line limit,
86
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
87
87
  - any QA gate delta is non-zero after self-correction,
88
88
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
89
89
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -83,7 +83,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
83
83
  Stop implementation and return to the user when:
84
84
 
85
85
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
86
- - a file is near or would exceed the 500-line limit,
86
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
87
87
  - any QA gate delta is non-zero after self-correction,
88
88
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
89
89
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -83,7 +83,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
83
83
  Stop implementation and return to the user when:
84
84
 
85
85
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
86
- - a file is near or would exceed the 500-line limit,
86
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
87
87
  - any QA gate delta is non-zero after self-correction,
88
88
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
89
89
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -83,7 +83,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
83
83
  Stop implementation and return to the user when:
84
84
 
85
85
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
86
- - a file is near or would exceed the 500-line limit,
86
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
87
87
  - any QA gate delta is non-zero after self-correction,
88
88
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
89
89
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -83,7 +83,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
83
83
  Stop implementation and return to the user when:
84
84
 
85
85
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
86
- - a file is near or would exceed the 500-line limit,
86
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
87
87
  - any QA gate delta is non-zero after self-correction,
88
88
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
89
89
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -83,7 +83,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
83
83
  Stop implementation and return to the user when:
84
84
 
85
85
  - the scope estimate or an in-flight batch would exceed the 3-production-file cap in direct mode,
86
- - a file is near or would exceed the 500-line limit,
86
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
87
87
  - any QA gate delta is non-zero after self-correction,
88
88
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
89
89
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -137,6 +137,14 @@ For each language that has changed files in the feature branch:
137
137
 
138
138
  The agent does NOT rerun coverage generation. Evidence verification from existing artifacts is the required model.
139
139
 
140
+ ## File Size Advisory
141
+
142
+ The tiered file-size policy (`## File Size Limit` in `.agents/skills/general-code-change/SKILL.md`) sets a 500-line guidance tier, a 700-line advisory tier, and an 800-line hard limit. Measure the logical line count of every added or modified covered file in the branch diff. Covered files have one of the extensions `.py`, `.ps1`, `.psm1`, `.ts`, `.tsx`, `.js`, `.cjs`, `.mjs`, `.cs`, `.sh`, or `.bats` and are not under a build, cache, dependency, virtual-environment, or `docs` directory. A logical line count splits the content on line terminators, and a trailing terminator does not add a line; it equals `@(Get-Content -LiteralPath <path>).Count`. Do not use `wc -l` or `Measure-Object -Line`.
143
+
144
+ - Report each covered file at or above 700 lines as a non-blocking `Warning` row in the Findings Table of `code-review.<timestamp>.md`, naming the file and its line count. Do not write the Warning to `remediation-inputs.<timestamp>.md`, and do not give it a remediation severity label.
145
+ - Report a covered file above 800 lines that has no entry in `config/file-size-baseline.json`, and any added or increased entry in `config/file-size-baseline.json`, as a blocking policy finding.
146
+ - Produce no finding for the 500-line guidance tier.
147
+
140
148
  ## Evidence Location Invariant
141
149
 
142
150
  All evidence artifacts this agent produces (baselines, QA gates, regression results, coverage) MUST be written to `<FEATURE>/evidence/<kind>/` as defined in `.agents/skills/evidence-and-timestamp-conventions/SKILL.md`.
@@ -93,7 +93,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
93
93
  Stop implementation and return to the user when:
94
94
 
95
95
  - the scope estimate exceeds the 2-production-file cap in direct mode,
96
- - a file is near or would exceed the 500-line limit,
96
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
97
97
  - any QA gate delta is non-zero after self-correction,
98
98
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
99
99
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -93,7 +93,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
93
93
  Stop implementation and return to the user when:
94
94
 
95
95
  - the scope estimate exceeds the 2-production-file cap in direct mode,
96
- - a file is near or would exceed the 500-line limit,
96
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
97
97
  - any QA gate delta is non-zero after self-correction,
98
98
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
99
99
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -93,7 +93,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
93
93
  Stop implementation and return to the user when:
94
94
 
95
95
  - the scope estimate exceeds the 2-production-file cap in direct mode,
96
- - a file is near or would exceed the 500-line limit,
96
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
97
97
  - any QA gate delta is non-zero after self-correction,
98
98
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
99
99
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -93,7 +93,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
93
93
  Stop implementation and return to the user when:
94
94
 
95
95
  - the scope estimate exceeds the 2-production-file cap in direct mode,
96
- - a file is near or would exceed the 500-line limit,
96
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
97
97
  - any QA gate delta is non-zero after self-correction,
98
98
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
99
99
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -93,7 +93,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
93
93
  Stop implementation and return to the user when:
94
94
 
95
95
  - the scope estimate exceeds the 2-production-file cap in direct mode,
96
- - a file is near or would exceed the 500-line limit,
96
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
97
97
  - any QA gate delta is non-zero after self-correction,
98
98
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
99
99
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -93,7 +93,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
93
93
  Stop implementation and return to the user when:
94
94
 
95
95
  - the scope estimate exceeds the 2-production-file cap in direct mode,
96
- - a file is near or would exceed the 500-line limit,
96
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
97
97
  - any QA gate delta is non-zero after self-correction,
98
98
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
99
99
  - orchestrator handoff mode is requested but the required context package is incomplete,
@@ -87,7 +87,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
87
87
  Stop implementation and return to the user when:
88
88
 
89
89
  - the scope estimate exceeds 3 production files in direct mode,
90
- - a file is near or would exceed the 500-line limit,
90
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
91
91
  - any QA gate delta is non-zero after self-correction,
92
92
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
93
93
  - policy instructions conflict.
@@ -87,7 +87,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
87
87
  Stop implementation and return to the user when:
88
88
 
89
89
  - the scope estimate exceeds 3 production files in direct mode,
90
- - a file is near or would exceed the 500-line limit,
90
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
91
91
  - any QA gate delta is non-zero after self-correction,
92
92
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
93
93
  - policy instructions conflict.
@@ -87,7 +87,7 @@ If the marker is missing or malformed, fail closed to `full-feature`.
87
87
  Stop implementation and return to the user when:
88
88
 
89
89
  - the scope estimate exceeds 3 production files in direct mode,
90
- - a file is near or would exceed the 500-line limit,
90
+ - a file is above or would exceed the 800-line hard limit of the tiered file-size policy (split it before proceeding; at 500 lines look for a logical split, and at 700 lines split more aggressively),
91
91
  - any QA gate delta is non-zero after self-correction,
92
92
  - the toolchain cannot be executed in the current environment (mark the change **unverified**),
93
93
  - policy instructions conflict.