Skip to content

Commit 050cbb1

Browse files
committed
Canonicalize ProjectInstructions branch lifecycle
1 parent edca0a2 commit 050cbb1

22 files changed

Lines changed: 7880 additions & 1401 deletions

docs_build/dev/BUILD_PR.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This `BUILD_PR.md`, `PLAN_PR.md`, and the user request are the source of truth f
1414
- Establish `docs_build/dev/ProjectInstructions/` as the only active source.
1515
- Mark all other ProjectInstructions-style sources changed by this PR as deprecated references.
1616
- Update active team start/governance docs to reference only `docs_build/dev/ProjectInstructions/`.
17-
- Add EOD main lock, next-day reset governance, and explicit START / WORK / END branch lifecycle rules.
17+
- Add EOD main lock, next-day reset governance, and canonical START / WORK / END branch lifecycle rules.
1818
- Add required reports under `docs_build/dev/reports/`.
1919

2020
## Exact Targets
@@ -46,7 +46,7 @@ Run:
4646

4747
```powershell
4848
rg -n 'project-instructions/addendums|docs_build/dev/PROJECT_INSTRUCTIONS.md.*source of truth|Codex must always read `docs_build/dev/PROJECT_INSTRUCTIONS.md`|Read `docs_build/dev/PROJECT_INSTRUCTIONS.md`' docs_build/dev/ProjectInstructions docs_build/dev/PROJECT_INSTRUCTIONS.md project-instructions
49-
rg -n "START RULE|WORK RULE|END RULE|HARD STOP before committing|Codex commits only to the PR branch|HEAD SHA recorded as new EOD baseline|End of Day:|Next Day Start:|HEAD.*published EOD SHA|only active Project Instructions source" docs_build/dev/ProjectInstructions
49+
rg -n "Branch Lifecycle \\(Canonical\\)|Every PR follows exactly three phases|^START$|^WORK$|^END$|Mandatory Hard Stops|tomorrow's official baseline|No commits on main|Never checkout main|Only after ALL four pass" docs_build/dev/ProjectInstructions
5050
git diff --name-only -- src assets toolbox games api serverside package.json package-lock.json docs_build/dev/start_of_day
5151
git diff --check
5252
```

docs_build/dev/PLAN_PR.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Make `docs_build/dev/ProjectInstructions/` the only active Project Instructions
1010
- Mark legacy ProjectInstructions-style sources as deprecated reference material.
1111
- Move active legacy addendums into `docs_build/dev/ProjectInstructions/addendums/`.
1212
- Update active team start and governance docs to reference only `docs_build/dev/ProjectInstructions/`.
13-
- Add EOD main lock, next-day reset, team PR branch creation gate, and explicit START / WORK / END branch lifecycle rules.
13+
- Add EOD main lock, next-day reset, team PR branch creation gate, and canonical START / WORK / END branch lifecycle rules.
1414
- Add required Codex reports under `docs_build/dev/reports/`.
1515

1616
## Out Of Scope
@@ -23,6 +23,6 @@ Make `docs_build/dev/ProjectInstructions/` the only active Project Instructions
2323
## Validation Plan
2424

2525
1. Run targeted grep/search proving no active duplicate ProjectInstructions source remains.
26-
2. Confirm EOD/Next Day and START / WORK / END branch lifecycle rules appear in active governance docs.
26+
2. Confirm EOD/Next Day and canonical START / WORK / END branch lifecycle rules appear in active governance docs.
2727
3. Confirm no product/runtime files changed.
2828
4. Run `git diff --check`.

docs_build/dev/ProjectInstructions/PROJECT_INSTRUCTIONS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Existing Project Instructions outside `docs_build/dev/ProjectInstructions/` rema
4949

5050
## Single Source and Main Lock Governance
5151

52-
`docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md` defines the single active Project Instructions source, EOD main lock, next-day reset, and team branch creation gate.
52+
`docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md` defines the single active Project Instructions source, canonical START / WORK / END branch lifecycle, EOD main lock, next-day reset, team branch creation gate, daily synchronization baseline, and mandatory hard stops.
5353

5454
## Merge Control
5555

docs_build/dev/ProjectInstructions/README.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ Team assignment workflow:
1313
Team assignments are tracked under team_assignments/. A team pulls work from BACKLOG_MASTER.md, marks the item building when assigned, and records the active assignment under the owning team. Teams work only on assigned items unless an OWNER override explicitly changes the assignment.
1414

