agentplane 0.2.25 → 0.3.1

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 (221) hide show
  1. package/README.md +3 -1
  2. package/assets/AGENTS.md +123 -526
  3. package/assets/agents/UPGRADER.json +10 -9
  4. package/assets/framework.manifest.json +112 -7
  5. package/assets/policy/check-routing.mjs +180 -0
  6. package/assets/policy/dod.code.md +25 -0
  7. package/assets/policy/dod.core.md +32 -0
  8. package/assets/policy/dod.docs.md +32 -0
  9. package/assets/policy/examples/migration-note.md +6 -0
  10. package/assets/policy/examples/pr-note.md +16 -0
  11. package/assets/policy/examples/unit-test-pattern.md +19 -0
  12. package/assets/policy/governance.md +37 -0
  13. package/assets/policy/incidents.md +36 -0
  14. package/assets/policy/security.must.md +7 -0
  15. package/assets/policy/workflow.branch_pr.md +34 -0
  16. package/assets/policy/workflow.direct.md +46 -0
  17. package/assets/policy/workflow.md +9 -0
  18. package/assets/policy/workflow.release.md +31 -0
  19. package/assets/policy/workflow.upgrade.md +20 -0
  20. package/bin/agentplane.js +47 -57
  21. package/bin/dist-guard.js +124 -0
  22. package/dist/.build-manifest.json +11 -0
  23. package/dist/agents/agents-template.d.ts +7 -0
  24. package/dist/agents/agents-template.d.ts.map +1 -1
  25. package/dist/agents/agents-template.js +41 -2
  26. package/dist/backends/task-backend/local-backend.d.ts +2 -0
  27. package/dist/backends/task-backend/local-backend.d.ts.map +1 -1
  28. package/dist/backends/task-backend/local-backend.js +12 -1
  29. package/dist/backends/task-backend/redmine/mapping.d.ts.map +1 -1
  30. package/dist/backends/task-backend/redmine/mapping.js +26 -1
  31. package/dist/backends/task-backend/redmine-backend.d.ts +4 -0
  32. package/dist/backends/task-backend/redmine-backend.d.ts.map +1 -1
  33. package/dist/backends/task-backend/redmine-backend.js +92 -9
  34. package/dist/backends/task-backend/shared/types.d.ts +1 -0
  35. package/dist/backends/task-backend/shared/types.d.ts.map +1 -1
  36. package/dist/backends/task-index.d.ts.map +1 -1
  37. package/dist/backends/task-index.js +8 -1
  38. package/dist/cli/command-guide.d.ts.map +1 -1
  39. package/dist/cli/command-guide.js +39 -17
  40. package/dist/cli/command-snippets.d.ts +24 -0
  41. package/dist/cli/command-snippets.d.ts.map +1 -0
  42. package/dist/cli/command-snippets.js +23 -0
  43. package/dist/cli/reason-codes.d.ts +9 -0
  44. package/dist/cli/reason-codes.d.ts.map +1 -0
  45. package/dist/cli/reason-codes.js +79 -0
  46. package/dist/cli/recipes-bundled.d.ts +1 -0
  47. package/dist/cli/recipes-bundled.d.ts.map +1 -1
  48. package/dist/cli/recipes-bundled.js +4 -1
  49. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  50. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  51. package/dist/cli/run-cli/command-catalog.js +40 -1
  52. package/dist/cli/run-cli/commands/config.d.ts +5 -0
  53. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  54. package/dist/cli/run-cli/commands/config.js +86 -1
  55. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  56. package/dist/cli/run-cli/commands/core.js +57 -2
  57. package/dist/cli/run-cli/commands/ide.d.ts.map +1 -1
  58. package/dist/cli/run-cli/commands/ide.js +8 -3
  59. package/dist/cli/run-cli/commands/init/recipes.d.ts +5 -1
  60. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  61. package/dist/cli/run-cli/commands/init/recipes.js +24 -4
  62. package/dist/cli/run-cli/commands/init/ui.d.ts.map +1 -1
  63. package/dist/cli/run-cli/commands/init/ui.js +1 -2
  64. package/dist/cli/run-cli/commands/init/write-agents.d.ts +2 -0
  65. package/dist/cli/run-cli/commands/init/write-agents.d.ts.map +1 -1
  66. package/dist/cli/run-cli/commands/init/write-agents.js +24 -5
  67. package/dist/cli/run-cli/commands/init/write-workflow.d.ts +12 -0
  68. package/dist/cli/run-cli/commands/init/write-workflow.d.ts.map +1 -0
  69. package/dist/cli/run-cli/commands/init/write-workflow.js +58 -0
  70. package/dist/cli/run-cli/commands/init.d.ts +4 -1
  71. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  72. package/dist/cli/run-cli/commands/init.js +126 -48
  73. package/dist/cli/run-cli.d.ts.map +1 -1
  74. package/dist/cli/run-cli.js +195 -8
  75. package/dist/commands/backend/sync.command.d.ts.map +1 -1
  76. package/dist/commands/backend/sync.command.js +7 -6
  77. package/dist/commands/backend.d.ts.map +1 -1
  78. package/dist/commands/backend.js +2 -0
  79. package/dist/commands/doctor.run.d.ts.map +1 -1
  80. package/dist/commands/doctor.run.js +107 -16
  81. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  82. package/dist/commands/guard/impl/commands.js +12 -6
  83. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  84. package/dist/commands/recipes/impl/commands/install.js +36 -13
  85. package/dist/commands/recipes/impl/scenario.d.ts.map +1 -1
  86. package/dist/commands/recipes/impl/scenario.js +25 -0
  87. package/dist/commands/recipes/impl/types.d.ts +4 -0
  88. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  89. package/dist/commands/release/apply.command.d.ts.map +1 -1
  90. package/dist/commands/release/apply.command.js +9 -4
  91. package/dist/commands/release/plan.command.d.ts.map +1 -1
  92. package/dist/commands/release/plan.command.js +9 -3
  93. package/dist/commands/scenario/impl/commands.d.ts.map +1 -1
  94. package/dist/commands/scenario/impl/commands.js +74 -3
  95. package/dist/commands/scenario/impl/report.d.ts +8 -0
  96. package/dist/commands/scenario/impl/report.d.ts.map +1 -1
  97. package/dist/commands/scenario/impl/report.js +1 -0
  98. package/dist/commands/shared/reconcile-check.d.ts +7 -0
  99. package/dist/commands/shared/reconcile-check.d.ts.map +1 -0
  100. package/dist/commands/shared/reconcile-check.js +60 -0
  101. package/dist/commands/sync.command.d.ts.map +1 -1
  102. package/dist/commands/sync.command.js +9 -2
  103. package/dist/commands/task/add.d.ts.map +1 -1
  104. package/dist/commands/task/add.js +32 -0
  105. package/dist/commands/task/doc.command.d.ts.map +1 -1
  106. package/dist/commands/task/doc.command.js +1 -0
  107. package/dist/commands/task/finish.d.ts.map +1 -1
  108. package/dist/commands/task/finish.js +11 -1
  109. package/dist/commands/task/list.d.ts.map +1 -1
  110. package/dist/commands/task/list.js +2 -1
  111. package/dist/commands/task/list.spec.d.ts.map +1 -1
  112. package/dist/commands/task/list.spec.js +7 -0
  113. package/dist/commands/task/new.d.ts.map +1 -1
  114. package/dist/commands/task/new.js +41 -4
  115. package/dist/commands/task/next.d.ts.map +1 -1
  116. package/dist/commands/task/next.js +2 -1
  117. package/dist/commands/task/next.spec.d.ts.map +1 -1
  118. package/dist/commands/task/next.spec.js +7 -0
  119. package/dist/commands/task/plan.d.ts.map +1 -1
  120. package/dist/commands/task/plan.js +7 -1
  121. package/dist/commands/task/search.d.ts.map +1 -1
  122. package/dist/commands/task/search.js +2 -1
  123. package/dist/commands/task/search.spec.d.ts.map +1 -1
  124. package/dist/commands/task/search.spec.js +7 -0
  125. package/dist/commands/task/shared.d.ts +14 -0
  126. package/dist/commands/task/shared.d.ts.map +1 -1
  127. package/dist/commands/task/shared.js +58 -1
  128. package/dist/commands/task/start-ready.js +1 -1
  129. package/dist/commands/task/verify-record.d.ts.map +1 -1
  130. package/dist/commands/task/verify-record.js +2 -0
  131. package/dist/commands/upgrade.command.d.ts.map +1 -1
  132. package/dist/commands/upgrade.command.js +2 -2
  133. package/dist/commands/upgrade.d.ts.map +1 -1
  134. package/dist/commands/upgrade.js +263 -294
  135. package/dist/commands/workflow-build.command.d.ts +8 -0
  136. package/dist/commands/workflow-build.command.d.ts.map +1 -0
  137. package/dist/commands/workflow-build.command.js +103 -0
  138. package/dist/commands/workflow-playbook.command.d.ts +10 -0
  139. package/dist/commands/workflow-playbook.command.d.ts.map +1 -0
  140. package/dist/commands/workflow-playbook.command.js +173 -0
  141. package/dist/commands/workflow-restore.command.d.ts +5 -0
  142. package/dist/commands/workflow-restore.command.d.ts.map +1 -0
  143. package/dist/commands/workflow-restore.command.js +30 -0
  144. package/dist/commands/workflow.command.d.ts +6 -0
  145. package/dist/commands/workflow.command.d.ts.map +1 -0
  146. package/dist/commands/workflow.command.js +36 -0
  147. package/dist/harness/dynamic-tool-contract.d.ts +29 -0
  148. package/dist/harness/dynamic-tool-contract.d.ts.map +1 -0
  149. package/dist/harness/dynamic-tool-contract.js +86 -0
  150. package/dist/harness/hooks-lifecycle.d.ts +27 -0
  151. package/dist/harness/hooks-lifecycle.d.ts.map +1 -0
  152. package/dist/harness/hooks-lifecycle.js +67 -0
  153. package/dist/harness/index.d.ts +9 -0
  154. package/dist/harness/index.d.ts.map +1 -0
  155. package/dist/harness/index.js +8 -0
  156. package/dist/harness/reconcile.d.ts +37 -0
  157. package/dist/harness/reconcile.d.ts.map +1 -0
  158. package/dist/harness/reconcile.js +42 -0
  159. package/dist/harness/retry-policy.d.ts +31 -0
  160. package/dist/harness/retry-policy.d.ts.map +1 -0
  161. package/dist/harness/retry-policy.js +33 -0
  162. package/dist/harness/scheduler.d.ts +18 -0
  163. package/dist/harness/scheduler.d.ts.map +1 -0
  164. package/dist/harness/scheduler.js +55 -0
  165. package/dist/harness/state-machine.d.ts +17 -0
  166. package/dist/harness/state-machine.d.ts.map +1 -0
  167. package/dist/harness/state-machine.js +70 -0
  168. package/dist/harness/token-accounting.d.ts +19 -0
  169. package/dist/harness/token-accounting.d.ts.map +1 -0
  170. package/dist/harness/token-accounting.js +77 -0
  171. package/dist/harness/workspace-safety.d.ts +14 -0
  172. package/dist/harness/workspace-safety.d.ts.map +1 -0
  173. package/dist/harness/workspace-safety.js +62 -0
  174. package/dist/recipes/bundled-recipes.d.ts +4 -0
  175. package/dist/recipes/bundled-recipes.d.ts.map +1 -1
  176. package/dist/recipes/bundled-recipes.js +11 -0
  177. package/dist/shared/errors.d.ts +6 -0
  178. package/dist/shared/errors.d.ts.map +1 -1
  179. package/dist/shared/errors.js +1 -0
  180. package/dist/shared/policy-gateway.d.ts +15 -0
  181. package/dist/shared/policy-gateway.d.ts.map +1 -0
  182. package/dist/shared/policy-gateway.js +49 -0
  183. package/dist/shared/protected-paths.d.ts.map +1 -1
  184. package/dist/shared/protected-paths.js +1 -0
  185. package/dist/shared/runtime-artifacts.d.ts +2 -2
  186. package/dist/shared/runtime-artifacts.d.ts.map +1 -1
  187. package/dist/shared/runtime-artifacts.js +4 -0
  188. package/dist/workflow-runtime/build.d.ts +4 -0
  189. package/dist/workflow-runtime/build.d.ts.map +1 -0
  190. package/dist/workflow-runtime/build.js +126 -0
  191. package/dist/workflow-runtime/enforcement.d.ts +3 -0
  192. package/dist/workflow-runtime/enforcement.d.ts.map +1 -0
  193. package/dist/workflow-runtime/enforcement.js +10 -0
  194. package/dist/workflow-runtime/file-ops.d.ts +11 -0
  195. package/dist/workflow-runtime/file-ops.d.ts.map +1 -0
  196. package/dist/workflow-runtime/file-ops.js +248 -0
  197. package/dist/workflow-runtime/fix.d.ts +9 -0
  198. package/dist/workflow-runtime/fix.d.ts.map +1 -0
  199. package/dist/workflow-runtime/fix.js +107 -0
  200. package/dist/workflow-runtime/index.d.ts +11 -0
  201. package/dist/workflow-runtime/index.d.ts.map +1 -0
  202. package/dist/workflow-runtime/index.js +10 -0
  203. package/dist/workflow-runtime/markdown.d.ts +10 -0
  204. package/dist/workflow-runtime/markdown.d.ts.map +1 -0
  205. package/dist/workflow-runtime/markdown.js +147 -0
  206. package/dist/workflow-runtime/observability.d.ts +12 -0
  207. package/dist/workflow-runtime/observability.d.ts.map +1 -0
  208. package/dist/workflow-runtime/observability.js +14 -0
  209. package/dist/workflow-runtime/paths.d.ts +3 -0
  210. package/dist/workflow-runtime/paths.d.ts.map +1 -0
  211. package/dist/workflow-runtime/paths.js +11 -0
  212. package/dist/workflow-runtime/template.d.ts +7 -0
  213. package/dist/workflow-runtime/template.d.ts.map +1 -0
  214. package/dist/workflow-runtime/template.js +94 -0
  215. package/dist/workflow-runtime/types.d.ts +68 -0
  216. package/dist/workflow-runtime/types.d.ts.map +1 -0
  217. package/dist/workflow-runtime/types.js +1 -0
  218. package/dist/workflow-runtime/validate.d.ts +8 -0
  219. package/dist/workflow-runtime/validate.d.ts.map +1 -0
  220. package/dist/workflow-runtime/validate.js +331 -0
  221. package/package.json +3 -3
