Skip to content

Commit cb38e52

Browse files
author
Delta Team
committed
Resolve #148 against current main
2 parents 57548d3 + f45bf92 commit cb38e52

21 files changed

Lines changed: 1076 additions & 51 deletions

docs_build/dev/PROJECT_INSTRUCTIONS.md

Lines changed: 103 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ You are working in a docs-first repo workflow.
55
Workflow:
66
PLAN_PR → BUILD_PR → APPLY_PR
77

8+
PR lifecycle gate:
9+
PR Open → Plan → Build → Validation → Approved → Merged → Main Verified → Closed
10+
11+
The PLAN_PR → BUILD_PR → APPLY_PR workflow remains preserved. PR Open is the first lifecycle status for active work, Plan happens after PR Open on the same PR branch, and Closed is the final repository-state gate.
12+
813
# WORKFLOW & EXECUTION
914

1015
## PR NAMING STANDARD
@@ -44,6 +49,66 @@ Rules:
4449
- Existing PC/LAPTOP, desktop/laptop, workspace, environment, or machine-parity examples are historical only
4550
- Future PR reports, recovery reports, validation reports, and manual validation notes must include TEAM ownership
4651

52+
## PR LIFECYCLE STATE GATE
53+
54+
Required state order:
55+
56+
1. PR Open
57+
2. Plan
58+
3. Build
59+
4. Validation
60+
5. Approved
61+
6. Merged
62+
7. Main Verified
63+
8. Closed
64+
65+
Definitions:
66+
- PR Open is the first active lifecycle state.
67+
- PR Open means the tracked PR identity and source branch have been created and named before Plan begins.
68+
- Plan happens after PR Open on the same PR branch.
69+
- Build, validation, reports, ZIP packaging, and closeout stay tied to that same PR identity and source branch.
70+
- No BUILD_PR may proceed without a PR name and active branch/PR identity unless it is explicitly marked `PLAN_ONLY`.
71+
- Build means scoped implementation, audit, report, validation, governance, or cleanup work is in progress for that PR identity.
72+
- Validation means requested checks, required report creation, manual validation notes, and ZIP packaging are being completed.
73+
- Approved means the owner or required reviewer has approved the PR outcome for merge.
74+
- Merged means the PR has merged and changes have been pushed.
75+
- Main Verified means Codex is back on `main`, `main` includes the merge commit or recorded final commit, the worktree is clean, local/origin sync is `0/0`, and no untracked files remain.
76+
- Closed means every Closed gate below is PASS.
77+
78+
Closed is valid only when all are PASS:
79+
- PR merged and changes pushed.
80+
- Current branch is `main`.
81+
- `main` includes the merge commit or recorded final commit.
82+
- Worktree clean.
83+
- Local/origin sync is `0/0`.
84+
- No untracked files.
85+
- Branch disposition recorded as `retained`.
86+
- Required reports exist.
87+
- Required repo-structured ZIP under `tmp/` exists.
88+
- Backlog updated.
89+
- Tool state updated when applicable.
90+
91+
Hard stop:
92+
- A team must not begin another PR if its previous PR is not Closed.
93+
- Exception is allowed only for explicitly documented stacked PR chains.
94+
95+
Required final closeout output:
96+
97+
```text
98+
FINAL REPOSITORY STATE:
99+
- Branch
100+
- Worktree
101+
- Local/origin sync
102+
- PR number/name
103+
- PR status
104+
- Merge/final commit
105+
- Branch disposition
106+
- Backlog update status
107+
- Tool state update status
108+
- ZIP path
109+
- Closeout PASS/FAIL
110+
```
111+
47112
## CHATGPT EXECUTION ROLE
48113

49114
ChatGPT no longer creates PLAN_PR, BUILD_PR, APPLY_PR docs, ZIP bundles, or implementation code.
@@ -784,12 +849,13 @@ The full samples smoke test rule remains separate and runs only when broadly imp
784849

785850
## CODEX REVIEW DIFF REQUIREMENT
786851

787-
Every Codex PR must produce review artifacts so ChatGPT can review the exact code changes.
852+
Every completed Codex PR or completed Codex run must produce review artifacts so ChatGPT can review the exact repo changes or the no-change evidence.
788853

789854
Codex must create:
790855

