Skip to content

Commit ddaa805

Browse files
Merge pull request #15 from engineeredsoftware/v28/gate-10-read-need-comprehension
Gate 10: close Read-Need comprehension
2 parents 8b1651a + f64e669 commit ddaa805

30 files changed

Lines changed: 763 additions & 297 deletions

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
node scripts/check-bitcode-canonical-inputs.mjs --current-target V27
4747
node scripts/check-v28-metadevelopment-readiness.mjs --skip-branch-check
4848
node scripts/check-v28-gate9-depository-evidence.mjs
49+
node scripts/check-v28-gate10-read-need-comprehension.mjs
4950
node scripts/promote-bitcode-canon.mjs --version V28 --commit HEAD --dry-run
5051
5152
- name: Validate source casing and imports

BITCODE_SPEC_V28.md

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ Purpose:
598598
Finish the enterprise Reading product experience around two named pipelines
599599
and five reviewable Terminal steps. `ReadNeedComprehensionSynthesis` turns a
600600
reader's Read Request into a measured Need that the reader can review.
601-
`ReadFindingFitsSynthesis` accepts only that reviewed Need, searches the Bitcode
601+
`ReadFitsFindingSynthesis` accepts only that reviewed Need, searches the Bitcode
602602
Depository for every qualifying fit deposit above the configured confidence and
603603
quality thresholds, synthesizes a source-safe AssetPack from those deposits
604604
when enough fit evidence exists, and prepares BTC settlement and pull-request
@@ -613,13 +613,13 @@ Acceptance criteria:
613613
comprehension, Need measurement, and operator review. All phase ids, agent
614614
ids, PTRR step ids, ThricifiedGeneration ids, prompt ids, and telemetry ids are prefixed under
615615
`ReadNeedComprehensionSynthesis`.
616-
- `ReadFindingFitsSynthesis` owns accepted-Need admission, setup/read
616+
- `ReadFitsFindingSynthesis` owns accepted-Need admission, setup/read
617617
comprehension, depository discovery, vector/lexical Finding Fits search,
618618
AssetPack implementation from qualifying fit deposits, validation,
619619
source-safe preview, Share-to-Fee pricing, settlement readback, and
620620
pull-request delivery. All phase ids, agent ids, PTRR step ids,
621621
ThricifiedGeneration ids, tool ids, prompt ids, and telemetry ids are prefixed under
622-
`ReadFindingFitsSynthesis`.
622+
`ReadFitsFindingSynthesis`.
623623
- the Read-Need comprehension pipeline stores prompt templates, prompt inputs,
624624
interpolated context, raw model responses when used, parsed typed Need,
625625
measurement root, review state, feedback history, resynthesis attempts, and
@@ -826,9 +826,27 @@ reviewable Need through `ReadNeedComprehensionSynthesis`, allow feedback and
826826
resynthesis, persist accepted Need truth, and block Finding Fits until the Need
827827
is reviewed.
828828

829+
Gate 10 acceptance requires:
830+
831+
- a typed `bitcode.read.request` record embedded in every `bitcode.read.need`
832+
so the raw request remains auditable as request truth rather than fit truth;
833+
- `ReadNeedComprehensionSynthesis` contract trace exposure for every phase,
834+
PTRR agent, PTRR step, and ThricifiedGeneration identifier used by route
835+
telemetry and Terminal stream/history surfaces;
836+
- resynthesis lineage: each resynthesized Need records the prior Need id and
837+
appends operator feedback without losing earlier feedback turns;
838+
- accepted Need truth: accepting a Need computes an acceptance root, records
839+
review state `accepted`, and emits Finding Fits admission evidence;
840+
- strict admission: `ReadFitsFindingSynthesis` receives only an accepted
841+
`bitcode.read.need` when `requireAcceptedReadNeed=true`; raw Read requests
842+
and unaccepted Needs produce blocked readiness;
843+
- Terminal exposes the first two enterprise Reading steps without raw JSON:
844+
synthesize Need, review measurements/proof expectations/feedback, request
845+
resynthesis, or accept the Need before the Fit button becomes ready.
846+
829847
### Gate 11: Finding Fits And Source-Safe AssetPack Preview
830848

831-
Gate 11 owns `ReadFindingFitsSynthesis`: depository search, candidate fit
849+
Gate 11 owns `ReadFitsFindingSynthesis`: depository search, candidate fit
832850
ranking, fitting deposits as synthesis context, AssetPack measurement, source-
833851
safe preview, Share-to-Fee quote, and proof-rich Terminal stream visibility.
834852