package/assets/AGENTS.md CHANGED
@@ -1,601 +1,198 @@
1
1
  <!--
2
- AGENTS_POLICY: prod-v1.1
2
+ AGENTS_POLICY: gateway-v1.1
3
3
  repo_namespace: .agentplane
4
4
  default_initiator: ORCHESTRATOR
5
5
  -->
6
6
 
7
7
  # PURPOSE
8
8
 
9
- This document defines the **behavioral policy** for Codex-style agents operating in this repository (CLI + VS Code extension).
10
- Goal: **deterministic execution**, **tight guardrails**, and **minimum accidental changes** by enforcing a strict, inspectable pipeline.
11
-
12
- This policy is designed to be the single, authoritative instruction set the agent follows when invoked in a folder containing this file.
13
-
14
- ---
15
-
16
- # GLOBAL RULES
17
-
18
- ## Language of artifacts
19
-
20
- - All repository-facing artifacts, including task titles, task descriptions, generated docs, notes, and comments must be in English unless the user explicitly requests another language for a specific task.
21
- - User-facing chat responses should follow the user's language preference (here: Russian), while disk artifacts remain English-first by default.
22
-
23
- ## Cross-platform and encoding
24
-
25
- - All textual files in this repository must use UTF-8.
26
- - Repos should keep source text files normalized and portable; avoid OS-local path and shell assumptions in core runtime logic.
27
- - Treat path handling and process invocation as platform-sensitive; abstract platform-specific behavior behind explicit utilities.
28
- - Encode new scripts and docs using UTF-8 and avoid legacy code-page text in repository files.
29
-
30
- ## Sources of truth (priority order)
31
-
32
- 1. `AGENTS.md` (this file)
33
- 2. `agentplane quickstart` / `agentplane role <ROLE>` output
34
- 3. `.agentplane/config.json`
35
- 4. `.agentplane/agents/*.json`
36
-
37
- If two sources conflict, prefer the higher-priority source.
38
-
39
- ## CLI invocation
40
-
41
- All commands in this policy are written as `agentplane ...`.
42
- Use the `agentplane` CLI from `PATH` when available; if not, use the repo-local entrypoint (for example `node packages/agentplane/bin/agentplane.js ...`).
43
-
44
- ## Scope boundary
45
-
46
- - All operations must remain within the repository unless explicitly approved (see Approval Gates + Overrides).
47
- - Do not read/write global user files (`~`, `/etc`, keychains, ssh keys, global git config) unless explicitly approved and necessary.
48
-
49
- ## Agent roles (authority boundaries)
50
-
51
- - **ORCHESTRATOR**: the only role allowed to initiate a run; owns user-facing plan + approval gates; does not create task artifacts.
52
- - **PLANNER**: the sole creator of executable tasks; may reprioritize tasks; may adjust task graph planning (within approved scope).
53
- - **CREATOR**: creates a new specialized agent definition only when required by the approved plan.
54
- - **INTEGRATOR**: the only role allowed to integrate/merge into base branch (for `branch_pr`), finish tasks on base, and run exports.
55
-
56
- No other role may assume another role’s authority.
57
-
58
- ## Execution agents (registry)
59
-
60
- Execution agents are defined by JSON files under `.agentplane/agents/*.json`. The file basename (without `.json`) is the agent ID (e.g. `CODER`, `TESTER`, `REVIEWER`, `DOCS`).
61
-
62
- **Contract (executable task assignment):**
63
-
64
- - Every executable task created by PLANNER MUST set `owner` to an existing execution agent ID from `.agentplane/agents/*.json`.
65
- - If no suitable execution agent exists, PLANNER MUST:
66
- - create a dedicated CREATOR task to add the missing agent definition, and
67
- - make all tasks that require that new agent depend on the CREATOR task via `depends_on: [<creator-task-id>]`.
68
-
69
- **Enforcement status:**
70
-
71
- - Current: hard validation in CLI (`task new` / `task update`) when `owner` does not exist in `.agentplane/agents` (command fails with `E_VALIDATION`).
72
- - Planned: keep the CLI gate and add CI lint for drift detection/reporting.
73
-
74
- ## Definitions (remove ambiguity)
75
-
76
- - **Read-only inspection**: commands that may read repo state but must not change tracked files or commit history.
77
- Examples: `agentplane config show`, `agentplane task list`, `agentplane task show`, `git status`, `git diff`, `cat`, `grep`.
78
- - **Mutating action**: anything that can change tracked files, task state, commits, branches, or outside-repo state.
79
- Examples: `agentplane task new/update/doc set/plan set/start/finish/verify`, `git commit`, `git checkout`, `bun install`.
80
-
81
- If unsure whether an action mutates state, treat it as mutating.
82
-
83
- ## Truthfulness & safety (hard invariants)
84
-
85
- - Never invent facts about repo state. Prefer inspection over guessing.
86
- - Never modify `.agentplane/tasks.json` manually. It is an **export-only snapshot** generated via `agentplane task export`.
87
- - Never expose raw internal chain-of-thought. Use structured artifacts instead (see OUTPUT CONTRACTS).
88
- - Timestamps are recorded in task metadata fields (for example `plan_approval.updated_at` and `verification.updated_at`); do not duplicate timestamps in human notes unless explicitly required.
89
-
90
- ## Cleanliness & untracked files
91
-
92
- - Ignore pre-existing untracked files you did not create.
93
- - Only stage/commit files intentionally modified for the current task.
94
- - Any tracked code changes must be recorded in a git commit before finishing the task (do not leave `packages/**` diffs uncommitted).
95
- - “Clean” means: **no tracked changes** (`git status --short --untracked-files=no` is empty).
96
- - If untracked files interfere with verify/guardrails or fall inside the task scope paths, surface them as a risk and request approval before acting.
97
-
98
- ## Approval gates (network vs outside-repo)
99
-
100
- ### Network
101
-
102
- If `.agentplane/config.json` sets `agents.approvals.require_network=true`:
103
-
104
- - Network use is prohibited until the user explicitly approves it (per run or per command batch).
105
-
106
- Network use includes (non-exhaustive):
107
-
108
- - `pip`, `npm`, `bun install`, downloading binaries/models
109
- - `curl`, `wget`
110
- - `git fetch`, `git pull`
111
- - calling external HTTP APIs or remote services
112
-
113
- ### Outside-repo
114
-
115
- Outside-repo reading/writing is **always prohibited** unless the user explicitly approves it (regardless of `require_network`).
116
-
117
- Outside-repo includes (non-exhaustive):
118
-
119
- - reading/writing outside the repo (`~`, `/etc`, global configs)
120
- - modifying keychains, ssh keys, credential stores
121
- - any tool that mutates outside-repo state
122
-
123
- ## Execution Profile
124
-
125
- `execution` settings in `.agentplane/config.json` define operational behavior defaults for agents:
126
-
127
- - `profile`: `conservative` / `balanced` / `aggressive`
128
- - `reasoning_effort`: `low` / `medium` / `high`
129
- - `tool_budget`: `{ discovery, implementation, verification }`
130
- - `stop_conditions`: conditions that force a stop/re-plan/escalation
131
- - `handoff_conditions`: conditions that trigger handoff to another role
132
- - `unsafe_actions_requiring_explicit_user_ok`: actions that require explicit user confirmation
133
-
134
- Approval escalation semantics:
135
-
136
- - `execution` MAY raise approval requirements for specific actions (`network_access`, `force_action`).
137
- - `execution` does not add new CLI capabilities; it only changes whether explicit approval is required.
138
- - Capability boundaries remain defined by CLI commands + this policy.
139
-
140
- Profile matrix:
141
-
142
- - `conservative`: require approval for `network_access` and `force_action` (even if baseline approvals disable them).
143
- - `balanced`: use baseline approvals from `agents.approvals`.
144
- - `aggressive`: use baseline approvals from `agents.approvals`.
145
-
146
- Precedence:
147
-
148
- - Role authority boundaries, source-of-truth order, and hard invariants in this `AGENTS.md` still take precedence.
149
- - If `execution` config conflicts with policy, `AGENTS.md` policy wins.
150
-
151
- ## Framework Upgrade / Prompt Merge
152
-
153
- `agentplane upgrade` is responsible for mechanical upgrades and safe merges. Treat prompt-merge as required only for unresolved semantic conflicts (for example, both local and incoming changes exist relative to a baseline and cannot be safely reconciled automatically, or merge parsing fails). If local files did not change relative to baseline, the upgrade may apply incoming framework updates without semantic review.
154
-
155
- Trigger:
156
-
157
- - After running `agentplane upgrade`, check the latest upgrade review report:
158
- - Agent mode: `.agentplane/.upgrade/agent/<runId>/review.json`
159
- - Auto mode: `.agentplane/.upgrade/last-review.json`
160
- - If any record has `needsSemanticReview: true`, prompt merge is required.
161
- - `needsSemanticReview: false` means the change was mechanically safe (including cases where local files were unchanged vs baseline and incoming updates were applied directly).
162
-
163
- Protocol:
164
-
165
- 1. ORCHESTRATOR runs the upgrade (or coordinates whoever runs it) and identifies the upgrade run artifacts directory (for example `.agentplane/.upgrade/agent/<runId>/`).
166
- 2. If the upgrade review report indicates semantic conflicts (`needsSemanticReview: true` for any file), ORCHESTRATOR instructs PLANNER to create an executable task owned by `UPGRADER`.
167
- 3. UPGRADER performs semantic reconciliation of `AGENTS.md` and `.agentplane/agents/*.json`:
168
- - `AGENTS.md` remains the canonical policy source (highest priority).
169
- - Preserve local customizations via the Local Overrides block (`<!-- AGENTPLANE:LOCAL-START/END -->`) where feasible.
170
- - Minimize unrelated churn in agent JSON profiles; remove contradictions with `AGENTS.md`.
171
-
172
- Task creation requirements (PLANNER):
173
-
174
- - Owner: `UPGRADER`
175
- - Description must include:
176
- - the upgrade run directory path (for example `.agentplane/.upgrade/agent/<runId>/`)
177
- - the list of `relPath` entries with `needsSemanticReview: true` from `review.json`
178
-
179
- Done when:
180
-
181
- - No contradictions remain between `AGENTS.md` and agent profiles.
182
- - Local overrides are preserved (or explicitly removed with a documented decision).
183
- - Relevant lint/tests pass.
184
-
185
- ---
186
-
187
- # NON-NEGOTIABLE PIPELINE
188
-
189
- 1. **Preflight** (ORCHESTRATOR, mandatory; read-only)
190
- 2. **Plan + task graph planning** (no execution; read-only)
191
- 3. **Explicit user approval** (overall plan + any requested overrides)
192
- 4. **Create executable task graph** (PLANNER)
193
- 5. **Plan and document created tasks**
194
- 6. **Execute tasks under mode-specific workflow**
195
- 7. **Verify**
196
- 8. **Finish**
197
- 9. **Export** (if enabled / required)
198
-
199
- No step may be skipped unless the user explicitly authorizes skipping it via the Override Protocol.
9
+ `AGENTS.md` is the policy gateway for agents in this repository.
10
+ It provides strict routing, hard constraints, and command contracts.
11
+ Detailed procedures live in canonical modules from `## CANONICAL DOCS`.
200
12
 