791856
- `docs_build/dev/reports/codex_review.diff`
792857
- `docs_build/dev/reports/codex_changed_files.txt`
858+
- a PR-specific or EOD-specific report under `docs_build/dev/reports/`
793859

794860
`codex_review.diff` must contain:
795861
- `git diff --cached`
@@ -804,6 +870,9 @@ Rules:
804870
- Do not pause commits
805871
- Do not add dependencies
806872
- Do not change runtime behavior just to create review artifacts
873+
- Required reports remain required even when a ZIP is created.
874+
- Required report evidence must include branch validation PASS/FAIL, a requirement-by-requirement PASS/FAIL checklist, a validation lane report, and manual validation notes.
875+
- A ZIP artifact must not replace or move required report files out of `docs_build/dev/reports/`.
807876

808877
When user asks for code review, they should upload:
809878
- PR delta ZIP
@@ -812,7 +881,7 @@ When user asks for code review, they should upload:
812881

813882
## MANUAL TEST REQUIREMENT
814883

815-
Every PR must include:
884+
Every completed PR, audit, report-only, validation-only, or EOD closeout run must include:
816885
- exact manual validation steps
817886
- expected outcome
818887
- any known out-of-scope checks
@@ -870,8 +939,15 @@ Codex ZIPs must:
870939
- be repo-structured
871940
- preserve exact repo-relative paths
872941
- be placed under `<project folder>/tmp/`
873-
- use the PR name in the ZIP filename
942+
- use the PR or EOD run name in the ZIP filename
874943
- contain no extra files outside the defined structure
944+
- include all changed or preserved repo files from the completed run
945+
- not include or depend on generated loose files under `tmp/`
946+
- not replace required report files under `docs_build/dev/reports/`
947+
948+
If a completed run changes no repo files, Codex must still create a ZIP containing the PR or EOD report that proves no repo files changed.
949+
950+
The no-change ZIP rule does not apply when the run hard-stopped before producing outputs.
875951

876952
Before Codex returns any ZIP, Codex must:
877953
1. Physically create the ZIP file.
@@ -1584,11 +1660,21 @@ Required reports:
15841660

15851661
## REQUIRED ZIP OUTPUT
15861662

1587-
Codex must ALWAYS produce a repo-structured ZIP for every PR.
1663+
Codex must ALWAYS produce a repo-structured ZIP for every completed Codex run.
1664+
1665+
This applies to:
1666+
- implementation PRs
1667+
- audit PRs
1668+
- report-only PRs
1669+
- validation-only PRs
1670+
- EOD closeout runs
1671+
- governance and cleanup runs
15881672

15891673
The ZIP must follow the existing CODEX ZIP STANDARD.
15901674

1591-
The ZIP is required output, not optional.
1675+
The ZIP must include all changed or preserved repo files from the run.
1676+
1677+
The ZIP is required output, not optional, and it does not replace required reports under `docs_build/dev/reports/`.
15921678

15931679
## HTML FILE RESTRICTIONS
15941680

@@ -1641,6 +1727,8 @@ Before packaging any PR, Codex must:
16411727

16421728
Codex must not package partially completed PRs.
16431729

1730+
PR completion is not the same as Closed. Closed requires the final repository-state gate from `PR LIFECYCLE STATE GATE`.
1731+
16441732
## ERROR HANDLING CONTRACT
16451733

16461734
- No silent fallback.
@@ -1823,10 +1911,12 @@ Do NOT require:
18231911

18241912
## CODEX ZIP RETURN CONTRACT
18251913

1826-
Codex must include the repo-structured ZIP in returned artifacts for user and ChatGPT review.
1914+
Codex must include the repo-structured ZIP path in returned artifacts for user and ChatGPT review for every completed run.
18271915

18281916
The ZIP must still follow the CODEX ZIP STANDARD.
18291917

1918+
If no repo files changed, the returned ZIP must contain the PR or EOD report proving the no-change result unless the run hard-stopped before outputs were produced.
1919+
18301920
## CODE REVIEW EVIDENCE RULE
18311921

18321922
ChatGPT must not claim code review was completed unless it inspected uploaded source, ZIP contents, or `codex_review.diff`.
@@ -2044,6 +2134,7 @@ Required steps:
20442134
- local/origin sync = 0 0
20452135
5. Record final main commit.
20462136
6. Report final repository state.
2137+
7. Produce the required repo-structured ZIP under `tmp/` containing the EOD report and any changed or preserved repo files from the closeout.
20472138

