Skip to content

docs(cc-251): brief-authoring discipline for multi-file dispatches + close cc-250#145

Merged
screenleon merged 2 commits into
mainfrom
cc-251-brief-discipline
May 23, 2026
Merged

docs(cc-251): brief-authoring discipline for multi-file dispatches + close cc-250#145
screenleon merged 2 commits into
mainfrom
cc-251-brief-discipline

Conversation

@screenleon
Copy link
Copy Markdown
Owner

Summary

v0.3.0 M1 prerequisite #2 (sister to CC-250). Documents 3 brief-authoring patterns derived from the CC-247/248 (#142) and CC-250 (#144) dispatch hang retros. No code change — discipline lands in agents/project-pm.md + docs/dispatch-brief.md + memory [[feedback_codex_brief_discipline]].

Also tail-closes CC-250 (status flip 🔵→✅, pr:TBDpr:#144, body Outcome) — the closure pattern PR #144's brief explicitly deferred.

3 patterns (trigger: brief touches > 4 files OR embeds > 50 lines verbatim)

# Pattern What Why
1 apply_patch retry-cap Constraint text: "HALT after 2nd consecutive verification failure on same file; no 3rd retry" Codex has no internal retry-cap → debug loop runs until dispatch timeout (1800s)
2 Verbatim-as-attached-file Write blocks > 50 lines to /tmp/<task>-content/*.md; brief references path + says "copy verbatim, do NOT paraphrase" Eliminates hallucinate-when-retyping (CC-250 stderr observed pass/fail print-formatprint-format — "pass/fail" silently dropped)
3 expected_head_sha state pin 40-char sha in brief metadata + git rev-parse HEAD == <sha> self_verify Catches "wrong branch / branch advanced / file changed under me" before any patch is attempted

For briefs > 8 files OR > 200 lines verbatim, also split the dispatch into 2–3 smaller ones. Discipline first, split second.

Files

Path Change
agents/project-pm.md +7 lines — "Multi-file brief discipline" prose in "Writing a brief for codex-executor" section
docs/dispatch-brief.md +8 lines — expected_head_sha as Optional section with usage example
BACKLOG.md +35/-3 — CC-251 row + body; CC-250 status flip + Outcome / See blocks
MILESTONES.md +2/-1 — M1 prerequisite sub-table flips CC-250 ⏳→✅(#144), adds CC-251 ⏳

Memory feedback_codex_brief_discipline.md (separate repo, already committed) holds the retro evidence with CC-247/248 + CC-250 stderr excerpts.

Verification

  • bash pm/scripts/validate.sh BACKLOG.md — parity 30 (CC-228 baseline)
  • bash scripts/check-docs-freshness.sh — 0 blocking, 2 WARN (CC-249 pr:TBD spike-pending, CC-251 pr:TBD this PR — both expected)
  • /pr-gate expressFinal: GO, critic + qa-tester pass; one [low] critic finding (50-line vs 30-line threshold inconsistency) fixed in tail commit aa96696
  • CI shellcheck — N/A (no shell file changed)

Long-term resolution

These 3 patterns are operator discipline; the structural fix:

  • CC-235 (tiered-lifecycle-gate) enforces split mechanically by task size
  • CC-244 (typed spike→brief→handover schema) turns verbatim into schema fields with automatic validation
  • CC-215 (pmctl) may add --expect-head <sha> wrapper flag for pattern 3 enforcement

Out of scope

  • pmctl --expect-head wrapper — defer to CC-215
  • Auto-split heuristic — defer to CC-235

🤖 Generated with Claude Code

screenleon and others added 2 commits May 23, 2026 23:13
…close cc-250

CC-251 — 3 patterns added to prevent codex apply_patch debug-loop hang
on > 4 files OR > 50 lines verbatim briefs:

1. **apply_patch retry-cap** (constraint text): HALT after 2nd
   consecutive verification failure on the same file; no 3rd retry.
   Codex has no internal retry-cap → without this, debug loop runs
   until dispatch timeout (1800s).

2. **Verbatim-as-attached-file** (pattern): write embedded content
   (override-policy paragraphs, BACKLOG rows, brief-template fragments)
   to /tmp/<task>-content/*.md BEFORE dispatch; brief references path
   + says "copy verbatim, do NOT paraphrase". Eliminates the
   hallucinate-when-retyping failure mode (CC-250 stderr observed
   `pass/fail print-format` → `print-format` — "pass/fail" dropped).

3. **`expected_head_sha` state pin** (schema field): 40-char sha in
   brief metadata + `git rev-parse HEAD == <sha>` self_verify check.
   Catches "wrong branch / branch advanced / file changed by another
   process" before any patch is attempted.

Documented in:
- `agents/project-pm.md` — "Multi-file brief discipline" prose added to
  the "Writing a brief for codex-executor" section
- `docs/dispatch-brief.md` — `expected_head_sha` as Optional section
  with usage example
- Memory `[[feedback_codex_brief_discipline]]` (separate repo) — retro
  evidence from CC-247/248 #142 + CC-250 #144 dispatch hangs

For briefs touching > 8 files OR > 200 lines verbatim, ALSO split the
dispatch into 2–3 smaller ones (each 2–4 files); split alone without
the 3 patterns above doesn't fully prevent the hang.

Also closes **CC-250** as a tail-cleanup (status flip + `pr:TBD` →
`pr:#144` + body Outcome / See blocks; mirrors the pattern PR #144
brief explicitly deferred to a follow-up commit). MILESTONES.md M1
prerequisite sub-table flips CC-250 ⏳ → ✅ (#144) and adds CC-251 ⏳.

Long-term resolution: CC-235 (tiered-lifecycle-gate) enforces split
mechanically; CC-244 (typed pipeline) turns verbatim into schema
fields; CC-215 (pmctl) may add `--expect-head <sha>` wrapper flag.

Validator parity preserved at 30 (CC-228 baseline). No code change;
discipline is brief-authoring time, not runtime.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR-gate critic [low]: intro states `> 50 lines` trigger but bullet 2
said `> 30 lines`. Standardize to 50 across both. Matches the memory
copy at feedback_codex_brief_discipline.md (also updated 30→50).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@screenleon screenleon merged commit f40213b into main May 23, 2026
30 of 32 checks passed
@screenleon screenleon deleted the cc-251-brief-discipline branch May 23, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant