@amsterdamdatalabs/adl-agent-control-darwin-arm64 0.1.58 → 0.1.63

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 (203) hide show
  1. package/bin/adl +2 -2
  2. package/bin/health-check +13 -1
  3. package/bin/job-watchdog +11 -0
  4. package/bin/repo-search-mcp +2 -2
  5. package/bin/setup +41 -0
  6. package/bin/validate-manifest +22 -1
  7. package/package.json +2 -1
  8. package/packages/agent-hooks/README.md +24 -0
  9. package/packages/agent-hooks/assets/automation-exempt.json +434 -0
  10. package/packages/agent-hooks/src/gating/config.ts +53 -5
  11. package/packages/agent-hooks/src/pre-tool-use/handler.ts +28 -6
  12. package/packages/agent-hooks/src/rules/automation-exempt.ts +16 -0
  13. package/packages/agent-hooks/src/rules/engine.ts +47 -1
  14. package/packages/agent-hooks/src/rules/impl/adl-human-azdo-bypass.ts +76 -13
  15. package/packages/agent-pool/image/provision.sh +122 -0
  16. package/packages/agent-skills/assets/implement-feature/SKILL.md +1 -1
  17. package/packages/agent-skills/assets/plan-feature/SKILL.md +10 -5
  18. package/packages/agent-skills/assets/workitems-process/SKILL.md +3 -3
  19. package/packages/agent-skills/assets/workitems-process/references/ado-and-git.md +1 -1
  20. package/packages/agent-skills/dist/manifest.d.ts.map +1 -1
  21. package/packages/agent-skills/dist/manifest.js +7 -1
  22. package/packages/agent-skills/dist/manifest.js.map +1 -1
  23. package/packages/agent-skills/src/manifest.ts +8 -3
  24. package/packages/fleet/manifest.json +36 -12
  25. package/packages/fleet/manifest.schema.json +34 -0
  26. package/packages/fleet/src/repo-maintain.ts +16 -16
  27. package/packages/repo-controls/README.md +39 -0
  28. package/packages/repo-controls/assets/automation-exempt.json +265 -0
  29. package/packages/repo-controls/package/adl-compliance/pyproject.toml +13 -3
  30. package/packages/repo-controls/package/adl-compliance/uv.lock +54 -74
  31. package/packages/repo-controls/src/automation-exempt.ts +20 -0
  32. package/packages/repo-controls/src/config.ts +43 -2
  33. package/packages/repo-controls/src/constants.ts +27 -0
  34. package/packages/repo-controls/src/hook.ts +53 -11
  35. package/bin/lean-ctx-observe-strip +0 -434
  36. package/bin/lib/lean-ctx-observe-hooks.sh +0 -634
  37. package/bin/update-azure-agent-pool +0 -29
  38. package/packages/agent-hooks/src/hooks/lean-ctx/handler.ts +0 -22
  39. package/packages/agent-hooks/src/hooks/lean-ctx/index.ts +0 -173
  40. package/packages/agent-hooks/src/hooks/lean-ctx/mapping.ts +0 -121
  41. package/packages/agent-hooks/src/hooks/lean-ctx/scope-rewrite.ts +0 -207
  42. package/packages/agent-hooks/src/lean-ctx/env.ts +0 -123
  43. package/packages/agent-hooks/src/lean-ctx/mcp.ts +0 -142
  44. package/packages/agent-hooks/src/rules/impl/adl-build-run-denied.ts +0 -51
  45. package/packages/agent-hooks/src/rules/impl/adl-session-required.ts +0 -403
  46. package/packages/agent-hooks/src/rules/impl/tool-lean-ctx-global.ts +0 -594
  47. package/packages/agent-settings/assets/GLOBAL-AGENTS.md +0 -112
  48. package/packages/agent-settings/assets/lean-ctx/config.toml +0 -42
  49. package/packages/agent-settings/assets/lean-ctx/gitignore +0 -10
  50. package/packages/agent-settings/assets/lean-ctx/layout.toml +0 -7
  51. package/packages/agent-settings/src/deploy/lean-ctx-deploy.ts +0 -230
  52. package/packages/agent-settings/src/deploy/lean-ctx-merge.ts +0 -580
  53. package/packages/agent-skills/assets/adl-mechanics/SKILL.md +0 -38
  54. package/packages/agent-skills/assets/codebase-design/SKILL.md +0 -98
  55. package/packages/agent-skills/assets/codebase-design/references/DEEPENING.md +0 -37
  56. package/packages/agent-skills/assets/codebase-design/references/DESIGN-IT-TWICE.md +0 -44
  57. package/packages/agent-skills/assets/codebase-design/references/TESTABILITY.md +0 -29
  58. package/packages/agent-skills/assets/debug-issue/SKILL.md +0 -41
  59. package/packages/agent-skills/assets/domain-modeling/SKILL.md +0 -86
  60. package/packages/agent-skills/assets/domain-modeling/references/ADR-FORMAT.md +0 -47
  61. package/packages/agent-skills/assets/domain-modeling/references/CONTEXT-FORMAT.md +0 -60
  62. package/packages/agent-skills/assets/implement/SKILL.md +0 -28
  63. package/packages/agent-skills/assets/review-changes/SKILL.md +0 -45
  64. package/packages/agent-skills/assets/tdd/SKILL.md +0 -49
  65. package/packages/agent-skills/assets/tdd/references/mocking.md +0 -59
  66. package/packages/agent-skills/assets/tdd/references/tests.md +0 -77
  67. package/packages/agent-skills/assets/testing/SKILL.md +0 -54
  68. package/packages/agent-skills/assets/testing/references/e2e.md +0 -37
  69. package/packages/agent-skills/assets/testing/references/integration.md +0 -37
  70. package/packages/agent-skills/assets/testing/references/unit.md +0 -32
  71. package/packages/agent-skills/assets/to-feature/SKILL.md +0 -91
  72. package/packages/agent-skills/assets/to-feature/references/FEATURE-SPEC-TEMPLATE.md +0 -88
  73. package/packages/agent-skills/assets/to-workitems/SKILL.md +0 -90
  74. package/packages/agent-skills/assets/to-workitems/references/AZURE-DEVOPS-HIERARCHY.md +0 -121
  75. package/packages/agent-skills/assets/to-workitems/references/TICKET-TEMPLATES.md +0 -70
  76. package/packages/azdo/src/workflow-rules-matrix.csv +0 -85
  77. package/packages/fleet/src/launch-agents.ts +0 -649
  78. package/packages/repo-controls/assets/GLOBAL-INVARIANTS.md +0 -21
  79. package/packages/repo-controls/assets/enable-integration-auto-complete.mjs +0 -79
  80. package/packages/repo-controls/assets/scaffold/docs/notes.md +0 -20
  81. package/packages/repo-controls/assets/scaffold/plans/GAPS-AND-FINDINGS.md +0 -12
  82. package/packages/repo-controls/azure-pipelines.yml +0 -274
  83. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/closed_set/fixtures/docs/notes.md +0 -1
  84. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/english_only/fixtures/excluded/frontend/mobile/src/i18n/locales/zh-CN/strings.ts +0 -1
  85. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-clean/docs/notes.md +0 -17
  86. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/okf_profile/fixtures/okf-ledger-no-lines/docs/notes.md +0 -13
  87. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-delivery.md +0 -10
  88. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/stable-recommendation.md +0 -12
  89. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/docs/semantics/fixtures/semantics-violations/docs/architecture/product/target-narration.md +0 -10
  90. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-clean/frontend/packages/desktop/src/renderer/solo/item.ts +0 -1
  91. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-empty-register/frontend/packages/desktop/src/a.ts +0 -1
  92. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-empty-register/frontend/packages/desktop/src/b.ts +0 -1
  93. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/fresh/fresh.ts +0 -1
  94. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub1/only.ts +0 -1
  95. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub10/only.ts +0 -1
  96. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub11/only.ts +0 -1
  97. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub2/only.ts +0 -1
  98. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub3/only.ts +0 -1
  99. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub4/only.ts +0 -1
  100. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub5/only.ts +0 -1
  101. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub6/only.ts +0 -1
  102. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub7/only.ts +0 -1
  103. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub8/only.ts +0 -1
  104. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/many/sub9/only.ts +0 -1
  105. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/services/i18n/locales/de/common.json +0 -1
  106. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/renderer/solo/item.ts +0 -1
  107. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-excluded/frontend/packages/desktop/src/vendored-crate/Cargo.toml +0 -2
  108. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-missing-tree/frontend/packages/desktop/src/renderer/solo/item.ts +0 -1
  109. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/frontend/packages/desktop/src/a.ts +0 -1
  110. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/frontend/packages/desktop/src/b.ts +0 -1
  111. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-no-ceilings/frontend/packages/desktop/src/c.ts +0 -1
  112. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-stale-entry/frontend/packages/desktop/src/renderer/solo/item.ts +0 -1
  113. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/fresh/fresh.ts +0 -1
  114. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub1/only.ts +0 -1
  115. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub10/only.ts +0 -1
  116. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub11/only.ts +0 -1
  117. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub2/only.ts +0 -1
  118. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub3/only.ts +0 -1
  119. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub4/only.ts +0 -1
  120. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub5/only.ts +0 -1
  121. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub6/only.ts +0 -1
  122. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub7/only.ts +0 -1
  123. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub8/only.ts +0 -1
  124. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/many/sub9/only.ts +0 -1
  125. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unbaselined/frontend/packages/desktop/src/renderer/solo/item.ts +0 -1
  126. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/directory_ratchet/fixtures/directory-ratchet-unusable-register/frontend/packages/desktop/src/renderer/solo/item.ts +0 -1
  127. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/fixtures/open-work-cap-clean/plans/GAPS-AND-FINDINGS.md +0 -5
  128. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/open_work_cap/fixtures/open-work-cap-clean/plans/features/az601-clean/spec.md +0 -10
  129. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/agent/crates/enact-providers/src/snapshots/README.md +0 -1
  130. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/backend/crates/enact-app/assets/builtin-assistants/avatars/assistant.jpg +0 -1
  131. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/backend/crates/enact-assets/assets/logos/tools/coding/tool.png +0 -1
  132. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/backend/crates/enact-session/src/backend/codex_init_prompt.md +0 -1
  133. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/mobile/assets/images/icon.png +0 -1
  134. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/packages/desktop/src/renderer/assets/logos/brand/app.png +0 -1
  135. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/packages/desktop/src/renderer/assets/themes/default-theme.png +0 -1
  136. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/public/pwa/icon-192.png +0 -1
  137. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-allowed/frontend/resources/product.png +0 -1
  138. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/placement/fixtures/placement-stray/backend/crates/enact-session/src/backend/README.md +0 -1
  139. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-clean/plans/features/az347-test-coverage/spec.md +0 -12
  140. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/plans_layout/fixtures/plans-layout-violation/plans/features/az347-test-coverage/spec.md +0 -12
  141. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/__init__.py +0 -11
  142. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/check.py +0 -62
  143. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/NotAMigration.sql +0 -1
  144. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/0001_long_prefix.sql +0 -1
  145. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/001_init.sql +0 -1
  146. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/002_add_index.sql +0 -1
  147. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/003-dashed-slug.sql +0 -1
  148. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/004_MixedCase.sql +0 -1
  149. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/005_trailing space.sql +0 -1
  150. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/01_short_prefix.sql +0 -1
  151. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/fixtures/migration-filenames/backend/crates/demo/migrations/not-a-migration.sql +0 -1
  152. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/profile_data/test_check.py +0 -116
  153. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/links.md +0 -20
  154. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-broken/docs/architecture/product/route-target.md +0 -8
  155. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/links.md +0 -20
  156. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/references/fixtures/link-targets-clean/docs/architecture/product/route-target.md +0 -8
  157. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_closed_set/fixtures/.changeset/declared.txt +0 -1
  158. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/layout/root_markdown_allowlist/fixtures/root-markdown-clean/INDEPENDENT-VERIFICATION.md +0 -3
  159. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/.gitattributes +0 -1
  160. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/attribute-without-conversion/large file.bin +0 -3
  161. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/.gitattributes +0 -1
  162. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/large file.bin +0 -3
  163. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/clean/small.txt +0 -1
  164. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/missing-filter/large file.bin +0 -0
  165. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/.gitattributes +0 -1
  166. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/lfs/integrity/fixtures/unmatched-extension/payload.dat +0 -0
  167. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/__init__.py +0 -1
  168. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/__init__.py +0 -12
  169. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/check.py +0 -129
  170. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/disjoint/gate-registry.yaml +0 -13
  171. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/empty/gate-registry.yaml +0 -7
  172. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/fixtures/overlapping/gate-registry.yaml +0 -13
  173. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/pipeline/phase_disjoint/test_check.py +0 -109
  174. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/__init__.py +0 -1
  175. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/__init__.py +0 -11
  176. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/check.py +0 -149
  177. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/clean/docs/readme.md +0 -4
  178. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/fixtures/relevant/VERSION +0 -1
  179. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/changeset_plan/test_check.py +0 -151
  180. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/__init__.py +0 -11
  181. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/check.py +0 -202
  182. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/changesets/package.json +0 -5
  183. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/.workflows/package.json +0 -5
  184. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/CHANGELOG.md +0 -5
  185. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/aligned/VERSION +0 -1
  186. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/changesets/package.json +0 -5
  187. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/.workflows/package.json +0 -5
  188. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/CHANGELOG.md +0 -5
  189. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/fixtures/mismatched/VERSION +0 -1
  190. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/release/version_release/test_check.py +0 -162
  191. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/banned_commands/check.py +0 -103
  192. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.lock +0 -7
  193. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/Cargo.toml +0 -4
  194. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/rust-toolchain.toml +0 -3
  195. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/backend/src/main.rs +0 -1
  196. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/clean/frontend/bun.lock +0 -1
  197. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.lock +0 -7
  198. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/Cargo.toml +0 -4
  199. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/rust-toolchain.toml +0 -3
  200. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/backend/src/main.rs +0 -1
  201. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/checks/repository/lockfile_integrity/fixtures/empty-bun-lock/frontend/bun.lock +0 -0
  202. package/packages/repo-controls/package/adl-compliance/src/adl_compliance/policy/grants-registry.yaml +0 -112
  203. package/packages/repo-controls/workflows/scripts/release/verify-npm-artifact.ts +0 -119
@@ -35,7 +35,13 @@
35
35
  * unsafeAllowUncertain = false
36
36
  *
37
37
  * [rules."rm-smoke"]
38
- * enabled = false
38
+ * enabled = false # default: the rule spec's own enabledByDefault
39
+ * automationExempt = false # default false; when true AND the hook process
40
+ * # carries ADL_AGENT_HOOKS_OVERRIDE=1, the rule
41
+ * # is NOT enforced and one loud stderr line per
42
+ * # context build names what was dropped. Adds to
43
+ * # the shipped policy below — the env var alone
44
+ * # already relaxes the shipped set.
39
45
  *
40
46
  * [repo]
41
47
  * protectedTrees = [".agents/"]
@@ -59,6 +65,19 @@
59
65
  * leaves each rule at whatever default its own spec declares
60
66
  * (`enabledByDefault`). A rule in the `uncertain` category additionally
61
67
  * cannot resolve to disabled unless `unsafeAllowUncertain` is set.
68
+ *
69
+ * The `automationExempt` flag is the repo-owned half of the automation
70
+ * override for dispatcher-driven agent sessions (Tarun named the env marker
71
+ * `ADL_AGENT_HOOKS_OVERRIDE`): a rule whose `[rules."<id>"]` entry sets it is
72
+ * dropped from the enabled set at context-build time ONLY when the hook
73
+ * process environment carries `ADL_AGENT_HOOKS_OVERRIDE=1`. The shipped
74
+ * policy (`../assets/automation-exempt.json`) is the other half: it relaxes
75
+ * the `git` and `filesystem` rules, except the branch-change and
76
+ * worktree-change ones, on the env var alone. A repo's flag ADDS to that
77
+ * set; it never narrows it. The override never re-ENABLES anything, and it
78
+ * applies after `isRuleEnabled` so the `uncertain` guard's behaviour for
79
+ * every other rule is untouched. See `../rules/engine.ts`'s
80
+ * `buildEngineContext` and `docs/operations/automation-override.md`.
62
81
  */
