Appendix A - 25. Mandatory snippet-table enforcement

The Structure of Mandatory snippet-table enforcement — its shape at a glance:

The table is a registry keyed by snippet, each row carrying an include-when condition and a marker string; the brief lint reads the table and asserts every applicable marker is present.

flowchart LR
  Table[(Snippet registry)] --> Lint{{Brief lint}}
  Brief[/Task brief/] --> Lint
  Lint -->|every required marker present| Pass([Dispatch])
  Lint -->|a required snippet absent| Fail([Refuse launch])

Accessible description: a snippet registry and the task brief both feed the brief lint, which asserts every applicable snippet's marker is present; the dispatch proceeds when all are and is refused when a required snippet is absent.

Projected from the catalogue entry governance-doc-controls / Mandatory snippet-table enforcement.

On this page: Intent · Motivation · Applicability · Structure · Sample Code · Consequences · Example use within DocAble · Related Patterns

Intent

Intent — A registry of mandatory agent-brief snippets (PATH export, commit-cadence, worktree discovery, submodule check, …) whose presence is asserted at dispatch by brief-linting, so every dispatched brief carries the safety and context boilerplate it needs.

Motivation

Every dispatch needs certain boilerplate to be safe: the PATH export (or 65+ PDF tests fail for lack of a binary), the commit-cadence discipline, worktree discovery via $(pwd), the submodule check. An author who forgets one ships an agent that trips exactly that sharp edge 20 minutes in. Without a registry of what's mandatory, "which snippets does this brief need" is tribal knowledge that drifts as snippets are added, and the failure recurs on every hand-authored brief.

Applicability

Structure

The Structure diagram appears at the top of this page.

Sample Code

The table pairs each snippet with a grep-able marker and an include-when condition; the lint enumerates the required snippets for a given brief and asserts each marker is present. Always-include snippets have no condition; conditional ones fire on the brief's declared shape.

SNIPPET_TABLE = [
    {"name": "path-export",    "marker": "<!-- snip:path -->",      "when": lambda b: True},
    {"name": "commit-cadence", "marker": "<!-- snip:commit -->",    "when": lambda b: True},
    {"name": "submodule-check","marker": "<!-- snip:submodule -->", "when": lambda b: "test/samples" in b},
]

def required_snippets(brief: str) -> list[dict]:
    return [s for s in SNIPPET_TABLE if s["when"](brief)]

def lint_snippets(brief: str) -> list[str]:
    return [f"missing mandatory snippet '{s['name']}' (marker {s['marker']})"
            for s in required_snippets(brief) if s["marker"] not in brief]

if __name__ == "__main__":
    import sys
    findings = lint_snippets(open(sys.argv[1]).read())
    print("\n".join(findings))
    sys.exit(1 if findings else 0)

Consequences

Example use within DocAble

Contents
© James C. Davis, 2026–present