Output contracts: per-label template enforcement
Part of Issue Contracts (umbrella: #57).
Depends on **Issues #58, #59, and #60 ** being complete.
Context
/verify-issue (issue #58) checks that for_cowork issues have required sections (## Steps, ## Done when, ## Do not touch). That's the starting point of template enforcement.
This issue extends the idea: each routing label has an output contract — a defined shape that issues carrying that label must match. The verification endpoint enforces the shape. Issue bodies that don't match get flagged as contract violations.
The output contracts
rfc output contract
An RFC issue must contain:
- Problem statement — what's broken or unclear
- Proposed design — the architectural move, not implementation details
- Gate condition — what triggers promotion out of RFC
- Out of scope — what this RFC is deliberately not addressing
An RFC without a gate condition has no exit criteria. An RFC without "out of scope" will expand in review. Both are contract violations.
for_cowork output contract
A cowork issue must contain (already in #58 , extended here):
- Context — why this issue exists
- Steps — concrete, tool-call-referencing actions
- Done when — machine-checkable criteria (gate URLs, pass counts, file existence)
- Do not touch — explicit file/scope exclusions
- Out of scope — what's deliberately deferred to follow-up
for_session output contract
A session issue must contain:
- Context — the situation requiring judgment
- Decision point — the explicit question or choice
- Options — at least two defensible paths
- Constraints — what limits the decision
regression / hotfix output contract
A regression/hotfix issue must contain:
- Reproduction — steps or gate URL that shows the failure
- Expected behavior — what should happen instead
- Observed in version — SF_VERSION where the failure appeared
- Blast radius — what's affected, what isn't
Verification extensions
Add to /verify-issue universal checks (new template-compliance profile):
| Check |
Severity |
Description |
| Template compliance |
warn for new labels, error for stable labels |
Body must contain all required sections for the label's output contract. |
Severity is nuanced: for a freshly-adopted label taxonomy (like rfc before it was codified), enforcing is aggressive. For the current stable set, violations are errors.
Steps
- Define output contracts in code as a
LABEL_TEMPLATES object — keys are label names, values are arrays of required section headers
- Implement
checkTemplateCompliance(issueBody, label) returning { missing_sections, ok }
- Wire into existing
/verify-issue profile for each routing label
- Create template files in
templates/ folder:
templates/rfc.md
templates/for_cowork.md
templates/for_session.md
templates/regression.md
- Link templates from HANDOFF.md Issue Contracts section
- Optional: add GitHub issue templates (
.github/ISSUE_TEMPLATE/) that match the output contracts
- Audit existing open issues — flag ones that fail template compliance
- Fix or label existing issues that fail
Done when
Do not touch
Out of scope
- Forcing compliance retroactively on closed issues
- Natural-language template detection (exact section header match only for now)
- Multi-label template merging (an issue with both
rfc and for_cowork is rare; cross that bridge if it appears)
Why this completes the umbrella
Issue #58 verifies the AI can safely engage. Issue #59 tells it how. Issue #60 communicates contracts visually. Issue #61 makes the contracts enforceable at authoring time — so issues are well-formed before an AI ever sees them.
The full Issue Contracts system: labels control engagement, knowledge guides the work, templates enforce the shape. At that point, the AI picking up an issue has structural guarantees about what it's reading, what's required, what principles apply, and how to proceed.
Output contracts: per-label template enforcement
Part of Issue Contracts (umbrella: #57).
Depends on **Issues #58, #59, and #60 ** being complete.
Context
/verify-issue(issue #58) checks thatfor_coworkissues have required sections (## Steps,## Done when,## Do not touch). That's the starting point of template enforcement.This issue extends the idea: each routing label has an output contract — a defined shape that issues carrying that label must match. The verification endpoint enforces the shape. Issue bodies that don't match get flagged as contract violations.
The output contracts
rfcoutput contractAn RFC issue must contain:
An RFC without a gate condition has no exit criteria. An RFC without "out of scope" will expand in review. Both are contract violations.
for_coworkoutput contractA cowork issue must contain (already in #58 , extended here):
for_sessionoutput contractA session issue must contain:
regression/hotfixoutput contractA regression/hotfix issue must contain:
Verification extensions
Add to
/verify-issueuniversal checks (new template-compliance profile):Severity is nuanced: for a freshly-adopted label taxonomy (like
rfcbefore it was codified), enforcing is aggressive. For the current stable set, violations are errors.Steps
LABEL_TEMPLATESobject — keys are label names, values are arrays of required section headerscheckTemplateCompliance(issueBody, label)returning{ missing_sections, ok }/verify-issueprofile for each routing labeltemplates/folder:templates/rfc.mdtemplates/for_cowork.mdtemplates/for_session.mdtemplates/regression.md.github/ISSUE_TEMPLATE/) that match the output contractsDone when
LABEL_TEMPLATESdefined in server code/verify-issuefor all routing labelstemplates/folderGET /testDo not touch
Out of scope
rfcandfor_coworkis rare; cross that bridge if it appears)Why this completes the umbrella
Issue #58 verifies the AI can safely engage. Issue #59 tells it how. Issue #60 communicates contracts visually. Issue #61 makes the contracts enforceable at authoring time — so issues are well-formed before an AI ever sees them.
The full Issue Contracts system: labels control engagement, knowledge guides the work, templates enforce the shape. At that point, the AI picking up an issue has structural guarantees about what it's reading, what's required, what principles apply, and how to proceed.