Skip to content

Commit 6d322b5

Browse files
V38 Gate 4: Prove Prompt Benchmark Coverage
Add the source-safe V38PromptBenchmarkReport artifact for PromptPart and complete Prompt benchmarking across Reading, Conversation, and tool-definition surfaces. Wire the Gate 4 generator, checker, protocol exports, workflow checks, and protocol tests; update V38 specifications, roadmap, and documentation with the closure anchor. Validation: pnpm run check:v38-gate1; pnpm run check:v38-gate2; pnpm run check:v38-gate3; pnpm run check:v38-gate4; node --test --test-force-exit packages/protocol/test/v38-prompt-benchmark-report.test.js; pnpm --filter @bitcode/protocol typecheck; pnpm --filter @bitcode/protocol test; node scripts/run-bitcode-spec-quality.mjs --mode strict-version --version V38; pnpm --dir packages/prompts exec tsx src/benchmarking/cli.ts benchmark:report; git diff --cached --check.
1 parent 280396c commit 6d322b5

18 files changed

Lines changed: 3289 additions & 28 deletions

.bitcode/v38-prompt-benchmark-report.json

Lines changed: 1891 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/bitcode-canon-quality.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ jobs:
151151
if [ -f scripts/check-v38-gate3-ptrr-failsafe-thricified-stack.mjs ]; then
152152
node scripts/check-v38-gate3-ptrr-failsafe-thricified-stack.mjs --skip-branch-check
153153
fi
154+
if [ -f scripts/check-v38-gate4-prompt-benchmark-report.mjs ]; then
155+
node scripts/check-v38-gate4-prompt-benchmark-report.mjs --skip-branch-check
156+
fi
154157
fi
155158
else
156159
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2

.github/workflows/bitcode-gate-quality.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ jobs:
280280
if [ -f scripts/check-v38-gate3-ptrr-failsafe-thricified-stack.mjs ]; then
281281
node scripts/check-v38-gate3-ptrr-failsafe-thricified-stack.mjs --skip-branch-check
282282
fi
283+
if [ -f scripts/check-v38-gate4-prompt-benchmark-report.mjs ]; then
284+
node scripts/check-v38-gate4-prompt-benchmark-report.mjs --skip-branch-check
285+
fi
283286
fi
284287
else
285288
echo "Unexpected BITCODE_SPEC.txt pointer: $POINTER" >&2
@@ -362,6 +365,9 @@ jobs:
362365
if [ -f packages/protocol/test/v38-ptrr-failsafe-thricified-stack.test.js ]; then
363366
pnpm --dir packages/protocol exec node --test --test-force-exit test/v38-ptrr-failsafe-thricified-stack.test.js
364367
fi
368+
if [ -f packages/protocol/test/v38-prompt-benchmark-report.test.js ]; then
369+
pnpm --dir packages/protocol exec node --test --test-force-exit test/v38-prompt-benchmark-report.test.js
370+
fi
365371
pnpm --filter @bitcode/protocol test
366372
367373
- name: Test staged Reading route and Terminal harness contracts

BITCODE_SPEC_V38.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Prior canonical anchor: `BITCODE_SPEC_V37.md`
99
- Prior generated proof appendix: `BITCODE_SPEC_V37_PROVEN.md`
1010
- Active canonical pointer during draft opening: `BITCODE_SPEC.txt` -> `V37`
11-
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
11+
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, `.bitcode/v38-prompt-benchmark-report.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
1212
- Source parity state: V38 source-side inference stack, prompt benchmarking, Reading pipeline, depository-search, telemetry, rehearsal, workflow, and promotion surfaces are draft-required until their gates close
1313
- Notes companion: `BITCODE_SPEC_V38_NOTES.md`
1414
- Delta companion: `BITCODE_SPEC_V38_DELTA.md`
@@ -86,8 +86,11 @@ Gate 3 confirms tools remain step-owned postprocess capabilities while `Failsafe
8686
### Gate 4: PromptPart And Prompt Benchmarking
8787

8888
Gate 4 completes prompt and PromptPart benchmarking.
89+
Prompt benchmarking is the source-safe measurement contract for complete Prompt registries and their composed PromptParts.
8990
Semantically divided PromptParts and complete Prompts must be benchmarkable with initial benchmark suites for active Reading, Conversation, and tool-definition inference surfaces.
9091
Benchmarks must preserve prompt identity, fixture inputs, expected typed-output qualities, disclosure tiers, and stable report artifacts.
92+
Gate 4 is closed by the package-backed `V38PromptBenchmarkReport` source and deterministic `.bitcode/v38-prompt-benchmark-report.json` artifact.
93+
The artifact has `source-safe-prompt-benchmark-metadata` disclosure posture and records 7 benchmark rows, 13 source-safe fixtures, 24 typed-output quality expectations, 38 passed source predicates, 443 active PromptPart doc-comments, 39 complete Prompt doc-comments, 465 benchmark definitions, 275 PromptPart exports, and 85 Prompt constructions across Reading, Conversation, and tool-definition inference surfaces without serializing raw prompt text, protected source, credentials, raw provider responses, or unpaid AssetPack source.
9194