63
82
 
64
83
  import { AGENT_TABLE_KEYS, CONFIG_TABLES, HOOKS_TABLE_KEYS, REPO_TABLE_KEYS, ROOT_KEYS, applicableMigrations } from './config-schema.ts'
@@ -66,7 +85,21 @@ import { MARKER } from './root.ts'
66
85
  import { runningAdl } from './running-adl.ts'
67
86
 
68
87
  interface RuleSection {
69
- readonly enabled: boolean
88
+ /**
89
+ * The rule's explicit `enabled` override. `undefined` means the table
90
+ * carries no `enabled` key — the rule then resolves by the ordinary rules
91
+ * (`rules.default`, the spec's own default). An exemption-only table
92
+ * (`[rules."<id>"] automationExempt = true`) must NOT arm or disarm the
93
+ * rule on its own.
94
+ */
95
+ readonly enabled: boolean | undefined
96
+ /**
97
+ * Repo-owned half of the automation override (see this file's header): with
98
+ * `ADL_AGENT_HOOKS_OVERRIDE=1` in the hook process environment, a rule
99
+ * whose entry sets this is dropped from the enabled set at context-build
100
+ * time. Inert without the env var, and additive to the shipped policy.
101
+ */
102
+ readonly automationExempt: boolean
70
103
  }
71
104
 