1515
No direct commits to main:
16-
Do not commit directly to main unless the owner explicitly instructs that exception. Normal work must use PR branches, draft PRs, validation evidence, and owner-controlled merge approval.
16+
Do not commit directly to main. Normal work must use PR branches, draft PRs, validation evidence, and owner-controlled merge approval.
17+
18+
Branch lifecycle:
19+
Every PR follows exactly three phases: START, WORK, END. The canonical lifecycle is `docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
1720

1821
OWNER override rule:
1922
An OWNER override must use this wording:
@@ -40,6 +43,7 @@ READ THIS FIRST
4043
9. Follow OWNER governance decisions.
4144
10. When guidance conflicts, newest OWNER-approved guidance wins.
4245
11. Batch Governance Mode is the default for governance, documentation, and administrative work.
46+
12. Follow the canonical START / WORK / END lifecycle.
4347

4448
Addendum index:
4549
- Single Source and EOD Main Lock: docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md

docs_build/dev/ProjectInstructions/TEAM_START_COMMANDS.md

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,15 @@ No team creates a PR branch until all checks pass:
1111

1212
Use `docs_build/dev/ProjectInstructions/` as the only active Project Instructions source.
1313

14-
START RULE:
15-
- Every team starts on `main`.
16-
- `main` must be clean.
17-
- `main...origin/main` must be `0 0`.
18-
- `HEAD` SHA must match published EOD SHA.
19-
- Only then create or switch to the PR branch.
20-
- No commits are allowed on `main`.
21-
22-
WORK RULE:
23-
- Codex must remain on the PR branch during implementation.
24-
- Codex commits only to the PR branch.
25-
- Codex pushes only the PR branch.
26-
- HARD STOP if branch changes unexpectedly.
27-
- HARD STOP before committing if current branch is `main`.
28-
29-
END RULE:
30-
- After PR validation, push the PR branch.
31-
- Merge PR into `main` only when approved.
32-
- Checkout `main`.
33-
- Run `git fetch origin`.
34-
- Run `git pull --ff-only origin main`.
35-
- Confirm current branch is `main`.
36-
- Confirm worktree is clean.
37-
- Confirm `main...origin/main` is `0 0`.
38-
- Record `HEAD` SHA as new EOD baseline.
14+
Branch Lifecycle (Canonical):
15+
- Every PR follows exactly three phases: START, WORK, END.
16+
- Follow `docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
17+
- START begins on synchronized `main` and creates the PR branch only after all gates pass.
18+
- WORK remains on the PR branch. Never checkout `main`.
19+
- END merges, returns to synchronized `main`, publishes branch, HEAD SHA, and date/time, then stops all work.
20+
- No commits on `main`.
21+
- No implementation on `main`.
22+
- No validation on `main` except start validation.
3923

4024
## Start Team Alfa
4125

@@ -180,4 +164,6 @@ git pull --ff-only origin main
180164
git status
181165
git rev-list --left-right --count main...origin/main
182166
git rev-parse HEAD
167+
168+
Publish Branch, HEAD SHA, and Date/time. This becomes tomorrow's official baseline.
183169
```

docs_build/dev/ProjectInstructions/addendums/branch_context_governance.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ At the start of work, report or validate:
2121
- active PR number/name or explicit `PLAN_ONLY`
2222
- previous PR Closed status unless this is an explicitly documented stacked PR chain
2323

24+
Session start must follow the canonical START phase in `docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
25+
2426
## Stop Conditions
2527

2628
Stop and report before changing files when:
@@ -38,6 +40,8 @@ Stop and report before changing files when:
3840

3941
After a branch is created, the branch remains the working context.
4042

43+
This is the canonical WORK phase: remain on the PR branch, never checkout `main`, commit only on the PR branch, push only the PR branch, validate from the PR branch, and open/update the PR from the PR branch.
44+
4145
Do not automatically return to `main` after:
4246

4347
- commit
@@ -47,7 +51,7 @@ Do not automatically return to `main` after:
4751
- review updates
4852
- additional commits
4953

50-
Return to `main` only after the PR is merged, the branch is retired, or OWNER explicitly says to return to `main`.
54+
Return to `main` only in the canonical END phase after the PR is merged, the branch is retired, or OWNER explicitly says to return to `main`.
5155

5256
Returning to `main` is required before Closed can be recorded.
5357