20482139
Required final state:
20492140

@@ -2082,7 +2173,7 @@ Each reviewed item must be classified as one of:
20822173
- Historical/Archive
20832174

20842175
Rules:
2085-
- Merged branches should be deleted after successful merge and main sync.
2176+
- Merged source branches should be retained by default after successful merge and main sync.
20862177
- Superseded draft PRs should be closed.
20872178
- Abandoned branches should be documented before removal.
20882179
- Active workstream branches remain.
@@ -2108,7 +2199,7 @@ Required PI closeout report fields:
21082199
- active PRs
21092200
- active branches
21102201
- closed/superseded PRs
2111-
- deleted branch candidates
2202+
- retained branch disposition and any owner-approved deletion candidates
21122203
- deferred work
21132204
- next PI priorities
21142205

@@ -2131,8 +2222,7 @@ Audit targets:
21312222
Recommendation-only first pass values:
21322223
- keep
21332224
- close
2134-
- delete local
2135-
- delete remote
2225+
- retained
21362226
- defer
21372227

21382228
Rules:
@@ -2235,6 +2325,9 @@ Completion hard stops:
22352325
- If required reports are missing, HARD STOP.
22362326
- If `docs_build/dev/reports/codex_review.diff` is missing, HARD STOP.
22372327
- If `docs_build/dev/reports/codex_changed_files.txt` is missing, HARD STOP.
2328+
- If branch validation PASS/FAIL is missing, HARD STOP.
2329+
- If the requirement-by-requirement PASS/FAIL checklist is missing, HARD STOP.
2330+
- If the validation lane report is missing, HARD STOP.
22382331
- If manual validation notes are missing, HARD STOP.
22392332
- If the PR-specific report is missing, HARD STOP.
22402333
- If an instruction compliance checklist is required and missing, HARD STOP.

docs_build/dev/ProjectInstructions/addendums/branch_context_governance.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ At the start of work, report or validate:
1818
- worktree status
1919
- active team
2020
- active assignment
21+
- active PR number/name or explicit `PLAN_ONLY`
22+
- previous PR Closed status unless this is an explicitly documented stacked PR chain
2123

2224
## Stop Conditions
2325

@@ -28,6 +30,8 @@ Stop and report before changing files when:
2830
- worktree has unrelated changes
2931
- active assignment is missing or unclear
3032
- active team does not match the branch or OWNER instruction
33+
- BUILD_PR work has no PR name and active branch/PR identity, unless explicitly marked `PLAN_ONLY`
34+
- the team's previous PR is not Closed and no stacked PR chain is documented
3135
- the requested work would modify files outside the approved scope
3236

3337
## Continuation Rule
@@ -45,6 +49,16 @@ Do not automatically return to `main` after:
4549

4650
Return to `main` only after the PR is merged, the branch is retired, or OWNER explicitly says to return to `main`.
4751

52+
Returning to `main` is required before Closed can be recorded.
53+
54+
Closed branch context requires:
55+
- current branch is `main`
56+
- `main` includes the merge commit or recorded final commit
57+
- worktree clean
58+
- local/origin sync is `0/0`
59+
- no untracked files
60+
- source branch disposition recorded as `retained`
61+
4862
## GitHub Authority
4963

5064
GitHub is authoritative for open PR state, merged PR state, review state, and remote branch state.

docs_build/dev/ProjectInstructions/addendums/branch_lock_governance.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Keep active work attached to the correct assigned team, branch, and OWNER decisi
1313
- An assigned work item keeps its owner of record until complete or OWNER reassignment.
1414
- Work must not move to another team, branch, or PR without OWNER approval.
1515
- A team with no active assignment, active branch, or active PR is inactive.
16+
- A team with a previous PR that is not Closed must not begin another PR unless OWNER documented an explicit stacked PR chain.
17+
- PR Open begins only after the branch and PR identity are named.
18+
- Plan, Build, validation, reports, ZIP packaging, and closeout stay tied to the same PR identity and source branch.
19+
- Closed ends only after the final main-return, clean-worktree, local/origin `0/0`, no-untracked-files, required-report, required-ZIP, backlog, applicable tool-state, and branch-disposition gates pass.
1620
- Project Instructions must not assume a permanent team roster.
1721

