Item 7: delegation brief template and check carry the rebuild's lessons (six advice flags). done 7 / next 8 (recipes and verifier entry)

This commit is contained in:
swaits committed 2026-11-23 12:30:53 -07:00
1 parent 1b57d00e60
commit d63b0f9c49
3 files changed
+129 -6

No files matched your search

+57
View File
@@ -37,15 +37,21 @@ def template():
"",
"## Acceptance",
"[How the result will be judged: the check that decides accepted or rejected.]",
"[Every size, speed or brevity requirement is a number with the command that measures it.]",
"[If the worker writes data for another module to read, name that reader and require one end-to-end test that shows the reader's behaviour changes.]",
"[If you ask for a classifier, matcher or heuristic and a labelled set, the labels come from a different worker, or a held-out part is written first.]",
"",
"## Deliverables and report format",
"[What to send back, and in what shape: a short report, what changed, the check run.]",
"[For numbered items: a commit after each, with a one-line \"done / next\" note in the message.]",
"",
"## Files you may change",
"[The files or folders the worker may change; everything else is read-only.]",
"",
"## Verification",
"[The check the worker must run before reporting, and what output to include.]",
"[For an approval gate, trust check or validation step, list the abuse cases the tests must cover: omit the field that triggers the gate, forge the field that marks trust, make the failing-before step fail for an unrelated reason.]",
"[New test modules are run about 30 times, with copies in parallel, before the report.]",
"",
"## Budget and escalation",
"[Time or cost budget; when to stop and escalate instead of guessing.]",
@@ -114,3 +120,54 @@ def missing_required(text):
found = sections(text)
return [title for key, title, _n, _r in PARTS
if key in _REQUIRED and (key not in found or not _filled(found[key]))]
# ---------------------------------------------------------------- advice (never blocks)
_VAGUE = re.compile(r"\b(short|fast|small|brief|concise|quick)\b", re.I)
_GATE = re.compile(r"\b(approv\w*|trust\w*|validat\w*|untrusted)\b", re.I)
_ABUSE = re.compile(r"\b(abuse|misuse)\b", re.I)
_TESTS = re.compile(r"\btests?\b", re.I)
_REPEAT = re.compile(r"\brepeat|\b\d+ times\b|in parallel", re.I)
_FOR_OTHERS = re.compile(r"(for|that) (other|another|downstream) modules? (to|will|that)? ?(read|consume|use)|"
r"(other|another) modules? (reads?|will read|consumes?)", re.I)
_READER = re.compile(r"\b(read by|reader is|reader:|the reader|consumer is|consumer:)\s+[`\w./]+", re.I)
_HEURISTIC = re.compile(r"\b(classifier|matcher|heuristic)\b", re.I)
_LABELS = re.compile(r"\blabell?ed\b|\blabels\b|ground truth", re.I)
_LABELS_INDEPENDENT = re.compile(r"different worker|another worker|other worker|held[- ]?out|blind", re.I)
_NUMBERED = re.compile(r"^\s*(\d+[.)]|item \d+)\s", re.I | re.M)
_COMMIT_PER_ITEM = re.compile(r"commit (after|per|for) each|done ?/ ?next", re.I)
def _written(text):
"""The lines the brief's author wrote: the template's bracketed guidance does not count."""
return [ln for ln in (text or "").splitlines()
if not (ln.strip().startswith("[") and ln.strip().endswith("]"))]
def advice(text):
"""Short pieces of advice about a brief, each with its reason. Advice never blocks a delegation."""
lines = _written(text)
body = "\n".join(lines)
acceptance = sections("\n".join(lines)).get("acceptance", [])
out = []
vague = sorted({m.group(1).lower() for ln in acceptance if not re.search(r"\d", ln) for m in _VAGUE.finditer(ln)})
if vague:
out.append("Acceptance says %s with no number: state each size, speed or brevity limit as a number "
"and the command that measures it." % "/".join(vague))
if _GATE.search(body) and not _ABUSE.search(body):
out.append("It mentions approval, trust or validation but lists no abuse cases: name them (omit the "
"trigger field, forge the trust mark, fail the before-step for an unrelated reason).")
if _TESTS.search(body) and not _REPEAT.search(body):
out.append("It asks for tests but not a repeat run: run new test modules about 30 times, with copies "
"in parallel, before reporting (exposes time and order dependence).")
if _FOR_OTHERS.search(body) and not _READER.search(body):
out.append("The worker writes data for other modules to read, but no reader is named: name it and ask "
"for one end-to-end test showing its behaviour changes.")
if _HEURISTIC.search(body) and _LABELS.search(body) and not _LABELS_INDEPENDENT.search(body):
out.append("It asks for a classifier, matcher or heuristic and a labelled set from the same worker: the "
"labels should come from a different worker, or a held-out part be written first.")
if len(_NUMBERED.findall(body)) >= 2 and not _COMMIT_PER_ITEM.search(body):
out.append("It has numbered items but no commit per item: ask for a commit after each, with a "
"\"done / next\" note, so an interruption loses at most one.")
return out