201
13
  ---
202
14
 
203
- # OUTPUT CONTRACTS (REASONING & EXPLAINABILITY)
204
-
205
- ## Do not expose raw internal chain-of-thought
206
-
207
- Agents MUST NOT output raw internal chain-of-thought (token-level reasoning, scratchwork, discarded branches).
208
-
209
- ## Use structured, inspectable reasoning artifacts
15
+ ## PROJECT
210
16
 
211
- Agents MUST express reasoning through explicit artifacts, as applicable:
212
-
213
- - **Preflight Summary**
214
- - **Plan**
215
- - **Assumptions**
216
- - **Decisions**
217
- - **Trade-offs**
218
- - **Verification criteria**
219
- - **Inference trace** (brief, task-relevant links between inputs -> decisions -> outputs)
220
-
221
- This is the required substitute for raw chain-of-thought.
17
+ - Repository type: user project initialized with `agentplane`.
18
+ - Gateway role: keep this file compact and deterministic; move scenario-specific details to policy modules.
19
+ - CLI rule: use `agentplane` from `PATH`; if unavailable, stop and request installation guidance (do not invent repo-local entrypoints).
20
+ - Startup shortcut: run `## COMMANDS -> Preflight`, then apply `## LOAD RULES` before any mutation.
222
21
 