@@ -58,6 +62,7 @@ Closed branch context requires:
5862
- local/origin sync is `0/0`
5963
- no untracked files
6064
- source branch disposition recorded as `retained`
65+
- branch, HEAD SHA, and date/time recorded as the new EOD baseline when this is EOD closeout
6166

6267
## GitHub Authority
6368

docs_build/dev/ProjectInstructions/addendums/branch_lock_governance.md

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Keep active work attached to the correct assigned team, branch, and OWNER decisi
2424
- Start from current `main`.
2525
- Pull latest `origin/main` before creating a work branch.
2626
- Do not create a PR branch unless current branch is `main`, worktree is clean, `main...origin/main` is `0 0`, and `HEAD` SHA matches the published EOD SHA.
27+
- Follow the canonical START / WORK / END lifecycle in `docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
2728
- Keep work on the active branch until the PR is merged, the branch is retired, or OWNER says to return to `main`.
2829
- Do not commit directly to `main`.
2930
- HARD STOP before committing if current branch is `main`.
@@ -34,34 +35,23 @@ Keep active work attached to the correct assigned team, branch, and OWNER decisi
3435
- Retain source branches by default after merge and closeout.
3536
- Record branch disposition before Closed as `retained`.
3637

37-
## START RULE
38+
## Branch Lifecycle (Canonical)
3839

39-
- Every team starts on `main`.
40-
- `main` must be clean.
41-
- `main...origin/main` must be `0 0`.
42-
- `HEAD` SHA must match published EOD SHA.
43-
- Only then create or switch to the PR branch.
44-
- No commits are allowed on `main`.
40+
Every PR follows exactly three phases:
4541

46-
## WORK RULE
42+
```text
43+
START
44+
WORK
45+
END
46+
```
4747

48-
- Codex must remain on the PR branch during implementation.
49-
- Codex commits only to the PR branch.
50-
- Codex pushes only the PR branch.
51-
- HARD STOP if branch changes unexpectedly.
52-
- HARD STOP before committing if current branch is `main`.
48+
The canonical lifecycle lives in `docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
5349

54-
## END RULE
55-
56-
- After PR validation, push the PR branch.
57-
- Merge PR into `main` only when approved.
58-
- Checkout `main`.
59-
- Run `git fetch origin`.
60-
- Run `git pull --ff-only origin main`.
61-
- Confirm current branch is `main`.
62-
- Confirm worktree is clean.
63-
- Confirm `main...origin/main` is `0 0`.
64-
- Record `HEAD` SHA as new EOD baseline.
50+
Branch lock governance enforces:
51+
- START on synchronized `main`.
52+
- WORK only on the PR branch.
53+
- END by merging, returning to synchronized `main`, publishing branch, HEAD SHA, and date/time, then stopping all work.
54+
- Mandatory hard stops before commits on `main`, dirty branch creation, non-`0 0` main sync, baseline SHA mismatch, unvalidated merge, or new PR work before synchronized main return.
6555

6656
## OWNER Override
6757

docs_build/dev/ProjectInstructions/addendums/codex_project_instructions_startup.md

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,25 @@ Codex must use this as the only active source of truth for:
2323

2424
## Branch Lifecycle Start Gate
2525

26-
START RULE:
27-
- Every team starts on `main`.
28-
- `main` must be clean.
29-
- `main...origin/main` must be `0 0`.
30-
- `HEAD` SHA must match published EOD SHA.
31-
- Only then create or switch to the PR branch.
32-
- No commits are allowed on `main`.
33-
34-
WORK RULE:
35-
- Codex must remain on the PR branch during implementation.
36-
- Codex commits only to the PR branch.
37-
- Codex pushes only the PR branch.
38-
- HARD STOP if branch changes unexpectedly.
39-
- HARD STOP before committing if current branch is `main`.
40-
41-
END RULE:
42-
- After PR validation, push the PR branch.
43-
- Merge PR into `main` only when approved.
44-
- Checkout `main`.
45-
- Run `git fetch origin`.
46-
- Run `git pull --ff-only origin main`.
47-
- Confirm current branch is `main`.
48-
- Confirm worktree is clean.
49-
- Confirm `main...origin/main` is `0 0`.
50-
- Record `HEAD` SHA as new EOD baseline.
26+
Every PR follows exactly three phases:
27+
28+
```text
29+
START
30+
WORK
31+
END
32+
```
33+
34+
Codex must follow the canonical lifecycle in:
35+
36+
`docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`
37+
38+
Startup enforcement:
39+
- START begins on synchronized `main`.
40+
- WORK remains on the PR branch. Never checkout `main`.
41+
- END merges, returns to synchronized `main`, publishes branch, HEAD SHA, and date/time, then stops all work.
42+
- STOP if current branch is `main` before commit.
43+
- STOP if attempting to push `main`.
44+
- STOP if a new PR starts before returning to synchronized `main`.
5145