9295
### Gate 5: Inference Telemetry And Disclosure Tiers
9396

BITCODE_SPEC_V38_DELTA.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Current canonical/latest target: `V37`
88
- Prior canonical anchor: `BITCODE_SPEC_V37.md`
99
- Prior generated proof appendix: `BITCODE_SPEC_V37_PROVEN.md`
10-
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
10+
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, `.bitcode/v38-prompt-benchmark-report.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
1111
- Source parity state: V38 source-side inference stack, prompt benchmarking, Reading pipeline, depository-search, telemetry, rehearsal, workflow, and promotion surfaces are draft-required until their gates close
1212
- Spec companion: `BITCODE_SPEC_V38.md`
1313
- Notes companion: `BITCODE_SPEC_V38_NOTES.md`
@@ -105,10 +105,17 @@ Closure implementation:
105105
Closure acceptance:
106106

107107
- PromptParts and complete Prompts are benchmarkable;
108+
- Prompt benchmarking remains source-safe and registry-backed;
108109
- active Reading, Conversation, and tool-definition prompts have initial benchmark suites;
109110
- benchmark artifacts preserve prompt identities, fixtures, typed-output quality expectations, and disclosure tiers;
110111
- `pnpm run check:v38-gate4` validates benchmark runner, fixtures, reports, and source-safe metadata.
111112

113+
Closure implementation:
114+
115+
- `V38PromptBenchmarkReport` is now package-backed in `packages/protocol/src/canonical/prompt-benchmark-report.js` and generated to `.bitcode/v38-prompt-benchmark-report.json`.
116+
- The generated artifact is `source-safe-prompt-benchmark-metadata` and covers benchmark infrastructure, generic PTRR/Failsafe/ThricifiedGeneration PromptParts, `ReadNeedComprehensionSynthesis` PromptParts, `ReadFitsFindingSynthesis` PromptParts, complete Reading Prompt registries, Website Conversation Prompts, and DocCodeToolPrompt surfaces.
117+
- The current benchmark report records 7 rows, 13 source-safe fixtures, 24 typed-output quality expectations, 38 passed source predicates, 443 active PromptPart doc-comments, 39 complete Prompt doc-comments, 465 benchmark definitions, 275 PromptPart exports, and 85 Prompt constructions without serializing raw prompt text, protected source, raw provider responses, credentials, or unpaid AssetPack source.
118+
112119
### Gate 5: Inference Telemetry And Disclosure Tiers
113120

114121
Closure acceptance:

BITCODE_SPEC_V38_NOTES.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
- Current active draft target: `V38`
99
- Prior canonical anchor: `BITCODE_SPEC_V37.md`
1010
- Prior generated proof appendix: `BITCODE_SPEC_V37_PROVEN.md`
11-
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
11+
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, `.bitcode/v38-prompt-benchmark-report.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
1212
- Source parity state: V38 source-side inference stack, prompt benchmarking, Reading pipeline, depository-search, telemetry, rehearsal, workflow, and promotion surfaces are draft-required until their gates close
1313
- Spec companion: `BITCODE_SPEC_V38.md`
1414
- Delta companion: `BITCODE_SPEC_V38_DELTA.md`
@@ -162,6 +162,15 @@ Gate 3 closes the practical PTRR stack contract by making the existing source-ba
162162
The artifact proves 69 source predicates and binds 52 PTRR steps to 156 Failsafe sequences, 156 ThricifiedGeneration chains, and 468 provider-call slots.
163163
Tools remain step-owned postprocess executions; `ThricifiedGeneration` remains the lowest-level Reason, Judge, StructuredOutput provider-call chain.
164164

165+
## Gate 4 implementation notes
166+
167+
Gate 4 closes the first concrete prompt benchmarking contract by making benchmark coverage package-backed, generated, tested, and workflow-checkable.
168+
Prompt benchmarking remains the complete-Prompt side of the same benchmark law that applies to semantically divided PromptParts.
169+
`V38PromptBenchmarkReport` and `.bitcode/v38-prompt-benchmark-report.json` record prompt benchmark infrastructure, generic PTRR/Failsafe/ThricifiedGeneration PromptParts, `ReadNeedComprehensionSynthesis` PromptParts, `ReadFitsFindingSynthesis` PromptParts, complete Reading Prompt registries, Website Conversation Prompts, and DocCodeToolPrompt surfaces as `source-safe-prompt-benchmark-metadata`.
170+
The artifact deliberately stores prompt identities, source-safe fixture ids, typed-output quality expectations, disclosure tiers, source roots, counts, predicate ids, and proof roots rather than raw prompt text or provider responses.
171+
The current generated report covers 7 benchmark rows, 13 fixtures, 24 typed-output quality expectations, 38 source predicates, 443 active PromptPart doc-comments, 39 complete Prompt doc-comments, 465 benchmark definitions, 275 PromptPart exports, and 85 Prompt constructions.
172+
Later V38 gates must use this report when streaming inference telemetry, hardening the two Reading pipelines, and applying Conversation/tool-prompt parity.
173+
165174
## V38 gate plan
166175