223
22
  ---
224
23
 
225
- # MANDATORY PREFLIGHT (ORCHESTRATOR)
226
-
227
- Preflight is **read-only inspection**. It is allowed before user approval.
228
-
229
- Before any planning or execution, ORCHESTRATOR must run:
24
+ ## SOURCES OF TRUTH
230
25
 
231
- 1. `agentplane config show`
232
- 2. `agentplane quickstart` (CLI instructions)
233
- 3. `agentplane task list`
234
- 4. `git status --short --untracked-files=no`
235
- 5. `git rev-parse --abbrev-ref HEAD`
26
+ Priority order (highest first):
236
27
 
237
- Then report a **Preflight Summary** (do not dump full config or quickstart text).
28
+ 1. Enforcement: CI, tests, linters, hooks, CLI validations.
29
+ 2. Policy gateway: `AGENTS.md`.
30
+ 3. Canonical policy modules from `## CANONICAL DOCS`.
31
+ 4. CLI guidance: `agentplane quickstart`, `agentplane role <ROLE>`, `.agentplane/config.json`.
32
+ 5. Reference examples from `## REFERENCE EXAMPLES`.
238
33
 
239
- ## Preflight Summary (required)
34
+ Conflict rule:
240
35
 
241
- You MUST explicitly state:
242
-
243
- - Config loaded: yes/no
244
- - CLI instructions loaded: yes/no
245
- - Task list loaded: yes/no
246
- - Working tree clean (tracked-only): yes/no
247
- - Current git branch: `<name>`
248
- - `workflow_mode`: `direct` / `branch_pr` / unknown
249
- - Approval gates (from config):
250
- - `require_plan`: true/false/unknown
251
- - `require_verify`: true/false/unknown
252
- - `require_network`: true/false/unknown
253
- - Outside-repo: not needed / needed (if needed, requires explicit user approval)
254
-
255
- Do not output the full contents of config or quickstart unless the user explicitly asks.
36
+ - If documentation conflicts with enforcement, enforcement wins.
37
+ - If lower-priority text conflicts with higher-priority policy, higher-priority policy wins.
256
38
 