@@ -961,15 +979,15 @@ The Terminal enterprise Reading path is exactly five user steps:
961979
history. Terminal shows the full Need; the user can accept it or request
962980
resynthesis with feedback. No depository search, BTC fee, BTD mint, or
963981
AssetPack source disclosure is allowed before Need acceptance.
964-
3. **Request Fit.** `ReadFindingFitsSynthesis` accepts only the latest accepted
982+
3. **Request Fit.** `ReadFitsFindingSynthesis` accepts only the latest accepted
965983
Need. The pipeline verifies Need schema/review/measurement roots, prepares
966984
setup and read-comprehension context, then the discovery phase searches the
967985
Depository through lexical and vector channels, admits every deposit whose
968986
source-bound score, confidence, proof, measurement, and readback posture are
969987
above the configured thresholds, ranks those fits, and returns
970988
`worthy_fit`, `no_worthy_fit`, or `blocked_readiness`.
971989
4. **Review synthesized AssetPack.** When a worthy fit exists,
972-
`ReadFindingFitsSynthesis` implementation uses the discovered fit deposits
990+
`ReadFitsFindingSynthesis` implementation uses the discovered fit deposits
973991
as contextual knowledge to synthesize a source-safe AssetPack preview for
974992
the accepted Need. Preview may show Need measurement, Fit measurement, fit
975993
deposit ids, roots, score bands, proof posture, ownership boundary,
@@ -1045,26 +1063,26 @@ and `retry`. Every PTRR step owns three ThricifiedGeneration units for
10451063
`prepare-concise-context`, `chunk-then-sum`, and `stitch-until-complete`; each
10461064
ThricifiedGeneration is the strict reason, judge, structured-output sequence.
10471065

1048-
`ReadFindingFitsSynthesis` has seven phases, eight PTRR agents, thirty-two
1066+
`ReadFitsFindingSynthesis` has seven phases, eight PTRR agents, thirty-two
10491067
declared PTRR steps, ninety-six ThricifiedGeneration units, sixteen
10501068
model-structured PTRR steps, and four tool contracts:
10511069

10521070
| Phase | PTRR agent | Agent objective | Return type |
10531071
| --- | --- | --- | --- |
1054-
| `ReadFindingFitsSynthesis.admit` | `ReadFindingFitsSynthesis.admit.accepted-need-gate` | verify accepted Need: schema, review state, measurement root | `ReadFindingFitsAdmission` |
1055-
| `ReadFindingFitsSynthesis.prepare` | `ReadFindingFitsSynthesis.prepare.setup-plan` | setup plan: summarize Read, source revision, fit boundaries | `PlanSchema` |
1056-
| `ReadFindingFitsSynthesis.prepare` | `ReadFindingFitsSynthesis.prepare.read-comprehension` | comprehend Read: primary intent, satisfaction criteria, entities, risk admission | `BoundedReadComprehensionSchema` |
1057-
| `ReadFindingFitsSynthesis.discovery` | `ReadFindingFitsSynthesis.discovery.finding-fits` | discover fit deposits: build query, lexical search, vector search, admit qualifying fit deposits, rank fit deposits | `DepositoryFitsResult` |
1058-
| `ReadFindingFitsSynthesis.implementation` | `ReadFindingFitsSynthesis.implementation.asset-pack` | structured AssetPack synthesis from fit deposits: plan pack, write evidence, bind proof, prepare preview | `AssetPackSynthesisOutput` |
1059-
| `ReadFindingFitsSynthesis.validate` | `ReadFindingFitsSynthesis.validate.fit-quality` | source/proof readiness: validate search, synthesis, disclosure, finish readiness | `ReadyToFinishOutput` |
1060-
| `ReadFindingFitsSynthesis.preview` | `ReadFindingFitsSynthesis.preview.source-safe-preview` | measure fee and lock source: Share-to-Fee, range projection, access policy, source lock | `AssetPackSourceSafePreview` |
1061-
| `ReadFindingFitsSynthesis.settle` | `ReadFindingFitsSynthesis.settle.buy-deliver` | buy and deliver: reader BTC fee, range/license/journal readback, pull request, completion | `AssetPackCompletionOutput` |
1072+
| `ReadFitsFindingSynthesis.admit` | `ReadFitsFindingSynthesis.admit.accepted-need-gate` | verify accepted Need: schema, review state, measurement root | `ReadFitsFindingAdmission` |
1073+
| `ReadFitsFindingSynthesis.prepare` | `ReadFitsFindingSynthesis.prepare.setup-plan` | setup plan: summarize Read, source revision, fit boundaries | `PlanSchema` |
1074+
| `ReadFitsFindingSynthesis.prepare` | `ReadFitsFindingSynthesis.prepare.read-comprehension` | comprehend Read: primary intent, satisfaction criteria, entities, risk admission | `BoundedReadComprehensionSchema` |
1075+
| `ReadFitsFindingSynthesis.discovery` | `ReadFitsFindingSynthesis.discovery.finding-fits` | discover fit deposits: build query, lexical search, vector search, admit qualifying fit deposits, rank fit deposits | `DepositoryFitsResult` |
1076+
| `ReadFitsFindingSynthesis.implementation` | `ReadFitsFindingSynthesis.implementation.asset-pack` | structured AssetPack synthesis from fit deposits: plan pack, write evidence, bind proof, prepare preview | `AssetPackSynthesisOutput` |
1077+
| `ReadFitsFindingSynthesis.validate` | `ReadFitsFindingSynthesis.validate.fit-quality` | source/proof readiness: validate search, synthesis, disclosure, finish readiness | `ReadyToFinishOutput` |
1078+
| `ReadFitsFindingSynthesis.preview` | `ReadFitsFindingSynthesis.preview.source-safe-preview` | measure fee and lock source: Share-to-Fee, range projection, access policy, source lock | `AssetPackSourceSafePreview` |
1079+
| `ReadFitsFindingSynthesis.settle` | `ReadFitsFindingSynthesis.settle.buy-deliver` | buy and deliver: reader BTC fee, range/license/journal readback, pull request, completion | `AssetPackCompletionOutput` |
10621080