5246
Deprecated Project Instructions material outside `docs_build/dev/ProjectInstructions/` is reference-only and must not override active governance.
5347

docs_build/dev/ProjectInstructions/addendums/multi_team.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Rules:
5151
- One Codex session may execute multiple sequential PRs.
5252
- Each PR must still have one clear purpose.
5353
- Each PR must create or use its own approved branch.
54+
- Each PR must follow the canonical START / WORK / END lifecycle in `docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`.
5455
- Each PR may be committed and pushed during active work.
5556
- Each PR may be opened as a draft PR during active work.
5657
- Do not commit directly to main.
@@ -69,13 +70,14 @@ During active work:
6970
- Pushes are allowed and expected.
7071
- Draft PRs are allowed and expected.
7172
- Direct commits to main are prohibited.
73+
- WORK remains on the PR branch; never checkout main during WORK.
7274
- Merges to main are prohibited unless explicitly approved by the owner.
7375

7476
At end of day:
7577
- Owner reviews ready PRs.
7678
- Owner explicitly approves which PRs merge.
7779
- Only owner-approved PRs may merge to main.
78-
- After merge, return to main and pull latest main.
80+
- After merge, execute the canonical END phase, return to synchronized main, and publish branch, HEAD SHA, and date/time.
7981
- Do not treat sequential PR completion as merge approval.
8082

8183
Commit/push during the day is allowed only on assigned team/OWNER/PR branches.

docs_build/dev/ProjectInstructions/addendums/pr_workflow.md

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,33 @@ Define the standard pull request workflow for Game Foundry Studio.
2626
15. Pull latest main before starting the next PR.
2727
16. Verify Main Verified and Closed gates.
2828

29-
## Branch Lifecycle Governance
30-
31-
### START RULE
32-
33-
- Every team starts on `main`.
34-
- `main` must be clean.
35-
- `main...origin/main` must be `0 0`.
36-
- `HEAD` SHA must match published EOD SHA.
37-
- Only then create or switch to the PR branch.
38-
- No commits are allowed on `main`.
39-
40-
### WORK RULE
41-
42-
- Codex must remain on the PR branch during implementation.
43-
- Codex commits only to the PR branch.
44-
- Codex pushes only the PR branch.
45-
- HARD STOP if branch changes unexpectedly.
46-
- HARD STOP before committing if current branch is `main`.
47-
48-
### END RULE
49-
50-
- After PR validation, push the PR branch.
51-
- Merge PR into `main` only when approved.
52-
- Checkout `main`.
53-
- Run `git fetch origin`.
54-
- Run `git pull --ff-only origin main`.
55-
- Confirm current branch is `main`.
56-
- Confirm worktree is clean.
57-
- Confirm `main...origin/main` is `0 0`.
58-
- Record `HEAD` SHA as new EOD baseline.
29+
## Branch Lifecycle (Canonical)
30+
31+
Every PR follows exactly three phases:
32+
33+
```text
34+
START
35+
WORK
36+
END
37+
```
38+
39+
The canonical START, WORK, END, Daily Synchronization, and Mandatory Hard Stops rules live in:
40+
41+
`docs_build/dev/ProjectInstructions/addendums/project_instructions_single_source_eod_lock.md`
42+
43+
PR workflow must follow that lifecycle exactly.
44+
45+
Summary:
46+
- START happens on synchronized `main` only and creates the PR branch only after all required gates pass.
47+
- WORK happens only on the PR branch.
48+
- END validates, commits, pushes, opens/updates the PR, merges, returns to synchronized `main`, publishes branch, HEAD SHA, and date/time, then stops all work.
49+
- No commits on `main`.
50+
- No implementation on `main`.
51+
- No validation on `main` except start validation.
52+
- Never checkout `main` during WORK.
53+
- STOP before commit if current branch is `main`.
54+
- STOP if current branch changes unexpectedly.
55+
- STOP if attempting to push `main`.
5956

6057
## PR Lifecycle States
6158

0 commit comments

Comments
 (0)