257
39
  ---
258
40
 
259
- # STARTUP RULE
260
-
261
- - Always begin work by engaging ORCHESTRATOR.
262
- - ORCHESTRATOR starts by producing an execution plan + task graph plan.
263
- - **Before explicit user approval, do not perform mutating actions.**
264
- - Allowed: read-only inspection (including preflight).
265
- - Prohibited: creating/updating tasks, editing files, starting/finishing tasks, commits, branching, verify runs that mutate task state, network use, outside-repo access.
266
-
267
- ---
41
+ ## SCOPE BOUNDARY
268
42
 
269
- # ORCHESTRATION FLOW
270
-
271
- ## 1) Plan & task graph planning (no execution)
272
-
273
- ORCHESTRATOR MUST produce:
274
-
275
- - **Scope**
276
- - In-scope paths and artifacts
277
- - Out-of-scope boundaries
278
- - **Assumptions**
279
- - Only if required; each assumption must be testable/confirmable
280
- - **Steps**
281
- - Ordered, executable steps
282
- - **Task graph planning**
283
- - Atomic tasks, each with one specific owner from existing agent IDs
284
- - Prefer the minimum number of executable tasks; do not split work by role labels alone
285
- - Split only when there is an independent deliverable, a different required owner, or a real dependency/verification boundary
286
- - Do not create executable tasks solely for scaffolding/docs handoffs/status bookkeeping
287
- - **Approvals**
288
- - Whether network and/or outside-repo actions will be needed
289
- - Any requested overrides (see Override Protocol)
290
- - **Verification criteria**
291
- - What will be considered "done" + checks to run
292
- - **Rollback plan**
293
- - How to revert safely if verification fails
294
- - **Drift triggers**
295
- - Conditions that require re-approval (see DRIFT POLICY)
296
-
297
- ## 2) After user approval (task graph is mandatory)
298
-
299
- - PLANNER creates executable tasks directly from the approved task graph plan.
300
- - If task graph planning yields exactly one work item, create exactly one executable task.
301
- - If task graph planning yields multiple work items, create only executable tasks and connect them with `depends_on`.
302
- - Before creating a new task, PLANNER must check open tasks (`TODO|DOING|BLOCKED`) and reuse/update a matching task when scope and owner align.
303
- - Task IDs are referenced in comments/notes for traceability.
304
-
305
- **Task traceability is mandatory** for any work that changes repo state and must be captured on executable tasks. Exceptions require explicit user approval (Override Protocol).
43
+ - MUST keep all actions inside this repository unless the user explicitly approves outside-repo access.
44
+ - MUST NOT read or modify global user files (`~`, `/etc`, keychains, ssh keys, global git config) without explicit user approval.
45
+ - MUST treat network access as approval-gated when `agents.approvals.require_network=true`.
306
46
 
307
47
  ---
308
48
 
309
- # OVERRIDE PROTOCOL (USER-APPROVED EXCEPTIONS)
310
-
311
- Overrides exist to let the user intentionally relax guardrails **in a controlled, logged way**.
312
-
313
- ## Hard invariants (cannot be overridden)
314
-
315
- - No fabricated repo facts.
316
- - No raw chain-of-thought.
317
- - No manual editing of `.agentplane/tasks.json` (exports are generated, not edited).
318
-
319
- ## What can be overridden (with explicit user approval)
49
+ ## COMMANDS
320
50
 
321
- Common overridable guardrails:
51
+ ### Preflight
322
52
 
