buildDesignVerifyPrompt function

String buildDesignVerifyPrompt({
  1. required Bead bead,
  2. required Map<String, String> documents,
  3. required List<DesignFinding> findings,
  4. required int round,
})

The verifier's brief — bounded, self-contained, and explicit that a judgment is EVIDENCE and never fact.

Exposed so a test reads the exact prose the station sends (the A19 trap: a contract the prompt never states is a contract nobody is held to).

Implementation

String buildDesignVerifyPrompt({
  required Bead bead,
  required Map<String, String> documents,
  required List<DesignFinding> findings,
  required int round,
}) {
  final b = StringBuffer()
    ..writeln('# Design round $round — VERIFY')
    ..writeln()
    ..writeln(
      'You are the VERIFIER of an adversarial design round. Four judges read '
      'the document below through four different lenses and raised the '
      'findings listed after it. Each judgment is EVIDENCE, NEVER FACT: a '
      'judge argues, it does not rule. Your job is to CONFIRM or REFUTE every '
      'finding against the document, the tree and the rulings the bead names — '
      'and to FIX the ones you confirm.',
    )
    ..writeln()
    ..writeln('## The work bead — the rulings this round is held to')
    ..writeln(PackagedAssetLoader.beadBlock(bead))
    ..writeln()
    ..writeln('## The document(s) under review');
  for (final entry in documents.entries) {
    b
      ..writeln()
      ..writeln('### `${entry.key}`')
      ..writeln('<<<DOCUMENT ${entry.key}')
      ..writeln(entry.value.trimRight())
      ..writeln('DOCUMENT>>>');
  }
  b
    ..writeln()
    ..writeln('## The judges\' findings — ${findings.length} to adjudicate')
    ..writeln();
  for (final finding in findings) {
    b.writeln(
      '- `${finding.key}` [${finding.severity}] — ${finding.claim}\n'
      '  - the judge\'s receipt: ${finding.receipt}',
    );
  }
  b
    ..writeln()
    ..writeln('## How to adjudicate')
    ..writeln(
      '- `CONFIRMED-FIXED` — the finding is real AND your revised document '
      'fixes it. Say what you changed.\n'
      '- `REFUTED` — the finding is wrong. Say WHY, with your own receipt: the '
      'judge\'s rationale does not make it true.\n'
      '- `$kDesignVerdictOpen` — the finding is real and you cannot fix it '
      'here (it needs a decision the bead does not make, or work outside this '
      'document). Only these block the round, so use it deliberately.',
    )
    ..writeln(
      'Adjudicate EVERY finding exactly once, keeping its lane, id and '
      'severity. Do not invent findings, and do not merge two into one.',
    )
    ..writeln()
    ..writeln('## Your answer')
    ..writeln(
      'Answer with STRICT JSON and nothing else — no prose before or after:',
    )
    ..writeln(
      '{"documents":{${documents.keys.map((path) => '"$path":"<the COMPLETE revised body>"').join(',')}},'
      '"adjudications":[{"lane":"<judge lane>","findingId":"<id>",'
      '"finding":"<the finding restated>","severity":"<BLOCKER|MAJOR|MINOR>",'
      '"verdict":"<${kDesignVerdicts.join('|')}>","why":"<your receipt>"}]}',
    )
    ..writeln(
      'Each `documents` value is the WHOLE file after your fixes, not a patch '
      'and not an excerpt — it REPLACES the file on disk. Name no other file. '
      'Do NOT write an adjudication log into the document: the station appends '
      'it from your `adjudications`.',
    );
  return b.toString();
}