@tiic-tech/openworkflow 0.1.1 → 0.1.2

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 (213) hide show
  1. package/dist/adapters/codex/src/cleanCodexAdapter.js +4 -1
  2. package/dist/adapters/codex/src/cleanCodexAdapter.js.map +1 -1
  3. package/dist/adapters/codex/src/constants.d.ts +1 -0
  4. package/dist/adapters/codex/src/constants.js +2 -0
  5. package/dist/adapters/codex/src/constants.js.map +1 -0
  6. package/dist/adapters/codex/src/generateCommands.js +14 -9
  7. package/dist/adapters/codex/src/generateCommands.js.map +1 -1
  8. package/dist/adapters/codex/src/generateSkills.js +13 -0
  9. package/dist/adapters/codex/src/generateSkills.js.map +1 -1
  10. package/dist/adapters/codex/src/generatedFiles.js +1 -1
  11. package/dist/adapters/codex/src/manifest.js +11 -2
  12. package/dist/adapters/codex/src/manifest.js.map +1 -1
  13. package/dist/adapters/codex/src/templates.d.ts +0 -1
  14. package/dist/adapters/codex/src/templates.js +0 -1
  15. package/dist/adapters/codex/src/templates.js.map +1 -1
  16. package/dist/adapters/src/registry.d.ts +20 -0
  17. package/dist/adapters/src/registry.js +81 -0
  18. package/dist/adapters/src/registry.js.map +1 -0
  19. package/dist/cli/src/commands/brief.d.ts +46 -0
  20. package/dist/cli/src/commands/brief.js +294 -0
  21. package/dist/cli/src/commands/brief.js.map +1 -0
  22. package/dist/cli/src/commands/check.d.ts +42 -0
  23. package/dist/cli/src/commands/check.js +326 -0
  24. package/dist/cli/src/commands/check.js.map +1 -0
  25. package/dist/cli/src/commands/clean.js +46 -1
  26. package/dist/cli/src/commands/clean.js.map +1 -1
  27. package/dist/cli/src/commands/context.d.ts +1 -0
  28. package/dist/cli/src/commands/context.js +471 -0
  29. package/dist/cli/src/commands/context.js.map +1 -0
  30. package/dist/cli/src/commands/doctor.js +122 -12
  31. package/dist/cli/src/commands/doctor.js.map +1 -1
  32. package/dist/cli/src/commands/draft.d.ts +1 -0
  33. package/dist/cli/src/commands/draft.js +175 -0
  34. package/dist/cli/src/commands/draft.js.map +1 -0
  35. package/dist/cli/src/commands/gitAutomation.d.ts +1 -0
  36. package/dist/cli/src/commands/gitAutomation.js +378 -0
  37. package/dist/cli/src/commands/gitAutomation.js.map +1 -0
  38. package/dist/cli/src/commands/handoff.d.ts +22 -0
  39. package/dist/cli/src/commands/handoff.js +122 -0
  40. package/dist/cli/src/commands/handoff.js.map +1 -0
  41. package/dist/cli/src/commands/init.js +52 -1
  42. package/dist/cli/src/commands/init.js.map +1 -1
  43. package/dist/cli/src/commands/inspect.d.ts +23 -0
  44. package/dist/cli/src/commands/inspect.js +157 -0
  45. package/dist/cli/src/commands/inspect.js.map +1 -0
  46. package/dist/cli/src/commands/register.d.ts +1 -0
  47. package/dist/cli/src/commands/register.js +251 -0
  48. package/dist/cli/src/commands/register.js.map +1 -0
  49. package/dist/cli/src/commands/resume.d.ts +59 -0
  50. package/dist/cli/src/commands/resume.js +280 -0
  51. package/dist/cli/src/commands/resume.js.map +1 -0
  52. package/dist/cli/src/commands/shared.js +6 -2
  53. package/dist/cli/src/commands/shared.js.map +1 -1
  54. package/dist/cli/src/commands/summaries.d.ts +1 -0
  55. package/dist/cli/src/commands/summaries.js +77 -0
  56. package/dist/cli/src/commands/summaries.js.map +1 -0
  57. package/dist/cli/src/commands/summarize.d.ts +1 -0
  58. package/dist/cli/src/commands/summarize.js +316 -0
  59. package/dist/cli/src/commands/summarize.js.map +1 -0
  60. package/dist/cli/src/commands/sync.js +135 -12
  61. package/dist/cli/src/commands/sync.js.map +1 -1
  62. package/dist/cli/src/commands/validate.js +25 -1
  63. package/dist/cli/src/commands/validate.js.map +1 -1
  64. package/dist/cli/src/dev/verifyAgentE2E.d.ts +2 -0
  65. package/dist/cli/src/dev/verifyAgentE2E.js +391 -0
  66. package/dist/cli/src/dev/verifyAgentE2E.js.map +1 -0
  67. package/dist/cli/src/dev/verifyCleanCommand.js +213 -2
  68. package/dist/cli/src/dev/verifyCleanCommand.js.map +1 -1
  69. package/dist/cli/src/dev/verifyRuntimeSurface.js +4940 -54
  70. package/dist/cli/src/dev/verifyRuntimeSurface.js.map +1 -1
  71. package/dist/cli/src/dev/verifyWorkflowE2E.js +477 -45
  72. package/dist/cli/src/dev/verifyWorkflowE2E.js.map +1 -1
  73. package/dist/cli/src/index.js +184 -6
  74. package/dist/cli/src/index.js.map +1 -1
  75. package/dist/cli/src/report.d.ts +26 -0
  76. package/dist/cli/src/report.js +17 -0
  77. package/dist/cli/src/report.js.map +1 -0
  78. package/dist/core/src/artifacts/readiness.d.ts +7 -0
  79. package/dist/core/src/artifacts/readiness.js +240 -0
  80. package/dist/core/src/artifacts/readiness.js.map +1 -0
  81. package/dist/core/src/artifacts/registry.d.ts +9 -2
  82. package/dist/core/src/artifacts/registry.js +687 -60
  83. package/dist/core/src/artifacts/registry.js.map +1 -1
  84. package/dist/core/src/commands/registry.js +1425 -146
  85. package/dist/core/src/commands/registry.js.map +1 -1
  86. package/dist/core/src/contracts/index.d.ts +1 -1
  87. package/dist/core/src/fs/index.d.ts +24 -0
  88. package/dist/core/src/fs/index.js +48 -1
  89. package/dist/core/src/fs/index.js.map +1 -1
  90. package/dist/core/src/git/autonomousSimulator.d.ts +46 -0
  91. package/dist/core/src/git/autonomousSimulator.js +163 -0
  92. package/dist/core/src/git/autonomousSimulator.js.map +1 -0
  93. package/dist/core/src/git/branchIdentity.d.ts +19 -0
  94. package/dist/core/src/git/branchIdentity.js +75 -0
  95. package/dist/core/src/git/branchIdentity.js.map +1 -0
  96. package/dist/core/src/git/draftPrPilot.d.ts +47 -0
  97. package/dist/core/src/git/draftPrPilot.js +196 -0
  98. package/dist/core/src/git/draftPrPilot.js.map +1 -0
  99. package/dist/core/src/git/localEvidenceReader.d.ts +21 -0
  100. package/dist/core/src/git/localEvidenceReader.js +142 -0
  101. package/dist/core/src/git/localEvidenceReader.js.map +1 -0
  102. package/dist/core/src/git/localGitAutomation.d.ts +68 -0
  103. package/dist/core/src/git/localGitAutomation.js +470 -0
  104. package/dist/core/src/git/localGitAutomation.js.map +1 -0
  105. package/dist/core/src/git/mergeReadinessCheckpoint.d.ts +31 -0
  106. package/dist/core/src/git/mergeReadinessCheckpoint.js +110 -0
  107. package/dist/core/src/git/mergeReadinessCheckpoint.js.map +1 -0
  108. package/dist/core/src/git/prReadySummary.d.ts +16 -0
  109. package/dist/core/src/git/prReadySummary.js +144 -0
  110. package/dist/core/src/git/prReadySummary.js.map +1 -0
  111. package/dist/core/src/git/remoteReadonlyPlanner.d.ts +60 -0
  112. package/dist/core/src/git/remoteReadonlyPlanner.js +223 -0
  113. package/dist/core/src/git/remoteReadonlyPlanner.js.map +1 -0
  114. package/dist/core/src/onboarding/agentsGuide.d.ts +32 -0
  115. package/dist/core/src/onboarding/agentsGuide.js +164 -0
  116. package/dist/core/src/onboarding/agentsGuide.js.map +1 -0
  117. package/dist/core/src/validators/validateOpenWorkflow.js +1331 -15
  118. package/dist/core/src/validators/validateOpenWorkflow.js.map +1 -1
  119. package/dist/core/src/validators/validateRepositoryContracts.js +2321 -306
  120. package/dist/core/src/validators/validateRepositoryContracts.js.map +1 -1
  121. package/dist/core/src/workflow/cleanOpenWorkflow.d.ts +2 -0
  122. package/dist/core/src/workflow/cleanOpenWorkflow.js +97 -8
  123. package/dist/core/src/workflow/cleanOpenWorkflow.js.map +1 -1
  124. package/dist/core/src/workflow/doctorOpenWorkflow.d.ts +7 -0
  125. package/dist/core/src/workflow/doctorOpenWorkflow.js +26 -0
  126. package/dist/core/src/workflow/doctorOpenWorkflow.js.map +1 -0
  127. package/dist/core/src/workflow/initOpenWorkflow.d.ts +7 -0
  128. package/dist/core/src/workflow/initOpenWorkflow.js +96 -8
  129. package/dist/core/src/workflow/initOpenWorkflow.js.map +1 -1
  130. package/dist/core/src/workflow/planningQueueResume.d.ts +105 -0
  131. package/dist/core/src/workflow/planningQueueResume.js +596 -0
  132. package/dist/core/src/workflow/planningQueueResume.js.map +1 -0
  133. package/dist/core/src/workflow/readWorkflowConfig.d.ts +6 -0
  134. package/dist/core/src/workflow/readWorkflowConfig.js +28 -0
  135. package/dist/core/src/workflow/readWorkflowConfig.js.map +1 -0
  136. package/dist/core/src/workflow/summaryHealth.d.ts +60 -0
  137. package/dist/core/src/workflow/summaryHealth.js +713 -0
  138. package/dist/core/src/workflow/summaryHealth.js.map +1 -0
  139. package/dist/core/src/workflow/syncOpenWorkflow.d.ts +22 -0
  140. package/dist/core/src/workflow/syncOpenWorkflow.js +235 -0
  141. package/dist/core/src/workflow/syncOpenWorkflow.js.map +1 -0
  142. package/package.json +2 -1
  143. package/references/artifact-authoring-templates.md +14 -12
  144. package/references/artifact-instruction-envelope.md +133 -0
  145. package/references/coder-continuous-growth-loop.md +68 -0
  146. package/references/gh-operation-governance.md +114 -0
  147. package/references/git-automation-governance.md +324 -0
  148. package/references/git-version-control-governance.md +227 -0
  149. package/references/internal-coder-protocol.md +202 -0
  150. package/references/issue-governance.md +115 -0
  151. package/references/planning-artifact-contracts.md +595 -0
  152. package/references/planning-skill-runtime-exposure.md +159 -0
  153. package/references/proto-redesign-artifact-contracts.md +217 -0
  154. package/references/proto2html-artifact-contracts.md +113 -0
  155. package/references/skill-system-lifecycle.md +198 -0
  156. package/references/validation-trust-domains.md +286 -0
  157. package/references/workflow-blueprint-runtime-alignment.md +287 -0
  158. package/schemas/atom-tasks.schema.json +101 -0
  159. package/schemas/candidate-changes.schema.json +323 -0
  160. package/schemas/current-state.schema.json +113 -0
  161. package/schemas/html-prototype.schema.json +288 -0
  162. package/schemas/openworkflow-contract.schema.json +9 -1
  163. package/schemas/proto-prompt-pack.schema.json +1333 -0
  164. package/schemas/prototype-evidence.schema.json +684 -142
  165. package/schemas/selected-change.schema.json +104 -0
  166. package/schemas/validation-target.schema.json +187 -1
  167. package/schemas/validation.schema.json +187 -1
  168. package/schemas/vision-session.schema.json +151 -0
  169. package/skills/analyze-changes/SKILL.md +92 -0
  170. package/skills/analyze-changes/agents/openai.yaml +4 -0
  171. package/skills/analyze-changes/references/analysis-protocol.md +116 -0
  172. package/skills/build-proto-prompt/SKILL.md +125 -0
  173. package/skills/build-proto-prompt/references/output-boundary.md +54 -0
  174. package/skills/build-proto-prompt/references/prompt-pack-compiler-protocol.md +80 -0
  175. package/skills/build-prototype/SKILL.md +162 -38
  176. package/skills/build-prototype/agents/openai.yaml +2 -2
  177. package/skills/build-prototype/references/philosophy-engine.md +61 -0
  178. package/skills/build-prototype/references/strategic-prompt-pack-protocol.md +365 -0
  179. package/skills/build-prototype/references/vision2prompt/01_input_contract.md +84 -0
  180. package/skills/build-prototype/references/vision2prompt/02_vision_decomposition.md +108 -0
  181. package/skills/build-prototype/references/vision2prompt/03_strategy_hypothesis_generation.md +89 -0
  182. package/skills/build-prototype/references/vision2prompt/04_product_system_extraction.md +78 -0
  183. package/skills/build-prototype/references/vision2prompt/05_prototype_prompt_schema.md +189 -0
  184. package/skills/build-prototype/references/vision2prompt/06_output_templates.md +125 -0
  185. package/skills/build-prototype/references/vision2prompt/07_quality_rubric.md +171 -0
  186. package/skills/build-validation/SKILL.md +136 -54
  187. package/skills/build-validation/references/prototype-validation-target-rubric.md +35 -0
  188. package/skills/build-validation/references/return-to-vision-gate.md +32 -0
  189. package/skills/build-vision/SKILL.md +192 -0
  190. package/skills/build-vision/references/proto-readiness-rubric.md +48 -0
  191. package/skills/build-vision/references/vision-interview-protocol.md +48 -0
  192. package/skills/coder/SKILL.md +204 -0
  193. package/skills/decompose-to-changes/SKILL.md +176 -0
  194. package/skills/decompose-to-changes/agents/openai.yaml +4 -0
  195. package/skills/decompose-to-changes/references/decomposition-protocol.md +278 -0
  196. package/skills/prompt2proto/SKILL.md +157 -0
  197. package/skills/prompt2proto/agents/openai.yaml +4 -0
  198. package/skills/prompt2proto/references/00_role_philosophy_engine.md +96 -0
  199. package/skills/prompt2proto/references/01_input_contract.md +53 -0
  200. package/skills/prompt2proto/references/02_prompt_pack_readiness.md +50 -0
  201. package/skills/prompt2proto/references/03_visual_translation_workflow.md +64 -0
  202. package/skills/prompt2proto/references/04_output_contract.md +67 -0
  203. package/skills/prompt2proto/references/05_quality_rubric.md +46 -0
  204. package/skills/proto2html/SKILL.md +136 -0
  205. package/skills/proto2html/agents/openai.yaml +4 -0
  206. package/skills/proto2html/references/proto2html-protocol.md +115 -0
  207. package/skills/run-team/SKILL.md +4 -0
  208. package/skills/select-change/SKILL.md +200 -0
  209. package/skills/select-change/agents/openai.yaml +4 -0
  210. package/skills/select-change/references/selection-protocol.md +281 -0
  211. package/skills/tune-prototype/SKILL.md +121 -0
  212. package/skills/tune-prototype/agents/openai.yaml +4 -0
  213. package/skills/tune-prototype/references/refined-prompt-pack-protocol.md +161 -0