167176
- Gate 1: V38 Inference Stack Roadmap And Spec Opening

BITCODE_SPEC_V38_PARITY_MATRIX.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- Current canonical/latest target: `V37`
88
- Prior canonical anchor: `BITCODE_SPEC_V37.md`
99
- Prior generated proof appendix: `BITCODE_SPEC_V37_PROVEN.md`
10-
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
10+
- Generated structured artifact inventory: draft `.bitcode/v38-spec-family-report.json`, `.bitcode/v38-canonical-input-report.json`, `.bitcode/v38-canon-posture-drift-report.json`, `.bitcode/v38-inference-surface-inventory.json`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, `.bitcode/v38-prompt-benchmark-report.json`, V38 gate-quality workflow evidence, and future V38 generated proof artifacts as gates close
1111
- Source parity state: V38 source-side inference stack, prompt benchmarking, Reading pipeline, depository-search, telemetry, rehearsal, workflow, and promotion surfaces are draft-required until their gates close
1212
- Spec companion: `BITCODE_SPEC_V38.md`
1313
- Notes companion: `BITCODE_SPEC_V38_NOTES.md`
@@ -64,6 +64,11 @@ Gate 1 audit basis:
6464
- `packages/protocol/test/v38-ptrr-failsafe-thricified-stack.test.js`
6565
- `scripts/generate-v38-ptrr-failsafe-thricified-stack.mjs`
6666
- `scripts/check-v38-gate3-ptrr-failsafe-thricified-stack.mjs`
67+
- `.bitcode/v38-prompt-benchmark-report.json`
68+
- `packages/protocol/src/canonical/prompt-benchmark-report.js`
69+
- `packages/protocol/test/v38-prompt-benchmark-report.test.js`
70+
- `scripts/generate-v38-prompt-benchmark-report.mjs`
71+
- `scripts/check-v38-gate4-prompt-benchmark-report.mjs`
6772

6873
No `_legacy/` source is active source truth.
6974

@@ -80,6 +85,7 @@ No `_legacy/` source is active source truth.
8085
| Telemetry disclosure scope | Gate 1 | V35 telemetry law, V37 stream UI law, V38 inference notes | drafted | Gate plan requires source-safe prompt, raw response, parsed output, schema verdict, retry, and repair visibility at permitted tiers. |
8186
| Inference surface inventory | Gate 2 | `V38InferenceSurfaceInventory`, `.bitcode/v38-inference-surface-inventory.json`, protocol test, generator, checker, workflows | closed | Source-safe inventory covers Reading, Conversation, tool-definition prompt, interface entrypoint, prompt registry, and execution primitive families with 52 PTRR steps and later-gate gaps explicit. |
8287
| PTRR Failsafe and Thricified execution stack | Gate 3 | `V38PtrrFailsafeThricifiedStack`, `.bitcode/v38-ptrr-failsafe-thricified-stack.json`, protocol test, generator, checker, workflows | closed | Practical PTRR agents prove four steps, three Failsafe stages, three ThricifiedGeneration stages, 69 source predicates, and Gate 2 count binding with step-owned tools. |
88+
| PromptPart and Prompt benchmarking | Gate 4 | `V38PromptBenchmarkReport`, `.bitcode/v38-prompt-benchmark-report.json`, protocol test, generator, checker, workflows | closed | Source-safe benchmark report covers active Reading, Conversation, and tool-definition PromptParts and complete Prompts with 7 rows, 13 fixtures, 24 typed-output quality expectations, and 38 passed source predicates. |
8389

8490
## V38 implementation checklist
8591

