Prompt pack — draft a blueprint from an existing repository#

Status: experimental. This is an agent inference aid, not an engine feature. It drives a coding agent to propose an EngineeringBlueprint for a repository it can read; a human then reviews and merges that proposal through a normal PR. The engine never authors your contract unattended, and bce teeth is the hard gate that refuses a vacuous draft. It has been validated on a set of public repositories (see VALIDATION.md); treat its output as a starting draft to review, never as a ratified contract.

If you just want to see bce work, do the quickstart first — that is the guaranteed offline path and it does not depend on this pack.


What you are asking the agent to do#

Give this file to a coding agent that can read the target repository and run shell commands. The agent surveys the repo, identifies ONE real architectural invariant the codebase already upholds (or intends to), expresses it as a small blueprint using constraints the engine can actually evaluate, and proves the draft is valid and falsifiable before handing it to you. You review the draft as a PR — accept it, tighten it, or reject it.

The contract the agent must honor, non-negotiable:


What the engine can enforce (read this before drafting)#

TypeScript/JavaScript uses the mature AST path. Python ships as an explicit import-graph MVP behind the same provider seam. The graph model is language-neutral, but each profile below has a narrower observed surface; draft only what its extractor can prove.

Four extraction profiles shape how files become a graph:

The workhorse constraints are profile-shaped. File and content checks are portable; dependency and egress checks require the active extractor to emit the corresponding facts:

ConstraintWhat it forbids / requiresSupport boundary
forbiddenDependency:<module>an import/require of <module> anywhere in scopeimport-emitting profiles; module graph targets must be canonical
forbiddenFile:<glob>any raw file matching <glob> (export-shape-agnostic)all profiles
forbiddenPattern:<regex>any line matching <regex> in a scoped fileall profiles
forbiddenEgress:<host,...>a fetch/HTTP call to a forbidden host (blocklist)TypeScript framework AST profiles only
forbiddenEgress:governed=<host,...>a fetch/HTTP call to a host NOT on the allowlistTypeScript framework AST profiles only
forbiddenPath:<glob>a component under <glob>all profiles, limited to extracted components

Structural constraints (requiredComponent:<type>, requiredDependency:<type>) depend on the profile's extractor recognizing your components — powerful for a Next.js route surface or a recognized plugin factory, but fragile on an arbitrary repo whose shape the profile does not model. For an ordinary TS/JS dependency boundary, use typescript-module-graph with canonical module:, package:, or builtin: targets and explicit importer scopePaths. Do not attach forbiddenEgress to typescript-module-graph or python-import-surface; strict validation rejects that unsupported combination. Prefer portable file/content constraints for a first blueprint on an unfamiliar shape.

Three constraint types (requiredEvidence, minimumMetric, customPolicy) are declared-but-not-yet -enforced by the grader; teeth reports them INDETERMINATE, not toothed. Do not build a first blueprint solely from those — it will be toothless.

Optional trailing severity on any constraint: :<info|low|medium|high|critical> (default high).


The procedure the agent follows#

1. Survey the repository#

Read enough to name the architecture honestly:

2. Pick ONE real invariant#

Name a rule that is true of this repo and that a realistic bad PR could violate. Good first-blueprint shapes, in order of portability:

Avoid inventing a rule the repo does not actually hold to (it will either be absurd or immediately red for reasons nobody agreed to). One toothed constraint is a fine first blueprint — more is not better if the extra ones are trivial.

3. Draft the blueprint with bce author#

bce author is interactive-free and self-validating — it emits a schema-VALID draft and, with --repo, refuses (exit 2) a scope that matches zero files. Name the output *.blueprint.json so bce gate can discover it.

bce author \
  --id <kebab-id> \
  --name "<one honest sentence naming the invariant>" \
  --intent-ref "policy/<why-this-rule-exists>" \
  --constraint "forbiddenDependency:<module>:high" \
  --extraction-profile plugin-surface \
  --scope-paths "<the real source glob, e.g. lib/**/*.js>" \
  --min-files <a floor at or below the real file count> \
  --repo <path-to-target-repo> \
  --out <id>.blueprint.json

4. Prove it: validate, then teeth#

bce validate --blueprint <id>.blueprint.json
bce teeth --blueprint <id>.blueprint.json --ct-repo <path-to-target-repo> --no-pin --extractor ast

5. Run the gate and read the verdict#

# put the blueprint where the gate discovers it, then gate the repo
mkdir -p <path-to-target-repo>/.blueprints
cp <id>.blueprint.json <path-to-target-repo>/.blueprints/
bce gate --repo <path-to-target-repo> --extractor ast --all

Read the verdict and make sure it is explainable:

6. Hand it to a human#

The agent's output is a draft blueprint plus its evidence: the validate, teeth, and gate transcripts. Present them and stop. The human reviews the draft as a PR — accepts, tightens the scope or severity, or rejects it. Merging the blueprint (and ratifying it to approved) is the human's decision. On a real red found later, the standing rule is: fix the code; never edit the blueprint to make a red disappear without human review.


The instruction to paste to the agent#

You are drafting an architecture-conformance blueprint for the repository at <PATH>, to be graded by bce (the blueprint conformance engine; bce --help for the CLI). Follow the procedure in prompts/blueprint-author.md exactly:

  1. Survey the repo (source roots, package.json dependencies, layering, any stated architecture rules).
  2. Choose ONE real architectural invariant this repo upholds that a bad PR could violate — prefer a dependency-boundary or layering rule expressed with a forbidden* constraint. For ordinary TS/JS modules use typescript-module-graph; use plugin-surface only for an extension factory.
  3. Draft it with bce author, pointing --scope-paths at the repo's real source glob and setting --min-files at or below the current file count.
  4. Prove it with bce validate and bce teeth --no-pin --extractor ast. Preserve the exact teeth label: evaluator-refutable is not toothed; add a disposable source mutation before claiming extractor-real proof. If it reports TOOTHLESS, pick another invariant.
  5. Run bce gate --repo <PATH> --extractor ast --all and confirm the verdict is explainable (a PASS on a repo that genuinely upholds the rule is correct; a RED must name a real violation).
  6. STOP and present the draft blueprint plus the validate/teeth/gate transcripts for human review. Do NOT edit the repository's source to make the gate pass, and do NOT commit the blueprint — leave it for a human to review and merge as a PR.

When this pack does not fit#

Python is supported only for the import and scanned-file rules documented by the python-import-surface MVP. Other languages are not yet extracted. Draft against a supported surface of a mixed repo or extend the provider seam. If the agent cannot find a single falsifiable invariant it can express, that is a real finding: say so rather than ship a toothless blueprint. The quickstart remains the guaranteed path regardless.


Read Markdown · Source: prompts/blueprint-author.md