10631081
The required tool contracts are
1064-
`ReadFindingFitsSynthesis.tool.lexical-depository-search`,
1065-
`ReadFindingFitsSynthesis.tool.vector-depository-search`,
1066-
`ReadFindingFitsSynthesis.tool.verification-evidence`, and
1067-
`ReadFindingFitsSynthesis.tool.vcs-create-pull-request`. Every inference telemetry
1082+
`ReadFitsFindingSynthesis.tool.lexical-depository-search`,
1083+
`ReadFitsFindingSynthesis.tool.vector-depository-search`,
1084+
`ReadFitsFindingSynthesis.tool.verification-evidence`, and
1085+
`ReadFitsFindingSynthesis.tool.vcs-create-pull-request`. Every inference telemetry
10681086
line must expose prompt template, interpolated prompt/messages, raw response,
10691087
parsed typed output, schema/return type, usage/timing, execution state, and
10701088
fail-closed status. Every tool telemetry line must expose tool id, input
@@ -1088,15 +1106,15 @@ Terminal step 2: review synthesized Need
10881106
-> ReadNeedComprehensionSynthesis.review
10891107
-> accepted bitcode.read.need
10901108
Terminal step 3: request Fit
1091-
-> ReadFindingFitsSynthesis.admit
1092-
-> ReadFindingFitsSynthesis.prepare
1093-
-> ReadFindingFitsSynthesis.discovery
1109+
-> ReadFitsFindingSynthesis.admit
1110+
-> ReadFitsFindingSynthesis.prepare
1111+
-> ReadFitsFindingSynthesis.discovery
10941112
Terminal step 4: review synthesized AssetPack
1095-
-> ReadFindingFitsSynthesis.implementation
1096-
-> ReadFindingFitsSynthesis.validate
1097-
-> ReadFindingFitsSynthesis.preview
1113+
-> ReadFitsFindingSynthesis.implementation
1114+
-> ReadFitsFindingSynthesis.validate
1115+
-> ReadFitsFindingSynthesis.preview
10981116
Terminal step 5: buy AssetPack, settle
1099-
-> ReadFindingFitsSynthesis.settle
1117+
-> ReadFitsFindingSynthesis.settle
11001118
-> BTC fee readback + BTD range/license/journal readback + pull request
11011119
```
11021120

@@ -1128,7 +1146,7 @@ Prompt and return-type audit:
11281146
| Pipeline | Model-structured PTRR agents | Model-structured PTRR steps | Model prompt templates | Parsed return types |
11291147
| --- | ---: | ---: | --- | --- |
11301148
| `ReadNeedComprehensionSynthesis` | 1 | 4 | `ReadNeedComprehensionSynthesis.prompt.need-synthesis` | `ReadNeed` |
1131-
| `ReadFindingFitsSynthesis` | 4 | 16 | `ReadFindingFitsSynthesis.prompt.setup-plan`; `ReadFindingFitsSynthesis.prompt.read-comprehension`; `ReadFindingFitsSynthesis.prompt.asset-pack-synthesis`; `ReadFindingFitsSynthesis.prompt.fit-quality-validation` | `PlanSchema`; `BoundedReadComprehensionSchema`; `AssetPackSynthesisOutput`; `ReadyToFinishOutput` |
1149+
| `ReadFitsFindingSynthesis` | 4 | 16 | `ReadFitsFindingSynthesis.prompt.setup-plan`; `ReadFitsFindingSynthesis.prompt.read-comprehension`; `ReadFitsFindingSynthesis.prompt.asset-pack-synthesis`; `ReadFitsFindingSynthesis.prompt.fit-quality-validation` | `PlanSchema`; `BoundedReadComprehensionSchema`; `AssetPackSynthesisOutput`; `ReadyToFinishOutput` |
11321150

11331151
Every model-structured PTRR step records the common prompt registry posture:
11341152
`factoryAgentWithPTRR` with the `prompt` + `stepPrompts` carrier, agent
@@ -1141,7 +1159,7 @@ Tool audit:
11411159
| Pipeline | Tool count | Tool ids | Return types |
11421160
| --- | ---: | --- | --- |
11431161
| `ReadNeedComprehensionSynthesis` | 0 | none | none |
1144-
| `ReadFindingFitsSynthesis` | 4 | `ReadFindingFitsSynthesis.tool.lexical-depository-search`; `ReadFindingFitsSynthesis.tool.vector-depository-search`; `ReadFindingFitsSynthesis.tool.verification-evidence`; `ReadFindingFitsSynthesis.tool.vcs-create-pull-request` | `DepositorySearchResult`; `EmbeddingSearchResult`; `AssetPackVerificationEvidenceResult`; `PullRequestDeliveryResult` |
1162+
| `ReadFitsFindingSynthesis` | 4 | `ReadFitsFindingSynthesis.tool.lexical-depository-search`; `ReadFitsFindingSynthesis.tool.vector-depository-search`; `ReadFitsFindingSynthesis.tool.verification-evidence`; `ReadFitsFindingSynthesis.tool.vcs-create-pull-request` | `DepositorySearchResult`; `EmbeddingSearchResult`; `AssetPackVerificationEvidenceResult`; `PullRequestDeliveryResult` |
11451163

11461164
### Share-to-Fee measurement clarity
11471165

@@ -1171,8 +1189,9 @@ Gate 4 implementation state:
11711189

11721190
- `/api/read-review` exposes server-side Read-Need synthesis, resynthesis, and
11731191
acceptance actions while preserving the prior Read review boundary. The
1174-
response stores prompt input, interpolated source context, parsed Need,
1175-
measurement root, review state, feedback, and synthesis telemetry.
1192+
response stores prompt input, interpolated source context, typed
1193+
`bitcode.read.request`, parsed Need, measurement root, review state,
1194+
feedback, resynthesis lineage, contract trace, and synthesis telemetry.
11761195
- Read-Need test coverage must stay implementation-guiding rather than
11771196
snapshot-only: it must assert typed Need fields, measurement roots,
11781197
source-disclosure constraints, pricing measurement vectors, acceptance

BITCODE_SPEC_V28_DELTA.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,14 @@ harness deposit reference. The vector document policy is explicit:
198198
`text-embedding-3-small`, 1536 dimensions, `deliverable_vectors`, and
199199
`match_deliverable_vectors`.
200200

201+
Gate 10 introduces the first two enterprise Reading steps as typed protocol
202+
state. `/api/read-review` can synthesize, resynthesize, and accept
203+
Read-Needs; every Need embeds its `bitcode.read.request`, feedback lineage, and
204+
prior Need id when resynthesized. Route telemetry exposes the
205+
ReadNeedComprehensionSynthesis contract trace across phases, PTRR agents,
206+
PTRR steps, and ThricifiedGeneration identifiers. Terminal cannot request
207+
Finding Fits from this path until an accepted `bitcode.read.need` is present.
208+
201209
## Later Version Handoff
202210

203211
- V29: deeper Terminal workflows and transaction operation beyond V28 MVP QA.

BITCODE_SPEC_V28_NOTES.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,26 @@ distance. Gate 9 records the vector document as ready for embedding generation;
570570
later Finding Fits and live validation gates own provider execution, ranking,
571571
settlement, and protected-source disclosure boundaries.
572572

573+
## Gate 10 Read-Need comprehension closure notes
574+
575+
Gate 10 closes the first two enterprise Reading UX steps. The raw request is
576+
stored as `bitcode.read.request` and embedded in the synthesized
577+
`bitcode.read.need`. This keeps request capture auditable without allowing a
578+
raw request to drive depository discovery.
579+
580+
ReadNeedComprehensionSynthesis route telemetry now carries a contract trace for
581+
all request, comprehend, measure, and review phase PTRR agents, their four PTRR
582+
steps, and the three ThricifiedGeneration identifiers under each step. The
583+
route-level telemetry also includes prompt template, interpolated context, raw
584+
structured response posture, parsed typed output, measurement root, review
585+
state, and resynthesis lineage.
586+
587+
Resynthesis appends operator feedback and records the previous Need id. Need
588+
acceptance computes an acceptance root and returns Finding Fits admission
589+
evidence. Terminal uses that accepted Need as the only live harness input for
590+
Finding Fits while keeping the previous measured-Read history path visible for
591+
readback compatibility.
592+
573593
## Non-Goals For V28
574594

575595
- V28 does not implement or QA Exchange product behavior, broad order-book depth, external market routing, wrapper liquidity, or third-party marketplace integration.

0 commit comments

Comments
 (0)