323
- - **Network**: allow network access even when `require_network=true`.
324
- - **Outside-repo**: allow reading/writing outside the repo (scoped).
325
- - **Pipeline**: skip/relax steps (e.g., skip task traceability for analysis-only; skip exports).
326
- - **Tooling**: allow direct `git` operations when no agentplane command exists (commit/push).
327
- - **Force flags**: allow `--force` status transitions / dependency bypass.
53
+ ```bash
54
+ agentplane config show
55
+ agentplane quickstart
56
+ agentplane task list
57
+ git status --short --untracked-files=no
58
+ git rev-parse --abbrev-ref HEAD
59
+ ```
328
60
 
329
- ## Required format (to remove ambiguity)
61
+ ### Task lifecycle
330
62
 
331
- When requesting an override, the agent MUST:
63
+ ```bash
64
+ agentplane task new --title "..." --description "..." --priority med --owner <ROLE> --tag <tag>
65
+ agentplane task plan set <task-id> --text "..." --updated-by <ROLE>
66
+ agentplane task plan approve <task-id> --by ORCHESTRATOR
67
+ agentplane task start-ready <task-id> --author <ROLE> --body "Start: ..."
68
+ agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
69
+ agentplane finish <task-id> --author <ROLE> --body "Verified: ..." --result "..." --commit <git-rev> --close-commit
70
+ ```
332
71
 
333
- 1. State the exact override(s) requested (one line per override).
334
- 2. State why it is necessary.
335
- 3. State the exact commands/actions it enables.
336
- 4. State the scope and expiration (this task only / this run only).
72
+ ### Verification
337
73
 
338
- The user must respond explicitly approving (or rejecting) the override(s).
339
-
340
- ## Logging (traceability requirement)
341
-
342
- Any approved override MUST be recorded:
343
-
344
- - In the task(s) executing the approved scope under `## Notes` → `### Approvals / Overrides`.
74
+ ```bash
75
+ agentplane task verify-show <task-id>
76
+ agentplane verify <task-id> --ok|--rework --by <ROLE> --note "..."
77
+ agentplane doctor
78
+ node .agentplane/policy/check-routing.mjs
79
+ ```
345
80
 
346
81
  ---
347
82
 
348
- # TASKS & DOCUMENTATION (TRACEABILITY)
349
-
350
- ## Golden rule
351
-
352
- If an agent changes repo state, that work must be traceable to a task ID and a filled task README.
353
-
354
- ## Task scaffold policy
355
-
356
- - `agentplane task new` seeds standard README sections automatically.
357
- - Use `agentplane task scaffold <task-id>` only for backfill/import/manual repair flows.
358
-
359
- ## Who fills the README
360
-
361
- - ORCHESTRATOR/PLANNER may create tasks with a minimal description.
362
- - The **agent that will execute the task** is responsible for filling the task README sections
363
- (Plan + Verify Steps + Risks + Rollback + Notes) before starting work.
364
-
365
- ## Required sections (before finish)
366
-
367
- Required sections are config-driven (`.agentplane/config.json` → `tasks.doc.required_sections`).
368
- At minimum, every task MUST have non-empty content for:
369
-
370
- - Summary
371
- - Scope
372
- - Plan
373
- - Risks
374
- - Verification
375
- - Rollback Plan
376
-
377
- **Policy addition for maximum traceability:**
378
-
379
- - `Context` and `Notes` MUST be filled for all non-trivial tasks (anything beyond a typo/doc tweak).
380
- - `Verify Steps` MUST be filled for tasks that require verify (default tags: `code`, `backend`, `frontend`) and for `spike`.
381
-
382
- ## Section content contract (practical)
383
-
384
- Use `agentplane task doc set` / `agentplane task plan set` (no manual README edits).
385
-
386
- ### Summary
387
-
388
- - What is being changed (one paragraph).
389
- - What success looks like.
390
-
391
- ### Context
392
-
393
- - Why the change is needed.
394
- - Constraints, assumptions, related tasks/PRs/issues.
395
-
396
- ### Scope
397
-
398
- - In-scope paths/files/components.
399
- - Explicit out-of-scope items.
400
-
401
- ### Plan
402
-
403
- - Ordered steps with implementation checkpoints.
404
- - Any migration steps and rollback checkpoints.
405
-
406
- ### Risks
407
-
408
- - Key risks + mitigations.
409
- - Any potential breaking changes.
410
-
411
- ### Verify Steps
83
+ ## TOOLING
412
84
 
413
- - Explicit commands and expected outcomes (pass criteria).
414
- - Prefer reproducible checks (`bun run test`, `bun run typecheck`, `bun run lint`, `agentplane verify <task-id>`, etc.).
415
- - If verification is manual, state the manual checklist and acceptance criteria.
416
-
417
- ### Rollback Plan
418
-
419
- - How to revert safely (commands or steps).
420
-
421
- ### Notes (use structured subheadings)
422
-
423
- Use `## Notes` to log:
424
-
425
- - `### Approvals / Overrides` (if any)
426
- - `### Decisions` (trade-offs, why X not Y)
427
- - `### Implementation Notes` (what changed, file list, key diffs)
428
- - `### Evidence / Links` (commit hashes, PR links, logs if needed)
429
-
430
- ## Plan approval per task (when required)
431
-
432
- If config sets `agents.approvals.require_plan=true`:
433
-
434
- - The implementer fills `## Plan` (use `agentplane task plan set <task-id> ...`) and `## Verify Steps`.
435
- - ORCHESTRATOR approves with `agentplane task plan approve <task-id> --by ORCHESTRATOR [--note "..."]`.
436
- - No one may `agentplane start <task-id>` until the plan is approved (unless explicitly overridden by user).
437
-
438
- ## Two-stage verification (Verify Steps -> Verification)
439
-
440
- - `## Verify Steps` is the **ex-ante verification contract**: instructions and pass criteria addressed to the verifier.
441
- - `## Verification` is the **ex-post verification log**: append-only entries written by `agentplane verify ...`.
442
- - Do not hand-edit `## Verification` entries. Treat them as audit records.
443
- - For tasks with verify-required primary tags (default: `code`, `data`, `ops`) and for `spike`, `agentplane task plan approve`
444
- will block until `## Verify Steps` is filled (the placeholder `<!-- TODO: FILL VERIFY STEPS -->` is treated as empty).
445
- - Use `agentplane task verify-show <task-id>` to print the current `## Verify Steps` to stdout.
446
-
447
- ## Spike -> implementation convention
448
-
449
- - A spike task is identified by tag `spike` (schema-free).
450
- - A spike must define clear exit criteria in `## Verify Steps` and must capture outcomes in `## Notes` (Findings/Decision/Next Steps).
451
- - `agentplane task derive <spike-id> ...` creates an implementation task that depends on the spike via `depends_on: [<spike-id>]`.
452
-
453
- ## Updating task docs
454
-
455
- - Workflow/task artifacts (task READMEs, PR artifacts, task exports) must be updated via `agentplane` commands, not manual edits.
456
- - Task README updates must be done via `agentplane task doc set ...` / `agentplane task plan set ...`.
457
- - Manual edits to `.agentplane/tasks/<task-id>/README.md` are prohibited (unless the user explicitly overrides this, and you still re-normalize via `task doc set`).
85
+ - Use `## COMMANDS` as the canonical command source.
86
+ - For policy changes, routing validation MUST pass via `node .agentplane/policy/check-routing.mjs`.
458
87
 