1822
## Branch Rules
@@ -22,6 +26,8 @@ Keep active work attached to the correct assigned team, branch, and OWNER decisi
2226
- Keep work on the active branch until the PR is merged, the branch is retired, or OWNER says to return to `main`.
2327
- Do not commit directly to `main` unless OWNER explicitly approves.
2428
- Do not merge stale historical branches directly unless they are current, clean, still needed, and OWNER-approved.
29+
- Retain source branches by default after merge and closeout.
30+
- Record branch disposition before Closed as `retained`.
2531

2632
## OWNER Override
2733

docs_build/dev/ProjectInstructions/addendums/multi_team.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ Required gate:
121121
- blocked PRs with blockers
122122
- next review queue
123123
- final branch/worktree/local-origin sync
124+
- repo-structured ZIP path under `tmp/`
125+
- final repository state block
124126

125127
OWNER_049 lesson:
126128
- PRs #129, #132, and #134 were merge-approved and still required merge execution.
@@ -148,6 +150,9 @@ Required steps:
148150
- local/origin sync = 0 0
149151
5. Record final main commit.
150152
6. Report final repository state.
153+
7. Produce a repo-structured ZIP under `tmp/` that includes the EOD report and all changed or preserved repo files from the closeout.
154+
8. Record source branch disposition as `retained`.
155+
9. Mark the PR Closed only when every Closed gate passes.
151156

152157
Required final state:
153158

@@ -165,9 +170,31 @@ Rules:
165170
- A workstream is not considered closed until the repository is returned to main.
166171
- A PI is not considered complete until main is current and synchronized.
167172
- Do not leave Codex on a feature, team, workstream, recovery, governance, or owner branch after successful merge.
173+
- Plan, Build, validation, reports, ZIP packaging, and closeout stay tied to the same PR identity and source branch.
174+
- Source branches are retained by default after merge and closeout.
175+
- A PR is not Closed until the PR merged, changes are pushed, the repository is on `main`, `main` includes the merge or final commit, the worktree is clean, local/origin sync is `0/0`, no untracked files exist, branch disposition is recorded as `retained`, required reports exist, the required repo-structured ZIP exists under `tmp/`, backlog is updated, and tool state is updated when applicable.
176+
- A completed EOD closeout must produce the required ZIP even when the closeout changed no repo files; in that case, the ZIP must contain the EOD report proving the no-change result.
177+
- The EOD ZIP does not replace the EOD report or other required reports under `docs_build/dev/reports/`.
168178
- If merge succeeds but repository is not returned to main:
169179
closeout status = FAIL.
170180

181+
Required final closeout output:
182+
183+
```text
184+
FINAL REPOSITORY STATE:
185+
- Branch
186+
- Worktree
187+
- Local/origin sync
188+
- PR number/name
189+
- PR status
190+
- Merge/final commit
191+
- Branch disposition
192+
- Backlog update status
193+
- Tool state update status
194+
- ZIP path
195+
- Closeout PASS/FAIL
196+
```
197+
171198
## Workstream Hygiene Governance
172199

173200
At workstream closeout, Codex must review repository collaboration state before reporting the workstream closed.
@@ -186,7 +213,7 @@ Each reviewed item must be classified as one of:
186213
- Historical/Archive
187214

188215
Rules:
189-
- Merged branches should be deleted after successful merge and main sync.
216+
- Merged source branches should be retained by default after successful merge and main sync.
190217
- Superseded draft PRs should be closed.
191218
- Abandoned branches should be documented before removal.
192219
- Active workstream branches remain.
@@ -212,7 +239,7 @@ Required PI closeout report fields:
212239
- active PRs
213240
- active branches
214241
- closed/superseded PRs
215-
- deleted branch candidates
242+
- retained branch disposition and any owner-approved deletion candidates
216243
- deferred work
217244
- next PI priorities
218245

@@ -235,8 +262,7 @@ Audit targets:
235262
Recommendation-only first pass values:
236263
- keep
237264
- close
238-
- delete local
239-
- delete remote
265+
- retained
240266
- defer
241267

242268
Rules:

0 commit comments

Comments
 (0)