@@ -94,6 +100,7 @@ No `_legacy/` source is active source truth.
94100
| Package docs | README, protocol package README, demonstration README, and PR template state V37 active / V38 draft workflow | drafted |
95101
| Inference surface inventory | `.bitcode/v38-inference-surface-inventory.json` and `V38InferenceSurfaceInventory` are generated, tested, checked, documented, and workflow-wired as `source-safe-inference-surface-metadata` | closed |
96102
| PTRR stack artifact | `.bitcode/v38-ptrr-failsafe-thricified-stack.json` and `V38PtrrFailsafeThricifiedStack` are generated, tested, checked, documented, and workflow-wired as `source-safe-ptrr-failsafe-thricified-stack-metadata` | closed |
103+
| Prompt benchmark artifact | `.bitcode/v38-prompt-benchmark-report.json` and `V38PromptBenchmarkReport` are generated, tested, checked, documented, and workflow-wired as `source-safe-prompt-benchmark-metadata` | closed |
97104
| Inference stack vocabulary | V38 spec family names `PipelineExecution`, PTRR agents, Plan, Try, Refine, Retry, `FailsafeGenerationSequence`, `ThricifiedGeneration`, `ToolExecution`, `DocCodeToolPrompt`, and provider call boundaries | drafted |
98105
| Reading vocabulary | V38 spec family names `ReadNeedComprehensionSynthesis` and `ReadFitsFindingSynthesis` | drafted |
99106
| Depository search vocabulary | V38 spec family names lexical, symbolic, path, metadata, measurement, embedding/vector, provider-specific channels, candidate deposits, ranking, thresholds, and selected-fit provenance | drafted |
@@ -146,9 +153,25 @@ No `_legacy/` source is active source truth.
146153
| Gate 2 counts are bound | 52 PTRR steps, 156 Failsafe sequences, 156 ThricifiedGeneration chains, 468 provider-call slots | closed |
147154
| Gate checker is wired | `pnpm run check:v38-gate3`, package test, generator check, gate/canon workflows | closed |
148155

156+
## Gate 4 Parity
157+
158+
| Requirement | Source evidence | Current V38 judgment |
159+
| --- | --- | --- |
160+
| Benchmark report source is package-owned | `packages/protocol/src/canonical/prompt-benchmark-report.js`, `packages/protocol/src/index.js`, `packages/protocol/src/index.d.ts` | closed |
161+
| Deterministic artifact exists | `.bitcode/v38-prompt-benchmark-report.json` | closed |
162+
| Source-safe disclosure posture is explicit | `source-safe-prompt-benchmark-metadata`, fixture ids, typed-output quality ids, raw prompt text private, raw provider response private | closed |
163+
| Benchmark runner and suite types are included | `packages/prompts/src/benchmarking/runner.ts`, `packages/prompts/src/benchmarking/types.ts`, `packages/prompts/src/developing/doc-comment-developing.ts` | closed |
164+
| Generic PromptParts are benchmarkable | generic PTRR, Failsafe, ThricifiedGeneration, formatting, and DocCode PromptParts | closed |
165+
| Reading PromptParts are benchmarkable | `ReadNeedComprehensionSynthesis` and `ReadFitsFindingSynthesis` specific PromptParts and typed-output quality fixtures | closed |
166+
| Complete Reading Prompts are benchmarkable | `packages/pipelines/asset-pack/src/agents/prompts`, `packages/pipelines/asset-pack/src/reading-pipeline-contract.ts` | closed |
167+
| Conversation Prompt is benchmarkable | `BitcodeTerminalConversationSystemPrompt` benchmark row with route-local source-safe fixture | closed |
168+
| Tool-definition Prompts are benchmarkable | `DocCodeToolPrompt`, `formatUsableTools`, web-search, repository-evidence search, and VCS PR tool prompts | closed |
169+
| Count contract is explicit | 7 rows, 13 fixtures, 24 typed-output quality expectations, 38 source predicates, 443 PromptPart doc-comments, 39 complete Prompt doc-comments, 465 benchmark definitions, 275 PromptPart exports, and 85 Prompt constructions | closed |
170+
| Gate checker is wired | `pnpm run check:v38-gate4`, package test, generator check, gate/canon workflows | closed |
171+
149172
## Completion condition
150173

151-
Gate 3 closes when `pnpm run check:v38-gate3`, the V38 PTRR/Failsafe/Thricified stack generator check, Gate 2 inventory checks, V38 draft spec-family validation over V37, V37/V38 canon-posture drift validation, canonical input validation for V37, strict V38 spec quality, protocol tests, workflow wiring checks, secret scans, and diff hygiene all pass on `v38/gate-3-ptrr-failsafe-thricified-stack`.
174+
Gate 4 closes when `pnpm run check:v38-gate4`, the V38 prompt benchmark report generator check, Gate 3 PTRR/Failsafe/Thricified stack checks, Gate 2 inventory checks, V38 draft spec-family validation over V37, V37/V38 canon-posture drift validation, canonical input validation for V37, strict V38 spec quality, protocol tests, workflow wiring checks, secret scans, and diff hygiene all pass on `v38/gate-4-promptpart-prompt-benchmarking`.
152175

153176
## accepted boundaries
154177

0 commit comments

Comments
 (0)