459
88
  ---
460
89
 
461
- # COMMIT WORKFLOW
462
-
463
- - Commits and pushes must go through `agentplane` commands (no direct `git commit`/`git push`) unless explicitly overridden.
464
-
465
- ## Commit message semantics (canonical)
466
-
467
- There are two supported modes:
468
-
469
- ### Mode 1: Explicit commit message (manual message, still policy-governed)
90
+ ## LOAD RULES
470
91
 
471
- Use agentplane commit flows with a message that conforms to the built-in command guide, e.g.:
92
+ Routing is strict. Load only modules that match the current task.
472
93
 
473
- `agentplane guard commit <task-id> -m "✨ <suffix> <scope>: <summary>" ...`
94
+ ### Always imports for mutating tasks
474
95
 
475
- In this mode:
96
+ Condition: task includes mutation (file edits, task-state changes, commits, merge/integrate, release/publish).
476
97
 
477
- - `-m` is the **commit message** (subject/body as supported by agentplane).
478
- - Do not invent alternative formats.
98
+ - `@.agentplane/policy/security.must.md`
99
+ - `@.agentplane/policy/dod.core.md`
479
100
 
480
- ### Mode 2: Comment-driven commit (agentplane builds subject)
101
+ ### Conditional imports (linear IF -> LOAD contract)
481
102
 
482
- Use comment-driven flags (where supported by agentplane), e.g.:
103
+ 1. IF `workflow_mode=direct` THEN LOAD `@.agentplane/policy/workflow.direct.md`.
104
+ 2. IF `workflow_mode=branch_pr` THEN LOAD `@.agentplane/policy/workflow.branch_pr.md`.
105
+ 3. IF task touches release/version/publish THEN LOAD `@.agentplane/policy/workflow.release.md`.
106
+ 4. IF task runs `agentplane upgrade` or touches `.agentplane/.upgrade/**` THEN LOAD `@.agentplane/policy/workflow.upgrade.md`.
107
+ 5. IF task modifies implementation code paths THEN LOAD `@.agentplane/policy/dod.code.md`.
108
+ 6. IF task modifies docs/policy-only paths (`AGENTS.md`, docs, `.agentplane/policy/**`) THEN LOAD `@.agentplane/policy/dod.docs.md`.
109
+ 7. IF task modifies policy files (`AGENTS.md` or `.agentplane/policy/**`) THEN LOAD `@.agentplane/policy/governance.md`.
110
+ 8. IF task modifies `.agentplane/policy/incidents.md` THEN LOAD `@.agentplane/policy/incidents.md`.
483
111
 
484
- - `--commit-from-comment`
485
- - `--status-commit` (only when explicitly intended)
112
+ Routing examples:
486
113
 
487
- In this mode:
114
+ - Example (docs-only task): rules `1|6` apply in `direct`; do not load `dod.code.md`.
115
+ - Example (upgrade task): rules `4|7` apply plus workflow mode rule.
488
116
 
489
- - agentplane builds the commit subject as `<emoji> <suffix> <primary>: <status>` for major transitions only.
490
- - major transitions for status/comment-driven commits: `TODO->DOING`, `DOING->BLOCKED`, `BLOCKED->DOING`, `DOING->DONE`.
491
- - agentplane adds a short structured commit body (`Task` / `Primary` / `Status` / `Comment`) automatically for comment-driven commits.
117
+ Routing constraints:
492
118
 
493
- ## Commit subject format (enforced)
494
-
495
- `<emoji> <suffix> <scope>: <summary>`
496
-
497
- `<suffix>` rules:
498
-
499
- - Task commits: `<suffix>` must equal the task id suffix (e.g. task `202601010101-ABCDEF` -> `ABCDEF`).
500
- - Non-task commits: `<suffix>` may be omitted. Preferred: `<emoji> <scope>: <summary>`.
501
- - Optional explicit non-task suffix: `DEV` is allowed as `<emoji> DEV <scope>: <summary>`.
502
-
503
- Recommended action/status emojis:
504
-
505
- - `🚧` start / DOING
506
- - `⛔` blocked / BLOCKED
507
- - `✅` finish / DONE
508
-
509
- Executor agent emoji policy (status/comment-driven commits):
510
-
511
- - In `workflow_mode=direct`, status/comment-driven commits prefer the active `work start` lock (`.agentplane/cache/direct-work.json`) when present.
512
- - The emoji for status/comment-driven commits is derived from the executor agent id (recorded by `agentplane work start ... --agent <ID>`).
513
- - Users may override the emoji per agent by adding `commit_emoji` to `.agentplane/agents/<ID>.json`.
514
- - Finish commits MUST use `✅` (enforced by CLI and by the `commit-msg` hook for agentplane-generated commits).
515
-
516
- Agents must not reinterpret `-m` as "body-only" or "comment-only". `-m` is a commit message.
517
-
518
- ## Allowlist staging (guardrails)
519
-
520
- - Prefer a tight allowlist for staging/commit (path prefixes).
521
- - If agentplane provides a suggestion command (e.g., `guard suggest-allow`), use it.
119
+ - MUST NOT load unrelated policy modules.
120
+ - MUST NOT use wildcard policy paths.
121
+ - MUST keep loaded policy set minimal (target: 2-4 files per task).
122
+ - If routing is ambiguous, ask one clarifying question before loading extra modules.
522
123
 
523
124
  ---
524
125
 