@@ -0,0 +1,114 @@
1
+ # Gh Operation Governance
2
+
3
+ This reference classifies `gh` and GitHub operations for OpenWorkflow dogfood
4
+ work. It is a governance contract, not an implementation plan.
5
+
6
+ ## Preconditions
7
+
8
+ Any gh-dependent workflow requires:
9
+
10
+ - explicit user authorization
11
+ - a configured `gh` CLI or GitHub connector
12
+ - a known repository remote
13
+ - clear source-of-truth mode for Issues and PRs
14
+ - local audit evidence for remote-impacting operations
15
+
16
+ If these preconditions are missing, OW should use local planning artifacts and
17
+ avoid remote mutation.
18
+
19
+ ## Operation Tiers
20
+
21
+ ### Local-Only Git Automation
22
+
23
+ Local-only git automation is not a gh operation. It is governed by
24
+ `references/git-version-control-governance.md` and may cover local branch
25
+ creation or checkout, local selected-change commits, and local
26
+ `PR_READY_SUMMARY.md` generation after preview and validation.
27
+
28
+ Local-only automation must not push, create remote PRs, edit Issues, mutate
29
+ labels, or merge. The moment an operation reaches a remote or authenticated
30
+ GitHub target, it enters one of the gh tiers below.
31
+
32
+ ### Read-Only
33
+
34
+ Read-only operations inspect remote state and do not mutate GitHub.
35
+
36
+ Examples:
37
+
38
+ - list or view issues
39
+ - list or view PRs
40
+ - inspect labels, milestones, assignees, or review state
41
+ - read CI/check status
42
+ - resolve issue or PR URLs for local linkage
43
+
44
+ Read-only operations may be used for analysis when the user has authorized gh
45
+ access or explicitly provided the remote data.
46
+
47
+ ### Evidence-Writing
48
+
49
+ Evidence-writing operations add audit breadcrumbs but do not change the core
50
+ truth of an Issue or PR.
51
+
52
+ Examples:
53
+
54
+ - add a comment linking an Issue to a plan id or PR
55
+ - add a non-destructive label that marks decomposition state
56
+ - update a draft PR body with OW-generated summary text
57
+
58
+ These operations require explicit user approval for the specific action. A CLI
59
+ boolean such as `--allow-draft-pr` is never approval by itself; write-mode draft
60
+ PR pilots must also name explicit local approval evidence with
61
+ `--approval-evidence`. The local OW artifact remains the audit record and should
62
+ capture the remote URL, timestamp, operation kind, and summary of the mutation.
63
+
64
+ ### High-Risk Mutation
65
+
66
+ High-risk mutations change remote state in ways that can affect collaboration,
67
+ delivery, or user trust.
68
+
69
+ Examples:
70
+
71
+ - create or close an Issue
72
+ - edit an Issue body
73
+ - close or reopen a PR
74
+ - create a PR
75
+ - push a branch
76
+ - merge a PR
77
+ - force-push
78
+ - remove labels, milestones, or assignments used by humans
79
+
80
+ These operations require a `HIGH_RISK_DECISION_REPORT.md` until OW has an
81
+ approved remote operation model. Approval must name the concrete action and
82
+ guardrails.
83
+
84
+ Merge-readiness conflict probes are not merge approval. A read-only checkpoint
85
+ may name conflict files and required evidence, but conflict resolution requires
86
+ an isolated worktree, explicit operation-level approval, validation reruns, and
87
+ local audit evidence before any later merge operation.
88
+
89
+ ## Audit Requirements
90
+
91
+ For any evidence-writing or high-risk mutation, record locally:
92
+
93
+ - remote target URL or number
94
+ - operation type
95
+ - user approval source
96
+ - local plan id and candidate id
97
+ - branch name when relevant
98
+ - base branch when relevant
99
+ - body or checkpoint digest when relevant
100
+ - commit hash when relevant
101
+ - timestamp
102
+ - result or remote URL after mutation
103
+ - rollback guidance
104
+
105
+ Do not rely on remote comments alone as the OW audit record.
106
+
107
+ ## Relationship To Issues And PRs
108
+
109
+ GitHub Issues may be the source of truth for issue bodies and comments when the
110
+ user configures GitHub mode. OW local artifacts should store linkage and audit
111
+ metadata, not duplicate issue bodies as authoritative text.
112
+
113
+ PR-ready summaries are local handoff artifacts. Opening or updating a remote PR
114
+ is a separate gh operation and must follow the tiers above.
@@ -0,0 +1,324 @@
1
+ # Git Automation Governance
2
+
3
+ ## Purpose
4
+
5
+ OpenWorkflow git automation has two policy modes:
6
+
7
+ - `managed`: OW may automate local branch, local commit, and local PR-ready
8
+ summary actions while asking for approval at remote-impacting boundaries.
9
+ - `autonomous`: OW may eventually run the full git lifecycle without stepwise
10
+ approval, but only after a separate high-risk candidate defines exact
11
+ operations, evidence, rollback, and safety limits.
12
+
13
+ G015 implements the managed command shell. It does not implement autonomous
14
+ push, PR creation, PR merge, or GitHub Issue mutation.
15
+
16
+ ## Managed Mode
17
+
18
+ Managed mode can:
19
+
20
+ - create or check out the local feat branch recorded in
21
+ `queue_policy.branch_boundary`
22
+ - create local selected-change commits when validation evidence exists
23
+ - create local follow-up evidence commits
24
+ - generate local `PR_READY_SUMMARY.md`
25
+ - recommend when remote PR or merge review is appropriate
26
+
27
+ Managed mode must gate:
28
+
29
+ - `git push`
30
+ - `gh pr create`, `gh pr edit`, and `gh pr merge`
31
+ - `gh issue create`, `gh issue edit`, and `gh issue close`
32
+ - destructive operations such as reset, rebase, force-push, or branch deletion
33
+
34
+ When a user approves a remote operation, the agent must be able to reconstruct
35
+ the correct operation sequence from local evidence even when a branch contains
36
+ hundreds or thousands of local commits. Managed mode should prepare a remote
37
+ operation plan before execution:
38
+
39
+ 1. confirm clean working tree and current validation evidence
40
+ 2. identify the feat branch and target base
41
+ 3. list ordered local commits from the approved base to HEAD, or fall back to
42
+ commit evidence recorded in `CANDIDATE_CHANGES.yaml`
43
+ 4. push the feat branch to the approved remote branch
44
+ 5. create or update the PR using the local `PR_READY_SUMMARY.md`
45
+ 6. wait for checks and resolve conflicts against the target base
46
+ 7. merge only after user approval and repository protection checks pass
47
+ 8. record remote URL, PR id, merge commit, and rollback guidance
48
+
49
+ ## Autonomous Mode
50
+
51
+ Autonomous mode is a future high-risk capability. Before implementation, OW
52
+ must define:
53
+
54
+ - explicit configuration that enables autonomous mode
55
+ - exact allowed git and gh operations
56
+ - evidence required before and after every operation
57
+ - rollback or recovery guidance for each mutation class
58
+ - repository protection checks and branch constraints
59
+ - refusal behavior for unclean state, unknown remote state, and failed
60
+ validation
61
+
62
+ G016 defines the contract for this mode. It does not make autonomous remote
63
+ mutation executable.
64
+
65
+ ### Enablement Contract
66
+
67
+ Autonomous mode must be enabled by an explicit local configuration. It must not
68
+ be inferred from conversation wording or from the existence of a candidate
69
+ queue.
70
+
71
+ Minimum configuration shape:
72
+
73
+ ```yaml
74
+ git_automation:
75
+ mode: managed # managed | autonomous
76
+ autonomous:
77
+ enabled: false
78
+ target_remote: origin
79
+ target_base: main
80
+ allowed_operations:
81
+ local_branch: true
82
+ local_commit: true
83
+ push: false
84
+ draft_pr: false
85
+ ready_pr: false
86
+ merge: false
87
+ issue_mutation: false
88
+ required_validation:
89
+ - npm run validate
90
+ evidence_dir: changes/<plan_id>/git-automation/
91
+ conflict_policy: stop
92
+ rollback_policy: record_recovery_plan
93
+ ```
94
+
95
+ The only default-safe autonomous operations are local branch, local commit, and
96
+ local summary generation. Push, PR creation or update, merge, and Issue
97
+ mutation must each be explicitly allowed by configuration and supported by the
98
+ current operation contract.
99
+
100
+ ### Operation Matrix
101
+
102
+ | Operation | Default | Required gate | Evidence |
103
+ | --- | --- | --- | --- |
104
+ | Local branch create or checkout | allowed | branch boundary and clean tree | before branch, after branch, command preview |
105
+ | Local selected-change commit | allowed | validation evidence and allowed paths | dirty paths, commit message, commit hash |
106
+ | Local PR-ready summary | allowed | queue exists | output path and validation summary |
107
+ | Push feat branch | denied | autonomous push enabled, clean tree, target remote and base known | before ref, after ref, ordered commits |
108
+ | Draft PR create or update | denied | push completed, PR summary exists | PR URL, payload digest, branch and base |
109
+ | Ready PR create or update | denied | validation current, blockers absent | PR URL, validation, review notes |
110
+ | Merge PR | denied | checks pass, protection satisfied or waiver recorded | merge method, merge commit, rollback path |
111
+ | Issue mutation | denied | separate Issue operation policy | target issue, payload digest, before and after state |
112
+ | Reset, rebase, force-push, destructive branch deletion | denied | separate high-risk report only | exact command and recovery plan |
113
+
114
+ ### Autonomous Run Record
115
+
116
+ Every autonomous run must produce an operation record before and after mutation.
117
+ The preflight record must be written before any remote action and include:
118
+
119
+ - operation id
120
+ - requested mode and allowed operation set
121
+ - plan id, candidate ids, and source queue
122
+ - current branch, branch boundary, target remote, and target base
123
+ - local HEAD and target base ref
124
+ - ordered local commits from base to HEAD
125
+ - dirty paths and rejected paths
126
+ - validation commands and status
127
+ - PR-ready summary path and digest when relevant
128
+ - remote state snapshot when available
129
+ - planned commands or API calls
130
+ - refusal criteria evaluated
131
+
132
+ The completion record must include:
133
+
134
+ - commands or API calls that actually ran
135
+ - before and after refs
136
+ - pushed branch or remote ref
137
+ - PR URL and id when created or updated
138
+ - merge method and merge commit when merged
139
+ - conflict-resolution notes when conflicts were encountered
140
+ - rollback or recovery instructions
141
+ - validation status after operation
142
+ - final status: `completed`, `refused`, `failed`, or `needs_human`
143
+
144
+ ### Merge Readiness
145
+
146
+ Autonomous merge is not allowed unless all configured gates pass:
147
+
148
+ - local validation is current
149
+ - remote checks are passing or explicitly waived
150
+ - PR branch is up to date with target base or the conflict policy has handled it
151
+ - PR-ready summary is current after the last local commit
152
+ - no candidate in the queue is blocked unless explicitly excluded from the PR
153
+ - high-risk reports are resolved or intentionally deferred
154
+ - repository protection is satisfied or the waiver is recorded
155
+
156
+ When any gate is unknown, autonomous mode must stop with status `needs_human`.
157
+
158
+ ### Conflict Policy
159
+
160
+ The default conflict policy is `stop`. Autonomous conflict resolution can only
161
+ run when a later high-risk candidate defines exact file classes, resolution
162
+ rules, validation requirements, and rollback behavior.
163
+
164
+ Allowed conflict policies:
165
+
166
+ - `stop`: stop and emit conflict evidence.
167
+ - `manual_resolution_required`: prepare instructions and wait for human or
168
+ agent-directed resolution.
169
+ - `policy_driven_resolution`: future high-risk mode only.
170
+
171
+ ### Rollback And Recovery
172
+
173
+ Rollback guidance must be recorded before any remote mutation. The recovery path
174
+ depends on operation class:
175
+
176
+ - Push: name the previous remote ref and recovery command or PR-based revert
177
+ strategy.
178
+ - PR create or update: record PR URL, previous body digest when available, and
179
+ close or edit-back guidance.
180
+ - Merge: record merge commit, revert command or follow-up revert PR plan, and
181
+ affected target branch.
182
+ - Issue mutation: record before state, after state, target issue URL, and edit
183
+ recovery guidance.
184
+
185
+ Rollback must not rely on force-push by default.
186
+
187
+ ### Implementation Path
188
+
189
+ The safe implementation path is:
190
+
191
+ 1. Design-only autonomous contract.
192
+ 2. Read-only autonomous simulator that produces full plans and evidence without
193
+ remote mutation.
194
+ 3. Remote read-only PR-ready planning that inspects remote state and produces
195
+ an executable operation plan without mutation.
196
+ 4. Narrow autonomous pilot for one remote operation class, starting with draft
197
+ PR creation or update.
198
+ 5. Branch push, ready-for-review transition, merge, and Issue mutation only as
199
+ later high-risk candidates.
200
+ 6. Full autonomous lifecycle only after the simulator and pilots prove evidence,
201
+ conflict, and rollback behavior.
202
+
203
+ ### Approved Narrow Pilot Sequence
204
+
205
+ G018 approves the staged B -> C path:
206
+
207
+ - **B: remote read-only plus PR-ready remote plan.** The next implementation
208
+ candidate is G019. It may read remote refs and PR metadata, compare them to
209
+ local evidence, and write a local plan. It must not push, create or edit PRs,
210
+ merge, or mutate Issues.
211
+ - **C: draft PR remote mutation pilot.** The follow-up candidate is G020. It is
212
+ limited to draft PR creation or managed-section update after G019 proves the
213
+ evidence model. It must still deny merge, ready-for-review transition, Issue
214
+ mutation, force-push, reset, rebase, and destructive branch deletion.
215
+
216
+ The recommended first mutation class is draft PR creation or update because the
217
+ result is reviewable and reversible by closing or editing the PR. It remains a
218
+ remote mutation and therefore requires explicit configuration, current simulator
219
+ evidence, target identity checks, payload preview, before/after evidence, and a
220
+ rollback plan.
221
+
222
+ ## Evidence
223
+
224
+ Every git operation should record enough evidence to reconstruct what happened:
225
+
226
+ - operation id or command invocation
227
+ - plan id and candidate id when applicable
228
+ - current branch and branch boundary
229
+ - dirty paths included or rejected
230
+ - command preview
231
+ - validation evidence
232
+ - before and after commit or ref state when applicable
233
+ - ordered local commits for remote push, PR, and merge planning
234
+ - output artifact path when generated
235
+ - refusal reason when blocked
236
+
237
+ Remote operations require separate operation-level approval until autonomous
238
+ mode is explicitly designed and accepted.
239
+
240
+ ## Read-Only Autonomous Simulator
241
+
242
+ The simulator is the required bridge between design-only autonomous contracts
243
+ and any autonomous remote pilot. It must be impossible for simulator mode to
244
+ push, create or update PRs, merge, mutate Issues, resolve conflicts, or change
245
+ refs.
246
+
247
+ Simulator input:
248
+
249
+ - source `CANDIDATE_CHANGES.yaml`
250
+ - target base or base ref
251
+ - target remote when remote metadata is available
252
+ - optional `PR_READY_SUMMARY.md` path
253
+
254
+ Simulator output:
255
+
256
+ - clean-tree and branch-boundary status
257
+ - ordered local commits from base to HEAD
258
+ - commit evidence from the queue
259
+ - validation evidence discovered in the queue
260
+ - PR-ready summary status
261
+ - remote branch and base metadata when readable
262
+ - simulated push, PR, checks, merge, and rollback plan
263
+ - blockers that must be resolved before any autonomous pilot
264
+
265
+ The simulator is successful only when it can produce a complete plan without
266
+ missing branch, commit, validation, PR-summary, or rollback evidence. Unknown
267
+ remote metadata is a warning when local evidence is otherwise complete; stale
268
+ or conflicting remote metadata is a blocker for later execution candidates.
269
+
270
+ ## Remote Read-Only PR-Ready Plan
271
+
272
+ `openworkflow git-automation remote-plan` is the approved B step after the
273
+ simulator. It reads remote state and emits a local JSON plan. It must not push,
274
+ create PRs, edit PRs, close PRs, merge, mutate Issues, or alter refs.
275
+
276
+ Remote-plan input:
277
+
278
+ - source `CANDIDATE_CHANGES.yaml`
279
+ - target remote
280
+ - target base
281
+ - optional target branch
282
+ - optional base ref for ordered local commits
283
+ - optional `PR_READY_SUMMARY.md` path
284
+
285
+ Remote-plan output:
286
+
287
+ - target identity: remote URL, target branch, target base, current branch, and
288
+ queue branch boundary
289
+ - local state: local HEAD, dirty paths, ordered local commits, queue commit
290
+ evidence, validation evidence, and PR-ready summary status
291
+ - remote state: target branch head and base head when readable
292
+ - optional PR metadata from `gh pr list` when available
293
+ - blockers, warnings, read-only operation plan, and rollback guidance
294
+
295
+ Remote-plan is successful only when the target remote and base are readable,
296
+ the working tree is clean, the branch boundary matches, validation evidence is
297
+ present, and `PR_READY_SUMMARY.md` exists. Missing branch head is a warning
298
+ because a later approved push or draft PR pilot may create it; missing base head
299
+ is a blocker.
300
+
301
+ ## Draft PR Pilot
302
+
303
+ `openworkflow git-automation draft-pr` is the approved C pilot after remote
304
+ read-only planning. It is disabled by default: without `--write` it only emits a
305
+ payload preview, and with `--write` it still refuses unless `--allow-draft-pr`
306
+ is present.
307
+
308
+ Draft-pr input:
309
+
310
+ - the same target identity inputs as `remote-plan`
311
+ - `PR_READY_SUMMARY.md` as the managed PR body source
312
+ - optional PR title
313
+ - explicit `--write --allow-draft-pr` for mutation
314
+
315
+ Draft-pr guarantees:
316
+
317
+ - dry-run returns `mutation_performed: false`
318
+ - mutation is limited to `gh pr create --draft` or a managed draft PR body edit
319
+ - remote branch and target base must already be readable
320
+ - the PR body is wrapped in an OpenWorkflow managed section and digest
321
+ - rollback guidance is included before mutation
322
+
323
+ Draft-pr must not push, merge, mark ready for review, mutate Issues, force-push,
324
+ reset, rebase, or destructively delete branches.
@@ -0,0 +1,227 @@
1
+ # Git Version Control Governance
2
+
3
+ This reference defines OpenWorkflow's git governance hierarchy for dogfood
4
+ development. It is a planning and audit contract, not an automation mandate.
5
+
6
+ ## Hierarchy
7
+
8
+ Use these boundaries when planning and implementing work:
9
+
10
+ - Atom task: an implementation checklist item inside one selected change.
11
+ - Selected change: one commit-sized implementation unit.
12
+ - `CANDIDATE_CHANGES.yaml`: one feature-sized planning queue.
13
+ - Feat branch: the git branch that owns one candidate queue.
14
+ - Pull request: the integration review boundary for one feat branch.
15
+ - Merge or release: the boundary where accepted PR work enters the target line.
16
+
17
+ An Issue is an intent, problem, request, bug, or external tracking source. It
18
+ can decompose into one or more candidate queues, and one candidate queue can
19
+ reference one or more Issues. An Issue is not automatically a selected change.
20
+ Use `references/issue-governance.md` for local and GitHub-backed
21
+ source-of-truth rules.
22
+
23
+ ## Commit Boundary
24
+
25
+ A selected candidate should normally complete as one coherent git commit. The
26
+ commit should include:
27
+
28
+ - selection artifacts under `changes/<plan_id>/<candidate-id>-<slug>/`
29
+ - source, reference, or fixture edits owned by the selected candidate
30
+ - queue status and completion evidence for that selected candidate
31
+ - validation evidence in the queue or selected change artifact
32
+
33
+ Commit messages should include the plan id and candidate id when practical:
34
+
35
+ ```text
36
+ M71/G001 Formalize git governance hierarchy
37
+ ```
38
+
39
+ If a candidate is discovered to be too broad for one commit, split or supersede
40
+ it in the owning queue before implementation continues.
41
+
42
+ ## Feat Branch Boundary
43
+
44
+ Each new `CANDIDATE_CHANGES.yaml` queue should have an owning branch. The branch
45
+ name should be stable and scoped to the feat, for example:
46
+
47
+ ```text
48
+ codex/m71-git-version-governance
49
+ ```
50
+
51
+ The queue should record the branch in `queue_policy.branch_boundary` when the
52
+ queue opts into branch governance. Work for selected candidates should happen on
53
+ that branch unless the user explicitly approves an exception.
54
+
55
+ For new branch-governed queues, the branch boundary should carry the same
56
+ feat identity as the queue plan id, normally the leading milestone token such
57
+ as `M114` in both `M114-engineering-quality-foundation` and
58
+ `codex/m114-engineering-quality-foundation`. A branch boundary that names
59
+ another plan id is not feat ownership even when it equals the current branch.
60
+ If a queue must temporarily continue on an older branch, record an explicit
61
+ `queue_policy.branch_identity_exception` with:
62
+
63
+ - `mode: temporary_continuation_branch`
64
+ - `approved: true`
65
+ - `allowed_operations` limited to the specific local operations being allowed
66
+ - `reason` explaining why the exception is temporary
67
+
68
+ Queue maintenance can happen before strict branch validation exists, but the
69
+ maintenance operation should record the current branch and reason when it
70
+ touches a branch-governed queue from a different branch.
71
+
72
+ New branch-governed queues should opt into
73
+ `queue_policy.git_lifecycle_gate: strict`. In strict lifecycle mode, the queue
74
+ must record a plan-owned `queue_policy.branch_boundary` before selected work is
75
+ treated as ready. When the whole queue is marked `completed` or `done`, it must
76
+ also record PR/publication evidence such as `DRAFT_PR_OPERATION_EVIDENCE.yaml`,
77
+ or remain explicitly blocked/deferred before PR creation. This keeps the branch
78
+ and PR boundary visible to low-context Agents instead of relying on chat
79
+ memory.
80
+
81
+ ## Pull Request Boundary
82
+
83
+ A pull request should normally represent one feat branch, not one atom task.
84
+ Use `changes/<plan_id>/PR_READY_SUMMARY.md` to prepare the branch for review
85
+ before any remote PR operation. The PR-ready summary should explain:
86
+
87
+ - the owning candidate queue
88
+ - completed selected changes and commit evidence
89
+ - deferred, blocked, superseded, or high-risk candidates
90
+ - validation commands and results
91
+ - unresolved risks or follow-up queues
92
+
93
+ Opening, editing, or merging PRs is not implied by either the planning contract
94
+ or `PR_READY_SUMMARY.md`. Those remote operations are governed by
95
+ `references/gh-operation-governance.md`.
96
+
97
+ ## Issue Boundary
98
+
99
+ Issues sit before decomposition in the governance hierarchy:
100
+
101
+ ```text
102
+ Issue -> CANDIDATE_CHANGES -> selected change -> commit -> branch -> PR
103
+ ```
104
+
105
+ The arrow is not one-to-one. A single Issue can lead to multiple feat queues,
106
+ and a single feat queue can aggregate several related Issues.
107
+
108
+ When local issue artifacts are the source of truth, they are git-tracked
109
+ planning artifacts. When GitHub Issues are the source of truth, local OW
110
+ artifacts should record linkage such as issue URLs, plan ids, candidate ids,
111
+ commit hashes, branch names, and PR refs.
112
+
113
+ ## Non-Destructive Git Policy
114
+
115
+ OW skills may inspect git state as part of planning, selection, and audit.
116
+ Examples include:
117
+
118
+ - current branch
119
+ - dirty working tree
120
+ - recent commit hashes
121
+ - tracked and untracked paths
122
+
123
+ Skills must not perform destructive git operations unless the user explicitly
124
+ requests that specific operation. Destructive or remote-impacting operations
125
+ include:
126
+
127
+ - reset, checkout, restore, clean, or rebase actions that discard work
128
+ - branch deletion
129
+ - forced push
130
+ - push to a remote branch
131
+ - PR creation, update, merge, or close
132
+ - GitHub Issue creation, body edit, closure, or destructive label changes
133
+
134
+ Local commits may be created when the user has authorized the dogfood workflow
135
+ that treats each selected change as a commit. Remote mutation requires separate
136
+ authorization and should be governed by a high-risk decision report until OW has
137
+ an approved gh operation model. See `references/gh-operation-governance.md` for
138
+ read-only, evidence-writing, and high-risk mutation tiers.
139
+
140
+ ## Approved Local Automation Boundary
141
+
142
+ The M71 high-risk decision approved a narrowed local automation path. A future
143
+ `ow:git-automation` command may automate local git actions only inside these
144
+ boundaries:
145
+
146
+ - create or check out the local feat branch recorded in
147
+ `queue_policy.branch_boundary`
148
+ - commit one completed selected change as at least one local commit
149
+ - generate a local `PR_READY_SUMMARY.md` for a fully implemented and validated
150
+ candidate queue
151
+
152
+ Every local mutation mode must support preview or dry-run output before it
153
+ changes the repository. The preview should show:
154
+
155
+ - target plan id and candidate id when applicable
156
+ - current branch and expected branch boundary
157
+ - dirty paths that would be included or rejected
158
+ - exact commit message or summary path when applicable
159
+ - validation evidence required before mutation
160
+
161
+ The command must refuse local mutation when:
162
+
163
+ - the working tree contains unrelated dirty paths
164
+ - the current branch conflicts with the queue's branch boundary
165
+ - the queue branch boundary names another plan id and no explicit temporary
166
+ continuation exception allows the local operation
167
+ - the selected change is not complete
168
+ - required validation evidence is missing
169
+ - the operation would require push, remote PR creation, Issue mutation, or merge
170
+
171
+ Selected changes must not finish without a local commit. A selected change may
172
+ produce multiple local commits when traceability requires a follow-up evidence
173
+ commit. Do not amend solely to force a commit to contain its own hash. Treat the
174
+ latest local HEAD produced for the selected change as the relationship anchor,
175
+ and record the primary implementation commit hash when a follow-up evidence
176
+ commit is used.
177
+
178
+ The preferred local completion path is:
179
+
180
+ ```text
181
+ openworkflow git-automation commit --root . --queue changes/<plan_id>/CANDIDATE_CHANGES.yaml --candidate <id> --message "<plan-id> <candidate-id> ..." --validation-evidence "<commands>" --commit-evidence --json
182
+ ```
183
+
184
+ When `--commit-evidence` is used, the selected change should record
185
+ `LOCAL_COMMIT_EVIDENCE.yaml` under its own selected-change folder and the queue
186
+ completion should reference that repo-relative path. A checkpoint commit that
187
+ batches multiple completed selected changes is not valid per-candidate evidence.
188
+
189
+ Remote operations are outside the approved local boundary. Push, remote PR
190
+ creation or update, Issue mutation, and merge require explicit operation-level
191
+ approval and must follow `references/gh-operation-governance.md`.
192
+
193
+ ## Merge Readiness And Conflict Checkpoints
194
+
195
+ Remote readiness may compute a structured merge checkpoint with read-only git
196
+ commands such as `git merge-base`, `git merge-base --is-ancestor`, and
197
+ `git merge-tree --write-tree`. This checkpoint may report target base, target
198
+ branch, merge base, fast-forward state, conflict files, required validations,
199
+ and stop reasons.
200
+
201
+ The checkpoint is not permission to merge and must not run `git merge`, modify
202
+ the user's working tree, auto-resolve conflicts, rebase, reset, force-push, or
203
+ mark a PR ready. If conflicts are reported, future work must use an isolated
204
+ worktree, explicit operation-level user approval, conflict-resolution evidence,
205
+ validation reruns, and local audit evidence before any later approved merge.
206
+
207
+ ## Evidence
208
+
209
+ When a selected change completes, the owning queue should record enough
210
+ evidence to audit the work later:
211
+
212
+ - selected change id
213
+ - completion timestamp
214
+ - changed paths or artifact paths
215
+ - validation commands
216
+ - commit hash when available
217
+
218
+ New strict branch-governed queues should also record whether implementation
219
+ files changed:
220
+
221
+ - `implementation_changed_files: true` requires repo-relative
222
+ `LOCAL_COMMIT_EVIDENCE.yaml` in completion evidence.
223
+ - `implementation_changed_files: false` requires `commit_not_required_reason`.
224
+
225
+ Older queues may not contain all fields. They remain migration-mode artifacts
226
+ until touched or intentionally opted into
227
+ `queue_policy.selected_change_commit_gate: strict`.