72
105
  export interface RulesConfig {
@@ -352,6 +385,15 @@ export function decodeConfig(text: string): ConfigDecodeResult {
352
385
 
353
386
  const KNOWN_HOOKS_KEYS = new Set(Object.keys(HOOKS_TABLE_KEYS))
354
387
 
388
+ /**
389
+ * The keys a `[rules."<id>"]` sub-table accepts — a typo'd key fails loud via
390
+ * `rejectUnknownKeys`. Exported so the CLI's own config check validates the
391
+ * same set: the shared-schema sweep does not reach these sub-tables, and the
392
+ * decode issue is suppressed for unknown-key errors, so without this the CLI
393
+ * would accept a file the hook rejects.
394
+ */
395
+ export const KNOWN_RULE_ENTRY_KEYS: ReadonlySet<string> = new Set(['enabled', 'automationExempt'])
396
+
355
397
  function decodeHooks(value: unknown): { ok: true; value: HooksConfig } | { ok: false; issue: ConfigDecodeIssue } {
356
398
  if (value === undefined) return { ok: true, value: DEFAULT_CONFIG.hooks }
357
399
  if (!isPlainObject(value)) {
@@ -402,11 +444,17 @@ function decodeRules(value: unknown): { ok: true; value: RulesConfig } | { ok: f
402
444
  if (!isPlainObject(entry)) {
403
445
  return { ok: false, issue: { pointer: `/rules/${key}`, message: 'expected a table' } }
404
446
  }
447
+ const unknown = rejectUnknownKeys(entry, KNOWN_RULE_ENTRY_KEYS, `/rules/${key}`)
448
+ if (unknown !== null) return { ok: false, issue: unknown }
405
449
  const ruleEnabled = entry.enabled
406
- if (typeof ruleEnabled !== 'boolean') {
450
+ if (ruleEnabled !== undefined && typeof ruleEnabled !== 'boolean') {
407
451
  return { ok: false, issue: { pointer: `/rules/${key}/enabled`, message: 'expected a boolean' } }
408
452
  }
409
- byId[key] = { enabled: ruleEnabled }
453
+ const automationExempt = entry.automationExempt
454
+ if (automationExempt !== undefined && typeof automationExempt !== 'boolean') {
455
+ return { ok: false, issue: { pointer: `/rules/${key}/automationExempt`, message: 'expected a boolean' } }
456
+ }
457
+ byId[key] = { enabled: ruleEnabled, automationExempt: automationExempt ?? false }
410
458
  }
411
459
 
412
460
  return {
@@ -493,7 +541,7 @@ export function isRuleEnabled(
493
541
  specDefault: boolean,
494
542
  ): RuleEnabledResult {
495
543
  const explicit = config.byId[ruleId]
496
- const resolved = explicit !== undefined ? explicit.enabled : config.default === 'off' ? false : specDefault
544
+ const resolved = explicit?.enabled !== undefined ? explicit.enabled : config.default === 'off' ? false : specDefault
497
545
 
498
546
  if (category === 'uncertain' && !resolved && !config.unsafeAllowUncertain) {
499
547
  return {
@@ -222,11 +222,30 @@ export async function handlePreToolUse(inv: HookInvocation): Promise<HookResult>
222
222
  // it would block the very edit that repairs the file. The default rules
223
223
  // still run, and one loud WARN line goes to stderr on every call.
224
224
  const loaded = decodeConfigOrDefaults(readFileSync(configPath, 'utf8'), inv.root)
225
- const result = await decideWithConfig(inv, configPath, loaded.config)
225
+ const decided = await decideWithConfig(inv, configPath, loaded.config)
226
+ // The automation override's record of what it skipped must reach the
227
+ // operator, not only stderr: an exit-0 hook's stderr is invisible to
228
+ // Claude Code (see `withWarning`). Fold it into the result's own channels.
229
+ const override = decided.automationExempted.length > 0 ? automationOverrideWarning(decided.automationExempted) : null
230
+ const result = override === null ? decided.result : withWarningLine(inv.host, decided.result, override)
226
231
  if (loaded.warning === null) return result
227
232
  return { ...result, stdout: withWarning(inv.host, result.stdout, loaded.warning), stderr: `${loaded.warning}\n${result.stderr}` }
228
233
  }
229
234
 
235
+ /** The operator-visible line naming the rules the automation override dropped. */
236
+ function automationOverrideWarning(dropped: readonly RuleId[]): string {
237
+ const quoted = dropped.map((id) => `'${id}'`).join(', ')
238
+ return `adl hook: automation override — not enforcing automation-exempt rule(s): ${quoted}`
239
+ }
240
+
241
+ /**
242
+ * Fold a line into a result's own channels, the way `withWarning` does, so
243
+ * the operator sees it. The stderr copy is kept for hosts that read it.
244
+ */
245
+ function withWarningLine(host: HookInvocation['host'], result: HookResult, line: string): HookResult {
246
+ return { ...result, stdout: withWarning(host, result.stdout, line), stderr: `${line}\n${result.stderr}` }
247
+ }
248
+
230
249
  /**
231
250
  * Carry the config WARN to the model, not only to stderr: a hook that exits 0
232
251
  * never shows its stderr to Claude Code. Each host's channel, from its own docs
@@ -250,7 +269,7 @@ function withWarning(host: HookInvocation['host'], stdout: string, warning: stri
250
269
  return `${JSON.stringify({ ...merged, systemMessage: warning })}\n`
251
270
  }
252
271
 
253
- async function decideWithConfig(inv: HookInvocation, configPath: string, config: AdlRepoConfig): Promise<HookResult> {
272
+ async function decideWithConfig(inv: HookInvocation, configPath: string, config: AdlRepoConfig): Promise<{ result: HookResult; automationExempted: readonly RuleId[] }> {
254
273
  // The invocation's own environment, not the handler process's ambient one:
255
274
  // `main.ts` passes `process.env` here in production, and the identity rules
256
275
  // (`adl.run-required-for-writes`, `adl.git-push-branch-policy`,
@@ -271,13 +290,16 @@ async function decideWithConfig(inv: HookInvocation, configPath: string, config:
271
290
  if (!ctx.ok) {
272
291
  inv.record?.({ reason: 'ERROR rules config', message: `adl hook: ${configPath} ${ctx.issue.pointer}: ${ctx.issue.message}${runningAdl()}` })
273
292
  return {
274
- stdout: '',
275
- stderr: `adl hook: ${configPath} ${ctx.issue.pointer}: ${ctx.issue.message}${runningAdl()}\n`,
276
- exitCode: FAIL_CLOSED_EXIT_CODE,
293
+ result: {
294
+ stdout: '',
295
+ stderr: `adl hook: ${configPath} ${ctx.issue.pointer}: ${ctx.issue.message}${runningAdl()}\n`,
296
+ exitCode: FAIL_CLOSED_EXIT_CODE,
297
+ },
298
+ automationExempted: [],
277
299
  }
278
300
  }
279
301
 
280
- return decideAndRespond(inv, ctx.value)
302
+ return { result: decideAndRespond(inv, ctx.value), automationExempted: ctx.value.automationExempted }
281
303
  }
282
304
 
283
305
  /**
@@ -0,0 +1,16 @@
1
+ // The shipped automation-override policy: docs/operations/automation-override.md.
2
+ import policy from '../../assets/automation-exempt.json'
3
+
4
+ /** The env marker that activates the override — see `./engine.ts`. */
5
+ export const AUTOMATION_OVERRIDE_ENV = 'ADL_AGENT_HOOKS_OVERRIDE'
6
+
7
+ /** The rule ids the automation override switches off, read from the shipped policy file. */
8
+ export const AUTOMATION_EXEMPT_RULES: Readonly<Record<string, true>> = Object.fromEntries(
9
+ policy.rules.filter((rule) => rule.state === 'disabled').map((rule) => [rule.id, true]),
10
+ )
11
+
12
+ /** The rule ids the shipped policy keeps enforced while the override is active. */
13
+ export const AUTOMATION_RETAINED_RULES: Readonly<Record<string, true>> = Object.fromEntries(
14
+ policy.rules.filter((rule) => rule.state !== 'disabled').map((rule) => [rule.id, true]),
15
+ )
16
+
@@ -22,6 +22,7 @@
22
22
 
23
23
  import type { AgentSection, ConfigDecodeIssue, RepoSection, RulesConfig } from '../gating/config.ts'
24
24
  import { isRuleEnabled } from '../gating/config.ts'
25
+ import { AUTOMATION_EXEMPT_RULES, AUTOMATION_OVERRIDE_ENV } from './automation-exempt.ts'
25
26
  import type { AgentPort, EnvPort, RepoIndexPort } from './ports.ts'
26
27
  import { noAgent } from './ports.ts'
27
28
  import type { AnyRuleSpec, Finding, MessageContext, RuleId } from './spec.ts'
@@ -56,12 +57,26 @@ export interface EngineContext {
56
57
  readonly agentId: AgentPort
57
58
  /** The repository root the hook is running against — see `spec.ts`'s `RuleContext.root`. Empty when unknown. */
58
59
  readonly root: string
60
+ /**
61
+ * The rule ids the automation override dropped from `enabled`, in drop
62
+ * order. Empty when the override is inactive. The pre-tool-use handler
63
+ * folds these into the hook result so the operator sees what was skipped
64
+ * — a hook that exits 0 never shows its stderr (see
65
+ * `../pre-tool-use/handler.ts`'s `withWarning`).
66
+ */
67
+ readonly automationExempted: readonly RuleId[]
59
68
  }
60
69
 
61
70
  export type BuildEngineContextResult =
62
71
  | { readonly ok: true; readonly value: EngineContext }
63
72
  | { readonly ok: false; readonly issue: ConfigDecodeIssue }
64
73
 
74
+ /** The single audit line `buildEngineContext` emits when the override dropped at least one rule. */
75
+ function automationExemptLine(ruleIds: readonly RuleId[]): string {
76
+ const quoted = ruleIds.map((id) => `'${id}'`).join(', ')
77
+ return `adl hook: automation override (${AUTOMATION_OVERRIDE_ENV}=1) — not enforcing automation-exempt rule(s): ${quoted} (shipped policy: packages/agent-hooks/assets/automation-exempt.json; repo config: [rules."<id>"] automationExempt = true)`
78
+ }
79
+
65
80
  /** Resolve which rules are enabled once, so `decide()` never has to consult `isRuleEnabled` per call. */
66
81
  export function buildEngineContext(
67
82
  config: RulesConfig,
@@ -73,6 +88,13 @@ export function buildEngineContext(
73
88
  agent: AgentSection = { user: '', protectedBranches: ['main', 'integration'] },
74
89
  /** The repository root — see `EngineContext.root`. Optional, appended last, so every existing call site keeps compiling. */
75
90
  root = '',
91
+ /**
92
+ * Sink for the automation-override audit line; defaults to the process's
93
+ * own stderr, the same fd `main.ts` writes a `HookResult.stderr` to. Tests
94
+ * inject a capture sink; the pre-tool-use handler and the CLI both get the
95
+ * default, so the override always leaves this trail.
96
+ */
97
+ warn: (line: string) => void = (line) => process.stderr.write(`${line}\n`),
76
98
  ): BuildEngineContextResult {
77
99
  const enabled = new Set<RuleId>()
78
100
  for (const rule of rules.values()) {
@@ -80,7 +102,31 @@ export function buildEngineContext(
80
102
  if (!resolved.ok) return resolved
81
103
  if (resolved.enabled) enabled.add(rule.id)
82
104
  }
83
- return { ok: true, value: { config, repo, agent, rules, enabled, index, env, agentId, root } }
105
+ // The automation override, applied AFTER ordinary resolution so a rule an
106
+ // `uncertain`-category guard would reject still errors the same way it
107
+ // always has, and rules outside the exempt set are byte-identical to a
108
+ // build without the env var. The exempt set is the SHIPPED policy
109
+ // (`assets/automation-exempt.json`: git and filesystem rules, except the
110
+ // branch-change and worktree-change ones) plus whatever the repo marked
111
+ // `[rules."<id>"] automationExempt = true` in its own config. The override
112
+ // only ever removes ids from `enabled`; it never re-enables one.
113
+ //
114
+ // An `uncertain`-category rule is NOT dropped: those fail closed by design
115
+ // and turning that off needs `rules.unsafeAllowUncertain = true`, the same
116
+ // explicit opt-in `isRuleEnabled` demands. Without that flag the rule keeps
117
+ // its ordinary resolution — dropping it here would bypass the interlock.
118
+ const exempted: RuleId[] = []
119
+ if (env.get(AUTOMATION_OVERRIDE_ENV) === '1') {
120
+ for (const id of [...enabled]) {
121
+ if (rules.get(id)?.category === 'uncertain' && !config.unsafeAllowUncertain) continue
122
+ if (AUTOMATION_EXEMPT_RULES[id] === true || config.byId[id]?.automationExempt === true) {
123
+ enabled.delete(id)
124
+ exempted.push(id)
125
+ }
126
+ }
127
+ if (exempted.length > 0) warn(automationExemptLine(exempted))
128
+ }
129
+ return { ok: true, value: { config, repo, agent, rules, enabled, index, env, agentId, root, automationExempted: exempted } }
84
130
  }
85
131
 
86
132
  export type DecideInput =
@@ -84,6 +84,15 @@
84
84
  * /dev/null git push origin feat/x` is still caught as `script`, not
85
85
  * missed because the literal first word was a wrapper.
86
86
  *
87
+ * (d) Setting `ADL_AGENT_HOOKS_OVERRIDE` is denied in the same named
88
+ * forms as (a): it is the automation override marker, and the
89
+ * dispatcher's session launch sets it for a dispatcher-driven agent
90
+ * session. An agent that set it for itself would stand the hook gates
91
+ * down (the git and filesystem rules, and the repo-controls
92
+ * integrity/protected-branch/findings-ratchet steps) for the whole
93
+ * process — its own gates. The detection is the one (a) already owns,
94
+ * parameterised by the marker name.
95
+ *
87
96
  * Word collection deliberately does NOT walk into here-documents, here-
88
97
  * strings, or `$(...)`/backtick substitutions (out of scope for this rule);
89
98
  * it only reaches one level into a REAL shell's `-c`/`--command` script
@@ -140,12 +149,29 @@ export const RULE_ID = 'adl.human-azdo-bypass'
140
149
  */
141
150
  const ADL_HUMAN_AZDO_ENV_VAR = 'ADL_HUMAN_AZDO'
142
151
 
143
- /** `os.environ['ADL_HUMAN_AZDO'] = ...` / `os.environ.setdefault('ADL_HUMAN_AZDO', ...)` — Python. Checked against ONLY the `-c`/`-e`/`--eval` code argument (see this file's own header). */
144
- const PYTHON_HUMAN_AZDO_SET_RE = /os\.environ\s*(?:\[\s*['"]ADL_HUMAN_AZDO['"]\s*\]|\.setdefault\(\s*['"]ADL_HUMAN_AZDO['"])\s*[=(]/
145
- /** `process.env.ADL_HUMAN_AZDO = ...` / `process.env['ADL_HUMAN_AZDO'] = ...` — Node. */
146
- const NODE_HUMAN_AZDO_SET_RE = /process\.env\s*(?:\.\s*ADL_HUMAN_AZDO\b|\[\s*['"]ADL_HUMAN_AZDO['"]\s*\])\s*=/
147
- /** `$ENV{ADL_HUMAN_AZDO} = ...` — Perl. */
148
- const PERL_HUMAN_AZDO_SET_RE = /\$ENV\{\s*['"]?ADL_HUMAN_AZDO['"]?\s*\}\s*=/
152
+ /**
153
+ * The automation override marker. The dispatcher's session launch sets it
154
+ * for a dispatcher-driven agent session; an agent may never set it for
155
+ * itself — the override stands the hook gates down, so a self-minted marker
156
+ * would let an agent disable its own gates.
157
+ */
158
+ const ADL_AGENT_HOOKS_OVERRIDE_ENV_VAR = 'ADL_AGENT_HOOKS_OVERRIDE'
159
+
160
+ /**
161
+ * An interpreter's own setter for a protected marker — Python's
162
+ * `os.environ[...] =` / `os.environ.setdefault(...)`, Node's
163
+ * `process.env.X =` / `process.env['X'] =`, Perl's `$ENV{X} =`. Checked
164
+ * against ONLY the `-c`/`-e`/`--eval` code argument (see this file's own
165
+ * header).
166
+ */
167
+ function interpreterMarkerSetPattern(name: string): RegExp {
168
+ const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
169
+ return new RegExp(
170
+ '(?:os\\.environ\\s*(?:\\[\\s*[\'"]' + escaped + '[\'"]\\s*\\]|\\.setdefault\\(\\s*[\'"]' + escaped + '[\'"])\\s*[=(]' +
171
+ '|process\\.env\\s*(?:\\.\\s*' + escaped + '\\b|\\[\\s*[\'"]' + escaped + '[\'"]\\s*\\])\\s*=' +
172
+ '|\\$ENV\\{\\s*[\'"]?' + escaped + '[\'"]?\\s*\\}\\s*=)',
173
+ )
174
+ }
149
175
 
150
176
  /** `del os.environ['ADL_AGENT_ID_AGENT']` / `os.environ.pop(...)` / `os.unsetenv(...)` — Python. */
151
177
  const PYTHON_AGENT_ID_DELETE_RE = /\bdel\s+os\.environ\s*\[\s*['"]ADL_AGENT_ID_AGENT['"]\s*\]|\bos\.environ\.pop\(\s*['"]ADL_AGENT_ID_AGENT['"]|\bos\.unsetenv\(\s*['"]ADL_AGENT_ID_AGENT['"]/
@@ -339,9 +365,19 @@ function afterHeadSkipWords(values: readonly string[]): readonly string[] {
339
365
  return rest
340
366
  }
341
367
 
342
- /** True when `values` (one piece's words) sets/exports/declares/reads-into/printf-v's `ADL_HUMAN_AZDO` in a real setter POSITION, or an interpreter's inline code writes it via `os.environ`/`process.env`/`$ENV`. */
343
- function pieceSetsHumanAzdo(values: readonly string[], heredocs: readonly string[]): boolean {
344
- const name = ADL_HUMAN_AZDO_ENV_VAR
368
+ /**
369
+ * True when `values` (one piece's words) SETS one of the environment markers
370
+ * an agent may never mint for itself, in a real setter POSITION: a leading
371
+ * assignment, `export`/`declare`/`typeset`/`local`/`read`/`printf -v`,
372
+ * `env NAME=value`, or an interpreter's inline code writing it via
373
+ * `os.environ`/`process.env`/`$ENV`.
374
+ *
375
+ * The markers are `ADL_HUMAN_AZDO` (the human pass-through marker) and
376
+ * `ADL_AGENT_HOOKS_OVERRIDE` (the automation override marker — the
377
+ * dispatcher's session launch sets it, and an agent that could set it would
378
+ * stand the gates down for itself).
379
+ */
380
+ function pieceSetsProtectedMarker(values: readonly string[], heredocs: readonly string[], name: string): boolean {
345
381
  let index = 0
346
382
  while (index < values.length && ASSIGNMENT_SHAPE_RE.test(values[index] as string)) {
347
383
  const word = values[index] as string
@@ -390,7 +426,7 @@ function pieceSetsHumanAzdo(values: readonly string[], heredocs: readonly string
390
426
  // (computed once from the whole command, not per-piece).
391
427
  const inline = interpreterInlineCode(rest)
392
428
  const candidates = inline !== null ? [inline] : heredocs
393
- return candidates.some((code) => PYTHON_HUMAN_AZDO_SET_RE.test(code) || NODE_HUMAN_AZDO_SET_RE.test(code) || PERL_HUMAN_AZDO_SET_RE.test(code))
429
+ return candidates.some((code) => interpreterMarkerSetPattern(name).test(code))
394
430
  }
395
431
  return false
396
432
  }
@@ -566,7 +602,7 @@ function pieceUsesPtyFakingWrapper(piece: WordPiece): boolean {
566
602
  return false
567
603
  }
568
604
 
569
- type BypassReason = 'sets-human-azdo' | 'clears-agent-identity' | 'pty-faking-wrapper'
605
+ type BypassReason = 'sets-human-azdo' | 'sets-automation-override' | 'clears-agent-identity' | 'pty-faking-wrapper'
570
606
 
571
607
  export const adlHumanAzdoBypass: RuleSpec = {
572
608
  id: RULE_ID,
@@ -574,7 +610,7 @@ export const adlHumanAzdoBypass: RuleSpec = {
574
610
  severity: 'deny',
575
611
  enabledByDefault: true,
576
612
  summary:
577
- "Deny an agent command that sets/exports/assigns ADL_HUMAN_AZDO, clears ADL_AGENT_ID_AGENT, or fakes a TTY to defeat bin/git-ado's human/agent decision.",
613
+ "Deny an agent command that sets/exports/assigns ADL_HUMAN_AZDO or ADL_AGENT_HOOKS_OVERRIDE, clears ADL_AGENT_ID_AGENT, or fakes a TTY to defeat bin/git-ado's human/agent decision.",
578
614
  params: noParams,
579
615
  match(inv: Invocation, ctx: RuleContext<Record<string, never>>): Finding | null {
580
616
  // A tool-call payload (a real MCP call) carries no shell command text
@@ -589,10 +625,14 @@ export const adlHumanAzdoBypass: RuleSpec = {
589
625
  const heredocs = heredocBodies(command)
590
626
  let reason: BypassReason | null = null
591
627
  for (const piece of pieces) {
592
- if (pieceSetsHumanAzdo(piece.values, heredocs)) {
628
+ if (pieceSetsProtectedMarker(piece.values, heredocs, ADL_HUMAN_AZDO_ENV_VAR)) {
593
629
  reason = 'sets-human-azdo'
594
630
  break
595
631
  }
632
+ if (pieceSetsProtectedMarker(piece.values, heredocs, ADL_AGENT_HOOKS_OVERRIDE_ENV_VAR)) {
633
+ reason = 'sets-automation-override'
634
+ break
635
+ }
596
636
  if (pieceClearsAgentIdentity(piece, heredocs)) {
597
637
  reason = 'clears-agent-identity'
598
638
  break
@@ -613,6 +653,20 @@ export const adlHumanAzdoBypass: RuleSpec = {
613
653
  },
614
654
  message(finding: Finding, ctx: MessageContext) {
615
655
  const reason = (typeof finding.detail.reason === 'string' ? finding.detail.reason : 'sets-human-azdo') as BypassReason
656
+ if (reason === 'sets-automation-override') {
657
+ const user = `${ADL_AGENT_HOOKS_OVERRIDE_ENV_VAR} is the automation override marker; an agent may never set it`
658
+ return {
659
+ user,
660
+ agent:
661
+ `DENIED ${user}. ${ADL_AGENT_HOOKS_OVERRIDE_ENV_VAR}=1 stands the hook gates down (the git and filesystem ` +
662
+ `rules, and the repo-controls integrity/protected-branch/findings-ratchet steps) for the whole process. Only the ` +
663
+ `dispatcher's session launch sets it, for a dispatcher-driven agent session; an agent that sets it for itself ` +
664
+ `would disable its own gates. Setting, exporting, or assigning it from an agent surface (inline, export, env, ` +
665
+ `declare/typeset -x, printf -v, read, a nested REAL shell, or an interpreter's own os.environ/process.env/$ENV) ` +
666
+ `is denied in every form. If a gate is blocking legitimate work, report the finding instead of standing it down. ` +
667
+ `Blocked: ${ctx.snippet}`,
668
+ }
669
+ }
616
670
  if (reason === 'clears-agent-identity') {
617
671
  const user = `clearing ${ADL_AGENT_ID_ENV_VAR} is not allowed — an agent must always carry its identity`
618
672
  return {
@@ -693,6 +747,15 @@ export const adlHumanAzdoBypass: RuleSpec = {
693
747
  'ssh -t 127.0.0.1 git push origin feat/x',
694
748
  // The live bypass found by the independent review, combined.
695
749
  "export ADL_HUMAN_AZD''O=1; unset ADL_AGENT_ID_AGENT; script -q /dev/null git push origin feat/x",
750
+ // Minting the automation override marker: an agent that sets it stands
751
+ // the hook gates down for itself.
752
+ 'ADL_AGENT_HOOKS_OVERRIDE=1 git commit -m x',
753
+ 'export ADL_AGENT_HOOKS_OVERRIDE=1',
754
+ 'env ADL_AGENT_HOOKS_OVERRIDE=1 git commit -m x',
755
+ 'declare -x ADL_AGENT_HOOKS_OVERRIDE=1',
756
+ `bash -c 'export ADL_AGENT_HOOKS_OVERRIDE=1 && git commit -m x'`,
757
+ `python3 -c "import os; os.environ['ADL_AGENT_HOOKS_OVERRIDE'] = '1'"`,
758
+ `node -e "process.env.ADL_AGENT_HOOKS_OVERRIDE = '1'"`,
696
759
  ],
697
760
  allow: [
698
761
  'git status',
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env bash
2
+ # See docs/operations/agent-pool.md, section "Design notes".
3
+ #
4
+ # See docs/operations/agent-pool.md, section "Design notes".
5
+ main() {
6
+ set -euo pipefail
7
+
8
+ export DEBIAN_FRONTEND=noninteractive
9
+
10
+ # See docs/operations/agent-pool.md, section "Design notes".
11
+ local AGENT_VERSION="4.275.0"
12
+ local AGENT_SHA256="416eb9340385d599e3159b86d08c03754af24d1cb2b6624425142a47ca65f346"
13
+ local AGENT_URL="https://download.agent.dev.azure.com/agent/${AGENT_VERSION}/vsts-agent-linux-x64-${AGENT_VERSION}.tar.gz"
14
+ local AGENT_USER="azp"
15
+ local AGENT_DIRS=(/opt/azp/agent-a /opt/azp/agent-b)
16
+ # Release binaries with no apt package: pinned by version and sha256.
17
+ local YQ_VERSION="v4.54.1"
18
+ local YQ_SHA256="8e34fc298390875de416e6a4afcb8cabeceb25d9aa8506c1a2f9353cf702ea5f"
19
+ local JUST_VERSION="1.59.0"
20
+ local JUST_SHA256="409044617b6f06517c1035e55ca38c8c856ff8b650e41bc2aa1ef82d5903a23e"
21
+
22
+ apt-get update
23
+ apt-get install -y ca-certificates curl gnupg git jq unzip iptables
24
+
25
+ # docker-ce (official apt repo)
26
+ install -m 0755 -d /etc/apt/keyrings
27
+ curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
28
+ chmod a+r /etc/apt/keyrings/docker.asc
29
+ local codename
30
+ codename="$(. /etc/os-release; echo "$VERSION_CODENAME")"
31
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian ${codename} stable" \
32
+ > /etc/apt/sources.list.d/docker.list
33
+
34
+ apt-get update
35
+ apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
36
+ systemctl enable docker
37
+
38
+ # Toolchain: see docs/operations/agent-pool.md, section "Image toolchain".
39
+ apt-get install -y git-lfs unzip zip xvfb lsof python3 python3-venv golang-go rustc cargo \
40
+ build-essential ripgrep fd-find shfmt
41
+ ln -sf /usr/bin/fdfind /usr/local/bin/fd
42
+
43
+ # NodeSource node 22, Microsoft azure-cli, PostgreSQL PGDG client 18: official apt repos
44
+ curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor --yes -o /etc/apt/keyrings/nodesource.gpg
45
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" \
46
+ > /etc/apt/sources.list.d/nodesource.list
47
+ curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor --yes -o /etc/apt/keyrings/microsoft.gpg
48
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ bookworm main" \
49
+ > /etc/apt/sources.list.d/azure-cli.list
50
+ curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc -o /etc/apt/keyrings/pgdg.asc
51
+ echo "deb [signed-by=/etc/apt/keyrings/pgdg.asc] https://apt.postgresql.org/pub/repos/apt ${codename}-pgdg main" \
52
+ > /etc/apt/sources.list.d/pgdg.list
53
+ apt-get update
54
+ apt-get install -y nodejs azure-cli postgresql-client-18
55
+ # ast-grep: release binary only (npm's `sg` alias collides with /usr/bin/sg)
56
+ curl -fsSL -o /tmp/ast-grep.zip https://github.com/ast-grep/ast-grep/releases/download/0.51.0/app-x86_64-unknown-linux-gnu.zip
57
+ echo "a7eead5552d3a8daad70f5d50d935da44bd0c138e946b5b0a96b1d38169fa639 /tmp/ast-grep.zip" | sha256sum -c -
58
+ unzip -o -j /tmp/ast-grep.zip ast-grep -d /usr/local/bin
59
+ rm -f /tmp/ast-grep.zip
60
+
61
+ # bun and uv: official install scripts, system-wide
62
+ curl -fsSL https://bun.sh/install | BUN_INSTALL=/usr/local bash
63
+ curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin UV_NO_MODIFY_PATH=1 sh
64
+
65
+ # yq and just: GitHub release binaries, sha256-checked
66
+ local rel
67
+ rel="$(mktemp -d)"
68
+ curl -fsSL "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_amd64" -o "$rel/yq"
69
+ echo "${YQ_SHA256} $rel/yq" | sha256sum -c -
70
+ install -m 0755 "$rel/yq" /usr/local/bin/yq
71
+ curl -fsSL "https://github.com/casey/just/releases/download/${JUST_VERSION}/just-${JUST_VERSION}-x86_64-unknown-linux-musl.tar.gz" -o "$rel/just.tgz"
72
+ echo "${JUST_SHA256} $rel/just.tgz" | sha256sum -c -
73
+ tar -xzf "$rel/just.tgz" -C "$rel" just
74
+ install -m 0755 "$rel/just" /usr/local/bin/just
75
+ rm -rf "$rel"
76
+
77
+ git lfs install --system
78
+
79
+ # See docs/operations/agent-pool.md, section "Design notes".
80
+ if ! id -u "$AGENT_USER" >/dev/null 2>&1; then
81
+ useradd --create-home --shell /bin/bash "$AGENT_USER"
82
+ fi
83
+ usermod -aG docker "$AGENT_USER"
84
+
85
+ # agent tarball: download once, verify, unpack per agent dir
86
+ local tmp
87
+ tmp="$(mktemp -d)"
88
+ curl -fsSL "$AGENT_URL" -o "$tmp/agent.tar.gz"
89
+ echo "${AGENT_SHA256} $tmp/agent.tar.gz" | sha256sum -c -
90
+
91
+ mkdir -p /opt/azp
92
+ local dir
93
+ for dir in "${AGENT_DIRS[@]}"; do
94
+ mkdir -p "$dir"
95
+ tar -xzf "$tmp/agent.tar.gz" -C "$dir"
96
+ chown -R "$AGENT_USER":"$AGENT_USER" "$dir"
97
+ (cd "$dir"; ./bin/installdependencies.sh)
98
+ done
99
+ rm -rf "$tmp"
100
+
101
+ # Fail loudly if any toolchain binary is missing: no half-built image gets the success marker.
102
+ local tool
103
+ for tool in git git-lfs docker node npm bun az uv jq yq just xvfb-run psql unzip zip python3 go cargo rustc make gcc rg fd shfmt lsof ast-grep; do
104
+ if ! command -v "$tool" >/dev/null 2>&1; then
105
+ echo "provision: missing tool: $tool" >&2
106
+ exit 1
107
+ fi
108
+ done
109
+
110
+ # See docs/operations/agent-pool.md, section "Design notes".
111
+ apt-get clean
112
+ rm -rf /var/lib/apt/lists/*
113
+ rm -f /etc/ssh/ssh_host_*
114
+ truncate -s 0 /etc/machine-id
115
+ rm -f /var/lib/dbus/machine-id
116
+ ln -sf /etc/machine-id /var/lib/dbus/machine-id
117
+ sync
118
+ # See docs/operations/agent-pool.md, section "Design notes": success marker, checked at agent boot.
119
+ touch /etc/adl-image-ok
120
+ }
121
+
122
+ main "$@" </dev/null
@@ -30,7 +30,7 @@ Load `workitems-process` first. This card is the lead's whole procedure. Sub-age
30
30
  ## Preconditions
31
31
 
32
32
  1. The worktree matches `worktree`; the branch is the Feature's implementation branch (per-Bug run: the per-Bug branch); the tree is clean, or the dirt is your own previous attempt.
33
- 2. Read the Feature's children (`workitem_list_or_get`). Every in-scope item is at Approved or later; if not, the trigger does not hold: report the item and its state on the Feature and end the run. Per-Bug run: read only the Bug; it must be at Approved through Updating Docs with its PR not merged (other Bugs in the Fixes Feature do not matter); if not, report its state on the Bug and end the run.
33
+ 2. Read the Feature's children (`workitem_list_or_get`). Every in-scope item is at Approved or later; if not, the trigger does not hold: report the item and its state on the Feature and end the run. Every predecessor Feature is at Awaiting Release or Done — the dispatcher's decider enforces this (it holds such items as `predecessor-open`), and a manual run self-checks the same way: if a predecessor is still open, report it on the Feature and end the run. Per-Bug run: read only the Bug; it must be at Approved through Updating Docs with its PR not merged (other Bugs in the Fixes Feature do not matter); if not, report its state on the Bug and end the run.
34
34
  3. The plan folder is on the branch (planning PR merged): the four plan documents and every `items/az<id>-*.md` exist. If the planning PR is not merged yet, end the run and report it; the next tick re-evaluates.
35
35
  4. `sha256` of `requirements.md` equals `PlanHash` (the hash covers `requirements.md` only). On a mismatch, post both hashes as a Feature comment and do not start Design Validation: the approved plan is not the one on the branch. **[pending F7: the tool will refuse the Design Validation move on a mismatch; the field reference name is not yet confirmed through the API.]**
36
36
 
@@ -16,7 +16,7 @@ Load `workitems-process` first. This card adds only what the planning run does.
16
16
  - **Mode A, planning run (default).** Dispatched planning target, key = the Feature. Lead: `planner`. When it fires: [Targets and triggers](../workitems-process/SKILL.md#targets-and-triggers).
17
17
  - **Mode B, design update.** A sub-agent brief from the implementation lead: `design.md` no longer matches the repo. See "Mode B".
18
18
  - **Not for Bugs.** A Bug is never planned: see [Bug states](../workitems-process/references/workitem-states.md#5-bug-states).
19
- - Not for a Feature with no `intent.md` (that is `write-feature`, a live session).
19
+ - A Feature whose `intent.md` is not yet on the integration base: not a stop — derive it in-run from the Feature's description (see Preconditions 2). (`write-feature`, a live session, remains the way a Feature is born with human wording.)
20
20
 
21
21
  ## Inputs
22
22
 
@@ -31,8 +31,13 @@ Branch: the planning branch, created by adl-dispatcher. A re-entry reuses the sa
31
31
  ## Preconditions
32
32
 
33
33
  1. `workitems-process` universal preconditions (worktree, board state, identity). The state check is on the Feature: New or In Progress.
34
- 2. `plans/features/az<feature>-<slug>/intent.md` exists on the integration base and its `work_item` id equals the folder id. If not, the trigger does not hold: report the mismatch on the Feature and end the run; the next tick re-evaluates.
35
- 3. The Feature has an Epic parent and at least one predecessor Feature (the very first Feature has none), and every predecessor is at Awaiting Release or Done. If not, report what is missing on the Feature and end the run; the Epic and the links are authored by the human, never created or guessed by you.
34
+ 2. `plans/features/az<feature>-<slug>/intent.md` on the integration base with `work_item` equal to the Feature. **Absent is not a stop — derive it.** The Feature's board Description is a verbatim copy of `intent.md` (that is how `write-feature` writes it), so restore from there:
35
+ 1. Read the Feature's Description. If it already carries the four headings, copy them verbatim — the human's own sentences, no rewording, nothing invented.
36
+ 2. If the Description is not intent-shaped, restructure it under the four headings using only the Feature's own sentences (a board update is allowed for this: the description must carry the four headings to move off New anyway). A heading with no source text gets `- <missing: the human owes this line>` — never a guess.
37
+ 3. Write `intent.md` with the [ado-and-git.md frontmatter](../workitems-process/references/ado-and-git.md#4-plan-files) (`type: intent`, `title`, `status`, `work_item` = the Feature's board URL, `last_update`, optional `sources`) and the four sections, into the plan folder of this run's branch — the slug is the title slug, `az<feature>-<slug>`. It reaches the integration base through the planning PR, like every plan file.
38
+ 4. Record the derivation in the run report and as a Feature comment: which sections were restored verbatim and which are `<missing: …>`, so the human can fill gaps at G1 review. Planning proceeds with what exists — a missing section never stalls the run.
39
+ Only if the Description itself carries no intent material at all (empty of Why/Outcome substance) does the trigger not hold: report that on the Feature and end the run.
40
+ 3. The Feature has an Epic parent. Predecessor links are the human's to author and may name Features still open: planning ahead of an unfinished predecessor is expected, and an open predecessor never blocks a planning run (the dispatcher gates **implementation**, not planning, on predecessor state — its decider holds such items as `predecessor-open`). If the Epic parent is missing, report what is missing on the Feature and end the run; the Epic and the links are authored by the human, never created or guessed by you.
36
41
  4. Resume: read the board and the branch first. Reuse allocated ids; never allocate twice.
37
42
 
38
43
  ## Procedure (Mode A)
@@ -41,7 +46,7 @@ Branch: the planning branch, created by adl-dispatcher. A re-entry reuses the sa
41
46
 
42
47
  ### 1. Orient and pin the baseline
43
48
 
44
- 1. Read `intent.md`, the predecessor Features' plan folders on the integration base, the existing plan folder if any, and every G1 finding or reviewer finding left on the Feature and its items (comment read tool pending T1).
49
+ 1. Read `intent.md`, the predecessor Features' plan folders on the integration base, the existing plan folder if any, and every G1 finding or reviewer finding left on the Feature and its items (comment read tool pending T1). If `intent.md` is absent on the base, derive it first per Preconditions 2 and read the derived copy.
45
50
  2. Understand the code: `crg architecture`, `crg query callers_of|tests_for <symbol>`, `crg impact`. You may spawn read-only explore sub-agents on the fast tier; they write nothing.
46
51
  3. Re-entry on an existing plan branch: bring it current with the integration base. Never recreate, rebase or force-push it.
47
52
  4. **Baseline Sha** = the exact integration SHA you read. It goes in `file-map-reference.md` `## Baseline` and in the Feature's Baseline Sha field.
@@ -134,7 +139,7 @@ A Fixes Bug has its own ladder and no plan folder ([Bug states](../workitems-pro
134
139
  ## Never
135
140
 
136
141
  - Never move an item to Awaiting Approval, Approved, Done or Removed. Never move a Feature (workitem-triage rolls it up).
137
- - Never edit `intent.md`. It is the human's.
142
+ - Never edit `intent.md` once it exists. It is the human's. The single exception: a planning run whose `intent.md` is absent on the integration base derives it verbatim from the Feature's Description (Preconditions 2) — that is restoration, not editing.
138
143
  - Never answer a G1 open question and remove it yourself; it stays listed for G1.
139
144
  - Never put the Plan Hash, revision or baseline in frontmatter.
140
145
  - Never ask the Architect and Critic in one parallel batch, and never let the same context author and approve.
@@ -29,10 +29,10 @@ References: [`references/workitem-states.md`](references/workitem-states.md) (st
29
29
  | 2 | `implementation` | Feature, or one Fixes Bug (Approved through Updating Docs) keyed by the Bug **[pending L5, X2]** | `implement-feature` | `lead` | the one implementation PR merged into `integration` |
30
30
 
31
31
  - A Feature takes two runs: one planning run, then one implementation run. A Fixes Bug takes one run: the per-Bug implementation run. One run = one worktree, one terminal, one lead session that orchestrates its sub-agents.
32
- - **Ready:** a Feature is ready when every predecessor Feature is at Awaiting Release or Done.
32
+ - **Implementation-ready:** a Feature is implementation-ready when every predecessor Feature is at Awaiting Release or Done. Planning is never predecessor-gated: a Feature plans as soon as its own trigger fires, so its plan is approved and waiting the moment the predecessor ships.
33
33
  - **`workitem-triage` fires on any of:** an open PBI or Bug off the ladder (`Committed` included); an item whose state may not match its evidence; a Feature roll-up is due; a Feature with no parent Epic, or (all but the first) no predecessor Feature; a red pipeline **[pending X4]**. A red pipeline is filed only when the LATEST completed run of the `integration` or `main` pipeline is red AND its build id is named in no Bug's `## Failing builds` (any state). Then: if an open Bug (New through Updating Docs) names the same failure, append the build id to it, with no comment. Otherwise file a new Bug through `report-bug`; if an earlier Bug (Done or Parked for Removal) names the same failure, that Bug is its predecessor. Older runs are never filed. A run already named never files again. Once named, a red `main` run waiting for promotion and the last red `integration` run before the fix's next run both stay quiet. Done proof: each latest completed run is green or its build id is named by a Bug.
34
- - **`planning` fires on either:** a Feature at New whose `intent.md` is on the integration base and which is ready; or a Feature at In Progress with any child at New or In Planning (the G1 rework or requeue re-fire) **[pending X1]**. Nothing queues it. It never fires on a Bug, and never on a `Fixes to closed Features` Feature: its Bugs at New are not planned (G1 approves each Bug's Description, then X2).
35
- - **`implementation` fires per Feature on all of:** every in-scope item (not Parked for Removal or Removed) is at Approved or later; at least one in-scope item is not Done; the Feature is ready; the Feature's planning PR is merged into `integration` **[pending X5]**. A `Fixes to closed Features` Feature never fires it under the Feature key; each of its Bugs fires alone, keyed by the Bug, at Approved through Updating Docs, until its PR merges (the X12 done proof) **[pending X2]**. A Bug at Approved starts a fresh run; a Bug at In Reproduction through Updating Docs is a died or `PR_OPEN` run, resumed from the Bug's state.
34
+ - **`planning` fires on either:** a Feature at New (its `intent.md` is on the integration base, or the planning run derives it from the Feature's Description — see `plan-feature` Preconditions 2); or a Feature at In Progress with any child at New or In Planning (the G1 rework or requeue re-fire) **[pending X1]**. Nothing queues it. It never fires on a Bug, and never on a `Fixes to closed Features` Feature: its Bugs at New are not planned (G1 approves each Bug's Description, then X2). A predecessor Feature still open does not gate planning; it gates implementation only.
35
+ - **`implementation` fires per Feature on all of:** every in-scope item (not Parked for Removal or Removed) is at Approved or later; at least one in-scope item is not Done; the Feature is implementation-ready; the Feature's planning PR is merged into `integration` **[pending X5]**. A `Fixes to closed Features` Feature never fires it under the Feature key; each of its Bugs fires alone, keyed by the Bug, at Approved through Updating Docs, until its PR merges (the X12 done proof) **[pending X2]**. A Bug at Approved starts a fresh run; a Bug at In Reproduction through Updating Docs is a died or `PR_OPEN` run, resumed from the Bug's state.
36
36
  - CI is not a target; it is the last stage of implementation (ADR-019).
37
37
  - **The dispatcher is a trigger:** code, no LLM. It reads the board, PRs, pipelines and branches, picks targets in rank order, and starts one session. It writes nothing to ADO. Every board write is made by the session it starts or by adl-agent-control.
38
38
  - **No attempt cap.** While a key's trigger holds, the same key is re-dispatched into the same worktree and branch, and the lead resolves the cause. A session silent for 20 min is interrupted; the trigger still holds, so the key is re-dispatched.
@@ -89,7 +89,7 @@ One folder per Feature: `plans/features/az<feature id>-<slug>/` holding `intent.
89
89
  - Frontmatter `status` mirrors the board state; the board is authoritative. Plan Revision, Plan Hash and Baseline Sha are never frontmatter.
90
90
  - The file contracts (frontmatter + sections) are the tables below; there is no per-repo `plans/templates/`.
91
91
 
92
- **`intent.md`** (Tarun, live `write-feature` session; agents never edit it). Frontmatter: `type: intent`, `title`, `status`, `work_item` (the Feature's board URL), `last_update`, optional `sources`.
92
+ **`intent.md`** (authored by Tarun in a live `write-feature` session; agents never edit it once it exists, with one exception — a planning run whose `intent.md` is absent on the integration base derives it verbatim from the Feature's Description, no invented text, per `plan-feature` Preconditions 2). Frontmatter: `type: intent`, `title`, `status`, `work_item` (the Feature's board URL), `last_update`, optional `sources`.
93
93
 
94
94
  | Section | Rule |
95
95
  |---|---|