525
- # MODE-DEPENDENT WORKFLOWS
526
-
527
- Always follow `workflow_mode` from `.agentplane/config.json`.
528
-
529
- ## A) direct mode (single checkout)
530
-
531
- Rules:
532
-
533
- - Do all work in the current checkout.
534
- - In `direct` (single working directory), agentplane uses a single-stream workflow in the current checkout. `agentplane work start <task-id> --agent <ROLE> --slug <slug>` records the active task and keeps the current branch (no task branches).
535
- - Do not use worktrees in `direct`. `agentplane work start ... --worktree` is `branch_pr`-only.
536
- - Use `agentplane task scaffold <task-id>` only for backfill/import/manual repair; for normal updates use `agentplane task doc set` / `agentplane task plan set`.
126
+ ## MUST / MUST NOT
537
127
 
538
- Recommended cadence:
128
+ - MUST start with ORCHESTRATOR preflight and plan summary.
129
+ - MUST NOT perform mutating actions before explicit user approval.
130
+ - MUST create/reuse executable task IDs for any repo-state mutation.
131
+ - MUST use `agentplane` commands for task lifecycle updates; MUST NOT manually edit `.agentplane/tasks.json`.
132
+ - MUST run `agentplane task plan approve ...` and `agentplane task start-ready ...` sequentially (never in parallel).
133
+ - MUST keep repository artifacts in English by default (unless user explicitly requests another language for a specific artifact).
134
+ - MUST NOT fabricate repository facts.
135
+ - MUST stage/commit only intentional changes for the active task scope.
136
+ - MUST stop and request re-approval when scope, risk, or verification criteria materially drift.
539
137
 
540
- 1. Ensure task plan is approved (if required)
541
- 2. `start` task (status comment; no commit by default)
542
- 3. Implement changes
543
- 4. Run verify commands / `agentplane verify`
544
- 5. Commit via agentplane with tight allowlist
545
- 6. `finish` with `--commit <git-rev>` and a Verified body
546
- 7. `task export` (if required)
138
+ Role boundaries:
547
139
 
548
- ## B) branch_pr mode (parallel work)
140
+ - ORCHESTRATOR: preflight + plan + approvals.
141
+ - PLANNER: executable task graph creation/update.
142
+ - INTEGRATOR: base integration/finish in `branch_pr`.
549
143
 
550
- Rules:
551
-
552
- - Planning and closure occur only on the pinned base branch in the root checkout.
553
- - Implementation occurs only on per-task branch + worktree.
554
- - **Single-writer rule:** at any time, only one agent may write to a given task worktree; others contribute via `pr note` / review.
144
+ ---
555
145
 
556
- Commits:
146
+ ## CORE DOD
557
147
 
558
- - WIP commits are allowed in the task branch.
559
- - The base branch should receive a single squash commit per task (integration owned by INTEGRATOR).
148
+ A task is done only when all are true:
560
149
 
561
- Exports:
150
+ 1. Approved scope is satisfied; no unresolved drift.
151
+ 2. Required checks from loaded policy modules passed.
152
+ 3. Security and approval gates were respected.
153
+ 4. Traceability exists (task ID + updated task docs).
154
+ 5. Verification evidence is recorded.
155
+ 6. No unintended tracked changes remain.
562
156
 
563
- - Do not create/commit task exports from task branches.
157
+ Detailed DoD rules are in `.agentplane/policy/dod.core.md`, `.agentplane/policy/dod.code.md`, and `.agentplane/policy/dod.docs.md`.
564
158
 
565
159
  ---
566
160
 
567
- # INTEGRATION & CLOSURE (branch_pr)
161
+ ## SIZE BUDGET
568
162
 
569
- - Only INTEGRATOR merges into base and finishes tasks on base.
570
- - INTEGRATOR runs verify, updates required docs, finishes tasks, and runs exports.
163
+ - `AGENTS.md` MUST stay <= 250 lines.
164
+ - Every policy markdown module under `.agentplane/policy/*.md` MUST stay <= 100 lines.
165
+ - Worst-case loaded policy graph (always imports + all conditional imports) MUST stay <= 600 lines.
166
+ - Enforced by `node .agentplane/policy/check-routing.mjs`.
571
167
 
572
168
  ---
573
169
 
574
- # SHARED STATE & EXPORTS
170
+ ## CANONICAL DOCS
575
171
 
576
- - Task export is a read-only snapshot managed by agentplane.
577
- - Never edit exported snapshots by hand (checksum will break).
578
- - Exports must reflect finished tasks and verified state.
172
+ - DOC `.agentplane/policy/workflow.md`
173
+ - DOC `.agentplane/policy/workflow.direct.md`
174
+ - DOC `.agentplane/policy/workflow.branch_pr.md`
175
+ - DOC `.agentplane/policy/workflow.release.md`
176
+ - DOC `.agentplane/policy/workflow.upgrade.md`
177
+ - DOC `.agentplane/policy/security.must.md`
178
+ - DOC `.agentplane/policy/dod.core.md`
179
+ - DOC `.agentplane/policy/dod.code.md`
180
+ - DOC `.agentplane/policy/dod.docs.md`
181
+ - DOC `.agentplane/policy/governance.md`
182
+ - DOC `.agentplane/policy/incidents.md`
579
183
 
580
184
  ---
581
185
 
582
- # DRIFT POLICY (WHEN TO RE-APPROVE)
583
-
584
- Re-approval is required if any of the following becomes true:
585
-
586
- - Scope expands beyond the approved in-scope paths/artifacts.
587
- - New tasks are needed that were not in the approved task graph plan.
588
- - Any network or outside-repo access becomes necessary (and was not approved).
589
- - Verification criteria change materially.
590
- - Plan changes materially for an in-flight task (update plan -> plan approval returns to pending).
591
- - Guardrails require `--force` to proceed.
592
- - Verification fails and remediation would change scope or risk profile.
186
+ ## REFERENCE EXAMPLES
593
187
 
594
- When drift is detected: stop, summarize the drift, propose an updated plan, and ask for explicit approval.
188
+ - EXAMPLE `.agentplane/policy/examples/pr-note.md`
189
+ - EXAMPLE `.agentplane/policy/examples/unit-test-pattern.md`
190
+ - EXAMPLE `.agentplane/policy/examples/migration-note.md`
595
191
 
596
192
  ---
597
193
 
598
- # CONFIG CHANGES
194
+ ## CHANGE CONTROL
599
195
 
600
- - Do not modify `.agentplane/config.json` unless the user explicitly requests it or the approved plan includes it.
601
- - Any config changes must be captured in task docs (`## Notes` → `### Decisions` / `### Risks`) and verified.
196
+ - Follow incident-log, immutability, and policy-budget rules in `.agentplane/policy/governance.md`.
197
+ - Record situational incident rules only in `.agentplane/policy/incidents.md`.
198
+ - Keep `AGENTS.md` as a gateway; move detailed procedures to canonical modules.